@overlordai/server 1.0.43 → 1.0.44

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 (51) hide show
  1. package/package.json +2 -2
  2. package/public/assets/{AccessTokensPage-bSuzjk3Y.js → AccessTokensPage-CuDIq3mK.js} +1 -1
  3. package/public/assets/{AdminPage-CWuaOv13.js → AdminPage-WUf_DH26.js} +1 -1
  4. package/public/assets/{ApiReferencePage-DzvO8t7S.js → ApiReferencePage-B4VEeopm.js} +1 -1
  5. package/public/assets/{AuditLogPage-DN8yUTwT.js → AuditLogPage-DARHQlvl.js} +1 -1
  6. package/public/assets/{BotManage-FsGWv-Cs.js → BotManage-CJqrHdGB.js} +1 -1
  7. package/public/assets/{CliReferencePage-Dr4YTU9I.js → CliReferencePage-DdShMz7c.js} +1 -1
  8. package/public/assets/{DeveloperManage-NVw4KyvZ.js → DeveloperManage-BPZREf7l.js} +1 -1
  9. package/public/assets/{EditProjectPage-Ypprcu5c.js → EditProjectPage-CSRXhvIJ.js} +1 -1
  10. package/public/assets/{EmptyState-D_O928BP.js → EmptyState-DzCKambS.js} +1 -1
  11. package/public/assets/{HomePage-B2OxK5xj.js → HomePage-D4-N3McT.js} +1 -1
  12. package/public/assets/{LandingPage-BKxZn7u-.js → LandingPage-CponhSIC.js} +1 -1
  13. package/public/assets/{LoginPage-D1iYDj3x.js → LoginPage-B3p2RAhz.js} +1 -1
  14. package/public/assets/{MachineDetailPage-B8kl4br1.js → MachineDetailPage-B1Mvy6B-.js} +1 -1
  15. package/public/assets/{MachineListPage-Cdhs5E6Q.js → MachineListPage-DklA4fO_.js} +1 -1
  16. package/public/assets/{NotFoundPage-8NSuGh0w.js → NotFoundPage-TPG6sDNi.js} +1 -1
  17. package/public/assets/{PipelineEditorPage-Dvw7waws.js → PipelineEditorPage-C3yCVmcn.js} +1 -1
  18. package/public/assets/{ProfilePage-fbqb6M9W.js → ProfilePage-BpF9U5Z_.js} +1 -1
  19. package/public/assets/{ProjectDetailPage-C8_CaJ4q.js → ProjectDetailPage-D-DQIT-o.js} +1 -1
  20. package/public/assets/{ProjectListPage-Bo9irGl7.js → ProjectListPage-CkUyPRWX.js} +1 -1
  21. package/public/assets/{QuickAuth-BVu5F4-Z.js → QuickAuth-BI0Tx9ne.js} +1 -1
  22. package/public/assets/{RemoveMemberConfirmDialog-VXTWA_wn.js → RemoveMemberConfirmDialog-8DleD0Hw.js} +1 -1
  23. package/public/assets/{Select-D1rjtzkM.js → Select-CPqSszMb.js} +1 -1
  24. package/public/assets/{SettingsPage-BYx5zcQ4.js → SettingsPage-BJVgLzVg.js} +1 -1
  25. package/public/assets/{Skeleton-JjetbQBe.js → Skeleton-CY9tzQX6.js} +1 -1
  26. package/public/assets/{SkillPage-W3D0XriB.js → SkillPage-BALXQsF3.js} +1 -1
  27. package/public/assets/{TaskDetailPage-Cj8c16k5.js → TaskDetailPage-DMoXJ7Sh.js} +2 -2
  28. package/public/assets/{TaskListPage-zOvt0-cZ.js → TaskListPage-Devlwdac.js} +1 -1
  29. package/public/assets/{TaskStatusBadge-4uLJX_Vd.js → TaskStatusBadge-Dl69wpxH.js} +1 -1
  30. package/public/assets/{TokenManage-B8Ib-gxA.js → TokenManage-BvE5noxb.js} +1 -1
  31. package/public/assets/{TotpSetupPage-DFyQKciF.js → TotpSetupPage-EHohoQr_.js} +1 -1
  32. package/public/assets/{WorkerSetupGuidePage-LUifUcBd.js → WorkerSetupGuidePage-9Z7LKYBn.js} +1 -1
  33. package/public/assets/{arrow-left-CR5jvFjP.js → arrow-left-BTuWsVB2.js} +1 -1
  34. package/public/assets/{arrow-right-Bo1TJaJG.js → arrow-right-B9x1F1gE.js} +1 -1
  35. package/public/assets/{bot-DxFLx72V.js → bot-Dr86mLtd.js} +1 -1
  36. package/public/assets/{chevron-right-VfZqXu3w.js → chevron-right-Cnu_BlwV.js} +1 -1
  37. package/public/assets/{copy-xV3w7rMd.js → copy-CQsonKZY.js} +1 -1
  38. package/public/assets/{external-link-YMd0b2Hu.js → external-link-BpHI4mME.js} +1 -1
  39. package/public/assets/{index-MbPa7F7Y.css → index-CQojj7Zu.css} +1 -1
  40. package/public/assets/{index-_asV5ZlD.js → index-MlIm5Zqq.js} +2 -2
  41. package/public/assets/{key-Bq5CCd4F.js → key-CN5iSZmy.js} +1 -1
  42. package/public/assets/{loader-circle-B9QqvZqZ.js → loader-circle-t2hVF1ss.js} +1 -1
  43. package/public/assets/{pencil-DbvawD2W.js → pencil-C9FcKtr5.js} +1 -1
  44. package/public/assets/{plus-DHhiUFNm.js → plus-58oQJgAF.js} +1 -1
  45. package/public/assets/{rotate-ccw-Chvhmlkh.js → rotate-ccw-Cd08QlGT.js} +1 -1
  46. package/public/assets/{scroll-text-C6gAM7YD.js → scroll-text-B2DWPewZ.js} +1 -1
  47. package/public/assets/{settings-B50SrjPV.js → settings-D9FZzg11.js} +1 -1
  48. package/public/assets/{task.store-DyE-1EPm.js → task.store-B1HbDqca.js} +1 -1
  49. package/public/assets/{trash-2-DFZZLvex.js → trash-2-0XZvPD__.js} +1 -1
  50. package/public/assets/{users-CP0hBaq4.js → users-vLcPWGEp.js} +1 -1
  51. package/public/index.html +2 -2
@@ -1,4 +1,4 @@
1
- var He=Object.defineProperty;var Fe=(G,$,F)=>$ in G?He(G,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):G[$]=F;var ve=(G,$,F)=>Fe(G,typeof $!="symbol"?$+"":$,F);import{c as pe,r as z,u as We,f as ce,j as C,a as be,l as Ie,m as Ue,d as $e,n as ze,X as we,o as Ke,t as ke,i as qe}from"./index-_asV5ZlD.js";import{u as Ve}from"./task.store-DyE-1EPm.js";import{S as Ge}from"./Select-D1rjtzkM.js";import{A as Xe}from"./arrow-left-CR5jvFjP.js";import{R as Je}from"./rotate-ccw-Chvhmlkh.js";import{E as Ye}from"./external-link-YMd0b2Hu.js";import{L as Ee}from"./loader-circle-B9QqvZqZ.js";/**
1
+ var He=Object.defineProperty;var Fe=(G,$,F)=>$ in G?He(G,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):G[$]=F;var ve=(G,$,F)=>Fe(G,typeof $!="symbol"?$+"":$,F);import{c as pe,r as z,u as We,f as ce,j as C,a as be,l as Ie,m as Ue,d as $e,n as ze,X as we,o as Ke,t as ke,i as qe}from"./index-MlIm5Zqq.js";import{u as Ve}from"./task.store-B1HbDqca.js";import{S as Ge}from"./Select-CPqSszMb.js";import{A as Xe}from"./arrow-left-BTuWsVB2.js";import{R as Je}from"./rotate-ccw-Cd08QlGT.js";import{E as Ye}from"./external-link-BpHI4mME.js";import{L as Ee}from"./loader-circle-t2hVF1ss.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -41,4 +41,4 @@ WARNING: This link could potentially be dangerous`)){const i=window.open();if(i)
41
41
  `:`
42
42
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(l){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),i.isLinux&&l&&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(l){const p=this._getMouseBufferCoords(l),x=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!!(x&&L&&p)&&this._areCoordsInSelection(p,x,L)}isCellInSelection(l,p){const x=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!x||!L)&&this._areCoordsInSelection([l,p],x,L)}_areCoordsInSelection(l,p,x){return l[1]>p[1]&&l[1]<x[1]||p[1]===x[1]&&l[1]===p[1]&&l[0]>=p[0]&&l[0]<x[0]||p[1]<x[1]&&l[1]===x[1]&&l[0]<x[0]||p[1]<x[1]&&l[1]===p[1]&&l[0]>=p[0]}_selectWordAtCursor(l,p){var x,L;const y=(L=(x=this._linkifier.currentLink)===null||x===void 0?void 0:x.link)===null||L===void 0?void 0:L.range;if(y)return this._model.selectionStart=[y.start.x-1,y.start.y-1],this._model.selectionStartLength=(0,s.getRangeLength)(y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const E=this._getMouseBufferCoords(l);return!!E&&(this._selectWordAt(E,p),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(l,p){this._model.clearSelection(),l=Math.max(l,0),p=Math.min(p,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,l],this._model.selectionEnd=[this._bufferService.cols,p],this.refresh(),this._onSelectionChange.fire()}_handleTrim(l){this._model.handleTrim(l)&&this.refresh()}_getMouseBufferCoords(l){const p=this._mouseService.getCoords(l,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(p)return p[0]--,p[1]--,p[1]+=this._bufferService.buffer.ydisp,p}_getMouseEventScrollAmount(l){let p=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,l,this._screenElement)[1];const x=this._renderService.dimensions.css.canvas.height;return p>=0&&p<=x?0:(p>x&&(p-=x),p=Math.min(Math.max(p,-50),50),p/=50,p/Math.abs(p)+Math.round(14*p))}shouldForceSelection(l){return i.isMac?l.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:l.shiftKey}handleMouseDown(l){if(this._mouseDownTimeStamp=l.timeStamp,(l.button!==2||!this.hasSelection)&&l.button===0){if(!this._enabled){if(!this.shouldForceSelection(l))return;l.stopPropagation()}l.preventDefault(),this._dragScrollAmount=0,this._enabled&&l.shiftKey?this._handleIncrementalClick(l):l.detail===1?this._handleSingleClick(l):l.detail===2?this._handleDoubleClick(l):l.detail===3&&this._handleTripleClick(l),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(l){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(l))}_handleSingleClick(l){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(l)?3:0,this._model.selectionStart=this._getMouseBufferCoords(l),!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(l){this._selectWordAtCursor(l,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(l){const p=this._getMouseBufferCoords(l);p&&(this._activeSelectionMode=2,this._selectLineAt(p[1]))}shouldColumnSelect(l){return l.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(l){if(l.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(l),!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(l),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const x=this._bufferService.buffer;if(this._model.selectionEnd[1]<x.lines.length){const L=x.lines.get(this._model.selectionEnd[1]);L&&L.hasWidth(this._model.selectionEnd[0])===0&&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 l=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(l.ydisp+this._bufferService.rows,l.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=l.ydisp),this.refresh()}}_handleMouseUp(l){const p=l.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&p<500&&l.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const x=this._mouseService.getCoords(l,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(x&&x[0]!==void 0&&x[1]!==void 0){const L=(0,d.moveToCellSequence)(x[0]-1,x[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const l=this._model.finalSelectionStart,p=this._model.finalSelectionEnd,x=!(!l||!p||l[0]===p[0]&&l[1]===p[1]);x?l&&p&&(this._oldSelectionStart&&this._oldSelectionEnd&&l[0]===this._oldSelectionStart[0]&&l[1]===this._oldSelectionStart[1]&&p[0]===this._oldSelectionEnd[0]&&p[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(l,p,x)):this._oldHasSelection&&this._fireOnSelectionChange(l,p,x)}_fireOnSelectionChange(l,p,x){this._oldSelectionStart=l,this._oldSelectionEnd=p,this._oldHasSelection=x,this._onSelectionChange.fire()}_handleBufferActivate(l){this.clearSelection(),this._trimListener.dispose(),this._trimListener=l.activeBuffer.lines.onTrim((p=>this._handleTrim(p)))}_convertViewportColToCharacterIndex(l,p){let x=p;for(let L=0;p>=L;L++){const y=l.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?x--:y>1&&p!==L&&(x+=y-1)}return x}setSelection(l,p,x){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[l,p],this._model.selectionStartLength=x,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(l){this._isClickInSelection(l)||(this._selectWordAtCursor(l,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(l,p,x=!0,L=!0){if(l[0]>=this._bufferService.cols)return;const y=this._bufferService.buffer,E=y.lines.get(l[1]);if(!E)return;const B=y.translateBufferLineToString(l[1],!1);let I=this._convertViewportColToCharacterIndex(E,l[0]),H=I;const j=l[0]-I;let b=0,w=0,k=0,D=0;if(B.charAt(I)===" "){for(;I>0&&B.charAt(I-1)===" ";)I--;for(;H<B.length&&B.charAt(H+1)===" ";)H++}else{let V=l[0],q=l[0];E.getWidth(V)===0&&(b++,V--),E.getWidth(q)===2&&(w++,q++);const ee=E.getString(q).length;for(ee>1&&(D+=ee-1,H+=ee-1);V>0&&I>0&&!this._isCharWordSeparator(E.loadCell(V-1,this._workCell));){E.loadCell(V-1,this._workCell);const S=this._workCell.getChars().length;this._workCell.getWidth()===0?(b++,V--):S>1&&(k+=S-1,I-=S-1),I--,V--}for(;q<E.length&&H+1<B.length&&!this._isCharWordSeparator(E.loadCell(q+1,this._workCell));){E.loadCell(q+1,this._workCell);const S=this._workCell.getChars().length;this._workCell.getWidth()===2?(w++,q++):S>1&&(D+=S-1,H+=S-1),H++,q++}}H++;let N=I+j-b+k,W=Math.min(this._bufferService.cols,H-I+b+w-k-D);if(p||B.slice(I,H).trim()!==""){if(x&&N===0&&E.getCodePoint(0)!==32){const V=y.lines.get(l[1]-1);if(V&&E.isWrapped&&V.getCodePoint(this._bufferService.cols-1)!==32){const q=this._getWordAt([this._bufferService.cols-1,l[1]-1],!1,!0,!1);if(q){const ee=this._bufferService.cols-q.start;N-=ee,W+=ee}}}if(L&&N+W===this._bufferService.cols&&E.getCodePoint(this._bufferService.cols-1)!==32){const V=y.lines.get(l[1]+1);if(V!=null&&V.isWrapped&&V.getCodePoint(0)!==32){const q=this._getWordAt([0,l[1]+1],!1,!1,!0);q&&(W+=q.length)}}return{start:N,length:W}}}_selectWordAt(l,p){const x=this._getWordAt(l,p);if(x){for(;x.start<0;)x.start+=this._bufferService.cols,l[1]--;this._model.selectionStart=[x.start,l[1]],this._model.selectionStartLength=x.length}}_selectToWordAt(l){const p=this._getWordAt(l,!0);if(p){let x=l[1];for(;p.start<0;)p.start+=this._bufferService.cols,x--;if(!this._model.areSelectionValuesReversed())for(;p.start+p.length>this._bufferService.cols;)p.length-=this._bufferService.cols,x++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?p.start:p.start+p.length,x]}}_isCharWordSeparator(l){return l.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(l.getChars())>=0}_selectLineAt(l){const p=this._bufferService.buffer.getWrappedRangeForLine(l),x={start:{x:0,y:p.first},end:{x:this._bufferService.cols-1,y:p.last}};this._model.selectionStart=[0,p.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,s.getRangeLength)(x,this._bufferService.cols)}};r.SelectionService=m=h([_(3,o.IBufferService),_(4,o.ICoreService),_(5,g.IMouseService),_(6,o.IOptionsService),_(7,g.IRenderService),_(8,g.ICoreBrowserService)],m)},4725:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const h=a(8343);r.ICharSizeService=(0,h.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),r.IMouseService=(0,h.createDecorator)("MouseService"),r.IRenderService=(0,h.createDecorator)("RenderService"),r.ISelectionService=(0,h.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,h.createDecorator)("ThemeService")},6731:function(T,r,a){var h=this&&this.__decorate||function(m,l,p,x){var L,y=arguments.length,E=y<3?l:x===null?x=Object.getOwnPropertyDescriptor(l,p):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,l,p,x);else for(var B=m.length-1;B>=0;B--)(L=m[B])&&(E=(y<3?L(E):y>3?L(l,p,E):L(l,p))||E);return y>3&&E&&Object.defineProperty(l,p,E),E},_=this&&this.__param||function(m,l){return function(p,x){l(p,x,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const n=a(7239),d=a(8055),v=a(8460),g=a(844),u=a(2585),e=d.css.toColor("#ffffff"),i=d.css.toColor("#000000"),s=d.css.toColor("#ffffff"),t=d.css.toColor("#000000"),o={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],l=[0,95,135,175,215,255];for(let p=0;p<216;p++){const x=l[p/36%6|0],L=l[p/6%6|0],y=l[p%6];m.push({css:d.channels.toCss(x,L,y),rgba:d.channels.toRgba(x,L,y)})}for(let p=0;p<24;p++){const x=8+10*p;m.push({css:d.channels.toCss(x,x,x),rgba:d.channels.toRgba(x,x,x)})}return m})());let c=r.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:i,cursor:s,cursorAccent:t,selectionForeground:void 0,selectionBackgroundTransparent:o,selectionBackgroundOpaque:d.color.blend(i,o),selectionInactiveBackgroundTransparent:o,selectionInactiveBackgroundOpaque:d.color.blend(i,o),ansi:r.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 l=this._colors;if(l.foreground=f(m.foreground,e),l.background=f(m.background,i),l.cursor=f(m.cursor,s),l.cursorAccent=f(m.cursorAccent,t),l.selectionBackgroundTransparent=f(m.selectionBackground,o),l.selectionBackgroundOpaque=d.color.blend(l.background,l.selectionBackgroundTransparent),l.selectionInactiveBackgroundTransparent=f(m.selectionInactiveBackground,l.selectionBackgroundTransparent),l.selectionInactiveBackgroundOpaque=d.color.blend(l.background,l.selectionInactiveBackgroundTransparent),l.selectionForeground=m.selectionForeground?f(m.selectionForeground,d.NULL_COLOR):void 0,l.selectionForeground===d.NULL_COLOR&&(l.selectionForeground=void 0),d.color.isOpaque(l.selectionBackgroundTransparent)&&(l.selectionBackgroundTransparent=d.color.opacity(l.selectionBackgroundTransparent,.3)),d.color.isOpaque(l.selectionInactiveBackgroundTransparent)&&(l.selectionInactiveBackgroundTransparent=d.color.opacity(l.selectionInactiveBackgroundTransparent,.3)),l.ansi=r.DEFAULT_ANSI_COLORS.slice(),l.ansi[0]=f(m.black,r.DEFAULT_ANSI_COLORS[0]),l.ansi[1]=f(m.red,r.DEFAULT_ANSI_COLORS[1]),l.ansi[2]=f(m.green,r.DEFAULT_ANSI_COLORS[2]),l.ansi[3]=f(m.yellow,r.DEFAULT_ANSI_COLORS[3]),l.ansi[4]=f(m.blue,r.DEFAULT_ANSI_COLORS[4]),l.ansi[5]=f(m.magenta,r.DEFAULT_ANSI_COLORS[5]),l.ansi[6]=f(m.cyan,r.DEFAULT_ANSI_COLORS[6]),l.ansi[7]=f(m.white,r.DEFAULT_ANSI_COLORS[7]),l.ansi[8]=f(m.brightBlack,r.DEFAULT_ANSI_COLORS[8]),l.ansi[9]=f(m.brightRed,r.DEFAULT_ANSI_COLORS[9]),l.ansi[10]=f(m.brightGreen,r.DEFAULT_ANSI_COLORS[10]),l.ansi[11]=f(m.brightYellow,r.DEFAULT_ANSI_COLORS[11]),l.ansi[12]=f(m.brightBlue,r.DEFAULT_ANSI_COLORS[12]),l.ansi[13]=f(m.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),l.ansi[14]=f(m.brightCyan,r.DEFAULT_ANSI_COLORS[14]),l.ansi[15]=f(m.brightWhite,r.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const p=Math.min(l.ansi.length-16,m.extendedAnsi.length);for(let x=0;x<p;x++)l.ansi[x+16]=f(m.extendedAnsi[x],r.DEFAULT_ANSI_COLORS[x+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 l=0;l<this._restoreColors.ansi.length;++l)this._colors.ansi[l]=this._restoreColors.ansi[l]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function f(m,l){if(m!==void 0)try{return d.css.toColor(m)}catch{}return l}r.ThemeService=c=h([_(0,u.IOptionsService)],c)},6349:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const h=a(8460),_=a(844);class n extends _.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(v){if(this._maxLength===v)return;const g=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)g[u]=this._array[this._getCyclicIndex(u)];this._array=g,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let g=this._length;g<v;g++)this._array[g]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,g){this._array[this._getCyclicIndex(v)]=g}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,g,...u){if(g){for(let e=v;e<this._length-g;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+g)];this._length-=g,this.onDeleteEmitter.fire({index:v,amount:g})}for(let e=this._length-1;e>=v;e--)this._array[this._getCyclicIndex(e+u.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<u.length;e++)this._array[this._getCyclicIndex(v+e)]=u[e];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){const e=this._length+u.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,g,u){if(!(g<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let i=g-1;i>=0;i--)this.set(v+i+u,this.get(v+i));const e=v+g+u-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<g;e++)this.set(v+e+u,this.get(v+e))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=n},1439:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function a(h,_=5){if(typeof h!="object")return h;const n=Array.isArray(h)?[]:{};for(const d in h)n[d]=_<=1?h[d]:h[d]&&a(h[d],_-1);return n}},8055:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const h=a(6114);let _=0,n=0,d=0,v=0;var g,u,e,i,s;function t(c){const f=c.toString(16);return f.length<2?"0"+f:f}function o(c,f){return c<f?(f+.05)/(c+.05):(c+.05)/(f+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(c){c.toCss=function(f,m,l,p){return p!==void 0?`#${t(f)}${t(m)}${t(l)}${t(p)}`:`#${t(f)}${t(m)}${t(l)}`},c.toRgba=function(f,m,l,p=255){return(f<<24|m<<16|l<<8|p)>>>0}})(g||(r.channels=g={})),(function(c){function f(m,l){return v=Math.round(255*l),[_,n,d]=s.toChannels(m.rgba),{css:g.toCss(_,n,d,v),rgba:g.toRgba(_,n,d,v)}}c.blend=function(m,l){if(v=(255&l.rgba)/255,v===1)return{css:l.css,rgba:l.rgba};const p=l.rgba>>24&255,x=l.rgba>>16&255,L=l.rgba>>8&255,y=m.rgba>>24&255,E=m.rgba>>16&255,B=m.rgba>>8&255;return _=y+Math.round((p-y)*v),n=E+Math.round((x-E)*v),d=B+Math.round((L-B)*v),{css:g.toCss(_,n,d),rgba:g.toRgba(_,n,d)}},c.isOpaque=function(m){return(255&m.rgba)==255},c.ensureContrastRatio=function(m,l,p){const x=s.ensureContrastRatio(m.rgba,l.rgba,p);if(x)return s.toColor(x>>24&255,x>>16&255,x>>8&255)},c.opaque=function(m){const l=(255|m.rgba)>>>0;return[_,n,d]=s.toChannels(l),{css:g.toCss(_,n,d),rgba:l}},c.opacity=f,c.multiplyOpacity=function(m,l){return v=255&m.rgba,f(m,v*l/255)},c.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}})(u||(r.color=u={})),(function(c){let f,m;if(!h.isNode){const l=document.createElement("canvas");l.width=1,l.height=1;const p=l.getContext("2d",{willReadFrequently:!0});p&&(f=p,f.globalCompositeOperation="copy",m=f.createLinearGradient(0,0,1,1))}c.toColor=function(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return _=parseInt(l.slice(1,2).repeat(2),16),n=parseInt(l.slice(2,3).repeat(2),16),d=parseInt(l.slice(3,4).repeat(2),16),s.toColor(_,n,d);case 5:return _=parseInt(l.slice(1,2).repeat(2),16),n=parseInt(l.slice(2,3).repeat(2),16),d=parseInt(l.slice(3,4).repeat(2),16),v=parseInt(l.slice(4,5).repeat(2),16),s.toColor(_,n,d,v);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}const p=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(p)return _=parseInt(p[1]),n=parseInt(p[2]),d=parseInt(p[3]),v=Math.round(255*(p[5]===void 0?1:parseFloat(p[5]))),s.toColor(_,n,d,v);if(!f||!m)throw new Error("css.toColor: Unsupported css format");if(f.fillStyle=m,f.fillStyle=l,typeof f.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(f.fillRect(0,0,1,1),[_,n,d,v]=f.getImageData(0,0,1,1).data,v!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(_,n,d,v),css:l}}})(e||(r.css=e={})),(function(c){function f(m,l,p){const x=m/255,L=l/255,y=p/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))}c.relativeLuminance=function(m){return f(m>>16&255,m>>8&255,255&m)},c.relativeLuminance2=f})(i||(r.rgb=i={})),(function(c){function f(l,p,x){const L=l>>24&255,y=l>>16&255,E=l>>8&255;let B=p>>24&255,I=p>>16&255,H=p>>8&255,j=o(i.relativeLuminance2(B,I,H),i.relativeLuminance2(L,y,E));for(;j<x&&(B>0||I>0||H>0);)B-=Math.max(0,Math.ceil(.1*B)),I-=Math.max(0,Math.ceil(.1*I)),H-=Math.max(0,Math.ceil(.1*H)),j=o(i.relativeLuminance2(B,I,H),i.relativeLuminance2(L,y,E));return(B<<24|I<<16|H<<8|255)>>>0}function m(l,p,x){const L=l>>24&255,y=l>>16&255,E=l>>8&255;let B=p>>24&255,I=p>>16&255,H=p>>8&255,j=o(i.relativeLuminance2(B,I,H),i.relativeLuminance2(L,y,E));for(;j<x&&(B<255||I<255||H<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),I=Math.min(255,I+Math.ceil(.1*(255-I))),H=Math.min(255,H+Math.ceil(.1*(255-H))),j=o(i.relativeLuminance2(B,I,H),i.relativeLuminance2(L,y,E));return(B<<24|I<<16|H<<8|255)>>>0}c.ensureContrastRatio=function(l,p,x){const L=i.relativeLuminance(l>>8),y=i.relativeLuminance(p>>8);if(o(L,y)<x){if(y<L){const I=f(l,p,x),H=o(L,i.relativeLuminance(I>>8));if(H<x){const j=m(l,p,x);return H>o(L,i.relativeLuminance(j>>8))?I:j}return I}const E=m(l,p,x),B=o(L,i.relativeLuminance(E>>8));if(B<x){const I=f(l,p,x);return B>o(L,i.relativeLuminance(I>>8))?E:I}return E}},c.reduceLuminance=f,c.increaseLuminance=m,c.toChannels=function(l){return[l>>24&255,l>>16&255,l>>8&255,255&l]},c.toColor=function(l,p,x,L){return{css:g.toCss(l,p,x,L),rgba:g.toRgba(l,p,x,L)}}})(s||(r.rgba=s={})),r.toPaddedHex=t,r.contrastRatio=o},8969:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const h=a(844),_=a(2585),n=a(4348),d=a(7866),v=a(744),g=a(7302),u=a(6975),e=a(8460),i=a(1753),s=a(1480),t=a(7994),o=a(9282),c=a(5435),f=a(5981),m=a(2660);let l=!1;class p extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((L=>{var y;(y=this._onScrollApi)===null||y===void 0||y.fire(L.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(L){for(const y in L)this.optionsService.options[y]=L[y]}constructor(L){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 g.OptionsService(L)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(i.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(s.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(t.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new c.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((y=>{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((y=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new f.WriteBuffer(((y,E)=>this._inputHandler.parse(y,E)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,y){this._writeBuffer.write(L,y)}writeSync(L,y){this._logService.logLevel<=_.LogLevelEnum.WARN&&!l&&(this._logService.warn("writeSync is unreliable and will be removed soon."),l=!0),this._writeBuffer.writeSync(L,y)}resize(L,y){isNaN(L)||isNaN(y)||(L=Math.max(L,v.MINIMUM_COLS),y=Math.max(y,v.MINIMUM_ROWS),this._bufferService.resize(L,y))}scroll(L,y=!1){this._bufferService.scroll(L,y)}scrollLines(L,y,E){this._bufferService.scrollLines(L,y,E)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const y=L-this._bufferService.buffer.ydisp;y!==0&&this.scrollLines(y)}registerEscHandler(L,y){return this._inputHandler.registerEscHandler(L,y)}registerDcsHandler(L,y){return this._inputHandler.registerDcsHandler(L,y)}registerCsiHandler(L,y){return this._inputHandler.registerCsiHandler(L,y)}registerOscHandler(L,y){return this._inputHandler.registerOscHandler(L,y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const y=this.optionsService.rawOptions.windowsPty;y&&y.buildNumber!==void 0&&y.buildNumber!==void 0?L=y.backend==="conpty"&&y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(o.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,o.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const y of L)y.dispose()}))}}}r.CoreTerminal=p},8460:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.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 _=[];for(let n=0;n<this._listeners.length;n++)_.push(this._listeners[n]);for(let n=0;n<_.length;n++)_[n].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(a,h){return a((_=>h.fire(_)))}},5435:function(T,r,a){var h=this&&this.__decorate||function(j,b,w,k){var D,N=arguments.length,W=N<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(j,b,w,k);else for(var V=j.length-1;V>=0;V--)(D=j[V])&&(W=(N<3?D(W):N>3?D(b,w,W):D(b,w))||W);return N>3&&W&&Object.defineProperty(b,w,W),W},_=this&&this.__param||function(j,b){return function(w,k){b(w,k,j)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const n=a(2584),d=a(7116),v=a(2015),g=a(844),u=a(482),e=a(8437),i=a(8460),s=a(643),t=a(511),o=a(3734),c=a(2585),f=a(6242),m=a(6351),l=a(5941),p={"(":0,")":1,"*":2,"+":3,"-":1,".":2},x=131072;function L(j,b){if(j>24)return b.setWinLines||!1;switch(j){case 1:return!!b.restoreWin;case 2:return!!b.minimizeWin;case 3:return!!b.setWinPosition;case 4:return!!b.setWinSizePixels;case 5:return!!b.raiseWin;case 6:return!!b.lowerWin;case 7:return!!b.refreshWin;case 8:return!!b.setWinSizeChars;case 9:return!!b.maximizeWin;case 10:return!!b.fullscreenWin;case 11:return!!b.getWinState;case 13:return!!b.getWinPosition;case 14:return!!b.getWinSizePixels;case 15:return!!b.getScreenSizePixels;case 16:return!!b.getCellSizePixels;case 18:return!!b.getWinSizeChars;case 19:return!!b.getScreenSizeChars;case 20:return!!b.getIconTitle;case 21:return!!b.getWinTitle;case 22:return!!b.pushTitle;case 23:return!!b.popTitle;case 24:return!!b.setWinLines}return!1}var y;(function(j){j[j.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",j[j.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(y||(r.WindowsOptionsReportType=y={}));let E=0;class B extends g.Disposable{getAttrData(){return this._curAttrData}constructor(b,w,k,D,N,W,V,q,ee=new v.EscapeSequenceParser){super(),this._bufferService=b,this._charsetService=w,this._coreService=k,this._logService=D,this._optionsService=N,this._oscLinkService=W,this._coreMouseService=V,this._unicodeService=q,this._parser=ee,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new t.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new i.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new i.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new i.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new i.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new i.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new i.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new i.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new i.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new i.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new i.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new i.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new i.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new I(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((S=>this._activeBuffer=S.activeBuffer))),this._parser.setCsiHandlerFallback(((S,R)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(S),params:R.toArray()})})),this._parser.setEscHandlerFallback((S=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(S)})})),this._parser.setExecuteHandlerFallback((S=>{this._logService.debug("Unknown EXECUTE code: ",{code:S})})),this._parser.setOscHandlerFallback(((S,R,M)=>{this._logService.debug("Unknown OSC code: ",{identifier:S,action:R,data:M})})),this._parser.setDcsHandlerFallback(((S,R,M)=>{R==="HOOK"&&(M=M.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(S),action:R,payload:M})})),this._parser.setPrintHandler(((S,R,M)=>this.print(S,R,M))),this._parser.registerCsiHandler({final:"@"},(S=>this.insertChars(S))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(S=>this.scrollLeft(S))),this._parser.registerCsiHandler({final:"A"},(S=>this.cursorUp(S))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(S=>this.scrollRight(S))),this._parser.registerCsiHandler({final:"B"},(S=>this.cursorDown(S))),this._parser.registerCsiHandler({final:"C"},(S=>this.cursorForward(S))),this._parser.registerCsiHandler({final:"D"},(S=>this.cursorBackward(S))),this._parser.registerCsiHandler({final:"E"},(S=>this.cursorNextLine(S))),this._parser.registerCsiHandler({final:"F"},(S=>this.cursorPrecedingLine(S))),this._parser.registerCsiHandler({final:"G"},(S=>this.cursorCharAbsolute(S))),this._parser.registerCsiHandler({final:"H"},(S=>this.cursorPosition(S))),this._parser.registerCsiHandler({final:"I"},(S=>this.cursorForwardTab(S))),this._parser.registerCsiHandler({final:"J"},(S=>this.eraseInDisplay(S,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(S=>this.eraseInDisplay(S,!0))),this._parser.registerCsiHandler({final:"K"},(S=>this.eraseInLine(S,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(S=>this.eraseInLine(S,!0))),this._parser.registerCsiHandler({final:"L"},(S=>this.insertLines(S))),this._parser.registerCsiHandler({final:"M"},(S=>this.deleteLines(S))),this._parser.registerCsiHandler({final:"P"},(S=>this.deleteChars(S))),this._parser.registerCsiHandler({final:"S"},(S=>this.scrollUp(S))),this._parser.registerCsiHandler({final:"T"},(S=>this.scrollDown(S))),this._parser.registerCsiHandler({final:"X"},(S=>this.eraseChars(S))),this._parser.registerCsiHandler({final:"Z"},(S=>this.cursorBackwardTab(S))),this._parser.registerCsiHandler({final:"`"},(S=>this.charPosAbsolute(S))),this._parser.registerCsiHandler({final:"a"},(S=>this.hPositionRelative(S))),this._parser.registerCsiHandler({final:"b"},(S=>this.repeatPrecedingCharacter(S))),this._parser.registerCsiHandler({final:"c"},(S=>this.sendDeviceAttributesPrimary(S))),this._parser.registerCsiHandler({prefix:">",final:"c"},(S=>this.sendDeviceAttributesSecondary(S))),this._parser.registerCsiHandler({final:"d"},(S=>this.linePosAbsolute(S))),this._parser.registerCsiHandler({final:"e"},(S=>this.vPositionRelative(S))),this._parser.registerCsiHandler({final:"f"},(S=>this.hVPosition(S))),this._parser.registerCsiHandler({final:"g"},(S=>this.tabClear(S))),this._parser.registerCsiHandler({final:"h"},(S=>this.setMode(S))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(S=>this.setModePrivate(S))),this._parser.registerCsiHandler({final:"l"},(S=>this.resetMode(S))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(S=>this.resetModePrivate(S))),this._parser.registerCsiHandler({final:"m"},(S=>this.charAttributes(S))),this._parser.registerCsiHandler({final:"n"},(S=>this.deviceStatus(S))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(S=>this.deviceStatusPrivate(S))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(S=>this.softReset(S))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(S=>this.setCursorStyle(S))),this._parser.registerCsiHandler({final:"r"},(S=>this.setScrollRegion(S))),this._parser.registerCsiHandler({final:"s"},(S=>this.saveCursor(S))),this._parser.registerCsiHandler({final:"t"},(S=>this.windowOptions(S))),this._parser.registerCsiHandler({final:"u"},(S=>this.restoreCursor(S))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(S=>this.insertColumns(S))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(S=>this.deleteColumns(S))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(S=>this.selectProtected(S))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(S=>this.requestMode(S,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(S=>this.requestMode(S,!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 f.OscHandler((S=>(this.setTitle(S),this.setIconName(S),!0)))),this._parser.registerOscHandler(1,new f.OscHandler((S=>this.setIconName(S)))),this._parser.registerOscHandler(2,new f.OscHandler((S=>this.setTitle(S)))),this._parser.registerOscHandler(4,new f.OscHandler((S=>this.setOrReportIndexedColor(S)))),this._parser.registerOscHandler(8,new f.OscHandler((S=>this.setHyperlink(S)))),this._parser.registerOscHandler(10,new f.OscHandler((S=>this.setOrReportFgColor(S)))),this._parser.registerOscHandler(11,new f.OscHandler((S=>this.setOrReportBgColor(S)))),this._parser.registerOscHandler(12,new f.OscHandler((S=>this.setOrReportCursorColor(S)))),this._parser.registerOscHandler(104,new f.OscHandler((S=>this.restoreIndexedColor(S)))),this._parser.registerOscHandler(110,new f.OscHandler((S=>this.restoreFgColor(S)))),this._parser.registerOscHandler(111,new f.OscHandler((S=>this.restoreBgColor(S)))),this._parser.registerOscHandler(112,new f.OscHandler((S=>this.restoreCursorColor(S)))),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 S in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:S},(()=>this.selectCharset("("+S))),this._parser.registerEscHandler({intermediates:")",final:S},(()=>this.selectCharset(")"+S))),this._parser.registerEscHandler({intermediates:"*",final:S},(()=>this.selectCharset("*"+S))),this._parser.registerEscHandler({intermediates:"+",final:S},(()=>this.selectCharset("+"+S))),this._parser.registerEscHandler({intermediates:"-",final:S},(()=>this.selectCharset("-"+S))),this._parser.registerEscHandler({intermediates:".",final:S},(()=>this.selectCharset("."+S))),this._parser.registerEscHandler({intermediates:"/",final:S},(()=>this.selectCharset("/"+S)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((S=>(this._logService.error("Parsing error: ",S),S))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m.DcsHandler(((S,R)=>this.requestStatusString(S,R))))}_preserveStack(b,w,k,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=b,this._parseStack.cursorStartY=w,this._parseStack.decodedLength=k,this._parseStack.position=D}_logSlowResolvingAsync(b){this._logService.logLevel<=c.LogLevelEnum.WARN&&Promise.race([b,new Promise(((w,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((w=>{if(w!=="#SLOW_TIMEOUT")throw w;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(b,w){let k,D=this._activeBuffer.x,N=this._activeBuffer.y,W=0;const V=this._parseStack.paused;if(V){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,w))return this._logSlowResolvingAsync(k),k;D=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,b.length>x&&(W=this._parseStack.position+x)}if(this._logService.logLevel<=c.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof b=="string"?` "${b}"`:` "${Array.prototype.map.call(b,(q=>String.fromCharCode(q))).join("")}"`),typeof b=="string"?b.split("").map((q=>q.charCodeAt(0))):b),this._parseBuffer.length<b.length&&this._parseBuffer.length<x&&(this._parseBuffer=new Uint32Array(Math.min(b.length,x))),V||this._dirtyRowTracker.clearRange(),b.length>x)for(let q=W;q<b.length;q+=x){const ee=q+x<b.length?q+x:b.length,S=typeof b=="string"?this._stringDecoder.decode(b.substring(q,ee),this._parseBuffer):this._utf8Decoder.decode(b.subarray(q,ee),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,S))return this._preserveStack(D,N,S,q),this._logSlowResolvingAsync(k),k}else if(!V){const q=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,q))return this._preserveStack(D,N,q,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===D&&this._activeBuffer.y===N||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(b,w,k){let D,N;const W=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,q=this._bufferService.cols,ee=this._coreService.decPrivateModes.wraparound,S=this._coreService.modes.insertMode,R=this._curAttrData;let M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-w>0&&M.getWidth(this._activeBuffer.x-1)===2&&M.setCellFromCodePoint(this._activeBuffer.x-1,0,1,R.fg,R.bg,R.extended);for(let O=w;O<k;++O){if(D=b[O],N=this._unicodeService.wcwidth(D),D<127&&W){const Y=W[String.fromCharCode(D)];Y&&(D=Y.charCodeAt(0))}if(V&&this._onA11yChar.fire((0,u.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),N||!this._activeBuffer.x){if(this._activeBuffer.x+N-1>=q){if(ee){for(;this._activeBuffer.x<q;)M.setCellFromCodePoint(this._activeBuffer.x++,0,1,R.fg,R.bg,R.extended);this._activeBuffer.x=0,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),M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=q-1,N===2)continue}if(S&&(M.insertCells(this._activeBuffer.x,N,this._activeBuffer.getNullCell(R),R),M.getWidth(q-1)===2&&M.setCellFromCodePoint(q-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,R.fg,R.bg,R.extended)),M.setCellFromCodePoint(this._activeBuffer.x++,D,N,R.fg,R.bg,R.extended),N>0)for(;--N;)M.setCellFromCodePoint(this._activeBuffer.x++,0,0,R.fg,R.bg,R.extended)}else M.getWidth(this._activeBuffer.x-1)?M.addCodepointToCell(this._activeBuffer.x-1,D):M.addCodepointToCell(this._activeBuffer.x-2,D)}k-w>0&&(M.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<q&&k-w>0&&M.getWidth(this._activeBuffer.x)===0&&!M.hasContent(this._activeBuffer.x)&&M.setCellFromCodePoint(this._activeBuffer.x,0,1,R.fg,R.bg,R.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(b,w){return b.final!=="t"||b.prefix||b.intermediates?this._parser.registerCsiHandler(b,w):this._parser.registerCsiHandler(b,(k=>!L(k.params[0],this._optionsService.rawOptions.windowOptions)||w(k)))}registerDcsHandler(b,w){return this._parser.registerDcsHandler(b,new m.DcsHandler(w))}registerEscHandler(b,w){return this._parser.registerEscHandler(b,w)}registerOscHandler(b,w){return this._parser.registerOscHandler(b,new f.OscHandler(w))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var b;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(!((b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||b===void 0)&&b.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);w.hasWidth(this._activeBuffer.x)&&!w.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const b=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-b),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(b=this._bufferService.cols-1){this._activeBuffer.x=Math.min(b,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(b,w){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=b,this._activeBuffer.y=this._activeBuffer.scrollTop+w):(this._activeBuffer.x=b,this._activeBuffer.y=w),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(b,w){this._restrictCursor(),this._setCursor(this._activeBuffer.x+b,this._activeBuffer.y+w)}cursorUp(b){const w=this._activeBuffer.y-this._activeBuffer.scrollTop;return w>=0?this._moveCursor(0,-Math.min(w,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1)),!0}cursorDown(b){const w=this._activeBuffer.scrollBottom-this._activeBuffer.y;return w>=0?this._moveCursor(0,Math.min(w,b.params[0]||1)):this._moveCursor(0,b.params[0]||1),!0}cursorForward(b){return this._moveCursor(b.params[0]||1,0),!0}cursorBackward(b){return this._moveCursor(-(b.params[0]||1),0),!0}cursorNextLine(b){return this.cursorDown(b),this._activeBuffer.x=0,!0}cursorPrecedingLine(b){return this.cursorUp(b),this._activeBuffer.x=0,!0}cursorCharAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(b){return this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1),!0}charPosAbsolute(b){return this._setCursor((b.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(b){return this._moveCursor(b.params[0]||1,0),!0}linePosAbsolute(b){return this._setCursor(this._activeBuffer.x,(b.params[0]||1)-1),!0}vPositionRelative(b){return this._moveCursor(0,b.params[0]||1),!0}hVPosition(b){return this.cursorPosition(b),!0}tabClear(b){const w=b.params[0];return w===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:w===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=b.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(b){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let w=b.params[0]||1;for(;w--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(b){const w=b.params[0];return w===1&&(this._curAttrData.bg|=536870912),w!==2&&w!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(b,w,k,D=!1,N=!1){const W=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);W.replaceCells(w,k,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),N),D&&(W.isWrapped=!1)}_resetBufferLine(b,w=!1){const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+b);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),w),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+b),k.isWrapped=!1)}eraseInDisplay(b,w=!1){let k;switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);k<this._bufferService.rows;k++)this._resetBufferLine(k,w);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,w),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,w);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,w);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(b,w=!1){switch(this._restrictCursor(this._bufferService.cols),b.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,w);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,w);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,w)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(b){this._restrictCursor();let w=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const k=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;w--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(b){this._restrictCursor();let w=b.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const k=this._activeBuffer.ybase+this._activeBuffer.y;let D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;w--;)this._activeBuffer.lines.splice(k,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(b){this._restrictCursor();const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.insertCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(b){this._restrictCursor();const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.deleteCells(this._activeBuffer.x,b.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(b){let w=b.params[0]||1;for(;w--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(b){let w=b.params[0]||1;for(;w--;)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(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.deleteCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.insertCells(0,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.insertCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(b){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const w=b.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);D.deleteCells(this._activeBuffer.x,w,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(b){this._restrictCursor();const w=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return w&&(w.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(b.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(b){if(!this._parser.precedingCodepoint)return!0;const w=b.params[0]||1,k=new Uint32Array(w);for(let D=0;D<w;++D)k[D]=this._parser.precedingCodepoint;return this.print(k,0,k.length),!0}sendDeviceAttributesPrimary(b){return b.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(b){return b.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(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(n.C0.ESC+"[>83;40003;0c")),!0}_is(b){return(this._optionsService.rawOptions.termName+"").indexOf(b)===0}setMode(b){for(let w=0;w<b.length;w++)switch(b.params[w]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(b){for(let w=0;w<b.length;w++)switch(b.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(b){for(let w=0;w<b.length;w++)switch(b.params[w]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(b){for(let w=0;w<b.length;w++)switch(b.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),b.params[w]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(b,w){const k=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:N}=this._coreMouseService,W=this._coreService,{buffers:V,cols:q}=this._bufferService,{active:ee,alt:S}=V,R=this._optionsService.rawOptions,M=Q=>Q?1:2,O=b.params[0];return Y=O,U=w?O===2?4:O===4?M(W.modes.insertMode):O===12?3:O===20?M(R.convertEol):0:O===1?M(k.applicationCursorKeys):O===3?R.windowOptions.setWinLines?q===80?2:q===132?1:0:0:O===6?M(k.origin):O===7?M(k.wraparound):O===8?3:O===9?M(D==="X10"):O===12?M(R.cursorBlink):O===25?M(!W.isCursorHidden):O===45?M(k.reverseWraparound):O===66?M(k.applicationKeypad):O===67?4:O===1e3?M(D==="VT200"):O===1002?M(D==="DRAG"):O===1003?M(D==="ANY"):O===1004?M(k.sendFocus):O===1005?4:O===1006?M(N==="SGR"):O===1015?4:O===1016?M(N==="SGR_PIXELS"):O===1048?1:O===47||O===1047||O===1049?M(ee===S):O===2004?M(k.bracketedPasteMode):0,W.triggerDataEvent(`${n.C0.ESC}[${w?"":"?"}${Y};${U}$y`),!0;var Y,U}_updateAttrColor(b,w,k,D,N){return w===2?(b|=50331648,b&=-16777216,b|=o.AttributeData.fromColorRGB([k,D,N])):w===5&&(b&=-50331904,b|=33554432|255&k),b}_extractColor(b,w,k){const D=[0,0,-1,0,0,0];let N=0,W=0;do{if(D[W+N]=b.params[w+W],b.hasSubParams(w+W)){const V=b.getSubParams(w+W);let q=0;do D[1]===5&&(N=1),D[W+q+1+N]=V[q];while(++q<V.length&&q+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+w<b.length&&W+N<D.length);for(let V=2;V<D.length;++V)D[V]===-1&&(D[V]=0);switch(D[0]){case 38:k.fg=this._updateAttrColor(k.fg,D[1],D[3],D[4],D[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,D[1],D[3],D[4],D[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,D[1],D[3],D[4],D[5])}return W}_processUnderline(b,w){w.extended=w.extended.clone(),(!~b||b>5)&&(b=1),w.extended.underlineStyle=b,w.fg|=268435456,b===0&&(w.fg&=-268435457),w.updateExtended()}_processSGR0(b){b.fg=e.DEFAULT_ATTR_DATA.fg,b.bg=e.DEFAULT_ATTR_DATA.bg,b.extended=b.extended.clone(),b.extended.underlineStyle=0,b.extended.underlineColor&=-67108864,b.updateExtended()}charAttributes(b){if(b.length===1&&b.params[0]===0)return this._processSGR0(this._curAttrData),!0;const w=b.length;let k;const D=this._curAttrData;for(let N=0;N<w;N++)k=b.params[N],k>=30&&k<=37?(D.fg&=-50331904,D.fg|=16777216|k-30):k>=40&&k<=47?(D.bg&=-50331904,D.bg|=16777216|k-40):k>=90&&k<=97?(D.fg&=-50331904,D.fg|=16777224|k-90):k>=100&&k<=107?(D.bg&=-50331904,D.bg|=16777224|k-100):k===0?this._processSGR0(D):k===1?D.fg|=134217728:k===3?D.bg|=67108864:k===4?(D.fg|=268435456,this._processUnderline(b.hasSubParams(N)?b.getSubParams(N)[0]:1,D)):k===5?D.fg|=536870912:k===7?D.fg|=67108864:k===8?D.fg|=1073741824:k===9?D.fg|=2147483648:k===2?D.bg|=134217728:k===21?this._processUnderline(2,D):k===22?(D.fg&=-134217729,D.bg&=-134217729):k===23?D.bg&=-67108865:k===24?(D.fg&=-268435457,this._processUnderline(0,D)):k===25?D.fg&=-536870913:k===27?D.fg&=-67108865:k===28?D.fg&=-1073741825:k===29?D.fg&=2147483647:k===39?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):k===49?(D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?N+=this._extractColor(b,N,D):k===53?D.bg|=1073741824:k===55?D.bg&=-1073741825:k===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):k===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.",k);return!0}deviceStatus(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const w=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${w};${k}R`)}return!0}deviceStatusPrivate(b){if(b.params[0]===6){const w=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${w};${k}R`)}return!0}softReset(b){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(b){const w=b.params[0]||1;switch(w){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const k=w%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(b){const w=b.params[0]||1;let k;return(b.length<2||(k=b.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>w&&(this._activeBuffer.scrollTop=w-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(b){if(!L(b.params[0],this._optionsService.rawOptions.windowOptions))return!0;const w=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:w!==2&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:w!==0&&w!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),w!==0&&w!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:w!==0&&w!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),w!==0&&w!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(b){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(b){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(b){return this._windowTitle=b,this._onTitleChange.fire(b),!0}setIconName(b){return this._iconName=b,!0}setOrReportIndexedColor(b){const w=[],k=b.split(";");for(;k.length>1;){const D=k.shift(),N=k.shift();if(/^\d+$/.exec(D)){const W=parseInt(D);if(H(W))if(N==="?")w.push({type:0,index:W});else{const V=(0,l.parseColor)(N);V&&w.push({type:1,index:W,color:V})}}}return w.length&&this._onColor.fire(w),!0}setHyperlink(b){const w=b.split(";");return!(w.length<2)&&(w[1]?this._createHyperlink(w[0],w[1]):!w[0]&&this._finishHyperlink())}_createHyperlink(b,w){this._getCurrentLinkId()&&this._finishHyperlink();const k=b.split(":");let D;const N=k.findIndex((W=>W.startsWith("id=")));return N!==-1&&(D=k[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:w}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(b,w){const k=b.split(";");for(let D=0;D<k.length&&!(w>=this._specialColors.length);++D,++w)if(k[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[w]}]);else{const N=(0,l.parseColor)(k[D]);N&&this._onColor.fire([{type:1,index:this._specialColors[w],color:N}])}return!0}setOrReportFgColor(b){return this._setOrReportSpecialColor(b,0)}setOrReportBgColor(b){return this._setOrReportSpecialColor(b,1)}setOrReportCursorColor(b){return this._setOrReportSpecialColor(b,2)}restoreIndexedColor(b){if(!b)return this._onColor.fire([{type:2}]),!0;const w=[],k=b.split(";");for(let D=0;D<k.length;++D)if(/^\d+$/.exec(k[D])){const N=parseInt(k[D]);H(N)&&w.push({type:2,index:N})}return w.length&&this._onColor.fire(w),!0}restoreFgColor(b){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(b){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(b){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(b){return b.length!==2?(this.selectDefaultCharset(),!0):(b[0]==="/"||this._charsetService.setgCharset(p[b[0]],d.CHARSETS[b[1]]||d.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const b=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,b,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(b){return this._charsetService.setgLevel(b),!0}screenAlignmentPattern(){const b=new t.CellData;b.content=4194373,b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg,this._setCursor(0,0);for(let w=0;w<this._bufferService.rows;++w){const k=this._activeBuffer.ybase+this._activeBuffer.y+w,D=this._activeBuffer.lines.get(k);D&&(D.fill(b),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(b,w){const k=this._bufferService.buffer,D=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${n.C0.ESC}${N}${n.C0.ESC}\\`),!0))(b==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:b==='"p'?'P1$r61;1"p':b==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:b==="m"?"P1$r0m":b===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(b,w){this._dirtyRowTracker.markRangeDirty(b,w)}}r.InputHandler=B;let I=class{constructor(j){this._bufferService=j,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(j){j<this.start?this.start=j:j>this.end&&(this.end=j)}markRangeDirty(j,b){j>b&&(E=j,j=b,b=E),j<this.start&&(this.start=j),b>this.end&&(this.end=b)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H(j){return 0<=j&&j<256}I=h([_(0,c.IBufferService)],I)},844:(T,r)=>{function a(h){for(const _ of h)_.dispose();h.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.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 _=this._disposables.indexOf(h);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var _;this._isDisposed||h===this._value||((_=this._value)===null||_===void 0||_.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)===null||h===void 0||h.dispose(),this._value=void 0}},r.toDisposable=function(h){return{dispose:h}},r.disposeArray=a,r.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,n,d){this._data[_]||(this._data[_]={}),this._data[_][n]=d}get(_,n){return this._data[_]?this._data[_][n]:void 0}clear(){this._data={}}}r.TwoKeyMap=a,r.FourKeyMap=class{constructor(){this._data=new a}set(h,_,n,d,v){this._data.get(h,_)||this._data.set(h,_,new a),this._data.get(h,_).set(n,d,v)}get(h,_,n,d){var v;return(v=this._data.get(h,_))===null||v===void 0?void 0:v.get(n,d)}clear(){this._data.clear()}}},6114:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const a=r.isNode?"node":navigator.userAgent,h=r.isNode?"node":navigator.platform;r.isFirefox=a.includes("Firefox"),r.isLegacyEdge=a.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(a),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=a.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),r.isIpad=h==="iPad",r.isIphone=h==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),r.isLinux=h.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(a)},6106:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let a=0;r.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 _=this._getKey(h);if(_===void 0||(a=this._search(_),a===-1)||this._getKey(this._array[a])!==_)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])===_);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,_){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do _(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let _=0,n=this._array.length-1;for(;n>=_;){let d=_+n>>1;const v=this._getKey(this._array[d]);if(v>h)n=d-1;else{if(!(v<h)){for(;d>0&&this._getKey(this._array[d-1])===h;)d--;return d}_=d+1}}return _}}},7226:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const h=a(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let g=0,u=0,e=v.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),u=Math.max(g,u),i=v.timeRemaining(),1.5*u>i)return e-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-g))}ms`),void this._start();e=i}this.clear()}}class n extends _{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const g=Date.now()+v;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}r.PriorityTaskQueue=n,r.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:n,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const h=a(643);r.updateWindowsModeWrappedState=function(_){const n=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),d=n==null?void 0:n.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&d&&(v.isWrapped=d[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&d[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.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}}r.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}constructor(n=0,d=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=d}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=h},9092:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const h=a(6349),_=a(7226),n=a(3734),d=a(8437),v=a(4634),g=a(511),u=a(643),e=a(4863),i=a(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(s,t,o){this._hasScrollback=s,this._optionsService=t,this._bufferService=o,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.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(s){return s?(this._nullCell.fg=s.fg,this._nullCell.bg=s.bg,this._nullCell.extended=s.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(s){return s?(this._whitespaceCell.fg=s.fg,this._whitespaceCell.bg=s.bg,this._whitespaceCell.extended=s.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(s,t){return new d.BufferLine(this._bufferService.cols,this.getNullCell(s),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const s=this.ybase+this.y-this.ydisp;return s>=0&&s<this._rows}_getCorrectBufferLength(s){if(!this._hasScrollback)return s;const t=s+this._optionsService.rawOptions.scrollback;return t>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:t}fillViewportRows(s){if(this.lines.length===0){s===void 0&&(s=d.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(s))}}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(s,t){const o=this.getNullCell(d.DEFAULT_ATTR_DATA);let c=0;const f=this._getCorrectBufferLength(t);if(f>this.lines.maxLength&&(this.lines.maxLength=f),this.lines.length>0){if(this._cols<s)for(let l=0;l<this.lines.length;l++)c+=+this.lines.get(l).resize(s,o);let m=0;if(this._rows<t)for(let l=this._rows;l<t;l++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new d.BufferLine(s,o)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(s,o)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(f<this.lines.maxLength){const l=this.lines.length-f;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=f}this.x=Math.min(this.x,s-1),this.y=Math.min(this.y,t-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,s-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(s,t),this._cols>s))for(let m=0;m<this.lines.length;m++)c+=+this.lines.get(m).resize(s,o);this._cols=s,this._rows=t,this._memoryCleanupQueue.clear(),c>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let s=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,s=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return s}get _isReflowEnabled(){const s=this._optionsService.rawOptions.windowsPty;return s&&s.buildNumber?this._hasScrollback&&s.backend==="conpty"&&s.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(s,t){this._cols!==s&&(s>this._cols?this._reflowLarger(s,t):this._reflowSmaller(s,t))}_reflowLarger(s,t){const o=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,s,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(o.length>0){const c=(0,v.reflowLargerCreateNewLayout)(this.lines,o);(0,v.reflowLargerApplyNewLayout)(this.lines,c.layout),this._reflowLargerAdjustViewport(s,t,c.countRemoved)}}_reflowLargerAdjustViewport(s,t,o){const c=this.getNullCell(d.DEFAULT_ATTR_DATA);let f=o;for(;f-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new d.BufferLine(s,c))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-o,0)}_reflowSmaller(s,t){const o=this.getNullCell(d.DEFAULT_ATTR_DATA),c=[];let f=0;for(let m=this.lines.length-1;m>=0;m--){let l=this.lines.get(m);if(!l||!l.isWrapped&&l.getTrimmedLength()<=s)continue;const p=[l];for(;l.isWrapped&&m>0;)l=this.lines.get(--m),p.unshift(l);const x=this.ybase+this.y;if(x>=m&&x<m+p.length)continue;const L=p[p.length-1].getTrimmedLength(),y=(0,v.reflowSmallerGetNewLineLengths)(p,this._cols,s),E=y.length-p.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+E):Math.max(0,this.lines.length-this.lines.maxLength+E);const I=[];for(let D=0;D<E;D++){const N=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);I.push(N)}I.length>0&&(c.push({start:m+p.length+f,newLines:I}),f+=I.length),p.push(...I);let H=y.length-1,j=y[H];j===0&&(H--,j=y[H]);let b=p.length-E-1,w=L;for(;b>=0;){const D=Math.min(w,j);if(p[H]===void 0)break;if(p[H].copyCellsFrom(p[b],w-D,j-D,D,!0),j-=D,j===0&&(H--,j=y[H]),w-=D,w===0){b--;const N=Math.max(b,0);w=(0,v.getWrappedLineTrimmedLength)(p,N,this._cols)}}for(let D=0;D<p.length;D++)y[D]<s&&p[D].setCell(y[D],o);let k=E-B;for(;k-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+f)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+E,this.ybase+t-1)}if(c.length>0){const m=[],l=[];for(let H=0;H<this.lines.length;H++)l.push(this.lines.get(H));const p=this.lines.length;let x=p-1,L=0,y=c[L];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+f);let E=0;for(let H=Math.min(this.lines.maxLength-1,p+f-1);H>=0;H--)if(y&&y.start>x+E){for(let j=y.newLines.length-1;j>=0;j--)this.lines.set(H--,y.newLines[j]);H++,m.push({index:x+1,amount:y.newLines.length}),E+=y.newLines.length,y=c[++L]}else this.lines.set(H,l[x--]);let B=0;for(let H=m.length-1;H>=0;H--)m[H].index+=B,this.lines.onInsertEmitter.fire(m[H]),B+=m[H].amount;const I=Math.max(0,p+f-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(s,t,o=0,c){const f=this.lines.get(s);return f?f.translateToString(t,o,c):""}getWrappedRangeForLine(s){let t=s,o=s;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;o+1<this.lines.length&&this.lines.get(o+1).isWrapped;)o++;return{first:t,last:o}}setupTabStops(s){for(s!=null?this.tabs[s]||(s=this.prevStop(s)):(this.tabs={},s=0);s<this._cols;s+=this._optionsService.rawOptions.tabStopWidth)this.tabs[s]=!0}prevStop(s){for(s==null&&(s=this.x);!this.tabs[--s]&&s>0;);return s>=this._cols?this._cols-1:s<0?0:s}nextStop(s){for(s==null&&(s=this.x);!this.tabs[++s]&&s<this._cols;);return s>=this._cols?this._cols-1:s<0?0:s}clearMarkers(s){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===s&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].dispose(),this.markers.splice(s--,1);this._isClearing=!1}addMarker(s){const t=new e.Marker(s);return this.markers.push(t),t.register(this.lines.onTrim((o=>{t.line-=o,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((o=>{t.line>=o.index&&(t.line+=o.amount)}))),t.register(this.lines.onDelete((o=>{t.line>=o.index&&t.line<o.index+o.amount&&t.dispose(),t.line>o.index&&(t.line-=o.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(s){this._isClearing||this.markers.splice(this.markers.indexOf(s),1)}}},8437:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const h=a(3734),_=a(511),n=a(643),d=a(482);r.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let v=0;class g{constructor(e,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const t=i||_.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let o=0;o<e;++o)this.setCell(o,t);this.length=e}get(e){const i=this._data[3*e+0],s=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:s?(0,d.stringFromCodePoint)(s):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[3*e+1]=i[n.CHAR_DATA_ATTR_INDEX],i[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=i[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?(0,d.stringFromCodePoint)(2097151&i):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,i){return v=3*e,i.content=this._data[v+0],i.fg=this._data[v+1],i.bg=this._data[v+2],2097152&i.content&&(i.combinedData=this._combined[e]),268435456&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodePoint(e,i,s,t,o,c){268435456&o&&(this._extendedAttrs[e]=c),this._data[3*e+0]=i|s<<22,this._data[3*e+1]=t,this._data[3*e+2]=o}addCodepointToCell(e,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,d.stringFromCodePoint)(i):(2097151&s?(this._combined[e]=(0,d.stringFromCodePoint)(2097151&s)+(0,d.stringFromCodePoint)(i),s&=-2097152,s|=2097152):s=i|4194304,this._data[3*e+0]=s)}insertCells(e,i,s,t){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs),i<this.length-e){const o=new _.CellData;for(let c=this.length-e-i-1;c>=0;--c)this.setCell(e+i+c,this.loadCell(e+c,o));for(let c=0;c<i;++c)this.setCell(e+c,s)}else for(let o=e;o<this.length;++o)this.setCell(o,s);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs)}deleteCells(e,i,s,t){if(e%=this.length,i<this.length-e){const o=new _.CellData;for(let c=0;c<this.length-e-i;++c)this.setCell(e+c,this.loadCell(e+i+c,o));for(let c=this.length-i;c<this.length;++c)this.setCell(c,s)}else for(let o=e;o<this.length;++o)this.setCell(o,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs)}replaceCells(e,i,s,t,o=!1){if(o)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodePoint(i,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodePoint(i,0,1,(t==null?void 0:t.fg)||0,(t==null?void 0:t.bg)||0,(t==null?void 0:t.extended)||new h.ExtendedAttrs);e<i&&e<this.length;)this.setCell(e++,s)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const s=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{const t=new Uint32Array(s);t.set(this._data),this._data=t}for(let t=this.length;t<e;++t)this.setCell(t,i)}else{this._data=this._data.subarray(0,s);const t=Object.keys(this._combined);for(let c=0;c<t.length;c++){const f=parseInt(t[c],10);f>=e&&delete this._combined[f]}const o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){const f=parseInt(o[c],10);f>=e&&delete this._extendedAttrs[f]}}return this.length=e,4*s*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i)for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);else{this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(const i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){const e=new g(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const i in this._combined)e._combined[i]=this._combined[i];for(const i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,s,t,o){const c=e._data;if(o)for(let m=t-1;m>=0;m--){for(let l=0;l<3;l++)this._data[3*(s+m)+l]=c[3*(i+m)+l];268435456&c[3*(i+m)+2]&&(this._extendedAttrs[s+m]=e._extendedAttrs[i+m])}else for(let m=0;m<t;m++){for(let l=0;l<3;l++)this._data[3*(s+m)+l]=c[3*(i+m)+l];268435456&c[3*(i+m)+2]&&(this._extendedAttrs[s+m]=e._extendedAttrs[i+m])}const f=Object.keys(e._combined);for(let m=0;m<f.length;m++){const l=parseInt(f[m],10);l>=i&&(this._combined[l-i+s]=e._combined[l])}}translateToString(e=!1,i=0,s=this.length){e&&(s=Math.min(s,this.getTrimmedLength()));let t="";for(;i<s;){const o=this._data[3*i+0],c=2097151&o;t+=2097152&o?this._combined[i]:c?(0,d.stringFromCodePoint)(c):n.WHITESPACE_CELL_CHAR,i+=o>>22||1}return t}}r.BufferLine=g},4841:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(T,r)=>{function a(h,_,n){if(_===h.length-1)return h[_].getTrimmedLength();const d=!h[_].hasContent(n-1)&&h[_].getWidth(n-1)===1,v=h[_+1].getWidth(0)===2;return d&&v?n-1:n}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(h,_,n,d,v){const g=[];for(let u=0;u<h.length-1;u++){let e=u,i=h.get(++e);if(!i.isWrapped)continue;const s=[h.get(u)];for(;e<h.length&&i.isWrapped;)s.push(i),i=h.get(++e);if(d>=u&&d<e){u+=s.length-1;continue}let t=0,o=a(s,t,_),c=1,f=0;for(;c<s.length;){const l=a(s,c,_),p=l-f,x=n-o,L=Math.min(p,x);s[t].copyCellsFrom(s[c],f,o,L,!1),o+=L,o===n&&(t++,o=0),f+=L,f===l&&(c++,f=0),o===0&&t!==0&&s[t-1].getWidth(n-1)===2&&(s[t].copyCellsFrom(s[t-1],n-1,o++,1,!1),s[t-1].setCell(n-1,v))}s[t].replaceCells(o,n,v);let m=0;for(let l=s.length-1;l>0&&(l>t||s[l].getTrimmedLength()===0);l--)m++;m>0&&(g.push(u+s.length-m),g.push(m)),u+=s.length-1}return g},r.reflowLargerCreateNewLayout=function(h,_){const n=[];let d=0,v=_[d],g=0;for(let u=0;u<h.length;u++)if(v===u){const e=_[++d];h.onDeleteEmitter.fire({index:u-g,amount:e}),u+=e-1,g+=e,v=_[++d]}else n.push(u);return{layout:n,countRemoved:g}},r.reflowLargerApplyNewLayout=function(h,_){const n=[];for(let d=0;d<_.length;d++)n.push(h.get(_[d]));for(let d=0;d<n.length;d++)h.set(d,n[d]);h.length=_.length},r.reflowSmallerGetNewLineLengths=function(h,_,n){const d=[],v=h.map(((i,s)=>a(h,s,_))).reduce(((i,s)=>i+s));let g=0,u=0,e=0;for(;e<v;){if(v-e<n){d.push(v-e);break}g+=n;const i=a(h,u,_);g>i&&(g-=i,u++);const s=h[u].getWidth(g-1)===2;s&&g--;const t=s?n-1:n;d.push(t),e+=t}return d},r.getWrappedLineTrimmedLength=a},5295:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const h=a(8460),_=a(844),n=a(9092);class d extends _.Disposable{constructor(g,u){super(),this._optionsService=g,this._bufferService=u,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(g){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(g),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(g,u){this._normal.resize(g,u),this._alt.resize(g,u),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}r.BufferSet=d},511:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const h=a(482),_=a(643),n=a(3734);class d extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const u=new d;return u.setFromCharData(g),u}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(g){this.fg=g[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(g[_.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(g[_.CHAR_DATA_CHAR_INDEX].length===2){const e=g[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=g[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|g[_.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=g[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[_.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=g[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=d},643:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const h=a(8460),_=a(844);class n{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=n,n._nextId=1},7116:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(T,r)=>{var a,h,_;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.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=`
43
43
  `,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||(r.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||(r.C1=h={})),(function(n){n.ST=`${a.ESC}\\`})(_||(r.C1_ESCAPED=_={}))},7399:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const h=a(2584),_={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:["'",'"']};r.evaluateKeyboardEvent=function(n,d,v,g){const u={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"?u.key=d?h.C0.ESC+"OA":h.C0.ESC+"[A":n.key==="UIKeyInputLeftArrow"?u.key=d?h.C0.ESC+"OD":h.C0.ESC+"[D":n.key==="UIKeyInputRightArrow"?u.key=d?h.C0.ESC+"OC":h.C0.ESC+"[C":n.key==="UIKeyInputDownArrow"&&(u.key=d?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:if(n.altKey){u.key=h.C0.ESC+h.C0.DEL;break}u.key=h.C0.DEL;break;case 9:if(n.shiftKey){u.key=h.C0.ESC+"[Z";break}u.key=h.C0.HT,u.cancel=!0;break;case 13:u.key=n.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,u.cancel=!0;break;case 27:u.key=h.C0.ESC,n.altKey&&(u.key=h.C0.ESC+h.C0.ESC),u.cancel=!0;break;case 37:if(n.metaKey)break;e?(u.key=h.C0.ESC+"[1;"+(e+1)+"D",u.key===h.C0.ESC+"[1;3D"&&(u.key=h.C0.ESC+(v?"b":"[1;5D"))):u.key=d?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(n.metaKey)break;e?(u.key=h.C0.ESC+"[1;"+(e+1)+"C",u.key===h.C0.ESC+"[1;3C"&&(u.key=h.C0.ESC+(v?"f":"[1;5C"))):u.key=d?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(n.metaKey)break;e?(u.key=h.C0.ESC+"[1;"+(e+1)+"A",v||u.key!==h.C0.ESC+"[1;3A"||(u.key=h.C0.ESC+"[1;5A")):u.key=d?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(n.metaKey)break;e?(u.key=h.C0.ESC+"[1;"+(e+1)+"B",v||u.key!==h.C0.ESC+"[1;3B"||(u.key=h.C0.ESC+"[1;5B")):u.key=d?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:n.shiftKey||n.ctrlKey||(u.key=h.C0.ESC+"[2~");break;case 46:u.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:u.key=e?h.C0.ESC+"[1;"+(e+1)+"H":d?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:u.key=e?h.C0.ESC+"[1;"+(e+1)+"F":d?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:n.shiftKey?u.type=2:n.ctrlKey?u.key=h.C0.ESC+"[5;"+(e+1)+"~":u.key=h.C0.ESC+"[5~";break;case 34:n.shiftKey?u.type=3:n.ctrlKey?u.key=h.C0.ESC+"[6;"+(e+1)+"~":u.key=h.C0.ESC+"[6~";break;case 112:u.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:u.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:u.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:u.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:u.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:u.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:u.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:u.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:u.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:u.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:u.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:u.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!n.ctrlKey||n.shiftKey||n.altKey||n.metaKey)if(v&&!g||!n.altKey||n.metaKey)!v||n.altKey||n.ctrlKey||n.shiftKey||!n.metaKey?n.key&&!n.ctrlKey&&!n.altKey&&!n.metaKey&&n.keyCode>=48&&n.key.length===1?u.key=n.key:n.key&&n.ctrlKey&&(n.key==="_"&&(u.key=h.C0.US),n.key==="@"&&(u.key=h.C0.NUL)):n.keyCode===65&&(u.type=1);else{const i=_[n.keyCode],s=i==null?void 0:i[n.shiftKey?1:0];if(s)u.key=h.C0.ESC+s;else if(n.keyCode>=65&&n.keyCode<=90){const t=n.ctrlKey?n.keyCode-64:n.keyCode+32;let o=String.fromCharCode(t);n.shiftKey&&(o=o.toUpperCase()),u.key=h.C0.ESC+o}else if(n.keyCode===32)u.key=h.C0.ESC+(n.ctrlKey?h.C0.NUL:" ");else if(n.key==="Dead"&&n.code.startsWith("Key")){let t=n.code.slice(3,4);n.shiftKey||(t=t.toLowerCase()),u.key=h.C0.ESC+t,u.cancel=!0}}else n.keyCode>=65&&n.keyCode<=90?u.key=String.fromCharCode(n.keyCode-64):n.keyCode===32?u.key=h.C0.NUL:n.keyCode>=51&&n.keyCode<=55?u.key=String.fromCharCode(n.keyCode-51+27):n.keyCode===56?u.key=h.C0.DEL:n.keyCode===219?u.key=h.C0.ESC:n.keyCode===220?u.key=h.C0.FS:n.keyCode===221&&(u.key=h.C0.GS)}return u}},482:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},r.utf32ToString=function(a,h=0,_=a.length){let n="";for(let d=h;d<_;++d){let v=a[d];v>65535?(v-=65536,n+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):n+=String.fromCharCode(v)}return n},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const _=a.length;if(!_)return 0;let n=0,d=0;if(this._interim){const v=a.charCodeAt(d++);56320<=v&&v<=57343?h[n++]=1024*(this._interim-55296)+v-56320+65536:(h[n++]=this._interim,h[n++]=v),this._interim=0}for(let v=d;v<_;++v){const g=a.charCodeAt(v);if(55296<=g&&g<=56319){if(++v>=_)return this._interim=g,n;const u=a.charCodeAt(v);56320<=u&&u<=57343?h[n++]=1024*(g-55296)+u-56320+65536:(h[n++]=g,h[n++]=u)}else g!==65279&&(h[n++]=g)}return n}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const _=a.length;if(!_)return 0;let n,d,v,g,u=0,e=0,i=0;if(this.interim[0]){let o=!1,c=this.interim[0];c&=(224&c)==192?31:(240&c)==224?15:7;let f,m=0;for(;(f=63&this.interim[++m])&&m<4;)c<<=6,c|=f;const l=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=l-m;for(;i<p;){if(i>=_)return 0;if(f=a[i++],(192&f)!=128){i--,o=!0;break}this.interim[m++]=f,c<<=6,c|=63&f}o||(l===2?c<128?i--:h[u++]=c:l===3?c<2048||c>=55296&&c<=57343||c===65279||(h[u++]=c):c<65536||c>1114111||(h[u++]=c)),this.interim.fill(0)}const s=_-4;let t=i;for(;t<_;){for(;!(!(t<s)||128&(n=a[t])||128&(d=a[t+1])||128&(v=a[t+2])||128&(g=a[t+3]));)h[u++]=n,h[u++]=d,h[u++]=v,h[u++]=g,t+=4;if(n=a[t++],n<128)h[u++]=n;else if((224&n)==192){if(t>=_)return this.interim[0]=n,u;if(d=a[t++],(192&d)!=128){t--;continue}if(e=(31&n)<<6|63&d,e<128){t--;continue}h[u++]=e}else if((240&n)==224){if(t>=_)return this.interim[0]=n,u;if(d=a[t++],(192&d)!=128){t--;continue}if(t>=_)return this.interim[0]=n,this.interim[1]=d,u;if(v=a[t++],(192&v)!=128){t--;continue}if(e=(15&n)<<12|(63&d)<<6|63&v,e<2048||e>=55296&&e<=57343||e===65279)continue;h[u++]=e}else if((248&n)==240){if(t>=_)return this.interim[0]=n,u;if(d=a[t++],(192&d)!=128){t--;continue}if(t>=_)return this.interim[0]=n,this.interim[1]=d,u;if(v=a[t++],(192&v)!=128){t--;continue}if(t>=_)return this.interim[0]=n,this.interim[1]=d,this.interim[2]=v,u;if(g=a[t++],(192&g)!=128){t--;continue}if(e=(7&n)<<18|(63&d)<<12|(63&v)<<6|63&g,e<65536||e>1114111)continue;h[u++]=e}}return u}}},225:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const a=[[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]],h=[[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 _;r.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 n=0;n<a.length;++n)_.fill(0,a[n][0],a[n][1]+1)}}wcwidth(n){return n<32?0:n<127?1:n<65536?_[n]:(function(d,v){let g,u=0,e=v.length-1;if(d<v[0][0]||d>v[e][1])return!1;for(;e>=u;)if(g=u+e>>1,d>v[g][1])u=g+1;else{if(!(d<v[g][0]))return!0;e=g-1}return!1})(n,h)?0:n>=131072&&n<=196605||n>=196608&&n<=262141?2:1}}},5981:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const h=a(8460),_=a(844);class n extends _.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,g){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(g),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(g)}_innerWrite(v=0,g=!0){const u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],i=this._action(e,g);if(i){const t=o=>Date.now()-u>=12?setTimeout((()=>this._innerWrite(0,o))):this._innerWrite(u,o);return void i.catch((o=>(queueMicrotask((()=>{throw o})),Promise.resolve(!1)))).then(t)}const s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-u>=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()}}r.WriteBuffer=n},5941:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.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 _(n,d){const v=n.toString(16),g=v.length<2?"0"+v:v;switch(d){case 4:return v[0];case 8:return g;case 12:return(g+g).slice(0,3);default:return g+g}}r.parseColor=function(n){if(!n)return;let d=n.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const v=a.exec(d);if(v){const g=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/g*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/g*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/g*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),h.exec(d)&&[3,6,9,12].includes(d.length))){const v=d.length/3,g=[0,0,0];for(let u=0;u<3;++u){const e=parseInt(d.slice(v*u,v*u+v),16);g[u]=v===1?e<<4:v===2?e:v===3?e>>4:e>>8}return g}},r.toRgbString=function(n,d=16){const[v,g,u]=n;return`rgb:${_(v,d)}/${_(g,d)}/${_(u,d)}`}},5770:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const h=a(482),_=a(8742),n=a(5770),d=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(g,u){this._handlers[g]===void 0&&(this._handlers[g]=[]);const e=this._handlers[g];return e.push(u),{dispose:()=>{const i=e.indexOf(u);i!==-1&&e.splice(i,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}reset(){if(this._active.length)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(g,u){if(this.reset(),this._ident=g,this._active=this._handlers[g]||d,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(g,u,e){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(g,u,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(g,u,e))}unhook(g,u=!0){if(this._active.length){let e=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,e=u,s=this._stack.fallThrough,this._stack.paused=!1),!s&&e===!1){for(;i>=0&&(e=this._active[i].unhook(g),e!==!0);i--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,e;i--}for(;i>=0;i--)if(e=this._active[i].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",g);this._active=d,this._ident=0}};const v=new _.Params;v.addParam(0),r.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=v,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():v,this._data="",this._hitLimit=!1}put(g,u,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(g,u,e),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let u=!1;if(this._hitLimit)u=!1;else if(g&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then((e=>(this._params=v,this._data="",this._hitLimit=!1,e)));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const h=a(844),_=a(8742),n=a(6242),d=a(6351);class v{constructor(i){this.table=new Uint8Array(i)}setDefault(i,s){this.table.fill(i<<4|s)}add(i,s,t,o){this.table[s<<8|i]=t<<4|o}addMany(i,s,t,o){for(let c=0;c<i.length;c++)this.table[s<<8|i[c]]=t<<4|o}}r.TransitionTable=v;const g=160;r.VT500_TRANSITION_TABLE=(function(){const e=new v(4095),i=Array.apply(null,Array(256)).map(((m,l)=>l)),s=(m,l)=>i.slice(m,l),t=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));const c=s(0,14);let f;for(f in e.setDefault(1,0),e.addMany(t,0,2,0),c)e.addMany([24,26,153,154],f,3,0),e.addMany(s(128,144),f,3,0),e.addMany(s(144,152),f,3,0),e.add(156,f,0,0),e.add(27,f,11,1),e.add(157,f,4,8),e.addMany([152,158,159],f,0,7),e.add(155,f,11,3),e.add(144,f,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(t,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(t,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(t,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(g,0,2,0),e.add(g,8,5,8),e.add(g,6,0,6),e.add(g,11,0,11),e.add(g,13,13,13),e})();class u extends h.Disposable{constructor(i=r.VT500_TRANSITION_TABLE){super(),this._transitions=i,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(s,t,o)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,t)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,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 d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(i,s=[64,126]){let t=0;if(i.prefix){if(i.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=i.prefix.charCodeAt(0),t&&60>t||t>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let c=0;c<i.intermediates.length;++c){const f=i.intermediates.charCodeAt(c);if(32>f||f>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=f}}if(i.final.length!==1)throw new Error("final must be a single byte");const o=i.final.charCodeAt(0);if(s[0]>o||o>s[1])throw new Error(`final must be in range ${s[0]} .. ${s[1]}`);return t<<=8,t|=o,t}identToString(i){const s=[];for(;i;)s.push(String.fromCharCode(255&i)),i>>=8;return s.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,s){const t=this._identifier(i,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);const o=this._escHandlers[t];return o.push(s),{dispose:()=>{const c=o.indexOf(s);c!==-1&&o.splice(c,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,s){this._executeHandlers[i.charCodeAt(0)]=s}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,s){const t=this._identifier(i);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);const o=this._csiHandlers[t];return o.push(s),{dispose:()=>{const c=o.indexOf(s);c!==-1&&o.splice(c,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,s){return this._dcsParser.registerHandler(this._identifier(i),s)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,s){return this._oscParser.registerHandler(i,s)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(i,s,t,o,c){this._parseStack.state=i,this._parseStack.handlers=s,this._parseStack.handlerPos=t,this._parseStack.transition=o,this._parseStack.chunkPos=c}parse(i,s,t){let o,c=0,f=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const l=this._parseStack.handlers;let p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&p>-1){for(;p>=0&&(o=l[p](this._params),o!==!0);p--)if(o instanceof Promise)return this._parseStack.handlerPos=p,o}this._parseStack.handlers=[];break;case 4:if(t===!1&&p>-1){for(;p>=0&&(o=l[p](),o!==!0);p--)if(o instanceof Promise)return this._parseStack.handlerPos=p,o}this._parseStack.handlers=[];break;case 6:if(c=i[this._parseStack.chunkPos],o=this._dcsParser.unhook(c!==24&&c!==26,t),o)return o;c===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(c=i[this._parseStack.chunkPos],o=this._oscParser.end(c!==24&&c!==26,t),o)return o;c===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.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let l=m;l<s;++l){switch(c=i[l],f=this._transitions.table[this.currentState<<8|(c<160?c:g)],f>>4){case 2:for(let E=l+1;;++E){if(E>=s||(c=i[E])<32||c>126&&c<g){this._printHandler(i,l,E),l=E-1;break}if(++E>=s||(c=i[E])<32||c>126&&c<g){this._printHandler(i,l,E),l=E-1;break}if(++E>=s||(c=i[E])<32||c>126&&c<g){this._printHandler(i,l,E),l=E-1;break}if(++E>=s||(c=i[E])<32||c>126&&c<g){this._printHandler(i,l,E),l=E-1;break}}break;case 3:this._executeHandlers[c]?this._executeHandlers[c]():this._executeHandlerFb(c),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:c,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const p=this._csiHandlers[this._collect<<8|c];let x=p?p.length-1:-1;for(;x>=0&&(o=p[x](this._params),o!==!0);x--)if(o instanceof Promise)return this._preserveStack(3,p,x,f,l),o;x<0&&this._csiHandlerFb(this._collect<<8|c,this._params),this.precedingCodepoint=0;break;case 8:do switch(c){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(c-48)}while(++l<s&&(c=i[l])>47&&c<60);l--;break;case 9:this._collect<<=8,this._collect|=c;break;case 10:const L=this._escHandlers[this._collect<<8|c];let y=L?L.length-1:-1;for(;y>=0&&(o=L[y](),o!==!0);y--)if(o instanceof Promise)return this._preserveStack(4,L,y,f,l),o;y<0&&this._escHandlerFb(this._collect<<8|c),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|c,this._params);break;case 13:for(let E=l+1;;++E)if(E>=s||(c=i[E])===24||c===26||c===27||c>127&&c<g){this._dcsParser.put(i,l,E),l=E-1;break}break;case 14:if(o=this._dcsParser.unhook(c!==24&&c!==26),o)return this._preserveStack(6,[],0,f,l),o;c===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let E=l+1;;E++)if(E>=s||(c=i[E])<32||c>127&&c<g){this._oscParser.put(i,l,E),l=E-1;break}break;case 6:if(o=this._oscParser.end(c!==24&&c!==26),o)return this._preserveStack(5,[],0,f,l),o;c===27&&(f|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&f}}}r.EscapeSequenceParser=u},6242:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const h=a(5770),_=a(482),n=[];r.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(d,v){this._handlers[d]===void 0&&(this._handlers[d]=[]);const g=this._handlers[d];return g.push(v),{dispose:()=>{const u=g.indexOf(v);u!==-1&&g.splice(u,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].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 d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,v,g){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(d,v,g);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(d,v,g))}start(){this.reset(),this._state=1}put(d,v,g){if(this._state!==3){if(this._state===1)for(;v<g;){const u=d[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&g-v>0&&this._put(d,v,g)}}end(d,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,u=this._active.length-1,e=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,g=v,e=this._stack.fallThrough,this._stack.paused=!1),!e&&g===!1){for(;u>=0&&(g=this._active[u].end(d),g!==!0);u--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,g;u--}for(;u>=0;u--)if(g=this._active[u].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",d);this._active=n,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,v,g){this._hitLimit||(this._data+=(0,_.utf32ToString)(d,v,g),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let v=!1;if(this._hitLimit)v=!1;else if(d&&(v=this._handler(this._data),v instanceof Promise))return v.then((g=>(this._data="",this._hitLimit=!1,g)));return this._data="",this._hitLimit=!1,v}}},8742:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const a=2147483647;class h{static fromArray(n){const d=new h;if(!n.length)return d;for(let v=Array.isArray(n[0])?1:0;v<n.length;++v){const g=n[v];if(Array.isArray(g))for(let u=0;u<g.length;++u)d.addSubParam(g[u]);else d.addParam(g)}return d}constructor(n=32,d=32){if(this.maxLength=n,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(d),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 d=0;d<this.length;++d){n.push(this.params[d]);const v=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-v>0&&n.push(Array.prototype.slice.call(this._subParams,v,g))}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 d=this._subParamsIdx[n]>>8,v=255&this._subParamsIdx[n];return v-d>0?this._subParams.subarray(d,v):null}getSubParamsAll(){const n={};for(let d=0;d<this.length;++d){const v=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-v>0&&(n[d]=this._subParams.slice(v,g))}return n}addDigit(n){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,g=v[d-1];v[d-1]=~g?Math.min(10*g+n,a):n}}r.Params=h},5741:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.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 _={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(_),h.dispose=()=>this._wrappedAddonDispose(_),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===a){h=_;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const h=a(3785),_=a(511);r.BufferApiView=class{constructor(n,d){this._buffer=n,this.type=d}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 d=this._buffer.lines.get(n);if(d)return new h.BufferLineApiView(d)}getNullCell(){return new _.CellData}}},3785:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const h=a(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,n){if(!(_<0||_>=this._line.length))return n?(this._line.loadCell(_,n),n):this._line.loadCell(_,new h.CellData)}translateToString(_,n,d){return this._line.translateToString(_,n,d)}}},8285:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const h=a(8771),_=a(8460),n=a(844);class d extends n.Disposable{constructor(g){super(),this._core=g,this._onBufferChange=this.register(new _.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)}}r.BufferNamespaceApi=d},7975:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,(_=>h(_.toArray())))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,((_,n)=>h(_,n.toArray())))}addDcsHandler(a,h){return this.registerDcsHandler(a,h)}registerEscHandler(a,h){return this._core.registerEscHandler(a,h)}addEscHandler(a,h){return this.registerEscHandler(a,h)}registerOscHandler(a,h){return this._core.registerOscHandler(a,h)}addOscHandler(a,h){return this.registerOscHandler(a,h)}}},7090:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(T,r,a){var h=this&&this.__decorate||function(e,i,s,t){var o,c=arguments.length,f=c<3?i:t===null?t=Object.getOwnPropertyDescriptor(i,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,i,s,t);else for(var m=e.length-1;m>=0;m--)(o=e[m])&&(f=(c<3?o(f):c>3?o(i,s,f):o(i,s))||f);return c>3&&f&&Object.defineProperty(i,s,f),f},_=this&&this.__param||function(e,i){return function(s,t){i(s,t,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const n=a(8460),d=a(844),v=a(5295),g=a(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends d.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,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(e,this))}resize(e,i){this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){const s=this.buffer;let t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===e.fg&&t.getBg(0)===e.bg||(t=s.getBlankLine(e,i),this._cachedBlankLine=t),t.isWrapped=i;const o=s.ybase+s.scrollTop,c=s.ybase+s.scrollBottom;if(s.scrollTop===0){const f=s.lines.isFull;c===s.lines.length-1?f?s.lines.recycle().copyFrom(t):s.lines.push(t.clone()):s.lines.splice(c+1,0,t.clone()),f?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{const f=c-o+1;s.lines.shiftElements(o+1,f-1,-1),s.lines.set(c,t.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,i,s){const t=this.buffer;if(e<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else e+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);const o=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+e,t.ybase),0),o!==t.ydisp&&(i||this._onScroll.fire(t.ydisp))}};r.BufferService=u=h([_(0,g.IOptionsService)],u)},7994:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(T,r,a){var h=this&&this.__decorate||function(t,o,c,f){var m,l=arguments.length,p=l<3?o:f===null?f=Object.getOwnPropertyDescriptor(o,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(t,o,c,f);else for(var x=t.length-1;x>=0;x--)(m=t[x])&&(p=(l<3?m(p):l>3?m(o,c,p):m(o,c))||p);return l>3&&p&&Object.defineProperty(o,c,p),p},_=this&&this.__param||function(t,o){return function(c,f){o(c,f,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const n=a(2585),d=a(8460),v=a(844),g={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function u(t,o){let c=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(c|=64,c|=t.action):(c|=3&t.button,4&t.button&&(c|=64),8&t.button&&(c|=128),t.action===32?c|=32:t.action!==0||o||(c|=3)),c}const e=String.fromCharCode,i={DEFAULT:t=>{const o=[u(t,!1)+32,t.col+32,t.row+32];return o[0]>255||o[1]>255||o[2]>255?"":`\x1B[M${e(o[0])}${e(o[1])}${e(o[2])}`},SGR:t=>{const o=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${u(t,!0)};${t.col};${t.row}${o}`},SGR_PIXELS:t=>{const o=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${u(t,!0)};${t.x};${t.y}${o}`}};let s=r.CoreMouseService=class extends v.Disposable{constructor(t,o){super(),this._bufferService=t,this._coreService=o,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const c of Object.keys(g))this.addProtocol(c,g[c]);for(const c of Object.keys(i))this.addEncoding(c,i[c]);this.reset()}addProtocol(t,o){this._protocols[t]=o}addEncoding(t,o){this._encodings[t]=o}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;const o=this._encodings[this._activeEncoding](t);return o&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(o):this._coreService.triggerDataEvent(o,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,o,c){if(c){if(t.x!==o.x||t.y!==o.y)return!1}else if(t.col!==o.col||t.row!==o.row)return!1;return t.button===o.button&&t.action===o.action&&t.ctrl===o.ctrl&&t.alt===o.alt&&t.shift===o.shift}};r.CoreMouseService=s=h([_(0,n.IBufferService),_(1,n.ICoreService)],s)},6975:function(T,r,a){var h=this&&this.__decorate||function(s,t,o,c){var f,m=arguments.length,l=m<3?t:c===null?c=Object.getOwnPropertyDescriptor(t,o):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(s,t,o,c);else for(var p=s.length-1;p>=0;p--)(f=s[p])&&(l=(m<3?f(l):m>3?f(t,o,l):f(t,o))||l);return m>3&&l&&Object.defineProperty(t,o,l),l},_=this&&this.__param||function(s,t){return function(o,c){t(o,c,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const n=a(1439),d=a(8460),v=a(844),g=a(2585),u=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let i=r.CoreService=class extends v.Disposable{constructor(s,t,o){super(),this._bufferService=s,this._logService=t,this._optionsService=o,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(u),this.decPrivateModes=(0,n.clone)(e)}reset(){this.modes=(0,n.clone)(u),this.decPrivateModes=(0,n.clone)(e)}triggerDataEvent(s,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const o=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&o.ybase!==o.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${s}"`,(()=>s.split("").map((c=>c.charCodeAt(0))))),this._onData.fire(s)}triggerBinaryEvent(s){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${s}"`,(()=>s.split("").map((t=>t.charCodeAt(0))))),this._onBinary.fire(s))}};r.CoreService=i=h([_(0,g.IBufferService),_(1,g.ILogService),_(2,g.IOptionsService)],i)},9074:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const h=a(8055),_=a(8460),n=a(844),d=a(6106);let v=0,g=0;class u extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((s=>s==null?void 0:s.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)((()=>this.reset())))}registerDecoration(s){if(s.marker.isDisposed)return;const t=new e(s);if(t){const o=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),o.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const s of this._decorations.values())s.dispose();this._decorations.clear()}*getDecorationsAtCell(s,t,o){var c,f,m;let l=0,p=0;for(const x of this._decorations.getKeyIterator(t))l=(c=x.options.x)!==null&&c!==void 0?c:0,p=l+((f=x.options.width)!==null&&f!==void 0?f:1),s>=l&&s<p&&(!o||((m=x.options.layer)!==null&&m!==void 0?m:"bottom")===o)&&(yield x)}forEachDecorationAtCell(s,t,o,c){this._decorations.forEachByKey(t,(f=>{var m,l,p;v=(m=f.options.x)!==null&&m!==void 0?m:0,g=v+((l=f.options.width)!==null&&l!==void 0?l:1),s>=v&&s<g&&(!o||((p=f.options.layer)!==null&&p!==void 0?p:"bottom")===o)&&c(f)}))}}r.DecorationService=u;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(s){super(),this.options=s,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=s.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const h=a(2585),_=a(8343);class n{constructor(...v){this._entries=new Map;for(const[g,u]of v)this.set(g,u)}set(v,g){const u=this._entries.get(v);return this._entries.set(v,g),u}forEach(v){for(const[g,u]of this._entries.entries())v(g,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=n,r.InstantiationService=class{constructor(){this._services=new n,this._services.set(h.IInstantiationService,this)}setService(d,v){this._services.set(d,v)}getService(d){return this._services.get(d)}createInstance(d,...v){const g=(0,_.getServiceDependencies)(d).sort(((i,s)=>i.index-s.index)),u=[];for(const i of g){const s=this._services.get(i.id);if(!s)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${i.id}.`);u.push(s)}const e=g.length>0?g[0].index:v.length;if(v.length!==e)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${e+1} conflicts with ${v.length} static arguments`);return new d(...v,...u)}}},7866:function(T,r,a){var h=this&&this.__decorate||function(e,i,s,t){var o,c=arguments.length,f=c<3?i:t===null?t=Object.getOwnPropertyDescriptor(i,s):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(e,i,s,t);else for(var m=e.length-1;m>=0;m--)(o=e[m])&&(f=(c<3?o(f):c>3?o(i,s,f):o(i,s))||f);return c>3&&f&&Object.defineProperty(i,s,f),f},_=this&&this.__param||function(e,i){return function(s,t){i(s,t,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const n=a(844),d=a(2585),v={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF};let g,u=r.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),g=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){var s,t;this._logLevel<=d.LogLevelEnum.TRACE&&this._log((t=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.trace.bind(this._optionsService.options.logger))!==null&&t!==void 0?t:console.log,e,i)}debug(e,...i){var s,t;this._logLevel<=d.LogLevelEnum.DEBUG&&this._log((t=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.debug.bind(this._optionsService.options.logger))!==null&&t!==void 0?t:console.log,e,i)}info(e,...i){var s,t;this._logLevel<=d.LogLevelEnum.INFO&&this._log((t=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.info.bind(this._optionsService.options.logger))!==null&&t!==void 0?t:console.info,e,i)}warn(e,...i){var s,t;this._logLevel<=d.LogLevelEnum.WARN&&this._log((t=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.warn.bind(this._optionsService.options.logger))!==null&&t!==void 0?t:console.warn,e,i)}error(e,...i){var s,t;this._logLevel<=d.LogLevelEnum.ERROR&&this._log((t=(s=this._optionsService.options.logger)===null||s===void 0?void 0:s.error.bind(this._optionsService.options.logger))!==null&&t!==void 0?t:console.error,e,i)}};r.LogService=u=h([_(0,d.IOptionsService)],u),r.setTraceLogger=function(e){g=e},r.traceCall=function(e,i,s){if(typeof s.value!="function")throw new Error("not supported");const t=s.value;s.value=function(...o){if(g.logLevel!==d.LogLevelEnum.TRACE)return t.apply(this,o);g.trace(`GlyphRenderer#${t.name}(${o.map((f=>JSON.stringify(f))).join(", ")})`);const c=t.apply(this,o);return g.trace(`GlyphRenderer#${t.name} return`,c),c}}},7302:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const h=a(8460),_=a(844),n=a(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,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:{},rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const d=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(u){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e=Object.assign({},r.DEFAULT_OPTIONS);for(const i in u)if(i in e)try{const s=u[i];e[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=e,this.options=Object.assign({},e),this._setupOptions()}onSpecificOptionChange(u,e){return this.onOptionChange((i=>{i===u&&e(this.rawOptions[u])}))}onMultipleOptionChange(u,e){return this.onOptionChange((i=>{u.indexOf(i)!==-1&&e()}))}_setupOptions(){const u=i=>{if(!(i in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,s)=>{if(!(i in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(const i in this.rawOptions){const s={get:u.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(u,e){switch(u){case"cursorStyle":if(e||(e=r.DEFAULT_OPTIONS[u]),!(function(i){return i==="block"||i==="underline"||i==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${u}`);break;case"wordSeparator":e||(e=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=d.includes(e)?e:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${u} 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(`${u} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${u} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}r.OptionsService=v},2660:function(T,r,a){var h=this&&this.__decorate||function(v,g,u,e){var i,s=arguments.length,t=s<3?g:e===null?e=Object.getOwnPropertyDescriptor(g,u):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(v,g,u,e);else for(var o=v.length-1;o>=0;o--)(i=v[o])&&(t=(s<3?i(t):s>3?i(g,u,t):i(g,u))||t);return s>3&&t&&Object.defineProperty(g,u,t),t},_=this&&this.__param||function(v,g){return function(u,e){g(u,e,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const n=a(2585);let d=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const g=this._bufferService.buffer;if(v.id===void 0){const o=g.addMarker(g.ybase+g.y),c={data:v,id:this._nextId++,lines:[o]};return o.onDispose((()=>this._removeMarkerFromLink(c,o))),this._dataByLinkId.set(c.id,c),c.id}const u=v,e=this._getEntryIdKey(u),i=this._entriesWithId.get(e);if(i)return this.addLineToLink(i.id,g.ybase+g.y),i.id;const s=g.addMarker(g.ybase+g.y),t={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[s]};return s.onDispose((()=>this._removeMarkerFromLink(t,s))),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(v,g){const u=this._dataByLinkId.get(v);if(u&&u.lines.every((e=>e.line!==g))){const e=this._bufferService.buffer.addMarker(g);u.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(u,e)))}}getLinkData(v){var g;return(g=this._dataByLinkId.get(v))===null||g===void 0?void 0:g.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,g){const u=v.lines.indexOf(g);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=d=h([_(0,n.IBufferService)],d)},8343:(T,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const a="di$target",h="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[h]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const n=function(d,v,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,e,i){e[a]===e?e[h].push({id:u,index:i}):(e[h]=[{id:u,index:i}],e[a]=e)})(n,d,g)};return n.toString=()=>_,r.serviceRegistry.set(_,n),n}},2585:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const h=a(8343);var _;r.IBufferService=(0,h.createDecorator)("BufferService"),r.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),r.ICoreService=(0,h.createDecorator)("CoreService"),r.ICharsetService=(0,h.createDecorator)("CharsetService"),r.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"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,h.createDecorator)("LogService"),r.IOptionsService=(0,h.createDecorator)("OptionsService"),r.IOscLinkService=(0,h.createDecorator)("OscLinkService"),r.IUnicodeService=(0,h.createDecorator)("UnicodeService"),r.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(T,r,a)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const h=a(8460),_=a(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const n=new _.UnicodeV6;this.register(n),this._active=n.version,this._activeProvider=n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(n){if(!this._providers[n])throw new Error(`unknown Unicode version "${n}"`);this._active=n,this._activeProvider=this._providers[n],this._onChange.fire(n)}register(n){this._providers[n.version]=n}wcwidth(n){return this._activeProvider.wcwidth(n)}getStringCellWidth(n){let d=0;const v=n.length;for(let g=0;g<v;++g){let u=n.charCodeAt(g);if(55296<=u&&u<=56319){if(++g>=v)return d+this.wcwidth(u);const e=n.charCodeAt(g);56320<=e&&e<=57343?u=1024*(u-55296)+e-56320+65536:d+=this.wcwidth(e)}d+=this.wcwidth(u)}return d}}}},K={};function A(T){var r=K[T];if(r!==void 0)return r.exports;var a=K[T]={exports:{}};return F[T].call(a.exports,a,a.exports,A),a.exports}var J={};return(()=>{var T=J;Object.defineProperty(T,"__esModule",{value:!0}),T.Terminal=void 0;const r=A(9042),a=A(3236),h=A(844),_=A(5741),n=A(8285),d=A(7975),v=A(7090),g=["cols","rows"];class u extends h.Disposable{constructor(i){super(),this._core=this.register(new a.Terminal(i)),this._addonManager=this.register(new _.AddonManager),this._publicOptions=Object.assign({},this._core.options);const s=o=>this._core.options[o],t=(o,c)=>{this._checkReadonlyOptions(o),this._core.options[o]=c};for(const o in this._core.options){const c={get:s.bind(this,o),set:t.bind(this,o)};Object.defineProperty(this._publicOptions,o,c)}}_checkReadonlyOptions(i){if(g.includes(i))throw new Error(`Option "${i}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const i=this._core.coreService.decPrivateModes;let s="none";switch(this._core.coreMouseService.activeProtocol){case"X10":s="x10";break;case"VT200":s="vt200";break;case"DRAG":s="drag";break;case"ANY":s="any"}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:s,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(const s in i)this._publicOptions[s]=i[s]}blur(){this._core.blur()}focus(){this._core.focus()}resize(i,s){this._verifyIntegers(i,s),this._core.resize(i,s)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){var s,t,o;return this._checkProposedApi(),this._verifyPositiveIntegers((s=i.x)!==null&&s!==void 0?s:0,(t=i.width)!==null&&t!==void 0?t:0,(o=i.height)!==null&&o!==void 0?o:0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,s,t){this._verifyIntegers(i,s,t),this._core.select(i,s,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,s){this._verifyIntegers(i,s),this._core.selectLines(i,s)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,s){this._core.write(i,s)}writeln(i,s){this._core.write(i),this._core.write(`\r
44
- `,s)}paste(i){this._core.paste(i)}refresh(i,s){this._verifyIntegers(i,s),this._core.refresh(i,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return r}_verifyIntegers(...i){for(const s of i)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const s of i)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}T.Terminal=u})(),J})()))})(Ce)),Ce.exports}var nt=rt(),xe={exports:{}},Re;function ot(){return Re||(Re=1,(function(G,$){(function(F,K){G.exports=K()})(self,(()=>(()=>{var F={};return(()=>{var K=F;Object.defineProperty(K,"__esModule",{value:!0}),K.FitAddon=void 0,K.FitAddon=class{activate(A){this._terminal=A}dispose(){}fit(){const A=this.proposeDimensions();if(!A||!this._terminal||isNaN(A.cols)||isNaN(A.rows))return;const J=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||(J._renderService.clear(),this._terminal.resize(A.cols,A.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const A=this._terminal._core,J=A._renderService.dimensions;if(J.css.cell.width===0||J.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:A.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),n=a-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),d=h-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(d/J.css.cell.width)),rows:Math.max(1,Math.floor(n/J.css.cell.height))}}}})(),F})()))})(xe)),xe.exports}var at=ot();class lt{constructor($){ve(this,"ws",null);ve(this,"reconnectAttempts",0);ve(this,"maxReconnectAttempts",10);ve(this,"reconnectTimer",null);ve(this,"disposed",!1);ve(this,"options");this.options=$}getLocation(){return window.location}connect(){var J,T;if(this.disposed)return;const{taskId:$}=this.options,F=this.getLocation(),A=`${F.protocol==="https:"?"wss:":"ws:"}//${F.host}/ws/pty/${$}`;(T=(J=this.options).onStatus)==null||T.call(J,"connecting"),this.ws=new WebSocket(A),this.ws.onopen=()=>{var r,a;this.reconnectAttempts=0,this.send({type:"auth",token:this.options.accessToken,channelToken:this.options.channelToken}),(a=(r=this.options).onStatus)==null||a.call(r,"connected")},this.ws.onmessage=r=>{var a,h;try{const _=JSON.parse(r.data);_.type==="data"&&this.options.onData&&this.options.onData(_.data),(h=(a=this.options).onMessage)==null||h.call(a,_)}catch{}},this.ws.onclose=()=>{var r,a;(a=(r=this.options).onStatus)==null||a.call(r,"disconnected"),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()}}send($){var F;((F=this.ws)==null?void 0:F.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify($))}sendData($){this.send({type:"data",data:$})}sendResize($,F){this.send({type:"resize",cols:$,rows:F})}requestTakeover($){this.send({type:"request_takeover",sessionId:$})}releaseTakeover(){this.send({type:"release_takeover"})}updateAuth($,F){this.options.accessToken=$,this.options.channelToken=F}scheduleReconnect(){if(this.disposed||this.reconnectAttempts>=this.maxReconnectAttempts)return;const $=Math.min(1e3*2**this.reconnectAttempts,3e4);this.reconnectAttempts++,this.reconnectTimer=setTimeout(async()=>{if(!this.disposed){if(this.options.getChannelToken)try{this.options.channelToken=await this.options.getChannelToken()}catch{this.scheduleReconnect();return}this.connect()}},$)}dispose(){var $;this.disposed=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),($=this.ws)==null||$.close(),this.ws=null}}const Ae=z.forwardRef(function({taskId:$,sessionId:F,taskFinished:K,onStatusChange:A,onTakeoverChange:J},T){const r=z.useRef(null),a=z.useRef(null),h=z.useRef(null),_=z.useRef(null),[n,d]=z.useState("observer"),[v,g]=z.useState(!1),[u,e]=z.useState(0),i=We(t=>t.accessToken);z.useImperativeHandle(T,()=>({requestTakeover(){var t;(t=_.current)==null||t.send({type:"force_takeover"}),g(!0)},releaseTakeover(){var t;(t=_.current)==null||t.releaseTakeover(),d("observer")}}),[]),z.useEffect(()=>{const t=u>0&&n==="observer"?"denied":v?"requesting":n==="writer"?"manual":"auto";J==null||J(t)},[n,v,u,J]);const s=z.useCallback(async()=>(await ce.post(`web/tasks/${$}/pty-token`).json()).channelToken,[$]);return z.useEffect(()=>{if(!r.current)return;const t=new nt.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"Fira Code", "Cascadia Code", Menlo, monospace',theme:{background:"#0c0c0c",foreground:"#d4d4d4",cursor:"#d4d4d4"},scrollback:5e3,convertEol:!0}),o=new at.FitAddon;t.loadAddon(o),t.open(r.current);try{o.fit()}catch{}a.current=t,h.current=o;const c=new ResizeObserver(()=>{try{o.fit()}catch{}});return c.observe(r.current),()=>{c.disconnect(),t.dispose(),a.current=null,h.current=null}},[]),z.useEffect(()=>{if(!i||K)return;let t=!1;async function o(){try{const c=await s();if(t)return;const f=new lt({taskId:$,accessToken:i,channelToken:c,getChannelToken:s,onData:m=>{var l;(l=a.current)==null||l.write(m)},onMessage:m=>{switch(m.type){case"takeover_granted":d("writer"),g(!1),e(0);break;case"takeover_denied":g(!1),e(p=>p+1);break;case"writer_revoked":d("observer"),e(0);break}},onStatus:m=>{if(t||A==null||A(m),m==="connected"){const l=a.current;l&&f.sendResize(l.cols,l.rows)}}});_.current=f,f.connect()}catch{}}return o(),()=>{var c;t=!0,(c=_.current)==null||c.dispose(),_.current=null}},[$,i,K,s,A]),z.useEffect(()=>{const t=a.current;if(!t)return;const o=t.onData(f=>{const m=_.current;m&&(n==="writer"?m.sendData(f):!v&&F&&(g(!0),m.requestTakeover(F)))}),c=t.onResize(({cols:f,rows:m})=>{var l;(l=_.current)==null||l.sendResize(f,m)});return()=>{o.dispose(),c.dispose()}},[n,v,F]),C.jsx("div",{ref:r,className:"h-full w-full bg-[#0c0c0c] p-1"})});function Te({isOpen:G,onClose:$,taskId:F,stageIndex:K,stageName:A,mode:J,prompt:T,choices:r,defaultChoice:a,timeoutSeconds:h,onSubmitted:_}){const{t:n}=be(),[d,v]=z.useState(h),[g,u]=z.useState(a??""),[e,i]=z.useState(""),[s,t]=z.useState(!1);z.useEffect(()=>{if(!G)return;v(h);const f=setInterval(()=>{v(m=>m<=1?(clearInterval(f),0):m-1)},1e3);return()=>clearInterval(f)},[G,h]),z.useEffect(()=>{d===0&&G&&$()},[d,G,$]);const o=z.useCallback(async f=>{t(!0);try{await ce.post(`web/tasks/${F}/confirm-stage`,{json:{stageIndex:K,result:f}}),_==null||_(),$()}catch{}finally{t(!1)}},[F,K,$,_]);function c(f){const m=Math.floor(f/60),l=f%60;return`${m}:${l.toString().padStart(2,"0")}`}return G?C.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[C.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),C.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[C.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(tt,{className:"h-4 w-4 text-[var(--accent)]"}),C.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",A??`stage_${K}`]})]}),C.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[C.jsx(Qe,{className:"h-3.5 w-3.5"}),c(d)]})]}),C.jsxs("div",{className:"space-y-4 px-5 py-5",children:[T&&C.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:T}),J==="choice"&&r&&C.jsxs("div",{className:"space-y-2",children:[C.jsx("label",{className:"block text-xs text-[var(--text-muted)]",children:n("tasks.stage_choose_option")}),r.map(f=>C.jsxs("label",{className:`flex cursor-pointer items-center gap-2 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===f.value?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-secondary)] hover:border-[var(--accent)]/50"}`,children:[C.jsx("input",{type:"radio",name:"stage-choice",value:f.value,checked:g===f.value,onChange:()=>u(f.value),className:"accent-[var(--accent)]"}),f.label]},f.value))]}),J==="input"&&C.jsxs("div",{children:[C.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:n("tasks.stage_your_response")}),C.jsx("input",{type:"text",placeholder:n("tasks.stage_type_answer"),value:e,onChange:f=>i(f.target.value),autoFocus:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}),C.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[J==="confirm"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:s,onClick:()=>o("cancel"),children:n("common.cancel")}),C.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:s,onClick:()=>o("continue"),children:n(s?"tasks.stage_submitting":"tasks.stage_continue")})]}),J==="choice"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:s,onClick:$,children:n("common.cancel")}),C.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:s||!g,onClick:()=>o(g),children:n(s?"tasks.stage_submitting":"common.confirm")})]}),J==="input"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:s,onClick:$,children:n("common.cancel")}),C.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:s||!e.trim(),onClick:()=>o(e),children:n(s?"tasks.stage_submitting":"tasks.stage_submit")})]})]})]})]}):null}function ct(G,$){const F=new Date(G).getTime()-Date.now();if(F<=0)return $("tasks.tunnel_expired");const K=Math.floor(F/36e5),A=Math.floor(F%36e5/6e4);return K>0?$("tasks.tunnel_expires_hm",{h:K,m:A}):$("tasks.tunnel_expires_m",{m:A})}function Be(G){switch(G){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Me(G,$){switch(G){case"IDLE":case"CLOSED":return $("tasks.tunnel_idle");case"STARTING":return $("tasks.tunnel_starting");case"CONNECTED":return $("tasks.tunnel_connected");case"EXPIRED":return $("tasks.tunnel_expired");case"CLOSING":return $("tasks.tunnel_closing");default:return String(G).toLowerCase()}}function ht({taskId:G,taskFinished:$,compact:F}){const{t:K}=be(),[A,J]=z.useState("IDLE"),[T,r]=z.useState(null),[a,h]=z.useState(null),[_,n]=z.useState(""),[d,v]=z.useState(!1),[g,u]=z.useState(!1),e=z.useRef(null),i=z.useCallback(async()=>{try{const m=await ce.get(`web/workspace-tunnel/${G}/status`).json();J(m.status),r(m.tunnelUrl??null),h(m.expiresAt??null),(m.status==="EXPIRED"||m.status==="IDLE"||m.status==="CLOSED")&&t()}catch{}},[G]);function s(){t(),e.current=setInterval(i,5e3)}function t(){e.current&&(clearInterval(e.current),e.current=null)}z.useEffect(()=>{$&&(A==="STARTING"||A==="CONNECTED")&&(J("IDLE"),r(null),t())},[$,A]),z.useEffect(()=>{if(A!=="CONNECTED"||!a)return;const m=()=>{const p=ct(a,K);n(p),p===K("tasks.tunnel_expired")&&(J("EXPIRED"),r(null),t())};m();const l=setInterval(m,3e4);return()=>clearInterval(l)},[A,a]),z.useEffect(()=>()=>t(),[]),z.useEffect(()=>{i()},[i]);async function o(){v(!0);try{await ce.post(`web/workspace-tunnel/${G}/start`),J("STARTING"),s()}catch{}finally{v(!1)}}async function c(){v(!0);try{await ce.post(`web/workspace-tunnel/${G}/stop`),J("IDLE"),r(null),t()}catch{}finally{v(!1)}}async function f(){T&&(await navigator.clipboard.writeText(T),u(!0),setTimeout(()=>u(!1),2e3))}return F?C.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"cursor_tunnel:"}),C.jsx("span",{style:{color:Be(A)},children:Me(A,K)}),(A==="IDLE"||A==="CLOSED"||A==="EXPIRED")&&C.jsx("button",{onClick:o,disabled:d,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:K(d?"tasks.tunnel_starting":"tasks.tunnel_start")}),A==="CONNECTED"&&T&&C.jsx("a",{href:T.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:K("tasks.tunnel_open_in_cursor")})]}):C.jsxs("div",{className:"rounded border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[C.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:K("tasks.tunnel_header")}),C.jsxs("span",{className:"text-xs",style:{color:Be(A)},children:["● ",Me(A,K)]})]}),A==="CONNECTED"&&a&&C.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",_]}),A==="CONNECTED"&&T&&C.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[C.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:T}),C.jsxs("button",{onClick:f,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":K("tasks.tunnel_copy_url"),children:["[",K("common.copy"),"]"]})]}),g&&C.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:K("tasks.tunnel_copied")}),A==="STARTING"&&C.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:K("tasks.tunnel_waiting")}),C.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(A==="IDLE"||A==="CLOSED")&&C.jsx("button",{onClick:o,disabled:d,className:"rounded border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),A==="STARTING"&&C.jsx("button",{onClick:c,disabled:d,className:"rounded border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),A==="CONNECTED"&&T&&C.jsxs(C.Fragment,{children:[C.jsx("a",{href:T.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:K("tasks.tunnel_open_cursor")}),C.jsx("a",{href:T.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:K("tasks.tunnel_open_vscode")}),C.jsx("button",{onClick:c,disabled:d,className:"rounded border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),A==="EXPIRED"&&C.jsx("button",{onClick:o,disabled:d,className:"rounded border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function dt({isOpen:G,onClose:$,onConfirm:F,taskId:K,isLoading:A}){const{t:J}=be();return C.jsx(Ie,{isOpen:G,onClose:$,onConfirm:F,title:J("tasks.cancel_task_title"),message:J("tasks.cancel_task_message",{id:String(K)}),confirmLabel:J("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:A})}function ut({isOpen:G,onClose:$,onConfirm:F,taskId:K,mrUrl:A,isLoading:J}){const{t:T}=be(),r=A?T("tasks.retry_message_with_mr",{id:String(K),url:A}):T("tasks.retry_message_without_mr",{id:String(K)});return C.jsx(Ie,{isOpen:G,onClose:$,onConfirm:F,title:T("tasks.retry_title"),message:r,confirmLabel:T("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:J})}function _t(G){switch(G){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function Oe(G){switch(G){case"RUNNING":return"var(--accent)";case"COMPLETED":return"var(--accent)";case"FAILED":return"var(--destructive)";case"CANCELLED":return"var(--text-muted)";case"SUSPENDED":return"var(--warning)";case"ASSIGNED":return"#60a5fa";default:return"var(--text-muted)"}}function Pe({status:G}){return C.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:Oe(G)},children:[C.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:Oe(G)}}),G.toLowerCase()]})}function ye(G){if(!G)return"-";const $=new Date(G).getTime();if(Number.isNaN($))return"-";const F=Date.now()-$,K=Math.floor(F/6e4);if(K<1)return"just now";if(K<60)return`${K}m ago`;const A=Math.floor(K/60);return A<24?`${A}h ago`:`${Math.floor(A/24)}d ago`}function ft(G){let F=["clone_repository","analyze_issue","develop","test","submit_mr"];if(G.configSnapshot)try{const A=JSON.parse(G.configSnapshot);if(A.pipeline){const J=JSON.parse(A.pipeline);Array.isArray(J.stages)&&J.stages.length>0&&(F=J.stages.map(T=>T.name))}}catch{}const K=G.currentStage?F.indexOf(G.currentStage):-1;return F.map((A,J)=>{let T="pending";return G.status==="COMPLETED"?T="completed":G.status==="FAILED"&&J<=K?T=J===K?"failed":"completed":K>=0&&(J<K?T="completed":J===K&&(T="running")),{name:A,status:T}})}const vt=["COMPLETED","FAILED","CANCELLED"];function wt(){var _e,le;const{id:G}=Ue(),$=$e(),{t:F}=be(),K=Ve(P=>P.cancelTask),[A,J]=z.useState(null),[T,r]=z.useState([]),[a,h]=z.useState(!0),[_,n]=z.useState(null),[d,v]=z.useState(!1),[g,u]=z.useState(!1),[e,i]=z.useState(!1),[s,t]=z.useState(!1),[o,c]=z.useState("terminal"),[f,m]=z.useState([]),[l,p]=z.useState(0),[x,L]=z.useState(0),[y,E]=z.useState(""),[B,I]=z.useState(""),[H,j]=z.useState(!1),[b,w]=z.useState(!1),[k,D]=z.useState(null),[N,W]=z.useState("disconnected"),[V,q]=z.useState("auto"),ee=z.useRef(null),S=Number(G),R=A?vt.includes(A.status):!1;ze(A?`#${A.id} ${A.description}`:null);const M=z.useCallback(async()=>{try{const P=await ce.get(`web/tasks/${S}`).json();J(P)}catch{}},[S]),O=z.useCallback(async()=>{try{const P=await ce.get(`web/tasks/${S}/logs`).json();r(P.lines)}catch{}},[S]),Y=z.useCallback(async()=>{try{const P=await ce.get(`web/tasks/${S}/pending-confirm`).json();n(P.confirm)}catch{n(null)}},[S]),U=z.useCallback(async()=>{j(!0);try{const P=new URLSearchParams;P.set("limit","50"),P.set("offset",String(x*50)),y&&P.set("type",y),B&&P.set("search",B);const Z=await ce.get(`web/tasks/${S}/events?${P}`).json();m(Z.events),p(Z.total)}catch{}finally{j(!1)}},[S,x,y,B]);z.useEffect(()=>{o==="logs"&&U()},[o,U]),z.useEffect(()=>{o==="pipeline"&&ce.get(`web/workspaces/${S}`).json().then(D).catch(()=>{})},[o,S]),z.useEffect(()=>{h(!0),Promise.all([M(),O(),Y()]).finally(()=>h(!1))},[M,O,Y]),z.useEffect(()=>{if(R)return;const P=setInterval(()=>{M(),O(),Y()},5e3);return()=>clearInterval(P)},[R,M,O,Y]);const Q=z.useCallback(()=>n(null),[]),ie=z.useCallback(()=>{n(null),M()},[M]);async function ne(){i(!0);try{await K(S),v(!1),await M()}finally{i(!1)}}async function ue(){t(!0);try{const P=await ce.post(`web/tasks/${S}/retry`).json();u(!1),$(`/tasks/${P.task.id}`)}finally{t(!1)}}if(a)return C.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:C.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:F("tasks.loading_task")})});if(!A)return C.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[C.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:F("tasks.task_not_found")}),C.jsxs("button",{onClick:()=>$("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",F("tasks.back_to_tasks")]})]});const X=ft(A),de=X.findIndex(P=>P.status==="running"),ge=C.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[C.jsx("button",{onClick:()=>$("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:C.jsx(Xe,{className:"h-4 w-4"})}),C.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:["#",A.id," ",A.description]})]}),fe=C.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[C.jsx(Pe,{status:A.status}),C.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),C.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["project: ",C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),A.branch&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),C.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",C.jsx("span",{className:"text-[var(--text-primary)]",children:A.branch})]})]}),A.mrUrl&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),C.jsxs("a",{href:A.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((_e=A.mrUrl.match(/!?\d+$/))==null?void 0:_e[0])??"view"]})]})]}),me=C.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!R&&C.jsxs("button",{onClick:()=>v(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",style:{backgroundColor:"rgba(239,68,68,0.12)"},children:[C.jsx(we,{className:"h-3 w-3"}),F("tasks.cancel_task")]}),A.status==="FAILED"&&C.jsxs("button",{onClick:()=>u(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[#171717] px-3 h-8 text-[11px] text-[var(--text-muted)]",children:[C.jsx(Je,{className:"h-3 w-3"}),F("tasks.retry_task")]}),A.machineId&&!R&&C.jsxs("button",{onClick:()=>{},className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[C.jsx(Ye,{className:"h-3 w-3"}),F("tasks.cursor_tunnel")]})]}),Se=C.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[C.jsxs("div",{className:"flex flex-col gap-3",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.pipeline_stages")}),X.map(P=>{const Z=P.status==="completed",te=P.status==="running",re=P.status==="failed";return C.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${te?"bg-[#1a1a1a]":""}`,children:[Z&&C.jsx(Ke,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),te&&C.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),re&&C.jsx(we,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),P.status==="pending"&&C.jsx(Ze,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),C.jsx("span",{className:"text-xs",style:{color:Z?"var(--accent)":te?"#e5e5e5":re?"var(--destructive)":"#525252",fontWeight:te?500:400},children:te?`> ${P.name}`:P.name})]},P.name)})]}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.activity_log")}),T.length>0?C.jsx("div",{className:"flex flex-col gap-1.5",children:T.slice(0,8).map((P,Z)=>C.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:P},Z))}):C.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:F("tasks.no_activity")})]})]}),oe=C.jsxs(C.Fragment,{children:[C.jsx(dt,{isOpen:d,onClose:()=>v(!1),onConfirm:ne,taskId:S,isLoading:e}),C.jsx(ut,{isOpen:g,onClose:()=>u(!1),onConfirm:ue,taskId:S,mrUrl:A.mrUrl??void 0,isLoading:s})]});return b&&o==="terminal"?C.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase",children:[fe,C.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.pty_terminal")}),C.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] ${N==="connected"?"text-[var(--accent)]":N==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[C.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N==="connected"?"bg-[var(--accent)]":N==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),F(`tasks.${N}`)]})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[!R&&V==="auto"&&C.jsxs("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[C.jsx(Le,{className:"h-3 w-3"}),F("tasks.take_over")]}),!R&&V==="manual"&&C.jsx("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:F("tasks.restore_auto")}),A.currentStage&&C.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[F("tasks.stage"),": ",A.currentStage]}),C.jsx("button",{onClick:()=>w(!1),className:"flex items-center rounded-[4px] bg-[#171717] px-2.5 py-1 text-[var(--text-muted)]",children:C.jsx(st,{className:"h-3 w-3"})})]})]}),C.jsx("div",{className:"min-h-0 flex-1",children:C.jsx(Ae,{ref:ee,taskId:S,sessionId:A.currentSessionId??void 0,taskFinished:R,onStatusChange:W,onTakeoverChange:q})}),me,oe]}):A.status==="SUSPENDED"?C.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,fe,C.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:F("tasks.task_suspended_banner")}),C.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[C.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[C.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[C.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",A.id]}),C.jsx("span",{className:"text-base text-[var(--text-secondary)]",children:A.description}),C.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:F("tasks.status_suspended")})]}),C.jsx("div",{className:"flex items-center gap-2 md:hidden",children:C.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:F("tasks.status_suspended")})}),_&&C.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[C.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:F("tasks.pending_confirmation")}),C.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:_.prompt??F("tasks.pipeline_requires_confirmation")}),_.stageName&&C.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:_.stageName})]})}),C.jsx("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:_.choices?_.choices.map((P,Z)=>C.jsx("button",{onClick:async()=>{try{await ce.post(`web/tasks/${S}/confirm-stage`,{json:{stageIndex:_.stageIndex,result:P.value}}),ie()}catch{ke.error(F("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] px-4 py-2.5 md:py-2 text-[11px] font-bold",style:Z===0?{backgroundColor:"var(--accent)",color:"#0c0c0c"}:{backgroundColor:"#1a1a1a",border:"1px solid var(--border)",color:"var(--text-primary)"},children:P.label},P.value)):C.jsxs(C.Fragment,{children:[C.jsx("button",{onClick:async()=>{try{await ce.post(`web/tasks/${S}/confirm-stage`,{json:{stageIndex:_.stageIndex,result:"retry"}}),ie()}catch{ke.error(F("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:F("tasks.confirm_and_proceed")}),C.jsx("button",{onClick:()=>v(!0),className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:F("tasks.reject")})]})})]}),C.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:X.map((P,Z)=>{const te=P.status==="failed",re=P.status==="completed",ae=P.status==="running"&&A.status==="SUSPENDED",he=te?"var(--destructive)":re?"var(--accent)":ae?"var(--warning)":"#525252",se=te?"rgba(239,68,68,0.12)":re?"rgba(34,197,94,0.12)":ae?"rgba(245,158,11,0.12)":"transparent";return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:he,backgroundColor:se,fontWeight:ae?700:400,border:ae?`1px solid ${he}`:void 0},children:ae?"confirm":`${P.name}${re?" ✓":te?" ✗":""}`}),Z<X.length-1&&C.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},P.name)})}),C.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[C.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:F("tasks.pty_output")}),C.jsxs("div",{className:"flex flex-col gap-1",children:[T.slice(-10).map((P,Z)=>C.jsx("p",{className:"text-[10px] leading-relaxed text-[var(--text-secondary)]",children:P},Z)),T.length===0&&C.jsx("p",{className:"text-[10px] text-[var(--text-muted)]",children:F("tasks.no_output")})]})]})]}),C.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[#171717] p-4 lg:flex",children:[C.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:F("tasks.task_info")}),C.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),C.jsx("span",{className:"font-bold text-[var(--warning)]",children:"suspended"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.machineName??"-"})]})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:F("tasks.stage_timeline")}),C.jsx("div",{className:"flex flex-col gap-2",children:X.map(P=>{const Z=P.status==="completed"?"var(--accent)":P.status==="failed"?"var(--destructive)":P.status==="running"?"var(--warning)":"#525252",te=P.status==="failed"?"var(--destructive)":P.status==="running"?"var(--warning)":"#a3a3a3",re=P.status==="completed"?"completed":P.status==="running"?"suspended":P.status==="failed"?"failed":"pending";return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:Z}}),C.jsxs("span",{className:"text-[10px]",style:{color:te,fontWeight:P.status==="running"?700:400},children:[P.name," ",re]})]},P.name)})}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:ye(A.createdAt)})]})})]})]}),_&&C.jsx(Te,{isOpen:!!_,onClose:Q,taskId:S,stageIndex:_.stageIndex,stageName:_.stageName??(A==null?void 0:A.currentStage)??void 0,mode:_.mode,prompt:_.prompt,choices:_.choices,defaultChoice:_.defaultChoice,timeoutSeconds:Math.ceil(_.timeout/1e3),onSubmitted:ie}),oe]}):C.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,fe,A.errorMessage&&C.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(239,68,68,0.08)",borderColor:"rgba(239,68,68,0.2)",color:"var(--destructive)"},children:["// error: ",A.errorMessage]}),_&&C.jsx(Te,{isOpen:!!_,onClose:Q,taskId:S,stageIndex:_.stageIndex,stageName:_.stageName??(A==null?void 0:A.currentStage)??void 0,mode:_.mode,prompt:_.prompt,choices:_.choices,defaultChoice:_.defaultChoice,timeoutSeconds:Math.ceil(_.timeout/1e3),onSubmitted:ie}),C.jsxs("div",{className:"flex min-h-0 flex-1",children:[C.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[C.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0",children:["terminal","pipeline","logs"].map(P=>C.jsx("button",{onClick:()=>c(P),className:`px-4 py-2.5 text-xs transition-colors ${o===P?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:F(P==="terminal"?"tasks.terminal":P==="pipeline"?"tasks.pipeline_tab":"tasks.logs")},P))}),o==="terminal"&&C.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[C.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[C.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.pty_terminal")}),C.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] ${N==="connected"?"text-[var(--accent)]":N==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[C.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N==="connected"?"bg-[var(--accent)]":N==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),F(`tasks.${N}`)]})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[!R&&V==="auto"&&C.jsxs("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[C.jsx(Le,{className:"h-3 w-3"}),F("tasks.take_over")]}),!R&&V==="manual"&&C.jsx("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:F("tasks.restore_auto")}),!R&&V==="requesting"&&C.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-6 text-[11px] text-[var(--warning)]",children:[C.jsx(Ee,{className:"h-3 w-3 animate-spin"}),F("tasks.requesting_takeover")]}),!R&&A.currentStage&&C.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[#171717] px-2.5 h-6 text-[11px] text-[var(--text-muted)]",children:[C.jsx(it,{className:"h-3 w-3"}),F("tasks.skip_stage")]}),C.jsx("button",{onClick:()=>w(!0),className:"hidden md:flex items-center rounded-[4px] bg-[#171717] px-2.5 h-6 text-[var(--text-muted)]",children:C.jsx(et,{className:"h-3 w-3"})})]})]}),C.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[C.jsx(Pe,{status:A.status}),A.machineName&&C.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["on ",A.machineName]})]}),C.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:F("tasks.stage_progress")}),C.jsx("div",{className:"mt-2 flex items-center gap-1 overflow-x-auto no-scrollbar",children:X.map((P,Z)=>{const te=P.status==="completed",re=P.status==="running",he=P.status==="failed"?"var(--destructive)":te||re?"var(--accent)":"#525252";return C.jsxs("div",{className:"flex items-center",children:[C.jsxs("span",{className:"shrink-0 text-[10px] whitespace-nowrap",style:{color:he,fontWeight:re?600:400},children:[P.name,te?" ✓":re?" ...":""]}),Z<X.length-1&&C.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:he}})]},P.name)})})]}),C.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:F("tasks.pty_output")})}),C.jsx("div",{className:"min-h-0 flex-1",children:C.jsx(Ae,{ref:ee,taskId:S,sessionId:A.currentSessionId??void 0,taskFinished:R,onStatusChange:W,onTakeoverChange:q})}),me]}),o==="pipeline"&&C.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[C.jsx("div",{className:"flex items-center py-4 mb-4 md:mb-5 overflow-x-auto no-scrollbar",children:X.map((P,Z)=>{const te=P.status==="completed",re=P.status==="running",se=P.status==="failed"?"var(--destructive)":te||re?"var(--accent)":"#525252";return C.jsxs("div",{className:"flex items-center",style:{flex:Z<X.length-1?1:void 0},children:[C.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[C.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:se},children:[te&&C.jsx("span",{className:"text-[10px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),re&&C.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),C.jsx("span",{className:"text-[9px] md:text-[11px] font-medium whitespace-nowrap",style:{color:se},children:P.name})]}),Z<X.length-1&&C.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:Z<(de>=0?de:0)?"var(--accent)":"#525252"}})]},P.name)})}),A.currentStage&&C.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[#171717] p-3 text-xs leading-relaxed",children:[C.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",A.currentStage," (",de+1,"/",X.length,")"]}),A.startedAt&&C.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",ye(A.startedAt).replace(" ago","")]}),C.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",A.retryCount,"/2"]})]}),C.jsx("button",{onClick:()=>c("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:C.jsxs("span",{children:["// ",F("tasks.view_terminal")]})}),C.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:hidden",children:[C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:F("tasks.task_info")}),C.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.machineName??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.branch??"-"})]})]})]})]}),o==="logs"&&C.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:F("tasks.task_logs")}),C.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[C.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(P=>C.jsx("button",{onClick:()=>{E(P),L(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[10px] ${y===P?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:P||"all"},P))}),C.jsx("div",{className:"hidden md:block",children:C.jsx(Ge,{value:y,onChange:P=>{E(P),L(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),C.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[C.jsx(qe,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),C.jsx("input",{type:"text",placeholder:F("tasks.search_logs"),value:B,onChange:P=>{I(P.target.value),L(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),C.jsxs("div",{className:"flex flex-col gap-0.5",children:[f.map((P,Z)=>C.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${Z%2===0?"bg-[var(--bg-card)]":""}`,children:[C.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(P.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),C.jsx("span",{className:`shrink-0 font-medium ${_t(P.type)}`,children:P.type}),C.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:P.message})]},P.id)),f.length===0&&!H&&C.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:F("tasks.no_log_entries")})]}),l>50&&C.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(l/50)}).slice(0,5).map((P,Z)=>C.jsx("button",{onClick:()=>L(Z),className:`rounded-[4px] px-2 py-1 text-xs ${x===Z?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:Z+1},Z)),Math.ceil(l/50)>5&&C.jsx("button",{onClick:()=>L(x+1),disabled:x>=Math.ceil(l/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),o==="terminal"&&Se,o==="pipeline"&&C.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.task_info")}),C.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.creatorName??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"machine"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.machineName??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"created_at"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:ye(A.createdAt)})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"agent_type"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.agentType??"cursor"})]})]})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.workspace_section")}),C.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.branch??(k==null?void 0:k.branch)??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"worktree"}),C.jsx("span",{className:"ml-4 truncate text-[var(--text-primary)]",children:(k==null?void 0:k.path)??"-"})]}),A.mrUrl&&C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"mr_link"}),C.jsx("a",{href:A.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((le=A.mrUrl.match(/!?\d+$/))==null?void 0:le[0])??"view"})]})]})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.cursor_tunnel_section")}),A.machineId?C.jsx(ht,{taskId:S,taskFinished:R,compact:!0}):C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:F("tasks.no_machine_assigned")})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.stage_timeline")}),C.jsx("div",{className:"flex flex-col gap-2 text-xs",children:X.map(P=>{const Z=P.status==="completed"?"✓":P.status==="running"?"→":"·",te=P.status==="completed"||P.status==="running"?"var(--accent)":P.status==="failed"?"var(--destructive)":"#525252",re=P.status==="completed"?"done":P.status==="running"?"running...":P.status==="failed"?"failed":"pending";return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"font-semibold",style:{color:te},children:Z}),C.jsx("span",{className:P.status==="running"?"font-medium":"",style:{color:te},children:P.name}),C.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",re]})]},P.name)})})]})]})]}),oe]})}export{wt as default};
44
+ `,s)}paste(i){this._core.paste(i)}refresh(i,s){this._verifyIntegers(i,s),this._core.refresh(i,s)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return r}_verifyIntegers(...i){for(const s of i)if(s===1/0||isNaN(s)||s%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const s of i)if(s&&(s===1/0||isNaN(s)||s%1!=0||s<0))throw new Error("This API only accepts positive integers")}}T.Terminal=u})(),J})()))})(Ce)),Ce.exports}var nt=rt(),xe={exports:{}},Re;function ot(){return Re||(Re=1,(function(G,$){(function(F,K){G.exports=K()})(self,(()=>(()=>{var F={};return(()=>{var K=F;Object.defineProperty(K,"__esModule",{value:!0}),K.FitAddon=void 0,K.FitAddon=class{activate(A){this._terminal=A}dispose(){}fit(){const A=this.proposeDimensions();if(!A||!this._terminal||isNaN(A.cols)||isNaN(A.rows))return;const J=this._terminal._core;this._terminal.rows===A.rows&&this._terminal.cols===A.cols||(J._renderService.clear(),this._terminal.resize(A.cols,A.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const A=this._terminal._core,J=A._renderService.dimensions;if(J.css.cell.width===0||J.css.cell.height===0)return;const T=this._terminal.options.scrollback===0?0:A.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(r.getPropertyValue("height")),h=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),n=a-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),d=h-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-T;return{cols:Math.max(2,Math.floor(d/J.css.cell.width)),rows:Math.max(1,Math.floor(n/J.css.cell.height))}}}})(),F})()))})(xe)),xe.exports}var at=ot();class lt{constructor($){ve(this,"ws",null);ve(this,"reconnectAttempts",0);ve(this,"maxReconnectAttempts",10);ve(this,"reconnectTimer",null);ve(this,"disposed",!1);ve(this,"options");this.options=$}getLocation(){return window.location}connect(){var J,T;if(this.disposed)return;const{taskId:$}=this.options,F=this.getLocation(),A=`${F.protocol==="https:"?"wss:":"ws:"}//${F.host}/ws/pty/${$}`;(T=(J=this.options).onStatus)==null||T.call(J,"connecting"),this.ws=new WebSocket(A),this.ws.onopen=()=>{var r,a;this.reconnectAttempts=0,this.send({type:"auth",token:this.options.accessToken,channelToken:this.options.channelToken}),(a=(r=this.options).onStatus)==null||a.call(r,"connected")},this.ws.onmessage=r=>{var a,h;try{const _=JSON.parse(r.data);_.type==="data"&&this.options.onData&&this.options.onData(_.data),(h=(a=this.options).onMessage)==null||h.call(a,_)}catch{}},this.ws.onclose=()=>{var r,a;(a=(r=this.options).onStatus)==null||a.call(r,"disconnected"),this.scheduleReconnect()},this.ws.onerror=()=>{var r;(r=this.ws)==null||r.close()}}send($){var F;((F=this.ws)==null?void 0:F.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify($))}sendData($){this.send({type:"data",data:$})}sendResize($,F){this.send({type:"resize",cols:$,rows:F})}requestTakeover($){this.send({type:"request_takeover",sessionId:$})}releaseTakeover(){this.send({type:"release_takeover"})}updateAuth($,F){this.options.accessToken=$,this.options.channelToken=F}scheduleReconnect(){if(this.disposed||this.reconnectAttempts>=this.maxReconnectAttempts)return;const $=Math.min(1e3*2**this.reconnectAttempts,3e4);this.reconnectAttempts++,this.reconnectTimer=setTimeout(async()=>{if(!this.disposed){if(this.options.getChannelToken)try{this.options.channelToken=await this.options.getChannelToken()}catch{this.scheduleReconnect();return}this.connect()}},$)}dispose(){var $;this.disposed=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),($=this.ws)==null||$.close(),this.ws=null}}const Ae=z.forwardRef(function({taskId:$,sessionId:F,taskFinished:K,onStatusChange:A,onTakeoverChange:J},T){const r=z.useRef(null),a=z.useRef(null),h=z.useRef(null),_=z.useRef(null),[n,d]=z.useState("observer"),[v,g]=z.useState(!1),[u,e]=z.useState(0),i=We(t=>t.accessToken);z.useImperativeHandle(T,()=>({requestTakeover(){var t;(t=_.current)==null||t.send({type:"force_takeover"}),g(!0)},releaseTakeover(){var t;(t=_.current)==null||t.releaseTakeover(),d("observer")}}),[]),z.useEffect(()=>{const t=u>0&&n==="observer"?"denied":v?"requesting":n==="writer"?"manual":"auto";J==null||J(t)},[n,v,u,J]);const s=z.useCallback(async()=>(await ce.post(`web/tasks/${$}/pty-token`).json()).channelToken,[$]);return z.useEffect(()=>{if(!r.current)return;const t=new nt.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"Fira Code", "Cascadia Code", Menlo, monospace',theme:{background:"#0c0c0c",foreground:"#d4d4d4",cursor:"#d4d4d4"},scrollback:5e3,convertEol:!0}),o=new at.FitAddon;t.loadAddon(o),t.open(r.current);try{o.fit()}catch{}a.current=t,h.current=o;const c=new ResizeObserver(()=>{try{o.fit()}catch{}});return c.observe(r.current),()=>{c.disconnect(),t.dispose(),a.current=null,h.current=null}},[]),z.useEffect(()=>{if(!i||K)return;let t=!1;async function o(){try{const c=await s();if(t)return;const f=new lt({taskId:$,accessToken:i,channelToken:c,getChannelToken:s,onData:m=>{var l;(l=a.current)==null||l.write(m)},onMessage:m=>{switch(m.type){case"takeover_granted":d("writer"),g(!1),e(0);break;case"takeover_denied":g(!1),e(p=>p+1);break;case"writer_revoked":d("observer"),e(0);break}},onStatus:m=>{if(t||A==null||A(m),m==="connected"){const l=a.current;l&&f.sendResize(l.cols,l.rows)}}});_.current=f,f.connect()}catch{}}return o(),()=>{var c;t=!0,(c=_.current)==null||c.dispose(),_.current=null}},[$,i,K,s,A]),z.useEffect(()=>{const t=a.current;if(!t)return;const o=t.onData(f=>{const m=_.current;m&&(n==="writer"?m.sendData(f):!v&&F&&(g(!0),m.requestTakeover(F)))}),c=t.onResize(({cols:f,rows:m})=>{var l;(l=_.current)==null||l.sendResize(f,m)});return()=>{o.dispose(),c.dispose()}},[n,v,F]),C.jsx("div",{ref:r,className:"h-full w-full bg-[#0c0c0c] p-1"})});function Te({isOpen:G,onClose:$,taskId:F,stageIndex:K,stageName:A,mode:J,prompt:T,choices:r,defaultChoice:a,timeoutSeconds:h,onSubmitted:_}){const{t:n}=be(),[d,v]=z.useState(h),[g,u]=z.useState(a??""),[e,i]=z.useState(""),[s,t]=z.useState(!1);z.useEffect(()=>{if(!G)return;v(h);const f=setInterval(()=>{v(m=>m<=1?(clearInterval(f),0):m-1)},1e3);return()=>clearInterval(f)},[G,h]),z.useEffect(()=>{d===0&&G&&$()},[d,G,$]);const o=z.useCallback(async f=>{t(!0);try{await ce.post(`web/tasks/${F}/confirm-stage`,{json:{stageIndex:K,result:f}}),_==null||_(),$()}catch{}finally{t(!1)}},[F,K,$,_]);function c(f){const m=Math.floor(f/60),l=f%60;return`${m}:${l.toString().padStart(2,"0")}`}return G?C.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[C.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),C.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[C.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(tt,{className:"h-4 w-4 text-[var(--accent)]"}),C.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// stage: ",A??`stage_${K}`]})]}),C.jsxs("span",{className:"flex items-center gap-1 text-xs text-[var(--text-muted)]",children:[C.jsx(Qe,{className:"h-3.5 w-3.5"}),c(d)]})]}),C.jsxs("div",{className:"space-y-4 px-5 py-5",children:[T&&C.jsx("p",{className:"whitespace-pre-wrap text-xs text-[var(--text-primary)]",children:T}),J==="choice"&&r&&C.jsxs("div",{className:"space-y-2",children:[C.jsx("label",{className:"block text-xs text-[var(--text-muted)]",children:n("tasks.stage_choose_option")}),r.map(f=>C.jsxs("label",{className:`flex cursor-pointer items-center gap-2 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===f.value?"border-[var(--accent)] text-[var(--text-primary)]":"border-[var(--border)] text-[var(--text-secondary)] hover:border-[var(--accent)]/50"}`,children:[C.jsx("input",{type:"radio",name:"stage-choice",value:f.value,checked:g===f.value,onChange:()=>u(f.value),className:"accent-[var(--accent)]"}),f.label]},f.value))]}),J==="input"&&C.jsxs("div",{children:[C.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:n("tasks.stage_your_response")}),C.jsx("input",{type:"text",placeholder:n("tasks.stage_type_answer"),value:e,onChange:f=>i(f.target.value),autoFocus:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}),C.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[J==="confirm"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:s,onClick:()=>o("cancel"),children:n("common.cancel")}),C.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:s,onClick:()=>o("continue"),children:n(s?"tasks.stage_submitting":"tasks.stage_continue")})]}),J==="choice"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:s,onClick:$,children:n("common.cancel")}),C.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:s||!g,onClick:()=>o(g),children:n(s?"tasks.stage_submitting":"common.confirm")})]}),J==="input"&&C.jsxs(C.Fragment,{children:[C.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",disabled:s,onClick:$,children:n("common.cancel")}),C.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:s||!e.trim(),onClick:()=>o(e),children:n(s?"tasks.stage_submitting":"tasks.stage_submit")})]})]})]})]}):null}function ct(G,$){const F=new Date(G).getTime()-Date.now();if(F<=0)return $("tasks.tunnel_expired");const K=Math.floor(F/36e5),A=Math.floor(F%36e5/6e4);return K>0?$("tasks.tunnel_expires_hm",{h:K,m:A}):$("tasks.tunnel_expires_m",{m:A})}function Be(G){switch(G){case"CONNECTED":return"var(--accent)";case"STARTING":return"var(--warning)";case"EXPIRED":return"var(--text-muted)";default:return"var(--text-muted)"}}function Me(G,$){switch(G){case"IDLE":case"CLOSED":return $("tasks.tunnel_idle");case"STARTING":return $("tasks.tunnel_starting");case"CONNECTED":return $("tasks.tunnel_connected");case"EXPIRED":return $("tasks.tunnel_expired");case"CLOSING":return $("tasks.tunnel_closing");default:return String(G).toLowerCase()}}function ht({taskId:G,taskFinished:$,compact:F}){const{t:K}=be(),[A,J]=z.useState("IDLE"),[T,r]=z.useState(null),[a,h]=z.useState(null),[_,n]=z.useState(""),[d,v]=z.useState(!1),[g,u]=z.useState(!1),e=z.useRef(null),i=z.useCallback(async()=>{try{const m=await ce.get(`web/workspace-tunnel/${G}/status`).json();J(m.status),r(m.tunnelUrl??null),h(m.expiresAt??null),(m.status==="EXPIRED"||m.status==="IDLE"||m.status==="CLOSED")&&t()}catch{}},[G]);function s(){t(),e.current=setInterval(i,5e3)}function t(){e.current&&(clearInterval(e.current),e.current=null)}z.useEffect(()=>{$&&(A==="STARTING"||A==="CONNECTED")&&(J("IDLE"),r(null),t())},[$,A]),z.useEffect(()=>{if(A!=="CONNECTED"||!a)return;const m=()=>{const p=ct(a,K);n(p),p===K("tasks.tunnel_expired")&&(J("EXPIRED"),r(null),t())};m();const l=setInterval(m,3e4);return()=>clearInterval(l)},[A,a]),z.useEffect(()=>()=>t(),[]),z.useEffect(()=>{i()},[i]);async function o(){v(!0);try{await ce.post(`web/workspace-tunnel/${G}/start`),J("STARTING"),s()}catch{}finally{v(!1)}}async function c(){v(!0);try{await ce.post(`web/workspace-tunnel/${G}/stop`),J("IDLE"),r(null),t()}catch{}finally{v(!1)}}async function f(){T&&(await navigator.clipboard.writeText(T),u(!0),setTimeout(()=>u(!1),2e3))}return F?C.jsxs("div",{className:"flex items-center gap-2 font-mono lowercase text-xs",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"cursor_tunnel:"}),C.jsx("span",{style:{color:Be(A)},children:Me(A,K)}),(A==="IDLE"||A==="CLOSED"||A==="EXPIRED")&&C.jsx("button",{onClick:o,disabled:d,className:"rounded-[4px] px-2 py-1 text-[var(--info)] disabled:opacity-50",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:K(d?"tasks.tunnel_starting":"tasks.tunnel_start")}),A==="CONNECTED"&&T&&C.jsx("a",{href:T.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded-[4px] px-2 py-1 text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:K("tasks.tunnel_open_in_cursor")})]}):C.jsxs("div",{className:"rounded border border-[var(--border)] bg-[var(--bg-card)] p-4 font-mono lowercase",children:[C.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:K("tasks.tunnel_header")}),C.jsxs("span",{className:"text-xs",style:{color:Be(A)},children:["● ",Me(A,K)]})]}),A==="CONNECTED"&&a&&C.jsxs("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:["// ",_]}),A==="CONNECTED"&&T&&C.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded border border-[var(--border)] bg-[var(--bg-primary)] px-3 py-2",children:[C.jsx("code",{className:"flex-1 truncate text-xs text-[var(--text-primary)]",children:T}),C.jsxs("button",{onClick:f,className:"shrink-0 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":K("tasks.tunnel_copy_url"),children:["[",K("common.copy"),"]"]})]}),g&&C.jsx("p",{className:"mb-2 text-xs text-[var(--accent)]",children:K("tasks.tunnel_copied")}),A==="STARTING"&&C.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:K("tasks.tunnel_waiting")}),C.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(A==="IDLE"||A==="CLOSED")&&C.jsx("button",{onClick:o,disabled:d,className:"rounded border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_starting_button":"tasks.tunnel_start_button")}),A==="STARTING"&&C.jsx("button",{onClick:c,disabled:d,className:"rounded border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_stopping":"tasks.tunnel_cancel")}),A==="CONNECTED"&&T&&C.jsxs(C.Fragment,{children:[C.jsx("a",{href:T.replace(/^https?:/,"cursor:"),target:"_blank",rel:"noopener noreferrer",className:"rounded border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:K("tasks.tunnel_open_cursor")}),C.jsx("a",{href:T.replace(/^https?:/,"vscode:"),target:"_blank",rel:"noopener noreferrer",className:"rounded border border-[var(--border)] px-3 py-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:K("tasks.tunnel_open_vscode")}),C.jsx("button",{onClick:c,disabled:d,className:"rounded border border-[var(--destructive)]/40 px-3 py-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_stopping":"tasks.tunnel_stop")})]}),A==="EXPIRED"&&C.jsx("button",{onClick:o,disabled:d,className:"rounded border border-[var(--accent)]/40 px-3 py-1.5 text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors disabled:opacity-50",children:K(d?"tasks.tunnel_starting_button":"tasks.tunnel_restart")})]})]})}function dt({isOpen:G,onClose:$,onConfirm:F,taskId:K,isLoading:A}){const{t:J}=be();return C.jsx(Ie,{isOpen:G,onClose:$,onConfirm:F,title:J("tasks.cancel_task_title"),message:J("tasks.cancel_task_message",{id:String(K)}),confirmLabel:J("tasks.cancel_task_confirm_label"),confirmVariant:"danger",isLoading:A})}function ut({isOpen:G,onClose:$,onConfirm:F,taskId:K,mrUrl:A,isLoading:J}){const{t:T}=be(),r=A?T("tasks.retry_message_with_mr",{id:String(K),url:A}):T("tasks.retry_message_without_mr",{id:String(K)});return C.jsx(Ie,{isOpen:G,onClose:$,onConfirm:F,title:T("tasks.retry_title"),message:r,confirmLabel:T("tasks.retry_confirm_label"),confirmVariant:"accent",isLoading:J})}function _t(G){switch(G){case"stage_change":return"text-[var(--accent)]";case"info":return"text-[var(--text-secondary)]";case"warning":return"text-[var(--warning)]";case"error":return"text-[var(--destructive)]";case"system":return"text-[var(--info)]";default:return"text-[var(--text-muted)]"}}function Oe(G){switch(G){case"RUNNING":return"var(--accent)";case"COMPLETED":return"var(--accent)";case"FAILED":return"var(--destructive)";case"CANCELLED":return"var(--text-muted)";case"SUSPENDED":return"var(--warning)";case"ASSIGNED":return"#60a5fa";default:return"var(--text-muted)"}}function Pe({status:G}){return C.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[4px] px-2 py-0.5 text-xs",style:{color:Oe(G)},children:[C.jsx("span",{className:"h-1.5 w-1.5 rounded-[3px]",style:{backgroundColor:Oe(G)}}),G.toLowerCase()]})}function ye(G){if(!G)return"-";const $=new Date(G).getTime();if(Number.isNaN($))return"-";const F=Date.now()-$,K=Math.floor(F/6e4);if(K<1)return"just now";if(K<60)return`${K}m ago`;const A=Math.floor(K/60);return A<24?`${A}h ago`:`${Math.floor(A/24)}d ago`}function ft(G){let F=["clone_repository","analyze_issue","develop","test","submit_mr"];if(G.configSnapshot)try{const A=JSON.parse(G.configSnapshot);if(A.pipeline){const J=JSON.parse(A.pipeline);Array.isArray(J.stages)&&J.stages.length>0&&(F=J.stages.map(T=>T.name))}}catch{}const K=G.currentStage?F.indexOf(G.currentStage):-1;return F.map((A,J)=>{let T="pending";return G.status==="COMPLETED"?T="completed":G.status==="FAILED"&&J<=K?T=J===K?"failed":"completed":K>=0&&(J<K?T="completed":J===K&&(T="running")),{name:A,status:T}})}const vt=["COMPLETED","FAILED","CANCELLED"];function wt(){var _e,le;const{id:G}=Ue(),$=$e(),{t:F}=be(),K=Ve(P=>P.cancelTask),[A,J]=z.useState(null),[T,r]=z.useState([]),[a,h]=z.useState(!0),[_,n]=z.useState(null),[d,v]=z.useState(!1),[g,u]=z.useState(!1),[e,i]=z.useState(!1),[s,t]=z.useState(!1),[o,c]=z.useState("terminal"),[f,m]=z.useState([]),[l,p]=z.useState(0),[x,L]=z.useState(0),[y,E]=z.useState(""),[B,I]=z.useState(""),[H,j]=z.useState(!1),[b,w]=z.useState(!1),[k,D]=z.useState(null),[N,W]=z.useState("disconnected"),[V,q]=z.useState("auto"),ee=z.useRef(null),S=Number(G),R=A?vt.includes(A.status):!1;ze(A?`#${A.id} ${A.description}`:null);const M=z.useCallback(async()=>{try{const P=await ce.get(`web/tasks/${S}`).json();J(P)}catch{}},[S]),O=z.useCallback(async()=>{try{const P=await ce.get(`web/tasks/${S}/logs`).json();r(P.lines)}catch{}},[S]),Y=z.useCallback(async()=>{try{const P=await ce.get(`web/tasks/${S}/pending-confirm`).json();n(P.confirm)}catch{n(null)}},[S]),U=z.useCallback(async()=>{j(!0);try{const P=new URLSearchParams;P.set("limit","50"),P.set("offset",String(x*50)),y&&P.set("type",y),B&&P.set("search",B);const Z=await ce.get(`web/tasks/${S}/events?${P}`).json();m(Z.events),p(Z.total)}catch{}finally{j(!1)}},[S,x,y,B]);z.useEffect(()=>{o==="logs"&&U()},[o,U]),z.useEffect(()=>{o==="pipeline"&&ce.get(`web/workspaces/${S}`).json().then(D).catch(()=>{})},[o,S]),z.useEffect(()=>{h(!0),Promise.all([M(),O(),Y()]).finally(()=>h(!1))},[M,O,Y]),z.useEffect(()=>{if(R)return;const P=setInterval(()=>{M(),O(),Y()},5e3);return()=>clearInterval(P)},[R,M,O,Y]);const Q=z.useCallback(()=>n(null),[]),ie=z.useCallback(()=>{n(null),M()},[M]);async function ne(){i(!0);try{await K(S),v(!1),await M()}finally{i(!1)}}async function ue(){t(!0);try{const P=await ce.post(`web/tasks/${S}/retry`).json();u(!1),$(`/tasks/${P.task.id}`)}finally{t(!1)}}if(a)return C.jsx("div",{className:"flex h-full items-center justify-center font-mono",children:C.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:F("tasks.loading_task")})});if(!A)return C.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[C.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:F("tasks.task_not_found")}),C.jsxs("button",{onClick:()=>$("/tasks"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",F("tasks.back_to_tasks")]})]});const X=ft(A),de=X.findIndex(P=>P.status==="running"),ge=C.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[C.jsx("button",{onClick:()=>$("/tasks"),className:"shrink-0 text-[var(--text-muted)]",children:C.jsx(Xe,{className:"h-4 w-4"})}),C.jsxs("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:["#",A.id," ",A.description]})]}),fe=C.jsxs("div",{className:"hidden md:flex items-center gap-4 border-b border-[var(--border)] bg-[var(--bg-primary)] px-5 shrink-0",style:{height:44},children:[C.jsx(Pe,{status:A.status}),C.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),C.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["project: ",C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),A.branch&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),C.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["branch: ",C.jsx("span",{className:"text-[var(--text-primary)]",children:A.branch})]})]}),A.mrUrl&&C.jsxs(C.Fragment,{children:[C.jsx("span",{className:"text-xs text-[var(--border)]",children:"|"}),C.jsxs("a",{href:A.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[var(--info)] hover:underline",children:["MR: ",((_e=A.mrUrl.match(/!?\d+$/))==null?void 0:_e[0])??"view"]})]})]}),me=C.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] bg-[var(--bg-primary)] px-4 md:px-5 shrink-0",style:{height:48},children:[!R&&C.jsxs("button",{onClick:()=>v(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--destructive)]",style:{backgroundColor:"rgba(239,68,68,0.12)"},children:[C.jsx(we,{className:"h-3 w-3"}),F("tasks.cancel_task")]}),A.status==="FAILED"&&C.jsxs("button",{onClick:()=>u(!0),className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] bg-[#171717] px-3 h-8 text-[11px] text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[#222] transition-colors cursor-pointer",children:[C.jsx(Je,{className:"h-3 w-3"}),F("tasks.retry_task")]}),A.machineId&&!R&&C.jsxs("button",{onClick:()=>{},className:"flex flex-1 md:flex-none items-center justify-center gap-1.5 rounded-[4px] px-3 h-8 text-[11px] font-medium text-[var(--info)]",style:{backgroundColor:"rgba(59,130,246,0.12)"},children:[C.jsx(Ye,{className:"h-3 w-3"}),F("tasks.cursor_tunnel")]})]}),Se=C.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-6 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-4 lg:flex",children:[C.jsxs("div",{className:"flex flex-col gap-3",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.pipeline_stages")}),X.map(P=>{const Z=P.status==="completed",te=P.status==="running",re=P.status==="failed";return C.jsxs("div",{className:`flex items-center gap-2 rounded-[4px] px-2 py-1.5 ${te?"bg-[#1a1a1a]":""}`,children:[Z&&C.jsx(Ke,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),te&&C.jsx(Ee,{className:"h-3.5 w-3.5 shrink-0 text-[var(--accent)]"}),re&&C.jsx(we,{className:"h-3.5 w-3.5 shrink-0 text-[var(--destructive)]"}),P.status==="pending"&&C.jsx(Ze,{className:"h-3.5 w-3.5 shrink-0 text-[#525252]"}),C.jsx("span",{className:"text-xs",style:{color:Z?"var(--accent)":te?"#e5e5e5":re?"var(--destructive)":"#525252",fontWeight:te?500:400},children:te?`> ${P.name}`:P.name})]},P.name)})]}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.activity_log")}),T.length>0?C.jsx("div",{className:"flex flex-col gap-1.5",children:T.slice(0,8).map((P,Z)=>C.jsx("p",{className:"text-[11px] leading-relaxed text-[var(--text-muted)]",children:P},Z))}):C.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:F("tasks.no_activity")})]})]}),oe=C.jsxs(C.Fragment,{children:[C.jsx(dt,{isOpen:d,onClose:()=>v(!1),onConfirm:ne,taskId:S,isLoading:e}),C.jsx(ut,{isOpen:g,onClose:()=>u(!1),onConfirm:ue,taskId:S,mrUrl:A.mrUrl??void 0,isLoading:s})]});return b&&o==="terminal"?C.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[var(--bg-primary)] font-mono lowercase",children:[fe,C.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.pty_terminal")}),C.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] ${N==="connected"?"text-[var(--accent)]":N==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[C.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N==="connected"?"bg-[var(--accent)]":N==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),F(`tasks.${N}`)]})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[!R&&V==="auto"&&C.jsxs("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[C.jsx(Le,{className:"h-3 w-3"}),F("tasks.take_over")]}),!R&&V==="manual"&&C.jsx("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:F("tasks.restore_auto")}),A.currentStage&&C.jsxs("span",{className:"text-[11px] text-[var(--accent)]",children:[F("tasks.stage"),": ",A.currentStage]}),C.jsx("button",{onClick:()=>w(!1),className:"flex items-center rounded-[4px] bg-[#171717] px-2.5 py-1 text-[var(--text-muted)]",children:C.jsx(st,{className:"h-3 w-3"})})]})]}),C.jsx("div",{className:"min-h-0 flex-1",children:C.jsx(Ae,{ref:ee,taskId:S,sessionId:A.currentSessionId??void 0,taskFinished:R,onStatusChange:W,onTakeoverChange:q})}),me,oe]}):A.status==="SUSPENDED"?C.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,fe,C.jsx("div",{className:"flex items-center gap-2 border-b px-4 md:px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(245,158,11,0.08)",borderColor:"rgba(245,158,11,0.2)",color:"var(--warning)"},children:F("tasks.task_suspended_banner")}),C.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row gap-4 md:gap-6 p-4 md:p-6 overflow-y-auto",children:[C.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-4",children:[C.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[C.jsxs("span",{className:"text-xl font-bold text-[var(--text-primary)]",children:["#",A.id]}),C.jsx("span",{className:"text-base text-[var(--text-secondary)]",children:A.description}),C.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:F("tasks.status_suspended")})]}),C.jsx("div",{className:"flex items-center gap-2 md:hidden",children:C.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px] font-bold text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:F("tasks.status_suspended")})}),_&&C.jsxs("div",{className:"rounded-[4px] border p-4",style:{borderColor:"rgba(245,158,11,0.27)",backgroundColor:"#1a1a1a"},children:[C.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:F("tasks.pending_confirmation")}),C.jsx("p",{className:"mb-3 text-xs text-[var(--text-secondary)]",children:_.prompt??F("tasks.pipeline_requires_confirmation")}),_.stageName&&C.jsx("div",{className:"mb-3 flex flex-col gap-1.5 text-[11px]",children:C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"stage"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:_.stageName})]})}),C.jsx("div",{className:"flex flex-col gap-2 md:flex-row md:flex-wrap md:gap-3",children:_.choices?_.choices.map((P,Z)=>C.jsx("button",{onClick:async()=>{try{await ce.post(`web/tasks/${S}/confirm-stage`,{json:{stageIndex:_.stageIndex,result:P.value}}),ie()}catch{ke.error(F("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] px-4 py-2.5 md:py-2 text-[11px] font-bold",style:Z===0?{backgroundColor:"var(--accent)",color:"#0c0c0c"}:{backgroundColor:"#1a1a1a",border:"1px solid var(--border)",color:"var(--text-primary)"},children:P.label},P.value)):C.jsxs(C.Fragment,{children:[C.jsx("button",{onClick:async()=>{try{await ce.post(`web/tasks/${S}/confirm-stage`,{json:{stageIndex:_.stageIndex,result:"retry"}}),ie()}catch{ke.error(F("tasks.confirm_failed"))}},className:"flex-1 md:flex-none rounded-[4px] bg-[var(--accent)] px-4 py-2.5 md:py-2 text-[11px] font-bold text-[#0c0c0c]",children:F("tasks.confirm_and_proceed")}),C.jsx("button",{onClick:()=>v(!0),className:"flex-1 md:flex-none rounded-[4px] bg-[#1a1a1a] px-4 py-2.5 md:py-2 text-[11px] text-[var(--destructive)]",style:{border:"1px solid rgba(239,68,68,0.27)"},children:F("tasks.reject")})]})})]}),C.jsx("div",{className:"hidden md:flex flex-wrap items-center gap-2 py-2",children:X.map((P,Z)=>{const te=P.status==="failed",re=P.status==="completed",ae=P.status==="running"&&A.status==="SUSPENDED",he=te?"var(--destructive)":re?"var(--accent)":ae?"var(--warning)":"#525252",se=te?"rgba(239,68,68,0.12)":re?"rgba(34,197,94,0.12)":ae?"rgba(245,158,11,0.12)":"transparent";return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"rounded-[4px] px-2.5 py-1 text-[11px]",style:{color:he,backgroundColor:se,fontWeight:ae?700:400,border:ae?`1px solid ${he}`:void 0},children:ae?"confirm":`${P.name}${re?" ✓":te?" ✗":""}`}),Z<X.length-1&&C.jsx("div",{className:"h-px w-6 bg-[var(--border)]"})]},P.name)})}),C.jsxs("div",{className:"hidden md:block min-h-[200px] flex-1 rounded-[4px] border border-[var(--border)] bg-[#0c0c0c] p-4",children:[C.jsx("p",{className:"mb-2 text-[11px] font-bold text-[var(--accent)]",children:F("tasks.pty_output")}),C.jsxs("div",{className:"flex flex-col gap-1",children:[T.slice(-10).map((P,Z)=>C.jsx("p",{className:"text-[10px] leading-relaxed text-[var(--text-secondary)]",children:P},Z)),T.length===0&&C.jsx("p",{className:"text-[10px] text-[var(--text-muted)]",children:F("tasks.no_output")})]})]})]}),C.jsxs("div",{className:"hidden w-[280px] shrink-0 flex-col gap-4 rounded-[4px] border border-[var(--border)] bg-[#171717] p-4 lg:flex",children:[C.jsx("span",{className:"text-[13px] font-bold text-[var(--accent)]",children:F("tasks.task_info")}),C.jsxs("div",{className:"flex flex-col gap-1.5 text-[11px]",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"status"}),C.jsx("span",{className:"font-bold text-[var(--warning)]",children:"suspended"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.machineName??"-"})]})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:F("tasks.stage_timeline")}),C.jsx("div",{className:"flex flex-col gap-2",children:X.map(P=>{const Z=P.status==="completed"?"var(--accent)":P.status==="failed"?"var(--destructive)":P.status==="running"?"var(--warning)":"#525252",te=P.status==="failed"?"var(--destructive)":P.status==="running"?"var(--warning)":"#a3a3a3",re=P.status==="completed"?"completed":P.status==="running"?"suspended":P.status==="failed"?"failed":"pending";return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"h-2 w-2 shrink-0 rounded-[4px]",style:{backgroundColor:Z}}),C.jsxs("span",{className:"text-[10px]",style:{color:te,fontWeight:P.status==="running"?700:400},children:[P.name," ",re]})]},P.name)})}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsx("div",{className:"flex flex-col gap-1.5 text-[11px]",children:C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"created"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:ye(A.createdAt)})]})})]})]}),_&&C.jsx(Te,{isOpen:!!_,onClose:Q,taskId:S,stageIndex:_.stageIndex,stageName:_.stageName??(A==null?void 0:A.currentStage)??void 0,mode:_.mode,prompt:_.prompt,choices:_.choices,defaultChoice:_.defaultChoice,timeoutSeconds:Math.ceil(_.timeout/1e3),onSubmitted:ie}),oe]}):C.jsxs("div",{className:"flex h-full flex-col font-mono lowercase",children:[ge,fe,A.errorMessage&&C.jsxs("div",{className:"flex items-center gap-2 border-b px-6 py-2 text-xs shrink-0",style:{backgroundColor:"rgba(239,68,68,0.08)",borderColor:"rgba(239,68,68,0.2)",color:"var(--destructive)"},children:["// error: ",A.errorMessage]}),_&&C.jsx(Te,{isOpen:!!_,onClose:Q,taskId:S,stageIndex:_.stageIndex,stageName:_.stageName??(A==null?void 0:A.currentStage)??void 0,mode:_.mode,prompt:_.prompt,choices:_.choices,defaultChoice:_.defaultChoice,timeoutSeconds:Math.ceil(_.timeout/1e3),onSubmitted:ie}),C.jsxs("div",{className:"flex min-h-0 flex-1",children:[C.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[C.jsx("div",{className:"flex items-center border-b border-[var(--border)] shrink-0",children:["terminal","pipeline","logs"].map(P=>C.jsx("button",{onClick:()=>c(P),className:`px-4 py-2.5 text-xs transition-colors ${o===P?"border-b-2 border-[var(--accent)] text-[var(--accent)] font-medium":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:F(P==="terminal"?"tasks.terminal":P==="pipeline"?"tasks.pipeline_tab":"tasks.logs")},P))}),o==="terminal"&&C.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[C.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 md:px-5 shrink-0",style:{height:36,backgroundColor:"#111111"},children:[C.jsxs("div",{className:"flex items-center gap-2 md:gap-3",children:[C.jsx("span",{className:"text-[11px] font-medium text-[var(--text-muted)]",children:F("tasks.pty_terminal")}),C.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] ${N==="connected"?"text-[var(--accent)]":N==="connecting"?"text-[var(--warning)]":"text-[var(--text-muted)]"}`,children:[C.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N==="connected"?"bg-[var(--accent)]":N==="connecting"?"bg-[var(--warning)]":"bg-[#525252]"}`}),F(`tasks.${N}`)]})]}),C.jsxs("div",{className:"flex items-center gap-2",children:[!R&&V==="auto"&&C.jsxs("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.requestTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--warning)]",style:{backgroundColor:"rgba(245,158,11,0.12)"},children:[C.jsx(Le,{className:"h-3 w-3"}),F("tasks.take_over")]}),!R&&V==="manual"&&C.jsx("button",{onClick:()=>{var P;return(P=ee.current)==null?void 0:P.releaseTakeover()},className:"flex items-center gap-1.5 rounded-[4px] px-2.5 h-6 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:F("tasks.restore_auto")}),!R&&V==="requesting"&&C.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 h-6 text-[11px] text-[var(--warning)]",children:[C.jsx(Ee,{className:"h-3 w-3 animate-spin"}),F("tasks.requesting_takeover")]}),!R&&A.currentStage&&C.jsxs("button",{className:"hidden md:flex items-center gap-1.5 rounded-[4px] bg-[#171717] px-2.5 h-6 text-[11px] text-[var(--text-muted)]",children:[C.jsx(it,{className:"h-3 w-3"}),F("tasks.skip_stage")]}),C.jsx("button",{onClick:()=>w(!0),className:"hidden md:flex items-center rounded-[4px] bg-[#171717] px-2.5 h-6 text-[var(--text-muted)]",children:C.jsx(et,{className:"h-3 w-3"})})]})]}),C.jsxs("div",{className:"flex items-center gap-2 border-b border-[var(--border)] px-4 py-2 shrink-0 md:hidden",children:[C.jsx(Pe,{status:A.status}),A.machineName&&C.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["on ",A.machineName]})]}),C.jsxs("div",{className:"border-b border-[var(--border)] px-4 py-3 shrink-0 md:hidden",children:[C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:F("tasks.stage_progress")}),C.jsx("div",{className:"mt-2 flex items-center gap-1 overflow-x-auto no-scrollbar",children:X.map((P,Z)=>{const te=P.status==="completed",re=P.status==="running",he=P.status==="failed"?"var(--destructive)":te||re?"var(--accent)":"#525252";return C.jsxs("div",{className:"flex items-center",children:[C.jsxs("span",{className:"shrink-0 text-[10px] whitespace-nowrap",style:{color:he,fontWeight:re?600:400},children:[P.name,te?" ✓":re?" ...":""]}),Z<X.length-1&&C.jsx("div",{className:"mx-1.5 h-px w-4 shrink-0",style:{backgroundColor:he}})]},P.name)})})]}),C.jsx("div",{className:"px-4 pt-3 pb-1 shrink-0 md:hidden",children:C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:F("tasks.pty_output")})}),C.jsx("div",{className:"min-h-0 flex-1",children:C.jsx(Ae,{ref:ee,taskId:S,sessionId:A.currentSessionId??void 0,taskFinished:R,onStatusChange:W,onTakeoverChange:q})}),me]}),o==="pipeline"&&C.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4 md:p-6 lg:p-8",children:[C.jsx("div",{className:"flex items-center py-4 mb-4 md:mb-5 overflow-x-auto no-scrollbar",children:X.map((P,Z)=>{const te=P.status==="completed",re=P.status==="running",se=P.status==="failed"?"var(--destructive)":te||re?"var(--accent)":"#525252";return C.jsxs("div",{className:"flex items-center",style:{flex:Z<X.length-1?1:void 0},children:[C.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[C.jsxs("div",{className:"flex h-6 w-6 md:h-7 md:w-7 items-center justify-center rounded-full shrink-0",style:{backgroundColor:se},children:[te&&C.jsx("span",{className:"text-[10px] md:text-xs font-semibold text-[#0c0c0c]",children:"✓"}),re&&C.jsx("span",{className:"h-2 w-2 md:h-2.5 md:w-2.5 rounded-full bg-[#0c0c0c]"})]}),C.jsx("span",{className:"text-[9px] md:text-[11px] font-medium whitespace-nowrap",style:{color:se},children:P.name})]}),Z<X.length-1&&C.jsx("div",{className:"mx-1 md:mx-2 h-0.5 flex-1 min-w-3 rounded-full",style:{backgroundColor:Z<(de>=0?de:0)?"var(--accent)":"#525252"}})]},P.name)})}),A.currentStage&&C.jsxs("div",{className:"mb-4 md:mb-5 rounded-[4px] border border-[var(--border)] bg-[#171717] p-3 text-xs leading-relaxed",children:[C.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// stage: ",A.currentStage," (",de+1,"/",X.length,")"]}),A.startedAt&&C.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// elapsed: ",ye(A.startedAt).replace(" ago","")]}),C.jsxs("p",{className:"text-[var(--text-secondary)]",children:["// retries: ",A.retryCount,"/2"]})]}),C.jsx("button",{onClick:()=>c("terminal"),className:"flex-1 min-h-[100px] rounded-[4px] border border-dashed border-[var(--border)] flex items-center justify-center gap-2 text-[11px] text-[var(--text-muted)] hover:border-[var(--accent)] hover:text-[var(--accent)] transition-colors",children:C.jsxs("span",{children:["// ",F("tasks.view_terminal")]})}),C.jsxs("div",{className:"mt-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:hidden",children:[C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)]",children:F("tasks.task_info")}),C.jsxs("div",{className:"mt-2 flex flex-col gap-1.5 text-[11px]",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"worker"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.machineName??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.branch??"-"})]})]})]})]}),o==="logs"&&C.jsxs("div",{className:"flex flex-1 flex-col gap-3 md:gap-5 overflow-y-auto p-4 md:p-6 lg:p-8",children:[C.jsx("span",{className:"text-[11px] font-bold text-[var(--accent)] md:hidden",children:F("tasks.task_logs")}),C.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:gap-3",children:[C.jsx("div",{className:"flex items-center gap-1 overflow-x-auto no-scrollbar md:hidden",children:["","error","system"].map(P=>C.jsx("button",{onClick:()=>{E(P),L(0)},className:`shrink-0 rounded-[4px] px-2.5 py-1 text-[10px] ${y===P?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)]"}`,children:P||"all"},P))}),C.jsx("div",{className:"hidden md:block",children:C.jsx(Ge,{value:y,onChange:P=>{E(P),L(0)},options:[{value:"",label:"all"},{value:"stage_change",label:"stage_change"},{value:"info",label:"info"},{value:"warning",label:"warning"},{value:"error",label:"error"},{value:"system",label:"system"}],className:"w-36"})}),C.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-3 py-2",children:[C.jsx(qe,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),C.jsx("input",{type:"text",placeholder:F("tasks.search_logs"),value:B,onChange:P=>{I(P.target.value),L(0)},className:"flex-1 bg-transparent text-xs text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"})]})]}),C.jsxs("div",{className:"flex flex-col gap-0.5",children:[f.map((P,Z)=>C.jsxs("div",{className:`flex items-start md:items-center gap-2 md:gap-4 rounded-[4px] px-2 md:px-3 py-2 text-[11px] md:text-xs ${Z%2===0?"bg-[var(--bg-card)]":""}`,children:[C.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:new Date(P.timestamp).toLocaleTimeString("en-US",{hour12:!1})}),C.jsx("span",{className:`shrink-0 font-medium ${_t(P.type)}`,children:P.type}),C.jsx("span",{className:"min-w-0 break-words md:truncate text-[var(--text-primary)]",children:P.message})]},P.id)),f.length===0&&!H&&C.jsx("p",{className:"py-8 text-center text-xs text-[var(--text-muted)]",children:F("tasks.no_log_entries")})]}),l>50&&C.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Array.from({length:Math.ceil(l/50)}).slice(0,5).map((P,Z)=>C.jsx("button",{onClick:()=>L(Z),className:`rounded-[4px] px-2 py-1 text-xs ${x===Z?"bg-[var(--accent)] text-black font-medium":"text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:Z+1},Z)),Math.ceil(l/50)>5&&C.jsx("button",{onClick:()=>L(x+1),disabled:x>=Math.ceil(l/50)-1,className:"rounded-[4px] px-2 py-1 text-xs text-[var(--text-muted)] disabled:opacity-30",children:">"})]})]})]}),o==="terminal"&&Se,o==="pipeline"&&C.jsxs("div",{className:"hidden w-[420px] shrink-0 flex-col gap-5 overflow-y-auto border-l border-[var(--border)] bg-[var(--bg-primary)] p-5 lg:flex",children:[C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.task_info")}),C.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"project"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.projectKey})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"creator"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.creatorName??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"machine"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.machineName??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"created_at"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:ye(A.createdAt)})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"agent_type"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.agentType??"cursor"})]})]})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.workspace_section")}),C.jsxs("div",{className:"flex flex-col gap-1.5 text-xs",children:[C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"branch"}),C.jsx("span",{className:"text-[var(--text-primary)]",children:A.branch??(k==null?void 0:k.branch)??"-"})]}),C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"worktree"}),C.jsx("span",{className:"ml-4 truncate text-[var(--text-primary)]",children:(k==null?void 0:k.path)??"-"})]}),A.mrUrl&&C.jsxs("div",{className:"flex justify-between",children:[C.jsx("span",{className:"text-[var(--text-muted)]",children:"mr_link"}),C.jsx("a",{href:A.mrUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-[var(--info)] hover:underline",children:((le=A.mrUrl.match(/!?\d+$/))==null?void 0:le[0])??"view"})]})]})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.cursor_tunnel_section")}),A.machineId?C.jsx(ht,{taskId:S,taskFinished:R,compact:!0}):C.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:F("tasks.no_machine_assigned")})]}),C.jsx("div",{className:"h-px bg-[var(--border)]"}),C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsx("span",{className:"text-[13px] font-semibold text-[var(--accent)]",children:F("tasks.stage_timeline")}),C.jsx("div",{className:"flex flex-col gap-2 text-xs",children:X.map(P=>{const Z=P.status==="completed"?"✓":P.status==="running"?"→":"·",te=P.status==="completed"||P.status==="running"?"var(--accent)":P.status==="failed"?"var(--destructive)":"#525252",re=P.status==="completed"?"done":P.status==="running"?"running...":P.status==="failed"?"failed":"pending";return C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx("span",{className:"font-semibold",style:{color:te},children:Z}),C.jsx("span",{className:P.status==="running"?"font-medium":"",style:{color:te},children:P.name}),C.jsxs("span",{className:"text-[11px]",style:{color:"#525252"},children:["— ",re]})]},P.name)})})]})]})]}),oe]})}export{wt as default};