spexcode 0.4.1 → 0.4.3

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.
Files changed (106) hide show
  1. package/README.md +37 -17
  2. package/package.json +9 -5
  3. package/spec-cli/README.md +23 -14
  4. package/spec-cli/hooks/dispatch.sh +7 -5
  5. package/spec-cli/hooks/harness.sh +19 -8
  6. package/spec-cli/src/anchors.ts +110 -18
  7. package/spec-cli/src/cli.ts +88 -37
  8. package/spec-cli/src/client.ts +34 -11
  9. package/spec-cli/src/doctor.ts +174 -36
  10. package/spec-cli/src/gateway-auth.ts +194 -0
  11. package/spec-cli/src/gateway-hub.ts +360 -0
  12. package/spec-cli/src/gateway.ts +27 -19
  13. package/spec-cli/src/git.ts +12 -5
  14. package/spec-cli/src/graph.ts +54 -43
  15. package/spec-cli/src/graphStream.ts +265 -34
  16. package/spec-cli/src/guide.ts +105 -55
  17. package/spec-cli/src/harness-select.ts +20 -6
  18. package/spec-cli/src/harness.ts +181 -33
  19. package/spec-cli/src/help.ts +64 -27
  20. package/spec-cli/src/host.ts +610 -0
  21. package/spec-cli/src/identity-presets.d.ts +13 -0
  22. package/spec-cli/src/identity-presets.js +128 -0
  23. package/spec-cli/src/index.ts +145 -86
  24. package/spec-cli/src/init.ts +53 -25
  25. package/spec-cli/src/layout.ts +5 -5
  26. package/spec-cli/src/lint.ts +25 -121
  27. package/spec-cli/src/login-page.ts +12 -5
  28. package/spec-cli/src/materialize.ts +39 -13
  29. package/spec-cli/src/mentions.ts +16 -11
  30. package/spec-cli/src/opencode.ts +145 -0
  31. package/spec-cli/src/pi-harness.ts +124 -0
  32. package/spec-cli/src/project-identity.ts +73 -0
  33. package/spec-cli/src/pty-bridge.ts +321 -521
  34. package/spec-cli/src/pty-helper.mjs +86 -0
  35. package/spec-cli/src/reaper.ts +16 -8
  36. package/spec-cli/src/reviewSnapshot.ts +23 -0
  37. package/spec-cli/src/reviews.ts +347 -0
  38. package/spec-cli/src/session-timeline.ts +14 -0
  39. package/spec-cli/src/sessions.ts +188 -66
  40. package/spec-cli/src/shim-runtime.ts +169 -0
  41. package/spec-cli/src/slash-commands.ts +76 -0
  42. package/spec-cli/src/source-files.ts +79 -0
  43. package/spec-cli/src/specs.ts +12 -7
  44. package/spec-cli/src/supervise.ts +37 -15
  45. package/spec-cli/src/tree.ts +8 -8
  46. package/spec-cli/src/uninstall.ts +56 -23
  47. package/spec-cli/templates/hooks/prepare-commit-msg +32 -18
  48. package/spec-cli/templates/spec/project/.plugins/commands/extract/spec.md +24 -18
  49. package/spec-cli/templates/spec/project/.plugins/commands/regroup/spec.md +3 -3
  50. package/spec-cli/templates/spec/project/.plugins/commands/rename/spec.md +11 -0
  51. package/spec-cli/templates/spec/project/.plugins/commands/spec.md +22 -8
  52. package/spec-cli/templates/spec/project/.plugins/commands/supervisor/spec.md +1 -1
  53. package/spec-cli/templates/spec/project/.plugins/commands/tidy/spec.md +29 -11
  54. package/spec-cli/templates/spec/project/.plugins/core/idle/spec.md +1 -1
  55. package/spec-cli/templates/spec/project/.plugins/core/mark-active/spec.md +2 -0
  56. package/spec-cli/templates/spec/project/.plugins/core/session-fail/spec.md +1 -1
  57. package/spec-cli/templates/spec/project/.plugins/core/spec-first/spec-first.sh +28 -39
  58. package/spec-cli/templates/spec/project/.plugins/core/spec-first/spec.md +5 -3
  59. package/spec-cli/templates/spec/project/.plugins/core/spec-of-file/spec.md +1 -1
  60. package/spec-cli/templates/spec/project/.plugins/core/spec.md +2 -2
  61. package/spec-cli/templates/spec/project/.plugins/core/stop-gate/spec.md +7 -1
  62. package/spec-cli/templates/spec/project/.plugins/prompts/forge-link/spec.md +2 -2
  63. package/spec-cli/templates/spec/project/.plugins/prompts/reproduce-before-fix/spec.md +5 -5
  64. package/spec-cli/templates/spec/project/.plugins/prompts/spec.md +10 -6
  65. package/spec-cli/templates/spec/project/.plugins/skills/distill/spec.md +38 -50
  66. package/spec-cli/templates/spec/project/.plugins/skills/spec.md +9 -7
  67. package/spec-cli/templates/spec/project/.plugins/spec.md +17 -12
  68. package/spec-cli/templates/spec/project/spec.md +6 -5
  69. package/spec-cli/templates/spexcode.json +4 -2
  70. package/spec-dashboard/dist/assets/Dashboard-CiHh-gLD.js +27 -0
  71. package/spec-dashboard/dist/assets/EvalsPage-DmiX3rdU.js +2 -0
  72. package/spec-dashboard/dist/assets/IssuesPage-CIbVGRUJ.js +1 -0
  73. package/spec-dashboard/dist/assets/MobileApp-D-N9_eh0.js +2 -0
  74. package/spec-dashboard/dist/assets/Modal-DHMzSFJ4.js +1 -0
  75. package/spec-dashboard/dist/assets/PageScroll-C15adEYI.js +1 -0
  76. package/spec-dashboard/dist/assets/ProjectsPage-sQpzglp5.js +1 -0
  77. package/spec-dashboard/dist/assets/SessionInterface-6GBZ9nXN.css +32 -0
  78. package/spec-dashboard/dist/assets/SessionInterface-B8pGU7Rg.js +39 -0
  79. package/spec-dashboard/dist/assets/SessionWindow-CuDO_67z.js +13 -0
  80. package/spec-dashboard/dist/assets/Settings-C_N1wX1f.js +1 -0
  81. package/spec-dashboard/dist/assets/bindings-BC9vqpYU.js +1 -0
  82. package/spec-dashboard/dist/assets/index-DmWbmvCq.js +41 -0
  83. package/spec-dashboard/dist/assets/index-GGIVdKwH.css +1 -0
  84. package/spec-dashboard/dist/assets/terminalFont-DmTPNdbU.js +1 -0
  85. package/spec-dashboard/dist/index.html +10 -10
  86. package/spec-dashboard/src/reviewFilters.js +279 -0
  87. package/spec-dashboard/src/reviewQuery.js +174 -0
  88. package/spec-dashboard/src/session.js +167 -0
  89. package/spec-eval/src/cli.ts +49 -28
  90. package/spec-eval/src/humanok.ts +1 -1
  91. package/spec-eval/src/matrix.ts +693 -0
  92. package/spec-eval/src/sessioneval.ts +726 -66
  93. package/spec-cli/src/migrate-table.ts +0 -408
  94. package/spec-cli/src/migrate.ts +0 -386
  95. package/spec-dashboard/dist/assets/Dashboard-C_fGmOKK.js +0 -27
  96. package/spec-dashboard/dist/assets/EvalsPage-Cnr1s3bq.js +0 -2
  97. package/spec-dashboard/dist/assets/FoldToggle-x9gtO1OQ.js +0 -1
  98. package/spec-dashboard/dist/assets/IssuesPage-5f_vL-JV.js +0 -1
  99. package/spec-dashboard/dist/assets/MobileApp-DEO1jgGM.js +0 -1
  100. package/spec-dashboard/dist/assets/SessionInterface-CAlbMOFR.js +0 -66
  101. package/spec-dashboard/dist/assets/SessionInterface-DYP7pi_n.css +0 -32
  102. package/spec-dashboard/dist/assets/SessionWindow-JYbpPwNB.js +0 -13
  103. package/spec-dashboard/dist/assets/Settings-DKb5Ji_X.js +0 -1
  104. package/spec-dashboard/dist/assets/index-BQu-oJ8J.js +0 -41
  105. package/spec-dashboard/dist/assets/index-BbMkwuix.css +0 -1
  106. package/spec-dashboard/dist/assets/launch-BM9GgvkX.js +0 -6
@@ -1,66 +0,0 @@
1
- import{r as K,j as F,u as qe,e as Ze}from"./index-BQu-oJ8J.js";import{C as $t,O as Wt,s as dt,d as Ut,D as jt,n as Fe,m as zt,F as qt,y as Kt,z as Gt,J as ut,R as Vt,B as Xt,l as Yt,K as Jt,M as Zt,P as Qt,Q as ei,U as _t,V as ti}from"./SessionWindow-JYbpPwNB.js";import{u as ii,a as si,b as ri,c as ni}from"./launch-BM9GgvkX.js";import{u as ze,M as Qe,a as oi}from"./Dashboard-C_fGmOKK.js";import{E as ai,a as hi}from"./EvalsPage-Cnr1s3bq.js";import{F as li}from"./FoldToggle-x9gtO1OQ.js";var St={exports:{}};(function(U,ie){(function(te,V){U.exports=V()})(globalThis,()=>(()=>{var te={4567:function(O,t,a){var h=this&&this.__decorate||function(i,r,u,f){var c,m=arguments.length,d=m<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,u):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,f);else for(var p=i.length-1;p>=0;p--)(c=i[p])&&(d=(m<3?c(d):m>3?c(r,u,d):c(r,u))||d);return m>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,f){r(u,f,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=a(9042),_=a(9924),g=a(844),v=a(4725),o=a(2585),e=a(3656);let s=t.AccessibilityManager=class extends g.Disposable{constructor(i,r,u,f){super(),this._terminal=i,this._coreBrowserService=u,this._renderService=f,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 c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,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(c=>this._handleResize(c.rows))),this.register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(c=>this._handleChar(c))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
- `))),this.register(this._terminal.onA11yTab(c=>this._handleTab(c))),this.register(this._terminal.onKey(c=>this._handleKey(c.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(i){for(let r=0;r<i;r++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
3
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,r){this._liveRegionDebouncer.refresh(i,r,this._terminal.rows)}_renderRows(i,r){const u=this._terminal.buffer,f=u.lines.length.toString();for(let c=i;c<=r;c++){const m=u.lines.get(u.ydisp+c),d=[],p=(m==null?void 0:m.translateToString(!0,void 0,void 0,d))||"",S=(u.ydisp+c+1).toString(),y=this._rowElements[c];y&&(p.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=p,this._rowColumns.set(y,d)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,r){const u=i.target,f=this._rowElements[r===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==f)return;let c,m;if(r===0?(c=u,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(c=this._rowElements.shift(),m=u,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{const d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var p;if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:i.anchorNode,offset:i.anchorOffset},u={node:i.focusNode,offset:i.focusOffset};if((r.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===u.node&&r.offset>u.offset)&&([r,u]=[u,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 f=this._rowElements.slice(-1)[0];if(u.node.compareDocumentPosition(f)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:f,offset:((p=f.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(u.node))return;const c=({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=c(r),d=c(u);if(m&&d){if(m.row>d.row||m.row===d.row&&m.column>=d.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(d.row-m.row)*this._terminal.cols-m.column+d.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=s=h([l(1,o.IInstantiationService),l(2,v.ICoreBrowserService),l(3,v.IRenderService)],s)},3614:(O,t)=>{function a(_){return _.replace(/\r?\n/g,"\r")}function h(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function l(_,g,v,o){_=h(_=a(_),v.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(_,!0),g.value=""}function n(_,g,v){const o=v.getBoundingClientRect(),e=_.clientX-o.left-10,s=_.clientY-o.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${e}px`,g.style.top=`${s}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=h,t.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},t.handlePasteEvent=function(_,g,v,o){_.stopPropagation(),_.clipboardData&&l(_.clipboardData.getData("text/plain"),g,v,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(_,g,v,o,e){n(_,g,v),e&&o.rightClickSelect(_),g.value=o.selectionText,g.select()}},7239:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,n,_){this._css.set(l,n,_)}getCss(l,n){return this._css.get(l,n)}setColor(l,n,_){this._color.set(l,n,_)}getColor(l,n){return this._color.get(l,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,h,l,n){a.addEventListener(h,l,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(h,l,n))}}}},3551:function(O,t,a){var h=this&&this.__decorate||function(s,i,r,u){var f,c=arguments.length,m=c<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,r):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,i,r,u);else for(var d=s.length-1;d>=0;d--)(f=s[d])&&(m=(c<3?f(m):c>3?f(i,r,m):f(i,r))||m);return c>3&&m&&Object.defineProperty(i,r,m),m},l=this&&this.__param||function(s,i){return function(r,u){i(r,u,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),_=a(8460),g=a(844),v=a(2585),o=a(4725);let e=t.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(s,i,r,u,f){super(),this._element=s,this._mouseService=i,this._renderService=r,this._bufferService=u,this._linkProviderService=f,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 c;this._lastMouseEvent=void 0,(c=this._activeProviderReplies)==null||c.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(s){this._lastMouseEvent=s;const i=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const r=s.composedPath();for(let u=0;u<r.length;u++){const f=r[u];if(f.classList.contains("xterm"))break;if(f.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,i){var u,f;this._activeProviderReplies&&i||((u=this._activeProviderReplies)==null||u.forEach(c=>{c==null||c.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=s.y);let r=!1;for(const[c,m]of this._linkProviderService.linkProviders.entries())i?(f=this._activeProviderReplies)!=null&&f.get(c)&&(r=this._checkLinkProviderResult(c,s,r)):m.provideLinks(s.y,d=>{var S,y;if(this._isMouseOut)return;const p=d==null?void 0:d.map(b=>({link:b}));(S=this._activeProviderReplies)==null||S.set(c,p),r=this._checkLinkProviderResult(c,s,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)})}_removeIntersectingLinks(s,i){const r=new Set;for(let u=0;u<i.size;u++){const f=i.get(u);if(f)for(let c=0;c<f.length;c++){const m=f[c],d=m.link.range.start.y<s?0:m.link.range.start.x,p=m.link.range.end.y>s?this._bufferService.cols:m.link.range.end.x;for(let S=d;S<=p;S++){if(r.has(S)){f.splice(c--,1);break}r.add(S)}}}}_checkLinkProviderResult(s,i,r){var c;if(!this._activeProviderReplies)return r;const u=this._activeProviderReplies.get(s);let f=!1;for(let m=0;m<s;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(f=!0);if(!f&&u){const m=u.find(d=>this._linkAtPosition(d.link,i));m&&(r=!0,this._handleNewLink(m))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let m=0;m<this._activeProviderReplies.size;m++){const d=(c=this._activeProviderReplies.get(m))==null?void 0:c.find(p=>this._linkAtPosition(p.link,i));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._currentLink)return;const i=this._positionFromMouseEvent(s,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,i){this._currentLink&&this._lastMouseEvent&&(!s||!i||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(s.link,i)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>{var r,u;return(u=(r=this._currentLink)==null?void 0:r.state)==null?void 0:u.decorations.pointerCursor},set:r=>{var u;(u=this._currentLink)!=null&&u.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,u;return(u=(r=this._currentLink)==null?void 0:r.state)==null?void 0:u.decorations.underline},set:r=>{var u,f,c;(u=this._currentLink)!=null&&u.state&&((c=(f=this._currentLink)==null?void 0:f.state)==null?void 0:c.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;const u=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=f&&(this._clearCurrentLink(u,f),this._lastMouseEvent)){const c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(s,i,r){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(r,i.text)}_fireUnderlineEvent(s,i){const r=s.range,u=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-u-1,r.end.x,r.end.y-u-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(s,i,r){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(r,i.text)}_linkAtPosition(s,i){const r=s.range.start.y*this._bufferService.cols+s.range.start.x,u=s.range.end.y*this._bufferService.cols+s.range.end.x,f=i.y*this._bufferService.cols+i.x;return r<=f&&f<=u}_positionFromMouseEvent(s,i,r){const u=r.getCoords(s,i,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,i,r,u,f){return{x1:s,y1:i,x2:r,y2:u,cols:this._bufferService.cols,fg:f}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,v.IBufferService),l(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 h=this&&this.__decorate||function(o,e,s,i){var r,u=arguments.length,f=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,i);else for(var c=o.length-1;c>=0;c--)(r=o[c])&&(f=(u<3?r(f):u>3?r(e,s,f):r(e,s))||f);return u>3&&f&&Object.defineProperty(e,s,f),f},l=this&&this.__param||function(o,e){return function(s,i){e(s,i,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,s){this._bufferService=o,this._optionsService=e,this._oscLinkService=s}provideLinks(o,e){var p;const s=this._bufferService.buffer.lines.get(o-1);if(!s)return void e(void 0);const i=[],r=this._optionsService.rawOptions.linkHandler,u=new n.CellData,f=s.getTrimmedLength();let c=-1,m=-1,d=!1;for(let S=0;S<f;S++)if(m!==-1||s.hasContent(S)){if(s.loadCell(S,u),u.hasExtendedAttrs()&&u.extended.urlId){if(m===-1){m=S,c=u.extended.urlId;continue}d=u.extended.urlId!==c}else m!==-1&&(d=!0);if(d||m!==-1&&S===f-1){const y=(p=this._oscLinkService.getLinkData(c))==null?void 0:p.uri;if(y){const b={start:{x:m+1,y:o},end:{x:S+(d||S!==f-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||i.push({text:y,range:b,activate:(L,B)=>r?r.activate(L,B,b):v(0,B),hover:(L,B)=>{var P;return(P=r==null?void 0:r.hover)==null?void 0:P.call(r,L,B,b)},leave:(L,B)=>{var P;return(P=r==null?void 0:r.leave)==null?void 0:P.call(r,L,B,b)}})}d=!1,u.hasExtendedAttrs()&&u.extended.urlId?(m=S,c=u.extended.urlId):(m=-1,c=-1)}}e(i)}};function v(o,e){if(confirm(`Do you want to navigate to ${e}?
4
-
5
- WARNING: This link could potentially be dangerous`)){const s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=g=h([l(0,_.IBufferService),l(1,_.IOptionsService),l(2,_.IOscLinkService)],g)},6193:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),n=a(3551),_=a(9042),g=a(3730),v=a(1680),o=a(3107),e=a(5744),s=a(2950),i=a(1296),r=a(428),u=a(4269),f=a(5114),c=a(8934),m=a(3230),d=a(9312),p=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),L=a(844),B=a(6114),P=a(8437),T=a(2584),A=a(7399),C=a(5941),E=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(k={}){super(k),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(E.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((x,$)=>this.refresh(x,$))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(x=>this._reportWindowsOptions(x))),this.register(this._inputHandler.onColor(x=>this._handleColorEvent(x))),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(x=>this._afterResize(x.cols,x.rows))),this.register((0,L.toDisposable)(()=>{var x,$;this._customKeyEventHandler=void 0,($=(x=this.element)==null?void 0:x.parentNode)==null||$.removeChild(this.element)}))}_handleColorEvent(k){if(this._themeService)for(const x of k){let $,H="";switch(x.index){case 256:$="foreground",H="10";break;case 257:$="background",H="11";break;case 258:$="cursor",H="12";break;default:$="ansi",H="4;"+x.index}switch(x.type){case 0:const G=y.color.toColorRGB($==="ansi"?this._themeService.colors.ansi[x.index]:this._themeService.colors[$]);this.coreService.triggerDataEvent(`${T.C0.ESC}]${H};${(0,C.toRgbString)(G)}${T.C1_ESCAPED.ST}`);break;case 1:if($==="ansi")this._themeService.modifyColors(j=>j.ansi[x.index]=y.channels.toColor(...x.color));else{const j=$;this._themeService.modifyColors(re=>re[j]=y.channels.toColor(...x.color))}break;case 2:this._themeService.restoreColor(x.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(k){k?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(k){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(T.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var k;return(k=this.textarea)==null?void 0:k.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(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 k=this.buffer.ybase+this.buffer.y,x=this.buffer.lines.get(k);if(!x)return;const $=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,G=x.getWidth($),j=this._renderService.dimensions.css.cell.width*G,re=this.buffer.y*this._renderService.dimensions.css.cell.height,ee=$*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ee+"px",this.textarea.style.top=re+"px",this.textarea.style.width=j+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",x=>{this.hasSelection()&&(0,h.copyHandler)(x,this._selectionService)}));const k=x=>(0,h.handlePasteEvent)(x,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",k)),this.register((0,l.addDisposableDomListener)(this.element,"paste",k)),B.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",x=>{x.button===2&&(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",x=>{(0,h.rightClickHandler)(x,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),B.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",x=>{x.button===1&&(0,h.moveTextAreaUnderMouseCursor)(x,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",k=>this._keyUp(k),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",k=>this._keyDown(k),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",k=>this._keyPress(k),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",k=>this._compositionHelper.compositionupdate(k))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,l.addDisposableDomListener)(this.textarea,"input",k=>this._inputEvent(k),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(k){var $;if(!k)throw new Error("Terminal requires a parent element.");if(k.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),(($=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=k.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),k.appendChild(this.element);const x=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),x.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),x.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(f.CoreBrowserService,this.textarea,k.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(p.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(r.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(p.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(p.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(u.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(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(c.MouseService),this._instantiationService.setService(p.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(x);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(v.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(d.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,l.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",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(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const k=this,x=this.element;function $(j){const re=k._mouseService.getMouseReportCoords(j,k.screenElement);if(!re)return!1;let ee,ce;switch(j.overrideType||j.type){case"mousemove":ce=32,j.buttons===void 0?(ee=3,j.button!==void 0&&(ee=j.button<3?j.button:3)):ee=1&j.buttons?0:4&j.buttons?1:2&j.buttons?2:3;break;case"mouseup":ce=0,ee=j.button<3?j.button:3;break;case"mousedown":ce=1,ee=j.button<3?j.button:3;break;case"wheel":if(k._customWheelEventHandler&&k._customWheelEventHandler(j)===!1||k.viewport.getLinesScrolled(j)===0)return!1;ce=j.deltaY<0?0:1,ee=4;break;default:return!1}return!(ce===void 0||ee===void 0||ee>4)&&k.coreMouseService.triggerMouseEvent({col:re.col,row:re.row,x:re.x,y:re.y,button:ee,action:ce,ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},G={mouseup:j=>($(j),j.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(j)),wheel:j=>($(j),this.cancel(j,!0)),mousedrag:j=>{j.buttons&&$(j)},mousemove:j=>{j.buttons||$(j)}};this.register(this.coreMouseService.onProtocolChange(j=>{j?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(j)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&j?H.mousemove||(x.addEventListener("mousemove",G.mousemove),H.mousemove=G.mousemove):(x.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&j?H.wheel||(x.addEventListener("wheel",G.wheel,{passive:!1}),H.wheel=G.wheel):(x.removeEventListener("wheel",H.wheel),H.wheel=null),2&j?H.mouseup||(H.mouseup=G.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&j?H.mousedrag||(H.mousedrag=G.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(x,"mousedown",j=>{if(j.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(j))return $(j),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(j)})),this.register((0,l.addDisposableDomListener)(x,"wheel",j=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(j)===!1)return!1;if(!this.buffer.hasScrollback){const re=this.viewport.getLinesScrolled(j);if(re===0)return;const ee=T.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(j.deltaY<0?"A":"B");let ce="";for(let pe=0;pe<Math.abs(re);pe++)ce+=ee;return this.coreService.triggerDataEvent(ce,!0),this.cancel(j,!0)}return this.viewport.handleWheel(j)?this.cancel(j):void 0}},{passive:!1})),this.register((0,l.addDisposableDomListener)(x,"touchstart",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(j),this.cancel(j)},{passive:!0})),this.register((0,l.addDisposableDomListener)(x,"touchmove",j=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(j)?void 0:this.cancel(j)},{passive:!1}))}refresh(k,x){var $;($=this._renderService)==null||$.refreshRows(k,x)}updateCursorStyle(k){var x;(x=this._selectionService)!=null&&x.shouldColumnSelect(k)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(k,x,$=0){var H;$===1?(super.scrollLines(k,x,$),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(k)}paste(k){(0,h.paste)(k,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(k){this._customKeyEventHandler=k}attachCustomWheelEventHandler(k){this._customWheelEventHandler=k}registerLinkProvider(k){return this._linkProviderService.registerLinkProvider(k)}registerCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const x=this._characterJoinerService.register(k);return this.refresh(0,this.rows-1),x}deregisterCharacterJoiner(k){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(k)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(k){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+k)}registerDecoration(k){return this._decorationService.registerDecoration(k)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(k,x,$){this._selectionService.setSelection(k,x,$)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var k;(k=this._selectionService)==null||k.clearSelection()}selectAll(){var k;(k=this._selectionService)==null||k.selectAll()}selectLines(k,x){var $;($=this._selectionService)==null||$.selectLines(k,x)}_keyDown(k){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;const x=this.browser.isMac&&this.options.macOptionIsMeta&&k.altKey;if(!x&&!this._compositionHelper.keydown(k))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;x||k.key!=="Dead"&&k.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const $=(0,A.evaluateKeyboardEvent)(k,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(k),$.type===3||$.type===2){const H=this.rows-1;return this.scrollLines($.type===2?-H:H),this.cancel(k,!0)}return $.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,k)||($.cancel&&this.cancel(k,!0),!$.key||!!(k.key&&!k.ctrlKey&&!k.altKey&&!k.metaKey&&k.key.length===1&&k.key.charCodeAt(0)>=65&&k.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):($.key!==T.C0.ETX&&$.key!==T.C0.CR||(this.textarea.value=""),this._onKey.fire({key:$.key,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent($.key,!0),!this.optionsService.rawOptions.screenReaderMode||k.altKey||k.ctrlKey?this.cancel(k,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(k,x){const $=k.isMac&&!this.options.macOptionIsMeta&&x.altKey&&!x.ctrlKey&&!x.metaKey||k.isWindows&&x.altKey&&x.ctrlKey&&!x.metaKey||k.isWindows&&x.getModifierState("AltGraph");return x.type==="keypress"?$:$&&(!x.keyCode||x.keyCode>47)}_keyUp(k){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1||(function(x){return x.keyCode===16||x.keyCode===17||x.keyCode===18}(k)||this.focus(),this.updateCursorStyle(k),this._keyPressHandled=!1)}_keyPress(k){let x;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(k)===!1)return!1;if(this.cancel(k),k.charCode)x=k.charCode;else if(k.which===null||k.which===void 0)x=k.keyCode;else{if(k.which===0||k.charCode===0)return!1;x=k.which}return!(!x||(k.altKey||k.ctrlKey||k.metaKey)&&!this._isThirdLevelShift(this.browser,k)||(x=String.fromCharCode(x),this._onKey.fire({key:x,domEvent:k}),this._showCursor(),this.coreService.triggerDataEvent(x,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(k){if(k.data&&k.inputType==="insertText"&&(!k.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const x=k.data;return this.coreService.triggerDataEvent(x,!0),this.cancel(k),!0}return!1}resize(k,x){k!==this.cols||x!==this.rows?super.resize(k,x):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(k,x){var $,H;($=this._charSizeService)==null||$.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var k;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let x=1;x<this.rows;x++)this.buffer.lines.push(this.buffer.getBlankLine(P.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(k=this.viewport)==null||k.reset(),this.refresh(0,this.rows-1)}}reset(){var x,$;this.options.rows=this.rows,this.options.cols=this.cols;const k=this._customKeyEventHandler;this._setup(),super.reset(),(x=this._selectionService)==null||x.reset(),this._decorationService.reset(),($=this.viewport)==null||$.reset(),this._customKeyEventHandler=k,this.refresh(0,this.rows-1)}clearTextureAtlas(){var k;(k=this._renderService)==null||k.clearTextureAtlas()}_reportFocus(){var k;(k=this.element)!=null&&k.classList.contains("focus")?this.coreService.triggerDataEvent(T.C0.ESC+"[I"):this.coreService.triggerDataEvent(T.C0.ESC+"[O")}_reportWindowsOptions(k){if(this._renderService)switch(k){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const x=this._renderService.dimensions.css.canvas.width.toFixed(0),$=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[4;${$};${x}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),G=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${T.C0.ESC}[6;${G};${H}t`)}}cancel(k,x){if(this.options.cancelEvents||x)return k.preventDefault(),k.stopPropagation(),!1}}t.Terminal=X},9924:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=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),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(O,t,a){var h=this&&this.__decorate||function(s,i,r,u){var f,c=arguments.length,m=c<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,r):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,i,r,u);else for(var d=s.length-1;d>=0;d--)(f=s[d])&&(m=(c<3?f(m):c>3?f(i,r,m):f(i,r))||m);return c>3&&m&&Object.defineProperty(i,r,m),m},l=this&&this.__param||function(s,i){return function(r,u){i(r,u,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const n=a(3656),_=a(4725),g=a(8460),v=a(844),o=a(2585);let e=t.Viewport=class extends v.Disposable{constructor(s,i,r,u,f,c,m,d){super(),this._viewportElement=s,this._scrollArea=i,this._bufferService=r,this._optionsService=u,this._charSizeService=f,this._renderService=c,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(d.colors),this.register(d.onChangeColors(p=>this._handleThemeChange(p))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(s){this._viewportElement.style.backgroundColor=s.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(s){if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const s=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==s&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=s),this._refreshAnimationFrame=null}syncScrollArea(s=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(s)}_handleScroll(s){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const s=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(s*(this._smoothScrollState.target-this._smoothScrollState.origin)),s<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(s,i){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&r<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)}handleWheel(s){const i=this._getPixelsScrolled(s);return i!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(s,i))}scrollLines(s){if(s!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=s*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:s,suppressScrollEvent:!1})}_getPixelsScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let i=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(s,i){var d;let r,u="";const f=[],c=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let p=s;p<c;p++){const S=m.get(p);if(!S)continue;const y=(d=m.get(p+1))==null?void 0:d.isWrapped;if(u+=S.translateToString(!y),!y||p===m.length-1){const b=document.createElement("div");b.textContent=u,f.push(b),u.length>0&&(r=b),u=""}}return{bufferElements:f,cursorElement:r}}getLinesScrolled(s){if(s.deltaY===0||s.shiftKey)return 0;let i=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(s,i){const r=this._optionsService.rawOptions.fastScrollModifier;return r==="alt"&&i.altKey||r==="ctrl"&&i.ctrlKey||r==="shift"&&i.shiftKey?s*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:s*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(s){this._lastTouchY=s.touches[0].pageY}handleTouchMove(s){const i=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(s,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,_.ICharSizeService),l(5,_.IRenderService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],e)},3107:function(O,t,a){var h=this&&this.__decorate||function(o,e,s,i){var r,u=arguments.length,f=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,i);else for(var c=o.length-1;c>=0;c--)(r=o[c])&&(f=(u<3?r(f):u>3?r(e,s,f):r(e,s))||f);return u>3&&f&&Object.defineProperty(e,s,f),f},l=this&&this.__param||function(o,e){return function(s,i){e(s,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const n=a(4725),_=a(844),g=a(2585);let v=t.BufferDecorationRenderer=class extends _.Disposable{constructor(o,e,s,i,r){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=s,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(u=>this._removeDecoration(u))),this.register((0,_.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){var i;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((i=o==null?void 0:o.options)==null?void 0:i.layer)==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const s=o.options.x??0;return s&&s>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 s=this._decorationElements.get(o);s||(s=this._createElement(o),o.element=s,this._decorationElements.set(o,s),this._container.appendChild(s),o.onDispose(()=>{this._decorationElements.delete(o),s.remove()})),s.style.top=e*this._renderService.dimensions.css.cell.height+"px",s.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(s)}}_refreshXPosition(o,e=o.element){if(!e)return;const s=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=s?s*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=s?s*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=v=h([l(1,g.IBufferService),l(2,n.ICoreBrowserService),l(3,g.IDecorationService),l(4,n.IRenderService)],v)},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 h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(O,t,a){var h=this&&this.__decorate||function(r,u,f,c){var m,d=arguments.length,p=d<3?u:c===null?c=Object.getOwnPropertyDescriptor(u,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,u,f,c);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(d<3?m(p):d>3?m(u,f,p):m(u,f))||p);return d>3&&p&&Object.defineProperty(u,f,p),p},l=this&&this.__param||function(r,u){return function(f,c){u(f,c,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const n=a(5871),_=a(4725),g=a(844),v=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends g.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(r,u,f,c,m,d,p){var y;super(),this._viewportElement=r,this._screenElement=u,this._bufferService=f,this._decorationService=c,this._renderService=m,this._optionsService=d,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),u=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=r,e.center=u,e.right=r,this._refreshDrawHeightConstants(),s.full=0,s.left=0,s.center=e.left,s.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const r=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(r,12),6)*this._coreBrowserService.dpr);o.left=u,o.center=u,o.right=u}_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 u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const r=this._colorZoneStore.zones;for(const u of r)u.position!=="full"&&this._renderColorZone(u);for(const u of r)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(r){this._ctx.fillStyle=r.color,this._ctx.fillRect(s[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,u){this._shouldUpdateDimensions=r||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=i=h([l(2,v.IBufferService),l(3,v.IDecorationService),l(4,_.IRenderService),l(5,v.IOptionsService),l(6,_.ICoreBrowserService)],i)},2950:function(O,t,a){var h=this&&this.__decorate||function(o,e,s,i){var r,u=arguments.length,f=u<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(o,e,s,i);else for(var c=o.length-1;c>=0;c--)(r=o[c])&&(f=(u<3?r(f):u>3?r(e,s,f):r(e,s))||f);return u>3&&f&&Object.defineProperty(e,s,f),f},l=this&&this.__param||function(o,e){return function(s,i){e(s,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const n=a(4725),_=a(2585),g=a(2584);let v=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,s,i,r,u){this._textarea=o,this._compositionView=e,this._bufferService=s,this._optionsService=i,this._coreService=r,this._renderService=u,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(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 s;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,s=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=e.replace(o,"");this._dataAlreadySent=s,e.length>o.length?this._coreService.triggerDataEvent(s,!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),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const u=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(u.width,1)+"px",this._textarea.style.height=Math.max(u.height,1)+"px",this._textarea.style.lineHeight=u.height+"px"}o||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=v=h([l(2,_.IBufferService),l(3,_.IOptionsService),l(4,_.ICoreService),l(5,n.IRenderService)],v)},9806:(O,t)=>{function a(h,l,n){const _=n.getBoundingClientRect(),g=h.getComputedStyle(n),v=parseInt(g.getPropertyValue("padding-left")),o=parseInt(g.getPropertyValue("padding-top"));return[l.clientX-_.left-v,l.clientY-_.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,n,_,g,v,o,e,s){if(!v)return;const i=a(h,l,n);return i?(i[0]=Math.ceil((i[0]+(s?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),_+(s?1:0)),i[1]=Math.min(Math.max(i[1],1),g),i):void 0}},9504:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,s,i,r){const u=e-n(e,i),f=s-n(s,i),c=Math.abs(u-f)-function(m,d,p){let S=0;const y=m-n(m,p),b=d-n(d,p);for(let w=0;w<Math.abs(y-b);w++){const L=_(m,d)==="A"?-1:1,B=p.buffer.lines.get(y+L*w);B!=null&&B.isWrapped&&S++}return S}(e,s,i);return o(c,v(_(e,s),r))}function n(e,s){let i=0,r=s.buffer.lines.get(e),u=r==null?void 0:r.isWrapped;for(;u&&e>=0&&e<s.rows;)i++,r=s.buffer.lines.get(--e),u=r==null?void 0:r.isWrapped;return i}function _(e,s){return e>s?"A":"B"}function g(e,s,i,r,u,f){let c=e,m=s,d="";for(;c!==i||m!==r;)c+=u?1:-1,u&&c>f.cols-1?(d+=f.buffer.translateBufferLineToString(m,!1,e,c),c=0,e=0,m++):!u&&c<0&&(d+=f.buffer.translateBufferLineToString(m,!1,0,e+1),c=f.cols-1,e=c,m--);return d+f.buffer.translateBufferLineToString(m,!1,e,c)}function v(e,s){const i=s?"O":"[";return h.C0.ESC+i+e}function o(e,s){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=s;return i}t.moveToCellSequence=function(e,s,i,r){const u=i.buffer.x,f=i.buffer.y;if(!i.buffer.hasScrollback)return function(d,p,S,y,b,w){return l(p,y,b,w).length===0?"":o(g(d,p,d,p-n(p,b),!1,b).length,v("D",w))}(u,f,0,s,i,r)+l(f,s,i,r)+function(d,p,S,y,b,w){let L;L=l(p,y,b,w).length>0?y-n(y,b):p;const B=y,P=function(T,A,C,E,R,D){let N;return N=l(C,E,R,D).length>0?E-n(E,R):A,T<C&&N<=E||T>=C&&N<E?"C":"D"}(d,p,S,y,b,w);return o(g(d,L,S,B,P==="C",b).length,v(P,w))}(u,f,e,s,i,r);let c;if(f===s)return c=u>e?"D":"C",o(Math.abs(u-e),v(c,r));c=f>s?"D":"C";const m=Math.abs(f-s);return o(function(d,p){return p.cols-d}(f>s?e:u,i)+(m-1)*i.cols+1+((f>s?u:e)-1),v(c,r))}},1296:function(O,t,a){var h=this&&this.__decorate||function(w,L,B,P){var T,A=arguments.length,C=A<3?L:P===null?P=Object.getOwnPropertyDescriptor(L,B):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,L,B,P);else for(var E=w.length-1;E>=0;E--)(T=w[E])&&(C=(A<3?T(C):A>3?T(L,B,C):T(L,B))||C);return A>3&&C&&Object.defineProperty(L,B,C),C},l=this&&this.__param||function(w,L){return function(B,P){L(B,P,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const n=a(3787),_=a(2550),g=a(2223),v=a(6171),o=a(6052),e=a(4725),s=a(8055),i=a(8460),r=a(844),u=a(2585),f="xterm-dom-renderer-owner-",c="xterm-rows",m="xterm-fg-",d="xterm-bg-",p="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends r.Disposable{constructor(w,L,B,P,T,A,C,E,R,D,N,W,X){super(),this._terminal=w,this._document=L,this._element=B,this._screenElement=P,this._viewportElement=T,this._helperContainer=A,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 i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(c),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,v.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=E.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(f+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(f+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} .${c} 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} .${c} { 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} .${c} .xterm-dim { color: ${s.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}`,P=`blink_bar_${this._terminalClass}`,T=`blink_block_${this._terminalClass}`;L+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,L+=`@keyframes ${P} { 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} .${c}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${c}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${c}.${p} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${T} 1s step-end infinite;}${this._terminalSelector} .${c} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${c} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${c} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${c} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${c} .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[A,C]of w.ansi.entries())L+=`${this._terminalSelector} .${m}${A} { color: ${C.css}; }${this._terminalSelector} .${m}${A}.xterm-dim { color: ${s.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${d}${A} { background-color: ${C.css}; }`;L+=`${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${g.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${d}${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 P=this._document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}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 P=this._selectionRenderModel.viewportStartRow,T=this._selectionRenderModel.viewportEndRow,A=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(A>=this._bufferService.rows||C<0)return;const E=this._document.createDocumentFragment();if(B){const R=w[0]>L[0];E.appendChild(this._createSelectionElement(A,R?L[0]:w[0],R?w[0]:L[0],C-A+1))}else{const R=P===A?w[0]:0,D=A===T?L[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(A,R,D));const N=C-A-1;if(E.appendChild(this._createSelectionElement(A+1,0,this._bufferService.cols,N)),A!==C){const W=T===C?L[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(C,0,W))}}this._selectionContainer.appendChild(E)}_createSelectionElement(w,L,B,P=1){const T=this._document.createElement("div"),A=L*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(B-L);return A+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-A),T.style.height=P*this.dimensions.css.cell.height+"px",T.style.top=w*this.dimensions.css.cell.height+"px",T.style.left=`${A}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,P=B.ybase+B.y,T=Math.min(B.x,this._bufferService.cols-1),A=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,E=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===P,C,E,T,A,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${f}${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,P,T,A){B<0&&(w=0),P<0&&(L=0);const C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),P=Math.max(Math.min(P,C),0),T=Math.min(T,this._bufferService.cols);const E=this._bufferService.buffer,R=E.ybase+E.y,D=Math.min(E.x,T-1),N=this._optionsService.rawOptions.cursorBlink,W=this._optionsService.rawOptions.cursorStyle,X=this._optionsService.rawOptions.cursorInactiveStyle;for(let Y=B;Y<=P;++Y){const k=Y+E.ydisp,x=this._rowElements[Y],$=E.lines.get(k);if(!x||!$)break;x.replaceChildren(...this._rowFactory.createRow($,k,k===R,W,X,D,N,this.dimensions.css.cell.width,this._widthCache,A?Y===B?w:0:-1,A?(Y===P?L:T)-1:-1))}}};t.DomRenderer=b=h([l(7,u.IInstantiationService),l(8,e.ICharSizeService),l(9,u.IOptionsService),l(10,u.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],b)},3787:function(O,t,a){var h=this&&this.__decorate||function(c,m,d,p){var S,y=arguments.length,b=y<3?m:p===null?p=Object.getOwnPropertyDescriptor(m,d):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(c,m,d,p);else for(var w=c.length-1;w>=0;w--)(S=c[w])&&(b=(y<3?S(b):y>3?S(m,d,b):S(m,d))||b);return y>3&&b&&Object.defineProperty(m,d,b),b},l=this&&this.__param||function(c,m){return function(d,p){m(d,p,c)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const n=a(2223),_=a(643),g=a(511),v=a(2585),o=a(8055),e=a(4725),s=a(4269),i=a(6171),r=a(3734);let u=t.DomRendererRowFactory=class{constructor(c,m,d,p,S,y,b){this._document=c,this._characterJoinerService=m,this._optionsService=d,this._coreBrowserService=p,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new g.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(c,m,d){this._selectionStart=c,this._selectionEnd=m,this._columnSelectMode=d}createRow(c,m,d,p,S,y,b,w,L,B,P){const T=[],A=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let E,R=c.getNoBgTrimmedLength();d&&R<y+1&&(R=y+1);let D=0,N="",W=0,X=0,Y=0,k=!1,x=0,$=!1,H=0;const G=[],j=B!==-1&&P!==-1;for(let re=0;re<R;re++){c.loadCell(re,this._workCell);let ee=this._workCell.getWidth();if(ee===0)continue;let ce=!1,pe=re,Z=this._workCell;if(A.length>0&&re===A[0][0]){ce=!0;const he=A.shift();Z=new s.JoinedCellData(this._workCell,c.translateToString(!0,he[0],he[1]),he[1]-he[0]),pe=he[1]-1,ee=Z.getWidth()}const Se=this._isCellInSelection(re,m),Ae=d&&re===y,de=j&&re>=B&&re<=P;let oe=!1;this._decorationService.forEachDecorationAtCell(re,m,void 0,he=>{oe=!0});let ae=Z.getChars()||_.WHITESPACE_CELL_CHAR;if(ae===" "&&(Z.isUnderline()||Z.isOverline())&&(ae=" "),H=ee*w-L.get(ae,Z.isBold(),Z.isItalic()),E){if(D&&(Se&&$||!Se&&!$&&Z.bg===W)&&(Se&&$&&C.selectionForeground||Z.fg===X)&&Z.extended.ext===Y&&de===k&&H===x&&!Ae&&!ce&&!oe){Z.isInvisible()?N+=_.WHITESPACE_CELL_CHAR:N+=ae,D++;continue}D&&(E.textContent=N),E=this._document.createElement("span"),D=0,N=""}else E=this._document.createElement("span");if(W=Z.bg,X=Z.fg,Y=Z.extended.ext,k=de,x=H,$=Se,ce&&y>=re&&y<=pe&&(y=re),!this._coreService.isCursorHidden&&Ae&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&G.push("xterm-cursor-blink"),G.push(p==="bar"?"xterm-cursor-bar":p==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline")}}if(Z.isBold()&&G.push("xterm-bold"),Z.isItalic()&&G.push("xterm-italic"),Z.isDim()&&G.push("xterm-dim"),N=Z.isInvisible()?_.WHITESPACE_CELL_CHAR:Z.getChars()||_.WHITESPACE_CELL_CHAR,Z.isUnderline()&&(G.push(`xterm-underline-${Z.extended.underlineStyle}`),N===" "&&(N=" "),!Z.isUnderlineColorDefault()))if(Z.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${r.AttributeData.toColorRGB(Z.getUnderlineColor()).join(",")})`;else{let he=Z.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Z.isBold()&&he<8&&(he+=8),E.style.textDecorationColor=C.ansi[he].css}Z.isOverline()&&(G.push("xterm-overline"),N===" "&&(N=" ")),Z.isStrikethrough()&&G.push("xterm-strikethrough"),de&&(E.style.textDecoration="underline");let J=Z.getFgColor(),ue=Z.getFgColorMode(),ve=Z.getBgColor(),_e=Z.getBgColorMode();const Re=!!Z.isInverse();if(Re){const he=J;J=ve,ve=he;const le=ue;ue=_e,_e=le}let we,ne,me,fe=!1;switch(this._decorationService.forEachDecorationAtCell(re,m,void 0,he=>{he.options.layer!=="top"&&fe||(he.backgroundColorRGB&&(_e=50331648,ve=he.backgroundColorRGB.rgba>>8&16777215,we=he.backgroundColorRGB),he.foregroundColorRGB&&(ue=50331648,J=he.foregroundColorRGB.rgba>>8&16777215,ne=he.foregroundColorRGB),fe=he.options.layer==="top")}),!fe&&Se&&(we=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ve=we.rgba>>8&16777215,_e=50331648,fe=!0,C.selectionForeground&&(ue=50331648,J=C.selectionForeground.rgba>>8&16777215,ne=C.selectionForeground)),fe&&G.push("xterm-decoration-top"),_e){case 16777216:case 33554432:me=C.ansi[ve],G.push(`xterm-bg-${ve}`);break;case 50331648:me=o.channels.toColor(ve>>16,ve>>8&255,255&ve),this._addStyle(E,`background-color:#${f((ve>>>0).toString(16),"0",6)}`);break;default:Re?(me=C.foreground,G.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):me=C.background}switch(we||Z.isDim()&&(we=o.color.multiplyOpacity(me,.5)),ue){case 16777216:case 33554432:Z.isBold()&&J<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(J+=8),this._applyMinimumContrast(E,me,C.ansi[J],Z,we,void 0)||G.push(`xterm-fg-${J}`);break;case 50331648:const he=o.channels.toColor(J>>16&255,J>>8&255,255&J);this._applyMinimumContrast(E,me,he,Z,we,ne)||this._addStyle(E,`color:#${f(J.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,me,C.foreground,Z,we,ne)||Re&&G.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}G.length&&(E.className=G.join(" "),G.length=0),Ae||ce||oe?E.textContent=N:D++,H!==this.defaultSpacing&&(E.style.letterSpacing=`${H}px`),T.push(E),re=pe}return E&&D&&(E.textContent=N),T}_applyMinimumContrast(c,m,d,p,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(p.getCode()))return!1;const b=this._getContrastCache(p);let w;if(S||y||(w=b.getColor(m.rgba,d.rgba)),w===void 0){const L=this._optionsService.rawOptions.minimumContrastRatio/(p.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,y||d,L),b.setColor((S||m).rgba,(y||d).rgba,w??null)}return!!w&&(this._addStyle(c,`color:${w.css}`),!0)}_getContrastCache(c){return c.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(c,m){c.setAttribute("style",`${c.getAttribute("style")||""}${m};`)}_isCellInSelection(c,m){const d=this._selectionStart,p=this._selectionEnd;return!(!d||!p)&&(this._columnSelectMode?d[0]<=p[0]?c>=d[0]&&m>=d[1]&&c<p[0]&&m<=p[1]:c<d[0]&&m>=d[1]&&c>=p[0]&&m<=p[1]:m>d[1]&&m<p[1]||d[1]===p[1]&&m===d[1]&&c>=d[0]&&c<p[0]||d[1]<p[1]&&m===p[1]&&c<p[0]||d[1]<p[1]&&m===d[1]&&c>=d[0])}};function f(c,m,d){for(;c.length<d;)c=m+c;return c}t.DomRendererRowFactory=u=h([l(1,e.ICharacterJoinerService),l(2,v.IOptionsService),l(3,e.ICoreBrowserService),l(4,v.ICoreService),l(5,v.IDecorationService),l(6,e.IThemeService)],u)},2550:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const n=a.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";const _=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=[l,n,_,g],this._container.appendChild(l),this._container.appendChild(n),this._container.appendChild(_),this._container.appendChild(g),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,h,l,n){a===this._font&&h===this._fontSize&&l===this._weight&&n===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(a,h,l){let n=0;if(!h&&!l&&a.length===1&&(n=a.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];const v=this._measure(a,0);return v>0&&(this._flat[n]=v),v}let _=a;h&&(_+="B"),l&&(_+="I");let g=this._holey.get(_);if(g===void 0){let v=0;h&&(v|=1),l&&(v|=2),g=this._measure(a,v),g>0&&this._holey.set(_,g)}return g}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.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 h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(O,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(v){return 57344<=v&&v<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=9631}(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,n,_=0){return(l-(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(l,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const v=l.buffers.active.ydisp,o=n[1]-v,e=_[1]-v,s=Math.max(o,0),i=Math.min(e,l.rows-1);s>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=s,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=_[0])}isCellSelected(l,n,_){return!!this.hasSelection&&(_-=l.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,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(O,t,a){var h=this&&this.__decorate||function(i,r,u,f){var c,m=arguments.length,d=m<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,u):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,f);else for(var p=i.length-1;p>=0;p--)(c=i[p])&&(d=(m<3?c(d):m>3?c(r,u,d):c(r,u))||d);return m>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,f){r(u,f,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const n=a(2585),_=a(8460),g=a(844);let v=t.CharSizeService=class extends g.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,r,u){super(),this._optionsService=u,this.width=0,this.height=0,this._onCharSizeChange=this.register(new _.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new s(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,r,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=v=h([l(2,n.IOptionsService)],v);class o extends g.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(r,u){r!==void 0&&r>0&&u!==void 0&&u>0&&(this._result.width=r,this._result.height=u)}}class e extends o{constructor(r,u,f){super(),this._document=r,this._parentElement=u,this._optionsService=f,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class s extends o{constructor(r){super(),this._optionsService=r,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const u=this._ctx.measureText("W");if(!("width"in u&&"fontBoundingBoxAscent"in u&&"fontBoundingBoxDescent"in u))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const r=this._ctx.measureText("W");return this._validateAndSet(r.width,r.fontBoundingBoxAscent+r.fontBoundingBoxDescent),this._result}}},4269:function(O,t,a){var h=this&&this.__decorate||function(s,i,r,u){var f,c=arguments.length,m=c<3?i:u===null?u=Object.getOwnPropertyDescriptor(i,r):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,i,r,u);else for(var d=s.length-1;d>=0;d--)(f=s[d])&&(m=(c<3?f(m):c>3?f(i,r,m):f(i,r))||m);return c>3&&m&&Object.defineProperty(i,r,m),m},l=this&&this.__param||function(s,i){return function(r,u){i(r,u,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=a(3734),_=a(643),g=a(511),v=a(2585);class o extends n.AttributeData{constructor(i,r,u){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=r,this._width=u}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class Ct{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new g.CellData}register(i){const r={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(r),r.id}deregister(i){for(let r=0;r<this._characterJoiners.length;r++)if(this._characterJoiners[r].id===i)return this._characterJoiners.splice(r,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const r=this._bufferService.buffer.lines.get(i);if(!r||r.length===0)return[];const u=[],f=r.translateToString(!0);let c=0,m=0,d=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-c>1){const b=this._getJoinedRanges(f,d,m,r,c);for(let w=0;w<b.length;w++)u.push(b[w])}c=y,d=m,p=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||_.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-c>1){const y=this._getJoinedRanges(f,d,m,r,c);for(let b=0;b<y.length;b++)u.push(y[b])}return u}_getJoinedRanges(i,r,u,f,c){const m=i.substring(r,u);let d=[];try{d=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++)Ct._mergeRanges(d,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(d,f,c),d}_stringRangesToCellRanges(i,r,u){let f=0,c=!1,m=0,d=i[f];if(d){for(let p=u;p<this._bufferService.cols;p++){const S=r.getWidth(p),y=r.getString(p).length||_.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!c&&d[0]<=m&&(d[0]=p,c=!0),d[1]<=m){if(d[1]=p,d=i[++f],!d)break;d[0]<=m?(d[0]=p,c=!0):c=!1}m+=y}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(i,r){let u=!1;for(let f=0;f<i.length;f++){const c=i[f];if(u){if(r[1]<=c[0])return i[f-1][1]=r[1],i;if(r[1]<=c[1])return i[f-1][1]=Math.max(r[1],c[1]),i.splice(f,1),i;i.splice(f,1),f--}else{if(r[1]<=c[0])return i.splice(f,0,r),i;if(r[1]<=c[1])return c[0]=Math.min(r[0],c[0]),i;r[0]<c[1]&&(c[0]=Math.min(r[0],c[0]),u=!0)}}return u?i[i.length-1][1]=r[1]:i.push(r),i}};t.CharacterJoinerService=e=h([l(0,v.IBufferService)],e)},5114:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),n=a(3656);class _ extends h.Disposable{constructor(o,e,s){super(),this._textarea=o,this._window=e,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new g(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}t.CoreBrowserService=_;class g extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)(()=>this.clearListener()))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var o;this._outerListener&&((o=this._resolutionMediaMatchList)==null||o.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(_){return this.linkProviders.push(_),{dispose:()=>{const g=this.linkProviders.indexOf(_);g!==-1&&this.linkProviders.splice(g,1)}}}}t.LinkProviderService=l},8934:function(O,t,a){var h=this&&this.__decorate||function(v,o,e,s){var i,r=arguments.length,u=r<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(v,o,e,s);else for(var f=v.length-1;f>=0;f--)(i=v[f])&&(u=(r<3?i(u):r>3?i(o,e,u):i(o,e))||u);return r>3&&u&&Object.defineProperty(o,e,u),u},l=this&&this.__param||function(v,o){return function(e,s){o(e,s,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const n=a(4725),_=a(9806);let g=t.MouseService=class{constructor(v,o){this._renderService=v,this._charSizeService=o}getCoords(v,o,e,s,i){return(0,_.getCoords)(window,v,o,e,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(v,o){const e=(0,_.getCoordsRelativeToElement)(window,v,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=h([l(0,n.IRenderService),l(1,n.ICharSizeService)],g)},3230:function(O,t,a){var h=this&&this.__decorate||function(i,r,u,f){var c,m=arguments.length,d=m<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,u):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,f);else for(var p=i.length-1;p>=0;p--)(c=i[p])&&(d=(m<3?c(d):m>3?c(r,u,d):c(r,u))||d);return m>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,f){r(u,f,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const n=a(6193),_=a(4725),g=a(8460),v=a(844),o=a(7226),e=a(2585);let s=t.RenderService=class extends v.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,r,u,f,c,m,d,p){super(),this._rowCount=i,this._charSizeService=f,this._renderer=this.register(new v.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new v.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),d),this.register(this._renderDebouncer),this.register(d.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(u.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(c.onDecorationRegistered(()=>this._fullRefresh())),this.register(c.onDecorationRemoved(()=>this._fullRefresh())),this.register(u.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()})),this.register(u.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(m.buffer.y,m.buffer.y,!0))),this.register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(d.window,r),this.register(d.onWindowChange(S=>this._registerIntersectionObserver(S,r)))}_registerIntersectionObserver(i,r){if("IntersectionObserver"in i){const u=new i.IntersectionObserver(f=>this._handleIntersectionChange(f[f.length-1]),{threshold:0});u.observe(r),this._observerDisposable.value=(0,v.toDisposable)(()=>u.disconnect())}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,r,u=!1){this._isPaused?this._needsFullRefresh=!0:(u||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,r,this._rowCount))}_renderRows(i,r){this._renderer.value&&(i=Math.min(i,this._rowCount-1),r=Math.min(r,this._rowCount-1),this._renderer.value.renderRows(i,r),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:r}),this._onRender.fire({start:i,end:r}),this._isNextRenderRedrawOnly=!0)}resize(i,r){this._rowCount=r,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw(r=>this.refreshRows(r.start,r.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var i,r;this._renderer.value&&((r=(i=this._renderer.value).clearTextureAtlas)==null||r.call(i),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,r){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var u;return(u=this._renderer.value)==null?void 0:u.handleResize(i,r)}):this._renderer.value.handleResize(i,r),this._fullRefresh())}handleCharSizeChanged(){var i;(i=this._renderer.value)==null||i.handleCharSizeChanged()}handleBlur(){var i;(i=this._renderer.value)==null||i.handleBlur()}handleFocus(){var i;(i=this._renderer.value)==null||i.handleFocus()}handleSelectionChanged(i,r,u){var f;this._selectionState.start=i,this._selectionState.end=r,this._selectionState.columnSelectMode=u,(f=this._renderer.value)==null||f.handleSelectionChanged(i,r,u)}handleCursorMove(){var i;(i=this._renderer.value)==null||i.handleCursorMove()}clear(){var i;(i=this._renderer.value)==null||i.clear()}};t.RenderService=s=h([l(2,e.IOptionsService),l(3,_.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,_.ICoreBrowserService),l(7,_.IThemeService)],s)},9312:function(O,t,a){var h=this&&this.__decorate||function(d,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(d,p,S,y);else for(var B=d.length-1;B>=0;B--)(b=d[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},l=this&&this.__param||function(d,p){return function(S,y){p(S,y,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const n=a(9806),_=a(9504),g=a(456),v=a(4725),o=a(8460),e=a(844),s=a(6114),i=a(4841),r=a(511),u=a(2585),f=" ",c=new RegExp(f,"g");let m=t.SelectionService=class extends e.Disposable{constructor(d,p,S,y,b,w,L,B,P){super(),this._element=d,this._screenElement=p,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=L,this._renderService=B,this._coreBrowserService=P,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 d=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;return!(!d||!p||d[0]===p[0]&&d[1]===p[1])}get selectionText(){const d=this._model.finalSelectionStart,p=this._model.finalSelectionEnd;if(!d||!p)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(d[0]===p[0])return"";const b=d[0]<p[0]?d[0]:p[0],w=d[0]<p[0]?p[0]:d[0];for(let L=d[1];L<=p[1];L++){const B=S.translateBufferLineToString(L,!0,b,w);y.push(B)}}else{const b=d[1]===p[1]?p[0]:void 0;y.push(S.translateBufferLineToString(d[1],!0,d[0],b));for(let w=d[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(d[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(c," ")).join(s.isWindows?`\r
6
- `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s.isLinux&&d&&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(d){const p=this._getMouseBufferCoords(d),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&p)&&this._areCoordsInSelection(p,S,y)}isCellInSelection(d,p){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([d,p],S,y)}_areCoordsInSelection(d,p,S){return d[1]>p[1]&&d[1]<S[1]||p[1]===S[1]&&d[1]===p[1]&&d[0]>=p[0]&&d[0]<S[0]||p[1]<S[1]&&d[1]===S[1]&&d[0]<S[0]||p[1]<S[1]&&d[1]===p[1]&&d[0]>=p[0]}_selectWordAtCursor(d,p){var b,w;const S=(w=(b=this._linkifier.currentLink)==null?void 0:b.link)==null?void 0:w.range;if(S)return this._model.selectionStart=[S.start.x-1,S.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const y=this._getMouseBufferCoords(d);return!!y&&(this._selectWordAt(y,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,p){this._model.clearSelection(),d=Math.max(d,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){const p=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(d){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,d,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(d){return s.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),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(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!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(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){const p=this._getMouseBufferCoords(d);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(d){return d.altKey&&!(s.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.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(d),!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(d),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 d=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){const p=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(d,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 d=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,S=!(!d||!p||d[0]===p[0]&&d[1]===p[1]);S?d&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,p,S)):this._oldHasSelection&&this._fireOnSelectionChange(d,p,S)}_fireOnSelectionChange(d,p,S){this._oldSelectionStart=d,this._oldSelectionEnd=p,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim(p=>this._handleTrim(p))}_convertViewportColToCharacterIndex(d,p){let S=p;for(let y=0;p>=y;y++){const b=d.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&p!==y&&(S+=b-1)}return S}setSelection(d,p,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,p],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,p,S=!0,y=!0){if(d[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(d[1]);if(!w)return;const L=b.translateBufferLineToString(d[1],!1);let B=this._convertViewportColToCharacterIndex(w,d[0]),P=B;const T=d[0]-B;let A=0,C=0,E=0,R=0;if(L.charAt(B)===" "){for(;B>0&&L.charAt(B-1)===" ";)B--;for(;P<L.length&&L.charAt(P+1)===" ";)P++}else{let W=d[0],X=d[0];w.getWidth(W)===0&&(A++,W--),w.getWidth(X)===2&&(C++,X++);const Y=w.getString(X).length;for(Y>1&&(R+=Y-1,P+=Y-1);W>0&&B>0&&!this._isCharWordSeparator(w.loadCell(W-1,this._workCell));){w.loadCell(W-1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===0?(A++,W--):k>1&&(E+=k-1,B-=k-1),B--,W--}for(;X<w.length&&P+1<L.length&&!this._isCharWordSeparator(w.loadCell(X+1,this._workCell));){w.loadCell(X+1,this._workCell);const k=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,X++):k>1&&(R+=k-1,P+=k-1),P++,X++}}P++;let D=B+T-A+E,N=Math.min(this._bufferService.cols,P-B+A+C-E-R);if(p||L.slice(B,P).trim()!==""){if(S&&D===0&&w.getCodePoint(0)!==32){const W=b.lines.get(d[1]-1);if(W&&w.isWrapped&&W.getCodePoint(this._bufferService.cols-1)!==32){const X=this._getWordAt([this._bufferService.cols-1,d[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(d[1]+1);if(W!=null&&W.isWrapped&&W.getCodePoint(0)!==32){const X=this._getWordAt([0,d[1]+1],!1,!1,!0);X&&(N+=X.length)}}return{start:D,length:N}}}_selectWordAt(d,p){const S=this._getWordAt(d,p);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[S.start,d[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(d){const p=this._getWordAt(d,!0);if(p){let S=d[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(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){const p=this._bufferService.buffer.getWrappedRangeForLine(d),S={start:{x:0,y:p.first},end:{x:this._bufferService.cols-1,y:p.last}};this._model.selectionStart=[0,p.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=m=h([l(3,u.IBufferService),l(4,u.ICoreService),l(5,v.IMouseService),l(6,u.IOptionsService),l(7,v.IRenderService),l(8,v.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 h=a(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(O,t,a){var h=this&&this.__decorate||function(m,d,p,S){var y,b=arguments.length,w=b<3?d:S===null?S=Object.getOwnPropertyDescriptor(d,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(m,d,p,S);else for(var L=m.length-1;L>=0;L--)(y=m[L])&&(w=(b<3?y(w):b>3?y(d,p,w):y(d,p))||w);return b>3&&w&&Object.defineProperty(d,p,w),w},l=this&&this.__param||function(m,d){return function(p,S){d(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),v=a(844),o=a(2585),e=_.css.toColor("#ffffff"),s=_.css.toColor("#000000"),i=_.css.toColor("#ffffff"),r=_.css.toColor("#000000"),u={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")],d=[0,95,135,175,215,255];for(let p=0;p<216;p++){const S=d[p/36%6|0],y=d[p/6%6|0],b=d[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 f=t.ThemeService=class extends v.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:s,cursor:i,cursorAccent:r,selectionForeground:void 0,selectionBackgroundTransparent:u,selectionBackgroundOpaque:_.color.blend(s,u),selectionInactiveBackgroundTransparent:u,selectionInactiveBackgroundOpaque:_.color.blend(s,u),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 d=this._colors;if(d.foreground=c(m.foreground,e),d.background=c(m.background,s),d.cursor=c(m.cursor,i),d.cursorAccent=c(m.cursorAccent,r),d.selectionBackgroundTransparent=c(m.selectionBackground,u),d.selectionBackgroundOpaque=_.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=c(m.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=_.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=m.selectionForeground?c(m.selectionForeground,_.NULL_COLOR):void 0,d.selectionForeground===_.NULL_COLOR&&(d.selectionForeground=void 0),_.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=_.color.opacity(d.selectionBackgroundTransparent,.3)),_.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=_.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=t.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=c(m.black,t.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=c(m.red,t.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=c(m.green,t.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=c(m.yellow,t.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=c(m.blue,t.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=c(m.magenta,t.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=c(m.cyan,t.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=c(m.white,t.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=c(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=c(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=c(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=c(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=c(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=c(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=c(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=c(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const p=Math.min(d.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<p;S++)d.ansi[S+16]=c(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 d=0;d<this._restoreColors.ansi.length;++d)this._colors.ansi[d]=this._restoreColors.ansi[d]}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 c(m,d){if(m!==void 0)try{return _.css.toColor(m)}catch{}return d}t.ThemeService=f=h([l(0,o.IOptionsService)],f)},6349:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class n extends l.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(g){if(this._maxLength===g)return;const v=new Array(g);for(let o=0;o<Math.min(g,this.length);o++)v[o]=this._array[this._getCyclicIndex(o)];this._array=v,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let v=this._length;v<g;v++)this._array[v]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,v){this._array[this._getCyclicIndex(g)]=v}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,v,...o){if(v){for(let e=g;e<this._length-v;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+v)];this._length-=v,this.onDeleteEmitter.fire({index:g,amount:v})}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,v,o){if(!(v<=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 s=v-1;s>=0;s--)this.set(g+s+o,this.get(g+s));const e=g+v+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<v;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(h,l=5){if(typeof h!="object")return h;const n=Array.isArray(h)?[]:{};for(const _ in h)n[_]=l<=1?h[_]:h[_]&&a(h[_],l-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,h=0,l=0,n=0;var _,g,v,o,e;function s(r){const u=r.toString(16);return u.length<2?"0"+u:u}function i(r,u){return r<u?(u+.05)/(r+.05):(r+.05)/(u+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(u,f,c,m){return m!==void 0?`#${s(u)}${s(f)}${s(c)}${s(m)}`:`#${s(u)}${s(f)}${s(c)}`},r.toRgba=function(u,f,c,m=255){return(u<<24|f<<16|c<<8|m)>>>0},r.toColor=function(u,f,c,m){return{css:r.toCss(u,f,c,m),rgba:r.toRgba(u,f,c,m)}}}(_||(t.channels=_={})),function(r){function u(f,c){return n=Math.round(255*c),[a,h,l]=e.toChannels(f.rgba),{css:_.toCss(a,h,l,n),rgba:_.toRgba(a,h,l,n)}}r.blend=function(f,c){if(n=(255&c.rgba)/255,n===1)return{css:c.css,rgba:c.rgba};const m=c.rgba>>24&255,d=c.rgba>>16&255,p=c.rgba>>8&255,S=f.rgba>>24&255,y=f.rgba>>16&255,b=f.rgba>>8&255;return a=S+Math.round((m-S)*n),h=y+Math.round((d-y)*n),l=b+Math.round((p-b)*n),{css:_.toCss(a,h,l),rgba:_.toRgba(a,h,l)}},r.isOpaque=function(f){return(255&f.rgba)==255},r.ensureContrastRatio=function(f,c,m){const d=e.ensureContrastRatio(f.rgba,c.rgba,m);if(d)return _.toColor(d>>24&255,d>>16&255,d>>8&255)},r.opaque=function(f){const c=(255|f.rgba)>>>0;return[a,h,l]=e.toChannels(c),{css:_.toCss(a,h,l),rgba:c}},r.opacity=u,r.multiplyOpacity=function(f,c){return n=255&f.rgba,u(f,n*c/255)},r.toColorRGB=function(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}}(g||(t.color=g={})),function(r){let u,f;try{const c=document.createElement("canvas");c.width=1,c.height=1;const m=c.getContext("2d",{willReadFrequently:!0});m&&(u=m,u.globalCompositeOperation="copy",f=u.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(c){if(c.match(/#[\da-f]{3,8}/i))switch(c.length){case 4:return a=parseInt(c.slice(1,2).repeat(2),16),h=parseInt(c.slice(2,3).repeat(2),16),l=parseInt(c.slice(3,4).repeat(2),16),_.toColor(a,h,l);case 5:return a=parseInt(c.slice(1,2).repeat(2),16),h=parseInt(c.slice(2,3).repeat(2),16),l=parseInt(c.slice(3,4).repeat(2),16),n=parseInt(c.slice(4,5).repeat(2),16),_.toColor(a,h,l,n);case 7:return{css:c,rgba:(parseInt(c.slice(1),16)<<8|255)>>>0};case 9:return{css:c,rgba:parseInt(c.slice(1),16)>>>0}}const m=c.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,h,l,n);if(!u||!f)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=f,u.fillStyle=c,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,h,l,n]=u.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,h,l,n),css:c}}}(v||(t.css=v={})),function(r){function u(f,c,m){const d=f/255,p=c/255,S=m/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.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(f){return u(f>>16&255,f>>8&255,255&f)},r.relativeLuminance2=u}(o||(t.rgb=o={})),function(r){function u(c,m,d){const p=c>>24&255,S=c>>16&255,y=c>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<d&&(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=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function f(c,m,d){const p=c>>24&255,S=c>>16&255,y=c>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<d&&(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=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(c,m){if(n=(255&m)/255,n===1)return m;const d=m>>24&255,p=m>>16&255,S=m>>8&255,y=c>>24&255,b=c>>16&255,w=c>>8&255;return a=y+Math.round((d-y)*n),h=b+Math.round((p-b)*n),l=w+Math.round((S-w)*n),_.toRgba(a,h,l)},r.ensureContrastRatio=function(c,m,d){const p=o.relativeLuminance(c>>8),S=o.relativeLuminance(m>>8);if(i(p,S)<d){if(S<p){const w=u(c,m,d),L=i(p,o.relativeLuminance(w>>8));if(L<d){const B=f(c,m,d);return L>i(p,o.relativeLuminance(B>>8))?w:B}return w}const y=f(c,m,d),b=i(p,o.relativeLuminance(y>>8));if(b<d){const w=u(c,m,d);return b>i(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=u,r.increaseLuminance=f,r.toChannels=function(c){return[c>>24&255,c>>16&255,c>>8&255,255&c]}}(e||(t.rgba=e={})),t.toPaddedHex=s,t.contrastRatio=i},8969:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),n=a(4348),_=a(7866),g=a(744),v=a(7302),o=a(6975),e=a(8460),s=a(1753),i=a(1480),r=a(7994),u=a(9282),f=a(5435),c=a(5981),m=a(2660);let d=!1;class p extends h.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 h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new v.OptionsService(y)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(_.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(s.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(r.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new f.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 c.WriteBuffer((b,w)=>this._inputHandler.parse(b,w))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(y,b){this._writeBuffer.write(y,b)}writeSync(y,b){this._logService.logLevel<=l.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!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(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,h.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 h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},5435:function(O,t,a){var h=this&&this.__decorate||function(A,C,E,R){var D,N=arguments.length,W=N<3?C:R===null?R=Object.getOwnPropertyDescriptor(C,E):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(A,C,E,R);else for(var X=A.length-1;X>=0;X--)(D=A[X])&&(W=(N<3?D(W):N>3?D(C,E,W):D(C,E))||W);return N>3&&W&&Object.defineProperty(C,E,W),W},l=this&&this.__param||function(A,C){return function(E,R){C(E,R,A)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=a(2584),_=a(7116),g=a(2015),v=a(844),o=a(482),e=a(8437),s=a(8460),i=a(643),r=a(511),u=a(3734),f=a(2585),c=a(1480),m=a(6242),d=a(6351),p=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(A,C){if(A>24)return C.setWinLines||!1;switch(A){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(A){A[A.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",A[A.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let L=0;class B extends v.Disposable{getAttrData(){return this._curAttrData}constructor(C,E,R,D,N,W,X,Y,k=new g.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=E,this._coreService=R,this._logService=D,this._optionsService=N,this._oscLinkService=W,this._coreMouseService=X,this._unicodeService=Y,this._parser=k,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new r.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new s.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new s.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new s.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new s.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new s.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new s.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new s.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new s.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new s.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new s.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new s.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(x=>this._activeBuffer=x.activeBuffer)),this._parser.setCsiHandlerFallback((x,$)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:$.toArray()})}),this._parser.setEscHandlerFallback(x=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(x)})}),this._parser.setExecuteHandlerFallback(x=>{this._logService.debug("Unknown EXECUTE code: ",{code:x})}),this._parser.setOscHandlerFallback((x,$,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:$,data:H})}),this._parser.setDcsHandlerFallback((x,$,H)=>{$==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:$,payload:H})}),this._parser.setPrintHandler((x,$,H)=>this.print(x,$,H)),this._parser.registerCsiHandler({final:"@"},x=>this.insertChars(x)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},x=>this.scrollLeft(x)),this._parser.registerCsiHandler({final:"A"},x=>this.cursorUp(x)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},x=>this.scrollRight(x)),this._parser.registerCsiHandler({final:"B"},x=>this.cursorDown(x)),this._parser.registerCsiHandler({final:"C"},x=>this.cursorForward(x)),this._parser.registerCsiHandler({final:"D"},x=>this.cursorBackward(x)),this._parser.registerCsiHandler({final:"E"},x=>this.cursorNextLine(x)),this._parser.registerCsiHandler({final:"F"},x=>this.cursorPrecedingLine(x)),this._parser.registerCsiHandler({final:"G"},x=>this.cursorCharAbsolute(x)),this._parser.registerCsiHandler({final:"H"},x=>this.cursorPosition(x)),this._parser.registerCsiHandler({final:"I"},x=>this.cursorForwardTab(x)),this._parser.registerCsiHandler({final:"J"},x=>this.eraseInDisplay(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},x=>this.eraseInDisplay(x,!0)),this._parser.registerCsiHandler({final:"K"},x=>this.eraseInLine(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},x=>this.eraseInLine(x,!0)),this._parser.registerCsiHandler({final:"L"},x=>this.insertLines(x)),this._parser.registerCsiHandler({final:"M"},x=>this.deleteLines(x)),this._parser.registerCsiHandler({final:"P"},x=>this.deleteChars(x)),this._parser.registerCsiHandler({final:"S"},x=>this.scrollUp(x)),this._parser.registerCsiHandler({final:"T"},x=>this.scrollDown(x)),this._parser.registerCsiHandler({final:"X"},x=>this.eraseChars(x)),this._parser.registerCsiHandler({final:"Z"},x=>this.cursorBackwardTab(x)),this._parser.registerCsiHandler({final:"`"},x=>this.charPosAbsolute(x)),this._parser.registerCsiHandler({final:"a"},x=>this.hPositionRelative(x)),this._parser.registerCsiHandler({final:"b"},x=>this.repeatPrecedingCharacter(x)),this._parser.registerCsiHandler({final:"c"},x=>this.sendDeviceAttributesPrimary(x)),this._parser.registerCsiHandler({prefix:">",final:"c"},x=>this.sendDeviceAttributesSecondary(x)),this._parser.registerCsiHandler({final:"d"},x=>this.linePosAbsolute(x)),this._parser.registerCsiHandler({final:"e"},x=>this.vPositionRelative(x)),this._parser.registerCsiHandler({final:"f"},x=>this.hVPosition(x)),this._parser.registerCsiHandler({final:"g"},x=>this.tabClear(x)),this._parser.registerCsiHandler({final:"h"},x=>this.setMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"h"},x=>this.setModePrivate(x)),this._parser.registerCsiHandler({final:"l"},x=>this.resetMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"l"},x=>this.resetModePrivate(x)),this._parser.registerCsiHandler({final:"m"},x=>this.charAttributes(x)),this._parser.registerCsiHandler({final:"n"},x=>this.deviceStatus(x)),this._parser.registerCsiHandler({prefix:"?",final:"n"},x=>this.deviceStatusPrivate(x)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},x=>this.softReset(x)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},x=>this.setCursorStyle(x)),this._parser.registerCsiHandler({final:"r"},x=>this.setScrollRegion(x)),this._parser.registerCsiHandler({final:"s"},x=>this.saveCursor(x)),this._parser.registerCsiHandler({final:"t"},x=>this.windowOptions(x)),this._parser.registerCsiHandler({final:"u"},x=>this.restoreCursor(x)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},x=>this.insertColumns(x)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},x=>this.deleteColumns(x)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},x=>this.selectProtected(x)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},x=>this.requestMode(x,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},x=>this.requestMode(x,!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(x=>(this.setTitle(x),this.setIconName(x),!0))),this._parser.registerOscHandler(1,new m.OscHandler(x=>this.setIconName(x))),this._parser.registerOscHandler(2,new m.OscHandler(x=>this.setTitle(x))),this._parser.registerOscHandler(4,new m.OscHandler(x=>this.setOrReportIndexedColor(x))),this._parser.registerOscHandler(8,new m.OscHandler(x=>this.setHyperlink(x))),this._parser.registerOscHandler(10,new m.OscHandler(x=>this.setOrReportFgColor(x))),this._parser.registerOscHandler(11,new m.OscHandler(x=>this.setOrReportBgColor(x))),this._parser.registerOscHandler(12,new m.OscHandler(x=>this.setOrReportCursorColor(x))),this._parser.registerOscHandler(104,new m.OscHandler(x=>this.restoreIndexedColor(x))),this._parser.registerOscHandler(110,new m.OscHandler(x=>this.restoreFgColor(x))),this._parser.registerOscHandler(111,new m.OscHandler(x=>this.restoreBgColor(x))),this._parser.registerOscHandler(112,new m.OscHandler(x=>this.restoreCursorColor(x))),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 x in _.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:x},()=>this.selectCharset("("+x)),this._parser.registerEscHandler({intermediates:")",final:x},()=>this.selectCharset(")"+x)),this._parser.registerEscHandler({intermediates:"*",final:x},()=>this.selectCharset("*"+x)),this._parser.registerEscHandler({intermediates:"+",final:x},()=>this.selectCharset("+"+x)),this._parser.registerEscHandler({intermediates:"-",final:x},()=>this.selectCharset("-"+x)),this._parser.registerEscHandler({intermediates:".",final:x},()=>this.selectCharset("."+x)),this._parser.registerEscHandler({intermediates:"/",final:x},()=>this.selectCharset("/"+x));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(x=>(this._logService.error("Parsing error: ",x),x)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new d.DcsHandler((x,$)=>this.requestStatusString(x,$)))}_preserveStack(C,E,R,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=R,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=f.LogLevelEnum.WARN&&Promise.race([C,new Promise((E,R)=>setTimeout(()=>R("#SLOW_TIMEOUT"),5e3))]).catch(E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,E){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,E))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<=f.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,x=>String.fromCharCode(x)).join("")}"`),typeof C=="string"?C.split("").map(x=>x.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 x=W;x<C.length;x+=y){const $=x+y<C.length?x+y:C.length,H=typeof C=="string"?this._stringDecoder.decode(C.substring(x,$),this._parseBuffer):this._utf8Decoder.decode(C.subarray(x,$),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,H))return this._preserveStack(D,N,H,x),this._logSlowResolvingAsync(R),R}else if(!X){const x=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,x))return this._preserveStack(D,N,x,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),k=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);k<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(k,this._bufferService.rows-1),Math.min(Y,this._bufferService.rows-1))}print(C,E,R){let D,N;const W=this._charsetService.charset,X=this._optionsService.rawOptions.screenReaderMode,Y=this._bufferService.cols,k=this._coreService.decPrivateModes.wraparound,x=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-E>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$);let G=this._parser.precedingJoinState;for(let j=E;j<R;++j){if(D=C[j],D<127&&W){const pe=W[String.fromCharCode(D)];pe&&(D=pe.charCodeAt(0))}const re=this._unicodeService.charProperties(D,G);N=c.UnicodeService.extractWidth(re);const ee=c.UnicodeService.extractShouldJoin(re),ce=ee?c.UnicodeService.extractWidth(G):0;if(G=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-ce>Y){if(k){const pe=H;let Z=this._activeBuffer.x-ce;for(this._activeBuffer.x=ce,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),ce>0&&H instanceof e.BufferLine&&H.copyCellsFrom(pe,Z,0,ce,!1);Z<Y;)pe.setCellFromCodepoint(Z++,0,1,$)}else if(this._activeBuffer.x=Y-1,N===2)continue}if(ee&&this._activeBuffer.x){const pe=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-pe,D,N);for(let Z=N-ce;--Z>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}else if(x&&(H.insertCells(this._activeBuffer.x,N-ce,this._activeBuffer.getNullCell($)),H.getWidth(Y-1)===2&&H.setCellFromCodepoint(Y-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,$)),H.setCellFromCodepoint(this._activeBuffer.x++,D,N,$),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,$)}this._parser.precedingJoinState=G,this._activeBuffer.x<Y&&R-E>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,E){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,E):this._parser.registerCsiHandler(C,R=>!b(R.params[0],this._optionsService.rawOptions.windowOptions)||E(R))}registerDcsHandler(C,E){return this._parser.registerDcsHandler(C,new d.DcsHandler(E))}registerEscHandler(C,E){return this._parser.registerEscHandler(C,E)}registerOscHandler(C,E){return this._parser.registerOscHandler(C,new m.OscHandler(E))}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 E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);E.hasWidth(this._activeBuffer.x)&&!E.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,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=C,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+E)}cursorUp(C){const E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,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 E=C.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=C.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=C.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const E=C.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,E,R,D=!1,N=!1){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);W.replaceCells(E,R,this._activeBuffer.getNullCell(this._eraseAttrData()),N),D&&(W.isWrapped=!1)}_resetBufferLine(C,E=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),R.isWrapped=!1)}eraseInDisplay(C,E=!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,E);R<this._bufferService.rows;R++)this._resetBufferLine(R,E);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,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,E);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,E=!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,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let E=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(;E--;)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 E=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;E--;)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 E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.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 E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let E=C.params[0]||1;for(;E--;)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 E=C.params[0]||1;for(;E--;)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 E=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,E,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 E=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,E,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 E=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,E,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 E=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,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.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 E=this._parser.precedingJoinState;if(!E)return!0;const R=C.params[0]||1,D=c.UnicodeService.extractWidth(E),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 x=0;x<W.length;){const $=W.codePointAt(x)||0;X[Y++]=$,x+=$>65535?2:1}let k=Y;for(let x=1;x<R;++x)X.copyWithin(k,0,Y),k+=Y;return this.print(X,0,k),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(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 E=0;E<C.length;E++)switch(C.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let E=0;E<C.length;E++)switch(C.params[E]){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 E=0;E<C.length;E++)switch(C.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let E=0;E<C.length;E++)switch(C.params[E]){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[E]===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,E){const R=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,W=this._coreService,{buffers:X,cols:Y}=this._bufferService,{active:k,alt:x}=X,$=this._optionsService.rawOptions,H=ee=>ee?1:2,G=C.params[0];return j=G,re=E?G===2?4:G===4?H(W.modes.insertMode):G===12?3:G===20?H($.convertEol):0:G===1?H(R.applicationCursorKeys):G===3?$.windowOptions.setWinLines?Y===80?2:Y===132?1:0:0:G===6?H(R.origin):G===7?H(R.wraparound):G===8?3:G===9?H(D==="X10"):G===12?H($.cursorBlink):G===25?H(!W.isCursorHidden):G===45?H(R.reverseWraparound):G===66?H(R.applicationKeypad):G===67?4:G===1e3?H(D==="VT200"):G===1002?H(D==="DRAG"):G===1003?H(D==="ANY"):G===1004?H(R.sendFocus):G===1005?4:G===1006?H(N==="SGR"):G===1015?4:G===1016?H(N==="SGR_PIXELS"):G===1048?1:G===47||G===1047||G===1049?H(k===x):G===2004?H(R.bracketedPasteMode):0,W.triggerDataEvent(`${n.C0.ESC}[${E?"":"?"}${j};${re}$y`),!0;var j,re}_updateAttrColor(C,E,R,D,N){return E===2?(C|=50331648,C&=-16777216,C|=u.AttributeData.fromColorRGB([R,D,N])):E===5&&(C&=-50331904,C|=33554432|255&R),C}_extractColor(C,E,R){const D=[0,0,-1,0,0,0];let N=0,W=0;do{if(D[W+N]=C.params[E+W],C.hasSubParams(E+W)){const X=C.getSubParams(E+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+E<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,E){E.extended=E.extended.clone(),(!~C||C>5)&&(C=1),E.extended.underlineStyle=C,E.fg|=268435456,C===0&&(E.fg&=-268435457),E.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 E=C.length;let R;const D=this._curAttrData;for(let N=0;N<E;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 E=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${E};${R}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const E=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${E};${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 E=C.params[0]||1;switch(E){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=E%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(C){const E=C.params[0]||1;let R;return(C.length<2||(R=C.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>E&&(this._activeBuffer.scrollTop=E-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 E=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:E!==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:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==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 E=[],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==="?")E.push({type:0,index:W});else{const X=(0,p.parseColor)(N);X&&E.push({type:1,index:W,color:X})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(C){const E=C.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(C,E){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:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,E){const R=C.split(";");for(let D=0;D<R.length&&!(E>=this._specialColors.length);++D,++E)if(R[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{const N=(0,p.parseColor)(R[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[E],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 E=[],R=C.split(";");for(let D=0;D<R.length;++D)if(/^\d+$/.exec(R[D])){const N=parseInt(R[D]);T(N)&&E.push({type:2,index:N})}return E.length&&this._onColor.fire(E),!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 E=0;E<this._bufferService.rows;++E){const R=this._activeBuffer.ybase+this._activeBuffer.y+E,D=this._activeBuffer.lines.get(R);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,E){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,E){this._dirtyRowTracker.markRangeDirty(C,E)}}t.InputHandler=B;let P=class{constructor(A){this._bufferService=A,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(A){A<this.start?this.start=A:A>this.end&&(this.end=A)}markRangeDirty(A,C){A>C&&(L=A,A=C,C=L),A<this.start&&(this.start=A),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function T(A){return 0<=A&&A<256}P=h([l(0,f.IBufferService)],P)},844:(O,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,_){this._data[l]||(this._data[l]={}),this._data[l][n]=_}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,_,g){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,_,g)}get(h,l,n,_){var g;return(g=this._data.get(h,l))==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,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,n=this._array.length-1;for(;n>=l;){let _=l+n>>1;const g=this._getKey(this._array[_]);if(g>h)n=_-1;else{if(!(g<h)){for(;_>0&&this._getKey(this._array[_-1])===h;)_--;return _}l=_+1}}return l}}},7226:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(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 v=0,o=0,e=g.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),s=g.timeRemaining(),1.5*o>s)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=s}this.clear()}}class n extends l{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const v=Date.now()+g;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_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 h=a(643);t.updateWindowsModeWrappedState=function(l){const n=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),_=n==null?void 0:n.get(l.cols-1),g=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);g&&_&&(g.isWrapped=_[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&_[h.CHAR_DATA_CODE_INDEX]!==h.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 h}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),n=a(3734),_=a(8437),g=a(4634),v=a(511),o=a(643),e=a(4863),s=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,r,u){this._hasScrollback=i,this._optionsService=r,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_.DEFAULT_ATTR_DATA.clone(),this.savedCharset=s.DEFAULT_CHARSET,this.markers=[],this._nullCell=v.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=v.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,r){return new _.BufferLine(this._bufferService.cols,this.getNullCell(i),r)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const r=i+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=_.DEFAULT_ATTR_DATA);let r=this._rows;for(;r--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,r){const u=this.getNullCell(_.DEFAULT_ATTR_DATA);let f=0;const c=this._getCorrectBufferLength(r);if(c>this.lines.maxLength&&(this.lines.maxLength=c),this.lines.length>0){if(this._cols<i)for(let d=0;d<this.lines.length;d++)f+=+this.lines.get(d).resize(i,u);let m=0;if(this._rows<r)for(let d=this._rows;d<r;d++)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(i,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new _.BufferLine(i,u)));else for(let d=this._rows;d>r;d--)this.lines.length>r+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(c<this.lines.maxLength){const d=this.lines.length-c;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=c}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,r-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=r-1,this._isReflowEnabled&&(this._reflow(i,r),this._cols>i))for(let m=0;m<this.lines.length;m++)f+=+this.lines.get(m).resize(i,u);this._cols=i,this._rows=r,this._memoryCleanupQueue.clear(),f>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let r=0;for(;this._memoryCleanupPosition<this.lines.length;)if(r+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),r>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,r){this._cols!==i&&(i>this._cols?this._reflowLarger(i,r):this._reflowSmaller(i,r))}_reflowLarger(i,r){const u=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(_.DEFAULT_ATTR_DATA));if(u.length>0){const f=(0,g.reflowLargerCreateNewLayout)(this.lines,u);(0,g.reflowLargerApplyNewLayout)(this.lines,f.layout),this._reflowLargerAdjustViewport(i,r,f.countRemoved)}}_reflowLargerAdjustViewport(i,r,u){const f=this.getNullCell(_.DEFAULT_ATTR_DATA);let c=u;for(;c-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<r&&this.lines.push(new _.BufferLine(i,f))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(i,r){const u=this.getNullCell(_.DEFAULT_ATTR_DATA),f=[];let c=0;for(let m=this.lines.length-1;m>=0;m--){let d=this.lines.get(m);if(!d||!d.isWrapped&&d.getTrimmedLength()<=i)continue;const p=[d];for(;d.isWrapped&&m>0;)d=this.lines.get(--m),p.unshift(d);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,i),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&&(f.push({start:m+p.length+c,newLines:B}),c+=B.length),p.push(...B);let P=b.length-1,T=b[P];T===0&&(P--,T=b[P]);let A=p.length-w-1,C=y;for(;A>=0;){const R=Math.min(C,T);if(p[P]===void 0)break;if(p[P].copyCellsFrom(p[A],C-R,T-R,R,!0),T-=R,T===0&&(P--,T=b[P]),C-=R,C===0){A--;const D=Math.max(A,0);C=(0,g.getWrappedLineTrimmedLength)(p,D,this._cols)}}for(let R=0;R<p.length;R++)b[R]<i&&p[R].setCell(b[R],u);let E=w-L;for(;E-- >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+c)-r&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+r-1)}if(f.length>0){const m=[],d=[];for(let P=0;P<this.lines.length;P++)d.push(this.lines.get(P));const p=this.lines.length;let S=p-1,y=0,b=f[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let w=0;for(let P=Math.min(this.lines.maxLength-1,p+c-1);P>=0;P--)if(b&&b.start>S+w){for(let T=b.newLines.length-1;T>=0;T--)this.lines.set(P--,b.newLines[T]);P++,m.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=f[++y]}else this.lines.set(P,d[S--]);let L=0;for(let P=m.length-1;P>=0;P--)m[P].index+=L,this.lines.onInsertEmitter.fire(m[P]),L+=m[P].amount;const B=Math.max(0,p+c-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(i,r,u=0,f){const c=this.lines.get(i);return c?c.translateToString(r,u,f):""}getWrappedRangeForLine(i){let r=i,u=i;for(;r>0&&this.lines.get(r).isWrapped;)r--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:r,last:u}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].line===i&&(this.markers[r].dispose(),this.markers.splice(r--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const r=new e.Marker(i);return this.markers.push(r),r.register(this.lines.onTrim(u=>{r.line-=u,r.line<0&&r.dispose()})),r.register(this.lines.onInsert(u=>{r.line>=u.index&&(r.line+=u.amount)})),r.register(this.lines.onDelete(u=>{r.line>=u.index&&r.line<u.index+u.amount&&r.dispose(),r.line>u.index&&(r.line-=u.amount)})),r.register(r.onDispose(()=>this._removeMarker(r))),r}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),n=a(643),_=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let g=0;class v{constructor(e,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const r=s||l.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let u=0;u<e;++u)this.setCell(u,r);this.length=e}get(e){const s=this._data[3*e+0],i=2097151&s;return[this._data[3*e+1],2097152&s?this._combined[e]:i?(0,_.stringFromCodePoint)(i):"",s>>22,2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,s){this._data[3*e+1]=s[n.CHAR_DATA_ATTR_INDEX],s[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=s[1],this._data[3*e+0]=2097152|e|s[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=s[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|s[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 s=this._data[3*e+0];return 2097152&s?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&s}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const s=this._data[3*e+0];return 2097152&s?this._combined[e]:2097151&s?(0,_.stringFromCodePoint)(2097151&s):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,s){return g=3*e,s.content=this._data[g+0],s.fg=this._data[g+1],s.bg=this._data[g+2],2097152&s.content&&(s.combinedData=this._combined[e]),268435456&s.bg&&(s.extended=this._extendedAttrs[e]),s}setCell(e,s){2097152&s.content&&(this._combined[e]=s.combinedData),268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=s.content,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}setCellFromCodepoint(e,s,i,r){268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=s|i<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,s,i){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,_.stringFromCodePoint)(s):2097151&r?(this._combined[e]=(0,_.stringFromCodePoint)(2097151&r)+(0,_.stringFromCodePoint)(s),r&=-2097152,r|=2097152):r=s|4194304,i&&(r&=-12582913,r|=i<<22),this._data[3*e+0]=r}insertCells(e,s,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length-e){const r=new l.CellData;for(let u=this.length-e-s-1;u>=0;--u)this.setCell(e+s+u,this.loadCell(e+u,r));for(let u=0;u<s;++u)this.setCell(e+u,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,s,i){if(e%=this.length,s<this.length-e){const r=new l.CellData;for(let u=0;u<this.length-e-s;++u)this.setCell(e+u,this.loadCell(e+s+u,r));for(let u=this.length-s;u<this.length;++u)this.setCell(u,i)}else for(let r=e;r<this.length;++r)this.setCell(r,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,s,i,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);e<s&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);e<s&&e<this.length;)this.setCell(e++,i)}resize(e,s){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,s)}else{this._data=this._data.subarray(0,i);const r=Object.keys(this._combined);for(let f=0;f<r.length;f++){const c=parseInt(r[f],10);c>=e&&delete this._combined[c]}const u=Object.keys(this._extendedAttrs);for(let f=0;f<u.length;f++){const c=parseInt(u[f],10);c>=e&&delete this._extendedAttrs[c]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,s=!1){if(s)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const s in e._combined)this._combined[s]=e._combined[s];this._extendedAttrs={};for(const s in e._extendedAttrs)this._extendedAttrs[s]=e._extendedAttrs[s];this.isWrapped=e.isWrapped}clone(){const e=new v(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const s in this._combined)e._combined[s]=this._combined[s];for(const s in this._extendedAttrs)e._extendedAttrs[s]=this._extendedAttrs[s];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,s,i,r,u){const f=e._data;if(u)for(let m=r-1;m>=0;m--){for(let d=0;d<3;d++)this._data[3*(i+m)+d]=f[3*(s+m)+d];268435456&f[3*(s+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[s+m])}else for(let m=0;m<r;m++){for(let d=0;d<3;d++)this._data[3*(i+m)+d]=f[3*(s+m)+d];268435456&f[3*(s+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[s+m])}const c=Object.keys(e._combined);for(let m=0;m<c.length;m++){const d=parseInt(c[m],10);d>=s&&(this._combined[d-s+i]=e._combined[d])}}translateToString(e,s,i,r){s=s??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let u="";for(;s<i;){const f=this._data[3*s+0],c=2097151&f,m=2097152&f?this._combined[s]:c?(0,_.stringFromCodePoint)(c):n.WHITESPACE_CELL_CHAR;if(u+=m,r)for(let d=0;d<m.length;++d)r.push(s);s+=f>>22||1}return r&&r.push(s),u}}t.BufferLine=v},4841:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(O,t)=>{function a(h,l,n){if(l===h.length-1)return h[l].getTrimmedLength();const _=!h[l].hasContent(n-1)&&h[l].getWidth(n-1)===1,g=h[l+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(h,l,n,_,g){const v=[];for(let o=0;o<h.length-1;o++){let e=o,s=h.get(++e);if(!s.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&s.isWrapped;)i.push(s),s=h.get(++e);if(_>=o&&_<e){o+=i.length-1;continue}let r=0,u=a(i,r,l),f=1,c=0;for(;f<i.length;){const d=a(i,f,l),p=d-c,S=n-u,y=Math.min(p,S);i[r].copyCellsFrom(i[f],c,u,y,!1),u+=y,u===n&&(r++,u=0),c+=y,c===d&&(f++,c=0),u===0&&r!==0&&i[r-1].getWidth(n-1)===2&&(i[r].copyCellsFrom(i[r-1],n-1,u++,1,!1),i[r-1].setCell(n-1,g))}i[r].replaceCells(u,n,g);let m=0;for(let d=i.length-1;d>0&&(d>r||i[d].getTrimmedLength()===0);d--)m++;m>0&&(v.push(o+i.length-m),v.push(m)),o+=i.length-1}return v},t.reflowLargerCreateNewLayout=function(h,l){const n=[];let _=0,g=l[_],v=0;for(let o=0;o<h.length;o++)if(g===o){const e=l[++_];h.onDeleteEmitter.fire({index:o-v,amount:e}),o+=e-1,v+=e,g=l[++_]}else n.push(o);return{layout:n,countRemoved:v}},t.reflowLargerApplyNewLayout=function(h,l){const n=[];for(let _=0;_<l.length;_++)n.push(h.get(l[_]));for(let _=0;_<n.length;_++)h.set(_,n[_]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,n){const _=[],g=h.map((s,i)=>a(h,i,l)).reduce((s,i)=>s+i);let v=0,o=0,e=0;for(;e<g;){if(g-e<n){_.push(g-e);break}v+=n;const s=a(h,o,l);v>s&&(v-=s,o++);const i=h[o].getWidth(v-1)===2;i&&v--;const r=i?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 h=a(8460),l=a(844),n=a(9092);class _ extends l.Disposable{constructor(v,o){super(),this._optionsService=v,this._bufferService=o,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(v){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(v),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(v,o){this._normal.resize(v,o),this._alt.resize(v,o),this.setupTabStops(v)}setupTabStops(v){this._normal.setupTabStops(v),this._alt.setupTabStops(v)}}t.BufferSet=_},511:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=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(v){const o=new _;return o.setFromCharData(v),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[l.CHAR_DATA_CHAR_INDEX].length===2){const e=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[l.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 h=a(8460),l=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 h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(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,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(n){n.NUL="\0",n.SOH="",n.STX="",n.ETX="",n.EOT="",n.ENQ="",n.ACK="",n.BEL="\x07",n.BS="\b",n.HT=" ",n.LF=`
8
- `,n.VT="\v",n.FF="\f",n.CR="\r",n.SO="",n.SI="",n.DLE="",n.DC1="",n.DC2="",n.DC3="",n.DC4="",n.NAK="",n.SYN="",n.ETB="",n.CAN="",n.EM="",n.SUB="",n.ESC="\x1B",n.FS="",n.GS="",n.RS="",n.US="",n.SP=" ",n.DEL=""}(a||(t.C0=a={})),function(n){n.PAD="€",n.HOP="",n.BPH="‚",n.NBH="ƒ",n.IND="„",n.NEL="…",n.SSA="†",n.ESA="‡",n.HTS="ˆ",n.HTJ="‰",n.VTS="Š",n.PLD="‹",n.PLU="Œ",n.RI="",n.SS2="Ž",n.SS3="",n.DCS="",n.PU1="‘",n.PU2="’",n.STS="“",n.CCH="”",n.MW="•",n.SPA="–",n.EPA="—",n.SOS="˜",n.SGCI="™",n.SCI="š",n.CSI="›",n.ST="œ",n.OSC="",n.PM="ž",n.APC="Ÿ"}(h||(t.C1=h={})),function(n){n.ST=`${a.ESC}\\`}(l||(t.C1_ESCAPED=l={}))},7399:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(n,_,g,v){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=_?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?o.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?o.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(o.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=n.ctrlKey?"\b":h.C0.DEL,n.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(n.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,n.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(g?"b":"[1;5D"))):o.key=_?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(g?"f":"[1;5C"))):o.key=_?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",g||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=_?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",g||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=_?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":_?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":_?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:n.shiftKey?o.type=2:n.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?o.type=3:n.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(g&&!v||!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=h.C0.US),n.key==="@"&&(o.key=h.C0.NUL)):n.keyCode===65&&(o.type=1);else{const s=l[n.keyCode],i=s==null?void 0:s[n.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(n.keyCode>=65&&n.keyCode<=90){const r=n.ctrlKey?n.keyCode-64:n.keyCode+32;let u=String.fromCharCode(r);n.shiftKey&&(u=u.toUpperCase()),o.key=h.C0.ESC+u}else if(n.keyCode===32)o.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let r=n.code.slice(3,4);n.shiftKey||(r=r.toLowerCase()),o.key=h.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=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?o.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?o.key=h.C0.DEL:n.keyCode===219?o.key=h.C0.ESC:n.keyCode===220?o.key=h.C0.FS:n.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(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,h=0,l=a.length){let n="";for(let _=h;_<l;++_){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,h){const l=a.length;if(!l)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?h[n++]=1024*(this._interim-55296)+g-56320+65536:(h[n++]=this._interim,h[n++]=g),this._interim=0}for(let g=_;g<l;++g){const v=a.charCodeAt(g);if(55296<=v&&v<=56319){if(++g>=l)return this._interim=v,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?h[n++]=1024*(v-55296)+o-56320+65536:(h[n++]=v,h[n++]=o)}else v!==65279&&(h[n++]=v)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,_,g,v,o=0,e=0,s=0;if(this.interim[0]){let u=!1,f=this.interim[0];f&=(224&f)==192?31:(240&f)==224?15:7;let c,m=0;for(;(c=63&this.interim[++m])&&m<4;)f<<=6,f|=c;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=d-m;for(;s<p;){if(s>=l)return 0;if(c=a[s++],(192&c)!=128){s--,u=!0;break}this.interim[m++]=c,f<<=6,f|=63&c}u||(d===2?f<128?s--:h[o++]=f:d===3?f<2048||f>=55296&&f<=57343||f===65279||(h[o++]=f):f<65536||f>1114111||(h[o++]=f)),this.interim.fill(0)}const i=l-4;let r=s;for(;r<l;){for(;!(!(r<i)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(v=a[r+3]));)h[o++]=n,h[o++]=_,h[o++]=g,h[o++]=v,r+=4;if(n=a[r++],n<128)h[o++]=n;else if((224&n)==192){if(r>=l)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}h[o++]=e}else if((240&n)==224){if(r>=l)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=l)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;h[o++]=e}else if((248&n)==240){if(r>=l)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(v=a[r++],(192&v)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),l=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let _;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<l.length;++g)_.fill(0,l[g][0],l[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?_[g]:function(v,o){let e,s=0,i=o.length-1;if(v<o[0][0]||v>o[i][1])return!1;for(;i>=s;)if(e=s+i>>1,v>o[e][1])s=e+1;else{if(!(v<o[e][0]))return!0;i=e-1}return!1}(g,n)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,v){let o=this.wcwidth(g),e=o===0&&v!==0;if(e){const s=h.UnicodeService.extractWidth(v);s===0?e=!1:s>o&&(o=s)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class n extends l.Disposable{constructor(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 h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,v){if(v!==void 0&&this._syncCalls>v)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,v){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(v),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(v)}_innerWrite(g=0,v=!0){const o=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,v);if(s){const r=u=>Date.now()-o>=12?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(o,u);return void s.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(r)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=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})$/,h=/^[\da-f]+$/;function l(n,_){const g=n.toString(16),v=g.length<2?"0"+g:g;switch(_){case 4:return g[0];case 8:return v;case 12:return(v+v).slice(0,3);default:return v+v}}t.parseColor=function(n){if(!n)return;let _=n.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const g=a.exec(_);if(g){const v=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/v*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/v*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/v*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),h.exec(_)&&[3,6,9,12].includes(_.length))){const g=_.length/3,v=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(_.slice(g*o,g*o+g),16);v[o]=g===1?e<<4:g===2?e:g===3?e>>4:e>>8}return v}},t.toRgbString=function(n,_=16){const[g,v,o]=n;return`rgb:${l(g,_)}/${l(v,_)}/${l(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 h=a(482),l=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(v,o){this._handlers[v]===void 0&&(this._handlers[v]=[]);const e=this._handlers[v];return e.push(o),{dispose:()=>{const s=e.indexOf(o);s!==-1&&e.splice(s,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}reset(){if(this._active.length)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(v,o){if(this.reset(),this._ident=v,this._active=this._handlers[v]||_,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(v,o,e){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(v,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(v,o,e))}unhook(v,o=!0){if(this._active.length){let e=!1,s=this._active.length-1,i=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;s>=0&&(e=this._active[s].unhook(v),e!==!0);s--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,e;s--}for(;s>=0;s--)if(e=this._active[s].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",v);this._active=_,this._ident=0}};const g=new l.Params;g.addParam(0),t.DcsHandler=class{constructor(v){this._handler=v,this._data="",this._params=g,this._hitLimit=!1}hook(v){this._params=v.length>1||v.params[0]?v.clone():g,this._data="",this._hitLimit=!1}put(v,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(v,o,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(v){let o=!1;if(this._hitLimit)o=!1;else if(v&&(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 h=a(844),l=a(8742),n=a(6242),_=a(6351);class g{constructor(s){this.table=new Uint8Array(s)}setDefault(s,i){this.table.fill(s<<4|i)}add(s,i,r,u){this.table[i<<8|s]=r<<4|u}addMany(s,i,r,u){for(let f=0;f<s.length;f++)this.table[i<<8|s[f]]=r<<4|u}}t.TransitionTable=g;const v=160;t.VT500_TRANSITION_TABLE=function(){const e=new g(4095),s=Array.apply(null,Array(256)).map((m,d)=>d),i=(m,d)=>s.slice(m,d),r=i(32,127),u=i(0,24);u.push(25),u.push.apply(u,i(28,32));const f=i(0,14);let c;for(c in e.setDefault(1,0),e.addMany(r,0,2,0),f)e.addMany([24,26,153,154],c,3,0),e.addMany(i(128,144),c,3,0),e.addMany(i(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(u,0,3,0),e.addMany(u,1,3,1),e.add(127,1,0,1),e.addMany(u,8,0,8),e.addMany(u,3,3,3),e.add(127,3,0,3),e.addMany(u,4,3,4),e.add(127,4,0,4),e.addMany(u,6,3,6),e.addMany(u,5,3,5),e.add(127,5,0,5),e.addMany(u,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(u,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(u,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(u,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(u,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(u,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(u,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(v,0,2,0),e.add(v,8,5,8),e.add(v,6,0,6),e.add(v,11,0,11),e.add(v,13,13,13),e}();class o extends h.Disposable{constructor(s=t.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,u)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new _.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(s,i=[64,126]){let r=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=s.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let f=0;f<s.intermediates.length;++f){const c=s.intermediates.charCodeAt(f);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=c}}if(s.final.length!==1)throw new Error("final must be a single byte");const u=s.final.charCodeAt(0);if(i[0]>u||u>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=u,r}identToString(s){const i=[];for(;s;)i.push(String.fromCharCode(255&s)),s>>=8;return i.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,i){const r=this._identifier(s,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);const u=this._escHandlers[r];return u.push(i),{dispose:()=>{const f=u.indexOf(i);f!==-1&&u.splice(f,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,i){this._executeHandlers[s.charCodeAt(0)]=i}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,i){const r=this._identifier(s);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);const u=this._csiHandlers[r];return u.push(i),{dispose:()=>{const f=u.indexOf(i);f!==-1&&u.splice(f,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,i){return this._dcsParser.registerHandler(this._identifier(s),i)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,i){return this._oscParser.registerHandler(s,i)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(s,i,r,u,f){this._parseStack.state=s,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=u,this._parseStack.chunkPos=f}parse(s,i,r){let u,f=0,c=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 d=this._parseStack.handlers;let p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&p>-1){for(;p>=0&&(u=d[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&p>-1){for(;p>=0&&(u=d[p](),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 6:if(f=s[this._parseStack.chunkPos],u=this._dcsParser.unhook(f!==24&&f!==26,r),u)return u;f===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(f=s[this._parseStack.chunkPos],u=this._oscParser.end(f!==24&&f!==26,r),u)return u;f===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 d=m;d<i;++d){switch(f=s[d],c=this._transitions.table[this.currentState<<8|(f<160?f:v)],c>>4){case 2:for(let w=d+1;;++w){if(w>=i||(f=s[w])<32||f>126&&f<v){this._printHandler(s,d,w),d=w-1;break}if(++w>=i||(f=s[w])<32||f>126&&f<v){this._printHandler(s,d,w),d=w-1;break}if(++w>=i||(f=s[w])<32||f>126&&f<v){this._printHandler(s,d,w),d=w-1;break}if(++w>=i||(f=s[w])<32||f>126&&f<v){this._printHandler(s,d,w),d=w-1;break}}break;case 3:this._executeHandlers[f]?this._executeHandlers[f]():this._executeHandlerFb(f),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:f,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const p=this._csiHandlers[this._collect<<8|f];let S=p?p.length-1:-1;for(;S>=0&&(u=p[S](this._params),u!==!0);S--)if(u instanceof Promise)return this._preserveStack(3,p,S,c,d),u;S<0&&this._csiHandlerFb(this._collect<<8|f,this._params),this.precedingJoinState=0;break;case 8:do switch(f){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(f-48)}while(++d<i&&(f=s[d])>47&&f<60);d--;break;case 9:this._collect<<=8,this._collect|=f;break;case 10:const y=this._escHandlers[this._collect<<8|f];let b=y?y.length-1:-1;for(;b>=0&&(u=y[b](),u!==!0);b--)if(u instanceof Promise)return this._preserveStack(4,y,b,c,d),u;b<0&&this._escHandlerFb(this._collect<<8|f),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|f,this._params);break;case 13:for(let w=d+1;;++w)if(w>=i||(f=s[w])===24||f===26||f===27||f>127&&f<v){this._dcsParser.put(s,d,w),d=w-1;break}break;case 14:if(u=this._dcsParser.unhook(f!==24&&f!==26),u)return this._preserveStack(6,[],0,c,d),u;f===27&&(c|=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=d+1;;w++)if(w>=i||(f=s[w])<32||f>127&&f<v){this._oscParser.put(s,d,w),d=w-1;break}break;case 6:if(u=this._oscParser.end(f!==24&&f!==26),u)return this._preserveStack(5,[],0,c,d),u;f===27&&(c|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&c}}}t.EscapeSequenceParser=o},6242:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,g){this._handlers[_]===void 0&&(this._handlers[_]=[]);const v=this._handlers[_];return v.push(g),{dispose:()=>{const o=v.indexOf(g);o!==-1&&v.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,v){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(_,g,v);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(_,g,v))}start(){this.reset(),this._state=1}put(_,g,v){if(this._state!==3){if(this._state===1)for(;g<v;){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&&v-g>0&&this._put(_,g,v)}}end(_,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let v=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,v=g,e=this._stack.fallThrough,this._stack.paused=!1),!e&&v===!1){for(;o>=0&&(v=this._active[o].end(_),v!==!0);o--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,v;o--}for(;o>=0;o--)if(v=this._active[o].end(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,v}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,v){this._hitLimit||(this._data+=(0,l.utf32ToString)(_,g,v),this._data.length>h.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(v=>(this._data="",this._hitLimit=!1,v));return this._data="",this._hitLimit=!1,g}}},8742:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(n){const _=new h;if(!n.length)return _;for(let g=Array.isArray(n[0])?1:0;g<n.length;++g){const v=n[g];if(Array.isArray(v))for(let o=0;o<v.length;++o)_.addSubParam(v[o]);else _.addParam(v)}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 h(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){const n=[];for(let _=0;_<this.length;++_){n.push(this.params[_]);const g=this._subParamsIdx[_]>>8,v=255&this._subParamsIdx[_];v-g>0&&n.push(Array.prototype.slice.call(this._subParams,g,v))}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,v=255&this._subParamsIdx[_];v-g>0&&(n[_]=this._subParams.slice(g,v))}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,v=g[_-1];g[_-1]=~v?Math.min(10*v+n,a):n}}t.Params=h},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,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=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 h.BufferLineApiView(_)}getNullCell(){return new l.CellData}}},3785:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,n){if(!(l<0||l>=this._line.length))return n?(this._line.loadCell(l,n),n):this._line.loadCell(l,new h.CellData)}translateToString(l,n,_){return this._line.translateToString(l,n,_)}}},8285:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),n=a(844);class _ extends n.Disposable{constructor(v){super(),this._core=v,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=_},7975:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,l=>h(l.toArray()))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,(l,n)=>h(l,n.toArray()))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(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 h=this&&this.__decorate||function(e,s,i,r){var u,f=arguments.length,c=f<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,s,i,r);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(c=(f<3?u(c):f>3?u(s,i,c):u(s,i))||c);return f>3&&c&&Object.defineProperty(s,i,c),c},l=this&&this.__param||function(e,s){return function(i,r){s(i,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),v=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,s){this.cols=e,this.rows=s,this.buffers.resize(e,s),this._onResize.fire({cols:e,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,s=!1){const i=this.buffer;let r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=i.getBlankLine(e,s),this._cachedBlankLine=r),r.isWrapped=s;const u=i.ybase+i.scrollTop,f=i.ybase+i.scrollBottom;if(i.scrollTop===0){const c=i.lines.isFull;f===i.lines.length-1?c?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(f+1,0,r.clone()),c?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const c=f-u+1;i.lines.shiftElements(u+1,c-1,-1),i.lines.set(f,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,s,i){const r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);const u=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),u!==r.ydisp&&(s||this._onScroll.fire(r.ydisp))}};t.BufferService=o=h([l(0,v.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,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(O,t,a){var h=this&&this.__decorate||function(r,u,f,c){var m,d=arguments.length,p=d<3?u:c===null?c=Object.getOwnPropertyDescriptor(u,f):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(r,u,f,c);else for(var S=r.length-1;S>=0;S--)(m=r[S])&&(p=(d<3?m(p):d>3?m(u,f,p):m(u,f))||p);return d>3&&p&&Object.defineProperty(u,f,p),p},l=this&&this.__param||function(r,u){return function(f,c){u(f,c,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const n=a(2585),_=a(8460),g=a(844),v={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,u){let f=(r.ctrl?16:0)|(r.shift?4:0)|(r.alt?8:0);return r.button===4?(f|=64,f|=r.action):(f|=3&r.button,4&r.button&&(f|=64),8&r.button&&(f|=128),r.action===32?f|=32:r.action!==0||u||(f|=3)),f}const e=String.fromCharCode,s={DEFAULT:r=>{const u=[o(r,!1)+32,r.col+32,r.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${e(u[0])}${e(u[1])}${e(u[2])}`},SGR:r=>{const u=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.col};${r.row}${u}`},SGR_PIXELS:r=>{const u=r.action===0&&r.button!==4?"m":"M";return`\x1B[<${o(r,!0)};${r.x};${r.y}${u}`}};let i=t.CoreMouseService=class extends g.Disposable{constructor(r,u){super(),this._bufferService=r,this._coreService=u,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new _.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const f of Object.keys(v))this.addProtocol(f,v[f]);for(const f of Object.keys(s))this.addEncoding(f,s[f]);this.reset()}addProtocol(r,u){this._protocols[r]=u}addEncoding(r,u){this._encodings[r]=u}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 u=this._encodings[this._activeEncoding](r);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!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,u,f){if(f){if(r.x!==u.x||r.y!==u.y)return!1}else if(r.col!==u.col||r.row!==u.row)return!1;return r.button===u.button&&r.action===u.action&&r.ctrl===u.ctrl&&r.alt===u.alt&&r.shift===u.shift}};t.CoreMouseService=i=h([l(0,n.IBufferService),l(1,n.ICoreService)],i)},6975:function(O,t,a){var h=this&&this.__decorate||function(i,r,u,f){var c,m=arguments.length,d=m<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,u):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,r,u,f);else for(var p=i.length-1;p>=0;p--)(c=i[p])&&(d=(m<3?c(d):m>3?c(r,u,d):c(r,u))||d);return m>3&&d&&Object.defineProperty(r,u,d),d},l=this&&this.__param||function(i,r){return function(u,f){r(u,f,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const n=a(1439),_=a(8460),g=a(844),v=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 s=t.CoreService=class extends g.Disposable{constructor(i,r,u){super(),this._bufferService=i,this._logService=r,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new _.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new _.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(o),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(i,r=!1){if(this._optionsService.rawOptions.disableStdin)return;const u=this._bufferService.buffer;r&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),r&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,()=>i.split("").map(f=>f.charCodeAt(0))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,()=>i.split("").map(r=>r.charCodeAt(0))),this._onBinary.fire(i))}};t.CoreService=s=h([l(0,v.IBufferService),l(1,v.ILogService),l(2,v.IOptionsService)],s)},9074:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),n=a(844),_=a(6106);let g=0,v=0;class o extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new _.SortedList(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)(()=>this.reset()))}registerDecoration(i){if(i.marker.isDisposed)return;const r=new e(i);if(r){const u=r.marker.onDispose(()=>r.dispose());r.onDispose(()=>{r&&(this._decorations.delete(r)&&this._onDecorationRemoved.fire(r),u.dispose())}),this._decorations.insert(r),this._onDecorationRegistered.fire(r)}return r}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,r,u){let f=0,c=0;for(const m of this._decorations.getKeyIterator(r))f=m.options.x??0,c=f+(m.options.width??1),i>=f&&i<c&&(!u||(m.options.layer??"bottom")===u)&&(yield m)}forEachDecorationAtCell(i,r,u,f){this._decorations.forEachByKey(r,c=>{g=c.options.x??0,v=g+(c.options.width??1),i>=g&&i<v&&(!u||(c.options.layer??"bottom")===u)&&f(c)})}}t.DecorationService=o;class e extends n.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class n{constructor(...g){this._entries=new Map;for(const[v,o]of g)this.set(v,o)}set(g,v){const o=this._entries.get(g);return this._entries.set(g,v),o}forEach(g){for(const[v,o]of this._entries.entries())g(v,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(h.IInstantiationService,this)}setService(_,g){this._services.set(_,g)}getService(_){return this._services.get(_)}createInstance(_,...g){const v=(0,l.getServiceDependencies)(_).sort((s,i)=>s.index-i.index),o=[];for(const s of v){const i=this._services.get(s.id);if(!i)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${s.id}.`);o.push(i)}const e=v.length>0?v[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 h=this&&this.__decorate||function(e,s,i,r){var u,f=arguments.length,c=f<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,s,i,r);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(c=(f<3?u(c):f>3?u(s,i,c):u(s,i))||c);return f>3&&c&&Object.defineProperty(s,i,c),c},l=this&&this.__param||function(e,s){return function(i,r){s(i,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 v,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())),v=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;s<e.length;s++)typeof e[s]=="function"&&(e[s]=e[s]())}_log(e,s,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...i)}trace(e,...s){var i;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,s)}debug(e,...s){var i;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,s)}info(e,...s){var i;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,s)}warn(e,...s){var i;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,s)}error(e,...s){var i;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,s)}};t.LogService=o=h([l(0,_.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,s,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(...u){if(v.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,u);v.trace(`GlyphRenderer#${r.name}(${u.map(c=>JSON.stringify(c)).join(", ")})`);const f=r.apply(this,u);return v.trace(`GlyphRenderer#${r.name} return`,f),f}}},7302:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),n=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const _=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const s in o)if(s in e)try{const i=o[s];e[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(o,e){return this.onOptionChange(s=>{s===o&&e(this.rawOptions[o])})}onMultipleOptionChange(o,e){return this.onOptionChange(s=>{o.indexOf(s)!==-1&&e()})}_setupOptions(){const o=s=>{if(!(s in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},e=(s,i)=>{if(!(s in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(const s in this.rawOptions){const i={get:o.bind(this,s),set:e.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!function(s){return s==="block"||s==="underline"||s==="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 h=this&&this.__decorate||function(g,v,o,e){var s,i=arguments.length,r=i<3?v:e===null?e=Object.getOwnPropertyDescriptor(v,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(g,v,o,e);else for(var u=g.length-1;u>=0;u--)(s=g[u])&&(r=(i<3?s(r):i>3?s(v,o,r):s(v,o))||r);return i>3&&r&&Object.defineProperty(v,o,r),r},l=this&&this.__param||function(g,v){return function(o,e){v(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 v=this._bufferService.buffer;if(g.id===void 0){const u=v.addMarker(v.ybase+v.y),f={data:g,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(f,u)),this._dataByLinkId.set(f.id,f),f.id}const o=g,e=this._getEntryIdKey(o),s=this._entriesWithId.get(e);if(s)return this.addLineToLink(s.id,v.ybase+v.y),s.id;const i=v.addMarker(v.ybase+v.y),r={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose(()=>this._removeMarkerFromLink(r,i)),this._entriesWithId.set(r.key,r),this._dataByLinkId.set(r.id,r),r.id}addLineToLink(g,v){const o=this._dataByLinkId.get(g);if(o&&o.lines.every(e=>e.line!==v)){const e=this._bufferService.buffer.addMarker(v);o.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(o,e))}}getLinkData(g){var v;return(v=this._dataByLinkId.get(g))==null?void 0:v.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,v){const o=g.lines.indexOf(v);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=_=h([l(0,n.IBufferService)],_)},8343:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(_,g,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,s){e[a]===e?e[h].push({id:o,index:s}):(e[h]=[{id:o,index:s}],e[a]=e)})(n,_,v)};return n.toString=()=>l,t.serviceRegistry.set(l,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 h=a(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=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,v,o=!1){return(16777215&g)<<3|(3&v)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const g=new l.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 v=0,o=0;const e=g.length;for(let s=0;s<e;++s){let i=g.charCodeAt(s);if(55296<=i&&i<=56319){if(++s>=e)return v+this.wcwidth(i);const f=g.charCodeAt(s);56320<=f&&f<=57343?i=1024*(i-55296)+f-56320+65536:v+=this.wcwidth(f)}const r=this.charProperties(i,o);let u=n.extractWidth(r);n.extractShouldJoin(r)&&(u-=n.extractWidth(o)),v+=u,o=r}return v}charProperties(g,v){return this._activeProvider.charProperties(g,v)}}t.UnicodeService=n}},V={};function q(O){var t=V[O];if(t!==void 0)return t.exports;var a=V[O]={exports:{}};return te[O].call(a.exports,a,a.exports,q),a.exports}var Q={};return(()=>{var O=Q;Object.defineProperty(O,"__esModule",{value:!0}),O.Terminal=void 0;const t=q(9042),a=q(3236),h=q(844),l=q(5741),n=q(8285),_=q(7975),g=q(7090),v=["cols","rows"];class o extends h.Disposable{constructor(s){super(),this._core=this.register(new a.Terminal(s)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=u=>this._core.options[u],r=(u,f)=>{this._checkReadonlyOptions(u),this._core.options[u]=f};for(const u in this._core.options){const f={get:i.bind(this,u),set:r.bind(this,u)};Object.defineProperty(this._publicOptions,u,f)}}_checkReadonlyOptions(s){if(v.includes(s))throw new Error(`Option "${s}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new _.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new 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 s=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(const i in s)this._publicOptions[i]=s[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,i=!0){this._core.input(s,i)}resize(s,i){this._verifyIntegers(s,i),this._core.resize(s,i)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,i,r){this._verifyIntegers(s,i,r),this._core.select(s,i,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,i){this._verifyIntegers(s,i),this._core.selectLines(s,i)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,i){this._core.write(s,i)}writeln(s,i){this._core.write(s),this._core.write(`\r
9
- `,i)}paste(s){this._core.paste(s)}refresh(s,i){this._verifyIntegers(s,i),this._core.refresh(s,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return t}_verifyIntegers(...s){for(const i of s)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(const i of s)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}O.Terminal=o})(),Q})())})(St);var ci=St.exports,bt={exports:{}};(function(U,ie){(function(te,V){U.exports=V()})(self,()=>(()=>{var te={};return(()=>{var V=te;Object.defineProperty(V,"__esModule",{value:!0}),V.FitAddon=void 0,V.FitAddon=class{activate(q){this._terminal=q}dispose(){}fit(){const q=this.proposeDimensions();if(!q||!this._terminal||isNaN(q.cols)||isNaN(q.rows))return;const Q=this._terminal._core;this._terminal.rows===q.rows&&this._terminal.cols===q.cols||(Q._renderService.clear(),this._terminal.resize(q.cols,q.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const q=this._terminal._core,Q=q._renderService.dimensions;if(Q.css.cell.width===0||Q.css.cell.height===0)return;const O=this._terminal.options.scrollback===0?0:q.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),n=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),_=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-O;return{cols:Math.max(2,Math.floor(_/Q.css.cell.width)),rows:Math.max(1,Math.floor(n/Q.css.cell.height))}}}})(),te})())})(bt);var di=bt.exports,wt={exports:{}};(function(U,ie){(function(te,V){U.exports=V()})(self,()=>(()=>{var te={965:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),n=a(855),_=a(859),g=a(381),v=11,o=v*Float32Array.BYTES_PER_ELEMENT;let e,s=0,i=0,r=0;class u extends _.Disposable{constructor(c,m,d,p){super(),this._terminal=c,this._gl=m,this._dimensions=d,this._optionsService=p,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const S=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,g.createProgram)(S,`#version 300 es
10
- layout (location = 0) in vec2 a_unitquad;
11
- layout (location = 1) in vec2 a_cellpos;
12
- layout (location = 2) in vec2 a_offset;
13
- layout (location = 3) in vec2 a_size;
14
- layout (location = 4) in float a_texpage;
15
- layout (location = 5) in vec2 a_texcoord;
16
- layout (location = 6) in vec2 a_texsize;
17
-
18
- uniform mat4 u_projection;
19
- uniform vec2 u_resolution;
20
-
21
- out vec2 v_texcoord;
22
- flat out int v_texpage;
23
-
24
- void main() {
25
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
26
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
27
- v_texpage = int(a_texpage);
28
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
29
- }`,function(P){let T="";for(let A=1;A<P;A++)T+=` else if (v_texpage == ${A}) { outColor = texture(u_texture[${A}], v_texcoord); }`;return`#version 300 es
30
- precision lowp float;
31
-
32
- in vec2 v_texcoord;
33
- flat in int v_texpage;
34
-
35
- uniform sampler2D u_texture[${P}];
36
-
37
- out vec4 outColor;
38
-
39
- void main() {
40
- if (v_texpage == 0) {
41
- outColor = texture(u_texture[0], v_texcoord);
42
- } ${T}
43
- }`}(l.TextureAtlas.maxAtlasPages))),this.register((0,_.toDisposable)(()=>S.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,h.throwIfFalsy)(S.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=S.createVertexArray(),S.bindVertexArray(this._vertexArrayObject);const y=new Float32Array([0,0,1,0,0,1,1,1]),b=S.createBuffer();this.register((0,_.toDisposable)(()=>S.deleteBuffer(b))),S.bindBuffer(S.ARRAY_BUFFER,b),S.bufferData(S.ARRAY_BUFFER,y,S.STATIC_DRAW),S.enableVertexAttribArray(0),S.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const w=new Uint8Array([0,1,2,3]),L=S.createBuffer();this.register((0,_.toDisposable)(()=>S.deleteBuffer(L))),S.bindBuffer(S.ELEMENT_ARRAY_BUFFER,L),S.bufferData(S.ELEMENT_ARRAY_BUFFER,w,S.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(S.createBuffer()),this.register((0,_.toDisposable)(()=>S.deleteBuffer(this._attributesBuffer))),S.bindBuffer(S.ARRAY_BUFFER,this._attributesBuffer),S.enableVertexAttribArray(2),S.vertexAttribPointer(2,2,S.FLOAT,!1,o,0),S.vertexAttribDivisor(2,1),S.enableVertexAttribArray(3),S.vertexAttribPointer(3,2,S.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(3,1),S.enableVertexAttribArray(4),S.vertexAttribPointer(4,1,S.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(4,1),S.enableVertexAttribArray(5),S.vertexAttribPointer(5,2,S.FLOAT,!1,o,5*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(5,1),S.enableVertexAttribArray(6),S.vertexAttribPointer(6,2,S.FLOAT,!1,o,7*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(6,1),S.enableVertexAttribArray(1),S.vertexAttribPointer(1,2,S.FLOAT,!1,o,9*Float32Array.BYTES_PER_ELEMENT),S.vertexAttribDivisor(1,1),S.useProgram(this._program);const B=new Int32Array(l.TextureAtlas.maxAtlasPages);for(let P=0;P<l.TextureAtlas.maxAtlasPages;P++)B[P]=P;S.uniform1iv(this._textureLocation,B),S.uniformMatrix4fv(this._projectionLocation,!1,g.PROJECTION_MATRIX),this._atlasTextures=[];for(let P=0;P<l.TextureAtlas.maxAtlasPages;P++){const T=new g.GLTexture((0,h.throwIfFalsy)(S.createTexture()));this.register((0,_.toDisposable)(()=>S.deleteTexture(T.texture))),S.activeTexture(S.TEXTURE0+P),S.bindTexture(S.TEXTURE_2D,T.texture),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,S.CLAMP_TO_EDGE),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,S.CLAMP_TO_EDGE),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,1,1,0,S.RGBA,S.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[P]=T}S.enable(S.BLEND),S.blendFunc(S.SRC_ALPHA,S.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(c,m,d,p,S,y,b,w,L){this._updateCell(this._vertices.attributes,c,m,d,p,S,y,b,w,L)}_updateCell(c,m,d,p,S,y,b,w,L,B){s=(d*this._terminal.cols+m)*v,p!==n.NULL_CELL_CODE&&p!==void 0?this._atlas&&(e=w&&w.length>1?this._atlas.getRasterizedGlyphCombinedChar(w,S,y,b,!1):this._atlas.getRasterizedGlyph(p,S,y,b,!1),i=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),S!==B&&e.offset.x>i?(r=e.offset.x-i,c[s]=-(e.offset.x-r)+this._dimensions.device.char.left,c[s+1]=-e.offset.y+this._dimensions.device.char.top,c[s+2]=(e.size.x-r)/this._dimensions.device.canvas.width,c[s+3]=e.size.y/this._dimensions.device.canvas.height,c[s+4]=e.texturePage,c[s+5]=e.texturePositionClipSpace.x+r/this._atlas.pages[e.texturePage].canvas.width,c[s+6]=e.texturePositionClipSpace.y,c[s+7]=e.sizeClipSpace.x-r/this._atlas.pages[e.texturePage].canvas.width,c[s+8]=e.sizeClipSpace.y):(c[s]=-e.offset.x+this._dimensions.device.char.left,c[s+1]=-e.offset.y+this._dimensions.device.char.top,c[s+2]=e.size.x/this._dimensions.device.canvas.width,c[s+3]=e.size.y/this._dimensions.device.canvas.height,c[s+4]=e.texturePage,c[s+5]=e.texturePositionClipSpace.x,c[s+6]=e.texturePositionClipSpace.y,c[s+7]=e.sizeClipSpace.x,c[s+8]=e.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,h.allowRescaling)(p,L,e.size.x,this._dimensions.device.cell.width)&&(c[s+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):c.fill(0,s,s+v-1-2)}clear(){const c=this._terminal,m=c.cols*c.rows*v;this._vertices.count!==m?this._vertices.attributes=new Float32Array(m):this._vertices.attributes.fill(0);let d=0;for(;d<this._vertices.attributesBuffers.length;d++)this._vertices.count!==m?this._vertices.attributesBuffers[d]=new Float32Array(m):this._vertices.attributesBuffers[d].fill(0);this._vertices.count=m,d=0;for(let p=0;p<c.rows;p++)for(let S=0;S<c.cols;S++)this._vertices.attributes[d+9]=S/c.cols,this._vertices.attributes[d+10]=p/c.rows,d+=v}handleResize(){const c=this._gl;c.useProgram(this._program),c.viewport(0,0,c.canvas.width,c.canvas.height),c.uniform2f(this._resolutionLocation,c.canvas.width,c.canvas.height),this.clear()}render(c){if(!this._atlas)return;const m=this._gl;m.useProgram(this._program),m.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const d=this._vertices.attributesBuffers[this._activeBuffer];let p=0;for(let S=0;S<c.lineLengths.length;S++){const y=S*this._terminal.cols*v,b=this._vertices.attributes.subarray(y,y+c.lineLengths[S]*v);d.set(b,p),p+=b.length}m.bindBuffer(m.ARRAY_BUFFER,this._attributesBuffer),m.bufferData(m.ARRAY_BUFFER,d.subarray(0,p),m.STREAM_DRAW);for(let S=0;S<this._atlas.pages.length;S++)this._atlas.pages[S].version!==this._atlasTextures[S].version&&this._bindAtlasPageTexture(m,this._atlas,S);m.drawElementsInstanced(m.TRIANGLE_STRIP,4,m.UNSIGNED_BYTE,0,p/v)}setAtlas(c){this._atlas=c;for(const m of this._atlasTextures)m.version=-1}_bindAtlasPageTexture(c,m,d){c.activeTexture(c.TEXTURE0+d),c.bindTexture(c.TEXTURE_2D,this._atlasTextures[d].texture),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.pages[d].canvas),c.generateMipmap(c.TEXTURE_2D),this._atlasTextures[d].version=m.pages[d].version}setDimensions(c){this._dimensions=c}}t.GlyphRenderer=u},742:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RectangleRenderer=void 0;const h=a(374),l=a(859),n=a(310),_=a(381),g=8*Float32Array.BYTES_PER_ELEMENT;class v{constructor(){this.attributes=new Float32Array(160),this.count=0}}let o=0,e=0,s=0,i=0,r=0,u=0,f=0;class c extends l.Disposable{constructor(d,p,S,y){super(),this._terminal=d,this._gl=p,this._dimensions=S,this._themeService=y,this._vertices=new v,this._verticesCursor=new v;const b=this._gl;this._program=(0,h.throwIfFalsy)((0,_.createProgram)(b,`#version 300 es
44
- layout (location = 0) in vec2 a_position;
45
- layout (location = 1) in vec2 a_size;
46
- layout (location = 2) in vec4 a_color;
47
- layout (location = 3) in vec2 a_unitquad;
48
-
49
- uniform mat4 u_projection;
50
-
51
- out vec4 v_color;
52
-
53
- void main() {
54
- vec2 zeroToOne = a_position + (a_unitquad * a_size);
55
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
56
- v_color = a_color;
57
- }`,`#version 300 es
58
- precision lowp float;
59
-
60
- in vec4 v_color;
61
-
62
- out vec4 outColor;
63
-
64
- void main() {
65
- outColor = v_color;
66
- }`)),this.register((0,l.toDisposable)(()=>b.deleteProgram(this._program))),this._projectionLocation=(0,h.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),L=b.createBuffer();this.register((0,l.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]),P=b.createBuffer();this.register((0,l.toDisposable)(()=>b.deleteBuffer(P))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,P),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(b.createBuffer()),this.register((0,l.toDisposable)(()=>b.deleteBuffer(this._attributesBuffer))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,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(d){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,d.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,d.count)}handleResize(){this._updateViewportRectangle()}setDimensions(d){this._dimensions=d}_updateCachedColors(d){this._bgFloat=this._colorToFloat32Array(d.background),this._cursorFloat=this._colorToFloat32Array(d.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(d){const p=this._terminal,S=this._vertices;let y,b,w,L,B,P,T,A,C,E,R,D=1;for(y=0;y<p.rows;y++){for(w=-1,L=0,B=0,P=!1,b=0;b<p.cols;b++)T=(y*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,A=d.cells[T+n.RENDER_MODEL_BG_OFFSET],C=d.cells[T+n.RENDER_MODEL_FG_OFFSET],E=!!(67108864&C),(A!==L||C!==B&&(P||E))&&((L!==0||P&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,b,y)),w=b,L=A,B=C,P=E);(L!==0||P&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,p.cols,y))}S.count=D}updateCursor(d){const p=this._verticesCursor,S=d.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(d,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}d.attributes.length<p+4&&(d.attributes=(0,_.expandFloat32Array)(d.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,s=L*this._dimensions.device.cell.height,i=(o>>24&255)/255,r=(o>>16&255)/255,u=(o>>8&255)/255,f=1,this._addRectangle(d.attributes,p,e,s,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,r,u,f)}_addRectangle(d,p,S,y,b,w,L,B,P,T){d[p]=S/this._dimensions.device.canvas.width,d[p+1]=y/this._dimensions.device.canvas.height,d[p+2]=b/this._dimensions.device.canvas.width,d[p+3]=w/this._dimensions.device.canvas.height,d[p+4]=L,d[p+5]=B,d[p+6]=P,d[p+7]=T}_addRectangleFloat(d,p,S,y,b,w,L){d[p]=S/this._dimensions.device.canvas.width,d[p+1]=y/this._dimensions.device.canvas.height,d[p+2]=b/this._dimensions.device.canvas.width,d[p+3]=w/this._dimensions.device.canvas.height,d[p+4]=L[0],d[p+5]=L[1],d[p+6]=L[2],d[p+7]=L[3]}_colorToFloat32Array(d){return new Float32Array([(d.rgba>>24&255)/255,(d.rgba>>16&255)/255,(d.rgba>>8&255)/255,(255&d.rgba)/255])}}t.RectangleRenderer=c},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 h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,n){const _=l*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 h=a(820),l=a(274),n=a(627),_=a(457),g=a(56),v=a(374),o=a(345),e=a(859),s=a(147),i=a(782),r=a(855),u=a(965),f=a(742),c=a(310),m=a(733);class d extends e.Disposable{constructor(b,w,L,B,P,T,A,C,E){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=L,this._coreBrowserService=B,this._coreService=P,this._decorationService=T,this._optionsService=A,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 c.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,A,this._themeService)],this.dimensions=(0,v.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(A.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const R={antialias:!1,depth:!1,preserveDrawingBuffer:E};if(this._gl=this._canvas.getContext("webgl2",R),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.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,h.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,P,T;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const A of this._renderLayers)A.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(L=this._rectangleRenderer.value)==null||L.setDimensions(this.dimensions),(B=this._rectangleRenderer.value)==null||B.handleResize(),(P=this._glyphRenderer.value)==null||P.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 f.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new u.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,P,T,A,C,E,R,D,N,W,X,Y,k,x,$=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,G=H-L.buffer.ydisp,j=Math.min(this._terminal.buffer.active.cursorX,L.cols-1);let re=-1;const ee=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ce=!1;for(P=b;P<=w;P++)for(T=P+L.buffer.ydisp,A=L.buffer.lines.get(T),this._model.lineLengths[P]=0,C=this._characterJoinerService.getJoinedCharacters(T),k=0;k<L.cols;k++)if(B=this._cellColorResolver.result.bg,A.loadCell(k,$),k===0&&(B=this._cellColorResolver.result.bg),E=!1,R=k,C.length>0&&k===C[0][0]&&(E=!0,D=C.shift(),$=new p($,A.translateToString(!0,D[0],D[1]),D[1]-D[0]),R=D[1]-1),N=$.getChars(),W=$.getCode(),Y=(P*L.cols+k)*c.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve($,k,T,this.dimensions.device.cell.width),ee&&T===H&&(k===j&&(this._model.cursor={x:j,y:G,width:$.getWidth(),style:this._coreBrowserService.isFocused?L.options.cursorStyle||"block":L.options.cursorInactiveStyle,cursorWidth:L.options.cursorWidth,dpr:this._devicePixelRatio},re=j+$.getWidth()-1),k>=j&&k<=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[P]=k+1),(this._model.cells[Y]!==W||this._model.cells[Y+c.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Y+c.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Y+c.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ce=!0,N.length>1&&(W|=c.COMBINED_CHAR_BIT_MASK),this._model.cells[Y]=W,this._model.cells[Y+c.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Y+c.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Y+c.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=$.getWidth(),this._glyphRenderer.value.updateCell(k,P,W,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,N,X,B),E))for($=this._workCell,k++;k<R;k++)x=(P*L.cols+k)*c.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(k,P,r.NULL_CELL_CODE,0,0,0,r.NULL_CELL_CHAR,0,0),this._model.cells[x]=r.NULL_CELL_CODE,this._model.cells[x+c.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[x+c.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[x+c.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ce&&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=d;class p extends s.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 h=a(374);function l(n,_,g){const v=(0,h.throwIfFalsy)(n.createShader(_));if(n.shaderSource(v,g),n.compileShader(v),n.getShaderParameter(v,n.COMPILE_STATUS))return v;console.error(n.getShaderInfoLog(v)),n.deleteShader(v)}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 v=(0,h.throwIfFalsy)(n.createProgram());if(n.attachShader(v,(0,h.throwIfFalsy)(l(n,n.VERTEX_SHADER,_))),n.attachShader(v,(0,h.throwIfFalsy)(l(n,n.FRAGMENT_SHADER,g))),n.linkProgram(v),n.getProgramParameter(v,n.LINK_STATUS))return v;console.error(n.getProgramInfoLog(v)),n.deleteProgram(v)},t.createShader=l,t.expandFloat32Array=function(n,_){const g=Math.min(2*n.length,_),v=new Float32Array(g);for(let o=0;o<n.length;o++)v[o]=n[o];return v},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 h=a(627),l=a(237),n=a(374),_=a(859);class g extends _.Disposable{constructor(o,e,s,i,r,u,f,c){super(),this._container=e,this._alpha=r,this._coreBrowserService=u,this._optionsService=f,this._themeService=c,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-${s}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,_.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,s){}handleSelectionChanged(o,e,s,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const s=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,s=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*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,s,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,s*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,s*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,s,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(s,i,e.getWidth()),this._ctx.fillText(e.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,s){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,s){return`${s?"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 h=a(197),l=a(237),n=a(592);class _ extends n.BaseRenderLayer{constructor(v,o,e,s,i,r,u){super(e,v,"link",o,!0,i,r,u),this.register(s.onShowLinkUnderline(f=>this._handleShowLinkUnderline(f))),this.register(s.onHideLinkUnderline(f=>this._handleHideLinkUnderline(f)))}resize(v,o){super.resize(v,o),this._state=void 0}reset(v){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const v=this._state.y2-this._state.y1-1;v>0&&this._clearCells(0,this._state.y1+1,this._state.cols,v),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(v){if(v.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:v.fg!==void 0&&(0,h.is256Color)(v.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[v.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,v.y1===v.y2)this._fillBottomLineAtCells(v.x1,v.y1,v.x2-v.x1);else{this._fillBottomLineAtCells(v.x1,v.y1,v.cols-v.x1);for(let o=v.y1+1;o<v.y2;o++)this._fillBottomLineAtCells(0,o,v.cols);this._fillBottomLineAtCells(0,v.y2,v.x2)}this._state=v}_handleHideLinkUnderline(v){this._clearCurrentLink()}}t.LinkRenderLayer=_},820:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,n){a.addEventListener(h,l,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(h,l,n))}}}},274:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),n=a(374);let _,g=0,v=0,o=!1,e=!1,s=!1,i=0;t.CellColorResolver=class{constructor(r,u,f,c,m,d){this._terminal=r,this._optionService=u,this._selectionRenderModel=f,this._decorationService=c,this._coreBrowserService=m,this._themeService=d,this.result={fg:0,bg:0,ext:0}}resolve(r,u,f,c){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,v=0,g=0,e=!1,o=!1,s=!1,_=this._themeService.colors,i=0,r.getCode()!==h.NULL_CELL_CODE&&r.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=u*c%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(u,f,"bottom",m=>{m.backgroundColorRGB&&(v=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),s=this._selectionRenderModel.isCellSelected(this._terminal,u,f),s){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:v=(16777215&this.result.fg)<<8|255;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:v=(16777215&this.result.bg)<<8|255}v=l.rgba.blend(v,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else v=(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=l.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(u,f,"top",m=>{m.backgroundColorRGB&&(v=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(v=s?-16777216&r.bg&-134217729|v|50331648:-16777216&r.bg|v|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&&(v=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?v:this.result.bg,this.result.fg=o?g:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),n=[];t.acquireTextureAtlas=function(_,g,v,o,e,s,i,r){const u=(0,l.generateConfig)(o,e,s,i,g,v,r);for(let m=0;m<n.length;m++){const d=n[m],p=d.ownedBy.indexOf(_);if(p>=0){if((0,l.configEquals)(d.config,u))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),n.splice(m,1)):d.ownedBy.splice(p,1);break}}for(let m=0;m<n.length;m++){const d=n[m];if((0,l.configEquals)(d.config,u))return d.ownedBy.push(_),d.atlas}const f=_._core,c={atlas:new h.TextureAtlas(document,u,f.unicodeService),config:u,ownedBy:[_]};return n.push(c),c.atlas},t.removeTerminalFromCache=function(_){for(let g=0;g<n.length;g++){const v=n[g].ownedBy.indexOf(_);if(v!==-1){n[g].ownedBy.length===1?(n[g].atlas.dispose(),n.splice(g,1)):n[g].ownedBy.splice(v,1);break}}}},197:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,n,_,g,v,o,e){const s={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:v.customGlyphs,devicePixelRatio:e,letterSpacing:v.letterSpacing,lineHeight:v.lineHeight,deviceCellWidth:l,deviceCellHeight:n,deviceCharWidth:_,deviceCharHeight:g,fontFamily:v.fontFamily,fontSize:v.fontSize,fontWeight:v.fontWeight,fontWeightBold:v.fontWeightBold,allowTransparency:v.allowTransparency,drawBoldTextInBrightColors:v.drawBoldTextInBrightColors,minimumContrastRatio:v.minimumContrastRatio,colors:s}},t.configEquals=function(l,n){for(let _=0;_<l.colors.ansi.length;_++)if(l.colors.ansi[_].rgba!==n.colors.ansi[_].rgba)return!1;return l.devicePixelRatio===n.devicePixelRatio&&l.customGlyphs===n.customGlyphs&&l.lineHeight===n.lineHeight&&l.letterSpacing===n.letterSpacing&&l.fontFamily===n.fontFamily&&l.fontSize===n.fontSize&&l.fontWeight===n.fontWeight&&l.fontWeightBold===n.fontWeightBold&&l.allowTransparency===n.allowTransparency&&l.deviceCharWidth===n.deviceCharWidth&&l.deviceCharHeight===n.deviceCharHeight&&l.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&l.minimumContrastRatio===n.minimumContrastRatio&&l.colors.foreground.rgba===n.colors.foreground.rgba&&l.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,s,i,r,u,f,c){const m=t.blockElementDefinitions[e];if(m)return function(y,b,w,L,B,P){for(let T=0;T<b.length;T++){const A=b[T],C=B/8,E=P/8;y.fillRect(w+A.x*C,L+A.y*E,A.w*C,A.h*E)}}(o,m,s,i,r,u),!0;const d=l[e];if(d)return function(y,b,w,L,B,P){let T=n.get(b);T||(T=new Map,n.set(b,T));const A=y.fillStyle;if(typeof A!="string")throw new Error(`Unexpected fillStyle type "${A}"`);let C=T.get(A);if(!C){const E=b[0].length,R=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=E,D.height=R;const N=(0,h.throwIfFalsy)(D.getContext("2d")),W=new ImageData(E,R);let X,Y,k,x;if(A.startsWith("#"))X=parseInt(A.slice(1,3),16),Y=parseInt(A.slice(3,5),16),k=parseInt(A.slice(5,7),16),x=A.length>7&&parseInt(A.slice(7,9),16)||1;else{if(!A.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${A}" when drawing pattern glyph`);[X,Y,k,x]=A.substring(5,A.length-1).split(",").map($=>parseFloat($))}for(let $=0;$<R;$++)for(let H=0;H<E;H++)W.data[4*($*E+H)]=X,W.data[4*($*E+H)+1]=Y,W.data[4*($*E+H)+2]=k,W.data[4*($*E+H)+3]=b[$][H]*(255*x);N.putImageData(W,0,0),C=(0,h.throwIfFalsy)(y.createPattern(D,null)),T.set(A,C)}y.fillStyle=C,y.fillRect(w,L,B,P)}(o,d,s,i,r,u),!0;const p=t.boxDrawingDefinitions[e];if(p)return function(y,b,w,L,B,P,T){y.strokeStyle=y.fillStyle;for(const[A,C]of Object.entries(b)){let E;y.beginPath(),y.lineWidth=T*Number.parseInt(A),E=typeof C=="function"?C(.15,.15/P*B):C;for(const R of E.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,v(W,B,P,w,L,!0,T))}y.stroke(),y.closePath()}}(o,p,s,i,r,u,c),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(y,b,w,L,B,P,T,A){const C=new Path2D;C.rect(w,L,B,P),y.clip(C),y.beginPath();const E=T/12;y.lineWidth=A*E;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,v(W,B,P,w,L,!1,A,(b.leftPadding??0)*(E/2),(b.rightPadding??0)*(E/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()}(o,S,s,i,r,u,f,c),!0)};const n=new Map;function _(o,e,s=0){return Math.max(Math.min(o,e),s)}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 v(o,e,s,i,r,u,f,c=0,m=0){const d=o.map(p=>parseFloat(p)||parseInt(p));if(d.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<d.length;p+=2)d[p]*=e-c*f-m*f,u&&d[p]!==0&&(d[p]=_(Math.round(d[p]+.5)-.5,e,0)),d[p]+=i+c*f;for(let p=1;p<d.length;p+=2)d[p]*=s,u&&d[p]!==0&&(d[p]=_(Math.round(d[p]+.5)-.5,s,0)),d[p]+=r;return d}},56:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,n,_){let g=new n.ResizeObserver(v=>{const o=v.find(i=>i.target===l);if(!o)return;if(!("devicePixelContentBoxSize"in o))return g==null||g.disconnect(),void(g=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,s=o.devicePixelContentBoxSize[0].blockSize;e>0&&s>0&&_(e,s)});try{g.observe(l,{box:["device-pixel-content-box"]})}catch{g.disconnect(),g=void 0}return(0,h.toDisposable)(()=>g==null?void 0:g.disconnect())}},374:(O,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!function(v){return 57344<=v&&v<=63743}(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||function(n){return 9472<=n&&n<=9631}(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,n,_=0){return(l-(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(l,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const v=l.buffers.active.ydisp,o=n[1]-v,e=_[1]-v,s=Math.max(o,0),i=Math.min(e,l.rows-1);s>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=s,this.viewportCappedEndRow=i,this.startCol=n[0],this.endCol=_[0])}isCellSelected(l,n,_){return!!this.hasSelection&&(_-=l.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 h=a(237),l=a(860),n=a(374),_=a(160),g=a(345),v=a(485),o=a(385),e=a(147),s=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let r;class u{get pages(){return this._pages}constructor(p,S,y){this._document=p,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new v.FourKeyMap,this._cacheMapCombined=new v.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,s.DEFAULT_COLOR,s.DEFAULT_COLOR,s.DEFAULT_EXT)){const y=this._drawToCache(S,s.DEFAULT_COLOR,s.DEFAULT_COLOR,s.DEFAULT_EXT);this._cacheMap.set(S,s.DEFAULT_COLOR,s.DEFAULT_COLOR,s.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(u.maxAtlasPages&&this._pages.length>=Math.max(4,u.maxAtlasPages)){const S=this._pages.filter(T=>2*T.canvas.width<=(u.maxTextureSize||4096)).sort((T,A)=>A.canvas.width!==T.canvas.width?A.canvas.width-T.canvas.width:A.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,A)=>T>A?1:-1),B=this.pages.length-w.length,P=this._mergePages(w,B);P.version++;for(let T=L.length-1;T>=0;T--)this._deletePage(L[T]);this.pages.push(P),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(P.canvas)}const p=new f(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 f(this._document,y,p);for(const[w,L]of p.entries()){const B=w*L.canvas.width%y,P=Math.floor(w/2)*L.canvas.height;b.ctx.drawImage(L.canvas,B,P);for(const A of L.glyphs)A.texturePage=S,A.sizeClipSpace.x=A.size.x/y,A.sizeClipSpace.y=A.size.y/y,A.texturePosition.x+=B,A.texturePosition.y+=P,A.texturePositionClipSpace.x=A.texturePosition.x/y,A.texturePositionClipSpace.y=A.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,P,T,A){const C=this._getMinimumContrastColor(p,S,y,b,w,L,B,T,P,A);if(C)return C;let E;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&T&&L<8&&(L+=8),E=this._getColorFromAnsiIndex(L);break;case 50331648:const R=e.AttributeData.toColorRGB(L);E=_.channels.toColor(R[0],R[1],R[2]);break;default:E=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(E=_.color.opaque(E)),P&&(E=_.color.multiplyOpacity(E,h.DIM_OPACITY)),E}_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,P,T,A){if(this._config.minimumContrastRatio===1||A)return;const C=this._getContrastCache(T),E=C.getColor(p,b);if(E!==void 0)return E||void 0;const R=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,L,B,P),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 P=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<P&&(this._tmpCanvas.height=P),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return i;const T=!!this._workAttributeData.isBold(),A=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),E=!!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(),k=this._workAttributeData.getBgColorMode();if(A){const J=W;W=Y,Y=J;const ue=X;X=k,k=ue}const x=this._getBackgroundColor(k,Y,A,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.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=E?"italic":"";this._tmpCtx.font=`${H} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const G=L.length===1&&(0,n.isPowerlineGlyph)(L.charCodeAt(0)),j=L.length===1&&(0,n.isRestrictedPowerlineGlyph)(L.charCodeAt(0)),re=this._getForegroundColor(S,k,Y,y,X,W,A,C,T,(0,n.treatGlyphAsBackgroundColor)(L.charCodeAt(0)));this._tmpCtx.fillStyle=re.css;const ee=j?0:4;let ce=!1;this._config.customGlyphs!==!1&&(ce=(0,l.tryDrawCustomChar)(this._tmpCtx,L,ee,ee,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let pe,Z=!G;if(pe=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)),ue=J%2==1?.5:0;if(this._tmpCtx.lineWidth=J,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Z=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Z=!1;let 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 ve=ee,_e=Math.ceil(ee+this._config.deviceCharHeight)-ue-(w?2*J:0),Re=_e+J,we=_e+2*J;let ne=this._workAttributeData.getUnderlineVariantOffset();for(let me=0;me<pe;me++){this._tmpCtx.save();const fe=ve+me*this._config.deviceCellWidth,he=ve+(me+1)*this._config.deviceCellWidth,le=fe+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(fe,_e),this._tmpCtx.lineTo(he,_e),this._tmpCtx.moveTo(fe,we),this._tmpCtx.lineTo(he,we);break;case 3:const Ee=J<=1?we:Math.ceil(ee+this._config.deviceCharHeight-J/2)-ue,Te=J<=1?_e:Math.ceil(ee+this._config.deviceCharHeight+J/2)-ue,De=new Path2D;De.rect(fe,_e,this._config.deviceCellWidth,we-_e),this._tmpCtx.clip(De),this._tmpCtx.moveTo(fe-this._config.deviceCellWidth/2,Re),this._tmpCtx.bezierCurveTo(fe-this._config.deviceCellWidth/2,Te,fe,Te,fe,Re),this._tmpCtx.bezierCurveTo(fe,Ee,le,Ee,le,Re),this._tmpCtx.bezierCurveTo(le,Te,he,Te,he,Re),this._tmpCtx.bezierCurveTo(he,Ee,he+this._config.deviceCellWidth/2,Ee,he+this._config.deviceCellWidth/2,Re);break;case 4:const ye=ne===0?0:ne>=J?2*J-ne:J-ne;ne>=J||ye===0?(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(fe+ye,_e),this._tmpCtx.lineTo(he,_e)):(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(fe,_e),this._tmpCtx.lineTo(fe+ye,_e),this._tmpCtx.moveTo(fe+ye+J,_e),this._tmpCtx.lineTo(he,_e)),ne=(0,n.computeNextVariantOffset)(he-fe,J,ne);break;case 5:const He=.6,Ne=.3,Be=he-fe,Pe=Math.floor(He*Be),$e=Math.floor(Ne*Be),Ke=Be-Pe-$e;this._tmpCtx.setLineDash([Pe,$e,Ke]),this._tmpCtx.moveTo(fe,_e),this._tmpCtx.lineTo(he,_e);break;default:this._tmpCtx.moveTo(fe,_e),this._tmpCtx.lineTo(he,_e)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ce&&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(ve,_e-Math.ceil(J/2),this._config.deviceCellWidth*pe,we-_e+Math.ceil(J/2)),this._tmpCtx.clip(fe),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(L,ee,ee+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ue=J%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ee,ee+ue),this._tmpCtx.lineTo(ee+this._config.deviceCharWidth*pe,ee+ue),this._tmpCtx.stroke()}if(ce||this._tmpCtx.fillText(L,ee,ee+this._config.deviceCharHeight),L==="_"&&!this._config.allowTransparency){let J=c(this._tmpCtx.getImageData(ee,ee,this._config.deviceCellWidth,this._config.deviceCellHeight),x,re,Z);if(J)for(let ue=1;ue<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(L,ee,ee+this._config.deviceCharHeight-ue),J=c(this._tmpCtx.getImageData(ee,ee,this._config.deviceCellWidth,this._config.deviceCellHeight),x,re,Z),J);ue++);}if(D){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ue=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ee,ee+Math.floor(this._config.deviceCharHeight/2)-ue),this._tmpCtx.lineTo(ee+this._config.deviceCharWidth*pe,ee+Math.floor(this._config.deviceCharHeight/2)-ue),this._tmpCtx.stroke()}this._tmpCtx.restore();const Se=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Ae;if(Ae=this._config.allowTransparency?function(J){for(let ue=0;ue<J.data.length;ue+=4)if(J.data[ue+3]>0)return!1;return!0}(Se):c(Se,x,re,Z),Ae)return i;const de=this._findGlyphBoundingBox(Se,this._workBoundingBox,B,j,ce,ee);let oe,ae;for(;;){if(this._activePages.length===0){const J=this._createNewPage();oe=J,ae=J.currentRow,ae.height=de.size.y;break}oe=this._activePages[this._activePages.length-1],ae=oe.currentRow;for(const J of this._activePages)de.size.y<=J.currentRow.height&&(oe=J,ae=J.currentRow);for(let J=this._activePages.length-1;J>=0;J--)for(const ue of this._activePages[J].fixedRows)ue.height<=ae.height&&de.size.y<=ue.height&&(oe=this._activePages[J],ae=ue);if(ae.y+de.size.y>=oe.canvas.height||ae.height>de.size.y+2){let J=!1;if(oe.currentRow.y+oe.currentRow.height+de.size.y>=oe.canvas.height){let ue;for(const ve of this._activePages)if(ve.currentRow.y+ve.currentRow.height+de.size.y<ve.canvas.height){ue=ve;break}if(ue)oe=ue;else if(u.maxAtlasPages&&this._pages.length>=u.maxAtlasPages&&ae.y+de.size.y<=oe.canvas.height&&ae.height>=de.size.y&&ae.x+de.size.x<=oe.canvas.width)J=!0;else{const ve=this._createNewPage();oe=ve,ae=ve.currentRow,ae.height=de.size.y,J=!0}}J||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),ae={x:0,y:oe.currentRow.y+oe.currentRow.height,height:de.size.y},oe.fixedRows.push(ae),oe.currentRow={x:0,y:ae.y+ae.height,height:0})}if(ae.x+de.size.x<=oe.canvas.width)break;ae===oe.currentRow?(ae.x=0,ae.y+=ae.height,ae.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(ae),1)}return de.texturePage=this._pages.indexOf(oe),de.texturePosition.x=ae.x,de.texturePosition.y=ae.y,de.texturePositionClipSpace.x=ae.x/oe.canvas.width,de.texturePositionClipSpace.y=ae.y/oe.canvas.height,de.sizeClipSpace.x/=oe.canvas.width,de.sizeClipSpace.y/=oe.canvas.height,ae.height=Math.max(ae.height,de.size.y),ae.x+=de.size.x,oe.ctx.putImageData(Se,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,P=b?this._config.deviceCellWidth:y;let T=!1;for(let A=0;A<B;A++){for(let C=0;C<P;C++){const E=A*this._tmpCanvas.width*4+4*C+3;if(p.data[E]!==0){S.top=A,T=!0;break}}if(T)break}S.left=0,T=!1;for(let A=0;A<L+P;A++){for(let C=0;C<B;C++){const E=C*this._tmpCanvas.width*4+4*A+3;if(p.data[E]!==0){S.left=A,T=!0;break}}if(T)break}S.right=P,T=!1;for(let A=L+P-1;A>=L;A--){for(let C=0;C<B;C++){const E=C*this._tmpCanvas.width*4+4*A+3;if(p.data[E]!==0){S.right=A,T=!0;break}}if(T)break}S.bottom=B,T=!1;for(let A=B-1;A>=0;A--){for(let C=0;C<P;C++){const E=A*this._tmpCanvas.width*4+4*C+3;if(p.data[E]!==0){S.bottom=A,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=u;class f{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 c(d,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,L=p.rgba>>>8&255,B=S.rgba>>>24,P=S.rgba>>>16&255,T=S.rgba>>>8&255,A=Math.floor((Math.abs(b-B)+Math.abs(w-P)+Math.abs(L-T))/12);let C=!0;for(let E=0;E<d.data.length;E+=4)d.data[E]===b&&d.data[E+1]===w&&d.data[E+2]===L||y&&Math.abs(d.data[E]-b)+Math.abs(d.data[E+1]-w)+Math.abs(d.data[E+2]-L)<A?d.data[E+3]=0:C=!1;return C}function m(d,p,S){const y=d.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,h=0,l=0,n=0;var _,g,v,o,e;function s(r){const u=r.toString(16);return u.length<2?"0"+u:u}function i(r,u){return r<u?(u+.05)/(r+.05):(r+.05)/(u+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(u,f,c,m){return m!==void 0?`#${s(u)}${s(f)}${s(c)}${s(m)}`:`#${s(u)}${s(f)}${s(c)}`},r.toRgba=function(u,f,c,m=255){return(u<<24|f<<16|c<<8|m)>>>0},r.toColor=function(u,f,c,m){return{css:r.toCss(u,f,c,m),rgba:r.toRgba(u,f,c,m)}}}(_||(t.channels=_={})),function(r){function u(f,c){return n=Math.round(255*c),[a,h,l]=e.toChannels(f.rgba),{css:_.toCss(a,h,l,n),rgba:_.toRgba(a,h,l,n)}}r.blend=function(f,c){if(n=(255&c.rgba)/255,n===1)return{css:c.css,rgba:c.rgba};const m=c.rgba>>24&255,d=c.rgba>>16&255,p=c.rgba>>8&255,S=f.rgba>>24&255,y=f.rgba>>16&255,b=f.rgba>>8&255;return a=S+Math.round((m-S)*n),h=y+Math.round((d-y)*n),l=b+Math.round((p-b)*n),{css:_.toCss(a,h,l),rgba:_.toRgba(a,h,l)}},r.isOpaque=function(f){return(255&f.rgba)==255},r.ensureContrastRatio=function(f,c,m){const d=e.ensureContrastRatio(f.rgba,c.rgba,m);if(d)return _.toColor(d>>24&255,d>>16&255,d>>8&255)},r.opaque=function(f){const c=(255|f.rgba)>>>0;return[a,h,l]=e.toChannels(c),{css:_.toCss(a,h,l),rgba:c}},r.opacity=u,r.multiplyOpacity=function(f,c){return n=255&f.rgba,u(f,n*c/255)},r.toColorRGB=function(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}}(g||(t.color=g={})),function(r){let u,f;try{const c=document.createElement("canvas");c.width=1,c.height=1;const m=c.getContext("2d",{willReadFrequently:!0});m&&(u=m,u.globalCompositeOperation="copy",f=u.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(c){if(c.match(/#[\da-f]{3,8}/i))switch(c.length){case 4:return a=parseInt(c.slice(1,2).repeat(2),16),h=parseInt(c.slice(2,3).repeat(2),16),l=parseInt(c.slice(3,4).repeat(2),16),_.toColor(a,h,l);case 5:return a=parseInt(c.slice(1,2).repeat(2),16),h=parseInt(c.slice(2,3).repeat(2),16),l=parseInt(c.slice(3,4).repeat(2),16),n=parseInt(c.slice(4,5).repeat(2),16),_.toColor(a,h,l,n);case 7:return{css:c,rgba:(parseInt(c.slice(1),16)<<8|255)>>>0};case 9:return{css:c,rgba:parseInt(c.slice(1),16)>>>0}}const m=c.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,h,l,n);if(!u||!f)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=f,u.fillStyle=c,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,h,l,n]=u.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,h,l,n),css:c}}}(v||(t.css=v={})),function(r){function u(f,c,m){const d=f/255,p=c/255,S=m/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.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(f){return u(f>>16&255,f>>8&255,255&f)},r.relativeLuminance2=u}(o||(t.rgb=o={})),function(r){function u(c,m,d){const p=c>>24&255,S=c>>16&255,y=c>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<d&&(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=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function f(c,m,d){const p=c>>24&255,S=c>>16&255,y=c>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<d&&(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=i(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(c,m){if(n=(255&m)/255,n===1)return m;const d=m>>24&255,p=m>>16&255,S=m>>8&255,y=c>>24&255,b=c>>16&255,w=c>>8&255;return a=y+Math.round((d-y)*n),h=b+Math.round((p-b)*n),l=w+Math.round((S-w)*n),_.toRgba(a,h,l)},r.ensureContrastRatio=function(c,m,d){const p=o.relativeLuminance(c>>8),S=o.relativeLuminance(m>>8);if(i(p,S)<d){if(S<p){const w=u(c,m,d),L=i(p,o.relativeLuminance(w>>8));if(L<d){const B=f(c,m,d);return L>i(p,o.relativeLuminance(B>>8))?w:B}return w}const y=f(c,m,d),b=i(p,o.relativeLuminance(y>>8));if(b<d){const w=u(c,m,d);return b>i(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=u,r.increaseLuminance=f,r.toChannels=function(c){return[c>>24&255,c>>16&255,c>>8&255,255&c]}}(e||(t.rgba=e={})),t.toPaddedHex=s,t.contrastRatio=i},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 h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let n=0;n<this._listeners.length;n++)l.push(this._listeners[n]);for(let n=0;n<l.length;n++)l[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a(l=>h.fire(l))},t.runAndSubscribe=function(a,h){return h(void 0),a(l=>h(l))}},859:(O,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var l;this._isDisposed||h===this._value||((l=this._value)==null||l.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},485:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,n,_){this._data[l]||(this._data[l]={}),this._data[l][n]=_}get(l,n){return this._data[l]?this._data[l][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,n,_,g){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(n,_,g)}get(h,l,n,_){var g;return(g=this._data.get(h,l))==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,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(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 v=0,o=0,e=g.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(v=Date.now(),this._tasks[this._i]()||this._i++,v=Math.max(1,Date.now()-v),o=Math.max(v,o),s=g.timeRemaining(),1.5*o>s)return e-v<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-v))}ms`),void this._start();e=s}this.clear()}}class n extends l{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const v=Date.now()+g;return{timeRemaining:()=>Math.max(0,v-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_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 h}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},782:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=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(v){const o=new _;return o.setFromCharData(v),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(v){this.fg=v[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(v[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(v[l.CHAR_DATA_CHAR_INDEX].length===2){const e=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const s=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(e-55296)+s-56320+65536|v[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=v[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=v[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[l.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,h=0,l=a.length){let n="";for(let _=h;_<l;++_){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,h){const l=a.length;if(!l)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?h[n++]=1024*(this._interim-55296)+g-56320+65536:(h[n++]=this._interim,h[n++]=g),this._interim=0}for(let g=_;g<l;++g){const v=a.charCodeAt(g);if(55296<=v&&v<=56319){if(++g>=l)return this._interim=v,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?h[n++]=1024*(v-55296)+o-56320+65536:(h[n++]=v,h[n++]=o)}else v!==65279&&(h[n++]=v)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let n,_,g,v,o=0,e=0,s=0;if(this.interim[0]){let u=!1,f=this.interim[0];f&=(224&f)==192?31:(240&f)==224?15:7;let c,m=0;for(;(c=63&this.interim[++m])&&m<4;)f<<=6,f|=c;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=d-m;for(;s<p;){if(s>=l)return 0;if(c=a[s++],(192&c)!=128){s--,u=!0;break}this.interim[m++]=c,f<<=6,f|=63&c}u||(d===2?f<128?s--:h[o++]=f:d===3?f<2048||f>=55296&&f<=57343||f===65279||(h[o++]=f):f<65536||f>1114111||(h[o++]=f)),this.interim.fill(0)}const i=l-4;let r=s;for(;r<l;){for(;!(!(r<i)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(v=a[r+3]));)h[o++]=n,h[o++]=_,h[o++]=g,h[o++]=v,r+=4;if(n=a[r++],n<128)h[o++]=n;else if((224&n)==192){if(r>=l)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}h[o++]=e}else if((240&n)==224){if(r>=l)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=l)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;h[o++]=e}else if((248&n)==240){if(r>=l)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=l)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(v=a[r++],(192&v)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&v,e<65536||e>1114111)continue;h[o++]=e}}return o}}},776:function(O,t,a){var h=this&&this.__decorate||function(e,s,i,r){var u,f=arguments.length,c=f<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,s,i,r);else for(var m=e.length-1;m>=0;m--)(u=e[m])&&(c=(f<3?u(c):f>3?u(s,i,c):u(s,i))||c);return f>3&&c&&Object.defineProperty(s,i,c),c},l=this&&this.__param||function(e,s){return function(i,r){s(i,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 v,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())),v=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let s=0;s<e.length;s++)typeof e[s]=="function"&&(e[s]=e[s]())}_log(e,s,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...i)}trace(e,...s){var i;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,s)}debug(e,...s){var i;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,s)}info(e,...s){var i;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,s)}warn(e,...s){var i;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,s)}error(e,...s){var i;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,s)}};t.LogService=o=h([l(0,_.IOptionsService)],o),t.setTraceLogger=function(e){v=e},t.traceCall=function(e,s,i){if(typeof i.value!="function")throw new Error("not supported");const r=i.value;i.value=function(...u){if(v.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,u);v.trace(`GlyphRenderer#${r.name}(${u.map(c=>JSON.stringify(c)).join(", ")})`);const f=r.apply(this,u);return v.trace(`GlyphRenderer#${r.name} return`,f),f}}},726:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const n=function(_,g,v){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,s){e[a]===e?e[h].push({id:o,index:s}):(e[h]=[{id:o,index:s}],e[a]=e)})(n,_,v)};return n.toString=()=>l,t.serviceRegistry.set(l,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 h=a(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")}},V={};function q(O){var t=V[O];if(t!==void 0)return t.exports;var a=V[O]={exports:{}};return te[O].call(a.exports,a,a.exports,q),a.exports}var Q={};return(()=>{var O=Q;Object.defineProperty(O,"__esModule",{value:!0}),O.WebglAddon=void 0;const t=q(345),a=q(859),h=q(399),l=q(666),n=q(776);class _ extends a.Disposable{constructor(v){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=v,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(v){const o=v._core;if(!v.element)return void this.register(o.onWillOpen(()=>this.activate(v)));this._terminal=v;const e=o.coreService,s=o.optionsService,i=o,r=i._renderService,u=i._characterJoinerService,f=i._charSizeService,c=i._coreBrowserService,m=i._decorationService,d=i._logService,p=i._themeService;(0,n.setTraceLogger)(d),this._renderer=this.register(new l.WebglRenderer(v,u,f,c,e,m,s,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(v.cols,v.rows)}))}get textureAtlas(){var v;return(v=this._renderer)==null?void 0:v.textureAtlas}clearTextureAtlas(){var v;(v=this._renderer)==null||v.clearTextureAtlas()}}O.WebglAddon=_})(),Q})())})(wt);var ui=wt.exports;const ft=1,_i=[500,1e3,2e3,4e3,8e3],fi=3e3;function vi({url:U,binaryType:ie="arraybuffer",WebSocketImpl:te=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:V=setTimeout,clearTimeoutImpl:q=clearTimeout,backoff:Q=_i,stableMs:O=fi,onOpen:t=()=>{},onMessage:a=()=>{},onState:h=()=>{}}){let l=null,n=0,_=!1,g=0,v=0;const o=typeof U=="function"?U:()=>U,e=()=>{v&&(q(v),v=0)},s=()=>{h(n===0?"connecting":"reconnecting");let f;try{f=new te(o())}catch{r();return}l=f;try{f.binaryType=ie}catch{}f.onopen=()=>{f===l&&(h("open"),v=V(()=>{n=0,v=0},O),t(u))},f.onmessage=c=>{f===l&&a(c)},f.onclose=()=>{f===l&&i()},f.onerror=()=>{}},i=()=>{e(),!_&&r()},r=()=>{h("reconnecting");const f=Q[Math.min(n,Q.length-1)];n++,g=V(()=>{g=0,s()},f)},u={send(f){return l&&l.readyState===ft?(l.send(f),!0):!1},isOpen(){return!!l&&l.readyState===ft},close(){if(_=!0,g&&(q(g),g=0),e(),l)try{l.close()}catch{}l=null},get raw(){return l}};return s(),u}function gi(U){var q;const ie=U.buffer.active;let te=!1,V=!1;for(let Q=ie.baseY;Q<ie.baseY+U.rows;Q++){const O=((q=ie.getLine(Q))==null?void 0:q.translateToString(!0))||"";/^\s{0,6}❯\s+\S/.test(O)&&(te=!0),/esc/i.test(O)&&/(enter|↵|↑|↓|select|confirm)/i.test(O)&&(V=!0)}return te&&V}function pi(U){var ie;return(ie=navigator.clipboard)!=null&&ie.writeText?navigator.clipboard.writeText(U).then(()=>!0).catch(()=>vt(U)):Promise.resolve(vt(U))}function vt(U){var q;const ie=document.activeElement,te=document.createElement("textarea");te.value=U,te.setAttribute("readonly",""),te.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(te);let V=!1;try{te.select(),te.setSelectionRange(0,U.length),V=document.execCommand("copy")}catch{V=!1}te.remove();try{(q=ie==null?void 0:ie.focus)==null||q.call(ie)}catch{}return V||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),V}function mi({sessionId:U,active:ie=!0,onMenu:te}){const V=K.useRef(null),q=K.useRef(null),Q=K.useRef(null),O=K.useRef({cols:0,rows:0}),t=K.useRef(null),a=K.useRef(!1),h=K.useRef(!1),l=K.useRef(!0),[n,_]=K.useState(!1),[g,v]=K.useState("connecting"),o=K.useRef(te);return o.current=te,K.useEffect(()=>{a.current=!1,h.current=!1;const e=new ci.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"}});q.current=e;const s=new di.FitAddon;e.loadAddon(s),e.open(V.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`,u=()=>{try{const T=V.current;if(T&&T.clientWidth>=40&&T.clientHeight>=40){const A=s.proposeDimensions();if(A&&A.cols>0&&A.rows>0&&!(A.cols<20&&T.clientWidth>200))return a.current=!0,`${r}?cols=${A.cols}&rows=${A.rows}`}}catch{}return a.current=!1,r};let f=null;const c=()=>{const T=V.current;if(!T||T.clientWidth<40||T.clientHeight<40)return;try{s.fit()}catch{return}const{cols:A,rows:C}=e;if(!A||!C||A<20&&T.clientWidth>200)return;const E=O.current;if(A===E.cols&&C===E.rows)return;O.current={cols:A,rows:C};const R=l.current;l.current=!1,f!=null&&f.isOpen()&&f.send(JSON.stringify({t:"resize",cols:A,rows:C,full:R}))};t.current=c;let m=[],d=0;const p=()=>{if(d=0,!m.length)return;let T=0;for(const E of m)T+=E.length;const A=new Uint8Array(T);let C=0;for(const E of m)A.set(E,C),C+=E.length;m=[],e.write(A)};f=vi({url:u,onState:v,onOpen:()=>{m=[],d&&(cancelAnimationFrame(d),d=0),e.reset(),l.current=!0,O.current={cols:0,rows:0},c()},onMessage:T=>{T.data instanceof ArrayBuffer&&(m.push(new Uint8Array(T.data)),d||(d=requestAnimationFrame(p)))}}),e.attachCustomWheelEventHandler(T=>{const A=V.current;if(A&&e.cols&&e.rows){const C=A.getBoundingClientRect(),E=(W,X)=>Math.min(X,Math.max(1,W)),R=E(Math.floor((T.clientX-C.left)/(C.width/e.cols))+1,e.cols),D=E(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)));f!=null&&f.isOpen()&&f.send(JSON.stringify({t:"wheel",up:T.deltaY<0,col:R,row:D,ticks:N}))}return T.preventDefault(),!1});let S;const y=V.current,b=T=>{if(!(T.metaKey||T.ctrlKey)||T.key!=="c"&&T.key!=="C"||!y||y.offsetParent===null)return;const A=e.getSelection();if(!A)return;const C=document.activeElement;C&&(C.tagName==="TEXTAREA"||C.tagName==="INPUT")&&C.selectionStart!==C.selectionEnd||(T.preventDefault(),T.stopPropagation(),pi(A).then(E=>{E&&(_(!0),clearTimeout(S),S=setTimeout(()=>_(!1),1200))}))};document.addEventListener("keydown",b);const w=requestAnimationFrame(c),L=V.current.closest(".si-term");L&&L.addEventListener("animationend",c);const B=[60,180,320].map(T=>setTimeout(c,T)),P=new ResizeObserver(c);return P.observe(V.current),window.addEventListener("resize",c),()=>{cancelAnimationFrame(w),d&&cancelAnimationFrame(d),clearTimeout(S),document.removeEventListener("keydown",b),B.forEach(clearTimeout),L&&L.removeEventListener("animationend",c),P.disconnect(),window.removeEventListener("resize",c),f.close(),e.dispose(),q.current=null,Q.current=null,t.current=null}},[U]),K.useEffect(()=>{const e=q.current;if(!e||!ie)return;const s=setInterval(()=>{var i;try{(i=o.current)==null||i.call(o,U,gi(e))}catch{}},700);return()=>{var i;clearInterval(s),(i=o.current)==null||i.call(o,U,!1)}},[U,ie]),K.useEffect(()=>{const e=q.current;if(e){if(ie){if(!Q.current)try{const s=new ui.WebglAddon;s.onContextLoss(()=>{try{s.dispose()}catch{}Q.current=null,O.current={cols:0,rows:0},requestAnimationFrame(()=>{var i;(i=t.current)==null||i.call(t);try{e.refresh(0,e.rows-1)}catch{}})}),e.loadAddon(s),Q.current=s}catch{Q.current=null}h.current||(h.current=!0,a.current||(e.reset(),l.current=!0,O.current={cols:0,rows:0})),requestAnimationFrame(()=>{var s;(s=t.current)==null||s.call(t);try{e.refresh(0,e.rows-1)}catch{}})}else if(Q.current){try{Q.current.dispose()}catch{}Q.current=null}}},[U,ie]),F.jsxs("div",{className:"st-wrap",children:[F.jsx("div",{className:"st-host",ref:V}),n&&F.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!n&&g==="reconnecting"&&F.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const Si=[{id:"claude",label:"Claude Code",Glyph:$t},{id:"codex",label:"Codex",Glyph:Wt}],gt=Object.fromEntries(Si.map(U=>[U.id,U]));function Ci({menu:U,onClose:ie,onChanged:te,onMultiSelect:V}){const q=qe(),[Q,O]=K.useState(null),[t,a]=K.useState(null),[h,l]=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]),ze(!!U,ie),ze(!!Q,()=>O(null)),ze(!!t,()=>a(null)),K.useEffect(()=>{Q&&requestAnimationFrame(()=>{var r;return(r=g.current)==null?void 0:r.select()})},[Q]);const v=r=>{var u;r.stopPropagation(),l((((u=U.session.raw)==null?void 0:u.name)??U.session.name)||""),O(U.session),ie()},o=r=>{r.stopPropagation(),V==null||V(U.session),ie()},e=r=>{r.stopPropagation(),a(U.session),ie()},s=()=>{const{id:r}=t;a(null),Ze(`/api/sessions/${r}/close`,{method:"POST"}).catch(()=>{}).finally(()=>te==null?void 0:te())},i=async r=>{if(r.preventDefault(),!n){_(!0);try{await Ze(`/api/sessions/${Q.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})}),te==null||te()}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:v,children:q("sessionWindow.rename")}),F.jsx("button",{className:"sess-menu-item",onClick:o,children:q("sessionWindow.select")}),F.jsx("button",{className:"sess-menu-item danger",onClick:e,children:q("sessionWindow.close")})]}),Q&&F.jsx(Qe,{title:q("sessionWindow.renameTitle",{name:dt(Q)}),closeLabel:q("common.close"),className:"sess-rename-modal",onClose:()=>O(null),children:F.jsxs("form",{className:"sess-rename",onSubmit:i,children:[F.jsx("input",{ref:g,className:"sess-rename-input",value:h,autoFocus:!0,placeholder:q("sessionWindow.renamePlaceholder"),onChange:r=>l(r.target.value)}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>O(null),children:q("common.cancel")}),F.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:n,children:q("common.save")})]})]})}),t&&F.jsx(Qe,{title:q("sessionWindow.closeTitle",{name:dt(t)}),closeLabel:q("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:q("sessionWindow.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>a(null),children:q("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:s,children:q("sessionWindow.close")})]})]})})]})}function bi({ids:U,onCancel:ie,onClosed:te}){const V=qe(),[q,Q]=K.useState(!1),O=U.length;ze(q,()=>Q(!1));const t=()=>{Q(!1),Promise.all(U.map(a=>Ze(`/api/sessions/${a}/close`,{method:"POST"}).catch(()=>{}))).finally(()=>te==null?void 0:te())};return F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"si-selbar",children:[F.jsx("span",{className:"si-selcount",children:V("sessionSelect.selected",{n:O})}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",disabled:O===0,onClick:()=>Q(!0),children:V("sessionSelect.close")}),F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:ie,children:V("common.cancel")})]}),q&&F.jsx(Qe,{"data-tip":V("sessionSelect.closeTitle",{n:O}),closeLabel:V("common.close"),className:"sess-rename-modal",onClose:()=>Q(!1),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:V("sessionSelect.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>Q(!1),children:V("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:t,children:V("sessionSelect.close")})]})]})})]})}function wi({sessionId:U,specs:ie=[],sessions:te=[],onOpenSession:V}){var u;const q=qe(),[Q,O]=K.useState(null),[t,a]=K.useState(!1),[h,l]=K.useState(null),n=K.useRef(0),_=K.useCallback(()=>{const f=++n.current;return fetch(`/api/sessions/${encodeURIComponent(U)}/evals`).then(c=>c.ok?c.json():Promise.reject()).then(c=>{f===n.current&&O(c)}).catch(()=>{f===n.current&&O(!1)})},[U]);K.useEffect(()=>{O(null),l(null),a(!1),_()},[U,_]);const g=K.useMemo(()=>Q?Q.nodes.map(f=>{const c=Ut(f.scenarios,f.evals),m=c.filter(p=>!p.reading).map(p=>({blind:!0,scenario:p.name,expected:p.expected,tags:p.tags,node:f.id,hue:f.hue,state:"missing"})),d=c.filter(p=>p.reading).map(p=>({...p.reading,expected:p.expected??p.reading.expected,state:p.state,node:f.id,hue:f.hue})).sort((p,S)=>Number(S.inSession)-Number(p.inSession)||(p.ts<S.ts?1:-1));return{node:f,blind:m,rows:d,sessionN:d.filter(p=>p.inSession).length}}):[],[Q]),v=g.reduce((f,c)=>f+c.sessionN,0),o=K.useMemo(()=>g.flatMap(f=>[...f.blind.map(c=>({kind:"blind",key:`blind:${c.node}·${c.scenario}`,item:c})),...f.rows.filter(c=>!t||c.inSession).map(c=>({kind:"eval",key:jt(c),item:c}))]),[g,t]),e=h&&o.some(f=>f.key===h)?h:((u=o[0])==null?void 0:u.key)??null,s=o.find(f=>f.key===e),i=K.useMemo(()=>{if((s==null?void 0:s.kind)!=="eval")return;const f=Q==null?void 0:Q.nodes.find(c=>c.id===s.item.node);return f?f.evals.filter(c=>c.scenario===s.item.scenario):void 0},[Q,s]);if(Q===null)return F.jsx("div",{className:"fv-note",children:q("common.loading")});if(Q===!1)return F.jsx("div",{className:"fv-note",children:q("sessionEval.none")});const r=(s==null?void 0:s.kind)==="eval"?F.jsx(ai,{entry:s.item,history:i,specs:ie,sessions:te,onOpenSession:V,onWrite:_}):(s==null?void 0:s.kind)==="blind"?F.jsxs("div",{className:"an-detail",children:[F.jsxs("header",{className:"an-head",children:[F.jsx("span",{className:"an-title",children:s.item.scenario}),F.jsx("span",{className:"an-node",children:s.item.node})]}),s.item.expected&&F.jsxs("div",{className:"an-expected",children:[F.jsx("b",{children:q("nodeView.eval.expected")})," ",s.item.expected]}),F.jsx("div",{className:"an-hint",children:q("sessionEval.blindHint")})]}):F.jsx("div",{className:"fv-note",children:q("sessionEval.empty")});return F.jsxs("div",{className:"se-pane",children:[F.jsxs("div",{className:"se-gates",children:[Q.gates.map(f=>F.jsxs("span",{className:`se-gate ${f.ok?"ok":"bad"}`,"data-tip":f.detail,children:[f.ok?"✓":"✗"," ",f.label]},f.label)),v>0&&F.jsx("button",{className:`ef-chip ef-stale ${t?"on":""}`,onClick:()=>a(f=>!f),children:q("sessionEval.sessionN",{n:v})}),F.jsx("a",{className:"se-export",href:`/api/sessions/${encodeURIComponent(U)}/evals?format=html`,target:"_blank",rel:"noreferrer","data-tip":q("sessionEval.exportTitle"),"aria-label":q("sessionEval.export"),children:F.jsx(Fe,{name:"download",size:13})})]}),F.jsx(hi,{rowKeys:o.map(f=>f.key),sel:e,onSel:l,detail:r,children:F.jsxs("div",{className:"fv-scroll",children:[o.length===0&&F.jsx("div",{className:"fv-note",children:q("sessionEval.empty")}),g.map(f=>{const c=o.filter(m=>m.item.node===f.node.id);return!c.length&&!f.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(${f.node.hue} 60% 60%)`},children:f.node.title}),f.node.uncoveredFrontend&&F.jsx("span",{className:"se-warn",children:q("sessionEval.noEvalFile")})]}),c.map((m,d)=>{const p=m.kind==="eval"&&!m.item.inSession&&d>0&&c[d-1].kind==="eval"&&c[d-1].item.inSession,S=m.kind==="blind"?F.jsxs("button",{className:`ef-row se-blind ${e===m.key?"sel":""}`,onClick:()=>l(m.key),children:[F.jsx(zt,{state:"missing"}),F.jsx("span",{className:"ef-scenario",children:m.item.scenario}),F.jsx("span",{className:"ef-time",children:q("sessionEval.unmeasured")})]},m.key):F.jsx(qt,{e:m.item,selected:e===m.key,onClick:()=>l(m.key)},m.key);return p?[F.jsx("div",{className:"se-divider",children:q("sessionEval.inherited")},`div:${f.node.id}`),S]:S})]},f.node.id)})]})})]})}const yi=[{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:"stop",color:"muted",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.stopTitle",descKey:"session.cmd.stopDesc"},{name:"close",color:"red",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function Ei(U,ie){return yi.filter(te=>te.when(U)).map(te=>({...te,run:ie[te.name]}))}const pt=()=>F.jsx(Fe,{name:"paperclip",size:15}),mt=()=>F.jsx(Fe,{name:"loader",size:15,className:"si-attach-busy"}),xi={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End"," ":"Space"},Je=U=>{var ie;return U.isComposing||((ie=U.nativeEvent)==null?void 0:ie.isComposing)||U.keyCode===229};function Li(U){const ie=xi[U.key],te=U.ctrlKey||U.altKey||U.metaKey;let V=null;if(ie?V=ie:te?/^Key[A-Z]$/.test(U.code)?V=U.shiftKey?U.code.slice(3):U.code.slice(3).toLowerCase():/^Digit[0-9]$/.test(U.code)?V=U.code.slice(5):U.key.length===1&&(V=U.key):U.key.length===1&&(V=U.key),V==null)return null;let q="";return U.ctrlKey&&(q+="C-"),(U.altKey||U.metaKey)&&(q+="M-"),U.shiftKey&&ie&&(q+="S-"),q+V}function Bi({sessions:U,specs:ie=[],focusNode:te,open:V,searchOpen:q=!1,sel:Q,setSel:O,seed:t,onSeedConsumed:a,onClose:h,onPickSession:l,onOpenSession:n,onOpenSearch:_,reload:g}){const v=qe(),[o,e]=K.useState(""),[s,i]=K.useState(null),[r,u]=K.useState(null),[f,c]=K.useState(!1),[m,d]=K.useState(()=>new Set),[p,S]=K.useState([]),[y,b]=K.useState({}),{launchers:w,launcher:L,pickLauncher:B}=ii(),[P,T]=K.useState(!1),[A,C]=K.useState(null),[E,R]=K.useState(!1),[D,N]=K.useState({}),[W,X]=K.useState("terminal"),[Y,k]=K.useState(!1),x=Y&&W==="eval",[$,H]=K.useState(!1),[G,j]=K.useState(!1),[re,ee]=K.useState(null),[ce,pe]=K.useState(null),Z=K.useRef(null),Se=K.useRef(null),Ae=K.useRef(null),de=K.useRef(null),oe=K.useRef(null),ae=K.useRef("new"),{expanded:J,toggle:ue}=Kt(),ve=K.useMemo(()=>Gt(U,M=>J.has(M)),[U,J]),_e=K.useMemo(()=>ve.filter(M=>M.type==="row").map(M=>M.s),[ve]),Re=K.useMemo(()=>["new",..._e.map(M=>M.id)],[_e]),we=K.useMemo(()=>new Set(["new",...U.map(M=>M.id)]),[U]),ne=we.has(Q)?Q:"new";K.useEffect(()=>{V&&!we.has(Q)&&O("new")},[V,we,Q,O]);const[me,fe]=oi("spex.siListWidth",240,{min:180,max:480}),he=(te==null?void 0:te.id)||null,le=U.find(M=>M.id===ne),Ee=(le==null?void 0:le.liveness)==="offline",Te=Ee&&(le==null?void 0:le.status)!=="queued",De=y[ne]||"",ye=M=>b(I=>({...I,[ne]:M}));K.useEffect(()=>{const M=(le==null?void 0:le.harness)||"claude";fetch(`/api/slash-commands?harness=${M}`).then(I=>I.json()).then(I=>{Array.isArray(I)&&S(I)}).catch(()=>{})},[le==null?void 0:le.harness]);const He=si();K.useEffect(()=>{R(!1),T(!1),i(null),X("terminal")},[ne]),K.useEffect(()=>{k(W==="eval")},[W]),K.useEffect(()=>{W==="terminal"&&ne!=="new"&&!E&&le&&le.liveness!=="offline"&&requestAnimationFrame(()=>{var M;return(M=Se.current)==null?void 0:M.focus()})},[W]),K.useEffect(()=>{(le==null?void 0:le.liveness)==="offline"&&R(!1)},[le==null?void 0:le.liveness]),K.useEffect(()=>{C(null)},[ne]);const Ne=K.useRef(!1);K.useEffect(()=>{var M;Ne.current&&!E&&ne!=="new"&&(le==null?void 0:le.liveness)!=="offline"&&((M=Se.current)==null||M.focus()),Ne.current=E},[E]);const Be=K.useRef(new Map),Pe=M=>{const I=Be.current.get(M);if(!I||I.busy||I.keys.length===0)return;const z=I.keys;I.keys=[],I.busy=!0,fetch(`/api/sessions/${M}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"keys",keys:z})}).catch(()=>{}).finally(()=>{I.busy=!1,Pe(M)})},$e=M=>{const I=ne;let z=Be.current.get(I);z||(z={keys:[],busy:!1},Be.current.set(I,z)),z.keys.push(M),Pe(I)},Ke=(M,I)=>N(z=>z[M]===I?z:{...z,[M]:I}),[yt,Et]=K.useState(()=>new Set);K.useEffect(()=>{Et(M=>{const I=new Set;for(const z of U)z.liveness!=="offline"&&I.add(z.id);if(I.size!==M.size)return I;for(const z of I)if(!M.has(z))return I;return M})},[U]),K.useEffect(()=>{t!=null&&(O("new"),e(t),i(null),a==null||a(),requestAnimationFrame(()=>{const M=Z.current;M&&(M.focus(),M.setSelectionRange(t.length,t.length))}))},[t]),K.useEffect(()=>{if(!V)return;const M=setTimeout(()=>{var I,z;ne==="new"?(I=Z.current)==null||I.focus():le&&le.liveness!=="offline"&&((z=Se.current)==null||z.focus())},0);return()=>clearTimeout(M)},[V,ne,le==null?void 0:le.liveness]),K.useEffect(()=>{const M=Z.current;!M||ne!=="new"||!V||ut(M,parseFloat(getComputedStyle(M).maxHeight)||1/0)},[o,ne,V]),K.useEffect(()=>{var z;const M=Se.current;if(!M||ne==="new"||!V)return;const I=Math.round((((z=de.current)==null?void 0:z.clientHeight)||360)*.5);M.style.maxHeight=`${I}px`,ut(M,I)},[De,ne,V,W,E]);const xt=M=>M.replace(ti,(I,z)=>{const se=ie.find(ge=>ge.id===z);return se?`[[${se.id}]] (${se.path})`:I}),Lt=()=>{const M=o.trim();if(!M)return;const I=ri(M,He,ie);e(""),ni(I,L).then(()=>g==null?void 0:g())},Rt=(M,I)=>{const z=Qt(M,I,ie,he);if(z)return z;const se=ei(M,I,U);if(se)return se;if(ne==="new"){const Ce=M.match(/^\/(\S*)$/);if(Ce){const xe=_t(He,Ce[1]);return xe.length?{kind:"config",items:xe,index:0,start:0,end:M.length,query:Ce[1]}:null}return null}const ge=M.match(/^\/(\S*)$/);if(ge){const Ce=Ue.map(be=>({name:be.name,description:v(be.descKey),ui:!0,color:be.color})),xe=new Set(Ce.map(be=>be.name)),Le=_t([...Ce,...p.filter(be=>!xe.has(be.name))],ge[1]);return Le.length?{kind:"slash",items:Le,index:0,start:0,end:M.length,query:ge[1]}:null}return null},We=M=>i(M?Rt(M.value,M.selectionStart):null),Dt=M=>i(I=>I&&{...I,index:(I.index+M+I.items.length)%I.items.length}),Ge=M=>{if(!M||!s)return;if(s.kind==="slash"){if(M.ui){const Me=Ue.find(Xe=>Xe.name===M.name);ye(""),i(null),Me==null||Me.run();return}const be=`/${M.name} `,Oe=De.slice(0,s.start);ye(Oe+be+De.slice(s.end)),i(null);const je=Oe.length+be.length;requestAnimationFrame(()=>{const Me=Se.current;Me&&(Me.focus(),Me.setSelectionRange(je,je))});return}const I=s.kind==="config"?`/${M.name} `:s.kind==="actor"?`@${M.id} `:`[[${M.id}]] `,z=(s.kind==="mention"||s.kind==="actor")&&ne!=="new",se=z?Se:Z,ge=z?De:o,Ce=z?ye:e,xe=ge.slice(0,s.start);Ce(xe+I+ge.slice(s.end)),i(null);const Le=xe.length+I.length;requestAnimationFrame(()=>{const be=se.current;be&&(be.focus(),be.setSelectionRange(Le,Le))})},et=(M,I)=>F.jsx(Jt,{menu:s,up:M,head:I,onPick:Ge,onHover:z=>i(se=>se&&{...se,index:z})}),tt=M=>F.jsx(Zt,{menu:s,up:M,onPick:Ge,onHover:I=>i(z=>z&&{...z,index:I})}),kt=async()=>{const M=De;if(!M.trim()||ne==="new")return;const I=Ue.find(se=>M.trim()===`/${se.name}`);if(I){ye(""),i(null),I.run();return}const z=xt(M);ye(""),T(!1);try{const se=await fetch(`/api/sessions/${ne}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"text",text:z})});if(!se.ok)throw new Error(`input ${se.status}`)}catch{ye(M),T(!0)}},At=async M=>{const I=new FormData;I.append("file",M,M.name||"pasted");const z=await fetch("/api/uploads",{method:"POST",body:I});if(!z.ok)throw new Error(`upload ${z.status}`);const se=await z.json().catch(()=>null);if(!(se!=null&&se.path))throw new Error("upload: no path");return se.path},it=(M,I,z,se)=>{const ge=M.current,Ce=ge?ge.selectionStart:I.length,xe=ge?ge.selectionEnd:I.length,Le=I.slice(0,Ce),be=(Le&&!/\s$/.test(Le)?" ":"")+se+" ";z(Le+be+I.slice(xe)),requestAnimationFrame(()=>{if(!ge)return;ge.focus();const Oe=Le.length+be.length;ge.setSelectionRange(Oe,Oe)})},Ve=async(M,I)=>{const z=[...M||[]];if(!(!z.length||$)){j(!1),pe(I),H(!0);try{const se=[];for(const ge of z)se.push(await At(ge));I==="new"?it(Z,o,e,se.join(" ")):it(Se,De,ye,se.join(" "))}catch{j(!0)}finally{H(!1)}}},st=(M,I)=>{var se;const z=(se=M.clipboardData)==null?void 0:se.files;z&&z.length&&(M.preventDefault(),Ve(z,I))},rt=(M,I)=>{var z;M.preventDefault(),ee(null),Ve((z=M.dataTransfer)==null?void 0:z.files,I)},nt=(M,I)=>{var z;[...((z=M.dataTransfer)==null?void 0:z.types)||[]].includes("Files")&&(M.preventDefault(),ee(I))},ot=M=>{var I;ae.current=M,(I=oe.current)==null||I.click()},Ie=async M=>{C(null);try{const I=await fetch(`/api/sessions/${ne}/${M}`,{method:"POST"});if(!I.ok){const z=await I.json().catch(()=>null);z!=null&&z.error&&C(z.error)}}catch{}await(g==null?void 0:g())},Mt=M=>{c(!0),d(new Set([M.id]))},at=()=>{c(!1),d(new Set)},Tt=M=>d(I=>{const z=new Set(I);return z.has(M)?z.delete(M):z.add(M),z}),Bt=()=>{at(),g==null||g()},Ot={type:()=>R(M=>!M),eval:()=>X("eval"),merge:()=>Ie("merge"),stop:()=>Ie("stop"),close:()=>Ie("close")},Ue=Ei(le==null?void 0:le.status,Ot),ht=K.useRef({});ht.current={order:Re,active:ne,submit:Lt,menu:s,navMenu:Dt,accept:Ge,setMenu:i,onClose:h,open:V,searchOpen:q,typeMode:E,setTypeMode:R,sendRawKey:$e},K.useEffect(()=>{const M=I=>{var ct;const{order:z,active:se,submit:ge,menu:Ce,navMenu:xe,accept:Le,setMenu:be,onClose:Oe,open:je,searchOpen:Me,typeMode:Xe,setTypeMode:Ht,sendRawKey:lt}=ht.current;if(!je||Me)return;const Nt=I.code==="KeyI"||I.key==="i"||I.key==="I";if(I.altKey!==I.metaKey&&Nt&&se!=="new"){I.preventDefault(),I.stopPropagation(),Ht(ke=>!ke);return}if(!(I.altKey&&!I.metaKey&&!I.ctrlKey&&["KeyN","KeyF","Digit1","Digit2","Digit3","Digit4"].includes(I.code))){if((I.metaKey||I.altKey||I.ctrlKey)&&(I.key==="ArrowUp"||I.key==="ArrowDown")){I.preventDefault(),I.stopPropagation();let ke=z.indexOf(se);ke<0&&(ke=0);const Ye=Math.max(0,Math.min(z.length-1,ke+(I.key==="ArrowDown"?1:-1)));O(z[Ye]);return}if(Xe&&se!=="new"){if(I.preventDefault(),I.stopPropagation(),I.key==="Escape"){lt("Escape");return}const ke=Li(I);ke&&lt(ke);return}if(Ce){if(I.key==="ArrowDown"){I.preventDefault(),I.stopPropagation(),xe(1);return}if(I.key==="ArrowUp"){I.preventDefault(),I.stopPropagation(),xe(-1);return}if((I.key==="Enter"||I.key==="Tab")&&!Je(I)){I.preventDefault(),I.stopPropagation(),Le(Ce.items[Ce.index]);return}if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),be(null);return}}if(I.key==="ArrowUp"||I.key==="ArrowDown"){if(((ct=I.target)==null?void 0:ct.tagName)==="TEXTAREA")return;I.preventDefault(),I.stopPropagation();const ke=z.indexOf(se),Ye=Math.max(0,Math.min(z.length-1,ke+(I.key==="ArrowDown"?1:-1)));O(z[Ye]);return}I.key==="Enter"&&!I.shiftKey&&!Je(I)&&se==="new"&&(I.preventDefault(),I.stopPropagation(),ge())}};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[O]);const Pt=M=>M&&(M.tagName==="TEXTAREA"||M.tagName==="INPUT"||M.isContentEditable),It=()=>{const M=Z.current||Se.current;M&&requestAnimationFrame(()=>M.focus())},Ft=M=>{if(M.stopPropagation(),M.button!==0)return;const I=M.target;Pt(I)||I.closest&&I.closest("select")||I.closest&&I.closest(".si-term-body")||I.closest&&I.closest(".se-pane")||M.preventDefault()};return K.useEffect(()=>{if(!V)return;const M=I=>{var z;(z=Ae.current)!=null&&z.contains(I.target)&&(I.preventDefault(),It())};return window.addEventListener("contextmenu",M,!0),()=>window.removeEventListener("contextmenu",M,!0)},[V]),F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"si-page",style:V?void 0:{display:"none"},children:F.jsxs("div",{className:"si-panel",ref:Ae,onMouseDown:Ft,children:[F.jsx("input",{ref:oe,type:"file",multiple:!0,style:{display:"none"},onChange:M=>{Ve(M.target.files,ae.current),M.target.value=""}}),x&&F.jsx(li,{className:"si-list-unfold",folded:!0,onToggle:()=>k(!1)}),F.jsxs("aside",{className:"si-list",style:x?{display:"none"}:{flex:`0 0 ${me}px`},children:[f?F.jsx(bi,{ids:[...m],onCancel:at,onClosed:Bt}):F.jsxs("div",{className:"si-toprow",children:[F.jsx("button",{className:ne==="new"?"si-pill new on":"si-pill new","data-tip":v("session.newSessionTitle"),"aria-label":v("session.newSessionTitle"),onClick:()=>O("new"),children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(Fe,{name:"plus",size:15,strokeWidth:2})})}),F.jsx("button",{className:"si-pill search","data-tip":v("session.searchTitle"),"aria-label":v("session.searchTitle"),onClick:_,children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(Fe,{name:"search",size:15})})})]}),ve.map(M=>{var ge;if(M.type==="zone")return F.jsx("div",{className:`si-zone si-zone-${M.zone}`,children:v(`sessionZone.${M.zone}`)},`zone-${M.zone}`);const I=M.s,z=M.expandable||M.depth?F.jsx(Vt,{guides:M.guides,expandable:M.expandable,expanded:M.expanded,rollup:M.rollup,kin:M.kin,onToggle:()=>ue(I.id)}):null,se=f&&m.has(I.id);return F.jsxs("button",{"data-sid":I.id,className:`si-item${!f&&ne===I.id?" on":""}${se?" picked":""}`,style:{"--ov":Yt(I.id)},onClick:()=>f?Tt(I.id):O(I.id),onDoubleClick:()=>{!f&&l&&(l(I,!1),h())},onContextMenu:Ce=>{Ce.preventDefault(),Ce.stopPropagation(),f||u({x:Ce.clientX,y:Ce.clientY,session:I})},"data-tip":(ge=I.ops)!=null&&ge.length?v("session.opsTitle"):v("session.lockTitle"),children:[f&&F.jsx("span",{className:`si-check${se?" on":""}`,"aria-hidden":"true"}),F.jsx(Xt,{s:I,locked:!1,showAvatar:!1,lead:z})]},I.id)})]}),!x&&F.jsx("div",{className:"pane-resizer si-resizer",onMouseDown:fe,role:"separator","aria-orientation":"vertical"}),F.jsxs("section",{className:ne==="new"?"si-content is-new":"si-content is-session",children:[ne==="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:v("session.ask")}),F.jsxs("div",{className:re==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:M=>nt(M,"new"),onDragLeave:()=>ee(null),onDrop:M=>rt(M,"new"),children:[F.jsx("textarea",{ref:Z,className:"si-input","data-focus-sink":!0,rows:1,value:o,onChange:M=>{e(M.target.value),We(M.target)},onSelect:M=>We(M.target),onPaste:M=>st(M,"new"),onBlur:()=>i(null),placeholder:v("session.inputPlaceholder"),spellCheck:!1}),F.jsx("button",{type:"button",className:"si-attach","data-tip":v("session.attachTitle"),onClick:()=>ot("new"),disabled:$,children:$&&ce==="new"?F.jsx(mt,{}):F.jsx(pt,{})}),G&&ce==="new"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:v("session.attachError")}),s&&(s.kind==="mention"||s.kind==="actor")&&tt(!1),s&&s.kind==="config"&&et(!1,s.query?`/${s.query}`:v("session.menuPresets"))]}),w.length?(()=>{var z;const M=gt[((z=w.find(se=>se.name===L))==null?void 0:z.harness)||"claude"]||gt.claude,I=M.Glyph;return F.jsxs("label",{className:"si-launcher-picker","data-tip":v("session.launcherLabel"),children:[F.jsx("span",{className:"si-launcher-label",children:v("session.launcherLabel")}),F.jsx("span",{className:"si-launcher-harness","data-tip":M.label,"aria-hidden":"true",children:F.jsx(I,{})}),F.jsx("select",{className:"si-launcher-select",value:L,onChange:se=>B(se.target.value),"aria-label":v("session.launcherLabel"),children:w.map(se=>F.jsx("option",{value:se.name,children:se.name},se.name))})]})})():null,F.jsxs("div",{className:"si-hint",children:[v("session.hint.before"),F.jsx("code",{children:"[["}),v("session.hint.mid"),F.jsx("code",{children:"/"}),v("session.hint.after")]})]}),F.jsxs("div",{className:"si-session-wrap",style:{display:ne==="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":W==="terminal",className:W==="terminal"?"si-tab on":"si-tab",onClick:()=>X("terminal"),children:v("session.tabTerminal")}),F.jsx("button",{role:"tab","aria-selected":W==="eval",className:W==="eval"?"si-tab on":"si-tab",onClick:()=>X("eval"),children:v("session.tabEval")})]}),F.jsx("div",{className:"si-actions",children:Te?F.jsx("button",{className:"si-act go",onClick:()=>Ie("resume"),children:v("session.relaunch")}):Ue.filter(M=>M.button).map(M=>{const I=M.name==="type"?E?" on":D[ne]?" suggest":"":"";return F.jsx("button",{className:`si-act ui sc-${M.color} ${M.name}${I}`,"data-tip":v(M.titleKey),onClick:M.run,children:v(M.labelKey)},M.name)})})]}),F.jsxs("div",{className:"si-term-body",ref:de,style:{position:"relative",display:W==="terminal"?void 0:"none"},children:[[...yt].map(M=>F.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,display:M===ne?"block":"none"},children:F.jsx(mi,{sessionId:M,active:M===ne,onMenu:Ke})},M)),Te&&F.jsxs("div",{className:"si-offline",children:[F.jsx("div",{className:"si-offline-msg",children:v("session.offlineMsg")}),F.jsxs("div",{className:"si-offline-sub",children:[v("session.offlineSubBefore"),F.jsxs("code",{children:[ne.slice(0,8),"…"]}),v("session.offlineSubAfter")]}),F.jsx("button",{className:"si-act go big",onClick:()=>Ie("resume"),children:v("session.relaunchResume")}),A&&F.jsx("div",{className:"si-offline-err",role:"alert",children:A})]})]}),W==="terminal"&&(E?F.jsxs("div",{className:"si-bottom type",onClick:()=>R(!1),"data-tip":v("session.typeExit"),children:[F.jsx("span",{className:"si-type-ind",children:v("session.typeInd")}),F.jsx("span",{className:"si-type-help",children:v("session.typeHelp")})]}):F.jsxs("div",{className:`${P?"si-bottom err":"si-bottom"}${re==="msg"?" dragover":""}`,onDragOver:M=>{Ee||nt(M,"msg")},onDragLeave:()=>ee(null),onDrop:M=>{Ee||rt(M,"msg")},children:[F.jsx("span",{className:"si-prompt",children:"❯"}),F.jsx("textarea",{ref:Se,className:"si-input","data-focus-sink":!0,rows:1,value:De,onChange:M=>{ye(M.target.value),P&&T(!1),We(M.target)},onSelect:M=>We(M.target),onPaste:M=>{Ee||st(M,"msg")},onBlur:()=>i(null),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&!Je(M)&&(M.preventDefault(),M.stopPropagation(),kt())},placeholder:v(Ee?"session.msgOffline":"session.msgPlaceholder"),spellCheck:!1,disabled:Ee}),F.jsx("button",{type:"button",className:"si-attach","data-tip":v("session.attachTitle"),onClick:()=>ot("msg"),disabled:$||Ee,children:$&&ce==="msg"?F.jsx(mt,{}):F.jsx(pt,{})}),G&&ce==="msg"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:v("session.attachError")}),P&&F.jsx("span",{className:"si-send-err",role:"alert",children:v("session.msgError")}),s&&s.kind==="slash"&&et(!0,s.query?`/${s.query}`:v("session.menuCommands")),s&&(s.kind==="mention"||s.kind==="actor")&&tt(!0)]})),W==="eval"&&F.jsx(wi,{sessionId:ne,specs:ie,sessions:U,onOpenSession:M=>{X("terminal"),M!==ne&&(n==null||n(M))}})]})]})]})}),F.jsx(Ci,{menu:r,onClose:()=>u(null),onChanged:g,onMultiSelect:Mt})]})}export{Bi as default};