agent-tower 0.1.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/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +62 -0
- package/dist/app.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +131 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/container.d.ts +11 -0
- package/dist/core/container.d.ts.map +1 -0
- package/dist/core/container.js +66 -0
- package/dist/core/container.js.map +1 -0
- package/dist/core/event-bus.d.ts +58 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +29 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/executors/base.executor.d.ts +160 -0
- package/dist/executors/base.executor.d.ts.map +1 -0
- package/dist/executors/base.executor.js +122 -0
- package/dist/executors/base.executor.js.map +1 -0
- package/dist/executors/claude-code.executor.d.ts +78 -0
- package/dist/executors/claude-code.executor.d.ts.map +1 -0
- package/dist/executors/claude-code.executor.js +160 -0
- package/dist/executors/claude-code.executor.js.map +1 -0
- package/dist/executors/command-builder.d.ts +64 -0
- package/dist/executors/command-builder.d.ts.map +1 -0
- package/dist/executors/command-builder.js +144 -0
- package/dist/executors/command-builder.js.map +1 -0
- package/dist/executors/cursor-agent.executor.d.ts +57 -0
- package/dist/executors/cursor-agent.executor.d.ts.map +1 -0
- package/dist/executors/cursor-agent.executor.js +109 -0
- package/dist/executors/cursor-agent.executor.js.map +1 -0
- package/dist/executors/default-profiles.json +29 -0
- package/dist/executors/execution-env.d.ts +64 -0
- package/dist/executors/execution-env.d.ts.map +1 -0
- package/dist/executors/execution-env.js +97 -0
- package/dist/executors/execution-env.js.map +1 -0
- package/dist/executors/gemini-cli.executor.d.ts +55 -0
- package/dist/executors/gemini-cli.executor.d.ts.map +1 -0
- package/dist/executors/gemini-cli.executor.js +117 -0
- package/dist/executors/gemini-cli.executor.js.map +1 -0
- package/dist/executors/index.d.ts +49 -0
- package/dist/executors/index.d.ts.map +1 -0
- package/dist/executors/index.js +95 -0
- package/dist/executors/index.js.map +1 -0
- package/dist/executors/profiles.d.ts +61 -0
- package/dist/executors/profiles.d.ts.map +1 -0
- package/dist/executors/profiles.js +192 -0
- package/dist/executors/profiles.js.map +1 -0
- package/dist/git/git-cli.d.ts +59 -0
- package/dist/git/git-cli.d.ts.map +1 -0
- package/dist/git/git-cli.js +156 -0
- package/dist/git/git-cli.js.map +1 -0
- package/dist/git/worktree.manager.d.ts +166 -0
- package/dist/git/worktree.manager.d.ts.map +1 -0
- package/dist/git/worktree.manager.js +481 -0
- package/dist/git/worktree.manager.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/context.d.ts +15 -0
- package/dist/mcp/context.d.ts.map +1 -0
- package/dist/mcp/context.js +19 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/http-client.d.ts +46 -0
- package/dist/mcp/http-client.d.ts.map +1 -0
- package/dist/mcp/http-client.js +100 -0
- package/dist/mcp/http-client.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +36 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +6 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +32 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/projects.d.ts +7 -0
- package/dist/mcp/tools/projects.d.ts.map +1 -0
- package/dist/mcp/tools/projects.js +12 -0
- package/dist/mcp/tools/projects.js.map +1 -0
- package/dist/mcp/tools/sessions.d.ts +7 -0
- package/dist/mcp/tools/sessions.d.ts.map +1 -0
- package/dist/mcp/tools/sessions.js +22 -0
- package/dist/mcp/tools/sessions.js.map +1 -0
- package/dist/mcp/tools/tasks.d.ts +7 -0
- package/dist/mcp/tools/tasks.d.ts.map +1 -0
- package/dist/mcp/tools/tasks.js +68 -0
- package/dist/mcp/tools/tasks.js.map +1 -0
- package/dist/mcp/tools/workspaces.d.ts +7 -0
- package/dist/mcp/tools/workspaces.d.ts.map +1 -0
- package/dist/mcp/tools/workspaces.js +45 -0
- package/dist/mcp/tools/workspaces.js.map +1 -0
- package/dist/mcp/types.d.ts +109 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +55 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/middleware/tunnel-auth.d.ts +13 -0
- package/dist/middleware/tunnel-auth.d.ts.map +1 -0
- package/dist/middleware/tunnel-auth.js +39 -0
- package/dist/middleware/tunnel-auth.js.map +1 -0
- package/dist/output/__tests__/claude-code-parser-token.test.d.ts +2 -0
- package/dist/output/__tests__/claude-code-parser-token.test.d.ts.map +1 -0
- package/dist/output/__tests__/claude-code-parser-token.test.js +233 -0
- package/dist/output/__tests__/claude-code-parser-token.test.js.map +1 -0
- package/dist/output/__tests__/cursor-agent-parser-token.test.d.ts +2 -0
- package/dist/output/__tests__/cursor-agent-parser-token.test.d.ts.map +1 -0
- package/dist/output/__tests__/cursor-agent-parser-token.test.js +95 -0
- package/dist/output/__tests__/cursor-agent-parser-token.test.js.map +1 -0
- package/dist/output/__tests__/msg-store-token.test.d.ts +2 -0
- package/dist/output/__tests__/msg-store-token.test.d.ts.map +1 -0
- package/dist/output/__tests__/msg-store-token.test.js +38 -0
- package/dist/output/__tests__/msg-store-token.test.js.map +1 -0
- package/dist/output/claude-code-parser.d.ts +96 -0
- package/dist/output/claude-code-parser.d.ts.map +1 -0
- package/dist/output/claude-code-parser.js +498 -0
- package/dist/output/claude-code-parser.js.map +1 -0
- package/dist/output/cursor-agent-parser.d.ts +87 -0
- package/dist/output/cursor-agent-parser.d.ts.map +1 -0
- package/dist/output/cursor-agent-parser.js +476 -0
- package/dist/output/cursor-agent-parser.js.map +1 -0
- package/dist/output/index.d.ts +9 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +13 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/msg-store.d.ts +110 -0
- package/dist/output/msg-store.d.ts.map +1 -0
- package/dist/output/msg-store.js +274 -0
- package/dist/output/msg-store.js.map +1 -0
- package/dist/output/types.d.ts +90 -0
- package/dist/output/types.d.ts.map +1 -0
- package/dist/output/types.js +93 -0
- package/dist/output/types.js.map +1 -0
- package/dist/output/utils/ansi.d.ts +8 -0
- package/dist/output/utils/ansi.d.ts.map +1 -0
- package/dist/output/utils/ansi.js +17 -0
- package/dist/output/utils/ansi.js.map +1 -0
- package/dist/output/utils/patch.d.ts +57 -0
- package/dist/output/utils/patch.d.ts.map +1 -0
- package/dist/output/utils/patch.js +113 -0
- package/dist/output/utils/patch.js.map +1 -0
- package/dist/pipeline/agent-pipeline.d.ts +28 -0
- package/dist/pipeline/agent-pipeline.d.ts.map +1 -0
- package/dist/pipeline/agent-pipeline.js +76 -0
- package/dist/pipeline/agent-pipeline.js.map +1 -0
- package/dist/routes/attachments.d.ts +3 -0
- package/dist/routes/attachments.d.ts.map +1 -0
- package/dist/routes/attachments.js +141 -0
- package/dist/routes/attachments.js.map +1 -0
- package/dist/routes/demo.d.ts +3 -0
- package/dist/routes/demo.d.ts.map +1 -0
- package/dist/routes/demo.js +152 -0
- package/dist/routes/demo.js.map +1 -0
- package/dist/routes/files.d.ts +3 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +313 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/filesystem.d.ts +3 -0
- package/dist/routes/filesystem.d.ts.map +1 -0
- package/dist/routes/filesystem.js +126 -0
- package/dist/routes/filesystem.js.map +1 -0
- package/dist/routes/git.d.ts +3 -0
- package/dist/routes/git.d.ts.map +1 -0
- package/dist/routes/git.js +170 -0
- package/dist/routes/git.js.map +1 -0
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +45 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/notifications.d.ts +10 -0
- package/dist/routes/notifications.d.ts.map +1 -0
- package/dist/routes/notifications.js +54 -0
- package/dist/routes/notifications.js.map +1 -0
- package/dist/routes/profiles.d.ts +12 -0
- package/dist/routes/profiles.d.ts.map +1 -0
- package/dist/routes/profiles.js +76 -0
- package/dist/routes/profiles.js.map +1 -0
- package/dist/routes/projects.d.ts +3 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +94 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/sessions.d.ts +12 -0
- package/dist/routes/sessions.d.ts.map +1 -0
- package/dist/routes/sessions.js +109 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/system.d.ts +3 -0
- package/dist/routes/system.d.ts.map +1 -0
- package/dist/routes/system.js +42 -0
- package/dist/routes/system.js.map +1 -0
- package/dist/routes/tasks.d.ts +3 -0
- package/dist/routes/tasks.d.ts.map +1 -0
- package/dist/routes/tasks.js +136 -0
- package/dist/routes/tasks.js.map +1 -0
- package/dist/routes/terminals.d.ts +3 -0
- package/dist/routes/terminals.d.ts.map +1 -0
- package/dist/routes/terminals.js +54 -0
- package/dist/routes/terminals.js.map +1 -0
- package/dist/routes/tunnel.d.ts +3 -0
- package/dist/routes/tunnel.d.ts.map +1 -0
- package/dist/routes/tunnel.js +36 -0
- package/dist/routes/tunnel.js.map +1 -0
- package/dist/routes/workspaces.d.ts +3 -0
- package/dist/routes/workspaces.d.ts.map +1 -0
- package/dist/routes/workspaces.js +171 -0
- package/dist/routes/workspaces.js.map +1 -0
- package/dist/services/commit-message.service.d.ts +32 -0
- package/dist/services/commit-message.service.d.ts.map +1 -0
- package/dist/services/commit-message.service.js +202 -0
- package/dist/services/commit-message.service.js.map +1 -0
- package/dist/services/notifications/feishu-channel.d.ts +9 -0
- package/dist/services/notifications/feishu-channel.d.ts.map +1 -0
- package/dist/services/notifications/feishu-channel.js +51 -0
- package/dist/services/notifications/feishu-channel.js.map +1 -0
- package/dist/services/notifications/index.d.ts +3 -0
- package/dist/services/notifications/index.d.ts.map +1 -0
- package/dist/services/notifications/index.js +2 -0
- package/dist/services/notifications/index.js.map +1 -0
- package/dist/services/notifications/notification.service.d.ts +10 -0
- package/dist/services/notifications/notification.service.d.ts.map +1 -0
- package/dist/services/notifications/notification.service.js +85 -0
- package/dist/services/notifications/notification.service.js.map +1 -0
- package/dist/services/notifications/os-channel.d.ts +8 -0
- package/dist/services/notifications/os-channel.d.ts.map +1 -0
- package/dist/services/notifications/os-channel.js +38 -0
- package/dist/services/notifications/os-channel.js.map +1 -0
- package/dist/services/notifications/types.d.ts +11 -0
- package/dist/services/notifications/types.d.ts.map +1 -0
- package/dist/services/notifications/types.js +2 -0
- package/dist/services/notifications/types.js.map +1 -0
- package/dist/services/project.service.d.ts +91 -0
- package/dist/services/project.service.d.ts.map +1 -0
- package/dist/services/project.service.js +138 -0
- package/dist/services/project.service.js.map +1 -0
- package/dist/services/session-manager.d.ts +164 -0
- package/dist/services/session-manager.d.ts.map +1 -0
- package/dist/services/session-manager.js +569 -0
- package/dist/services/session-manager.js.map +1 -0
- package/dist/services/task.service.d.ts +179 -0
- package/dist/services/task.service.d.ts.map +1 -0
- package/dist/services/task.service.js +281 -0
- package/dist/services/task.service.js.map +1 -0
- package/dist/services/terminal-manager.d.ts +64 -0
- package/dist/services/terminal-manager.d.ts.map +1 -0
- package/dist/services/terminal-manager.js +217 -0
- package/dist/services/terminal-manager.js.map +1 -0
- package/dist/services/tunnel.service.d.ts +16 -0
- package/dist/services/tunnel.service.d.ts.map +1 -0
- package/dist/services/tunnel.service.js +77 -0
- package/dist/services/tunnel.service.js.map +1 -0
- package/dist/services/workspace.service.d.ts +219 -0
- package/dist/services/workspace.service.d.ts.map +1 -0
- package/dist/services/workspace.service.js +351 -0
- package/dist/services/workspace.service.js.map +1 -0
- package/dist/socket/events.d.ts +2 -0
- package/dist/socket/events.d.ts.map +1 -0
- package/dist/socket/events.js +3 -0
- package/dist/socket/events.js.map +1 -0
- package/dist/socket/index.d.ts +20 -0
- package/dist/socket/index.d.ts.map +1 -0
- package/dist/socket/index.js +77 -0
- package/dist/socket/index.js.map +1 -0
- package/dist/socket/middleware/auth.d.ts +13 -0
- package/dist/socket/middleware/auth.d.ts.map +1 -0
- package/dist/socket/middleware/auth.js +29 -0
- package/dist/socket/middleware/auth.js.map +1 -0
- package/dist/socket/middleware/error-handler.d.ts +11 -0
- package/dist/socket/middleware/error-handler.d.ts.map +1 -0
- package/dist/socket/middleware/error-handler.js +39 -0
- package/dist/socket/middleware/error-handler.js.map +1 -0
- package/dist/socket/middleware/index.d.ts +3 -0
- package/dist/socket/middleware/index.d.ts.map +1 -0
- package/dist/socket/middleware/index.js +3 -0
- package/dist/socket/middleware/index.js.map +1 -0
- package/dist/socket/rooms.d.ts +30 -0
- package/dist/socket/rooms.d.ts.map +1 -0
- package/dist/socket/rooms.js +39 -0
- package/dist/socket/rooms.js.map +1 -0
- package/dist/socket/socket-gateway.d.ts +21 -0
- package/dist/socket/socket-gateway.d.ts.map +1 -0
- package/dist/socket/socket-gateway.js +173 -0
- package/dist/socket/socket-gateway.js.map +1 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +41 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/web/assets/AgentDemoPage-WdWEQtyU.js +1 -0
- package/dist/web/assets/DemoPage-C4Z_ftHI.js +4 -0
- package/dist/web/assets/NotificationSettingsPage-FrLfgt9y.js +1 -0
- package/dist/web/assets/ProfileSettingsPage-Cs93rTRr.js +3 -0
- package/dist/web/assets/ProjectKanbanPage-BmlRVfzo.js +75 -0
- package/dist/web/assets/ProjectKanbanPage-G5OQeJvU.css +1 -0
- package/dist/web/assets/api-client-CEBkg5lt.js +1 -0
- package/dist/web/assets/circle-alert-BEozlsMd.js +1 -0
- package/dist/web/assets/code-block-OCS4YCEC-CGgYYS4A.js +2 -0
- package/dist/web/assets/folder-picker-BP3x3phB.js +1 -0
- package/dist/web/assets/index-BuAijQvi.js +13 -0
- package/dist/web/assets/index-CxV866Yg.css +1 -0
- package/dist/web/assets/loader-circle-yEIqsdJ1.js +1 -0
- package/dist/web/assets/mermaid-NOHMQCX5-CIqtI2jF.js +123 -0
- package/dist/web/assets/mermaid-NOHMQCX5-lI9o3AWT.css +1 -0
- package/dist/web/assets/modal-BoX2RXaV.js +1 -0
- package/dist/web/assets/query-keys-BD_s_Etj.js +1 -0
- package/dist/web/assets/use-profiles-Rh8rBsAt.js +1 -0
- package/dist/web/index.html +14 -0
- package/dist/web/vite.svg +1 -0
- package/node_modules/@agent-tower/shared/dist/dev-port.d.ts +12 -0
- package/node_modules/@agent-tower/shared/dist/dev-port.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/dev-port.js +31 -0
- package/node_modules/@agent-tower/shared/dist/dev-port.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/index.d.ts +5 -0
- package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/index.js +5 -0
- package/node_modules/@agent-tower/shared/dist/index.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts +72 -0
- package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/log-adapter.js +144 -0
- package/node_modules/@agent-tower/shared/dist/log-adapter.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +133 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.js +32 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/socket/index.d.ts +2 -0
- package/node_modules/@agent-tower/shared/dist/socket/index.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/socket/index.js +2 -0
- package/node_modules/@agent-tower/shared/dist/socket/index.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/types.d.ts +168 -0
- package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/types.js +53 -0
- package/node_modules/@agent-tower/shared/dist/types.js.map +1 -0
- package/node_modules/@agent-tower/shared/package.json +38 -0
- package/package.json +46 -0
- package/prisma/schema.prisma +130 -0
- package/scripts/postinstall.js +120 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-BoX2RXaV.js","assets/index-BuAijQvi.js","assets/index-CxV866Yg.css","assets/api-client-CEBkg5lt.js","assets/folder-picker-BP3x3phB.js","assets/mermaid-NOHMQCX5-CIqtI2jF.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-yEIqsdJ1.js","assets/circle-alert-BEozlsMd.js","assets/query-keys-BD_s_Etj.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as io,q as $r,d as no,y as oo,u as Ae,r as R,n as ao,c as ue,R as J,z as gt,j as f,s as pt,S as Fe,C as st,i as ss,g as is,A as lo,B as co,L as Es,_ as ki}from"./index-BuAijQvi.js";import{Q as Ri,b as ho,c as uo,e as fo,d as po,f as vo,s as ks,g as Rs,w as mo,h as _o,a as Ue,q as ce,u as ot}from"./query-keys-BD_s_Etj.js";import{e as Ct,C as mr,i as ns,b as os,d as as,c as ls,j as cs,k as Ot,G as _r,u as Di,a as Ai,f as Li,T as Ti,P as Mi,h as ji,S as Ds}from"./mermaid-NOHMQCX5-CIqtI2jF.js";import{P as Kr,X as gr,M as br,T as Pi}from"./modal-BoX2RXaV.js";import{a as he,c as Ee,B as it}from"./api-client-CEBkg5lt.js";import{L as Je}from"./loader-circle-yEIqsdJ1.js";function As(e,t){const r=new Set(t);return e.filter(l=>!r.has(l))}function go(e,t,r){const l=e.slice(0);return l[t]=r,l}var bo=class extends io{#s;#e;#i;#n;#t;#r;#o;#a;#l;#c=[];constructor(e,t,r){super(),this.#s=e,this.#n=r,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,$r.batch(()=>{const r=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const v=l.map(d=>d.observer),x=v.map(d=>d.getCurrentResult()),C=r.length!==v.length,s=v.some((d,o)=>d!==r[o]),i=C||s,a=i?!0:x.some((d,o)=>{const p=this.#e[o];return!p||!no(d,p)});!i&&!a||(i&&(this.#c=l,this.#t=v),this.#e=x,this.hasListeners()&&(i&&(As(r,v).forEach(d=>{d.destroy()}),As(v,r).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const r=this.#d(e),l=r.map(x=>x.observer.getOptimisticResult(x.defaultedQueryOptions)),v=r.map(x=>x.defaultedQueryOptions.queryHash);return[l,x=>this.#u(x??l,t,v),()=>this.#h(l,r)]}#h(e,t){return t.map((r,l)=>{const v=e[l];return r.defaultedQueryOptions.notifyOnChangeProps?v:r.observer.trackResult(v,x=>{t.forEach(C=>{C.observer.trackProp(x)})})})}#u(e,t,r){if(t){const l=this.#l,v=r!==void 0&&l!==void 0&&(l.length!==r.length||r.some((x,C)=>x!==l[C]));return(!this.#r||this.#e!==this.#a||v||t!==this.#o)&&(this.#o=t,this.#a=this.#e,r!==void 0&&(this.#l=r),this.#r=oo(this.#r,t(e))),this.#r}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const v=l.options.queryHash;if(!v)return;const x=t.get(v);x?x.push(l):t.set(v,[l])});const r=[];return e.forEach(l=>{const v=this.#s.defaultQueryOptions(l),C=t.get(v.queryHash)?.shift()??new Ri(this.#s,v);r.push({defaultedQueryOptions:v,observer:C})}),r}#f(e,t){const r=this.#t.indexOf(e);r!==-1&&(this.#e=go(this.#e,r,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#r,t=this.#h(this.#e,this.#c),r=this.#u(t,this.#n?.combine);e!==r&&$r.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function So({queries:e,...t},r){const l=Ae(),v=ho(),x=uo(),C=R.useMemo(()=>e.map(_=>{const n=l.defaultQueryOptions(_);return n._optimisticResults=v?"isRestoring":"optimistic",n}),[e,l,v]);C.forEach(_=>{fo(_);const n=l.getQueryCache().get(_.queryHash);po(_,x,n)}),vo(x);const[s]=R.useState(()=>new bo(l,C,t)),[i,a,d]=s.getOptimisticResult(C,t.combine),o=!v&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(_=>o?s.subscribe($r.batchCalls(_)):ao,[s,o]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),R.useEffect(()=>{s.setQueries(C,t)},[C,t,s]);const S=i.some((_,n)=>ks(C[n],_))?i.flatMap((_,n)=>{const u=C[n];if(u){const c=new Ri(l,u);if(ks(u,_))return Rs(u,c,x);mo(_,v)&&Rs(u,c,x)}return[]}):[];if(S.length>0)throw Promise.all(S);const y=i.find((_,n)=>{const u=C[n];return u&&_o({result:_,errorResetBoundary:x,throwOnError:u.throwOnError,query:l.getQueryCache().get(u.queryHash),suspense:u.suspense})});if(y?.error)throw y.error;return a(d())}const xo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ni=ue("arrow-right",xo);const Co=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Oi=ue("arrow-up",Co);const yo=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ls=ue("circle-check-big",yo);const wo=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Sr=ue("code-xml",wo);const Eo=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ts=ue("copy",Eo);const ko=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Bi=ue("ellipsis-vertical",ko);const Ro=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],Do=ue("file-braces-corner",Ro);const Ao=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],qr=ue("file-code-corner",Ao);const Lo=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],To=ue("file-exclamation-point",Lo);const Mo=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ii=ue("file-text",Mo);const jo=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Po=ue("file",jo);const No=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Fi=ue("folder-open",No);const Oo=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Bo=ue("folder",Oo);const Io=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Fo=ue("gauge",Io);const Ho=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],zo=ue("git-branch",Ho);const Wo=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Uo=ue("git-fork",Wo);const $o=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Bt=ue("git-graph",$o);const Ko=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Hi=ue("git-merge",Ko);const qo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],hs=ue("image",qo);const Xo=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ms=ue("layers",Xo);const Yo=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Vo=ue("maximize",Yo);const Go=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Qo=ue("message-square",Go);const Zo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Jo=ue("panel-left-close",Zo);const ea=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],ta=ue("panel-left-open",ea);const ra=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],sa=ue("panel-right-close",ra);const ia=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],na=ue("panel-right-open",ia);const oa=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],nr=ue("play",oa);const aa=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],la=ue("refresh-cw",aa);const ca=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],ha=ue("shield",ca);const ua=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],or=ue("terminal",ua);const da=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],us=ue("triangle-alert",da);const fa=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],pa=ue("zoom-in",fa);const va=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ma=ue("zoom-out",va),xr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ds(e){return"nodeType"in e}function $e(e){var t,r;return e?yt(e)?e:ds(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function fs(e){const{Document:t}=$e(e);return e instanceof t}function Wt(e){return yt(e)?!1:e instanceof $e(e).HTMLElement}function zi(e){return e instanceof $e(e).SVGElement}function wt(e){return e?yt(e)?e.document:ds(e)?fs(e)?e:Wt(e)||zi(e)?e.ownerDocument:document:document:document}const nt=xr?R.useLayoutEffect:R.useEffect;function Cr(e){const t=R.useRef(e);return nt(()=>{t.current=e}),R.useCallback(function(){for(var r=arguments.length,l=new Array(r),v=0;v<r;v++)l[v]=arguments[v];return t.current==null?void 0:t.current(...l)},[])}function _a(){const e=R.useRef(null),t=R.useCallback((l,v)=>{e.current=setInterval(l,v)},[]),r=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function It(e,t){t===void 0&&(t=[e]);const r=R.useRef(e);return nt(()=>{r.current!==e&&(r.current=e)},t),r}function Ut(e,t){const r=R.useRef();return R.useMemo(()=>{const l=e(r.current);return r.current=l,l},[...t])}function ar(e){const t=Cr(e),r=R.useRef(null),l=R.useCallback(v=>{v!==r.current&&t?.(v,r.current),r.current=v},[]);return[r,l]}function lr(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let jr={};function yr(e,t){return R.useMemo(()=>{if(t)return t;const r=jr[e]==null?0:jr[e]+1;return jr[e]=r,e+"-"+r},[e,t])}function Wi(e){return function(t){for(var r=arguments.length,l=new Array(r>1?r-1:0),v=1;v<r;v++)l[v-1]=arguments[v];return l.reduce((x,C)=>{const s=Object.entries(C);for(const[i,a]of s){const d=x[i];d!=null&&(x[i]=d+e*a)}return x},{...t})}}const xt=Wi(1),cr=Wi(-1);function ga(e){return"clientX"in e&&"clientY"in e}function ps(e){if(!e)return!1;const{KeyboardEvent:t}=$e(e.target);return t&&e instanceof t}function ba(e){if(!e)return!1;const{TouchEvent:t}=$e(e.target);return t&&e instanceof t}function hr(e){if(ba(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return ga(e)?{x:e.clientX,y:e.clientY}:null}const Ft=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Ft.Translate.toString(e),Ft.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:l}=e;return t+" "+r+"ms "+l}}}),js="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Sa(e){return e.matches(js)?e:e.querySelector(js)}const xa={display:"none"};function Ca(e){let{id:t,value:r}=e;return J.createElement("div",{id:t,style:xa},r)}function ya(e){let{id:t,announcement:r,ariaLiveType:l="assertive"}=e;const v={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return J.createElement("div",{id:t,style:v,role:"status","aria-live":l,"aria-atomic":!0},r)}function wa(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const Ui=R.createContext(null);function Ea(e){const t=R.useContext(Ui);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ka(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:v,event:x}=l;e.forEach(C=>{var s;return(s=C[v])==null?void 0:s.call(C,x)})},[e]),t]}const Ra={draggable:`
|
|
3
|
+
To pick up a draggable item, press the space bar.
|
|
4
|
+
While dragging, use the arrow keys to move the item.
|
|
5
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
+
`},Da={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Aa(e){let{announcements:t=Da,container:r,hiddenTextDescribedById:l,screenReaderInstructions:v=Ra}=e;const{announce:x,announcement:C}=wa(),s=yr("DndLiveRegion"),[i,a]=R.useState(!1);if(R.useEffect(()=>{a(!0)},[]),Ea(R.useMemo(()=>({onDragStart(o){let{active:p}=o;x(t.onDragStart({active:p}))},onDragMove(o){let{active:p,over:S}=o;t.onDragMove&&x(t.onDragMove({active:p,over:S}))},onDragOver(o){let{active:p,over:S}=o;x(t.onDragOver({active:p,over:S}))},onDragEnd(o){let{active:p,over:S}=o;x(t.onDragEnd({active:p,over:S}))},onDragCancel(o){let{active:p,over:S}=o;x(t.onDragCancel({active:p,over:S}))}}),[x,t])),!i)return null;const d=J.createElement(J.Fragment,null,J.createElement(Ca,{id:l,value:v.draggable}),J.createElement(ya,{id:s,announcement:C}));return r?gt.createPortal(d,r):d}var je;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(je||(je={}));function ur(){}function La(e,t){return R.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ta(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return R.useMemo(()=>[...t].filter(l=>l!=null),[...t])}const tt=Object.freeze({x:0,y:0});function Ma(e,t){const r=hr(e);if(!r)return"0 0";const l={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return l.x+"% "+l.y+"%"}function ja(e,t){let{data:{value:r}}=e,{data:{value:l}}=t;return l-r}function Pa(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Na(e,t){const r=Math.max(t.top,e.top),l=Math.max(t.left,e.left),v=Math.min(t.left+t.width,e.left+e.width),x=Math.min(t.top+t.height,e.top+e.height),C=v-l,s=x-r;if(l<v&&r<x){const i=t.width*t.height,a=e.width*e.height,d=C*s,o=d/(i+a-d);return Number(o.toFixed(4))}return 0}const Oa=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:l}=e;const v=[];for(const x of l){const{id:C}=x,s=r.get(C);if(s){const i=Na(s,t);i>0&&v.push({id:C,data:{droppableContainer:x,value:i}})}}return v.sort(ja)};function Ba(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function $i(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:tt}function Ia(e){return function(r){for(var l=arguments.length,v=new Array(l>1?l-1:0),x=1;x<l;x++)v[x-1]=arguments[x];return v.reduce((C,s)=>({...C,top:C.top+e*s.y,bottom:C.bottom+e*s.y,left:C.left+e*s.x,right:C.right+e*s.x}),{...r})}}const Fa=Ia(1);function Ki(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Ha(e,t,r){const l=Ki(t);if(!l)return e;const{scaleX:v,scaleY:x,x:C,y:s}=l,i=e.left-C-(1-v)*parseFloat(r),a=e.top-s-(1-x)*parseFloat(r.slice(r.indexOf(" ")+1)),d=v?e.width/v:e.width,o=x?e.height/x:e.height;return{width:d,height:o,top:a,right:i+d,bottom:a+o,left:i}}const za={ignoreTransform:!1};function $t(e,t){t===void 0&&(t=za);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:a,transformOrigin:d}=$e(e).getComputedStyle(e);a&&(r=Ha(r,a,d))}const{top:l,left:v,width:x,height:C,bottom:s,right:i}=r;return{top:l,left:v,width:x,height:C,bottom:s,right:i}}function Ps(e){return $t(e,{ignoreTransform:!0})}function Wa(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Ua(e,t){return t===void 0&&(t=$e(e).getComputedStyle(e)),t.position==="fixed"}function $a(e,t){t===void 0&&(t=$e(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(v=>{const x=t[v];return typeof x=="string"?r.test(x):!1})}function vs(e,t){const r=[];function l(v){if(t!=null&&r.length>=t||!v)return r;if(fs(v)&&v.scrollingElement!=null&&!r.includes(v.scrollingElement))return r.push(v.scrollingElement),r;if(!Wt(v)||zi(v)||r.includes(v))return r;const x=$e(e).getComputedStyle(v);return v!==e&&$a(v,x)&&r.push(v),Ua(v,x)?r:l(v.parentNode)}return e?l(e):r}function qi(e){const[t]=vs(e,1);return t??null}function Pr(e){return!xr||!e?null:yt(e)?e:ds(e)?fs(e)||e===wt(e).scrollingElement?window:Wt(e)?e:null:null}function Xi(e){return yt(e)?e.scrollX:e.scrollLeft}function Yi(e){return yt(e)?e.scrollY:e.scrollTop}function Xr(e){return{x:Xi(e),y:Yi(e)}}var Ne;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ne||(Ne={}));function Vi(e){return!xr||!e?!1:e===document.scrollingElement}function Gi(e){const t={x:0,y:0},r=Vi(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},l={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},v=e.scrollTop<=t.y,x=e.scrollLeft<=t.x,C=e.scrollTop>=l.y,s=e.scrollLeft>=l.x;return{isTop:v,isLeft:x,isBottom:C,isRight:s,maxScroll:l,minScroll:t}}const Ka={x:.2,y:.2};function qa(e,t,r,l,v){let{top:x,left:C,right:s,bottom:i}=r;l===void 0&&(l=10),v===void 0&&(v=Ka);const{isTop:a,isBottom:d,isLeft:o,isRight:p}=Gi(e),S={x:0,y:0},y={x:0,y:0},_={height:t.height*v.y,width:t.width*v.x};return!a&&x<=t.top+_.height?(S.y=Ne.Backward,y.y=l*Math.abs((t.top+_.height-x)/_.height)):!d&&i>=t.bottom-_.height&&(S.y=Ne.Forward,y.y=l*Math.abs((t.bottom-_.height-i)/_.height)),!p&&s>=t.right-_.width?(S.x=Ne.Forward,y.x=l*Math.abs((t.right-_.width-s)/_.width)):!o&&C<=t.left+_.width&&(S.x=Ne.Backward,y.x=l*Math.abs((t.left+_.width-C)/_.width)),{direction:S,speed:y}}function Xa(e){if(e===document.scrollingElement){const{innerWidth:x,innerHeight:C}=window;return{top:0,left:0,right:x,bottom:C,width:x,height:C}}const{top:t,left:r,right:l,bottom:v}=e.getBoundingClientRect();return{top:t,left:r,right:l,bottom:v,width:e.clientWidth,height:e.clientHeight}}function Qi(e){return e.reduce((t,r)=>xt(t,Xr(r)),tt)}function Ya(e){return e.reduce((t,r)=>t+Xi(r),0)}function Va(e){return e.reduce((t,r)=>t+Yi(r),0)}function Zi(e,t){if(t===void 0&&(t=$t),!e)return;const{top:r,left:l,bottom:v,right:x}=t(e);qi(e)&&(v<=0||x<=0||r>=window.innerHeight||l>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ga=[["x",["left","right"],Ya],["y",["top","bottom"],Va]];class ms{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const l=vs(r),v=Qi(l);this.rect={...t},this.width=t.width,this.height=t.height;for(const[x,C,s]of Ga)for(const i of C)Object.defineProperty(this,i,{get:()=>{const a=s(l),d=v[x]-a;return this.rect[i]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Tt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var l;return(l=this.target)==null?void 0:l.removeEventListener(...r)})},this.target=t}add(t,r,l){var v;(v=this.target)==null||v.addEventListener(t,r,l),this.listeners.push([t,r,l])}}function Qa(e){const{EventTarget:t}=$e(e);return e instanceof t?e:wt(e)}function Nr(e,t){const r=Math.abs(e.x),l=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+l**2)>t:"x"in t&&"y"in t?r>t.x&&l>t.y:"x"in t?r>t.x:"y"in t?l>t.y:!1}var Ge;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ge||(Ge={}));function Ns(e){e.preventDefault()}function Za(e){e.stopPropagation()}var ge;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ge||(ge={}));const Ji={start:[ge.Space,ge.Enter],cancel:[ge.Esc],end:[ge.Space,ge.Enter,ge.Tab]},Ja=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case ge.Right:return{...r,x:r.x+25};case ge.Left:return{...r,x:r.x-25};case ge.Down:return{...r,y:r.y+25};case ge.Up:return{...r,y:r.y-25}}};class en{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Tt(wt(r)),this.windowListeners=new Tt($e(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ge.Resize,this.handleCancel),this.windowListeners.add(Ge.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ge.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,l=t.node.current;l&&Zi(l),r(tt)}handleKeyDown(t){if(ps(t)){const{active:r,context:l,options:v}=this.props,{keyboardCodes:x=Ji,coordinateGetter:C=Ja,scrollBehavior:s="smooth"}=v,{code:i}=t;if(x.end.includes(i)){this.handleEnd(t);return}if(x.cancel.includes(i)){this.handleCancel(t);return}const{collisionRect:a}=l.current,d=a?{x:a.left,y:a.top}:tt;this.referenceCoordinates||(this.referenceCoordinates=d);const o=C(t,{active:r,context:l.current,currentCoordinates:d});if(o){const p=cr(o,d),S={x:0,y:0},{scrollableAncestors:y}=l.current;for(const _ of y){const n=t.code,{isTop:u,isRight:c,isLeft:h,isBottom:m,maxScroll:b,minScroll:w}=Gi(_),k=Xa(_),g={x:Math.min(n===ge.Right?k.right-k.width/2:k.right,Math.max(n===ge.Right?k.left:k.left+k.width/2,o.x)),y:Math.min(n===ge.Down?k.bottom-k.height/2:k.bottom,Math.max(n===ge.Down?k.top:k.top+k.height/2,o.y))},E=n===ge.Right&&!c||n===ge.Left&&!h,L=n===ge.Down&&!m||n===ge.Up&&!u;if(E&&g.x!==o.x){const T=_.scrollLeft+p.x,M=n===ge.Right&&T<=b.x||n===ge.Left&&T>=w.x;if(M&&!p.y){_.scrollTo({left:T,behavior:s});return}M?S.x=_.scrollLeft-T:S.x=n===ge.Right?_.scrollLeft-b.x:_.scrollLeft-w.x,S.x&&_.scrollBy({left:-S.x,behavior:s});break}else if(L&&g.y!==o.y){const T=_.scrollTop+p.y,M=n===ge.Down&&T<=b.y||n===ge.Up&&T>=w.y;if(M&&!p.x){_.scrollTo({top:T,behavior:s});return}M?S.y=_.scrollTop-T:S.y=n===ge.Down?_.scrollTop-b.y:_.scrollTop-w.y,S.y&&_.scrollBy({top:-S.y,behavior:s});break}}this.handleMove(t,xt(cr(o,this.referenceCoordinates),S))}}}handleMove(t,r){const{onMove:l}=this.props;t.preventDefault(),l(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}en.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:l=Ji,onActivation:v}=t,{active:x}=r;const{code:C}=e.nativeEvent;if(l.start.includes(C)){const s=x.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),v?.({event:e.nativeEvent}),!0)}return!1}}];function Os(e){return!!(e&&"distance"in e)}function Bs(e){return!!(e&&"delay"in e)}class _s{constructor(t,r,l){var v;l===void 0&&(l=Qa(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:x}=t,{target:C}=x;this.props=t,this.events=r,this.document=wt(C),this.documentListeners=new Tt(this.document),this.listeners=new Tt(l),this.windowListeners=new Tt($e(C)),this.initialCoordinates=(v=hr(x))!=null?v:tt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:l}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ge.Resize,this.handleCancel),this.windowListeners.add(Ge.DragStart,Ns),this.windowListeners.add(Ge.VisibilityChange,this.handleCancel),this.windowListeners.add(Ge.ContextMenu,Ns),this.documentListeners.add(Ge.Keydown,this.handleKeydown),r){if(l!=null&&l({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Bs(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Os(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:l,onPending:v}=this.props;v(l,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ge.Click,Za,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ge.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:l,initialCoordinates:v,props:x}=this,{onMove:C,options:{activationConstraint:s}}=x;if(!v)return;const i=(r=hr(t))!=null?r:tt,a=cr(v,i);if(!l&&s){if(Os(s)){if(s.tolerance!=null&&Nr(a,s.tolerance))return this.handleCancel();if(Nr(a,s.distance))return this.handleStart()}if(Bs(s)&&Nr(a,s.tolerance))return this.handleCancel();this.handlePending(s,a);return}t.cancelable&&t.preventDefault(),C(i)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ge.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const el={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class gs extends _s{constructor(t){const{event:r}=t,l=wt(r.target);super(t,el,l)}}gs.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:l}=t;return!r.isPrimary||r.button!==0?!1:(l?.({event:r}),!0)}}];const tl={move:{name:"mousemove"},end:{name:"mouseup"}};var Yr;(function(e){e[e.RightClick=2]="RightClick"})(Yr||(Yr={}));class rl extends _s{constructor(t){super(t,tl,wt(t.event.target))}}rl.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:l}=t;return r.button===Yr.RightClick?!1:(l?.({event:r}),!0)}}];const Or={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class sl extends _s{constructor(t){super(t,Or)}static setup(){return window.addEventListener(Or.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Or.move.name,t)};function t(){}}}sl.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:l}=t;const{touches:v}=r;return v.length>1?!1:(l?.({event:r}),!0)}}];var Mt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Mt||(Mt={}));var dr;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(dr||(dr={}));function il(e){let{acceleration:t,activator:r=Mt.Pointer,canScroll:l,draggingRect:v,enabled:x,interval:C=5,order:s=dr.TreeOrder,pointerCoordinates:i,scrollableAncestors:a,scrollableAncestorRects:d,delta:o,threshold:p}=e;const S=ol({delta:o,disabled:!x}),[y,_]=_a(),n=R.useRef({x:0,y:0}),u=R.useRef({x:0,y:0}),c=R.useMemo(()=>{switch(r){case Mt.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Mt.DraggableRect:return v}},[r,v,i]),h=R.useRef(null),m=R.useCallback(()=>{const w=h.current;if(!w)return;const k=n.current.x*u.current.x,g=n.current.y*u.current.y;w.scrollBy(k,g)},[]),b=R.useMemo(()=>s===dr.TreeOrder?[...a].reverse():a,[s,a]);R.useEffect(()=>{if(!x||!a.length||!c){_();return}for(const w of b){if(l?.(w)===!1)continue;const k=a.indexOf(w),g=d[k];if(!g)continue;const{direction:E,speed:L}=qa(w,g,c,t,p);for(const T of["x","y"])S[T][E[T]]||(L[T]=0,E[T]=0);if(L.x>0||L.y>0){_(),h.current=w,y(m,C),n.current=L,u.current=E;return}}n.current={x:0,y:0},u.current={x:0,y:0},_()},[t,m,l,_,x,C,JSON.stringify(c),JSON.stringify(S),y,a,b,d,JSON.stringify(p)])}const nl={x:{[Ne.Backward]:!1,[Ne.Forward]:!1},y:{[Ne.Backward]:!1,[Ne.Forward]:!1}};function ol(e){let{delta:t,disabled:r}=e;const l=lr(t);return Ut(v=>{if(r||!l||!v)return nl;const x={x:Math.sign(t.x-l.x),y:Math.sign(t.y-l.y)};return{x:{[Ne.Backward]:v.x[Ne.Backward]||x.x===-1,[Ne.Forward]:v.x[Ne.Forward]||x.x===1},y:{[Ne.Backward]:v.y[Ne.Backward]||x.y===-1,[Ne.Forward]:v.y[Ne.Forward]||x.y===1}}},[r,t,l])}function al(e,t){const r=t!=null?e.get(t):void 0,l=r?r.node.current:null;return Ut(v=>{var x;return t==null?null:(x=l??v)!=null?x:null},[l,t])}function ll(e,t){return R.useMemo(()=>e.reduce((r,l)=>{const{sensor:v}=l,x=v.activators.map(C=>({eventName:C.eventName,handler:t(C.handler,l)}));return[...r,...x]},[]),[e,t])}var Ht;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ht||(Ht={}));var Vr;(function(e){e.Optimized="optimized"})(Vr||(Vr={}));const Is=new Map;function cl(e,t){let{dragging:r,dependencies:l,config:v}=t;const[x,C]=R.useState(null),{frequency:s,measure:i,strategy:a}=v,d=R.useRef(e),o=n(),p=It(o),S=R.useCallback(function(u){u===void 0&&(u=[]),!p.current&&C(c=>c===null?u:c.concat(u.filter(h=>!c.includes(h))))},[p]),y=R.useRef(null),_=Ut(u=>{if(o&&!r)return Is;if(!u||u===Is||d.current!==e||x!=null){const c=new Map;for(let h of e){if(!h)continue;if(x&&x.length>0&&!x.includes(h.id)&&h.rect.current){c.set(h.id,h.rect.current);continue}const m=h.node.current,b=m?new ms(i(m),m):null;h.rect.current=b,b&&c.set(h.id,b)}return c}return u},[e,x,r,o,i]);return R.useEffect(()=>{d.current=e},[e]),R.useEffect(()=>{o||S()},[r,o]),R.useEffect(()=>{x&&x.length>0&&C(null)},[JSON.stringify(x)]),R.useEffect(()=>{o||typeof s!="number"||y.current!==null||(y.current=setTimeout(()=>{S(),y.current=null},s))},[s,o,S,...l]),{droppableRects:_,measureDroppableContainers:S,measuringScheduled:x!=null};function n(){switch(a){case Ht.Always:return!1;case Ht.BeforeDragging:return r;default:return!r}}}function bs(e,t){return Ut(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function hl(e,t){return bs(e,t)}function ul(e){let{callback:t,disabled:r}=e;const l=Cr(t),v=R.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:x}=window;return new x(l)},[l,r]);return R.useEffect(()=>()=>v?.disconnect(),[v]),v}function wr(e){let{callback:t,disabled:r}=e;const l=Cr(t),v=R.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:x}=window;return new x(l)},[r]);return R.useEffect(()=>()=>v?.disconnect(),[v]),v}function dl(e){return new ms($t(e),e)}function Fs(e,t,r){t===void 0&&(t=dl);const[l,v]=R.useState(null);function x(){v(i=>{if(!e)return null;if(e.isConnected===!1){var a;return(a=i??r)!=null?a:null}const d=t(e);return JSON.stringify(i)===JSON.stringify(d)?i:d})}const C=ul({callback(i){if(e)for(const a of i){const{type:d,target:o}=a;if(d==="childList"&&o instanceof HTMLElement&&o.contains(e)){x();break}}}}),s=wr({callback:x});return nt(()=>{x(),e?(s?.observe(e),C?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),C?.disconnect())},[e]),l}function fl(e){const t=bs(e);return $i(e,t)}const Hs=[];function pl(e){const t=R.useRef(e),r=Ut(l=>e?l&&l!==Hs&&e&&t.current&&e.parentNode===t.current.parentNode?l:vs(e):Hs,[e]);return R.useEffect(()=>{t.current=e},[e]),r}function vl(e){const[t,r]=R.useState(null),l=R.useRef(e),v=R.useCallback(x=>{const C=Pr(x.target);C&&r(s=>s?(s.set(C,Xr(C)),new Map(s)):null)},[]);return R.useEffect(()=>{const x=l.current;if(e!==x){C(x);const s=e.map(i=>{const a=Pr(i);return a?(a.addEventListener("scroll",v,{passive:!0}),[a,Xr(a)]):null}).filter(i=>i!=null);r(s.length?new Map(s):null),l.current=e}return()=>{C(e),C(x)};function C(s){s.forEach(i=>{const a=Pr(i);a?.removeEventListener("scroll",v)})}},[v,e]),R.useMemo(()=>e.length?t?Array.from(t.values()).reduce((x,C)=>xt(x,C),tt):Qi(e):tt,[e,t])}function zs(e,t){t===void 0&&(t=[]);const r=R.useRef(null);return R.useEffect(()=>{r.current=null},t),R.useEffect(()=>{const l=e!==tt;l&&!r.current&&(r.current=e),!l&&r.current&&(r.current=null)},[e]),r.current?cr(e,r.current):tt}function ml(e){R.useEffect(()=>{if(!xr)return;const t=e.map(r=>{let{sensor:l}=r;return l.setup==null?void 0:l.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function _l(e,t){return R.useMemo(()=>e.reduce((r,l)=>{let{eventName:v,handler:x}=l;return r[v]=C=>{x(C,t)},r},{}),[e,t])}function tn(e){return R.useMemo(()=>e?Wa(e):null,[e])}const Ws=[];function gl(e,t){t===void 0&&(t=$t);const[r]=e,l=tn(r?$e(r):null),[v,x]=R.useState(Ws);function C(){x(()=>e.length?e.map(i=>Vi(i)?l:new ms(t(i),i)):Ws)}const s=wr({callback:C});return nt(()=>{s?.disconnect(),C(),e.forEach(i=>s?.observe(i))},[e]),v}function rn(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Wt(t)?t:e}function bl(e){let{measure:t}=e;const[r,l]=R.useState(null),v=R.useCallback(a=>{for(const{target:d}of a)if(Wt(d)){l(o=>{const p=t(d);return o?{...o,width:p.width,height:p.height}:p});break}},[t]),x=wr({callback:v}),C=R.useCallback(a=>{const d=rn(a);x?.disconnect(),d&&x?.observe(d),l(d?t(d):null)},[t,x]),[s,i]=ar(C);return R.useMemo(()=>({nodeRef:s,rect:r,setRef:i}),[r,s,i])}const Sl=[{sensor:gs,options:{}},{sensor:en,options:{}}],xl={current:{}},ir={draggable:{measure:Ps},droppable:{measure:Ps,strategy:Ht.WhileDragging,frequency:Vr.Optimized},dragOverlay:{measure:$t}};class jt extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,l;return(r=(l=this.get(t))==null?void 0:l.node.current)!=null?r:void 0}}const Cl={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new jt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ur},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ir,measureDroppableContainers:ur,windowRect:null,measuringScheduled:!1},sn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ur,draggableNodes:new Map,over:null,measureDroppableContainers:ur},Kt=R.createContext(sn),nn=R.createContext(Cl);function yl(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new jt}}}function wl(e,t){switch(t.type){case je.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case je.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case je.DragEnd:case je.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case je.RegisterDroppable:{const{element:r}=t,{id:l}=r,v=new jt(e.droppable.containers);return v.set(l,r),{...e,droppable:{...e.droppable,containers:v}}}case je.SetDroppableDisabled:{const{id:r,key:l,disabled:v}=t,x=e.droppable.containers.get(r);if(!x||l!==x.key)return e;const C=new jt(e.droppable.containers);return C.set(r,{...x,disabled:v}),{...e,droppable:{...e.droppable,containers:C}}}case je.UnregisterDroppable:{const{id:r,key:l}=t,v=e.droppable.containers.get(r);if(!v||l!==v.key)return e;const x=new jt(e.droppable.containers);return x.delete(r),{...e,droppable:{...e.droppable,containers:x}}}default:return e}}function El(e){let{disabled:t}=e;const{active:r,activatorEvent:l,draggableNodes:v}=R.useContext(Kt),x=lr(l),C=lr(r?.id);return R.useEffect(()=>{if(!t&&!l&&x&&C!=null){if(!ps(x)||document.activeElement===x.target)return;const s=v.get(C);if(!s)return;const{activatorNode:i,node:a}=s;if(!i.current&&!a.current)return;requestAnimationFrame(()=>{for(const d of[i.current,a.current]){if(!d)continue;const o=Sa(d);if(o){o.focus();break}}})}},[l,t,v,C,x]),null}function on(e,t){let{transform:r,...l}=t;return e!=null&&e.length?e.reduce((v,x)=>x({transform:v,...l}),r):r}function kl(e){return R.useMemo(()=>({draggable:{...ir.draggable,...e?.draggable},droppable:{...ir.droppable,...e?.droppable},dragOverlay:{...ir.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Rl(e){let{activeNode:t,measure:r,initialRect:l,config:v=!0}=e;const x=R.useRef(!1),{x:C,y:s}=typeof v=="boolean"?{x:v,y:v}:v;nt(()=>{if(!C&&!s||!t){x.current=!1;return}if(x.current||!l)return;const a=t?.node.current;if(!a||a.isConnected===!1)return;const d=r(a),o=$i(d,l);if(C||(o.x=0),s||(o.y=0),x.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const p=qi(a);p&&p.scrollBy({top:o.y,left:o.x})}},[t,C,s,l,r])}const Er=R.createContext({...tt,scaleX:1,scaleY:1});var at;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(at||(at={}));const Dl=R.memo(function(t){var r,l,v,x;let{id:C,accessibility:s,autoScroll:i=!0,children:a,sensors:d=Sl,collisionDetection:o=Oa,measuring:p,modifiers:S,...y}=t;const _=R.useReducer(wl,void 0,yl),[n,u]=_,[c,h]=ka(),[m,b]=R.useState(at.Uninitialized),w=m===at.Initialized,{draggable:{active:k,nodes:g,translate:E},droppable:{containers:L}}=n,T=k!=null?g.get(k):null,M=R.useRef({initial:null,translated:null}),P=R.useMemo(()=>{var Pe;return k!=null?{id:k,data:(Pe=T?.data)!=null?Pe:xl,rect:M}:null},[k,T]),B=R.useRef(null),[F,W]=R.useState(null),[H,D]=R.useState(null),j=It(y,Object.values(y)),N=yr("DndDescribedBy",C),O=R.useMemo(()=>L.getEnabled(),[L]),$=kl(p),{droppableRects:Y,measureDroppableContainers:V,measuringScheduled:Q}=cl(O,{dragging:w,dependencies:[E.x,E.y],config:$.droppable}),re=al(g,k),A=R.useMemo(()=>H?hr(H):null,[H]),I=Tr(),U=hl(re,$.draggable.measure);Rl({activeNode:k!=null?g.get(k):null,config:I.layoutShiftCompensation,initialRect:U,measure:$.draggable.measure});const z=Fs(re,$.draggable.measure,U),Z=Fs(re?re.parentElement:null),G=R.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:g,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=L.getNodeFor((r=G.current.over)==null?void 0:r.id),le=bl({measure:$.dragOverlay.measure}),de=(l=le.nodeRef.current)!=null?l:re,ve=w?(v=le.rect)!=null?v:z:null,ee=!!(le.nodeRef.current&&le.rect),ke=fl(ee?null:z),Be=tn(de?$e(de):null),Te=pl(w?ie??re:null),Se=gl(Te),Ie=on(S,{transform:{x:E.x-ke.x,y:E.y-ke.y,scaleX:1,scaleY:1},activatorEvent:H,active:P,activeNodeRect:z,containerNodeRect:Z,draggingNodeRect:ve,over:G.current.over,overlayNodeRect:le.rect,scrollableAncestors:Te,scrollableAncestorRects:Se,windowRect:Be}),Re=A?xt(A,E):null,K=vl(Te),q=zs(K),te=zs(K,[z]),me=xt(Ie,q),oe=ve?Fa(ve,Ie):null,ye=P&&oe?o({active:P,collisionRect:oe,droppableRects:Y,droppableContainers:O,pointerCoordinates:Re}):null,xe=Pa(ye,"id"),[De,fe]=R.useState(null),dt=ee?Ie:xt(Ie,te),Et=Ba(dt,(x=De?.rect)!=null?x:null,z),_t=R.useRef(null),Vt=R.useCallback((Pe,He)=>{let{sensor:Oe,options:Ye}=He;if(B.current==null)return;const Ke=g.get(B.current);if(!Ke)return;const ze=Pe.nativeEvent,Ve=new Oe({active:B.current,activeNode:Ke,event:ze,options:Ye,context:G,onAbort(X){if(!g.get(X))return;const{onDragAbort:_e}=j.current,pe={id:X};_e?.(pe),c({type:"onDragAbort",event:pe})},onPending(X,se,_e,pe){if(!g.get(X))return;const{onDragPending:We}=j.current,qe={id:X,constraint:se,initialCoordinates:_e,offset:pe};We?.(qe),c({type:"onDragPending",event:qe})},onStart(X){const se=B.current;if(se==null)return;const _e=g.get(se);if(!_e)return;const{onDragStart:pe}=j.current,Me={activatorEvent:ze,active:{id:se,data:_e.data,rect:M}};gt.unstable_batchedUpdates(()=>{pe?.(Me),b(at.Initializing),u({type:je.DragStart,initialCoordinates:X,active:se}),c({type:"onDragStart",event:Me}),W(_t.current),D(ze)})},onMove(X){u({type:je.DragMove,coordinates:X})},onEnd:rt(je.DragEnd),onCancel:rt(je.DragCancel)});_t.current=Ve;function rt(X){return async function(){const{active:_e,collisions:pe,over:Me,scrollAdjustedTranslate:We}=G.current;let qe=null;if(_e&&We){const{cancelDrop:Rt}=j.current;qe={activatorEvent:ze,active:_e,collisions:pe,delta:We,over:Me},X===je.DragEnd&&typeof Rt=="function"&&await Promise.resolve(Rt(qe))&&(X=je.DragCancel)}B.current=null,gt.unstable_batchedUpdates(()=>{u({type:X}),b(at.Uninitialized),fe(null),W(null),D(null),_t.current=null;const Rt=X===je.DragEnd?"onDragEnd":"onDragCancel";if(qe){const Mr=j.current[Rt];Mr?.(qe),c({type:Rt,event:qe})}})}}},[g]),Lr=R.useCallback((Pe,He)=>(Oe,Ye)=>{const Ke=Oe.nativeEvent,ze=g.get(Ye);if(B.current!==null||!ze||Ke.dndKit||Ke.defaultPrevented)return;const Ve={active:ze};Pe(Oe,He.options,Ve)===!0&&(Ke.dndKit={capturedBy:He.sensor},B.current=Ye,Vt(Oe,He))},[g,Vt]),Gt=ll(d,Lr);ml(d),nt(()=>{z&&m===at.Initializing&&b(at.Initialized)},[z,m]),R.useEffect(()=>{const{onDragMove:Pe}=j.current,{active:He,activatorEvent:Oe,collisions:Ye,over:Ke}=G.current;if(!He||!Oe)return;const ze={active:He,activatorEvent:Oe,collisions:Ye,delta:{x:me.x,y:me.y},over:Ke};gt.unstable_batchedUpdates(()=>{Pe?.(ze),c({type:"onDragMove",event:ze})})},[me.x,me.y]),R.useEffect(()=>{const{active:Pe,activatorEvent:He,collisions:Oe,droppableContainers:Ye,scrollAdjustedTranslate:Ke}=G.current;if(!Pe||B.current==null||!He||!Ke)return;const{onDragOver:ze}=j.current,Ve=Ye.get(xe),rt=Ve&&Ve.rect.current?{id:Ve.id,rect:Ve.rect.current,data:Ve.data,disabled:Ve.disabled}:null,X={active:Pe,activatorEvent:He,collisions:Oe,delta:{x:Ke.x,y:Ke.y},over:rt};gt.unstable_batchedUpdates(()=>{fe(rt),ze?.(X),c({type:"onDragOver",event:X})})},[xe]),nt(()=>{G.current={activatorEvent:H,active:P,activeNode:re,collisionRect:oe,collisions:ye,droppableRects:Y,draggableNodes:g,draggingNode:de,draggingNodeRect:ve,droppableContainers:L,over:De,scrollableAncestors:Te,scrollAdjustedTranslate:me},M.current={initial:ve,translated:oe}},[P,re,ye,oe,g,de,ve,Y,L,De,Te,me]),il({...I,delta:E,draggingRect:oe,pointerCoordinates:Re,scrollableAncestors:Te,scrollableAncestorRects:Se});const Qt=R.useMemo(()=>({active:P,activeNode:re,activeNodeRect:z,activatorEvent:H,collisions:ye,containerNodeRect:Z,dragOverlay:le,draggableNodes:g,droppableContainers:L,droppableRects:Y,over:De,measureDroppableContainers:V,scrollableAncestors:Te,scrollableAncestorRects:Se,measuringConfiguration:$,measuringScheduled:Q,windowRect:Be}),[P,re,z,H,ye,Z,le,g,L,Y,De,V,Te,Se,$,Q,Be]),kt=R.useMemo(()=>({activatorEvent:H,activators:Gt,active:P,activeNodeRect:z,ariaDescribedById:{draggable:N},dispatch:u,draggableNodes:g,over:De,measureDroppableContainers:V}),[H,Gt,P,z,u,N,g,De,V]);return J.createElement(Ui.Provider,{value:h},J.createElement(Kt.Provider,{value:kt},J.createElement(nn.Provider,{value:Qt},J.createElement(Er.Provider,{value:Et},a)),J.createElement(El,{disabled:s?.restoreFocus===!1})),J.createElement(Aa,{...s,hiddenTextDescribedById:N}));function Tr(){const Pe=F?.autoScrollEnabled===!1,He=typeof i=="object"?i.enabled===!1:i===!1,Oe=w&&!Pe&&!He;return typeof i=="object"?{...i,enabled:Oe}:{enabled:Oe}}}),Al=R.createContext(null),Us="button",Ll="Draggable";function Tl(e){let{id:t,data:r,disabled:l=!1,attributes:v}=e;const x=yr(Ll),{activators:C,activatorEvent:s,active:i,activeNodeRect:a,ariaDescribedById:d,draggableNodes:o,over:p}=R.useContext(Kt),{role:S=Us,roleDescription:y="draggable",tabIndex:_=0}=v??{},n=i?.id===t,u=R.useContext(n?Er:Al),[c,h]=ar(),[m,b]=ar(),w=_l(C,t),k=It(r);nt(()=>(o.set(t,{id:t,key:x,node:c,activatorNode:m,data:k}),()=>{const E=o.get(t);E&&E.key===x&&o.delete(t)}),[o,t]);const g=R.useMemo(()=>({role:S,tabIndex:_,"aria-disabled":l,"aria-pressed":n&&S===Us?!0:void 0,"aria-roledescription":y,"aria-describedby":d.draggable}),[l,S,_,n,y,d.draggable]);return{active:i,activatorEvent:s,activeNodeRect:a,attributes:g,isDragging:n,listeners:l?void 0:w,node:c,over:p,setNodeRef:h,setActivatorNodeRef:b,transform:u}}function Ml(){return R.useContext(nn)}const jl="Droppable",Pl={timeout:25};function Nl(e){let{data:t,disabled:r=!1,id:l,resizeObserverConfig:v}=e;const x=yr(jl),{active:C,dispatch:s,over:i,measureDroppableContainers:a}=R.useContext(Kt),d=R.useRef({disabled:r}),o=R.useRef(!1),p=R.useRef(null),S=R.useRef(null),{disabled:y,updateMeasurementsFor:_,timeout:n}={...Pl,...v},u=It(_??l),c=R.useCallback(()=>{if(!o.current){o.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{a(Array.isArray(u.current)?u.current:[u.current]),S.current=null},n)},[n]),h=wr({callback:c,disabled:y||!C}),m=R.useCallback((g,E)=>{h&&(E&&(h.unobserve(E),o.current=!1),g&&h.observe(g))},[h]),[b,w]=ar(m),k=It(t);return R.useEffect(()=>{!h||!b.current||(h.disconnect(),o.current=!1,h.observe(b.current))},[b,h]),R.useEffect(()=>(s({type:je.RegisterDroppable,element:{id:l,key:x,disabled:r,node:b,rect:p,data:k}}),()=>s({type:je.UnregisterDroppable,key:x,id:l})),[l]),R.useEffect(()=>{r!==d.current.disabled&&(s({type:je.SetDroppableDisabled,id:l,key:x,disabled:r}),d.current.disabled=r)},[l,x,r,s]),{active:C,rect:p,isOver:i?.id===l,node:b,over:i,setNodeRef:w}}function Ol(e){let{animation:t,children:r}=e;const[l,v]=R.useState(null),[x,C]=R.useState(null),s=lr(r);return!r&&!l&&s&&v(s),nt(()=>{if(!x)return;const i=l?.key,a=l?.props.id;if(i==null||a==null){v(null);return}Promise.resolve(t(a,x)).then(()=>{v(null)})},[t,l,x]),J.createElement(J.Fragment,null,r,l?R.cloneElement(l,{ref:C}):null)}const Bl={x:0,y:0,scaleX:1,scaleY:1};function Il(e){let{children:t}=e;return J.createElement(Kt.Provider,{value:sn},J.createElement(Er.Provider,{value:Bl},t))}const Fl={position:"fixed",touchAction:"none"},Hl=e=>ps(e)?"transform 250ms ease":void 0,zl=R.forwardRef((e,t)=>{let{as:r,activatorEvent:l,adjustScale:v,children:x,className:C,rect:s,style:i,transform:a,transition:d=Hl}=e;if(!s)return null;const o=v?a:{...a,scaleX:1,scaleY:1},p={...Fl,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ft.Transform.toString(o),transformOrigin:v&&l?Ma(l,s):void 0,transition:typeof d=="function"?d(l):d,...i};return J.createElement(r,{className:C,style:p,ref:t},x)}),Wl=e=>t=>{let{active:r,dragOverlay:l}=t;const v={},{styles:x,className:C}=e;if(x!=null&&x.active)for(const[s,i]of Object.entries(x.active))i!==void 0&&(v[s]=r.node.style.getPropertyValue(s),r.node.style.setProperty(s,i));if(x!=null&&x.dragOverlay)for(const[s,i]of Object.entries(x.dragOverlay))i!==void 0&&l.node.style.setProperty(s,i);return C!=null&&C.active&&r.node.classList.add(C.active),C!=null&&C.dragOverlay&&l.node.classList.add(C.dragOverlay),function(){for(const[i,a]of Object.entries(v))r.node.style.setProperty(i,a);C!=null&&C.active&&r.node.classList.remove(C.active)}},Ul=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Ft.Transform.toString(t)},{transform:Ft.Transform.toString(r)}]},$l={duration:250,easing:"ease",keyframes:Ul,sideEffects:Wl({styles:{active:{opacity:"0"}}})};function Kl(e){let{config:t,draggableNodes:r,droppableContainers:l,measuringConfiguration:v}=e;return Cr((x,C)=>{if(t===null)return;const s=r.get(x);if(!s)return;const i=s.node.current;if(!i)return;const a=rn(C);if(!a)return;const{transform:d}=$e(C).getComputedStyle(C),o=Ki(d);if(!o)return;const p=typeof t=="function"?t:ql(t);return Zi(i,v.draggable.measure),p({active:{id:x,data:s.data,node:i,rect:v.draggable.measure(i)},draggableNodes:r,dragOverlay:{node:C,rect:v.dragOverlay.measure(a)},droppableContainers:l,measuringConfiguration:v,transform:o})})}function ql(e){const{duration:t,easing:r,sideEffects:l,keyframes:v}={...$l,...e};return x=>{let{active:C,dragOverlay:s,transform:i,...a}=x;if(!t)return;const d={x:s.rect.left-C.rect.left,y:s.rect.top-C.rect.top},o={scaleX:i.scaleX!==1?C.rect.width*i.scaleX/s.rect.width:1,scaleY:i.scaleY!==1?C.rect.height*i.scaleY/s.rect.height:1},p={x:i.x-d.x,y:i.y-d.y,...o},S=v({...a,active:C,dragOverlay:s,transform:{initial:i,final:p}}),[y]=S,_=S[S.length-1];if(JSON.stringify(y)===JSON.stringify(_))return;const n=l?.({active:C,dragOverlay:s,...a}),u=s.node.animate(S,{duration:t,easing:r,fill:"forwards"});return new Promise(c=>{u.onfinish=()=>{n?.(),c()}})}}let $s=0;function Xl(e){return R.useMemo(()=>{if(e!=null)return $s++,$s},[e])}const Yl=J.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:l,style:v,transition:x,modifiers:C,wrapperElement:s="div",className:i,zIndex:a=999}=e;const{activatorEvent:d,active:o,activeNodeRect:p,containerNodeRect:S,draggableNodes:y,droppableContainers:_,dragOverlay:n,over:u,measuringConfiguration:c,scrollableAncestors:h,scrollableAncestorRects:m,windowRect:b}=Ml(),w=R.useContext(Er),k=Xl(o?.id),g=on(C,{activatorEvent:d,active:o,activeNodeRect:p,containerNodeRect:S,draggingNodeRect:n.rect,over:u,overlayNodeRect:n.rect,scrollableAncestors:h,scrollableAncestorRects:m,transform:w,windowRect:b}),E=bs(p),L=Kl({config:l,draggableNodes:y,droppableContainers:_,measuringConfiguration:c}),T=E?n.setRef:void 0;return J.createElement(Il,null,J.createElement(Ol,{animation:L},o&&k?J.createElement(zl,{key:k,id:o.id,ref:T,as:s,activatorEvent:d,adjustScale:t,className:i,transition:x,rect:E,style:{zIndex:a,...v},transform:g},r):null))}),ne={Review:"Review",Running:"Running",Pending:"Pending",Done:"Done",Cancelled:"Cancelled"},Vl=[{status:ne.Review,label:"Review",icon:ns,color:"text-amber-600"},{status:ne.Running,label:"Running",icon:os,color:"text-blue-600"},{status:ne.Pending,label:"Pending",icon:as,color:"text-neutral-600"},{status:ne.Done,label:"Done",icon:ls,color:"text-emerald-600"},{status:ne.Cancelled,label:"Cancelled",icon:cs,color:"text-neutral-500"}];function Gl({task:e,status:t,isSelected:r,isAgentActive:l,project:v,onSelectTask:x,onTaskStatusChange:C,onDeleteTask:s}){const{attributes:i,listeners:a,setNodeRef:d,isDragging:o}=Tl({id:e.id,data:{task:e,fromStatus:t}}),[p,S]=R.useState(null),y=R.useRef(null),_=R.useCallback(n=>{!C&&!s||(n.preventDefault(),S({x:n.clientX,y:n.clientY}))},[C,s]);return R.useEffect(()=>{if(!p)return;const n=u=>{y.current&&!y.current.contains(u.target)&&S(null)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[p]),f.jsxs(f.Fragment,{children:[f.jsxs("button",{ref:d,onClick:()=>x(e.id),onContextMenu:_,className:`flex items-start pl-8 pr-4 py-2 text-sm w-full text-left transition-all border-l-2 group
|
|
7
|
+
${o?"opacity-30":""}
|
|
8
|
+
${r?"bg-neutral-100 border-neutral-800":"border-transparent hover:bg-neutral-50 hover:border-neutral-200"}`,...a,...i,children:[f.jsxs("div",{className:`mt-0.5 mr-3 flex-shrink-0 ${t===ne.Running?"text-blue-600":"text-neutral-500"}`,children:[t===ne.Review&&f.jsx(ns,{className:r?"text-amber-600":"text-neutral-500"}),t===ne.Running&&f.jsx(os,{className:"animate-pulse"}),t===ne.Pending&&f.jsx(as,{}),t===ne.Done&&f.jsx(ls,{className:"text-neutral-400"}),t===ne.Cancelled&&f.jsx(cs,{className:"text-neutral-400"})]}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"mb-0.5",children:[f.jsx("span",{className:`font-medium mr-1 ${v?.color||"text-neutral-500"}`,children:v?.name}),f.jsx("span",{className:"text-neutral-400",children:"/"}),f.jsx("span",{className:`ml-1 ${r?"text-neutral-900":"text-neutral-700"}`,children:e.title}),l&&f.jsxs("span",{className:"relative inline-flex h-2 w-2 ml-1.5 align-middle",children:[f.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),f.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]})]}),f.jsx("p",{className:`text-xs line-clamp-2 leading-relaxed ${r?"text-neutral-500":"text-neutral-400 group-hover:text-neutral-500"}`,children:e.description})]})]}),p&&f.jsxs("div",{ref:y,className:"fixed z-[100] w-44 bg-white rounded-lg border border-neutral-200 shadow-xl py-1 animate-in fade-in zoom-in-95 duration-100",style:{left:p.x,top:p.y},children:[C&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:"移动到"}),Vl.filter(n=>n.status!==t).map(n=>{const u=n.icon;return f.jsxs("button",{onClick:()=>{C(e.id,n.status),S(null)},className:"w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-neutral-50 transition-colors",children:[f.jsx(u,{className:`w-3.5 h-3.5 ${n.color}`}),f.jsx("span",{className:"text-neutral-700",children:n.label})]},n.status)})]}),s&&f.jsxs(f.Fragment,{children:[C&&f.jsx("div",{className:"my-1 border-t border-neutral-100"}),f.jsxs("button",{onClick:()=>{s(e.id),S(null)},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-red-600 hover:bg-red-50 transition-colors",children:[f.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5",children:[f.jsx("path",{d:"M3 6h18"}),f.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),f.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),f.jsx("span",{children:"删除任务"})]})]})]})]})}const Ql=R.memo(function({title:t,tasks:r,status:l,defaultOpen:v,selectedTaskId:x,onSelectTask:C,projects:s,activeTaskIds:i,isDragging:a,dragFromStatus:d,onTaskStatusChange:o,onDeleteTask:p}){const[S,y]=R.useState(v),_=r.length===0,n=a&&d===l,u=a&&d!==l,{setNodeRef:c,isOver:h}=Nl({id:`group-${l}`,data:{status:l}}),m=l===ne.Review,b=a?n&&(S||!0):S;return f.jsxs("div",{className:"mb-2",children:[f.jsxs("button",{onClick:()=>!a&&y(w=>!w),className:"flex items-center w-full px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 hover:bg-neutral-50 transition-colors",children:[f.jsx("span",{className:"mr-2 text-neutral-400",children:b?f.jsx(Ct,{size:14}):f.jsx(mr,{size:14})}),f.jsx("span",{className:"flex-1 text-left",children:t}),m&&!_?f.jsx("span",{className:"px-2 py-0.5 bg-amber-100 text-amber-700 text-xs font-bold rounded-full animate-hop",children:r.length}):f.jsxs("span",{className:"text-xs text-neutral-400 font-normal",children:["(",r.length,")"]})]}),u&&f.jsx("div",{ref:c,className:`mx-3 my-1 flex items-center justify-center rounded-lg border-2 border-dashed transition-all duration-150 h-10
|
|
9
|
+
${h?"border-blue-400 bg-blue-50 text-blue-600":"border-neutral-300 bg-neutral-50/50 text-neutral-400"}`,children:f.jsx("span",{className:"text-xs font-medium",children:h?`放入 ${t}`:"拖到此处"})}),b&&!u&&f.jsx("div",{ref:n?void 0:c,className:`flex flex-col mt-1 min-h-[40px] rounded-md mx-2 transition-colors
|
|
10
|
+
${h&&!n?"bg-blue-50 ring-1 ring-blue-200":""}
|
|
11
|
+
${_&&a?"border border-dashed border-neutral-300":""}`,children:_?f.jsx("span",{className:"text-xs text-neutral-300 py-2 pl-8",children:"No tasks"}):r.map(w=>{const k=s.find(L=>L.id===w.projectId),g=x===w.id,E=i?.has(w.id)??!1;return f.jsx(Gl,{task:w,status:l,isSelected:g,isAgentActive:E,project:k,onSelectTask:C,onTaskStatusChange:o,onDeleteTask:p},w.id)})})]})}),Zl=f.jsx("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:f.jsx("span",{children:"0 tasks"})});function Jl(e){const t={[ne.Review]:[],[ne.Running]:[],[ne.Pending]:[],[ne.Done]:[],[ne.Cancelled]:[]};for(const r of e)t[r.status].push(r);return t}const ec=[{status:ne.Review,title:"Review",defaultOpen:!0},{status:ne.Running,title:"Running",defaultOpen:!0},{status:ne.Pending,title:"Pending",defaultOpen:!1},{status:ne.Done,title:"Done",defaultOpen:!1},{status:ne.Cancelled,title:"Cancelled",defaultOpen:!1}];function Ks({tasks:e=[],projects:t=[],selectedTaskId:r,onSelectTask:l,filterProjectId:v,setFilterProjectId:x,width:C=320,onCreateProject:s,onCreateTask:i,activeTaskIds:a,onTaskStatusChange:d,onDeleteTask:o}){const[p,S]=R.useState(!1),[y,_]=R.useState(null),[n,u]=R.useState(null),c=Ta(La(gs,{activationConstraint:{distance:8}})),h=R.useCallback(E=>{const L=E.active.data.current?.task,T=E.active.data.current?.fromStatus;L&&_(L),T&&u(T)},[]),m=R.useCallback(E=>{_(null),u(null);const{active:L,over:T}=E;if(!T)return;const M=L.data.current?.task,P=L.data.current?.fromStatus,B=T.data.current?.status;!M||!P||!B||P!==B&&d?.(M.id,B)},[d]),b=v?e.filter(E=>E.projectId===v):e,w=v?t.find(E=>E.id===v)??null:null,k=Jl(b),g=C==="100%";return f.jsxs("div",{className:`h-full flex flex-col bg-white flex-shrink-0 ${g?"":"border-r border-neutral-200"}`,style:{width:C},children:[f.jsxs("div",{className:"h-14 flex items-center justify-between px-3 border-b border-neutral-100 flex-shrink-0 relative z-20",children:[f.jsxs("div",{className:"relative flex-1 mr-2",children:[f.jsxs("button",{onClick:()=>S(E=>!E),className:"flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-semibold text-neutral-900 hover:bg-neutral-100 transition-colors w-full text-left group",children:[v&&w?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${w.color.replace("text-","bg-")}`}),f.jsx("span",{className:"truncate",children:w.name})]}):f.jsxs(f.Fragment,{children:[f.jsx(Ms,{size:16,className:"text-neutral-500 group-hover:text-neutral-800"}),f.jsx("span",{children:"All Projects"})]}),f.jsx(Ct,{size:14,className:`text-neutral-400 ml-auto transition-transform duration-200 ${p?"rotate-180":""}`})]}),p?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>S(!1)}),f.jsxs("div",{className:"absolute left-0 top-full mt-1 w-56 bg-white border border-neutral-200 rounded-lg shadow-xl shadow-neutral-200/50 z-40 py-1 animate-in fade-in zoom-in-95 duration-100 origin-top-left",children:[f.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold text-neutral-400 uppercase tracking-wider",children:"Select View"}),f.jsxs("button",{onClick:()=>{x(null),S(!1)},className:"w-full text-left px-3 py-2 text-xs flex items-center justify-between hover:bg-neutral-50 transition-colors group",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded border border-neutral-200 bg-neutral-50 text-neutral-500 group-hover:border-neutral-300",children:f.jsx(Ms,{size:12})}),f.jsx("span",{className:v===null?"text-neutral-900 font-medium":"text-neutral-600",children:"All Projects"})]}),v===null?f.jsx(Ot,{size:14,className:"text-neutral-900"}):null]}),f.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),t.map(E=>{const L=v===E.id,T=E.color.replace("text-","bg-");return f.jsxs("button",{onClick:()=>{x(E.id),S(!1)},className:"w-full text-left px-3 py-2 text-xs flex items-center justify-between hover:bg-neutral-50 transition-colors",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:`w-2 h-2 rounded-full ml-1.5 mr-1.5 ${T}`}),f.jsx("span",{className:L?"text-neutral-900 font-medium":"text-neutral-600",children:E.name})]}),L?f.jsx(Ot,{size:14,className:"text-neutral-900"}):null]},E.id)}),f.jsx("div",{className:"h-px bg-neutral-100 my-1 mx-2"}),f.jsxs("button",{onClick:()=>{S(!1),s?.()},className:"w-full text-left px-3 py-2 text-xs flex items-center gap-2 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-50 transition-colors",children:[f.jsx(Kr,{size:14}),f.jsx("span",{children:"Create New Project..."})]})]})]}):null]}),f.jsx("button",{onClick:i,className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors flex-shrink-0",title:"New Task",children:f.jsx(Kr,{size:18})})]}),f.jsxs(Dl,{sensors:c,onDragStart:h,onDragEnd:m,children:[f.jsx("div",{className:"flex-1 overflow-y-auto py-4 relative",children:ec.map(({status:E,title:L,defaultOpen:T})=>f.jsx(Ql,{title:L,tasks:k[E],status:E,defaultOpen:T,selectedTaskId:r,onSelectTask:l,projects:t,activeTaskIds:a,isDragging:y!==null,dragFromStatus:n,onTaskStatusChange:d,onDeleteTask:o},E))}),f.jsx(Yl,{dropAnimation:null,children:y?f.jsx("div",{className:"bg-white shadow-lg rounded-md border border-neutral-200 px-4 py-2 text-sm max-w-[280px] opacity-90",children:f.jsx("span",{className:"text-neutral-700 font-medium",children:y.title})}):null})]}),b.length>0?f.jsxs("div",{className:"p-4 border-t border-neutral-100 text-xs text-neutral-400 flex items-center justify-between",children:[f.jsxs("span",{children:[b.length," tasks"]}),v?f.jsx("button",{onClick:()=>x(null),className:"hover:text-neutral-800 underline decoration-neutral-300 underline-offset-2",children:"Clear filter"}):null]}):Zl]})}var Qe;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(Qe||(Qe={}));var qs;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED"})(qs||(qs={}));var Pt;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT"})(Pt||(Pt={}));var Le;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(Le||(Le={}));var Xs;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(Xs||(Xs={}));var Gr;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(Gr||(Gr={}));function Zt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function tc(e){return e>=.9?"text-red-500":e>=.7?"text-amber-500":"text-neutral-400"}function an({usage:e}){if(!e)return null;const t=e.modelContextWindow,r=t?e.totalTokens/t:0,l=t?Math.min(Math.round(r*100),100):null,v=t?tc(r):"text-neutral-400";return f.jsxs("div",{className:"group relative flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[f.jsx(Fo,{size:14,className:v}),f.jsxs("span",{className:`tabular-nums ${v}`,children:[Zt(e.totalTokens),l!==null&&f.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",l,"%"]})]}),f.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-2 bg-neutral-900 text-white text-xs rounded-lg opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-50 shadow-lg",children:[t?f.jsxs("span",{children:["上下文: ",Zt(e.totalTokens)," / ",Zt(t)," tokens"]}):f.jsxs("span",{children:["已使用: ",Zt(e.totalTokens)," tokens"]}),f.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-neutral-900"})]})]})}var Br={exports:{}},Ys;function rc(){return Ys||(Ys=1,(function(e,t){(function(r,l){e.exports=l()})(self,(()=>(()=>{var r={4567:function(C,s,i){var a=this&&this.__decorate||function(h,m,b,w){var k,g=arguments.length,E=g<3?m:w===null?w=Object.getOwnPropertyDescriptor(m,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,m,b,w);else for(var L=h.length-1;L>=0;L--)(k=h[L])&&(E=(g<3?k(E):g>3?k(m,b,E):k(m,b))||E);return g>3&&E&&Object.defineProperty(m,b,E),E},d=this&&this.__param||function(h,m){return function(b,w){m(b,w,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const o=i(9042),p=i(6114),S=i(9924),y=i(844),_=i(5596),n=i(4725),u=i(3656);let c=s.AccessibilityManager=class extends y.Disposable{constructor(h,m){super(),this._terminal=h,this._renderService=m,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.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((b=>this._handleResize(b.rows)))),this.register(this._terminal.onRender((b=>this._refreshRows(b.start,b.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((b=>this._handleChar(b)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
12
|
+
`)))),this.register(this._terminal.onA11yTab((b=>this._handleTab(b)))),this.register(this._terminal.onKey((b=>this._handleKey(b.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new _.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,u.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(h){for(let m=0;m<h;m++)this._handleChar(" ")}_handleChar(h){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
|
|
13
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)),p.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,p.isMac&&this._liveRegion.remove()}_handleKey(h){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(h)||this._charsToConsume.push(h)}_refreshRows(h,m){this._liveRegionDebouncer.refresh(h,m,this._terminal.rows)}_renderRows(h,m){const b=this._terminal.buffer,w=b.lines.length.toString();for(let k=h;k<=m;k++){const g=b.translateBufferLineToString(b.ydisp+k,!0),E=(b.ydisp+k+1).toString(),L=this._rowElements[k];L&&(g.length===0?L.innerText=" ":L.textContent=g,L.setAttribute("aria-posinset",E),L.setAttribute("aria-setsize",w))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,m){const b=h.target,w=this._rowElements[m===0?1:this._rowElements.length-2];if(b.getAttribute("aria-posinset")===(m===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==w)return;let k,g;if(m===0?(k=b,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(k=this._rowElements.shift(),g=b,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),m===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(m===0?-1:1),this._rowElements[m===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let m=this._rowContainer.children.length;m<this._terminal.rows;m++)this._rowElements[m]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[m]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const h=document.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_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 h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=c=a([d(1,n.IRenderService)],c)},3614:(C,s)=>{function i(p){return p.replace(/\r?\n/g,"\r")}function a(p,S){return S?"\x1B[200~"+p+"\x1B[201~":p}function d(p,S,y,_){p=a(p=i(p),y.decPrivateModes.bracketedPasteMode&&_.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),S.value=""}function o(p,S,y){const _=y.getBoundingClientRect(),n=p.clientX-_.left-10,u=p.clientY-_.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${n}px`,S.style.top=`${u}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=i,s.bracketTextForPaste=a,s.copyHandler=function(p,S){p.clipboardData&&p.clipboardData.setData("text/plain",S.selectionText),p.preventDefault()},s.handlePasteEvent=function(p,S,y,_){p.stopPropagation(),p.clipboardData&&d(p.clipboardData.getData("text/plain"),S,y,_)},s.paste=d,s.moveTextAreaUnderMouseCursor=o,s.rightClickHandler=function(p,S,y,_,n){o(p,S,y),n&&_.rightClickSelect(p),S.value=_.selectionText,S.select()}},7239:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const a=i(1505);s.ColorContrastCache=class{constructor(){this._color=new a.TwoKeyMap,this._css=new a.TwoKeyMap}setCss(d,o,p){this._css.set(d,o,p)}getCss(d,o){return this._css.get(d,o)}setColor(d,o,p){this._color.set(d,o,p)}getColor(d,o){return this._color.get(d,o)}clear(){this._color.clear(),this._css.clear()}}},3656:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(i,a,d,o){i.addEventListener(a,d,o);let p=!1;return{dispose:()=>{p||(p=!0,i.removeEventListener(a,d,o))}}}},6465:function(C,s,i){var a=this&&this.__decorate||function(n,u,c,h){var m,b=arguments.length,w=b<3?u:h===null?h=Object.getOwnPropertyDescriptor(u,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,u,c,h);else for(var k=n.length-1;k>=0;k--)(m=n[k])&&(w=(b<3?m(w):b>3?m(u,c,w):m(u,c))||w);return b>3&&w&&Object.defineProperty(u,c,w),w},d=this&&this.__param||function(n,u){return function(c,h){u(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier2=void 0;const o=i(3656),p=i(8460),S=i(844),y=i(2585);let _=s.Linkifier2=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(n){super(),this._bufferService=n,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(n){return this._linkProviders.push(n),{dispose:()=>{const u=this._linkProviders.indexOf(n);u!==-1&&this._linkProviders.splice(u,1)}}}attachToDom(n,u,c){this._element=n,this._mouseService=u,this._renderService=c,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){if(this._lastMouseEvent=n,!this._element||!this._mouseService)return;const u=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!u)return;this._isMouseOut=!1;const c=n.composedPath();for(let h=0;h<c.length;h++){const m=c[h];if(m.classList.contains("xterm"))break;if(m.classList.contains("xterm-hover"))return}this._lastBufferCell&&u.x===this._lastBufferCell.x&&u.y===this._lastBufferCell.y||(this._handleHover(u),this._lastBufferCell=u)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,u){var c,h;this._activeProviderReplies&&u||((c=this._activeProviderReplies)===null||c===void 0||c.forEach((b=>{b?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=n.y);let m=!1;for(const[b,w]of this._linkProviders.entries())u?!((h=this._activeProviderReplies)===null||h===void 0)&&h.get(b)&&(m=this._checkLinkProviderResult(b,n,m)):w.provideLinks(n.y,(k=>{var g,E;if(this._isMouseOut)return;const L=k?.map((T=>({link:T})));(g=this._activeProviderReplies)===null||g===void 0||g.set(b,L),m=this._checkLinkProviderResult(b,n,m),((E=this._activeProviderReplies)===null||E===void 0?void 0:E.size)===this._linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)}))}_removeIntersectingLinks(n,u){const c=new Set;for(let h=0;h<u.size;h++){const m=u.get(h);if(m)for(let b=0;b<m.length;b++){const w=m[b],k=w.link.range.start.y<n?0:w.link.range.start.x,g=w.link.range.end.y>n?this._bufferService.cols:w.link.range.end.x;for(let E=k;E<=g;E++){if(c.has(E)){m.splice(b--,1);break}c.add(E)}}}}_checkLinkProviderResult(n,u,c){var h;if(!this._activeProviderReplies)return c;const m=this._activeProviderReplies.get(n);let b=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(b=!0);if(!b&&m){const w=m.find((k=>this._linkAtPosition(k.link,u)));w&&(c=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviders.length&&!c)for(let w=0;w<this._activeProviderReplies.size;w++){const k=(h=this._activeProviderReplies.get(w))===null||h===void 0?void 0:h.find((g=>this._linkAtPosition(g.link,u)));if(k){c=!0,this._handleNewLink(k);break}}return c}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._element||!this._mouseService||!this._currentLink)return;const u=this._positionFromMouseEvent(n,this._element,this._mouseService);u&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,u)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,u){this._element&&this._currentLink&&this._lastMouseEvent&&(!n||!u||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=u)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._linkAtPosition(n.link,u)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var c,h;return(h=(c=this._currentLink)===null||c===void 0?void 0:c.state)===null||h===void 0?void 0:h.decorations.pointerCursor},set:c=>{var h,m;!((h=this._currentLink)===null||h===void 0)&&h.state&&this._currentLink.state.decorations.pointerCursor!==c&&(this._currentLink.state.decorations.pointerCursor=c,this._currentLink.state.isHovered&&((m=this._element)===null||m===void 0||m.classList.toggle("xterm-cursor-pointer",c)))}},underline:{get:()=>{var c,h;return(h=(c=this._currentLink)===null||c===void 0?void 0:c.state)===null||h===void 0?void 0:h.decorations.underline},set:c=>{var h,m,b;!((h=this._currentLink)===null||h===void 0)&&h.state&&((b=(m=this._currentLink)===null||m===void 0?void 0:m.state)===null||b===void 0?void 0:b.decorations.underline)!==c&&(this._currentLink.state.decorations.underline=c,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,c))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((c=>{if(!this._currentLink)return;const h=c.start===0?0:c.start+1+this._bufferService.buffer.ydisp,m=this._bufferService.buffer.ydisp+1+c.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=m&&(this._clearCurrentLink(h,m),this._lastMouseEvent&&this._element)){const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}}))))}_linkHover(n,u,c){var h;!((h=this._currentLink)===null||h===void 0)&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(u,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),u.hover&&u.hover(c,u.text)}_fireUnderlineEvent(n,u){const c=n.range,h=this._bufferService.buffer.ydisp,m=this._createLinkUnderlineEvent(c.start.x-1,c.start.y-h-1,c.end.x,c.end.y-h-1,void 0);(u?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(m)}_linkLeave(n,u,c){var h;!((h=this._currentLink)===null||h===void 0)&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(u,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),u.leave&&u.leave(c,u.text)}_linkAtPosition(n,u){const c=n.range.start.y*this._bufferService.cols+n.range.start.x,h=n.range.end.y*this._bufferService.cols+n.range.end.x,m=u.y*this._bufferService.cols+u.x;return c<=m&&m<=h}_positionFromMouseEvent(n,u,c){const h=c.getCoords(n,u,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,u,c,h,m){return{x1:n,y1:u,x2:c,y2:h,cols:this._bufferService.cols,fg:m}}};s.Linkifier2=_=a([d(0,y.IBufferService)],_)},9042:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(C,s,i){var a=this&&this.__decorate||function(_,n,u,c){var h,m=arguments.length,b=m<3?n:c===null?c=Object.getOwnPropertyDescriptor(n,u):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,n,u,c);else for(var w=_.length-1;w>=0;w--)(h=_[w])&&(b=(m<3?h(b):m>3?h(n,u,b):h(n,u))||b);return m>3&&b&&Object.defineProperty(n,u,b),b},d=this&&this.__param||function(_,n){return function(u,c){n(u,c,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const o=i(511),p=i(2585);let S=s.OscLinkProvider=class{constructor(_,n,u){this._bufferService=_,this._optionsService=n,this._oscLinkService=u}provideLinks(_,n){var u;const c=this._bufferService.buffer.lines.get(_-1);if(!c)return void n(void 0);const h=[],m=this._optionsService.rawOptions.linkHandler,b=new o.CellData,w=c.getTrimmedLength();let k=-1,g=-1,E=!1;for(let L=0;L<w;L++)if(g!==-1||c.hasContent(L)){if(c.loadCell(L,b),b.hasExtendedAttrs()&&b.extended.urlId){if(g===-1){g=L,k=b.extended.urlId;continue}E=b.extended.urlId!==k}else g!==-1&&(E=!0);if(E||g!==-1&&L===w-1){const T=(u=this._oscLinkService.getLinkData(k))===null||u===void 0?void 0:u.uri;if(T){const M={start:{x:g+1,y:_},end:{x:L+(E||L!==w-1?0:1),y:_}};let P=!1;if(!m?.allowNonHttpProtocols)try{const B=new URL(T);["http:","https:"].includes(B.protocol)||(P=!0)}catch{P=!0}P||h.push({text:T,range:M,activate:(B,F)=>m?m.activate(B,F,M):y(0,F),hover:(B,F)=>{var W;return(W=m?.hover)===null||W===void 0?void 0:W.call(m,B,F,M)},leave:(B,F)=>{var W;return(W=m?.leave)===null||W===void 0?void 0:W.call(m,B,F,M)}})}E=!1,b.hasExtendedAttrs()&&b.extended.urlId?(g=L,k=b.extended.urlId):(g=-1,k=-1)}}n(h)}};function y(_,n){if(confirm(`Do you want to navigate to ${n}?
|
|
14
|
+
|
|
15
|
+
WARNING: This link could potentially be dangerous`)){const u=window.open();if(u){try{u.opener=null}catch{}u.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=S=a([d(0,p.IBufferService),d(1,p.IOptionsService),d(2,p.IOscLinkService)],S)},6193:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(i,a){this._parentWindow=i,this._renderCallback=a,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(i){return this._refreshCallbacks.push(i),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(i,a,d){this._rowCount=d,i=i!==void 0?i:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a,this._animationFrame||(this._animationFrame=this._parentWindow.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 i=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,a),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const i of this._refreshCallbacks)i(0);this._refreshCallbacks=[]}}},5596:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ScreenDprMonitor=void 0;const a=i(844);class d extends a.Disposable{constructor(p){super(),this._parentWindow=p,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,a.toDisposable)((()=>{this.clearListener()})))}setListener(p){this._listener&&this.clearListener(),this._listener=p,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var p;this._outerListener&&((p=this._resolutionMediaMatchList)===null||p===void 0||p.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}s.ScreenDprMonitor=d},3236:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const a=i(3614),d=i(3656),o=i(6465),p=i(9042),S=i(3730),y=i(1680),_=i(3107),n=i(5744),u=i(2950),c=i(1296),h=i(428),m=i(4269),b=i(5114),w=i(8934),k=i(3230),g=i(9312),E=i(4725),L=i(6731),T=i(8055),M=i(8969),P=i(8460),B=i(844),F=i(6114),W=i(8437),H=i(2584),D=i(7399),j=i(5941),N=i(9074),O=i(2585),$=i(5435),Y=i(4567),V=typeof window<"u"?window.document:null;class Q extends M.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(A={}){super(A),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new P.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new P.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new P.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new P.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new P.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new P.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new P.EventEmitter),this._onBlur=this.register(new P.EventEmitter),this._onA11yCharEmitter=this.register(new P.EventEmitter),this._onA11yTabEmitter=this.register(new P.EventEmitter),this._onWillOpen=this.register(new P.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(N.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((I,U)=>this.refresh(I,U)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((I=>this._reportWindowsOptions(I)))),this.register(this._inputHandler.onColor((I=>this._handleColorEvent(I)))),this.register((0,P.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,P.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((I=>this._afterResize(I.cols,I.rows)))),this.register((0,B.toDisposable)((()=>{var I,U;this._customKeyEventHandler=void 0,(U=(I=this.element)===null||I===void 0?void 0:I.parentNode)===null||U===void 0||U.removeChild(this.element)})))}_handleColorEvent(A){if(this._themeService)for(const I of A){let U,z="";switch(I.index){case 256:U="foreground",z="10";break;case 257:U="background",z="11";break;case 258:U="cursor",z="12";break;default:U="ansi",z="4;"+I.index}switch(I.type){case 0:const Z=T.color.toColorRGB(U==="ansi"?this._themeService.colors.ansi[I.index]:this._themeService.colors[U]);this.coreService.triggerDataEvent(`${H.C0.ESC}]${z};${(0,j.toRgbString)(Z)}${H.C1_ESCAPED.ST}`);break;case 1:if(U==="ansi")this._themeService.modifyColors((G=>G.ansi[I.index]=T.rgba.toColor(...I.color)));else{const G=U;this._themeService.modifyColors((ie=>ie[G]=T.rgba.toColor(...I.color)))}break;case 2:this._themeService.restoreColor(I.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(A){A?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Y.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(A){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[I"),this.updateCursorStyle(A),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var A;return(A=this.textarea)===null||A===void 0?void 0:A.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(H.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const A=this.buffer.ybase+this.buffer.y,I=this.buffer.lines.get(A);if(!I)return;const U=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,Z=I.getWidth(U),G=this._renderService.dimensions.css.cell.width*Z,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,le=U*this._renderService.dimensions.css.cell.width;this.textarea.style.left=le+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=G+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(I=>{this.hasSelection()&&(0,a.copyHandler)(I,this._selectionService)})));const A=I=>(0,a.handlePasteEvent)(I,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",A)),this.register((0,d.addDisposableDomListener)(this.element,"paste",A)),F.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(I=>{I.button===2&&(0,a.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(I=>{(0,a.rightClickHandler)(I,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),F.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(I=>{I.button===1&&(0,a.moveTextAreaUnderMouseCursor)(I,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",(A=>this._keyUp(A)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",(A=>this._keyDown(A)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",(A=>this._keyPress(A)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",(A=>this._compositionHelper.compositionupdate(A)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",(A=>this._inputEvent(A)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(A){var I;if(!A)throw new Error("Terminal requires a parent element.");A.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=A.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),A.appendChild(this.element);const U=V.createDocumentFragment();this._viewportElement=V.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),U.appendChild(this._viewportElement),this._viewportScrollArea=V.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=V.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=V.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),U.appendChild(this.screenElement),this.textarea=V.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),F.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._instantiationService.createInstance(b.CoreBrowserService,this.textarea,(I=this._document.defaultView)!==null&&I!==void 0?I:window),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",(z=>this._handleTextAreaFocus(z)))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((z=>this._onRender.fire(z)))),this.onResize((z=>this._renderService.resize(z.cols,z.rows))),this._compositionView=V.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(u.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(U);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(w.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((z=>this.scrollLines(z.amount,z.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(g.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((z=>this.scrollLines(z.amount,z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((z=>this._renderService.handleSelectionChanged(z.start,z.end,z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((z=>{this.textarea.value=z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(_.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(z=>this._selectionService.handleMouseDown(z)))),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(Y.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(z=>this._handleScreenReaderModeOptionChange(z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(z=>{!this._overviewRulerRenderer&&z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(n.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const A=this,I=this.element;function U(G){const ie=A._mouseService.getMouseReportCoords(G,A.screenElement);if(!ie)return!1;let le,de;switch(G.overrideType||G.type){case"mousemove":de=32,G.buttons===void 0?(le=3,G.button!==void 0&&(le=G.button<3?G.button:3)):le=1&G.buttons?0:4&G.buttons?1:2&G.buttons?2:3;break;case"mouseup":de=0,le=G.button<3?G.button:3;break;case"mousedown":de=1,le=G.button<3?G.button:3;break;case"wheel":if(A.viewport.getLinesScrolled(G)===0)return!1;de=G.deltaY<0?0:1,le=4;break;default:return!1}return!(de===void 0||le===void 0||le>4)&&A.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:le,action:de,ctrl:G.ctrlKey,alt:G.altKey,shift:G.shiftKey})}const z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:G=>(U(G),G.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(G)),wheel:G=>(U(G),this.cancel(G,!0)),mousedrag:G=>{G.buttons&&U(G)},mousemove:G=>{G.buttons||U(G)}};this.register(this.coreMouseService.onProtocolChange((G=>{G?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(G)),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&G?z.mousemove||(I.addEventListener("mousemove",Z.mousemove),z.mousemove=Z.mousemove):(I.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&G?z.wheel||(I.addEventListener("wheel",Z.wheel,{passive:!1}),z.wheel=Z.wheel):(I.removeEventListener("wheel",z.wheel),z.wheel=null),2&G?z.mouseup||(I.addEventListener("mouseup",Z.mouseup),z.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),I.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&G?z.mousedrag||(z.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(I,"mousedown",(G=>{if(G.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(G))return U(G),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(G)}))),this.register((0,d.addDisposableDomListener)(I,"wheel",(G=>{if(!z.wheel){if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(G);if(ie===0)return;const le=H.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(G.deltaY<0?"A":"B");let de="";for(let ve=0;ve<Math.abs(ie);ve++)de+=le;return this.coreService.triggerDataEvent(de,!0),this.cancel(G,!0)}return this.viewport.handleWheel(G)?this.cancel(G):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(I,"touchstart",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(G),this.cancel(G)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(I,"touchmove",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(G)?void 0:this.cancel(G)}),{passive:!1}))}refresh(A,I){var U;(U=this._renderService)===null||U===void 0||U.refreshRows(A,I)}updateCursorStyle(A){var I;!((I=this._selectionService)===null||I===void 0)&&I.shouldColumnSelect(A)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(A,I,U=0){var z;U===1?(super.scrollLines(A,I,U),this.refresh(0,this.rows-1)):(z=this.viewport)===null||z===void 0||z.scrollLines(A)}paste(A){(0,a.paste)(A,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(A){this._customKeyEventHandler=A}registerLinkProvider(A){return this.linkifier2.registerLinkProvider(A)}registerCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const I=this._characterJoinerService.register(A);return this.refresh(0,this.rows-1),I}deregisterCharacterJoiner(A){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(A)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(A){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+A)}registerDecoration(A){return this._decorationService.registerDecoration(A)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(A,I,U){this._selectionService.setSelection(A,I,U)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var A;(A=this._selectionService)===null||A===void 0||A.clearSelection()}selectAll(){var A;(A=this._selectionService)===null||A===void 0||A.selectAll()}selectLines(A,I){var U;(U=this._selectionService)===null||U===void 0||U.selectLines(A,I)}_keyDown(A){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;const I=this.browser.isMac&&this.options.macOptionIsMeta&&A.altKey;if(!I&&!this._compositionHelper.keydown(A))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;I||A.key!=="Dead"&&A.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const U=(0,D.evaluateKeyboardEvent)(A,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(A),U.type===3||U.type===2){const z=this.rows-1;return this.scrollLines(U.type===2?-z:z),this.cancel(A,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,A)||(U.cancel&&this.cancel(A,!0),!U.key||!!(A.key&&!A.ctrlKey&&!A.altKey&&!A.metaKey&&A.key.length===1&&A.key.charCodeAt(0)>=65&&A.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(U.key!==H.C0.ETX&&U.key!==H.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(U.key,!0),!this.optionsService.rawOptions.screenReaderMode||A.altKey||A.ctrlKey?this.cancel(A,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(A,I){const U=A.isMac&&!this.options.macOptionIsMeta&&I.altKey&&!I.ctrlKey&&!I.metaKey||A.isWindows&&I.altKey&&I.ctrlKey&&!I.metaKey||A.isWindows&&I.getModifierState("AltGraph");return I.type==="keypress"?U:U&&(!I.keyCode||I.keyCode>47)}_keyUp(A){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1||((function(I){return I.keyCode===16||I.keyCode===17||I.keyCode===18})(A)||this.focus(),this.updateCursorStyle(A),this._keyPressHandled=!1)}_keyPress(A){let I;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(A)===!1)return!1;if(this.cancel(A),A.charCode)I=A.charCode;else if(A.which===null||A.which===void 0)I=A.keyCode;else{if(A.which===0||A.charCode===0)return!1;I=A.which}return!(!I||(A.altKey||A.ctrlKey||A.metaKey)&&!this._isThirdLevelShift(this.browser,A)||(I=String.fromCharCode(I),this._onKey.fire({key:I,domEvent:A}),this._showCursor(),this.coreService.triggerDataEvent(I,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(A){if(A.data&&A.inputType==="insertText"&&(!A.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const I=A.data;return this.coreService.triggerDataEvent(I,!0),this.cancel(A),!0}return!1}resize(A,I){A!==this.cols||I!==this.rows?super.resize(A,I):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(A,I){var U,z;(U=this._charSizeService)===null||U===void 0||U.measure(),(z=this.viewport)===null||z===void 0||z.syncScrollArea(!0)}clear(){var A;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let I=1;I<this.rows;I++)this.buffer.lines.push(this.buffer.getBlankLine(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(A=this.viewport)===null||A===void 0||A.reset(),this.refresh(0,this.rows-1)}}reset(){var A,I;this.options.rows=this.rows,this.options.cols=this.cols;const U=this._customKeyEventHandler;this._setup(),super.reset(),(A=this._selectionService)===null||A===void 0||A.reset(),this._decorationService.reset(),(I=this.viewport)===null||I===void 0||I.reset(),this._customKeyEventHandler=U,this.refresh(0,this.rows-1)}clearTextureAtlas(){var A;(A=this._renderService)===null||A===void 0||A.clearTextureAtlas()}_reportFocus(){var A;!((A=this.element)===null||A===void 0)&&A.classList.contains("focus")?this.coreService.triggerDataEvent(H.C0.ESC+"[I"):this.coreService.triggerDataEvent(H.C0.ESC+"[O")}_reportWindowsOptions(A){if(this._renderService)switch(A){case $.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const I=this._renderService.dimensions.css.canvas.width.toFixed(0),U=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[4;${U};${I}t`);break;case $.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const z=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${H.C0.ESC}[6;${Z};${z}t`)}}cancel(A,I){if(this.options.cancelEvents||I)return A.preventDefault(),A.stopPropagation(),!1}}s.Terminal=Q},9924:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(i,a=1e3){this._renderCallback=i,this._debounceThresholdMS=a,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(i,a,d){this._rowCount=d,i=i!==void 0?i:0,a=a!==void 0?a:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,i):i,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,a):a;const o=Date.now();if(o-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=o,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=o-this._lastRefreshMs,S=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const i=Math.max(this._rowStart,0),a=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(i,a)}}},1680:function(C,s,i){var a=this&&this.__decorate||function(u,c,h,m){var b,w=arguments.length,k=w<3?c:m===null?m=Object.getOwnPropertyDescriptor(c,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,c,h,m);else for(var g=u.length-1;g>=0;g--)(b=u[g])&&(k=(w<3?b(k):w>3?b(c,h,k):b(c,h))||k);return w>3&&k&&Object.defineProperty(c,h,k),k},d=this&&this.__param||function(u,c){return function(h,m){c(h,m,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const o=i(3656),p=i(4725),S=i(8460),y=i(844),_=i(2585);let n=s.Viewport=class extends y.Disposable{constructor(u,c,h,m,b,w,k,g){super(),this._viewportElement=u,this._scrollArea=c,this._bufferService=h,this._optionsService=m,this._charSizeService=b,this._renderService=w,this._coreBrowserService=k,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 S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((E=>this._activeBuffer=E.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((E=>this._renderDimensions=E))),this._handleThemeChange(g.colors),this.register(g.onChangeColors((E=>this._handleThemeChange(E)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(u){this._viewportElement.style.backgroundColor=u.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(u){if(u)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._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const c=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==c&&(this._lastRecordedBufferHeight=c,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const u=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==u&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=u),this._refreshAnimationFrame=null}syncScrollArea(u=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(u);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(u)}_handleScroll(u){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 c=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:c,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const u=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(u*(this._smoothScrollState.target-this._smoothScrollState.origin)),u<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(u,c){const h=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(c<0&&this._viewportElement.scrollTop!==0||c>0&&h<this._lastRecordedBufferHeight)||(u.cancelable&&u.preventDefault(),!1)}handleWheel(u){const c=this._getPixelsScrolled(u);return c!==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+c:this._smoothScrollState.target+=c,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=c,this._bubbleScroll(u,c))}scrollLines(u){if(u!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const c=u*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+c,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:u,suppressScrollEvent:!1})}_getPixelsScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let c=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_LINE?c*=this._currentRowHeight:u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(c*=this._currentRowHeight*this._bufferService.rows),c}getBufferElements(u,c){var h;let m,b="";const w=[],k=c??this._bufferService.buffer.lines.length,g=this._bufferService.buffer.lines;for(let E=u;E<k;E++){const L=g.get(E);if(!L)continue;const T=(h=g.get(E+1))===null||h===void 0?void 0:h.isWrapped;if(b+=L.translateToString(!T),!T||E===g.length-1){const M=document.createElement("div");M.textContent=b,w.push(M),b.length>0&&(m=M),b=""}}return{bufferElements:w,cursorElement:m}}getLinesScrolled(u){if(u.deltaY===0||u.shiftKey)return 0;let c=this._applyScrollModifier(u.deltaY,u);return u.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(c/=this._currentRowHeight+0,this._wheelPartialScroll+=c,c=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):u.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(c*=this._bufferService.rows),c}_applyScrollModifier(u,c){const h=this._optionsService.rawOptions.fastScrollModifier;return h==="alt"&&c.altKey||h==="ctrl"&&c.ctrlKey||h==="shift"&&c.shiftKey?u*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:u*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(u){this._lastTouchY=u.touches[0].pageY}handleTouchMove(u){const c=this._lastTouchY-u.touches[0].pageY;return this._lastTouchY=u.touches[0].pageY,c!==0&&(this._viewportElement.scrollTop+=c,this._bubbleScroll(u,c))}};s.Viewport=n=a([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,p.ICharSizeService),d(5,p.IRenderService),d(6,p.ICoreBrowserService),d(7,p.IThemeService)],n)},3107:function(C,s,i){var a=this&&this.__decorate||function(n,u,c,h){var m,b=arguments.length,w=b<3?u:h===null?h=Object.getOwnPropertyDescriptor(u,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,u,c,h);else for(var k=n.length-1;k>=0;k--)(m=n[k])&&(w=(b<3?m(w):b>3?m(u,c,w):m(u,c))||w);return b>3&&w&&Object.defineProperty(u,c,w),w},d=this&&this.__param||function(n,u){return function(c,h){u(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const o=i(3656),p=i(4725),S=i(844),y=i(2585);let _=s.BufferDecorationRenderer=class extends S.Disposable{constructor(n,u,c,h){super(),this._screenElement=n,this._bufferService=u,this._decorationService=c,this._renderService=h,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((0,o.addDisposableDomListener)(window,"resize",(()=>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((m=>this._removeDecoration(m)))),this.register((0,S.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 n of this._decorationService.decorations)this._renderDecoration(n);this._dimensionsChanged=!1}_renderDecoration(n){this._refreshStyle(n),this._dimensionsChanged&&this._refreshXPosition(n)}_createElement(n){var u,c;const h=document.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((u=n?.options)===null||u===void 0?void 0:u.layer)==="top"),h.style.width=`${Math.round((n.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(n.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(n.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=(c=n.options.x)!==null&&c!==void 0?c:0;return m&&m>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(n,h),h}_refreshStyle(n){const u=n.marker.line-this._bufferService.buffers.active.ydisp;if(u<0||u>=this._bufferService.rows)n.element&&(n.element.style.display="none",n.onRenderEmitter.fire(n.element));else{let c=this._decorationElements.get(n);c||(c=this._createElement(n),n.element=c,this._decorationElements.set(n,c),this._container.appendChild(c),n.onDispose((()=>{this._decorationElements.delete(n),c.remove()}))),c.style.top=u*this._renderService.dimensions.css.cell.height+"px",c.style.display=this._altBufferIsActive?"none":"block",n.onRenderEmitter.fire(c)}}_refreshXPosition(n,u=n.element){var c;if(!u)return;const h=(c=n.options.x)!==null&&c!==void 0?c:0;(n.options.anchor||"left")==="right"?u.style.right=h?h*this._renderService.dimensions.css.cell.width+"px":"":u.style.left=h?h*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(n){var u;(u=this._decorationElements.get(n))===null||u===void 0||u.remove(),this._decorationElements.delete(n),n.dispose()}};s.BufferDecorationRenderer=_=a([d(1,y.IBufferService),d(2,y.IDecorationService),d(3,p.IRenderService)],_)},5871:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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(i){if(i.options.overviewRulerOptions){for(const a of this._zones)if(a.color===i.options.overviewRulerOptions.color&&a.position===i.options.overviewRulerOptions.position){if(this._lineIntersectsZone(a,i.marker.line))return;if(this._lineAdjacentToZone(a,i.marker.line,i.options.overviewRulerOptions.position))return void this._addLineToZone(a,i.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=i.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=i.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=i.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=i.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:i.options.overviewRulerOptions.color,position:i.options.overviewRulerOptions.position,startBufferLine:i.marker.line,endBufferLine:i.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(i){this._linePadding=i}_lineIntersectsZone(i,a){return a>=i.startBufferLine&&a<=i.endBufferLine}_lineAdjacentToZone(i,a,d){return a>=i.startBufferLine-this._linePadding[d||"full"]&&a<=i.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(i,a){i.startBufferLine=Math.min(i.startBufferLine,a),i.endBufferLine=Math.max(i.endBufferLine,a)}}},5744:function(C,s,i){var a=this&&this.__decorate||function(m,b,w,k){var g,E=arguments.length,L=E<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(m,b,w,k);else for(var T=m.length-1;T>=0;T--)(g=m[T])&&(L=(E<3?g(L):E>3?g(b,w,L):g(b,w))||L);return E>3&&L&&Object.defineProperty(b,w,L),L},d=this&&this.__param||function(m,b){return function(w,k){b(w,k,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const o=i(5871),p=i(3656),S=i(4725),y=i(844),_=i(2585),n={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0};let h=s.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(m,b,w,k,g,E,L){var T;super(),this._viewportElement=m,this._screenElement=b,this._bufferService=w,this._decorationService=k,this._renderService=g,this._optionsService=E,this._coreBrowseService=L,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(T=this._viewportElement.parentElement)===null||T===void 0||T.insertBefore(this._canvas,this._viewportElement);const M=this._canvas.getContext("2d");if(!M)throw new Error("Ctx cannot be null");this._ctx=M,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,y.toDisposable)((()=>{var P;(P=this._canvas)===null||P===void 0||P.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((0,p.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const m=Math.floor(this._canvas.width/3),b=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=m,u.center=b,u.right=m,this._refreshDrawHeightConstants(),c.full=0,c.left=0,c.center=u.left,c.right=u.left+u.center}_refreshDrawHeightConstants(){n.full=Math.round(2*this._coreBrowseService.dpr);const m=this._canvas.height/this._bufferService.buffer.lines.length,b=Math.round(Math.max(Math.min(m,12),6)*this._coreBrowseService.dpr);n.left=b,n.center=b,n.right=b}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*n.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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 b of this._decorationService.decorations)this._colorZoneStore.addDecoration(b);this._ctx.lineWidth=1;const m=this._colorZoneStore.zones;for(const b of m)b.position!=="full"&&this._renderColorZone(b);for(const b of m)b.position==="full"&&this._renderColorZone(b);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(m){this._ctx.fillStyle=m.color,this._ctx.fillRect(c[m.position||"full"],Math.round((this._canvas.height-1)*(m.startBufferLine/this._bufferService.buffers.active.lines.length)-n[m.position||"full"]/2),u[m.position||"full"],Math.round((this._canvas.height-1)*((m.endBufferLine-m.startBufferLine)/this._bufferService.buffers.active.lines.length)+n[m.position||"full"]))}_queueRefresh(m,b){this._shouldUpdateDimensions=m||this._shouldUpdateDimensions,this._shouldUpdateAnchor=b||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};s.OverviewRulerRenderer=h=a([d(2,_.IBufferService),d(3,_.IDecorationService),d(4,S.IRenderService),d(5,_.IOptionsService),d(6,S.ICoreBrowserService)],h)},2950:function(C,s,i){var a=this&&this.__decorate||function(_,n,u,c){var h,m=arguments.length,b=m<3?n:c===null?c=Object.getOwnPropertyDescriptor(n,u):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,n,u,c);else for(var w=_.length-1;w>=0;w--)(h=_[w])&&(b=(m<3?h(b):m>3?h(n,u,b):h(n,u))||b);return m>3&&b&&Object.defineProperty(n,u,b),b},d=this&&this.__param||function(_,n){return function(u,c){n(u,c,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const o=i(4725),p=i(2585),S=i(2584);let y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(_,n,u,c,h,m){this._textarea=_,this._compositionView=n,this._bufferService=u,this._optionsService=c,this._coreService=h,this._renderService=m,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(_){this._compositionView.textContent=_.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(_){if(this._isComposing||this._isSendingComposition){if(_.keyCode===229||_.keyCode===16||_.keyCode===17||_.keyCode===18)return!1;this._finalizeComposition(!1)}return _.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(_){if(this._compositionView.classList.remove("active"),this._isComposing=!1,_){const n={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let u;this._isSendingComposition=!1,n.start+=this._dataAlreadySent.length,u=this._isComposing?this._textarea.value.substring(n.start,n.end):this._textarea.value.substring(n.start),u.length>0&&this._coreService.triggerDataEvent(u,!0)}}),0)}else{this._isSendingComposition=!1;const n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}}_handleAnyTextareaChanges(){const _=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const n=this._textarea.value,u=n.replace(_,"");this._dataAlreadySent=u,n.length>_.length?this._coreService.triggerDataEvent(u,!0):n.length<_.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):n.length===_.length&&n!==_&&this._coreService.triggerDataEvent(n,!0)}}),0)}updateCompositionElements(_){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),u=this._renderService.dimensions.css.cell.height,c=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,h=n*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=h+"px",this._compositionView.style.top=c+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const m=this._compositionView.getBoundingClientRect();this._textarea.style.left=h+"px",this._textarea.style.top=c+"px",this._textarea.style.width=Math.max(m.width,1)+"px",this._textarea.style.height=Math.max(m.height,1)+"px",this._textarea.style.lineHeight=m.height+"px"}_||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};s.CompositionHelper=y=a([d(2,p.IBufferService),d(3,p.IOptionsService),d(4,p.ICoreService),d(5,o.IRenderService)],y)},9806:(C,s)=>{function i(a,d,o){const p=o.getBoundingClientRect(),S=a.getComputedStyle(o),y=parseInt(S.getPropertyValue("padding-left")),_=parseInt(S.getPropertyValue("padding-top"));return[d.clientX-p.left-y,d.clientY-p.top-_]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=i,s.getCoords=function(a,d,o,p,S,y,_,n,u){if(!y)return;const c=i(a,d,o);return c?(c[0]=Math.ceil((c[0]+(u?_/2:0))/_),c[1]=Math.ceil(c[1]/n),c[0]=Math.min(Math.max(c[0],1),p+(u?1:0)),c[1]=Math.min(Math.max(c[1],1),S),c):void 0}},9504:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const a=i(2584);function d(n,u,c,h){const m=n-o(n,c),b=u-o(u,c),w=Math.abs(m-b)-(function(k,g,E){let L=0;const T=k-o(k,E),M=g-o(g,E);for(let P=0;P<Math.abs(T-M);P++){const B=p(k,g)==="A"?-1:1,F=E.buffer.lines.get(T+B*P);F?.isWrapped&&L++}return L})(n,u,c);return _(w,y(p(n,u),h))}function o(n,u){let c=0,h=u.buffer.lines.get(n),m=h?.isWrapped;for(;m&&n>=0&&n<u.rows;)c++,h=u.buffer.lines.get(--n),m=h?.isWrapped;return c}function p(n,u){return n>u?"A":"B"}function S(n,u,c,h,m,b){let w=n,k=u,g="";for(;w!==c||k!==h;)w+=m?1:-1,m&&w>b.cols-1?(g+=b.buffer.translateBufferLineToString(k,!1,n,w),w=0,n=0,k++):!m&&w<0&&(g+=b.buffer.translateBufferLineToString(k,!1,0,n+1),w=b.cols-1,n=w,k--);return g+b.buffer.translateBufferLineToString(k,!1,n,w)}function y(n,u){const c=u?"O":"[";return a.C0.ESC+c+n}function _(n,u){n=Math.floor(n);let c="";for(let h=0;h<n;h++)c+=u;return c}s.moveToCellSequence=function(n,u,c,h){const m=c.buffer.x,b=c.buffer.y;if(!c.buffer.hasScrollback)return(function(g,E,L,T,M,P){return d(E,T,M,P).length===0?"":_(S(g,E,g,E-o(E,M),!1,M).length,y("D",P))})(m,b,0,u,c,h)+d(b,u,c,h)+(function(g,E,L,T,M,P){let B;B=d(E,T,M,P).length>0?T-o(T,M):E;const F=T,W=(function(H,D,j,N,O,$){let Y;return Y=d(j,N,O,$).length>0?N-o(N,O):D,H<j&&Y<=N||H>=j&&Y<N?"C":"D"})(g,E,L,T,M,P);return _(S(g,B,L,F,W==="C",M).length,y(W,P))})(m,b,n,u,c,h);let w;if(b===u)return w=m>n?"D":"C",_(Math.abs(m-n),y(w,h));w=b>u?"D":"C";const k=Math.abs(b-u);return _((function(g,E){return E.cols-g})(b>u?n:m,c)+(k-1)*c.cols+1+((b>u?m:n)-1),y(w,h))}},1296:function(C,s,i){var a=this&&this.__decorate||function(M,P,B,F){var W,H=arguments.length,D=H<3?P:F===null?F=Object.getOwnPropertyDescriptor(P,B):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(M,P,B,F);else for(var j=M.length-1;j>=0;j--)(W=M[j])&&(D=(H<3?W(D):H>3?W(P,B,D):W(P,B))||D);return H>3&&D&&Object.defineProperty(P,B,D),D},d=this&&this.__param||function(M,P){return function(B,F){P(B,F,M)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const o=i(3787),p=i(2550),S=i(2223),y=i(6171),_=i(4725),n=i(8055),u=i(8460),c=i(844),h=i(2585),m="xterm-dom-renderer-owner-",b="xterm-rows",w="xterm-fg-",k="xterm-bg-",g="xterm-focus",E="xterm-selection";let L=1,T=s.DomRenderer=class extends c.Disposable{constructor(M,P,B,F,W,H,D,j,N,O){super(),this._element=M,this._screenElement=P,this._viewportElement=B,this._linkifier2=F,this._charSizeService=H,this._optionsService=D,this._bufferService=j,this._coreBrowserService=N,this._themeService=O,this._terminalClass=L++,this._rowElements=[],this.onRequestRedraw=this.register(new u.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(b),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(E),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors(($=>this._injectCss($)))),this._injectCss(this._themeService.colors),this._rowFactory=W.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(m+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(($=>this._handleLinkHover($)))),this.register(this._linkifier2.onHideLinkUnderline(($=>this._handleLinkLeave($)))),this.register((0,c.toDisposable)((()=>{this._element.classList.remove(m+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const M=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*M,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*M),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/M),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/M),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=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const P=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=P,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(M){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let P=`${this._terminalSelector} .${b} { color: ${M.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;P+=`${this._terminalSelector} .${b} .xterm-dim { color: ${n.color.multiplyOpacity(M.foreground,.5).css};}`,P+=`${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;}`,P+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",P+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css}; } 50% { background-color: inherit; color: ${M.cursor.css}; }}`,P+=`${this._terminalSelector} .${b}.${g} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${b}.${g} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${M.cursor.css}; color: ${M.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${M.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${M.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${M.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,P+=`${this._terminalSelector} .${E} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${E} div { position: absolute; background-color: ${M.selectionBackgroundOpaque.css};}${this._terminalSelector} .${E} div { position: absolute; background-color: ${M.selectionInactiveBackgroundOpaque.css};}`;for(const[B,F]of M.ansi.entries())P+=`${this._terminalSelector} .${w}${B} { color: ${F.css}; }${this._terminalSelector} .${w}${B}.xterm-dim { color: ${n.color.multiplyOpacity(F,.5).css}; }${this._terminalSelector} .${k}${B} { background-color: ${F.css}; }`;P+=`${this._terminalSelector} .${w}${S.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(M.background).css}; }${this._terminalSelector} .${w}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(M.background),.5).css}; }${this._terminalSelector} .${k}${S.INVERTED_DEFAULT_COLOR} { background-color: ${M.foreground.css}; }`,this._themeStyleElement.textContent=P}_setDefaultSpacing(){const M=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${M}px`,this._rowFactory.defaultSpacing=M}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(M,P){for(let B=this._rowElements.length;B<=P;B++){const F=document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>P;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(M,P){this._refreshRowElements(M,P),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(g)}handleFocus(){this._rowContainer.classList.add(g),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(M,P,B){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(M,P,B),this.renderRows(0,this._bufferService.rows-1),!M||!P)return;const F=M[1]-this._bufferService.buffer.ydisp,W=P[1]-this._bufferService.buffer.ydisp,H=Math.max(F,0),D=Math.min(W,this._bufferService.rows-1);if(H>=this._bufferService.rows||D<0)return;const j=document.createDocumentFragment();if(B){const N=M[0]>P[0];j.appendChild(this._createSelectionElement(H,N?P[0]:M[0],N?M[0]:P[0],D-H+1))}else{const N=F===H?M[0]:0,O=H===W?P[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(H,N,O));const $=D-H-1;if(j.appendChild(this._createSelectionElement(H+1,0,this._bufferService.cols,$)),H!==D){const Y=W===D?P[0]:this._bufferService.cols;j.appendChild(this._createSelectionElement(D,0,Y))}}this._selectionContainer.appendChild(j)}_createSelectionElement(M,P,B,F=1){const W=document.createElement("div");return W.style.height=F*this.dimensions.css.cell.height+"px",W.style.top=M*this.dimensions.css.cell.height+"px",W.style.left=P*this.dimensions.css.cell.width+"px",W.style.width=this.dimensions.css.cell.width*(B-P)+"px",W}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 M of this._rowElements)M.replaceChildren()}renderRows(M,P){const B=this._bufferService.buffer,F=B.ybase+B.y,W=Math.min(B.x,this._bufferService.cols-1),H=this._optionsService.rawOptions.cursorBlink,D=this._optionsService.rawOptions.cursorStyle,j=this._optionsService.rawOptions.cursorInactiveStyle;for(let N=M;N<=P;N++){const O=N+B.ydisp,$=this._rowElements[N],Y=B.lines.get(O);if(!$||!Y)break;$.replaceChildren(...this._rowFactory.createRow(Y,O,O===F,D,j,W,H,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${m}${this._terminalClass}`}_handleLinkHover(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!0)}_handleLinkLeave(M){this._setCellUnderline(M.x1,M.x2,M.y1,M.y2,M.cols,!1)}_setCellUnderline(M,P,B,F,W,H){B<0&&(M=0),F<0&&(P=0);const D=this._bufferService.rows-1;B=Math.max(Math.min(B,D),0),F=Math.max(Math.min(F,D),0),W=Math.min(W,this._bufferService.cols);const j=this._bufferService.buffer,N=j.ybase+j.y,O=Math.min(j.x,W-1),$=this._optionsService.rawOptions.cursorBlink,Y=this._optionsService.rawOptions.cursorStyle,V=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=B;Q<=F;++Q){const re=Q+j.ydisp,A=this._rowElements[Q],I=j.lines.get(re);if(!A||!I)break;A.replaceChildren(...this._rowFactory.createRow(I,re,re===N,Y,V,O,$,this.dimensions.css.cell.width,this._widthCache,H?Q===B?M:0:-1,H?(Q===F?P:W)-1:-1))}}};s.DomRenderer=T=a([d(4,h.IInstantiationService),d(5,_.ICharSizeService),d(6,h.IOptionsService),d(7,h.IBufferService),d(8,_.ICoreBrowserService),d(9,_.IThemeService)],T)},3787:function(C,s,i){var a=this&&this.__decorate||function(w,k,g,E){var L,T=arguments.length,M=T<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,g):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,k,g,E);else for(var P=w.length-1;P>=0;P--)(L=w[P])&&(M=(T<3?L(M):T>3?L(k,g,M):L(k,g))||M);return T>3&&M&&Object.defineProperty(k,g,M),M},d=this&&this.__param||function(w,k){return function(g,E){k(g,E,w)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const o=i(2223),p=i(643),S=i(511),y=i(2585),_=i(8055),n=i(4725),u=i(4269),c=i(6171),h=i(3734);let m=s.DomRendererRowFactory=class{constructor(w,k,g,E,L,T,M){this._document=w,this._characterJoinerService=k,this._optionsService=g,this._coreBrowserService=E,this._coreService=L,this._decorationService=T,this._themeService=M,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(w,k,g){this._selectionStart=w,this._selectionEnd=k,this._columnSelectMode=g}createRow(w,k,g,E,L,T,M,P,B,F,W){const H=[],D=this._characterJoinerService.getJoinedCharacters(k),j=this._themeService.colors;let N,O=w.getNoBgTrimmedLength();g&&O<T+1&&(O=T+1);let $=0,Y="",V=0,Q=0,re=0,A=!1,I=0,U=!1,z=0;const Z=[],G=F!==-1&&W!==-1;for(let ie=0;ie<O;ie++){w.loadCell(ie,this._workCell);let le=this._workCell.getWidth();if(le===0)continue;let de=!1,ve=ie,ee=this._workCell;if(D.length>0&&ie===D[0][0]){de=!0;const fe=D.shift();ee=new u.JoinedCellData(this._workCell,w.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),ve=fe[1]-1,le=ee.getWidth()}const ke=this._isCellInSelection(ie,k),Be=g&&ie===T,Te=G&&ie>=F&&ie<=W;let Se=!1;this._decorationService.forEachDecorationAtCell(ie,k,void 0,(fe=>{Se=!0}));let Ie=ee.getChars()||p.WHITESPACE_CELL_CHAR;if(Ie===" "&&(ee.isUnderline()||ee.isOverline())&&(Ie=" "),z=le*P-B.get(Ie,ee.isBold(),ee.isItalic()),N){if($&&(ke&&U||!ke&&!U&&ee.bg===V)&&(ke&&U&&j.selectionForeground||ee.fg===Q)&&ee.extended.ext===re&&Te===A&&z===I&&!Be&&!de&&!Se){Y+=Ie,$++;continue}$&&(N.textContent=Y),N=this._document.createElement("span"),$=0,Y=""}else N=this._document.createElement("span");if(V=ee.bg,Q=ee.fg,re=ee.extended.ext,A=Te,I=z,U=ke,de&&T>=ie&&T<=ve&&(T=ie),!this._coreService.isCursorHidden&&Be){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(ee.isBold()&&Z.push("xterm-bold"),ee.isItalic()&&Z.push("xterm-italic"),ee.isDim()&&Z.push("xterm-dim"),Y=ee.isInvisible()?p.WHITESPACE_CELL_CHAR:ee.getChars()||p.WHITESPACE_CELL_CHAR,ee.isUnderline()&&(Z.push(`xterm-underline-${ee.extended.underlineStyle}`),Y===" "&&(Y=" "),!ee.isUnderlineColorDefault()))if(ee.isUnderlineColorRGB())N.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(ee.getUnderlineColor()).join(",")})`;else{let fe=ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ee.isBold()&&fe<8&&(fe+=8),N.style.textDecorationColor=j.ansi[fe].css}ee.isOverline()&&(Z.push("xterm-overline"),Y===" "&&(Y=" ")),ee.isStrikethrough()&&Z.push("xterm-strikethrough"),Te&&(N.style.textDecoration="underline");let Re=ee.getFgColor(),K=ee.getFgColorMode(),q=ee.getBgColor(),te=ee.getBgColorMode();const me=!!ee.isInverse();if(me){const fe=Re;Re=q,q=fe;const dt=K;K=te,te=dt}let oe,ye,xe,De=!1;switch(this._decorationService.forEachDecorationAtCell(ie,k,void 0,(fe=>{fe.options.layer!=="top"&&De||(fe.backgroundColorRGB&&(te=50331648,q=fe.backgroundColorRGB.rgba>>8&16777215,oe=fe.backgroundColorRGB),fe.foregroundColorRGB&&(K=50331648,Re=fe.foregroundColorRGB.rgba>>8&16777215,ye=fe.foregroundColorRGB),De=fe.options.layer==="top")})),!De&&ke&&(oe=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,q=oe.rgba>>8&16777215,te=50331648,De=!0,j.selectionForeground&&(K=50331648,Re=j.selectionForeground.rgba>>8&16777215,ye=j.selectionForeground)),De&&Z.push("xterm-decoration-top"),te){case 16777216:case 33554432:xe=j.ansi[q],Z.push(`xterm-bg-${q}`);break;case 50331648:xe=_.rgba.toColor(q>>16,q>>8&255,255&q),this._addStyle(N,`background-color:#${b((q>>>0).toString(16),"0",6)}`);break;default:me?(xe=j.foreground,Z.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):xe=j.background}switch(oe||ee.isDim()&&(oe=_.color.multiplyOpacity(xe,.5)),K){case 16777216:case 33554432:ee.isBold()&&Re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Re+=8),this._applyMinimumContrast(N,xe,j.ansi[Re],ee,oe,void 0)||Z.push(`xterm-fg-${Re}`);break;case 50331648:const fe=_.rgba.toColor(Re>>16&255,Re>>8&255,255&Re);this._applyMinimumContrast(N,xe,fe,ee,oe,ye)||this._addStyle(N,`color:#${b(Re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(N,xe,j.foreground,ee,oe,void 0)||me&&Z.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}Z.length&&(N.className=Z.join(" "),Z.length=0),Be||de||Se?N.textContent=Y:$++,z!==this.defaultSpacing&&(N.style.letterSpacing=`${z}px`),H.push(N),ie=ve}return N&&$&&(N.textContent=Y),H}_applyMinimumContrast(w,k,g,E,L,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,c.excludeFromContrastRatioDemands)(E.getCode()))return!1;const M=this._getContrastCache(E);let P;if(L||T||(P=M.getColor(k.rgba,g.rgba)),P===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);P=_.color.ensureContrastRatio(L||k,T||g,B),M.setColor((L||k).rgba,(T||g).rgba,P??null)}return!!P&&(this._addStyle(w,`color:${P.css}`),!0)}_getContrastCache(w){return w.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(w,k){w.setAttribute("style",`${w.getAttribute("style")||""}${k};`)}_isCellInSelection(w,k){const g=this._selectionStart,E=this._selectionEnd;return!(!g||!E)&&(this._columnSelectMode?g[0]<=E[0]?w>=g[0]&&k>=g[1]&&w<E[0]&&k<=E[1]:w<g[0]&&k>=g[1]&&w>=E[0]&&k<=E[1]:k>g[1]&&k<E[1]||g[1]===E[1]&&k===g[1]&&w>=g[0]&&w<E[0]||g[1]<E[1]&&k===E[1]&&w<E[0]||g[1]<E[1]&&k===g[1]&&w>=g[0])}};function b(w,k,g){for(;w.length<g;)w=k+w;return w}s.DomRendererRowFactory=m=a([d(1,n.ICharacterJoinerService),d(2,y.IOptionsService),d(3,n.ICoreBrowserService),d(4,y.ICoreService),d(5,y.IDecorationService),d(6,n.IThemeService)],m)},2550:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=i.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const a=i.createElement("span"),d=i.createElement("span");d.style.fontWeight="bold";const o=i.createElement("span");o.style.fontStyle="italic";const p=i.createElement("span");p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[a,d,o,p],this._container.appendChild(a),this._container.appendChild(d),this._container.appendChild(o),this._container.appendChild(p),i.body.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(i,a,d,o){i===this._font&&a===this._fontSize&&d===this._weight&&o===this._weightBold||(this._font=i,this._fontSize=a,this._weight=d,this._weightBold=o,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${o}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${o}`,this.clear())}get(i,a,d){let o=0;if(!a&&!d&&i.length===1&&(o=i.charCodeAt(0))<256)return this._flat[o]!==-9999?this._flat[o]:this._flat[o]=this._measure(i,0);let p=i;a&&(p+="B"),d&&(p+="I");let S=this._holey.get(p);if(S===void 0){let y=0;a&&(y|=1),d&&(y|=2),S=this._measure(i,y),this._holey.set(p,S)}return S}_measure(i,a){const d=this._measureElements[a];return d.textContent=i.repeat(32),d.offsetWidth/32}}},2223:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const a=i(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=a.isFirefox||a.isLegacyEdge?"bottom":"ideographic"},6171:(C,s)=>{function i(a){return 57508<=a&&a<=57558}Object.defineProperty(s,"__esModule",{value:!0}),s.createRenderDimensions=s.excludeFromContrastRatioDemands=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(a){if(!a)throw new Error("value must not be falsy");return a},s.isPowerlineGlyph=i,s.isRestrictedPowerlineGlyph=function(a){return 57520<=a&&a<=57527},s.excludeFromContrastRatioDemands=function(a){return i(a)||(function(d){return 9472<=d&&d<=9631})(a)},s.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}}}}},456:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(i){this._bufferService=i,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 i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?i%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const i=this.selectionStart,a=this.selectionEnd;return!(!i||!a)&&(i[1]>a[1]||i[1]===a[1]&&i[0]>a[0])}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(C,s,i){var a=this&&this.__decorate||function(n,u,c,h){var m,b=arguments.length,w=b<3?u:h===null?h=Object.getOwnPropertyDescriptor(u,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,u,c,h);else for(var k=n.length-1;k>=0;k--)(m=n[k])&&(w=(b<3?m(w):b>3?m(u,c,w):m(u,c))||w);return b>3&&w&&Object.defineProperty(u,c,w),w},d=this&&this.__param||function(n,u){return function(c,h){u(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const o=i(2585),p=i(8460),S=i(844);let y=s.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(n,u,c){super(),this._optionsService=c,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new _(n,u,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const n=this._measureStrategy.measure();n.width===this.width&&n.height===this.height||(this.width=n.width,this.height=n.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=a([d(2,o.IOptionsService)],y);class _{constructor(u,c,h){this._document=u,this._parentElement=c,this._optionsService=h,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const u={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return u.width!==0&&u.height!==0&&(this._result.width=u.width/32,this._result.height=Math.ceil(u.height)),this._result}}},4269:function(C,s,i){var a=this&&this.__decorate||function(u,c,h,m){var b,w=arguments.length,k=w<3?c:m===null?m=Object.getOwnPropertyDescriptor(c,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(u,c,h,m);else for(var g=u.length-1;g>=0;g--)(b=u[g])&&(k=(w<3?b(k):w>3?b(c,h,k):b(c,h))||k);return w>3&&k&&Object.defineProperty(c,h,k),k},d=this&&this.__param||function(u,c){return function(h,m){c(h,m,u)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const o=i(3734),p=i(643),S=i(511),y=i(2585);class _ extends o.AttributeData{constructor(c,h,m){super(),this.content=0,this.combinedData="",this.fg=c.fg,this.bg=c.bg,this.combinedData=h,this._width=m}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(c){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=_;let n=s.CharacterJoinerService=class ln{constructor(c){this._bufferService=c,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(c){const h={id:this._nextCharacterJoinerId++,handler:c};return this._characterJoiners.push(h),h.id}deregister(c){for(let h=0;h<this._characterJoiners.length;h++)if(this._characterJoiners[h].id===c)return this._characterJoiners.splice(h,1),!0;return!1}getJoinedCharacters(c){if(this._characterJoiners.length===0)return[];const h=this._bufferService.buffer.lines.get(c);if(!h||h.length===0)return[];const m=[],b=h.translateToString(!0);let w=0,k=0,g=0,E=h.getFg(0),L=h.getBg(0);for(let T=0;T<h.getTrimmedLength();T++)if(h.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==L){if(T-w>1){const M=this._getJoinedRanges(b,g,k,h,w);for(let P=0;P<M.length;P++)m.push(M[P])}w=T,g=k,E=this._workCell.fg,L=this._workCell.bg}k+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-w>1){const T=this._getJoinedRanges(b,g,k,h,w);for(let M=0;M<T.length;M++)m.push(T[M])}return m}_getJoinedRanges(c,h,m,b,w){const k=c.substring(h,m);let g=[];try{g=this._characterJoiners[0].handler(k)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const L=this._characterJoiners[E].handler(k);for(let T=0;T<L.length;T++)ln._mergeRanges(g,L[T])}catch(L){console.error(L)}return this._stringRangesToCellRanges(g,b,w),g}_stringRangesToCellRanges(c,h,m){let b=0,w=!1,k=0,g=c[b];if(g){for(let E=m;E<this._bufferService.cols;E++){const L=h.getWidth(E),T=h.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!w&&g[0]<=k&&(g[0]=E,w=!0),g[1]<=k){if(g[1]=E,g=c[++b],!g)break;g[0]<=k?(g[0]=E,w=!0):w=!1}k+=T}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(c,h){let m=!1;for(let b=0;b<c.length;b++){const w=c[b];if(m){if(h[1]<=w[0])return c[b-1][1]=h[1],c;if(h[1]<=w[1])return c[b-1][1]=Math.max(h[1],w[1]),c.splice(b,1),c;c.splice(b,1),b--}else{if(h[1]<=w[0])return c.splice(b,0,h),c;if(h[1]<=w[1])return w[0]=Math.min(h[0],w[0]),c;h[0]<w[1]&&(w[0]=Math.min(h[0],w[0]),m=!0)}}return m?c[c.length-1][1]=h[1]:c.push(h),c}};s.CharacterJoinerService=n=a([d(0,y.IBufferService)],n)},5114:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0,s.CoreBrowserService=class{constructor(i,a){this._textarea=i,this.window=a,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}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}}},8934:function(C,s,i){var a=this&&this.__decorate||function(y,_,n,u){var c,h=arguments.length,m=h<3?_:u===null?u=Object.getOwnPropertyDescriptor(_,n):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(y,_,n,u);else for(var b=y.length-1;b>=0;b--)(c=y[b])&&(m=(h<3?c(m):h>3?c(_,n,m):c(_,n))||m);return h>3&&m&&Object.defineProperty(_,n,m),m},d=this&&this.__param||function(y,_){return function(n,u){_(n,u,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const o=i(4725),p=i(9806);let S=s.MouseService=class{constructor(y,_){this._renderService=y,this._charSizeService=_}getCoords(y,_,n,u,c){return(0,p.getCoords)(window,y,_,n,u,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,c)}getMouseReportCoords(y,_){const n=(0,p.getCoordsRelativeToElement)(window,y,_);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};s.MouseService=S=a([d(0,o.IRenderService),d(1,o.ICharSizeService)],S)},3230:function(C,s,i){var a=this&&this.__decorate||function(m,b,w,k){var g,E=arguments.length,L=E<3?b:k===null?k=Object.getOwnPropertyDescriptor(b,w):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(m,b,w,k);else for(var T=m.length-1;T>=0;T--)(g=m[T])&&(L=(E<3?g(L):E>3?g(b,w,L):g(b,w))||L);return E>3&&L&&Object.defineProperty(b,w,L),L},d=this&&this.__param||function(m,b){return function(w,k){b(w,k,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const o=i(3656),p=i(6193),S=i(5596),y=i(4725),_=i(8460),n=i(844),u=i(7226),c=i(2585);let h=s.RenderService=class extends n.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,b,w,k,g,E,L,T){if(super(),this._rowCount=m,this._charSizeService=k,this._renderer=this.register(new n.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(L.window,((M,P)=>this._renderRows(M,P))),this.register(this._renderDebouncer),this._screenDprMonitor=new S.ScreenDprMonitor(L.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(E.onResize((()=>this._fullRefresh()))),this.register(E.buffers.onBufferActivate((()=>{var M;return(M=this._renderer.value)===null||M===void 0?void 0:M.clear()}))),this.register(w.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(g.onDecorationRegistered((()=>this._fullRefresh()))),this.register(g.onDecorationRemoved((()=>this._fullRefresh()))),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(E.cols,E.rows),this._fullRefresh()}))),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(E.buffer.y,E.buffer.y,!0)))),this.register((0,o.addDisposableDomListener)(L.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(T.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in L.window){const M=new L.window.IntersectionObserver((P=>this._handleIntersectionChange(P[P.length-1])),{threshold:0});M.observe(b),this.register({dispose:()=>M.disconnect()})}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.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(m,b,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,b,this._rowCount))}_renderRows(m,b){this._renderer.value&&(m=Math.min(m,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(m,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:m,end:b}),this._onRender.fire({start:m,end:b}),this._isNextRenderRedrawOnly=!0)}resize(m,b){this._rowCount=b,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(m){this._renderer.value=m,this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,b;this._renderer.value&&((b=(m=this._renderer.value).clearTextureAtlas)===null||b===void 0||b.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(m,b))):this._renderer.value.handleResize(m,b),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)===null||m===void 0||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)===null||m===void 0||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)===null||m===void 0||m.handleFocus()}handleSelectionChanged(m,b,w){var k;this._selectionState.start=m,this._selectionState.end=b,this._selectionState.columnSelectMode=w,(k=this._renderer.value)===null||k===void 0||k.handleSelectionChanged(m,b,w)}handleCursorMove(){var m;(m=this._renderer.value)===null||m===void 0||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)===null||m===void 0||m.clear()}};s.RenderService=h=a([d(2,c.IOptionsService),d(3,y.ICharSizeService),d(4,c.IDecorationService),d(5,c.IBufferService),d(6,y.ICoreBrowserService),d(7,y.IThemeService)],h)},9312:function(C,s,i){var a=this&&this.__decorate||function(g,E,L,T){var M,P=arguments.length,B=P<3?E:T===null?T=Object.getOwnPropertyDescriptor(E,L):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(g,E,L,T);else for(var F=g.length-1;F>=0;F--)(M=g[F])&&(B=(P<3?M(B):P>3?M(E,L,B):M(E,L))||B);return P>3&&B&&Object.defineProperty(E,L,B),B},d=this&&this.__param||function(g,E){return function(L,T){E(L,T,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const o=i(9806),p=i(9504),S=i(456),y=i(4725),_=i(8460),n=i(844),u=i(6114),c=i(4841),h=i(511),m=i(2585),b=" ",w=new RegExp(b,"g");let k=s.SelectionService=class extends n.Disposable{constructor(g,E,L,T,M,P,B,F,W){super(),this._element=g,this._screenElement=E,this._linkifier=L,this._bufferService=T,this._coreService=M,this._mouseService=P,this._optionsService=B,this._renderService=F,this._coreBrowserService=W,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new _.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new _.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new _.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=H=>this._handleMouseMove(H),this._mouseUpListener=H=>this._handleMouseUp(H),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((H=>this._handleTrim(H))),this.register(this._bufferService.buffers.onBufferActivate((H=>this._handleBufferActivate(H)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,n.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 g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!g||!E||g[0]===E[0]&&g[1]===E[1])}get selectionText(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!g||!E)return"";const L=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(g[0]===E[0])return"";const M=g[0]<E[0]?g[0]:E[0],P=g[0]<E[0]?E[0]:g[0];for(let B=g[1];B<=E[1];B++){const F=L.translateBufferLineToString(B,!0,M,P);T.push(F)}}else{const M=g[1]===E[1]?E[0]:void 0;T.push(L.translateBufferLineToString(g[1],!0,g[0],M));for(let P=g[1]+1;P<=E[1]-1;P++){const B=L.lines.get(P),F=L.translateBufferLineToString(P,!0);B?.isWrapped?T[T.length-1]+=F:T.push(F)}if(g[1]!==E[1]){const P=L.lines.get(E[1]),B=L.translateBufferLineToString(E[1],!0,0,E[0]);P&&P.isWrapped?T[T.length-1]+=B:T.push(B)}}return T.map((M=>M.replace(w," "))).join(u.isWindows?`\r
|
|
16
|
+
`:`
|
|
17
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),u.isLinux&&g&&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(g){const E=this._getMouseBufferCoords(g),L=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(L&&T&&E)&&this._areCoordsInSelection(E,L,T)}isCellInSelection(g,E){const L=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!L||!T)&&this._areCoordsInSelection([g,E],L,T)}_areCoordsInSelection(g,E,L){return g[1]>E[1]&&g[1]<L[1]||E[1]===L[1]&&g[1]===E[1]&&g[0]>=E[0]&&g[0]<L[0]||E[1]<L[1]&&g[1]===L[1]&&g[0]<L[0]||E[1]<L[1]&&g[1]===E[1]&&g[0]>=E[0]}_selectWordAtCursor(g,E){var L,T;const M=(T=(L=this._linkifier.currentLink)===null||L===void 0?void 0:L.link)===null||T===void 0?void 0:T.range;if(M)return this._model.selectionStart=[M.start.x-1,M.start.y-1],this._model.selectionStartLength=(0,c.getRangeLength)(M,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const P=this._getMouseBufferCoords(g);return!!P&&(this._selectWordAt(P,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,E){this._model.clearSelection(),g=Math.max(g,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const E=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(g){let E=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=L?0:(E>L&&(E-=L),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(g){return u.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(g),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(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const E=this._getMouseBufferCoords(g);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(g){return g.altKey&&!(u.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!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(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const T=L.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const E=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const T=(0,p.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,L=!(!g||!E||g[0]===E[0]&&g[1]===E[1]);L?g&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,E,L)):this._oldHasSelection&&this._fireOnSelectionChange(g,E,L)}_fireOnSelectionChange(g,E,L){this._oldSelectionStart=g,this._oldSelectionEnd=E,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(g,E){let L=E;for(let T=0;E>=T;T++){const M=g.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:M>1&&E!==T&&(L+=M-1)}return L}setSelection(g,E,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,E],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,E,L=!0,T=!0){if(g[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,P=M.lines.get(g[1]);if(!P)return;const B=M.translateBufferLineToString(g[1],!1);let F=this._convertViewportColToCharacterIndex(P,g[0]),W=F;const H=g[0]-F;let D=0,j=0,N=0,O=0;if(B.charAt(F)===" "){for(;F>0&&B.charAt(F-1)===" ";)F--;for(;W<B.length&&B.charAt(W+1)===" ";)W++}else{let V=g[0],Q=g[0];P.getWidth(V)===0&&(D++,V--),P.getWidth(Q)===2&&(j++,Q++);const re=P.getString(Q).length;for(re>1&&(O+=re-1,W+=re-1);V>0&&F>0&&!this._isCharWordSeparator(P.loadCell(V-1,this._workCell));){P.loadCell(V-1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===0?(D++,V--):A>1&&(N+=A-1,F-=A-1),F--,V--}for(;Q<P.length&&W+1<B.length&&!this._isCharWordSeparator(P.loadCell(Q+1,this._workCell));){P.loadCell(Q+1,this._workCell);const A=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,Q++):A>1&&(O+=A-1,W+=A-1),W++,Q++}}W++;let $=F+H-D+N,Y=Math.min(this._bufferService.cols,W-F+D+j-N-O);if(E||B.slice(F,W).trim()!==""){if(L&&$===0&&P.getCodePoint(0)!==32){const V=M.lines.get(g[1]-1);if(V&&P.isWrapped&&V.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(Q){const re=this._bufferService.cols-Q.start;$-=re,Y+=re}}}if(T&&$+Y===this._bufferService.cols&&P.getCodePoint(this._bufferService.cols-1)!==32){const V=M.lines.get(g[1]+1);if(V?.isWrapped&&V.getCodePoint(0)!==32){const Q=this._getWordAt([0,g[1]+1],!1,!1,!0);Q&&(Y+=Q.length)}}return{start:$,length:Y}}}_selectWordAt(g,E){const L=this._getWordAt(g,E);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[L.start,g[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(g){const E=this._getWordAt(g,!0);if(E){let L=g[1];for(;E.start<0;)E.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,L]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const E=this._bufferService.buffer.getWrappedRangeForLine(g),L={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,c.getRangeLength)(L,this._bufferService.cols)}};s.SelectionService=k=a([d(3,m.IBufferService),d(4,m.ICoreService),d(5,y.IMouseService),d(6,m.IOptionsService),d(7,y.IRenderService),d(8,y.ICoreBrowserService)],k)},4725:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const a=i(8343);s.ICharSizeService=(0,a.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,a.createDecorator)("CoreBrowserService"),s.IMouseService=(0,a.createDecorator)("MouseService"),s.IRenderService=(0,a.createDecorator)("RenderService"),s.ISelectionService=(0,a.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,a.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,a.createDecorator)("ThemeService")},6731:function(C,s,i){var a=this&&this.__decorate||function(k,g,E,L){var T,M=arguments.length,P=M<3?g:L===null?L=Object.getOwnPropertyDescriptor(g,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(k,g,E,L);else for(var B=k.length-1;B>=0;B--)(T=k[B])&&(P=(M<3?T(P):M>3?T(g,E,P):T(g,E))||P);return M>3&&P&&Object.defineProperty(g,E,P),P},d=this&&this.__param||function(k,g){return function(E,L){g(E,L,k)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const o=i(7239),p=i(8055),S=i(8460),y=i(844),_=i(2585),n=p.css.toColor("#ffffff"),u=p.css.toColor("#000000"),c=p.css.toColor("#ffffff"),h=p.css.toColor("#000000"),m={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const k=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let E=0;E<216;E++){const L=g[E/36%6|0],T=g[E/6%6|0],M=g[E%6];k.push({css:p.channels.toCss(L,T,M),rgba:p.channels.toRgba(L,T,M)})}for(let E=0;E<24;E++){const L=8+10*E;k.push({css:p.channels.toCss(L,L,L),rgba:p.channels.toRgba(L,L,L)})}return k})());let b=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(k){super(),this._optionsService=k,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:n,background:u,cursor:c,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:p.color.blend(u,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:p.color.blend(u,m),ansi:s.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(k={}){const g=this._colors;if(g.foreground=w(k.foreground,n),g.background=w(k.background,u),g.cursor=w(k.cursor,c),g.cursorAccent=w(k.cursorAccent,h),g.selectionBackgroundTransparent=w(k.selectionBackground,m),g.selectionBackgroundOpaque=p.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=w(k.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=p.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=k.selectionForeground?w(k.selectionForeground,p.NULL_COLOR):void 0,g.selectionForeground===p.NULL_COLOR&&(g.selectionForeground=void 0),p.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=p.color.opacity(g.selectionBackgroundTransparent,.3)),p.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=p.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=s.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=w(k.black,s.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=w(k.red,s.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=w(k.green,s.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=w(k.yellow,s.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=w(k.blue,s.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=w(k.magenta,s.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=w(k.cyan,s.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=w(k.white,s.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=w(k.brightBlack,s.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=w(k.brightRed,s.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=w(k.brightGreen,s.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=w(k.brightYellow,s.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=w(k.brightBlue,s.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=w(k.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=w(k.brightCyan,s.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=w(k.brightWhite,s.DEFAULT_ANSI_COLORS[15]),k.extendedAnsi){const E=Math.min(g.ansi.length-16,k.extendedAnsi.length);for(let L=0;L<E;L++)g.ansi[L+16]=w(k.extendedAnsi[L],s.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(k){this._restoreColor(k),this._onChangeColors.fire(this.colors)}_restoreColor(k){if(k!==void 0)switch(k){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[k]=this._restoreColors.ansi[k]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(k){k(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 w(k,g){if(k!==void 0)try{return p.css.toColor(k)}catch{}return g}s.ThemeService=b=a([d(0,_.IOptionsService)],b)},6349:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const a=i(8460),d=i(844);class o extends d.Disposable{constructor(S){super(),this._maxLength=S,this.onDeleteEmitter=this.register(new a.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new a.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new a.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(S){if(this._maxLength===S)return;const y=new Array(S);for(let _=0;_<Math.min(S,this.length);_++)y[_]=this._array[this._getCyclicIndex(_)];this._array=y,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let y=this._length;y<S;y++)this._array[y]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,y){this._array[this._getCyclicIndex(S)]=y}push(S){this._array[this._getCyclicIndex(this._length)]=S,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(S,y,..._){if(y){for(let n=S;n<this._length-y;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+y)];this._length-=y,this.onDeleteEmitter.fire({index:S,amount:y})}for(let n=this._length-1;n>=S;n--)this._array[this._getCyclicIndex(n+_.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<_.length;n++)this._array[this._getCyclicIndex(S+n)]=_[n];if(_.length&&this.onInsertEmitter.fire({index:S,amount:_.length}),this._length+_.length>this._maxLength){const n=this._length+_.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=_.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,y,_){if(!(y<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let u=y-1;u>=0;u--)this.set(S+u+_,this.get(S+u));const n=S+y+_-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<y;n++)this.set(S+n+_,this.get(S+n))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}s.CircularList=o},1439:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function i(a,d=5){if(typeof a!="object")return a;const o=Array.isArray(a)?[]:{};for(const p in a)o[p]=d<=1?a[p]:a[p]&&i(a[p],d-1);return o}},8055:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;const a=i(6114);let d=0,o=0,p=0,S=0;var y,_,n,u,c;function h(b){const w=b.toString(16);return w.length<2?"0"+w:w}function m(b,w){return b<w?(w+.05)/(b+.05):(b+.05)/(w+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(w,k,g,E){return E!==void 0?`#${h(w)}${h(k)}${h(g)}${h(E)}`:`#${h(w)}${h(k)}${h(g)}`},b.toRgba=function(w,k,g,E=255){return(w<<24|k<<16|g<<8|E)>>>0}})(y||(s.channels=y={})),(function(b){function w(k,g){return S=Math.round(255*g),[d,o,p]=c.toChannels(k.rgba),{css:y.toCss(d,o,p,S),rgba:y.toRgba(d,o,p,S)}}b.blend=function(k,g){if(S=(255&g.rgba)/255,S===1)return{css:g.css,rgba:g.rgba};const E=g.rgba>>24&255,L=g.rgba>>16&255,T=g.rgba>>8&255,M=k.rgba>>24&255,P=k.rgba>>16&255,B=k.rgba>>8&255;return d=M+Math.round((E-M)*S),o=P+Math.round((L-P)*S),p=B+Math.round((T-B)*S),{css:y.toCss(d,o,p),rgba:y.toRgba(d,o,p)}},b.isOpaque=function(k){return(255&k.rgba)==255},b.ensureContrastRatio=function(k,g,E){const L=c.ensureContrastRatio(k.rgba,g.rgba,E);if(L)return c.toColor(L>>24&255,L>>16&255,L>>8&255)},b.opaque=function(k){const g=(255|k.rgba)>>>0;return[d,o,p]=c.toChannels(g),{css:y.toCss(d,o,p),rgba:g}},b.opacity=w,b.multiplyOpacity=function(k,g){return S=255&k.rgba,w(k,S*g/255)},b.toColorRGB=function(k){return[k.rgba>>24&255,k.rgba>>16&255,k.rgba>>8&255]}})(_||(s.color=_={})),(function(b){let w,k;if(!a.isNode){const g=document.createElement("canvas");g.width=1,g.height=1;const E=g.getContext("2d",{willReadFrequently:!0});E&&(w=E,w.globalCompositeOperation="copy",k=w.createLinearGradient(0,0,1,1))}b.toColor=function(g){if(g.match(/#[\da-f]{3,8}/i))switch(g.length){case 4:return d=parseInt(g.slice(1,2).repeat(2),16),o=parseInt(g.slice(2,3).repeat(2),16),p=parseInt(g.slice(3,4).repeat(2),16),c.toColor(d,o,p);case 5:return d=parseInt(g.slice(1,2).repeat(2),16),o=parseInt(g.slice(2,3).repeat(2),16),p=parseInt(g.slice(3,4).repeat(2),16),S=parseInt(g.slice(4,5).repeat(2),16),c.toColor(d,o,p,S);case 7:return{css:g,rgba:(parseInt(g.slice(1),16)<<8|255)>>>0};case 9:return{css:g,rgba:parseInt(g.slice(1),16)>>>0}}const E=g.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(E)return d=parseInt(E[1]),o=parseInt(E[2]),p=parseInt(E[3]),S=Math.round(255*(E[5]===void 0?1:parseFloat(E[5]))),c.toColor(d,o,p,S);if(!w||!k)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=k,w.fillStyle=g,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[d,o,p,S]=w.getImageData(0,0,1,1).data,S!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(d,o,p,S),css:g}}})(n||(s.css=n={})),(function(b){function w(k,g,E){const L=k/255,T=g/255,M=E/255;return .2126*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))}b.relativeLuminance=function(k){return w(k>>16&255,k>>8&255,255&k)},b.relativeLuminance2=w})(u||(s.rgb=u={})),(function(b){function w(g,E,L){const T=g>>24&255,M=g>>16&255,P=g>>8&255;let B=E>>24&255,F=E>>16&255,W=E>>8&255,H=m(u.relativeLuminance2(B,F,W),u.relativeLuminance2(T,M,P));for(;H<L&&(B>0||F>0||W>0);)B-=Math.max(0,Math.ceil(.1*B)),F-=Math.max(0,Math.ceil(.1*F)),W-=Math.max(0,Math.ceil(.1*W)),H=m(u.relativeLuminance2(B,F,W),u.relativeLuminance2(T,M,P));return(B<<24|F<<16|W<<8|255)>>>0}function k(g,E,L){const T=g>>24&255,M=g>>16&255,P=g>>8&255;let B=E>>24&255,F=E>>16&255,W=E>>8&255,H=m(u.relativeLuminance2(B,F,W),u.relativeLuminance2(T,M,P));for(;H<L&&(B<255||F<255||W<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),F=Math.min(255,F+Math.ceil(.1*(255-F))),W=Math.min(255,W+Math.ceil(.1*(255-W))),H=m(u.relativeLuminance2(B,F,W),u.relativeLuminance2(T,M,P));return(B<<24|F<<16|W<<8|255)>>>0}b.ensureContrastRatio=function(g,E,L){const T=u.relativeLuminance(g>>8),M=u.relativeLuminance(E>>8);if(m(T,M)<L){if(M<T){const F=w(g,E,L),W=m(T,u.relativeLuminance(F>>8));if(W<L){const H=k(g,E,L);return W>m(T,u.relativeLuminance(H>>8))?F:H}return F}const P=k(g,E,L),B=m(T,u.relativeLuminance(P>>8));if(B<L){const F=w(g,E,L);return B>m(T,u.relativeLuminance(F>>8))?P:F}return P}},b.reduceLuminance=w,b.increaseLuminance=k,b.toChannels=function(g){return[g>>24&255,g>>16&255,g>>8&255,255&g]},b.toColor=function(g,E,L,T){return{css:y.toCss(g,E,L,T),rgba:y.toRgba(g,E,L,T)}}})(c||(s.rgba=c={})),s.toPaddedHex=h,s.contrastRatio=m},8969:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const a=i(844),d=i(2585),o=i(4348),p=i(7866),S=i(744),y=i(7302),_=i(6975),n=i(8460),u=i(1753),c=i(1480),h=i(7994),m=i(9282),b=i(5435),w=i(5981),k=i(2660);let g=!1;class E extends a.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new n.EventEmitter),this._onScroll.event((T=>{var M;(M=this._onScrollApi)===null||M===void 0||M.fire(T.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(T){for(const M in T)this.optionsService.options[M]=T[M]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new a.MutableDisposable),this._onBinary=this.register(new n.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new n.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new n.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new y.OptionsService(T)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(S.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(_.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(u.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(c.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(k.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,n.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,n.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,n.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,n.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((M=>{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((M=>{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 w.WriteBuffer(((M,P)=>this._inputHandler.parse(M,P)))),this.register((0,n.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,M){this._writeBuffer.write(T,M)}writeSync(T,M){this._logService.logLevel<=d.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(T,M)}resize(T,M){isNaN(T)||isNaN(M)||(T=Math.max(T,S.MINIMUM_COLS),M=Math.max(M,S.MINIMUM_ROWS),this._bufferService.resize(T,M))}scroll(T,M=!1){this._bufferService.scroll(T,M)}scrollLines(T,M,P){this._bufferService.scrollLines(T,M,P)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){const M=T-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(T,M){return this._inputHandler.registerEscHandler(T,M)}registerDcsHandler(T,M){return this._inputHandler.registerDcsHandler(T,M)}registerCsiHandler(T,M){return this._inputHandler.registerCsiHandler(T,M)}registerOscHandler(T,M){return this._inputHandler.registerOscHandler(T,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?T=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const T=[];T.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,a.toDisposable)((()=>{for(const M of T)M.dispose()}))}}}s.CoreTerminal=E},8460:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=i=>(this._listeners.push(i),{dispose:()=>{if(!this._disposed){for(let a=0;a<this._listeners.length;a++)if(this._listeners[a]===i)return void this._listeners.splice(a,1)}}})),this._event}fire(i,a){const d=[];for(let o=0;o<this._listeners.length;o++)d.push(this._listeners[o]);for(let o=0;o<d.length;o++)d[o].call(void 0,i,a)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(i,a){return i((d=>a.fire(d)))}},5435:function(C,s,i){var a=this&&this.__decorate||function(H,D,j,N){var O,$=arguments.length,Y=$<3?D:N===null?N=Object.getOwnPropertyDescriptor(D,j):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(H,D,j,N);else for(var V=H.length-1;V>=0;V--)(O=H[V])&&(Y=($<3?O(Y):$>3?O(D,j,Y):O(D,j))||Y);return $>3&&Y&&Object.defineProperty(D,j,Y),Y},d=this&&this.__param||function(H,D){return function(j,N){D(j,N,H)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const o=i(2584),p=i(7116),S=i(2015),y=i(844),_=i(482),n=i(8437),u=i(8460),c=i(643),h=i(511),m=i(3734),b=i(2585),w=i(6242),k=i(6351),g=i(5941),E={"(":0,")":1,"*":2,"+":3,"-":1,".":2},L=131072;function T(H,D){if(H>24)return D.setWinLines||!1;switch(H){case 1:return!!D.restoreWin;case 2:return!!D.minimizeWin;case 3:return!!D.setWinPosition;case 4:return!!D.setWinSizePixels;case 5:return!!D.raiseWin;case 6:return!!D.lowerWin;case 7:return!!D.refreshWin;case 8:return!!D.setWinSizeChars;case 9:return!!D.maximizeWin;case 10:return!!D.fullscreenWin;case 11:return!!D.getWinState;case 13:return!!D.getWinPosition;case 14:return!!D.getWinSizePixels;case 15:return!!D.getScreenSizePixels;case 16:return!!D.getCellSizePixels;case 18:return!!D.getWinSizeChars;case 19:return!!D.getScreenSizeChars;case 20:return!!D.getIconTitle;case 21:return!!D.getWinTitle;case 22:return!!D.pushTitle;case 23:return!!D.popTitle;case 24:return!!D.setWinLines}return!1}var M;(function(H){H[H.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",H[H.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(M||(s.WindowsOptionsReportType=M={}));let P=0;class B extends y.Disposable{getAttrData(){return this._curAttrData}constructor(D,j,N,O,$,Y,V,Q,re=new S.EscapeSequenceParser){super(),this._bufferService=D,this._charsetService=j,this._coreService=N,this._logService=O,this._optionsService=$,this._oscLinkService=Y,this._coreMouseService=V,this._unicodeService=Q,this._parser=re,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _.StringToUtf32,this._utf8Decoder=new _.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new u.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new u.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new u.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new u.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new u.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new u.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new u.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new u.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new u.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new u.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new u.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((A=>this._activeBuffer=A.activeBuffer))),this._parser.setCsiHandlerFallback(((A,I)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(A),params:I.toArray()})})),this._parser.setEscHandlerFallback((A=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(A)})})),this._parser.setExecuteHandlerFallback((A=>{this._logService.debug("Unknown EXECUTE code: ",{code:A})})),this._parser.setOscHandlerFallback(((A,I,U)=>{this._logService.debug("Unknown OSC code: ",{identifier:A,action:I,data:U})})),this._parser.setDcsHandlerFallback(((A,I,U)=>{I==="HOOK"&&(U=U.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(A),action:I,payload:U})})),this._parser.setPrintHandler(((A,I,U)=>this.print(A,I,U))),this._parser.registerCsiHandler({final:"@"},(A=>this.insertChars(A))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(A=>this.scrollLeft(A))),this._parser.registerCsiHandler({final:"A"},(A=>this.cursorUp(A))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(A=>this.scrollRight(A))),this._parser.registerCsiHandler({final:"B"},(A=>this.cursorDown(A))),this._parser.registerCsiHandler({final:"C"},(A=>this.cursorForward(A))),this._parser.registerCsiHandler({final:"D"},(A=>this.cursorBackward(A))),this._parser.registerCsiHandler({final:"E"},(A=>this.cursorNextLine(A))),this._parser.registerCsiHandler({final:"F"},(A=>this.cursorPrecedingLine(A))),this._parser.registerCsiHandler({final:"G"},(A=>this.cursorCharAbsolute(A))),this._parser.registerCsiHandler({final:"H"},(A=>this.cursorPosition(A))),this._parser.registerCsiHandler({final:"I"},(A=>this.cursorForwardTab(A))),this._parser.registerCsiHandler({final:"J"},(A=>this.eraseInDisplay(A,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(A=>this.eraseInDisplay(A,!0))),this._parser.registerCsiHandler({final:"K"},(A=>this.eraseInLine(A,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(A=>this.eraseInLine(A,!0))),this._parser.registerCsiHandler({final:"L"},(A=>this.insertLines(A))),this._parser.registerCsiHandler({final:"M"},(A=>this.deleteLines(A))),this._parser.registerCsiHandler({final:"P"},(A=>this.deleteChars(A))),this._parser.registerCsiHandler({final:"S"},(A=>this.scrollUp(A))),this._parser.registerCsiHandler({final:"T"},(A=>this.scrollDown(A))),this._parser.registerCsiHandler({final:"X"},(A=>this.eraseChars(A))),this._parser.registerCsiHandler({final:"Z"},(A=>this.cursorBackwardTab(A))),this._parser.registerCsiHandler({final:"`"},(A=>this.charPosAbsolute(A))),this._parser.registerCsiHandler({final:"a"},(A=>this.hPositionRelative(A))),this._parser.registerCsiHandler({final:"b"},(A=>this.repeatPrecedingCharacter(A))),this._parser.registerCsiHandler({final:"c"},(A=>this.sendDeviceAttributesPrimary(A))),this._parser.registerCsiHandler({prefix:">",final:"c"},(A=>this.sendDeviceAttributesSecondary(A))),this._parser.registerCsiHandler({final:"d"},(A=>this.linePosAbsolute(A))),this._parser.registerCsiHandler({final:"e"},(A=>this.vPositionRelative(A))),this._parser.registerCsiHandler({final:"f"},(A=>this.hVPosition(A))),this._parser.registerCsiHandler({final:"g"},(A=>this.tabClear(A))),this._parser.registerCsiHandler({final:"h"},(A=>this.setMode(A))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(A=>this.setModePrivate(A))),this._parser.registerCsiHandler({final:"l"},(A=>this.resetMode(A))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(A=>this.resetModePrivate(A))),this._parser.registerCsiHandler({final:"m"},(A=>this.charAttributes(A))),this._parser.registerCsiHandler({final:"n"},(A=>this.deviceStatus(A))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(A=>this.deviceStatusPrivate(A))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(A=>this.softReset(A))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(A=>this.setCursorStyle(A))),this._parser.registerCsiHandler({final:"r"},(A=>this.setScrollRegion(A))),this._parser.registerCsiHandler({final:"s"},(A=>this.saveCursor(A))),this._parser.registerCsiHandler({final:"t"},(A=>this.windowOptions(A))),this._parser.registerCsiHandler({final:"u"},(A=>this.restoreCursor(A))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(A=>this.insertColumns(A))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(A=>this.deleteColumns(A))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(A=>this.selectProtected(A))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(A=>this.requestMode(A,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(A=>this.requestMode(A,!1))),this._parser.setExecuteHandler(o.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(o.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(o.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(o.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(o.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(o.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(o.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(o.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(o.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(o.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new w.OscHandler((A=>(this.setTitle(A),this.setIconName(A),!0)))),this._parser.registerOscHandler(1,new w.OscHandler((A=>this.setIconName(A)))),this._parser.registerOscHandler(2,new w.OscHandler((A=>this.setTitle(A)))),this._parser.registerOscHandler(4,new w.OscHandler((A=>this.setOrReportIndexedColor(A)))),this._parser.registerOscHandler(8,new w.OscHandler((A=>this.setHyperlink(A)))),this._parser.registerOscHandler(10,new w.OscHandler((A=>this.setOrReportFgColor(A)))),this._parser.registerOscHandler(11,new w.OscHandler((A=>this.setOrReportBgColor(A)))),this._parser.registerOscHandler(12,new w.OscHandler((A=>this.setOrReportCursorColor(A)))),this._parser.registerOscHandler(104,new w.OscHandler((A=>this.restoreIndexedColor(A)))),this._parser.registerOscHandler(110,new w.OscHandler((A=>this.restoreFgColor(A)))),this._parser.registerOscHandler(111,new w.OscHandler((A=>this.restoreBgColor(A)))),this._parser.registerOscHandler(112,new w.OscHandler((A=>this.restoreCursorColor(A)))),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 A in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:A},(()=>this.selectCharset("("+A))),this._parser.registerEscHandler({intermediates:")",final:A},(()=>this.selectCharset(")"+A))),this._parser.registerEscHandler({intermediates:"*",final:A},(()=>this.selectCharset("*"+A))),this._parser.registerEscHandler({intermediates:"+",final:A},(()=>this.selectCharset("+"+A))),this._parser.registerEscHandler({intermediates:"-",final:A},(()=>this.selectCharset("-"+A))),this._parser.registerEscHandler({intermediates:".",final:A},(()=>this.selectCharset("."+A))),this._parser.registerEscHandler({intermediates:"/",final:A},(()=>this.selectCharset("/"+A)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((A=>(this._logService.error("Parsing error: ",A),A))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new k.DcsHandler(((A,I)=>this.requestStatusString(A,I))))}_preserveStack(D,j,N,O){this._parseStack.paused=!0,this._parseStack.cursorStartX=D,this._parseStack.cursorStartY=j,this._parseStack.decodedLength=N,this._parseStack.position=O}_logSlowResolvingAsync(D){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([D,new Promise(((j,N)=>setTimeout((()=>N("#SLOW_TIMEOUT")),5e3)))]).catch((j=>{if(j!=="#SLOW_TIMEOUT")throw j;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(D,j){let N,O=this._activeBuffer.x,$=this._activeBuffer.y,Y=0;const V=this._parseStack.paused;if(V){if(N=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,j))return this._logSlowResolvingAsync(N),N;O=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,D.length>L&&(Y=this._parseStack.position+L)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof D=="string"?` "${D}"`:` "${Array.prototype.map.call(D,(Q=>String.fromCharCode(Q))).join("")}"`),typeof D=="string"?D.split("").map((Q=>Q.charCodeAt(0))):D),this._parseBuffer.length<D.length&&this._parseBuffer.length<L&&(this._parseBuffer=new Uint32Array(Math.min(D.length,L))),V||this._dirtyRowTracker.clearRange(),D.length>L)for(let Q=Y;Q<D.length;Q+=L){const re=Q+L<D.length?Q+L:D.length,A=typeof D=="string"?this._stringDecoder.decode(D.substring(Q,re),this._parseBuffer):this._utf8Decoder.decode(D.subarray(Q,re),this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,A))return this._preserveStack(O,$,A,Q),this._logSlowResolvingAsync(N),N}else if(!V){const Q=typeof D=="string"?this._stringDecoder.decode(D,this._parseBuffer):this._utf8Decoder.decode(D,this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,Q))return this._preserveStack(O,$,Q,0),this._logSlowResolvingAsync(N),N}this._activeBuffer.x===O&&this._activeBuffer.y===$||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(D,j,N){let O,$;const Y=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,re=this._coreService.decPrivateModes.wraparound,A=this._coreService.modes.insertMode,I=this._curAttrData;let U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&N-j>0&&U.getWidth(this._activeBuffer.x-1)===2&&U.setCellFromCodePoint(this._activeBuffer.x-1,0,1,I.fg,I.bg,I.extended);for(let z=j;z<N;++z){if(O=D[z],$=this._unicodeService.wcwidth(O),O<127&&Y){const Z=Y[String.fromCharCode(O)];Z&&(O=Z.charCodeAt(0))}if(V&&this._onA11yChar.fire((0,_.stringFromCodePoint)(O)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),$||!this._activeBuffer.x){if(this._activeBuffer.x+$-1>=Q){if(re){for(;this._activeBuffer.x<Q;)U.setCellFromCodePoint(this._activeBuffer.x++,0,1,I.fg,I.bg,I.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=Q-1,$===2)continue}if(A&&(U.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(I),I),U.getWidth(Q-1)===2&&U.setCellFromCodePoint(Q-1,c.NULL_CELL_CODE,c.NULL_CELL_WIDTH,I.fg,I.bg,I.extended)),U.setCellFromCodePoint(this._activeBuffer.x++,O,$,I.fg,I.bg,I.extended),$>0)for(;--$;)U.setCellFromCodePoint(this._activeBuffer.x++,0,0,I.fg,I.bg,I.extended)}else U.getWidth(this._activeBuffer.x-1)?U.addCodepointToCell(this._activeBuffer.x-1,O):U.addCodepointToCell(this._activeBuffer.x-2,O)}N-j>0&&(U.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<Q&&N-j>0&&U.getWidth(this._activeBuffer.x)===0&&!U.hasContent(this._activeBuffer.x)&&U.setCellFromCodePoint(this._activeBuffer.x,0,1,I.fg,I.bg,I.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(D,j){return D.final!=="t"||D.prefix||D.intermediates?this._parser.registerCsiHandler(D,j):this._parser.registerCsiHandler(D,(N=>!T(N.params[0],this._optionsService.rawOptions.windowOptions)||j(N)))}registerDcsHandler(D,j){return this._parser.registerDcsHandler(D,new k.DcsHandler(j))}registerEscHandler(D,j){return this._parser.registerEscHandler(D,j)}registerOscHandler(D,j){return this._parser.registerOscHandler(D,new w.OscHandler(j))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var D;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&&(!((D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||D===void 0)&&D.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);j.hasWidth(this._activeBuffer.x)&&!j.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const D=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-D),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(D=this._bufferService.cols-1){this._activeBuffer.x=Math.min(D,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(D,j){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=D,this._activeBuffer.y=this._activeBuffer.scrollTop+j):(this._activeBuffer.x=D,this._activeBuffer.y=j),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(D,j){this._restrictCursor(),this._setCursor(this._activeBuffer.x+D,this._activeBuffer.y+j)}cursorUp(D){const j=this._activeBuffer.y-this._activeBuffer.scrollTop;return j>=0?this._moveCursor(0,-Math.min(j,D.params[0]||1)):this._moveCursor(0,-(D.params[0]||1)),!0}cursorDown(D){const j=this._activeBuffer.scrollBottom-this._activeBuffer.y;return j>=0?this._moveCursor(0,Math.min(j,D.params[0]||1)):this._moveCursor(0,D.params[0]||1),!0}cursorForward(D){return this._moveCursor(D.params[0]||1,0),!0}cursorBackward(D){return this._moveCursor(-(D.params[0]||1),0),!0}cursorNextLine(D){return this.cursorDown(D),this._activeBuffer.x=0,!0}cursorPrecedingLine(D){return this.cursorUp(D),this._activeBuffer.x=0,!0}cursorCharAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(D){return this._setCursor(D.length>=2?(D.params[1]||1)-1:0,(D.params[0]||1)-1),!0}charPosAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(D){return this._moveCursor(D.params[0]||1,0),!0}linePosAbsolute(D){return this._setCursor(this._activeBuffer.x,(D.params[0]||1)-1),!0}vPositionRelative(D){return this._moveCursor(0,D.params[0]||1),!0}hVPosition(D){return this.cursorPosition(D),!0}tabClear(D){const j=D.params[0];return j===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:j===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=D.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=D.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(D){const j=D.params[0];return j===1&&(this._curAttrData.bg|=536870912),j!==2&&j!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(D,j,N,O=!1,$=!1){const Y=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);Y.replaceCells(j,N,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),$),O&&(Y.isWrapped=!1)}_resetBufferLine(D,j=!1){const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);N&&(N.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),j),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+D),N.isWrapped=!1)}eraseInDisplay(D,j=!1){let N;switch(this._restrictCursor(this._bufferService.cols),D.params[0]){case 0:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,j);N<this._bufferService.rows;N++)this._resetBufferLine(N,j);this._dirtyRowTracker.markDirty(N);break;case 1:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N,0,this._activeBuffer.x+1,!0,j),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(N+1).isWrapped=!1);N--;)this._resetBufferLine(N,j);this._dirtyRowTracker.markDirty(0);break;case 2:for(N=this._bufferService.rows,this._dirtyRowTracker.markDirty(N-1);N--;)this._resetBufferLine(N,j);this._dirtyRowTracker.markDirty(0);break;case 3:const O=this._activeBuffer.lines.length-this._bufferService.rows;O>0&&(this._activeBuffer.lines.trimStart(O),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-O,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-O,0),this._onScroll.fire(0))}return!0}eraseInLine(D,j=!1){switch(this._restrictCursor(this._bufferService.cols),D.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,j);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,j);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,j)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(D){this._restrictCursor();let j=D.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y,O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-O+1;for(;j--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(N,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(D){this._restrictCursor();let j=D.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y;let O;for(O=this._bufferService.rows-1-this._activeBuffer.scrollBottom,O=this._bufferService.rows-1+this._activeBuffer.ybase-O;j--;)this._activeBuffer.lines.splice(N,1),this._activeBuffer.lines.splice(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(D){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.insertCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(D){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.deleteCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(D){let j=D.params[0]||1;for(;j--;)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(D){let j=D.params[0]||1;for(;j--;)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(n.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=D.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);O.deleteCells(0,j,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=D.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);O.insertCells(0,j,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=D.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);O.insertCells(this._activeBuffer.x,j,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=D.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);O.deleteCells(this._activeBuffer.x,j,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),O.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(D){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(D.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(D){if(!this._parser.precedingCodepoint)return!0;const j=D.params[0]||1,N=new Uint32Array(j);for(let O=0;O<j;++O)N[O]=this._parser.precedingCodepoint;return this.print(N,0,N.length),!0}sendDeviceAttributesPrimary(D){return D.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(D){return D.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(D.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(D){return(this._optionsService.rawOptions.termName+"").indexOf(D)===0}setMode(D){for(let j=0;j<D.length;j++)switch(D.params[j]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(D){for(let j=0;j<D.length;j++)switch(D.params[j]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(D){for(let j=0;j<D.length;j++)switch(D.params[j]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(D){for(let j=0;j<D.length;j++)switch(D.params[j]){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(),D.params[j]===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(D,j){const N=this._coreService.decPrivateModes,{activeProtocol:O,activeEncoding:$}=this._coreMouseService,Y=this._coreService,{buffers:V,cols:Q}=this._bufferService,{active:re,alt:A}=V,I=this._optionsService.rawOptions,U=ie=>ie?1:2,z=D.params[0];return Z=z,G=j?z===2?4:z===4?U(Y.modes.insertMode):z===12?3:z===20?U(I.convertEol):0:z===1?U(N.applicationCursorKeys):z===3?I.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:z===6?U(N.origin):z===7?U(N.wraparound):z===8?3:z===9?U(O==="X10"):z===12?U(I.cursorBlink):z===25?U(!Y.isCursorHidden):z===45?U(N.reverseWraparound):z===66?U(N.applicationKeypad):z===67?4:z===1e3?U(O==="VT200"):z===1002?U(O==="DRAG"):z===1003?U(O==="ANY"):z===1004?U(N.sendFocus):z===1005?4:z===1006?U($==="SGR"):z===1015?4:z===1016?U($==="SGR_PIXELS"):z===1048?1:z===47||z===1047||z===1049?U(re===A):z===2004?U(N.bracketedPasteMode):0,Y.triggerDataEvent(`${o.C0.ESC}[${j?"":"?"}${Z};${G}$y`),!0;var Z,G}_updateAttrColor(D,j,N,O,$){return j===2?(D|=50331648,D&=-16777216,D|=m.AttributeData.fromColorRGB([N,O,$])):j===5&&(D&=-50331904,D|=33554432|255&N),D}_extractColor(D,j,N){const O=[0,0,-1,0,0,0];let $=0,Y=0;do{if(O[Y+$]=D.params[j+Y],D.hasSubParams(j+Y)){const V=D.getSubParams(j+Y);let Q=0;do O[1]===5&&($=1),O[Y+Q+1+$]=V[Q];while(++Q<V.length&&Q+Y+1+$<O.length);break}if(O[1]===5&&Y+$>=2||O[1]===2&&Y+$>=5)break;O[1]&&($=1)}while(++Y+j<D.length&&Y+$<O.length);for(let V=2;V<O.length;++V)O[V]===-1&&(O[V]=0);switch(O[0]){case 38:N.fg=this._updateAttrColor(N.fg,O[1],O[3],O[4],O[5]);break;case 48:N.bg=this._updateAttrColor(N.bg,O[1],O[3],O[4],O[5]);break;case 58:N.extended=N.extended.clone(),N.extended.underlineColor=this._updateAttrColor(N.extended.underlineColor,O[1],O[3],O[4],O[5])}return Y}_processUnderline(D,j){j.extended=j.extended.clone(),(!~D||D>5)&&(D=1),j.extended.underlineStyle=D,j.fg|=268435456,D===0&&(j.fg&=-268435457),j.updateExtended()}_processSGR0(D){D.fg=n.DEFAULT_ATTR_DATA.fg,D.bg=n.DEFAULT_ATTR_DATA.bg,D.extended=D.extended.clone(),D.extended.underlineStyle=0,D.extended.underlineColor&=-67108864,D.updateExtended()}charAttributes(D){if(D.length===1&&D.params[0]===0)return this._processSGR0(this._curAttrData),!0;const j=D.length;let N;const O=this._curAttrData;for(let $=0;$<j;$++)N=D.params[$],N>=30&&N<=37?(O.fg&=-50331904,O.fg|=16777216|N-30):N>=40&&N<=47?(O.bg&=-50331904,O.bg|=16777216|N-40):N>=90&&N<=97?(O.fg&=-50331904,O.fg|=16777224|N-90):N>=100&&N<=107?(O.bg&=-50331904,O.bg|=16777224|N-100):N===0?this._processSGR0(O):N===1?O.fg|=134217728:N===3?O.bg|=67108864:N===4?(O.fg|=268435456,this._processUnderline(D.hasSubParams($)?D.getSubParams($)[0]:1,O)):N===5?O.fg|=536870912:N===7?O.fg|=67108864:N===8?O.fg|=1073741824:N===9?O.fg|=2147483648:N===2?O.bg|=134217728:N===21?this._processUnderline(2,O):N===22?(O.fg&=-134217729,O.bg&=-134217729):N===23?O.bg&=-67108865:N===24?(O.fg&=-268435457,this._processUnderline(0,O)):N===25?O.fg&=-536870913:N===27?O.fg&=-67108865:N===28?O.fg&=-1073741825:N===29?O.fg&=2147483647:N===39?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg):N===49?(O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):N===38||N===48||N===58?$+=this._extractColor(D,$,O):N===53?O.bg|=1073741824:N===55?O.bg&=-1073741825:N===59?(O.extended=O.extended.clone(),O.extended.underlineColor=-1,O.updateExtended()):N===100?(O.fg&=-67108864,O.fg|=16777215&n.DEFAULT_ATTR_DATA.fg,O.bg&=-67108864,O.bg|=16777215&n.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",N);return!0}deviceStatus(D){switch(D.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const j=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${j};${N}R`)}return!0}deviceStatusPrivate(D){if(D.params[0]===6){const j=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${j};${N}R`)}return!0}softReset(D){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=n.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(D){const j=D.params[0]||1;switch(j){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 N=j%2==1;return this._optionsService.options.cursorBlink=N,!0}setScrollRegion(D){const j=D.params[0]||1;let N;return(D.length<2||(N=D.params[1])>this._bufferService.rows||N===0)&&(N=this._bufferService.rows),N>j&&(this._activeBuffer.scrollTop=j-1,this._activeBuffer.scrollBottom=N-1,this._setCursor(0,0)),!0}windowOptions(D){if(!T(D.params[0],this._optionsService.rawOptions.windowOptions))return!0;const j=D.length>1?D.params[1]:0;switch(D.params[0]){case 14:j!==2&&this._onRequestWindowsOptionsReport.fire(M.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(M.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:j!==0&&j!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),j!==0&&j!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:j!==0&&j!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),j!==0&&j!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(D){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(D){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(D){return this._windowTitle=D,this._onTitleChange.fire(D),!0}setIconName(D){return this._iconName=D,!0}setOrReportIndexedColor(D){const j=[],N=D.split(";");for(;N.length>1;){const O=N.shift(),$=N.shift();if(/^\d+$/.exec(O)){const Y=parseInt(O);if(W(Y))if($==="?")j.push({type:0,index:Y});else{const V=(0,g.parseColor)($);V&&j.push({type:1,index:Y,color:V})}}}return j.length&&this._onColor.fire(j),!0}setHyperlink(D){const j=D.split(";");return!(j.length<2)&&(j[1]?this._createHyperlink(j[0],j[1]):!j[0]&&this._finishHyperlink())}_createHyperlink(D,j){this._getCurrentLinkId()&&this._finishHyperlink();const N=D.split(":");let O;const $=N.findIndex((Y=>Y.startsWith("id=")));return $!==-1&&(O=N[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:O,uri:j}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(D,j){const N=D.split(";");for(let O=0;O<N.length&&!(j>=this._specialColors.length);++O,++j)if(N[O]==="?")this._onColor.fire([{type:0,index:this._specialColors[j]}]);else{const $=(0,g.parseColor)(N[O]);$&&this._onColor.fire([{type:1,index:this._specialColors[j],color:$}])}return!0}setOrReportFgColor(D){return this._setOrReportSpecialColor(D,0)}setOrReportBgColor(D){return this._setOrReportSpecialColor(D,1)}setOrReportCursorColor(D){return this._setOrReportSpecialColor(D,2)}restoreIndexedColor(D){if(!D)return this._onColor.fire([{type:2}]),!0;const j=[],N=D.split(";");for(let O=0;O<N.length;++O)if(/^\d+$/.exec(N[O])){const $=parseInt(N[O]);W($)&&j.push({type:2,index:$})}return j.length&&this._onColor.fire(j),!0}restoreFgColor(D){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(D){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(D){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,p.DEFAULT_CHARSET),!0}selectCharset(D){return D.length!==2?(this.selectDefaultCharset(),!0):(D[0]==="/"||this._charsetService.setgCharset(E[D[0]],p.CHARSETS[D[1]]||p.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 D=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,D,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=n.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=n.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(D){return this._charsetService.setgLevel(D),!0}screenAlignmentPattern(){const D=new h.CellData;D.content=4194373,D.fg=this._curAttrData.fg,D.bg=this._curAttrData.bg,this._setCursor(0,0);for(let j=0;j<this._bufferService.rows;++j){const N=this._activeBuffer.ybase+this._activeBuffer.y+j,O=this._activeBuffer.lines.get(N);O&&(O.fill(D),O.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(D,j){const N=this._bufferService.buffer,O=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${$}${o.C0.ESC}\\`),!0))(D==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:D==='"p'?'P1$r61;1"p':D==="r"?`P1$r${N.scrollTop+1};${N.scrollBottom+1}r`:D==="m"?"P1$r0m":D===" q"?`P1$r${{block:2,underline:4,bar:6}[O.cursorStyle]-(O.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(D,j){this._dirtyRowTracker.markRangeDirty(D,j)}}s.InputHandler=B;let F=class{constructor(H){this._bufferService=H,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(H){H<this.start?this.start=H:H>this.end&&(this.end=H)}markRangeDirty(H,D){H>D&&(P=H,H=D,D=P),H<this.start&&(this.start=H),D>this.end&&(this.end=D)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function W(H){return 0<=H&&H<256}F=a([d(0,b.IBufferService)],F)},844:(C,s)=>{function i(a){for(const d of a)d.dispose();a.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const a of this._disposables)a.dispose();this._disposables.length=0}register(a){return this._disposables.push(a),a}unregister(a){const d=this._disposables.indexOf(a);d!==-1&&this._disposables.splice(d,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(a){var d;this._isDisposed||a===this._value||((d=this._value)===null||d===void 0||d.dispose(),this._value=a)}clear(){this.value=void 0}dispose(){var a;this._isDisposed=!0,(a=this._value)===null||a===void 0||a.dispose(),this._value=void 0}},s.toDisposable=function(a){return{dispose:a}},s.disposeArray=i,s.getDisposeArrayDisposable=function(a){return{dispose:()=>i(a)}}},1505:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(d,o,p){this._data[d]||(this._data[d]={}),this._data[d][o]=p}get(d,o){return this._data[d]?this._data[d][o]:void 0}clear(){this._data={}}}s.TwoKeyMap=i,s.FourKeyMap=class{constructor(){this._data=new i}set(a,d,o,p,S){this._data.get(a,d)||this._data.set(a,d,new i),this._data.get(a,d).set(o,p,S)}get(a,d,o,p){var S;return(S=this._data.get(a,d))===null||S===void 0?void 0:S.get(o,p)}clear(){this._data.clear()}}},6114:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof navigator>"u";const i=s.isNode?"node":navigator.userAgent,a=s.isNode?"node":navigator.platform;s.isFirefox=i.includes("Firefox"),s.isLegacyEdge=i.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(i),s.getSafariVersion=function(){if(!s.isSafari)return 0;const d=i.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(a),s.isIpad=a==="iPad",s.isIphone=a==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(a),s.isLinux=a.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(i)},6106:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let i=0;s.SortedList=class{constructor(a){this._getKey=a,this._array=[]}clear(){this._array.length=0}insert(a){this._array.length!==0?(i=this._search(this._getKey(a)),this._array.splice(i,0,a)):this._array.push(a)}delete(a){if(this._array.length===0)return!1;const d=this._getKey(a);if(d===void 0||(i=this._search(d),i===-1)||this._getKey(this._array[i])!==d)return!1;do if(this._array[i]===a)return this._array.splice(i,1),!0;while(++i<this._array.length&&this._getKey(this._array[i])===d);return!1}*getKeyIterator(a){if(this._array.length!==0&&(i=this._search(a),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===a))do yield this._array[i];while(++i<this._array.length&&this._getKey(this._array[i])===a)}forEachByKey(a,d){if(this._array.length!==0&&(i=this._search(a),!(i<0||i>=this._array.length)&&this._getKey(this._array[i])===a))do d(this._array[i]);while(++i<this._array.length&&this._getKey(this._array[i])===a)}values(){return[...this._array].values()}_search(a){let d=0,o=this._array.length-1;for(;o>=d;){let p=d+o>>1;const S=this._getKey(this._array[p]);if(S>a)o=p-1;else{if(!(S<a)){for(;p>0&&this._getKey(this._array[p-1])===a;)p--;return p}d=p+1}}return d}}},7226:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const a=i(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let y=0,_=0,n=S.timeRemaining(),u=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),_=Math.max(y,_),u=S.timeRemaining(),1.5*_>u)return n-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-y))}ms`),void this._start();n=u}this.clear()}}class o extends d{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const y=Date.now()+S;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=o,s.IdleTaskQueue=!a.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:o,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const a=i(643);s.updateWindowsModeWrappedState=function(d){const o=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),p=o?.get(d.cols-1),S=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);S&&p&&(S.isWrapped=p[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&p[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},3734:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new a}static toColorRGB(o){return[o>>>16&255,o>>>8&255,255&o]}static fromColorRGB(o){return(255&o[0])<<16|(255&o[1])<<8|255&o[2]}clone(){const o=new i;return o.fg=this.fg,o.bg=this.bg,o.extended=this.extended.clone(),o}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}}s.AttributeData=i;class a{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(o){this._ext=o}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(o){this._ext&=-469762049,this._ext|=o<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(o){this._ext&=-67108864,this._ext|=67108863&o}get urlId(){return this._urlId}set urlId(o){this._urlId=o}constructor(o=0,p=0){this._ext=0,this._urlId=0,this._ext=o,this._urlId=p}clone(){return new a(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=a},9092:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const a=i(6349),d=i(7226),o=i(3734),p=i(8437),S=i(4634),y=i(511),_=i(643),n=i(4863),u=i(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(c,h,m){this._hasScrollback=c,this._optionsService=h,this._bufferService=m,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=u.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(c){return c?(this._nullCell.fg=c.fg,this._nullCell.bg=c.bg,this._nullCell.extended=c.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(c){return c?(this._whitespaceCell.fg=c.fg,this._whitespaceCell.bg=c.bg,this._whitespaceCell.extended=c.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(c,h){return new p.BufferLine(this._bufferService.cols,this.getNullCell(c),h)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const c=this.ybase+this.y-this.ydisp;return c>=0&&c<this._rows}_getCorrectBufferLength(c){if(!this._hasScrollback)return c;const h=c+this._optionsService.rawOptions.scrollback;return h>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:h}fillViewportRows(c){if(this.lines.length===0){c===void 0&&(c=p.DEFAULT_ATTR_DATA);let h=this._rows;for(;h--;)this.lines.push(this.getBlankLine(c))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(c,h){const m=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=0;const w=this._getCorrectBufferLength(h);if(w>this.lines.maxLength&&(this.lines.maxLength=w),this.lines.length>0){if(this._cols<c)for(let g=0;g<this.lines.length;g++)b+=+this.lines.get(g).resize(c,m);let k=0;if(this._rows<h)for(let g=this._rows;g<h;g++)this.lines.length<h+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(c,m)):this.ybase>0&&this.lines.length<=this.ybase+this.y+k+1?(this.ybase--,k++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(c,m)));else for(let g=this._rows;g>h;g--)this.lines.length>h+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(w<this.lines.maxLength){const g=this.lines.length-w;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=w}this.x=Math.min(this.x,c-1),this.y=Math.min(this.y,h-1),k&&(this.y+=k),this.savedX=Math.min(this.savedX,c-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(c,h),this._cols>c))for(let k=0;k<this.lines.length;k++)b+=+this.lines.get(k).resize(c,m);this._cols=c,this._rows=h,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let c=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,c=!1);let h=0;for(;this._memoryCleanupPosition<this.lines.length;)if(h+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),h>100)return!0;return c}get _isReflowEnabled(){const c=this._optionsService.rawOptions.windowsPty;return c&&c.buildNumber?this._hasScrollback&&c.backend==="conpty"&&c.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(c,h){this._cols!==c&&(c>this._cols?this._reflowLarger(c,h):this._reflowSmaller(c,h))}_reflowLarger(c,h){const m=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,c,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(m.length>0){const b=(0,S.reflowLargerCreateNewLayout)(this.lines,m);(0,S.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(c,h,b.countRemoved)}}_reflowLargerAdjustViewport(c,h,m){const b=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=m;for(;w-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new p.BufferLine(c,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-m,0)}_reflowSmaller(c,h){const m=this.getNullCell(p.DEFAULT_ATTR_DATA),b=[];let w=0;for(let k=this.lines.length-1;k>=0;k--){let g=this.lines.get(k);if(!g||!g.isWrapped&&g.getTrimmedLength()<=c)continue;const E=[g];for(;g.isWrapped&&k>0;)g=this.lines.get(--k),E.unshift(g);const L=this.ybase+this.y;if(L>=k&&L<k+E.length)continue;const T=E[E.length-1].getTrimmedLength(),M=(0,S.reflowSmallerGetNewLineLengths)(E,this._cols,c),P=M.length-E.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+P):Math.max(0,this.lines.length-this.lines.maxLength+P);const F=[];for(let O=0;O<P;O++){const $=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);F.push($)}F.length>0&&(b.push({start:k+E.length+w,newLines:F}),w+=F.length),E.push(...F);let W=M.length-1,H=M[W];H===0&&(W--,H=M[W]);let D=E.length-P-1,j=T;for(;D>=0;){const O=Math.min(j,H);if(E[W]===void 0)break;if(E[W].copyCellsFrom(E[D],j-O,H-O,O,!0),H-=O,H===0&&(W--,H=M[W]),j-=O,j===0){D--;const $=Math.max(D,0);j=(0,S.getWrappedLineTrimmedLength)(E,$,this._cols)}}for(let O=0;O<E.length;O++)M[O]<c&&E[O].setCell(M[O],m);let N=P-B;for(;N-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+w)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+h-1)}if(b.length>0){const k=[],g=[];for(let W=0;W<this.lines.length;W++)g.push(this.lines.get(W));const E=this.lines.length;let L=E-1,T=0,M=b[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+w);let P=0;for(let W=Math.min(this.lines.maxLength-1,E+w-1);W>=0;W--)if(M&&M.start>L+P){for(let H=M.newLines.length-1;H>=0;H--)this.lines.set(W--,M.newLines[H]);W++,k.push({index:L+1,amount:M.newLines.length}),P+=M.newLines.length,M=b[++T]}else this.lines.set(W,g[L--]);let B=0;for(let W=k.length-1;W>=0;W--)k[W].index+=B,this.lines.onInsertEmitter.fire(k[W]),B+=k[W].amount;const F=Math.max(0,E+w-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(c,h,m=0,b){const w=this.lines.get(c);return w?w.translateToString(h,m,b):""}getWrappedRangeForLine(c){let h=c,m=c;for(;h>0&&this.lines.get(h).isWrapped;)h--;for(;m+1<this.lines.length&&this.lines.get(m+1).isWrapped;)m++;return{first:h,last:m}}setupTabStops(c){for(c!=null?this.tabs[c]||(c=this.prevStop(c)):(this.tabs={},c=0);c<this._cols;c+=this._optionsService.rawOptions.tabStopWidth)this.tabs[c]=!0}prevStop(c){for(c==null&&(c=this.x);!this.tabs[--c]&&c>0;);return c>=this._cols?this._cols-1:c<0?0:c}nextStop(c){for(c==null&&(c=this.x);!this.tabs[++c]&&c<this._cols;);return c>=this._cols?this._cols-1:c<0?0:c}clearMarkers(c){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].line===c&&(this.markers[h].dispose(),this.markers.splice(h--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let c=0;c<this.markers.length;c++)this.markers[c].dispose(),this.markers.splice(c--,1);this._isClearing=!1}addMarker(c){const h=new n.Marker(c);return this.markers.push(h),h.register(this.lines.onTrim((m=>{h.line-=m,h.line<0&&h.dispose()}))),h.register(this.lines.onInsert((m=>{h.line>=m.index&&(h.line+=m.amount)}))),h.register(this.lines.onDelete((m=>{h.line>=m.index&&h.line<m.index+m.amount&&h.dispose(),h.line>m.index&&(h.line-=m.amount)}))),h.register(h.onDispose((()=>this._removeMarker(h)))),h}_removeMarker(c){this._isClearing||this.markers.splice(this.markers.indexOf(c),1)}}},8437:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const a=i(3734),d=i(511),o=i(643),p=i(482);s.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);let S=0;class y{constructor(n,u,c=!1){this.isWrapped=c,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*n);const h=u||d.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let m=0;m<n;++m)this.setCell(m,h);this.length=n}get(n){const u=this._data[3*n+0],c=2097151&u;return[this._data[3*n+1],2097152&u?this._combined[n]:c?(0,p.stringFromCodePoint)(c):"",u>>22,2097152&u?this._combined[n].charCodeAt(this._combined[n].length-1):c]}set(n,u){this._data[3*n+1]=u[o.CHAR_DATA_ATTR_INDEX],u[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[n]=u[1],this._data[3*n+0]=2097152|n|u[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*n+0]=u[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(n){return this._data[3*n+0]>>22}hasWidth(n){return 12582912&this._data[3*n+0]}getFg(n){return this._data[3*n+1]}getBg(n){return this._data[3*n+2]}hasContent(n){return 4194303&this._data[3*n+0]}getCodePoint(n){const u=this._data[3*n+0];return 2097152&u?this._combined[n].charCodeAt(this._combined[n].length-1):2097151&u}isCombined(n){return 2097152&this._data[3*n+0]}getString(n){const u=this._data[3*n+0];return 2097152&u?this._combined[n]:2097151&u?(0,p.stringFromCodePoint)(2097151&u):""}isProtected(n){return 536870912&this._data[3*n+2]}loadCell(n,u){return S=3*n,u.content=this._data[S+0],u.fg=this._data[S+1],u.bg=this._data[S+2],2097152&u.content&&(u.combinedData=this._combined[n]),268435456&u.bg&&(u.extended=this._extendedAttrs[n]),u}setCell(n,u){2097152&u.content&&(this._combined[n]=u.combinedData),268435456&u.bg&&(this._extendedAttrs[n]=u.extended),this._data[3*n+0]=u.content,this._data[3*n+1]=u.fg,this._data[3*n+2]=u.bg}setCellFromCodePoint(n,u,c,h,m,b){268435456&m&&(this._extendedAttrs[n]=b),this._data[3*n+0]=u|c<<22,this._data[3*n+1]=h,this._data[3*n+2]=m}addCodepointToCell(n,u){let c=this._data[3*n+0];2097152&c?this._combined[n]+=(0,p.stringFromCodePoint)(u):(2097151&c?(this._combined[n]=(0,p.stringFromCodePoint)(2097151&c)+(0,p.stringFromCodePoint)(u),c&=-2097152,c|=2097152):c=u|4194304,this._data[3*n+0]=c)}insertCells(n,u,c,h){if((n%=this.length)&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs),u<this.length-n){const m=new d.CellData;for(let b=this.length-n-u-1;b>=0;--b)this.setCell(n+u+b,this.loadCell(n+b,m));for(let b=0;b<u;++b)this.setCell(n+b,c)}else for(let m=n;m<this.length;++m)this.setCell(m,c);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs)}deleteCells(n,u,c,h){if(n%=this.length,u<this.length-n){const m=new d.CellData;for(let b=0;b<this.length-n-u;++b)this.setCell(n+b,this.loadCell(n+u+b,m));for(let b=this.length-u;b<this.length;++b)this.setCell(b,c)}else for(let m=n;m<this.length;++m)this.setCell(m,c);n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs),this.getWidth(n)!==0||this.hasContent(n)||this.setCellFromCodePoint(n,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs)}replaceCells(n,u,c,h,m=!1){if(m)for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs),u<this.length&&this.getWidth(u-1)===2&&!this.isProtected(u)&&this.setCellFromCodePoint(u,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs);n<u&&n<this.length;)this.isProtected(n)||this.setCell(n,c),n++;else for(n&&this.getWidth(n-1)===2&&this.setCellFromCodePoint(n-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs),u<this.length&&this.getWidth(u-1)===2&&this.setCellFromCodePoint(u,0,1,h?.fg||0,h?.bg||0,h?.extended||new a.ExtendedAttrs);n<u&&n<this.length;)this.setCell(n++,c)}resize(n,u){if(n===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const c=3*n;if(n>this.length){if(this._data.buffer.byteLength>=4*c)this._data=new Uint32Array(this._data.buffer,0,c);else{const h=new Uint32Array(c);h.set(this._data),this._data=h}for(let h=this.length;h<n;++h)this.setCell(h,u)}else{this._data=this._data.subarray(0,c);const h=Object.keys(this._combined);for(let b=0;b<h.length;b++){const w=parseInt(h[b],10);w>=n&&delete this._combined[w]}const m=Object.keys(this._extendedAttrs);for(let b=0;b<m.length;b++){const w=parseInt(m[b],10);w>=n&&delete this._extendedAttrs[w]}}return this.length=n,4*c*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,u=!1){if(u)for(let c=0;c<this.length;++c)this.isProtected(c)||this.setCell(c,n);else{this._combined={},this._extendedAttrs={};for(let c=0;c<this.length;++c)this.setCell(c,n)}}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(const u in n._combined)this._combined[u]=n._combined[u];this._extendedAttrs={};for(const u in n._extendedAttrs)this._extendedAttrs[u]=n._extendedAttrs[u];this.isWrapped=n.isWrapped}clone(){const n=new y(0);n._data=new Uint32Array(this._data),n.length=this.length;for(const u in this._combined)n._combined[u]=this._combined[u];for(const u in this._extendedAttrs)n._extendedAttrs[u]=this._extendedAttrs[u];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0])return n+(this._data[3*n+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(4194303&this._data[3*n+0]||50331648&this._data[3*n+2])return n+(this._data[3*n+0]>>22);return 0}copyCellsFrom(n,u,c,h,m){const b=n._data;if(m)for(let k=h-1;k>=0;k--){for(let g=0;g<3;g++)this._data[3*(c+k)+g]=b[3*(u+k)+g];268435456&b[3*(u+k)+2]&&(this._extendedAttrs[c+k]=n._extendedAttrs[u+k])}else for(let k=0;k<h;k++){for(let g=0;g<3;g++)this._data[3*(c+k)+g]=b[3*(u+k)+g];268435456&b[3*(u+k)+2]&&(this._extendedAttrs[c+k]=n._extendedAttrs[u+k])}const w=Object.keys(n._combined);for(let k=0;k<w.length;k++){const g=parseInt(w[k],10);g>=u&&(this._combined[g-u+c]=n._combined[g])}}translateToString(n=!1,u=0,c=this.length){n&&(c=Math.min(c,this.getTrimmedLength()));let h="";for(;u<c;){const m=this._data[3*u+0],b=2097151&m;h+=2097152&m?this._combined[u]:b?(0,p.stringFromCodePoint)(b):o.WHITESPACE_CELL_CHAR,u+=m>>22||1}return h}}s.BufferLine=y},4841:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(i,a){if(i.start.y>i.end.y)throw new Error(`Buffer range end (${i.end.x}, ${i.end.y}) cannot be before start (${i.start.x}, ${i.start.y})`);return a*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}},4634:(C,s)=>{function i(a,d,o){if(d===a.length-1)return a[d].getTrimmedLength();const p=!a[d].hasContent(o-1)&&a[d].getWidth(o-1)===1,S=a[d+1].getWidth(0)===2;return p&&S?o-1:o}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(a,d,o,p,S){const y=[];for(let _=0;_<a.length-1;_++){let n=_,u=a.get(++n);if(!u.isWrapped)continue;const c=[a.get(_)];for(;n<a.length&&u.isWrapped;)c.push(u),u=a.get(++n);if(p>=_&&p<n){_+=c.length-1;continue}let h=0,m=i(c,h,d),b=1,w=0;for(;b<c.length;){const g=i(c,b,d),E=g-w,L=o-m,T=Math.min(E,L);c[h].copyCellsFrom(c[b],w,m,T,!1),m+=T,m===o&&(h++,m=0),w+=T,w===g&&(b++,w=0),m===0&&h!==0&&c[h-1].getWidth(o-1)===2&&(c[h].copyCellsFrom(c[h-1],o-1,m++,1,!1),c[h-1].setCell(o-1,S))}c[h].replaceCells(m,o,S);let k=0;for(let g=c.length-1;g>0&&(g>h||c[g].getTrimmedLength()===0);g--)k++;k>0&&(y.push(_+c.length-k),y.push(k)),_+=c.length-1}return y},s.reflowLargerCreateNewLayout=function(a,d){const o=[];let p=0,S=d[p],y=0;for(let _=0;_<a.length;_++)if(S===_){const n=d[++p];a.onDeleteEmitter.fire({index:_-y,amount:n}),_+=n-1,y+=n,S=d[++p]}else o.push(_);return{layout:o,countRemoved:y}},s.reflowLargerApplyNewLayout=function(a,d){const o=[];for(let p=0;p<d.length;p++)o.push(a.get(d[p]));for(let p=0;p<o.length;p++)a.set(p,o[p]);a.length=d.length},s.reflowSmallerGetNewLineLengths=function(a,d,o){const p=[],S=a.map(((u,c)=>i(a,c,d))).reduce(((u,c)=>u+c));let y=0,_=0,n=0;for(;n<S;){if(S-n<o){p.push(S-n);break}y+=o;const u=i(a,_,d);y>u&&(y-=u,_++);const c=a[_].getWidth(y-1)===2;c&&y--;const h=c?o-1:o;p.push(h),n+=h}return p},s.getWrappedLineTrimmedLength=i},5295:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const a=i(8460),d=i(844),o=i(9092);class p extends d.Disposable{constructor(y,_){super(),this._optionsService=y,this._bufferService=_,this._onBufferActivate=this.register(new a.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 o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,_){this._normal.resize(y,_),this._alt.resize(y,_),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=p},511:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const a=i(482),d=i(643),o=i(3734);class p extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const _=new p;return _.setFromCharData(y),_}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,a.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let _=!1;if(y[d.CHAR_DATA_CHAR_INDEX].length>2)_=!0;else if(y[d.CHAR_DATA_CHAR_INDEX].length===2){const n=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){const u=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=u&&u<=57343?this.content=1024*(n-55296)+u-56320+65536|y[d.CHAR_DATA_WIDTH_INDEX]<<22:_=!0}else _=!0}else this.content=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22;_&&(this.combinedData=y[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=p},643:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const a=i(8460),d=i(844);class o{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new a.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,d.disposeArray)(this._disposables),this._disposables.length=0)}register(S){return this._disposables.push(S),S}}s.Marker=o,o._nextId=1},7116:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.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:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(C,s)=>{var i,a,d;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,(function(o){o.NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="\x07",o.BS="\b",o.HT=" ",o.LF=`
|
|
18
|
+
`,o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="\x1B",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL=""})(i||(s.C0=i={})),(function(o){o.PAD="",o.HOP="",o.BPH="",o.NBH="",o.IND="",o.NEL="
",o.SSA="",o.ESA="",o.HTS="",o.HTJ="",o.VTS="",o.PLD="",o.PLU="",o.RI="",o.SS2="",o.SS3="",o.DCS="",o.PU1="",o.PU2="",o.STS="",o.CCH="",o.MW="",o.SPA="",o.EPA="",o.SOS="",o.SGCI="",o.SCI="",o.CSI="",o.ST="",o.OSC="",o.PM="",o.APC=""})(a||(s.C1=a={})),(function(o){o.ST=`${i.ESC}\\`})(d||(s.C1_ESCAPED=d={}))},7399:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const a=i(2584),d={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};s.evaluateKeyboardEvent=function(o,p,S,y){const _={type:0,cancel:!1,key:void 0},n=(o.shiftKey?1:0)|(o.altKey?2:0)|(o.ctrlKey?4:0)|(o.metaKey?8:0);switch(o.keyCode){case 0:o.key==="UIKeyInputUpArrow"?_.key=p?a.C0.ESC+"OA":a.C0.ESC+"[A":o.key==="UIKeyInputLeftArrow"?_.key=p?a.C0.ESC+"OD":a.C0.ESC+"[D":o.key==="UIKeyInputRightArrow"?_.key=p?a.C0.ESC+"OC":a.C0.ESC+"[C":o.key==="UIKeyInputDownArrow"&&(_.key=p?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:if(o.altKey){_.key=a.C0.ESC+a.C0.DEL;break}_.key=a.C0.DEL;break;case 9:if(o.shiftKey){_.key=a.C0.ESC+"[Z";break}_.key=a.C0.HT,_.cancel=!0;break;case 13:_.key=o.altKey?a.C0.ESC+a.C0.CR:a.C0.CR,_.cancel=!0;break;case 27:_.key=a.C0.ESC,o.altKey&&(_.key=a.C0.ESC+a.C0.ESC),_.cancel=!0;break;case 37:if(o.metaKey)break;n?(_.key=a.C0.ESC+"[1;"+(n+1)+"D",_.key===a.C0.ESC+"[1;3D"&&(_.key=a.C0.ESC+(S?"b":"[1;5D"))):_.key=p?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(o.metaKey)break;n?(_.key=a.C0.ESC+"[1;"+(n+1)+"C",_.key===a.C0.ESC+"[1;3C"&&(_.key=a.C0.ESC+(S?"f":"[1;5C"))):_.key=p?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(o.metaKey)break;n?(_.key=a.C0.ESC+"[1;"+(n+1)+"A",S||_.key!==a.C0.ESC+"[1;3A"||(_.key=a.C0.ESC+"[1;5A")):_.key=p?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(o.metaKey)break;n?(_.key=a.C0.ESC+"[1;"+(n+1)+"B",S||_.key!==a.C0.ESC+"[1;3B"||(_.key=a.C0.ESC+"[1;5B")):_.key=p?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:o.shiftKey||o.ctrlKey||(_.key=a.C0.ESC+"[2~");break;case 46:_.key=n?a.C0.ESC+"[3;"+(n+1)+"~":a.C0.ESC+"[3~";break;case 36:_.key=n?a.C0.ESC+"[1;"+(n+1)+"H":p?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:_.key=n?a.C0.ESC+"[1;"+(n+1)+"F":p?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:o.shiftKey?_.type=2:o.ctrlKey?_.key=a.C0.ESC+"[5;"+(n+1)+"~":_.key=a.C0.ESC+"[5~";break;case 34:o.shiftKey?_.type=3:o.ctrlKey?_.key=a.C0.ESC+"[6;"+(n+1)+"~":_.key=a.C0.ESC+"[6~";break;case 112:_.key=n?a.C0.ESC+"[1;"+(n+1)+"P":a.C0.ESC+"OP";break;case 113:_.key=n?a.C0.ESC+"[1;"+(n+1)+"Q":a.C0.ESC+"OQ";break;case 114:_.key=n?a.C0.ESC+"[1;"+(n+1)+"R":a.C0.ESC+"OR";break;case 115:_.key=n?a.C0.ESC+"[1;"+(n+1)+"S":a.C0.ESC+"OS";break;case 116:_.key=n?a.C0.ESC+"[15;"+(n+1)+"~":a.C0.ESC+"[15~";break;case 117:_.key=n?a.C0.ESC+"[17;"+(n+1)+"~":a.C0.ESC+"[17~";break;case 118:_.key=n?a.C0.ESC+"[18;"+(n+1)+"~":a.C0.ESC+"[18~";break;case 119:_.key=n?a.C0.ESC+"[19;"+(n+1)+"~":a.C0.ESC+"[19~";break;case 120:_.key=n?a.C0.ESC+"[20;"+(n+1)+"~":a.C0.ESC+"[20~";break;case 121:_.key=n?a.C0.ESC+"[21;"+(n+1)+"~":a.C0.ESC+"[21~";break;case 122:_.key=n?a.C0.ESC+"[23;"+(n+1)+"~":a.C0.ESC+"[23~";break;case 123:_.key=n?a.C0.ESC+"[24;"+(n+1)+"~":a.C0.ESC+"[24~";break;default:if(!o.ctrlKey||o.shiftKey||o.altKey||o.metaKey)if(S&&!y||!o.altKey||o.metaKey)!S||o.altKey||o.ctrlKey||o.shiftKey||!o.metaKey?o.key&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&o.keyCode>=48&&o.key.length===1?_.key=o.key:o.key&&o.ctrlKey&&(o.key==="_"&&(_.key=a.C0.US),o.key==="@"&&(_.key=a.C0.NUL)):o.keyCode===65&&(_.type=1);else{const u=d[o.keyCode],c=u?.[o.shiftKey?1:0];if(c)_.key=a.C0.ESC+c;else if(o.keyCode>=65&&o.keyCode<=90){const h=o.ctrlKey?o.keyCode-64:o.keyCode+32;let m=String.fromCharCode(h);o.shiftKey&&(m=m.toUpperCase()),_.key=a.C0.ESC+m}else if(o.keyCode===32)_.key=a.C0.ESC+(o.ctrlKey?a.C0.NUL:" ");else if(o.key==="Dead"&&o.code.startsWith("Key")){let h=o.code.slice(3,4);o.shiftKey||(h=h.toLowerCase()),_.key=a.C0.ESC+h,_.cancel=!0}}else o.keyCode>=65&&o.keyCode<=90?_.key=String.fromCharCode(o.keyCode-64):o.keyCode===32?_.key=a.C0.NUL:o.keyCode>=51&&o.keyCode<=55?_.key=String.fromCharCode(o.keyCode-51+27):o.keyCode===56?_.key=a.C0.DEL:o.keyCode===219?_.key=a.C0.ESC:o.keyCode===220?_.key=a.C0.FS:o.keyCode===221&&(_.key=a.C0.GS)}return _}},482:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(i){return i>65535?(i-=65536,String.fromCharCode(55296+(i>>10))+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)},s.utf32ToString=function(i,a=0,d=i.length){let o="";for(let p=a;p<d;++p){let S=i[p];S>65535?(S-=65536,o+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):o+=String.fromCharCode(S)}return o},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(i,a){const d=i.length;if(!d)return 0;let o=0,p=0;if(this._interim){const S=i.charCodeAt(p++);56320<=S&&S<=57343?a[o++]=1024*(this._interim-55296)+S-56320+65536:(a[o++]=this._interim,a[o++]=S),this._interim=0}for(let S=p;S<d;++S){const y=i.charCodeAt(S);if(55296<=y&&y<=56319){if(++S>=d)return this._interim=y,o;const _=i.charCodeAt(S);56320<=_&&_<=57343?a[o++]=1024*(y-55296)+_-56320+65536:(a[o++]=y,a[o++]=_)}else y!==65279&&(a[o++]=y)}return o}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(i,a){const d=i.length;if(!d)return 0;let o,p,S,y,_=0,n=0,u=0;if(this.interim[0]){let m=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let w,k=0;for(;(w=63&this.interim[++k])&&k<4;)b<<=6,b|=w;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=g-k;for(;u<E;){if(u>=d)return 0;if(w=i[u++],(192&w)!=128){u--,m=!0;break}this.interim[k++]=w,b<<=6,b|=63&w}m||(g===2?b<128?u--:a[_++]=b:g===3?b<2048||b>=55296&&b<=57343||b===65279||(a[_++]=b):b<65536||b>1114111||(a[_++]=b)),this.interim.fill(0)}const c=d-4;let h=u;for(;h<d;){for(;!(!(h<c)||128&(o=i[h])||128&(p=i[h+1])||128&(S=i[h+2])||128&(y=i[h+3]));)a[_++]=o,a[_++]=p,a[_++]=S,a[_++]=y,h+=4;if(o=i[h++],o<128)a[_++]=o;else if((224&o)==192){if(h>=d)return this.interim[0]=o,_;if(p=i[h++],(192&p)!=128){h--;continue}if(n=(31&o)<<6|63&p,n<128){h--;continue}a[_++]=n}else if((240&o)==224){if(h>=d)return this.interim[0]=o,_;if(p=i[h++],(192&p)!=128){h--;continue}if(h>=d)return this.interim[0]=o,this.interim[1]=p,_;if(S=i[h++],(192&S)!=128){h--;continue}if(n=(15&o)<<12|(63&p)<<6|63&S,n<2048||n>=55296&&n<=57343||n===65279)continue;a[_++]=n}else if((248&o)==240){if(h>=d)return this.interim[0]=o,_;if(p=i[h++],(192&p)!=128){h--;continue}if(h>=d)return this.interim[0]=o,this.interim[1]=p,_;if(S=i[h++],(192&S)!=128){h--;continue}if(h>=d)return this.interim[0]=o,this.interim[1]=p,this.interim[2]=S,_;if(y=i[h++],(192&y)!=128){h--;continue}if(n=(7&o)<<18|(63&p)<<12|(63&S)<<6|63&y,n<65536||n>1114111)continue;a[_++]=n}}return _}}},225:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;const i=[[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]],a=[[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 d;s.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let o=0;o<i.length;++o)d.fill(0,i[o][0],i[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?d[o]:(function(p,S){let y,_=0,n=S.length-1;if(p<S[0][0]||p>S[n][1])return!1;for(;n>=_;)if(y=_+n>>1,p>S[y][1])_=y+1;else{if(!(p<S[y][0]))return!0;n=y-1}return!1})(o,a)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1}}},5981:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;const a=i(8460),d=i(844);class o extends d.Disposable{constructor(S){super(),this._action=S,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new a.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(S,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let _;for(this._isSyncWriting=!0;_=this._writeBuffer.shift();){this._action(_);const n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,y){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+=S.length,this._writeBuffer.push(S),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(y)}_innerWrite(S=0,y=!0){const _=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const n=this._writeBuffer[this._bufferOffset],u=this._action(n,y);if(u){const h=m=>Date.now()-_>=12?setTimeout((()=>this._innerWrite(0,m))):this._innerWrite(_,m);return void u.catch((m=>(queueMicrotask((()=>{throw m})),Promise.resolve(!1)))).then(h)}const c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=n.length,Date.now()-_>=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()}}s.WriteBuffer=o},5941:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;const i=/^([\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})$/,a=/^[\da-f]+$/;function d(o,p){const S=o.toString(16),y=S.length<2?"0"+S:S;switch(p){case 4:return S[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(o){if(!o)return;let p=o.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const S=i.exec(p);if(S){const y=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/y*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/y*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),a.exec(p)&&[3,6,9,12].includes(p.length))){const S=p.length/3,y=[0,0,0];for(let _=0;_<3;++_){const n=parseInt(p.slice(S*_,S*_+S),16);y[_]=S===1?n<<4:S===2?n:S===3?n>>4:n>>8}return y}},s.toRgbString=function(o,p=16){const[S,y,_]=o;return`rgb:${d(S,p)}/${d(y,p)}/${d(_,p)}`}},5770:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;const a=i(482),d=i(8742),o=i(5770),p=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(y,_){this._handlers[y]===void 0&&(this._handlers[y]=[]);const n=this._handlers[y];return n.push(_),{dispose:()=>{const u=n.indexOf(_);u!==-1&&n.splice(u,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(y,_){if(this.reset(),this._ident=y,this._active=this._handlers[y]||p,this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(_);else this._handlerFb(this._ident,"HOOK",_)}put(y,_,n){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(y,_,n);else this._handlerFb(this._ident,"PUT",(0,a.utf32ToString)(y,_,n))}unhook(y,_=!0){if(this._active.length){let n=!1,u=this._active.length-1,c=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,n=_,c=this._stack.fallThrough,this._stack.paused=!1),!c&&n===!1){for(;u>=0&&(n=this._active[u].unhook(y),n!==!0);u--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,n;u--}for(;u>=0;u--)if(n=this._active[u].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const S=new d.Params;S.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=S,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():S,this._data="",this._hitLimit=!1}put(y,_,n){this._hitLimit||(this._data+=(0,a.utf32ToString)(y,_,n),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let _=!1;if(this._hitLimit)_=!1;else if(y&&(_=this._handler(this._data,this._params),_ instanceof Promise))return _.then((n=>(this._params=S,this._data="",this._hitLimit=!1,n)));return this._params=S,this._data="",this._hitLimit=!1,_}}},2015:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;const a=i(844),d=i(8742),o=i(6242),p=i(6351);class S{constructor(u){this.table=new Uint8Array(u)}setDefault(u,c){this.table.fill(u<<4|c)}add(u,c,h,m){this.table[c<<8|u]=h<<4|m}addMany(u,c,h,m){for(let b=0;b<u.length;b++)this.table[c<<8|u[b]]=h<<4|m}}s.TransitionTable=S;const y=160;s.VT500_TRANSITION_TABLE=(function(){const n=new S(4095),u=Array.apply(null,Array(256)).map(((k,g)=>g)),c=(k,g)=>u.slice(k,g),h=c(32,127),m=c(0,24);m.push(25),m.push.apply(m,c(28,32));const b=c(0,14);let w;for(w in n.setDefault(1,0),n.addMany(h,0,2,0),b)n.addMany([24,26,153,154],w,3,0),n.addMany(c(128,144),w,3,0),n.addMany(c(144,152),w,3,0),n.add(156,w,0,0),n.add(27,w,11,1),n.add(157,w,4,8),n.addMany([152,158,159],w,0,7),n.add(155,w,11,3),n.add(144,w,11,9);return n.addMany(m,0,3,0),n.addMany(m,1,3,1),n.add(127,1,0,1),n.addMany(m,8,0,8),n.addMany(m,3,3,3),n.add(127,3,0,3),n.addMany(m,4,3,4),n.add(127,4,0,4),n.addMany(m,6,3,6),n.addMany(m,5,3,5),n.add(127,5,0,5),n.addMany(m,2,3,2),n.add(127,2,0,2),n.add(93,1,4,8),n.addMany(h,8,5,8),n.add(127,8,5,8),n.addMany([156,27,24,26,7],8,6,0),n.addMany(c(28,32),8,0,8),n.addMany([88,94,95],1,0,7),n.addMany(h,7,0,7),n.addMany(m,7,0,7),n.add(156,7,0,0),n.add(127,7,0,7),n.add(91,1,11,3),n.addMany(c(64,127),3,7,0),n.addMany(c(48,60),3,8,4),n.addMany([60,61,62,63],3,9,4),n.addMany(c(48,60),4,8,4),n.addMany(c(64,127),4,7,0),n.addMany([60,61,62,63],4,0,6),n.addMany(c(32,64),6,0,6),n.add(127,6,0,6),n.addMany(c(64,127),6,0,0),n.addMany(c(32,48),3,9,5),n.addMany(c(32,48),5,9,5),n.addMany(c(48,64),5,0,6),n.addMany(c(64,127),5,7,0),n.addMany(c(32,48),4,9,5),n.addMany(c(32,48),1,9,2),n.addMany(c(32,48),2,9,2),n.addMany(c(48,127),2,10,0),n.addMany(c(48,80),1,10,0),n.addMany(c(81,88),1,10,0),n.addMany([89,90,92],1,10,0),n.addMany(c(96,127),1,10,0),n.add(80,1,11,9),n.addMany(m,9,0,9),n.add(127,9,0,9),n.addMany(c(28,32),9,0,9),n.addMany(c(32,48),9,9,12),n.addMany(c(48,60),9,8,10),n.addMany([60,61,62,63],9,9,10),n.addMany(m,11,0,11),n.addMany(c(32,128),11,0,11),n.addMany(c(28,32),11,0,11),n.addMany(m,10,0,10),n.add(127,10,0,10),n.addMany(c(28,32),10,0,10),n.addMany(c(48,60),10,8,10),n.addMany([60,61,62,63],10,0,11),n.addMany(c(32,48),10,9,12),n.addMany(m,12,0,12),n.add(127,12,0,12),n.addMany(c(28,32),12,0,12),n.addMany(c(32,48),12,9,12),n.addMany(c(48,64),12,0,11),n.addMany(c(64,127),12,12,13),n.addMany(c(64,127),10,12,13),n.addMany(c(64,127),9,12,13),n.addMany(m,13,13,13),n.addMany(h,13,13,13),n.add(127,13,0,13),n.addMany([27,156,24,26],13,14,0),n.add(y,0,2,0),n.add(y,8,5,8),n.add(y,6,0,6),n.add(y,11,0,11),n.add(y,13,13,13),n})();class _ extends a.Disposable{constructor(u=s.VT500_TRANSITION_TABLE){super(),this._transitions=u,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(c,h,m)=>{},this._executeHandlerFb=c=>{},this._csiHandlerFb=(c,h)=>{},this._escHandlerFb=c=>{},this._errorHandlerFb=c=>c,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,a.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(u,c=[64,126]){let h=0;if(u.prefix){if(u.prefix.length>1)throw new Error("only one byte as prefix supported");if(h=u.prefix.charCodeAt(0),h&&60>h||h>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(u.intermediates){if(u.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<u.intermediates.length;++b){const w=u.intermediates.charCodeAt(b);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");h<<=8,h|=w}}if(u.final.length!==1)throw new Error("final must be a single byte");const m=u.final.charCodeAt(0);if(c[0]>m||m>c[1])throw new Error(`final must be in range ${c[0]} .. ${c[1]}`);return h<<=8,h|=m,h}identToString(u){const c=[];for(;u;)c.push(String.fromCharCode(255&u)),u>>=8;return c.reverse().join("")}setPrintHandler(u){this._printHandler=u}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(u,c){const h=this._identifier(u,[48,126]);this._escHandlers[h]===void 0&&(this._escHandlers[h]=[]);const m=this._escHandlers[h];return m.push(c),{dispose:()=>{const b=m.indexOf(c);b!==-1&&m.splice(b,1)}}}clearEscHandler(u){this._escHandlers[this._identifier(u,[48,126])]&&delete this._escHandlers[this._identifier(u,[48,126])]}setEscHandlerFallback(u){this._escHandlerFb=u}setExecuteHandler(u,c){this._executeHandlers[u.charCodeAt(0)]=c}clearExecuteHandler(u){this._executeHandlers[u.charCodeAt(0)]&&delete this._executeHandlers[u.charCodeAt(0)]}setExecuteHandlerFallback(u){this._executeHandlerFb=u}registerCsiHandler(u,c){const h=this._identifier(u);this._csiHandlers[h]===void 0&&(this._csiHandlers[h]=[]);const m=this._csiHandlers[h];return m.push(c),{dispose:()=>{const b=m.indexOf(c);b!==-1&&m.splice(b,1)}}}clearCsiHandler(u){this._csiHandlers[this._identifier(u)]&&delete this._csiHandlers[this._identifier(u)]}setCsiHandlerFallback(u){this._csiHandlerFb=u}registerDcsHandler(u,c){return this._dcsParser.registerHandler(this._identifier(u),c)}clearDcsHandler(u){this._dcsParser.clearHandler(this._identifier(u))}setDcsHandlerFallback(u){this._dcsParser.setHandlerFallback(u)}registerOscHandler(u,c){return this._oscParser.registerHandler(u,c)}clearOscHandler(u){this._oscParser.clearHandler(u)}setOscHandlerFallback(u){this._oscParser.setHandlerFallback(u)}setErrorHandler(u){this._errorHandler=u}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(u,c,h,m,b){this._parseStack.state=u,this._parseStack.handlers=c,this._parseStack.handlerPos=h,this._parseStack.transition=m,this._parseStack.chunkPos=b}parse(u,c,h){let m,b=0,w=0,k=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,k=this._parseStack.chunkPos+1;else{if(h===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(h===!1&&E>-1){for(;E>=0&&(m=g[E](this._params),m!==!0);E--)if(m instanceof Promise)return this._parseStack.handlerPos=E,m}this._parseStack.handlers=[];break;case 4:if(h===!1&&E>-1){for(;E>=0&&(m=g[E](),m!==!0);E--)if(m instanceof Promise)return this._parseStack.handlerPos=E,m}this._parseStack.handlers=[];break;case 6:if(b=u[this._parseStack.chunkPos],m=this._dcsParser.unhook(b!==24&&b!==26,h),m)return m;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=u[this._parseStack.chunkPos],m=this._oscParser.end(b!==24&&b!==26,h),m)return m;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,k=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let g=k;g<c;++g){switch(b=u[g],w=this._transitions.table[this.currentState<<8|(b<160?b:y)],w>>4){case 2:for(let P=g+1;;++P){if(P>=c||(b=u[P])<32||b>126&&b<y){this._printHandler(u,g,P),g=P-1;break}if(++P>=c||(b=u[P])<32||b>126&&b<y){this._printHandler(u,g,P),g=P-1;break}if(++P>=c||(b=u[P])<32||b>126&&b<y){this._printHandler(u,g,P),g=P-1;break}if(++P>=c||(b=u[P])<32||b>126&&b<y){this._printHandler(u,g,P),g=P-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|b];let L=E?E.length-1:-1;for(;L>=0&&(m=E[L](this._params),m!==!0);L--)if(m instanceof Promise)return this._preserveStack(3,E,L,w,g),m;L<0&&this._csiHandlerFb(this._collect<<8|b,this._params),this.precedingCodepoint=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++g<c&&(b=u[g])>47&&b<60);g--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const T=this._escHandlers[this._collect<<8|b];let M=T?T.length-1:-1;for(;M>=0&&(m=T[M](),m!==!0);M--)if(m instanceof Promise)return this._preserveStack(4,T,M,w,g),m;M<0&&this._escHandlerFb(this._collect<<8|b),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|b,this._params);break;case 13:for(let P=g+1;;++P)if(P>=c||(b=u[P])===24||b===26||b===27||b>127&&b<y){this._dcsParser.put(u,g,P),g=P-1;break}break;case 14:if(m=this._dcsParser.unhook(b!==24&&b!==26),m)return this._preserveStack(6,[],0,w,g),m;b===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let P=g+1;;P++)if(P>=c||(b=u[P])<32||b>127&&b<y){this._oscParser.put(u,g,P),g=P-1;break}break;case 6:if(m=this._oscParser.end(b!==24&&b!==26),m)return this._preserveStack(5,[],0,w,g),m;b===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&w}}}s.EscapeSequenceParser=_},6242:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;const a=i(5770),d=i(482),o=[];s.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,S){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(S),{dispose:()=>{const _=y.indexOf(S);_!==-1&&y.splice(_,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,S,y){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(p,S,y);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(p,S,y))}start(){this.reset(),this._state=1}put(p,S,y){if(this._state!==3){if(this._state===1)for(;S<y;){const _=p[S++];if(_===59){this._state=2,this._start();break}if(_<48||57<_)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+_-48}this._state===2&&y-S>0&&this._put(p,S,y)}}end(p,S=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,_=this._active.length-1,n=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,y=S,n=this._stack.fallThrough,this._stack.paused=!1),!n&&y===!1){for(;_>=0&&(y=this._active[_].end(p),y!==!0);_--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,y;_--}for(;_>=0;_--)if(y=this._active[_].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",p);this._active=o,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,S,y){this._hitLimit||(this._data+=(0,d.utf32ToString)(p,S,y),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let S=!1;if(this._hitLimit)S=!1;else if(p&&(S=this._handler(this._data),S instanceof Promise))return S.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,S}}},8742:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;const i=2147483647;class a{static fromArray(o){const p=new a;if(!o.length)return p;for(let S=Array.isArray(o[0])?1:0;S<o.length;++S){const y=o[S];if(Array.isArray(y))for(let _=0;_<y.length;++_)p.addSubParam(y[_]);else p.addParam(y)}return p}constructor(o=32,p=32){if(this.maxLength=o,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(o),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(o),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const o=new a(this.maxLength,this.maxSubParamsLength);return o.params.set(this.params),o.length=this.length,o._subParams.set(this._subParams),o._subParamsLength=this._subParamsLength,o._subParamsIdx.set(this._subParamsIdx),o._rejectDigits=this._rejectDigits,o._rejectSubDigits=this._rejectSubDigits,o._digitIsSub=this._digitIsSub,o}toArray(){const o=[];for(let p=0;p<this.length;++p){o.push(this.params[p]);const S=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-S>0&&o.push(Array.prototype.slice.call(this._subParams,S,y))}return o}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(o){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=o>i?i:o}}addSubParam(o){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(o<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=o>i?i:o,this._subParamsIdx[this.length-1]++}}hasSubParams(o){return(255&this._subParamsIdx[o])-(this._subParamsIdx[o]>>8)>0}getSubParams(o){const p=this._subParamsIdx[o]>>8,S=255&this._subParamsIdx[o];return S-p>0?this._subParams.subarray(p,S):null}getSubParamsAll(){const o={};for(let p=0;p<this.length;++p){const S=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-S>0&&(o[p]=this._subParams.slice(S,y))}return o}addDigit(o){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,y=S[p-1];S[p-1]=~y?Math.min(10*y+o,i):o}}s.Params=a},5741:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let i=this._addons.length-1;i>=0;i--)this._addons[i].instance.dispose()}loadAddon(i,a){const d={instance:a,dispose:a.dispose,isDisposed:!1};this._addons.push(d),a.dispose=()=>this._wrappedAddonDispose(d),a.activate(i)}_wrappedAddonDispose(i){if(i.isDisposed)return;let a=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===i){a=d;break}if(a===-1)throw new Error("Could not dispose an addon that has not been loaded");i.isDisposed=!0,i.dispose.apply(i.instance),this._addons.splice(a,1)}}},8771:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;const a=i(3785),d=i(511);s.BufferApiView=class{constructor(o,p){this._buffer=o,this.type=p}init(o){return this._buffer=o,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(o){const p=this._buffer.lines.get(o);if(p)return new a.BufferLineApiView(p)}getNullCell(){return new d.CellData}}},3785:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;const a=i(511);s.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,o){if(!(d<0||d>=this._line.length))return o?(this._line.loadCell(d,o),o):this._line.loadCell(d,new a.CellData)}translateToString(d,o,p){return this._line.translateToString(d,o,p)}}},8285:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;const a=i(8771),d=i(8460),o=i(844);class p extends o.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new d.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new a.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new a.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)}}s.BufferNamespaceApi=p},7975:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(i){this._core=i}registerCsiHandler(i,a){return this._core.registerCsiHandler(i,(d=>a(d.toArray())))}addCsiHandler(i,a){return this.registerCsiHandler(i,a)}registerDcsHandler(i,a){return this._core.registerDcsHandler(i,((d,o)=>a(d,o.toArray())))}addDcsHandler(i,a){return this.registerDcsHandler(i,a)}registerEscHandler(i,a){return this._core.registerEscHandler(i,a)}addEscHandler(i,a){return this.registerEscHandler(i,a)}registerOscHandler(i,a){return this._core.registerOscHandler(i,a)}addOscHandler(i,a){return this.registerOscHandler(i,a)}}},7090:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(i){this._core=i}register(i){this._core.unicodeService.register(i)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(i){this._core.unicodeService.activeVersion=i}}},744:function(C,s,i){var a=this&&this.__decorate||function(n,u,c,h){var m,b=arguments.length,w=b<3?u:h===null?h=Object.getOwnPropertyDescriptor(u,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,u,c,h);else for(var k=n.length-1;k>=0;k--)(m=n[k])&&(w=(b<3?m(w):b>3?m(u,c,w):m(u,c))||w);return b>3&&w&&Object.defineProperty(u,c,w),w},d=this&&this.__param||function(n,u){return function(c,h){u(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;const o=i(8460),p=i(844),S=i(5295),y=i(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let _=s.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(n){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(n.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(n.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(n,this))}resize(n,u){this.cols=n,this.rows=u,this.buffers.resize(n,u),this._onResize.fire({cols:n,rows:u})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(n,u=!1){const c=this.buffer;let h;h=this._cachedBlankLine,h&&h.length===this.cols&&h.getFg(0)===n.fg&&h.getBg(0)===n.bg||(h=c.getBlankLine(n,u),this._cachedBlankLine=h),h.isWrapped=u;const m=c.ybase+c.scrollTop,b=c.ybase+c.scrollBottom;if(c.scrollTop===0){const w=c.lines.isFull;b===c.lines.length-1?w?c.lines.recycle().copyFrom(h):c.lines.push(h.clone()):c.lines.splice(b+1,0,h.clone()),w?this.isUserScrolling&&(c.ydisp=Math.max(c.ydisp-1,0)):(c.ybase++,this.isUserScrolling||c.ydisp++)}else{const w=b-m+1;c.lines.shiftElements(m+1,w-1,-1),c.lines.set(b,h.clone())}this.isUserScrolling||(c.ydisp=c.ybase),this._onScroll.fire(c.ydisp)}scrollLines(n,u,c){const h=this.buffer;if(n<0){if(h.ydisp===0)return;this.isUserScrolling=!0}else n+h.ydisp>=h.ybase&&(this.isUserScrolling=!1);const m=h.ydisp;h.ydisp=Math.max(Math.min(h.ydisp+n,h.ybase),0),m!==h.ydisp&&(u||this._onScroll.fire(h.ydisp))}};s.BufferService=_=a([d(0,y.IOptionsService)],_)},7994:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(i){this.glevel=i,this.charset=this._charsets[i]}setgCharset(i,a){this._charsets[i]=a,this.glevel===i&&(this.charset=a)}}},1753:function(C,s,i){var a=this&&this.__decorate||function(h,m,b,w){var k,g=arguments.length,E=g<3?m:w===null?w=Object.getOwnPropertyDescriptor(m,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(h,m,b,w);else for(var L=h.length-1;L>=0;L--)(k=h[L])&&(E=(g<3?k(E):g>3?k(m,b,E):k(m,b))||E);return g>3&&E&&Object.defineProperty(m,b,E),E},d=this&&this.__param||function(h,m){return function(b,w){m(b,w,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;const o=i(2585),p=i(8460),S=i(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:h=>h.button!==4&&h.action===1&&(h.ctrl=!1,h.alt=!1,h.shift=!1,!0)},VT200:{events:19,restrict:h=>h.action!==32},DRAG:{events:23,restrict:h=>h.action!==32||h.button!==3},ANY:{events:31,restrict:h=>!0}};function _(h,m){let b=(h.ctrl?16:0)|(h.shift?4:0)|(h.alt?8:0);return h.button===4?(b|=64,b|=h.action):(b|=3&h.button,4&h.button&&(b|=64),8&h.button&&(b|=128),h.action===32?b|=32:h.action!==0||m||(b|=3)),b}const n=String.fromCharCode,u={DEFAULT:h=>{const m=[_(h,!1)+32,h.col+32,h.row+32];return m[0]>255||m[1]>255||m[2]>255?"":`\x1B[M${n(m[0])}${n(m[1])}${n(m[2])}`},SGR:h=>{const m=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${_(h,!0)};${h.col};${h.row}${m}`},SGR_PIXELS:h=>{const m=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${_(h,!0)};${h.x};${h.y}${m}`}};let c=s.CoreMouseService=class extends S.Disposable{constructor(h,m){super(),this._bufferService=h,this._coreService=m,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const b of Object.keys(y))this.addProtocol(b,y[b]);for(const b of Object.keys(u))this.addEncoding(b,u[b]);this.reset()}addProtocol(h,m){this._protocols[h]=m}addEncoding(h,m){this._encodings[h]=m}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(h){if(!this._protocols[h])throw new Error(`unknown protocol "${h}"`);this._activeProtocol=h,this._onProtocolChange.fire(this._protocols[h].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(h){if(!this._encodings[h])throw new Error(`unknown encoding "${h}"`);this._activeEncoding=h}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(h){if(h.col<0||h.col>=this._bufferService.cols||h.row<0||h.row>=this._bufferService.rows||h.button===4&&h.action===32||h.button===3&&h.action!==32||h.button!==4&&(h.action===2||h.action===3)||(h.col++,h.row++,h.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,h,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(h))return!1;const m=this._encodings[this._activeEncoding](h);return m&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(m):this._coreService.triggerDataEvent(m,!0)),this._lastEvent=h,!0}explainEvents(h){return{down:!!(1&h),up:!!(2&h),drag:!!(4&h),move:!!(8&h),wheel:!!(16&h)}}_equalEvents(h,m,b){if(b){if(h.x!==m.x||h.y!==m.y)return!1}else if(h.col!==m.col||h.row!==m.row)return!1;return h.button===m.button&&h.action===m.action&&h.ctrl===m.ctrl&&h.alt===m.alt&&h.shift===m.shift}};s.CoreMouseService=c=a([d(0,o.IBufferService),d(1,o.ICoreService)],c)},6975:function(C,s,i){var a=this&&this.__decorate||function(c,h,m,b){var w,k=arguments.length,g=k<3?h:b===null?b=Object.getOwnPropertyDescriptor(h,m):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(c,h,m,b);else for(var E=c.length-1;E>=0;E--)(w=c[E])&&(g=(k<3?w(g):k>3?w(h,m,g):w(h,m))||g);return k>3&&g&&Object.defineProperty(h,m,g),g},d=this&&this.__param||function(c,h){return function(m,b){h(m,b,c)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;const o=i(1439),p=i(8460),S=i(844),y=i(2585),_=Object.freeze({insertMode:!1}),n=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let u=s.CoreService=class extends S.Disposable{constructor(c,h,m){super(),this._bufferService=c,this._logService=h,this._optionsService=m,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(_),this.decPrivateModes=(0,o.clone)(n)}reset(){this.modes=(0,o.clone)(_),this.decPrivateModes=(0,o.clone)(n)}triggerDataEvent(c,h=!1){if(this._optionsService.rawOptions.disableStdin)return;const m=this._bufferService.buffer;h&&this._optionsService.rawOptions.scrollOnUserInput&&m.ybase!==m.ydisp&&this._onRequestScrollToBottom.fire(),h&&this._onUserInput.fire(),this._logService.debug(`sending data "${c}"`,(()=>c.split("").map((b=>b.charCodeAt(0))))),this._onData.fire(c)}triggerBinaryEvent(c){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${c}"`,(()=>c.split("").map((h=>h.charCodeAt(0))))),this._onBinary.fire(c))}};s.CoreService=u=a([d(0,y.IBufferService),d(1,y.ILogService),d(2,y.IOptionsService)],u)},9074:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;const a=i(8055),d=i(8460),o=i(844),p=i(6106);let S=0,y=0;class _ extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((c=>c?.marker.line)),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)((()=>this.reset())))}registerDecoration(c){if(c.marker.isDisposed)return;const h=new n(c);if(h){const m=h.marker.onDispose((()=>h.dispose()));h.onDispose((()=>{h&&(this._decorations.delete(h)&&this._onDecorationRemoved.fire(h),m.dispose())})),this._decorations.insert(h),this._onDecorationRegistered.fire(h)}return h}reset(){for(const c of this._decorations.values())c.dispose();this._decorations.clear()}*getDecorationsAtCell(c,h,m){var b,w,k;let g=0,E=0;for(const L of this._decorations.getKeyIterator(h))g=(b=L.options.x)!==null&&b!==void 0?b:0,E=g+((w=L.options.width)!==null&&w!==void 0?w:1),c>=g&&c<E&&(!m||((k=L.options.layer)!==null&&k!==void 0?k:"bottom")===m)&&(yield L)}forEachDecorationAtCell(c,h,m,b){this._decorations.forEachByKey(h,(w=>{var k,g,E;S=(k=w.options.x)!==null&&k!==void 0?k:0,y=S+((g=w.options.width)!==null&&g!==void 0?g:1),c>=S&&c<y&&(!m||((E=w.options.layer)!==null&&E!==void 0?E:"bottom")===m)&&b(w)}))}}s.DecorationService=_;class n extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=a.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=a.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(c){super(),this.options=c,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=c.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;const a=i(2585),d=i(8343);class o{constructor(...S){this._entries=new Map;for(const[y,_]of S)this.set(y,_)}set(S,y){const _=this._entries.get(S);return this._entries.set(S,y),_}forEach(S){for(const[y,_]of this._entries.entries())S(y,_)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}s.ServiceCollection=o,s.InstantiationService=class{constructor(){this._services=new o,this._services.set(a.IInstantiationService,this)}setService(p,S){this._services.set(p,S)}getService(p){return this._services.get(p)}createInstance(p,...S){const y=(0,d.getServiceDependencies)(p).sort(((u,c)=>u.index-c.index)),_=[];for(const u of y){const c=this._services.get(u.id);if(!c)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${u.id}.`);_.push(c)}const n=y.length>0?y[0].index:S.length;if(S.length!==n)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${n+1} conflicts with ${S.length} static arguments`);return new p(...S,..._)}}},7866:function(C,s,i){var a=this&&this.__decorate||function(n,u,c,h){var m,b=arguments.length,w=b<3?u:h===null?h=Object.getOwnPropertyDescriptor(u,c):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,u,c,h);else for(var k=n.length-1;k>=0;k--)(m=n[k])&&(w=(b<3?m(w):b>3?m(u,c,w):m(u,c))||w);return b>3&&w&&Object.defineProperty(u,c,w),w},d=this&&this.__param||function(n,u){return function(c,h){u(c,h,n)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const o=i(844),p=i(2585),S={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,_=s.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(n){super(),this._optionsService=n,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(n){for(let u=0;u<n.length;u++)typeof n[u]=="function"&&(n[u]=n[u]())}_log(n,u,c){this._evalLazyOptionalParams(c),n.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+u,...c)}trace(n,...u){var c,h;this._logLevel<=p.LogLevelEnum.TRACE&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.trace.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.log,n,u)}debug(n,...u){var c,h;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.debug.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.log,n,u)}info(n,...u){var c,h;this._logLevel<=p.LogLevelEnum.INFO&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.info.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.info,n,u)}warn(n,...u){var c,h;this._logLevel<=p.LogLevelEnum.WARN&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.warn.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.warn,n,u)}error(n,...u){var c,h;this._logLevel<=p.LogLevelEnum.ERROR&&this._log((h=(c=this._optionsService.options.logger)===null||c===void 0?void 0:c.error.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.error,n,u)}};s.LogService=_=a([d(0,p.IOptionsService)],_),s.setTraceLogger=function(n){y=n},s.traceCall=function(n,u,c){if(typeof c.value!="function")throw new Error("not supported");const h=c.value;c.value=function(...m){if(y.logLevel!==p.LogLevelEnum.TRACE)return h.apply(this,m);y.trace(`GlyphRenderer#${h.name}(${m.map((w=>JSON.stringify(w))).join(", ")})`);const b=h.apply(this,m);return y.trace(`GlyphRenderer#${h.name} return`,b),b}}},7302:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;const a=i(8460),d=i(844),o=i(6114);s.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends d.Disposable{constructor(_){super(),this._onOptionChange=this.register(new a.EventEmitter),this.onOptionChange=this._onOptionChange.event;const n=Object.assign({},s.DEFAULT_OPTIONS);for(const u in _)if(u in n)try{const c=_[u];n[u]=this._sanitizeAndValidateOption(u,c)}catch(c){console.error(c)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}onSpecificOptionChange(_,n){return this.onOptionChange((u=>{u===_&&n(this.rawOptions[_])}))}onMultipleOptionChange(_,n){return this.onOptionChange((u=>{_.indexOf(u)!==-1&&n()}))}_setupOptions(){const _=u=>{if(!(u in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);return this.rawOptions[u]},n=(u,c)=>{if(!(u in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${u}"`);c=this._sanitizeAndValidateOption(u,c),this.rawOptions[u]!==c&&(this.rawOptions[u]=c,this._onOptionChange.fire(u))};for(const u in this.rawOptions){const c={get:_.bind(this,u),set:n.bind(this,u)};Object.defineProperty(this.options,u,c)}}_sanitizeAndValidateOption(_,n){switch(_){case"cursorStyle":if(n||(n=s.DEFAULT_OPTIONS[_]),!(function(u){return u==="block"||u==="underline"||u==="bar"})(n))throw new Error(`"${n}" is not a valid value for ${_}`);break;case"wordSeparator":n||(n=s.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof n=="number"&&1<=n&&n<=1e3)break;n=p.includes(n)?n:s.DEFAULT_OPTIONS[_];break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw new Error(`${_} cannot be less than 1, value: ${n}`);break;case"minimumContrastRatio":n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case"scrollback":if((n=Math.min(n,4294967295))<0)throw new Error(`${_} cannot be less than 0, value: ${n}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${n}`);break;case"rows":case"cols":if(!n&&n!==0)throw new Error(`${_} must be numeric, value: ${n}`);break;case"windowsPty":n=n??{}}return n}}s.OptionsService=S},2660:function(C,s,i){var a=this&&this.__decorate||function(S,y,_,n){var u,c=arguments.length,h=c<3?y:n===null?n=Object.getOwnPropertyDescriptor(y,_):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(S,y,_,n);else for(var m=S.length-1;m>=0;m--)(u=S[m])&&(h=(c<3?u(h):c>3?u(y,_,h):u(y,_))||h);return c>3&&h&&Object.defineProperty(y,_,h),h},d=this&&this.__param||function(S,y){return function(_,n){y(_,n,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;const o=i(2585);let p=s.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const y=this._bufferService.buffer;if(S.id===void 0){const m=y.addMarker(y.ybase+y.y),b={data:S,id:this._nextId++,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(b,m))),this._dataByLinkId.set(b.id,b),b.id}const _=S,n=this._getEntryIdKey(_),u=this._entriesWithId.get(n);if(u)return this.addLineToLink(u.id,y.ybase+y.y),u.id;const c=y.addMarker(y.ybase+y.y),h={id:this._nextId++,key:this._getEntryIdKey(_),data:_,lines:[c]};return c.onDispose((()=>this._removeMarkerFromLink(h,c))),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(S,y){const _=this._dataByLinkId.get(S);if(_&&_.lines.every((n=>n.line!==y))){const n=this._bufferService.buffer.addMarker(y);_.lines.push(n),n.onDispose((()=>this._removeMarkerFromLink(_,n)))}}getLinkData(S){var y;return(y=this._dataByLinkId.get(S))===null||y===void 0?void 0:y.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,y){const _=S.lines.indexOf(y);_!==-1&&(S.lines.splice(_,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};s.OscLinkService=p=a([d(0,o.IBufferService)],p)},8343:(C,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const i="di$target",a="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(d){return d[a]||[]},s.createDecorator=function(d){if(s.serviceRegistry.has(d))return s.serviceRegistry.get(d);const o=function(p,S,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(_,n,u){n[i]===n?n[a].push({id:_,index:u}):(n[a]=[{id:_,index:u}],n[i]=n)})(o,p,y)};return o.toString=()=>d,s.serviceRegistry.set(d,o),o}},2585:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const a=i(8343);var d;s.IBufferService=(0,a.createDecorator)("BufferService"),s.ICoreMouseService=(0,a.createDecorator)("CoreMouseService"),s.ICoreService=(0,a.createDecorator)("CoreService"),s.ICharsetService=(0,a.createDecorator)("CharsetService"),s.IInstantiationService=(0,a.createDecorator)("InstantiationService"),(function(o){o[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF"})(d||(s.LogLevelEnum=d={})),s.ILogService=(0,a.createDecorator)("LogService"),s.IOptionsService=(0,a.createDecorator)("OptionsService"),s.IOscLinkService=(0,a.createDecorator)("OscLinkService"),s.IUnicodeService=(0,a.createDecorator)("UnicodeService"),s.IDecorationService=(0,a.createDecorator)("DecorationService")},1480:(C,s,i)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;const a=i(8460),d=i(225);s.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter,this.onChange=this._onChange.event;const o=new d.UnicodeV6;this.register(o),this._active=o.version,this._activeProvider=o}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(o){if(!this._providers[o])throw new Error(`unknown Unicode version "${o}"`);this._active=o,this._activeProvider=this._providers[o],this._onChange.fire(o)}register(o){this._providers[o.version]=o}wcwidth(o){return this._activeProvider.wcwidth(o)}getStringCellWidth(o){let p=0;const S=o.length;for(let y=0;y<S;++y){let _=o.charCodeAt(y);if(55296<=_&&_<=56319){if(++y>=S)return p+this.wcwidth(_);const n=o.charCodeAt(y);56320<=n&&n<=57343?_=1024*(_-55296)+n-56320+65536:p+=this.wcwidth(n)}p+=this.wcwidth(_)}return p}}}},l={};function v(C){var s=l[C];if(s!==void 0)return s.exports;var i=l[C]={exports:{}};return r[C].call(i.exports,i,i.exports,v),i.exports}var x={};return(()=>{var C=x;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const s=v(9042),i=v(3236),a=v(844),d=v(5741),o=v(8285),p=v(7975),S=v(7090),y=["cols","rows"];class _ extends a.Disposable{constructor(u){super(),this._core=this.register(new i.Terminal(u)),this._addonManager=this.register(new d.AddonManager),this._publicOptions=Object.assign({},this._core.options);const c=m=>this._core.options[m],h=(m,b)=>{this._checkReadonlyOptions(m),this._core.options[m]=b};for(const m in this._core.options){const b={get:c.bind(this,m),set:h.bind(this,m)};Object.defineProperty(this._publicOptions,m,b)}}_checkReadonlyOptions(u){if(y.includes(u))throw new Error(`Option "${u}" 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 p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.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 o.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const u=this._core.coreService.decPrivateModes;let c="none";switch(this._core.coreMouseService.activeProtocol){case"X10":c="x10";break;case"VT200":c="vt200";break;case"DRAG":c="drag";break;case"ANY":c="any"}return{applicationCursorKeysMode:u.applicationCursorKeys,applicationKeypadMode:u.applicationKeypad,bracketedPasteMode:u.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:c,originMode:u.origin,reverseWraparoundMode:u.reverseWraparound,sendFocusMode:u.sendFocus,wraparoundMode:u.wraparound}}get options(){return this._publicOptions}set options(u){for(const c in u)this._publicOptions[c]=u[c]}blur(){this._core.blur()}focus(){this._core.focus()}resize(u,c){this._verifyIntegers(u,c),this._core.resize(u,c)}open(u){this._core.open(u)}attachCustomKeyEventHandler(u){this._core.attachCustomKeyEventHandler(u)}registerLinkProvider(u){return this._core.registerLinkProvider(u)}registerCharacterJoiner(u){return this._checkProposedApi(),this._core.registerCharacterJoiner(u)}deregisterCharacterJoiner(u){this._checkProposedApi(),this._core.deregisterCharacterJoiner(u)}registerMarker(u=0){return this._verifyIntegers(u),this._core.registerMarker(u)}registerDecoration(u){var c,h,m;return this._checkProposedApi(),this._verifyPositiveIntegers((c=u.x)!==null&&c!==void 0?c:0,(h=u.width)!==null&&h!==void 0?h:0,(m=u.height)!==null&&m!==void 0?m:0),this._core.registerDecoration(u)}hasSelection(){return this._core.hasSelection()}select(u,c,h){this._verifyIntegers(u,c,h),this._core.select(u,c,h)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(u,c){this._verifyIntegers(u,c),this._core.selectLines(u,c)}dispose(){super.dispose()}scrollLines(u){this._verifyIntegers(u),this._core.scrollLines(u)}scrollPages(u){this._verifyIntegers(u),this._core.scrollPages(u)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(u){this._verifyIntegers(u),this._core.scrollToLine(u)}clear(){this._core.clear()}write(u,c){this._core.write(u,c)}writeln(u,c){this._core.write(u),this._core.write(`\r
|
|
19
|
+
`,c)}paste(u){this._core.paste(u)}refresh(u,c){this._verifyIntegers(u,c),this._core.refresh(u,c)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(u){this._addonManager.loadAddon(this,u)}static get strings(){return s}_verifyIntegers(...u){for(const c of u)if(c===1/0||isNaN(c)||c%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...u){for(const c of u)if(c&&(c===1/0||isNaN(c)||c%1!=0||c<0))throw new Error("This API only accepts positive integers")}}C.Terminal=_})(),x})()))})(Br)),Br.exports}var sc=rc();var ic=2,nc=1,oc=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(r.getPropertyValue("height")),v=Math.max(0,parseInt(r.getPropertyValue("width"))),x=window.getComputedStyle(this._terminal.element),C={top:parseInt(x.getPropertyValue("padding-top")),bottom:parseInt(x.getPropertyValue("padding-bottom")),right:parseInt(x.getPropertyValue("padding-right")),left:parseInt(x.getPropertyValue("padding-left"))},s=C.top+C.bottom,i=C.right+C.left,a=l-s,d=v-i-t;return{cols:Math.max(ic,Math.floor(d/e.css.cell.width)),rows:Math.max(nc,Math.floor(a/e.css.cell.height))}}};function ac(e={}){const{cwd:t,cols:r,rows:l,onOutput:v,onExit:x}=e,[C,s]=R.useState(null),[i,a]=R.useState(()=>pt.isConnected()),[d,o]=R.useState(!1),[p,S]=R.useState(!1),y=R.useRef({onOutput:v,onExit:x});y.current={onOutput:v,onExit:x};const _=R.useRef(null);_.current=C,R.useEffect(()=>{if(!C)return;const m=pt.getSocket(),b=()=>{a(!0),o(!1),y.current.onExit?.(-1),s(null)},w=()=>{a(!1),o(!1)},k=T=>{T.terminalId===C&&y.current.onOutput?.(T.data)},g=T=>{T.terminalId===C&&(o(!1),y.current.onExit?.(T.exitCode),s(null))},E=T=>{T.terminalId===C&&o(!0)},L=T=>{T.terminalId===C&&o(!1)};return m.on("connect",b),m.on("disconnect",w),m.on(Fe.TERMINAL_STDOUT,k),m.on(Fe.TERMINAL_EXIT,g),m.on(Fe.TERMINAL_SUBSCRIBED,E),m.on(Fe.TERMINAL_UNSUBSCRIBED,L),a(m.connected),m.connected&&m.emit(st.SUBSCRIBE,{topic:"terminal",id:C},T=>{T.success&&o(!0)}),()=>{m.off("connect",b),m.off("disconnect",w),m.off(Fe.TERMINAL_STDOUT,k),m.off(Fe.TERMINAL_EXIT,g),m.off(Fe.TERMINAL_SUBSCRIBED,E),m.off(Fe.TERMINAL_UNSUBSCRIBED,L),m.emit(st.UNSUBSCRIBE,{topic:"terminal",id:C})}},[C]);const n=R.useCallback(async()=>{const m=pt.getSocket();if(!m.connected)return null;S(!0);try{const b=await he.post("/terminals",{socketId:m.id,cwd:t,cols:r,rows:l});return s(b.terminalId),b.terminalId}catch(b){return console.error("[useStandaloneTerminal] Failed to create terminal:",b),null}finally{S(!1)}},[t,r,l]),u=R.useCallback(async()=>{const m=_.current;if(m){try{await he.delete(`/terminals/${m}`)}catch(b){console.error("[useStandaloneTerminal] Failed to destroy terminal:",b)}s(null),o(!1)}},[]),c=R.useCallback(m=>{const b=_.current;if(!b)return;pt.getSocket().emit(st.TERMINAL_INPUT,{terminalId:b,data:m})},[]),h=R.useCallback((m,b)=>{const w=_.current;if(!w)return;pt.getSocket().emit(st.TERMINAL_RESIZE,{terminalId:w,cols:m,rows:b})},[]);return R.useEffect(()=>()=>{const m=_.current;m&&he.delete(`/terminals/${m}`).catch(()=>{})},[]),{terminalId:C,isConnected:i,isAttached:d,isCreating:p,create:n,destroy:u,sendInput:c,resize:h}}const lc={background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78",black:"#1e1e1e",red:"#f44747",green:"#6a9955",yellow:"#d7ba7d",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#6a9955",brightYellow:"#d7ba7d",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#ffffff"},cc=J.memo(function({cwd:t,onExit:r}){const l=R.useRef(null),v=R.useRef(null),x=R.useRef(null),C=R.useRef(!1),{terminalId:s,isAttached:i,create:a,sendInput:d,resize:o}=ac({cwd:t,onOutput:R.useCallback(p=>{v.current?.write(p)},[]),onExit:R.useCallback(p=>{v.current?.writeln(`\r
|
|
20
|
+
\x1B[90m[Process exited with code ${p}]\x1B[0m`),r?.(p)},[r])});return R.useLayoutEffect(()=>{if(!l.current)return;const p=new sc.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:lc,scrollback:5e3,convertEol:!0}),S=new oc;p.loadAddon(S),p.open(l.current);const y=(_=0)=>{if(!(_>=5))try{const u=l.current;if(!u||u.clientWidth===0||u.clientHeight===0){setTimeout(()=>y(_+1),50);return}S.fit(),o(p.cols,p.rows)}catch{setTimeout(()=>y(_+1),50)}};return y(0),setTimeout(()=>y(1),100),v.current=p,x.current=S,()=>{p.dispose(),v.current=null,x.current=null}},[o]),R.useEffect(()=>{C.current||(C.current=!0,a())},[a]),R.useEffect(()=>{const p=v.current;if(!p||!i)return;const S=p.onData(y=>{d(y)});return()=>S.dispose()},[d,i]),R.useEffect(()=>{if(!l.current)return;const p=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{const S=x.current,y=v.current,_=l.current;S&&y&&_&&_.clientWidth>0&&_.clientHeight>0&&(S.fit(),o(y.cols,y.rows))}catch{}})});return p.observe(l.current),()=>p.disconnect()},[o]),f.jsxs("div",{className:"relative flex h-full flex-col bg-[#1e1e1e]",children:[!s&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral-500 text-xs z-10 bg-[#1e1e1e]",children:"Starting terminal..."}),f.jsx("div",{ref:l,className:"flex-1 overflow-hidden px-1 pt-1"})]})});let hc=0;function Vs(){return`shell-${++hc}`}const uc=J.memo(function({cwd:t}){const[r,l]=R.useState(()=>[{id:Vs(),label:"Shell 1"}]),[v,x]=R.useState(()=>r[0].id),C=R.useCallback(()=>{const a=Vs(),d={id:a,label:`Shell ${r.length+1}`};l(o=>[...o,d]),x(a)},[r.length]),s=R.useCallback((a,d)=>{d.stopPropagation(),l(o=>{const p=o.filter(S=>S.id!==a);return a===v&&p.length>0&&x(p[p.length-1].id),p})},[v]),i=R.useCallback(a=>{l(d=>{const o=d.filter(p=>p.id!==a);return a===v&&o.length>0&&x(o[o.length-1].id),o})},[v]);return f.jsxs("div",{className:"flex h-full flex-col bg-[#1e1e1e]",children:[f.jsxs("div",{className:"flex items-center bg-[#252526] border-b border-[#333] shrink-0 select-none",children:[f.jsx("div",{className:"flex items-center overflow-x-auto flex-1 min-w-0",children:r.map(a=>f.jsxs("button",{onClick:()=>x(a.id),className:Ee("flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r border-[#333] whitespace-nowrap group transition-colors",a.id===v?"bg-[#1e1e1e] text-neutral-200":"bg-[#2d2d2d] text-neutral-500 hover:text-neutral-300"),children:[f.jsx(or,{size:11,className:"shrink-0"}),f.jsx("span",{children:a.label}),r.length>1&&f.jsx("span",{onClick:d=>s(a.id,d),className:"ml-1 p-0.5 rounded hover:bg-[#444] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:f.jsx(gr,{size:10})})]},a.id))}),f.jsx("button",{onClick:C,className:"flex items-center justify-center px-2 py-1.5 text-neutral-500 hover:text-neutral-300 hover:bg-[#333] transition-colors shrink-0",title:"New Terminal",children:f.jsx(Kr,{size:14})})]}),f.jsx("div",{className:"flex-1 overflow-hidden relative",children:r.length===0?f.jsx("div",{className:"flex-1 flex items-center justify-center h-full text-neutral-500",children:f.jsxs("div",{className:"flex flex-col items-center gap-2",children:[f.jsx(or,{size:28}),f.jsx("span",{className:"text-xs",children:"No terminals open"}),f.jsx("button",{onClick:C,className:"mt-1 px-3 py-1 text-xs bg-[#333] hover:bg-[#444] rounded transition-colors text-neutral-300",children:"New Terminal"})]})}):r.map(a=>f.jsx("div",{className:"absolute inset-0",style:{display:a.id===v?"block":"none"},children:f.jsx(cc,{cwd:t,onExit:()=>i(a.id)})},a.id))})]})});function Gs(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,l=Array(t);r<t;r++)l[r]=e[r];return l}function dc(e){if(Array.isArray(e))return e}function fc(e,t,r){return(t=Sc(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pc(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var l,v,x,C,s=[],i=!0,a=!1;try{if(x=(r=r.call(e)).next,t!==0)for(;!(i=(l=x.call(r)).done)&&(s.push(l.value),s.length!==t);i=!0);}catch(d){a=!0,v=d}finally{try{if(!i&&r.return!=null&&(C=r.return(),Object(C)!==C))return}finally{if(a)throw v}}return s}}function vc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
21
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),r.push.apply(r,l)}return r}function Zs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Qs(Object(r),!0).forEach(function(l){fc(e,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qs(Object(r)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(r,l))})}return e}function mc(e,t){if(e==null)return{};var r,l,v=_c(e,t);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(e);for(l=0;l<x.length;l++)r=x[l],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(v[r]=e[r])}return v}function _c(e,t){if(e==null)return{};var r={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(t.indexOf(l)!==-1)continue;r[l]=e[l]}return r}function gc(e,t){return dc(e)||pc(e,t)||xc(e,t)||vc()}function bc(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var l=r.call(e,t);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sc(e){var t=bc(e,"string");return typeof t=="symbol"?t:t+""}function xc(e,t){if(e){if(typeof e=="string")return Gs(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gs(e,t):void 0}}function Cc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Js(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),r.push.apply(r,l)}return r}function ei(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Js(Object(r),!0).forEach(function(l){Cc(e,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Js(Object(r)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(r,l))})}return e}function yc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(l){return t.reduceRight(function(v,x){return x(v)},l)}}function Lt(e){return function t(){for(var r=this,l=arguments.length,v=new Array(l),x=0;x<l;x++)v[x]=arguments[x];return v.length>=e.length?e.apply(this,v):function(){for(var C=arguments.length,s=new Array(C),i=0;i<C;i++)s[i]=arguments[i];return t.apply(r,[].concat(v,s))}}}function fr(e){return{}.toString.call(e).includes("Object")}function wc(e){return!Object.keys(e).length}function zt(e){return typeof e=="function"}function Ec(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function kc(e,t){return fr(t)||lt("changeType"),Object.keys(t).some(function(r){return!Ec(e,r)})&<("changeField"),t}function Rc(e){zt(e)||lt("selectorType")}function Dc(e){zt(e)||fr(e)||lt("handlerType"),fr(e)&&Object.values(e).some(function(t){return!zt(t)})&<("handlersType")}function Ac(e){e||lt("initialIsRequired"),fr(e)||lt("initialType"),wc(e)&<("initialContent")}function Lc(e,t){throw new Error(e[t]||e.default)}var Tc={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},lt=Lt(Lc)(Tc),Jt={changes:kc,selector:Rc,handler:Dc,initial:Ac};function Mc(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jt.initial(e),Jt.handler(t);var r={current:e},l=Lt(Nc)(r,t),v=Lt(Pc)(r),x=Lt(Jt.changes)(e),C=Lt(jc)(r);function s(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Jt.selector(a),a(r.current)}function i(a){yc(l,v,x,C)(a)}return[s,i]}function jc(e,t){return zt(t)?t(e.current):t}function Pc(e,t){return e.current=ei(ei({},e.current),t),t}function Nc(e,t,r){return zt(t)?t(e.current):Object.keys(r).forEach(function(l){var v;return(v=t[l])===null||v===void 0?void 0:v.call(t,e.current[l])}),r}var Oc={create:Mc},Bc={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ic(e){return function t(){for(var r=this,l=arguments.length,v=new Array(l),x=0;x<l;x++)v[x]=arguments[x];return v.length>=e.length?e.apply(this,v):function(){for(var C=arguments.length,s=new Array(C),i=0;i<C;i++)s[i]=arguments[i];return t.apply(r,[].concat(v,s))}}}function Fc(e){return{}.toString.call(e).includes("Object")}function Hc(e){return e||ti("configIsRequired"),Fc(e)||ti("configType"),e.urls?(zc(),{paths:{vs:e.urls.monacoBase}}):e}function zc(){console.warn(cn.deprecation)}function Wc(e,t){throw new Error(e[t]||e.default)}var cn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
22
|
+
You are using deprecated way of configuration.
|
|
23
|
+
|
|
24
|
+
Instead of using
|
|
25
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
26
|
+
use
|
|
27
|
+
monaco.config({ paths: { vs: '...' } })
|
|
28
|
+
|
|
29
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
30
|
+
`},ti=Ic(Wc)(cn),Uc={config:Hc},$c=function(){for(var t=arguments.length,r=new Array(t),l=0;l<t;l++)r[l]=arguments[l];return function(v){return r.reduceRight(function(x,C){return C(x)},v)}};function hn(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],hn(e[r],t[r]))}),Zs(Zs({},e),t)}var Kc={type:"cancelation",msg:"operation is manually canceled"};function Ir(e){var t=!1,r=new Promise(function(l,v){e.then(function(x){return t?v(Kc):l(x)}),e.catch(v)});return r.cancel=function(){return t=!0},r}var qc=["monaco"],Xc=Oc.create({config:Bc,isInitialized:!1,resolve:null,reject:null,monaco:null}),un=gc(Xc,2),qt=un[0],kr=un[1];function Yc(e){var t=Uc.config(e),r=t.monaco,l=mc(t,qc);kr(function(v){return{config:hn(v.config,l),monaco:r}})}function Vc(){var e=qt(function(t){var r=t.monaco,l=t.isInitialized,v=t.resolve;return{monaco:r,isInitialized:l,resolve:v}});if(!e.isInitialized){if(kr({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ir(Fr);if(window.monaco&&window.monaco.editor)return dn(window.monaco),e.resolve(window.monaco),Ir(Fr);$c(Gc,Zc)(Jc)}return Ir(Fr)}function Gc(e){return document.body.appendChild(e)}function Qc(e){var t=document.createElement("script");return e&&(t.src=e),t}function Zc(e){var t=qt(function(l){var v=l.config,x=l.reject;return{config:v,reject:x}}),r=Qc("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function Jc(){var e=qt(function(r){var l=r.config,v=r.resolve,x=r.reject;return{config:l,resolve:v,reject:x}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var l=r.m||r;dn(l),e.resolve(l)},function(r){e.reject(r)})}function dn(e){qt().monaco||kr({monaco:e})}function eh(){return qt(function(e){var t=e.monaco;return t})}var Fr=new Promise(function(e,t){return kr({resolve:e,reject:t})}),fn={config:Yc,init:Vc,__getMonacoInstance:eh},th={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Hr=th,rh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},sh=rh;function ih({children:e}){return J.createElement("div",{style:sh.container},e)}var nh=ih,oh=nh;function ah({width:e,height:t,isEditorReady:r,loading:l,_ref:v,className:x,wrapperProps:C}){return J.createElement("section",{style:{...Hr.wrapper,width:e,height:t},...C},!r&&J.createElement(oh,null,l),J.createElement("div",{ref:v,style:{...Hr.fullWidth,...!r&&Hr.hide},className:x}))}var lh=ah,pn=R.memo(lh);function ch(e){R.useEffect(e,[])}var vn=ch;function hh(e,t,r=!0){let l=R.useRef(!0);R.useEffect(l.current||!r?()=>{l.current=!1}:e,t)}var Xe=hh;function Nt(){}function bt(e,t,r,l){return uh(e,l)||dh(e,t,r,l)}function uh(e,t){return e.editor.getModel(mn(e,t))}function dh(e,t,r,l){return e.editor.createModel(t,r,l?mn(e,l):void 0)}function mn(e,t){return e.Uri.parse(t)}function fh({original:e,modified:t,language:r,originalLanguage:l,modifiedLanguage:v,originalModelPath:x,modifiedModelPath:C,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:i=!1,theme:a="light",loading:d="Loading...",options:o={},height:p="100%",width:S="100%",className:y,wrapperProps:_={},beforeMount:n=Nt,onMount:u=Nt}){let[c,h]=R.useState(!1),[m,b]=R.useState(!0),w=R.useRef(null),k=R.useRef(null),g=R.useRef(null),E=R.useRef(u),L=R.useRef(n),T=R.useRef(!1);vn(()=>{let F=fn.init();return F.then(W=>(k.current=W)&&b(!1)).catch(W=>W?.type!=="cancelation"&&console.error("Monaco initialization: error:",W)),()=>w.current?B():F.cancel()}),Xe(()=>{if(w.current&&k.current){let F=w.current.getOriginalEditor(),W=bt(k.current,e||"",l||r||"text",x||"");W!==F.getModel()&&F.setModel(W)}},[x],c),Xe(()=>{if(w.current&&k.current){let F=w.current.getModifiedEditor(),W=bt(k.current,t||"",v||r||"text",C||"");W!==F.getModel()&&F.setModel(W)}},[C],c),Xe(()=>{let F=w.current.getModifiedEditor();F.getOption(k.current.editor.EditorOption.readOnly)?F.setValue(t||""):t!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[t],c),Xe(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],c),Xe(()=>{let{original:F,modified:W}=w.current.getModel();k.current.editor.setModelLanguage(F,l||r||"text"),k.current.editor.setModelLanguage(W,v||r||"text")},[r,l,v],c),Xe(()=>{k.current?.editor.setTheme(a)},[a],c),Xe(()=>{w.current?.updateOptions(o)},[o],c);let M=R.useCallback(()=>{if(!k.current)return;L.current(k.current);let F=bt(k.current,e||"",l||r||"text",x||""),W=bt(k.current,t||"",v||r||"text",C||"");w.current?.setModel({original:F,modified:W})},[r,t,v,e,l,x,C]),P=R.useCallback(()=>{!T.current&&g.current&&(w.current=k.current.editor.createDiffEditor(g.current,{automaticLayout:!0,...o}),M(),k.current?.editor.setTheme(a),h(!0),T.current=!0)},[o,a,M]);R.useEffect(()=>{c&&E.current(w.current,k.current)},[c]),R.useEffect(()=>{!m&&!c&&P()},[m,c,P]);function B(){let F=w.current?.getModel();s||F?.original?.dispose(),i||F?.modified?.dispose(),w.current?.dispose()}return J.createElement(pn,{width:S,height:p,isEditorReady:c,loading:d,_ref:g,className:y,wrapperProps:_})}var ph=fh;R.memo(ph);function vh(e){let t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}var mh=vh,er=new Map;function _h({defaultValue:e,defaultLanguage:t,defaultPath:r,value:l,language:v,path:x,theme:C="light",line:s,loading:i="Loading...",options:a={},overrideServices:d={},saveViewState:o=!0,keepCurrentModel:p=!1,width:S="100%",height:y="100%",className:_,wrapperProps:n={},beforeMount:u=Nt,onMount:c=Nt,onChange:h,onValidate:m=Nt}){let[b,w]=R.useState(!1),[k,g]=R.useState(!0),E=R.useRef(null),L=R.useRef(null),T=R.useRef(null),M=R.useRef(c),P=R.useRef(u),B=R.useRef(),F=R.useRef(l),W=mh(x),H=R.useRef(!1),D=R.useRef(!1);vn(()=>{let O=fn.init();return O.then($=>(E.current=$)&&g(!1)).catch($=>$?.type!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>L.current?N():O.cancel()}),Xe(()=>{let O=bt(E.current,e||l||"",t||v||"",x||r||"");O!==L.current?.getModel()&&(o&&er.set(W,L.current?.saveViewState()),L.current?.setModel(O),o&&L.current?.restoreViewState(er.get(x)))},[x],b),Xe(()=>{L.current?.updateOptions(a)},[a],b),Xe(()=>{!L.current||l===void 0||(L.current.getOption(E.current.editor.EditorOption.readOnly)?L.current.setValue(l):l!==L.current.getValue()&&(D.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:l,forceMoveMarkers:!0}]),L.current.pushUndoStop(),D.current=!1))},[l],b),Xe(()=>{let O=L.current?.getModel();O&&v&&E.current?.editor.setModelLanguage(O,v)},[v],b),Xe(()=>{s!==void 0&&L.current?.revealLine(s)},[s],b),Xe(()=>{E.current?.editor.setTheme(C)},[C],b);let j=R.useCallback(()=>{if(!(!T.current||!E.current)&&!H.current){P.current(E.current);let O=x||r,$=bt(E.current,l||e||"",t||v||"",O||"");L.current=E.current?.editor.create(T.current,{model:$,automaticLayout:!0,...a},d),o&&L.current.restoreViewState(er.get(O)),E.current.editor.setTheme(C),s!==void 0&&L.current.revealLine(s),w(!0),H.current=!0}},[e,t,r,l,v,x,a,d,o,C,s]);R.useEffect(()=>{b&&M.current(L.current,E.current)},[b]),R.useEffect(()=>{!k&&!b&&j()},[k,b,j]),F.current=l,R.useEffect(()=>{b&&h&&(B.current?.dispose(),B.current=L.current?.onDidChangeModelContent(O=>{D.current||h(L.current.getValue(),O)}))},[b,h]),R.useEffect(()=>{if(b){let O=E.current.editor.onDidChangeMarkers($=>{let Y=L.current.getModel()?.uri;if(Y&&$.find(V=>V.path===Y.path)){let V=E.current.editor.getModelMarkers({resource:Y});m?.(V)}});return()=>{O?.dispose()}}return()=>{}},[b,m]);function N(){B.current?.dispose(),p?o&&er.set(x,L.current.saveViewState()):L.current.getModel()?.dispose(),L.current.dispose()}return J.createElement(pn,{width:S,height:y,isEditorReady:b,loading:i,_ref:T,className:_,wrapperProps:n})}var gh=_h,bh=R.memo(gh),Sh=bh,Ze=function(e,t){return Number(e.toFixed(t))},xh=function(e,t){return typeof e=="number"?e:t},Ce=function(e,t,r){r&&typeof r=="function"&&r(e,t)},Ch=function(e){return-Math.cos(e*Math.PI)/2+.5},yh=function(e){return e},wh=function(e){return e*e},Eh=function(e){return e*(2-e)},kh=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Rh=function(e){return e*e*e},Dh=function(e){return--e*e*e+1},Ah=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},Lh=function(e){return e*e*e*e},Th=function(e){return 1- --e*e*e*e},Mh=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},jh=function(e){return e*e*e*e*e},Ph=function(e){return 1+--e*e*e*e*e},Nh=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},_n={easeOut:Ch,linear:yh,easeInQuad:wh,easeOutQuad:Eh,easeInOutQuad:kh,easeInCubic:Rh,easeOutCubic:Dh,easeInOutCubic:Ah,easeInQuart:Lh,easeOutQuart:Th,easeInOutQuart:Mh,easeInQuint:jh,easeOutQuint:Ph,easeInOutQuint:Nh},gn=function(e){typeof e=="number"&&cancelAnimationFrame(e)},et=function(e){e.mounted&&(gn(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function bn(e,t,r,l){if(e.mounted){var v=new Date().getTime(),x=1;et(e),e.animation=function(){if(!e.mounted)return gn(e.animation);var C=new Date().getTime()-v,s=C/r,i=_n[t],a=i(s);C>=r?(l(x),e.animation=null):e.animation&&(l(a),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function Oh(e){var t=e.scale,r=e.positionX,l=e.positionY;return!(Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(l))}function ut(e,t,r,l){var v=Oh(t);if(!(!e.mounted||!v)){var x=e.setTransformState,C=e.transformState,s=C.scale,i=C.positionX,a=C.positionY,d=t.scale-s,o=t.positionX-i,p=t.positionY-a;r===0?x(t.scale,t.positionX,t.positionY):bn(e,l,r,function(S){var y=s+d*S,_=i+o*S,n=a+p*S;x(y,_,n)})}}function Bh(e,t,r){var l=e.offsetWidth,v=e.offsetHeight,x=t.offsetWidth,C=t.offsetHeight,s=x*r,i=C*r,a=l-s,d=v-i;return{wrapperWidth:l,wrapperHeight:v,newContentWidth:s,newDiffWidth:a,newContentHeight:i,newDiffHeight:d}}var Ih=function(e,t,r,l,v,x,C){var s=e>t?r*(C?1:.5):0,i=l>v?x*(C?1:.5):0,a=e-t-s,d=s,o=l-v-i,p=i;return{minPositionX:a,maxPositionX:d,minPositionY:o,maxPositionY:p}},Ss=function(e,t){var r=e.wrapperComponent,l=e.contentComponent,v=e.setup.centerZoomedOut;if(!r||!l)throw new Error("Components are not mounted");var x=Bh(r,l,t),C=x.wrapperWidth,s=x.wrapperHeight,i=x.newContentWidth,a=x.newDiffWidth,d=x.newContentHeight,o=x.newDiffHeight,p=Ih(C,i,a,s,d,o,!!v);return p},Qr=function(e,t,r,l){return l?e<t?Ze(t,2):e>r?Ze(r,2):Ze(e,2):Ze(e,2)},vt=function(e,t){var r=Ss(e,t);return e.bounds=r,r};function Xt(e,t,r,l,v,x,C){var s=r.minPositionX,i=r.minPositionY,a=r.maxPositionX,d=r.maxPositionY,o=0,p=0;C&&(o=v,p=x);var S=Qr(e,s-o,a+o,l),y=Qr(t,i-p,d+p,l);return{x:S,y}}function Rr(e,t,r,l,v,x){var C=e.transformState,s=C.scale,i=C.positionX,a=C.positionY,d=l-s;if(typeof t!="number"||typeof r!="number")return console.error("Mouse X and Y position were not provided!"),{x:i,y:a};var o=i-t*d,p=a-r*d,S=Xt(o,p,v,x,0,0,null);return S}function Yt(e,t,r,l,v){var x=v?l:0,C=t-x;return!Number.isNaN(r)&&e>=r?r:!Number.isNaN(t)&&e<=C?C:e}var ri=function(e,t){var r=e.setup.panning.excluded,l=e.isInitialized,v=e.wrapperComponent,x=t.target,C="shadowRoot"in x&&"composedPath"in t,s=C?t.composedPath().some(function(d){return d instanceof Element?v?.contains(d):!1}):v?.contains(x),i=l&&x&&s;if(!i)return!1;var a=Dr(x,r);return!a},si=function(e){var t=e.isInitialized,r=e.isPanning,l=e.setup,v=l.panning.disabled,x=t&&r&&!v;return!!x},Fh=function(e,t){var r=e.transformState,l=r.positionX,v=r.positionY;e.isPanning=!0;var x=t.clientX,C=t.clientY;e.startCoords={x:x-l,y:C-v}},Hh=function(e,t){var r=t.touches,l=e.transformState,v=l.positionX,x=l.positionY;e.isPanning=!0;var C=r.length===1;if(C){var s=r[0].clientX,i=r[0].clientY;e.startCoords={x:s-v,y:i-x}}};function zh(e){var t=e.transformState,r=t.positionX,l=t.positionY,v=t.scale,x=e.setup,C=x.disabled,s=x.limitToBounds,i=x.centerZoomedOut,a=e.wrapperComponent;if(!(C||!a||!e.bounds)){var d=e.bounds,o=d.maxPositionX,p=d.minPositionX,S=d.maxPositionY,y=d.minPositionY,_=r>o||r<p,n=l>S||l<y,u=r>o?a.offsetWidth:e.setup.minPositionX||0,c=l>S?a.offsetHeight:e.setup.minPositionY||0,h=Rr(e,u,c,v,e.bounds,s||i),m=h.x,b=h.y;return{scale:v,positionX:_?m:r,positionY:n?b:l}}}function Sn(e,t,r,l,v){var x=e.setup.limitToBounds,C=e.wrapperComponent,s=e.bounds,i=e.transformState,a=i.scale,d=i.positionX,o=i.positionY;if(!(C===null||s===null||t===d&&r===o)){var p=Xt(t,r,s,x,l,v,C),S=p.x,y=p.y;e.setTransformState(a,S,y)}}var Wh=function(e,t,r){var l=e.startCoords,v=e.transformState,x=e.setup.panning,C=x.lockAxisX,s=x.lockAxisY,i=v.positionX,a=v.positionY;if(!l)return{x:i,y:a};var d=t-l.x,o=r-l.y,p=C?i:d,S=s?a:o;return{x:p,y:S}},ht=function(e,t){var r=e.setup,l=e.transformState,v=l.scale,x=r.minScale,C=r.disablePadding;return t>0&&v>=x&&!C?t:0},Uh=function(e){var t=e.mounted,r=e.setup,l=r.disabled,v=r.velocityAnimation,x=e.transformState.scale,C=v.disabled,s=!C||x>1||!l||t;return!!s},$h=function(e){var t=e.mounted,r=e.velocity,l=e.bounds,v=e.setup,x=v.disabled,C=v.velocityAnimation,s=e.transformState.scale,i=C.disabled,a=!i||s>1||!x||t;return!(!a||!r||!l)};function Kh(e,t){var r=e.setup.velocityAnimation,l=r.equalToMove,v=r.animationTime,x=r.sensitivity;return l?v*t*x:v}function ii(e,t,r,l,v,x,C,s,i,a){if(v){if(t>C&&r>C){var d=C+(e-C)*a;return d>i?i:d<C?C:d}if(t<x&&r<x){var d=x+(e-x)*a;return d<s?s:d>x?x:d}}return l?t:Qr(e,x,C,v)}function qh(e,t){var r=1;return t?Math.min(r,e.offsetWidth/window.innerWidth):r}function Xh(e,t){var r=Uh(e);if(r){var l=e.lastMousePosition,v=e.velocityTime,x=e.setup,C=e.wrapperComponent,s=x.velocityAnimation.equalToMove,i=Date.now();if(l&&v&&C){var a=qh(C,s),d=t.x-l.x,o=t.y-l.y,p=d/a,S=o/a,y=i-v,_=d*d+o*o,n=Math.sqrt(_)/y;e.velocity={velocityX:p,velocityY:S,total:n}}e.lastMousePosition=t,e.velocityTime=i}}function Yh(e){var t=e.velocity,r=e.bounds,l=e.setup,v=e.wrapperComponent,x=$h(e);if(!(!x||!t||!r||!v)){var C=t.velocityX,s=t.velocityY,i=t.total,a=r.maxPositionX,d=r.minPositionX,o=r.maxPositionY,p=r.minPositionY,S=l.limitToBounds,y=l.alignmentAnimation,_=l.zoomAnimation,n=l.panning,u=n.lockAxisY,c=n.lockAxisX,h=_.animationType,m=y.sizeX,b=y.sizeY,w=y.velocityAlignmentTime,k=w,g=Kh(e,i),E=Math.max(g,k),L=ht(e,m),T=ht(e,b),M=L*v.offsetWidth/100,P=T*v.offsetHeight/100,B=a+M,F=d-M,W=o+P,H=p-P,D=e.transformState,j=new Date().getTime();bn(e,h,E,function(N){var O=e.transformState,$=O.scale,Y=O.positionX,V=O.positionY,Q=new Date().getTime()-j,re=Q/k,A=_n[y.animationType],I=1-A(Math.min(1,re)),U=1-N,z=Y+C*U,Z=V+s*U,G=ii(z,D.positionX,Y,c,S,d,a,F,B,I),ie=ii(Z,D.positionY,V,u,S,p,o,H,W,I);(Y!==z||V!==Z)&&e.setTransformState($,G,ie)})}}function ni(e,t){var r=e.transformState.scale;et(e),vt(e,r),window.TouchEvent!==void 0&&t instanceof TouchEvent?Hh(e,t):Fh(e,t)}function xs(e,t){var r=e.transformState.scale,l=e.setup,v=l.minScale,x=l.alignmentAnimation,C=x.disabled,s=x.sizeX,i=x.sizeY,a=x.animationTime,d=x.animationType,o=C||r<v||!s&&!i;if(!o){var p=zh(e);p&&ut(e,p,t??a,d)}}function oi(e,t,r){var l=e.startCoords,v=e.setup,x=v.alignmentAnimation,C=x.sizeX,s=x.sizeY;if(l){var i=Wh(e,t,r),a=i.x,d=i.y,o=ht(e,C),p=ht(e,s);Xh(e,{x:a,y:d}),Sn(e,a,d,o,p)}}function Vh(e){if(e.isPanning){var t=e.setup.panning.velocityDisabled,r=e.velocity,l=e.wrapperComponent,v=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var x=l?.getBoundingClientRect(),C=v?.getBoundingClientRect(),s=x?.width||0,i=x?.height||0,a=C?.width||0,d=C?.height||0,o=s<a||i<d,p=!t&&r&&r?.total>.1&&o;p?Yh(e):xs(e)}}function Cs(e,t,r,l){var v=e.setup,x=v.minScale,C=v.maxScale,s=v.limitToBounds,i=Yt(Ze(t,2),x,C,0,!1),a=vt(e,i),d=Rr(e,r,l,i,a,s),o=d.x,p=d.y;return{scale:i,positionX:o,positionY:p}}function xn(e,t,r){var l=e.transformState.scale,v=e.wrapperComponent,x=e.setup,C=x.minScale,s=x.limitToBounds,i=x.zoomAnimation,a=i.disabled,d=i.animationTime,o=i.animationType,p=a||l>=C;if((l>=1||s)&&xs(e),!(p||!v||!e.mounted)){var S=t||v.offsetWidth/2,y=r||v.offsetHeight/2,_=Cs(e,C,S,y);_&&ut(e,_,d,o)}}var ct=function(){return ct=Object.assign||function(t){for(var r,l=1,v=arguments.length;l<v;l++){r=arguments[l];for(var x in r)Object.prototype.hasOwnProperty.call(r,x)&&(t[x]=r[x])}return t},ct.apply(this,arguments)};function ai(e,t,r){for(var l=0,v=t.length,x;l<v;l++)(x||!(l in t))&&(x||(x=Array.prototype.slice.call(t,0,l)),x[l]=t[l]);return e.concat(x||Array.prototype.slice.call(t))}var tr={scale:1,positionX:0,positionY:0},Dt={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,wheel:{step:.2,disabled:!1,smoothStep:.001,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,wheelPanning:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},Zr={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},Cn=function(e){var t,r,l,v;return{previousScale:(t=e.initialScale)!==null&&t!==void 0?t:tr.scale,scale:(r=e.initialScale)!==null&&r!==void 0?r:tr.scale,positionX:(l=e.initialPositionX)!==null&&l!==void 0?l:tr.positionX,positionY:(v=e.initialPositionY)!==null&&v!==void 0?v:tr.positionY}},li=function(e){var t=ct({},Dt);return Object.keys(e).forEach(function(r){var l=typeof e[r]<"u",v=typeof Dt[r]<"u";if(v&&l){var x=Object.prototype.toString.call(Dt[r]),C=x==="[object Object]",s=x==="[object Array]";C?t[r]=ct(ct({},Dt[r]),e[r]):s?t[r]=ai(ai([],Dt[r],!0),e[r]):t[r]=e[r]}}),t},yn=function(e,t,r){var l=e.transformState.scale,v=e.wrapperComponent,x=e.setup,C=x.maxScale,s=x.minScale,i=x.zoomAnimation,a=x.smooth,d=i.size;if(!v)throw new Error("Wrapper is not mounted");var o=a?l*Math.exp(t*r):l+t*r,p=Yt(Ze(o,3),s,C,d,!1);return p};function wn(e,t,r,l,v){var x=e.wrapperComponent,C=e.transformState,s=C.scale,i=C.positionX,a=C.positionY;if(!x)return console.error("No WrapperComponent found");var d=x.offsetWidth,o=x.offsetHeight,p=(d/2-i)/s,S=(o/2-a)/s,y=yn(e,t,r),_=Cs(e,y,p,S);if(!_)return console.error("Error during zoom event. New transformation state was not calculated.");ut(e,_,l,v)}function En(e,t,r,l){var v=e.setup,x=e.wrapperComponent,C=v.limitToBounds,s=Cn(e.props),i=e.transformState,a=i.scale,d=i.positionX,o=i.positionY;if(x){var p=Ss(e,s.scale),S=Xt(s.positionX,s.positionY,p,C,0,0,x),y={scale:s.scale,positionX:S.x,positionY:S.y};a===s.scale&&d===s.positionX&&o===s.positionY||(l?.(),ut(e,y,t,r))}}function Gh(e,t,r,l){var v=e.getBoundingClientRect(),x=t.getBoundingClientRect(),C=r.getBoundingClientRect(),s=x.x*l.scale,i=x.y*l.scale;return{x:(v.x-C.x+s)/l.scale,y:(v.y-C.y+i)/l.scale}}function Qh(e,t,r){var l=e.wrapperComponent,v=e.contentComponent,x=e.transformState,C=e.setup,s=C.limitToBounds,i=C.minScale,a=C.maxScale;if(!l||!v)return x;var d=l.getBoundingClientRect(),o=t.getBoundingClientRect(),p=Gh(t,l,v,x),S=p.x,y=p.y,_=o.width/x.scale,n=o.height/x.scale,u=l.offsetWidth/_,c=l.offsetHeight/n,h=Yt(r||Math.min(u,c),i,a,0,!1),m=(d.width-_*h)/2,b=(d.height-n*h)/2,w=(d.left-S)*h+m,k=(d.top-y)*h+b,g=Ss(e,h),E=Xt(w,k,g,s,0,0,l),L=E.x,T=E.y;return{positionX:L,positionY:T,scale:h}}var Zh=function(e){return function(t,r,l){t===void 0&&(t=.5),r===void 0&&(r=300),l===void 0&&(l="easeOut"),wn(e,1,t,r,l)}},Jh=function(e){return function(t,r,l){t===void 0&&(t=.5),r===void 0&&(r=300),l===void 0&&(l="easeOut"),wn(e,-1,t,r,l)}},eu=function(e){return function(t,r,l,v,x){v===void 0&&(v=300),x===void 0&&(x="easeOut");var C=e.transformState,s=C.positionX,i=C.positionY,a=C.scale,d=e.wrapperComponent,o=e.contentComponent,p=e.setup.disabled;if(!(p||!d||!o)){var S={positionX:Number.isNaN(t)?s:t,positionY:Number.isNaN(r)?i:r,scale:Number.isNaN(l)?a:l};ut(e,S,v,x)}}},tu=function(e){return function(t,r){t===void 0&&(t=200),r===void 0&&(r="easeOut"),En(e,t,r)}},ru=function(e){return function(t,r,l){r===void 0&&(r=200),l===void 0&&(l="easeOut");var v=e.transformState,x=e.wrapperComponent,C=e.contentComponent;if(x&&C){var s=kn(t||v.scale,x,C);ut(e,s,r,l)}}},su=function(e){return function(t,r,l,v){l===void 0&&(l=600),v===void 0&&(v="easeOut"),et(e);var x=e.wrapperComponent,C=typeof t=="string"?document.getElementById(t):t;if(x&&C&&x.contains(C)){var s=Qh(e,C,r);ut(e,s,l,v)}}},pr=function(e){return{instance:e,zoomIn:Zh(e),zoomOut:Jh(e),setTransform:eu(e),resetTransform:tu(e),centerView:ru(e),zoomToElement:su(e)}},Jr=function(e){return{instance:e,state:e.transformState}},be=function(e){var t={};return Object.assign(t,Jr(e)),Object.assign(t,pr(e)),t},zr=!1;function Wr(){try{var e={get passive(){return zr=!0,!1}};return e}catch{return zr=!1,zr}}var rr=".".concat(Zr.wrapperClass),Dr=function(e,t){return t.some(function(r){return e.matches("".concat(rr," ").concat(r,", ").concat(rr," .").concat(r,", ").concat(rr," ").concat(r," *, ").concat(rr," .").concat(r," *"))})},es=function(e){e&&clearTimeout(e)},iu=function(e,t,r){return"translate(".concat(e,"px, ").concat(t,"px) scale(").concat(r,")")},kn=function(e,t,r){var l=r.offsetWidth*e,v=r.offsetHeight*e,x=(t.offsetWidth-l)/2,C=(t.offsetHeight-v)/2;return{scale:e,positionX:x,positionY:C}};function nu(e){return function(t){e.forEach(function(r){typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var ou=function(e,t){var r=e.setup.wheel,l=r.disabled,v=r.wheelDisabled,x=r.touchPadDisabled,C=r.excluded,s=e.isInitialized,i=e.isPanning,a=t.target,d=s&&!i&&!l&&a;if(!d||v&&!t.ctrlKey||x&&t.ctrlKey)return!1;var o=Dr(a,C);return!o},au=function(e){return e?e.deltaY<0?1:-1:0};function lu(e,t){var r=au(e),l=xh(t,r);return l}function Rn(e,t,r){var l=t.getBoundingClientRect(),v=0,x=0;if("clientX"in e)v=(e.clientX-l.left)/r,x=(e.clientY-l.top)/r;else{var C=e.touches[0];v=(C.clientX-l.left)/r,x=(C.clientY-l.top)/r}return(Number.isNaN(v)||Number.isNaN(x))&&console.error("No mouse or touch offset found"),{x:v,y:x}}var cu=function(e,t,r,l,v){var x=e.transformState.scale,C=e.wrapperComponent,s=e.setup,i=s.maxScale,a=s.minScale,d=s.zoomAnimation,o=s.disablePadding,p=d.size,S=d.disabled;if(!C)throw new Error("Wrapper is not mounted");var y=x+t*r,_=l?!1:!S,n=Yt(Ze(y,3),a,i,p,_&&!o);return n},hu=function(e,t){var r=e.previousWheelEvent,l=e.transformState.scale,v=e.setup,x=v.maxScale,C=v.minScale;return r?l<x||l>C||Math.sign(r.deltaY)!==Math.sign(t.deltaY)||r.deltaY>0&&r.deltaY<t.deltaY||r.deltaY<0&&r.deltaY>t.deltaY||Math.sign(r.deltaY)!==Math.sign(t.deltaY):!1},uu=function(e,t){var r=e.setup.pinch,l=r.disabled,v=r.excluded,x=e.isInitialized,C=t.target,s=x&&!l&&C;if(!s)return!1;var i=Dr(C,v);return!i},du=function(e){var t=e.setup.pinch.disabled,r=e.isInitialized,l=e.pinchStartDistance,v=r&&!t&&l;return!!v},fu=function(e,t,r){var l=r.getBoundingClientRect(),v=e.touches,x=Ze(v[0].clientX-l.left,5),C=Ze(v[0].clientY-l.top,5),s=Ze(v[1].clientX-l.left,5),i=Ze(v[1].clientY-l.top,5);return{x:(x+s)/2/t,y:(C+i)/2/t}},Dn=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},pu=function(e,t){var r=e.pinchStartScale,l=e.pinchStartDistance,v=e.setup,x=v.maxScale,C=v.minScale,s=v.zoomAnimation,i=v.disablePadding,a=s.size,d=s.disabled;if(!r||l===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var o=t/l,p=o*r;return Yt(Ze(p,2),C,x,a,!d&&!i)},vu=160,mu=100,_u=function(e,t){var r=e.props,l=r.onWheelStart,v=r.onZoomStart;e.wheelStopEventTimer||(et(e),Ce(be(e),t,l),Ce(be(e),t,v))},gu=function(e,t){var r=e.props,l=r.onWheel,v=r.onZoom,x=e.contentComponent,C=e.setup,s=e.transformState,i=s.scale,a=C.limitToBounds,d=C.centerZoomedOut,o=C.zoomAnimation,p=C.wheel,S=C.disablePadding,y=C.smooth,_=o.size,n=o.disabled,u=p.step,c=p.smoothStep;if(!x)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var h=lu(t,null),m=y?c*Math.abs(t.deltaY):u,b=cu(e,h,m,!t.ctrlKey);if(i!==b){var w=vt(e,b),k=Rn(t,x,i),g=n||_===0||d||S,E=a&&g,L=Rr(e,k.x,k.y,b,w,E),T=L.x,M=L.y;e.previousWheelEvent=t,e.setTransformState(b,T,M),Ce(be(e),t,l),Ce(be(e),t,v)}},bu=function(e,t){var r=e.props,l=r.onWheelStop,v=r.onZoomStop;es(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(xn(e,t.x,t.y),e.wheelAnimationTimer=null)},mu);var x=hu(e,t);x&&(es(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Ce(be(e),t,l),Ce(be(e),t,v))},vu))},An=function(e){for(var t=0,r=0,l=0;l<2;l+=1)t+=e.touches[l].clientX,r+=e.touches[l].clientY;var v=t/2,x=r/2;return{x:v,y:x}},Su=function(e,t){var r=Dn(t);e.pinchStartDistance=r,e.lastDistance=r,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var l=An(t);e.pinchLastCenterX=l.x,e.pinchLastCenterY=l.y,et(e)},xu=function(e,t){var r=e.contentComponent,l=e.pinchStartDistance,v=e.wrapperComponent,x=e.transformState.scale,C=e.setup,s=C.limitToBounds,i=C.centerZoomedOut,a=C.zoomAnimation,d=C.alignmentAnimation,o=a.disabled,p=a.size;if(!(l===null||!r)){var S=fu(t,x,r);if(!(!Number.isFinite(S.x)||!Number.isFinite(S.y))){var y=Dn(t),_=pu(e,y),n=An(t),u=n.x-(e.pinchLastCenterX||0),c=n.y-(e.pinchLastCenterY||0);if(!(_===x&&u===0&&c===0)){e.pinchLastCenterX=n.x,e.pinchLastCenterY=n.y;var h=vt(e,_),m=o||p===0||i,b=s&&m,w=Rr(e,S.x,S.y,_,h,b),k=w.x,g=w.y;e.pinchMidpoint=S,e.lastDistance=y;var E=d.sizeX,L=d.sizeY,T=ht(e,E),M=ht(e,L),P=k+u,B=g+c,F=Xt(P,B,h,s,T,M,v),W=F.x,H=F.y;e.setTransformState(_,W,H)}}}},Cu=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,xn(e,t?.x,t?.y)},Ln=function(e,t){var r=e.props.onZoomStop,l=e.setup.doubleClick.animationTime;es(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Ce(be(e),t,r)},l)},yu=function(e,t){var r=e.props,l=r.onZoomStart,v=r.onZoom,x=e.setup.doubleClick,C=x.animationTime,s=x.animationType;Ce(be(e),t,l),En(e,C,s,function(){return Ce(be(e),t,v)}),Ln(e,t)};function wu(e,t){return e==="toggle"?t===1?1:-1:e==="zoomOut"?-1:1}function Eu(e,t){var r=e.setup,l=e.doubleClickStopEventTimer,v=e.transformState,x=e.contentComponent,C=v.scale,s=e.props,i=s.onZoomStart,a=s.onZoom,d=r.doubleClick,o=d.disabled,p=d.mode,S=d.step,y=d.animationTime,_=d.animationType;if(!o&&!l){if(p==="reset")return yu(e,t);if(!x)return console.error("No ContentComponent found");var n=wu(p,e.transformState.scale),u=yn(e,n,S);if(C!==u){Ce(be(e),t,i);var c=Rn(t,x,C),h=Cs(e,u,c.x,c.y);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");Ce(be(e),t,a),ut(e,h,y,_),Ln(e,t)}}}var ku=function(e,t){var r=e.isInitialized,l=e.setup,v=e.wrapperComponent,x=l.doubleClick,C=x.disabled,s=x.excluded,i=t.target,a=v?.contains(i),d=r&&i&&a&&!C;if(!d)return!1;var o=Dr(i,s);return!o},Ru=(function(){function e(t){var r=this;this.mounted=!0,this.pinchLastCenterX=null,this.pinchLastCenterY=null,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){r.initializeWindowEvents()},this.unmount=function(){r.cleanupWindowEvents()},this.update=function(l){r.props=l,vt(r,r.transformState.scale),r.setup=li(l)},this.initializeWindowEvents=function(){var l,v,x=Wr(),C=(l=r.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,s=C?.defaultView;(v=r.wrapperComponent)===null||v===void 0||v.addEventListener("wheel",r.onWheelPanning,x),s?.addEventListener("mousedown",r.onPanningStart,x),s?.addEventListener("mousemove",r.onPanning,x),s?.addEventListener("mouseup",r.onPanningStop,x),C?.addEventListener("mouseleave",r.clearPanning,x),s?.addEventListener("keyup",r.setKeyUnPressed,x),s?.addEventListener("keydown",r.setKeyPressed,x)},this.cleanupWindowEvents=function(){var l,v,x=Wr(),C=(l=r.wrapperComponent)===null||l===void 0?void 0:l.ownerDocument,s=C?.defaultView;s?.removeEventListener("mousedown",r.onPanningStart,x),s?.removeEventListener("mousemove",r.onPanning,x),s?.removeEventListener("mouseup",r.onPanningStop,x),C?.removeEventListener("mouseleave",r.clearPanning,x),s?.removeEventListener("keyup",r.setKeyUnPressed,x),s?.removeEventListener("keydown",r.setKeyPressed,x),document.removeEventListener("mouseleave",r.clearPanning,x),et(r),(v=r.observer)===null||v===void 0||v.disconnect()},this.handleInitializeWrapperEvents=function(l){var v=Wr();l.addEventListener("wheel",r.onWheelZoom,v),l.addEventListener("dblclick",r.onDoubleClick,v),l.addEventListener("touchstart",r.onTouchPanningStart,v),l.addEventListener("touchmove",r.onTouchPanning,v),l.addEventListener("touchend",r.onTouchPanningStop,v)},this.handleInitialize=function(l,v){var x=!1,C=r.setup.centerOnInit,s=function(i,a){for(var d=0,o=i;d<o.length;d++){var p=o[d];if(p.target===a)return!0}return!1};r.applyTransformation(),r.onInitCallbacks.forEach(function(i){i(be(r))}),r.observer=new ResizeObserver(function(i){if(s(i,l)||s(i,v))if(C&&!x){var a=v.offsetWidth,d=v.offsetHeight;(a>0||d>0)&&(x=!0,r.setCenter())}else et(r),vt(r,r.transformState.scale),xs(r,0)}),r.observer.observe(l),r.observer.observe(v)},this.onWheelZoom=function(l){var v=r.setup.disabled;if(!v){var x=ou(r,l);if(x){var C=r.isPressingKeys(r.setup.wheel.activationKeys);C&&(_u(r,l),gu(r,l),bu(r,l))}}},this.onWheelPanning=function(l){var v=r.setup,x=v.disabled,C=v.wheel,s=v.panning;if(!(!r.wrapperComponent||!r.contentComponent||x||!C.wheelDisabled||s.disabled||!s.wheelPanning||l.ctrlKey)){l.preventDefault(),l.stopPropagation();var i=r.transformState,a=i.positionX,d=i.positionY,o=a-l.deltaX,p=d-l.deltaY,S=s.lockAxisX?a:o,y=s.lockAxisY?d:p,_=r.setup.alignmentAnimation,n=_.sizeX,u=_.sizeY,c=ht(r,n),h=ht(r,u);S===a&&y===d||Sn(r,S,y,c,h)}},this.onPanningStart=function(l){var v=r.setup.disabled,x=r.props.onPanningStart;if(!v){var C=ri(r,l);if(C){var s=r.isPressingKeys(r.setup.panning.activationKeys);s&&(l.button===0&&!r.setup.panning.allowLeftClickPan||l.button===1&&!r.setup.panning.allowMiddleClickPan||l.button===2&&!r.setup.panning.allowRightClickPan||(l.preventDefault(),l.stopPropagation(),et(r),ni(r,l),Ce(be(r),l,x)))}}},this.onPanning=function(l){var v=r.setup.disabled,x=r.props.onPanning;if(!v){var C=si(r);if(C){var s=r.isPressingKeys(r.setup.panning.activationKeys);s&&(l.preventDefault(),l.stopPropagation(),oi(r,l.clientX,l.clientY),Ce(be(r),l,x))}}},this.onPanningStop=function(l){var v=r.props.onPanningStop;r.isPanning&&(Vh(r),Ce(be(r),l,v))},this.onPinchStart=function(l){var v=r.setup.disabled,x=r.props,C=x.onPinchingStart,s=x.onZoomStart;if(!v){var i=uu(r,l);i&&(Su(r,l),et(r),Ce(be(r),l,C),Ce(be(r),l,s))}},this.onPinch=function(l){var v=r.setup.disabled,x=r.props,C=x.onPinching,s=x.onZoom;if(!v){var i=du(r);i&&(l.preventDefault(),l.stopPropagation(),xu(r,l),Ce(be(r),l,C),Ce(be(r),l,s))}},this.onPinchStop=function(l){var v=r.props,x=v.onPinchingStop,C=v.onZoomStop;r.pinchStartScale&&(Cu(r),Ce(be(r),l,x),Ce(be(r),l,C))},this.onTouchPanningStart=function(l){var v=r.setup.disabled,x=r.props.onPanningStart;if(!v){var C=ri(r,l);if(C){var s=r.lastTouch&&+new Date-r.lastTouch<200&&l.touches.length===1;if(!s){r.lastTouch=+new Date,et(r);var i=l.touches,a=i.length===1,d=i.length===2;a&&(et(r),ni(r,l),Ce(be(r),l,x)),d&&r.onPinchStart(l)}}}},this.onTouchPanning=function(l){var v=r.setup.disabled,x=r.props.onPanning;if(r.isPanning&&l.touches.length===1){if(v)return;var C=si(r);if(!C)return;l.preventDefault(),l.stopPropagation();var s=l.touches[0];oi(r,s.clientX,s.clientY),Ce(be(r),l,x)}else l.touches.length>1&&r.onPinch(l)},this.onTouchPanningStop=function(l){r.onPanningStop(l),r.onPinchStop(l)},this.onDoubleClick=function(l){var v=r.setup.disabled;if(!v){var x=ku(r,l);x&&Eu(r,l)}},this.clearPanning=function(l){r.isPanning&&r.onPanningStop(l)},this.setKeyPressed=function(l){r.pressedKeys[l.key]=!0},this.setKeyUnPressed=function(l){r.pressedKeys[l.key]=!1},this.isPressingKeys=function(l){return l.length?!!l.find(function(v){return r.pressedKeys[v]}):!0},this.setTransformState=function(l,v,x){var C=r.props.onTransformed;if(!Number.isNaN(l)&&!Number.isNaN(v)&&!Number.isNaN(x)){l!==r.transformState.scale&&(r.transformState.previousScale=r.transformState.scale,r.transformState.scale=l),r.transformState.positionX=v,r.transformState.positionY=x,r.applyTransformation();var s=be(r);r.onChangeCallbacks.forEach(function(i){return i(s)}),Ce(s,{scale:l,positionX:v,positionY:x},C)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(r.wrapperComponent&&r.contentComponent){var l=kn(r.transformState.scale,r.wrapperComponent,r.contentComponent);r.setTransformState(l.scale,l.positionX,l.positionY)}},this.handleTransformStyles=function(l,v,x){return r.props.customTransform?r.props.customTransform(l,v,x):iu(l,v,x)},this.applyTransformation=function(){if(!(!r.mounted||!r.contentComponent)){var l=r.transformState,v=l.scale,x=l.positionX,C=l.positionY,s=r.handleTransformStyles(x,C,v);r.contentComponent.style.transform=s}},this.getContext=function(){return be(r)},this.onChange=function(l){return r.onChangeCallbacks.has(l)||r.onChangeCallbacks.add(l),function(){r.onChangeCallbacks.delete(l)}},this.onInit=function(l){return r.onInitCallbacks.has(l)||r.onInitCallbacks.add(l),function(){r.onInitCallbacks.delete(l)}},this.init=function(l,v){r.cleanupWindowEvents(),r.wrapperComponent=l,r.contentComponent=v,vt(r,r.transformState.scale),r.handleInitializeWrapperEvents(l),r.handleInitialize(l,v),r.initializeWindowEvents(),r.isInitialized=!0;var x=be(r);Ce(x,void 0,r.props.onInit)},this.props=t,this.setup=li(this.props),this.transformState=Cn(this.props)}return e})(),Ar=J.createContext(null),Du=function(e,t){return typeof e=="function"?e(t):e},Au=J.forwardRef(function(e,t){var r=R.useRef(new Ru(e)).current,l=Du(e.children,pr(r));return R.useImperativeHandle(t,function(){return pr(r)},[r]),R.useEffect(function(){r.update(e)},[r,e]),J.createElement(Ar.Provider,{value:r},l)});J.forwardRef(function(e,t){var r=R.useRef(null),l=R.useContext(Ar);return R.useEffect(function(){return l.onChange(function(v){if(r.current){var x=0,C=0;r.current.style.transform=l.handleTransformStyles(x,C,1/v.instance.transformState.scale)}})},[l]),J.createElement("div",ct({},e,{ref:nu([r,t])}))});function Lu(e,t){t===void 0&&(t={});var r=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css",r==="top"&&l.firstChild?l.insertBefore(v,l.firstChild):l.appendChild(v),v.styleSheet?v.styleSheet.cssText=e:v.appendChild(document.createTextNode(e))}}var Tu=`.transform-component-module_wrapper__SPB86 {
|
|
31
|
+
position: relative;
|
|
32
|
+
width: -moz-fit-content;
|
|
33
|
+
width: fit-content;
|
|
34
|
+
height: -moz-fit-content;
|
|
35
|
+
height: fit-content;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
38
|
+
-webkit-user-select: none; /* Safari */
|
|
39
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
40
|
+
-moz-user-select: none; /* Firefox */
|
|
41
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
42
|
+
user-select: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
transform: translate3d(0, 0, 0);
|
|
46
|
+
}
|
|
47
|
+
.transform-component-module_content__FBWxo {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
width: -moz-fit-content;
|
|
51
|
+
width: fit-content;
|
|
52
|
+
height: -moz-fit-content;
|
|
53
|
+
height: fit-content;
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
transform-origin: 0% 0%;
|
|
57
|
+
}
|
|
58
|
+
.transform-component-module_content__FBWxo img {
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
`,ci={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};Lu(Tu);var Mu=function(e){var t=e.children,r=e.wrapperClass,l=r===void 0?"":r,v=e.contentClass,x=v===void 0?"":v,C=e.wrapperStyle,s=e.contentStyle,i=e.wrapperProps,a=i===void 0?{}:i,d=e.contentProps,o=d===void 0?{}:d,p=R.useContext(Ar),S=p.init,y=p.cleanupWindowEvents,_=R.useRef(null),n=R.useRef(null);return R.useEffect(function(){var u=_.current,c=n.current;return u!==null&&c!==null&&S&&S?.(u,c),function(){y?.()}},[]),J.createElement("div",ct({},a,{ref:_,className:"".concat(Zr.wrapperClass," ").concat(ci.wrapper," ").concat(l),style:C}),J.createElement("div",ct({},o,{ref:n,className:"".concat(Zr.contentClass," ").concat(ci.content," ").concat(x),style:s}),t))},Tn=function(){var e=R.useContext(Ar);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},ju=function(){var e=Tn();return pr(e)};function Pu(e){var t=Tn(),r=R.useState(e(Jr(t))),l=r[0],v=r[1];return R.useEffect(function(){var x=!0,C=t.onChange(function(s){x&&v(e(Jr(s.instance)))});return function(){C(),x=!1}},[e,t]),l}function Nu(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function Ou(e,t){return ot({queryKey:ce.files.tree(e||"",t),queryFn:()=>he.get("/files/tree",{params:{workingDir:e||"",path:t}}),enabled:!!e})}function Bu(e,t){return ot({queryKey:ce.files.content(e||"",t||""),queryFn:()=>he.get("/files/read",{params:{workingDir:e||"",path:t||""}}),enabled:!!e&&!!t})}function Iu(e){const t=Ae();return R.useCallback(()=>{e&&t.invalidateQueries({queryKey:["files","tree",e]})},[t,e])}function Fu(){const e=Ae();return Ue({mutationFn:t=>he.post("/files/write",t),onSuccess:(t,r)=>{const l=ce.files.content(r.workingDir,r.path),v=e.getQueryData(l);e.setQueryData(l,{content:r.content,language:v?.language||Nu(r.path)})}})}function Hu(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function zu(e,t){return e==="/"?t:`${e.slice(1)}/${t}`}const Wu=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function Uu(e){if(e.type==="directory")return null;const t=e.name.split(".").pop()?.toLowerCase();return t&&Wu.has(t)?hs:t==="ts"||t==="tsx"||t==="js"||t==="jsx"?qr:t==="json"?Do:t==="md"||t==="mdx"||t==="txt"?Ii:Po}const hi=({depth:e,active:t,onClick:r,leftIcon:l,rightIcon:v,label:x})=>f.jsxs("button",{type:"button",onClick:r,className:Ee("w-full flex items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-neutral-100",t&&"bg-neutral-100 text-neutral-900"),style:{paddingLeft:8+e*14},children:[f.jsx("span",{className:"shrink-0",children:v}),f.jsx("span",{className:"shrink-0 text-neutral-500",children:l}),f.jsx("span",{className:"truncate text-neutral-700",children:x})]}),Mn=({workingDir:e,path:t,depth:r,expanded:l,toggleDir:v,onFileSelect:x,selectedFilePath:C})=>{const{data:s,isLoading:i,isError:a}=Ou(e,t),d=R.useMemo(()=>s?.items??[],[s?.items]);return i?f.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+r*14},children:"Loading..."}):a?f.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+r*14},children:"Failed to load"}):f.jsx("div",{className:"space-y-0.5",children:d.map(o=>{if(o.type==="directory"){const n=Hu(t,o.name),u=l.has(n);return f.jsxs("div",{children:[f.jsx(hi,{depth:r,onClick:()=>v(n),rightIcon:u?f.jsx(Ct,{size:14,className:"text-neutral-400"}):f.jsx(mr,{size:14,className:"text-neutral-400"}),leftIcon:u?f.jsx(Fi,{size:14,className:"text-amber-500"}):f.jsx(Bo,{size:14,className:"text-amber-500"}),label:o.name}),u&&f.jsx(Mn,{workingDir:e,path:n,depth:r+1,expanded:l,toggleDir:v,onFileSelect:x,selectedFilePath:C})]},n)}const p=zu(t,o.name),S=Uu(o),y=C===p,_=S===hs;return f.jsx(hi,{depth:r,active:y,onClick:()=>x(p),rightIcon:f.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:S?f.jsx(S,{size:14,className:_?"text-emerald-600":"text-sky-600"}):null,label:o.name},p)})})},$u=({workingDir:e,className:t,onFileSelect:r,selectedFilePath:l,onCollapse:v})=>{const[x,C]=R.useState(()=>new Set),s=Iu(e),i=R.useCallback(a=>{C(d=>{const o=new Set(d);return o.has(a)?o.delete(a):o.add(a),o})},[]);return f.jsxs("div",{className:Ee("h-full flex flex-col",t),children:[f.jsxs("div",{className:"px-3 py-2 border-b border-neutral-200 bg-neutral-50/80 flex items-center justify-between",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"text-[11px] font-semibold text-neutral-600 uppercase tracking-wider",children:"Files"}),f.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||"No workingDir"})]}),f.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&f.jsx("button",{type:"button",onClick:s,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:"Refresh file tree",children:f.jsx(la,{size:13})}),v&&f.jsx("button",{type:"button",onClick:v,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:"Collapse file tree",children:f.jsx(Jo,{size:13})})]})]}),f.jsx("div",{className:"flex-1 overflow-auto p-2",children:e?f.jsx(Mn,{workingDir:e,path:"/",depth:0,expanded:x,toggleDir:i,onFileSelect:r,selectedFilePath:l}):f.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:"No workspace selected."})})]})},Ku=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function qu(e){const t=e.split(".").pop()?.toLowerCase();return t?Ku.has(t):!1}function Xu(e,t){const r="/api",l=new URLSearchParams({workingDir:e,path:t});if(ss()){const v=is();v&&l.set("token",v)}return`${r}/files/image?${l.toString()}`}const Yu=({filePath:e})=>{const{zoomIn:t,zoomOut:r,centerView:l}=ju(),v=Pu(C=>C.state.scale),x=Math.round(v*100);return f.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-neutral-200 bg-neutral-50/80 shrink-0",children:[f.jsx("button",{type:"button",onClick:()=>r(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom out",children:f.jsx(ma,{size:14})}),f.jsxs("button",{type:"button",onClick:()=>l(1),className:"px-1.5 py-0.5 rounded hover:bg-neutral-200 text-[11px] text-neutral-600 tabular-nums min-w-[40px] text-center transition-colors",title:"Reset zoom",children:[x,"%"]}),f.jsx("button",{type:"button",onClick:()=>t(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Zoom in",children:f.jsx(pa,{size:14})}),f.jsx("button",{type:"button",onClick:()=>l(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:"Fit to view",children:f.jsx(Vo,{size:13})}),f.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},Vu=({workingDir:e,filePath:t})=>{const[r,l]=R.useState(!1),v=Xu(e,t);return r?f.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"Failed to load image."}):f.jsx(Au,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:f.jsxs("div",{className:"h-full flex flex-col",children:[f.jsx(Yu,{filePath:t}),f.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:f.jsx(Mu,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:f.jsx("img",{src:v,alt:t,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>l(!0)})})})]})})};function Gu(e){const t=e.split("/");return t[t.length-1]||e}function Qu(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const Zu=({active:e,name:t,isDirty:r,onClick:l,onClose:v})=>f.jsxs("button",{type:"button",onClick:l,className:Ee("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px]",e?"bg-white border-neutral-200 text-neutral-900":"bg-neutral-100/60 border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100"),children:[f.jsx("span",{className:Ee("w-2 h-2 rounded-full",r?"bg-amber-500":"bg-transparent")}),f.jsx("span",{className:"truncate flex-1 text-left text-xs",children:t}),f.jsx("span",{onClick:v,className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-neutral-200 rounded transition-all shrink-0","aria-label":"Close tab",title:"Close",children:f.jsx(gr,{size:12})})]}),Ju=({workingDir:e,className:t})=>{const[r,l]=R.useState([]),[v,x]=R.useState(null),C=Fu(),[s,i]=R.useState(280),[a,d]=R.useState(!1),[o,p]=R.useState(!1),S=R.useRef(280),y=R.useCallback(()=>{d(T=>(T?i(S.current):S.current=s,!T))},[s]),_=R.useCallback(T=>{T.preventDefault(),p(!0);const M=T.clientX,P=s,B=W=>{const H=W.clientX-M,D=Math.min(480,Math.max(160,P+H));i(D)},F=()=>{p(!1),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",F)},[s]);R.useEffect(()=>{l([]),x(null)},[e]);const n=R.useMemo(()=>r.find(T=>T.path===v)||null,[r,v]),{data:u,isFetching:c,isError:h,error:m}=Bu(e,n?.isImage?null:v);R.useEffect(()=>{!v||!u||l(T=>T.map(M=>M.path!==v||M.isDirty||M.loaded?M:{...M,language:u.language||M.language,content:u.content,savedContent:u.content,isDirty:!1,loaded:!0}))},[v,u]);const b=R.useCallback(T=>{l(M=>{if(M.find(F=>F.path===T))return M;const B=qu(T);return[...M,{path:T,name:Gu(T),language:Qu(T),content:"",savedContent:"",isDirty:!1,loaded:B,isImage:B}]}),x(T)},[]),w=R.useCallback(T=>{l(M=>{const P=M.filter(B=>B.path!==T);return x(B=>B!==T?B:P.length?P[P.length-1].path:null),P})},[]),k=R.useCallback(T=>{l(M=>M.map(P=>{if(P.path!==v)return P;const B=T!==P.savedContent;return{...P,content:T,isDirty:B}}))},[v]),g=R.useCallback(async()=>{!e||!n||(await C.mutateAsync({workingDir:e,path:n.path,content:n.content}),l(T=>T.map(M=>M.path===n.path?{...M,savedContent:M.content,isDirty:!1,loaded:!0}:M)))},[e,n,C]),E=R.useRef(()=>{});R.useEffect(()=>{E.current=()=>{g().catch(()=>{})}},[g]),R.useEffect(()=>{const T=M=>{(M.metaKey||M.ctrlKey)&&M.key.toLowerCase()==="s"&&(M.preventDefault(),E.current())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]);const L=R.useCallback((T,M)=>{T.addCommand(M.KeyMod.CtrlCmd|M.KeyCode.KeyS,()=>{E.current()})},[]);return f.jsxs("div",{className:Ee("flex h-full overflow-hidden bg-white",t),style:o?{userSelect:"none",cursor:"col-resize"}:void 0,children:[f.jsx("div",{className:"border-r border-neutral-200 bg-white shrink-0 overflow-hidden relative",style:{width:a?36:s,transition:o?"none":"width 0.15s ease"},children:a?f.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:f.jsx("button",{type:"button",onClick:y,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:"Expand file tree",children:f.jsx(ta,{size:16})})}):f.jsx(f.Fragment,{children:f.jsx($u,{workingDir:e,onFileSelect:b,selectedFilePath:n?.path||null,onCollapse:y},e||"no-working-dir")})}),!a&&f.jsx("div",{onMouseDown:_,className:Ee("w-1 shrink-0 cursor-col-resize transition-colors",o?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),f.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 overflow-x-auto shrink-0",children:[r.length===0?f.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:"No open files"}):r.map(T=>f.jsx(Zu,{active:T.path===v,name:T.name,isDirty:T.isDirty,onClick:()=>x(T.path),onClose:M=>{M.stopPropagation(),w(T.path)}},T.path)),f.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[C.isPending&&f.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[f.jsx(Je,{size:14,className:"animate-spin"}),"Saving"]}),n?.isDirty&&!C.isPending&&f.jsx("span",{className:"text-[11px] text-amber-600",children:"Unsaved"})]})]}),f.jsx("div",{className:"flex-1 min-h-0 relative",children:e?n?n.isImage?f.jsx(Vu,{workingDir:e,filePath:n.path}):f.jsxs(f.Fragment,{children:[f.jsx(Sh,{path:n.path,value:n.content,language:n.language,theme:"vs-light",height:"100%",onChange:T=>k(T??""),onMount:L,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0}}),c&&!n.loaded&&f.jsx("div",{className:"absolute inset-0 bg-white/60 flex items-center justify-center",children:f.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-600",children:[f.jsx(Je,{size:14,className:"animate-spin"}),"Loading file..."]})}),h&&f.jsxs("div",{className:"absolute bottom-2 left-2 right-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1",children:["Failed to load file",m instanceof Error?`: ${m.message}`:"","."]})]}):f.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"Select a file from the tree to open."}):f.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:"No workspace selected."})})]})]})};function jn(e){return ot({queryKey:ce.git.changes(e||""),queryFn:()=>he.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e})}function Pn(e,t,r){return ot({queryKey:ce.git.diff(e||"",t||"",r),queryFn:()=>he.get("/git/diff",{params:{workingDir:e||"",path:t||"",type:r}}),enabled:!!e&&!!t})}const ui={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"},ed={M:"Modified",A:"Added",D:"Deleted",R:"Renamed"};function td(e){const t=e.split("/");return t[t.length-1]||e}function rd(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}const sd=({entry:e,selected:t,onClick:r})=>{const l=ui[e.status]||ui.M,v=ed[e.status]||e.status,x=rd(e.path);return f.jsxs("button",{type:"button",onClick:r,className:Ee("flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer group w-full text-left",t?"bg-blue-50":"hover:bg-neutral-50"),children:[f.jsx("span",{className:Ee("w-4 h-4 flex items-center justify-center text-[10px] font-bold border rounded-sm shrink-0",l),title:v,children:e.status}),f.jsx("span",{className:"text-xs text-neutral-900 truncate",children:td(e.path)}),x&&f.jsx("span",{className:"text-[10px] text-neutral-400 truncate ml-auto shrink-0",children:x})]})},di=({title:e,entries:t,type:r,selectedKey:l,onSelect:v})=>t.length===0?null:f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[f.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),f.jsx("span",{className:"text-[10px] text-neutral-400",children:t.length})]}),f.jsx("div",{className:"space-y-0.5",children:t.map(x=>{const C=`${r}:${x.path}`;return f.jsx(sd,{entry:x,selected:l===C,onClick:()=>v(x.path,r)},C)})})]}),id=({line:e,lineNum:t})=>{let r="",l="text-neutral-700";return e.startsWith("+")&&!e.startsWith("+++")?(r="bg-emerald-50",l="text-emerald-800"):e.startsWith("-")&&!e.startsWith("---")?(r="bg-red-50",l="text-red-800"):e.startsWith("@@")?(r="bg-blue-50",l="text-blue-700"):(e.startsWith("diff ")||e.startsWith("index "))&&(l="text-neutral-400"),f.jsxs("div",{className:Ee("flex",r),children:[f.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-neutral-400 select-none border-r border-neutral-100",children:t}),f.jsx("span",{className:Ee("pl-2 whitespace-pre",l),children:e})]})},nd=({workingDir:e,filePath:t,type:r})=>{const{data:l,isLoading:v,isError:x}=Pn(e,t,r);if(v)return f.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500",children:[f.jsx(Je,{size:16,className:"animate-spin mr-2"}),f.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(x)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-xs",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-xs",children:"No diff content available."});const s=C.split(`
|
|
62
|
+
`);return f.jsx("div",{className:"flex-1 overflow-auto font-mono text-xs leading-5",children:s.map((i,a)=>f.jsx(id,{line:i,lineNum:a+1},a))})},od=({workingDir:e})=>{const{data:t,isLoading:r,isError:l}=jn(e),[v,x]=R.useState(null),C=v?`${v.type}:${v.path}`:null,s=(o,p)=>{x({path:o,type:p})};if(!e)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-500 text-sm bg-white h-full",children:"No workspace selected."});if(r)return f.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-500 bg-white h-full",children:[f.jsx(Je,{size:16,className:"animate-spin mr-2"}),f.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(l)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm bg-white h-full",children:"Failed to load changes."});const i=t?.uncommitted||[],a=t?.committed||[],d=i.length+a.length;return f.jsxs("div",{className:"flex h-full bg-white",children:[f.jsxs("div",{className:"w-[260px] border-r border-neutral-200 flex flex-col shrink-0",children:[f.jsx("div",{className:"px-3 py-2.5 border-b border-neutral-100 shrink-0",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Bt,{size:14,className:"text-neutral-500"}),f.jsx("span",{className:"text-xs font-semibold text-neutral-900",children:"Changes"}),d>0&&f.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:d})]})}),f.jsx("div",{className:"flex-1 overflow-auto p-1.5",children:d===0?f.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-neutral-400",children:[f.jsx(Bt,{size:28,className:"mb-2"}),f.jsx("span",{className:"text-xs",children:"No pending changes"})]}):f.jsxs("div",{className:"space-y-2",children:[f.jsx(di,{title:"Uncommitted",entries:i,type:"uncommitted",selectedKey:C,onSelect:s}),f.jsx(di,{title:"Committed",entries:a,type:"committed",selectedKey:C,onSelect:s})]})})]}),f.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"px-3 py-2 border-b border-neutral-100 flex items-center gap-2 shrink-0",children:[f.jsx(qr,{size:14,className:"text-neutral-500"}),f.jsx("span",{className:"text-xs font-medium text-neutral-700 truncate",children:v.path}),f.jsxs("span",{className:"text-[10px] text-neutral-400",children:["(",v.type,")"]})]}),f.jsx(nd,{workingDir:e,filePath:v.path,type:v.type})]}):f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:f.jsxs("div",{className:"flex flex-col items-center gap-2",children:[f.jsx(qr,{size:28}),f.jsx("span",{className:"text-xs",children:"Select a file to view diff"})]})})})]})},ad=[{key:"changes",label:"Changes",icon:f.jsx(Bt,{size:14})},{key:"editor",label:"Editor",icon:f.jsx(Sr,{size:14})},{key:"terminal",label:"Terminal",icon:f.jsx(or,{size:14})},{key:"preview",label:"Preview",icon:f.jsx(_r,{size:14})}],ld=[{key:"editor",label:"Editor",icon:f.jsx(Sr,{size:14})},{key:"terminal",label:"Terminal",icon:f.jsx(or,{size:14})},{key:"preview",label:"Preview",icon:f.jsx(_r,{size:14})}],cd=({active:e,onClick:t,icon:r,label:l})=>f.jsxs("button",{onClick:t,className:Ee("flex items-center gap-2 px-4 py-2 text-xs font-medium transition-all rounded-t-md border-t border-x -mb-px",e?"bg-white border-neutral-200 text-neutral-900 shadow-[0_-2px_6px_rgba(0,0,0,0.02)] z-10":"bg-transparent border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-200/50"),children:[r,f.jsx("span",{children:l})]}),hd=({icon:e,title:t})=>f.jsx("div",{className:"flex-1 flex items-center justify-center bg-white",children:f.jsxs("div",{className:"flex flex-col items-center gap-2 text-neutral-400",children:[e,f.jsx("span",{className:"text-sm font-medium text-neutral-500",children:t}),f.jsx("span",{className:"text-xs",children:"Coming soon..."})]})}),Nn=J.memo(function({className:t,sessionId:r,workingDir:l,hideChanges:v}){const x=v?ld:ad,[C,s]=R.useState(v?"editor":"changes"),[i,a]=R.useState([]),d=R.useRef(void 0);return R.useEffect(()=>{l&&l!==d.current&&(d.current=l,a(o=>o.includes(l)?o:[...o,l]))},[l]),f.jsxs("div",{className:Ee("flex flex-col h-full bg-white",t),children:[f.jsx("div",{className:"flex items-center px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 shrink-0 gap-1 select-none",children:x.map(o=>f.jsx(cd,{active:C===o.key,onClick:()=>s(o.key),icon:o.icon,label:o.label},o.key))}),f.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[C==="editor"&&f.jsx(Ju,{workingDir:l}),i.map(o=>f.jsx("div",{className:"h-full absolute inset-0",style:{display:C==="terminal"&&l===o?"block":"none"},children:f.jsx(uc,{cwd:o})},o)),C==="preview"&&f.jsx(hd,{icon:f.jsx(_r,{size:32}),title:"Preview"}),C==="changes"&&f.jsx(od,{workingDir:l})]})]})});function On(e){return ot({queryKey:ce.workspaces.list(e),queryFn:()=>he.get(`/tasks/${e}/workspaces`),enabled:!!e})}function ud(e){const t=Ae();return Ue({mutationFn:r=>he.post(`/tasks/${e}/workspaces`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ce.workspaces.list(e)}),t.invalidateQueries({queryKey:ce.tasks.all})}})}function dd(){const e=Ae();return Ue({mutationFn:({id:t,commitMessage:r})=>he.post(`/workspaces/${t}/merge`,{commitMessage:r}),onSuccess:()=>{e.invalidateQueries({queryKey:ce.workspaces.all}),e.invalidateQueries({queryKey:ce.tasks.all})}})}function ys(){return Ue({mutationFn:({workspaceId:e,editorType:t})=>he.post(`/workspaces/${e}/open-editor`,{editorType:t})})}function Bn(e){return ot({queryKey:ce.workspaces.gitStatus(e),queryFn:()=>he.get(`/workspaces/${e}/git-status`),enabled:!!e})}function fd(){const e=Ae();return Ue({mutationFn:t=>he.post(`/workspaces/${t}/rebase`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(r)})},onError:(t,r)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(r)})}})}function pd(){const e=Ae();return Ue({mutationFn:t=>he.post(`/workspaces/${t}/abort-operation`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.workspaces.gitStatus(r)})}})}function In(){const e=Ae();return Ue({mutationFn:t=>he.post(`/sessions/${t}/start`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.sessions.detail(r)})}})}function Fn(){const e=Ae();return Ue({mutationFn:t=>he.post(`/sessions/${t}/stop`),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:ce.sessions.detail(r)})}})}function ws(){const e=Ae();return Ue({mutationFn:({id:t,message:r})=>he.post(`/sessions/${t}/message`,{message:r}),onSuccess:()=>{e.invalidateQueries({queryKey:ce.workspaces.all})}})}function Hn(e,t){return R.useMemo(()=>{for(let r=e.length-1;r>=0;r--){const l=e[r];if(l.tokenUsage&&typeof l.tokenUsage.totalTokens=="number"&&l.tokenUsage.totalTokens>0)return{totalTokens:l.tokenUsage.totalTokens,modelContextWindow:l.tokenUsage.modelContextWindow}}return t??null},[e,t])}const vd="/api";async function md(e){const t=new FormData;t.append("file",e);const r={};if(ss()){const v=is();v&&(r.Authorization=`Bearer ${v}`)}const l=await fetch(`${vd}/attachments/upload`,{method:"POST",body:t,headers:r});if(!l.ok){const v=await l.json().catch(()=>({}));throw new Error(v.error||`Upload failed (${l.status})`)}return l.json()}let _d=0;function zn(){const[e,t]=R.useState([]),r=R.useRef(e);r.current=e;const l=R.useCallback(async a=>{const d=a.map(o=>({tempId:`tmp-${++_d}`,file:o,progress:0,status:"uploading"}));t(o=>[...o,...d]),await Promise.allSettled(d.map(async o=>{try{const p=await md(o.file);t(S=>S.map(y=>y.tempId===o.tempId?{...y,status:"done",progress:100,attachment:p}:y))}catch(p){t(S=>S.map(y=>y.tempId===o.tempId?{...y,status:"error",error:p instanceof Error?p.message:"Upload failed"}:y))}}))},[]),v=R.useCallback(a=>{t(d=>d.filter(o=>o.tempId!==a))},[]),x=R.useCallback(()=>{t([])},[]),C=R.useCallback(()=>{const a=r.current.filter(d=>d.status==="done"&&d.attachment);return a.length===0?"":a.map(d=>{const o=d.attachment;return`${o.mimeType.startsWith("image/")?"!":""}[${o.originalName}](${o.storagePath})`}).join(`
|
|
63
|
+
`)},[]),s=e.length>0,i=e.some(a=>a.status==="uploading");return{files:e,addFiles:l,removeFile:v,clear:x,buildMarkdownLinks:C,hasFiles:s,isUploading:i}}const gd="/api";function bd(e){if(!ss())return e;const t=is();if(!t)return e;const r=e.includes("?")?"&":"?";return`${e}${r}token=${encodeURIComponent(t)}`}function Sd(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Wn({files:e,onRemove:t}){return e.length===0?null:f.jsx("div",{className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:e.map(r=>f.jsx(xd,{item:r,onRemove:t},r.tempId))})}function xd({item:e,onRemove:t}){const r=e.file.type.startsWith("image/"),l=e.status==="error",v=e.status==="uploading";return f.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${l?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[r&&e.status==="done"&&e.attachment?f.jsx("img",{src:bd(`${gd}${e.attachment.url}`),alt:e.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):f.jsx("span",{className:"flex-shrink-0",children:v?f.jsx(Je,{size:16,className:"animate-spin text-neutral-400"}):r?f.jsx(hs,{size:16,className:"text-neutral-400"}):f.jsx(Ii,{size:16,className:"text-neutral-400"})}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"truncate font-medium",children:e.file.name}),l?f.jsx("div",{className:"truncate text-red-500",children:e.error}):f.jsx("div",{className:"text-neutral-400",children:Sd(e.file.size)})]}),f.jsx("button",{onClick:()=>t(e.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:f.jsx(gr,{size:10})})]})}function Un({isOpen:e,onClose:t,taskId:r,taskTitle:l,taskDescription:v}){const[x,C]=R.useState([]),[s,i]=R.useState(""),[a,d]=R.useState(""),[o,p]=R.useState("idle"),[S,y]=R.useState(null),_=Ae(),n=ud(r),u=In();R.useEffect(()=>{e&&he.get("/demo/agents").then(b=>{C(b.agents);const w=b.agents.find(k=>k.available);w&&i(w.type)})},[e]),R.useEffect(()=>{if(e){const b=[l];v&&b.push(v),d(b.join(`
|
|
64
|
+
|
|
65
|
+
`)),p("idle"),y(null)}},[e,l,v]);const c=o!=="idle",h=async()=>{if(!(!s||!a.trim())){y(null);try{p("creating-workspace");const b=await n.mutateAsync({});p("creating-session");const w=await he.post(`/workspaces/${b.id}/sessions`,{agentType:s,prompt:a.trim()});p("starting-session"),await u.mutateAsync(w.id),await _.invalidateQueries({queryKey:ce.workspaces.list(r)}),p("idle"),t()}catch(b){p("idle"),y(b instanceof Error?b.message:"启动失败,请重试")}}},m={idle:"启动","creating-workspace":"创建工作空间...","creating-session":"创建会话...","starting-session":"启动 Agent..."};return f.jsx(br,{isOpen:e,onClose:c?()=>{}:t,title:"启动 Agent",action:f.jsxs(f.Fragment,{children:[f.jsx(it,{variant:"outline",onClick:t,disabled:c,children:"取消"}),f.jsx(it,{onClick:h,disabled:c||!s||!a.trim(),children:m[o]})]}),children:f.jsxs("div",{className:"space-y-5",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:"选择 Agent"}),f.jsxs("div",{className:"flex gap-2 flex-wrap",children:[x.length===0&&f.jsx("span",{className:"text-sm text-neutral-400",children:"加载中..."}),x.map(b=>f.jsxs(it,{variant:s===b.type?"default":"outline",size:"sm",disabled:!b.available||c,onClick:()=>i(b.type),children:[b.name,b.available&&b.version&&` (${b.version})`,!b.available&&" (不可用)"]},b.type))]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-2",children:"任务描述"}),f.jsx("textarea",{value:a,onChange:b=>d(b.target.value),rows:5,disabled:c,placeholder:"描述你想让 Agent 完成的任务...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm text-neutral-900 placeholder-neutral-400 focus:outline-none focus:ring-1 focus:ring-neutral-300 focus:border-neutral-300 resize-none disabled:opacity-50 disabled:bg-neutral-50"})]}),S&&f.jsx("div",{className:"text-sm text-red-600 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:S})]})})}const $n=({isOpen:e,onClose:t,onConfirm:r,title:l,description:v,confirmText:x="确认",cancelText:C="取消",variant:s="default",isLoading:i=!1})=>{const a=s==="danger";return f.jsx(br,{isOpen:e,onClose:t,title:l,className:"max-w-sm",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:t,disabled:i,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:C}),f.jsx("button",{onClick:r,disabled:i,className:Ee("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",a?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:i?"处理中...":x})]}),children:f.jsxs("div",{className:"flex gap-4",children:[a&&f.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:f.jsx(us,{size:20,className:"text-red-500"})}),f.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:v})]})})};function Cd({workspaceId:e,gitStatus:t,onResolve:r}){const l=pd();if(t.operation==="idle"||t.conflictedFiles.length===0)return null;const v=t.operation==="rebase"?"Rebase":"Merge";return f.jsxs("div",{className:"mx-6 mt-3 px-4 py-3 rounded-lg border border-amber-200 bg-amber-50 flex items-center gap-3",children:[f.jsx(us,{size:18,className:"text-amber-600 shrink-0"}),f.jsx("div",{className:"flex-1 min-w-0",children:f.jsxs("p",{className:"text-sm font-medium text-amber-900",children:[v," 冲突 — ",t.conflictedFiles.length," 个文件"]})}),f.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[f.jsx(it,{variant:"outline",size:"sm",onClick:()=>l.mutate(e),disabled:l.isPending,children:"中止操作"}),f.jsx(it,{size:"sm",onClick:r,children:"解决冲突"})]})]})}function yd(e,t,r,l){const v=r.map(x=>`- ${x}`).join(`
|
|
66
|
+
`);return l===Gr.REBASE?["## Rebase 冲突解决","",`在将分支 \`${e}\` rebase 到 \`${t}\` 时发生了冲突。`,"","### 冲突文件",v,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git rebase --continue` 继续 rebase 流程"].join(`
|
|
67
|
+
`):["## Merge 冲突解决","",`在将分支 \`${e}\` 合并到 \`${t}\` 时发生了冲突。`,"","### 冲突文件",v,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git commit` 完成合并"].join(`
|
|
68
|
+
`)}function wd({open:e,onOpenChange:t,workspaceId:r,conflictOp:l,conflictedFiles:v,sourceBranch:x,targetBranch:C,sessions:s}){const[i,a]=R.useState(""),d=ws(),o=ys(),p=()=>{if(!i)return;const _=yd(x,C,v,l);d.mutate({id:i,message:_},{onSuccess:()=>t(!1)})},S=()=>{o.mutate({workspaceId:r},{onSuccess:()=>t(!1)})},y=l==="REBASE"?"Rebase":"Merge";return f.jsx(br,{isOpen:e,onClose:()=>t(!1),title:`解决 ${y} 冲突`,action:f.jsxs("div",{className:"flex gap-2",children:[f.jsx(it,{variant:"outline",onClick:S,children:"在 IDE 中打开"}),f.jsx(it,{onClick:p,disabled:!i||d.isPending,children:d.isPending?"发送中...":"AI 辅助解决"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsxs("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:["冲突文件(",v.length,")"]}),f.jsx("div",{className:"max-h-40 overflow-y-auto rounded-md border border-neutral-200 bg-neutral-50",children:v.map(_=>f.jsx("div",{className:"px-3 py-1.5 text-xs font-mono text-neutral-700 border-b border-neutral-100 last:border-b-0",children:_},_))})]}),s.length>0&&f.jsxs("div",{children:[f.jsx("h4",{className:"text-sm font-medium text-neutral-700 mb-2",children:"选择 Session(AI 辅助解决)"}),f.jsxs("select",{value:i,onChange:_=>a(_.target.value),className:"w-full px-3 py-2 text-sm border border-neutral-200 rounded-md bg-white focus:outline-none focus:ring-2 focus:ring-neutral-300",children:[f.jsx("option",{value:"",children:"选择一个 Session..."}),s.map(_=>f.jsxs("option",{value:_.id,children:[_.agentType," — ",_.status]},_.id))]})]}),s.length===0&&f.jsx("p",{className:"text-sm text-neutral-500",children:"没有可用的 Session,请在 IDE 中手动解决冲突。"})]})})}function ft({children:e,variant:t}){const r={success:"bg-emerald-50 text-emerald-700 border-emerald-200",warning:"bg-amber-50 text-amber-700 border-amber-200",info:"bg-blue-50 text-blue-700 border-blue-200",neutral:"bg-neutral-50 text-neutral-600 border-neutral-200",danger:"bg-red-50 text-red-700 border-red-200"};return f.jsx("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${r[t]}`,children:e})}function Ed({gitStatus:e,branchName:t,targetBranch:r}){return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:t}),f.jsx(Ni,{size:14,className:"text-neutral-400"}),f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:r})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.hasUncommittedChanges&&f.jsxs(ft,{variant:"danger",children:[f.jsx(To,{size:12}),e.uncommittedCount," 个未提交变更"]}),e.conflictedFiles.length>0&&f.jsxs(ft,{variant:"warning",children:[f.jsx(us,{size:12}),e.conflictedFiles.length," 个冲突文件"]}),e.operation==="rebase"&&e.conflictedFiles.length===0&&f.jsxs(ft,{variant:"warning",children:[f.jsx(Je,{size:12,className:"animate-spin"}),"变基进行中"]}),e.operation==="merge"&&e.conflictedFiles.length===0&&f.jsxs(ft,{variant:"warning",children:[f.jsx(Je,{size:12,className:"animate-spin"}),"合并进行中"]}),e.ahead>0&&f.jsxs(ft,{variant:"success",children:[f.jsx(Ls,{size:12}),"领先 ",e.ahead," 个提交"]}),e.behind>0&&f.jsxs(ft,{variant:"warning",children:["落后 ",e.behind," 个提交"]}),e.operation==="idle"&&e.ahead===0&&e.behind===0&&!e.hasUncommittedChanges&&f.jsxs(ft,{variant:"neutral",children:[f.jsx(Ls,{size:12}),"已是最新"]})]}),e.hasUncommittedChanges&&f.jsx("div",{className:"px-3 py-2 rounded-md bg-amber-50 border border-amber-200 text-xs text-amber-800",children:"工作区有未提交的变更,请先让 Agent 提交或手动处理后再执行 Rebase / Merge 操作。"})]})}function kd({open:e,onOpenChange:t,workspaceId:r,branchName:l,targetBranch:v,commitMessage:x,onConflict:C}){const{data:s,isLoading:i}=Bn(r),a=fd(),d=dd(),[o,p]=R.useState(null),[S,y]=R.useState("select"),[_,n]=R.useState(""),u=s?s.conflictedFiles.length>0:!1,c=s?s.operation!=="idle":!1,h=s?.hasUncommittedChanges??!1;R.useEffect(()=>{e&&(y("select"),p(null),n(x??""))},[e,x]);const m=()=>{p(null),a.mutate(r,{onSuccess:()=>t(!1),onError:g=>{const E=g;E.status===409?(t(!1),C()):p(E.message??"变基失败")}})},b=()=>{p(null),y("confirm")},w=()=>{p(null);const g=_.trim()||void 0;d.mutate({id:r,commitMessage:g},{onSuccess:()=>t(!1),onError:E=>{const L=E;L.status===409?(t(!1),C()):p(L.message??"合并失败")}})},k=S==="confirm"?"确认合并":"Git 操作";return f.jsx(br,{isOpen:e,onClose:()=>t(!1),title:k,children:i||!s?f.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-neutral-400",children:[f.jsx(Je,{size:18,className:"animate-spin"}),f.jsx("span",{className:"text-sm",children:"加载分支状态..."})]}):S==="confirm"?f.jsx(Dd,{editableMessage:_,setEditableMessage:n,error:o,isPending:d.isPending,onConfirm:w,onBack:()=>y("select"),branchName:l,targetBranch:v}):f.jsx(Rd,{gitStatus:s,branchName:l,targetBranch:v,error:o,isDirty:h,hasConflicts:u,isOperationInProgress:c,rebasePending:a.isPending,mergePending:d.isPending,onRebase:m,onMerge:b})})}function Rd({gitStatus:e,branchName:t,targetBranch:r,error:l,isDirty:v,hasConflicts:x,isOperationInProgress:C,rebasePending:s,mergePending:i,onRebase:a,onMerge:d}){return f.jsxs("div",{className:"space-y-5",children:[f.jsx(Ed,{gitStatus:e,branchName:t,targetBranch:r}),l&&f.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:l}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("button",{onClick:a,disabled:s||x||C||v,className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-neutral-200 hover:border-neutral-300 hover:bg-neutral-50 transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[f.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-50 flex items-center justify-center shrink-0",children:f.jsx(zo,{size:16,className:"text-blue-600"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-neutral-900",children:s?"变基中...":"变基 (Rebase)"}),f.jsxs("div",{className:"text-xs text-neutral-500",children:["将当前分支变基到最新的 ",r]})]})]}),f.jsxs("button",{onClick:d,disabled:i||x||C||v||e.ahead===0,className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-neutral-200 hover:border-neutral-300 hover:bg-neutral-50 transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[f.jsx("div",{className:"w-8 h-8 rounded-md bg-emerald-50 flex items-center justify-center shrink-0",children:f.jsx(Hi,{size:16,className:"text-emerald-600"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-neutral-900",children:i?"合并中...":"合并 (Merge)"}),f.jsxs("div",{className:"text-xs text-neutral-500",children:["Squash merge 到 ",r]})]})]})]})]})}function Dd({editableMessage:e,setEditableMessage:t,error:r,isPending:l,onConfirm:v,onBack:x,branchName:C,targetBranch:s}){return f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:C}),f.jsx(Ni,{size:14,className:"text-neutral-400"}),f.jsx("span",{className:"px-2.5 py-1 rounded-md bg-neutral-100 font-mono text-xs text-neutral-700",children:s})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-xs font-medium text-neutral-600 mb-1.5",children:"提交消息"}),f.jsx("textarea",{value:e,onChange:i=>t(i.target.value),placeholder:"输入提交消息...",rows:4,className:"w-full px-3 py-2 rounded-md border border-neutral-200 text-sm font-mono text-neutral-800 placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-300 resize-none"}),!e.trim()&&f.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"留空将使用默认消息"})]}),r&&f.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:r}),f.jsxs("div",{className:"flex gap-2 justify-end",children:[f.jsx("button",{onClick:x,disabled:l,className:"px-4 py-2 rounded-md text-sm text-neutral-600 hover:bg-neutral-100 transition-colors disabled:opacity-50",children:"返回"}),f.jsx("button",{onClick:v,disabled:l,className:"flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 transition-colors disabled:opacity-50",children:l?f.jsxs(f.Fragment,{children:[f.jsx(Je,{size:14,className:"animate-spin"}),"合并中..."]}):f.jsxs(f.Fragment,{children:[f.jsx(Hi,{size:14}),"确认合并"]})})]})]})}const Ad=675,fi=320,pi=1200,Ld=f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-white text-neutral-400 select-none",children:[f.jsx("div",{className:"w-16 h-16 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-6",children:f.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-300",children:[f.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),f.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),f.jsx("h3",{className:"text-neutral-900 font-medium mb-2 text-lg",children:"Agent Tower"}),f.jsx("p",{className:"text-sm max-w-sm text-center text-neutral-500 leading-relaxed",children:"Select a task from the sidebar to view logs, monitor execution, or interact with an agent."})]}),vi=[{status:ne.Review,className:"bg-amber-50 text-amber-700 border-amber-100",hoverClass:"hover:bg-amber-100",icon:f.jsx(ns,{className:"w-3 h-3"})},{status:ne.Running,className:"bg-blue-50 text-blue-700 border-blue-100",hoverClass:"hover:bg-blue-100",icon:f.jsx(os,{className:"w-3 h-3"})},{status:ne.Pending,className:"bg-neutral-50 text-neutral-600 border-neutral-100",hoverClass:"hover:bg-neutral-100",icon:f.jsx(as,{className:"w-3 h-3"})},{status:ne.Done,className:"bg-emerald-50 text-emerald-700 border-emerald-100",hoverClass:"hover:bg-emerald-100",icon:f.jsx(ls,{className:"w-3 h-3"})},{status:ne.Cancelled,className:"bg-neutral-50 text-neutral-500 border-neutral-200",hoverClass:"hover:bg-neutral-200",icon:f.jsx(cs,{className:"w-3 h-3"})}];function Td({status:e,onChangeStatus:t}){const[r,l]=R.useState(!1),v=R.useRef(null);R.useEffect(()=>{if(!r)return;const C=s=>{v.current&&!v.current.contains(s.target)&&l(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[r]);const x=vi.find(C=>C.status===e);return f.jsxs("div",{className:"relative",ref:v,children:[f.jsxs("button",{onClick:()=>t&&l(C=>!C),className:`flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium border transition-colors ${x.className} ${t?"cursor-pointer hover:opacity-80":""}`,children:[x.icon,f.jsx("span",{children:e}),t&&f.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${r?"rotate-180":""}`,children:f.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})]}),r&&f.jsx("div",{className:"absolute right-0 top-full mt-2 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1 animate-in fade-in zoom-in-95 duration-100",children:vi.filter(C=>C.status!==e).map(C=>f.jsxs("button",{onClick:()=>{t?.(C.status),l(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${C.hoverClass}`,children:[f.jsx("span",{className:C.className.split(" ").find(s=>s.startsWith("text-")),children:C.icon}),f.jsx("span",{className:"text-neutral-700",children:C.status})]},C.status))})]})}function Md({task:e,onDeleteTask:t,isDeleting:r,onTaskStatusChange:l}){const[v,x]=R.useState(""),[C,s]=R.useState(!1),[i,a]=R.useState(!1),[d,o]=R.useState(!1),[p,S]=R.useState(!1),[y,_]=R.useState(!1),n=R.useRef(null),u=R.useRef(null),c=R.useRef(null),h=R.useRef(null),m=R.useRef(null),b=R.useRef("following"),w=R.useRef(null),[k,g]=R.useState(!0),[E,L]=R.useState(Ad),[T,M]=R.useState(!0),[P,B]=R.useState(!1),F=R.useRef(0),W=R.useRef(0),H=R.useRef(null),{data:D,isLoading:j}=On(e?.id??""),N=R.useMemo(()=>{if(!D)return null;const X=D.filter(pe=>pe.status==="ACTIVE"&&Array.isArray(pe.sessions)).flatMap(pe=>pe.sessions??[]),se=pe=>{const Me=pe.createdAt,We=pe.endedAt??pe.startedAt??Me;if(!We)return 0;const qe=Date.parse(We);return Number.isNaN(qe)?0:qe},_e=pe=>{const Me=X.filter(We=>pe.includes(We.status));return Me.length===0?null:Me.sort((We,qe)=>se(qe)-se(We))[0]??null};return _e([Le.RUNNING])??_e([Le.PENDING])??_e([Le.COMPLETED,Le.FAILED,Le.CANCELLED])},[D]),O=N?.id??"",$=N?.status===Le.RUNNING||N?.status===Le.PENDING,Y=R.useMemo(()=>{if(D){for(const X of D)if(X.status==="ACTIVE"&&X.worktreePath)return X.worktreePath;return D[0]?.worktreePath}},[D]),V=R.useMemo(()=>D?D.find(se=>se.status==="ACTIVE")?.id:void 0,[D]),{data:Q}=Bn(V??""),re=R.useMemo(()=>D?D.find(se=>se.status==="ACTIVE")?.sessions??[]:[],[D]),A=R.useMemo(()=>D?D.find(se=>se.status==="ACTIVE")?.branchName??"":"",[D]),I=R.useMemo(()=>D?D.find(se=>se.status==="ACTIVE")?.commitMessage:void 0,[D]),U=Ae();R.useEffect(()=>{if(!y)return;const X=se=>{n.current&&!n.current.contains(se.target)&&_(!1)};return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[y]);const z=ws(),Z=ys(),G=R.useCallback(()=>{V&&Z.mutate({workspaceId:V})},[V,Z]),ie=R.useCallback(()=>{!e?.id||!t||(t(e.id),a(!1))},[e?.id,t]),{isConnected:le,isLoadingSnapshot:de,logs:ve,entries:ee,attach:ke}=Di({sessionId:O,onExit:R.useCallback(()=>{U.invalidateQueries({queryKey:["workspaces"]})},[U])});R.useEffect(()=>{if(!O&&!e?.id)return;const X=pt.connect();e?.id&&X.emit(st.SUBSCRIBE,{topic:"task",id:e.id});const se=pe=>{pe.sessionId===O&&U.invalidateQueries({queryKey:["workspaces"]})},_e=pe=>{pe.taskId===e?.id&&U.invalidateQueries({queryKey:["tasks"]})};return X.on(Fe.SESSION_COMPLETED,se),X.on(Fe.TASK_UPDATED,_e),()=>{X.off(Fe.SESSION_COMPLETED,se),X.off(Fe.TASK_UPDATED,_e),e?.id&&X.emit(st.UNSUBSCRIBE,{topic:"task",id:e.id})}},[O,e?.id,U]);const{todos:Be}=Ai(ee),{files:Te,addFiles:Se,removeFile:Ie,clear:Re,buildMarkdownLinks:K,hasFiles:q,isUploading:te}=zn(),me=R.useMemo(()=>{if(!N?.tokenUsage)return;const X=N.tokenUsage;if(typeof X.totalTokens=="number")return X},[N?.tokenUsage]),oe=Hn(ve,me);R.useEffect(()=>{O&&le&&ke()},[O,le,ke]);const ye=R.useRef(e?.id);R.useEffect(()=>{ye.current!==e?.id&&(b.current="following",g(!0),w.current&&(clearTimeout(w.current),w.current=null)),ye.current=e?.id},[e?.id]);const xe=R.useCallback(()=>{b.current!=="programmatic"&&(b.current="user-scrolling")},[]),De=R.useCallback(()=>{if(b.current!=="user-scrolling")return;const X=m.current;X&&X.scrollHeight-X.scrollTop-X.clientHeight<2&&(b.current="following")},[]);R.useEffect(()=>{const X=m.current;if(X)return X.addEventListener("wheel",xe,{passive:!0}),X.addEventListener("touchmove",xe,{passive:!0}),()=>{X.removeEventListener("wheel",xe),X.removeEventListener("touchmove",xe)}},[xe]),R.useEffect(()=>{if(b.current==="following"){if(k&&ve.length>0){g(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{h.current?.scrollToBottom("instant")})});return}b.current="programmatic",h.current?.scrollToBottom("smooth"),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{b.current==="programmatic"&&(b.current="following")},300)}},[ve]);const fe=R.useRef(de);R.useEffect(()=>{const X=fe.current;fe.current=de,X&&!de&&(g(!1),ve.length>0&&(b.current="following",requestAnimationFrame(()=>{requestAnimationFrame(()=>{h.current?.scrollToBottom("instant")})})))},[de,ve.length]);const dt=Fn(),Et=R.useRef(!1),_t=R.useCallback(async()=>{if(!v.trim()&&!q||!O||Et.current||te)return;Et.current=!0;const X=K(),se=[v.trim(),X].filter(Boolean).join(`
|
|
69
|
+
|
|
70
|
+
`);x(""),Re(),u.current&&(u.current.style.height="60px"),z.mutate({id:O,message:se},{onSuccess:()=>{ke()},onSettled:()=>{Et.current=!1}})},[v,O,z,ke,q,te,K,Re]),Vt=R.useCallback(async()=>{O&&(await dt.mutateAsync(O),U.invalidateQueries({queryKey:["workspaces"]}))},[O,dt,U]),Lr=R.useCallback(X=>{const se=X.target.files;se&&se.length>0&&Se(Array.from(se)),X.target.value=""},[Se]),Gt=R.useCallback(X=>{const se=X.clipboardData.items,_e=[];for(const pe of se)if(pe.kind==="file"){const Me=pe.getAsFile();Me&&_e.push(Me)}_e.length>0&&(X.preventDefault(),Se(_e))},[Se]),[Qt,kt]=R.useState(!1),Tr=R.useCallback(X=>{X.preventDefault(),kt(!0)},[]),Pe=R.useCallback(X=>{X.preventDefault(),kt(!1)},[]),He=R.useCallback(X=>{X.preventDefault(),kt(!1);const se=X.dataTransfer.files;se.length>0&&Se(Array.from(se))},[Se]),Oe=R.useCallback(X=>{const se=X.clientX-F.current,_e=Math.max(fi,Math.min(W.current+se,pi));H.current&&(H.current.style.width=`${_e}px`),W.current=W.current},[]),Ye=R.useCallback(()=>{if(B(!1),H.current){const X=H.current.getBoundingClientRect().width;L(Math.max(fi,Math.min(Math.round(X),pi)))}document.body.style.cursor="",document.body.style.userSelect=""},[]);R.useEffect(()=>{if(P)return document.addEventListener("mousemove",Oe),document.addEventListener("mouseup",Ye),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Oe),document.removeEventListener("mouseup",Ye),document.body.style.cursor="",document.body.style.userSelect=""}},[P,Oe,Ye]);const Ke=R.useCallback(X=>{X.preventDefault(),F.current=X.clientX,W.current=E,B(!0)},[E]),ze=R.useCallback(()=>{M(X=>!X)},[]),Ve=R.useCallback(X=>{x(X.target.value);const se=X.target;se.style.height="auto";const _e=se.scrollHeight;se.style.height=`${Math.max(60,Math.min(_e,300))}px`},[]),rt=R.useMemo(()=>{const X=[];if(D&&D.length>0){const se=D.some(Me=>Me.status==="ACTIVE"),_e=D.some(Me=>Me.sessions?.some(We=>We.status===Le.RUNNING||We.status===Le.PENDING)),pe=D.some(Me=>Me.status==="ACTIVE");_e&&X.push("正在运行的 Agent 将被停止"),pe&&X.push("分支上未合并的变更将丢失"),se&&X.push("关联的工作目录(worktree)将被清理")}return X},[D]);return e?f.jsxs("div",{className:"flex-1 flex flex-col h-full bg-white relative overflow-hidden",children:[f.jsxs("div",{className:"px-6 py-4 flex items-center justify-between border-b border-neutral-100 bg-white/80 backdrop-blur-sm z-20 flex-shrink-0",children:[f.jsxs("div",{className:"flex flex-col",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[f.jsx("span",{className:`text-xs font-semibold uppercase tracking-wider ${e.projectColor}`,children:e.projectName}),f.jsx("span",{className:"text-neutral-300 text-xs",children:"/"}),f.jsx("span",{className:"text-xs text-neutral-500 font-mono",children:e.branch})]}),f.jsx("h2",{className:"text-lg font-bold text-neutral-900",children:e.title})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(Td,{status:e.status,onChangeStatus:l?X=>l(e.id,X):void 0}),V&&f.jsx("button",{onClick:()=>S(!0),className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:"Git 操作",children:f.jsx(Uo,{size:18})}),f.jsx("button",{onClick:G,disabled:!V,className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:"Open in IDE",children:f.jsx(Sr,{size:18})}),f.jsx("button",{onClick:ze,className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:"Toggle Workspace",children:T?f.jsx(sa,{size:18}):f.jsx(na,{size:18})}),t&&f.jsxs("div",{className:"relative",ref:n,children:[f.jsx("button",{onClick:()=>_(X=>!X),className:"w-8 h-8 flex items-center justify-center rounded-md text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 transition-colors",title:"More actions",children:f.jsx(Bi,{size:18})}),y&&f.jsx("div",{className:"absolute right-0 top-full mt-2 w-44 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:f.jsxs("button",{onClick:()=>{a(!0),_(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 hover:bg-red-50 transition-colors",children:[f.jsx(Pi,{size:15}),f.jsx("span",{children:"删除任务"})]})})]})]})]}),V&&Q&&f.jsx(Cd,{workspaceId:V,gitStatus:Q,onResolve:()=>o(!0)}),f.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[f.jsxs("div",{ref:H,className:`flex flex-col bg-white relative ${T?"flex-shrink-0":"flex-1"}`,style:{width:T?E:"100%"},children:[f.jsx("div",{ref:m,onScroll:De,className:"flex-1 overflow-y-auto px-6 pt-6 pb-4",children:f.jsxs("div",{className:"w-full",children:[f.jsx("div",{className:"mb-4 pb-4 border-b border-neutral-100",children:f.jsx("p",{className:"text-sm text-neutral-500 leading-relaxed",children:e.description})}),j?f.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[f.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsx("span",{className:"text-sm",children:"Loading..."})]}):O?de||ve.length===0&&k?f.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[f.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsx("span",{className:"text-sm",children:"Loading logs..."})]}):ve.length===0?f.jsx("div",{className:"text-neutral-400 text-center py-8",children:$?"Waiting for agent output...":"No logs recorded for this session."}):f.jsx(Li,{ref:h,logs:ve,scrollElementRef:m}):f.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[f.jsx("div",{className:"w-14 h-14 bg-neutral-50 rounded-2xl border border-neutral-100 flex items-center justify-center mb-5",children:f.jsx(nr,{size:24,className:"text-neutral-400 ml-0.5"})}),f.jsx("h3",{className:"text-base font-medium text-neutral-900 mb-1.5",children:"尚未启动 Agent"}),f.jsx("p",{className:"text-sm text-neutral-500 mb-6 max-w-xs",children:"选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。"}),f.jsxs(it,{onClick:()=>s(!0),children:[f.jsx(nr,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),Be.length>0&&f.jsx("div",{className:"px-6 pt-2 pb-1 bg-white flex-shrink-0 border-t border-neutral-100",children:f.jsx(Ti,{todos:Be})}),f.jsx("div",{className:"p-6 pt-2 bg-white flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:Tr,onDragLeave:Pe,onDrop:He,children:f.jsxs("div",{className:`relative bg-white rounded-xl border shadow-sm hover:shadow-md focus-within:shadow-md focus-within:border-neutral-300 transition-all duration-200 ${Qt?"border-blue-400 bg-blue-50/50 shadow-md":"border-neutral-200"}`,children:[f.jsx(Wn,{files:Te,onRemove:Ie}),f.jsx("textarea",{ref:u,value:v,onChange:Ve,onPaste:Gt,onKeyDown:X=>{X.key==="Enter"&&!X.shiftKey&&!X.repeat&&!X.nativeEvent.isComposing&&X.nativeEvent.keyCode!==229&&(X.preventDefault(),_t())},rows:1,placeholder:Qt?"Drop files here...":O&&!$?"Continue conversation...":"Message Agent...",className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-sm text-neutral-900 placeholder-neutral-400 leading-relaxed",style:{minHeight:"60px",maxHeight:"300px"}}),f.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:Lr}),f.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("button",{onClick:()=>c.current?.click(),className:"p-2 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 rounded-lg transition-colors",title:"Upload file",children:f.jsx(Mi,{size:18})}),f.jsx(an,{usage:oe})]}),f.jsx("div",{className:"flex items-center gap-2",children:$&&!v.trim()&&!q?f.jsx("button",{onClick:Vt,disabled:dt.isPending,className:"p-2 rounded-lg transition-all duration-200 bg-red-500 text-white hover:bg-red-600 shadow-md disabled:opacity-50",children:f.jsx(ji,{size:14})}):f.jsx("button",{onClick:_t,disabled:!v.trim()&&!q||te,className:`p-2 rounded-lg transition-all duration-200 ${(v.trim()||q)&&!te?"bg-neutral-900 text-white shadow-md hover:bg-black":"bg-transparent text-neutral-300 cursor-not-allowed"}`,children:f.jsx(Oi,{size:18})})})]})]})})]}),T&&f.jsx("div",{className:"w-1 cursor-col-resize hover:bg-neutral-200 active:bg-blue-400 transition-colors z-30 flex-shrink-0",onMouseDown:Ke}),T&&f.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-white",children:f.jsx(Nn,{sessionId:O||void 0,workingDir:Y})})]}),f.jsx(Un,{isOpen:C,onClose:()=>s(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),V&&f.jsx(kd,{open:p,onOpenChange:S,workspaceId:V,branchName:A,targetBranch:e.mainBranch,commitMessage:I,onConflict:()=>o(!0)}),V&&Q&&Q.conflictOp&&f.jsx(wd,{open:d,onOpenChange:o,workspaceId:V,conflictOp:Q.conflictOp,conflictedFiles:Q.conflictedFiles,sourceBranch:A,targetBranch:e.mainBranch,sessions:re}),f.jsx($n,{isOpen:i,onClose:()=>a(!1),onConfirm:ie,title:"删除任务",description:f.jsxs(f.Fragment,{children:[f.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),rt.length>0&&f.jsx("ul",{className:"mt-2 space-y-1",children:rt.map((X,se)=>f.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[f.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),f.jsx("span",{children:X})]},se))})]}),confirmText:"删除",variant:"danger",isLoading:r})]}):Ld}function jd(e){switch(e){case Qe.TODO:return ne.Pending;case Qe.IN_PROGRESS:return ne.Running;case Qe.IN_REVIEW:return ne.Review;case Qe.DONE:return ne.Done;case Qe.CANCELLED:return ne.Cancelled}}function Pd(e){switch(e){case ne.Pending:return Qe.TODO;case ne.Running:return Qe.IN_PROGRESS;case ne.Review:return Qe.IN_REVIEW;case ne.Done:return Qe.DONE;case ne.Cancelled:return Qe.CANCELLED}}function Nd(e){switch(e){case Pt.CLAUDE_CODE:return"Claude Code";case Pt.GEMINI_CLI:return"Gemini CLI";case Pt.CURSOR_AGENT:return"Cursor Agent"}}const mi=["text-indigo-600","text-emerald-600","text-rose-600","text-amber-600","text-cyan-600","text-violet-600","text-teal-600","text-pink-600"];function Od(e,t){let r=0;for(let l=0;l<e.length;l++)r=(r<<5)-r+e.charCodeAt(l)|0;return Math.abs(r)%t}function Bd(e){return{id:e.id,name:e.name,color:e.color||mi[Od(e.name,mi.length)]}}function Id(e){if(!e||e.length===0)return{agent:"—",branch:"—"};const t=e.find(v=>v.status==="ACTIVE")??e[0],r=t.branchName,l=t.sessions;if(l&&l.length>0){const v=l[l.length-1];return{agent:Nd(v.agentType),branch:r}}return{agent:"—",branch:r}}function Fd(e){const{agent:t,branch:r}=Id(e.workspaces);return{id:e.id,projectId:e.projectId,title:e.title,status:jd(e.status),agent:t,branch:r,description:e.description??""}}function Hd(e){const t={};return ot({queryKey:ce.projects.list(e),queryFn:()=>he.get("/projects",{params:t})})}function zd(){const e=Ae();return Ue({mutationFn:t=>he.post("/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:ce.projects.all})}})}function Wd(e,t){const r={};return ot({queryKey:ce.tasks.list(e,t),queryFn:()=>he.get(`/projects/${e}/tasks`,{params:r}),enabled:!!e})}function Ud(e){const t=Ae();return Ue({mutationFn:r=>he.post(`/projects/${e}/tasks`,r),onSuccess:()=>{t.invalidateQueries({queryKey:ce.tasks.list(e)}),t.invalidateQueries({queryKey:ce.tasks.stats(e)})}})}function $d(){const e=Ae();return Ue({mutationFn:({id:t,status:r})=>he.patch(`/tasks/${t}/status`,{status:r}),onSuccess:t=>{e.invalidateQueries({queryKey:ce.tasks.all}),e.invalidateQueries({queryKey:ce.tasks.detail(t.id)})}})}function Kd(){const e=Ae();return Ue({mutationFn:t=>he.delete(`/tasks/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tasks.all})}})}function qd(e){const t=Ae(),r=R.useRef(new Set);R.useEffect(()=>{if(e.length===0)return;const l=pt.connect(),v=r.current,x=new Set(e);for(const i of x)v.has(i)||l.emit(st.SUBSCRIBE,{topic:"project",id:i},a=>{a.success&&v.add(i)});for(const i of v)x.has(i)||l.emit(st.UNSUBSCRIBE,{topic:"project",id:i},()=>{v.delete(i)});const C=i=>{t.invalidateQueries({queryKey:ce.tasks.list(i.projectId)}),t.invalidateQueries({queryKey:ce.tasks.detail(i.taskId)})},s=i=>{t.invalidateQueries({queryKey:ce.tasks.list(i.projectId)}),t.removeQueries({queryKey:ce.tasks.detail(i.taskId)})};return l.on(Fe.TASK_UPDATED,C),l.on(Fe.TASK_DELETED,s),()=>{l.off(Fe.TASK_UPDATED,C),l.off(Fe.TASK_DELETED,s);for(const i of v)l.emit(st.UNSUBSCRIBE,{topic:"project",id:i});v.clear()}},[e,t])}const Kn=768;function Xd(e){const t=window.matchMedia(`(max-width: ${Kn-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function Yd(){return window.innerWidth<Kn}function Vd(){return!1}function Gd(){return R.useSyncExternalStore(Xd,Yd,Vd)}const _i={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Qd(e){const t=e.split("/");return t[t.length-1]||e}function Zd(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function Jd({workingDir:e,filePath:t,type:r}){const{data:l,isLoading:v,isError:x}=Pn(e,t,r);if(v)return f.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[f.jsx(Je,{size:14,className:"animate-spin"}),f.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(x)return f.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return f.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const s=C.split(`
|
|
71
|
+
`);return f.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:s.map((i,a)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),f.jsx("div",{className:Ee("px-3 whitespace-pre",d,o),children:i},a)})})}function ef({entry:e,type:t,workingDir:r}){const[l,v]=R.useState(!1),x=_i[e.status]||_i.M,C=Zd(e.path);return f.jsxs("div",{children:[f.jsxs("button",{onClick:()=>v(s=>!s),className:Ee("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[f.jsx("span",{className:Ee("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",x),children:e.status}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Qd(e.path)}),C&&f.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),f.jsx("span",{className:"text-neutral-400 shrink-0",children:l?f.jsx(Ct,{size:14}):f.jsx(mr,{size:14})})]}),l&&f.jsx(Jd,{workingDir:r,filePath:e.path,type:t})]})}function gi({title:e,entries:t,type:r,workingDir:l,defaultOpen:v}){const[x,C]=R.useState(v);return t.length===0?null:f.jsxs("div",{children:[f.jsxs("button",{onClick:()=>C(s=>!s),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[f.jsx("span",{className:"text-neutral-400",children:x?f.jsx(Ct,{size:14}):f.jsx(mr,{size:14})}),f.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),f.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),x&&f.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(s=>f.jsx(ef,{entry:s,type:r,workingDir:l},`${r}:${s.path}`))})]})}function tf({workingDir:e}){const{data:t,isLoading:r,isError:l}=jn(e);if(!e)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."});if(r)return f.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[f.jsx(Je,{size:16,className:"animate-spin mr-2"}),f.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(l)return f.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load changes."});const v=t?.uncommitted||[],x=t?.committed||[];return v.length+x.length===0?f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[f.jsx(Bt,{size:28,className:"mb-3"}),f.jsx("span",{className:"text-sm",children:"No pending changes"})]}):f.jsxs("div",{className:"flex-1 overflow-y-auto",children:[f.jsx(gi,{title:"Uncommitted",entries:v,type:"uncommitted",workingDir:e,defaultOpen:!0}),f.jsx(gi,{title:"Committed",entries:x,type:"committed",workingDir:e,defaultOpen:!1})]})}function rf({status:e}){const t={[ne.Running]:"bg-blue-500",[ne.Review]:"bg-amber-500",[ne.Pending]:"bg-neutral-400",[ne.Done]:"bg-emerald-500",[ne.Cancelled]:"bg-neutral-400"};return f.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t[e]}`})}const sf=[{key:"chat",label:"Chat",icon:Qo},{key:"changes",label:"Changes",icon:Bt},{key:"workspace",label:"Workspace",icon:Fi}];function nf({task:e,onBack:t,onDeleteTask:r,isDeleting:l}){const[v,x]=R.useState("chat"),[C,s]=R.useState(""),[i,a]=R.useState(!1),[d,o]=R.useState(!1),[p,S]=R.useState(!1),y=R.useRef(null),_=R.useRef(null),n=R.useRef(null),u=R.useRef(null),c=R.useRef(null),h=R.useRef("following"),m=R.useRef(null),[b,w]=R.useState(!0),k=Ae();R.useEffect(()=>{if(!p)return;const q=te=>{y.current&&!y.current.contains(te.target)&&S(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[p]);const{data:g,isLoading:E}=On(e.id),L=R.useMemo(()=>{if(!g)return null;const q=g.filter(oe=>oe.status==="ACTIVE"&&Array.isArray(oe.sessions)).flatMap(oe=>oe.sessions??[]),te=oe=>{const ye=oe.createdAt,xe=oe.endedAt??oe.startedAt??ye;if(!xe)return 0;const De=Date.parse(xe);return Number.isNaN(De)?0:De},me=oe=>{const ye=q.filter(xe=>oe.includes(xe.status));return ye.length===0?null:ye.sort((xe,De)=>te(De)-te(xe))[0]??null};return me([Le.RUNNING])??me([Le.PENDING])??me([Le.COMPLETED,Le.FAILED,Le.CANCELLED])},[g]),T=L?.id??"",M=L?.status===Le.RUNNING||L?.status===Le.PENDING,P=R.useMemo(()=>{if(g){for(const q of g)if(q.status==="ACTIVE"&&q.worktreePath)return q.worktreePath;return g[0]?.worktreePath}},[g]),B=R.useMemo(()=>{if(g)return g.find(q=>q.status==="ACTIVE")?.id},[g]),F=R.useMemo(()=>{const q=[];if(g&&g.length>0){const te=g.some(oe=>oe.status==="ACTIVE");g.some(oe=>oe.sessions?.some(ye=>ye.status===Le.RUNNING||ye.status===Le.PENDING))&&q.push("正在运行的 Agent 将被停止"),te&&(q.push("分支上未合并的变更将丢失"),q.push("关联的工作目录(worktree)将被清理"))}return q},[g]),W=ws(),H=ys(),D=Fn(),{isConnected:j,isLoadingSnapshot:N,logs:O,entries:$,attach:Y}=Di({sessionId:T,onExit:R.useCallback(()=>{k.invalidateQueries({queryKey:["workspaces"]})},[k])}),{todos:V}=Ai($),{files:Q,addFiles:re,removeFile:A,clear:I,buildMarkdownLinks:U,hasFiles:z,isUploading:Z}=zn(),G=R.useMemo(()=>{if(!L?.tokenUsage)return;const q=L.tokenUsage;if(typeof q.totalTokens=="number")return q},[L?.tokenUsage]),ie=Hn(O,G);R.useEffect(()=>{T&&j&&Y()},[T,j,Y]),R.useEffect(()=>{h.current="following",w(!0),m.current&&clearTimeout(m.current)},[e.id]);const le=R.useCallback(()=>{h.current!=="programmatic"&&(h.current="user-scrolling")},[]),de=R.useCallback(()=>{if(h.current!=="user-scrolling")return;const q=c.current;q&&q.scrollHeight-q.scrollTop-q.clientHeight<2&&(h.current="following")},[]);R.useEffect(()=>{const q=c.current;if(q)return q.addEventListener("wheel",le,{passive:!0}),q.addEventListener("touchmove",le,{passive:!0}),()=>{q.removeEventListener("wheel",le),q.removeEventListener("touchmove",le)}},[le]),R.useEffect(()=>{if(h.current==="following"){if(b&&O.length>0){w(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{u.current?.scrollToBottom("instant")})});return}h.current="programmatic",u.current?.scrollToBottom("smooth"),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{h.current==="programmatic"&&(h.current="following")},300)}},[O]);const ve=R.useRef(N);R.useEffect(()=>{const q=ve.current;ve.current=N,q&&!N&&(w(!1),O.length>0&&(h.current="following",requestAnimationFrame(()=>{requestAnimationFrame(()=>{u.current?.scrollToBottom("instant")})})))},[N,O.length]);const ee=R.useRef(!1),ke=R.useCallback(async()=>{if(!C.trim()&&!z||!T||ee.current||Z)return;ee.current=!0;const q=U(),te=[C.trim(),q].filter(Boolean).join(`
|
|
72
|
+
|
|
73
|
+
`);s(""),I(),_.current&&(_.current.style.height="40px"),W.mutate({id:T,message:te},{onSuccess:()=>Y(),onSettled:()=>{ee.current=!1}})},[C,T,W,Y,z,Z,U,I]),Be=R.useCallback(async()=>{T&&(await D.mutateAsync(T),k.invalidateQueries({queryKey:["workspaces"]}))},[T,D,k]),Te=R.useCallback(q=>{const te=q.target.files;te&&te.length>0&&re(Array.from(te)),q.target.value=""},[re]),Se=R.useCallback(q=>{const te=q.clipboardData.items,me=[];for(const oe of te)if(oe.kind==="file"){const ye=oe.getAsFile();ye&&me.push(ye)}me.length>0&&(q.preventDefault(),re(me))},[re]),Ie=R.useCallback(q=>{s(q.target.value);const te=q.target;te.style.height="auto",te.style.height=`${Math.max(40,Math.min(te.scrollHeight,140))}px`},[]),Re=R.useCallback(()=>{B&&H.mutate({workspaceId:B})},[B,H]),K=R.useRef(null);return R.useEffect(()=>{const q=window.visualViewport;if(!q)return;const te=()=>{K.current&&(K.current.style.height=`${q.height}px`,K.current.style.top=`${q.offsetTop}px`)};return q.addEventListener("resize",te),q.addEventListener("scroll",te),()=>{q.removeEventListener("resize",te),q.removeEventListener("scroll",te)}},[]),f.jsxs("div",{ref:K,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden",children:[f.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[f.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[f.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:f.jsx(lo,{size:18})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),f.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[f.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),f.jsx("span",{className:"text-neutral-300",children:"/"}),f.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),f.jsx(rf,{status:e.status}),f.jsx("button",{onClick:Re,disabled:!B,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:f.jsx(Sr,{size:16})}),r&&f.jsxs("div",{className:"relative",ref:y,children:[f.jsx("button",{onClick:()=>S(q=>!q),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:f.jsx(Bi,{size:16})}),p&&f.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:f.jsxs("button",{onClick:()=>{o(!0),S(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[f.jsx(Pi,{size:15}),f.jsx("span",{children:"删除任务"})]})})]})]}),f.jsx("div",{className:"flex border-t border-neutral-100",children:sf.map(({key:q,label:te,icon:me})=>f.jsxs("button",{onClick:()=>x(q),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${v===q?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[f.jsx(me,{size:13}),f.jsx("span",{children:te})]},q))})]}),v==="chat"&&f.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[f.jsxs("div",{ref:c,onScroll:de,className:"flex-1 overflow-y-auto overflow-x-hidden px-3 pt-3 pb-2",children:[f.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:f.jsx("p",{className:"text-[13px] text-neutral-500 leading-relaxed",children:e.description})}),E?f.jsx(bi,{label:"Loading..."}):T?N||O.length===0&&b?f.jsx(bi,{label:"Loading logs..."}):O.length===0?f.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:M?"Waiting for agent output...":"No logs recorded."}):f.jsx(Li,{ref:u,logs:O,scrollElementRef:c}):f.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[f.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:f.jsx(nr,{size:20,className:"text-neutral-400 ml-0.5"})}),f.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),f.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),f.jsxs(it,{onClick:()=>a(!0),children:[f.jsx(nr,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]}),V.length>0&&f.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:f.jsx(Ti,{todos:V,compact:!0})}),T&&f.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:f.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[f.jsx(Wn,{files:Q,onRemove:A}),f.jsx("textarea",{ref:_,value:C,onChange:Ie,onPaste:Se,onKeyDown:q=>{q.key==="Enter"&&!q.shiftKey&&!q.repeat&&!q.nativeEvent.isComposing&&q.nativeEvent.keyCode!==229&&(q.preventDefault(),ke())},rows:1,placeholder:M?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),f.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:Te}),f.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[f.jsxs("div",{className:"flex items-center gap-0.5",children:[f.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:f.jsx(Mi,{size:15})}),f.jsx(an,{usage:ie})]}),M&&!C.trim()&&!z?f.jsx("button",{onClick:Be,disabled:D.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:f.jsx(ji,{size:12})}):f.jsx("button",{onClick:ke,disabled:!C.trim()&&!z||Z,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||z)&&!Z?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:f.jsx(Oi,{size:15})})]})]})})]}),v==="changes"&&f.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:f.jsx(tf,{workingDir:P})}),v==="workspace"&&f.jsx("div",{className:"flex-1 overflow-hidden",children:f.jsx(Nn,{sessionId:T||void 0,workingDir:P,className:"h-full",hideChanges:!0})}),f.jsx(Un,{isOpen:i,onClose:()=>a(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),f.jsx($n,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{r?.(e.id),o(!1)},title:"删除任务",description:f.jsxs(f.Fragment,{children:[f.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),F.length>0&&f.jsx("ul",{className:"mt-2 space-y-1",children:F.map((q,te)=>f.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[f.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),f.jsx("span",{children:q})]},te))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function bi({label:e}){return f.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[f.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),f.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),f.jsx("span",{className:"text-sm",children:e})]})}var of=Object.defineProperty,vr=Object.getOwnPropertySymbols,qn=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable,Si=(e,t,r)=>t in e?of(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ts=(e,t)=>{for(var r in t||(t={}))qn.call(t,r)&&Si(e,r,t[r]);if(vr)for(var r of vr(t))Xn.call(t,r)&&Si(e,r,t[r]);return e},rs=(e,t)=>{var r={};for(var l in e)qn.call(e,l)&&t.indexOf(l)<0&&(r[l]=e[l]);if(e!=null&&vr)for(var l of vr(e))t.indexOf(l)<0&&Xn.call(e,l)&&(r[l]=e[l]);return r};var mt;(e=>{const t=class ae{constructor(i,a,d,o){if(this.version=i,this.errorCorrectionLevel=a,this.modules=[],this.isFunction=[],i<ae.MIN_VERSION||i>ae.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let y=0;y<this.size;y++)p.push(!1);for(let y=0;y<this.size;y++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const S=this.addEccAndInterleave(d);if(this.drawCodewords(S),o==-1){let y=1e9;for(let _=0;_<8;_++){this.applyMask(_),this.drawFormatBits(_);const n=this.getPenaltyScore();n<y&&(o=_,y=n),this.applyMask(_)}}v(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,a){const d=e.QrSegment.makeSegments(i);return ae.encodeSegments(d,a)}static encodeBinary(i,a){const d=e.QrSegment.makeBytes(i);return ae.encodeSegments([d],a)}static encodeSegments(i,a,d=1,o=40,p=-1,S=!0){if(!(ae.MIN_VERSION<=d&&d<=o&&o<=ae.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let y,_;for(y=d;;y++){const h=ae.getNumDataCodewords(y,a)*8,m=C.getTotalBits(i,y);if(m<=h){_=m;break}if(y>=o)throw new RangeError("Data too long")}for(const h of[ae.Ecc.MEDIUM,ae.Ecc.QUARTILE,ae.Ecc.HIGH])S&&_<=ae.getNumDataCodewords(y,h)*8&&(a=h);let n=[];for(const h of i){r(h.mode.modeBits,4,n),r(h.numChars,h.mode.numCharCountBits(y),n);for(const m of h.getData())n.push(m)}v(n.length==_);const u=ae.getNumDataCodewords(y,a)*8;v(n.length<=u),r(0,Math.min(4,u-n.length),n),r(0,(8-n.length%8)%8,n),v(n.length%8==0);for(let h=236;n.length<u;h^=253)r(h,8,n);let c=[];for(;c.length*8<n.length;)c.push(0);return n.forEach((h,m)=>c[m>>>3]|=h<<7-(m&7)),new ae(y,a,c,p)}getModule(i,a){return 0<=i&&i<this.size&&0<=a&&a<this.size&&this.modules[a][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),a=i.length;for(let d=0;d<a;d++)for(let o=0;o<a;o++)d==0&&o==0||d==0&&o==a-1||d==a-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const a=this.errorCorrectionLevel.formatBits<<3|i;let d=a;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(a<<10|d)^21522;v(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const a=this.version<<12|i;v(a>>>18==0);for(let d=0;d<18;d++){const o=l(a,d),p=this.size-11+d%3,S=Math.floor(d/3);this.setFunctionModule(p,S,o),this.setFunctionModule(S,p,o)}}drawFinderPattern(i,a){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),S=i+o,y=a+d;0<=S&&S<this.size&&0<=y&&y<this.size&&this.setFunctionModule(S,y,p!=2&&p!=4)}}drawAlignmentPattern(i,a){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,a+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,a,d){this.modules[a][i]=d,this.isFunction[a][i]=!0}addEccAndInterleave(i){const a=this.version,d=this.errorCorrectionLevel;if(i.length!=ae.getNumDataCodewords(a,d))throw new RangeError("Invalid argument");const o=ae.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][a],p=ae.ECC_CODEWORDS_PER_BLOCK[d.ordinal][a],S=Math.floor(ae.getNumRawDataModules(a)/8),y=o-S%o,_=Math.floor(S/o);let n=[];const u=ae.reedSolomonComputeDivisor(p);for(let h=0,m=0;h<o;h++){let b=i.slice(m,m+_-p+(h<y?0:1));m+=b.length;const w=ae.reedSolomonComputeRemainder(b,u);h<y&&b.push(0),n.push(b.concat(w))}let c=[];for(let h=0;h<n[0].length;h++)n.forEach((m,b)=>{(h!=_-p||b>=y)&&c.push(m[h])});return v(c.length==S),c}drawCodewords(i){if(i.length!=Math.floor(ae.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const S=d-p,_=(d+1&2)==0?this.size-1-o:o;!this.isFunction[_][S]&&a<i.length*8&&(this.modules[_][S]=l(i[a>>>3],7-(a&7)),a++)}}v(a==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+a)%2==0;break;case 1:o=a%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+a)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(a/2))%2==0;break;case 5:o=d*a%2+d*a%3==0;break;case 6:o=(d*a%2+d*a%3)%2==0;break;case 7:o=((d+a)%2+d*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][d]&&o&&(this.modules[a][d]=!this.modules[a][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let S=!1,y=0,_=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==S?(y++,y==5?i+=ae.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,_),S||(i+=this.finderPenaltyCountPatterns(_)*ae.PENALTY_N3),S=this.modules[p][n],y=1);i+=this.finderPenaltyTerminateAndCount(S,y,_)*ae.PENALTY_N3}for(let p=0;p<this.size;p++){let S=!1,y=0,_=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==S?(y++,y==5?i+=ae.PENALTY_N1:y>5&&i++):(this.finderPenaltyAddHistory(y,_),S||(i+=this.finderPenaltyCountPatterns(_)*ae.PENALTY_N3),S=this.modules[n][p],y=1);i+=this.finderPenaltyTerminateAndCount(S,y,_)*ae.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let S=0;S<this.size-1;S++){const y=this.modules[p][S];y==this.modules[p][S+1]&&y==this.modules[p+1][S]&&y==this.modules[p+1][S+1]&&(i+=ae.PENALTY_N2)}let a=0;for(const p of this.modules)a=p.reduce((S,y)=>S+(y?1:0),a);const d=this.size*this.size,o=Math.ceil(Math.abs(a*20-d*10)/d)-1;return v(0<=o&&o<=9),i+=o*ae.PENALTY_N4,v(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,a=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let d=[6];for(let o=this.size-7;d.length<i;o-=a)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<ae.MIN_VERSION||i>ae.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;a-=(25*d-10)*d-55,i>=7&&(a-=36)}return v(208<=a&&a<=29648),a}static getNumDataCodewords(i,a){return Math.floor(ae.getNumRawDataModules(i)/8)-ae.ECC_CODEWORDS_PER_BLOCK[a.ordinal][i]*ae.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let a=[];for(let o=0;o<i-1;o++)a.push(0);a.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<a.length;p++)a[p]=ae.reedSolomonMultiply(a[p],d),p+1<a.length&&(a[p]^=a[p+1]);d=ae.reedSolomonMultiply(d,2)}return a}static reedSolomonComputeRemainder(i,a){let d=a.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),a.forEach((S,y)=>d[y]^=ae.reedSolomonMultiply(S,p))}return d}static reedSolomonMultiply(i,a){if(i>>>8||a>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(a>>>o&1)*i;return v(d>>>8==0),d}finderPenaltyCountPatterns(i){const a=i[1];v(a<=this.size*3);const d=a>0&&i[2]==a&&i[3]==a*3&&i[4]==a&&i[5]==a;return(d&&i[0]>=a*4&&i[6]>=a?1:0)+(d&&i[6]>=a*4&&i[0]>=a?1:0)}finderPenaltyTerminateAndCount(i,a,d){return i&&(this.finderPenaltyAddHistory(a,d),a=0),a+=this.size,this.finderPenaltyAddHistory(a,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,a){a[0]==0&&(i+=this.size),a.pop(),a.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function r(s,i,a){if(i<0||i>31||s>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)a.push(s>>>d&1)}function l(s,i){return(s>>>i&1)!=0}function v(s){if(!s)throw new Error("Assertion error")}const x=class we{constructor(i,a,d){if(this.mode=i,this.numChars=a,this.bitData=d,a<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let a=[];for(const d of i)r(d,8,a);return new we(we.Mode.BYTE,i.length,a)}static makeNumeric(i){if(!we.isNumeric(i))throw new RangeError("String contains non-numeric characters");let a=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);r(parseInt(i.substring(d,d+o),10),o*3+1,a),d+=o}return new we(we.Mode.NUMERIC,i.length,a)}static makeAlphanumeric(i){if(!we.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],d;for(d=0;d+2<=i.length;d+=2){let o=we.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=we.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),r(o,11,a)}return d<i.length&&r(we.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,a),new we(we.Mode.ALPHANUMERIC,i.length,a)}static makeSegments(i){return i==""?[]:we.isNumeric(i)?[we.makeNumeric(i)]:we.isAlphanumeric(i)?[we.makeAlphanumeric(i)]:[we.makeBytes(we.toUtf8ByteArray(i))]}static makeEci(i){let a=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)r(i,8,a);else if(i<16384)r(2,2,a),r(i,14,a);else if(i<1e6)r(6,3,a),r(i,21,a);else throw new RangeError("ECI assignment value out of range");return new we(we.Mode.ECI,0,a)}static isNumeric(i){return we.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return we.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,a){let d=0;for(const o of i){const p=o.mode.numCharCountBits(a);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let a=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?a.push(i.charCodeAt(d)):(a.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return a}};x.NUMERIC_REGEX=/^[0-9]*$/,x.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,x.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=x;e.QrSegment=x})(mt||(mt={}));(e=>{(t=>{const r=class{constructor(v,x){this.ordinal=v,this.formatBits=x}};r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),t.Ecc=r})(e.QrCode||(e.QrCode={}))})(mt||(mt={}));(e=>{(t=>{const r=class{constructor(v,x){this.modeBits=v,this.numBitsCharCount=x}numCharCountBits(v){return this.numBitsCharCount[Math.floor((v+7)/17)]}};r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),t.Mode=r})(e.QrSegment||(e.QrSegment={}))})(mt||(mt={}));var St=mt;var af={L:St.QrCode.Ecc.LOW,M:St.QrCode.Ecc.MEDIUM,Q:St.QrCode.Ecc.QUARTILE,H:St.QrCode.Ecc.HIGH},Yn=128,Vn="L",Gn="#FFFFFF",Qn="#000000",Zn=!1,Jn=1,lf=4,cf=0,hf=.1;function eo(e,t=0){const r=[];return e.forEach(function(l,v){let x=null;l.forEach(function(C,s){if(!C&&x!==null){r.push(`M${x+t} ${v+t}h${s-x}v1H${x+t}z`),x=null;return}if(s===l.length-1){if(!C)return;x===null?r.push(`M${s+t},${v+t} h1v1H${s+t}z`):r.push(`M${x+t},${v+t} h${s+1-x}v1H${x+t}z`);return}C&&x===null&&(x=s)})}),r.join("")}function to(e,t){return e.slice().map((r,l)=>l<t.y||l>=t.y+t.h?r:r.map((v,x)=>x<t.x||x>=t.x+t.w?v:!1))}function uf(e,t,r,l){if(l==null)return null;const v=e.length+r*2,x=Math.floor(t*hf),C=v/t,s=(l.width||x)*C,i=(l.height||x)*C,a=l.x==null?e.length/2-s/2:l.x*C,d=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let y=Math.floor(a),_=Math.floor(d),n=Math.ceil(s+a-y),u=Math.ceil(i+d-_);p={x:y,y:_,w:n,h:u}}const S=l.crossOrigin;return{x:a,y:d,h:i,w:s,excavation:p,opacity:o,crossOrigin:S}}function df(e,t){return t!=null?Math.max(Math.floor(t),0):e?lf:cf}function ro({value:e,level:t,minVersion:r,includeMargin:l,marginSize:v,imageSettings:x,size:C,boostLevel:s}){let i=J.useMemo(()=>{const y=(Array.isArray(e)?e:[e]).reduce((_,n)=>(_.push(...St.QrSegment.makeSegments(n)),_),[]);return St.QrCode.encodeSegments(y,af[t],r,void 0,void 0,s)},[e,t,r,s]);const{cells:a,margin:d,numCells:o,calculatedImageSettings:p}=J.useMemo(()=>{let S=i.getModules();const y=df(l,v),_=S.length+y*2,n=uf(S,C,y,x);return{cells:S,margin:y,numCells:_,calculatedImageSettings:n}},[i,C,x,l,v]);return{qrcode:i,margin:d,cells:a,numCells:o,calculatedImageSettings:p}}var ff=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),pf=J.forwardRef(function(t,r){const l=t,{value:v,size:x=Yn,level:C=Vn,bgColor:s=Gn,fgColor:i=Qn,includeMargin:a=Zn,minVersion:d=Jn,boostLevel:o,marginSize:p,imageSettings:S}=l,_=rs(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=_,u=rs(_,["style"]),c=S?.src,h=J.useRef(null),m=J.useRef(null),b=J.useCallback(B=>{h.current=B,typeof r=="function"?r(B):r&&(r.current=B)},[r]),[w,k]=J.useState(!1),{margin:g,cells:E,numCells:L,calculatedImageSettings:T}=ro({value:v,level:C,minVersion:d,boostLevel:o,includeMargin:a,marginSize:p,imageSettings:S,size:x});J.useEffect(()=>{if(h.current!=null){const B=h.current,F=B.getContext("2d");if(!F)return;let W=E;const H=m.current,D=T!=null&&H!==null&&H.complete&&H.naturalHeight!==0&&H.naturalWidth!==0;D&&T.excavation!=null&&(W=to(E,T.excavation));const j=window.devicePixelRatio||1;B.height=B.width=x*j;const N=x/L*j;F.scale(N,N),F.fillStyle=s,F.fillRect(0,0,L,L),F.fillStyle=i,ff?F.fill(new Path2D(eo(W,g))):E.forEach(function(O,$){O.forEach(function(Y,V){Y&&F.fillRect(V+g,$+g,1,1)})}),T&&(F.globalAlpha=T.opacity),D&&F.drawImage(H,T.x+g,T.y+g,T.w,T.h)}}),J.useEffect(()=>{k(!1)},[c]);const M=ts({height:x,width:x},n);let P=null;return c!=null&&(P=J.createElement("img",{src:c,key:c,style:{display:"none"},onLoad:()=>{k(!0)},ref:m,crossOrigin:T?.crossOrigin})),J.createElement(J.Fragment,null,J.createElement("canvas",ts({style:M,height:x,width:x,ref:b,role:"img"},u)),P)});pf.displayName="QRCodeCanvas";var so=J.forwardRef(function(t,r){const l=t,{value:v,size:x=Yn,level:C=Vn,bgColor:s=Gn,fgColor:i=Qn,includeMargin:a=Zn,minVersion:d=Jn,boostLevel:o,title:p,marginSize:S,imageSettings:y}=l,_=rs(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:u,numCells:c,calculatedImageSettings:h}=ro({value:v,level:C,minVersion:d,boostLevel:o,includeMargin:a,marginSize:S,imageSettings:y,size:x});let m=u,b=null;y!=null&&h!=null&&(h.excavation!=null&&(m=to(u,h.excavation)),b=J.createElement("image",{href:y.src,height:h.h,width:h.w,x:h.x+n,y:h.y+n,preserveAspectRatio:"none",opacity:h.opacity,crossOrigin:h.crossOrigin}));const w=eo(m,n);return J.createElement("svg",ts({height:x,width:x,viewBox:`0 0 ${c} ${c}`,ref:r,role:"img"},_),!!p&&J.createElement("title",null,p),J.createElement("path",{fill:s,d:`M0,0 h${c}v${c}H0z`,shapeRendering:"crispEdges"}),J.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),b)});so.displayName="QRCodeSVG";function vf(){return ot({queryKey:ce.tunnel.status,queryFn:()=>he.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function mf(){const e=Ae();return Ue({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return he.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function _f(){const e=Ae();return Ue({mutationFn:()=>he.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:ce.tunnel.status})}})}function xi(){const{data:e}=vf(),t=mf(),r=_f(),[l,v]=R.useState(!1),[x,C]=R.useState(null),s=R.useRef(null),[i,a]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,S=t.isPending,y=e?.shareableUrl,_=e?.token;R.useEffect(()=>{if(l&&s.current){const m=s.current.getBoundingClientRect();a({top:m.bottom+8,right:window.innerWidth-m.right})}},[l]);const n=R.useCallback(()=>{p?v(!0):t.mutate(void 0,{onSuccess:()=>v(!0)})},[p,t]),u=R.useCallback(()=>{y&&(navigator.clipboard.writeText(y),C("url"),setTimeout(()=>C(null),2e3))},[y]),c=R.useCallback(()=>{_&&(navigator.clipboard.writeText(_),C("token"),setTimeout(()=>C(null),2e3))},[_]),h=R.useCallback(()=>{r.mutate(),v(!1),o(!1)},[r]);return f.jsxs("div",{className:"relative",children:[f.jsx("button",{ref:s,onClick:n,disabled:S,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:S?f.jsx(Je,{size:16,className:"animate-spin"}):f.jsx(_r,{size:16})}),p&&!S&&f.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&>.createPortal(f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>v(!1)}),f.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.right},children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),f.jsx("button",{onClick:()=>v(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:f.jsx(gr,{size:14})})]}),_&&f.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[f.jsx(ha,{size:12}),f.jsx("span",{children:"Token protected"})]}),y&&f.jsx("div",{className:"flex justify-center py-3",children:f.jsx(so,{value:y,size:160})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{readOnly:!0,value:y??e?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:m=>m.target.select()}),f.jsx("button",{onClick:u,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:x==="url"?f.jsx(Ot,{size:14,className:"text-emerald-500"}):f.jsx(Ts,{size:14})})]}),_&&f.jsxs("div",{className:"mt-2",children:[f.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&f.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[f.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:_}),f.jsx("button",{onClick:c,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:x==="token"?f.jsx(Ot,{size:14,className:"text-emerald-500"}):f.jsx(Ts,{size:14})})]})]}),f.jsx("button",{onClick:h,disabled:r.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:r.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}function sr({value:e,onChange:t,options:r,placeholder:l="Select...",disabled:v=!1,className:x}){const[C,s]=R.useState(!1),i=R.useRef(null),a=r.find(o=>o.value===e);R.useEffect(()=>{if(!C)return;const o=p=>{i.current&&!i.current.contains(p.target)&&s(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[C]);const d=R.useCallback(o=>{o.key==="Escape"&&s(!1)},[]);return f.jsxs("div",{ref:i,className:Ee("relative",x),onKeyDown:d,children:[f.jsxs("button",{type:"button",disabled:v,onClick:()=>s(o=>!o),className:Ee("flex items-center justify-between w-full h-9 px-3 border rounded-lg text-sm transition-colors","bg-white border-neutral-200 hover:border-neutral-300","focus:outline-none focus:border-neutral-400","disabled:opacity-50 disabled:cursor-not-allowed",C&&"border-neutral-400",!a&&"text-neutral-400"),children:[f.jsx("span",{className:"truncate",children:a?a.label:l}),f.jsx(Ct,{size:14,className:Ee("ml-2 shrink-0 text-neutral-400 transition-transform duration-150",C&&"rotate-180")})]}),C&&f.jsx("div",{className:"absolute z-50 mt-1 w-full min-w-[160px] bg-white border border-neutral-200 rounded-lg shadow-lg shadow-neutral-200/50 py-1 max-h-[200px] overflow-y-auto",children:r.length===0?f.jsx("div",{className:"px-3 py-2 text-sm text-neutral-400",children:"No options"}):r.map(o=>f.jsxs("button",{type:"button",disabled:o.disabled,onClick:()=>{t(o.value),s(!1)},className:Ee("flex items-center w-full px-3 py-1.5 text-sm text-left transition-colors","hover:bg-neutral-50",o.value===e?"text-neutral-900 font-medium":"text-neutral-600",o.disabled&&"opacity-40 cursor-not-allowed"),children:[f.jsx(Ot,{size:14,className:Ee("mr-2 shrink-0",o.value===e?"opacity-100":"opacity-0")}),f.jsx("span",{className:"truncate",children:o.label})]},o.value))})]})}const Ci={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},At=R.lazy(()=>ki(()=>import("./modal-BoX2RXaV.js").then(e=>e.m),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Modal}))),Ur=R.lazy(()=>ki(()=>import("./folder-picker-BP3x3phB.js"),__vite__mapDeps([4,1,2,3,5,6,7,8,9,0])).then(e=>({default:e.FolderPicker}))),yi=f.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[f.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),f.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),f.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),wi=f.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),gf=260,bf=600,Ei=400;function Sf(){const[e,t]=R.useState(null),[r,l]=R.useState(null),[v,x]=R.useState(Ei),[C,s]=R.useState(!1),[i,a]=R.useState(!1),[d,o]=R.useState(""),[p,S]=R.useState(""),[y,_]=R.useState(""),[n,u]=R.useState(""),[c,h]=R.useState(""),[m,b]=R.useState(""),[w,k]=R.useState([]),[g,E]=R.useState("idle"),L=R.useRef(!1),T=R.useRef(0),M=R.useRef(Ei),P=R.useRef(null),B=Ae(),{data:F,isLoading:W}=Hd(),H=F?.data??[],D=R.useMemo(()=>H.map(Bd),[H]),j=R.useMemo(()=>H.map(K=>K.id),[H]);qd(j);const{data:N,isLoading:O}=Wd(r??""),$=So({queries:r?[]:H.map(K=>({queryKey:ce.tasks.list(K.id),queryFn:()=>he.get(`/projects/${K.id}/tasks`,{params:{limit:"100"}})}))}),Y=!r&&$.some(K=>K.isLoading),V=R.useMemo(()=>{if(r)return N?.data??[];const K=[];for(const q of $)q.data?.data&&K.push(...q.data.data);return K},[r,N,$]),Q=R.useMemo(()=>V.map(Fd),[V]),re=R.useMemo(()=>new Set,[]),A=R.useMemo(()=>{if(!e)return null;const K=Q.find(te=>te.id===e);if(!K)return null;const q=H.find(te=>te.id===K.projectId);return{id:K.id,projectName:q?.name??"Unknown",projectColor:q?.color??"text-neutral-500",title:K.title,status:K.status,branch:K.branch,mainBranch:q?.mainBranch??"main",description:K.description}},[e,Q,H]),I=zd(),U=Ud(c),z=Kd(),Z=$d(),G=R.useCallback(K=>{z.mutate(K,{onSuccess:()=>{e===K&&t(null),B.invalidateQueries({queryKey:ce.tasks.all})}})},[z,e,B]),ie=R.useCallback((K,q)=>{Z.mutate({id:K,status:Pd(q)},{onError:()=>{co.error("状态变更失败,该操作不被允许")}})},[Z]),le=R.useCallback(K=>{K.preventDefault(),L.current=!0,T.current=K.clientX,M.current=v,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[v]);R.useEffect(()=>{const K=te=>{if(!L.current)return;const me=te.clientX-T.current,oe=Math.max(gf,Math.min(bf,M.current+me));x(oe)},q=()=>{L.current&&(L.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",q),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",q)}},[]);const de=R.useCallback(()=>{s(!0)},[]),ve=R.useCallback(()=>{h(r??H[0]?.id??""),b(""),E("idle"),a(!0),he.get("/demo/agents").then(K=>{k(K.agents);const q=K.agents.find(te=>te.available);q&&b(q.type)})},[r,H]),ee=R.useCallback(()=>{s(!1),o(""),S("")},[]),ke=R.useCallback(()=>{g==="idle"&&(a(!1),_(""),u(""),h(""),b(""),E("idle"))},[g]),Be=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await I.mutateAsync({name:d.trim(),repoPath:p.trim()}),ee()}catch{}},[d,p,I,ee]),Te=In(),Se=R.useCallback(async()=>{if(!(!y.trim()||!c))try{E("creating-task");const K=await U.mutateAsync({title:y.trim(),description:n.trim()||void 0});if(m){const q=[y.trim(),n.trim()].filter(Boolean).join(`
|
|
74
|
+
|
|
75
|
+
`);E("creating-workspace");const te=await he.post(`/tasks/${K.id}/workspaces`,{});E("creating-session");const me=await he.post(`/workspaces/${te.id}/sessions`,{agentType:m,prompt:q});E("starting-session"),await Te.mutateAsync(me.id),await B.invalidateQueries({queryKey:ce.workspaces.list(K.id)})}t(K.id),E("idle"),a(!1),_(""),u(""),h(""),b("")}catch{E("idle")}},[y,n,c,m,U,Te,B]),Ie=W||O||Y;return Gd()?e&&A?f.jsxs(f.Fragment,{children:[f.jsx(nf,{task:A,onBack:()=>t(null),onDeleteTask:G,isDeleting:z.isPending}),f.jsx(R.Suspense,{fallback:null,children:f.jsx(At,{isOpen:C,onClose:ee,title:"Create New Project",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ee,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),f.jsx("button",{onClick:Be,disabled:!d.trim()||!p.trim()||I.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!I.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:I.isPending?"Creating...":"Create"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),f.jsx("input",{type:"text",value:d,onChange:K=>o(K.target.value),placeholder:"e.g., Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),f.jsx(Ur,{value:p,onChange:S})]})]})})})]}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex flex-col h-dvh bg-neutral-50 overflow-hidden text-sm",children:[f.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between shrink-0 z-10",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[yi,wi]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(xi,{}),f.jsx(Es,{to:"/settings",className:"p-1.5 text-neutral-400 active:text-neutral-900 rounded-md",children:f.jsx(Ds,{size:16})})]})]}),Ie&&Q.length===0?f.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-neutral-400",children:"Loading..."}):f.jsx(Ks,{tasks:Q,projects:D,selectedTaskId:null,onSelectTask:t,filterProjectId:r,setFilterProjectId:l,width:"100%",onCreateProject:de,onCreateTask:ve,activeTaskIds:re,onTaskStatusChange:ie})]}),f.jsxs(R.Suspense,{fallback:null,children:[f.jsx(At,{isOpen:C,onClose:ee,title:"Create New Project",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ee,className:"px-4 py-2 text-sm text-neutral-600",children:"Cancel"}),f.jsx("button",{onClick:Be,disabled:!d.trim()||!p.trim()||I.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg ${d.trim()&&p.trim()&&!I.isPending?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:I.isPending?"Creating...":"Create"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),f.jsx("input",{type:"text",value:d,onChange:K=>o(K.target.value),placeholder:"e.g., Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",autoFocus:!0})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),f.jsx(Ur,{value:p,onChange:S})]})]})}),f.jsx(At,{isOpen:i,onClose:ke,title:"Create New Task",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ke,disabled:g!=="idle",className:"px-4 py-2 text-sm text-neutral-600 disabled:opacity-50",children:"Cancel"}),f.jsx("button",{onClick:Se,disabled:!y.trim()||!c||g!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg ${y.trim()&&c&&g==="idle"?"bg-neutral-900 text-white":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Ci[g]})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex gap-3",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project"}),f.jsx(sr,{value:c,onChange:h,options:H.map(K=>({value:K.id,label:K.name})),placeholder:"Select project...",disabled:g!=="idle"})]}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Agent"}),f.jsx(sr,{value:m,onChange:b,options:w.map(K=>({value:K.type,label:K.name+(K.available&&K.version?` (${K.version})`:""),disabled:!K.available})),placeholder:w.length===0?"Loading...":"Select agent...",disabled:g!=="idle"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),f.jsx("input",{type:"text",value:y,onChange:K=>_(K.target.value),placeholder:"e.g., Implement login flow",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400",disabled:g!=="idle",onKeyDown:K=>{K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&Se()}})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),f.jsx("textarea",{rows:3,value:n,onChange:K=>u(K.target.value),placeholder:"Optional...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 resize-none",disabled:g!=="idle",onKeyDown:K=>{(K.metaKey||K.ctrlKey)&&K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&Se()}})]})]})})]})]}):f.jsxs("div",{ref:P,className:"flex flex-col h-screen bg-neutral-50 overflow-hidden text-sm",children:[f.jsxs("header",{className:"h-12 bg-white border-b border-neutral-200 flex items-center px-4 justify-between flex-shrink-0 z-10 relative",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[yi,wi]}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(xi,{}),f.jsx(Es,{to:"/settings",className:"p-1.5 text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",children:f.jsx(Ds,{size:16})})]})]}),f.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[Ie&&Q.length===0?f.jsx("div",{className:"h-full flex items-center justify-center text-sm text-neutral-400 border-r border-neutral-200 flex-shrink-0",style:{width:v},children:"Loading..."}):f.jsx(Ks,{tasks:Q,projects:D,selectedTaskId:e,onSelectTask:t,filterProjectId:r,setFilterProjectId:l,width:v,onCreateProject:de,onCreateTask:ve,activeTaskIds:re,onTaskStatusChange:ie,onDeleteTask:G}),f.jsx("div",{onMouseDown:le,className:"w-1 cursor-col-resize hover:bg-neutral-300 active:bg-neutral-400 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:"Drag to resize"}),f.jsx(Md,{task:A,onDeleteTask:G,isDeleting:z.isPending,onTaskStatusChange:ie})]}),f.jsxs(R.Suspense,{fallback:null,children:[f.jsx(At,{isOpen:C,onClose:ee,title:"Create New Project",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ee,className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors",children:"Cancel"}),f.jsx("button",{onClick:Be,disabled:!d.trim()||!p.trim()||I.isPending,className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${d.trim()&&p.trim()&&!I.isPending?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:I.isPending?"Creating...":"Create Project"})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project Name"}),f.jsx("input",{type:"text",value:d,onChange:K=>o(K.target.value),placeholder:"e.g., Agent Tower",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",autoFocus:!0})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Repository Path"}),f.jsx(Ur,{value:p,onChange:S})]}),I.isError&&f.jsx("p",{className:"text-xs text-red-500",children:I.error instanceof Error?I.error.message:"Failed to create project"})]})}),f.jsx(At,{isOpen:i,onClose:ke,title:"Create New Task",action:f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:ke,disabled:g!=="idle",className:"px-4 py-2 text-sm text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:"Cancel"}),f.jsx("button",{onClick:Se,disabled:!y.trim()||!c||g!=="idle",className:`px-4 py-2 text-sm font-medium rounded-lg transition-all ${y.trim()&&c&&g==="idle"?"bg-neutral-900 text-white hover:bg-black":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:Ci[g]})]}),children:f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"flex gap-3",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Project"}),f.jsx(sr,{value:c,onChange:h,options:H.map(K=>({value:K.id,label:K.name})),placeholder:"Select project...",disabled:g!=="idle"})]}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Agent"}),f.jsx(sr,{value:m,onChange:b,options:w.map(K=>({value:K.type,label:K.name+(K.available&&K.version?` (${K.version})`:""),disabled:!K.available})),placeholder:w.length===0?"Loading...":"Select agent...",disabled:g!=="idle"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Task Title"}),f.jsx("input",{type:"text",value:y,onChange:K=>_(K.target.value),placeholder:"e.g., Implement login flow",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors",disabled:g!=="idle",onKeyDown:K=>{K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&Se()}})]}),f.jsxs("div",{children:[f.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:"Description"}),f.jsx("textarea",{rows:3,value:n,onChange:K=>u(K.target.value),placeholder:"Optional description...",className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:border-neutral-400 transition-colors resize-none",disabled:g!=="idle",onKeyDown:K=>{(K.metaKey||K.ctrlKey)&&K.key==="Enter"&&!K.nativeEvent.isComposing&&K.nativeEvent.keyCode!==229&&Se()}})]}),U.isError&&f.jsx("p",{className:"text-xs text-red-500",children:U.error instanceof Error?U.error.message:"Failed to create task"})]})})]})]})}const Af=Object.freeze(Object.defineProperty({__proto__:null,ProjectKanbanPage:Sf},Symbol.toStringTag,{value:"Module"}));export{Bo as F,Af as P};
|