wind-agent-cli 1.38.0 → 1.38.2

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 (78) hide show
  1. package/README.md +2 -0
  2. package/dist/assets/{CodeEditor-FvgsnJ7J.js → CodeEditor-C6BtLdoC.js} +1 -1
  3. package/dist/assets/{FileTree-NLULrBDi.js → FileTree-CGxNFZda.js} +1 -1
  4. package/dist/assets/{GitPanel-51KUBbEW.js → GitPanel-BV-IAyEC.js} +1 -1
  5. package/dist/assets/{MarkdownPreview-PEEWVWeS.js → MarkdownPreview-DVoEzpoc.js} +1 -1
  6. package/dist/assets/{Shell-BEx66cW_.js → Shell-CUTO-THd.js} +2 -2
  7. package/dist/assets/{StandaloneShell-BkuUCPZP.js → StandaloneShell-BKM1qxUc.js} +1 -1
  8. package/dist/assets/{TaskMasterPanel-DfQG80SF.js → TaskMasterPanel-DDDCVF6M.js} +2 -2
  9. package/dist/assets/{abnfDiagram-N423BO3Z-Cc0ul87U.js → abnfDiagram-N423BO3Z-Crubtav6.js} +1 -1
  10. package/dist/assets/{arc-BAuugHw_.js → arc-h9xb7EWA.js} +1 -1
  11. package/dist/assets/{architectureDiagram-T3A2C74G-DA3G7QZD.js → architectureDiagram-T3A2C74G-BmMQp4MC.js} +1 -1
  12. package/dist/assets/{blockDiagram-VBNYF7ZC-tJ12IJs3.js → blockDiagram-VBNYF7ZC-BtD-zDnJ.js} +1 -1
  13. package/dist/assets/{c4Diagram-5PPSVZJV-5BTMCXL4.js → c4Diagram-5PPSVZJV-D18s6J-v.js} +1 -1
  14. package/dist/assets/channel-CuR3zGvy.js +1 -0
  15. package/dist/assets/{chunk-2GRJ4B5K-BPaI06Ou.js → chunk-2GRJ4B5K-BHIcCvB_.js} +1 -1
  16. package/dist/assets/{chunk-2Q5K7J3B-HV4zmsEe.js → chunk-2Q5K7J3B-DcX4AeRe.js} +1 -1
  17. package/dist/assets/{chunk-5RXB4S5H-BAwutJoU.js → chunk-5RXB4S5H-CZwYDv9K.js} +1 -1
  18. package/dist/assets/{chunk-5VM5RSS4-B9QAJPrv.js → chunk-5VM5RSS4-CR-F7R13.js} +1 -1
  19. package/dist/assets/{chunk-6Q2QTUOP-BOIW8bzI.js → chunk-6Q2QTUOP-BPP216SB.js} +1 -1
  20. package/dist/assets/{chunk-GF5L2VYU-DD13o00-.js → chunk-GF5L2VYU-CcFeSmHe.js} +1 -1
  21. package/dist/assets/{chunk-JWPE2WC7-CFBm23VK.js → chunk-JWPE2WC7-C5T_9-OI.js} +1 -1
  22. package/dist/assets/{chunk-KBJHAD2P-C0i0v8Op.js → chunk-KBJHAD2P-g5eR5X5h.js} +1 -1
  23. package/dist/assets/{chunk-RYQCIY6F-DfeK0taV.js → chunk-RYQCIY6F-76WBDsoZ.js} +1 -1
  24. package/dist/assets/{chunk-XXDRQBXY-BKWvf-QE.js → chunk-XXDRQBXY-DGuy3LLn.js} +1 -1
  25. package/dist/assets/classDiagram-JCYQIIEL-BWpl-4NG.js +1 -0
  26. package/dist/assets/classDiagram-v2-OCEON4UE-BWpl-4NG.js +1 -0
  27. package/dist/assets/{cose-bilkent-JH36ORCC-CBE8oM7L.js → cose-bilkent-JH36ORCC-Cg4R1M0H.js} +1 -1
  28. package/dist/assets/{cynefin-VYW2F7L2-DziGp35A.js → cynefin-VYW2F7L2-Cbmals-o.js} +1 -1
  29. package/dist/assets/{cynefinDiagram-MW4NZA55-CNvtHl39.js → cynefinDiagram-MW4NZA55-CI79hpHc.js} +1 -1
  30. package/dist/assets/{dagre-VZM6K2ZE-Bz9lsU7m.js → dagre-VZM6K2ZE-r3Uz8Fhv.js} +1 -1
  31. package/dist/assets/{diagram-7IWD3JNH-CV7D3VSd.js → diagram-7IWD3JNH-ClRIkmQw.js} +1 -1
  32. package/dist/assets/{diagram-B4RE2ZJO-Dj4EjDNC.js → diagram-B4RE2ZJO-C71qkNlS.js} +1 -1
  33. package/dist/assets/{diagram-LBJQPF4R-wJ6FHvf-.js → diagram-LBJQPF4R-CC7ShhCC.js} +1 -1
  34. package/dist/assets/{diagram-Q27KOJAE-DMFYMhOB.js → diagram-Q27KOJAE-DPHL4vnP.js} +1 -1
  35. package/dist/assets/{diagram-UB23O5K3-DeBSbWAI.js → diagram-UB23O5K3-CP_My5E9.js} +1 -1
  36. package/dist/assets/{ebnfDiagram-BXEA7PRR-2NnJSGhT.js → ebnfDiagram-BXEA7PRR-BQe4AU9Z.js} +1 -1
  37. package/dist/assets/{erDiagram-JOGREHBK-DrSlg8hr.js → erDiagram-JOGREHBK-CFidQ-d5.js} +1 -1
  38. package/dist/assets/feature-chat-CHKsDTs-.js +88 -0
  39. package/dist/assets/{feature-workspace-CAB6bgPy.js → feature-workspace-BodovOw6.js} +2 -2
  40. package/dist/assets/{flowDiagram-UKHOOZJN-C0pejU6W.js → flowDiagram-UKHOOZJN-X5fPFxbp.js} +1 -1
  41. package/dist/assets/{ganttDiagram-PKOTCBZU-BM0VCUUz.js → ganttDiagram-PKOTCBZU-CILFHjP8.js} +1 -1
  42. package/dist/assets/{gitGraphDiagram-DS77QQ5N-SbLG0c5_.js → gitGraphDiagram-DS77QQ5N-DCQCtC_g.js} +1 -1
  43. package/dist/assets/{index-nyrkoQK6.js → index-Bn37f1jp.js} +13 -13
  44. package/dist/assets/{index-Gqazqfs3.js → index-Bo9nFrtn.js} +1 -1
  45. package/dist/assets/{index-Btkf0_rU.js → index-D0vbG70l.js} +1 -1
  46. package/dist/assets/{index-BflGfU1C.js → index-cNARKAN2.js} +1 -1
  47. package/dist/assets/{infoDiagram-6WML65LV-Cf5DSa66.js → infoDiagram-6WML65LV-Da145n1G.js} +1 -1
  48. package/dist/assets/{ishikawaDiagram-WSZJBQD7-DwyFutKy.js → ishikawaDiagram-WSZJBQD7-DGUP61eq.js} +1 -1
  49. package/dist/assets/{journeyDiagram-NVQOT4AX-Df0FRhLo.js → journeyDiagram-NVQOT4AX-BqfnKWDJ.js} +1 -1
  50. package/dist/assets/{kanban-definition-27J2QSJJ-HmpbjrZz.js → kanban-definition-27J2QSJJ-US6pQfNy.js} +1 -1
  51. package/dist/assets/{linear-DOM01LBe.js → linear-d91wK5kZ.js} +1 -1
  52. package/dist/assets/{mermaid.core-C2Ma-_S6.js → mermaid.core-BsWqrIaW.js} +4 -4
  53. package/dist/assets/{mindmap-definition-FAOFIHXS-B4GOIn76.js → mindmap-definition-FAOFIHXS-CXWD2UbS.js} +1 -1
  54. package/dist/assets/{pegDiagram-VL7TDLO6-BHur7aH2.js → pegDiagram-VL7TDLO6-BVzfDR-8.js} +1 -1
  55. package/dist/assets/{pieDiagram-7S7Q4E2Y-Cw0UELLV.js → pieDiagram-7S7Q4E2Y-PNpHZnJ9.js} +1 -1
  56. package/dist/assets/{quadrantDiagram-CIZ2JOQS-CB2BrX3g.js → quadrantDiagram-CIZ2JOQS-DxCI4i3K.js} +1 -1
  57. package/dist/assets/{railroadDiagram-AXF67PYL-DPYZYmLX.js → railroadDiagram-AXF67PYL-BYkvo3om.js} +1 -1
  58. package/dist/assets/{requirementDiagram-LRYGKXZP-DSX4IJ1n.js → requirementDiagram-LRYGKXZP-LUtvOYtV.js} +1 -1
  59. package/dist/assets/{sankeyDiagram-W5VNT64P-TenC3ZQo.js → sankeyDiagram-W5VNT64P-CVyI8YeM.js} +1 -1
  60. package/dist/assets/{sequenceDiagram-SI44F4Z6-DltGsf3F.js → sequenceDiagram-SI44F4Z6-1vuRFolM.js} +1 -1
  61. package/dist/assets/{sizeCapture-X5ZJPWSS-D7llwbJZ.js → sizeCapture-X5ZJPWSS-o4oVZXe8.js} +1 -1
  62. package/dist/assets/{stateDiagram-OKZ733FA-C-hAvbnY.js → stateDiagram-OKZ733FA-WedLIlXF.js} +1 -1
  63. package/dist/assets/stateDiagram-v2-UEYNNEHI-BqzvLVVB.js +1 -0
  64. package/dist/assets/{swimlanes-SLNWSIFB-DWD30fv6.js → swimlanes-SLNWSIFB-CpeXuk67.js} +2 -2
  65. package/dist/assets/swimlanesDiagram-ULZ7WXOC-CeI6fByR.js +8 -0
  66. package/dist/assets/{timeline-definition-Z64GVDOM-quWmimSE.js → timeline-definition-Z64GVDOM-DFcPWe47.js} +1 -1
  67. package/dist/assets/{vennDiagram-T6HMQDX7-aUQcm8h5.js → vennDiagram-T6HMQDX7-BH8C1C49.js} +1 -1
  68. package/dist/assets/{wardleyDiagram-T6FBY63Y-BZ0bwsFQ.js → wardleyDiagram-T6FBY63Y-K1Ew0uit.js} +1 -1
  69. package/dist/assets/{xychartDiagram-ELKLHX3M-DOVzAq63.js → xychartDiagram-ELKLHX3M-CQHlqWY2.js} +1 -1
  70. package/dist/index.html +3 -3
  71. package/dist/sw.js +1 -1
  72. package/package.json +5 -1
  73. package/dist/assets/channel-BGDgNNQz.js +0 -1
  74. package/dist/assets/classDiagram-JCYQIIEL-C2SNM4oy.js +0 -1
  75. package/dist/assets/classDiagram-v2-OCEON4UE-C2SNM4oy.js +0 -1
  76. package/dist/assets/feature-chat-CvOCyaLe.js +0 -88
  77. package/dist/assets/stateDiagram-v2-UEYNNEHI-DaYSFcRQ.js +0 -1
  78. package/dist/assets/swimlanesDiagram-ULZ7WXOC-LTkF2T6t.js +0 -8
@@ -1,4 +1,4 @@
1
- import{r as Y,j as J}from"./vendor-react-C2GTiUCy.js";import{a6 as dt,a5 as _t,g as Ae}from"./feature-workspace-CAB6bgPy.js";import{L as je,u as nt,X as ft,bz as gt,av as vt,aB as pt,aV as mt,aM as St,bA as Ct}from"./vendor-ui-CAUHSABu.js";import{u as ot}from"./vendor-i18n-B6HjLCnN.js";const bt=200,at=100,wt=50,yt=768,xt=480,Et=9,Lt=12,Rt="\x1B[?1002h\x1B[?1006h",Tt=500,Dt=20,At=15,Mt=5,kt=2,Te={cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}};function Bt(z,R,k){return!k&&z===R}function qe(z="default",R=Number.POSITIVE_INFINITY){return z!=="herdr"?{...Te}:{...Te,fontSize:R<=xt?Et:R<yt?Lt:Te.fontSize,convertEol:!1,cursorBlink:!1,scrollback:0,theme:{...Te.theme,cursor:"rgba(0, 0, 0, 0)",cursorAccent:"rgba(0, 0, 0, 0)"}}}const Pt=0,Ot=1;function We(z,R=z.current,k=!0){return!R||z.current!==R?!1:(z.current=null,R.onopen=null,R.onmessage=null,R.onclose=null,R.onerror=null,k&&(R.readyState===Pt||R.readyState===Ot)&&R.close(),!0)}function ye(z,R){return z?z.fullPath||z.path||"":R==="herdr"?"":null}function It(){const z=window.location.protocol==="https:"?"wss:":"ws:";if(dt)return`${z}//${window.location.host}/shell`;const R=_t();return R?`${z}//${window.location.host}/shell?token=${encodeURIComponent(R)}`:(console.error("No authentication token found for Shell WebSocket connection"),null)}function Ft(z){try{return JSON.parse(z)}catch{return null}}function fe(z,R){z&&z.readyState===WebSocket.OPEN&&z.send(JSON.stringify(R))}const Ht=/(?:\u001B\[[0-?]*[ -/]*[@-~]|\u009B[0-?]*[ -/]*[@-~]|\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)|\u009D[^\u0007\u009C]*(?:\u0007|\u009C)|\u001B[PX^_][^\u001B]*\u001B\\|[\u0090\u0098\u009E\u009F][^\u009C]*\u009C|\u001B[@-Z\\-_])/g,Nt=/Process exited with code (\d+)/;function Wt({connectionKey:z,wsRef:R,terminalRef:k,fitAddonRef:N,selectedProjectRef:j,selectedSessionRef:V,initialCommandRef:M,isPlainShellRef:t,onProcessCompleteRef:a,isInitialized:h,autoConnect:l,closeSocket:s,clearTerminalScreen:c,onOutputRef:f,shellSessionIdRef:g,shellModeRef:o}){const[e,r]=Y.useState(!1),[i,n]=Y.useState(!1),_=Y.useRef(!1),p=Y.useRef(!1),u=Y.useRef(!1),m=Y.useRef(null),d=Y.useRef(!0),v=Y.useRef(z),S=Y.useCallback(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),y=Y.useCallback((I,O)=>{d.current&&(r(I),n(O))},[]),b=Y.useCallback(I=>{if(!t.current||!a.current)return;const C=I.replace(Ht,"");if(C.includes("Process exited with code 0")){a.current(0);return}const E=C.match(Nt);if(!E)return;const T=Number.parseInt(E[1],10);!Number.isNaN(T)&&T!==0&&a.current(T)},[t,a]),w=Y.useCallback(I=>{const O=Ft(I);if(!O){console.error("[Shell] Error handling WebSocket message:",I);return}if(O.type==="output"){const C=typeof O.data=="string"?O.data:"";b(C),k.current?.write(C),f?.current?.();return}},[b,f,k]),x=Y.useCallback((I=!1)=>{if(!(_.current&&!I||i||e))try{const O=It();if(!O){_.current=!1,n(!1);return}_.current=!0;const C=new WebSocket(O);R.current=C,C.onopen=()=>{R.current===C&&(y(!0,!1),_.current=!1,S(),m.current=window.setTimeout(()=>{if(m.current=null,R.current!==C)return;const E=k.current,T=N.current,D=j.current,U=o.current,$=ye(D,U);if(!E||!T||$===null)return;T.fit();const K=p.current;p.current=!1,fe(C,{type:"init",projectPath:$,sessionId:t.current?g.current??null:V.current?.id||null,hasSession:t.current?!1:!!V.current,provider:t.current?"plain-shell":V.current?.__provider||localStorage.getItem("selected-provider")||"claude",cols:E.cols,rows:E.rows,initialCommand:M.current,isPlainShell:t.current,forceRestart:K,shellMode:o.current})},at))},C.onmessage=E=>{if(R.current!==C)return;const T=typeof E.data=="string"?E.data:String(E.data??"");w(T)},C.onclose=()=>{We(R,C,!1)&&(S(),y(!1,!1),_.current=!1,c())},C.onerror=()=>{We(R,C)&&(S(),y(!1,!1),_.current=!1,p.current=!1,c())}}catch{S(),y(!1,!1),_.current=!1,p.current=!1}},[c,S,N,w,M,e,i,t,j,V,o,g,k,y,R]),B=Y.useCallback(I=>{!h||e||i||_.current||(p.current=!!I?.forceRestart,u.current=!1,_.current=!0,n(!0),x(!0))},[x,e,i,h]),F=Y.useCallback(I=>{I?.suppressAutoConnect&&(u.current=!0),S(),s(),c(),r(!1),n(!1),_.current=!1,p.current=!1},[S,c,s]);return Y.useEffect(()=>(d.current=!0,()=>{d.current=!1,S(),s()}),[S,s]),Y.useEffect(()=>{v.current!==z&&(v.current=z,F())},[z,F]),Y.useEffect(()=>{!l||u.current||!h||i||e||B()},[l,B,e,i,h]),{isConnected:e,isConnecting:i,closeSocket:s,connectToShell:B,disconnectFromShell:F}}var ke={exports:{}},Ve;function $t(){return Ve||(Ve=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={575:function(M,t,a){typeof self<"u"||typeof window<"u"||a.g!==void 0&&a.g,M.exports=(function(){var h,l="3.7.7",s=l,c=typeof Buffer=="function",f=typeof TextDecoder=="function"?new TextDecoder:void 0,g=typeof TextEncoder=="function"?new TextEncoder:void 0,o=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),e=(h={},o.forEach((function(A,W){return h[A]=W})),h),r=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,i=String.fromCharCode.bind(String),n=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(A){return new Uint8Array(Array.prototype.slice.call(A,0))},_=function(A){return A.replace(/=/g,"").replace(/[+\/]/g,(function(W){return W=="+"?"-":"_"}))},p=function(A){return A.replace(/[^A-Za-z0-9\+\/]/g,"")},u=function(A){for(var W,q,ee,G,te="",ae=A.length%3,Q=0;Q<A.length;){if((q=A.charCodeAt(Q++))>255||(ee=A.charCodeAt(Q++))>255||(G=A.charCodeAt(Q++))>255)throw new TypeError("invalid character found");te+=o[(W=q<<16|ee<<8|G)>>18&63]+o[W>>12&63]+o[W>>6&63]+o[63&W]}return ae?te.slice(0,ae-3)+"===".substring(ae):te},m=typeof btoa=="function"?function(A){return btoa(A)}:c?function(A){return Buffer.from(A,"binary").toString("base64")}:u,d=c?function(A){return Buffer.from(A).toString("base64")}:function(A){for(var W=[],q=0,ee=A.length;q<ee;q+=4096)W.push(i.apply(null,A.subarray(q,q+4096)));return m(W.join(""))},v=function(A,W){return W===void 0&&(W=!1),W?_(d(A)):d(A)},S=function(A){if(A.length<2)return(W=A.charCodeAt(0))<128?A:W<2048?i(192|W>>>6)+i(128|63&W):i(224|W>>>12&15)+i(128|W>>>6&63)+i(128|63&W);var W=65536+1024*(A.charCodeAt(0)-55296)+(A.charCodeAt(1)-56320);return i(240|W>>>18&7)+i(128|W>>>12&63)+i(128|W>>>6&63)+i(128|63&W)},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,b=function(A){return A.replace(y,S)},w=c?function(A){return Buffer.from(A,"utf8").toString("base64")}:g?function(A){return d(g.encode(A))}:function(A){return m(b(A))},x=function(A,W){return W===void 0&&(W=!1),W?_(w(A)):w(A)},B=function(A){return x(A,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,I=function(A){switch(A.length){case 4:var W=((7&A.charCodeAt(0))<<18|(63&A.charCodeAt(1))<<12|(63&A.charCodeAt(2))<<6|63&A.charCodeAt(3))-65536;return i(55296+(W>>>10))+i(56320+(1023&W));case 3:return i((15&A.charCodeAt(0))<<12|(63&A.charCodeAt(1))<<6|63&A.charCodeAt(2));default:return i((31&A.charCodeAt(0))<<6|63&A.charCodeAt(1))}},O=function(A){return A.replace(F,I)},C=function(A){if(A=A.replace(/\s+/g,""),!r.test(A))throw new TypeError("malformed base64.");A+="==".slice(2-(3&A.length));for(var W,q,ee,G="",te=0;te<A.length;)W=e[A.charAt(te++)]<<18|e[A.charAt(te++)]<<12|(q=e[A.charAt(te++)])<<6|(ee=e[A.charAt(te++)]),G+=q===64?i(W>>16&255):ee===64?i(W>>16&255,W>>8&255):i(W>>16&255,W>>8&255,255&W);return G},E=typeof atob=="function"?function(A){return atob(p(A))}:c?function(A){return Buffer.from(A,"base64").toString("binary")}:C,T=c?function(A){return n(Buffer.from(A,"base64"))}:function(A){return n(E(A).split("").map((function(W){return W.charCodeAt(0)})))},D=function(A){return T($(A))},U=c?function(A){return Buffer.from(A,"base64").toString("utf8")}:f?function(A){return f.decode(T(A))}:function(A){return O(E(A))},$=function(A){return p(A.replace(/[-_]/g,(function(W){return W=="-"?"+":"/"})))},K=function(A){return U($(A))},X=function(A){return{value:A,enumerable:!1,writable:!0,configurable:!0}},P=function(){var A=function(W,q){return Object.defineProperty(String.prototype,W,X(q))};A("fromBase64",(function(){return K(this)})),A("toBase64",(function(W){return x(this,W)})),A("toBase64URI",(function(){return x(this,!0)})),A("toBase64URL",(function(){return x(this,!0)})),A("toUint8Array",(function(){return D(this)}))},L=function(){var A=function(W,q){return Object.defineProperty(Uint8Array.prototype,W,X(q))};A("toBase64",(function(W){return v(this,W)})),A("toBase64URI",(function(){return v(this,!0)})),A("toBase64URL",(function(){return v(this,!0)}))},H={version:l,VERSION:s,atob:E,atobPolyfill:C,btoa:m,btoaPolyfill:u,fromBase64:K,toBase64:x,encode:x,encodeURI:B,encodeURL:B,utob:b,btou:O,decode:K,isValid:function(A){if(typeof A!="string")return!1;var W=A.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},fromUint8Array:v,toUint8Array:D,extendString:P,extendUint8Array:L,extendBuiltins:function(){P(),L()},Base64:{}};return Object.keys(H).forEach((function(A){return H.Base64[A]=H[A]})),H})()}},N={};function j(M){var t=N[M];if(t!==void 0)return t.exports;var a=N[M]={exports:{}};return k[M].call(a.exports,a,a.exports,j),a.exports}j.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})();var V={};return(()=>{var M=V;Object.defineProperty(M,"__esModule",{value:!0}),M.Base64=M.BrowserClipboardProvider=M.ClipboardAddon=void 0;const t=j(575);M.ClipboardAddon=class{constructor(l=new h,s=new a){this._base64=l,this._provider=s}activate(l){this._terminal=l,this._disposable=l.parser.registerOscHandler(52,(s=>this._setOrReportClipboard(s)))}dispose(){return this._disposable?.dispose()}_readText(l,s){const c=this._base64.encodeText(s);this._terminal?.input(`\x1B]52;${l};${c}\x07`,!1)}_setOrReportClipboard(l){const s=l.split(";");if(s.length<2)return!0;const c=s[0],f=s[1];if(f==="?"){const e=this._provider.readText(c);return e instanceof Promise?e.then((r=>(this._readText(c,r),!0))):(this._readText(c,e),!0)}let g="";try{g=this._base64.decodeText(f)}catch{}const o=this._provider.writeText(c,g);return!(o instanceof Promise)||o.then((()=>!0))}};class a{async readText(s){return s!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(s,c){return s!=="c"?Promise.resolve():navigator.clipboard.writeText(c)}}M.BrowserClipboardProvider=a;class h{encodeText(s){return t.Base64.encode(s)}decodeText(s){const c=t.Base64.decode(s);return t.Base64.isValid(s)&&t.Base64.encode(c)===s?c:""}}M.Base64=h})(),V})()))})(ke)),ke.exports}var Ut=$t(),Be={exports:{}},Ke;function zt(){return Ke||(Ke=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={};return(()=>{var N=k;Object.defineProperty(N,"__esModule",{value:!0}),N.FitAddon=void 0,N.FitAddon=class{activate(j){this._terminal=j}dispose(){}fit(){const j=this.proposeDimensions();if(!j||!this._terminal||isNaN(j.cols)||isNaN(j.rows))return;const V=this._terminal._core;this._terminal.rows===j.rows&&this._terminal.cols===j.cols||(V._renderService.clear(),this._terminal.resize(j.cols,j.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const j=this._terminal._core,V=j._renderService.dimensions;if(V.css.cell.width===0||V.css.cell.height===0)return;const M=this._terminal.options.scrollback===0?0:j.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),s=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-M;return{cols:Math.max(2,Math.floor(c/V.css.cell.width)),rows:Math.max(1,Math.floor(s/V.css.cell.height))}}}})(),k})()))})(Be)),Be.exports}var jt=zt(),Pe={exports:{}},Ge;function qt(){return Ge||(Ge=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={6:(M,t)=>{function a(l){try{const s=new URL(l),c=s.password&&s.username?`${s.protocol}//${s.username}:${s.password}@${s.host}`:s.username?`${s.protocol}//${s.username}@${s.host}`:`${s.protocol}//${s.host}`;return l.toLocaleLowerCase().startsWith(c.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(l,s,c,f={}){this._terminal=l,this._regex=s,this._handler=c,this._options=f}provideLinks(l,s){const c=h.computeLink(l,this._regex,this._terminal,this._handler);s(this._addCallbacks(c))}_addCallbacks(l){return l.map((s=>(s.leave=this._options.leave,s.hover=(c,f)=>{if(this._options.hover){const{range:g}=s;this._options.hover(c,f,g)}},s)))}};class h{static computeLink(s,c,f,g){const o=new RegExp(c.source,(c.flags||"")+"g"),[e,r]=h._getWindowedLineStrings(s-1,f),i=e.join("");let n;const _=[];for(;n=o.exec(i);){const p=n[0];if(!a(p))continue;const[u,m]=h._mapStrIdx(f,r,0,n.index),[d,v]=h._mapStrIdx(f,u,m,p.length);if(u===-1||m===-1||d===-1||v===-1)continue;const S={start:{x:m+1,y:u+1},end:{x:v,y:d+1}};_.push({range:S,text:p,activate:g})}return _}static _getWindowedLineStrings(s,c){let f,g=s,o=s,e=0,r="";const i=[];if(f=c.buffer.active.getLine(s)){const n=f.translateToString(!0);if(f.isWrapped&&n[0]!==" "){for(e=0;(f=c.buffer.active.getLine(--g))&&e<2048&&(r=f.translateToString(!0),e+=r.length,i.push(r),f.isWrapped&&r.indexOf(" ")===-1););i.reverse()}for(i.push(n),e=0;(f=c.buffer.active.getLine(++o))&&f.isWrapped&&e<2048&&(r=f.translateToString(!0),e+=r.length,i.push(r),r.indexOf(" ")===-1););}return[i,g]}static _mapStrIdx(s,c,f,g){const o=s.buffer.active,e=o.getNullCell();let r=f;for(;g;){const i=o.getLine(c);if(!i)return[-1,-1];for(let n=r;n<i.length;++n){i.getCell(n,e);const _=e.getChars();if(e.getWidth()&&(g-=_.length||1,n===i.length-1&&_==="")){const p=o.getLine(c+1);p&&p.isWrapped&&(p.getCell(0,e),e.getWidth()===2&&(g+=1))}if(g<0)return[c,n]}c++,r=0}return[c,r]}}t.LinkComputer=h}},N={};function j(M){var t=N[M];if(t!==void 0)return t.exports;var a=N[M]={exports:{}};return k[M](a,a.exports,j),a.exports}var V={};return(()=>{var M=V;Object.defineProperty(M,"__esModule",{value:!0}),M.WebLinksAddon=void 0;const t=j(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function h(l,s){const c=window.open();if(c){try{c.opener=null}catch{}c.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}M.WebLinksAddon=class{constructor(l=h,s={}){this._handler=l,this._options=s}activate(l){this._terminal=l;const s=this._options,c=s.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,c,this._handler,s))}dispose(){this._linkProvider?.dispose()}}})(),V})()))})(Pe)),Pe.exports}var Vt=qt(),Oe={exports:{}},Xe;function Kt(){return Xe||(Xe=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={965:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),s=a(855),c=a(859),f=a(381),g=11,o=g*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,n=0;class _ extends c.Disposable{constructor(u,m,d,v){super(),this._terminal=u,this._gl=m,this._dimensions=d,this._optionsService=v,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const S=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,f.createProgram)(S,`#version 300 es
1
+ import{r as Y,j as J}from"./vendor-react-C2GTiUCy.js";import{a6 as dt,a5 as _t,g as Ae}from"./feature-workspace-BodovOw6.js";import{L as je,u as nt,X as ft,bz as gt,av as vt,aB as pt,aV as mt,aM as St,bA as Ct}from"./vendor-ui-CAUHSABu.js";import{u as ot}from"./vendor-i18n-B6HjLCnN.js";const bt=200,at=100,wt=50,yt=768,xt=480,Et=9,Lt=12,Rt="\x1B[?1002h\x1B[?1006h",Tt=500,Dt=20,At=15,Mt=5,kt=2,Te={cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selectionBackground:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}};function Bt(z,R,k){return!k&&z===R}function qe(z="default",R=Number.POSITIVE_INFINITY){return z!=="herdr"?{...Te}:{...Te,fontSize:R<=xt?Et:R<yt?Lt:Te.fontSize,convertEol:!1,cursorBlink:!1,scrollback:0,theme:{...Te.theme,cursor:"rgba(0, 0, 0, 0)",cursorAccent:"rgba(0, 0, 0, 0)"}}}const Pt=0,Ot=1;function We(z,R=z.current,k=!0){return!R||z.current!==R?!1:(z.current=null,R.onopen=null,R.onmessage=null,R.onclose=null,R.onerror=null,k&&(R.readyState===Pt||R.readyState===Ot)&&R.close(),!0)}function ye(z,R){return z?z.fullPath||z.path||"":R==="herdr"?"":null}function It(){const z=window.location.protocol==="https:"?"wss:":"ws:";if(dt)return`${z}//${window.location.host}/shell`;const R=_t();return R?`${z}//${window.location.host}/shell?token=${encodeURIComponent(R)}`:(console.error("No authentication token found for Shell WebSocket connection"),null)}function Ft(z){try{return JSON.parse(z)}catch{return null}}function fe(z,R){z&&z.readyState===WebSocket.OPEN&&z.send(JSON.stringify(R))}const Ht=/(?:\u001B\[[0-?]*[ -/]*[@-~]|\u009B[0-?]*[ -/]*[@-~]|\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)|\u009D[^\u0007\u009C]*(?:\u0007|\u009C)|\u001B[PX^_][^\u001B]*\u001B\\|[\u0090\u0098\u009E\u009F][^\u009C]*\u009C|\u001B[@-Z\\-_])/g,Nt=/Process exited with code (\d+)/;function Wt({connectionKey:z,wsRef:R,terminalRef:k,fitAddonRef:N,selectedProjectRef:j,selectedSessionRef:V,initialCommandRef:M,isPlainShellRef:t,onProcessCompleteRef:a,isInitialized:h,autoConnect:l,closeSocket:s,clearTerminalScreen:c,onOutputRef:f,shellSessionIdRef:g,shellModeRef:o}){const[e,r]=Y.useState(!1),[i,n]=Y.useState(!1),_=Y.useRef(!1),p=Y.useRef(!1),u=Y.useRef(!1),m=Y.useRef(null),d=Y.useRef(!0),v=Y.useRef(z),S=Y.useCallback(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),y=Y.useCallback((I,O)=>{d.current&&(r(I),n(O))},[]),b=Y.useCallback(I=>{if(!t.current||!a.current)return;const C=I.replace(Ht,"");if(C.includes("Process exited with code 0")){a.current(0);return}const E=C.match(Nt);if(!E)return;const T=Number.parseInt(E[1],10);!Number.isNaN(T)&&T!==0&&a.current(T)},[t,a]),w=Y.useCallback(I=>{const O=Ft(I);if(!O){console.error("[Shell] Error handling WebSocket message:",I);return}if(O.type==="output"){const C=typeof O.data=="string"?O.data:"";b(C),k.current?.write(C),f?.current?.();return}},[b,f,k]),x=Y.useCallback((I=!1)=>{if(!(_.current&&!I||i||e))try{const O=It();if(!O){_.current=!1,n(!1);return}_.current=!0;const C=new WebSocket(O);R.current=C,C.onopen=()=>{R.current===C&&(y(!0,!1),_.current=!1,S(),m.current=window.setTimeout(()=>{if(m.current=null,R.current!==C)return;const E=k.current,T=N.current,D=j.current,U=o.current,$=ye(D,U);if(!E||!T||$===null)return;T.fit();const K=p.current;p.current=!1,fe(C,{type:"init",projectPath:$,sessionId:t.current?g.current??null:V.current?.id||null,hasSession:t.current?!1:!!V.current,provider:t.current?"plain-shell":V.current?.__provider||localStorage.getItem("selected-provider")||"claude",cols:E.cols,rows:E.rows,initialCommand:M.current,isPlainShell:t.current,forceRestart:K,shellMode:o.current})},at))},C.onmessage=E=>{if(R.current!==C)return;const T=typeof E.data=="string"?E.data:String(E.data??"");w(T)},C.onclose=()=>{We(R,C,!1)&&(S(),y(!1,!1),_.current=!1,c())},C.onerror=()=>{We(R,C)&&(S(),y(!1,!1),_.current=!1,p.current=!1,c())}}catch{S(),y(!1,!1),_.current=!1,p.current=!1}},[c,S,N,w,M,e,i,t,j,V,o,g,k,y,R]),B=Y.useCallback(I=>{!h||e||i||_.current||(p.current=!!I?.forceRestart,u.current=!1,_.current=!0,n(!0),x(!0))},[x,e,i,h]),F=Y.useCallback(I=>{I?.suppressAutoConnect&&(u.current=!0),S(),s(),c(),r(!1),n(!1),_.current=!1,p.current=!1},[S,c,s]);return Y.useEffect(()=>(d.current=!0,()=>{d.current=!1,S(),s()}),[S,s]),Y.useEffect(()=>{v.current!==z&&(v.current=z,F())},[z,F]),Y.useEffect(()=>{!l||u.current||!h||i||e||B()},[l,B,e,i,h]),{isConnected:e,isConnecting:i,closeSocket:s,connectToShell:B,disconnectFromShell:F}}var ke={exports:{}},Ve;function $t(){return Ve||(Ve=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={575:function(M,t,a){typeof self<"u"||typeof window<"u"||a.g!==void 0&&a.g,M.exports=(function(){var h,l="3.7.7",s=l,c=typeof Buffer=="function",f=typeof TextDecoder=="function"?new TextDecoder:void 0,g=typeof TextEncoder=="function"?new TextEncoder:void 0,o=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),e=(h={},o.forEach((function(A,W){return h[A]=W})),h),r=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,i=String.fromCharCode.bind(String),n=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(A){return new Uint8Array(Array.prototype.slice.call(A,0))},_=function(A){return A.replace(/=/g,"").replace(/[+\/]/g,(function(W){return W=="+"?"-":"_"}))},p=function(A){return A.replace(/[^A-Za-z0-9\+\/]/g,"")},u=function(A){for(var W,q,ee,G,te="",ae=A.length%3,Q=0;Q<A.length;){if((q=A.charCodeAt(Q++))>255||(ee=A.charCodeAt(Q++))>255||(G=A.charCodeAt(Q++))>255)throw new TypeError("invalid character found");te+=o[(W=q<<16|ee<<8|G)>>18&63]+o[W>>12&63]+o[W>>6&63]+o[63&W]}return ae?te.slice(0,ae-3)+"===".substring(ae):te},m=typeof btoa=="function"?function(A){return btoa(A)}:c?function(A){return Buffer.from(A,"binary").toString("base64")}:u,d=c?function(A){return Buffer.from(A).toString("base64")}:function(A){for(var W=[],q=0,ee=A.length;q<ee;q+=4096)W.push(i.apply(null,A.subarray(q,q+4096)));return m(W.join(""))},v=function(A,W){return W===void 0&&(W=!1),W?_(d(A)):d(A)},S=function(A){if(A.length<2)return(W=A.charCodeAt(0))<128?A:W<2048?i(192|W>>>6)+i(128|63&W):i(224|W>>>12&15)+i(128|W>>>6&63)+i(128|63&W);var W=65536+1024*(A.charCodeAt(0)-55296)+(A.charCodeAt(1)-56320);return i(240|W>>>18&7)+i(128|W>>>12&63)+i(128|W>>>6&63)+i(128|63&W)},y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,b=function(A){return A.replace(y,S)},w=c?function(A){return Buffer.from(A,"utf8").toString("base64")}:g?function(A){return d(g.encode(A))}:function(A){return m(b(A))},x=function(A,W){return W===void 0&&(W=!1),W?_(w(A)):w(A)},B=function(A){return x(A,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,I=function(A){switch(A.length){case 4:var W=((7&A.charCodeAt(0))<<18|(63&A.charCodeAt(1))<<12|(63&A.charCodeAt(2))<<6|63&A.charCodeAt(3))-65536;return i(55296+(W>>>10))+i(56320+(1023&W));case 3:return i((15&A.charCodeAt(0))<<12|(63&A.charCodeAt(1))<<6|63&A.charCodeAt(2));default:return i((31&A.charCodeAt(0))<<6|63&A.charCodeAt(1))}},O=function(A){return A.replace(F,I)},C=function(A){if(A=A.replace(/\s+/g,""),!r.test(A))throw new TypeError("malformed base64.");A+="==".slice(2-(3&A.length));for(var W,q,ee,G="",te=0;te<A.length;)W=e[A.charAt(te++)]<<18|e[A.charAt(te++)]<<12|(q=e[A.charAt(te++)])<<6|(ee=e[A.charAt(te++)]),G+=q===64?i(W>>16&255):ee===64?i(W>>16&255,W>>8&255):i(W>>16&255,W>>8&255,255&W);return G},E=typeof atob=="function"?function(A){return atob(p(A))}:c?function(A){return Buffer.from(A,"base64").toString("binary")}:C,T=c?function(A){return n(Buffer.from(A,"base64"))}:function(A){return n(E(A).split("").map((function(W){return W.charCodeAt(0)})))},D=function(A){return T($(A))},U=c?function(A){return Buffer.from(A,"base64").toString("utf8")}:f?function(A){return f.decode(T(A))}:function(A){return O(E(A))},$=function(A){return p(A.replace(/[-_]/g,(function(W){return W=="-"?"+":"/"})))},K=function(A){return U($(A))},X=function(A){return{value:A,enumerable:!1,writable:!0,configurable:!0}},P=function(){var A=function(W,q){return Object.defineProperty(String.prototype,W,X(q))};A("fromBase64",(function(){return K(this)})),A("toBase64",(function(W){return x(this,W)})),A("toBase64URI",(function(){return x(this,!0)})),A("toBase64URL",(function(){return x(this,!0)})),A("toUint8Array",(function(){return D(this)}))},L=function(){var A=function(W,q){return Object.defineProperty(Uint8Array.prototype,W,X(q))};A("toBase64",(function(W){return v(this,W)})),A("toBase64URI",(function(){return v(this,!0)})),A("toBase64URL",(function(){return v(this,!0)}))},H={version:l,VERSION:s,atob:E,atobPolyfill:C,btoa:m,btoaPolyfill:u,fromBase64:K,toBase64:x,encode:x,encodeURI:B,encodeURL:B,utob:b,btou:O,decode:K,isValid:function(A){if(typeof A!="string")return!1;var W=A.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},fromUint8Array:v,toUint8Array:D,extendString:P,extendUint8Array:L,extendBuiltins:function(){P(),L()},Base64:{}};return Object.keys(H).forEach((function(A){return H.Base64[A]=H[A]})),H})()}},N={};function j(M){var t=N[M];if(t!==void 0)return t.exports;var a=N[M]={exports:{}};return k[M].call(a.exports,a,a.exports,j),a.exports}j.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})();var V={};return(()=>{var M=V;Object.defineProperty(M,"__esModule",{value:!0}),M.Base64=M.BrowserClipboardProvider=M.ClipboardAddon=void 0;const t=j(575);M.ClipboardAddon=class{constructor(l=new h,s=new a){this._base64=l,this._provider=s}activate(l){this._terminal=l,this._disposable=l.parser.registerOscHandler(52,(s=>this._setOrReportClipboard(s)))}dispose(){return this._disposable?.dispose()}_readText(l,s){const c=this._base64.encodeText(s);this._terminal?.input(`\x1B]52;${l};${c}\x07`,!1)}_setOrReportClipboard(l){const s=l.split(";");if(s.length<2)return!0;const c=s[0],f=s[1];if(f==="?"){const e=this._provider.readText(c);return e instanceof Promise?e.then((r=>(this._readText(c,r),!0))):(this._readText(c,e),!0)}let g="";try{g=this._base64.decodeText(f)}catch{}const o=this._provider.writeText(c,g);return!(o instanceof Promise)||o.then((()=>!0))}};class a{async readText(s){return s!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(s,c){return s!=="c"?Promise.resolve():navigator.clipboard.writeText(c)}}M.BrowserClipboardProvider=a;class h{encodeText(s){return t.Base64.encode(s)}decodeText(s){const c=t.Base64.decode(s);return t.Base64.isValid(s)&&t.Base64.encode(c)===s?c:""}}M.Base64=h})(),V})()))})(ke)),ke.exports}var Ut=$t(),Be={exports:{}},Ke;function zt(){return Ke||(Ke=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={};return(()=>{var N=k;Object.defineProperty(N,"__esModule",{value:!0}),N.FitAddon=void 0,N.FitAddon=class{activate(j){this._terminal=j}dispose(){}fit(){const j=this.proposeDimensions();if(!j||!this._terminal||isNaN(j.cols)||isNaN(j.rows))return;const V=this._terminal._core;this._terminal.rows===j.rows&&this._terminal.cols===j.cols||(V._renderService.clear(),this._terminal.resize(j.cols,j.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const j=this._terminal._core,V=j._renderService.dimensions;if(V.css.cell.width===0||V.css.cell.height===0)return;const M=this._terminal.options.scrollback===0?0:j.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(t.getPropertyValue("height")),h=Math.max(0,parseInt(t.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),s=a-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=h-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-M;return{cols:Math.max(2,Math.floor(c/V.css.cell.width)),rows:Math.max(1,Math.floor(s/V.css.cell.height))}}}})(),k})()))})(Be)),Be.exports}var jt=zt(),Pe={exports:{}},Ge;function qt(){return Ge||(Ge=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={6:(M,t)=>{function a(l){try{const s=new URL(l),c=s.password&&s.username?`${s.protocol}//${s.username}:${s.password}@${s.host}`:s.username?`${s.protocol}//${s.username}@${s.host}`:`${s.protocol}//${s.host}`;return l.toLocaleLowerCase().startsWith(c.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(l,s,c,f={}){this._terminal=l,this._regex=s,this._handler=c,this._options=f}provideLinks(l,s){const c=h.computeLink(l,this._regex,this._terminal,this._handler);s(this._addCallbacks(c))}_addCallbacks(l){return l.map((s=>(s.leave=this._options.leave,s.hover=(c,f)=>{if(this._options.hover){const{range:g}=s;this._options.hover(c,f,g)}},s)))}};class h{static computeLink(s,c,f,g){const o=new RegExp(c.source,(c.flags||"")+"g"),[e,r]=h._getWindowedLineStrings(s-1,f),i=e.join("");let n;const _=[];for(;n=o.exec(i);){const p=n[0];if(!a(p))continue;const[u,m]=h._mapStrIdx(f,r,0,n.index),[d,v]=h._mapStrIdx(f,u,m,p.length);if(u===-1||m===-1||d===-1||v===-1)continue;const S={start:{x:m+1,y:u+1},end:{x:v,y:d+1}};_.push({range:S,text:p,activate:g})}return _}static _getWindowedLineStrings(s,c){let f,g=s,o=s,e=0,r="";const i=[];if(f=c.buffer.active.getLine(s)){const n=f.translateToString(!0);if(f.isWrapped&&n[0]!==" "){for(e=0;(f=c.buffer.active.getLine(--g))&&e<2048&&(r=f.translateToString(!0),e+=r.length,i.push(r),f.isWrapped&&r.indexOf(" ")===-1););i.reverse()}for(i.push(n),e=0;(f=c.buffer.active.getLine(++o))&&f.isWrapped&&e<2048&&(r=f.translateToString(!0),e+=r.length,i.push(r),r.indexOf(" ")===-1););}return[i,g]}static _mapStrIdx(s,c,f,g){const o=s.buffer.active,e=o.getNullCell();let r=f;for(;g;){const i=o.getLine(c);if(!i)return[-1,-1];for(let n=r;n<i.length;++n){i.getCell(n,e);const _=e.getChars();if(e.getWidth()&&(g-=_.length||1,n===i.length-1&&_==="")){const p=o.getLine(c+1);p&&p.isWrapped&&(p.getCell(0,e),e.getWidth()===2&&(g+=1))}if(g<0)return[c,n]}c++,r=0}return[c,r]}}t.LinkComputer=h}},N={};function j(M){var t=N[M];if(t!==void 0)return t.exports;var a=N[M]={exports:{}};return k[M](a,a.exports,j),a.exports}var V={};return(()=>{var M=V;Object.defineProperty(M,"__esModule",{value:!0}),M.WebLinksAddon=void 0;const t=j(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function h(l,s){const c=window.open();if(c){try{c.opener=null}catch{}c.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}M.WebLinksAddon=class{constructor(l=h,s={}){this._handler=l,this._options=s}activate(l){this._terminal=l;const s=this._options,c=s.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,c,this._handler,s))}dispose(){this._linkProvider?.dispose()}}})(),V})()))})(Pe)),Pe.exports}var Vt=qt(),Oe={exports:{}},Xe;function Kt(){return Xe||(Xe=1,(function(z,R){(function(k,N){z.exports=N()})(self,(()=>(()=>{var k={965:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlyphRenderer=void 0;const h=a(374),l=a(509),s=a(855),c=a(859),f=a(381),g=11,o=g*Float32Array.BYTES_PER_ELEMENT;let e,r=0,i=0,n=0;class _ extends c.Disposable{constructor(u,m,d,v){super(),this._terminal=u,this._gl=m,this._dimensions=d,this._optionsService=v,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const S=this._gl;l.TextureAtlas.maxAtlasPages===void 0&&(l.TextureAtlas.maxAtlasPages=Math.min(32,(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_IMAGE_UNITS))),l.TextureAtlas.maxTextureSize=(0,h.throwIfFalsy)(S.getParameter(S.MAX_TEXTURE_SIZE))),this._program=(0,h.throwIfFalsy)((0,f.createProgram)(S,`#version 300 es
2
2
  layout (location = 0) in vec2 a_unitquad;
3
3
  layout (location = 1) in vec2 a_cellpos;
4
4
  layout (location = 2) in vec2 a_offset;
@@ -63,7 +63,7 @@ WARNING: This link could potentially be dangerous`)){const r=window.open();if(r)
63
63
  `:`
64
64
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(d){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),r.isLinux&&d&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(d){const v=this._getMouseBufferCoords(d),S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(S&&y&&v)&&this._areCoordsInSelection(v,S,y)}isCellInSelection(d,v){const S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y)&&this._areCoordsInSelection([d,v],S,y)}_areCoordsInSelection(d,v,S){return d[1]>v[1]&&d[1]<S[1]||v[1]===S[1]&&d[1]===v[1]&&d[0]>=v[0]&&d[0]<S[0]||v[1]<S[1]&&d[1]===S[1]&&d[0]<S[0]||v[1]<S[1]&&d[1]===v[1]&&d[0]>=v[0]}_selectWordAtCursor(d,v){const S=this._linkifier.currentLink?.link?.range;if(S)return this._model.selectionStart=[S.start.x-1,S.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const y=this._getMouseBufferCoords(d);return!!y&&(this._selectWordAt(y,v),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(d,v){this._model.clearSelection(),d=Math.max(d,0),v=Math.min(v,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,d],this._model.selectionEnd=[this._bufferService.cols,v],this.refresh(),this._onSelectionChange.fire()}_handleTrim(d){this._model.handleTrim(d)&&this.refresh()}_getMouseBufferCoords(d){const v=this._mouseService.getCoords(d,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(v)return v[0]--,v[1]--,v[1]+=this._bufferService.buffer.ydisp,v}_getMouseEventScrollAmount(d){let v=(0,s.getCoordsRelativeToElement)(this._coreBrowserService.window,d,this._screenElement)[1];const S=this._renderService.dimensions.css.canvas.height;return v>=0&&v<=S?0:(v>S&&(v-=S),v=Math.min(Math.max(v,-50),50),v/=50,v/Math.abs(v)+Math.round(14*v))}shouldForceSelection(d){return r.isMac?d.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:d.shiftKey}handleMouseDown(d){if(this._mouseDownTimeStamp=d.timeStamp,(d.button!==2||!this.hasSelection)&&d.button===0){if(!this._enabled){if(!this.shouldForceSelection(d))return;d.stopPropagation()}d.preventDefault(),this._dragScrollAmount=0,this._enabled&&d.shiftKey?this._handleIncrementalClick(d):d.detail===1?this._handleSingleClick(d):d.detail===2?this._handleDoubleClick(d):d.detail===3&&this._handleTripleClick(d),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(d){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(d))}_handleSingleClick(d){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(d)?3:0,this._model.selectionStart=this._getMouseBufferCoords(d),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const v=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);v&&v.length!==this._model.selectionStart[0]&&v.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(d){this._selectWordAtCursor(d,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(d){const v=this._getMouseBufferCoords(d);v&&(this._activeSelectionMode=2,this._selectLineAt(v[1]))}shouldColumnSelect(d){return d.altKey&&!(r.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(d){if(d.stopImmediatePropagation(),!this._model.selectionStart)return;const v=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(d),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(d),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const S=this._bufferService.buffer;if(this._model.selectionEnd[1]<S.lines.length){const y=S.lines.get(this._model.selectionEnd[1]);y&&y.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}v&&v[0]===this._model.selectionEnd[0]&&v[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const d=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(d.ydisp+this._bufferService.rows,d.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=d.ydisp),this.refresh()}}_handleMouseUp(d){const v=d.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&v<500&&d.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const S=this._mouseService.getCoords(d,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(S&&S[0]!==void 0&&S[1]!==void 0){const y=(0,c.moveToCellSequence)(S[0]-1,S[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const d=this._model.finalSelectionStart,v=this._model.finalSelectionEnd,S=!(!d||!v||d[0]===v[0]&&d[1]===v[1]);S?d&&v&&(this._oldSelectionStart&&this._oldSelectionEnd&&d[0]===this._oldSelectionStart[0]&&d[1]===this._oldSelectionStart[1]&&v[0]===this._oldSelectionEnd[0]&&v[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(d,v,S)):this._oldHasSelection&&this._fireOnSelectionChange(d,v,S)}_fireOnSelectionChange(d,v,S){this._oldSelectionStart=d,this._oldSelectionEnd=v,this._oldHasSelection=S,this._onSelectionChange.fire()}_handleBufferActivate(d){this.clearSelection(),this._trimListener.dispose(),this._trimListener=d.activeBuffer.lines.onTrim((v=>this._handleTrim(v)))}_convertViewportColToCharacterIndex(d,v){let S=v;for(let y=0;v>=y;y++){const b=d.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?S--:b>1&&v!==y&&(S+=b-1)}return S}setSelection(d,v,S){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[d,v],this._model.selectionStartLength=S,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(d){this._isClickInSelection(d)||(this._selectWordAtCursor(d,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(d,v,S=!0,y=!0){if(d[0]>=this._bufferService.cols)return;const b=this._bufferService.buffer,w=b.lines.get(d[1]);if(!w)return;const x=b.translateBufferLineToString(d[1],!1);let B=this._convertViewportColToCharacterIndex(w,d[0]),F=B;const I=d[0]-B;let O=0,C=0,E=0,T=0;if(x.charAt(B)===" "){for(;B>0&&x.charAt(B-1)===" ";)B--;for(;F<x.length&&x.charAt(F+1)===" ";)F++}else{let $=d[0],K=d[0];w.getWidth($)===0&&(O++,$--),w.getWidth(K)===2&&(C++,K++);const X=w.getString(K).length;for(X>1&&(T+=X-1,F+=X-1);$>0&&B>0&&!this._isCharWordSeparator(w.loadCell($-1,this._workCell));){w.loadCell($-1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===0?(O++,$--):P>1&&(E+=P-1,B-=P-1),B--,$--}for(;K<w.length&&F+1<x.length&&!this._isCharWordSeparator(w.loadCell(K+1,this._workCell));){w.loadCell(K+1,this._workCell);const P=this._workCell.getChars().length;this._workCell.getWidth()===2?(C++,K++):P>1&&(T+=P-1,F+=P-1),F++,K++}}F++;let D=B+I-O+E,U=Math.min(this._bufferService.cols,F-B+O+C-E-T);if(v||x.slice(B,F).trim()!==""){if(S&&D===0&&w.getCodePoint(0)!==32){const $=b.lines.get(d[1]-1);if($&&w.isWrapped&&$.getCodePoint(this._bufferService.cols-1)!==32){const K=this._getWordAt([this._bufferService.cols-1,d[1]-1],!1,!0,!1);if(K){const X=this._bufferService.cols-K.start;D-=X,U+=X}}}if(y&&D+U===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){const $=b.lines.get(d[1]+1);if($?.isWrapped&&$.getCodePoint(0)!==32){const K=this._getWordAt([0,d[1]+1],!1,!1,!0);K&&(U+=K.length)}}return{start:D,length:U}}}_selectWordAt(d,v){const S=this._getWordAt(d,v);if(S){for(;S.start<0;)S.start+=this._bufferService.cols,d[1]--;this._model.selectionStart=[S.start,d[1]],this._model.selectionStartLength=S.length}}_selectToWordAt(d){const v=this._getWordAt(d,!0);if(v){let S=d[1];for(;v.start<0;)v.start+=this._bufferService.cols,S--;if(!this._model.areSelectionValuesReversed())for(;v.start+v.length>this._bufferService.cols;)v.length-=this._bufferService.cols,S++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?v.start:v.start+v.length,S]}}_isCharWordSeparator(d){return d.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(d.getChars())>=0}_selectLineAt(d){const v=this._bufferService.buffer.getWrappedRangeForLine(d),S={start:{x:0,y:v.first},end:{x:this._bufferService.cols-1,y:v.last}};this._model.selectionStart=[0,v.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(S,this._bufferService.cols)}};t.SelectionService=m=h([l(3,_.IBufferService),l(4,_.ICoreService),l(5,g.IMouseService),l(6,_.IOptionsService),l(7,g.IRenderService),l(8,g.ICoreBrowserService)],m)},4725:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const h=a(8343);t.ICharSizeService=(0,h.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),t.IMouseService=(0,h.createDecorator)("MouseService"),t.IRenderService=(0,h.createDecorator)("RenderService"),t.ISelectionService=(0,h.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,h.createDecorator)("ThemeService"),t.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(M,t,a){var h=this&&this.__decorate||function(m,d,v,S){var y,b=arguments.length,w=b<3?d:S===null?S=Object.getOwnPropertyDescriptor(d,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(m,d,v,S);else for(var x=m.length-1;x>=0;x--)(y=m[x])&&(w=(b<3?y(w):b>3?y(d,v,w):y(d,v))||w);return b>3&&w&&Object.defineProperty(d,v,w),w},l=this&&this.__param||function(m,d){return function(v,S){d(v,S,m)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const s=a(7239),c=a(8055),f=a(8460),g=a(844),o=a(2585),e=c.css.toColor("#ffffff"),r=c.css.toColor("#000000"),i=c.css.toColor("#ffffff"),n=c.css.toColor("#000000"),_={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const m=[c.css.toColor("#2e3436"),c.css.toColor("#cc0000"),c.css.toColor("#4e9a06"),c.css.toColor("#c4a000"),c.css.toColor("#3465a4"),c.css.toColor("#75507b"),c.css.toColor("#06989a"),c.css.toColor("#d3d7cf"),c.css.toColor("#555753"),c.css.toColor("#ef2929"),c.css.toColor("#8ae234"),c.css.toColor("#fce94f"),c.css.toColor("#729fcf"),c.css.toColor("#ad7fa8"),c.css.toColor("#34e2e2"),c.css.toColor("#eeeeec")],d=[0,95,135,175,215,255];for(let v=0;v<216;v++){const S=d[v/36%6|0],y=d[v/6%6|0],b=d[v%6];m.push({css:c.channels.toCss(S,y,b),rgba:c.channels.toRgba(S,y,b)})}for(let v=0;v<24;v++){const S=8+10*v;m.push({css:c.channels.toCss(S,S,S),rgba:c.channels.toRgba(S,S,S)})}return m})());let p=t.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(m){super(),this._optionsService=m,this._contrastCache=new s.ColorContrastCache,this._halfContrastCache=new s.ColorContrastCache,this._onChangeColors=this.register(new f.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:r,cursor:i,cursorAccent:n,selectionForeground:void 0,selectionBackgroundTransparent:_,selectionBackgroundOpaque:c.color.blend(r,_),selectionInactiveBackgroundTransparent:_,selectionInactiveBackgroundOpaque:c.color.blend(r,_),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(m={}){const d=this._colors;if(d.foreground=u(m.foreground,e),d.background=u(m.background,r),d.cursor=u(m.cursor,i),d.cursorAccent=u(m.cursorAccent,n),d.selectionBackgroundTransparent=u(m.selectionBackground,_),d.selectionBackgroundOpaque=c.color.blend(d.background,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundTransparent=u(m.selectionInactiveBackground,d.selectionBackgroundTransparent),d.selectionInactiveBackgroundOpaque=c.color.blend(d.background,d.selectionInactiveBackgroundTransparent),d.selectionForeground=m.selectionForeground?u(m.selectionForeground,c.NULL_COLOR):void 0,d.selectionForeground===c.NULL_COLOR&&(d.selectionForeground=void 0),c.color.isOpaque(d.selectionBackgroundTransparent)&&(d.selectionBackgroundTransparent=c.color.opacity(d.selectionBackgroundTransparent,.3)),c.color.isOpaque(d.selectionInactiveBackgroundTransparent)&&(d.selectionInactiveBackgroundTransparent=c.color.opacity(d.selectionInactiveBackgroundTransparent,.3)),d.ansi=t.DEFAULT_ANSI_COLORS.slice(),d.ansi[0]=u(m.black,t.DEFAULT_ANSI_COLORS[0]),d.ansi[1]=u(m.red,t.DEFAULT_ANSI_COLORS[1]),d.ansi[2]=u(m.green,t.DEFAULT_ANSI_COLORS[2]),d.ansi[3]=u(m.yellow,t.DEFAULT_ANSI_COLORS[3]),d.ansi[4]=u(m.blue,t.DEFAULT_ANSI_COLORS[4]),d.ansi[5]=u(m.magenta,t.DEFAULT_ANSI_COLORS[5]),d.ansi[6]=u(m.cyan,t.DEFAULT_ANSI_COLORS[6]),d.ansi[7]=u(m.white,t.DEFAULT_ANSI_COLORS[7]),d.ansi[8]=u(m.brightBlack,t.DEFAULT_ANSI_COLORS[8]),d.ansi[9]=u(m.brightRed,t.DEFAULT_ANSI_COLORS[9]),d.ansi[10]=u(m.brightGreen,t.DEFAULT_ANSI_COLORS[10]),d.ansi[11]=u(m.brightYellow,t.DEFAULT_ANSI_COLORS[11]),d.ansi[12]=u(m.brightBlue,t.DEFAULT_ANSI_COLORS[12]),d.ansi[13]=u(m.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),d.ansi[14]=u(m.brightCyan,t.DEFAULT_ANSI_COLORS[14]),d.ansi[15]=u(m.brightWhite,t.DEFAULT_ANSI_COLORS[15]),m.extendedAnsi){const v=Math.min(d.ansi.length-16,m.extendedAnsi.length);for(let S=0;S<v;S++)d.ansi[S+16]=u(m.extendedAnsi[S],t.DEFAULT_ANSI_COLORS[S+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(m){this._restoreColor(m),this._onChangeColors.fire(this.colors)}_restoreColor(m){if(m!==void 0)switch(m){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[m]=this._restoreColors.ansi[m]}else for(let d=0;d<this._restoreColors.ansi.length;++d)this._colors.ansi[d]=this._restoreColors.ansi[d]}modifyColors(m){m(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function u(m,d){if(m!==void 0)try{return c.css.toColor(m)}catch{}return d}t.ThemeService=p=h([l(0,o.IOptionsService)],p)},6349:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const h=a(8460),l=a(844);class s extends l.Disposable{constructor(f){super(),this._maxLength=f,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(f){if(this._maxLength===f)return;const g=new Array(f);for(let o=0;o<Math.min(f,this.length);o++)g[o]=this._array[this._getCyclicIndex(o)];this._array=g,this._maxLength=f,this._startIndex=0}get length(){return this._length}set length(f){if(f>this._length)for(let g=this._length;g<f;g++)this._array[g]=void 0;this._length=f}get(f){return this._array[this._getCyclicIndex(f)]}set(f,g){this._array[this._getCyclicIndex(f)]=g}push(f){this._array[this._getCyclicIndex(this._length)]=f,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(f,g,...o){if(g){for(let e=f;e<this._length-g;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+g)];this._length-=g,this.onDeleteEmitter.fire({index:f,amount:g})}for(let e=this._length-1;e>=f;e--)this._array[this._getCyclicIndex(e+o.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<o.length;e++)this._array[this._getCyclicIndex(f+e)]=o[e];if(o.length&&this.onInsertEmitter.fire({index:f,amount:o.length}),this._length+o.length>this._maxLength){const e=this._length+o.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=o.length}trimStart(f){f>this._length&&(f=this._length),this._startIndex+=f,this._length-=f,this.onTrimEmitter.fire(f)}shiftElements(f,g,o){if(!(g<=0)){if(f<0||f>=this._length)throw new Error("start argument out of range");if(f+o<0)throw new Error("Cannot shift elements in list beyond index 0");if(o>0){for(let r=g-1;r>=0;r--)this.set(f+r+o,this.get(f+r));const e=f+g+o-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<g;e++)this.set(f+e+o,this.get(f+e))}}_getCyclicIndex(f){return(this._startIndex+f)%this._maxLength}}t.CircularList=s},1439:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function a(h,l=5){if(typeof h!="object")return h;const s=Array.isArray(h)?[]:{};for(const c in h)s[c]=l<=1?h[c]:h[c]&&a(h[c],l-1);return s}},8055:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,h=0,l=0,s=0;var c,f,g,o,e;function r(n){const _=n.toString(16);return _.length<2?"0"+_:_}function i(n,_){return n<_?(_+.05)/(n+.05):(n+.05)/(_+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(function(n){n.toCss=function(_,p,u,m){return m!==void 0?`#${r(_)}${r(p)}${r(u)}${r(m)}`:`#${r(_)}${r(p)}${r(u)}`},n.toRgba=function(_,p,u,m=255){return(_<<24|p<<16|u<<8|m)>>>0},n.toColor=function(_,p,u,m){return{css:n.toCss(_,p,u,m),rgba:n.toRgba(_,p,u,m)}}})(c||(t.channels=c={})),(function(n){function _(p,u){return s=Math.round(255*u),[a,h,l]=e.toChannels(p.rgba),{css:c.toCss(a,h,l,s),rgba:c.toRgba(a,h,l,s)}}n.blend=function(p,u){if(s=(255&u.rgba)/255,s===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,d=u.rgba>>16&255,v=u.rgba>>8&255,S=p.rgba>>24&255,y=p.rgba>>16&255,b=p.rgba>>8&255;return a=S+Math.round((m-S)*s),h=y+Math.round((d-y)*s),l=b+Math.round((v-b)*s),{css:c.toCss(a,h,l),rgba:c.toRgba(a,h,l)}},n.isOpaque=function(p){return(255&p.rgba)==255},n.ensureContrastRatio=function(p,u,m){const d=e.ensureContrastRatio(p.rgba,u.rgba,m);if(d)return c.toColor(d>>24&255,d>>16&255,d>>8&255)},n.opaque=function(p){const u=(255|p.rgba)>>>0;return[a,h,l]=e.toChannels(u),{css:c.toCss(a,h,l),rgba:u}},n.opacity=_,n.multiplyOpacity=function(p,u){return s=255&p.rgba,_(p,s*u/255)},n.toColorRGB=function(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}})(f||(t.color=f={})),(function(n){let _,p;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(_=m,_.globalCompositeOperation="copy",p=_.createLinearGradient(0,0,1,1))}catch{}n.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),h=parseInt(u.slice(2,3).repeat(2),16),l=parseInt(u.slice(3,4).repeat(2),16),c.toColor(a,h,l);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),h=parseInt(u.slice(2,3).repeat(2),16),l=parseInt(u.slice(3,4).repeat(2),16),s=parseInt(u.slice(4,5).repeat(2),16),c.toColor(a,h,l,s);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),h=parseInt(m[2]),l=parseInt(m[3]),s=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),c.toColor(a,h,l,s);if(!_||!p)throw new Error("css.toColor: Unsupported css format");if(_.fillStyle=p,_.fillStyle=u,typeof _.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(_.fillRect(0,0,1,1),[a,h,l,s]=_.getImageData(0,0,1,1).data,s!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:c.toRgba(a,h,l,s),css:u}}})(g||(t.css=g={})),(function(n){function _(p,u,m){const d=p/255,v=u/255,S=m/255;return .2126*(d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4))+.7152*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}n.relativeLuminance=function(p){return _(p>>16&255,p>>8&255,255&p)},n.relativeLuminance2=_})(o||(t.rgb=o={})),(function(n){function _(u,m,d){const v=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,x=m>>8&255,B=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(v,S,y));for(;B<d&&(b>0||w>0||x>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),x-=Math.max(0,Math.ceil(.1*x)),B=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(v,S,y));return(b<<24|w<<16|x<<8|255)>>>0}function p(u,m,d){const v=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,x=m>>8&255,B=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(v,S,y));for(;B<d&&(b<255||w<255||x<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),x=Math.min(255,x+Math.ceil(.1*(255-x))),B=i(o.relativeLuminance2(b,w,x),o.relativeLuminance2(v,S,y));return(b<<24|w<<16|x<<8|255)>>>0}n.blend=function(u,m){if(s=(255&m)/255,s===1)return m;const d=m>>24&255,v=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((d-y)*s),h=b+Math.round((v-b)*s),l=w+Math.round((S-w)*s),c.toRgba(a,h,l)},n.ensureContrastRatio=function(u,m,d){const v=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(i(v,S)<d){if(S<v){const w=_(u,m,d),x=i(v,o.relativeLuminance(w>>8));if(x<d){const B=p(u,m,d);return x>i(v,o.relativeLuminance(B>>8))?w:B}return w}const y=p(u,m,d),b=i(v,o.relativeLuminance(y>>8));if(b<d){const w=_(u,m,d);return b>i(v,o.relativeLuminance(w>>8))?y:w}return y}},n.reduceLuminance=_,n.increaseLuminance=p,n.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}})(e||(t.rgba=e={})),t.toPaddedHex=r,t.contrastRatio=i},8969:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const h=a(844),l=a(2585),s=a(4348),c=a(7866),f=a(744),g=a(7302),o=a(6975),e=a(8460),r=a(1753),i=a(1480),n=a(7994),_=a(9282),p=a(5435),u=a(5981),m=a(2660);let d=!1;class v extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((y=>{this._onScrollApi?.fire(y.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(y){for(const b in y)this.optionsService.options[b]=y[b]}constructor(y){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new s.InstantiationService,this.optionsService=this.register(new g.OptionsService(y)),this._instantiationService.setService(l.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(f.BufferService)),this._instantiationService.setService(l.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(c.LogService)),this._instantiationService.setService(l.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(o.CoreService)),this._instantiationService.setService(l.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(r.CoreMouseService)),this._instantiationService.setService(l.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(l.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(n.CharsetService),this._instantiationService.setService(l.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(m.OscLinkService),this._instantiationService.setService(l.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new p.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((b=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((b=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new u.WriteBuffer(((b,w)=>this._inputHandler.parse(b,w)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(y,b){this._writeBuffer.write(y,b)}writeSync(y,b){this._logService.logLevel<=l.LogLevelEnum.WARN&&!d&&(this._logService.warn("writeSync is unreliable and will be removed soon."),d=!0),this._writeBuffer.writeSync(y,b)}input(y,b=!0){this.coreService.triggerDataEvent(y,b)}resize(y,b){isNaN(y)||isNaN(b)||(y=Math.max(y,f.MINIMUM_COLS),b=Math.max(b,f.MINIMUM_ROWS),this._bufferService.resize(y,b))}scroll(y,b=!1){this._bufferService.scroll(y,b)}scrollLines(y,b,w){this._bufferService.scrollLines(y,b,w)}scrollPages(y){this.scrollLines(y*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(y){const b=y-this._bufferService.buffer.ydisp;b!==0&&this.scrollLines(b)}registerEscHandler(y,b){return this._inputHandler.registerEscHandler(y,b)}registerDcsHandler(y,b){return this._inputHandler.registerDcsHandler(y,b)}registerCsiHandler(y,b){return this._inputHandler.registerCsiHandler(y,b)}registerOscHandler(y,b){return this._inputHandler.registerOscHandler(y,b)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let y=!1;const b=this.optionsService.rawOptions.windowsPty;b&&b.buildNumber!==void 0&&b.buildNumber!==void 0?y=b.backend==="conpty"&&b.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(y=!0),y?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const y=[];y.push(this.onLineFeed(_.updateWindowsModeWrappedState.bind(null,this._bufferService))),y.push(this.registerCsiHandler({final:"H"},(()=>((0,_.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const b of y)b.dispose()}))}}}t.CoreTerminal=v},8460:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let h=0;h<this._listeners.length;h++)if(this._listeners[h]===a)return void this._listeners.splice(h,1)}}})),this._event}fire(a,h){const l=[];for(let s=0;s<this._listeners.length;s++)l.push(this._listeners[s]);for(let s=0;s<l.length;s++)l[s].call(void 0,a,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,h){return a((l=>h.fire(l)))},t.runAndSubscribe=function(a,h){return h(void 0),a((l=>h(l)))}},5435:function(M,t,a){var h=this&&this.__decorate||function(O,C,E,T){var D,U=arguments.length,$=U<3?C:T===null?T=Object.getOwnPropertyDescriptor(C,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(O,C,E,T);else for(var K=O.length-1;K>=0;K--)(D=O[K])&&($=(U<3?D($):U>3?D(C,E,$):D(C,E))||$);return U>3&&$&&Object.defineProperty(C,E,$),$},l=this&&this.__param||function(O,C){return function(E,T){C(E,T,O)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const s=a(2584),c=a(7116),f=a(2015),g=a(844),o=a(482),e=a(8437),r=a(8460),i=a(643),n=a(511),_=a(3734),p=a(2585),u=a(1480),m=a(6242),d=a(6351),v=a(5941),S={"(":0,")":1,"*":2,"+":3,"-":1,".":2},y=131072;function b(O,C){if(O>24)return C.setWinLines||!1;switch(O){case 1:return!!C.restoreWin;case 2:return!!C.minimizeWin;case 3:return!!C.setWinPosition;case 4:return!!C.setWinSizePixels;case 5:return!!C.raiseWin;case 6:return!!C.lowerWin;case 7:return!!C.refreshWin;case 8:return!!C.setWinSizeChars;case 9:return!!C.maximizeWin;case 10:return!!C.fullscreenWin;case 11:return!!C.getWinState;case 13:return!!C.getWinPosition;case 14:return!!C.getWinSizePixels;case 15:return!!C.getScreenSizePixels;case 16:return!!C.getCellSizePixels;case 18:return!!C.getWinSizeChars;case 19:return!!C.getScreenSizeChars;case 20:return!!C.getIconTitle;case 21:return!!C.getWinTitle;case 22:return!!C.pushTitle;case 23:return!!C.popTitle;case 24:return!!C.setWinLines}return!1}var w;(function(O){O[O.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",O[O.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(w||(t.WindowsOptionsReportType=w={}));let x=0;class B extends g.Disposable{getAttrData(){return this._curAttrData}constructor(C,E,T,D,U,$,K,X,P=new f.EscapeSequenceParser){super(),this._bufferService=C,this._charsetService=E,this._coreService=T,this._logService=D,this._optionsService=U,this._oscLinkService=$,this._coreMouseService=K,this._unicodeService=X,this._parser=P,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new o.StringToUtf32,this._utf8Decoder=new o.Utf8ToUtf32,this._workCell=new n.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new r.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new r.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new r.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new r.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new r.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new r.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new r.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new r.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new r.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new r.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new r.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new r.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._parser.setCsiHandlerFallback(((L,H)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:H.toArray()})})),this._parser.setEscHandlerFallback((L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})})),this._parser.setExecuteHandlerFallback((L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})})),this._parser.setOscHandlerFallback(((L,H,A)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:H,data:A})})),this._parser.setDcsHandlerFallback(((L,H,A)=>{H==="HOOK"&&(A=A.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:H,payload:A})})),this._parser.setPrintHandler(((L,H,A)=>this.print(L,H,A))),this._parser.registerCsiHandler({final:"@"},(L=>this.insertChars(L))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(L=>this.scrollLeft(L))),this._parser.registerCsiHandler({final:"A"},(L=>this.cursorUp(L))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(L=>this.scrollRight(L))),this._parser.registerCsiHandler({final:"B"},(L=>this.cursorDown(L))),this._parser.registerCsiHandler({final:"C"},(L=>this.cursorForward(L))),this._parser.registerCsiHandler({final:"D"},(L=>this.cursorBackward(L))),this._parser.registerCsiHandler({final:"E"},(L=>this.cursorNextLine(L))),this._parser.registerCsiHandler({final:"F"},(L=>this.cursorPrecedingLine(L))),this._parser.registerCsiHandler({final:"G"},(L=>this.cursorCharAbsolute(L))),this._parser.registerCsiHandler({final:"H"},(L=>this.cursorPosition(L))),this._parser.registerCsiHandler({final:"I"},(L=>this.cursorForwardTab(L))),this._parser.registerCsiHandler({final:"J"},(L=>this.eraseInDisplay(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(L=>this.eraseInDisplay(L,!0))),this._parser.registerCsiHandler({final:"K"},(L=>this.eraseInLine(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(L=>this.eraseInLine(L,!0))),this._parser.registerCsiHandler({final:"L"},(L=>this.insertLines(L))),this._parser.registerCsiHandler({final:"M"},(L=>this.deleteLines(L))),this._parser.registerCsiHandler({final:"P"},(L=>this.deleteChars(L))),this._parser.registerCsiHandler({final:"S"},(L=>this.scrollUp(L))),this._parser.registerCsiHandler({final:"T"},(L=>this.scrollDown(L))),this._parser.registerCsiHandler({final:"X"},(L=>this.eraseChars(L))),this._parser.registerCsiHandler({final:"Z"},(L=>this.cursorBackwardTab(L))),this._parser.registerCsiHandler({final:"`"},(L=>this.charPosAbsolute(L))),this._parser.registerCsiHandler({final:"a"},(L=>this.hPositionRelative(L))),this._parser.registerCsiHandler({final:"b"},(L=>this.repeatPrecedingCharacter(L))),this._parser.registerCsiHandler({final:"c"},(L=>this.sendDeviceAttributesPrimary(L))),this._parser.registerCsiHandler({prefix:">",final:"c"},(L=>this.sendDeviceAttributesSecondary(L))),this._parser.registerCsiHandler({final:"d"},(L=>this.linePosAbsolute(L))),this._parser.registerCsiHandler({final:"e"},(L=>this.vPositionRelative(L))),this._parser.registerCsiHandler({final:"f"},(L=>this.hVPosition(L))),this._parser.registerCsiHandler({final:"g"},(L=>this.tabClear(L))),this._parser.registerCsiHandler({final:"h"},(L=>this.setMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(L=>this.setModePrivate(L))),this._parser.registerCsiHandler({final:"l"},(L=>this.resetMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(L=>this.resetModePrivate(L))),this._parser.registerCsiHandler({final:"m"},(L=>this.charAttributes(L))),this._parser.registerCsiHandler({final:"n"},(L=>this.deviceStatus(L))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(L=>this.deviceStatusPrivate(L))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(L=>this.softReset(L))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(L=>this.setCursorStyle(L))),this._parser.registerCsiHandler({final:"r"},(L=>this.setScrollRegion(L))),this._parser.registerCsiHandler({final:"s"},(L=>this.saveCursor(L))),this._parser.registerCsiHandler({final:"t"},(L=>this.windowOptions(L))),this._parser.registerCsiHandler({final:"u"},(L=>this.restoreCursor(L))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(L=>this.insertColumns(L))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(L=>this.deleteColumns(L))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(L=>this.selectProtected(L))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(L=>this.requestMode(L,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(L=>this.requestMode(L,!1))),this._parser.setExecuteHandler(s.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(s.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(s.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(s.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(s.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(s.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(s.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(s.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(s.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(s.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new m.OscHandler((L=>(this.setTitle(L),this.setIconName(L),!0)))),this._parser.registerOscHandler(1,new m.OscHandler((L=>this.setIconName(L)))),this._parser.registerOscHandler(2,new m.OscHandler((L=>this.setTitle(L)))),this._parser.registerOscHandler(4,new m.OscHandler((L=>this.setOrReportIndexedColor(L)))),this._parser.registerOscHandler(8,new m.OscHandler((L=>this.setHyperlink(L)))),this._parser.registerOscHandler(10,new m.OscHandler((L=>this.setOrReportFgColor(L)))),this._parser.registerOscHandler(11,new m.OscHandler((L=>this.setOrReportBgColor(L)))),this._parser.registerOscHandler(12,new m.OscHandler((L=>this.setOrReportCursorColor(L)))),this._parser.registerOscHandler(104,new m.OscHandler((L=>this.restoreIndexedColor(L)))),this._parser.registerOscHandler(110,new m.OscHandler((L=>this.restoreFgColor(L)))),this._parser.registerOscHandler(111,new m.OscHandler((L=>this.restoreBgColor(L)))),this._parser.registerOscHandler(112,new m.OscHandler((L=>this.restoreCursorColor(L)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const L in c.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},(()=>this.selectCharset("("+L))),this._parser.registerEscHandler({intermediates:")",final:L},(()=>this.selectCharset(")"+L))),this._parser.registerEscHandler({intermediates:"*",final:L},(()=>this.selectCharset("*"+L))),this._parser.registerEscHandler({intermediates:"+",final:L},(()=>this.selectCharset("+"+L))),this._parser.registerEscHandler({intermediates:"-",final:L},(()=>this.selectCharset("-"+L))),this._parser.registerEscHandler({intermediates:".",final:L},(()=>this.selectCharset("."+L))),this._parser.registerEscHandler({intermediates:"/",final:L},(()=>this.selectCharset("/"+L)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((L=>(this._logService.error("Parsing error: ",L),L))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new d.DcsHandler(((L,H)=>this.requestStatusString(L,H))))}_preserveStack(C,E,T,D){this._parseStack.paused=!0,this._parseStack.cursorStartX=C,this._parseStack.cursorStartY=E,this._parseStack.decodedLength=T,this._parseStack.position=D}_logSlowResolvingAsync(C){this._logService.logLevel<=p.LogLevelEnum.WARN&&Promise.race([C,new Promise(((E,T)=>setTimeout((()=>T("#SLOW_TIMEOUT")),5e3)))]).catch((E=>{if(E!=="#SLOW_TIMEOUT")throw E;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(C,E){let T,D=this._activeBuffer.x,U=this._activeBuffer.y,$=0;const K=this._parseStack.paused;if(K){if(T=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,E))return this._logSlowResolvingAsync(T),T;D=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,C.length>y&&($=this._parseStack.position+y)}if(this._logService.logLevel<=p.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof C=="string"?` "${C}"`:` "${Array.prototype.map.call(C,(L=>String.fromCharCode(L))).join("")}"`),typeof C=="string"?C.split("").map((L=>L.charCodeAt(0))):C),this._parseBuffer.length<C.length&&this._parseBuffer.length<y&&(this._parseBuffer=new Uint32Array(Math.min(C.length,y))),K||this._dirtyRowTracker.clearRange(),C.length>y)for(let L=$;L<C.length;L+=y){const H=L+y<C.length?L+y:C.length,A=typeof C=="string"?this._stringDecoder.decode(C.substring(L,H),this._parseBuffer):this._utf8Decoder.decode(C.subarray(L,H),this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,A))return this._preserveStack(D,U,A,L),this._logSlowResolvingAsync(T),T}else if(!K){const L=typeof C=="string"?this._stringDecoder.decode(C,this._parseBuffer):this._utf8Decoder.decode(C,this._parseBuffer);if(T=this._parser.parse(this._parseBuffer,L))return this._preserveStack(D,U,L,0),this._logSlowResolvingAsync(T),T}this._activeBuffer.x===D&&this._activeBuffer.y===U||this._onCursorMove.fire();const X=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),P=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);P<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(P,this._bufferService.rows-1),Math.min(X,this._bufferService.rows-1))}print(C,E,T){let D,U;const $=this._charsetService.charset,K=this._optionsService.rawOptions.screenReaderMode,X=this._bufferService.cols,P=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,H=this._curAttrData;let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&T-E>0&&A.getWidth(this._activeBuffer.x-1)===2&&A.setCellFromCodepoint(this._activeBuffer.x-1,0,1,H);let W=this._parser.precedingJoinState;for(let q=E;q<T;++q){if(D=C[q],D<127&&$){const ae=$[String.fromCharCode(D)];ae&&(D=ae.charCodeAt(0))}const ee=this._unicodeService.charProperties(D,W);U=u.UnicodeService.extractWidth(ee);const G=u.UnicodeService.extractShouldJoin(ee),te=G?u.UnicodeService.extractWidth(W):0;if(W=ee,K&&this._onA11yChar.fire((0,o.stringFromCodePoint)(D)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-te>X){if(P){const ae=A;let Q=this._activeBuffer.x-te;for(this._activeBuffer.x=te,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),A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),te>0&&A instanceof e.BufferLine&&A.copyCellsFrom(ae,Q,0,te,!1);Q<X;)ae.setCellFromCodepoint(Q++,0,1,H)}else if(this._activeBuffer.x=X-1,U===2)continue}if(G&&this._activeBuffer.x){const ae=A.getWidth(this._activeBuffer.x-1)?1:2;A.addCodepointToCell(this._activeBuffer.x-ae,D,U);for(let Q=U-te;--Q>=0;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}else if(L&&(A.insertCells(this._activeBuffer.x,U-te,this._activeBuffer.getNullCell(H)),A.getWidth(X-1)===2&&A.setCellFromCodepoint(X-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,H)),A.setCellFromCodepoint(this._activeBuffer.x++,D,U,H),U>0)for(;--U;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}this._parser.precedingJoinState=W,this._activeBuffer.x<X&&T-E>0&&A.getWidth(this._activeBuffer.x)===0&&!A.hasContent(this._activeBuffer.x)&&A.setCellFromCodepoint(this._activeBuffer.x,0,1,H),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(C,E){return C.final!=="t"||C.prefix||C.intermediates?this._parser.registerCsiHandler(C,E):this._parser.registerCsiHandler(C,(T=>!b(T.params[0],this._optionsService.rawOptions.windowOptions)||E(T)))}registerDcsHandler(C,E){return this._parser.registerDcsHandler(C,new d.DcsHandler(E))}registerEscHandler(C,E){return this._parser.registerEscHandler(C,E)}registerOscHandler(C,E){return this._parser.registerOscHandler(C,new m.OscHandler(E))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const C=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);C.hasWidth(this._activeBuffer.x)&&!C.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const C=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-C),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(C=this._bufferService.cols-1){this._activeBuffer.x=Math.min(C,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(C,E){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=C,this._activeBuffer.y=this._activeBuffer.scrollTop+E):(this._activeBuffer.x=C,this._activeBuffer.y=E),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(C,E){this._restrictCursor(),this._setCursor(this._activeBuffer.x+C,this._activeBuffer.y+E)}cursorUp(C){const E=this._activeBuffer.y-this._activeBuffer.scrollTop;return E>=0?this._moveCursor(0,-Math.min(E,C.params[0]||1)):this._moveCursor(0,-(C.params[0]||1)),!0}cursorDown(C){const E=this._activeBuffer.scrollBottom-this._activeBuffer.y;return E>=0?this._moveCursor(0,Math.min(E,C.params[0]||1)):this._moveCursor(0,C.params[0]||1),!0}cursorForward(C){return this._moveCursor(C.params[0]||1,0),!0}cursorBackward(C){return this._moveCursor(-(C.params[0]||1),0),!0}cursorNextLine(C){return this.cursorDown(C),this._activeBuffer.x=0,!0}cursorPrecedingLine(C){return this.cursorUp(C),this._activeBuffer.x=0,!0}cursorCharAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(C){return this._setCursor(C.length>=2?(C.params[1]||1)-1:0,(C.params[0]||1)-1),!0}charPosAbsolute(C){return this._setCursor((C.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(C){return this._moveCursor(C.params[0]||1,0),!0}linePosAbsolute(C){return this._setCursor(this._activeBuffer.x,(C.params[0]||1)-1),!0}vPositionRelative(C){return this._moveCursor(0,C.params[0]||1),!0}hVPosition(C){return this.cursorPosition(C),!0}tabClear(C){const E=C.params[0];return E===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:E===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=C.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(C){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=C.params[0]||1;for(;E--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(C){const E=C.params[0];return E===1&&(this._curAttrData.bg|=536870912),E!==2&&E!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(C,E,T,D=!1,U=!1){const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);$.replaceCells(E,T,this._activeBuffer.getNullCell(this._eraseAttrData()),U),D&&($.isWrapped=!1)}_resetBufferLine(C,E=!1){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);T&&(T.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),E),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+C),T.isWrapped=!1)}eraseInDisplay(C,E=!1){let T;switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);T<this._bufferService.rows;T++)this._resetBufferLine(T,E);this._dirtyRowTracker.markDirty(T);break;case 1:for(T=this._activeBuffer.y,this._dirtyRowTracker.markDirty(T),this._eraseInBufferLine(T,0,this._activeBuffer.x+1,!0,E),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(T+1).isWrapped=!1);T--;)this._resetBufferLine(T,E);this._dirtyRowTracker.markDirty(0);break;case 2:for(T=this._bufferService.rows,this._dirtyRowTracker.markDirty(T-1);T--;)this._resetBufferLine(T,E);this._dirtyRowTracker.markDirty(0);break;case 3:const D=this._activeBuffer.lines.length-this._bufferService.rows;D>0&&(this._activeBuffer.lines.trimStart(D),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-D,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-D,0),this._onScroll.fire(0))}return!0}eraseInLine(C,E=!1){switch(this._restrictCursor(this._bufferService.cols),C.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,E);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,E);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,E)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(C){this._restrictCursor();let E=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y,D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-D+1;for(;E--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(C){this._restrictCursor();let E=C.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const T=this._activeBuffer.ybase+this._activeBuffer.y;let D;for(D=this._bufferService.rows-1-this._activeBuffer.scrollBottom,D=this._bufferService.rows-1+this._activeBuffer.ybase-D;E--;)this._activeBuffer.lines.splice(T,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(C){this._restrictCursor();const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.insertCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(C){this._restrictCursor();const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.deleteCells(this._activeBuffer.x,C.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(C){let E=C.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(C){let E=C.params[0]||1;for(;E--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(0,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.insertCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(C){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const E=C.params[0]||1;for(let T=this._activeBuffer.scrollTop;T<=this._activeBuffer.scrollBottom;++T){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D.deleteCells(this._activeBuffer.x,E,this._activeBuffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(C){this._restrictCursor();const E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return E&&(E.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(C.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(C){const E=this._parser.precedingJoinState;if(!E)return!0;const T=C.params[0]||1,D=u.UnicodeService.extractWidth(E),U=this._activeBuffer.x-D,$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),K=new Uint32Array($.length*T);let X=0;for(let L=0;L<$.length;){const H=$.codePointAt(L)||0;K[X++]=H,L+=H>65535?2:1}let P=X;for(let L=1;L<T;++L)K.copyWithin(P,0,X),P+=X;return this.print(K,0,P),!0}sendDeviceAttributesPrimary(C){return C.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(s.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(s.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(C){return C.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(s.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(s.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(C.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(s.C0.ESC+"[>83;40003;0c")),!0}_is(C){return(this._optionsService.rawOptions.termName+"").indexOf(C)===0}setMode(C){for(let E=0;E<C.length;E++)switch(C.params[E]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(C){for(let E=0;E<C.length;E++)switch(C.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),this._charsetService.setgCharset(1,c.DEFAULT_CHARSET),this._charsetService.setgCharset(2,c.DEFAULT_CHARSET),this._charsetService.setgCharset(3,c.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(C){for(let E=0;E<C.length;E++)switch(C.params[E]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(C){for(let E=0;E<C.length;E++)switch(C.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),C.params[E]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(C,E){const T=this._coreService.decPrivateModes,{activeProtocol:D,activeEncoding:U}=this._coreMouseService,$=this._coreService,{buffers:K,cols:X}=this._bufferService,{active:P,alt:L}=K,H=this._optionsService.rawOptions,A=G=>G?1:2,W=C.params[0];return q=W,ee=E?W===2?4:W===4?A($.modes.insertMode):W===12?3:W===20?A(H.convertEol):0:W===1?A(T.applicationCursorKeys):W===3?H.windowOptions.setWinLines?X===80?2:X===132?1:0:0:W===6?A(T.origin):W===7?A(T.wraparound):W===8?3:W===9?A(D==="X10"):W===12?A(H.cursorBlink):W===25?A(!$.isCursorHidden):W===45?A(T.reverseWraparound):W===66?A(T.applicationKeypad):W===67?4:W===1e3?A(D==="VT200"):W===1002?A(D==="DRAG"):W===1003?A(D==="ANY"):W===1004?A(T.sendFocus):W===1005?4:W===1006?A(U==="SGR"):W===1015?4:W===1016?A(U==="SGR_PIXELS"):W===1048?1:W===47||W===1047||W===1049?A(P===L):W===2004?A(T.bracketedPasteMode):0,$.triggerDataEvent(`${s.C0.ESC}[${E?"":"?"}${q};${ee}$y`),!0;var q,ee}_updateAttrColor(C,E,T,D,U){return E===2?(C|=50331648,C&=-16777216,C|=_.AttributeData.fromColorRGB([T,D,U])):E===5&&(C&=-50331904,C|=33554432|255&T),C}_extractColor(C,E,T){const D=[0,0,-1,0,0,0];let U=0,$=0;do{if(D[$+U]=C.params[E+$],C.hasSubParams(E+$)){const K=C.getSubParams(E+$);let X=0;do D[1]===5&&(U=1),D[$+X+1+U]=K[X];while(++X<K.length&&X+$+1+U<D.length);break}if(D[1]===5&&$+U>=2||D[1]===2&&$+U>=5)break;D[1]&&(U=1)}while(++$+E<C.length&&$+U<D.length);for(let K=2;K<D.length;++K)D[K]===-1&&(D[K]=0);switch(D[0]){case 38:T.fg=this._updateAttrColor(T.fg,D[1],D[3],D[4],D[5]);break;case 48:T.bg=this._updateAttrColor(T.bg,D[1],D[3],D[4],D[5]);break;case 58:T.extended=T.extended.clone(),T.extended.underlineColor=this._updateAttrColor(T.extended.underlineColor,D[1],D[3],D[4],D[5])}return $}_processUnderline(C,E){E.extended=E.extended.clone(),(!~C||C>5)&&(C=1),E.extended.underlineStyle=C,E.fg|=268435456,C===0&&(E.fg&=-268435457),E.updateExtended()}_processSGR0(C){C.fg=e.DEFAULT_ATTR_DATA.fg,C.bg=e.DEFAULT_ATTR_DATA.bg,C.extended=C.extended.clone(),C.extended.underlineStyle=0,C.extended.underlineColor&=-67108864,C.updateExtended()}charAttributes(C){if(C.length===1&&C.params[0]===0)return this._processSGR0(this._curAttrData),!0;const E=C.length;let T;const D=this._curAttrData;for(let U=0;U<E;U++)T=C.params[U],T>=30&&T<=37?(D.fg&=-50331904,D.fg|=16777216|T-30):T>=40&&T<=47?(D.bg&=-50331904,D.bg|=16777216|T-40):T>=90&&T<=97?(D.fg&=-50331904,D.fg|=16777224|T-90):T>=100&&T<=107?(D.bg&=-50331904,D.bg|=16777224|T-100):T===0?this._processSGR0(D):T===1?D.fg|=134217728:T===3?D.bg|=67108864:T===4?(D.fg|=268435456,this._processUnderline(C.hasSubParams(U)?C.getSubParams(U)[0]:1,D)):T===5?D.fg|=536870912:T===7?D.fg|=67108864:T===8?D.fg|=1073741824:T===9?D.fg|=2147483648:T===2?D.bg|=134217728:T===21?this._processUnderline(2,D):T===22?(D.fg&=-134217729,D.bg&=-134217729):T===23?D.bg&=-67108865:T===24?(D.fg&=-268435457,this._processUnderline(0,D)):T===25?D.fg&=-536870913:T===27?D.fg&=-67108865:T===28?D.fg&=-1073741825:T===29?D.fg&=2147483647:T===39?(D.fg&=-67108864,D.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):T===49?(D.bg&=-67108864,D.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):T===38||T===48||T===58?U+=this._extractColor(C,U,D):T===53?D.bg|=1073741824:T===55?D.bg&=-1073741825:T===59?(D.extended=D.extended.clone(),D.extended.underlineColor=-1,D.updateExtended()):T===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.",T);return!0}deviceStatus(C){switch(C.params[0]){case 5:this._coreService.triggerDataEvent(`${s.C0.ESC}[0n`);break;case 6:const E=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[${E};${T}R`)}return!0}deviceStatusPrivate(C){if(C.params[0]===6){const E=this._activeBuffer.y+1,T=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${s.C0.ESC}[?${E};${T}R`)}return!0}softReset(C){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(C){const E=C.params[0]||1;switch(E){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const T=E%2==1;return this._optionsService.options.cursorBlink=T,!0}setScrollRegion(C){const E=C.params[0]||1;let T;return(C.length<2||(T=C.params[1])>this._bufferService.rows||T===0)&&(T=this._bufferService.rows),T>E&&(this._activeBuffer.scrollTop=E-1,this._activeBuffer.scrollBottom=T-1,this._setCursor(0,0)),!0}windowOptions(C){if(!b(C.params[0],this._optionsService.rawOptions.windowOptions))return!0;const E=C.length>1?C.params[1]:0;switch(C.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${s.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(C){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(C){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(C){return this._windowTitle=C,this._onTitleChange.fire(C),!0}setIconName(C){return this._iconName=C,!0}setOrReportIndexedColor(C){const E=[],T=C.split(";");for(;T.length>1;){const D=T.shift(),U=T.shift();if(/^\d+$/.exec(D)){const $=parseInt(D);if(I($))if(U==="?")E.push({type:0,index:$});else{const K=(0,v.parseColor)(U);K&&E.push({type:1,index:$,color:K})}}}return E.length&&this._onColor.fire(E),!0}setHyperlink(C){const E=C.split(";");return!(E.length<2)&&(E[1]?this._createHyperlink(E[0],E[1]):!E[0]&&this._finishHyperlink())}_createHyperlink(C,E){this._getCurrentLinkId()&&this._finishHyperlink();const T=C.split(":");let D;const U=T.findIndex(($=>$.startsWith("id=")));return U!==-1&&(D=T[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:D,uri:E}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(C,E){const T=C.split(";");for(let D=0;D<T.length&&!(E>=this._specialColors.length);++D,++E)if(T[D]==="?")this._onColor.fire([{type:0,index:this._specialColors[E]}]);else{const U=(0,v.parseColor)(T[D]);U&&this._onColor.fire([{type:1,index:this._specialColors[E],color:U}])}return!0}setOrReportFgColor(C){return this._setOrReportSpecialColor(C,0)}setOrReportBgColor(C){return this._setOrReportSpecialColor(C,1)}setOrReportCursorColor(C){return this._setOrReportSpecialColor(C,2)}restoreIndexedColor(C){if(!C)return this._onColor.fire([{type:2}]),!0;const E=[],T=C.split(";");for(let D=0;D<T.length;++D)if(/^\d+$/.exec(T[D])){const U=parseInt(T[D]);I(U)&&E.push({type:2,index:U})}return E.length&&this._onColor.fire(E),!0}restoreFgColor(C){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(C){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(C){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,c.DEFAULT_CHARSET),!0}selectCharset(C){return C.length!==2?(this.selectDefaultCharset(),!0):(C[0]==="/"||this._charsetService.setgCharset(S[C[0]],c.CHARSETS[C[1]]||c.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const C=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,C,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(C){return this._charsetService.setgLevel(C),!0}screenAlignmentPattern(){const C=new n.CellData;C.content=4194373,C.fg=this._curAttrData.fg,C.bg=this._curAttrData.bg,this._setCursor(0,0);for(let E=0;E<this._bufferService.rows;++E){const T=this._activeBuffer.ybase+this._activeBuffer.y+E,D=this._activeBuffer.lines.get(T);D&&(D.fill(C),D.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(C,E){const T=this._bufferService.buffer,D=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${s.C0.ESC}${U}${s.C0.ESC}\\`),!0))(C==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:C==='"p'?'P1$r61;1"p':C==="r"?`P1$r${T.scrollTop+1};${T.scrollBottom+1}r`:C==="m"?"P1$r0m":C===" q"?`P1$r${{block:2,underline:4,bar:6}[D.cursorStyle]-(D.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(C,E){this._dirtyRowTracker.markRangeDirty(C,E)}}t.InputHandler=B;let F=class{constructor(O){this._bufferService=O,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(O){O<this.start?this.start=O:O>this.end&&(this.end=O)}markRangeDirty(O,C){O>C&&(x=O,O=C,C=x),O<this.start&&(this.start=O),C>this.end&&(this.end=C)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function I(O){return 0<=O&&O<256}F=h([l(0,p.IBufferService)],F)},844:(M,t)=>{function a(h){for(const l of h)l.dispose();h.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const l=this._disposables.indexOf(h);l!==-1&&this._disposables.splice(l,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){this._isDisposed||h===this._value||(this._value?.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(h){return{dispose:h}},t.disposeArray=a,t.getDisposeArrayDisposable=function(h){return{dispose:()=>a(h)}}},1505:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(l,s,c){this._data[l]||(this._data[l]={}),this._data[l][s]=c}get(l,s){return this._data[l]?this._data[l][s]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(h,l,s,c,f){this._data.get(h,l)||this._data.set(h,l,new a),this._data.get(h,l).set(s,c,f)}get(h,l,s,c){return this._data.get(h,l)?.get(s,c)}clear(){this._data.clear()}}},6114:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,h=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const l=a.match(/Version\/(\d+)/);return l===null||l.length<2?0:parseInt(l[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),t.isIpad=h==="iPad",t.isIphone=h==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),t.isLinux=h.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},6106:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let a=0;t.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(a=this._search(this._getKey(h)),this._array.splice(a,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const l=this._getKey(h);if(l===void 0||(a=this._search(l),a===-1)||this._getKey(this._array[a])!==l)return!1;do if(this._array[a]===h)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===l);return!1}*getKeyIterator(h){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===h)}forEachByKey(h,l){if(this._array.length!==0&&(a=this._search(h),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===h))do l(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===h)}values(){return[...this._array].values()}_search(h){let l=0,s=this._array.length-1;for(;s>=l;){let c=l+s>>1;const f=this._getKey(this._array[c]);if(f>h)s=c-1;else{if(!(f<h)){for(;c>0&&this._getKey(this._array[c-1])===h;)c--;return c}l=c+1}}return l}}},7226:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(6114);class l{constructor(){this._tasks=[],this._i=0}enqueue(f){this._tasks.push(f),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(f){this._idleCallback=void 0;let g=0,o=0,e=f.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),o=Math.max(g,o),r=f.timeRemaining(),1.5*o>r)return e-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-g))}ms`),void this._start();e=r}this.clear()}}class s extends l{_requestCallback(f){return setTimeout((()=>f(this._createDeadline(16))))}_cancelCallback(f){clearTimeout(f)}_createDeadline(f){const g=Date.now()+f;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}t.PriorityTaskQueue=s,t.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends l{_requestCallback(c){return requestIdleCallback(c)}_cancelCallback(c){cancelIdleCallback(c)}}:s,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(c){this._queue.clear(),this._queue.enqueue(c)}flush(){this._queue.flush()}}},9282:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const h=a(643);t.updateWindowsModeWrappedState=function(l){const s=l.buffer.lines.get(l.buffer.ybase+l.buffer.y-1),c=s?.get(l.cols-1),f=l.buffer.lines.get(l.buffer.ybase+l.buffer.y);f&&c&&(f.isWrapped=c[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&c[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(s){return[s>>>16&255,s>>>8&255,255&s]}static fromColorRGB(s){return(255&s[0])<<16|(255&s[1])<<8|255&s[2]}clone(){const s=new a;return s.fg=this.fg,s.bg=this.bg,s.extended=this.extended.clone(),s}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=a;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(s){this._ext=s}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(s){this._ext&=-469762049,this._ext|=s<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(s){this._ext&=-67108864,this._ext|=67108863&s}get urlId(){return this._urlId}set urlId(s){this._urlId=s}get underlineVariantOffset(){const s=(3758096384&this._ext)>>29;return s<0?4294967288^s:s}set underlineVariantOffset(s){this._ext&=536870911,this._ext|=s<<29&3758096384}constructor(s=0,c=0){this._ext=0,this._urlId=0,this._ext=s,this._urlId=c}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=h},9092:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const h=a(6349),l=a(7226),s=a(3734),c=a(8437),f=a(4634),g=a(511),o=a(643),e=a(4863),r=a(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(i,n,_){this._hasScrollback=i,this._optionsService=n,this._bufferService=_,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=c.DEFAULT_ATTR_DATA.clone(),this.savedCharset=r.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new l.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new s.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new s.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,n){return new c.BufferLine(this._bufferService.cols,this.getNullCell(i),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const n=i+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=c.DEFAULT_ATTR_DATA);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,n){const _=this.getNullCell(c.DEFAULT_ATTR_DATA);let p=0;const u=this._getCorrectBufferLength(n);if(u>this.lines.maxLength&&(this.lines.maxLength=u),this.lines.length>0){if(this._cols<i)for(let d=0;d<this.lines.length;d++)p+=+this.lines.get(d).resize(i,_);let m=0;if(this._rows<n)for(let d=this._rows;d<n;d++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new c.BufferLine(i,_)):this.ybase>0&&this.lines.length<=this.ybase+this.y+m+1?(this.ybase--,m++,this.ydisp>0&&this.ydisp--):this.lines.push(new c.BufferLine(i,_)));else for(let d=this._rows;d>n;d--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(u<this.lines.maxLength){const d=this.lines.length-u;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=u}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,n-1),m&&(this.y+=m),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(i,n),this._cols>i))for(let m=0;m<this.lines.length;m++)p+=+this.lines.get(m).resize(i,_);this._cols=i,this._rows=n,this._memoryCleanupQueue.clear(),p>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,n){this._cols!==i&&(i>this._cols?this._reflowLarger(i,n):this._reflowSmaller(i,n))}_reflowLarger(i,n){const _=(0,f.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(c.DEFAULT_ATTR_DATA));if(_.length>0){const p=(0,f.reflowLargerCreateNewLayout)(this.lines,_);(0,f.reflowLargerApplyNewLayout)(this.lines,p.layout),this._reflowLargerAdjustViewport(i,n,p.countRemoved)}}_reflowLargerAdjustViewport(i,n,_){const p=this.getNullCell(c.DEFAULT_ATTR_DATA);let u=_;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new c.BufferLine(i,p))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-_,0)}_reflowSmaller(i,n){const _=this.getNullCell(c.DEFAULT_ATTR_DATA),p=[];let u=0;for(let m=this.lines.length-1;m>=0;m--){let d=this.lines.get(m);if(!d||!d.isWrapped&&d.getTrimmedLength()<=i)continue;const v=[d];for(;d.isWrapped&&m>0;)d=this.lines.get(--m),v.unshift(d);const S=this.ybase+this.y;if(S>=m&&S<m+v.length)continue;const y=v[v.length-1].getTrimmedLength(),b=(0,f.reflowSmallerGetNewLineLengths)(v,this._cols,i),w=b.length-v.length;let x;x=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+w):Math.max(0,this.lines.length-this.lines.maxLength+w);const B=[];for(let T=0;T<w;T++){const D=this.getBlankLine(c.DEFAULT_ATTR_DATA,!0);B.push(D)}B.length>0&&(p.push({start:m+v.length+u,newLines:B}),u+=B.length),v.push(...B);let F=b.length-1,I=b[F];I===0&&(F--,I=b[F]);let O=v.length-w-1,C=y;for(;O>=0;){const T=Math.min(C,I);if(v[F]===void 0)break;if(v[F].copyCellsFrom(v[O],C-T,I-T,T,!0),I-=T,I===0&&(F--,I=b[F]),C-=T,C===0){O--;const D=Math.max(O,0);C=(0,f.getWrappedLineTrimmedLength)(v,D,this._cols)}}for(let T=0;T<v.length;T++)b[T]<i&&v[T].setCell(b[T],_);let E=w-x;for(;E-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+u)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+w,this.ybase+n-1)}if(p.length>0){const m=[],d=[];for(let F=0;F<this.lines.length;F++)d.push(this.lines.get(F));const v=this.lines.length;let S=v-1,y=0,b=p[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+u);let w=0;for(let F=Math.min(this.lines.maxLength-1,v+u-1);F>=0;F--)if(b&&b.start>S+w){for(let I=b.newLines.length-1;I>=0;I--)this.lines.set(F--,b.newLines[I]);F++,m.push({index:S+1,amount:b.newLines.length}),w+=b.newLines.length,b=p[++y]}else this.lines.set(F,d[S--]);let x=0;for(let F=m.length-1;F>=0;F--)m[F].index+=x,this.lines.onInsertEmitter.fire(m[F]),x+=m[F].amount;const B=Math.max(0,v+u-this.lines.maxLength);B>0&&this.lines.onTrimEmitter.fire(B)}}translateBufferLineToString(i,n,_=0,p){const u=this.lines.get(i);return u?u.translateToString(n,_,p):""}getWrappedRangeForLine(i){let n=i,_=i;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;_+1<this.lines.length&&this.lines.get(_+1).isWrapped;)_++;return{first:n,last:_}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let n=0;n<this.markers.length;n++)this.markers[n].line===i&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const n=new e.Marker(i);return this.markers.push(n),n.register(this.lines.onTrim((_=>{n.line-=_,n.line<0&&n.dispose()}))),n.register(this.lines.onInsert((_=>{n.line>=_.index&&(n.line+=_.amount)}))),n.register(this.lines.onDelete((_=>{n.line>=_.index&&n.line<_.index+_.amount&&n.dispose(),n.line>_.index&&(n.line-=_.amount)}))),n.register(n.onDispose((()=>this._removeMarker(n)))),n}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const h=a(3734),l=a(511),s=a(643),c=a(482);t.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let f=0;class g{constructor(e,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=r||l.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]);for(let _=0;_<e;++_)this.setCell(_,n);this.length=e}get(e){const r=this._data[3*e+0],i=2097151&r;return[this._data[3*e+1],2097152&r?this._combined[e]:i?(0,c.stringFromCodePoint)(i):"",r>>22,2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,r){this._data[3*e+1]=r[s.CHAR_DATA_ATTR_INDEX],r[s.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=r[1],this._data[3*e+0]=2097152|e|r[s.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=r[s.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|r[s.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&r}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const r=this._data[3*e+0];return 2097152&r?this._combined[e]:2097151&r?(0,c.stringFromCodePoint)(2097151&r):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,r){return f=3*e,r.content=this._data[f+0],r.fg=this._data[f+1],r.bg=this._data[f+2],2097152&r.content&&(r.combinedData=this._combined[e]),268435456&r.bg&&(r.extended=this._extendedAttrs[e]),r}setCell(e,r){2097152&r.content&&(this._combined[e]=r.combinedData),268435456&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=r.content,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}setCellFromCodepoint(e,r,i,n){268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=r|i<<22,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}addCodepointToCell(e,r,i){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,c.stringFromCodePoint)(r):2097151&n?(this._combined[e]=(0,c.stringFromCodePoint)(2097151&n)+(0,c.stringFromCodePoint)(r),n&=-2097152,n|=2097152):n=r|4194304,i&&(n&=-12582913,n|=i<<22),this._data[3*e+0]=n}insertCells(e,r,i){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length-e){const n=new l.CellData;for(let _=this.length-e-r-1;_>=0;--_)this.setCell(e+r+_,this.loadCell(e+_,n));for(let _=0;_<r;++_)this.setCell(e+_,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(e,r,i){if(e%=this.length,r<this.length-e){const n=new l.CellData;for(let _=0;_<this.length-e-r;++_)this.setCell(e+_,this.loadCell(e+r+_,n));for(let _=this.length-r;_<this.length;++_)this.setCell(_,i)}else for(let n=e;n<this.length;++n)this.setCell(n,i);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,i)}replaceCells(e,r,i,n=!1){if(n)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.isProtected(e)||this.setCell(e,i),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);e<r&&e<this.length;)this.setCell(e++,i)}resize(e,r){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const n=new Uint32Array(i);n.set(this._data),this._data=n}for(let n=this.length;n<e;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,i);const n=Object.keys(this._combined);for(let p=0;p<n.length;p++){const u=parseInt(n[p],10);u>=e&&delete this._combined[u]}const _=Object.keys(this._extendedAttrs);for(let p=0;p<_.length;p++){const u=parseInt(_[p],10);u>=e&&delete this._extendedAttrs[u]}}return this.length=e,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,r=!1){if(r)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const r in e._combined)this._combined[r]=e._combined[r];this._extendedAttrs={};for(const r in e._extendedAttrs)this._extendedAttrs[r]=e._extendedAttrs[r];this.isWrapped=e.isWrapped}clone(){const e=new g(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const r in this._combined)e._combined[r]=this._combined[r];for(const r in this._extendedAttrs)e._extendedAttrs[r]=this._extendedAttrs[r];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,r,i,n,_){const p=e._data;if(_)for(let m=n-1;m>=0;m--){for(let d=0;d<3;d++)this._data[3*(i+m)+d]=p[3*(r+m)+d];268435456&p[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}else for(let m=0;m<n;m++){for(let d=0;d<3;d++)this._data[3*(i+m)+d]=p[3*(r+m)+d];268435456&p[3*(r+m)+2]&&(this._extendedAttrs[i+m]=e._extendedAttrs[r+m])}const u=Object.keys(e._combined);for(let m=0;m<u.length;m++){const d=parseInt(u[m],10);d>=r&&(this._combined[d-r+i]=e._combined[d])}}translateToString(e,r,i,n){r=r??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),n&&(n.length=0);let _="";for(;r<i;){const p=this._data[3*r+0],u=2097151&p,m=2097152&p?this._combined[r]:u?(0,c.stringFromCodePoint)(u):s.WHITESPACE_CELL_CHAR;if(_+=m,n)for(let d=0;d<m.length;++d)n.push(r);r+=p>>22||1}return n&&n.push(r),_}}t.BufferLine=g},4841:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(a,h){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return h*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(M,t)=>{function a(h,l,s){if(l===h.length-1)return h[l].getTrimmedLength();const c=!h[l].hasContent(s-1)&&h[l].getWidth(s-1)===1,f=h[l+1].getWidth(0)===2;return c&&f?s-1:s}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(h,l,s,c,f){const g=[];for(let o=0;o<h.length-1;o++){let e=o,r=h.get(++e);if(!r.isWrapped)continue;const i=[h.get(o)];for(;e<h.length&&r.isWrapped;)i.push(r),r=h.get(++e);if(c>=o&&c<e){o+=i.length-1;continue}let n=0,_=a(i,n,l),p=1,u=0;for(;p<i.length;){const d=a(i,p,l),v=d-u,S=s-_,y=Math.min(v,S);i[n].copyCellsFrom(i[p],u,_,y,!1),_+=y,_===s&&(n++,_=0),u+=y,u===d&&(p++,u=0),_===0&&n!==0&&i[n-1].getWidth(s-1)===2&&(i[n].copyCellsFrom(i[n-1],s-1,_++,1,!1),i[n-1].setCell(s-1,f))}i[n].replaceCells(_,s,f);let m=0;for(let d=i.length-1;d>0&&(d>n||i[d].getTrimmedLength()===0);d--)m++;m>0&&(g.push(o+i.length-m),g.push(m)),o+=i.length-1}return g},t.reflowLargerCreateNewLayout=function(h,l){const s=[];let c=0,f=l[c],g=0;for(let o=0;o<h.length;o++)if(f===o){const e=l[++c];h.onDeleteEmitter.fire({index:o-g,amount:e}),o+=e-1,g+=e,f=l[++c]}else s.push(o);return{layout:s,countRemoved:g}},t.reflowLargerApplyNewLayout=function(h,l){const s=[];for(let c=0;c<l.length;c++)s.push(h.get(l[c]));for(let c=0;c<s.length;c++)h.set(c,s[c]);h.length=l.length},t.reflowSmallerGetNewLineLengths=function(h,l,s){const c=[],f=h.map(((r,i)=>a(h,i,l))).reduce(((r,i)=>r+i));let g=0,o=0,e=0;for(;e<f;){if(f-e<s){c.push(f-e);break}g+=s;const r=a(h,o,l);g>r&&(g-=r,o++);const i=h[o].getWidth(g-1)===2;i&&g--;const n=i?s-1:s;c.push(n),e+=n}return c},t.getWrappedLineTrimmedLength=a},5295:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const h=a(8460),l=a(844),s=a(9092);class c extends l.Disposable{constructor(g,o){super(),this._optionsService=g,this._bufferService=o,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new s.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new s.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(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,o){this._normal.resize(g,o),this._alt.resize(g,o),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}t.BufferSet=c},511:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(482),l=a(643),s=a(3734);class c extends s.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new s.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const o=new c;return o.setFromCharData(g),o}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[l.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(g[l.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(g[l.CHAR_DATA_CHAR_INDEX].length===2){const e=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const r=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(e-55296)+r-56320+65536|g[l.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=g[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[l.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=g[l.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[l.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=c},643:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const h=a(8460),l=a(844);class s{get id(){return this._id}constructor(f){this.line=f,this.isDisposed=!1,this._disposables=[],this._id=s._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,l.disposeArray)(this._disposables),this._disposables.length=0)}register(f){return this._disposables.push(f),f}}t.Marker=s,s._nextId=1},7116:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(M,t)=>{var a,h,l;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(function(s){s.NUL="\0",s.SOH="",s.STX="",s.ETX="",s.EOT="",s.ENQ="",s.ACK="",s.BEL="\x07",s.BS="\b",s.HT=" ",s.LF=`
65
65
  `,s.VT="\v",s.FF="\f",s.CR="\r",s.SO="",s.SI="",s.DLE="",s.DC1="",s.DC2="",s.DC3="",s.DC4="",s.NAK="",s.SYN="",s.ETB="",s.CAN="",s.EM="",s.SUB="",s.ESC="\x1B",s.FS="",s.GS="",s.RS="",s.US="",s.SP=" ",s.DEL=""})(a||(t.C0=a={})),(function(s){s.PAD="€",s.HOP="",s.BPH="‚",s.NBH="ƒ",s.IND="„",s.NEL="…",s.SSA="†",s.ESA="‡",s.HTS="ˆ",s.HTJ="‰",s.VTS="Š",s.PLD="‹",s.PLU="Œ",s.RI="",s.SS2="Ž",s.SS3="",s.DCS="",s.PU1="‘",s.PU2="’",s.STS="“",s.CCH="”",s.MW="•",s.SPA="–",s.EPA="—",s.SOS="˜",s.SGCI="™",s.SCI="š",s.CSI="›",s.ST="œ",s.OSC="",s.PM="ž",s.APC="Ÿ"})(h||(t.C1=h={})),(function(s){s.ST=`${a.ESC}\\`})(l||(t.C1_ESCAPED=l={}))},7399:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const h=a(2584),l={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(s,c,f,g){const o={type:0,cancel:!1,key:void 0},e=(s.shiftKey?1:0)|(s.altKey?2:0)|(s.ctrlKey?4:0)|(s.metaKey?8:0);switch(s.keyCode){case 0:s.key==="UIKeyInputUpArrow"?o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A":s.key==="UIKeyInputLeftArrow"?o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D":s.key==="UIKeyInputRightArrow"?o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C":s.key==="UIKeyInputDownArrow"&&(o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:o.key=s.ctrlKey?"\b":h.C0.DEL,s.altKey&&(o.key=h.C0.ESC+o.key);break;case 9:if(s.shiftKey){o.key=h.C0.ESC+"[Z";break}o.key=h.C0.HT,o.cancel=!0;break;case 13:o.key=s.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,o.cancel=!0;break;case 27:o.key=h.C0.ESC,s.altKey&&(o.key=h.C0.ESC+h.C0.ESC),o.cancel=!0;break;case 37:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"D",o.key===h.C0.ESC+"[1;3D"&&(o.key=h.C0.ESC+(f?"b":"[1;5D"))):o.key=c?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"C",o.key===h.C0.ESC+"[1;3C"&&(o.key=h.C0.ESC+(f?"f":"[1;5C"))):o.key=c?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"A",f||o.key!==h.C0.ESC+"[1;3A"||(o.key=h.C0.ESC+"[1;5A")):o.key=c?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(s.metaKey)break;e?(o.key=h.C0.ESC+"[1;"+(e+1)+"B",f||o.key!==h.C0.ESC+"[1;3B"||(o.key=h.C0.ESC+"[1;5B")):o.key=c?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:s.shiftKey||s.ctrlKey||(o.key=h.C0.ESC+"[2~");break;case 46:o.key=e?h.C0.ESC+"[3;"+(e+1)+"~":h.C0.ESC+"[3~";break;case 36:o.key=e?h.C0.ESC+"[1;"+(e+1)+"H":c?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:o.key=e?h.C0.ESC+"[1;"+(e+1)+"F":c?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:s.shiftKey?o.type=2:s.ctrlKey?o.key=h.C0.ESC+"[5;"+(e+1)+"~":o.key=h.C0.ESC+"[5~";break;case 34:s.shiftKey?o.type=3:s.ctrlKey?o.key=h.C0.ESC+"[6;"+(e+1)+"~":o.key=h.C0.ESC+"[6~";break;case 112:o.key=e?h.C0.ESC+"[1;"+(e+1)+"P":h.C0.ESC+"OP";break;case 113:o.key=e?h.C0.ESC+"[1;"+(e+1)+"Q":h.C0.ESC+"OQ";break;case 114:o.key=e?h.C0.ESC+"[1;"+(e+1)+"R":h.C0.ESC+"OR";break;case 115:o.key=e?h.C0.ESC+"[1;"+(e+1)+"S":h.C0.ESC+"OS";break;case 116:o.key=e?h.C0.ESC+"[15;"+(e+1)+"~":h.C0.ESC+"[15~";break;case 117:o.key=e?h.C0.ESC+"[17;"+(e+1)+"~":h.C0.ESC+"[17~";break;case 118:o.key=e?h.C0.ESC+"[18;"+(e+1)+"~":h.C0.ESC+"[18~";break;case 119:o.key=e?h.C0.ESC+"[19;"+(e+1)+"~":h.C0.ESC+"[19~";break;case 120:o.key=e?h.C0.ESC+"[20;"+(e+1)+"~":h.C0.ESC+"[20~";break;case 121:o.key=e?h.C0.ESC+"[21;"+(e+1)+"~":h.C0.ESC+"[21~";break;case 122:o.key=e?h.C0.ESC+"[23;"+(e+1)+"~":h.C0.ESC+"[23~";break;case 123:o.key=e?h.C0.ESC+"[24;"+(e+1)+"~":h.C0.ESC+"[24~";break;default:if(!s.ctrlKey||s.shiftKey||s.altKey||s.metaKey)if(f&&!g||!s.altKey||s.metaKey)!f||s.altKey||s.ctrlKey||s.shiftKey||!s.metaKey?s.key&&!s.ctrlKey&&!s.altKey&&!s.metaKey&&s.keyCode>=48&&s.key.length===1?o.key=s.key:s.key&&s.ctrlKey&&(s.key==="_"&&(o.key=h.C0.US),s.key==="@"&&(o.key=h.C0.NUL)):s.keyCode===65&&(o.type=1);else{const r=l[s.keyCode],i=r?.[s.shiftKey?1:0];if(i)o.key=h.C0.ESC+i;else if(s.keyCode>=65&&s.keyCode<=90){const n=s.ctrlKey?s.keyCode-64:s.keyCode+32;let _=String.fromCharCode(n);s.shiftKey&&(_=_.toUpperCase()),o.key=h.C0.ESC+_}else if(s.keyCode===32)o.key=h.C0.ESC+(s.ctrlKey?h.C0.NUL:" ");else if(s.key==="Dead"&&s.code.startsWith("Key")){let n=s.code.slice(3,4);s.shiftKey||(n=n.toLowerCase()),o.key=h.C0.ESC+n,o.cancel=!0}}else s.keyCode>=65&&s.keyCode<=90?o.key=String.fromCharCode(s.keyCode-64):s.keyCode===32?o.key=h.C0.NUL:s.keyCode>=51&&s.keyCode<=55?o.key=String.fromCharCode(s.keyCode-51+27):s.keyCode===56?o.key=h.C0.DEL:s.keyCode===219?o.key=h.C0.ESC:s.keyCode===220?o.key=h.C0.FS:s.keyCode===221&&(o.key=h.C0.GS)}return o}},482:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,h=0,l=a.length){let s="";for(let c=h;c<l;++c){let f=a[c];f>65535?(f-=65536,s+=String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):s+=String.fromCharCode(f)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,h){const l=a.length;if(!l)return 0;let s=0,c=0;if(this._interim){const f=a.charCodeAt(c++);56320<=f&&f<=57343?h[s++]=1024*(this._interim-55296)+f-56320+65536:(h[s++]=this._interim,h[s++]=f),this._interim=0}for(let f=c;f<l;++f){const g=a.charCodeAt(f);if(55296<=g&&g<=56319){if(++f>=l)return this._interim=g,s;const o=a.charCodeAt(f);56320<=o&&o<=57343?h[s++]=1024*(g-55296)+o-56320+65536:(h[s++]=g,h[s++]=o)}else g!==65279&&(h[s++]=g)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,h){const l=a.length;if(!l)return 0;let s,c,f,g,o=0,e=0,r=0;if(this.interim[0]){let _=!1,p=this.interim[0];p&=(224&p)==192?31:(240&p)==224?15:7;let u,m=0;for(;(u=63&this.interim[++m])&&m<4;)p<<=6,p|=u;const d=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,v=d-m;for(;r<v;){if(r>=l)return 0;if(u=a[r++],(192&u)!=128){r--,_=!0;break}this.interim[m++]=u,p<<=6,p|=63&u}_||(d===2?p<128?r--:h[o++]=p:d===3?p<2048||p>=55296&&p<=57343||p===65279||(h[o++]=p):p<65536||p>1114111||(h[o++]=p)),this.interim.fill(0)}const i=l-4;let n=r;for(;n<l;){for(;!(!(n<i)||128&(s=a[n])||128&(c=a[n+1])||128&(f=a[n+2])||128&(g=a[n+3]));)h[o++]=s,h[o++]=c,h[o++]=f,h[o++]=g,n+=4;if(s=a[n++],s<128)h[o++]=s;else if((224&s)==192){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(e=(31&s)<<6|63&c,e<128){n--;continue}h[o++]=e}else if((240&s)==224){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(f=a[n++],(192&f)!=128){n--;continue}if(e=(15&s)<<12|(63&c)<<6|63&f,e<2048||e>=55296&&e<=57343||e===65279)continue;h[o++]=e}else if((248&s)==240){if(n>=l)return this.interim[0]=s,o;if(c=a[n++],(192&c)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,o;if(f=a[n++],(192&f)!=128){n--;continue}if(n>=l)return this.interim[0]=s,this.interim[1]=c,this.interim[2]=f,o;if(g=a[n++],(192&g)!=128){n--;continue}if(e=(7&s)<<18|(63&c)<<12|(63&f)<<6|63&g,e<65536||e>1114111)continue;h[o++]=e}}return o}}},225:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const h=a(1480),l=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],s=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let c;t.UnicodeV6=class{constructor(){if(this.version="6",!c){c=new Uint8Array(65536),c.fill(1),c[0]=0,c.fill(0,1,32),c.fill(0,127,160),c.fill(2,4352,4448),c[9001]=2,c[9002]=2,c.fill(2,11904,42192),c[12351]=1,c.fill(2,44032,55204),c.fill(2,63744,64256),c.fill(2,65040,65050),c.fill(2,65072,65136),c.fill(2,65280,65377),c.fill(2,65504,65511);for(let f=0;f<l.length;++f)c.fill(0,l[f][0],l[f][1]+1)}}wcwidth(f){return f<32?0:f<127?1:f<65536?c[f]:(function(g,o){let e,r=0,i=o.length-1;if(g<o[0][0]||g>o[i][1])return!1;for(;i>=r;)if(e=r+i>>1,g>o[e][1])r=e+1;else{if(!(g<o[e][0]))return!0;i=e-1}return!1})(f,s)?0:f>=131072&&f<=196605||f>=196608&&f<=262141?2:1}charProperties(f,g){let o=this.wcwidth(f),e=o===0&&g!==0;if(e){const r=h.UnicodeService.extractWidth(g);r===0?e=!1:r>o&&(o=r)}return h.UnicodeService.createPropertyValue(0,o,e)}}},5981:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const h=a(8460),l=a(844);class s extends l.Disposable{constructor(f){super(),this._action=f,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(f,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(f,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+=f.length,this._writeBuffer.push(f),this._callbacks.push(g),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(g)}_innerWrite(f=0,g=!0){const o=f||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],r=this._action(e,g);if(r){const n=_=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(o,_);return void r.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(n)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-o>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=s},5941:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function l(s,c){const f=s.toString(16),g=f.length<2?"0"+f:f;switch(c){case 4:return f[0];case 8:return g;case 12:return(g+g).slice(0,3);default:return g+g}}t.parseColor=function(s){if(!s)return;let c=s.toLowerCase();if(c.indexOf("rgb:")===0){c=c.slice(4);const f=a.exec(c);if(f){const g=f[1]?15:f[4]?255:f[7]?4095:65535;return[Math.round(parseInt(f[1]||f[4]||f[7]||f[10],16)/g*255),Math.round(parseInt(f[2]||f[5]||f[8]||f[11],16)/g*255),Math.round(parseInt(f[3]||f[6]||f[9]||f[12],16)/g*255)]}}else if(c.indexOf("#")===0&&(c=c.slice(1),h.exec(c)&&[3,6,9,12].includes(c.length))){const f=c.length/3,g=[0,0,0];for(let o=0;o<3;++o){const e=parseInt(c.slice(f*o,f*o+f),16);g[o]=f===1?e<<4:f===2?e:f===3?e>>4:e>>8}return g}},t.toRgbString=function(s,c=16){const[f,g,o]=s;return`rgb:${l(f,c)}/${l(g,c)}/${l(o,c)}`}},5770:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const h=a(482),l=a(8742),s=a(5770),c=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=c,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}registerHandler(g,o){this._handlers[g]===void 0&&(this._handlers[g]=[]);const e=this._handlers[g];return e.push(o),{dispose:()=>{const r=e.indexOf(o);r!==-1&&e.splice(r,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=c,this._ident=0}hook(g,o){if(this.reset(),this._ident=g,this._active=this._handlers[g]||c,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(g,o,e){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(g,o,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(g,o,e))}unhook(g,o=!0){if(this._active.length){let e=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,e=o,i=this._stack.fallThrough,this._stack.paused=!1),!i&&e===!1){for(;r>=0&&(e=this._active[r].unhook(g),e!==!0);r--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,e;r--}for(;r>=0;r--)if(e=this._active[r].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",g);this._active=c,this._ident=0}};const f=new l.Params;f.addParam(0),t.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=f,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():f,this._data="",this._hitLimit=!1}put(g,o,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(g,o,e),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let o=!1;if(this._hitLimit)o=!1;else if(g&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then((e=>(this._params=f,this._data="",this._hitLimit=!1,e)));return this._params=f,this._data="",this._hitLimit=!1,o}}},2015:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const h=a(844),l=a(8742),s=a(6242),c=a(6351);class f{constructor(r){this.table=new Uint8Array(r)}setDefault(r,i){this.table.fill(r<<4|i)}add(r,i,n,_){this.table[i<<8|r]=n<<4|_}addMany(r,i,n,_){for(let p=0;p<r.length;p++)this.table[i<<8|r[p]]=n<<4|_}}t.TransitionTable=f;const g=160;t.VT500_TRANSITION_TABLE=(function(){const e=new f(4095),r=Array.apply(null,Array(256)).map(((m,d)=>d)),i=(m,d)=>r.slice(m,d),n=i(32,127),_=i(0,24);_.push(25),_.push.apply(_,i(28,32));const p=i(0,14);let u;for(u in e.setDefault(1,0),e.addMany(n,0,2,0),p)e.addMany([24,26,153,154],u,3,0),e.addMany(i(128,144),u,3,0),e.addMany(i(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(_,0,3,0),e.addMany(_,1,3,1),e.add(127,1,0,1),e.addMany(_,8,0,8),e.addMany(_,3,3,3),e.add(127,3,0,3),e.addMany(_,4,3,4),e.add(127,4,0,4),e.addMany(_,6,3,6),e.addMany(_,5,3,5),e.add(127,5,0,5),e.addMany(_,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(_,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(_,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(_,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(_,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(_,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(_,13,13,13),e.addMany(n,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 o extends h.Disposable{constructor(r=t.VT500_TRANSITION_TABLE){super(),this._transitions=r,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,_)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new s.OscParser),this._dcsParser=this.register(new c.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(r,i=[64,126]){let n=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=r.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let p=0;p<r.intermediates.length;++p){const u=r.intermediates.charCodeAt(p);if(32>u||u>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=u}}if(r.final.length!==1)throw new Error("final must be a single byte");const _=r.final.charCodeAt(0);if(i[0]>_||_>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=_,n}identToString(r){const i=[];for(;r;)i.push(String.fromCharCode(255&r)),r>>=8;return i.reverse().join("")}setPrintHandler(r){this._printHandler=r}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(r,i){const n=this._identifier(r,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);const _=this._escHandlers[n];return _.push(i),{dispose:()=>{const p=_.indexOf(i);p!==-1&&_.splice(p,1)}}}clearEscHandler(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]}setEscHandlerFallback(r){this._escHandlerFb=r}setExecuteHandler(r,i){this._executeHandlers[r.charCodeAt(0)]=i}clearExecuteHandler(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]}setExecuteHandlerFallback(r){this._executeHandlerFb=r}registerCsiHandler(r,i){const n=this._identifier(r);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);const _=this._csiHandlers[n];return _.push(i),{dispose:()=>{const p=_.indexOf(i);p!==-1&&_.splice(p,1)}}}clearCsiHandler(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]}setCsiHandlerFallback(r){this._csiHandlerFb=r}registerDcsHandler(r,i){return this._dcsParser.registerHandler(this._identifier(r),i)}clearDcsHandler(r){this._dcsParser.clearHandler(this._identifier(r))}setDcsHandlerFallback(r){this._dcsParser.setHandlerFallback(r)}registerOscHandler(r,i){return this._oscParser.registerHandler(r,i)}clearOscHandler(r){this._oscParser.clearHandler(r)}setOscHandlerFallback(r){this._oscParser.setHandlerFallback(r)}setErrorHandler(r){this._errorHandler=r}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(r,i,n,_,p){this._parseStack.state=r,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=_,this._parseStack.chunkPos=p}parse(r,i,n){let _,p=0,u=0,m=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,m=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const d=this._parseStack.handlers;let v=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&v>-1){for(;v>=0&&(_=d[v](this._params),_!==!0);v--)if(_ instanceof Promise)return this._parseStack.handlerPos=v,_}this._parseStack.handlers=[];break;case 4:if(n===!1&&v>-1){for(;v>=0&&(_=d[v](),_!==!0);v--)if(_ instanceof Promise)return this._parseStack.handlerPos=v,_}this._parseStack.handlers=[];break;case 6:if(p=r[this._parseStack.chunkPos],_=this._dcsParser.unhook(p!==24&&p!==26,n),_)return _;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(p=r[this._parseStack.chunkPos],_=this._oscParser.end(p!==24&&p!==26,n),_)return _;p===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,m=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let d=m;d<i;++d){switch(p=r[d],u=this._transitions.table[this.currentState<<8|(p<160?p:g)],u>>4){case 2:for(let w=d+1;;++w){if(w>=i||(p=r[w])<32||p>126&&p<g){this._printHandler(r,d,w),d=w-1;break}if(++w>=i||(p=r[w])<32||p>126&&p<g){this._printHandler(r,d,w),d=w-1;break}if(++w>=i||(p=r[w])<32||p>126&&p<g){this._printHandler(r,d,w),d=w-1;break}if(++w>=i||(p=r[w])<32||p>126&&p<g){this._printHandler(r,d,w),d=w-1;break}}break;case 3:this._executeHandlers[p]?this._executeHandlers[p]():this._executeHandlerFb(p),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:p,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const v=this._csiHandlers[this._collect<<8|p];let S=v?v.length-1:-1;for(;S>=0&&(_=v[S](this._params),_!==!0);S--)if(_ instanceof Promise)return this._preserveStack(3,v,S,u,d),_;S<0&&this._csiHandlerFb(this._collect<<8|p,this._params),this.precedingJoinState=0;break;case 8:do switch(p){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(p-48)}while(++d<i&&(p=r[d])>47&&p<60);d--;break;case 9:this._collect<<=8,this._collect|=p;break;case 10:const y=this._escHandlers[this._collect<<8|p];let b=y?y.length-1:-1;for(;b>=0&&(_=y[b](),_!==!0);b--)if(_ instanceof Promise)return this._preserveStack(4,y,b,u,d),_;b<0&&this._escHandlerFb(this._collect<<8|p),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|p,this._params);break;case 13:for(let w=d+1;;++w)if(w>=i||(p=r[w])===24||p===26||p===27||p>127&&p<g){this._dcsParser.put(r,d,w),d=w-1;break}break;case 14:if(_=this._dcsParser.unhook(p!==24&&p!==26),_)return this._preserveStack(6,[],0,u,d),_;p===27&&(u|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let w=d+1;;w++)if(w>=i||(p=r[w])<32||p>127&&p<g){this._oscParser.put(r,d,w),d=w-1;break}break;case 6:if(_=this._oscParser.end(p!==24&&p!==26),_)return this._preserveStack(5,[],0,u,d),_;p===27&&(u|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&u}}}t.EscapeSequenceParser=o},6242:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const h=a(5770),l=a(482),s=[];t.OscParser=class{constructor(){this._state=0,this._active=s,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(c,f){this._handlers[c]===void 0&&(this._handlers[c]=[]);const g=this._handlers[c];return g.push(f),{dispose:()=>{const o=g.indexOf(f);o!==-1&&g.splice(o,1)}}}clearHandler(c){this._handlers[c]&&delete this._handlers[c]}setHandlerFallback(c){this._handlerFb=c}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=s}reset(){if(this._state===2)for(let c=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;c>=0;--c)this._active[c].end(!1);this._stack.paused=!1,this._active=s,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||s,this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].start();else this._handlerFb(this._id,"START")}_put(c,f,g){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(c,f,g);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(c,f,g))}start(){this.reset(),this._state=1}put(c,f,g){if(this._state!==3){if(this._state===1)for(;f<g;){const o=c[f++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&g-f>0&&this._put(c,f,g)}}end(c,f=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,o=this._active.length-1,e=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,g=f,e=this._stack.fallThrough,this._stack.paused=!1),!e&&g===!1){for(;o>=0&&(g=this._active[o].end(c),g!==!0);o--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,g;o--}for(;o>=0;o--)if(g=this._active[o].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",c);this._active=s,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(c){this._handler=c,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(c,f,g){this._hitLimit||(this._data+=(0,l.utf32ToString)(c,f,g),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(c){let f=!1;if(this._hitLimit)f=!1;else if(c&&(f=this._handler(this._data),f instanceof Promise))return f.then((g=>(this._data="",this._hitLimit=!1,g)));return this._data="",this._hitLimit=!1,f}}},8742:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const a=2147483647;class h{static fromArray(s){const c=new h;if(!s.length)return c;for(let f=Array.isArray(s[0])?1:0;f<s.length;++f){const g=s[f];if(Array.isArray(g))for(let o=0;o<g.length;++o)c.addSubParam(g[o]);else c.addParam(g)}return c}constructor(s=32,c=32){if(this.maxLength=s,this.maxSubParamsLength=c,c>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(s),this.length=0,this._subParams=new Int32Array(c),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(s),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const s=new h(this.maxLength,this.maxSubParamsLength);return s.params.set(this.params),s.length=this.length,s._subParams.set(this._subParams),s._subParamsLength=this._subParamsLength,s._subParamsIdx.set(this._subParamsIdx),s._rejectDigits=this._rejectDigits,s._rejectSubDigits=this._rejectSubDigits,s._digitIsSub=this._digitIsSub,s}toArray(){const s=[];for(let c=0;c<this.length;++c){s.push(this.params[c]);const f=this._subParamsIdx[c]>>8,g=255&this._subParamsIdx[c];g-f>0&&s.push(Array.prototype.slice.call(this._subParams,f,g))}return s}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(s){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=s>a?a:s}}addSubParam(s){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(s<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=s>a?a:s,this._subParamsIdx[this.length-1]++}}hasSubParams(s){return(255&this._subParamsIdx[s])-(this._subParamsIdx[s]>>8)>0}getSubParams(s){const c=this._subParamsIdx[s]>>8,f=255&this._subParamsIdx[s];return f-c>0?this._subParams.subarray(c,f):null}getSubParamsAll(){const s={};for(let c=0;c<this.length;++c){const f=this._subParamsIdx[c]>>8,g=255&this._subParamsIdx[c];g-f>0&&(s[c]=this._subParams.slice(f,g))}return s}addDigit(s){let c;if(this._rejectDigits||!(c=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const f=this._digitIsSub?this._subParams:this.params,g=f[c-1];f[c-1]=~g?Math.min(10*g+s,a):s}}t.Params=h},5741:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,h){const l={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(l),h.dispose=()=>this._wrappedAddonDispose(l),h.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let h=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===a){h=l;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(h,1)}}},8771:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const h=a(3785),l=a(511);t.BufferApiView=class{constructor(s,c){this._buffer=s,this.type=c}init(s){return this._buffer=s,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(s){const c=this._buffer.lines.get(s);if(c)return new h.BufferLineApiView(c)}getNullCell(){return new l.CellData}}},3785:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const h=a(511);t.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,s){if(!(l<0||l>=this._line.length))return s?(this._line.loadCell(l,s),s):this._line.loadCell(l,new h.CellData)}translateToString(l,s,c){return this._line.translateToString(l,s,c)}}},8285:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const h=a(8771),l=a(8460),s=a(844);class c extends s.Disposable{constructor(g){super(),this._core=g,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=c},7975:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,h){return this._core.registerCsiHandler(a,(l=>h(l.toArray())))}addCsiHandler(a,h){return this.registerCsiHandler(a,h)}registerDcsHandler(a,h){return this._core.registerDcsHandler(a,((l,s)=>h(l,s.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:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,n){var _,p=arguments.length,u=p<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,i,n);else for(var m=e.length-1;m>=0;m--)(_=e[m])&&(u=(p<3?_(u):p>3?_(r,i,u):_(r,i))||u);return p>3&&u&&Object.defineProperty(r,i,u),u},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const s=a(8460),c=a(844),f=a(5295),g=a(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let o=t.BufferService=class extends c.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new s.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new f.BufferSet(e,this))}resize(e,r){this.cols=e,this.rows=r,this.buffers.resize(e,r),this._onResize.fire({cols:e,rows:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,r=!1){const i=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=i.getBlankLine(e,r),this._cachedBlankLine=n),n.isWrapped=r;const _=i.ybase+i.scrollTop,p=i.ybase+i.scrollBottom;if(i.scrollTop===0){const u=i.lines.isFull;p===i.lines.length-1?u?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(p+1,0,n.clone()),u?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const u=p-_+1;i.lines.shiftElements(_+1,u-1,-1),i.lines.set(p,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,r,i){const n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const _=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),_!==n.ydisp&&(r||this._onScroll.fire(n.ydisp))}};t.BufferService=o=h([l(0,g.IOptionsService)],o)},7994:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,h){this._charsets[a]=h,this.glevel===a&&(this.charset=h)}}},1753:function(M,t,a){var h=this&&this.__decorate||function(n,_,p,u){var m,d=arguments.length,v=d<3?_:u===null?u=Object.getOwnPropertyDescriptor(_,p):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(n,_,p,u);else for(var S=n.length-1;S>=0;S--)(m=n[S])&&(v=(d<3?m(v):d>3?m(_,p,v):m(_,p))||v);return d>3&&v&&Object.defineProperty(_,p,v),v},l=this&&this.__param||function(n,_){return function(p,u){_(p,u,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const s=a(2585),c=a(8460),f=a(844),g={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:n=>n.button!==4&&n.action===1&&(n.ctrl=!1,n.alt=!1,n.shift=!1,!0)},VT200:{events:19,restrict:n=>n.action!==32},DRAG:{events:23,restrict:n=>n.action!==32||n.button!==3},ANY:{events:31,restrict:n=>!0}};function o(n,_){let p=(n.ctrl?16:0)|(n.shift?4:0)|(n.alt?8:0);return n.button===4?(p|=64,p|=n.action):(p|=3&n.button,4&n.button&&(p|=64),8&n.button&&(p|=128),n.action===32?p|=32:n.action!==0||_||(p|=3)),p}const e=String.fromCharCode,r={DEFAULT:n=>{const _=[o(n,!1)+32,n.col+32,n.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${e(_[0])}${e(_[1])}${e(_[2])}`},SGR:n=>{const _=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.col};${n.row}${_}`},SGR_PIXELS:n=>{const _=n.action===0&&n.button!==4?"m":"M";return`\x1B[<${o(n,!0)};${n.x};${n.y}${_}`}};let i=t.CoreMouseService=class extends f.Disposable{constructor(n,_){super(),this._bufferService=n,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new c.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const p of Object.keys(g))this.addProtocol(p,g[p]);for(const p of Object.keys(r))this.addEncoding(p,r[p]);this.reset()}addProtocol(n,_){this._protocols[n]=_}addEncoding(n,_){this._encodings[n]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(n){if(!this._protocols[n])throw new Error(`unknown protocol "${n}"`);this._activeProtocol=n,this._onProtocolChange.fire(this._protocols[n].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(n){if(!this._encodings[n])throw new Error(`unknown encoding "${n}"`);this._activeEncoding=n}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(n){if(n.col<0||n.col>=this._bufferService.cols||n.row<0||n.row>=this._bufferService.rows||n.button===4&&n.action===32||n.button===3&&n.action!==32||n.button!==4&&(n.action===2||n.action===3)||(n.col++,n.row++,n.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,n,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(n))return!1;const _=this._encodings[this._activeEncoding](n);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=n,!0}explainEvents(n){return{down:!!(1&n),up:!!(2&n),drag:!!(4&n),move:!!(8&n),wheel:!!(16&n)}}_equalEvents(n,_,p){if(p){if(n.x!==_.x||n.y!==_.y)return!1}else if(n.col!==_.col||n.row!==_.row)return!1;return n.button===_.button&&n.action===_.action&&n.ctrl===_.ctrl&&n.alt===_.alt&&n.shift===_.shift}};t.CoreMouseService=i=h([l(0,s.IBufferService),l(1,s.ICoreService)],i)},6975:function(M,t,a){var h=this&&this.__decorate||function(i,n,_,p){var u,m=arguments.length,d=m<3?n:p===null?p=Object.getOwnPropertyDescriptor(n,_):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(i,n,_,p);else for(var v=i.length-1;v>=0;v--)(u=i[v])&&(d=(m<3?u(d):m>3?u(n,_,d):u(n,_))||d);return m>3&&d&&Object.defineProperty(n,_,d),d},l=this&&this.__param||function(i,n){return function(_,p){n(_,p,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const s=a(1439),c=a(8460),f=a(844),g=a(2585),o=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let r=t.CoreService=class extends f.Disposable{constructor(i,n,_){super(),this._bufferService=i,this._logService=n,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new c.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new c.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new c.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new c.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}reset(){this.modes=(0,s.clone)(o),this.decPrivateModes=(0,s.clone)(e)}triggerDataEvent(i,n=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,(()=>i.split("").map((p=>p.charCodeAt(0))))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,(()=>i.split("").map((n=>n.charCodeAt(0))))),this._onBinary.fire(i))}};t.CoreService=r=h([l(0,g.IBufferService),l(1,g.ILogService),l(2,g.IOptionsService)],r)},9074:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const h=a(8055),l=a(8460),s=a(844),c=a(6106);let f=0,g=0;class o extends s.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new c.SortedList((i=>i?.marker.line)),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,s.toDisposable)((()=>this.reset())))}registerDecoration(i){if(i.marker.isDisposed)return;const n=new e(i);if(n){const _=n.marker.onDispose((()=>n.dispose()));n.onDispose((()=>{n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),_.dispose())})),this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,n,_){let p=0,u=0;for(const m of this._decorations.getKeyIterator(n))p=m.options.x??0,u=p+(m.options.width??1),i>=p&&i<u&&(!_||(m.options.layer??"bottom")===_)&&(yield m)}forEachDecorationAtCell(i,n,_,p){this._decorations.forEachByKey(n,(u=>{f=u.options.x??0,g=f+(u.options.width??1),i>=f&&i<g&&(!_||(u.options.layer??"bottom")===_)&&p(u)}))}}t.DecorationService=o;class e extends s.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=h.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=h.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const h=a(2585),l=a(8343);class s{constructor(...f){this._entries=new Map;for(const[g,o]of f)this.set(g,o)}set(f,g){const o=this._entries.get(f);return this._entries.set(f,g),o}forEach(f){for(const[g,o]of this._entries.entries())f(g,o)}has(f){return this._entries.has(f)}get(f){return this._entries.get(f)}}t.ServiceCollection=s,t.InstantiationService=class{constructor(){this._services=new s,this._services.set(h.IInstantiationService,this)}setService(c,f){this._services.set(c,f)}getService(c){return this._services.get(c)}createInstance(c,...f){const g=(0,l.getServiceDependencies)(c).sort(((r,i)=>r.index-i.index)),o=[];for(const r of g){const i=this._services.get(r.id);if(!i)throw new Error(`[createInstance] ${c.name} depends on UNKNOWN service ${r.id}.`);o.push(i)}const e=g.length>0?g[0].index:f.length;if(f.length!==e)throw new Error(`[createInstance] First service dependency of ${c.name} at position ${e+1} conflicts with ${f.length} static arguments`);return new c(...f,...o)}}},7866:function(M,t,a){var h=this&&this.__decorate||function(e,r,i,n){var _,p=arguments.length,u=p<3?r:n===null?n=Object.getOwnPropertyDescriptor(r,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,r,i,n);else for(var m=e.length-1;m>=0;m--)(_=e[m])&&(u=(p<3?_(u):p>3?_(r,i,u):_(r,i))||u);return p>3&&u&&Object.defineProperty(r,i,u),u},l=this&&this.__param||function(e,r){return function(i,n){r(i,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const s=a(844),c=a(2585),f={trace:c.LogLevelEnum.TRACE,debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let g,o=t.LogService=class extends s.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),g=this}_updateLogLevel(){this._logLevel=f[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let r=0;r<e.length;r++)typeof e[r]=="function"&&(e[r]=e[r]())}_log(e,r,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+r,...i)}trace(e,...r){this._logLevel<=c.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,r)}debug(e,...r){this._logLevel<=c.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,r)}info(e,...r){this._logLevel<=c.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,r)}warn(e,...r){this._logLevel<=c.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,r)}error(e,...r){this._logLevel<=c.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,r)}};t.LogService=o=h([l(0,c.IOptionsService)],o),t.setTraceLogger=function(e){g=e},t.traceCall=function(e,r,i){if(typeof i.value!="function")throw new Error("not supported");const n=i.value;i.value=function(..._){if(g.logLevel!==c.LogLevelEnum.TRACE)return n.apply(this,_);g.trace(`GlyphRenderer#${n.name}(${_.map((u=>JSON.stringify(u))).join(", ")})`);const p=n.apply(this,_);return g.trace(`GlyphRenderer#${n.name} return`,p),p}}},7302:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const h=a(8460),l=a(844),s=a(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:s.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];class f extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...t.DEFAULT_OPTIONS};for(const r in o)if(r in e)try{const i=o[r];e[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,l.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(o,e){return this.onOptionChange((r=>{r===o&&e(this.rawOptions[o])}))}onMultipleOptionChange(o,e){return this.onOptionChange((r=>{o.indexOf(r)!==-1&&e()}))}_setupOptions(){const o=r=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},e=(r,i)=>{if(!(r in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(const r in this.rawOptions){const i={get:o.bind(this,r),set:e.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(o,e){switch(o){case"cursorStyle":if(e||(e=t.DEFAULT_OPTIONS[o]),!(function(r){return r==="block"||r==="underline"||r==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${o}`);break;case"wordSeparator":e||(e=t.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=c.includes(e)?e:t.DEFAULT_OPTIONS[o];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${o} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${o} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}t.OptionsService=f},2660:function(M,t,a){var h=this&&this.__decorate||function(f,g,o,e){var r,i=arguments.length,n=i<3?g:e===null?e=Object.getOwnPropertyDescriptor(g,o):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(f,g,o,e);else for(var _=f.length-1;_>=0;_--)(r=f[_])&&(n=(i<3?r(n):i>3?r(g,o,n):r(g,o))||n);return i>3&&n&&Object.defineProperty(g,o,n),n},l=this&&this.__param||function(f,g){return function(o,e){g(o,e,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const s=a(2585);let c=t.OscLinkService=class{constructor(f){this._bufferService=f,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(f){const g=this._bufferService.buffer;if(f.id===void 0){const _=g.addMarker(g.ybase+g.y),p={data:f,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(p,_))),this._dataByLinkId.set(p.id,p),p.id}const o=f,e=this._getEntryIdKey(o),r=this._entriesWithId.get(e);if(r)return this.addLineToLink(r.id,g.ybase+g.y),r.id;const i=g.addMarker(g.ybase+g.y),n={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(n,i))),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(f,g){const o=this._dataByLinkId.get(f);if(o&&o.lines.every((e=>e.line!==g))){const e=this._bufferService.buffer.addMarker(g);o.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(o,e)))}}getLinkData(f){return this._dataByLinkId.get(f)?.data}_getEntryIdKey(f){return`${f.id};;${f.uri}`}_removeMarkerFromLink(f,g){const o=f.lines.indexOf(g);o!==-1&&(f.lines.splice(o,1),f.lines.length===0&&(f.data.id!==void 0&&this._entriesWithId.delete(f.key),this._dataByLinkId.delete(f.id)))}};t.OscLinkService=c=h([l(0,s.IBufferService)],c)},8343:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",h="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(l){return l[h]||[]},t.createDecorator=function(l){if(t.serviceRegistry.has(l))return t.serviceRegistry.get(l);const s=function(c,f,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,r){e[a]===e?e[h].push({id:o,index:r}):(e[h]=[{id:o,index:r}],e[a]=e)})(s,c,g)};return s.toString=()=>l,t.serviceRegistry.set(l,s),s}},2585:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const h=a(8343);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(s){s[s.TRACE=0]="TRACE",s[s.DEBUG=1]="DEBUG",s[s.INFO=2]="INFO",s[s.WARN=3]="WARN",s[s.ERROR=4]="ERROR",s[s.OFF=5]="OFF"})(l||(t.LogLevelEnum=l={})),t.ILogService=(0,h.createDecorator)("LogService"),t.IOptionsService=(0,h.createDecorator)("OptionsService"),t.IOscLinkService=(0,h.createDecorator)("OscLinkService"),t.IUnicodeService=(0,h.createDecorator)("UnicodeService"),t.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const h=a(8460),l=a(225);class s{static extractShouldJoin(f){return(1&f)!=0}static extractWidth(f){return f>>1&3}static extractCharKind(f){return f>>3}static createPropertyValue(f,g,o=!1){return(16777215&f)<<3|(3&g)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const f=new l.UnicodeV6;this.register(f),this._active=f.version,this._activeProvider=f}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(f){if(!this._providers[f])throw new Error(`unknown Unicode version "${f}"`);this._active=f,this._activeProvider=this._providers[f],this._onChange.fire(f)}register(f){this._providers[f.version]=f}wcwidth(f){return this._activeProvider.wcwidth(f)}getStringCellWidth(f){let g=0,o=0;const e=f.length;for(let r=0;r<e;++r){let i=f.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=e)return g+this.wcwidth(i);const p=f.charCodeAt(r);56320<=p&&p<=57343?i=1024*(i-55296)+p-56320+65536:g+=this.wcwidth(p)}const n=this.charProperties(i,o);let _=s.extractWidth(n);s.extractShouldJoin(n)&&(_-=s.extractWidth(o)),g+=_,o=n}return g}charProperties(f,g){return this._activeProvider.charProperties(f,g)}}t.UnicodeService=s}},N={};function j(M){var t=N[M];if(t!==void 0)return t.exports;var a=N[M]={exports:{}};return k[M].call(a.exports,a,a.exports,j),a.exports}var V={};return(()=>{var M=V;Object.defineProperty(M,"__esModule",{value:!0}),M.Terminal=void 0;const t=j(9042),a=j(3236),h=j(844),l=j(5741),s=j(8285),c=j(7975),f=j(7090),g=["cols","rows"];class o extends h.Disposable{constructor(r){super(),this._core=this.register(new a.Terminal(r)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};const i=_=>this._core.options[_],n=(_,p)=>{this._checkReadonlyOptions(_),this._core.options[_]=p};for(const _ in this._core.options){const p={get:i.bind(this,_),set:n.bind(this,_)};Object.defineProperty(this._publicOptions,_,p)}}_checkReadonlyOptions(r){if(g.includes(r))throw new Error(`Option "${r}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new c.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const r=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:r.applicationCursorKeys,applicationKeypadMode:r.applicationKeypad,bracketedPasteMode:r.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:r.origin,reverseWraparoundMode:r.reverseWraparound,sendFocusMode:r.sendFocus,wraparoundMode:r.wraparound}}get options(){return this._publicOptions}set options(r){for(const i in r)this._publicOptions[i]=r[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(r,i=!0){this._core.input(r,i)}resize(r,i){this._verifyIntegers(r,i),this._core.resize(r,i)}open(r){this._core.open(r)}attachCustomKeyEventHandler(r){this._core.attachCustomKeyEventHandler(r)}attachCustomWheelEventHandler(r){this._core.attachCustomWheelEventHandler(r)}registerLinkProvider(r){return this._core.registerLinkProvider(r)}registerCharacterJoiner(r){return this._checkProposedApi(),this._core.registerCharacterJoiner(r)}deregisterCharacterJoiner(r){this._checkProposedApi(),this._core.deregisterCharacterJoiner(r)}registerMarker(r=0){return this._verifyIntegers(r),this._core.registerMarker(r)}registerDecoration(r){return this._checkProposedApi(),this._verifyPositiveIntegers(r.x??0,r.width??0,r.height??0),this._core.registerDecoration(r)}hasSelection(){return this._core.hasSelection()}select(r,i,n){this._verifyIntegers(r,i,n),this._core.select(r,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(r,i){this._verifyIntegers(r,i),this._core.selectLines(r,i)}dispose(){super.dispose()}scrollLines(r){this._verifyIntegers(r),this._core.scrollLines(r)}scrollPages(r){this._verifyIntegers(r),this._core.scrollPages(r)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(r){this._verifyIntegers(r),this._core.scrollToLine(r)}clear(){this._core.clear()}write(r,i){this._core.write(r,i)}writeln(r,i){this._core.write(r),this._core.write(`\r
66
- `,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}M.Terminal=o})(),V})()))})(Ie)),Ie.exports}var Yt=Xt();const Jt=600,Zt=350,De=8,Ce=22,Qt=40,Fe=12,pe=8,ei=50,Je=8,ti=48,ii=.95,Ze=.02,Qe=5,si=90;function ri(){return["Paste","Copy","Select All"]}function ni(){return typeof window>"u"||typeof navigator>"u"?!1:navigator.maxTouchPoints>0||"ontouchstart"in window||window.matchMedia?.("(pointer: coarse)").matches===!0}function me(z,R,k){return Math.max(R,Math.min(k,z))}function He(z,R){return Math.hypot(R.clientX-z.clientX,R.clientY-z.clientY)}function oi(z,R,k){return!k&&R-z<=Zt}function ai(z){let R=0;return{cancel:()=>{R++},schedule:k=>{const N=++R;queueMicrotask(()=>{N===R&&k()&&z()})}}}class hi{terminal;terminalContent;overlay;startHandle;endHandle;contextMenu;disposables=[];originalPosition;didSetPosition=!1;isDestroyed=!1;isSelecting=!1;isHandleDragging=!1;dragHandle=null;selectionStart=null;selectionEnd=null;touchStart=null;pendingClearTouch=null;tapHoldTimeout=null;cellDimensions={width:0,height:0};isContextMenuVisible=!1;minFontSize;maxFontSize;onFontSizeChange;onTwoFingerTap;onPaste;onTouchScrollReset;onTouchScroll;isPinching=!1;isFinishingPinch=!1;pinchStartDistance=0;twoFingerTapCandidate=null;initialFontSize=0;lastZoomTime=0;viewportElement=null;lastScrollTouchY=null;lastScrollTouchTime=0;scrollVelocity=0;inertiaFrame=null;didScrollTouch=!1;terminalFocusScheduler;constructor(R,k,N={}){this.terminal=R,this.terminalContent=k,this.originalPosition=k.style.position,this.terminalFocusScheduler=ai(()=>this.terminal.focus());const j=Number(N.minFontSize)||Je,V=Number(N.maxFontSize)||ti;this.minFontSize=Math.min(j,V),this.maxFontSize=Math.max(j,V),this.onFontSizeChange=N.onFontSizeChange??(M=>{this.terminal.options.fontSize=M,this.terminal.refresh(0,this.terminal.rows-1)}),this.onTouchScroll=N.onTouchScroll??null,this.onTouchScrollReset=N.onTouchScrollReset??(()=>{}),this.onTwoFingerTap=N.onTwoFingerTap??null,this.onPaste=N.onPaste??(()=>{}),window.getComputedStyle(k).position==="static"&&(k.style.position="relative",this.didSetPosition=!0),this.overlay=this.createSelectionOverlay(),this.startHandle=this.createHandle("start"),this.endHandle=this.createHandle("end"),this.contextMenu=this.createContextMenu(),this.overlay.append(this.startHandle,this.endHandle,this.contextMenu),this.terminalContent.appendChild(this.overlay),this.attachEventListeners(),this.updateCellDimensions()}createSelectionOverlay(){const R=document.createElement("div");return R.className="shell-mobile-selection-overlay",R.style.position="absolute",R.style.inset="0",R.style.overflow="hidden",R.style.pointerEvents="none",R.style.zIndex="30",R}createHandle(R){const k=document.createElement("div");return k.className=`shell-mobile-selection-handle shell-mobile-selection-handle-${R}`,k.dataset.handleType=R,k.style.position="absolute",k.style.width=`${Ce}px`,k.style.height=`${Ce}px`,k.style.borderRadius="50%",k.style.background="#3b82f6",k.style.border="2px solid #fff",k.style.boxShadow="0 2px 8px rgba(0,0,0,0.3)",k.style.display="none",k.style.pointerEvents="auto",k.style.touchAction="none",k.style.zIndex="31",k}createContextMenu(){const R=document.createElement("div");R.className="shell-mobile-selection-menu",R.style.position="absolute",R.style.display="none",R.style.alignItems="stretch",R.style.padding="4px",R.style.gap="2px",R.style.background="#1f2937",R.style.border="1px solid rgba(255,255,255,0.12)",R.style.borderRadius="10px",R.style.boxShadow="0 6px 20px rgba(0,0,0,0.4)",R.style.pointerEvents="auto",R.style.touchAction="none",R.style.zIndex="32",R.style.whiteSpace="nowrap",R.style.userSelect="none";const[k,N,j]=ri(),V=[{label:k,action:()=>{this.pasteFromClipboard()}},{label:N,action:()=>this.copySelection()},{label:j,action:()=>this.selectAllText()}];for(const M of V)R.appendChild(this.createContextMenuButton(M));return R}createContextMenuButton(R){const k=document.createElement("button");k.type="button",k.textContent=R.label,k.style.appearance="none",k.style.border="none",k.style.margin="0",k.style.padding="8px 14px",k.style.background="transparent",k.style.color="#f9fafb",k.style.fontSize="14px",k.style.fontFamily="inherit",k.style.lineHeight="1",k.style.borderRadius="6px",k.style.cursor="pointer",k.style.pointerEvents="auto",k.style.touchAction="none";let N=!1;const j=M=>{M.preventDefault(),M.stopPropagation(),N=!1},V=M=>{M.preventDefault(),M.stopPropagation(),!N&&(N=!0,R.action())};return k.addEventListener("touchstart",j,{passive:!1}),k.addEventListener("touchend",V,{passive:!1}),k.addEventListener("mousedown",j),k.addEventListener("mouseup",V),k.addEventListener("click",M=>{M.preventDefault(),M.stopPropagation()}),k}attachEventListeners(){this.terminal.element&&(this.terminalContent.addEventListener("touchstart",this.onTerminalTouchStart,{capture:!0,passive:!1}),this.terminalContent.addEventListener("touchmove",this.onTerminalTouchMove,{capture:!0,passive:!1}),this.terminalContent.addEventListener("touchend",this.onTerminalTouchEnd,{capture:!0,passive:!1}),this.terminalContent.addEventListener("touchcancel",this.onTerminalTouchCancel,{capture:!0,passive:!1}),this.startHandle.addEventListener("touchstart",this.onHandleTouchStart,{passive:!1}),this.startHandle.addEventListener("touchmove",this.onHandleTouchMove,{passive:!1}),this.startHandle.addEventListener("touchend",this.onHandleTouchEnd,{passive:!1}),this.startHandle.addEventListener("touchcancel",this.onHandleTouchEnd,{passive:!1}),this.endHandle.addEventListener("touchstart",this.onHandleTouchStart,{passive:!1}),this.endHandle.addEventListener("touchmove",this.onHandleTouchMove,{passive:!1}),this.endHandle.addEventListener("touchend",this.onHandleTouchEnd,{passive:!1}),this.endHandle.addEventListener("touchcancel",this.onHandleTouchEnd,{passive:!1}),document.addEventListener("touchstart",this.onDocumentTouchStart,{passive:!0}),this.disposables.push(this.terminal.onSelectionChange(this.onSelectionChange),this.terminal.onResize(this.onTerminalResize),this.terminal.onScroll(this.onTerminalScroll)))}onTerminalTouchStart=R=>{if(!this.isTerminalTouchEvent(R))return;if(this.cancelPendingTerminalFocus(),this.onTouchScroll&&(R.stopPropagation(),this.onTouchScrollReset()),this.cancelInertia(),this.resetScrollTracking(),this.didScrollTouch=!1,R.touches.length===2){R.preventDefault(),this.startPinchZoom(R);return}if(R.touches.length!==1){this.clearTapHoldTimeout();return}const k=this.toTouchCoords(R.touches[0]);if(this.touchStart=k,this.lastScrollTouchY=k.clientY,this.lastScrollTouchTime=performance.now(),this.isSelecting){this.pendingClearTouch={point:k,moved:!1};return}this.clearTapHoldTimeout(),this.tapHoldTimeout=window.setTimeout(()=>{this.tapHoldTimeout=null,this.startSelection(k)},Jt)};onTerminalTouchMove=R=>{if(!this.isTerminalTouchEvent(R))return;if(this.isFinishingPinch){R.preventDefault();return}if(R.touches.length===2&&this.isPinching){R.preventDefault(),this.onTouchScroll&&R.stopPropagation(),this.handlePinchZoom(R);return}if(R.touches.length!==1){this.clearTapHoldTimeout();return}if(this.isPinching)return;const k=this.toTouchCoords(R.touches[0]),N=this.touchStart;if(this.pendingClearTouch){this.pendingClearTouch.moved=this.pendingClearTouch.moved||He(this.pendingClearTouch.point,k)>De;return}if(!N)return;const j=He(N,k)>De;if(j&&this.clearTapHoldTimeout(),this.isSelecting&&!this.isHandleDragging){R.preventDefault(),R.stopPropagation(),this.extendSelection(k);return}const V=this.lastScrollTouchY;this.recordScrollSample(k),j&&V!==null&&this.onTouchScroll?.(V-k.clientY,k)&&(this.didScrollTouch=!0,R.preventDefault(),R.stopPropagation())};onTerminalTouchEnd=R=>{if(!this.isTerminalTouchEvent(R))return;if(this.isFinishingPinch){R.preventDefault(),this.isFinishingPinch=R.touches.length>0;return}if(this.onTouchScroll&&R.stopPropagation(),this.isPinching){const N=this.twoFingerTapCandidate,j=!!(N&&oi(N.timestamp,performance.now(),N.moved));this.endPinchZoom(),this.isFinishingPinch=R.touches.length>0,j&&N&&this.onTwoFingerTap&&(R.preventDefault(),this.blurTerminalInput(),this.onTwoFingerTap(N.center));return}if(this.clearTapHoldTimeout(),this.touchStart=null,(this.isSelecting||this.isHandleDragging)&&(R.preventDefault(),this.blurTerminalInput()),!this.pendingClearTouch){this.onTouchScroll&&!this.didScrollTouch&&!this.isSelecting&&!this.isHandleDragging&&this.scheduleTerminalFocus(),this.maybeStartInertia();return}const k=this.isSelecting&&!this.pendingClearTouch.moved&&!this.isHandleDragging;this.pendingClearTouch=null,k&&this.clearSelection()};onTerminalTouchCancel=R=>{this.isTerminalTouchEvent(R)&&(this.cancelPendingTerminalFocus(),this.isPinching&&this.endPinchZoom(),this.isFinishingPinch=!1,this.clearTapHoldTimeout(),this.touchStart=null,this.pendingClearTouch=null)};isTerminalTouchEvent(R){return!!(R.target&&this.terminal.element?.contains(R.target))}onHandleTouchStart=R=>{if(R.preventDefault(),R.stopPropagation(),R.touches.length!==1)return;const k=R.currentTarget;this.dragHandle=k.dataset.handleType==="start"?"start":"end",this.isHandleDragging=!0,this.pendingClearTouch=null};onHandleTouchMove=R=>{if(!this.isHandleDragging||!this.dragHandle||R.touches.length!==1)return;R.preventDefault(),R.stopPropagation();const k=this.toTouchCoords(R.touches[0]),N={clientX:k.clientX,clientY:k.clientY-Qt},j=this.touchToTerminalCoords(N);j&&(this.dragHandle==="start"?this.selectionStart=j:this.selectionEnd=j,this.swapHandlesIfNeeded(),this.updateSelection())};onHandleTouchEnd=R=>{this.isHandleDragging&&(R.preventDefault(),R.stopPropagation(),this.isHandleDragging=!1,this.dragHandle=null)};onSelectionChange=()=>{if(this.isSelecting){if(!this.terminal.hasSelection()){this.resetSelectionState();return}this.updateHandles()}};onTerminalResize=()=>{this.updateCellDimensions(),this.updateHandles()};onTerminalScroll=()=>{this.updateHandles()};onDocumentTouchStart=R=>{!this.isSelecting||!R.target||this.terminalContent.contains(R.target)||this.clearSelection()};startSelection(R){this.cancelPendingTerminalFocus();const k=this.touchToTerminalCoords(R);if(!k)return;const N=this.getWordBoundsAt(k);this.selectionStart=N?.start??k,this.selectionEnd=N?.end??k,this.isSelecting=!0,this.blurTerminalInput(),this.updateSelection(),this.showHandles(),this.showContextMenu()}extendSelection(R){const k=this.touchToTerminalCoords(R);k&&(this.selectionEnd=k,this.updateSelection())}updateSelection(){if(!this.selectionStart||!this.selectionEnd)return;const{start:R,end:k}=this.getOrderedSelection(),N=this.calculateSelectionLength(R,k);N<=0||(this.terminal.select(R.col,R.row,N),this.updateHandles())}calculateSelectionLength(R,k){return R.row===k.row?k.col-R.col+1:(k.row-R.row)*this.terminal.cols-R.col+k.col+1}getOrderedSelection(){const R=this.selectionStart,k=this.selectionEnd;if(!R||!k)throw new Error("Cannot order empty terminal selection");return R.row<k.row||R.row===k.row&&R.col<=k.col?{start:R,end:k}:{start:k,end:R}}swapHandlesIfNeeded(){if(!this.selectionStart||!this.selectionEnd||!this.dragHandle)return;const{start:R,end:k}=this.getOrderedSelection();R===this.selectionStart&&k===this.selectionEnd||(this.selectionStart=R,this.selectionEnd=k,this.dragHandle=this.dragHandle==="start"?"end":"start")}showHandles(){this.startHandle.style.display="block",this.endHandle.style.display="block",this.updateHandles()}hideHandles(){this.startHandle.style.display="none",this.endHandle.style.display="none"}showContextMenu(){this.contextMenu.style.display="flex",this.isContextMenuVisible=!0,this.positionContextMenu()}hideContextMenu(){this.contextMenu.style.display="none",this.isContextMenuVisible=!1}positionContextMenu(){if(!this.isContextMenuVisible)return;const R=this.terminalContent.getBoundingClientRect(),k=this.contextMenu.offsetWidth||0,N=this.contextMenu.offsetHeight||0,j=this.selectionStart&&this.selectionEnd?this.getOrderedSelection():null,V=j?this.terminalCoordsToPixels(j.start):null,M=j?this.terminalCoordsToPixels(j.end):null;let t,a;if(V||M){const s=Math.min(V?.y??M.y,M?.y??V.y);t=(V&&M?(V.x+M.x)/2:(V??M).x)-k/2,a=s-N-Fe,a<pe&&(a=Math.max(V?.y??M.y,M?.y??V.y)+this.cellDimensions.height+Ce+Fe)}else t=(R.width-k)/2,a=R.height-N-Fe;const h=R.width-k-pe,l=R.height-N-pe;t=me(t,pe,Math.max(pe,h)),a=me(a,pe,Math.max(pe,l)),this.contextMenu.style.left=`${t}px`,this.contextMenu.style.top=`${a}px`}copySelection(){const R=this.terminal.getSelection();R&&Ae(R),this.clearSelection()}async pasteFromClipboard(){await this.onPaste(),this.clearSelection(),this.terminal.focus()}selectAllText(){this.terminal.selectAll(),this.selectionStart=null,this.selectionEnd=null,this.isSelecting=!0,this.hideHandles(),this.terminal.hasSelection()?this.showContextMenu():this.clearSelection()}startPinchZoom(R){R.touches.length===2&&(this.cancelPendingTerminalFocus(),this.clearTapHoldTimeout(),this.touchStart=null,this.pendingClearTouch=null,this.isSelecting&&this.clearSelection(),this.isPinching=!0,this.initialFontSize=this.terminal.options.fontSize??Je,this.pinchStartDistance=this.getTouchDistance(R.touches[0],R.touches[1]),this.twoFingerTapCandidate={center:this.getTouchCenter(R.touches[0],R.touches[1]),distance:this.pinchStartDistance,moved:!1,timestamp:performance.now()},this.lastZoomTime=0)}handlePinchZoom(R){if(!this.isPinching||R.touches.length!==2||this.pinchStartDistance<=0)return;const k=this.getTouchCenter(R.touches[0],R.touches[1]),N=this.getTouchDistance(R.touches[0],R.touches[1]);this.twoFingerTapCandidate&&(this.twoFingerTapCandidate.moved=this.twoFingerTapCandidate.moved||He(this.twoFingerTapCandidate.center,k)>De||Math.abs(this.twoFingerTapCandidate.distance-N)>De);const j=Date.now();if(j-this.lastZoomTime<ei)return;this.lastZoomTime=j;const V=N/this.pinchStartDistance,M=me(Math.round(this.initialFontSize*V),this.minFontSize,this.maxFontSize);M!==this.terminal.options.fontSize&&this.onFontSizeChange(M)}endPinchZoom(){this.isPinching=!1,this.pinchStartDistance=0,this.twoFingerTapCandidate=null,this.initialFontSize=0}getTouchDistance(R,k){return Math.hypot(k.clientX-R.clientX,k.clientY-R.clientY)}getTouchCenter(R,k){return{clientX:(R.clientX+k.clientX)/2,clientY:(R.clientY+k.clientY)/2}}getViewportElement(){return this.viewportElement?.isConnected?this.viewportElement:(this.viewportElement=this.terminal.element?.querySelector(".xterm-viewport")??null,this.viewportElement)}resetScrollTracking(){this.lastScrollTouchY=null,this.lastScrollTouchTime=0,this.scrollVelocity=0}recordScrollSample(R){const k=performance.now();if(this.lastScrollTouchY!==null){const N=k-this.lastScrollTouchTime;if(N>0){const j=(this.lastScrollTouchY-R.clientY)/N;this.scrollVelocity=this.scrollVelocity*.4+j*.6}}this.lastScrollTouchY=R.clientY,this.lastScrollTouchTime=k}maybeStartInertia(){this.isSelecting||this.isHandleDragging||this.isPinching||performance.now()-this.lastScrollTouchTime>si||Math.abs(this.scrollVelocity)<Ze||this.startInertia(this.scrollVelocity)}startInertia(R){const k=this.getViewportElement();if(!k)return;this.cancelInertia();let N=me(R,-Qe,Qe),j=performance.now();const V=M=>{const t=Math.max(1,M-j);if(j=M,N*=Math.pow(ii,t/16),Math.abs(N)<Ze){this.inertiaFrame=null;return}const a=k.scrollTop;if(k.scrollTop=a+N*t,k.scrollTop===a){this.inertiaFrame=null;return}this.inertiaFrame=window.requestAnimationFrame(V)};this.inertiaFrame=window.requestAnimationFrame(V)}cancelInertia(){this.inertiaFrame!==null&&(window.cancelAnimationFrame(this.inertiaFrame),this.inertiaFrame=null)}updateHandles(){if(this.isContextMenuVisible&&this.positionContextMenu(),!this.isSelecting||!this.selectionStart||!this.selectionEnd){this.hideHandles();return}const{start:R,end:k}=this.getOrderedSelection(),N=this.terminalCoordsToPixels(R),j=this.terminalCoordsToPixels(k),V=Math.max(0,this.terminalContent.clientWidth-Ce);N?(this.startHandle.style.display="block",this.startHandle.style.left=`${me(N.x-Ce/2,0,V)}px`,this.startHandle.style.top=`${N.y+this.cellDimensions.height+4}px`):this.startHandle.style.display="none",j?(this.endHandle.style.display="block",this.endHandle.style.left=`${me(j.x+this.cellDimensions.width-Ce/2,0,V)}px`,this.endHandle.style.top=`${j.y+this.cellDimensions.height+4}px`):this.endHandle.style.display="none"}clearSelection(){this.terminal.clearSelection(),this.resetSelectionState()}resetSelectionState(){this.isSelecting=!1,this.isHandleDragging=!1,this.dragHandle=null,this.selectionStart=null,this.selectionEnd=null,this.pendingClearTouch=null,this.touchStart=null,this.hideHandles(),this.hideContextMenu(),this.clearTapHoldTimeout()}touchToTerminalCoords(R){const k=this.getTerminalScreenElement();if(!k)return null;const N=k.getBoundingClientRect(),j=R.clientX-N.left,V=R.clientY-N.top;if(j<0||V<0||j>N.width||V>N.height||(this.updateCellDimensions(),!this.cellDimensions.width||!this.cellDimensions.height))return null;const M=me(Math.floor(j/this.cellDimensions.width),0,this.terminal.cols-1),t=Math.floor(V/this.cellDimensions.height)+this.terminal.buffer.active.viewportY;return{col:M,row:Math.max(0,t)}}terminalCoordsToPixels(R){const k=this.getTerminalScreenElement();if(!k)return null;this.updateCellDimensions();const N=R.row-this.terminal.buffer.active.viewportY;if(N<0||N>=this.terminal.rows)return null;const j=k.getBoundingClientRect(),V=this.terminalContent.getBoundingClientRect();return{x:j.left-V.left+R.col*this.cellDimensions.width,y:j.top-V.top+N*this.cellDimensions.height}}updateCellDimensions(){const R=this.terminal._core?._renderService?.dimensions?.css?.cell;if(R?.width&&R.height){this.cellDimensions={width:R.width,height:R.height};return}const N=this.getTerminalScreenElement()?.getBoundingClientRect();if(!N||!this.terminal.cols||!this.terminal.rows){this.cellDimensions={width:0,height:0};return}this.cellDimensions={width:N.width/this.terminal.cols,height:N.height/this.terminal.rows}}getWordBoundsAt(R){const k=this.terminal.buffer.active.getLine(R.row);if(!k)return null;const N=k.translateToString(!1);if(!N||R.col>=N.length||/\s/.test(N[R.col]))return null;let j=R.col,V=R.col;for(;j>0&&!/\s/.test(N[j-1]);)j--;for(;V<N.length-1&&!/\s/.test(N[V+1]);)V++;return{start:{row:R.row,col:j},end:{row:R.row,col:V}}}blurTerminalInput(){this.terminal.element?.querySelector(".xterm-helper-textarea")?.blur()}scheduleTerminalFocus(){this.terminalFocusScheduler.schedule(()=>!this.isDestroyed&&!this.didScrollTouch&&!this.isSelecting&&!this.isHandleDragging&&!this.isPinching&&!this.isFinishingPinch&&this.pendingClearTouch===null)}cancelPendingTerminalFocus(){this.terminalFocusScheduler.cancel()}getTerminalScreenElement(){return this.terminal.element?.querySelector(".xterm-screen")??this.terminal.element??null}toTouchCoords(R){return{clientX:R.clientX,clientY:R.clientY}}clearTapHoldTimeout(){this.tapHoldTimeout!==null&&(window.clearTimeout(this.tapHoldTimeout),this.tapHoldTimeout=null)}dispose(){this.isDestroyed||(this.isDestroyed=!0,this.cancelPendingTerminalFocus(),this.clearTapHoldTimeout(),this.cancelInertia(),this.terminalContent.removeEventListener("touchstart",this.onTerminalTouchStart,{capture:!0}),this.terminalContent.removeEventListener("touchmove",this.onTerminalTouchMove,{capture:!0}),this.terminalContent.removeEventListener("touchend",this.onTerminalTouchEnd,{capture:!0}),this.terminalContent.removeEventListener("touchcancel",this.onTerminalTouchCancel,{capture:!0}),this.startHandle.removeEventListener("touchstart",this.onHandleTouchStart),this.startHandle.removeEventListener("touchmove",this.onHandleTouchMove),this.startHandle.removeEventListener("touchend",this.onHandleTouchEnd),this.startHandle.removeEventListener("touchcancel",this.onHandleTouchEnd),this.endHandle.removeEventListener("touchstart",this.onHandleTouchStart),this.endHandle.removeEventListener("touchmove",this.onHandleTouchMove),this.endHandle.removeEventListener("touchend",this.onHandleTouchEnd),this.endHandle.removeEventListener("touchcancel",this.onHandleTouchEnd),document.removeEventListener("touchstart",this.onDocumentTouchStart),this.disposables.forEach(R=>R.dispose()),this.disposables.length=0,this.overlay.remove(),this.didSetPosition&&(this.terminalContent.style.position=this.originalPosition))}}function li(z,R,k={}){return!ni()||!z.element?null:new hi(z,R,k)}const et=12,ci=64,ui=65;function tt(z){return typeof z!="string"||!/^[ \u00a0\u3000]+$/.test(z)?null:" ".repeat(z.length)}function di(z){return btoa(z)}function _i(z,R,k){const N=R&&k?xe(Math.floor((R.clientX-k.left)/Math.max(1,k.width)*z.cols)+1,1,z.cols):Math.max(1,Math.ceil(z.cols/2)),j=R&&k?xe(Math.floor((R.clientY-k.top)/Math.max(1,k.height)*z.rows)+1,1,z.rows):Math.max(1,Math.ceil(z.rows/2));return`\x1B[<2;${N};${j}M\x1B[<2;${N};${j}m`}function xe(z,R,k){return Math.max(R,Math.min(k,z))}function fi(z,R,k,N,j){const V=xe(Math.floor((R.clientX-k.left)/Math.max(1,k.width)*N)+1,1,N),M=xe(Math.floor((R.clientY-k.top)/Math.max(1,k.height)*j)+1,1,j);return`\x1B[<${z>0?ui:ci};${V};${M}M`.repeat(Math.abs(z))}function gi({terminal:z,getBoundingClientRect:R,send:k}){let N=0;const j=((V,M)=>{N+=V;const t=R(),a=t.height/Math.max(1,z.rows);if(!Number.isFinite(a)||a<=0)return!0;const h=Math.trunc(N/a);if(h===0)return!0;const l=xe(h,-et,et);return N-=l*a,k({type:"input",data:fi(l,M,t,Math.max(1,z.cols),Math.max(1,z.rows))}),!0});return j.reset=()=>{N=0},j}function vi({terminal:z,container:R,focusTarget:k=typeof window>"u"?null:window,visibilityTarget:N=typeof document>"u"?null:document,isVisible:j=()=>typeof document>"u"||document.visibilityState==="visible",shellMode:V,send:M}){let t=!1,a=null,h=null;const l=()=>{h!==null&&(clearTimeout(h),h=null)},s=()=>{l(),a=null},c=u=>{l(),a=u.data??""},f=u=>{if(a===null)return;const m=u;if(m.inputType&&m.inputType!=="insertText")return;const d=tt(m.data);if(d===null){m.data&&m.data!==a&&s();return}h===null&&(h=setTimeout(()=>{h=null,a=null,z.input(d,!0)},0))},g=()=>{V==="herdr"&&z.modes.mouseTrackingMode==="none"&&z.write(Rt)},o=u=>{V==="herdr"&&u.preventDefault()},e=()=>{V!=="herdr"||t||(t=!0,M({type:"viewport_claim",cols:z.cols,rows:z.rows}))},r=()=>{t=!1},i=()=>{j()?e():r()};R.addEventListener("contextmenu",o),R.addEventListener("pointerdown",e,!0),R.addEventListener("keydown",e,!0),k?.addEventListener("focus",e),k?.addEventListener("blur",r),N?.addEventListener("visibilitychange",i),V==="herdr"&&(R.addEventListener("compositionend",c,!0),R.addEventListener("beforeinput",f,!0),R.addEventListener("input",f,!0));const n=z.onData(u=>{a!==null&&(tt(u)!==null||u!==a)&&s(),M({type:"input",data:u})}),_=z.onBinary(u=>{M({type:"input_binary",data:di(u)})}),p=z.onWriteParsed(g);return g(),()=>{R.removeEventListener("contextmenu",o),R.removeEventListener("pointerdown",e,!0),R.removeEventListener("keydown",e,!0),k?.removeEventListener("focus",e),k?.removeEventListener("blur",r),N?.removeEventListener("visibilitychange",i),V==="herdr"&&(R.removeEventListener("compositionend",c,!0),R.removeEventListener("beforeinput",f,!0),R.removeEventListener("input",f,!0)),s(),n.dispose(),_.dispose(),p.dispose()}}const it="shell-xterm-focus-style",pi=`
66
+ `,i)}paste(r){this._core.paste(r)}refresh(r,i){this._verifyIntegers(r,i),this._core.refresh(r,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(r){this._addonManager.loadAddon(this,r)}static get strings(){return t}_verifyIntegers(...r){for(const i of r)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...r){for(const i of r)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}M.Terminal=o})(),V})()))})(Ie)),Ie.exports}var Yt=Xt();const Jt=600,Zt=350,De=8,Ce=22,Qt=40,Fe=12,pe=8,ei=50,Je=8,ti=48,ii=.95,Ze=.02,Qe=5,si=90;function ri(){return["Paste","Copy","Select All"]}function ni(){return typeof window>"u"||typeof navigator>"u"?!1:navigator.maxTouchPoints>0||"ontouchstart"in window||window.matchMedia?.("(pointer: coarse)").matches===!0}function me(z,R,k){return Math.max(R,Math.min(k,z))}function He(z,R){return Math.hypot(R.clientX-z.clientX,R.clientY-z.clientY)}function oi(z,R,k){return!k&&R-z<=Zt}function ai(z){let R=0;return{cancel:()=>{R++},schedule:k=>{const N=++R;queueMicrotask(()=>{N===R&&k()&&z()})}}}class hi{terminal;terminalContent;overlay;startHandle;endHandle;contextMenu;disposables=[];originalPosition;didSetPosition=!1;isDestroyed=!1;isSelecting=!1;isHandleDragging=!1;dragHandle=null;selectionStart=null;selectionEnd=null;touchStart=null;pendingClearTouch=null;tapHoldTimeout=null;cellDimensions={width:0,height:0};isContextMenuVisible=!1;minFontSize;maxFontSize;onFontSizeChange;onTwoFingerTap;onPaste;onTouchScrollReset;onTouchScroll;isPinching=!1;isFinishingPinch=!1;pinchStartDistance=0;twoFingerTapCandidate=null;initialFontSize=0;lastZoomTime=0;viewportElement=null;lastScrollTouchY=null;lastScrollTouchTime=0;scrollVelocity=0;inertiaFrame=null;didScrollTouch=!1;terminalFocusScheduler;constructor(R,k,N={}){this.terminal=R,this.terminalContent=k,this.originalPosition=k.style.position,this.terminalFocusScheduler=ai(()=>this.terminal.focus());const j=Number(N.minFontSize)||Je,V=Number(N.maxFontSize)||ti;this.minFontSize=Math.min(j,V),this.maxFontSize=Math.max(j,V),this.onFontSizeChange=N.onFontSizeChange??(M=>{this.terminal.options.fontSize=M,this.terminal.refresh(0,this.terminal.rows-1)}),this.onTouchScroll=N.onTouchScroll??null,this.onTouchScrollReset=N.onTouchScrollReset??(()=>{}),this.onTwoFingerTap=N.onTwoFingerTap??null,this.onPaste=N.onPaste??(()=>{}),window.getComputedStyle(k).position==="static"&&(k.style.position="relative",this.didSetPosition=!0),this.overlay=this.createSelectionOverlay(),this.startHandle=this.createHandle("start"),this.endHandle=this.createHandle("end"),this.contextMenu=this.createContextMenu(),this.overlay.append(this.startHandle,this.endHandle,this.contextMenu),this.terminalContent.appendChild(this.overlay),this.attachEventListeners(),this.updateCellDimensions()}createSelectionOverlay(){const R=document.createElement("div");return R.className="shell-mobile-selection-overlay",R.style.position="absolute",R.style.inset="0",R.style.overflow="hidden",R.style.pointerEvents="none",R.style.zIndex="30",R}createHandle(R){const k=document.createElement("div");return k.className=`shell-mobile-selection-handle shell-mobile-selection-handle-${R}`,k.dataset.handleType=R,k.style.position="absolute",k.style.width=`${Ce}px`,k.style.height=`${Ce}px`,k.style.borderRadius="50%",k.style.background="#3b82f6",k.style.border="2px solid #fff",k.style.boxShadow="0 2px 8px rgba(0,0,0,0.3)",k.style.display="none",k.style.pointerEvents="auto",k.style.touchAction="none",k.style.zIndex="31",k}createContextMenu(){const R=document.createElement("div");R.className="shell-mobile-selection-menu",R.style.position="absolute",R.style.display="none",R.style.alignItems="stretch",R.style.padding="4px",R.style.gap="2px",R.style.background="#1f2937",R.style.border="1px solid rgba(255,255,255,0.12)",R.style.borderRadius="10px",R.style.boxShadow="0 6px 20px rgba(0,0,0,0.4)",R.style.pointerEvents="auto",R.style.touchAction="none",R.style.zIndex="32",R.style.whiteSpace="nowrap",R.style.userSelect="none";const[k,N,j]=ri(),V=[{label:k,action:()=>{this.pasteFromClipboard()}},{label:N,action:()=>this.copySelection()},{label:j,action:()=>this.selectAllText()}];for(const M of V)R.appendChild(this.createContextMenuButton(M));return R}createContextMenuButton(R){const k=document.createElement("button");k.type="button",k.textContent=R.label,k.style.appearance="none",k.style.border="none",k.style.margin="0",k.style.padding="8px 14px",k.style.background="transparent",k.style.color="#f9fafb",k.style.fontSize="14px",k.style.fontFamily="inherit",k.style.lineHeight="1",k.style.borderRadius="6px",k.style.cursor="pointer",k.style.pointerEvents="auto",k.style.touchAction="none";let N=!1;const j=M=>{M.preventDefault(),M.stopPropagation(),N=!1},V=M=>{M.preventDefault(),M.stopPropagation(),!N&&(N=!0,R.action())};return k.addEventListener("touchstart",j,{passive:!1}),k.addEventListener("touchend",V,{passive:!1}),k.addEventListener("mousedown",j),k.addEventListener("mouseup",V),k.addEventListener("click",M=>{M.preventDefault(),M.stopPropagation()}),k}attachEventListeners(){this.terminal.element&&(this.terminalContent.addEventListener("touchstart",this.onTerminalTouchStart,{capture:!0,passive:!1}),this.terminalContent.addEventListener("touchmove",this.onTerminalTouchMove,{capture:!0,passive:!1}),this.terminalContent.addEventListener("touchend",this.onTerminalTouchEnd,{capture:!0,passive:!1}),this.terminalContent.addEventListener("touchcancel",this.onTerminalTouchCancel,{capture:!0,passive:!1}),this.startHandle.addEventListener("touchstart",this.onHandleTouchStart,{passive:!1}),this.startHandle.addEventListener("touchmove",this.onHandleTouchMove,{passive:!1}),this.startHandle.addEventListener("touchend",this.onHandleTouchEnd,{passive:!1}),this.startHandle.addEventListener("touchcancel",this.onHandleTouchEnd,{passive:!1}),this.endHandle.addEventListener("touchstart",this.onHandleTouchStart,{passive:!1}),this.endHandle.addEventListener("touchmove",this.onHandleTouchMove,{passive:!1}),this.endHandle.addEventListener("touchend",this.onHandleTouchEnd,{passive:!1}),this.endHandle.addEventListener("touchcancel",this.onHandleTouchEnd,{passive:!1}),document.addEventListener("touchstart",this.onDocumentTouchStart,{passive:!0}),this.disposables.push(this.terminal.onSelectionChange(this.onSelectionChange),this.terminal.onResize(this.onTerminalResize),this.terminal.onScroll(this.onTerminalScroll)))}onTerminalTouchStart=R=>{if(!this.isTerminalTouchEvent(R))return;if(this.cancelPendingTerminalFocus(),this.onTouchScroll&&(R.stopPropagation(),this.onTouchScrollReset()),this.cancelInertia(),this.resetScrollTracking(),this.didScrollTouch=!1,R.touches.length===2){R.preventDefault(),this.startPinchZoom(R);return}if(R.touches.length!==1){this.clearTapHoldTimeout();return}const k=this.toTouchCoords(R.touches[0]);if(this.touchStart=k,this.lastScrollTouchY=k.clientY,this.lastScrollTouchTime=performance.now(),this.isSelecting){this.pendingClearTouch={point:k,moved:!1};return}this.clearTapHoldTimeout(),this.tapHoldTimeout=window.setTimeout(()=>{this.tapHoldTimeout=null,this.startSelection(k)},Jt)};onTerminalTouchMove=R=>{if(!this.isTerminalTouchEvent(R))return;if(this.isFinishingPinch){R.preventDefault();return}if(R.touches.length===2&&this.isPinching){R.preventDefault(),this.onTouchScroll&&R.stopPropagation(),this.handlePinchZoom(R);return}if(R.touches.length!==1){this.clearTapHoldTimeout();return}if(this.isPinching)return;const k=this.toTouchCoords(R.touches[0]),N=this.touchStart;if(this.pendingClearTouch){this.pendingClearTouch.moved=this.pendingClearTouch.moved||He(this.pendingClearTouch.point,k)>De;return}if(!N)return;const j=He(N,k)>De;if(j&&this.clearTapHoldTimeout(),this.isSelecting&&!this.isHandleDragging){R.preventDefault(),R.stopPropagation(),this.extendSelection(k);return}const V=this.lastScrollTouchY;this.recordScrollSample(k),j&&V!==null&&this.onTouchScroll?.(V-k.clientY,k)&&(this.didScrollTouch=!0,R.preventDefault(),R.stopPropagation())};onTerminalTouchEnd=R=>{if(!this.isTerminalTouchEvent(R))return;if(this.isFinishingPinch){R.preventDefault(),this.isFinishingPinch=R.touches.length>0;return}if(this.onTouchScroll&&R.stopPropagation(),this.isPinching){const N=this.twoFingerTapCandidate,j=!!(N&&oi(N.timestamp,performance.now(),N.moved));this.endPinchZoom(),this.isFinishingPinch=R.touches.length>0,j&&N&&this.onTwoFingerTap&&(R.preventDefault(),this.blurTerminalInput(),this.onTwoFingerTap(N.center));return}if(this.clearTapHoldTimeout(),this.touchStart=null,(this.isSelecting||this.isHandleDragging)&&(R.preventDefault(),this.blurTerminalInput()),!this.pendingClearTouch){this.onTouchScroll&&!this.didScrollTouch&&!this.isSelecting&&!this.isHandleDragging&&(R.preventDefault(),this.scheduleTerminalFocus()),this.maybeStartInertia();return}const k=this.isSelecting&&!this.pendingClearTouch.moved&&!this.isHandleDragging;this.pendingClearTouch=null,k&&this.clearSelection()};onTerminalTouchCancel=R=>{this.isTerminalTouchEvent(R)&&(this.cancelPendingTerminalFocus(),this.isPinching&&this.endPinchZoom(),this.isFinishingPinch=!1,this.clearTapHoldTimeout(),this.touchStart=null,this.pendingClearTouch=null)};isTerminalTouchEvent(R){return!!(R.target&&this.terminal.element?.contains(R.target))}onHandleTouchStart=R=>{if(R.preventDefault(),R.stopPropagation(),R.touches.length!==1)return;const k=R.currentTarget;this.dragHandle=k.dataset.handleType==="start"?"start":"end",this.isHandleDragging=!0,this.pendingClearTouch=null};onHandleTouchMove=R=>{if(!this.isHandleDragging||!this.dragHandle||R.touches.length!==1)return;R.preventDefault(),R.stopPropagation();const k=this.toTouchCoords(R.touches[0]),N={clientX:k.clientX,clientY:k.clientY-Qt},j=this.touchToTerminalCoords(N);j&&(this.dragHandle==="start"?this.selectionStart=j:this.selectionEnd=j,this.swapHandlesIfNeeded(),this.updateSelection())};onHandleTouchEnd=R=>{this.isHandleDragging&&(R.preventDefault(),R.stopPropagation(),this.isHandleDragging=!1,this.dragHandle=null)};onSelectionChange=()=>{if(this.isSelecting){if(!this.terminal.hasSelection()){this.resetSelectionState();return}this.updateHandles()}};onTerminalResize=()=>{this.updateCellDimensions(),this.updateHandles()};onTerminalScroll=()=>{this.updateHandles()};onDocumentTouchStart=R=>{!this.isSelecting||!R.target||this.terminalContent.contains(R.target)||this.clearSelection()};startSelection(R){this.cancelPendingTerminalFocus();const k=this.touchToTerminalCoords(R);if(!k)return;const N=this.getWordBoundsAt(k);this.selectionStart=N?.start??k,this.selectionEnd=N?.end??k,this.isSelecting=!0,this.blurTerminalInput(),this.updateSelection(),this.showHandles(),this.showContextMenu()}extendSelection(R){const k=this.touchToTerminalCoords(R);k&&(this.selectionEnd=k,this.updateSelection())}updateSelection(){if(!this.selectionStart||!this.selectionEnd)return;const{start:R,end:k}=this.getOrderedSelection(),N=this.calculateSelectionLength(R,k);N<=0||(this.terminal.select(R.col,R.row,N),this.updateHandles())}calculateSelectionLength(R,k){return R.row===k.row?k.col-R.col+1:(k.row-R.row)*this.terminal.cols-R.col+k.col+1}getOrderedSelection(){const R=this.selectionStart,k=this.selectionEnd;if(!R||!k)throw new Error("Cannot order empty terminal selection");return R.row<k.row||R.row===k.row&&R.col<=k.col?{start:R,end:k}:{start:k,end:R}}swapHandlesIfNeeded(){if(!this.selectionStart||!this.selectionEnd||!this.dragHandle)return;const{start:R,end:k}=this.getOrderedSelection();R===this.selectionStart&&k===this.selectionEnd||(this.selectionStart=R,this.selectionEnd=k,this.dragHandle=this.dragHandle==="start"?"end":"start")}showHandles(){this.startHandle.style.display="block",this.endHandle.style.display="block",this.updateHandles()}hideHandles(){this.startHandle.style.display="none",this.endHandle.style.display="none"}showContextMenu(){this.contextMenu.style.display="flex",this.isContextMenuVisible=!0,this.positionContextMenu()}hideContextMenu(){this.contextMenu.style.display="none",this.isContextMenuVisible=!1}positionContextMenu(){if(!this.isContextMenuVisible)return;const R=this.terminalContent.getBoundingClientRect(),k=this.contextMenu.offsetWidth||0,N=this.contextMenu.offsetHeight||0,j=this.selectionStart&&this.selectionEnd?this.getOrderedSelection():null,V=j?this.terminalCoordsToPixels(j.start):null,M=j?this.terminalCoordsToPixels(j.end):null;let t,a;if(V||M){const s=Math.min(V?.y??M.y,M?.y??V.y);t=(V&&M?(V.x+M.x)/2:(V??M).x)-k/2,a=s-N-Fe,a<pe&&(a=Math.max(V?.y??M.y,M?.y??V.y)+this.cellDimensions.height+Ce+Fe)}else t=(R.width-k)/2,a=R.height-N-Fe;const h=R.width-k-pe,l=R.height-N-pe;t=me(t,pe,Math.max(pe,h)),a=me(a,pe,Math.max(pe,l)),this.contextMenu.style.left=`${t}px`,this.contextMenu.style.top=`${a}px`}copySelection(){const R=this.terminal.getSelection();R&&Ae(R),this.clearSelection()}async pasteFromClipboard(){await this.onPaste(),this.clearSelection(),this.terminal.focus()}selectAllText(){this.terminal.selectAll(),this.selectionStart=null,this.selectionEnd=null,this.isSelecting=!0,this.hideHandles(),this.terminal.hasSelection()?this.showContextMenu():this.clearSelection()}startPinchZoom(R){R.touches.length===2&&(this.cancelPendingTerminalFocus(),this.clearTapHoldTimeout(),this.touchStart=null,this.pendingClearTouch=null,this.isSelecting&&this.clearSelection(),this.isPinching=!0,this.initialFontSize=this.terminal.options.fontSize??Je,this.pinchStartDistance=this.getTouchDistance(R.touches[0],R.touches[1]),this.twoFingerTapCandidate={center:this.getTouchCenter(R.touches[0],R.touches[1]),distance:this.pinchStartDistance,moved:!1,timestamp:performance.now()},this.lastZoomTime=0)}handlePinchZoom(R){if(!this.isPinching||R.touches.length!==2||this.pinchStartDistance<=0)return;const k=this.getTouchCenter(R.touches[0],R.touches[1]),N=this.getTouchDistance(R.touches[0],R.touches[1]);this.twoFingerTapCandidate&&(this.twoFingerTapCandidate.moved=this.twoFingerTapCandidate.moved||He(this.twoFingerTapCandidate.center,k)>De||Math.abs(this.twoFingerTapCandidate.distance-N)>De);const j=Date.now();if(j-this.lastZoomTime<ei)return;this.lastZoomTime=j;const V=N/this.pinchStartDistance,M=me(Math.round(this.initialFontSize*V),this.minFontSize,this.maxFontSize);M!==this.terminal.options.fontSize&&this.onFontSizeChange(M)}endPinchZoom(){this.isPinching=!1,this.pinchStartDistance=0,this.twoFingerTapCandidate=null,this.initialFontSize=0}getTouchDistance(R,k){return Math.hypot(k.clientX-R.clientX,k.clientY-R.clientY)}getTouchCenter(R,k){return{clientX:(R.clientX+k.clientX)/2,clientY:(R.clientY+k.clientY)/2}}getViewportElement(){return this.viewportElement?.isConnected?this.viewportElement:(this.viewportElement=this.terminal.element?.querySelector(".xterm-viewport")??null,this.viewportElement)}resetScrollTracking(){this.lastScrollTouchY=null,this.lastScrollTouchTime=0,this.scrollVelocity=0}recordScrollSample(R){const k=performance.now();if(this.lastScrollTouchY!==null){const N=k-this.lastScrollTouchTime;if(N>0){const j=(this.lastScrollTouchY-R.clientY)/N;this.scrollVelocity=this.scrollVelocity*.4+j*.6}}this.lastScrollTouchY=R.clientY,this.lastScrollTouchTime=k}maybeStartInertia(){this.isSelecting||this.isHandleDragging||this.isPinching||performance.now()-this.lastScrollTouchTime>si||Math.abs(this.scrollVelocity)<Ze||this.startInertia(this.scrollVelocity)}startInertia(R){const k=this.getViewportElement();if(!k)return;this.cancelInertia();let N=me(R,-Qe,Qe),j=performance.now();const V=M=>{const t=Math.max(1,M-j);if(j=M,N*=Math.pow(ii,t/16),Math.abs(N)<Ze){this.inertiaFrame=null;return}const a=k.scrollTop;if(k.scrollTop=a+N*t,k.scrollTop===a){this.inertiaFrame=null;return}this.inertiaFrame=window.requestAnimationFrame(V)};this.inertiaFrame=window.requestAnimationFrame(V)}cancelInertia(){this.inertiaFrame!==null&&(window.cancelAnimationFrame(this.inertiaFrame),this.inertiaFrame=null)}updateHandles(){if(this.isContextMenuVisible&&this.positionContextMenu(),!this.isSelecting||!this.selectionStart||!this.selectionEnd){this.hideHandles();return}const{start:R,end:k}=this.getOrderedSelection(),N=this.terminalCoordsToPixels(R),j=this.terminalCoordsToPixels(k),V=Math.max(0,this.terminalContent.clientWidth-Ce);N?(this.startHandle.style.display="block",this.startHandle.style.left=`${me(N.x-Ce/2,0,V)}px`,this.startHandle.style.top=`${N.y+this.cellDimensions.height+4}px`):this.startHandle.style.display="none",j?(this.endHandle.style.display="block",this.endHandle.style.left=`${me(j.x+this.cellDimensions.width-Ce/2,0,V)}px`,this.endHandle.style.top=`${j.y+this.cellDimensions.height+4}px`):this.endHandle.style.display="none"}clearSelection(){this.terminal.clearSelection(),this.resetSelectionState()}resetSelectionState(){this.isSelecting=!1,this.isHandleDragging=!1,this.dragHandle=null,this.selectionStart=null,this.selectionEnd=null,this.pendingClearTouch=null,this.touchStart=null,this.hideHandles(),this.hideContextMenu(),this.clearTapHoldTimeout()}touchToTerminalCoords(R){const k=this.getTerminalScreenElement();if(!k)return null;const N=k.getBoundingClientRect(),j=R.clientX-N.left,V=R.clientY-N.top;if(j<0||V<0||j>N.width||V>N.height||(this.updateCellDimensions(),!this.cellDimensions.width||!this.cellDimensions.height))return null;const M=me(Math.floor(j/this.cellDimensions.width),0,this.terminal.cols-1),t=Math.floor(V/this.cellDimensions.height)+this.terminal.buffer.active.viewportY;return{col:M,row:Math.max(0,t)}}terminalCoordsToPixels(R){const k=this.getTerminalScreenElement();if(!k)return null;this.updateCellDimensions();const N=R.row-this.terminal.buffer.active.viewportY;if(N<0||N>=this.terminal.rows)return null;const j=k.getBoundingClientRect(),V=this.terminalContent.getBoundingClientRect();return{x:j.left-V.left+R.col*this.cellDimensions.width,y:j.top-V.top+N*this.cellDimensions.height}}updateCellDimensions(){const R=this.terminal._core?._renderService?.dimensions?.css?.cell;if(R?.width&&R.height){this.cellDimensions={width:R.width,height:R.height};return}const N=this.getTerminalScreenElement()?.getBoundingClientRect();if(!N||!this.terminal.cols||!this.terminal.rows){this.cellDimensions={width:0,height:0};return}this.cellDimensions={width:N.width/this.terminal.cols,height:N.height/this.terminal.rows}}getWordBoundsAt(R){const k=this.terminal.buffer.active.getLine(R.row);if(!k)return null;const N=k.translateToString(!1);if(!N||R.col>=N.length||/\s/.test(N[R.col]))return null;let j=R.col,V=R.col;for(;j>0&&!/\s/.test(N[j-1]);)j--;for(;V<N.length-1&&!/\s/.test(N[V+1]);)V++;return{start:{row:R.row,col:j},end:{row:R.row,col:V}}}blurTerminalInput(){this.terminal.element?.querySelector(".xterm-helper-textarea")?.blur()}scheduleTerminalFocus(){this.terminalFocusScheduler.schedule(()=>!this.isDestroyed&&!this.didScrollTouch&&!this.isSelecting&&!this.isHandleDragging&&!this.isPinching&&!this.isFinishingPinch&&this.pendingClearTouch===null)}cancelPendingTerminalFocus(){this.terminalFocusScheduler.cancel()}getTerminalScreenElement(){return this.terminal.element?.querySelector(".xterm-screen")??this.terminal.element??null}toTouchCoords(R){return{clientX:R.clientX,clientY:R.clientY}}clearTapHoldTimeout(){this.tapHoldTimeout!==null&&(window.clearTimeout(this.tapHoldTimeout),this.tapHoldTimeout=null)}dispose(){this.isDestroyed||(this.isDestroyed=!0,this.cancelPendingTerminalFocus(),this.clearTapHoldTimeout(),this.cancelInertia(),this.terminalContent.removeEventListener("touchstart",this.onTerminalTouchStart,{capture:!0}),this.terminalContent.removeEventListener("touchmove",this.onTerminalTouchMove,{capture:!0}),this.terminalContent.removeEventListener("touchend",this.onTerminalTouchEnd,{capture:!0}),this.terminalContent.removeEventListener("touchcancel",this.onTerminalTouchCancel,{capture:!0}),this.startHandle.removeEventListener("touchstart",this.onHandleTouchStart),this.startHandle.removeEventListener("touchmove",this.onHandleTouchMove),this.startHandle.removeEventListener("touchend",this.onHandleTouchEnd),this.startHandle.removeEventListener("touchcancel",this.onHandleTouchEnd),this.endHandle.removeEventListener("touchstart",this.onHandleTouchStart),this.endHandle.removeEventListener("touchmove",this.onHandleTouchMove),this.endHandle.removeEventListener("touchend",this.onHandleTouchEnd),this.endHandle.removeEventListener("touchcancel",this.onHandleTouchEnd),document.removeEventListener("touchstart",this.onDocumentTouchStart),this.disposables.forEach(R=>R.dispose()),this.disposables.length=0,this.overlay.remove(),this.didSetPosition&&(this.terminalContent.style.position=this.originalPosition))}}function li(z,R,k={}){return!ni()||!z.element?null:new hi(z,R,k)}const et=12,ci=64,ui=65;function tt(z){return typeof z!="string"||!/^[ \u00a0\u3000]+$/.test(z)?null:" ".repeat(z.length)}function di(z){return btoa(z)}function _i(z,R,k){const N=R&&k?xe(Math.floor((R.clientX-k.left)/Math.max(1,k.width)*z.cols)+1,1,z.cols):Math.max(1,Math.ceil(z.cols/2)),j=R&&k?xe(Math.floor((R.clientY-k.top)/Math.max(1,k.height)*z.rows)+1,1,z.rows):Math.max(1,Math.ceil(z.rows/2));return`\x1B[<2;${N};${j}M\x1B[<2;${N};${j}m`}function xe(z,R,k){return Math.max(R,Math.min(k,z))}function fi(z,R,k,N,j){const V=xe(Math.floor((R.clientX-k.left)/Math.max(1,k.width)*N)+1,1,N),M=xe(Math.floor((R.clientY-k.top)/Math.max(1,k.height)*j)+1,1,j);return`\x1B[<${z>0?ui:ci};${V};${M}M`.repeat(Math.abs(z))}function gi({terminal:z,getBoundingClientRect:R,send:k}){let N=0;const j=((V,M)=>{N+=V;const t=R(),a=t.height/Math.max(1,z.rows);if(!Number.isFinite(a)||a<=0)return!0;const h=Math.trunc(N/a);if(h===0)return!0;const l=xe(h,-et,et);return N-=l*a,k({type:"input",data:fi(l,M,t,Math.max(1,z.cols),Math.max(1,z.rows))}),!0});return j.reset=()=>{N=0},j}function vi({terminal:z,container:R,focusTarget:k=typeof window>"u"?null:window,visibilityTarget:N=typeof document>"u"?null:document,isVisible:j=()=>typeof document>"u"||document.visibilityState==="visible",shellMode:V,send:M}){let t=!1,a=null,h=null;const l=()=>{h!==null&&(clearTimeout(h),h=null)},s=()=>{l(),a=null},c=u=>{l(),a=u.data??""},f=u=>{if(a===null)return;const m=u;if(m.inputType&&m.inputType!=="insertText")return;const d=tt(m.data);if(d===null){m.data&&m.data!==a&&s();return}h===null&&(h=setTimeout(()=>{h=null,a=null,z.input(d,!0)},0))},g=()=>{V==="herdr"&&z.modes.mouseTrackingMode==="none"&&z.write(Rt)},o=u=>{V==="herdr"&&u.preventDefault()},e=()=>{V!=="herdr"||t||(t=!0,M({type:"viewport_claim",cols:z.cols,rows:z.rows}))},r=()=>{t=!1},i=()=>{j()?e():r()};R.addEventListener("contextmenu",o),R.addEventListener("pointerdown",e,!0),R.addEventListener("keydown",e,!0),k?.addEventListener("focus",e),k?.addEventListener("blur",r),N?.addEventListener("visibilitychange",i),V==="herdr"&&(R.addEventListener("compositionend",c,!0),R.addEventListener("beforeinput",f,!0),R.addEventListener("input",f,!0));const n=z.onData(u=>{a!==null&&(tt(u)!==null||u!==a)&&s(),M({type:"input",data:u})}),_=z.onBinary(u=>{M({type:"input_binary",data:di(u)})}),p=z.onWriteParsed(g);return g(),()=>{R.removeEventListener("contextmenu",o),R.removeEventListener("pointerdown",e,!0),R.removeEventListener("keydown",e,!0),k?.removeEventListener("focus",e),k?.removeEventListener("blur",r),N?.removeEventListener("visibilitychange",i),V==="herdr"&&(R.removeEventListener("compositionend",c,!0),R.removeEventListener("beforeinput",f,!0),R.removeEventListener("input",f,!0)),s(),n.dispose(),_.dispose(),p.dispose()}}const it="shell-xterm-focus-style",pi=`
67
67
  .xterm .xterm-screen {
68
68
  outline: none !important;
69
69
  }