wind-agent-cli 1.38.3 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/dist/api-docs.html +4 -3
- package/dist/assets/{CodeEditor-C9qFO6L8.js → CodeEditor-C8eMIGen.js} +1 -1
- package/dist/assets/{FileTree-0yJEzBi9.js → FileTree-D52nAPO4.js} +1 -1
- package/dist/assets/{GitPanel-BhbG7yVZ.js → GitPanel-DgeKbZsW.js} +1 -1
- package/dist/assets/{MarkdownPreview-C7pAt3xI.js → MarkdownPreview-B00VQTx6.js} +1 -1
- package/dist/assets/{Shell-CrjXAW4f.js → Shell-twzi9t5B.js} +7 -7
- package/dist/assets/{StandaloneShell-J5BR1g26.js → StandaloneShell-DH_GBJMj.js} +1 -1
- package/dist/assets/{TaskMasterPanel-B2wpEHWP.js → TaskMasterPanel-BY-pMPMl.js} +2 -2
- package/dist/assets/{abnfDiagram-N423BO3Z-DztbjsU0.js → abnfDiagram-N423BO3Z-BwBdstkH.js} +1 -1
- package/dist/assets/{arc-DRGumrCP.js → arc-C0IOpbFP.js} +1 -1
- package/dist/assets/{architectureDiagram-T3A2C74G-DnsczqwM.js → architectureDiagram-T3A2C74G-C-Wkj_AY.js} +1 -1
- package/dist/assets/{blockDiagram-VBNYF7ZC-CPsS5qw5.js → blockDiagram-VBNYF7ZC-_sXAZKku.js} +1 -1
- package/dist/assets/{c4Diagram-5PPSVZJV-DyjwDxYL.js → c4Diagram-5PPSVZJV-C0DUsZv8.js} +1 -1
- package/dist/assets/channel-B6xiB58V.js +1 -0
- package/dist/assets/{chunk-2GRJ4B5K-C794q4RK.js → chunk-2GRJ4B5K-D2TFB_6A.js} +1 -1
- package/dist/assets/{chunk-2Q5K7J3B-BfK76GMF.js → chunk-2Q5K7J3B-B_co_2bI.js} +1 -1
- package/dist/assets/{chunk-5RXB4S5H-Dmwk_KHT.js → chunk-5RXB4S5H-BcUSLq4H.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-DOeUnsxL.js → chunk-5VM5RSS4-0mQFBKSp.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-BrjdaybI.js → chunk-6Q2QTUOP-BAkqmW1M.js} +1 -1
- package/dist/assets/{chunk-GF5L2VYU-DCjoLr5D.js → chunk-GF5L2VYU-Cyz0Xl7f.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-TEJEfxQK.js → chunk-JWPE2WC7-DYO47aT-.js} +1 -1
- package/dist/assets/{chunk-KBJHAD2P-tbXW-dpx.js → chunk-KBJHAD2P-DvXEzV8J.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-CX4Zsite.js → chunk-RYQCIY6F-Beut8dYt.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-DVJXNcFN.js → chunk-XXDRQBXY-DLIy1GFl.js} +1 -1
- package/dist/assets/classDiagram-JCYQIIEL-C7xIPTll.js +1 -0
- package/dist/assets/classDiagram-v2-OCEON4UE-C7xIPTll.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-DLpXc-vJ.js → cose-bilkent-JH36ORCC-DynbO4dj.js} +1 -1
- package/dist/assets/{cynefin-VYW2F7L2-toFyL_eT.js → cynefin-VYW2F7L2-CYTJsH3o.js} +1 -1
- package/dist/assets/{cynefinDiagram-MW4NZA55-7KnX5nu-.js → cynefinDiagram-MW4NZA55-ftj-lAeE.js} +1 -1
- package/dist/assets/{dagre-VZM6K2ZE-C-QOFsDs.js → dagre-VZM6K2ZE-C1kSFboe.js} +1 -1
- package/dist/assets/{diagram-7IWD3JNH-26OmKaGK.js → diagram-7IWD3JNH-CqXHTFrY.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-0o9kK2uO.js → diagram-B4RE2ZJO-B84n3Zko.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-CAgMu3zd.js → diagram-LBJQPF4R-B710SefS.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-B0W-AePB.js → diagram-Q27KOJAE-CmVPl9pq.js} +1 -1
- package/dist/assets/{diagram-UB23O5K3-66AXZ7Mk.js → diagram-UB23O5K3-LozbeaFL.js} +1 -1
- package/dist/assets/{ebnfDiagram-BXEA7PRR-JlixVrAW.js → ebnfDiagram-BXEA7PRR-B321UBUA.js} +1 -1
- package/dist/assets/{erDiagram-JOGREHBK-ZxzuRr4f.js → erDiagram-JOGREHBK-CTbw676k.js} +1 -1
- package/dist/assets/feature-chat-pY0kOrz2.js +88 -0
- package/dist/assets/feature-workspace-FLomYkPq.js +39 -0
- package/dist/assets/{flowDiagram-UKHOOZJN-u67vU32D.js → flowDiagram-UKHOOZJN-BWVKTWlw.js} +1 -1
- package/dist/assets/{ganttDiagram-PKOTCBZU-Crl9IPqX.js → ganttDiagram-PKOTCBZU-BAj9eeeX.js} +1 -1
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-B2rTRd1W.js → gitGraphDiagram-DS77QQ5N-DcVMRU7N.js} +1 -1
- package/dist/assets/{index-YP8FmBZO.js → index-BYFstHFT.js} +1 -1
- package/dist/assets/index-BbBSplOU.js +35 -0
- package/dist/assets/{index-CPP7a6gU.js → index-BrWTp075.js} +1 -1
- package/dist/assets/index-CHukVVB2.css +1 -0
- package/dist/assets/{index-BTFkWJZe.js → index-k9M0VaFg.js} +1 -1
- package/dist/assets/{infoDiagram-6WML65LV-o9ZSr_ud.js → infoDiagram-6WML65LV-V6wz33B4.js} +1 -1
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-DnrbX4Ui.js → ishikawaDiagram-WSZJBQD7-Dd-WNPyK.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-CSfWpt5R.js → journeyDiagram-NVQOT4AX-D9VCuCeA.js} +1 -1
- package/dist/assets/{kanban-definition-27J2QSJJ-dj3PZxCQ.js → kanban-definition-27J2QSJJ-CUtwDOl-.js} +1 -1
- package/dist/assets/{linear-DieERJn8.js → linear-D_XGf1jO.js} +1 -1
- package/dist/assets/{mermaid.core-cq_VDJvZ.js → mermaid.core-DOnsXioB.js} +4 -4
- package/dist/assets/{mindmap-definition-FAOFIHXS-CHQ8W4LE.js → mindmap-definition-FAOFIHXS-DAYNL5ZV.js} +1 -1
- package/dist/assets/{pegDiagram-VL7TDLO6-CR2rMB3e.js → pegDiagram-VL7TDLO6-B5FX3-E6.js} +1 -1
- package/dist/assets/{pieDiagram-7S7Q4E2Y-Cs4NOlmu.js → pieDiagram-7S7Q4E2Y-EbnDBVd0.js} +1 -1
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-CdHqIaj5.js → quadrantDiagram-CIZ2JOQS-C1koOtwT.js} +1 -1
- package/dist/assets/{railroadDiagram-AXF67PYL-BNPU0Q8Z.js → railroadDiagram-AXF67PYL-D52xmshj.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-DwDQoirA.js → requirementDiagram-LRYGKXZP-B7VbfNnW.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-DSDSpLjf.js → sankeyDiagram-W5VNT64P-CeRG1vHN.js} +1 -1
- package/dist/assets/{sequenceDiagram-SI44F4Z6-zfhext7x.js → sequenceDiagram-SI44F4Z6-CfKHnmSE.js} +1 -1
- package/dist/assets/{sizeCapture-X5ZJPWSS-C56q6k2T.js → sizeCapture-X5ZJPWSS-DJTzyd0S.js} +1 -1
- package/dist/assets/{stateDiagram-OKZ733FA-D2lhrHPg.js → stateDiagram-OKZ733FA-DN0c7IYD.js} +1 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-DbihlVOQ.js +1 -0
- package/dist/assets/{swimlanes-SLNWSIFB-D1HyP0oO.js → swimlanes-SLNWSIFB-CaaJpBDA.js} +2 -2
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-BBRevuGP.js +8 -0
- package/dist/assets/{timeline-definition-Z64GVDOM-R1zaf6JI.js → timeline-definition-Z64GVDOM-CrzHN7d2.js} +1 -1
- package/dist/assets/{vennDiagram-T6HMQDX7-BwlaSNYk.js → vennDiagram-T6HMQDX7-BTldHIjo.js} +1 -1
- package/dist/assets/{wardleyDiagram-T6FBY63Y-Dd9-WAib.js → wardleyDiagram-T6FBY63Y-D9Y50OsZ.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-BVn4eBvu.js → xychartDiagram-ELKLHX3M-DjxSJ3aF.js} +1 -1
- package/dist/favicon.png +0 -0
- package/dist/icons/icon-128x128.png +0 -0
- package/dist/icons/icon-144x144.png +0 -0
- package/dist/icons/icon-152x152.png +0 -0
- package/dist/icons/icon-180x180.png +0 -0
- package/dist/icons/icon-192x192.png +0 -0
- package/dist/icons/icon-384x384.png +0 -0
- package/dist/icons/icon-512x512.png +0 -0
- package/dist/icons/icon-72x72.png +0 -0
- package/dist/icons/icon-96x96.png +0 -0
- package/dist/icons/icon-maskable-192x192.png +0 -0
- package/dist/icons/icon-maskable-512x512.png +0 -0
- package/dist/icons/new.png +0 -0
- package/dist/index.html +4 -4
- package/dist/logo-128.png +0 -0
- package/dist/logo-256.png +0 -0
- package/dist/sw.js +1 -1
- package/dist-server/server/index.js +2 -0
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/modules/agent/agent.routes.js +14 -2
- package/dist-server/server/modules/agent/agent.routes.js.map +1 -1
- package/dist-server/server/modules/agent/tests/agent.routes.test.js +1 -0
- package/dist-server/server/modules/agent/tests/agent.routes.test.js.map +1 -1
- package/dist-server/server/modules/commands/commands.routes.js +2 -1
- package/dist-server/server/modules/commands/commands.routes.js.map +1 -1
- package/dist-server/server/modules/database/migrations.js +43 -0
- package/dist-server/server/modules/database/migrations.js.map +1 -1
- package/dist-server/server/modules/database/tests/projects.db.integration.test.js +24 -1
- package/dist-server/server/modules/database/tests/projects.db.integration.test.js.map +1 -1
- package/dist-server/server/modules/notifications/services/notification-orchestrator.service.js +2 -0
- package/dist-server/server/modules/notifications/services/notification-orchestrator.service.js.map +1 -1
- package/dist-server/server/modules/providers/list/opencode/opencode-session-synchronizer.provider.js +10 -1
- package/dist-server/server/modules/providers/list/opencode/opencode-session-synchronizer.provider.js.map +1 -1
- package/dist-server/server/modules/providers/list/pi/index.js +5 -0
- package/dist-server/server/modules/providers/list/pi/index.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-auth.provider.js +55 -0
- package/dist-server/server/modules/providers/list/pi/pi-auth.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-mcp.provider.js +23 -0
- package/dist-server/server/modules/providers/list/pi/pi-mcp.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-models.provider.js +99 -0
- package/dist-server/server/modules/providers/list/pi/pi-models.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-runtime.provider.js +262 -0
- package/dist-server/server/modules/providers/list/pi/pi-runtime.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-session-synchronizer.provider.js +136 -0
- package/dist-server/server/modules/providers/list/pi/pi-session-synchronizer.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-sessions.provider.js +225 -0
- package/dist-server/server/modules/providers/list/pi/pi-sessions.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi-skills.provider.js +31 -0
- package/dist-server/server/modules/providers/list/pi/pi-skills.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/pi/pi.provider.js +22 -0
- package/dist-server/server/modules/providers/list/pi/pi.provider.js.map +1 -0
- package/dist-server/server/modules/providers/provider.registry.js +2 -0
- package/dist-server/server/modules/providers/provider.registry.js.map +1 -1
- package/dist-server/server/modules/providers/provider.routes.js +2 -1
- package/dist-server/server/modules/providers/provider.routes.js.map +1 -1
- package/dist-server/server/modules/providers/services/provider-capabilities.service.js +26 -0
- package/dist-server/server/modules/providers/services/provider-capabilities.service.js.map +1 -1
- package/dist-server/server/modules/providers/services/session-synchronizer.service.js +1 -0
- package/dist-server/server/modules/providers/services/session-synchronizer.service.js.map +1 -1
- package/dist-server/server/modules/providers/services/sessions-watcher.service.js +5 -0
- package/dist-server/server/modules/providers/services/sessions-watcher.service.js.map +1 -1
- package/dist-server/server/modules/providers/tests/mcp.test.js +4 -2
- package/dist-server/server/modules/providers/tests/mcp.test.js.map +1 -1
- package/dist-server/server/modules/providers/tests/opencode-sessions.test.js +56 -5
- package/dist-server/server/modules/providers/tests/opencode-sessions.test.js.map +1 -1
- package/dist-server/server/modules/providers/tests/pi-provider.test.js +244 -0
- package/dist-server/server/modules/providers/tests/pi-provider.test.js.map +1 -0
- package/dist-server/server/modules/providers/tests/provider-runtime.service.test.js +9 -0
- package/dist-server/server/modules/providers/tests/provider-runtime.service.test.js.map +1 -1
- package/dist-server/server/shared/utils.js +19 -0
- package/dist-server/server/shared/utils.js.map +1 -1
- package/package.json +1 -1
- package/public/api-docs.html +4 -3
- package/scripts/generate-pwa-icons.ps1 +1 -1
- package/server/index.ts +2 -0
- package/server/modules/agent/agent.module.ts +1 -1
- package/server/modules/agent/agent.routes.ts +15 -2
- package/server/modules/agent/tests/agent.routes.test.ts +1 -0
- package/server/modules/commands/commands.routes.ts +2 -1
- package/server/modules/database/migrations.ts +52 -0
- package/server/modules/database/tests/projects.db.integration.test.ts +28 -1
- package/server/modules/notifications/services/notification-orchestrator.service.js +2 -0
- package/server/modules/providers/README.md +5 -1
- package/server/modules/providers/list/opencode/opencode-session-synchronizer.provider.ts +18 -0
- package/server/modules/providers/list/pi/index.ts +4 -0
- package/server/modules/providers/list/pi/pi-auth.provider.ts +58 -0
- package/server/modules/providers/list/pi/pi-mcp.provider.ts +33 -0
- package/server/modules/providers/list/pi/pi-models.provider.ts +114 -0
- package/server/modules/providers/list/pi/pi-runtime.provider.ts +271 -0
- package/server/modules/providers/list/pi/pi-session-synchronizer.provider.ts +134 -0
- package/server/modules/providers/list/pi/pi-sessions.provider.ts +206 -0
- package/server/modules/providers/list/pi/pi-skills.provider.ts +37 -0
- package/server/modules/providers/list/pi/pi.provider.ts +33 -0
- package/server/modules/providers/provider.registry.ts +2 -0
- package/server/modules/providers/provider.routes.ts +1 -0
- package/server/modules/providers/services/provider-capabilities.service.ts +32 -0
- package/server/modules/providers/services/session-synchronizer.service.ts +1 -0
- package/server/modules/providers/services/sessions-watcher.service.ts +5 -0
- package/server/modules/providers/tests/mcp.test.ts +4 -2
- package/server/modules/providers/tests/opencode-sessions.test.ts +81 -6
- package/server/modules/providers/tests/pi-provider.test.ts +244 -0
- package/server/modules/providers/tests/provider-runtime.service.test.ts +10 -0
- package/server/shared/types.ts +1 -1
- package/server/shared/utils.ts +23 -0
- package/dist/assets/channel-Dj-iU3BT.js +0 -1
- package/dist/assets/classDiagram-JCYQIIEL-euwGMP6E.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-euwGMP6E.js +0 -1
- package/dist/assets/feature-chat-CNYDDkFQ.js +0 -88
- package/dist/assets/feature-workspace-BMlv7Ust.js +0 -39
- package/dist/assets/index-Cr5MbHuj.css +0 -1
- package/dist/assets/index-uINlYqXe.js +0 -35
- package/dist/assets/stateDiagram-v2-UEYNNEHI-C3wzBtFn.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-Dts8yQMu.js +0 -8
- package/dist/icons/new-icon.png +0 -0
|
@@ -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-BMlv7Ust.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 _t,a5 as ft,g as Ae}from"./feature-workspace-FLomYkPq.js";import{L as je,u as nt,X as gt,bz as vt,av as pt,aB as mt,aV as St,aM as Ct,bA as bt}from"./vendor-ui-CAUHSABu.js";import{u as ot}from"./vendor-i18n-B6HjLCnN.js";const wt=200,at=100,yt=50,xt=768,Et=480,Lt=9,Rt=12,Tt="\x1B[?1002h\x1B[?1006h",Dt=500,At=20,Mt=15,kt=5,Bt=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 Pt(z,R,k){return!k&&z===R}function qe(z="default",R=Number.POSITIVE_INFINITY){return z!=="herdr"?{...Te}:{...Te,fontSize:R<=Et?Lt:R<xt?Rt:Te.fontSize,convertEol:!1,cursorBlink:!1,scrollback:0,theme:{...Te.theme,cursor:"rgba(0, 0, 0, 0)",cursorAccent:"rgba(0, 0, 0, 0)"}}}const Ot=0,It=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===Ot||R.readyState===It)&&R.close(),!0)}function ye(z,R){return z?z.fullPath||z.path||"":R==="herdr"?"":null}function Ft(){const z=window.location.protocol==="https:"?"wss:":"ws:";if(_t)return`${z}//${window.location.host}/shell`;const R=ft();return R?`${z}//${window.location.host}/shell?token=${encodeURIComponent(R)}`:(console.error("No authentication token found for Shell WebSocket connection"),null)}function Ht(z){try{return JSON.parse(z)}catch{return null}}function fe(z,R){z&&z.readyState===WebSocket.OPEN&&z.send(JSON.stringify(R))}const Nt=/(?:\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,Wt=/Process exited with code (\d+)/;function $t({connectionKey:z,wsRef:R,terminalRef:k,fitAddonRef:H,selectedProjectRef:j,selectedSessionRef:q,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(Nt,"");if(C.includes("Process exited with code 0")){a.current(0);return}const E=C.match(Wt);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=Ht(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=Ft();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=H.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:q.current?.id||null,hasSession:t.current?!1:!!q.current,provider:t.current?"plain-shell":q.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,H,w,M,e,i,t,j,q,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 Ut(){return Ve||(Ve=1,(function(z,R){(function(k,H){z.exports=H()})(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,V,ee,G,te="",ae=A.length%3,Q=0;Q<A.length;){if((V=A.charCodeAt(Q++))>255||(ee=A.charCodeAt(Q++))>255||(G=A.charCodeAt(Q++))>255)throw new TypeError("invalid character found");te+=o[(W=V<<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=[],V=0,ee=A.length;V<ee;V+=4096)W.push(i.apply(null,A.subarray(V,V+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,V,ee,G="",te=0;te<A.length;)W=e[A.charAt(te++)]<<18|e[A.charAt(te++)]<<12|(V=e[A.charAt(te++)])<<6|(ee=e[A.charAt(te++)]),G+=V===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,V){return Object.defineProperty(String.prototype,W,X(V))};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,V){return Object.defineProperty(Uint8Array.prototype,W,X(V))};A("toBase64",(function(W){return v(this,W)})),A("toBase64URI",(function(){return v(this,!0)})),A("toBase64URL",(function(){return v(this,!0)}))},N={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(N).forEach((function(A){return N.Base64[A]=N[A]})),N})()}},H={};function j(M){var t=H[M];if(t!==void 0)return t.exports;var a=H[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 q={};return(()=>{var M=q;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})(),q})()))})(ke)),ke.exports}var zt=Ut(),Be={exports:{}},Ke;function jt(){return Ke||(Ke=1,(function(z,R){(function(k,H){z.exports=H()})(self,(()=>(()=>{var k={};return(()=>{var H=k;Object.defineProperty(H,"__esModule",{value:!0}),H.FitAddon=void 0,H.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 q=this._terminal._core;this._terminal.rows===j.rows&&this._terminal.cols===j.cols||(q._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,q=j._renderService.dimensions;if(q.css.cell.width===0||q.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/q.css.cell.width)),rows:Math.max(1,Math.floor(s/q.css.cell.height))}}}})(),k})()))})(Be)),Be.exports}var qt=jt(),Pe={exports:{}},Ge;function Vt(){return Ge||(Ge=1,(function(z,R){(function(k,H){z.exports=H()})(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}},H={};function j(M){var t=H[M];if(t!==void 0)return t.exports;var a=H[M]={exports:{}};return k[M](a,a.exports,j),a.exports}var q={};return(()=>{var M=q;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()}}})(),q})()))})(Pe)),Pe.exports}var Kt=Vt(),Oe={exports:{}},Xe;function Gt(){return Xe||(Xe=1,(function(z,R){(function(k,H){z.exports=H()})(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;
|
|
@@ -55,15 +55,15 @@ out vec4 outColor;
|
|
|
55
55
|
|
|
56
56
|
void main() {
|
|
57
57
|
outColor = v_color;
|
|
58
|
-
}`)),this.register((0,l.toDisposable)((()=>b.deleteProgram(this._program)))),this._projectionLocation=(0,h.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),x=b.createBuffer();this.register((0,l.toDisposable)((()=>b.deleteBuffer(x)))),b.bindBuffer(b.ARRAY_BUFFER,x),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),F=b.createBuffer();this.register((0,l.toDisposable)((()=>b.deleteBuffer(F)))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,F),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(b.createBuffer()),this.register((0,l.toDisposable)((()=>b.deleteBuffer(this._attributesBuffer)))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,f,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors((I=>{this._updateCachedColors(I),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(d){const v=this._gl;v.useProgram(this._program),v.bindVertexArray(this._vertexArrayObject),v.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),v.bindBuffer(v.ARRAY_BUFFER,this._attributesBuffer),v.bufferData(v.ARRAY_BUFFER,d.attributes,v.DYNAMIC_DRAW),v.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,v.UNSIGNED_BYTE,0,d.count)}handleResize(){this._updateViewportRectangle()}setDimensions(d){this._dimensions=d}_updateCachedColors(d){this._bgFloat=this._colorToFloat32Array(d.background),this._cursorFloat=this._colorToFloat32Array(d.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(d){const v=this._terminal,S=this._vertices;let y,b,w,x,B,F,I,O,C,E,T,D=1;for(y=0;y<v.rows;y++){for(w=-1,x=0,B=0,F=!1,b=0;b<v.cols;b++)I=(y*v.cols+b)*s.RENDER_MODEL_INDICIES_PER_CELL,O=d.cells[I+s.RENDER_MODEL_BG_OFFSET],C=d.cells[I+s.RENDER_MODEL_FG_OFFSET],E=!!(67108864&C),(O!==x||C!==B&&(F||E))&&((x!==0||F&&B!==0)&&(T=8*D++,this._updateRectangle(S,T,B,x,w,b,y)),w=b,x=O,B=C,F=E);(x!==0||F&&B!==0)&&(T=8*D++,this._updateRectangle(S,T,B,x,w,v.cols,y))}S.count=D}updateCursor(d){const v=this._verticesCursor,S=d.cursor;if(!S||S.style==="block")return void(v.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(v.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(v.attributes,y,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(y=8*b++,this._addRectangleFloat(v.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),y=8*b++,this._addRectangleFloat(v.attributes,y,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),v.count=b}_updateRectangle(d,v,S,y,b,w,x){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&y){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&y].rgba;break;case 50331648:o=(16777215&y)<<8;break;default:o=this._themeService.colors.background.rgba}d.attributes.length<v+4&&(d.attributes=(0,c.expandFloat32Array)(d.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,r=x*this._dimensions.device.cell.height,i=(o>>24&255)/255,n=(o>>16&255)/255,_=(o>>8&255)/255,p=1,this._addRectangle(d.attributes,v,e,r,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,n,_,p)}_addRectangle(d,v,S,y,b,w,x,B,F,I){d[v]=S/this._dimensions.device.canvas.width,d[v+1]=y/this._dimensions.device.canvas.height,d[v+2]=b/this._dimensions.device.canvas.width,d[v+3]=w/this._dimensions.device.canvas.height,d[v+4]=x,d[v+5]=B,d[v+6]=F,d[v+7]=I}_addRectangleFloat(d,v,S,y,b,w,x){d[v]=S/this._dimensions.device.canvas.width,d[v+1]=y/this._dimensions.device.canvas.height,d[v+2]=b/this._dimensions.device.canvas.width,d[v+3]=w/this._dimensions.device.canvas.height,d[v+4]=x[0],d[v+5]=x[1],d[v+6]=x[2],d[v+7]=x[3]}_colorToFloat32Array(d){return new Float32Array([(d.rgba>>24&255)/255,(d.rgba>>16&255)/255,(d.rgba>>8&255)/255,(255&d.rgba)/255])}}t.RectangleRenderer=u},310:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,s){const c=l*s*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),s=a(627),c=a(457),f=a(56),g=a(374),o=a(345),e=a(859),r=a(147),i=a(782),n=a(855),_=a(965),p=a(742),u=a(310),m=a(733);class d extends e.Disposable{constructor(b,w,x,B,F,I,O,C,E){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=x,this._coreBrowserService=B,this._coreService=F,this._decorationService=I,this._optionsService=O,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new u.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,O,this._themeService)],this.dimensions=(0,g.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(O.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const T={antialias:!1,depth:!1,preserveDrawingBuffer:E};if(this._gl=this._canvas.getContext("webgl2",T),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",(D=>{console.log("webglcontextlost event received"),D.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(D)}),3e3)}))),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",(D=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((D,U)=>this._setCanvasDevicePixelDimensions(D,U))),this.register(this._coreBrowserService.onWindowChange((D=>{this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,D,((U,$)=>this._setCanvasDevicePixelDimensions(U,$)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)((()=>{for(const D of this._renderLayers)D.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(b,w){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const x of this._renderLayers)x.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(const b of this._renderLayers)b.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(const b of this._renderLayers)b.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(b,w,x){for(const B of this._renderLayers)B.handleSelectionChanged(this._terminal,b,w,x);this._model.selection.update(this._core,b,w,x),this._requestRedrawViewport()}handleCursorMove(){for(const b of this._renderLayers)b.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new p.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(b){this._model.clear(),b&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(const b of this._renderLayers)b.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const x of this._renderLayers)x.handleGridChanged(this._terminal,b,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(b,w),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const x=this._core;let B,F,I,O,C,E,T,D,U,$,K,X,P,L,H=this._workCell;b=S(b,x.rows-1,0),w=S(w,x.rows-1,0);const A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,W=A-x.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,x.cols-1);let ee=-1;const G=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let te=!1;for(F=b;F<=w;F++)for(I=F+x.buffer.ydisp,O=x.buffer.lines.get(I),this._model.lineLengths[F]=0,C=this._characterJoinerService.getJoinedCharacters(I),P=0;P<x.cols;P++)if(B=this._cellColorResolver.result.bg,O.loadCell(P,H),P===0&&(B=this._cellColorResolver.result.bg),E=!1,T=P,C.length>0&&P===C[0][0]&&(E=!0,D=C.shift(),H=new v(H,O.translateToString(!0,D[0],D[1]),D[1]-D[0]),T=D[1]-1),U=H.getChars(),$=H.getCode(),X=(F*x.cols+P)*u.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(H,P,I,this.dimensions.device.cell.width),G&&I===A&&(P===q&&(this._model.cursor={x:q,y:W,width:H.getWidth(),style:this._coreBrowserService.isFocused?x.options.cursorStyle||"block":x.options.cursorInactiveStyle,cursorWidth:x.options.cursorWidth,dpr:this._devicePixelRatio},ee=q+H.getWidth()-1),P>=q&&P<=ee&&(this._coreBrowserService.isFocused&&(x.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&x.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),$!==n.NULL_CELL_CODE&&(this._model.lineLengths[F]=P+1),(this._model.cells[X]!==$||this._model.cells[X+u.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[X+u.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[X+u.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(te=!0,U.length>1&&($|=u.COMBINED_CHAR_BIT_MASK),this._model.cells[X]=$,this._model.cells[X+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[X+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[X+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,K=H.getWidth(),this._glyphRenderer.value.updateCell(P,F,$,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,K,B),E))for(H=this._workCell,P++;P<T;P++)L=(F*x.cols+P)*u.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(P,F,n.NULL_CELL_CODE,0,0,0,n.NULL_CELL_CHAR,0,0),this._model.cells[L]=n.NULL_CELL_CODE,this._model.cells[L+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[L+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[L+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;te&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(b,w){this._canvas.width===b&&this._canvas.height===w||(this._canvas.width=b,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const b=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:b,end:b})}}t.WebglRenderer=d;class v extends r.AttributeData{constructor(b,w,x){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=x}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(y,b,w=0){return Math.max(Math.min(y,b),w)}t.JoinedCellData=v},381:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function l(s,c,f){const g=(0,h.throwIfFalsy)(s.createShader(c));if(s.shaderSource(g,f),s.compileShader(g),s.getShaderParameter(g,s.COMPILE_STATUS))return g;console.error(s.getShaderInfoLog(g)),s.deleteShader(g)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,c,f){const g=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(g,(0,h.throwIfFalsy)(l(s,s.VERTEX_SHADER,c))),s.attachShader(g,(0,h.throwIfFalsy)(l(s,s.FRAGMENT_SHADER,f))),s.linkProgram(g),s.getProgramParameter(g,s.LINK_STATUS))return g;console.error(s.getProgramInfoLog(g)),s.deleteProgram(g)},t.createShader=l,t.expandFloat32Array=function(s,c){const f=Math.min(2*s.length,c),g=new Float32Array(f);for(let o=0;o<s.length;o++)g[o]=s[o];return g},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),s=a(374),c=a(859);class f extends c.Disposable{constructor(o,e,r,i,n,_,p,u){super(),this._container=e,this._alpha=n,this._coreBrowserService=_,this._optionsService=p,this._themeService=u,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((m=>{this._refreshCharAtlas(o,m),this.reset(o)}))),this.register((0,c.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=f},733:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),s=a(592);class c extends s.BaseRenderLayer{constructor(g,o,e,r,i,n,_){super(e,g,"link",o,!0,i,n,_),this.register(r.onShowLinkUnderline((p=>this._handleShowLinkUnderline(p)))),this.register(r.onHideLinkUnderline((p=>this._handleHideLinkUnderline(p))))}resize(g,o){super.resize(g,o),this._state=void 0}reset(g){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const g=this._state.y2-this._state.y1-1;g>0&&this._clearCells(0,this._state.y1+1,this._state.cols,g),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(g){if(g.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:g.fg!==void 0&&(0,h.is256Color)(g.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[g.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,g.y1===g.y2)this._fillBottomLineAtCells(g.x1,g.y1,g.x2-g.x1);else{this._fillBottomLineAtCells(g.x1,g.y1,g.cols-g.x1);for(let o=g.y1+1;o<g.y2;o++)this._fillBottomLineAtCells(0,o,g.cols);this._fillBottomLineAtCells(0,g.y2,g.x2)}this._state=g}_handleHideLinkUnderline(g){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},274:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),s=a(374);let c,f=0,g=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(n,_,p,u,m,d){this._terminal=n,this._optionService=_,this._selectionRenderModel=p,this._decorationService=u,this._coreBrowserService=m,this._themeService=d,this.result={fg:0,bg:0,ext:0}}resolve(n,_,p,u){if(this.result.bg=n.bg,this.result.fg=n.fg,this.result.ext=268435456&n.bg?n.extended.ext:0,g=0,f=0,e=!1,o=!1,r=!1,c=this._themeService.colors,i=0,n.getCode()!==h.NULL_CELL_CODE&&n.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=_*u%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(_,p,"bottom",(m=>{m.backgroundColorRGB&&(g=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(f=m.foregroundColorRGB.rgba>>8&16777215,o=!0)})),r=this._selectionRenderModel.isCellSelected(this._terminal,_,p),r){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}g=l.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else g=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(f=c.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(n.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(_,p,"top",(m=>{m.backgroundColorRGB&&(g=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(f=m.foregroundColorRGB.rgba>>8&16777215,o=!0)})),e&&(g=r?-16777216&n.bg&-134217729|g|50331648:-16777216&n.bg|g|50331648),o&&(f=-16777216&n.fg&-67108865|f|50331648),67108864&this.result.fg&&(e&&!o&&(f=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,o=!0),!e&&o&&(g=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,e=!0)),c=void 0,this.result.bg=e?g:this.result.bg,this.result.fg=o?f:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),s=[];t.acquireTextureAtlas=function(c,f,g,o,e,r,i,n){const _=(0,l.generateConfig)(o,e,r,i,f,g,n);for(let m=0;m<s.length;m++){const d=s[m],v=d.ownedBy.indexOf(c);if(v>=0){if((0,l.configEquals)(d.config,_))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),s.splice(m,1)):d.ownedBy.splice(v,1);break}}for(let m=0;m<s.length;m++){const d=s[m];if((0,l.configEquals)(d.config,_))return d.ownedBy.push(c),d.atlas}const p=c._core,u={atlas:new h.TextureAtlas(document,_,p.unicodeService),config:_,ownedBy:[c]};return s.push(u),u.atlas},t.removeTerminalFromCache=function(c){for(let f=0;f<s.length;f++){const g=s[f].ownedBy.indexOf(c);if(g!==-1){s[f].ownedBy.length===1?(s[f].atlas.dispose(),s.splice(f,1)):s[f].ownedBy.splice(g,1);break}}}},197:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,s,c,f,g,o,e){const r={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:g.customGlyphs,devicePixelRatio:e,letterSpacing:g.letterSpacing,lineHeight:g.lineHeight,deviceCellWidth:l,deviceCellHeight:s,deviceCharWidth:c,deviceCharHeight:f,fontFamily:g.fontFamily,fontSize:g.fontSize,fontWeight:g.fontWeight,fontWeightBold:g.fontWeightBold,allowTransparency:g.allowTransparency,drawBoldTextInBrightColors:g.drawBoldTextInBrightColors,minimumContrastRatio:g.minimumContrastRatio,colors:r}},t.configEquals=function(l,s){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==s.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===s.devicePixelRatio&&l.customGlyphs===s.customGlyphs&&l.lineHeight===s.lineHeight&&l.letterSpacing===s.letterSpacing&&l.fontFamily===s.fontFamily&&l.fontSize===s.fontSize&&l.fontWeight===s.fontWeight&&l.fontWeightBold===s.fontWeightBold&&l.allowTransparency===s.allowTransparency&&l.deviceCharWidth===s.deviceCharWidth&&l.deviceCharHeight===s.deviceCharHeight&&l.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&l.minimumContrastRatio===s.minimumContrastRatio&&l.colors.foreground.rgba===s.colors.foreground.rgba&&l.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,n,_,p,u){const m=t.blockElementDefinitions[e];if(m)return(function(y,b,w,x,B,F){for(let I=0;I<b.length;I++){const O=b[I],C=B/8,E=F/8;y.fillRect(w+O.x*C,x+O.y*E,O.w*C,O.h*E)}})(o,m,r,i,n,_),!0;const d=l[e];if(d)return(function(y,b,w,x,B,F){let I=s.get(b);I||(I=new Map,s.set(b,I));const O=y.fillStyle;if(typeof O!="string")throw new Error(`Unexpected fillStyle type "${O}"`);let C=I.get(O);if(!C){const E=b[0].length,T=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=E,D.height=T;const U=(0,h.throwIfFalsy)(D.getContext("2d")),$=new ImageData(E,T);let K,X,P,L;if(O.startsWith("#"))K=parseInt(O.slice(1,3),16),X=parseInt(O.slice(3,5),16),P=parseInt(O.slice(5,7),16),L=O.length>7&&parseInt(O.slice(7,9),16)||1;else{if(!O.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${O}" when drawing pattern glyph`);[K,X,P,L]=O.substring(5,O.length-1).split(",").map((H=>parseFloat(H)))}for(let H=0;H<T;H++)for(let A=0;A<E;A++)$.data[4*(H*E+A)]=K,$.data[4*(H*E+A)+1]=X,$.data[4*(H*E+A)+2]=P,$.data[4*(H*E+A)+3]=b[H][A]*(255*L);U.putImageData($,0,0),C=(0,h.throwIfFalsy)(y.createPattern(D,null)),I.set(O,C)}y.fillStyle=C,y.fillRect(w,x,B,F)})(o,d,r,i,n,_),!0;const v=t.boxDrawingDefinitions[e];if(v)return(function(y,b,w,x,B,F,I){y.strokeStyle=y.fillStyle;for(const[O,C]of Object.entries(b)){let E;y.beginPath(),y.lineWidth=I*Number.parseInt(O),E=typeof C=="function"?C(.15,.15/F*B):C;for(const T of E.split(" ")){const D=T[0],U=f[D];if(!U){console.error(`Could not find drawing instructions for "${D}"`);continue}const $=T.substring(1).split(",");$[0]&&$[1]&&U(y,g($,B,F,w,x,!0,I))}y.stroke(),y.closePath()}})(o,v,r,i,n,_,u),!0;const S=t.powerlineDefinitions[e];return!!S&&((function(y,b,w,x,B,F,I,O){const C=new Path2D;C.rect(w,x,B,F),y.clip(C),y.beginPath();const E=I/12;y.lineWidth=O*E;for(const T of b.d.split(" ")){const D=T[0],U=f[D];if(!U){console.error(`Could not find drawing instructions for "${D}"`);continue}const $=T.substring(1).split(",");$[0]&&$[1]&&U(y,g($,B,F,w,x,!1,O,(b.leftPadding??0)*(E/2),(b.rightPadding??0)*(E/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()})(o,S,r,i,n,_,p,u),!0)};const s=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const f={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function g(o,e,r,i,n,_,p,u=0,m=0){const d=o.map((v=>parseFloat(v)||parseInt(v)));if(d.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<d.length;v+=2)d[v]*=e-u*p-m*p,_&&d[v]!==0&&(d[v]=c(Math.round(d[v]+.5)-.5,e,0)),d[v]+=i+u*p;for(let v=1;v<d.length;v+=2)d[v]*=r,_&&d[v]!==0&&(d[v]=c(Math.round(d[v]+.5)-.5,r,0)),d[v]+=n;return d}},56:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,s,c){let f=new s.ResizeObserver((g=>{const o=g.find((i=>i.target===l));if(!o)return;if(!("devicePixelContentBoxSize"in o))return f?.disconnect(),void(f=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)}));try{f.observe(l,{box:["device-pixel-content-box"]})}catch{f.disconnect(),f=void 0}return(0,h.toDisposable)((()=>f?.disconnect()))}},374:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,f){return s===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!(function(g){return 57344<=g&&g<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(s){return 9472<=s&&s<=9631})(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},296:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,s,c,f=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const g=l.buffers.active.ydisp,o=s[1]-g,e=c[1]-g,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),s=a(374),c=a(160),f=a(345),g=a(485),o=a(385),e=a(147),r=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let n;class _{get pages(){return this._pages}constructor(v,S,y){this._document=v,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new g.FourKeyMap,this._cacheMapCombined=new g.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new f.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new f.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(v,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const v of this.pages)v.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const v=new o.IdleTaskQueue;for(let S=33;S<126;S++)v.enqueue((()=>{if(!this._cacheMap.get(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const y=this._drawToCache(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,y)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const v of this._pages)v.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(_.maxAtlasPages&&this._pages.length>=Math.max(4,_.maxAtlasPages)){const S=this._pages.filter((I=>2*I.canvas.width<=(_.maxTextureSize||4096))).sort(((I,O)=>O.canvas.width!==I.canvas.width?O.canvas.width-I.canvas.width:O.percentageUsed-I.percentageUsed));let y=-1,b=0;for(let I=0;I<S.length;I++)if(S[I].canvas.width!==b)y=I,b=S[I].canvas.width;else if(I-y==3)break;const w=S.slice(y,y+4),x=w.map((I=>I.glyphs[0].texturePage)).sort(((I,O)=>I>O?1:-1)),B=this.pages.length-w.length,F=this._mergePages(w,B);F.version++;for(let I=x.length-1;I>=0;I--)this._deletePage(x[I]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const v=new p(this._document,this._textureSize);return this._pages.push(v),this._activePages.push(v),this._onAddTextureAtlasCanvas.fire(v.canvas),v}_mergePages(v,S){const y=2*v[0].canvas.width,b=new p(this._document,y,v);for(const[w,x]of v.entries()){const B=w*x.canvas.width%y,F=Math.floor(w/2)*x.canvas.height;b.ctx.drawImage(x.canvas,B,F);for(const O of x.glyphs)O.texturePage=S,O.sizeClipSpace.x=O.size.x/y,O.sizeClipSpace.y=O.size.y/y,O.texturePosition.x+=B,O.texturePosition.y+=F,O.texturePositionClipSpace.x=O.texturePosition.x/y,O.texturePositionClipSpace.y=O.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(x.canvas);const I=this._activePages.indexOf(x);I!==-1&&this._activePages.splice(I,1)}return b}_deletePage(v){this._pages.splice(v,1);for(let S=v;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(v,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,v,S,y,b,w)}getRasterizedGlyph(v,S,y,b,w){return this._getFromCacheMap(this._cacheMap,v,S,y,b,w)}_getFromCacheMap(v,S,y,b,w,x=!1){return n=v.get(S,y,b,w),n||(n=this._drawToCache(S,y,b,w,x),v.set(S,y,b,w,n)),n}_getColorFromAnsiIndex(v){if(v>=this._config.colors.ansi.length)throw new Error("No color found for idx "+v);return this._config.colors.ansi[v]}_getBackgroundColor(v,S,y,b){if(this._config.allowTransparency)return c.NULL_COLOR;let w;switch(v){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const x=e.AttributeData.toColorRGB(S);w=c.channels.toColor(x[0],x[1],x[2]);break;default:w=y?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(v,S,y,b,w,x,B,F,I,O){const C=this._getMinimumContrastColor(v,S,y,b,w,x,B,I,F,O);if(C)return C;let E;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&I&&x<8&&(x+=8),E=this._getColorFromAnsiIndex(x);break;case 50331648:const T=e.AttributeData.toColorRGB(x);E=c.channels.toColor(T[0],T[1],T[2]);break;default:E=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(E=c.color.opaque(E)),F&&(E=c.color.multiplyOpacity(E,h.DIM_OPACITY)),E}_resolveBackgroundRgba(v,S,y){switch(v){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(v,S,y,b){switch(v){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&b&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(v,S,y,b,w,x,B,F,I,O){if(this._config.minimumContrastRatio===1||O)return;const C=this._getContrastCache(I),E=C.getColor(v,b);if(E!==void 0)return E||void 0;const T=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,x,B,F),U=c.rgba.ensureContrastRatio(T,D,this._config.minimumContrastRatio/(I?2:1));if(!U)return void C.setColor(v,b,null);const $=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return C.setColor(v,b,$),$}_getContrastCache(v){return v?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(v,S,y,b,w=!1){const x=typeof v=="number"?String.fromCharCode(v):v,B=Math.min(this._config.deviceCellWidth*Math.max(x.length,2)+4,this._textureSize);this._tmpCanvas.width<B&&(this._tmpCanvas.width=B);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return i;const I=!!this._workAttributeData.isBold(),O=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),E=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),D=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let $=this._workAttributeData.getFgColor(),K=this._workAttributeData.getFgColorMode(),X=this._workAttributeData.getBgColor(),P=this._workAttributeData.getBgColorMode();if(O){const Z=$;$=X,X=Z;const ne=K;K=P,P=ne}const L=this._getBackgroundColor(P,X,O,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const H=I?this._config.fontWeightBold:this._config.fontWeight,A=E?"italic":"";this._tmpCtx.font=`${A} ${H} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const W=x.length===1&&(0,s.isPowerlineGlyph)(x.charCodeAt(0)),q=x.length===1&&(0,s.isRestrictedPowerlineGlyph)(x.charCodeAt(0)),ee=this._getForegroundColor(S,P,X,y,K,$,O,C,I,(0,s.treatGlyphAsBackgroundColor)(x.charCodeAt(0)));this._tmpCtx.fillStyle=ee.css;const G=q?0:4;let te=!1;this._config.customGlyphs!==!1&&(te=(0,l.tryDrawCustomChar)(this._tmpCtx,x,G,G,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ae,Q=!W;if(ae=typeof v=="number"?this._unicodeService.wcwidth(v):this._unicodeService.getStringCellWidth(v),T){this._tmpCtx.save();const Z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ne=Z%2==1?.5:0;if(this._tmpCtx.lineWidth=Z,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Q=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Q=!1;let ue=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ue<8&&(ue+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ue).css}this._tmpCtx.beginPath();const ce=G,le=Math.ceil(G+this._config.deviceCharHeight)-ne-(w?2*Z:0),ve=le+Z,de=le+2*Z;let _e=this._workAttributeData.getUnderlineVariantOffset();for(let ue=0;ue<ae;ue++){this._tmpCtx.save();const he=ce+ue*this._config.deviceCellWidth,ie=ce+(ue+1)*this._config.deviceCellWidth,be=he+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ie,le),this._tmpCtx.moveTo(he,de),this._tmpCtx.lineTo(ie,de);break;case 3:const Ee=Z<=1?de:Math.ceil(G+this._config.deviceCharHeight-Z/2)-ne,Le=Z<=1?le:Math.ceil(G+this._config.deviceCharHeight+Z/2)-ne,$e=new Path2D;$e.rect(he,le,this._config.deviceCellWidth,de-le),this._tmpCtx.clip($e),this._tmpCtx.moveTo(he-this._config.deviceCellWidth/2,ve),this._tmpCtx.bezierCurveTo(he-this._config.deviceCellWidth/2,Le,he,Le,he,ve),this._tmpCtx.bezierCurveTo(he,Ee,be,Ee,be,ve),this._tmpCtx.bezierCurveTo(be,Le,ie,Le,ie,ve),this._tmpCtx.bezierCurveTo(ie,Ee,ie+this._config.deviceCellWidth/2,Ee,ie+this._config.deviceCellWidth/2,ve);break;case 4:const Re=_e===0?0:_e>=Z?2*Z-_e:Z-_e;_e>=Z||Re===0?(this._tmpCtx.setLineDash([Math.round(Z),Math.round(Z)]),this._tmpCtx.moveTo(he+Re,le),this._tmpCtx.lineTo(ie,le)):(this._tmpCtx.setLineDash([Math.round(Z),Math.round(Z)]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(he+Re,le),this._tmpCtx.moveTo(he+Re+Z,le),this._tmpCtx.lineTo(ie,le)),_e=(0,s.computeNextVariantOffset)(ie-he,Z,_e);break;case 5:const lt=.6,ct=.3,Me=ie-he,Ue=Math.floor(lt*Me),ze=Math.floor(ct*Me),ut=Me-Ue-ze;this._tmpCtx.setLineDash([Ue,ze,ut]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ie,le);break;default:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ie,le)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!te&&this._config.fontSize>=12&&!this._config.allowTransparency&&x!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ue=this._tmpCtx.measureText(x);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ue&&ue.actualBoundingBoxDescent>0){this._tmpCtx.save();const he=new Path2D;he.rect(ce,le-Math.ceil(Z/2),this._config.deviceCellWidth*ae,de-le+Math.ceil(Z/2)),this._tmpCtx.clip(he),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(x,G,G+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const Z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ne=Z%2==1?.5:0;this._tmpCtx.lineWidth=Z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+ne),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*ae,G+ne),this._tmpCtx.stroke()}if(te||this._tmpCtx.fillText(x,G,G+this._config.deviceCharHeight),x==="_"&&!this._config.allowTransparency){let Z=u(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),L,ee,Q);if(Z)for(let ne=1;ne<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(x,G,G+this._config.deviceCharHeight-ne),Z=u(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),L,ee,Q),Z);ne++);}if(D){const Z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ne=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+Math.floor(this._config.deviceCharHeight/2)-ne),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*ae,G+Math.floor(this._config.deviceCharHeight/2)-ne),this._tmpCtx.stroke()}this._tmpCtx.restore();const ge=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Se;if(Se=this._config.allowTransparency?(function(Z){for(let ne=0;ne<Z.data.length;ne+=4)if(Z.data[ne+3]>0)return!1;return!0})(ge):u(ge,L,ee,Q),Se)return i;const oe=this._findGlyphBoundingBox(ge,this._workBoundingBox,B,q,te,G);let se,re;for(;;){if(this._activePages.length===0){const Z=this._createNewPage();se=Z,re=Z.currentRow,re.height=oe.size.y;break}se=this._activePages[this._activePages.length-1],re=se.currentRow;for(const Z of this._activePages)oe.size.y<=Z.currentRow.height&&(se=Z,re=Z.currentRow);for(let Z=this._activePages.length-1;Z>=0;Z--)for(const ne of this._activePages[Z].fixedRows)ne.height<=re.height&&oe.size.y<=ne.height&&(se=this._activePages[Z],re=ne);if(re.y+oe.size.y>=se.canvas.height||re.height>oe.size.y+2){let Z=!1;if(se.currentRow.y+se.currentRow.height+oe.size.y>=se.canvas.height){let ne;for(const ce of this._activePages)if(ce.currentRow.y+ce.currentRow.height+oe.size.y<ce.canvas.height){ne=ce;break}if(ne)se=ne;else if(_.maxAtlasPages&&this._pages.length>=_.maxAtlasPages&&re.y+oe.size.y<=se.canvas.height&&re.height>=oe.size.y&&re.x+oe.size.x<=se.canvas.width)Z=!0;else{const ce=this._createNewPage();se=ce,re=ce.currentRow,re.height=oe.size.y,Z=!0}}Z||(se.currentRow.height>0&&se.fixedRows.push(se.currentRow),re={x:0,y:se.currentRow.y+se.currentRow.height,height:oe.size.y},se.fixedRows.push(re),se.currentRow={x:0,y:re.y+re.height,height:0})}if(re.x+oe.size.x<=se.canvas.width)break;re===se.currentRow?(re.x=0,re.y+=re.height,re.height=0):se.fixedRows.splice(se.fixedRows.indexOf(re),1)}return oe.texturePage=this._pages.indexOf(se),oe.texturePosition.x=re.x,oe.texturePosition.y=re.y,oe.texturePositionClipSpace.x=re.x/se.canvas.width,oe.texturePositionClipSpace.y=re.y/se.canvas.height,oe.sizeClipSpace.x/=se.canvas.width,oe.sizeClipSpace.y/=se.canvas.height,re.height=Math.max(re.height,oe.size.y),re.x+=oe.size.x,se.ctx.putImageData(ge,oe.texturePosition.x-this._workBoundingBox.left,oe.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,oe.size.x,oe.size.y),se.addGlyph(oe),se.version++,oe}_findGlyphBoundingBox(v,S,y,b,w,x){S.top=0;const B=b?this._config.deviceCellHeight:this._tmpCanvas.height,F=b?this._config.deviceCellWidth:y;let I=!1;for(let O=0;O<B;O++){for(let C=0;C<F;C++){const E=O*this._tmpCanvas.width*4+4*C+3;if(v.data[E]!==0){S.top=O,I=!0;break}}if(I)break}S.left=0,I=!1;for(let O=0;O<x+F;O++){for(let C=0;C<B;C++){const E=C*this._tmpCanvas.width*4+4*O+3;if(v.data[E]!==0){S.left=O,I=!0;break}}if(I)break}S.right=F,I=!1;for(let O=x+F-1;O>=x;O--){for(let C=0;C<B;C++){const E=C*this._tmpCanvas.width*4+4*O+3;if(v.data[E]!==0){S.right=O,I=!0;break}}if(I)break}S.bottom=B,I=!1;for(let O=B-1;O>=0;O--){for(let C=0;C<F;C++){const E=O*this._tmpCanvas.width*4+4*C+3;if(v.data[E]!==0){S.bottom=O,I=!0;break}}if(I)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+x+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+x+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=_;class p{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(v){this._glyphs.push(v),this._usedPixels+=v.size.x*v.size.y}constructor(v,S,y){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],y)for(const b of y)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=m(v,S,S),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function u(d,v,S,y){const b=v.rgba>>>24,w=v.rgba>>>16&255,x=v.rgba>>>8&255,B=S.rgba>>>24,F=S.rgba>>>16&255,I=S.rgba>>>8&255,O=Math.floor((Math.abs(b-B)+Math.abs(w-F)+Math.abs(x-I))/12);let C=!0;for(let E=0;E<d.data.length;E+=4)d.data[E]===b&&d.data[E+1]===w&&d.data[E+2]===x||y&&Math.abs(d.data[E]-b)+Math.abs(d.data[E+1]-w)+Math.abs(d.data[E+2]-x)<O?d.data[E+3]=0:C=!1;return C}function m(d,v,S){const y=d.createElement("canvas");return y.width=v,y.height=S,y}},160:(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},345:(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)))}},859:(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)}}},485:(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()}}},399:(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)},385:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(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()}}},147:(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},782:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),s=a(147);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},855:(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},133:(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}}},776: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(859),c=a(97),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}}},726:(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}},97:(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(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(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")}},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.WebglAddon=void 0;const t=j(345),a=j(859),h=j(399),l=j(666),s=j(776);class c extends a.Disposable{constructor(g){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=g,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(g){const o=g._core;if(!g.element)return void this.register(o.onWillOpen((()=>this.activate(g))));this._terminal=g;const e=o.coreService,r=o.optionsService,i=o,n=i._renderService,_=i._characterJoinerService,p=i._charSizeService,u=i._coreBrowserService,m=i._decorationService,d=i._logService,v=i._themeService;(0,s.setTraceLogger)(d),this._renderer=this.register(new l.WebglRenderer(g,_,p,u,e,m,r,v,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this.register((0,a.toDisposable)((()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(g.cols,g.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}M.WebglAddon=c})(),V})()))})(Oe)),Oe.exports}var Gt=Kt(),Ie={exports:{}},Ye;function Xt(){return Ye||(Ye=1,(function(z,R){(function(k,N){z.exports=N()})(globalThis,(()=>(()=>{var k={4567: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.AccessibilityManager=void 0;const s=a(9042),c=a(9924),f=a(844),g=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends f.Disposable{constructor(i,n,_,p){super(),this._terminal=i,this._coreBrowserService=_,this._renderService=p,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new c.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((u=>this._handleResize(u.rows)))),this.register(this._terminal.onRender((u=>this._refreshRows(u.start,u.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((u=>this._handleChar(u)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
58
|
+
}`)),this.register((0,l.toDisposable)((()=>b.deleteProgram(this._program)))),this._projectionLocation=(0,h.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),x=b.createBuffer();this.register((0,l.toDisposable)((()=>b.deleteBuffer(x)))),b.bindBuffer(b.ARRAY_BUFFER,x),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),F=b.createBuffer();this.register((0,l.toDisposable)((()=>b.deleteBuffer(F)))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,F),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,h.throwIfFalsy)(b.createBuffer()),this.register((0,l.toDisposable)((()=>b.deleteBuffer(this._attributesBuffer)))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,f,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors((I=>{this._updateCachedColors(I),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(d){const v=this._gl;v.useProgram(this._program),v.bindVertexArray(this._vertexArrayObject),v.uniformMatrix4fv(this._projectionLocation,!1,c.PROJECTION_MATRIX),v.bindBuffer(v.ARRAY_BUFFER,this._attributesBuffer),v.bufferData(v.ARRAY_BUFFER,d.attributes,v.DYNAMIC_DRAW),v.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,v.UNSIGNED_BYTE,0,d.count)}handleResize(){this._updateViewportRectangle()}setDimensions(d){this._dimensions=d}_updateCachedColors(d){this._bgFloat=this._colorToFloat32Array(d.background),this._cursorFloat=this._colorToFloat32Array(d.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(d){const v=this._terminal,S=this._vertices;let y,b,w,x,B,F,I,O,C,E,T,D=1;for(y=0;y<v.rows;y++){for(w=-1,x=0,B=0,F=!1,b=0;b<v.cols;b++)I=(y*v.cols+b)*s.RENDER_MODEL_INDICIES_PER_CELL,O=d.cells[I+s.RENDER_MODEL_BG_OFFSET],C=d.cells[I+s.RENDER_MODEL_FG_OFFSET],E=!!(67108864&C),(O!==x||C!==B&&(F||E))&&((x!==0||F&&B!==0)&&(T=8*D++,this._updateRectangle(S,T,B,x,w,b,y)),w=b,x=O,B=C,F=E);(x!==0||F&&B!==0)&&(T=8*D++,this._updateRectangle(S,T,B,x,w,v.cols,y))}S.count=D}updateCursor(d){const v=this._verticesCursor,S=d.cursor;if(!S||S.style==="block")return void(v.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(v.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(v.attributes,y,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(y=8*b++,this._addRectangleFloat(v.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),y=8*b++,this._addRectangleFloat(v.attributes,y,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),v.count=b}_updateRectangle(d,v,S,y,b,w,x){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&y){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&y].rgba;break;case 50331648:o=(16777215&y)<<8;break;default:o=this._themeService.colors.background.rgba}d.attributes.length<v+4&&(d.attributes=(0,c.expandFloat32Array)(d.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,r=x*this._dimensions.device.cell.height,i=(o>>24&255)/255,n=(o>>16&255)/255,_=(o>>8&255)/255,p=1,this._addRectangle(d.attributes,v,e,r,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,i,n,_,p)}_addRectangle(d,v,S,y,b,w,x,B,F,I){d[v]=S/this._dimensions.device.canvas.width,d[v+1]=y/this._dimensions.device.canvas.height,d[v+2]=b/this._dimensions.device.canvas.width,d[v+3]=w/this._dimensions.device.canvas.height,d[v+4]=x,d[v+5]=B,d[v+6]=F,d[v+7]=I}_addRectangleFloat(d,v,S,y,b,w,x){d[v]=S/this._dimensions.device.canvas.width,d[v+1]=y/this._dimensions.device.canvas.height,d[v+2]=b/this._dimensions.device.canvas.width,d[v+3]=w/this._dimensions.device.canvas.height,d[v+4]=x[0],d[v+5]=x[1],d[v+6]=x[2],d[v+7]=x[3]}_colorToFloat32Array(d){return new Float32Array([(d.rgba>>24&255)/255,(d.rgba>>16&255)/255,(d.rgba>>8&255)/255,(255&d.rgba)/255])}}t.RectangleRenderer=u},310:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const h=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,h.createSelectionRenderModel)()}resize(l,s){const c=l*s*t.RENDER_MODEL_INDICIES_PER_CELL;c!==this.cells.length&&(this.cells=new Uint32Array(c),this.lineLengths=new Uint32Array(s))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const h=a(820),l=a(274),s=a(627),c=a(457),f=a(56),g=a(374),o=a(345),e=a(859),r=a(147),i=a(782),n=a(855),_=a(965),p=a(742),u=a(310),m=a(733);class d extends e.Disposable{constructor(b,w,x,B,F,I,O,C,E){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=x,this._coreBrowserService=B,this._coreService=F,this._decorationService=I,this._optionsService=O,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new u.RenderModel,this._workCell=new i.CellData,this._workCell2=new i.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new l.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,O,this._themeService)],this.dimensions=(0,g.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(O.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const T={antialias:!1,depth:!1,preserveDrawingBuffer:E};if(this._gl=this._canvas.getContext("webgl2",T),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextlost",(D=>{console.log("webglcontextlost event received"),D.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(D)}),3e3)}))),this.register((0,h.addDisposableDomListener)(this._canvas,"webglcontextrestored",(D=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,s.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((D,U)=>this._setCanvasDevicePixelDimensions(D,U))),this.register(this._coreBrowserService.onWindowChange((D=>{this._observerDisposable.value=(0,f.observeDevicePixelDimensions)(this._canvas,D,((U,$)=>this._setCanvasDevicePixelDimensions(U,$)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)((()=>{for(const D of this._renderLayers)D.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,s.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(b,w){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const x of this._renderLayers)x.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(const b of this._renderLayers)b.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(const b of this._renderLayers)b.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(b,w,x){for(const B of this._renderLayers)B.handleSelectionChanged(this._terminal,b,w,x);this._model.selection.update(this._core,b,w,x),this._requestRedrawViewport()}handleCursorMove(){for(const b of this._renderLayers)b.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new p.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,s.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(b){this._model.clear(),b&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(const b of this._renderLayers)b.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const x of this._renderLayers)x.handleGridChanged(this._terminal,b,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(b,w),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new c.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const x=this._core;let B,F,I,O,C,E,T,D,U,$,K,X,P,L,N=this._workCell;b=S(b,x.rows-1,0),w=S(w,x.rows-1,0);const A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,W=A-x.buffer.ydisp,V=Math.min(this._terminal.buffer.active.cursorX,x.cols-1);let ee=-1;const G=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let te=!1;for(F=b;F<=w;F++)for(I=F+x.buffer.ydisp,O=x.buffer.lines.get(I),this._model.lineLengths[F]=0,C=this._characterJoinerService.getJoinedCharacters(I),P=0;P<x.cols;P++)if(B=this._cellColorResolver.result.bg,O.loadCell(P,N),P===0&&(B=this._cellColorResolver.result.bg),E=!1,T=P,C.length>0&&P===C[0][0]&&(E=!0,D=C.shift(),N=new v(N,O.translateToString(!0,D[0],D[1]),D[1]-D[0]),T=D[1]-1),U=N.getChars(),$=N.getCode(),X=(F*x.cols+P)*u.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(N,P,I,this.dimensions.device.cell.width),G&&I===A&&(P===V&&(this._model.cursor={x:V,y:W,width:N.getWidth(),style:this._coreBrowserService.isFocused?x.options.cursorStyle||"block":x.options.cursorInactiveStyle,cursorWidth:x.options.cursorWidth,dpr:this._devicePixelRatio},ee=V+N.getWidth()-1),P>=V&&P<=ee&&(this._coreBrowserService.isFocused&&(x.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&x.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),$!==n.NULL_CELL_CODE&&(this._model.lineLengths[F]=P+1),(this._model.cells[X]!==$||this._model.cells[X+u.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[X+u.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[X+u.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(te=!0,U.length>1&&($|=u.COMBINED_CHAR_BIT_MASK),this._model.cells[X]=$,this._model.cells[X+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[X+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[X+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,K=N.getWidth(),this._glyphRenderer.value.updateCell(P,F,$,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,K,B),E))for(N=this._workCell,P++;P<T;P++)L=(F*x.cols+P)*u.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(P,F,n.NULL_CELL_CODE,0,0,0,n.NULL_CELL_CHAR,0,0),this._model.cells[L]=n.NULL_CELL_CODE,this._model.cells[L+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[L+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[L+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;te&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(b,w){this._canvas.width===b&&this._canvas.height===w||(this._canvas.width=b,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const b=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:b,end:b})}}t.WebglRenderer=d;class v extends r.AttributeData{constructor(b,w,x){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=x}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(y,b,w=0){return Math.max(Math.min(y,b),w)}t.JoinedCellData=v},381:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const h=a(374);function l(s,c,f){const g=(0,h.throwIfFalsy)(s.createShader(c));if(s.shaderSource(g,f),s.compileShader(g),s.getShaderParameter(g,s.COMPILE_STATUS))return g;console.error(s.getShaderInfoLog(g)),s.deleteShader(g)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(s,c,f){const g=(0,h.throwIfFalsy)(s.createProgram());if(s.attachShader(g,(0,h.throwIfFalsy)(l(s,s.VERTEX_SHADER,c))),s.attachShader(g,(0,h.throwIfFalsy)(l(s,s.FRAGMENT_SHADER,f))),s.linkProgram(g),s.getProgramParameter(g,s.LINK_STATUS))return g;console.error(s.getProgramInfoLog(g)),s.deleteProgram(g)},t.createShader=l,t.expandFloat32Array=function(s,c){const f=Math.min(2*s.length,c),g=new Float32Array(f);for(let o=0;o<s.length;o++)g[o]=s[o];return g},t.GLTexture=class{constructor(s){this.texture=s,this.version=-1}}},592:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const h=a(627),l=a(237),s=a(374),c=a(859);class f extends c.Disposable{constructor(o,e,r,i,n,_,p,u){super(),this._container=e,this._alpha=n,this._coreBrowserService=_,this._optionsService=p,this._themeService=u,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${r}-layer`),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((m=>{this._refreshCharAtlas(o,m),this.reset(o)}))),this.register((0,c.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,s.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,r){}handleSelectionChanged(o,e,r,i=!1){}_setTransparency(o,e){if(e===this._alpha)return;const r=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,r),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,h.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,r=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,r*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,r,i){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,i*this._deviceCellHeight))}_fillCharTrueColor(o,e,r,i){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=l.TEXT_BASELINE,this._clipCell(r,i,e.getWidth()),this._ctx.fillText(e.getChars(),r*this._deviceCellWidth+this._deviceCharLeft,i*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,r){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,r*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,r){return`${r?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=f},733:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const h=a(197),l=a(237),s=a(592);class c extends s.BaseRenderLayer{constructor(g,o,e,r,i,n,_){super(e,g,"link",o,!0,i,n,_),this.register(r.onShowLinkUnderline((p=>this._handleShowLinkUnderline(p)))),this.register(r.onHideLinkUnderline((p=>this._handleHideLinkUnderline(p))))}resize(g,o){super.resize(g,o),this._state=void 0}reset(g){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const g=this._state.y2-this._state.y1-1;g>0&&this._clearCells(0,this._state.y1+1,this._state.cols,g),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(g){if(g.fg===l.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:g.fg!==void 0&&(0,h.is256Color)(g.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[g.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,g.y1===g.y2)this._fillBottomLineAtCells(g.x1,g.y1,g.x2-g.x1);else{this._fillBottomLineAtCells(g.x1,g.y1,g.cols-g.x1);for(let o=g.y1+1;o<g.y2;o++)this._fillBottomLineAtCells(0,o,g.cols);this._fillBottomLineAtCells(0,g.y2,g.x2)}this._state=g}_handleHideLinkUnderline(g){this._clearCurrentLink()}}t.LinkRenderLayer=c},820:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},274:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const h=a(855),l=a(160),s=a(374);let c,f=0,g=0,o=!1,e=!1,r=!1,i=0;t.CellColorResolver=class{constructor(n,_,p,u,m,d){this._terminal=n,this._optionService=_,this._selectionRenderModel=p,this._decorationService=u,this._coreBrowserService=m,this._themeService=d,this.result={fg:0,bg:0,ext:0}}resolve(n,_,p,u){if(this.result.bg=n.bg,this.result.fg=n.fg,this.result.ext=268435456&n.bg?n.extended.ext:0,g=0,f=0,e=!1,o=!1,r=!1,c=this._themeService.colors,i=0,n.getCode()!==h.NULL_CELL_CODE&&n.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));i=_*u%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(_,p,"bottom",(m=>{m.backgroundColorRGB&&(g=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(f=m.foregroundColorRGB.rgba>>8&16777215,o=!0)})),r=this._selectionRenderModel.isCellSelected(this._terminal,_,p),r){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}g=l.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else g=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,c.selectionForeground&&(f=c.selectionForeground.rgba>>8&16777215,o=!0),(0,s.treatGlyphAsBackgroundColor)(n.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)f=(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}f=l.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?c.selectionBackgroundOpaque:c.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(_,p,"top",(m=>{m.backgroundColorRGB&&(g=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(f=m.foregroundColorRGB.rgba>>8&16777215,o=!0)})),e&&(g=r?-16777216&n.bg&-134217729|g|50331648:-16777216&n.bg|g|50331648),o&&(f=-16777216&n.fg&-67108865|f|50331648),67108864&this.result.fg&&(e&&!o&&(f=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&c.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,o=!0),!e&&o&&(g=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&c.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,e=!0)),c=void 0,this.result.bg=e?g:this.result.bg,this.result.fg=o?f:this.result.fg,this.result.ext&=536870911,this.result.ext|=i<<29&3758096384}}},627:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const h=a(509),l=a(197),s=[];t.acquireTextureAtlas=function(c,f,g,o,e,r,i,n){const _=(0,l.generateConfig)(o,e,r,i,f,g,n);for(let m=0;m<s.length;m++){const d=s[m],v=d.ownedBy.indexOf(c);if(v>=0){if((0,l.configEquals)(d.config,_))return d.atlas;d.ownedBy.length===1?(d.atlas.dispose(),s.splice(m,1)):d.ownedBy.splice(v,1);break}}for(let m=0;m<s.length;m++){const d=s[m];if((0,l.configEquals)(d.config,_))return d.ownedBy.push(c),d.atlas}const p=c._core,u={atlas:new h.TextureAtlas(document,_,p.unicodeService),config:_,ownedBy:[c]};return s.push(u),u.atlas},t.removeTerminalFromCache=function(c){for(let f=0;f<s.length;f++){const g=s[f].ownedBy.indexOf(c);if(g!==-1){s[f].ownedBy.length===1?(s[f].atlas.dispose(),s.splice(f,1)):s[f].ownedBy.splice(g,1);break}}}},197:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const h=a(160);t.generateConfig=function(l,s,c,f,g,o,e){const r={foreground:o.foreground,background:o.background,cursor:h.NULL_COLOR,cursorAccent:h.NULL_COLOR,selectionForeground:h.NULL_COLOR,selectionBackgroundTransparent:h.NULL_COLOR,selectionBackgroundOpaque:h.NULL_COLOR,selectionInactiveBackgroundTransparent:h.NULL_COLOR,selectionInactiveBackgroundOpaque:h.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:g.customGlyphs,devicePixelRatio:e,letterSpacing:g.letterSpacing,lineHeight:g.lineHeight,deviceCellWidth:l,deviceCellHeight:s,deviceCharWidth:c,deviceCharHeight:f,fontFamily:g.fontFamily,fontSize:g.fontSize,fontWeight:g.fontWeight,fontWeightBold:g.fontWeightBold,allowTransparency:g.allowTransparency,drawBoldTextInBrightColors:g.drawBoldTextInBrightColors,minimumContrastRatio:g.minimumContrastRatio,colors:r}},t.configEquals=function(l,s){for(let c=0;c<l.colors.ansi.length;c++)if(l.colors.ansi[c].rgba!==s.colors.ansi[c].rgba)return!1;return l.devicePixelRatio===s.devicePixelRatio&&l.customGlyphs===s.customGlyphs&&l.lineHeight===s.lineHeight&&l.letterSpacing===s.letterSpacing&&l.fontFamily===s.fontFamily&&l.fontSize===s.fontSize&&l.fontWeight===s.fontWeight&&l.fontWeightBold===s.fontWeightBold&&l.allowTransparency===s.allowTransparency&&l.deviceCharWidth===s.deviceCharWidth&&l.deviceCharHeight===s.deviceCharHeight&&l.drawBoldTextInBrightColors===s.drawBoldTextInBrightColors&&l.minimumContrastRatio===s.minimumContrastRatio&&l.colors.foreground.rgba===s.colors.foreground.rgba&&l.colors.background.rgba===s.colors.background.rgba},t.is256Color=function(l){return(50331648&l)==16777216||(50331648&l)==33554432}},237:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},457:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,h>0)return void this._restartInterval(h)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const h=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(h)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const h=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const l={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,r,i,n,_,p,u){const m=t.blockElementDefinitions[e];if(m)return(function(y,b,w,x,B,F){for(let I=0;I<b.length;I++){const O=b[I],C=B/8,E=F/8;y.fillRect(w+O.x*C,x+O.y*E,O.w*C,O.h*E)}})(o,m,r,i,n,_),!0;const d=l[e];if(d)return(function(y,b,w,x,B,F){let I=s.get(b);I||(I=new Map,s.set(b,I));const O=y.fillStyle;if(typeof O!="string")throw new Error(`Unexpected fillStyle type "${O}"`);let C=I.get(O);if(!C){const E=b[0].length,T=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=E,D.height=T;const U=(0,h.throwIfFalsy)(D.getContext("2d")),$=new ImageData(E,T);let K,X,P,L;if(O.startsWith("#"))K=parseInt(O.slice(1,3),16),X=parseInt(O.slice(3,5),16),P=parseInt(O.slice(5,7),16),L=O.length>7&&parseInt(O.slice(7,9),16)||1;else{if(!O.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${O}" when drawing pattern glyph`);[K,X,P,L]=O.substring(5,O.length-1).split(",").map((N=>parseFloat(N)))}for(let N=0;N<T;N++)for(let A=0;A<E;A++)$.data[4*(N*E+A)]=K,$.data[4*(N*E+A)+1]=X,$.data[4*(N*E+A)+2]=P,$.data[4*(N*E+A)+3]=b[N][A]*(255*L);U.putImageData($,0,0),C=(0,h.throwIfFalsy)(y.createPattern(D,null)),I.set(O,C)}y.fillStyle=C,y.fillRect(w,x,B,F)})(o,d,r,i,n,_),!0;const v=t.boxDrawingDefinitions[e];if(v)return(function(y,b,w,x,B,F,I){y.strokeStyle=y.fillStyle;for(const[O,C]of Object.entries(b)){let E;y.beginPath(),y.lineWidth=I*Number.parseInt(O),E=typeof C=="function"?C(.15,.15/F*B):C;for(const T of E.split(" ")){const D=T[0],U=f[D];if(!U){console.error(`Could not find drawing instructions for "${D}"`);continue}const $=T.substring(1).split(",");$[0]&&$[1]&&U(y,g($,B,F,w,x,!0,I))}y.stroke(),y.closePath()}})(o,v,r,i,n,_,u),!0;const S=t.powerlineDefinitions[e];return!!S&&((function(y,b,w,x,B,F,I,O){const C=new Path2D;C.rect(w,x,B,F),y.clip(C),y.beginPath();const E=I/12;y.lineWidth=O*E;for(const T of b.d.split(" ")){const D=T[0],U=f[D];if(!U){console.error(`Could not find drawing instructions for "${D}"`);continue}const $=T.substring(1).split(",");$[0]&&$[1]&&U(y,g($,B,F,w,x,!1,O,(b.leftPadding??0)*(E/2),(b.rightPadding??0)*(E/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()})(o,S,r,i,n,_,p,u),!0)};const s=new Map;function c(o,e,r=0){return Math.max(Math.min(o,e),r)}const f={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function g(o,e,r,i,n,_,p,u=0,m=0){const d=o.map((v=>parseFloat(v)||parseInt(v)));if(d.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<d.length;v+=2)d[v]*=e-u*p-m*p,_&&d[v]!==0&&(d[v]=c(Math.round(d[v]+.5)-.5,e,0)),d[v]+=i+u*p;for(let v=1;v<d.length;v+=2)d[v]*=r,_&&d[v]!==0&&(d[v]=c(Math.round(d[v]+.5)-.5,r,0)),d[v]+=n;return d}},56:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const h=a(859);t.observeDevicePixelDimensions=function(l,s,c){let f=new s.ResizeObserver((g=>{const o=g.find((i=>i.target===l));if(!o)return;if(!("devicePixelContentBoxSize"in o))return f?.disconnect(),void(f=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,r=o.devicePixelContentBoxSize[0].blockSize;e>0&&r>0&&c(e,r)}));try{f.observe(l,{box:["device-pixel-content-box"]})}catch{f.disconnect(),f=void 0}return(0,h.toDisposable)((()=>f?.disconnect()))}},374:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,f){return s===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!(function(g){return 57344<=g&&g<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(s){return 9472<=s&&s<=9631})(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},296:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,s,c,f=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const g=l.buffers.active.ydisp,o=s[1]-g,e=c[1]-g,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const h=a(237),l=a(860),s=a(374),c=a(160),f=a(345),g=a(485),o=a(385),e=a(147),r=a(855),i={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let n;class _{get pages(){return this._pages}constructor(v,S,y){this._document=v,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new g.FourKeyMap,this._cacheMapCombined=new g.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new f.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new f.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(v,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,s.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const v of this.pages)v.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const v=new o.IdleTaskQueue;for(let S=33;S<126;S++)v.enqueue((()=>{if(!this._cacheMap.get(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT)){const y=this._drawToCache(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT);this._cacheMap.set(S,r.DEFAULT_COLOR,r.DEFAULT_COLOR,r.DEFAULT_EXT,y)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const v of this._pages)v.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(_.maxAtlasPages&&this._pages.length>=Math.max(4,_.maxAtlasPages)){const S=this._pages.filter((I=>2*I.canvas.width<=(_.maxTextureSize||4096))).sort(((I,O)=>O.canvas.width!==I.canvas.width?O.canvas.width-I.canvas.width:O.percentageUsed-I.percentageUsed));let y=-1,b=0;for(let I=0;I<S.length;I++)if(S[I].canvas.width!==b)y=I,b=S[I].canvas.width;else if(I-y==3)break;const w=S.slice(y,y+4),x=w.map((I=>I.glyphs[0].texturePage)).sort(((I,O)=>I>O?1:-1)),B=this.pages.length-w.length,F=this._mergePages(w,B);F.version++;for(let I=x.length-1;I>=0;I--)this._deletePage(x[I]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const v=new p(this._document,this._textureSize);return this._pages.push(v),this._activePages.push(v),this._onAddTextureAtlasCanvas.fire(v.canvas),v}_mergePages(v,S){const y=2*v[0].canvas.width,b=new p(this._document,y,v);for(const[w,x]of v.entries()){const B=w*x.canvas.width%y,F=Math.floor(w/2)*x.canvas.height;b.ctx.drawImage(x.canvas,B,F);for(const O of x.glyphs)O.texturePage=S,O.sizeClipSpace.x=O.size.x/y,O.sizeClipSpace.y=O.size.y/y,O.texturePosition.x+=B,O.texturePosition.y+=F,O.texturePositionClipSpace.x=O.texturePosition.x/y,O.texturePositionClipSpace.y=O.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(x.canvas);const I=this._activePages.indexOf(x);I!==-1&&this._activePages.splice(I,1)}return b}_deletePage(v){this._pages.splice(v,1);for(let S=v;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(v,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,v,S,y,b,w)}getRasterizedGlyph(v,S,y,b,w){return this._getFromCacheMap(this._cacheMap,v,S,y,b,w)}_getFromCacheMap(v,S,y,b,w,x=!1){return n=v.get(S,y,b,w),n||(n=this._drawToCache(S,y,b,w,x),v.set(S,y,b,w,n)),n}_getColorFromAnsiIndex(v){if(v>=this._config.colors.ansi.length)throw new Error("No color found for idx "+v);return this._config.colors.ansi[v]}_getBackgroundColor(v,S,y,b){if(this._config.allowTransparency)return c.NULL_COLOR;let w;switch(v){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const x=e.AttributeData.toColorRGB(S);w=c.channels.toColor(x[0],x[1],x[2]);break;default:w=y?c.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(v,S,y,b,w,x,B,F,I,O){const C=this._getMinimumContrastColor(v,S,y,b,w,x,B,I,F,O);if(C)return C;let E;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&I&&x<8&&(x+=8),E=this._getColorFromAnsiIndex(x);break;case 50331648:const T=e.AttributeData.toColorRGB(x);E=c.channels.toColor(T[0],T[1],T[2]);break;default:E=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(E=c.color.opaque(E)),F&&(E=c.color.multiplyOpacity(E,h.DIM_OPACITY)),E}_resolveBackgroundRgba(v,S,y){switch(v){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(v,S,y,b){switch(v){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&b&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(v,S,y,b,w,x,B,F,I,O){if(this._config.minimumContrastRatio===1||O)return;const C=this._getContrastCache(I),E=C.getColor(v,b);if(E!==void 0)return E||void 0;const T=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,x,B,F),U=c.rgba.ensureContrastRatio(T,D,this._config.minimumContrastRatio/(I?2:1));if(!U)return void C.setColor(v,b,null);const $=c.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return C.setColor(v,b,$),$}_getContrastCache(v){return v?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(v,S,y,b,w=!1){const x=typeof v=="number"?String.fromCharCode(v):v,B=Math.min(this._config.deviceCellWidth*Math.max(x.length,2)+4,this._textureSize);this._tmpCanvas.width<B&&(this._tmpCanvas.width=B);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return i;const I=!!this._workAttributeData.isBold(),O=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),E=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),D=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let $=this._workAttributeData.getFgColor(),K=this._workAttributeData.getFgColorMode(),X=this._workAttributeData.getBgColor(),P=this._workAttributeData.getBgColorMode();if(O){const Z=$;$=X,X=Z;const ne=K;K=P,P=ne}const L=this._getBackgroundColor(P,X,O,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const N=I?this._config.fontWeightBold:this._config.fontWeight,A=E?"italic":"";this._tmpCtx.font=`${A} ${N} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=h.TEXT_BASELINE;const W=x.length===1&&(0,s.isPowerlineGlyph)(x.charCodeAt(0)),V=x.length===1&&(0,s.isRestrictedPowerlineGlyph)(x.charCodeAt(0)),ee=this._getForegroundColor(S,P,X,y,K,$,O,C,I,(0,s.treatGlyphAsBackgroundColor)(x.charCodeAt(0)));this._tmpCtx.fillStyle=ee.css;const G=V?0:4;let te=!1;this._config.customGlyphs!==!1&&(te=(0,l.tryDrawCustomChar)(this._tmpCtx,x,G,G,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ae,Q=!W;if(ae=typeof v=="number"?this._unicodeService.wcwidth(v):this._unicodeService.getStringCellWidth(v),T){this._tmpCtx.save();const Z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ne=Z%2==1?.5:0;if(this._tmpCtx.lineWidth=Z,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Q=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Q=!1;let ue=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ue<8&&(ue+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ue).css}this._tmpCtx.beginPath();const ce=G,le=Math.ceil(G+this._config.deviceCharHeight)-ne-(w?2*Z:0),ve=le+Z,de=le+2*Z;let _e=this._workAttributeData.getUnderlineVariantOffset();for(let ue=0;ue<ae;ue++){this._tmpCtx.save();const he=ce+ue*this._config.deviceCellWidth,ie=ce+(ue+1)*this._config.deviceCellWidth,be=he+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ie,le),this._tmpCtx.moveTo(he,de),this._tmpCtx.lineTo(ie,de);break;case 3:const Ee=Z<=1?de:Math.ceil(G+this._config.deviceCharHeight-Z/2)-ne,Le=Z<=1?le:Math.ceil(G+this._config.deviceCharHeight+Z/2)-ne,$e=new Path2D;$e.rect(he,le,this._config.deviceCellWidth,de-le),this._tmpCtx.clip($e),this._tmpCtx.moveTo(he-this._config.deviceCellWidth/2,ve),this._tmpCtx.bezierCurveTo(he-this._config.deviceCellWidth/2,Le,he,Le,he,ve),this._tmpCtx.bezierCurveTo(he,Ee,be,Ee,be,ve),this._tmpCtx.bezierCurveTo(be,Le,ie,Le,ie,ve),this._tmpCtx.bezierCurveTo(ie,Ee,ie+this._config.deviceCellWidth/2,Ee,ie+this._config.deviceCellWidth/2,ve);break;case 4:const Re=_e===0?0:_e>=Z?2*Z-_e:Z-_e;_e>=Z||Re===0?(this._tmpCtx.setLineDash([Math.round(Z),Math.round(Z)]),this._tmpCtx.moveTo(he+Re,le),this._tmpCtx.lineTo(ie,le)):(this._tmpCtx.setLineDash([Math.round(Z),Math.round(Z)]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(he+Re,le),this._tmpCtx.moveTo(he+Re+Z,le),this._tmpCtx.lineTo(ie,le)),_e=(0,s.computeNextVariantOffset)(ie-he,Z,_e);break;case 5:const ct=.6,ut=.3,Me=ie-he,Ue=Math.floor(ct*Me),ze=Math.floor(ut*Me),dt=Me-Ue-ze;this._tmpCtx.setLineDash([Ue,ze,dt]),this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ie,le);break;default:this._tmpCtx.moveTo(he,le),this._tmpCtx.lineTo(ie,le)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!te&&this._config.fontSize>=12&&!this._config.allowTransparency&&x!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ue=this._tmpCtx.measureText(x);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ue&&ue.actualBoundingBoxDescent>0){this._tmpCtx.save();const he=new Path2D;he.rect(ce,le-Math.ceil(Z/2),this._config.deviceCellWidth*ae,de-le+Math.ceil(Z/2)),this._tmpCtx.clip(he),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(x,G,G+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const Z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),ne=Z%2==1?.5:0;this._tmpCtx.lineWidth=Z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+ne),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*ae,G+ne),this._tmpCtx.stroke()}if(te||this._tmpCtx.fillText(x,G,G+this._config.deviceCharHeight),x==="_"&&!this._config.allowTransparency){let Z=u(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),L,ee,Q);if(Z)for(let ne=1;ne<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(x,G,G+this._config.deviceCharHeight-ne),Z=u(this._tmpCtx.getImageData(G,G,this._config.deviceCellWidth,this._config.deviceCellHeight),L,ee,Q),Z);ne++);}if(D){const Z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),ne=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(G,G+Math.floor(this._config.deviceCharHeight/2)-ne),this._tmpCtx.lineTo(G+this._config.deviceCharWidth*ae,G+Math.floor(this._config.deviceCharHeight/2)-ne),this._tmpCtx.stroke()}this._tmpCtx.restore();const ge=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Se;if(Se=this._config.allowTransparency?(function(Z){for(let ne=0;ne<Z.data.length;ne+=4)if(Z.data[ne+3]>0)return!1;return!0})(ge):u(ge,L,ee,Q),Se)return i;const oe=this._findGlyphBoundingBox(ge,this._workBoundingBox,B,V,te,G);let se,re;for(;;){if(this._activePages.length===0){const Z=this._createNewPage();se=Z,re=Z.currentRow,re.height=oe.size.y;break}se=this._activePages[this._activePages.length-1],re=se.currentRow;for(const Z of this._activePages)oe.size.y<=Z.currentRow.height&&(se=Z,re=Z.currentRow);for(let Z=this._activePages.length-1;Z>=0;Z--)for(const ne of this._activePages[Z].fixedRows)ne.height<=re.height&&oe.size.y<=ne.height&&(se=this._activePages[Z],re=ne);if(re.y+oe.size.y>=se.canvas.height||re.height>oe.size.y+2){let Z=!1;if(se.currentRow.y+se.currentRow.height+oe.size.y>=se.canvas.height){let ne;for(const ce of this._activePages)if(ce.currentRow.y+ce.currentRow.height+oe.size.y<ce.canvas.height){ne=ce;break}if(ne)se=ne;else if(_.maxAtlasPages&&this._pages.length>=_.maxAtlasPages&&re.y+oe.size.y<=se.canvas.height&&re.height>=oe.size.y&&re.x+oe.size.x<=se.canvas.width)Z=!0;else{const ce=this._createNewPage();se=ce,re=ce.currentRow,re.height=oe.size.y,Z=!0}}Z||(se.currentRow.height>0&&se.fixedRows.push(se.currentRow),re={x:0,y:se.currentRow.y+se.currentRow.height,height:oe.size.y},se.fixedRows.push(re),se.currentRow={x:0,y:re.y+re.height,height:0})}if(re.x+oe.size.x<=se.canvas.width)break;re===se.currentRow?(re.x=0,re.y+=re.height,re.height=0):se.fixedRows.splice(se.fixedRows.indexOf(re),1)}return oe.texturePage=this._pages.indexOf(se),oe.texturePosition.x=re.x,oe.texturePosition.y=re.y,oe.texturePositionClipSpace.x=re.x/se.canvas.width,oe.texturePositionClipSpace.y=re.y/se.canvas.height,oe.sizeClipSpace.x/=se.canvas.width,oe.sizeClipSpace.y/=se.canvas.height,re.height=Math.max(re.height,oe.size.y),re.x+=oe.size.x,se.ctx.putImageData(ge,oe.texturePosition.x-this._workBoundingBox.left,oe.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,oe.size.x,oe.size.y),se.addGlyph(oe),se.version++,oe}_findGlyphBoundingBox(v,S,y,b,w,x){S.top=0;const B=b?this._config.deviceCellHeight:this._tmpCanvas.height,F=b?this._config.deviceCellWidth:y;let I=!1;for(let O=0;O<B;O++){for(let C=0;C<F;C++){const E=O*this._tmpCanvas.width*4+4*C+3;if(v.data[E]!==0){S.top=O,I=!0;break}}if(I)break}S.left=0,I=!1;for(let O=0;O<x+F;O++){for(let C=0;C<B;C++){const E=C*this._tmpCanvas.width*4+4*O+3;if(v.data[E]!==0){S.left=O,I=!0;break}}if(I)break}S.right=F,I=!1;for(let O=x+F-1;O>=x;O--){for(let C=0;C<B;C++){const E=C*this._tmpCanvas.width*4+4*O+3;if(v.data[E]!==0){S.right=O,I=!0;break}}if(I)break}S.bottom=B,I=!1;for(let O=B-1;O>=0;O--){for(let C=0;C<F;C++){const E=O*this._tmpCanvas.width*4+4*C+3;if(v.data[E]!==0){S.bottom=O,I=!0;break}}if(I)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+x+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+x+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=_;class p{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(v){this._glyphs.push(v),this._usedPixels+=v.size.x*v.size.y}constructor(v,S,y){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],y)for(const b of y)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=m(v,S,S),this.ctx=(0,s.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function u(d,v,S,y){const b=v.rgba>>>24,w=v.rgba>>>16&255,x=v.rgba>>>8&255,B=S.rgba>>>24,F=S.rgba>>>16&255,I=S.rgba>>>8&255,O=Math.floor((Math.abs(b-B)+Math.abs(w-F)+Math.abs(x-I))/12);let C=!0;for(let E=0;E<d.data.length;E+=4)d.data[E]===b&&d.data[E+1]===w&&d.data[E+2]===x||y&&Math.abs(d.data[E]-b)+Math.abs(d.data[E+1]-w)+Math.abs(d.data[E+2]-x)<O?d.data[E+3]=0:C=!1;return C}function m(d,v,S){const y=d.createElement("canvas");return y.width=v,y.height=S,y}},160:(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},345:(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)))}},859:(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)}}},485:(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()}}},399:(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)},385:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const h=a(399);class l{constructor(){this._tasks=[],this._i=0}enqueue(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()}}},147:(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},782:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const h=a(133),l=a(855),s=a(147);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},855:(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},133:(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}}},776: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(859),c=a(97),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}}},726:(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}},97:(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(726);var l;t.IBufferService=(0,h.createDecorator)("BufferService"),t.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),t.ICoreService=(0,h.createDecorator)("CoreService"),t.ICharsetService=(0,h.createDecorator)("CharsetService"),t.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(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")}},H={};function j(M){var t=H[M];if(t!==void 0)return t.exports;var a=H[M]={exports:{}};return k[M].call(a.exports,a,a.exports,j),a.exports}var q={};return(()=>{var M=q;Object.defineProperty(M,"__esModule",{value:!0}),M.WebglAddon=void 0;const t=j(345),a=j(859),h=j(399),l=j(666),s=j(776);class c extends a.Disposable{constructor(g){if(h.isSafari&&(0,h.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=g,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(g){const o=g._core;if(!g.element)return void this.register(o.onWillOpen((()=>this.activate(g))));this._terminal=g;const e=o.coreService,r=o.optionsService,i=o,n=i._renderService,_=i._characterJoinerService,p=i._charSizeService,u=i._coreBrowserService,m=i._decorationService,d=i._logService,v=i._themeService;(0,s.setTraceLogger)(d),this._renderer=this.register(new l.WebglRenderer(g,_,p,u,e,m,r,v,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this.register((0,a.toDisposable)((()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(g.cols,g.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}M.WebglAddon=c})(),q})()))})(Oe)),Oe.exports}var Xt=Gt(),Ie={exports:{}},Ye;function Yt(){return Ye||(Ye=1,(function(z,R){(function(k,H){z.exports=H()})(globalThis,(()=>(()=>{var k={4567: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.AccessibilityManager=void 0;const s=a(9042),c=a(9924),f=a(844),g=a(4725),o=a(2585),e=a(3656);let r=t.AccessibilityManager=class extends f.Disposable{constructor(i,n,_,p){super(),this._terminal=i,this._coreBrowserService=_,this._renderService=p,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new c.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((u=>this._handleResize(u.rows)))),this.register(this._terminal.onRender((u=>this._refreshRows(u.start,u.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((u=>this._handleChar(u)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
59
59
|
`)))),this.register(this._terminal.onA11yTab((u=>this._handleTab(u)))),this.register(this._terminal.onKey((u=>this._handleKey(u.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,e.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,f.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(i){for(let n=0;n<i;n++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
|
|
60
60
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=s.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,n){this._liveRegionDebouncer.refresh(i,n,this._terminal.rows)}_renderRows(i,n){const _=this._terminal.buffer,p=_.lines.length.toString();for(let u=i;u<=n;u++){const m=_.lines.get(_.ydisp+u),d=[],v=m?.translateToString(!0,void 0,void 0,d)||"",S=(_.ydisp+u+1).toString(),y=this._rowElements[u];y&&(v.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=v,this._rowColumns.set(y,d)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",p))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,n){const _=i.target,p=this._rowElements[n===0?1:this._rowElements.length-2];if(_.getAttribute("aria-posinset")===(n===0?"1":`${this._terminal.buffer.lines.length}`)||i.relatedTarget!==p)return;let u,m;if(n===0?(u=_,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(u=this._rowElements.shift(),m=_,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{const d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const i=document.getSelection();if(!i)return;if(i.isCollapsed)return void(this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection());if(!i.anchorNode||!i.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:i.anchorNode,offset:i.anchorOffset},_={node:i.focusNode,offset:i.focusOffset};if((n.node.compareDocumentPosition(_.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===_.node&&n.offset>_.offset)&&([n,_]=[_,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const p=this._rowElements.slice(-1)[0];if(_.node.compareDocumentPosition(p)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(_={node:p,offset:p.textContent?.length??0}),!this._rowContainer.contains(_.node))return;const u=({node:v,offset:S})=>{const y=v instanceof Text?v.parentNode:v;let b=parseInt(y?.getAttribute("aria-posinset"),10)-1;if(isNaN(b))return console.warn("row is invalid. Race condition?"),null;const w=this._rowColumns.get(y);if(!w)return console.warn("columns is null. Race condition?"),null;let x=S<w.length?w[S]:w.slice(-1)[0]+1;return x>=this._terminal.cols&&(++b,x=0),{row:b,column:x}},m=u(n),d=u(_);if(m&&d){if(m.row>d.row||m.row===d.row&&m.column>=d.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(d.row-m.row)*this._terminal.cols-m.column+d.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=r=h([l(1,o.IInstantiationService),l(2,g.ICoreBrowserService),l(3,g.IRenderService)],r)},3614:(M,t)=>{function a(c){return c.replace(/\r?\n/g,"\r")}function h(c,f){return f?"\x1B[200~"+c+"\x1B[201~":c}function l(c,f,g,o){c=h(c=a(c),g.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(c,!0),f.value=""}function s(c,f,g){const o=g.getBoundingClientRect(),e=c.clientX-o.left-10,r=c.clientY-o.top-10;f.style.width="20px",f.style.height="20px",f.style.left=`${e}px`,f.style.top=`${r}px`,f.style.zIndex="1000",f.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=h,t.copyHandler=function(c,f){c.clipboardData&&c.clipboardData.setData("text/plain",f.selectionText),c.preventDefault()},t.handlePasteEvent=function(c,f,g,o){c.stopPropagation(),c.clipboardData&&l(c.clipboardData.getData("text/plain"),f,g,o)},t.paste=l,t.moveTextAreaUnderMouseCursor=s,t.rightClickHandler=function(c,f,g,o,e){s(c,f,g),e&&o.rightClickSelect(c),f.value=o.selectionText,f.select()}},7239:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const h=a(1505);t.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(l,s,c){this._css.set(l,s,c)}getCss(l,s){return this._css.get(l,s)}setColor(l,s,c){this._color.set(l,s,c)}getColor(l,s){return this._color.get(l,s)}clear(){this._color.clear(),this._css.clear()}}},3656:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,h,l,s){a.addEventListener(h,l,s);let c=!1;return{dispose:()=>{c||(c=!0,a.removeEventListener(h,l,s))}}}},3551:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,_){var p,u=arguments.length,m=u<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,n,_);else for(var d=r.length-1;d>=0;d--)(p=r[d])&&(m=(u<3?p(m):u>3?p(i,n,m):p(i,n))||m);return u>3&&m&&Object.defineProperty(i,n,m),m},l=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const s=a(3656),c=a(8460),f=a(844),g=a(2585),o=a(4725);let e=t.Linkifier=class extends f.Disposable{get currentLink(){return this._currentLink}constructor(r,i,n,_,p){super(),this._element=r,this._mouseService=i,this._renderService=n,this._bufferService=_,this._linkProviderService=p,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new c.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new c.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,f.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,f.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,s.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,s.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,s.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(r){this._lastMouseEvent=r;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;const n=r.composedPath();for(let _=0;_<n.length;_++){const p=n[_];if(p.classList.contains("xterm"))break;if(p.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(r){if(this._activeLine!==r.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(r,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))}_askForLink(r,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach((_=>{_?.forEach((p=>{p.link.dispose&&p.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=r.y);let n=!1;for(const[_,p]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(_)&&(n=this._checkLinkProviderResult(_,r,n)):p.provideLinks(r.y,(u=>{if(this._isMouseOut)return;const m=u?.map((d=>({link:d})));this._activeProviderReplies?.set(_,m),n=this._checkLinkProviderResult(_,r,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(r.y,this._activeProviderReplies)}))}_removeIntersectingLinks(r,i){const n=new Set;for(let _=0;_<i.size;_++){const p=i.get(_);if(p)for(let u=0;u<p.length;u++){const m=p[u],d=m.link.range.start.y<r?0:m.link.range.start.x,v=m.link.range.end.y>r?this._bufferService.cols:m.link.range.end.x;for(let S=d;S<=v;S++){if(n.has(S)){p.splice(u--,1);break}n.add(S)}}}}_checkLinkProviderResult(r,i,n){if(!this._activeProviderReplies)return n;const _=this._activeProviderReplies.get(r);let p=!1;for(let u=0;u<r;u++)this._activeProviderReplies.has(u)&&!this._activeProviderReplies.get(u)||(p=!0);if(!p&&_){const u=_.find((m=>this._linkAtPosition(m.link,i)));u&&(n=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let u=0;u<this._activeProviderReplies.size;u++){const m=this._activeProviderReplies.get(u)?.find((d=>this._linkAtPosition(d.link,i)));if(m){n=!0,this._handleNewLink(m);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(r){if(!this._currentLink)return;const i=this._positionFromMouseEvent(r,this._element,this._mouseService);i&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(r,this._currentLink.link.text)}_clearCurrentLink(r,i){this._currentLink&&this._lastMouseEvent&&(!r||!i||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,f.disposeArray)(this._linkCacheDisposables))}_handleNewLink(r){if(!this._lastMouseEvent)return;const i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(r.link,i)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(r.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((n=>{if(!this._currentLink)return;const _=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,p=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=p&&(this._clearCurrentLink(_,p),this._lastMouseEvent)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}}))))}_linkHover(r,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(r,i){const n=r.range,_=this._bufferService.buffer.ydisp,p=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-_-1,n.end.x,n.end.y-_-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(p)}_linkLeave(r,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(r,i){const n=r.range.start.y*this._bufferService.cols+r.range.start.x,_=r.range.end.y*this._bufferService.cols+r.range.end.x,p=i.y*this._bufferService.cols+i.x;return n<=p&&p<=_}_positionFromMouseEvent(r,i,n){const _=n.getCoords(r,i,this._bufferService.cols,this._bufferService.rows);if(_)return{x:_[0],y:_[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(r,i,n,_,p){return{x1:r,y1:i,x2:n,y2:_,cols:this._bufferService.cols,fg:p}}};t.Linkifier=e=h([l(1,o.IMouseService),l(2,o.IRenderService),l(3,g.IBufferService),l(4,o.ILinkProviderService)],e)},9042:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,p=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(o,e,r,i);else for(var u=o.length-1;u>=0;u--)(n=o[u])&&(p=(_<3?n(p):_>3?n(e,r,p):n(e,r))||p);return _>3&&p&&Object.defineProperty(e,r,p),p},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const s=a(511),c=a(2585);let f=t.OscLinkProvider=class{constructor(o,e,r){this._bufferService=o,this._optionsService=e,this._oscLinkService=r}provideLinks(o,e){const r=this._bufferService.buffer.lines.get(o-1);if(!r)return void e(void 0);const i=[],n=this._optionsService.rawOptions.linkHandler,_=new s.CellData,p=r.getTrimmedLength();let u=-1,m=-1,d=!1;for(let v=0;v<p;v++)if(m!==-1||r.hasContent(v)){if(r.loadCell(v,_),_.hasExtendedAttrs()&&_.extended.urlId){if(m===-1){m=v,u=_.extended.urlId;continue}d=_.extended.urlId!==u}else m!==-1&&(d=!0);if(d||m!==-1&&v===p-1){const S=this._oscLinkService.getLinkData(u)?.uri;if(S){const y={start:{x:m+1,y:o},end:{x:v+(d||v!==p-1?0:1),y:o}};let b=!1;if(!n?.allowNonHttpProtocols)try{const w=new URL(S);["http:","https:"].includes(w.protocol)||(b=!0)}catch{b=!0}b||i.push({text:S,range:y,activate:(w,x)=>n?n.activate(w,x,y):g(0,x),hover:(w,x)=>n?.hover?.(w,x,y),leave:(w,x)=>n?.leave?.(w,x,y)})}d=!1,_.hasExtendedAttrs()&&_.extended.urlId?(m=v,u=_.extended.urlId):(m=-1,u=-1)}}e(i)}};function g(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
61
61
|
|
|
62
|
-
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=f=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],f)},6193:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),s=a(3551),c=a(9042),f=a(3730),g=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),n=a(428),_=a(4269),p=a(5114),u=a(8934),m=a(3230),d=a(9312),v=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),x=a(844),B=a(6114),F=a(8437),I=a(2584),O=a(7399),C=a(5941),E=a(9074),T=a(2585),D=a(5435),U=a(4567),$=a(779);class K extends b.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((L,H)=>this.refresh(L,H)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((L=>this._reportWindowsOptions(L)))),this.register(this._inputHandler.onColor((L=>this._handleColorEvent(L)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((L=>this._afterResize(L.cols,L.rows)))),this.register((0,x.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(P){if(this._themeService)for(const L of P){let H,A="";switch(L.index){case 256:H="foreground",A="10";break;case 257:H="background",A="11";break;case 258:H="cursor",A="12";break;default:H="ansi",A="4;"+L.index}switch(L.type){case 0:const W=y.color.toColorRGB(H==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[H]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${A};${(0,C.toRgbString)(W)}${I.C1_ESCAPED.ST}`);break;case 1:if(H==="ansi")this._themeService.modifyColors((q=>q.ansi[L.index]=y.channels.toColor(...L.color)));else{const q=H;this._themeService.modifyColors((ee=>ee[q]=y.channels.toColor(...L.color)))}break;case 2:this._themeService.restoreColor(L.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const P=this.buffer.ybase+this.buffer.y,L=this.buffer.lines.get(P);if(!L)return;const H=Math.min(this.buffer.x,this.cols-1),A=this._renderService.dimensions.css.cell.height,W=L.getWidth(H),q=this._renderService.dimensions.css.cell.width*W,ee=this.buffer.y*this._renderService.dimensions.css.cell.height,G=H*this._renderService.dimensions.css.cell.width;this.textarea.style.left=G+"px",this.textarea.style.top=ee+"px",this.textarea.style.width=q+"px",this.textarea.style.height=A+"px",this.textarea.style.lineHeight=A+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(L=>{this.hasSelection()&&(0,h.copyHandler)(L,this._selectionService)})));const P=L=>(0,h.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),B.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(L=>{L.button===2&&(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(L=>{(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(L=>{L.button===1&&(0,h.moveTextAreaUnderMouseCursor)(L,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(P=>this._keyUp(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(P=>this._keyDown(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(P=>this._keyPress(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(P=>this._compositionHelper.compositionupdate(P)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(P=>this._inputEvent(P)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(P){if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),P.appendChild(this.element);const L=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),L.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",(H=>this.updateCursorStyle(H)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),L.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(p.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(H=>this._handleTextAreaFocus(H)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((H=>this._onRender.fire(H)))),this.onResize((H=>this._renderService.resize(H.cols,H.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(L);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((H=>this.scrollLines(H.amount,H.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((H=>this.scrollLines(H.amount,H.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(H=>this._selectionService.handleMouseDown(H)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(H=>this._handleScreenReaderModeOptionChange(H)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const P=this,L=this.element;function H(q){const ee=P._mouseService.getMouseReportCoords(q,P.screenElement);if(!ee)return!1;let G,te;switch(q.overrideType||q.type){case"mousemove":te=32,q.buttons===void 0?(G=3,q.button!==void 0&&(G=q.button<3?q.button:3)):G=1&q.buttons?0:4&q.buttons?1:2&q.buttons?2:3;break;case"mouseup":te=0,G=q.button<3?q.button:3;break;case"mousedown":te=1,G=q.button<3?q.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(q)===!1||P.viewport.getLinesScrolled(q)===0)return!1;te=q.deltaY<0?0:1,G=4;break;default:return!1}return!(te===void 0||G===void 0||G>4)&&P.coreMouseService.triggerMouseEvent({col:ee.col,row:ee.row,x:ee.x,y:ee.y,button:G,action:te,ctrl:q.ctrlKey,alt:q.altKey,shift:q.shiftKey})}const A={mouseup:null,wheel:null,mousedrag:null,mousemove:null},W={mouseup:q=>(H(q),q.buttons||(this._document.removeEventListener("mouseup",A.mouseup),A.mousedrag&&this._document.removeEventListener("mousemove",A.mousedrag)),this.cancel(q)),wheel:q=>(H(q),this.cancel(q,!0)),mousedrag:q=>{q.buttons&&H(q)},mousemove:q=>{q.buttons||H(q)}};this.register(this.coreMouseService.onProtocolChange((q=>{q?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(q)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&q?A.mousemove||(L.addEventListener("mousemove",W.mousemove),A.mousemove=W.mousemove):(L.removeEventListener("mousemove",A.mousemove),A.mousemove=null),16&q?A.wheel||(L.addEventListener("wheel",W.wheel,{passive:!1}),A.wheel=W.wheel):(L.removeEventListener("wheel",A.wheel),A.wheel=null),2&q?A.mouseup||(A.mouseup=W.mouseup):(this._document.removeEventListener("mouseup",A.mouseup),A.mouseup=null),4&q?A.mousedrag||(A.mousedrag=W.mousedrag):(this._document.removeEventListener("mousemove",A.mousedrag),A.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(L,"mousedown",(q=>{if(q.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(q))return H(q),A.mouseup&&this._document.addEventListener("mouseup",A.mouseup),A.mousedrag&&this._document.addEventListener("mousemove",A.mousedrag),this.cancel(q)}))),this.register((0,l.addDisposableDomListener)(L,"wheel",(q=>{if(!A.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(q)===!1)return!1;if(!this.buffer.hasScrollback){const ee=this.viewport.getLinesScrolled(q);if(ee===0)return;const G=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(q.deltaY<0?"A":"B");let te="";for(let ae=0;ae<Math.abs(ee);ae++)te+=G;return this.coreService.triggerDataEvent(te,!0),this.cancel(q,!0)}return this.viewport.handleWheel(q)?this.cancel(q):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(L,"touchstart",(q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(q),this.cancel(q)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(L,"touchmove",(q=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(q)?void 0:this.cancel(q)}),{passive:!1}))}refresh(P,L){this._renderService?.refreshRows(P,L)}updateCursorStyle(P){this._selectionService?.shouldColumnSelect(P)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(P,L,H=0){H===1?(super.scrollLines(P,L,H),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(P)}paste(P){(0,h.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const L=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),L}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,L,H){this._selectionService.setSelection(P,L,H)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(P,L){this._selectionService?.selectLines(P,L)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const L=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!L&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const H=(0,O.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),H.type===3||H.type===2){const A=this.rows-1;return this.scrollLines(H.type===2?-A:A),this.cancel(P,!0)}return H.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(H.cancel&&this.cancel(P,!0),!H.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(H.key!==I.C0.ETX&&H.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:H.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(H.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,L){const H=P.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||P.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||P.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?H:H&&(!L.keyCode||L.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||((function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18})(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)L=P.charCode;else if(P.which===null||P.which===void 0)L=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;L=P.which}return!(!L||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(L,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const L=P.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(P),!0}return!1}resize(P,L){P!==this.cols||L!==this.rows?super.resize(P,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,L){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const P=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(I.C0.ESC+"[I"):this.coreService.triggerDataEvent(I.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const L=this._renderService.dimensions.css.canvas.width.toFixed(0),H=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[4;${H};${L}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const A=this._renderService.dimensions.css.cell.width.toFixed(0),W=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[6;${W};${A}t`)}}cancel(P,L){if(this.options.cancelEvents||L)return P.preventDefault(),P.stopPropagation(),!1}}t.Terminal=K},9924:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=s-this._lastRefreshMs,f=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),f)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,_){var p,u=arguments.length,m=u<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,n,_);else for(var d=r.length-1;d>=0;d--)(p=r[d])&&(m=(u<3?p(m):u>3?p(i,n,m):p(i,n))||m);return u>3&&m&&Object.defineProperty(i,n,m),m},l=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),c=a(4725),f=a(8460),g=a(844),o=a(2585);let e=t.Viewport=class extends g.Disposable{constructor(r,i,n,_,p,u,m,d){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=n,this._optionsService=_,this._charSizeService=p,this._renderService=u,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((v=>this._activeBuffer=v.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((v=>this._renderDimensions=v))),this._handleThemeChange(d.colors),this.register(d.onChangeColors((v=>this._handleThemeChange(v)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(r){if(r)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(r,i){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&n<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);return i!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){let n,_="";const p=[],u=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let d=r;d<u;d++){const v=m.get(d);if(!v)continue;const S=m.get(d+1)?.isWrapped;if(_+=v.translateToString(!S),!S||d===m.length-1){const y=document.createElement("div");y.textContent=_,p.push(y),_.length>0&&(n=y),_=""}}return{bufferElements:p,cursorElement:n}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&i.altKey||n==="ctrl"&&i.ctrlKey||n==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,p=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(o,e,r,i);else for(var u=o.length-1;u>=0;u--)(n=o[u])&&(p=(_<3?n(p):_>3?n(e,r,p):n(e,r))||p);return _>3&&p&&Object.defineProperty(e,r,p),p},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=a(4725),c=a(844),f=a(2585);let g=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,n){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((_=>this._removeDecoration(_)))),this.register((0,c.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",o?.options?.layer==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose((()=>{this._decorationElements.delete(o),r.remove()}))),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){this._decorationElements.get(o)?.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=g=h([l(1,f.IBufferService),l(2,s.ICoreBrowserService),l(3,f.IDecorationService),l(4,s.IRenderService)],g)},5871:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(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.OverviewRulerRenderer=void 0;const s=a(5871),c=a(4725),f=a(844),g=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(n,_,p,u,m,d,v){super(),this._viewportElement=n,this._screenElement=_,this._bufferService=p,this._decorationService=u,this._renderService=m,this._optionsService=d,this._coreBrowserService=v,this._colorZoneStore=new s.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const S=this._canvas.getContext("2d");if(!S)throw new Error("Ctx cannot be null");this._ctx=S,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const n=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=n,e.center=_,e.right=n,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const n=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(n,12),6)*this._coreBrowserService.dpr);o.left=_,o.center=_,o.right=_}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const _ of this._decorationService.decorations)this._colorZoneStore.addDecoration(_);this._ctx.lineWidth=1;const n=this._colorZoneStore.zones;for(const _ of n)_.position!=="full"&&this._renderColorZone(_);for(const _ of n)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(r[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-o[n.position||"full"]/2),e[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[n.position||"full"]))}_queueRefresh(n,_){this._shouldUpdateDimensions=n||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=i=h([l(2,g.IBufferService),l(3,g.IDecorationService),l(4,c.IRenderService),l(5,g.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,p=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(o,e,r,i);else for(var u=o.length-1;u>=0;u--)(n=o[u])&&(p=(_<3?n(p):_>3?n(e,r,p):n(e,r))||p);return _>3&&p&&Object.defineProperty(e,r,p),p},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=a(4725),c=a(2585),f=a(2584);let g=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,n,_){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=_,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}}),0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const _=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=g=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,s.IRenderService)],g)},9806:(M,t)=>{function a(h,l,s){const c=s.getBoundingClientRect(),f=h.getComputedStyle(s),g=parseInt(f.getPropertyValue("padding-left")),o=parseInt(f.getPropertyValue("padding-top"));return[l.clientX-c.left-g,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,s,c,f,g,o,e,r){if(!g)return;const i=a(h,l,s);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),f),i):void 0}},9504:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,n){const _=e-s(e,i),p=r-s(r,i),u=Math.abs(_-p)-(function(m,d,v){let S=0;const y=m-s(m,v),b=d-s(d,v);for(let w=0;w<Math.abs(y-b);w++){const x=c(m,d)==="A"?-1:1;v.buffer.lines.get(y+x*w)?.isWrapped&&S++}return S})(e,r,i);return o(u,g(c(e,r),n))}function s(e,r){let i=0,n=r.buffer.lines.get(e),_=n?.isWrapped;for(;_&&e>=0&&e<r.rows;)i++,n=r.buffer.lines.get(--e),_=n?.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function f(e,r,i,n,_,p){let u=e,m=r,d="";for(;u!==i||m!==n;)u+=_?1:-1,_&&u>p.cols-1?(d+=p.buffer.translateBufferLineToString(m,!1,e,u),u=0,e=0,m++):!_&&u<0&&(d+=p.buffer.translateBufferLineToString(m,!1,0,e+1),u=p.cols-1,e=u,m--);return d+p.buffer.translateBufferLineToString(m,!1,e,u)}function g(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=r;return i}t.moveToCellSequence=function(e,r,i,n){const _=i.buffer.x,p=i.buffer.y;if(!i.buffer.hasScrollback)return(function(d,v,S,y,b,w){return l(v,y,b,w).length===0?"":o(f(d,v,d,v-s(v,b),!1,b).length,g("D",w))})(_,p,0,r,i,n)+l(p,r,i,n)+(function(d,v,S,y,b,w){let x;x=l(v,y,b,w).length>0?y-s(y,b):v;const B=y,F=(function(I,O,C,E,T,D){let U;return U=l(C,E,T,D).length>0?E-s(E,T):O,I<C&&U<=E||I>=C&&U<E?"C":"D"})(d,v,S,y,b,w);return o(f(d,x,S,B,F==="C",b).length,g(F,w))})(_,p,e,r,i,n);let u;if(p===r)return u=_>e?"D":"C",o(Math.abs(_-e),g(u,n));u=p>r?"D":"C";const m=Math.abs(p-r);return o((function(d,v){return v.cols-d})(p>r?e:_,i)+(m-1)*i.cols+1+((p>r?_:e)-1),g(u,n))}},1296:function(M,t,a){var h=this&&this.__decorate||function(w,x,B,F){var I,O=arguments.length,C=O<3?x:F===null?F=Object.getOwnPropertyDescriptor(x,B):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,x,B,F);else for(var E=w.length-1;E>=0;E--)(I=w[E])&&(C=(O<3?I(C):O>3?I(x,B,C):I(x,B))||C);return O>3&&C&&Object.defineProperty(x,B,C),C},l=this&&this.__param||function(w,x){return function(B,F){x(B,F,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),c=a(2550),f=a(2223),g=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),n=a(844),_=a(2585),p="xterm-dom-renderer-owner-",u="xterm-rows",m="xterm-fg-",d="xterm-bg-",v="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends n.Disposable{constructor(w,x,B,F,I,O,C,E,T,D,U,$,K){super(),this._terminal=w,this._document=x,this._element=B,this._screenElement=F,this._viewportElement=I,this._helperContainer=O,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=U,this._coreBrowserService=$,this._themeService=K,this._terminalClass=y++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((X=>this._injectCss(X)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((X=>this._handleLinkHover(X)))),this.register(this._linkifier2.onHideLinkUnderline((X=>this._handleLinkLeave(X)))),this.register((0,n.toDisposable)((()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new c.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const x=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=x,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let x=`${this._terminalSelector} .${u} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;x+=`${this._terminalSelector} .${u} .xterm-dim { color: ${r.color.multiplyOpacity(w.foreground,.5).css};}`,x+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const B=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,I=`blink_block_${this._terminalClass}`;x+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${F} { 50% { box-shadow: none; }}`,x+=`@keyframes ${I} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,x+=`${this._terminalSelector} .${u}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${u}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${u}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,x+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(const[O,C]of w.ansi.entries())x+=`${this._terminalSelector} .${m}${O} { color: ${C.css}; }${this._terminalSelector} .${m}${O}.xterm-dim { color: ${r.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${d}${O} { background-color: ${C.css}; }`;x+=`${this._terminalSelector} .${m}${f.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${d}${f.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=x}_setDefaultSpacing(){const w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,x){for(let B=this._rowElements.length;B<=x;B++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,x){this._refreshRowElements(w,x),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(v),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(v),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,x,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,x,B),this.renderRows(0,this._bufferService.rows-1),!w||!x)return;this._selectionRenderModel.update(this._terminal,w,x,B);const F=this._selectionRenderModel.viewportStartRow,I=this._selectionRenderModel.viewportEndRow,O=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(O>=this._bufferService.rows||C<0)return;const E=this._document.createDocumentFragment();if(B){const T=w[0]>x[0];E.appendChild(this._createSelectionElement(O,T?x[0]:w[0],T?w[0]:x[0],C-O+1))}else{const T=F===O?w[0]:0,D=O===I?x[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(O,T,D));const U=C-O-1;if(E.appendChild(this._createSelectionElement(O+1,0,this._bufferService.cols,U)),O!==C){const $=I===C?x[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(C,0,$))}}this._selectionContainer.appendChild(E)}_createSelectionElement(w,x,B,F=1){const I=this._document.createElement("div"),O=x*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(B-x);return O+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-O),I.style.height=F*this.dimensions.css.cell.height+"px",I.style.top=w*this.dimensions.css.cell.height+"px",I.style.left=`${O}px`,I.style.width=`${C}px`,I}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const w of this._rowElements)w.replaceChildren()}renderRows(w,x){const B=this._bufferService.buffer,F=B.ybase+B.y,I=Math.min(B.x,this._bufferService.cols-1),O=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=w;T<=x;T++){const D=T+B.ydisp,U=this._rowElements[T],$=B.lines.get(D);if(!U||!$)break;U.replaceChildren(...this._rowFactory.createRow($,D,D===F,C,E,I,O,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,x,B,F,I,O){B<0&&(w=0),F<0&&(x=0);const C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),F=Math.max(Math.min(F,C),0),I=Math.min(I,this._bufferService.cols);const E=this._bufferService.buffer,T=E.ybase+E.y,D=Math.min(E.x,I-1),U=this._optionsService.rawOptions.cursorBlink,$=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let X=B;X<=F;++X){const P=X+E.ydisp,L=this._rowElements[X],H=E.lines.get(P);if(!L||!H)break;L.replaceChildren(...this._rowFactory.createRow(H,P,P===T,$,K,D,U,this.dimensions.css.cell.width,this._widthCache,O?X===B?w:0:-1,O?(X===F?x:I)-1:-1))}}};t.DomRenderer=b=h([l(7,_.IInstantiationService),l(8,e.ICharSizeService),l(9,_.IOptionsService),l(10,_.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],b)},3787:function(M,t,a){var h=this&&this.__decorate||function(u,m,d,v){var S,y=arguments.length,b=y<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,d):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,m,d,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(b=(y<3?S(b):y>3?S(m,d,b):S(m,d))||b);return y>3&&b&&Object.defineProperty(m,d,b),b},l=this&&this.__param||function(u,m){return function(d,v){m(d,v,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),c=a(643),f=a(511),g=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),n=a(3734);let _=t.DomRendererRowFactory=class{constructor(u,m,d,v,S,y,b){this._document=u,this._characterJoinerService=m,this._optionsService=d,this._coreBrowserService=v,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,m,d){this._selectionStart=u,this._selectionEnd=m,this._columnSelectMode=d}createRow(u,m,d,v,S,y,b,w,x,B,F){const I=[],O=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let E,T=u.getNoBgTrimmedLength();d&&T<y+1&&(T=y+1);let D=0,U="",$=0,K=0,X=0,P=!1,L=0,H=!1,A=0;const W=[],q=B!==-1&&F!==-1;for(let ee=0;ee<T;ee++){u.loadCell(ee,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let te=!1,ae=ee,Q=this._workCell;if(O.length>0&&ee===O[0][0]){te=!0;const ie=O.shift();Q=new r.JoinedCellData(this._workCell,u.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),ae=ie[1]-1,G=Q.getWidth()}const ge=this._isCellInSelection(ee,m),Se=d&&ee===y,oe=q&&ee>=B&&ee<=F;let se=!1;this._decorationService.forEachDecorationAtCell(ee,m,void 0,(ie=>{se=!0}));let re=Q.getChars()||c.WHITESPACE_CELL_CHAR;if(re===" "&&(Q.isUnderline()||Q.isOverline())&&(re=" "),A=G*w-x.get(re,Q.isBold(),Q.isItalic()),E){if(D&&(ge&&H||!ge&&!H&&Q.bg===$)&&(ge&&H&&C.selectionForeground||Q.fg===K)&&Q.extended.ext===X&&oe===P&&A===L&&!Se&&!te&&!se){Q.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=re,D++;continue}D&&(E.textContent=U),E=this._document.createElement("span"),D=0,U=""}else E=this._document.createElement("span");if($=Q.bg,K=Q.fg,X=Q.extended.ext,P=oe,L=A,H=ge,te&&y>=ee&&y<=ae&&(y=ee),!this._coreService.isCursorHidden&&Se&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&W.push("xterm-cursor-blink"),W.push(v==="bar"?"xterm-cursor-bar":v==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline")}}if(Q.isBold()&&W.push("xterm-bold"),Q.isItalic()&&W.push("xterm-italic"),Q.isDim()&&W.push("xterm-dim"),U=Q.isInvisible()?c.WHITESPACE_CELL_CHAR:Q.getChars()||c.WHITESPACE_CELL_CHAR,Q.isUnderline()&&(W.push(`xterm-underline-${Q.extended.underlineStyle}`),U===" "&&(U=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${n.AttributeData.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let ie=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&ie<8&&(ie+=8),E.style.textDecorationColor=C.ansi[ie].css}Q.isOverline()&&(W.push("xterm-overline"),U===" "&&(U=" ")),Q.isStrikethrough()&&W.push("xterm-strikethrough"),oe&&(E.style.textDecoration="underline");let Z=Q.getFgColor(),ne=Q.getFgColorMode(),ce=Q.getBgColor(),le=Q.getBgColorMode();const ve=!!Q.isInverse();if(ve){const ie=Z;Z=ce,ce=ie;const be=ne;ne=le,le=be}let de,_e,ue,he=!1;switch(this._decorationService.forEachDecorationAtCell(ee,m,void 0,(ie=>{ie.options.layer!=="top"&&he||(ie.backgroundColorRGB&&(le=50331648,ce=ie.backgroundColorRGB.rgba>>8&16777215,de=ie.backgroundColorRGB),ie.foregroundColorRGB&&(ne=50331648,Z=ie.foregroundColorRGB.rgba>>8&16777215,_e=ie.foregroundColorRGB),he=ie.options.layer==="top")})),!he&&ge&&(de=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ce=de.rgba>>8&16777215,le=50331648,he=!0,C.selectionForeground&&(ne=50331648,Z=C.selectionForeground.rgba>>8&16777215,_e=C.selectionForeground)),he&&W.push("xterm-decoration-top"),le){case 16777216:case 33554432:ue=C.ansi[ce],W.push(`xterm-bg-${ce}`);break;case 50331648:ue=o.channels.toColor(ce>>16,ce>>8&255,255&ce),this._addStyle(E,`background-color:#${p((ce>>>0).toString(16),"0",6)}`);break;default:ve?(ue=C.foreground,W.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):ue=C.background}switch(de||Q.isDim()&&(de=o.color.multiplyOpacity(ue,.5)),ne){case 16777216:case 33554432:Q.isBold()&&Z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Z+=8),this._applyMinimumContrast(E,ue,C.ansi[Z],Q,de,void 0)||W.push(`xterm-fg-${Z}`);break;case 50331648:const ie=o.channels.toColor(Z>>16&255,Z>>8&255,255&Z);this._applyMinimumContrast(E,ue,ie,Q,de,_e)||this._addStyle(E,`color:#${p(Z.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ue,C.foreground,Q,de,_e)||ve&&W.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}W.length&&(E.className=W.join(" "),W.length=0),Se||te||se?E.textContent=U:D++,A!==this.defaultSpacing&&(E.style.letterSpacing=`${A}px`),I.push(E),ee=ae}return E&&D&&(E.textContent=U),I}_applyMinimumContrast(u,m,d,v,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(v.getCode()))return!1;const b=this._getContrastCache(v);let w;if(S||y||(w=b.getColor(m.rgba,d.rgba)),w===void 0){const x=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,y||d,x),b.setColor((S||m).rgba,(y||d).rgba,w??null)}return!!w&&(this._addStyle(u,`color:${w.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,m){u.setAttribute("style",`${u.getAttribute("style")||""}${m};`)}_isCellInSelection(u,m){const d=this._selectionStart,v=this._selectionEnd;return!(!d||!v)&&(this._columnSelectMode?d[0]<=v[0]?u>=d[0]&&m>=d[1]&&u<v[0]&&m<=v[1]:u<d[0]&&m>=d[1]&&u>=v[0]&&m<=v[1]:m>d[1]&&m<v[1]||d[1]===v[1]&&m===d[1]&&u>=d[0]&&u<v[0]||d[1]<v[1]&&m===v[1]&&u<v[0]||d[1]<v[1]&&m===d[1]&&u>=d[0])}};function p(u,m,d){for(;u.length<d;)u=m+u;return u}t.DomRendererRowFactory=_=h([l(1,e.ICharacterJoinerService),l(2,g.IOptionsService),l(3,e.ICoreBrowserService),l(4,g.ICoreService),l(5,g.IDecorationService),l(6,e.IThemeService)],_)},2550:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const f=a.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[l,s,c,f],this._container.appendChild(l),this._container.appendChild(s),this._container.appendChild(c),this._container.appendChild(f),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,h,l,s){a===this._font&&h===this._fontSize&&l===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,h,l){let s=0;if(!h&&!l&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const g=this._measure(a,0);return g>0&&(this._flat[s]=g),g}let c=a;h&&(c+="B"),l&&(c+="I");let f=this._holey.get(c);if(f===void 0){let g=0;h&&(g|=1),l&&(g|=2),f=this._measure(a,g),f>0&&this._holey.set(c,f)}return f}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,f){return s===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!(function(g){return 57344<=g&&g<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(s){return 9472<=s&&s<=9631})(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},6052:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,s,c,f=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const g=l.buffers.active.ydisp,o=s[1]-g,e=c[1]-g,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(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.CharSizeService=void 0;const s=a(2585),c=a(8460),f=a(844);let g=t.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,n,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,n,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=g=h([l(2,s.IOptionsService)],g);class o extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,_){n!==void 0&&n>0&&_!==void 0&&_>0&&(this._result.width=n,this._result.height=_)}}class e extends o{constructor(n,_,p){super(),this._document=n,this._parentElement=_,this._optionsService=p,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const _=this._ctx.measureText("W");if(!("width"in _&&"fontBoundingBoxAscent"in _&&"fontBoundingBoxDescent"in _))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,_){var p,u=arguments.length,m=u<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,n,_);else for(var d=r.length-1;d>=0;d--)(p=r[d])&&(m=(u<3?p(m):u>3?p(i,n,m):p(i,n))||m);return u>3&&m&&Object.defineProperty(i,n,m),m},l=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),c=a(643),f=a(511),g=a(2585);class o extends s.AttributeData{constructor(i,n,_){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=n,this._width=_}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class ht{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(i){const n={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(n),n.id}deregister(i){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===i)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(i);if(!n||n.length===0)return[];const _=[],p=n.translateToString(!0);let u=0,m=0,d=0,v=n.getFg(0),S=n.getBg(0);for(let y=0;y<n.getTrimmedLength();y++)if(n.loadCell(y,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==v||this._workCell.bg!==S){if(y-u>1){const b=this._getJoinedRanges(p,d,m,n,u);for(let w=0;w<b.length;w++)_.push(b[w])}u=y,d=m,v=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1){const y=this._getJoinedRanges(p,d,m,n,u);for(let b=0;b<y.length;b++)_.push(y[b])}return _}_getJoinedRanges(i,n,_,p,u){const m=i.substring(n,_);let d=[];try{d=this._characterJoiners[0].handler(m)}catch(v){console.error(v)}for(let v=1;v<this._characterJoiners.length;v++)try{const S=this._characterJoiners[v].handler(m);for(let y=0;y<S.length;y++)ht._mergeRanges(d,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(d,p,u),d}_stringRangesToCellRanges(i,n,_){let p=0,u=!1,m=0,d=i[p];if(d){for(let v=_;v<this._bufferService.cols;v++){const S=n.getWidth(v),y=n.getString(v).length||c.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!u&&d[0]<=m&&(d[0]=v,u=!0),d[1]<=m){if(d[1]=v,d=i[++p],!d)break;d[0]<=m?(d[0]=v,u=!0):u=!1}m+=y}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(i,n){let _=!1;for(let p=0;p<i.length;p++){const u=i[p];if(_){if(n[1]<=u[0])return i[p-1][1]=n[1],i;if(n[1]<=u[1])return i[p-1][1]=Math.max(n[1],u[1]),i.splice(p,1),i;i.splice(p,1),p--}else{if(n[1]<=u[0])return i.splice(p,0,n),i;if(n[1]<=u[1])return u[0]=Math.min(n[0],u[0]),i;n[0]<u[1]&&(u[0]=Math.min(n[0],u[0]),_=!0)}}return _?i[i.length-1][1]=n[1]:i.push(n),i}};t.CharacterJoinerService=e=h([l(0,g.IBufferService)],e)},5114:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),s=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((i=>this._screenDprMonitor.setWindow(i)))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=c;class f extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const f=this.linkProviders.indexOf(c);f!==-1&&this.linkProviders.splice(f,1)}}}}t.LinkProviderService=l},8934:function(M,t,a){var h=this&&this.__decorate||function(g,o,e,r){var i,n=arguments.length,_=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(g,o,e,r);else for(var p=g.length-1;p>=0;p--)(i=g[p])&&(_=(n<3?i(_):n>3?i(o,e,_):i(o,e))||_);return n>3&&_&&Object.defineProperty(o,e,_),_},l=this&&this.__param||function(g,o){return function(e,r){o(e,r,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),c=a(9806);let f=t.MouseService=class{constructor(g,o){this._renderService=g,this._charSizeService=o}getCoords(g,o,e,r,i){return(0,c.getCoords)(window,g,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(g,o){const e=(0,c.getCoordsRelativeToElement)(window,g,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=f=h([l(0,s.IRenderService),l(1,s.ICharSizeService)],f)},3230: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.RenderService=void 0;const s=a(6193),c=a(4725),f=a(8460),g=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,n,_,p,u,m,d,v){super(),this._rowCount=i,this._charSizeService=p,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer(((S,y)=>this._renderRows(S,y)),d),this.register(this._renderDebouncer),this.register(d.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(m.onResize((()=>this._fullRefresh()))),this.register(m.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(_.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(u.onDecorationRegistered((()=>this._fullRefresh()))),this.register(u.onDecorationRemoved((()=>this._fullRefresh()))),this.register(_.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()}))),this.register(_.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(m.buffer.y,m.buffer.y,!0)))),this.register(v.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(d.window,n),this.register(d.onWindowChange((S=>this._registerIntersectionObserver(S,n))))}_registerIntersectionObserver(i,n){if("IntersectionObserver"in i){const _=new i.IntersectionObserver((p=>this._handleIntersectionChange(p[p.length-1])),{threshold:0});_.observe(n),this._observerDisposable.value=(0,g.toDisposable)((()=>_.disconnect()))}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,n,_=!1){this._isPaused?this._needsFullRefresh=!0:(_||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,n,this._rowCount))}_renderRows(i,n){this._renderer.value&&(i=Math.min(i,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(i,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:n}),this._onRender.fire({start:i,end:n}),this._isNextRenderRedrawOnly=!0)}resize(i,n){this._rowCount=n,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw((n=>this.refreshRows(n.start,n.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(i,n))):this._renderer.value.handleResize(i,n),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(i,n,_){this._selectionState.start=i,this._selectionState.end=n,this._selectionState.columnSelectMode=_,this._renderer.value?.handleSelectionChanged(i,n,_)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=r=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],r)},9312:function(M,t,a){var h=this&&this.__decorate||function(d,v,S,y){var b,w=arguments.length,x=w<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(d,v,S,y);else for(var B=d.length-1;B>=0;B--)(b=d[B])&&(x=(w<3?b(x):w>3?b(v,S,x):b(v,S))||x);return w>3&&x&&Object.defineProperty(v,S,x),x},l=this&&this.__param||function(d,v){return function(S,y){v(S,y,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),c=a(9504),f=a(456),g=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),n=a(511),_=a(2585),p=" ",u=new RegExp(p,"g");let m=t.SelectionService=class extends e.Disposable{constructor(d,v,S,y,b,w,x,B,F){super(),this._element=d,this._screenElement=v,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=x,this._renderService=B,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((I=>this._handleTrim(I))),this.register(this._bufferService.buffers.onBufferActivate((I=>this._handleBufferActivate(I)))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const d=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;return!(!d||!v||d[0]===v[0]&&d[1]===v[1])}get selectionText(){const d=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;if(!d||!v)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(d[0]===v[0])return"";const b=d[0]<v[0]?d[0]:v[0],w=d[0]<v[0]?v[0]:d[0];for(let x=d[1];x<=v[1];x++){const B=S.translateBufferLineToString(x,!0,b,w);y.push(B)}}else{const b=d[1]===v[1]?v[0]:void 0;y.push(S.translateBufferLineToString(d[1],!0,d[0],b));for(let w=d[1]+1;w<=v[1]-1;w++){const x=S.lines.get(w),B=S.translateBufferLineToString(w,!0);x?.isWrapped?y[y.length-1]+=B:y.push(B)}if(d[1]!==v[1]){const w=S.lines.get(v[1]),x=S.translateBufferLineToString(v[1],!0,0,v[0]);w&&w.isWrapped?y[y.length-1]+=x:y.push(x)}}return y.map((b=>b.replace(u," "))).join(r.isWindows?`\r
|
|
62
|
+
WARNING: This link could potentially be dangerous`)){const r=window.open();if(r){try{r.opener=null}catch{}r.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=f=h([l(0,c.IBufferService),l(1,c.IOptionsService),l(2,c.IOscLinkService)],f)},6193:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(a,h){this._renderCallback=a,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const h=a(3614),l=a(3656),s=a(3551),c=a(9042),f=a(3730),g=a(1680),o=a(3107),e=a(5744),r=a(2950),i=a(1296),n=a(428),_=a(4269),p=a(5114),u=a(8934),m=a(3230),d=a(9312),v=a(4725),S=a(6731),y=a(8055),b=a(8969),w=a(8460),x=a(844),B=a(6114),F=a(8437),I=a(2584),O=a(7399),C=a(5941),E=a(9074),T=a(2585),D=a(5435),U=a(4567),$=a(779);class K extends b.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(P={}){super(P),this.browser=B,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new w.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new w.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new w.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new w.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new w.EventEmitter),this._onBlur=this.register(new w.EventEmitter),this._onA11yCharEmitter=this.register(new w.EventEmitter),this._onA11yTabEmitter=this.register(new w.EventEmitter),this._onWillOpen=this.register(new w.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(E.DecorationService),this._instantiationService.setService(T.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($.LinkProviderService),this._instantiationService.setService(v.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(f.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((L,N)=>this.refresh(L,N)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((L=>this._reportWindowsOptions(L)))),this.register(this._inputHandler.onColor((L=>this._handleColorEvent(L)))),this.register((0,w.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,w.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,w.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((L=>this._afterResize(L.cols,L.rows)))),this.register((0,x.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(P){if(this._themeService)for(const L of P){let N,A="";switch(L.index){case 256:N="foreground",A="10";break;case 257:N="background",A="11";break;case 258:N="cursor",A="12";break;default:N="ansi",A="4;"+L.index}switch(L.type){case 0:const W=y.color.toColorRGB(N==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[N]);this.coreService.triggerDataEvent(`${I.C0.ESC}]${A};${(0,C.toRgbString)(W)}${I.C1_ESCAPED.ST}`);break;case 1:if(N==="ansi")this._themeService.modifyColors((V=>V.ansi[L.index]=y.channels.toColor(...L.color)));else{const V=N;this._themeService.modifyColors((ee=>ee[V]=y.channels.toColor(...L.color)))}break;case 2:this._themeService.restoreColor(L.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(P){P?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(P){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(I.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const P=this.buffer.ybase+this.buffer.y,L=this.buffer.lines.get(P);if(!L)return;const N=Math.min(this.buffer.x,this.cols-1),A=this._renderService.dimensions.css.cell.height,W=L.getWidth(N),V=this._renderService.dimensions.css.cell.width*W,ee=this.buffer.y*this._renderService.dimensions.css.cell.height,G=N*this._renderService.dimensions.css.cell.width;this.textarea.style.left=G+"px",this.textarea.style.top=ee+"px",this.textarea.style.width=V+"px",this.textarea.style.height=A+"px",this.textarea.style.lineHeight=A+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,l.addDisposableDomListener)(this.element,"copy",(L=>{this.hasSelection()&&(0,h.copyHandler)(L,this._selectionService)})));const P=L=>(0,h.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,l.addDisposableDomListener)(this.textarea,"paste",P)),this.register((0,l.addDisposableDomListener)(this.element,"paste",P)),B.isFirefox?this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(L=>{L.button===2&&(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,l.addDisposableDomListener)(this.element,"contextmenu",(L=>{(0,h.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),B.isLinux&&this.register((0,l.addDisposableDomListener)(this.element,"auxclick",(L=>{L.button===1&&(0,h.moveTextAreaUnderMouseCursor)(L,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,l.addDisposableDomListener)(this.textarea,"keyup",(P=>this._keyUp(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keydown",(P=>this._keyDown(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"keypress",(P=>this._keyPress(P)),!0)),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionupdate",(P=>this._compositionHelper.compositionupdate(P)))),this.register((0,l.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,l.addDisposableDomListener)(this.textarea,"input",(P=>this._inputEvent(P)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(P){if(!P)throw new Error("Terminal requires a parent element.");if(P.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=P.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),P.appendChild(this.element);const L=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),L.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,l.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),L.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",c.promptLabel),B.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(p.CoreBrowserService,this.textarea,P.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(v.ICoreBrowserService,this._coreBrowserService),this.register((0,l.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,l.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(v.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(S.ThemeService),this._instantiationService.setService(v.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_.CharacterJoinerService),this._instantiationService.setService(v.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(m.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(v.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(r.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u.MouseService),this._instantiationService.setService(v.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(s.Linkifier,this.screenElement)),this.element.appendChild(L);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(v.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(o.BufferDecorationRenderer,this.screenElement)),this.register((0,l.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(i.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const P=this,L=this.element;function N(V){const ee=P._mouseService.getMouseReportCoords(V,P.screenElement);if(!ee)return!1;let G,te;switch(V.overrideType||V.type){case"mousemove":te=32,V.buttons===void 0?(G=3,V.button!==void 0&&(G=V.button<3?V.button:3)):G=1&V.buttons?0:4&V.buttons?1:2&V.buttons?2:3;break;case"mouseup":te=0,G=V.button<3?V.button:3;break;case"mousedown":te=1,G=V.button<3?V.button:3;break;case"wheel":if(P._customWheelEventHandler&&P._customWheelEventHandler(V)===!1||P.viewport.getLinesScrolled(V)===0)return!1;te=V.deltaY<0?0:1,G=4;break;default:return!1}return!(te===void 0||G===void 0||G>4)&&P.coreMouseService.triggerMouseEvent({col:ee.col,row:ee.row,x:ee.x,y:ee.y,button:G,action:te,ctrl:V.ctrlKey,alt:V.altKey,shift:V.shiftKey})}const A={mouseup:null,wheel:null,mousedrag:null,mousemove:null},W={mouseup:V=>(N(V),V.buttons||(this._document.removeEventListener("mouseup",A.mouseup),A.mousedrag&&this._document.removeEventListener("mousemove",A.mousedrag)),this.cancel(V)),wheel:V=>(N(V),this.cancel(V,!0)),mousedrag:V=>{V.buttons&&N(V)},mousemove:V=>{V.buttons||N(V)}};this.register(this.coreMouseService.onProtocolChange((V=>{V?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(V)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&V?A.mousemove||(L.addEventListener("mousemove",W.mousemove),A.mousemove=W.mousemove):(L.removeEventListener("mousemove",A.mousemove),A.mousemove=null),16&V?A.wheel||(L.addEventListener("wheel",W.wheel,{passive:!1}),A.wheel=W.wheel):(L.removeEventListener("wheel",A.wheel),A.wheel=null),2&V?A.mouseup||(A.mouseup=W.mouseup):(this._document.removeEventListener("mouseup",A.mouseup),A.mouseup=null),4&V?A.mousedrag||(A.mousedrag=W.mousedrag):(this._document.removeEventListener("mousemove",A.mousedrag),A.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,l.addDisposableDomListener)(L,"mousedown",(V=>{if(V.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(V))return N(V),A.mouseup&&this._document.addEventListener("mouseup",A.mouseup),A.mousedrag&&this._document.addEventListener("mousemove",A.mousedrag),this.cancel(V)}))),this.register((0,l.addDisposableDomListener)(L,"wheel",(V=>{if(!A.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(V)===!1)return!1;if(!this.buffer.hasScrollback){const ee=this.viewport.getLinesScrolled(V);if(ee===0)return;const G=I.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(V.deltaY<0?"A":"B");let te="";for(let ae=0;ae<Math.abs(ee);ae++)te+=G;return this.coreService.triggerDataEvent(te,!0),this.cancel(V,!0)}return this.viewport.handleWheel(V)?this.cancel(V):void 0}}),{passive:!1})),this.register((0,l.addDisposableDomListener)(L,"touchstart",(V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(V),this.cancel(V)}),{passive:!0})),this.register((0,l.addDisposableDomListener)(L,"touchmove",(V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(V)?void 0:this.cancel(V)}),{passive:!1}))}refresh(P,L){this._renderService?.refreshRows(P,L)}updateCursorStyle(P){this._selectionService?.shouldColumnSelect(P)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(P,L,N=0){N===1?(super.scrollLines(P,L,N),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(P)}paste(P){(0,h.paste)(P,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(P){this._customKeyEventHandler=P}attachCustomWheelEventHandler(P){this._customWheelEventHandler=P}registerLinkProvider(P){return this._linkProviderService.registerLinkProvider(P)}registerCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const L=this._characterJoinerService.register(P);return this.refresh(0,this.rows-1),L}deregisterCharacterJoiner(P){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(P)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(P){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+P)}registerDecoration(P){return this._decorationService.registerDecoration(P)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(P,L,N){this._selectionService.setSelection(P,L,N)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(P,L){this._selectionService?.selectLines(P,L)}_keyDown(P){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;const L=this.browser.isMac&&this.options.macOptionIsMeta&&P.altKey;if(!L&&!this._compositionHelper.keydown(P))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||P.key!=="Dead"&&P.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const N=(0,O.evaluateKeyboardEvent)(P,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(P),N.type===3||N.type===2){const A=this.rows-1;return this.scrollLines(N.type===2?-A:A),this.cancel(P,!0)}return N.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,P)||(N.cancel&&this.cancel(P,!0),!N.key||!!(P.key&&!P.ctrlKey&&!P.altKey&&!P.metaKey&&P.key.length===1&&P.key.charCodeAt(0)>=65&&P.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(N.key!==I.C0.ETX&&N.key!==I.C0.CR||(this.textarea.value=""),this._onKey.fire({key:N.key,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(N.key,!0),!this.optionsService.rawOptions.screenReaderMode||P.altKey||P.ctrlKey?this.cancel(P,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(P,L){const N=P.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||P.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||P.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?N:N&&(!L.keyCode||L.keyCode>47)}_keyUp(P){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1||((function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18})(P)||this.focus(),this.updateCursorStyle(P),this._keyPressHandled=!1)}_keyPress(P){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(P)===!1)return!1;if(this.cancel(P),P.charCode)L=P.charCode;else if(P.which===null||P.which===void 0)L=P.keyCode;else{if(P.which===0||P.charCode===0)return!1;L=P.which}return!(!L||(P.altKey||P.ctrlKey||P.metaKey)&&!this._isThirdLevelShift(this.browser,P)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:P}),this._showCursor(),this.coreService.triggerDataEvent(L,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(P){if(P.data&&P.inputType==="insertText"&&(!P.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const L=P.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(P),!0}return!1}resize(P,L){P!==this.cols||L!==this.rows?super.resize(P,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(P,L){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let P=1;P<this.rows;P++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const P=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=P,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(I.C0.ESC+"[I"):this.coreService.triggerDataEvent(I.C0.ESC+"[O")}_reportWindowsOptions(P){if(this._renderService)switch(P){case D.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const L=this._renderService.dimensions.css.canvas.width.toFixed(0),N=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[4;${N};${L}t`);break;case D.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const A=this._renderService.dimensions.css.cell.width.toFixed(0),W=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${I.C0.ESC}[6;${W};${A}t`)}}cancel(P,L){if(this.options.cancelEvents||L)return P.preventDefault(),P.stopPropagation(),!1}}t.Terminal=K},9924:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(a,h=1e3){this._renderCallback=a,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,h,l){this._rowCount=l,a=a!==void 0?a:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const c=s-this._lastRefreshMs,f=this._debounceThresholdMS-c;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),f)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,h)}}},1680:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,_){var p,u=arguments.length,m=u<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,n,_);else for(var d=r.length-1;d>=0;d--)(p=r[d])&&(m=(u<3?p(m):u>3?p(i,n,m):p(i,n))||m);return u>3&&m&&Object.defineProperty(i,n,m),m},l=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const s=a(3656),c=a(4725),f=a(8460),g=a(844),o=a(2585);let e=t.Viewport=class extends g.Disposable{constructor(r,i,n,_,p,u,m,d){super(),this._viewportElement=r,this._scrollArea=i,this._bufferService=n,this._optionsService=_,this._charSizeService=p,this._renderService=u,this._coreBrowserService=m,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,s.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((v=>this._activeBuffer=v.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((v=>this._renderDimensions=v))),this._handleThemeChange(d.colors),this.register(d.onChangeColors((v=>this._handleThemeChange(v)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(r){this._viewportElement.style.backgroundColor=r.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(r){if(r)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const i=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==i&&(this._lastRecordedBufferHeight=i,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const r=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==r&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=r),this._refreshAnimationFrame=null}syncScrollArea(r=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(r)}_handleScroll(r){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const i=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const r=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(r*(this._smoothScrollState.target-this._smoothScrollState.origin)),r<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(r,i){const n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(i<0&&this._viewportElement.scrollTop!==0||i>0&&n<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)}handleWheel(r){const i=this._getPixelsScrolled(r);return i!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+i:this._smoothScrollState.target+=i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}scrollLines(r){if(r!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const i=r*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+i,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!1})}_getPixelsScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?i*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._currentRowHeight*this._bufferService.rows),i}getBufferElements(r,i){let n,_="";const p=[],u=i??this._bufferService.buffer.lines.length,m=this._bufferService.buffer.lines;for(let d=r;d<u;d++){const v=m.get(d);if(!v)continue;const S=m.get(d+1)?.isWrapped;if(_+=v.translateToString(!S),!S||d===m.length-1){const y=document.createElement("div");y.textContent=_,p.push(y),_.length>0&&(n=y),_=""}}return{bufferElements:p,cursorElement:n}}getLinesScrolled(r){if(r.deltaY===0||r.shiftKey)return 0;let i=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=this._currentRowHeight+0,this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(r,i){const n=this._optionsService.rawOptions.fastScrollModifier;return n==="alt"&&i.altKey||n==="ctrl"&&i.ctrlKey||n==="shift"&&i.shiftKey?r*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:r*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(r){this._lastTouchY=r.touches[0].pageY}handleTouchMove(r){const i=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,i!==0&&(this._viewportElement.scrollTop+=i,this._bubbleScroll(r,i))}};t.Viewport=e=h([l(2,o.IBufferService),l(3,o.IOptionsService),l(4,c.ICharSizeService),l(5,c.IRenderService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],e)},3107:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,p=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(o,e,r,i);else for(var u=o.length-1;u>=0;u--)(n=o[u])&&(p=(_<3?n(p):_>3?n(e,r,p):n(e,r))||p);return _>3&&p&&Object.defineProperty(e,r,p),p},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const s=a(4725),c=a(844),f=a(2585);let g=t.BufferDecorationRenderer=class extends c.Disposable{constructor(o,e,r,i,n){super(),this._screenElement=o,this._bufferService=e,this._coreBrowserService=r,this._decorationService=i,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((_=>this._removeDecoration(_)))),this.register((0,c.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const o of this._decorationService.decorations)this._renderDecoration(o);this._dimensionsChanged=!1}_renderDecoration(o){this._refreshStyle(o),this._dimensionsChanged&&this._refreshXPosition(o)}_createElement(o){const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",o?.options?.layer==="top"),e.style.width=`${Math.round((o.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(o.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(o.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const r=o.options.x??0;return r&&r>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(o,e),e}_refreshStyle(o){const e=o.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)o.element&&(o.element.style.display="none",o.onRenderEmitter.fire(o.element));else{let r=this._decorationElements.get(o);r||(r=this._createElement(o),o.element=r,this._decorationElements.set(o,r),this._container.appendChild(r),o.onDispose((()=>{this._decorationElements.delete(o),r.remove()}))),r.style.top=e*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",o.onRenderEmitter.fire(r)}}_refreshXPosition(o,e=o.element){if(!e)return;const r=o.options.x??0;(o.options.anchor||"left")==="right"?e.style.right=r?r*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=r?r*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(o){this._decorationElements.get(o)?.remove(),this._decorationElements.delete(o),o.dispose()}};t.BufferDecorationRenderer=g=h([l(1,f.IBufferService),l(2,s.ICoreBrowserService),l(3,f.IDecorationService),l(4,s.IRenderService)],g)},5871:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const h of this._zones)if(h.color===a.options.overviewRulerOptions.color&&h.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,a.marker.line))return;if(this._lineAdjacentToZone(h,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(h,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,h){return h>=a.startBufferLine&&h<=a.endBufferLine}_lineAdjacentToZone(a,h,l){return h>=a.startBufferLine-this._linePadding[l||"full"]&&h<=a.endBufferLine+this._linePadding[l||"full"]}_addLineToZone(a,h){a.startBufferLine=Math.min(a.startBufferLine,h),a.endBufferLine=Math.max(a.endBufferLine,h)}}},5744:function(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.OverviewRulerRenderer=void 0;const s=a(5871),c=a(4725),f=a(844),g=a(2585),o={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0};let i=t.OverviewRulerRenderer=class extends f.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(n,_,p,u,m,d,v){super(),this._viewportElement=n,this._screenElement=_,this._bufferService=p,this._decorationService=u,this._renderService=m,this._optionsService=d,this._coreBrowserService=v,this._colorZoneStore=new s.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const S=this._canvas.getContext("2d");if(!S)throw new Error("Ctx cannot be null");this._ctx=S,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,f.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const n=Math.floor(this._canvas.width/3),_=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=n,e.center=_,e.right=n,this._refreshDrawHeightConstants(),r.full=0,r.left=0,r.center=e.left,r.right=e.left+e.center}_refreshDrawHeightConstants(){o.full=Math.round(2*this._coreBrowserService.dpr);const n=this._canvas.height/this._bufferService.buffer.lines.length,_=Math.round(Math.max(Math.min(n,12),6)*this._coreBrowserService.dpr);o.left=_,o.center=_,o.right=_}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*o.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const _ of this._decorationService.decorations)this._colorZoneStore.addDecoration(_);this._ctx.lineWidth=1;const n=this._colorZoneStore.zones;for(const _ of n)_.position!=="full"&&this._renderColorZone(_);for(const _ of n)_.position==="full"&&this._renderColorZone(_);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(n){this._ctx.fillStyle=n.color,this._ctx.fillRect(r[n.position||"full"],Math.round((this._canvas.height-1)*(n.startBufferLine/this._bufferService.buffers.active.lines.length)-o[n.position||"full"]/2),e[n.position||"full"],Math.round((this._canvas.height-1)*((n.endBufferLine-n.startBufferLine)/this._bufferService.buffers.active.lines.length)+o[n.position||"full"]))}_queueRefresh(n,_){this._shouldUpdateDimensions=n||this._shouldUpdateDimensions,this._shouldUpdateAnchor=_||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=i=h([l(2,g.IBufferService),l(3,g.IDecorationService),l(4,c.IRenderService),l(5,g.IOptionsService),l(6,c.ICoreBrowserService)],i)},2950:function(M,t,a){var h=this&&this.__decorate||function(o,e,r,i){var n,_=arguments.length,p=_<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(o,e,r,i);else for(var u=o.length-1;u>=0;u--)(n=o[u])&&(p=(_<3?n(p):_>3?n(e,r,p):n(e,r))||p);return _>3&&p&&Object.defineProperty(e,r,p),p},l=this&&this.__param||function(o,e){return function(r,i){e(r,i,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const s=a(4725),c=a(2585),f=a(2584);let g=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(o,e,r,i,n,_){this._textarea=o,this._compositionView=e,this._bufferService=r,this._optionsService=i,this._coreService=n,this._renderService=_,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(o){this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(o){if(this._compositionView.classList.remove("active"),this._isComposing=!1,o){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let r;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,r=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const o=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,r=e.replace(o,"");this._dataAlreadySent=r,e.length>o.length?this._coreService.triggerDataEvent(r,!0):e.length<o.length?this._coreService.triggerDataEvent(`${f.C0.DEL}`,!0):e.length===o.length&&e!==o&&this._coreService.triggerDataEvent(e,!0)}}),0)}updateCompositionElements(o){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const _=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(_.width,1)+"px",this._textarea.style.height=Math.max(_.height,1)+"px",this._textarea.style.lineHeight=_.height+"px"}o||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=g=h([l(2,c.IBufferService),l(3,c.IOptionsService),l(4,c.ICoreService),l(5,s.IRenderService)],g)},9806:(M,t)=>{function a(h,l,s){const c=s.getBoundingClientRect(),f=h.getComputedStyle(s),g=parseInt(f.getPropertyValue("padding-left")),o=parseInt(f.getPropertyValue("padding-top"));return[l.clientX-c.left-g,l.clientY-c.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=a,t.getCoords=function(h,l,s,c,f,g,o,e,r){if(!g)return;const i=a(h,l,s);return i?(i[0]=Math.ceil((i[0]+(r?o/2:0))/o),i[1]=Math.ceil(i[1]/e),i[0]=Math.min(Math.max(i[0],1),c+(r?1:0)),i[1]=Math.min(Math.max(i[1],1),f),i):void 0}},9504:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const h=a(2584);function l(e,r,i,n){const _=e-s(e,i),p=r-s(r,i),u=Math.abs(_-p)-(function(m,d,v){let S=0;const y=m-s(m,v),b=d-s(d,v);for(let w=0;w<Math.abs(y-b);w++){const x=c(m,d)==="A"?-1:1;v.buffer.lines.get(y+x*w)?.isWrapped&&S++}return S})(e,r,i);return o(u,g(c(e,r),n))}function s(e,r){let i=0,n=r.buffer.lines.get(e),_=n?.isWrapped;for(;_&&e>=0&&e<r.rows;)i++,n=r.buffer.lines.get(--e),_=n?.isWrapped;return i}function c(e,r){return e>r?"A":"B"}function f(e,r,i,n,_,p){let u=e,m=r,d="";for(;u!==i||m!==n;)u+=_?1:-1,_&&u>p.cols-1?(d+=p.buffer.translateBufferLineToString(m,!1,e,u),u=0,e=0,m++):!_&&u<0&&(d+=p.buffer.translateBufferLineToString(m,!1,0,e+1),u=p.cols-1,e=u,m--);return d+p.buffer.translateBufferLineToString(m,!1,e,u)}function g(e,r){const i=r?"O":"[";return h.C0.ESC+i+e}function o(e,r){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=r;return i}t.moveToCellSequence=function(e,r,i,n){const _=i.buffer.x,p=i.buffer.y;if(!i.buffer.hasScrollback)return(function(d,v,S,y,b,w){return l(v,y,b,w).length===0?"":o(f(d,v,d,v-s(v,b),!1,b).length,g("D",w))})(_,p,0,r,i,n)+l(p,r,i,n)+(function(d,v,S,y,b,w){let x;x=l(v,y,b,w).length>0?y-s(y,b):v;const B=y,F=(function(I,O,C,E,T,D){let U;return U=l(C,E,T,D).length>0?E-s(E,T):O,I<C&&U<=E||I>=C&&U<E?"C":"D"})(d,v,S,y,b,w);return o(f(d,x,S,B,F==="C",b).length,g(F,w))})(_,p,e,r,i,n);let u;if(p===r)return u=_>e?"D":"C",o(Math.abs(_-e),g(u,n));u=p>r?"D":"C";const m=Math.abs(p-r);return o((function(d,v){return v.cols-d})(p>r?e:_,i)+(m-1)*i.cols+1+((p>r?_:e)-1),g(u,n))}},1296:function(M,t,a){var h=this&&this.__decorate||function(w,x,B,F){var I,O=arguments.length,C=O<3?x:F===null?F=Object.getOwnPropertyDescriptor(x,B):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(w,x,B,F);else for(var E=w.length-1;E>=0;E--)(I=w[E])&&(C=(O<3?I(C):O>3?I(x,B,C):I(x,B))||C);return O>3&&C&&Object.defineProperty(x,B,C),C},l=this&&this.__param||function(w,x){return function(B,F){x(B,F,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const s=a(3787),c=a(2550),f=a(2223),g=a(6171),o=a(6052),e=a(4725),r=a(8055),i=a(8460),n=a(844),_=a(2585),p="xterm-dom-renderer-owner-",u="xterm-rows",m="xterm-fg-",d="xterm-bg-",v="xterm-focus",S="xterm-selection";let y=1,b=t.DomRenderer=class extends n.Disposable{constructor(w,x,B,F,I,O,C,E,T,D,U,$,K){super(),this._terminal=w,this._document=x,this._element=B,this._screenElement=F,this._viewportElement=I,this._helperContainer=O,this._linkifier2=C,this._charSizeService=T,this._optionsService=D,this._bufferService=U,this._coreBrowserService=$,this._themeService=K,this._terminalClass=y++,this._rowElements=[],this._selectionRenderModel=(0,o.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new i.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(u),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(S),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((X=>this._injectCss(X)))),this._injectCss(this._themeService.colors),this._rowFactory=E.createInstance(s.DomRendererRowFactory,document),this._element.classList.add(p+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((X=>this._handleLinkHover(X)))),this.register(this._linkifier2.onHideLinkUnderline((X=>this._handleLinkLeave(X)))),this.register((0,n.toDisposable)((()=>{this._element.classList.remove(p+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new c.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const w=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*w,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*w),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/w),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/w),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const B of this._rowElements)B.style.width=`${this.dimensions.css.canvas.width}px`,B.style.height=`${this.dimensions.css.cell.height}px`,B.style.lineHeight=`${this.dimensions.css.cell.height}px`,B.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const x=`${this._terminalSelector} .${u} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=x,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(w){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let x=`${this._terminalSelector} .${u} { color: ${w.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;x+=`${this._terminalSelector} .${u} .xterm-dim { color: ${r.color.multiplyOpacity(w.foreground,.5).css};}`,x+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const B=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,I=`blink_block_${this._terminalClass}`;x+=`@keyframes ${B} { 50% { border-bottom-style: hidden; }}`,x+=`@keyframes ${F} { 50% { box-shadow: none; }}`,x+=`@keyframes ${I} { 0% { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css}; } 50% { background-color: inherit; color: ${w.cursor.css}; }}`,x+=`${this._terminalSelector} .${u}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${u}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${u}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block { background-color: ${w.cursor.css}; color: ${w.cursorAccent.css};}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${w.cursor.css} !important; color: ${w.cursorAccent.css} !important;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${w.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${w.cursor.css} inset;}${this._terminalSelector} .${u} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${w.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,x+=`${this._terminalSelector} .${S} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${S} div { position: absolute; background-color: ${w.selectionBackgroundOpaque.css};}${this._terminalSelector} .${S} div { position: absolute; background-color: ${w.selectionInactiveBackgroundOpaque.css};}`;for(const[O,C]of w.ansi.entries())x+=`${this._terminalSelector} .${m}${O} { color: ${C.css}; }${this._terminalSelector} .${m}${O}.xterm-dim { color: ${r.color.multiplyOpacity(C,.5).css}; }${this._terminalSelector} .${d}${O} { background-color: ${C.css}; }`;x+=`${this._terminalSelector} .${m}${f.INVERTED_DEFAULT_COLOR} { color: ${r.color.opaque(w.background).css}; }${this._terminalSelector} .${m}${f.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${r.color.multiplyOpacity(r.color.opaque(w.background),.5).css}; }${this._terminalSelector} .${d}${f.INVERTED_DEFAULT_COLOR} { background-color: ${w.foreground.css}; }`,this._themeStyleElement.textContent=x}_setDefaultSpacing(){const w=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${w}px`,this._rowFactory.defaultSpacing=w}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(w,x){for(let B=this._rowElements.length;B<=x;B++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(w,x){this._refreshRowElements(w,x),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(v),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(v),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(w,x,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(w,x,B),this.renderRows(0,this._bufferService.rows-1),!w||!x)return;this._selectionRenderModel.update(this._terminal,w,x,B);const F=this._selectionRenderModel.viewportStartRow,I=this._selectionRenderModel.viewportEndRow,O=this._selectionRenderModel.viewportCappedStartRow,C=this._selectionRenderModel.viewportCappedEndRow;if(O>=this._bufferService.rows||C<0)return;const E=this._document.createDocumentFragment();if(B){const T=w[0]>x[0];E.appendChild(this._createSelectionElement(O,T?x[0]:w[0],T?w[0]:x[0],C-O+1))}else{const T=F===O?w[0]:0,D=O===I?x[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(O,T,D));const U=C-O-1;if(E.appendChild(this._createSelectionElement(O+1,0,this._bufferService.cols,U)),O!==C){const $=I===C?x[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(C,0,$))}}this._selectionContainer.appendChild(E)}_createSelectionElement(w,x,B,F=1){const I=this._document.createElement("div"),O=x*this.dimensions.css.cell.width;let C=this.dimensions.css.cell.width*(B-x);return O+C>this.dimensions.css.canvas.width&&(C=this.dimensions.css.canvas.width-O),I.style.height=F*this.dimensions.css.cell.height+"px",I.style.top=w*this.dimensions.css.cell.height+"px",I.style.left=`${O}px`,I.style.width=`${C}px`,I}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const w of this._rowElements)w.replaceChildren()}renderRows(w,x){const B=this._bufferService.buffer,F=B.ybase+B.y,I=Math.min(B.x,this._bufferService.cols-1),O=this._optionsService.rawOptions.cursorBlink,C=this._optionsService.rawOptions.cursorStyle,E=this._optionsService.rawOptions.cursorInactiveStyle;for(let T=w;T<=x;T++){const D=T+B.ydisp,U=this._rowElements[T],$=B.lines.get(D);if(!U||!$)break;U.replaceChildren(...this._rowFactory.createRow($,D,D===F,C,E,I,O,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${p}${this._terminalClass}`}_handleLinkHover(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!0)}_handleLinkLeave(w){this._setCellUnderline(w.x1,w.x2,w.y1,w.y2,w.cols,!1)}_setCellUnderline(w,x,B,F,I,O){B<0&&(w=0),F<0&&(x=0);const C=this._bufferService.rows-1;B=Math.max(Math.min(B,C),0),F=Math.max(Math.min(F,C),0),I=Math.min(I,this._bufferService.cols);const E=this._bufferService.buffer,T=E.ybase+E.y,D=Math.min(E.x,I-1),U=this._optionsService.rawOptions.cursorBlink,$=this._optionsService.rawOptions.cursorStyle,K=this._optionsService.rawOptions.cursorInactiveStyle;for(let X=B;X<=F;++X){const P=X+E.ydisp,L=this._rowElements[X],N=E.lines.get(P);if(!L||!N)break;L.replaceChildren(...this._rowFactory.createRow(N,P,P===T,$,K,D,U,this.dimensions.css.cell.width,this._widthCache,O?X===B?w:0:-1,O?(X===F?x:I)-1:-1))}}};t.DomRenderer=b=h([l(7,_.IInstantiationService),l(8,e.ICharSizeService),l(9,_.IOptionsService),l(10,_.IBufferService),l(11,e.ICoreBrowserService),l(12,e.IThemeService)],b)},3787:function(M,t,a){var h=this&&this.__decorate||function(u,m,d,v){var S,y=arguments.length,b=y<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,d):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(u,m,d,v);else for(var w=u.length-1;w>=0;w--)(S=u[w])&&(b=(y<3?S(b):y>3?S(m,d,b):S(m,d))||b);return y>3&&b&&Object.defineProperty(m,d,b),b},l=this&&this.__param||function(u,m){return function(d,v){m(d,v,u)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const s=a(2223),c=a(643),f=a(511),g=a(2585),o=a(8055),e=a(4725),r=a(4269),i=a(6171),n=a(3734);let _=t.DomRendererRowFactory=class{constructor(u,m,d,v,S,y,b){this._document=u,this._characterJoinerService=m,this._optionsService=d,this._coreBrowserService=v,this._coreService=S,this._decorationService=y,this._themeService=b,this._workCell=new f.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(u,m,d){this._selectionStart=u,this._selectionEnd=m,this._columnSelectMode=d}createRow(u,m,d,v,S,y,b,w,x,B,F){const I=[],O=this._characterJoinerService.getJoinedCharacters(m),C=this._themeService.colors;let E,T=u.getNoBgTrimmedLength();d&&T<y+1&&(T=y+1);let D=0,U="",$=0,K=0,X=0,P=!1,L=0,N=!1,A=0;const W=[],V=B!==-1&&F!==-1;for(let ee=0;ee<T;ee++){u.loadCell(ee,this._workCell);let G=this._workCell.getWidth();if(G===0)continue;let te=!1,ae=ee,Q=this._workCell;if(O.length>0&&ee===O[0][0]){te=!0;const ie=O.shift();Q=new r.JoinedCellData(this._workCell,u.translateToString(!0,ie[0],ie[1]),ie[1]-ie[0]),ae=ie[1]-1,G=Q.getWidth()}const ge=this._isCellInSelection(ee,m),Se=d&&ee===y,oe=V&&ee>=B&&ee<=F;let se=!1;this._decorationService.forEachDecorationAtCell(ee,m,void 0,(ie=>{se=!0}));let re=Q.getChars()||c.WHITESPACE_CELL_CHAR;if(re===" "&&(Q.isUnderline()||Q.isOverline())&&(re=" "),A=G*w-x.get(re,Q.isBold(),Q.isItalic()),E){if(D&&(ge&&N||!ge&&!N&&Q.bg===$)&&(ge&&N&&C.selectionForeground||Q.fg===K)&&Q.extended.ext===X&&oe===P&&A===L&&!Se&&!te&&!se){Q.isInvisible()?U+=c.WHITESPACE_CELL_CHAR:U+=re,D++;continue}D&&(E.textContent=U),E=this._document.createElement("span"),D=0,U=""}else E=this._document.createElement("span");if($=Q.bg,K=Q.fg,X=Q.extended.ext,P=oe,L=A,N=ge,te&&y>=ee&&y<=ae&&(y=ee),!this._coreService.isCursorHidden&&Se&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)b&&W.push("xterm-cursor-blink"),W.push(v==="bar"?"xterm-cursor-bar":v==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(S)switch(S){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline")}}if(Q.isBold()&&W.push("xterm-bold"),Q.isItalic()&&W.push("xterm-italic"),Q.isDim()&&W.push("xterm-dim"),U=Q.isInvisible()?c.WHITESPACE_CELL_CHAR:Q.getChars()||c.WHITESPACE_CELL_CHAR,Q.isUnderline()&&(W.push(`xterm-underline-${Q.extended.underlineStyle}`),U===" "&&(U=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${n.AttributeData.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let ie=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&ie<8&&(ie+=8),E.style.textDecorationColor=C.ansi[ie].css}Q.isOverline()&&(W.push("xterm-overline"),U===" "&&(U=" ")),Q.isStrikethrough()&&W.push("xterm-strikethrough"),oe&&(E.style.textDecoration="underline");let Z=Q.getFgColor(),ne=Q.getFgColorMode(),ce=Q.getBgColor(),le=Q.getBgColorMode();const ve=!!Q.isInverse();if(ve){const ie=Z;Z=ce,ce=ie;const be=ne;ne=le,le=be}let de,_e,ue,he=!1;switch(this._decorationService.forEachDecorationAtCell(ee,m,void 0,(ie=>{ie.options.layer!=="top"&&he||(ie.backgroundColorRGB&&(le=50331648,ce=ie.backgroundColorRGB.rgba>>8&16777215,de=ie.backgroundColorRGB),ie.foregroundColorRGB&&(ne=50331648,Z=ie.foregroundColorRGB.rgba>>8&16777215,_e=ie.foregroundColorRGB),he=ie.options.layer==="top")})),!he&&ge&&(de=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ce=de.rgba>>8&16777215,le=50331648,he=!0,C.selectionForeground&&(ne=50331648,Z=C.selectionForeground.rgba>>8&16777215,_e=C.selectionForeground)),he&&W.push("xterm-decoration-top"),le){case 16777216:case 33554432:ue=C.ansi[ce],W.push(`xterm-bg-${ce}`);break;case 50331648:ue=o.channels.toColor(ce>>16,ce>>8&255,255&ce),this._addStyle(E,`background-color:#${p((ce>>>0).toString(16),"0",6)}`);break;default:ve?(ue=C.foreground,W.push(`xterm-bg-${s.INVERTED_DEFAULT_COLOR}`)):ue=C.background}switch(de||Q.isDim()&&(de=o.color.multiplyOpacity(ue,.5)),ne){case 16777216:case 33554432:Q.isBold()&&Z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Z+=8),this._applyMinimumContrast(E,ue,C.ansi[Z],Q,de,void 0)||W.push(`xterm-fg-${Z}`);break;case 50331648:const ie=o.channels.toColor(Z>>16&255,Z>>8&255,255&Z);this._applyMinimumContrast(E,ue,ie,Q,de,_e)||this._addStyle(E,`color:#${p(Z.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ue,C.foreground,Q,de,_e)||ve&&W.push(`xterm-fg-${s.INVERTED_DEFAULT_COLOR}`)}W.length&&(E.className=W.join(" "),W.length=0),Se||te||se?E.textContent=U:D++,A!==this.defaultSpacing&&(E.style.letterSpacing=`${A}px`),I.push(E),ee=ae}return E&&D&&(E.textContent=U),I}_applyMinimumContrast(u,m,d,v,S,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,i.treatGlyphAsBackgroundColor)(v.getCode()))return!1;const b=this._getContrastCache(v);let w;if(S||y||(w=b.getColor(m.rgba,d.rgba)),w===void 0){const x=this._optionsService.rawOptions.minimumContrastRatio/(v.isDim()?2:1);w=o.color.ensureContrastRatio(S||m,y||d,x),b.setColor((S||m).rgba,(y||d).rgba,w??null)}return!!w&&(this._addStyle(u,`color:${w.css}`),!0)}_getContrastCache(u){return u.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(u,m){u.setAttribute("style",`${u.getAttribute("style")||""}${m};`)}_isCellInSelection(u,m){const d=this._selectionStart,v=this._selectionEnd;return!(!d||!v)&&(this._columnSelectMode?d[0]<=v[0]?u>=d[0]&&m>=d[1]&&u<v[0]&&m<=v[1]:u<d[0]&&m>=d[1]&&u>=v[0]&&m<=v[1]:m>d[1]&&m<v[1]||d[1]===v[1]&&m===d[1]&&u>=d[0]&&u<v[0]||d[1]<v[1]&&m===v[1]&&u<v[0]||d[1]<v[1]&&m===d[1]&&u>=d[0])}};function p(u,m,d){for(;u.length<d;)u=m+u;return u}t.DomRendererRowFactory=_=h([l(1,e.ICharacterJoinerService),l(2,g.IOptionsService),l(3,e.ICoreBrowserService),l(4,g.ICoreService),l(5,g.IDecorationService),l(6,e.IThemeService)],_)},2550:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(a,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const l=a.createElement("span");l.classList.add("xterm-char-measure-element");const s=a.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";const c=a.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontStyle="italic";const f=a.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold",f.style.fontStyle="italic",this._measureElements=[l,s,c,f],this._container.appendChild(l),this._container.appendChild(s),this._container.appendChild(c),this._container.appendChild(f),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(a,h,l,s){a===this._font&&h===this._fontSize&&l===this._weight&&s===this._weightBold||(this._font=a,this._fontSize=h,this._weight=l,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${l}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${l}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(a,h,l){let s=0;if(!h&&!l&&a.length===1&&(s=a.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];const g=this._measure(a,0);return g>0&&(this._flat[s]=g),g}let c=a;h&&(c+="B"),l&&(c+="I");let f=this._holey.get(c);if(f===void 0){let g=0;h&&(g|=1),l&&(g|=2),f=this._measure(a,g),f>0&&this._holey.set(c,f)}return f}_measure(a,h){const l=this._measureElements[h];return l.textContent=a.repeat(32),l.offsetWidth/32}}},2223:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const h=a(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(M,t)=>{function a(l){return 57508<=l&&l<=57558}function h(l){return l>=128512&&l<=128591||l>=127744&&l<=128511||l>=128640&&l<=128767||l>=9728&&l<=9983||l>=9984&&l<=10175||l>=65024&&l<=65039||l>=129280&&l<=129535||l>=127462&&l<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(l){if(!l)throw new Error("value must not be falsy");return l},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(l){return 57520<=l&&l<=57527},t.isEmoji=h,t.allowRescaling=function(l,s,c,f){return s===1&&c>Math.ceil(1.5*f)&&l!==void 0&&l>255&&!h(l)&&!a(l)&&!(function(g){return 57344<=g&&g<=63743})(l)},t.treatGlyphAsBackgroundColor=function(l){return a(l)||(function(s){return 9472<=s&&s<=9631})(l)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(l,s,c=0){return(l-(2*Math.round(s)-c))%(2*Math.round(s))}},6052:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(l,s,c,f=!1){if(this.selectionStart=s,this.selectionEnd=c,!s||!c||s[0]===c[0]&&s[1]===c[1])return void this.clear();const g=l.buffers.active.ydisp,o=s[1]-g,e=c[1]-g,r=Math.max(o,0),i=Math.min(e,l.rows-1);r>=l.rows||i<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=f,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=r,this.viewportCappedEndRow=i,this.startCol=s[0],this.endCol=c[0])}isCellSelected(l,s,c){return!!this.hasSelection&&(c-=l.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?s>=this.startCol&&c>=this.viewportCappedStartRow&&s<this.endCol&&c<=this.viewportCappedEndRow:s<this.startCol&&c>=this.viewportCappedStartRow&&s>=this.endCol&&c<=this.viewportCappedEndRow:c>this.viewportStartRow&&c<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportEndRow&&s<this.endCol||this.viewportStartRow<this.viewportEndRow&&c===this.viewportStartRow&&s>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},456:(M,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,h=this.selectionEnd;return!(!a||!h)&&(a[1]>h[1]||a[1]===h[1]&&a[0]>h[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(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.CharSizeService=void 0;const s=a(2585),c=a(8460),f=a(844);let g=t.CharSizeService=class extends f.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(i,n,_){super(),this._optionsService=_,this.width=0,this.height=0,this._onCharSizeChange=this.register(new c.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new r(this._optionsService))}catch{this._measureStrategy=this.register(new e(i,n,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};t.CharSizeService=g=h([l(2,s.IOptionsService)],g);class o extends f.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(n,_){n!==void 0&&n>0&&_!==void 0&&_>0&&(this._result.width=n,this._result.height=_)}}class e extends o{constructor(n,_,p){super(),this._document=n,this._parentElement=_,this._optionsService=p,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class r extends o{constructor(n){super(),this._optionsService=n,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const _=this._ctx.measureText("W");if(!("width"in _&&"fontBoundingBoxAscent"in _&&"fontBoundingBoxDescent"in _))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const n=this._ctx.measureText("W");return this._validateAndSet(n.width,n.fontBoundingBoxAscent+n.fontBoundingBoxDescent),this._result}}},4269:function(M,t,a){var h=this&&this.__decorate||function(r,i,n,_){var p,u=arguments.length,m=u<3?i:_===null?_=Object.getOwnPropertyDescriptor(i,n):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(r,i,n,_);else for(var d=r.length-1;d>=0;d--)(p=r[d])&&(m=(u<3?p(m):u>3?p(i,n,m):p(i,n))||m);return u>3&&m&&Object.defineProperty(i,n,m),m},l=this&&this.__param||function(r,i){return function(n,_){i(n,_,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const s=a(3734),c=a(643),f=a(511),g=a(2585);class o extends s.AttributeData{constructor(i,n,_){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=n,this._width=_}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=o;let e=t.CharacterJoinerService=class ht{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new f.CellData}register(i){const n={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(n),n.id}deregister(i){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===i)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];const n=this._bufferService.buffer.lines.get(i);if(!n||n.length===0)return[];const _=[],p=n.translateToString(!0);let u=0,m=0,d=0,v=n.getFg(0),S=n.getBg(0);for(let y=0;y<n.getTrimmedLength();y++)if(n.loadCell(y,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==v||this._workCell.bg!==S){if(y-u>1){const b=this._getJoinedRanges(p,d,m,n,u);for(let w=0;w<b.length;w++)_.push(b[w])}u=y,d=m,v=this._workCell.fg,S=this._workCell.bg}m+=this._workCell.getChars().length||c.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-u>1){const y=this._getJoinedRanges(p,d,m,n,u);for(let b=0;b<y.length;b++)_.push(y[b])}return _}_getJoinedRanges(i,n,_,p,u){const m=i.substring(n,_);let d=[];try{d=this._characterJoiners[0].handler(m)}catch(v){console.error(v)}for(let v=1;v<this._characterJoiners.length;v++)try{const S=this._characterJoiners[v].handler(m);for(let y=0;y<S.length;y++)ht._mergeRanges(d,S[y])}catch(S){console.error(S)}return this._stringRangesToCellRanges(d,p,u),d}_stringRangesToCellRanges(i,n,_){let p=0,u=!1,m=0,d=i[p];if(d){for(let v=_;v<this._bufferService.cols;v++){const S=n.getWidth(v),y=n.getString(v).length||c.WHITESPACE_CELL_CHAR.length;if(S!==0){if(!u&&d[0]<=m&&(d[0]=v,u=!0),d[1]<=m){if(d[1]=v,d=i[++p],!d)break;d[0]<=m?(d[0]=v,u=!0):u=!1}m+=y}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(i,n){let _=!1;for(let p=0;p<i.length;p++){const u=i[p];if(_){if(n[1]<=u[0])return i[p-1][1]=n[1],i;if(n[1]<=u[1])return i[p-1][1]=Math.max(n[1],u[1]),i.splice(p,1),i;i.splice(p,1),p--}else{if(n[1]<=u[0])return i.splice(p,0,n),i;if(n[1]<=u[1])return u[0]=Math.min(n[0],u[0]),i;n[0]<u[1]&&(u[0]=Math.min(n[0],u[0]),_=!0)}}return _?i[i.length-1][1]=n[1]:i.push(n),i}};t.CharacterJoinerService=e=h([l(0,g.IBufferService)],e)},5114:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const h=a(844),l=a(8460),s=a(3656);class c extends h.Disposable{constructor(o,e,r){super(),this._textarea=o,this._window=e,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new f(this._window),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new l.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((i=>this._screenDprMonitor.setWindow(i)))),this.register((0,l.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(o){this._window!==o&&(this._window=o,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=c;class f extends h.Disposable{constructor(o){super(),this._parentWindow=o,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new l.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)((()=>this.clearListener())))}setWindow(o){this._parentWindow=o,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,s.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(M,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const h=a(844);class l extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(c){return this.linkProviders.push(c),{dispose:()=>{const f=this.linkProviders.indexOf(c);f!==-1&&this.linkProviders.splice(f,1)}}}}t.LinkProviderService=l},8934:function(M,t,a){var h=this&&this.__decorate||function(g,o,e,r){var i,n=arguments.length,_=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(g,o,e,r);else for(var p=g.length-1;p>=0;p--)(i=g[p])&&(_=(n<3?i(_):n>3?i(o,e,_):i(o,e))||_);return n>3&&_&&Object.defineProperty(o,e,_),_},l=this&&this.__param||function(g,o){return function(e,r){o(e,r,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const s=a(4725),c=a(9806);let f=t.MouseService=class{constructor(g,o){this._renderService=g,this._charSizeService=o}getCoords(g,o,e,r,i){return(0,c.getCoords)(window,g,o,e,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(g,o){const e=(0,c.getCoordsRelativeToElement)(window,g,o);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};t.MouseService=f=h([l(0,s.IRenderService),l(1,s.ICharSizeService)],f)},3230: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.RenderService=void 0;const s=a(6193),c=a(4725),f=a(8460),g=a(844),o=a(7226),e=a(2585);let r=t.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(i,n,_,p,u,m,d,v){super(),this._rowCount=i,this._charSizeService=p,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new o.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new f.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new f.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new f.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new f.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new s.RenderDebouncer(((S,y)=>this._renderRows(S,y)),d),this.register(this._renderDebouncer),this.register(d.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(m.onResize((()=>this._fullRefresh()))),this.register(m.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(_.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(u.onDecorationRegistered((()=>this._fullRefresh()))),this.register(u.onDecorationRemoved((()=>this._fullRefresh()))),this.register(_.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(m.cols,m.rows),this._fullRefresh()}))),this.register(_.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(m.buffer.y,m.buffer.y,!0)))),this.register(v.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(d.window,n),this.register(d.onWindowChange((S=>this._registerIntersectionObserver(S,n))))}_registerIntersectionObserver(i,n){if("IntersectionObserver"in i){const _=new i.IntersectionObserver((p=>this._handleIntersectionChange(p[p.length-1])),{threshold:0});_.observe(n),this._observerDisposable.value=(0,g.toDisposable)((()=>_.disconnect()))}}_handleIntersectionChange(i){this._isPaused=i.isIntersecting===void 0?i.intersectionRatio===0:!i.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(i,n,_=!1){this._isPaused?this._needsFullRefresh=!0:(_||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,n,this._rowCount))}_renderRows(i,n){this._renderer.value&&(i=Math.min(i,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(i,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:i,end:n}),this._onRender.fire({start:i,end:n}),this._isNextRenderRedrawOnly=!0)}resize(i,n){this._rowCount=n,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(i){this._renderer.value=i,this._renderer.value&&(this._renderer.value.onRequestRedraw((n=>this.refreshRows(n.start,n.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(i){return this._renderDebouncer.addRefreshCallback(i)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(i,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(i,n))):this._renderer.value.handleResize(i,n),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(i,n,_){this._selectionState.start=i,this._selectionState.end=n,this._selectionState.columnSelectMode=_,this._renderer.value?.handleSelectionChanged(i,n,_)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=r=h([l(2,e.IOptionsService),l(3,c.ICharSizeService),l(4,e.IDecorationService),l(5,e.IBufferService),l(6,c.ICoreBrowserService),l(7,c.IThemeService)],r)},9312:function(M,t,a){var h=this&&this.__decorate||function(d,v,S,y){var b,w=arguments.length,x=w<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(d,v,S,y);else for(var B=d.length-1;B>=0;B--)(b=d[B])&&(x=(w<3?b(x):w>3?b(v,S,x):b(v,S))||x);return w>3&&x&&Object.defineProperty(v,S,x),x},l=this&&this.__param||function(d,v){return function(S,y){v(S,y,d)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const s=a(9806),c=a(9504),f=a(456),g=a(4725),o=a(8460),e=a(844),r=a(6114),i=a(4841),n=a(511),_=a(2585),p=" ",u=new RegExp(p,"g");let m=t.SelectionService=class extends e.Disposable{constructor(d,v,S,y,b,w,x,B,F){super(),this._element=d,this._screenElement=v,this._linkifier=S,this._bufferService=y,this._coreService=b,this._mouseService=w,this._optionsService=x,this._renderService=B,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new n.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new o.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new o.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new o.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=I=>this._handleMouseMove(I),this._mouseUpListener=I=>this._handleMouseUp(I),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((I=>this._handleTrim(I))),this.register(this._bufferService.buffers.onBufferActivate((I=>this._handleBufferActivate(I)))),this.enable(),this._model=new f.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const d=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;return!(!d||!v||d[0]===v[0]&&d[1]===v[1])}get selectionText(){const d=this._model.finalSelectionStart,v=this._model.finalSelectionEnd;if(!d||!v)return"";const S=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(d[0]===v[0])return"";const b=d[0]<v[0]?d[0]:v[0],w=d[0]<v[0]?v[0]:d[0];for(let x=d[1];x<=v[1];x++){const B=S.translateBufferLineToString(x,!0,b,w);y.push(B)}}else{const b=d[1]===v[1]?v[0]:void 0;y.push(S.translateBufferLineToString(d[1],!0,d[0],b));for(let w=d[1]+1;w<=v[1]-1;w++){const x=S.lines.get(w),B=S.translateBufferLineToString(w,!0);x?.isWrapped?y[y.length-1]+=B:y.push(B)}if(d[1]!==v[1]){const w=S.lines.get(v[1]),x=S.translateBufferLineToString(v[1],!0,0,v[0]);w&&w.isWrapped?y[y.length-1]+=x:y.push(x)}}return y.map((b=>b.replace(u," "))).join(r.isWindows?`\r
|
|
63
63
|
`:`
|
|
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
|
-
`,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&&(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=`
|
|
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,N)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:N.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,N,A)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:N,data:A})})),this._parser.setDcsHandlerFallback(((L,N,A)=>{N==="HOOK"&&(A=A.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:N,payload:A})})),this._parser.setPrintHandler(((L,N,A)=>this.print(L,N,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,N)=>this.requestStatusString(L,N))))}_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 N=L+y<C.length?L+y:C.length,A=typeof C=="string"?this._stringDecoder.decode(C.substring(L,N),this._parseBuffer):this._utf8Decoder.decode(C.subarray(L,N),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,N=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,N);let W=this._parser.precedingJoinState;for(let V=E;V<T;++V){if(D=C[V],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,N)}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,N)}else if(L&&(A.insertCells(this._activeBuffer.x,U-te,this._activeBuffer.getNullCell(N)),A.getWidth(X-1)===2&&A.setCellFromCodepoint(X-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,N)),A.setCellFromCodepoint(this._activeBuffer.x++,D,U,N),U>0)for(;--U;)A.setCellFromCodepoint(this._activeBuffer.x++,0,0,N)}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,N),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 N=$.codePointAt(L)||0;K[X++]=N,L+=N>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,N=this._optionsService.rawOptions,A=G=>G?1:2,W=C.params[0];return V=W,ee=E?W===2?4:W===4?A($.modes.insertMode):W===12?3:W===20?A(N.convertEol):0:W===1?A(T.applicationCursorKeys):W===3?N.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(N.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?"":"?"}${V};${ee}$y`),!0;var V,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
|
+
`,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}},H={};function j(M){var t=H[M];if(t!==void 0)return t.exports;var a=H[M]={exports:{}};return k[M].call(a.exports,a,a.exports,j),a.exports}var q={};return(()=>{var M=q;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})(),q})()))})(Ie)),Ie.exports}var Jt=Yt();const Zt=600,Qt=350,De=8,Ce=22,ei=40,Fe=12,pe=8,ti=50,Je=8,ii=48,si=.95,Ze=.02,Qe=5,ri=90;function ni(){return["Paste","Copy","Select All"]}function oi(){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 ai(z,R,k){return!k&&R-z<=Qt}function hi(z){let R=0;return{cancel:()=>{R++},schedule:k=>{const H=++R;queueMicrotask(()=>{H===R&&k()&&z()})}}}class li{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;onTap;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,H={}){this.terminal=R,this.terminalContent=k,this.originalPosition=k.style.position,this.terminalFocusScheduler=hi(()=>this.terminal.focus());const j=Number(H.minFontSize)||Je,q=Number(H.maxFontSize)||ii;this.minFontSize=Math.min(j,q),this.maxFontSize=Math.max(j,q),this.onFontSizeChange=H.onFontSizeChange??(M=>{this.terminal.options.fontSize=M,this.terminal.refresh(0,this.terminal.rows-1)}),this.onTouchScroll=H.onTouchScroll??null,this.onTouchScrollReset=H.onTouchScrollReset??(()=>{}),this.onTap=H.onTap??null,this.onTwoFingerTap=H.onTwoFingerTap??null,this.onPaste=H.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,H,j]=ni(),q=[{label:k,action:()=>{this.pasteFromClipboard()}},{label:H,action:()=>this.copySelection()},{label:j,action:()=>this.selectAllText()}];for(const M of q)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 H=!1;const j=M=>{M.preventDefault(),M.stopPropagation(),H=!1},q=M=>{M.preventDefault(),M.stopPropagation(),!H&&(H=!0,R.action())};return k.addEventListener("touchstart",j,{passive:!1}),k.addEventListener("touchend",q,{passive:!1}),k.addEventListener("mousedown",j),k.addEventListener("mouseup",q),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)},Zt)};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]),H=this.touchStart;if(this.pendingClearTouch){this.pendingClearTouch.moved=this.pendingClearTouch.moved||He(this.pendingClearTouch.point,k)>De;return}if(!H)return;const j=He(H,k)>De;if(j&&this.clearTapHoldTimeout(),this.isSelecting&&!this.isHandleDragging){R.preventDefault(),R.stopPropagation(),this.extendSelection(k);return}const q=this.lastScrollTouchY;this.recordScrollSample(k),j&&q!==null&&this.onTouchScroll?.(q-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 j=this.twoFingerTapCandidate,q=!!(j&&ai(j.timestamp,performance.now(),j.moved));this.endPinchZoom(),this.isFinishingPinch=R.touches.length>0,q&&j&&this.onTwoFingerTap&&(R.preventDefault(),this.blurTerminalInput(),this.onTwoFingerTap(j.center));return}const k=this.touchStart;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(),k&&this.onTap?this.onTap(k):this.scheduleTerminalFocus()),this.maybeStartInertia();return}const H=this.isSelecting&&!this.pendingClearTouch.moved&&!this.isHandleDragging;this.pendingClearTouch=null,H&&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]),H={clientX:k.clientX,clientY:k.clientY-ei},j=this.touchToTerminalCoords(H);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 H=this.getWordBoundsAt(k);this.selectionStart=H?.start??k,this.selectionEnd=H?.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(),H=this.calculateSelectionLength(R,k);H<=0||(this.terminal.select(R.col,R.row,H),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,H=this.contextMenu.offsetHeight||0,j=this.selectionStart&&this.selectionEnd?this.getOrderedSelection():null,q=j?this.terminalCoordsToPixels(j.start):null,M=j?this.terminalCoordsToPixels(j.end):null;let t,a;if(q||M){const s=Math.min(q?.y??M.y,M?.y??q.y);t=(q&&M?(q.x+M.x)/2:(q??M).x)-k/2,a=s-H-Fe,a<pe&&(a=Math.max(q?.y??M.y,M?.y??q.y)+this.cellDimensions.height+Ce+Fe)}else t=(R.width-k)/2,a=R.height-H-Fe;const h=R.width-k-pe,l=R.height-H-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]),H=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-H)>De);const j=Date.now();if(j-this.lastZoomTime<ti)return;this.lastZoomTime=j;const q=H/this.pinchStartDistance,M=me(Math.round(this.initialFontSize*q),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 H=k-this.lastScrollTouchTime;if(H>0){const j=(this.lastScrollTouchY-R.clientY)/H;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>ri||Math.abs(this.scrollVelocity)<Ze||this.startInertia(this.scrollVelocity)}startInertia(R){const k=this.getViewportElement();if(!k)return;this.cancelInertia();let H=me(R,-Qe,Qe),j=performance.now();const q=M=>{const t=Math.max(1,M-j);if(j=M,H*=Math.pow(si,t/16),Math.abs(H)<Ze){this.inertiaFrame=null;return}const a=k.scrollTop;if(k.scrollTop=a+H*t,k.scrollTop===a){this.inertiaFrame=null;return}this.inertiaFrame=window.requestAnimationFrame(q)};this.inertiaFrame=window.requestAnimationFrame(q)}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(),H=this.terminalCoordsToPixels(R),j=this.terminalCoordsToPixels(k),q=Math.max(0,this.terminalContent.clientWidth-Ce);H?(this.startHandle.style.display="block",this.startHandle.style.left=`${me(H.x-Ce/2,0,q)}px`,this.startHandle.style.top=`${H.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,q)}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 H=k.getBoundingClientRect(),j=R.clientX-H.left,q=R.clientY-H.top;if(j<0||q<0||j>H.width||q>H.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(q/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 H=R.row-this.terminal.buffer.active.viewportY;if(H<0||H>=this.terminal.rows)return null;const j=k.getBoundingClientRect(),q=this.terminalContent.getBoundingClientRect();return{x:j.left-q.left+R.col*this.cellDimensions.width,y:j.top-q.top+H*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 H=this.getTerminalScreenElement()?.getBoundingClientRect();if(!H||!this.terminal.cols||!this.terminal.rows){this.cellDimensions={width:0,height:0};return}this.cellDimensions={width:H.width/this.terminal.cols,height:H.height/this.terminal.rows}}getWordBoundsAt(R){const k=this.terminal.buffer.active.getLine(R.row);if(!k)return null;const H=k.translateToString(!1);if(!H||R.col>=H.length||/\s/.test(H[R.col]))return null;let j=R.col,q=R.col;for(;j>0&&!/\s/.test(H[j-1]);)j--;for(;q<H.length-1&&!/\s/.test(H[q+1]);)q++;return{start:{row:R.row,col:j},end:{row:R.row,col:q}}}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 ci(z,R,k={}){return!oi()||!z.element?null:new li(z,R,k)}const et=12,ui=64,di=65;function tt(z){return typeof z!="string"||!/^[ \u00a0\u3000]+$/.test(z)?null:" ".repeat(z.length)}function _i(z){return btoa(z)}function lt(z,R,k,H){const j=k&&H?xe(Math.floor((k.clientX-H.left)/Math.max(1,H.width)*R.cols)+1,1,R.cols):Math.max(1,Math.ceil(R.cols/2)),q=k&&H?xe(Math.floor((k.clientY-H.top)/Math.max(1,H.height)*R.rows)+1,1,R.rows):Math.max(1,Math.ceil(R.rows/2));return`\x1B[<${z};${j};${q}M\x1B[<${z};${j};${q}m`}function fi(z,R,k){return lt(0,z,R,k)}function gi(z,R,k){return lt(2,z,R,k)}function xe(z,R,k){return Math.max(R,Math.min(k,z))}function vi(z,R,k,H,j){const q=xe(Math.floor((R.clientX-k.left)/Math.max(1,k.width)*H)+1,1,H),M=xe(Math.floor((R.clientY-k.top)/Math.max(1,k.height)*j)+1,1,j);return`\x1B[<${z>0?di:ui};${q};${M}M`.repeat(Math.abs(z))}function pi({terminal:z,getBoundingClientRect:R,send:k}){let H=0;const j=((q,M)=>{H+=q;const t=R(),a=t.height/Math.max(1,z.rows);if(!Number.isFinite(a)||a<=0)return!0;const h=Math.trunc(H/a);if(h===0)return!0;const l=xe(h,-et,et);return H-=l*a,k({type:"input",data:vi(l,M,t,Math.max(1,z.cols),Math.max(1,z.rows))}),!0});return j.reset=()=>{H=0},j}function mi({terminal:z,container:R,focusTarget:k=typeof window>"u"?null:window,visibilityTarget:H=typeof document>"u"?null:document,isVisible:j=()=>typeof document>"u"||document.visibilityState==="visible",shellMode:q,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=()=>{q==="herdr"&&z.modes.mouseTrackingMode==="none"&&z.write(Tt)},o=u=>{q==="herdr"&&u.preventDefault()},e=()=>{q!=="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),H?.addEventListener("visibilitychange",i),q==="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:_i(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),H?.removeEventListener("visibilitychange",i),q==="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",Si=`
|
|
67
67
|
.xterm .xterm-screen {
|
|
68
68
|
outline: none !important;
|
|
69
69
|
}
|
|
@@ -73,4 +73,4 @@ WARNING: This link could potentially be dangerous`)){const r=window.open();if(r)
|
|
|
73
73
|
.xterm-screen:focus {
|
|
74
74
|
outline: none !important;
|
|
75
75
|
}
|
|
76
|
-
`;function mi(){if(typeof document>"u"||document.getElementById(it))return;const z=document.createElement("style");z.id=it,z.type="text/css",z.innerText=pi,document.head.appendChild(z)}const Si={readText:async z=>{if(z!=="c")return"";try{return await navigator.clipboard?.readText?.()||""}catch{return""}},writeText:async(z,R)=>{z==="c"&&await Ae(R)}},Ci=Ut.ClipboardAddon;function bi({terminalContainerRef:z,terminalRef:R,fitAddonRef:k,wsRef:N,selectedProject:j,shellMode:V,minimal:M,isRestarting:t,closeSocket:a}){const[h,l]=Y.useState(!1),s=Y.useRef(null),c=Y.useRef(null),f=ye(j,V),g=f??"",o=f!==null;Y.useEffect(()=>{mi()},[]);const e=Y.useCallback(()=>{R.current&&(R.current.clear(),R.current.write("\x1B[2J\x1B[H"))},[R]),r=Y.useCallback(()=>{c.current&&(c.current.dispose(),c.current=null),R.current&&(R.current.dispose(),R.current=null),k.current=null,l(!1)},[k,R]);return Y.useEffect(()=>{const i=z.current;if(!i||!o||t||R.current)return;const n=qe(V,i.clientWidth);let _=n.fontSize,p=!1;const u=new Yt.Terminal(n);R.current=u;const m=new jt.FitAddon;k.current=m,u.loadAddon(m),u.loadAddon(new Ci(void 0,Si)),M||u.loadAddon(new Vt.WebLinksAddon);try{u.loadAddon(new Gt.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}const d=i.style.touchAction;V==="herdr"&&(i.style.touchAction="none"),u.open(i);const v=V==="herdr"?gi({terminal:u,getBoundingClientRect:()=>i.getBoundingClientRect(),send:x=>fe(N.current,x)}):void 0;c.current=li(u,i,{onTwoFingerTap:V==="herdr"?x=>{fe(N.current,{type:"input",data:_i(u,x,i.getBoundingClientRect())})}:void 0,onPaste:async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const x=await navigator.clipboard.readText();x&&fe(N.current,{type:"input",data:x})}catch{}},onTouchScroll:v,onTouchScrollReset:v?.reset,onFontSizeChange:x=>{p=!0,u.options.fontSize=x;const B=k.current;B?(B.fit(),fe(N.current,{type:"resize",cols:u.cols,rows:u.rows})):u.refresh(0,u.rows-1)}});const S=async()=>{const x=u.getSelection();return x?Ae(x):!1},y=x=>{if(!u.hasSelection())return;const B=u.getSelection();if(B){if(x.preventDefault(),x.clipboardData){x.clipboardData.setData("text/plain",B);return}Ae(B)}};i.addEventListener("copy",y);const b=vi({terminal:u,container:i,shellMode:V,send:x=>fe(N.current,x)});u.attachCustomKeyEventHandler(x=>x.type==="keydown"&&(x.ctrlKey||x.metaKey)&&x.key?.toLowerCase()==="c"&&u.hasSelection()?(x.preventDefault(),x.stopPropagation(),S(),!1):x.type==="keydown"&&(x.ctrlKey||x.metaKey)&&x.key?.toLowerCase()==="v"?(x.preventDefault(),x.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(B=>{fe(N.current,{type:"input",data:B})}).catch(()=>{}),!1):!0),window.setTimeout(()=>{const x=k.current,B=R.current;!x||!B||(x.fit(),fe(N.current,{type:"resize",cols:B.cols,rows:B.rows}))},at),l(!0);const w=new ResizeObserver(()=>{s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{const x=k.current,B=R.current;if(!x||!B)return;const F=qe(V,i.clientWidth).fontSize;Bt(B.options.fontSize,_,p)&&F!==_&&(B.options.fontSize=F),p||(_=F),x.fit(),fe(N.current,{type:"resize",cols:B.cols,rows:B.rows})},wt)});return w.observe(i),()=>{i.removeEventListener("copy",y),w.disconnect(),s.current!==null&&(window.clearTimeout(s.current),s.current=null),i.style.touchAction=d,b(),a(),r()}},[a,r,k,t,o,M,g,V,z,R,N]),{isInitialized:h,clearTerminalScreen:e,disposeTerminal:r}}function wi({selectedProject:z,selectedSession:R,initialCommand:k,isPlainShell:N,minimal:j,autoConnect:V,isRestarting:M,onProcessComplete:t,onOutputRef:a,shellSessionId:h,shellMode:l}){const s=Y.useRef(null),c=Y.useRef(null),f=Y.useRef(null),g=Y.useRef(null),o=Y.useRef(z),e=Y.useRef(R),r=Y.useRef(k),i=Y.useRef(N),n=Y.useRef(t),_=Y.useRef(h),p=Y.useRef(l),u=Y.useRef(R?.id??null),m=JSON.stringify({projectPath:ye(z,l),shellMode:l??"default"});Y.useEffect(()=>{o.current=z,e.current=R,r.current=k,i.current=N,n.current=t,_.current=h,p.current=l},[z,R,k,N,t,h,l]);const d=Y.useCallback(()=>{We(g)},[]),{isInitialized:v,clearTerminalScreen:S,disposeTerminal:y}=bi({terminalContainerRef:s,terminalRef:c,fitAddonRef:f,wsRef:g,selectedProject:z,shellMode:l,minimal:j,isRestarting:M,closeSocket:d}),{isConnected:b,isConnecting:w,connectToShell:x,disconnectFromShell:B}=Wt({connectionKey:m,wsRef:g,terminalRef:c,fitAddonRef:f,selectedProjectRef:o,selectedSessionRef:e,initialCommandRef:r,isPlainShellRef:i,onProcessCompleteRef:n,isInitialized:v,autoConnect:V,closeSocket:d,clearTerminalScreen:S,onOutputRef:a,shellSessionIdRef:_,shellModeRef:p});return Y.useEffect(()=>{M&&(B({suppressAutoConnect:!0}),y())},[B,y,M]),Y.useEffect(()=>{ye(z,l)===null&&(B(),y())},[B,y,z,l]),Y.useEffect(()=>{const F=R?.id??null;u.current!==F&&v&&B(),u.current=F},[B,v,R?.id]),{terminalContainerRef:s,terminalRef:c,wsRef:g,isConnected:b,isInitialized:v,isConnecting:w,connectToShell:x,disconnectFromShell:B}}function yi(z){return z?z.__provider==="cursor"?z.name||"Untitled Session":z.summary||"New Session":null}function xi({mode:z,description:R,loadingLabel:k,connectLabel:N,connectTitle:j,connectingLabel:V,onConnect:M}){return z==="loading"?J.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90",children:J.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-medium text-gray-100",children:[J.jsx(je,{className:"h-4 w-4 animate-spin text-blue-300","aria-hidden":"true"}),J.jsx("span",{children:k})]})}):z==="connect"?J.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:J.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[J.jsxs("button",{type:"button",onClick:M,className:"pointer-events-auto inline-flex min-h-12 w-full max-w-xs cursor-pointer items-center justify-center gap-2 rounded-md bg-emerald-600 px-5 py-3 text-base font-semibold text-white shadow-lg shadow-emerald-950/30 transition-colors hover:bg-emerald-500 focus:outline-none focus:ring-2 focus:ring-emerald-300 focus:ring-offset-2 focus:ring-offset-gray-950 active:bg-emerald-700",title:j,children:[J.jsx(nt,{className:"h-4 w-4","aria-hidden":"true"}),J.jsx("span",{className:"min-w-0 truncate",children:N})]}),J.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:R})]})}):J.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:J.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[J.jsxs("div",{className:"flex items-center justify-center gap-3 text-yellow-300",children:[J.jsx(je,{className:"h-5 w-5 animate-spin","aria-hidden":"true"}),J.jsx("span",{className:"text-base font-medium",children:V})]}),J.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:R})]})})}function Ei({title:z,description:R}){return J.jsx("div",{className:"flex h-full items-center justify-center",children:J.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[J.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:J.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),J.jsx("h3",{className:"mb-2 text-lg font-semibold",children:z}),J.jsx("p",{children:R})]})})}function Li({isConnected:z,isInitialized:R,isRestarting:k,hasSession:N,sessionDisplayNameShort:j,onDisconnect:V,onRestart:M,statusNewSessionText:t,statusInitializingText:a,statusRestartingText:h,disconnectLabel:l,disconnectTitle:s,restartLabel:c,restartTitle:f,disableRestart:g}){return J.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:J.jsxs("div",{className:"flex items-center justify-between",children:[J.jsxs("div",{className:"flex items-center space-x-2",children:[J.jsx("div",{className:`h-2 w-2 rounded-full ${z?"bg-green-500":"bg-red-500"}`}),N&&j&&J.jsxs("span",{className:"text-xs text-blue-300",children:["(",j,"...)"]}),!N&&J.jsx("span",{className:"text-xs text-gray-400",children:t}),!R&&J.jsx("span",{className:"text-xs text-yellow-400",children:a}),k&&J.jsx("span",{className:"text-xs text-blue-400",children:h})]}),J.jsxs("div",{className:"flex items-center gap-2",children:[z&&J.jsxs("button",{type:"button",onClick:V,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-red-600 px-3 text-xs font-medium text-white transition-colors hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-400/70 focus:ring-offset-2 focus:ring-offset-gray-800",title:s,children:[J.jsx(ft,{className:"h-3.5 w-3.5","aria-hidden":"true"}),J.jsx("span",{children:l})]}),J.jsxs("button",{type:"button",onClick:M,disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-gray-600/80 bg-gray-700/70 px-3 text-xs font-medium text-gray-100 transition-colors hover:border-blue-400/70 hover:bg-blue-600/80 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-400/70 focus:ring-offset-2 focus:ring-offset-gray-800 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-transparent disabled:text-gray-500 disabled:opacity-60",title:f,children:[J.jsx(nt,{className:`h-3.5 w-3.5 ${k?"animate-spin":""}`,"aria-hidden":"true"}),J.jsx("span",{children:c})]})]})]})})}function Ri({terminalContainerRef:z}){return J.jsx("div",{className:"relative h-full w-full bg-gray-900",children:J.jsx("div",{className:"absolute inset-x-0 bottom-[calc(3.5rem+env(safe-area-inset-bottom,0px))] top-0 md:bottom-0",children:J.jsx("div",{ref:z,className:"h-full w-full focus:outline-none",style:{outline:"none"}})})})}const Ti=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"},{type:"key",id:"ctrl-c",label:"Ctrl+C",sequence:""}],Di={up:St,down:mt,left:pt,right:vt},we=z=>z.preventDefault(),st="min-h-10 shrink-0 rounded-md border border-gray-600 bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",Ai="min-h-10 shrink-0 rounded-md border border-blue-500 bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",Ne="flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-gray-600 bg-gray-700 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function rt({wsRef:z,terminalRef:R,isConnected:k,bottomOffset:N="bottom-0"}){const{t:j}=ot("settings"),[V,M]=Y.useState(!1),[t,a]=Y.useState(!1),h=Y.useCallback(f=>{fe(z.current,{type:"input",data:f})},[z]),l=Y.useCallback(()=>{R.current?.scrollToBottom()},[R]),s=Y.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const f=await navigator.clipboard.readText();f.length>0&&h(f)}catch{}},[h]),c=Y.useCallback(f=>{let g=f;if(V&&f.length===1){const o=f.toLowerCase().charCodeAt(0);o>=97&&o<=122&&(g=String.fromCharCode(o-96)),M(!1)}t&&f.length===1&&(g="\x1B"+g,a(!1)),h(g)},[V,t,h]);return J.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${N} z-20 pb-[env(safe-area-inset-bottom,0px)] md:hidden`,style:{paddingLeft:"max(0.5rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.5rem, env(safe-area-inset-right, 0px))"},children:J.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[J.jsx("button",{type:"button",onPointerDown:we,onClick:()=>{s()},disabled:!k,className:Ne,title:j("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":j("terminalShortcuts.paste",{defaultValue:"Paste"}),children:J.jsx(gt,{className:"h-4 w-4"})}),Ti.map(f=>{if(f.type==="modifier"){const g=f.modifier==="ctrl"?V:t,o=f.modifier==="ctrl"?()=>M(e=>!e):()=>a(e=>!e);return J.jsx("button",{type:"button",onPointerDown:we,onClick:o,disabled:!k,className:g?Ai:st,children:f.label},f.id)}if(f.type==="arrow"){const g=Di[f.icon];return J.jsx("button",{type:"button",onPointerDown:we,onClick:()=>h(f.sequence),disabled:!k,className:Ne,children:J.jsx(g,{className:"h-4 w-4"})},f.id)}return J.jsx("button",{type:"button",onPointerDown:we,onClick:()=>c(f.sequence),disabled:!k,className:st,children:f.label},f.id)}),J.jsx("button",{type:"button",onPointerDown:we,onClick:l,disabled:!k,className:Ne,title:j("terminalShortcuts.scrollDown"),"aria-label":j("terminalShortcuts.scrollDown"),children:J.jsx(Ct,{className:"h-4 w-4"})})]})})}function Mi({selectedProject:z=null,selectedSession:R=null,initialCommand:k=null,isPlainShell:N=!1,onProcessComplete:j=null,minimal:V=!1,autoConnect:M=!1,isActive:t=!0,shellSessionId:a=null,shellMode:h="default"}){const{t:l}=ot("chat"),[s,c]=Y.useState(!1),[f,g]=Y.useState(null),o=Y.useRef(null),e=Y.useRef(null),r=Y.useRef(!1),i=Y.useRef(null),{terminalContainerRef:n,terminalRef:_,wsRef:p,isConnected:u,isInitialized:m,isConnecting:d,connectToShell:v,disconnectFromShell:S}=wi({selectedProject:z,selectedSession:R,initialCommand:k,isPlainShell:N,minimal:V,autoConnect:M,isRestarting:s,onProcessComplete:j,onOutputRef:i,shellSessionId:a,shellMode:h}),y=Y.useCallback(()=>{const $=_.current;if(!$)return;const K=$.buffer.active,X=K.baseY+K.cursorY,P=Math.min(K.baseY+K.length-1,X+10),L=Math.max(0,X-Dt),H=[];for(let G=L;G<=P;G++){const te=K.getLine(G);te&&H.push(te.translateToString().trimEnd())}let A=-1;for(let G=H.length-1;G>=0;G--)if(/esc to cancel/i.test(H[G])||/enter to select/i.test(H[G])){A=G;break}if(A===-1){g(null);return}const W=new Map,q=Math.max(0,A-At);for(let G=A-1;G>=q;G--){const te=H[G].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(te){const ae=te[1],Q=te[2].trim();parseInt(ae,10)<=Mt&&Q.length>0&&!W.has(ae)&&W.set(ae,Q)}}const ee=[];for(let G=1;G<=W.size&&W.has(String(G));G++)ee.push({number:String(G),label:W.get(String(G))});g(ee.length>=kt?ee:null)},[_]),b=Y.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(y,Tt)},[y]);Y.useEffect(()=>{i.current=b},[b]),Y.useEffect(()=>()=>{o.current&&clearTimeout(o.current),e.current&&clearTimeout(e.current)},[]),Y.useEffect(()=>{u||(o.current&&(clearTimeout(o.current),o.current=null),g(null))},[u]),Y.useEffect(()=>{if(!t||!m||!u)return;const $=()=>{_.current?.focus()},K=window.requestAnimationFrame($),X=window.setTimeout($,0);return()=>{window.cancelAnimationFrame(K),window.clearTimeout(X)}},[t,u,m,_]);const w=Y.useCallback($=>{fe(p.current,{type:"input",data:$})},[p]),x=Y.useMemo(()=>yi(R),[R]),B=Y.useMemo(()=>x?x.slice(0,30):null,[x]),F=Y.useMemo(()=>x?x.slice(0,50):null,[x]),I=z?.displayName??"Herdr",O=Y.useCallback(()=>{r.current=!0,c(!0),e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{c(!1),e.current=null},bt)},[]),C=Y.useCallback(()=>{r.current=!1,e.current&&(clearTimeout(e.current),e.current=null),c(!1),S({suppressAutoConnect:!0})},[S]);if(Y.useEffect(()=>{!r.current||s||!m||u||d||(r.current=!1,v({forceRestart:!0}))},[v,u,d,m,s]),ye(z,h)===null)return J.jsx(Ei,{title:l("shell.selectProject.title"),description:l("shell.selectProject.description")});if(V)return J.jsxs(J.Fragment,{children:[J.jsx(Ri,{terminalContainerRef:n}),J.jsx(rt,{wsRef:p,terminalRef:_,isConnected:u,bottomOffset:"bottom-0"})]});const E=N?l("shell.runCommand",{command:k||l("shell.defaultCommand"),projectName:I}):R?l("shell.resumeSession",{displayName:F}):l("shell.startSession"),T=N?l("shell.runCommand",{command:k||l("shell.defaultCommand"),projectName:I}):l("shell.startCli",{projectName:I}),D=m?d?"connecting":u?null:"connect":"loading",U=D==="connecting"?T:E;return J.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[J.jsx(Li,{isConnected:u,isInitialized:m,isRestarting:s,hasSession:!!R,sessionDisplayNameShort:B,onDisconnect:C,onRestart:O,statusNewSessionText:l("shell.status.newSession"),statusInitializingText:l("shell.status.initializing"),statusRestartingText:l("shell.status.restarting"),disconnectLabel:l("shell.actions.disconnect"),disconnectTitle:l("shell.actions.disconnectTitle"),restartLabel:l("shell.actions.restart"),restartTitle:l("shell.actions.restartTitle"),disableRestart:s||!m}),J.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[J.jsx("div",{ref:n,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),D&&J.jsx(xi,{mode:D,description:U,loadingLabel:l("shell.loading"),connectLabel:l("shell.actions.connect"),connectTitle:l("shell.actions.connectTitle"),connectingLabel:l("shell.connecting"),onConnect:O}),f&&u&&J.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm md:hidden",onMouseDown:$=>$.preventDefault(),children:J.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.map($=>J.jsxs("button",{type:"button",onClick:()=>{w($.number),g(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${$.number}. ${$.label}`,children:[$.number,". ",$.label]},$.number)),J.jsx("button",{type:"button",onClick:()=>{w("\x1B"),g(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),J.jsx(rt,{wsRef:p,terminalRef:_,isConnected:u})]})}const Ii=Object.freeze(Object.defineProperty({__proto__:null,default:Mi},Symbol.toStringTag,{value:"Module"}));export{Mi as S,Ii as a,ye as r};
|
|
76
|
+
`;function Ci(){if(typeof document>"u"||document.getElementById(it))return;const z=document.createElement("style");z.id=it,z.type="text/css",z.innerText=Si,document.head.appendChild(z)}const bi={readText:async z=>{if(z!=="c")return"";try{return await navigator.clipboard?.readText?.()||""}catch{return""}},writeText:async(z,R)=>{z==="c"&&await Ae(R)}},wi=zt.ClipboardAddon;function yi({terminalContainerRef:z,terminalRef:R,fitAddonRef:k,wsRef:H,selectedProject:j,shellMode:q,minimal:M,isRestarting:t,closeSocket:a}){const[h,l]=Y.useState(!1),s=Y.useRef(null),c=Y.useRef(null),f=ye(j,q),g=f??"",o=f!==null;Y.useEffect(()=>{Ci()},[]);const e=Y.useCallback(()=>{R.current&&(R.current.clear(),R.current.write("\x1B[2J\x1B[H"))},[R]),r=Y.useCallback(()=>{c.current&&(c.current.dispose(),c.current=null),R.current&&(R.current.dispose(),R.current=null),k.current=null,l(!1)},[k,R]);return Y.useEffect(()=>{const i=z.current;if(!i||!o||t||R.current)return;const n=qe(q,i.clientWidth);let _=n.fontSize,p=!1;const u=new Jt.Terminal(n);R.current=u;const m=new qt.FitAddon;k.current=m,u.loadAddon(m),u.loadAddon(new wi(void 0,bi)),M||u.loadAddon(new Kt.WebLinksAddon);try{u.loadAddon(new Xt.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}const d=i.style.touchAction;q==="herdr"&&(i.style.touchAction="none"),u.open(i);const v=q==="herdr"?pi({terminal:u,getBoundingClientRect:()=>i.getBoundingClientRect(),send:x=>fe(H.current,x)}):void 0;c.current=ci(u,i,{onTap:q==="herdr"?x=>{fe(H.current,{type:"input",data:fi(u,x,i.getBoundingClientRect())})}:void 0,onTwoFingerTap:q==="herdr"?x=>{fe(H.current,{type:"input",data:gi(u,x,i.getBoundingClientRect())})}:void 0,onPaste:async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const x=await navigator.clipboard.readText();x&&fe(H.current,{type:"input",data:x})}catch{}},onTouchScroll:v,onTouchScrollReset:v?.reset,onFontSizeChange:x=>{p=!0,u.options.fontSize=x;const B=k.current;B?(B.fit(),fe(H.current,{type:"resize",cols:u.cols,rows:u.rows})):u.refresh(0,u.rows-1)}});const S=async()=>{const x=u.getSelection();return x?Ae(x):!1},y=x=>{if(!u.hasSelection())return;const B=u.getSelection();if(B){if(x.preventDefault(),x.clipboardData){x.clipboardData.setData("text/plain",B);return}Ae(B)}};i.addEventListener("copy",y);const b=mi({terminal:u,container:i,shellMode:q,send:x=>fe(H.current,x)});u.attachCustomKeyEventHandler(x=>x.type==="keydown"&&(x.ctrlKey||x.metaKey)&&x.key?.toLowerCase()==="c"&&u.hasSelection()?(x.preventDefault(),x.stopPropagation(),S(),!1):x.type==="keydown"&&(x.ctrlKey||x.metaKey)&&x.key?.toLowerCase()==="v"?(x.preventDefault(),x.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(B=>{fe(H.current,{type:"input",data:B})}).catch(()=>{}),!1):!0),window.setTimeout(()=>{const x=k.current,B=R.current;!x||!B||(x.fit(),fe(H.current,{type:"resize",cols:B.cols,rows:B.rows}))},at),l(!0);const w=new ResizeObserver(()=>{s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{const x=k.current,B=R.current;if(!x||!B)return;const F=qe(q,i.clientWidth).fontSize;Pt(B.options.fontSize,_,p)&&F!==_&&(B.options.fontSize=F),p||(_=F),x.fit(),fe(H.current,{type:"resize",cols:B.cols,rows:B.rows})},yt)});return w.observe(i),()=>{i.removeEventListener("copy",y),w.disconnect(),s.current!==null&&(window.clearTimeout(s.current),s.current=null),i.style.touchAction=d,b(),a(),r()}},[a,r,k,t,o,M,g,q,z,R,H]),{isInitialized:h,clearTerminalScreen:e,disposeTerminal:r}}function xi({selectedProject:z,selectedSession:R,initialCommand:k,isPlainShell:H,minimal:j,autoConnect:q,isRestarting:M,onProcessComplete:t,onOutputRef:a,shellSessionId:h,shellMode:l}){const s=Y.useRef(null),c=Y.useRef(null),f=Y.useRef(null),g=Y.useRef(null),o=Y.useRef(z),e=Y.useRef(R),r=Y.useRef(k),i=Y.useRef(H),n=Y.useRef(t),_=Y.useRef(h),p=Y.useRef(l),u=Y.useRef(R?.id??null),m=JSON.stringify({projectPath:ye(z,l),shellMode:l??"default"});Y.useEffect(()=>{o.current=z,e.current=R,r.current=k,i.current=H,n.current=t,_.current=h,p.current=l},[z,R,k,H,t,h,l]);const d=Y.useCallback(()=>{We(g)},[]),{isInitialized:v,clearTerminalScreen:S,disposeTerminal:y}=yi({terminalContainerRef:s,terminalRef:c,fitAddonRef:f,wsRef:g,selectedProject:z,shellMode:l,minimal:j,isRestarting:M,closeSocket:d}),{isConnected:b,isConnecting:w,connectToShell:x,disconnectFromShell:B}=$t({connectionKey:m,wsRef:g,terminalRef:c,fitAddonRef:f,selectedProjectRef:o,selectedSessionRef:e,initialCommandRef:r,isPlainShellRef:i,onProcessCompleteRef:n,isInitialized:v,autoConnect:q,closeSocket:d,clearTerminalScreen:S,onOutputRef:a,shellSessionIdRef:_,shellModeRef:p});return Y.useEffect(()=>{M&&(B({suppressAutoConnect:!0}),y())},[B,y,M]),Y.useEffect(()=>{ye(z,l)===null&&(B(),y())},[B,y,z,l]),Y.useEffect(()=>{const F=R?.id??null;u.current!==F&&v&&B(),u.current=F},[B,v,R?.id]),{terminalContainerRef:s,terminalRef:c,wsRef:g,isConnected:b,isInitialized:v,isConnecting:w,connectToShell:x,disconnectFromShell:B}}function Ei(z){return z?z.__provider==="cursor"?z.name||"Untitled Session":z.summary||"New Session":null}function Li({mode:z,description:R,loadingLabel:k,connectLabel:H,connectTitle:j,connectingLabel:q,onConnect:M}){return z==="loading"?J.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90",children:J.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-medium text-gray-100",children:[J.jsx(je,{className:"h-4 w-4 animate-spin text-blue-300","aria-hidden":"true"}),J.jsx("span",{children:k})]})}):z==="connect"?J.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:J.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[J.jsxs("button",{type:"button",onClick:M,className:"pointer-events-auto inline-flex min-h-12 w-full max-w-xs cursor-pointer items-center justify-center gap-2 rounded-md bg-emerald-600 px-5 py-3 text-base font-semibold text-white shadow-lg shadow-emerald-950/30 transition-colors hover:bg-emerald-500 focus:outline-none focus:ring-2 focus:ring-emerald-300 focus:ring-offset-2 focus:ring-offset-gray-950 active:bg-emerald-700",title:j,children:[J.jsx(nt,{className:"h-4 w-4","aria-hidden":"true"}),J.jsx("span",{className:"min-w-0 truncate",children:H})]}),J.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:R})]})}):J.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-gray-950/90 p-6",children:J.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-3 text-center",children:[J.jsxs("div",{className:"flex items-center justify-center gap-3 text-yellow-300",children:[J.jsx(je,{className:"h-5 w-5 animate-spin","aria-hidden":"true"}),J.jsx("span",{className:"text-base font-medium",children:q})]}),J.jsx("p",{className:"max-w-md break-words px-2 text-sm leading-6 text-gray-300",children:R})]})})}function Ri({title:z,description:R}){return J.jsx("div",{className:"flex h-full items-center justify-center",children:J.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[J.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:J.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:J.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),J.jsx("h3",{className:"mb-2 text-lg font-semibold",children:z}),J.jsx("p",{children:R})]})})}function Ti({isConnected:z,isInitialized:R,isRestarting:k,hasSession:H,sessionDisplayNameShort:j,onDisconnect:q,onRestart:M,statusNewSessionText:t,statusInitializingText:a,statusRestartingText:h,disconnectLabel:l,disconnectTitle:s,restartLabel:c,restartTitle:f,disableRestart:g}){return J.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:J.jsxs("div",{className:"flex items-center justify-between",children:[J.jsxs("div",{className:"flex items-center space-x-2",children:[J.jsx("div",{className:`h-2 w-2 rounded-full ${z?"bg-green-500":"bg-red-500"}`}),H&&j&&J.jsxs("span",{className:"text-xs text-blue-300",children:["(",j,"...)"]}),!H&&J.jsx("span",{className:"text-xs text-gray-400",children:t}),!R&&J.jsx("span",{className:"text-xs text-yellow-400",children:a}),k&&J.jsx("span",{className:"text-xs text-blue-400",children:h})]}),J.jsxs("div",{className:"flex items-center gap-2",children:[z&&J.jsxs("button",{type:"button",onClick:q,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-red-600 px-3 text-xs font-medium text-white transition-colors hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-400/70 focus:ring-offset-2 focus:ring-offset-gray-800",title:s,children:[J.jsx(gt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),J.jsx("span",{children:l})]}),J.jsxs("button",{type:"button",onClick:M,disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-gray-600/80 bg-gray-700/70 px-3 text-xs font-medium text-gray-100 transition-colors hover:border-blue-400/70 hover:bg-blue-600/80 hover:text-white focus:outline-none focus:ring-2 focus:ring-blue-400/70 focus:ring-offset-2 focus:ring-offset-gray-800 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-transparent disabled:text-gray-500 disabled:opacity-60",title:f,children:[J.jsx(nt,{className:`h-3.5 w-3.5 ${k?"animate-spin":""}`,"aria-hidden":"true"}),J.jsx("span",{children:c})]})]})]})})}function Di({terminalContainerRef:z}){return J.jsx("div",{className:"relative h-full w-full bg-gray-900",children:J.jsx("div",{className:"absolute inset-x-0 bottom-[calc(3.5rem+env(safe-area-inset-bottom,0px))] top-0 md:bottom-0",children:J.jsx("div",{ref:z,className:"h-full w-full focus:outline-none",style:{outline:"none"}})})})}const Ai=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"},{type:"key",id:"ctrl-c",label:"Ctrl+C",sequence:""}],Mi={up:Ct,down:St,left:mt,right:pt},we=z=>z.preventDefault(),st="min-h-10 shrink-0 rounded-md border border-gray-600 bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",ki="min-h-10 shrink-0 rounded-md border border-blue-500 bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",Ne="flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-gray-600 bg-gray-700 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function rt({wsRef:z,terminalRef:R,isConnected:k,bottomOffset:H="bottom-0"}){const{t:j}=ot("settings"),[q,M]=Y.useState(!1),[t,a]=Y.useState(!1),h=Y.useCallback(f=>{fe(z.current,{type:"input",data:f})},[z]),l=Y.useCallback(()=>{R.current?.scrollToBottom()},[R]),s=Y.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const f=await navigator.clipboard.readText();f.length>0&&h(f)}catch{}},[h]),c=Y.useCallback(f=>{let g=f;if(q&&f.length===1){const o=f.toLowerCase().charCodeAt(0);o>=97&&o<=122&&(g=String.fromCharCode(o-96)),M(!1)}t&&f.length===1&&(g="\x1B"+g,a(!1)),h(g)},[q,t,h]);return J.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${H} z-20 pb-[env(safe-area-inset-bottom,0px)] md:hidden`,style:{paddingLeft:"max(0.5rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.5rem, env(safe-area-inset-right, 0px))"},children:J.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[J.jsx("button",{type:"button",onPointerDown:we,onClick:()=>{s()},disabled:!k,className:Ne,title:j("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":j("terminalShortcuts.paste",{defaultValue:"Paste"}),children:J.jsx(vt,{className:"h-4 w-4"})}),Ai.map(f=>{if(f.type==="modifier"){const g=f.modifier==="ctrl"?q:t,o=f.modifier==="ctrl"?()=>M(e=>!e):()=>a(e=>!e);return J.jsx("button",{type:"button",onPointerDown:we,onClick:o,disabled:!k,className:g?ki:st,children:f.label},f.id)}if(f.type==="arrow"){const g=Mi[f.icon];return J.jsx("button",{type:"button",onPointerDown:we,onClick:()=>h(f.sequence),disabled:!k,className:Ne,children:J.jsx(g,{className:"h-4 w-4"})},f.id)}return J.jsx("button",{type:"button",onPointerDown:we,onClick:()=>c(f.sequence),disabled:!k,className:st,children:f.label},f.id)}),J.jsx("button",{type:"button",onPointerDown:we,onClick:l,disabled:!k,className:Ne,title:j("terminalShortcuts.scrollDown"),"aria-label":j("terminalShortcuts.scrollDown"),children:J.jsx(bt,{className:"h-4 w-4"})})]})})}function Bi({selectedProject:z=null,selectedSession:R=null,initialCommand:k=null,isPlainShell:H=!1,onProcessComplete:j=null,minimal:q=!1,autoConnect:M=!1,isActive:t=!0,shellSessionId:a=null,shellMode:h="default"}){const{t:l}=ot("chat"),[s,c]=Y.useState(!1),[f,g]=Y.useState(null),o=Y.useRef(null),e=Y.useRef(null),r=Y.useRef(!1),i=Y.useRef(null),{terminalContainerRef:n,terminalRef:_,wsRef:p,isConnected:u,isInitialized:m,isConnecting:d,connectToShell:v,disconnectFromShell:S}=xi({selectedProject:z,selectedSession:R,initialCommand:k,isPlainShell:H,minimal:q,autoConnect:M,isRestarting:s,onProcessComplete:j,onOutputRef:i,shellSessionId:a,shellMode:h}),y=Y.useCallback(()=>{const $=_.current;if(!$)return;const K=$.buffer.active,X=K.baseY+K.cursorY,P=Math.min(K.baseY+K.length-1,X+10),L=Math.max(0,X-At),N=[];for(let G=L;G<=P;G++){const te=K.getLine(G);te&&N.push(te.translateToString().trimEnd())}let A=-1;for(let G=N.length-1;G>=0;G--)if(/esc to cancel/i.test(N[G])||/enter to select/i.test(N[G])){A=G;break}if(A===-1){g(null);return}const W=new Map,V=Math.max(0,A-Mt);for(let G=A-1;G>=V;G--){const te=N[G].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(te){const ae=te[1],Q=te[2].trim();parseInt(ae,10)<=kt&&Q.length>0&&!W.has(ae)&&W.set(ae,Q)}}const ee=[];for(let G=1;G<=W.size&&W.has(String(G));G++)ee.push({number:String(G),label:W.get(String(G))});g(ee.length>=Bt?ee:null)},[_]),b=Y.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(y,Dt)},[y]);Y.useEffect(()=>{i.current=b},[b]),Y.useEffect(()=>()=>{o.current&&clearTimeout(o.current),e.current&&clearTimeout(e.current)},[]),Y.useEffect(()=>{u||(o.current&&(clearTimeout(o.current),o.current=null),g(null))},[u]),Y.useEffect(()=>{if(!t||!m||!u)return;const $=()=>{_.current?.focus()},K=window.requestAnimationFrame($),X=window.setTimeout($,0);return()=>{window.cancelAnimationFrame(K),window.clearTimeout(X)}},[t,u,m,_]);const w=Y.useCallback($=>{fe(p.current,{type:"input",data:$})},[p]),x=Y.useMemo(()=>Ei(R),[R]),B=Y.useMemo(()=>x?x.slice(0,30):null,[x]),F=Y.useMemo(()=>x?x.slice(0,50):null,[x]),I=z?.displayName??"Herdr",O=Y.useCallback(()=>{r.current=!0,c(!0),e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{c(!1),e.current=null},wt)},[]),C=Y.useCallback(()=>{r.current=!1,e.current&&(clearTimeout(e.current),e.current=null),c(!1),S({suppressAutoConnect:!0})},[S]);if(Y.useEffect(()=>{!r.current||s||!m||u||d||(r.current=!1,v({forceRestart:!0}))},[v,u,d,m,s]),ye(z,h)===null)return J.jsx(Ri,{title:l("shell.selectProject.title"),description:l("shell.selectProject.description")});if(q)return J.jsxs(J.Fragment,{children:[J.jsx(Di,{terminalContainerRef:n}),J.jsx(rt,{wsRef:p,terminalRef:_,isConnected:u,bottomOffset:"bottom-0"})]});const E=H?l("shell.runCommand",{command:k||l("shell.defaultCommand"),projectName:I}):R?l("shell.resumeSession",{displayName:F}):l("shell.startSession"),T=H?l("shell.runCommand",{command:k||l("shell.defaultCommand"),projectName:I}):l("shell.startCli",{projectName:I}),D=m?d?"connecting":u?null:"connect":"loading",U=D==="connecting"?T:E;return J.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[J.jsx(Ti,{isConnected:u,isInitialized:m,isRestarting:s,hasSession:!!R,sessionDisplayNameShort:B,onDisconnect:C,onRestart:O,statusNewSessionText:l("shell.status.newSession"),statusInitializingText:l("shell.status.initializing"),statusRestartingText:l("shell.status.restarting"),disconnectLabel:l("shell.actions.disconnect"),disconnectTitle:l("shell.actions.disconnectTitle"),restartLabel:l("shell.actions.restart"),restartTitle:l("shell.actions.restartTitle"),disableRestart:s||!m}),J.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[J.jsx("div",{ref:n,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),D&&J.jsx(Li,{mode:D,description:U,loadingLabel:l("shell.loading"),connectLabel:l("shell.actions.connect"),connectTitle:l("shell.actions.connectTitle"),connectingLabel:l("shell.connecting"),onConnect:O}),f&&u&&J.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm md:hidden",onMouseDown:$=>$.preventDefault(),children:J.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.map($=>J.jsxs("button",{type:"button",onClick:()=>{w($.number),g(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${$.number}. ${$.label}`,children:[$.number,". ",$.label]},$.number)),J.jsx("button",{type:"button",onClick:()=>{w("\x1B"),g(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),J.jsx(rt,{wsRef:p,terminalRef:_,isConnected:u})]})}const Hi=Object.freeze(Object.defineProperty({__proto__:null,default:Bi},Symbol.toStringTag,{value:"Module"}));export{Bi as S,Hi as a,ye as r};
|