litepaseo 0.13.5 → 0.14.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/CHANGELOG.md +22 -0
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-DPZXRMSi.mjs → worker-DCp3pZYp.mjs} +182 -12
- package/dist/web/assets/AddProjectDialog-KlhTl3pQ.js +1 -0
- package/dist/web/assets/AddProjectDialog-KlhTl3pQ.js.br +0 -0
- package/dist/web/assets/AddProjectDialog-KlhTl3pQ.js.gz +0 -0
- package/dist/web/assets/{ArchivedWorkspaces-DNBn3mKs.js → ArchivedWorkspaces-DskP5Tih.js} +1 -1
- package/dist/web/assets/ArchivedWorkspaces-DskP5Tih.js.br +0 -0
- package/dist/web/assets/ArchivedWorkspaces-DskP5Tih.js.gz +0 -0
- package/dist/web/assets/{ChangesPanel-QZBTk75V.js → ChangesPanel-CNFEnH8u.js} +2 -2
- package/dist/web/assets/ChangesPanel-CNFEnH8u.js.br +0 -0
- package/dist/web/assets/ChangesPanel-CNFEnH8u.js.gz +0 -0
- package/dist/web/assets/{CodeBlockNode-BHoOznNJ.js → CodeBlockNode-D5UGBgBo.js} +1 -1
- package/dist/web/assets/CodeBlockNode-D5UGBgBo.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-D5UGBgBo.js.gz +0 -0
- package/dist/web/assets/{CommandCenter-Dwss9Qnk.js → CommandCenter-CfbLPl1u.js} +1 -1
- package/dist/web/assets/CommandCenter-CfbLPl1u.js.br +0 -0
- package/dist/web/assets/CommandCenter-CfbLPl1u.js.gz +0 -0
- package/dist/web/assets/{ConversationSearch-Dv4Xqop5.js → ConversationSearch-Cdqnpodo.js} +1 -1
- package/dist/web/assets/ConversationSearch-Cdqnpodo.js.br +0 -0
- package/dist/web/assets/ConversationSearch-Cdqnpodo.js.gz +0 -0
- package/dist/web/assets/FileViewer-BfvWZNL8.js +2 -0
- package/dist/web/assets/FileViewer-BfvWZNL8.js.br +0 -0
- package/dist/web/assets/FileViewer-BfvWZNL8.js.gz +0 -0
- package/dist/web/assets/FileViewer-DgsB2rdj.css +1 -0
- package/dist/web/assets/FileViewer-DgsB2rdj.css.br +0 -0
- package/dist/web/assets/FileViewer-DgsB2rdj.css.gz +0 -0
- package/dist/web/assets/FilesPanel-CZQKdUg4.js +1 -0
- package/dist/web/assets/FilesPanel-CZQKdUg4.js.br +0 -0
- package/dist/web/assets/FilesPanel-CZQKdUg4.js.gz +0 -0
- package/dist/web/assets/HostSettings-DAa1rg7p.js +5 -0
- package/dist/web/assets/HostSettings-DAa1rg7p.js.br +0 -0
- package/dist/web/assets/HostSettings-DAa1rg7p.js.gz +0 -0
- package/dist/web/assets/ImportSessionDialog-XjbnywIR.js +1 -0
- package/dist/web/assets/ImportSessionDialog-XjbnywIR.js.br +0 -0
- package/dist/web/assets/ImportSessionDialog-XjbnywIR.js.gz +0 -0
- package/dist/web/assets/{KanbanPage-DzEe4pWN.js → KanbanPage-6LaK4lAp.js} +1 -1
- package/dist/web/assets/KanbanPage-6LaK4lAp.js.br +0 -0
- package/dist/web/assets/KanbanPage-6LaK4lAp.js.gz +0 -0
- package/dist/web/assets/{LabelsDialog-DCc2Hsv3.js → LabelsDialog-aECWzRCP.js} +1 -1
- package/dist/web/assets/LabelsDialog-aECWzRCP.js.br +0 -0
- package/dist/web/assets/LabelsDialog-aECWzRCP.js.gz +0 -0
- package/dist/web/assets/{MarkdownMessage-DFHG7pFf.js → MarkdownMessage-Cz2a-heW.js} +5 -5
- package/dist/web/assets/MarkdownMessage-Cz2a-heW.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-Cz2a-heW.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-C0UxoChe.js → PreCodeBlock-VABP7RPr.js} +1 -1
- package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-BLqoijIq.js → PreCodeBlock.vue_vue_type_style_index_0_lang-B4p5wP0S.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-B4p5wP0S.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-B4p5wP0S.js.gz +0 -0
- package/dist/web/assets/{SubagentsPanel-BFmm8FFB.js → SubagentsPanel-DNQ0U-hw.js} +1 -1
- package/dist/web/assets/SubagentsPanel-DNQ0U-hw.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-DNQ0U-hw.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-BnjX_223.js +3 -0
- package/dist/web/assets/TerminalPanel-BnjX_223.js.br +0 -0
- package/dist/web/assets/TerminalPanel-BnjX_223.js.gz +0 -0
- package/dist/web/assets/{Tooltip-BRq8sE6L.js → Tooltip-DWpicVuG.js} +1 -1
- package/dist/web/assets/Tooltip-DWpicVuG.js.br +0 -0
- package/dist/web/assets/Tooltip-DWpicVuG.js.gz +0 -0
- package/dist/web/assets/index-Ce8bdxwG.js +45 -0
- package/dist/web/assets/index-Ce8bdxwG.js.br +0 -0
- package/dist/web/assets/index-Ce8bdxwG.js.gz +0 -0
- package/dist/web/assets/index-DwxhY3AB.css +1 -0
- package/dist/web/assets/index-DwxhY3AB.css.br +0 -0
- package/dist/web/assets/index-DwxhY3AB.css.gz +0 -0
- package/dist/web/assets/{index10-nZgW5UqR.js → index10-9PQ1qCgE.js} +1 -1
- package/dist/web/assets/index10-9PQ1qCgE.js.br +0 -0
- package/dist/web/assets/index10-9PQ1qCgE.js.gz +0 -0
- package/dist/web/assets/index3-D4BmE5z2.js +1 -0
- package/dist/web/assets/index4-DqdY9eET.js +1 -0
- package/dist/web/assets/{index5-DJvEzL3S.js → index5-EvVIUWBE.js} +1 -1
- package/dist/web/assets/index5-EvVIUWBE.js.br +0 -0
- package/dist/web/assets/index5-EvVIUWBE.js.gz +0 -0
- package/dist/web/assets/{index6-kE1gGLlp.js → index6-Dp2tbhQ_.js} +1 -1
- package/dist/web/assets/index6-Dp2tbhQ_.js.br +0 -0
- package/dist/web/assets/index6-Dp2tbhQ_.js.gz +0 -0
- package/dist/web/assets/{index7-gx9FMoSS.js → index7-CFOwrJfH.js} +1 -1
- package/dist/web/assets/index7-CFOwrJfH.js.br +0 -0
- package/dist/web/assets/index7-CFOwrJfH.js.gz +0 -0
- package/dist/web/assets/{index8-D18yLUPZ.js → index8-BvMAnsy9.js} +1 -1
- package/dist/web/assets/index8-BvMAnsy9.js.br +0 -0
- package/dist/web/assets/index8-BvMAnsy9.js.gz +0 -0
- package/dist/web/assets/{index9-BoIPulux.js → index9-Bj-VCtON.js} +1 -1
- package/dist/web/assets/index9-Bj-VCtON.js.br +0 -0
- package/dist/web/assets/index9-Bj-VCtON.js.gz +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/package.json +3 -3
- package/dist/web/assets/AddProjectDialog-B4VvzeJq.js +0 -1
- package/dist/web/assets/AddProjectDialog-B4VvzeJq.js.br +0 -0
- package/dist/web/assets/AddProjectDialog-B4VvzeJq.js.gz +0 -0
- package/dist/web/assets/ArchivedWorkspaces-DNBn3mKs.js.br +0 -0
- package/dist/web/assets/ArchivedWorkspaces-DNBn3mKs.js.gz +0 -0
- package/dist/web/assets/ChangesPanel-QZBTk75V.js.br +0 -0
- package/dist/web/assets/ChangesPanel-QZBTk75V.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-BHoOznNJ.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-BHoOznNJ.js.gz +0 -0
- package/dist/web/assets/CommandCenter-Dwss9Qnk.js.br +0 -0
- package/dist/web/assets/CommandCenter-Dwss9Qnk.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-Dv4Xqop5.js.br +0 -0
- package/dist/web/assets/ConversationSearch-Dv4Xqop5.js.gz +0 -0
- package/dist/web/assets/FileViewer-CWOWcrwG.css +0 -1
- package/dist/web/assets/FileViewer-CWOWcrwG.css.br +0 -0
- package/dist/web/assets/FileViewer-CWOWcrwG.css.gz +0 -0
- package/dist/web/assets/FileViewer-DnzF8BQv.js +0 -2
- package/dist/web/assets/FileViewer-DnzF8BQv.js.br +0 -0
- package/dist/web/assets/FileViewer-DnzF8BQv.js.gz +0 -0
- package/dist/web/assets/FilesPanel-CJo48xEV.js +0 -1
- package/dist/web/assets/FilesPanel-CJo48xEV.js.br +0 -0
- package/dist/web/assets/FilesPanel-CJo48xEV.js.gz +0 -0
- package/dist/web/assets/HostSettings-DTxw_uAJ.js +0 -5
- package/dist/web/assets/HostSettings-DTxw_uAJ.js.br +0 -0
- package/dist/web/assets/HostSettings-DTxw_uAJ.js.gz +0 -0
- package/dist/web/assets/KanbanPage-DzEe4pWN.js.br +0 -0
- package/dist/web/assets/KanbanPage-DzEe4pWN.js.gz +0 -0
- package/dist/web/assets/LabelsDialog-DCc2Hsv3.js.br +0 -0
- package/dist/web/assets/LabelsDialog-DCc2Hsv3.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-DFHG7pFf.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-DFHG7pFf.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BLqoijIq.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BLqoijIq.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-BFmm8FFB.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-BFmm8FFB.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-DH_irg39.js +0 -3
- package/dist/web/assets/TerminalPanel-DH_irg39.js.br +0 -0
- package/dist/web/assets/TerminalPanel-DH_irg39.js.gz +0 -0
- package/dist/web/assets/Tooltip-BRq8sE6L.js.br +0 -0
- package/dist/web/assets/Tooltip-BRq8sE6L.js.gz +0 -0
- package/dist/web/assets/index-CdRjL7-Z.css +0 -1
- package/dist/web/assets/index-CdRjL7-Z.css.br +0 -0
- package/dist/web/assets/index-CdRjL7-Z.css.gz +0 -0
- package/dist/web/assets/index-Db0xL9aq.js +0 -39
- package/dist/web/assets/index-Db0xL9aq.js.br +0 -0
- package/dist/web/assets/index-Db0xL9aq.js.gz +0 -0
- package/dist/web/assets/index10-nZgW5UqR.js.br +0 -0
- package/dist/web/assets/index10-nZgW5UqR.js.gz +0 -0
- package/dist/web/assets/index3-D6z4BWQd.js +0 -1
- package/dist/web/assets/index4-Hln2AGrF.js +0 -1
- package/dist/web/assets/index5-DJvEzL3S.js.br +0 -0
- package/dist/web/assets/index5-DJvEzL3S.js.gz +0 -0
- package/dist/web/assets/index6-kE1gGLlp.js.br +0 -0
- package/dist/web/assets/index6-kE1gGLlp.js.gz +0 -0
- package/dist/web/assets/index7-gx9FMoSS.js.br +0 -0
- package/dist/web/assets/index7-gx9FMoSS.js.gz +0 -0
- package/dist/web/assets/index8-D18yLUPZ.js.br +0 -0
- package/dist/web/assets/index8-D18yLUPZ.js.gz +0 -0
- package/dist/web/assets/index9-BoIPulux.js.br +0 -0
- package/dist/web/assets/index9-BoIPulux.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
- Upgrade `@getpaseo/client` and `@getpaseo/protocol` to `0.17.4`.
|
|
6
|
+
- **Sidebar multi-select batch archive & hover quick-archive**:
|
|
7
|
+
- `Shift+Click` any workspace row (or choose **Select…** from the thread menu) to enter multi-select mode with range selection, a sticky batch action bar, a single confirmation prompt, and a unified 6-second Undo toast (`Cmd/Ctrl+Z`).
|
|
8
|
+
- Added a hover quick-archive icon button on desktop workspace rows.
|
|
9
|
+
- **One-tap blockquote copy**:
|
|
10
|
+
- Top-level Markdown blockquotes in assistant replies now show a **Copy** control in the top-right corner that copies the quote body cleanly without `> ` markers.
|
|
11
|
+
- **Import CLI sessions**:
|
|
12
|
+
- Browse, search, and filter recent local CLI sessions (Claude Code, Codex, Pi, Antigravity, etc.) from the sidebar footer or Command Center and import them directly into LitePaseo, preserving partial results and provider warnings.
|
|
13
|
+
- **Command Center enhancements**:
|
|
14
|
+
- Added **Rewind latest turn** for active conversations whose provider supports rewind.
|
|
15
|
+
- Added host **Agent Profiles** (`Profile › <name>`) searchable by name, provider, model, or mode—applying directly to matching active agents or opening a pre-configured draft session for other providers—plus draft model/thinking shortcuts before the first message.
|
|
16
|
+
- **Worktrees from existing branches or GitHub PRs**:
|
|
17
|
+
- `NewSession` now supports creating worktrees from a **New branch**, **From branch** (with live host branch suggestions), **From PR** (`#123`), or an **Existing** worktree.
|
|
18
|
+
- **Built-in Plugin Gallery**:
|
|
19
|
+
- Browse, search, filter by category, inspect README details, and install plugins from the host's Paseo plugin registry directly inside Host Settings → Plugins.
|
|
20
|
+
- **Add Project dialog overhaul**:
|
|
21
|
+
- Unified into three tabs (**Existing**, **Clone**, **New folder**) with `Cmd/Ctrl+1/2/3` shortcuts, select-then-confirm rows, preserved tab drafts, and host-side folder creation.
|
|
22
|
+
- **Rich-text hyperlink paste & Issue/PR autolinking**:
|
|
23
|
+
- Pasting rich text containing hyperlinks into the composer preserves `[label](url)` Markdown links; `owner/repo#123` (and repo-scoped `#123`) references in replies and file previews link directly to their forge issues.
|
|
24
|
+
|
|
3
25
|
## 0.13.5
|
|
4
26
|
|
|
5
27
|
- **Fix missing workspace unread indicator (green dot) & tighten auto-read**:
|
package/dist/server/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
// src/server/version.ts
|
|
11
|
-
const VERSION = "0.
|
|
11
|
+
const VERSION = "0.14.0";
|
|
12
12
|
// src/server/rotating-log.ts
|
|
13
13
|
/** One writer (the supervisor); bounded active file plus numbered archives. */
|
|
14
14
|
var RotatingLog = class {
|
|
@@ -1764,7 +1764,7 @@ async function run() {
|
|
|
1764
1764
|
if (name === "--help" || name === "-h") return console.log(mainHelp(VERSION, displayDirectory(), out));
|
|
1765
1765
|
if (name === "worker") {
|
|
1766
1766
|
const paths = await dataDirectory();
|
|
1767
|
-
const { runWorker } = await import("./worker-
|
|
1767
|
+
const { runWorker } = await import("./worker-DCp3pZYp.mjs");
|
|
1768
1768
|
return runWorker(paths.directory, fileURLToPath(new URL("../web/", import.meta.url)));
|
|
1769
1769
|
}
|
|
1770
1770
|
const command = findCommand(name);
|
|
@@ -3423,14 +3423,19 @@ function registerHostSettings(app, hosts) {
|
|
|
3423
3423
|
});
|
|
3424
3424
|
app.get("/api/hosts/:host/plugins", async (c) => {
|
|
3425
3425
|
const plugins = await hosts.get(c.req.param("host")).driver.listPlugins();
|
|
3426
|
-
return c.json(plugins.map(({ id, name, enabled, status, description, error }) =>
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3426
|
+
return c.json(plugins.map(({ id, name, enabled, status, description, error, installation }) => {
|
|
3427
|
+
const identity = installation?.identity;
|
|
3428
|
+
const registryId = identity && "registry" in identity ? identity.registry?.id : void 0;
|
|
3429
|
+
return {
|
|
3430
|
+
id,
|
|
3431
|
+
name,
|
|
3432
|
+
enabled,
|
|
3433
|
+
status,
|
|
3434
|
+
description,
|
|
3435
|
+
error,
|
|
3436
|
+
...registryId ? { registryId } : {}
|
|
3437
|
+
};
|
|
3438
|
+
}));
|
|
3434
3439
|
});
|
|
3435
3440
|
app.post("/api/hosts/:host/plugins/:plugin/:action", async (c) => {
|
|
3436
3441
|
const driver = hosts.get(c.req.param("host")).driver, id = c.req.param("plugin");
|
|
@@ -3454,6 +3459,62 @@ function registerHostSettings(app, hosts) {
|
|
|
3454
3459
|
await driver.installPluginSource(input);
|
|
3455
3460
|
return c.json({ ok: true });
|
|
3456
3461
|
});
|
|
3462
|
+
app.get("/api/hosts/:host/plugin-registry", async (c) => {
|
|
3463
|
+
const driver = hosts.get(c.req.param("host")).driver;
|
|
3464
|
+
if (!driver.getLastServerInfoMessage()?.features?.pluginRegistry || typeof driver.listPluginRegistry !== "function") return c.json({ error: "Plugin gallery is unavailable on this host" }, 409);
|
|
3465
|
+
try {
|
|
3466
|
+
const idx = await driver.listPluginRegistry();
|
|
3467
|
+
return c.json({
|
|
3468
|
+
registryName: idx.registry.name,
|
|
3469
|
+
registryUrl: idx.registry.url,
|
|
3470
|
+
categories: idx.categories ?? [],
|
|
3471
|
+
featured: idx.featured ?? [],
|
|
3472
|
+
plugins: (idx.plugins ?? []).map((p) => ({
|
|
3473
|
+
id: p.id,
|
|
3474
|
+
name: p.name,
|
|
3475
|
+
description: p.description,
|
|
3476
|
+
categories: p.categories ?? [],
|
|
3477
|
+
author: {
|
|
3478
|
+
github: p.author.github,
|
|
3479
|
+
...p.author.name ? { name: p.author.name } : {}
|
|
3480
|
+
},
|
|
3481
|
+
repositoryUrl: p.repository.url,
|
|
3482
|
+
...p.license ? { license: p.license } : {},
|
|
3483
|
+
...typeof p.installs === "number" ? { installs: p.installs } : {},
|
|
3484
|
+
updatedAt: p.updatedAt,
|
|
3485
|
+
...p.artifact?.version ? { version: p.artifact.version } : {}
|
|
3486
|
+
}))
|
|
3487
|
+
});
|
|
3488
|
+
} catch (error) {
|
|
3489
|
+
return c.json({ error: error instanceof Error ? error.message : "Could not load plugin gallery" }, 502);
|
|
3490
|
+
}
|
|
3491
|
+
});
|
|
3492
|
+
app.get("/api/hosts/:host/plugin-registry/:owner/:name", async (c) => {
|
|
3493
|
+
const driver = hosts.get(c.req.param("host")).driver;
|
|
3494
|
+
if (!driver.getLastServerInfoMessage()?.features?.pluginRegistry || typeof driver.getRegistryPlugin !== "function") return c.json({ error: "Plugin gallery is unavailable on this host" }, 409);
|
|
3495
|
+
const id = `${c.req.param("owner")}/${c.req.param("name")}`;
|
|
3496
|
+
try {
|
|
3497
|
+
const p = await driver.getRegistryPlugin(id);
|
|
3498
|
+
return c.json({
|
|
3499
|
+
id: p.id,
|
|
3500
|
+
name: p.name,
|
|
3501
|
+
description: p.description,
|
|
3502
|
+
categories: p.categories ?? [],
|
|
3503
|
+
author: {
|
|
3504
|
+
github: p.author.github,
|
|
3505
|
+
...p.author.name ? { name: p.author.name } : {}
|
|
3506
|
+
},
|
|
3507
|
+
repositoryUrl: p.repository.url,
|
|
3508
|
+
...p.license ? { license: p.license } : {},
|
|
3509
|
+
...typeof p.installs === "number" ? { installs: p.installs } : {},
|
|
3510
|
+
updatedAt: p.updatedAt,
|
|
3511
|
+
...p.artifact?.version ? { version: p.artifact.version } : {},
|
|
3512
|
+
readme: p.readme ?? ""
|
|
3513
|
+
});
|
|
3514
|
+
} catch (error) {
|
|
3515
|
+
return c.json({ error: error instanceof Error ? error.message : "Could not load plugin details" }, 502);
|
|
3516
|
+
}
|
|
3517
|
+
});
|
|
3457
3518
|
app.get("/api/hosts/:host/status", async (c) => c.json(await hosts.get(c.req.param("host")).driver.getDaemonStatus()));
|
|
3458
3519
|
app.get("/api/hosts/:host/lifecycle", (c) => c.json(jobs.get(c.req.param("host")) ?? null));
|
|
3459
3520
|
app.post("/api/hosts/:host/lifecycle/:action", async (c) => {
|
|
@@ -4990,6 +5051,21 @@ function registerAgentRoutes(app, { hosts }) {
|
|
|
4990
5051
|
featureValues: z.record(z.string(), z.unknown()).optional(),
|
|
4991
5052
|
prompt: z.string().max(1e5).optional(),
|
|
4992
5053
|
worktreeBranch: z.string().trim().min(1).max(200).optional(),
|
|
5054
|
+
worktree: z.discriminatedUnion("mode", [
|
|
5055
|
+
z.object({
|
|
5056
|
+
mode: z.literal("branch-off"),
|
|
5057
|
+
newBranch: z.string().trim().min(1).max(200),
|
|
5058
|
+
base: z.string().trim().min(1).max(200).optional()
|
|
5059
|
+
}),
|
|
5060
|
+
z.object({
|
|
5061
|
+
mode: z.literal("checkout-branch"),
|
|
5062
|
+
branch: z.string().trim().min(1).max(200)
|
|
5063
|
+
}),
|
|
5064
|
+
z.object({
|
|
5065
|
+
mode: z.literal("checkout-pr"),
|
|
5066
|
+
prNumber: z.number().int().positive()
|
|
5067
|
+
})
|
|
5068
|
+
]).optional(),
|
|
4993
5069
|
workspaceId: z.string().trim().min(1).max(200).optional(),
|
|
4994
5070
|
attachments: z.array(z.object({
|
|
4995
5071
|
id: z.string().max(200).optional(),
|
|
@@ -5008,6 +5084,10 @@ function registerAgentRoutes(app, { hosts }) {
|
|
|
5008
5084
|
model = models.find((m) => m.isDefault)?.id ?? models[0]?.id;
|
|
5009
5085
|
if (!model) return c.json({ error: "No selectable model is available for this provider. Refresh providers and select a model." }, 400);
|
|
5010
5086
|
}
|
|
5087
|
+
const worktree = input.worktree ?? (input.worktreeBranch ? {
|
|
5088
|
+
mode: "branch-off",
|
|
5089
|
+
newBranch: input.worktreeBranch
|
|
5090
|
+
} : void 0);
|
|
5011
5091
|
const agent = input.workspaceId ? await driver.createAgent({
|
|
5012
5092
|
idempotencyKey: input.idempotencyKey,
|
|
5013
5093
|
workspaceId: input.workspaceId,
|
|
@@ -5030,10 +5110,7 @@ function registerAgentRoutes(app, { hosts }) {
|
|
|
5030
5110
|
},
|
|
5031
5111
|
...input.prompt?.trim() ? { prompt: input.prompt } : {},
|
|
5032
5112
|
...input.attachments?.length ? { attachments: input.attachments } : {},
|
|
5033
|
-
...
|
|
5034
|
-
mode: "branch-off",
|
|
5035
|
-
newBranch: input.worktreeBranch
|
|
5036
|
-
} } : {}
|
|
5113
|
+
...worktree ? { worktree } : {}
|
|
5037
5114
|
});
|
|
5038
5115
|
return c.json({
|
|
5039
5116
|
id: agent.id,
|
|
@@ -5116,6 +5193,77 @@ function registerAgentRoutes(app, { hosts }) {
|
|
|
5116
5193
|
return c.json({ error: errorMessage(error, "Could not list worktrees") }, 502);
|
|
5117
5194
|
}
|
|
5118
5195
|
});
|
|
5196
|
+
app.get("/api/hosts/:host/branches", async (c) => {
|
|
5197
|
+
const cwd = hostPath.parse(c.req.query("cwd"));
|
|
5198
|
+
const { driver } = hosts.get(c.req.param("host"));
|
|
5199
|
+
if (typeof driver.getBranchSuggestions !== "function") return c.json({ branches: [] });
|
|
5200
|
+
try {
|
|
5201
|
+
const res = await driver.getBranchSuggestions({ cwd });
|
|
5202
|
+
if (res.error) return c.json({ error: res.error }, 400);
|
|
5203
|
+
return c.json({ branches: res.branches ?? [] });
|
|
5204
|
+
} catch (error) {
|
|
5205
|
+
return c.json({ error: errorMessage(error, "Could not list branches") }, 502);
|
|
5206
|
+
}
|
|
5207
|
+
});
|
|
5208
|
+
app.get("/api/hosts/:host/importable-sessions", async (c) => {
|
|
5209
|
+
const { driver } = hosts.get(c.req.param("host"));
|
|
5210
|
+
if (typeof driver.fetchRecentProviderSessions !== "function") return c.json({ error: "This host does not support importing CLI sessions." }, 409);
|
|
5211
|
+
const cwd = c.req.query("cwd")?.trim() ? hostPath.parse(c.req.query("cwd")) : void 0;
|
|
5212
|
+
const provider = z.string().trim().min(1).max(100).optional().parse(c.req.query("provider") || void 0);
|
|
5213
|
+
const query = z.string().trim().max(200).optional().parse(c.req.query("q") || void 0);
|
|
5214
|
+
const rawLimit = Number(c.req.query("limit"));
|
|
5215
|
+
const limit = Number.isFinite(rawLimit) && rawLimit > 0 ? Math.min(200, Math.trunc(rawLimit)) : 50;
|
|
5216
|
+
try {
|
|
5217
|
+
const res = await driver.fetchRecentProviderSessions({
|
|
5218
|
+
...cwd ? { cwd } : {},
|
|
5219
|
+
...provider ? { providers: [provider] } : {},
|
|
5220
|
+
...query ? { query } : {},
|
|
5221
|
+
limit
|
|
5222
|
+
});
|
|
5223
|
+
const out = {
|
|
5224
|
+
entries: (res.entries ?? []).map((e) => ({
|
|
5225
|
+
providerId: e.providerId,
|
|
5226
|
+
providerLabel: e.providerLabel,
|
|
5227
|
+
providerHandleId: e.providerHandleId,
|
|
5228
|
+
cwd: e.cwd,
|
|
5229
|
+
title: e.title ?? null,
|
|
5230
|
+
firstPromptPreview: e.firstPromptPreview ?? null,
|
|
5231
|
+
lastPromptPreview: e.lastPromptPreview ?? null,
|
|
5232
|
+
lastActivityAt: e.lastActivityAt
|
|
5233
|
+
})),
|
|
5234
|
+
...typeof res.filteredAlreadyImportedCount === "number" ? { filteredAlreadyImportedCount: res.filteredAlreadyImportedCount } : {},
|
|
5235
|
+
...res.providerErrors?.length ? { providerErrors: res.providerErrors } : {}
|
|
5236
|
+
};
|
|
5237
|
+
return c.json(out);
|
|
5238
|
+
} catch (error) {
|
|
5239
|
+
return c.json({ error: errorMessage(error, "Could not load CLI sessions") }, 502);
|
|
5240
|
+
}
|
|
5241
|
+
});
|
|
5242
|
+
app.post("/api/hosts/:host/import-session", async (c) => {
|
|
5243
|
+
const input = z.object({
|
|
5244
|
+
providerId: z.string().trim().min(1).max(200),
|
|
5245
|
+
providerHandleId: z.string().trim().min(1).max(500),
|
|
5246
|
+
cwd: hostPath.optional(),
|
|
5247
|
+
workspaceId: z.string().trim().min(1).max(200).optional()
|
|
5248
|
+
}).parse(await c.req.json());
|
|
5249
|
+
const hostId = c.req.param("host");
|
|
5250
|
+
const { driver } = hosts.get(hostId);
|
|
5251
|
+
if (typeof driver.importAgent !== "function") return c.json({ error: "This host does not support importing CLI sessions." }, 409);
|
|
5252
|
+
try {
|
|
5253
|
+
const agent = await driver.importAgent({
|
|
5254
|
+
providerId: input.providerId,
|
|
5255
|
+
providerHandleId: input.providerHandleId,
|
|
5256
|
+
...input.cwd ? { cwd: input.cwd } : {},
|
|
5257
|
+
...input.workspaceId ? { workspaceId: input.workspaceId } : {}
|
|
5258
|
+
});
|
|
5259
|
+
return c.json({
|
|
5260
|
+
id: agent.id,
|
|
5261
|
+
key: `${hostId}:${agent.id}`
|
|
5262
|
+
}, 201);
|
|
5263
|
+
} catch (error) {
|
|
5264
|
+
return c.json({ error: errorMessage(error, "Could not import session") }, 502);
|
|
5265
|
+
}
|
|
5266
|
+
});
|
|
5119
5267
|
/** What the open agent can switch to. Modes/features come from the live directory (no round trip). */
|
|
5120
5268
|
app.get("/api/hosts/:host/agents/:agent/config", async (c) => {
|
|
5121
5269
|
const client = hosts.get(c.req.param("host"));
|
|
@@ -6193,6 +6341,28 @@ function registerProjectRoutes(app, { hosts, fetch }) {
|
|
|
6193
6341
|
return c.json({ error: errorMessage(error, "Could not add project.") }, 502);
|
|
6194
6342
|
}
|
|
6195
6343
|
});
|
|
6344
|
+
app.post("/api/hosts/:host/projects/create-directory", async (c) => {
|
|
6345
|
+
const input = z.object({
|
|
6346
|
+
parentPath: hostPath,
|
|
6347
|
+
name: z.string().trim().min(1).max(200).refine((v) => !v.includes("/") && !v.includes("\\") && v !== "." && v !== "..", "Invalid folder name")
|
|
6348
|
+
}).parse(await c.req.json());
|
|
6349
|
+
const { driver } = hosts.get(c.req.param("host"));
|
|
6350
|
+
if (typeof driver.createProjectDirectory !== "function") return c.json({ error: "This host does not support creating project folders." }, 409);
|
|
6351
|
+
try {
|
|
6352
|
+
const res = await driver.createProjectDirectory(input);
|
|
6353
|
+
if (res.error) return c.json({
|
|
6354
|
+
error: res.error,
|
|
6355
|
+
code: res.errorCode ?? null
|
|
6356
|
+
}, 400);
|
|
6357
|
+
return c.json({
|
|
6358
|
+
ok: true,
|
|
6359
|
+
path: res.directoryPath,
|
|
6360
|
+
project: res.project ?? null
|
|
6361
|
+
});
|
|
6362
|
+
} catch (error) {
|
|
6363
|
+
return c.json({ error: errorMessage(error, "Could not create project folder.") }, 502);
|
|
6364
|
+
}
|
|
6365
|
+
});
|
|
6196
6366
|
app.get("/api/hosts/:host/github/search", async (c) => {
|
|
6197
6367
|
const query = z.string().trim().min(1).max(200).parse(c.req.query("q") ?? "");
|
|
6198
6368
|
const { driver } = hosts.get(c.req.param("host"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,H as t,I as ee,M as n,Q as r,S as i,T as a,Y as o,c as s,ct as c,d as l,dt as u,f as d,g as f,h as p,it as m,s as te,st as h,v as g,y as _,z as v}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_ as y,v as ne,y as b}from"./index-Ce8bdxwG.js";var re={class:`sheet-head`},ie={class:`add-project-body`},ae={key:0,class:`field`},oe=[`value`],se={class:`segmented segmented-sm`,role:`tablist`},ce=[`aria-selected`],le=[`aria-selected`],ue=[`aria-selected`],de={key:1,class:`setting-note is-error`,role:`alert`},fe={class:`field`},pe=[`disabled`],me={key:0,class:`add-project-suggestions`},he={key:0,class:`subtle`},ge=[`disabled`,`onClick`,`onDblclick`],_e={class:`grow`},ve={class:`row-title`},ye={class:`row-sub mono`},be={class:`row-sub`},xe={class:`form-actions`},Se=[`disabled`],Ce=[`disabled`],we={key:0,class:`add-project-suggestions`},Te=[`onClick`],Ee={class:`grow`},De={class:`row-title`},Oe={key:0,class:`hs-tag`},ke={key:0,class:`row-sub`},Ae={class:`field`},x=[`disabled`],S={class:`field`},C=[`disabled`],je={class:`segmented segmented-sm`},Me={class:`form-actions`},Ne=[`disabled`],Pe={class:`field`},Fe=[`disabled`],w={class:`field`},Ie=[`disabled`],Le={key:0,class:`row-sub mono`},Re={class:`form-actions`},ze=[`disabled`],T=a({__name:`AddProjectDialog`,props:{hosts:{},initialHostId:{},api:{type:Function}},emits:[`close`,`added`],setup(a,{emit:T}){let E=a,D=T,O=m(null),k=m(null),A=m(null),j=m(null);ne(O,()=>D(`close`));let M=p(()=>E.hosts.filter(e=>e.state===`connected`)),N=m(M.value.find(e=>e.id===E.initialHostId)?.id??M.value[0]?.id??``),P=m(`existing`),F=m(!1),I=m(``),L=m(``),R=m([]),z=m(!1),B=p(()=>{let e=L.value.trim().toLowerCase();return e?R.value.filter(t=>t.path.toLowerCase().includes(e)||(t.name?.toLowerCase().includes(e)??!1)).slice(0,12):R.value.slice(0,12)}),V=m(``),H=m([]),U=m(!1),W=m(``),G=m(``),K=m(!1),q=m(`ssh`),J=m(``),Y=m(!1),X=m(``),Z=p(()=>{let e=R.value[0]?.path;if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``});async function Q(){if(N.value){z.value=!0;try{let e=await E.api(`/hosts/${encodeURIComponent(N.value)}/project-suggestions`);if(R.value=(e.suggestions??[]).map(e=>({path:e.path??e.rootPath??e.cwd??``,name:e.name??e.displayName})).filter(e=>!!e.path),Y.value||(J.value=Z.value),!K.value&&W.value&&Z.value){let e=W.value.split(`/`).pop()||W.value;G.value=`${Z.value.replace(/\/+$/,``)}/${e}`}}catch{R.value=[]}finally{z.value=!1}}}o(N,()=>{R.value=[],Y.value||(J.value=``),K.value||(G.value=``),Q()},{immediate:!0}),o(P,e=>{I.value=``,n(()=>{e===`existing`?k.value?.focus():e===`clone`?A.value?.focus():j.value?.focus()})});function Be(e){!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||(e.key===`1`?(e.preventDefault(),P.value=`existing`):e.key===`2`?(e.preventDefault(),P.value=`clone`):e.key===`3`&&(e.preventDefault(),P.value=`new`))}async function $(e){let t=(e??L.value).trim();if(N.value&&t){F.value=!0,I.value=``;try{await E.api(`/hosts/${encodeURIComponent(N.value)}/projects`,`POST`,{cwd:t}),D(`added`,N.value,t),D(`close`)}catch(e){I.value=e.message||`Could not add project.`}finally{F.value=!1}}}async function Ve(){if(N.value&&V.value.trim()){U.value=!0,I.value=``;try{let e=await E.api(`/hosts/${encodeURIComponent(N.value)}/github/search?q=${encodeURIComponent(V.value.trim())}`);H.value=(e.repositories??[]).map(e=>({fullName:e.fullName??e.nameWithOwner??e.repo??``,description:e.description??null,isPrivate:e.isPrivate===!0||e.private===!0})).filter(e=>!!e.fullName)}catch(e){I.value=e.message||`Could not search GitHub.`}finally{U.value=!1}}}function He(e){if(W.value=e,!K.value&&Z.value){let t=e.split(`/`).pop()||e;G.value=`${Z.value.replace(/\/+$/,``)}/${t}`}}async function Ue(){if(N.value&&W.value.trim()&&G.value.trim()){F.value=!0,I.value=``;try{let e=await E.api(`/hosts/${encodeURIComponent(N.value)}/projects/clone`,`POST`,{repo:W.value.trim(),targetDirectory:G.value.trim(),cloneProtocol:q.value},12e4);D(`added`,N.value,e.path||G.value.trim()),D(`close`)}catch(e){I.value=e.message||`Could not clone repository.`}finally{F.value=!1}}}async function We(){if(N.value&&J.value.trim()&&X.value.trim()){F.value=!0,I.value=``;try{let e=await E.api(`/hosts/${encodeURIComponent(N.value)}/projects/create-directory`,`POST`,{parentPath:J.value.trim(),name:X.value.trim()});D(`added`,N.value,e.path||`${J.value.trim().replace(/\/+$/,``)}/${X.value.trim()}`),D(`close`)}catch(e){I.value=e.message||`Could not create project folder.`}finally{F.value=!1}}}return ee(()=>{Q(),n(()=>k.value?.focus())}),(ee,n)=>(v(),_(`div`,{class:`overlay`,onMousedown:n[19]||=l(e=>D(`close`),[`self`])},[f(`section`,{ref_key:`sheet`,ref:O,class:`sheet add-project-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add project`,tabindex:`-1`,onKeydown:Be},[f(`header`,re,[n[20]||=f(`h2`,null,`Add project`,-1),f(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:n[0]||=e=>D(`close`)},[e(b,{name:`close`,size:16})])]),f(`div`,ie,[M.value.length>1?(v(),_(`label`,ae,[n[21]||=f(`span`,null,`Host`,-1),r(f(`select`,{"onUpdate:modelValue":n[1]||=e=>N.value=e},[(v(!0),_(d,null,t(M.value,e=>(v(),_(`option`,{key:e.id,value:e.id},u(e.label),9,oe))),128))],512),[[te,N.value]])])):g(``,!0),f(`div`,se,[f(`button`,{type:`button`,role:`tab`,"aria-selected":P.value===`existing`,class:c({chosen:P.value===`existing`}),onClick:n[2]||=e=>P.value=`existing`},`Existing`,10,ce),f(`button`,{type:`button`,role:`tab`,"aria-selected":P.value===`clone`,class:c({chosen:P.value===`clone`}),onClick:n[3]||=e=>P.value=`clone`},`Clone`,10,le),f(`button`,{type:`button`,role:`tab`,"aria-selected":P.value===`new`,class:c({chosen:P.value===`new`}),onClick:n[4]||=e=>P.value=`new`},`New folder`,10,ue)]),I.value?(v(),_(`p`,de,u(I.value),1)):g(``,!0),P.value===`existing`?(v(),_(`form`,{key:2,class:`add-project-form`,onSubmit:n[7]||=l(e=>$(),[`prevent`])},[f(`label`,fe,[n[22]||=f(`span`,null,`Directory path or filter recent folders`,-1),r(f(`input`,{ref_key:`existingInput`,ref:k,"onUpdate:modelValue":n[5]||=e=>L.value=e,placeholder:`/home/user/code/my-repo`,disabled:F.value},null,8,pe),[[s,L.value]])]),B.value.length||z.value?(v(),_(`div`,me,[n[24]||=f(`span`,{class:`subtle`},`Recent folders on this host · click to select, then confirm`,-1),z.value&&!R.value.length?(v(),_(`p`,he,[...n[23]||=[f(`span`,{class:`spinner spinner-sm`},null,-1),i(` Loading…`,-1)]])):g(``,!0),(v(!0),_(d,null,t(B.value,t=>(v(),_(`button`,{key:t.path,type:`button`,class:c([`suggestion-row`,{chosen:L.value.trim()===t.path}]),disabled:F.value,onClick:e=>L.value=t.path,onDblclick:e=>$(t.path)},[e(b,{name:`folder`,size:14}),f(`span`,_e,[f(`span`,ve,u(t.name||t.path.split(`/`).pop()),1),f(`span`,ye,u(h(y)(t.path)),1)]),f(`span`,be,u(L.value.trim()===t.path?`Selected`:`Select`),1)],42,ge))),128))])):g(``,!0),f(`div`,xe,[f(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[6]||=e=>D(`close`)},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-primary`,disabled:F.value||!L.value.trim()},u(F.value?`Adding…`:`Add project`),9,Se)])],32)):P.value===`clone`?(v(),_(d,{key:3},[f(`form`,{class:`archived-search`,onSubmit:l(Ve,[`prevent`])},[r(f(`input`,{ref_key:`cloneInput`,ref:A,"onUpdate:modelValue":n[8]||=e=>V.value=e,placeholder:`Search GitHub repos (owner/name or keyword)…`},null,512),[[s,V.value]]),f(`button`,{type:`submit`,class:`btn btn-sm btn-outline`,disabled:U.value||!V.value.trim()},u(U.value?`Searching…`:`Search`),9,Ce)],32),H.value.length?(v(),_(`div`,we,[(v(!0),_(d,null,t(H.value,t=>(v(),_(`button`,{key:t.fullName,type:`button`,class:c([`suggestion-row`,{chosen:W.value===t.fullName}]),onClick:e=>He(t.fullName)},[e(b,{name:`branch`,size:14}),f(`span`,Ee,[f(`span`,De,[i(u(t.fullName)+` `,1),t.isPrivate?(v(),_(`small`,Oe,`private`)):g(``,!0)]),t.description?(v(),_(`span`,ke,u(t.description),1)):g(``,!0)])],10,Te))),128))])):g(``,!0),f(`form`,{class:`add-project-form`,onSubmit:l(Ue,[`prevent`])},[f(`label`,Ae,[n[25]||=f(`span`,null,`Repository (owner/repo)`,-1),r(f(`input`,{"onUpdate:modelValue":n[9]||=e=>W.value=e,placeholder:`owner/repo`,disabled:F.value},null,8,x),[[s,W.value]])]),f(`label`,S,[n[26]||=f(`span`,null,`Target directory on host`,-1),r(f(`input`,{"onUpdate:modelValue":n[10]||=e=>G.value=e,placeholder:`/home/user/code/repo`,disabled:F.value,onInput:n[11]||=e=>K.value=!0},null,40,C),[[s,G.value]])]),f(`div`,je,[f(`button`,{type:`button`,class:c({chosen:q.value===`ssh`}),onClick:n[12]||=e=>q.value=`ssh`},`SSH`,2),f(`button`,{type:`button`,class:c({chosen:q.value===`https`}),onClick:n[13]||=e=>q.value=`https`},`HTTPS`,2)]),f(`div`,Me,[f(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[14]||=e=>D(`close`)},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-primary`,disabled:F.value||!W.value.trim()||!G.value.trim()},u(F.value?`Cloning…`:`Clone & add`),9,Ne)])],32)],64)):(v(),_(`form`,{key:4,class:`add-project-form`,onSubmit:l(We,[`prevent`])},[f(`label`,Pe,[n[27]||=f(`span`,null,`Parent directory on host`,-1),r(f(`input`,{"onUpdate:modelValue":n[15]||=e=>J.value=e,placeholder:`/home/user/code`,disabled:F.value,onInput:n[16]||=e=>Y.value=!0},null,40,Fe),[[s,J.value]])]),f(`label`,w,[n[28]||=f(`span`,null,`New folder name`,-1),r(f(`input`,{ref_key:`newFolderInput`,ref:j,"onUpdate:modelValue":n[17]||=e=>X.value=e,placeholder:`my-new-project`,disabled:F.value},null,8,Ie),[[s,X.value]])]),J.value.trim()&&X.value.trim()?(v(),_(`p`,Le,` Will create: `+u(h(y)(J.value.trim().replace(/\/+$/,``)+`/`+X.value.trim())),1)):g(``,!0),f(`div`,Re,[f(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[18]||=e=>D(`close`)},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-primary`,disabled:F.value||!J.value.trim()||!X.value.trim()},u(F.value?`Creating…`:`Create & add`),9,ze)])],32))])],544)],32))}});export{T as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,I as n,Q as r,S as i,T as a,c as o,d as s,dt as c,f as l,g as u,h as d,it as f,v as p,y as m,z as h}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{
|
|
1
|
+
import{C as e,H as t,I as n,Q as r,S as i,T as a,c as o,d as s,dt as c,f as l,g as u,h as d,it as f,v as p,y as m,z as h}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{t as g,v as _,y as v}from"./index-Ce8bdxwG.js";var y={class:`sheet-head`},b={class:`archived-search`},x=[`disabled`],S={key:0,class:`setting-note is-error`,role:`alert`},C={class:`archived-list`},w={key:0,class:`subtle archived-empty`},T={key:1,class:`subtle archived-empty`},E={class:`grow`},D={class:`row-title`},O={class:`row-sub`},k=[`disabled`,`onClick`],A=a({__name:`ArchivedWorkspaces`,props:{hosts:{},api:{type:Function}},emits:[`close`,`restored`],setup(a,{emit:A}){let j=a,M=A,N=f(null);_(N,()=>M(`close`));let P=f(``),F=f([]),I=f(!1),L=f(``),R=f(null),z=d(()=>new Map(j.hosts.map(e=>[e.id,e.label])));async function B(){I.value=!0,L.value=``;let e=j.hosts.filter(e=>e.state===`connected`);try{let t=await Promise.allSettled(e.map(e=>{let t=P.value.trim()?`?q=${encodeURIComponent(P.value.trim())}`:``;return j.api(`/hosts/${encodeURIComponent(e.id)}/archived-workspaces${t}`)})),n=[];for(let e of t)e.status===`fulfilled`&&Array.isArray(e.value)&&n.push(...e.value);n.sort((e,t)=>Date.parse(t.archivedAt)-Date.parse(e.archivedAt)),F.value=n}catch(e){L.value=e.message||`Could not load archived workspaces.`}finally{I.value=!1}}async function V(e){if(!e.workspaceId)return;let t=`${e.hostId}:${e.workspaceId}`;R.value=t,L.value=``;try{await j.api(`/hosts/${encodeURIComponent(e.hostId)}/workspaces/${encodeURIComponent(e.workspaceId)}/restore`,`POST`,{}),F.value=F.value.filter(t=>t.hostId!==e.hostId||t.workspaceId!==e.workspaceId),M(`restored`,e.hostId,e.workspaceId)}catch(e){L.value=e.message||`Could not restore workspace.`}finally{R.value=null}}function H(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<90?`just now`:t<3600?Math.round(t/60)+`m ago`:t<86400?Math.round(t/3600)+`h ago`:Math.round(t/86400)+`d ago`}return n(()=>void B()),(n,d)=>(h(),m(`div`,{class:`overlay`,onMousedown:d[2]||=s(e=>M(`close`),[`self`])},[u(`section`,{ref_key:`sheet`,ref:N,class:`sheet archived-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Archived workspaces`,tabindex:`-1`},[u(`header`,y,[d[3]||=u(`h2`,null,`Archived workspaces`,-1),u(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:d[0]||=e=>M(`close`)},[e(v,{name:`close`,size:16})])]),u(`div`,b,[u(`form`,{onSubmit:s(B,[`prevent`])},[r(u(`input`,{"onUpdate:modelValue":d[1]||=e=>P.value=e,type:`search`,placeholder:`Search archived workspaces…`,"aria-label":`Search archived workspaces`},null,512),[[o,P.value]]),u(`button`,{type:`submit`,class:`btn btn-sm btn-outline`,disabled:I.value},c(I.value?`Loading…`:`Search`),9,x)],32)]),L.value?(h(),m(`p`,S,c(L.value),1)):p(``,!0),u(`div`,C,[I.value&&!F.value.length?(h(),m(`p`,w,[...d[4]||=[u(`span`,{class:`spinner spinner-sm`},null,-1),i(` Loading archived workspaces…`,-1)]])):F.value.length?p(``,!0):(h(),m(`p`,T,`No archived workspaces found.`)),(h(!0),m(l,null,t(F.value,t=>(h(),m(`div`,{key:t.hostId+`:`+(t.workspaceId||t.id),class:`archived-row`},[e(g,{provider:t.provider},null,8,[`provider`]),u(`div`,E,[u(`div`,D,c(t.name),1),u(`div`,O,[i(c(t.project)+` `,1),a.hosts.length>1?(h(),m(l,{key:0},[i(` · `+c(z.value.get(t.hostId)||t.hostId),1)],64)):p(``,!0),i(` · archived `+c(H(t.archivedAt)),1)])]),t.workspaceId?(h(),m(`button`,{key:0,type:`button`,class:`btn btn-sm btn-outline`,disabled:R.value===t.hostId+`:`+t.workspaceId,onClick:e=>V(t)},[e(v,{name:`undo`,size:13}),i(c(R.value===t.hostId+`:`+t.workspaceId?`Restoring…`:`Restore`),1)],8,k)):p(``,!0)]))),128))])],512)],32))}});export{A as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as e,H as t,L as n,Q as r,S as i,T as a,Y as o,c as s,ct as c,d as l,dt as u,f as d,g as f,h as ee,it as p,u as te,v as m,y as h,z as g}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{_,
|
|
2
|
-
`)),H.value=[]}let $=ee(()=>{let e=F.value;if(!e||!e.pr)return null;let t=Array.isArray(e.checks)?e.checks:[],n=t.filter(e=>e.conclusion===`failure`||e.state===`failure`).length,r=t.filter(e=>e.status===`in_progress`||e.status===`queued`||e.state===`pending`).length,i=t.length-n-r;return{pr:e.pr,checksCount:t.length,failed:n,pending:r,passed:i}});return o(()=>[y.hostId,y.cwd],()=>{T.value=[],M.value=[],P.value={},H.value=[],F.value=null,K(),q()},{immediate:!0}),o(x,()=>{b.value===`diff`&&K()}),o(b,e=>{e===`commits`&&!M.value.length&&J()}),(n,a)=>(g(),h(`section`,ne,[f(`div`,re,[f(`div`,ie,[f(`button`,{type:`button`,role:`tab`,"aria-selected":b.value===`diff`,class:c({chosen:b.value===`diff`}),onClick:a[0]||=e=>b.value=`diff`},`Diff`,10,ae),f(`button`,{type:`button`,role:`tab`,"aria-selected":b.value===`commits`,class:c({chosen:b.value===`commits`}),onClick:a[1]||=e=>b.value=`commits`},`Commits`,10,oe)]),b.value===`diff`?(g(),h(`div`,se,[f(`button`,{type:`button`,class:c({chosen:x.value===`uncommitted`}),onClick:a[2]||=e=>x.value=`uncommitted`},`Uncommitted`,2),f(`button`,{type:`button`,class:c({chosen:x.value===`base`}),onClick:a[3]||=e=>x.value=`base`},`vs `+u(S.value||`Base`),3)])):m(``,!0),f(`button`,{type:`button`,class:`icon-btn`,disabled:O.value||N.value,title:`Refresh`,"aria-label":`Refresh changes`,onClick:a[4]||=e=>{b.value===`diff`?K():J(),q()}},[e(
|
|
1
|
+
import{C as e,H as t,L as n,Q as r,S as i,T as a,Y as o,c as s,ct as c,d as l,dt as u,f as d,g as f,h as ee,it as p,u as te,v as m,y as h,z as g}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{g as _,y as v}from"./index-Ce8bdxwG.js";var ne={class:`changes-panel`},re={class:`changes-top`},ie={class:`segmented segmented-sm`,role:`tablist`},ae=[`aria-selected`],oe=[`aria-selected`],se={key:0,class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Compare mode`},ce=[`disabled`],le={key:0,class:`base-bar`},ue=[`onKeydown`],de={class:`row-sub`},fe={key:1,class:`pr-bar`},pe=[`href`],me={class:`pr-title`},he={class:`git-actions`},ge=[`disabled`],_e=[`disabled`],ve=[`disabled`],ye=[`disabled`],be={class:`form-actions`},xe=[`disabled`],Se=[`disabled`],Ce=[`disabled`],we={class:`form-actions`},Te=[`disabled`],Ee={key:4,class:`setting-note`,role:`status`},De={key:5,class:`setting-note is-error`,role:`alert`},Oe={key:6,class:`review-tray`,role:`region`,"aria-label":`Pending review comments`},ke={class:`review-tray-head`},Ae={class:`grow`},je=[`onClick`],Me={key:0,class:`row-sub`},Ne={key:1,class:`row-sub`},Pe=[`onToggle`],Fe={class:`file-sum-path`},Ie={class:`file-sum-stat`},Le={class:`stat-add`},Re={class:`stat-del`},ze={class:`file-bar`},Be=[`onClick`],Ve=[`onClick`],He=[`onSubmit`],Ue={class:`form-actions`},We=[`disabled`],Ge={key:1,class:`row-sub`},Ke={key:2,class:`row-sub`},qe={class:`hunk`},Je=[`onClick`],Ye={class:`diff-code`},Xe=[`onSubmit`],Ze={class:`form-actions`},Qe=[`disabled`],$e={key:0,class:`row-sub`},et={key:1,class:`row-sub`},tt={class:`commit-sha`},nt={class:`commit-subj`},rt={key:0,class:`hs-tag`},it={class:`row-sub`},at=[`onToggle`],ot={class:`file-sum-stat`},st={class:`stat-add`},ct={class:`stat-del`},lt={key:0,class:`row-sub`},ut={key:1,class:`setting-note is-error`},dt={class:`hunk`},y=_(a({__name:`ChangesPanel`,props:{hostId:{},cwd:{},workspaceId:{},api:{type:Function}},emits:[`sendReview`],setup(a,{emit:_}){let y=a,ft=_,b=p(`diff`),x=p(`uncommitted`),S=p(``),C=p(!1),w=p(``),T=p([]),E=p(``),D=p(``),O=p(!1),k=p(!1),A=0,j=p(new Set),M=p([]),N=p(!1),P=p({}),F=p(null),I=p(!1),L=p(!1),R=p(``),z=p(!1),B=p(``),V=p(``),H=p([]),U=p(null),W=p(``),pt=0;n(()=>A++);let G=()=>`/hosts/${encodeURIComponent(y.hostId)}`;async function K(){let e=++A;O.value=!0,E.value=``,T.value=[],k.value=!1,j.value=new Set;try{let t=new URLSearchParams({cwd:y.cwd,mode:x.value});x.value===`base`&&S.value.trim()&&t.set(`baseRef`,S.value.trim());let n=await y.api(`${G()}/changes?${t}`);if(e!==A)return;T.value=n.files??[],k.value=!!n.diffTooLarge,n.baseRef&&!S.value&&(S.value=n.baseRef)}catch(t){e===A&&(E.value=t.message)}finally{e===A&&(O.value=!1)}}async function q(){try{F.value=await y.api(`${G()}/git/pr-status?cwd=${encodeURIComponent(y.cwd)}`)}catch{F.value=null}}async function J(){N.value=!0,E.value=``;try{let e=await y.api(`${G()}/git/commits?cwd=${encodeURIComponent(y.cwd)}`);M.value=e.commits??[],e.baseRef&&!S.value&&(S.value=e.baseRef)}catch(e){E.value=e.message}finally{N.value=!1}}async function mt(e,t){let n=`${e}:${t}`;if(!P.value[n])try{let r=await y.api(`${G()}/git/commit-diff?cwd=${encodeURIComponent(y.cwd)}&sha=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);P.value[n]=r.file??{status:`empty`,hunks:[]}}catch(e){P.value[n]={error:e.message}}}async function Y(){let e=w.value.trim();if(e){if(C.value=!1,S.value=e,y.workspaceId)try{await y.api(`${G()}/workspaces/${encodeURIComponent(y.workspaceId)}/base-branch`,`POST`,{baseRef:e})}catch{}x.value===`base`&&K()}}async function ht(){I.value=!0,E.value=D.value=``;try{await y.api(`${G()}/git/commit`,`POST`,{cwd:y.cwd,message:R.value.trim()||void 0,addAll:!0},6e4),R.value=``,L.value=!1,D.value=`Committed changes.`,await Promise.all([K(),q(),b.value===`commits`?J():Promise.resolve()])}catch(e){E.value=e.message}finally{I.value=!1}}async function X(){I.value=!0,E.value=D.value=``;try{await y.api(`${G()}/git/push`,`POST`,{cwd:y.cwd},6e4),D.value=`Pushed to remote.`,await q()}catch(e){E.value=e.message}finally{I.value=!1}}async function gt(){I.value=!0,E.value=D.value=``;try{let e=await y.api(`${G()}/git/pr`,`POST`,{cwd:y.cwd,title:B.value.trim()||void 0,body:V.value.trim()||void 0,baseRef:S.value.trim()||void 0},6e4);z.value=!1,B.value=V.value=``,D.value=e.url?`PR created: ${e.url}`:`PR created.`,await q()}catch(e){E.value=e.message}finally{I.value=!1}}async function _t(e){try{await navigator.clipboard.writeText(e)}catch{E.value=`Could not copy path.`}}function Z(e,t){let n=`${e}::${t}`;U.value===n?U.value=null:(U.value=n,W.value=``)}function Q(e,t){let n=W.value.trim();n&&(H.value.push({id:`c-${++pt}`,path:e,line:t,text:n}),W.value=``,U.value=null)}function vt(e){H.value=H.value.filter(t=>t.id!==e)}function yt(){if(!H.value.length)return;let e=[`Please address the following code review comments:`,``,...H.value.map((e,t)=>`${t+1}. \`${e.path}\` (${e.line}): ${e.text}`)];ft(`sendReview`,e.join(`
|
|
2
|
+
`)),H.value=[]}let $=ee(()=>{let e=F.value;if(!e||!e.pr)return null;let t=Array.isArray(e.checks)?e.checks:[],n=t.filter(e=>e.conclusion===`failure`||e.state===`failure`).length,r=t.filter(e=>e.status===`in_progress`||e.status===`queued`||e.state===`pending`).length,i=t.length-n-r;return{pr:e.pr,checksCount:t.length,failed:n,pending:r,passed:i}});return o(()=>[y.hostId,y.cwd],()=>{T.value=[],M.value=[],P.value={},H.value=[],F.value=null,K(),q()},{immediate:!0}),o(x,()=>{b.value===`diff`&&K()}),o(b,e=>{e===`commits`&&!M.value.length&&J()}),(n,a)=>(g(),h(`section`,ne,[f(`div`,re,[f(`div`,ie,[f(`button`,{type:`button`,role:`tab`,"aria-selected":b.value===`diff`,class:c({chosen:b.value===`diff`}),onClick:a[0]||=e=>b.value=`diff`},`Diff`,10,ae),f(`button`,{type:`button`,role:`tab`,"aria-selected":b.value===`commits`,class:c({chosen:b.value===`commits`}),onClick:a[1]||=e=>b.value=`commits`},`Commits`,10,oe)]),b.value===`diff`?(g(),h(`div`,se,[f(`button`,{type:`button`,class:c({chosen:x.value===`uncommitted`}),onClick:a[2]||=e=>x.value=`uncommitted`},`Uncommitted`,2),f(`button`,{type:`button`,class:c({chosen:x.value===`base`}),onClick:a[3]||=e=>x.value=`base`},`vs `+u(S.value||`Base`),3)])):m(``,!0),f(`button`,{type:`button`,class:`icon-btn`,disabled:O.value||N.value,title:`Refresh`,"aria-label":`Refresh changes`,onClick:a[4]||=e=>{b.value===`diff`?K():J(),q()}},[e(v,{name:`refresh`,size:14})],8,ce)]),b.value===`diff`&&x.value===`base`?(g(),h(`div`,le,[C.value?(g(),h(d,{key:0},[r(f(`input`,{"onUpdate:modelValue":a[5]||=e=>w.value=e,placeholder:`main`,"aria-label":`Base branch`,onKeydown:te(l(Y,[`prevent`]),[`enter`])},null,40,ue),[[s,w.value]]),f(`button`,{type:`button`,class:`btn btn-sm btn-primary`,onClick:Y},`Set`),f(`button`,{type:`button`,class:`btn btn-sm btn-ghost`,onClick:a[6]||=e=>C.value=!1},`Cancel`)],64)):(g(),h(d,{key:1},[f(`span`,de,[a[19]||=i(`Base: `,-1),f(`code`,null,u(S.value||`default`),1)]),f(`button`,{type:`button`,class:`link-btn`,onClick:a[7]||=e=>{w.value=S.value,C.value=!0}},`Change base`)],64))])):m(``,!0),$.value?(g(),h(`div`,fe,[f(`a`,{href:$.value.pr.url,target:`_blank`,rel:`noopener noreferrer`,class:`pr-link`},[e(v,{name:`branch`,size:13}),f(`strong`,null,`#`+u($.value.pr.number),1),f(`span`,me,u($.value.pr.title),1),e(v,{name:`external`,size:12})],8,pe),$.value.checksCount?(g(),h(`span`,{key:0,class:c([`pr-checks`,$.value.failed?`is-danger`:$.value.pending?`is-warn`:`is-ok`])},u($.value.failed?`${$.value.failed} failed`:$.value.pending?`${$.value.pending} running`:`${$.value.passed} passed`),3)):m(``,!0)])):m(``,!0),f(`div`,he,[f(`button`,{type:`button`,class:`btn btn-sm btn-outline`,disabled:I.value,onClick:a[8]||=e=>{L.value=!L.value,z.value=!1}},`Commit`,8,ge),f(`button`,{type:`button`,class:`btn btn-sm btn-outline`,disabled:I.value,onClick:X},u(I.value?`Working…`:`Push`),9,_e),$.value?m(``,!0):(g(),h(`button`,{key:0,type:`button`,class:`btn btn-sm btn-outline`,disabled:I.value,onClick:a[9]||=e=>{z.value=!z.value,L.value=!1}},`Create PR`,8,ve))]),L.value?(g(),h(`form`,{key:2,class:`git-form`,onSubmit:l(ht,[`prevent`])},[r(f(`textarea`,{"onUpdate:modelValue":a[10]||=e=>R.value=e,rows:`2`,placeholder:`Commit message (leave blank to auto-generate)`,disabled:I.value},null,8,ye),[[s,R.value]]),f(`div`,be,[f(`button`,{type:`button`,class:`btn btn-sm btn-ghost`,onClick:a[11]||=e=>L.value=!1},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-sm btn-primary`,disabled:I.value},u(I.value?`Committing…`:`Commit all`),9,xe)])],32)):m(``,!0),z.value?(g(),h(`form`,{key:3,class:`git-form`,onSubmit:l(gt,[`prevent`])},[r(f(`input`,{"onUpdate:modelValue":a[12]||=e=>B.value=e,placeholder:`PR title (leave blank to auto-generate)`,disabled:I.value},null,8,Se),[[s,B.value]]),r(f(`textarea`,{"onUpdate:modelValue":a[13]||=e=>V.value=e,rows:`2`,placeholder:`PR description (optional)`,disabled:I.value},null,8,Ce),[[s,V.value]]),f(`div`,we,[f(`button`,{type:`button`,class:`btn btn-sm btn-ghost`,onClick:a[14]||=e=>z.value=!1},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-sm btn-primary`,disabled:I.value},u(I.value?`Creating…`:`Create PR`),9,Te)])],32)):m(``,!0),D.value?(g(),h(`p`,Ee,u(D.value),1)):m(``,!0),E.value?(g(),h(`p`,De,u(E.value),1)):m(``,!0),H.value.length?(g(),h(`div`,Oe,[f(`div`,ke,[f(`strong`,null,u(H.value.length)+` review `+u(H.value.length===1?`comment`:`comments`),1),f(`button`,{type:`button`,class:`btn btn-sm btn-primary`,onClick:yt},`Send to agent`)]),(g(!0),h(d,null,t(H.value,t=>(g(),h(`div`,{key:t.id,class:`review-chip`},[f(`span`,Ae,[f(`code`,null,u(t.path)+`:`+u(t.line),1),i(` — `+u(t.text),1)]),f(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Remove comment`,onClick:e=>vt(t.id)},[e(v,{name:`close`,size:12})],8,je)]))),128))])):m(``,!0),b.value===`diff`?(g(),h(d,{key:7},[k.value?(g(),h(`p`,Me,`Diff exceeds the host limit; some changes are omitted.`)):m(``,!0),!O.value&&!E.value&&!T.value.length?(g(),h(`p`,Ne,`No `+u(x.value===`uncommitted`?`uncommitted `:``)+`changes.`,1)):m(``,!0),(g(!0),h(d,null,t(T.value,e=>(g(),h(`details`,{key:e.path,onToggle:t=>t.target.open?j.value.add(e.path):j.value.delete(e.path)},[f(`summary`,null,[f(`span`,Fe,u(e.oldPath?e.oldPath+` → `:``)+u(e.path),1),f(`span`,Ie,[f(`em`,Le,`+`+u(e.additions),1),a[20]||=i(),f(`em`,Re,`−`+u(e.deletions),1)])]),f(`div`,ze,[f(`button`,{type:`button`,class:`link-btn`,onClick:t=>_t(e.path)},`Copy path`,8,Be),f(`button`,{type:`button`,class:`link-btn`,onClick:t=>Z(e.path,`file`)},`+ Comment on file`,8,Ve)]),U.value===e.path+`::file`?(g(),h(`form`,{key:0,class:`review-form`,onSubmit:l(t=>Q(e.path,`file`),[`prevent`])},[r(f(`textarea`,{"onUpdate:modelValue":a[15]||=e=>W.value=e,rows:`2`,placeholder:`Write review comment for this file…`},null,512),[[s,W.value]]),f(`div`,Ue,[f(`button`,{type:`button`,class:`btn btn-sm btn-ghost`,onClick:a[16]||=e=>U.value=null},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-sm btn-primary`,disabled:!W.value.trim()},`Add comment`,8,We)])],40,He)):m(``,!0),e.status===`binary`?(g(),h(`p`,Ge,`Binary file changed.`)):e.status===`too_large`?(g(),h(`p`,Ke,`File diff is too large to display.`)):m(``,!0),j.value.has(e.path)?(g(!0),h(d,{key:3},t(e.hunks,(n,i)=>(g(),h(`div`,{key:i,class:`diff-hunk-block`},[f(`div`,qe,`@@ −`+u(n.oldStart)+`,`+u(n.oldCount)+` +`+u(n.newStart)+`,`+u(n.newCount)+` @@`,1),(g(!0),h(d,null,t(n.lines,(t,i)=>(g(),h(d,{key:i},[f(`div`,{class:c([`diff-line`,t.type])},[f(`button`,{type:`button`,class:`diff-comment-btn`,title:`Add review comment on this line`,"aria-label":`Add review comment`,onClick:r=>Z(e.path,`L${t.newLineNumber??t.oldLineNumber??n.newStart+i}`)},`+`,8,Je),f(`span`,Ye,u(t.type===`add`?`+`:t.type===`remove`?`−`:` `)+u(t.content),1)],2),U.value===`${e.path}::L${t.newLineNumber??t.oldLineNumber??n.newStart+i}`?(g(),h(`form`,{key:0,class:`review-form`,onSubmit:l(r=>Q(e.path,`L${t.newLineNumber??t.oldLineNumber??n.newStart+i}`),[`prevent`])},[r(f(`textarea`,{"onUpdate:modelValue":a[17]||=e=>W.value=e,rows:`2`,placeholder:`Write review comment on this line…`},null,512),[[s,W.value]]),f(`div`,Ze,[f(`button`,{type:`button`,class:`btn btn-sm btn-ghost`,onClick:a[18]||=e=>U.value=null},`Cancel`),f(`button`,{type:`submit`,class:`btn btn-sm btn-primary`,disabled:!W.value.trim()},`Add comment`,8,Qe)])],40,Xe)):m(``,!0)],64))),128))]))),128)):m(``,!0)],40,Pe))),128))],64)):(g(),h(d,{key:8},[N.value&&!M.value.length?(g(),h(`p`,$e,`Loading commits…`)):M.value.length?m(``,!0):(g(),h(`p`,et,`No commits found.`)),(g(!0),h(d,null,t(M.value,e=>(g(),h(`details`,{key:e.sha,class:`commit-item`},[f(`summary`,null,[f(`code`,tt,u(e.shortSha),1),f(`span`,nt,u(e.subject),1),e.isOnRemote?m(``,!0):(g(),h(`span`,rt,`unpushed`))]),f(`p`,it,u(e.authorName)+` · `+u(new Date(e.authorDate).toLocaleString()),1),(g(!0),h(d,null,t(e.files??[],n=>(g(),h(`details`,{key:n.path,class:`commit-file`,onToggle:t=>t.target.open&&mt(e.sha,n.path)},[f(`summary`,null,[i(u(n.path)+` `,1),f(`span`,ot,[f(`em`,st,`+`+u(n.additions??0),1),a[21]||=i(),f(`em`,ct,`−`+u(n.deletions??0),1)])]),P.value[e.sha+`:`+n.path]?P.value[e.sha+`:`+n.path].error?(g(),h(`p`,ut,u(P.value[e.sha+`:`+n.path].error),1)):(g(!0),h(d,{key:2},t(P.value[e.sha+`:`+n.path].hunks??[],(e,n)=>(g(),h(`pre`,{key:n},[f(`code`,null,[f(`span`,dt,`@@ −`+u(e.oldStart)+`,`+u(e.oldCount)+` +`+u(e.newStart)+`,`+u(e.newCount)+` @@
|
|
3
3
|
`,1),(g(!0),h(d,null,t(e.lines,(e,t)=>(g(),h(`span`,{key:t,class:c(e.type)},u(e.type===`add`?`+`:e.type===`remove`?`−`:` `)+u(e.content),3))),128))])]))),128)):(g(),h(`p`,lt,`Loading diff…`))],40,at))),128))]))),128))],64))]))}}),[[`__scopeId`,`data-v-c13449c7`]]);export{y as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{C as e,E as t,I as n,L as r,M as i,P as a,Q as o,T as s,U as c,Y as l,Z as u,_ as d,at as f,b as p,ct as ee,d as m,dt as te,g as h,h as g,it as _,k as ne,l as re,m as v,q as ie,st as ae,ut as oe,v as se,y as ce,z as le}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{E as ue,G as de,U as fe,W as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,c as be,d as xe,et as Se,ft as Ce,g as we,it as Te,lt as Ee,n as De,nt as Oe,ot as ke,rt as Ae,ut as je,v as Me,w as Ne,x as Pe}from"./MarkdownMessage-DFHG7pFf.js";import{n as Fe,r as Ie,t as Le}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-BLqoijIq.js";import{n as Re,t as y}from"./safeRaf-BDp3SJMs.js";import{a as ze}from"./index-Db0xL9aq.js";var b=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Be=!1,Ve=null,He=null,Ue=null;function We(){return b(this,null,function*(){if(Ue)return Ue;Ue=b(null,null,function*(){if(!He)try{if(He=function(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),detectLanguage:(n?.detectLanguage)?.bind(n),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}(yield ze(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!He)return null}catch{return null}try{return yield function(e){return b(this,null,function*(){if(!Be)return Ve||(Ve=b(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Be=!0}).finally(()=>{Ve=null}),Ve)})}(He),pe(),He}catch{return null}});try{return yield Ue}finally{Ue=null}})}var Ge=Object.defineProperty,Ke=Object.defineProperties,x=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||={})qe.call(t,n)&&Je(e,n,t[n]);if(S)for(var n of S(t))C.call(t,n)&&Je(e,n,t[n]);return e},Ye=(e,t)=>Ke(e,x(t)),T=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),E={class:`html-preview-frame__header`},Xe={class:`html-preview-frame__title`},D={class:`html-preview-frame__label`},O=[`sandbox`,`srcdoc`],Ze=Me(s({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:i}=Pe(),a=g(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?`#020617`:`#ffffff`};\n color: ${t.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),o=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function s(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return n(()=>{typeof window<`u`&&window.addEventListener(`keydown`,s)}),r(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,s)}),(e,n)=>(le(),d(v,{to:`body`},[h(`div`,{class:ee([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:n[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:n[1]||=m(()=>{},[`stop`])},[h(`div`,E,[h(`div`,Xe,[n[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,D,te(t.title||ae(i)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:n[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:o.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,O)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Qe=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],$e={class:`code-header-main`},et=[`innerHTML`],tt={class:`code-header-copy`},nt={class:`code-header-title`},rt={key:0,class:`code-header-caption`},it=[`data-markstream-host-hidden`],k=Me(s({__name:`CodeBlockNode`,props:{node:{},codeBlockOptions:{},clipboardWriter:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(s,{emit:m}){let v=s,pe=m,Me=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),ze=ie(),b=ne(me,null),Be=ne(`markstreamHostScrollManaged`,null),Ve=ne(we,void 0),He=g(()=>be(v,ze)),Ue=t(),Ge=g(()=>{let e=Ue?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Ke}=Pe(),x=_(null),S=_(null),qe=_(!1),C=_(Hr(v.node.language,v.node.code,Vr())),Je=g(()=>ge(C.value)),E=g(()=>Je.value===`plaintext`?`text`:Je.value),Xe=g(()=>Je.value===`plaintext`),D=_(!1),O=_(!1),k=_(!1),A=_(!1),j=_(!1),at=_(!1),M=!1,ot=!1,st=null,ct=null,lt=null,ut=0,dt=!1,ft=``,pt=_(null),mt=0,ht=!1,gt=De(),_t=ue(),vt=xe(),yt=f(null),N=_(typeof window>`u`||!vt.value),bt=t()?.vnode.el?.textContent??``,xt=typeof window<`u`&&String(v.node.code??``).length>0&&bt.includes(String(v.node.code)),St=_(!xt);n(()=>{St.value=!0}),typeof window<`u`&&l([()=>S.value,vt],([e,t],n,r)=>{var i;if((i=yt.value)==null||i.destroy(),yt.value=null,!t||N.value)return void(N.value=!0);if(!e)return void(N.value=!1);let a=!0,o=_t?.value.heavyBlockMargin??_t?.value.rootMargin??`0px`,s=gt(e,{rootMargin:o,allowIdle:!1});yt.value=s,N.value=N.value||s.isVisible.value,s.whenVisible.then(()=>{a&&yt.value===s&&(N.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),yt.value===s&&(yt.value=null)})},{immediate:!0}),a(()=>{var e;M=!0,function(){let e=ft;b&&e&&(ft=``,b.markSettled(e))}(),(e=yt.value)==null||e.destroy(),yt.value=null});let P=null,Ct=null,wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>{},Ot=()=>null,F=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),kt=()=>{},At=()=>{},jt=()=>{},Mt=null,L=null,Nt=null,Pt=null,Ft=()=>String(v.node.language??`plaintext`),It=()=>T(null,null,function*(){}),Lt=!1,Rt=null,zt=[],Bt=[],R=null,Vt=null,z=g(()=>Ae(v.node)),Ht=_({removed:0,added:0}),Ut=g(()=>`-${Ht.value.removed} +${Ht.value.added}`);function Wt(e,t){return{original:e,updated:t}}function Gt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function Kt(e){return String(e?.message??e).includes(`no diff result available`)}function qt(){if(!$())try{let e=jt();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=w({},v.codeBlockOptions||{});for(let t of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`,`maxHeight`,`padding`,`tabSize`])delete e[t];if(!z.value)return e;let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n={diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return Ye(w(w({},n),e),{parseDiffOptions:w(w({},n.parseDiffOptions),t)})}),Yt=g(()=>{return(v.theme===void 0?!fi(v.darkTheme,v.lightTheme):(e=v.theme)&&typeof e==`object`&&`light`in e&&`dark`in e)?!!v.isDark:function(e){let t=di(e)??``;return Te(t,!0===v.isDark)}(pi());var e}),Xt=g(()=>(z.value,Yt.value?`dark`:`light`)),Zt=g(()=>z.value?Xt.value===`dark`:Yt.value),B=g(()=>je({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=_(Qt.value),V=_(!1),H=_(!1),en=_(!1),U=_(!1),tn=_(null),nn=_(0),rn=_(0),an=_(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>ke(Jt.value));function fn(e){return!0===Be?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let pn=g(()=>fn(S.value)),mn=g(()=>!(V.value||!U.value&&H.value)),hn=g(()=>mn.value),gn=g(()=>mn.value&&!en.value),_n=g(()=>!V.value&&!U.value&&mn.value),vn=g(()=>H.value&&!V.value?`ready`:U.value?`fallback`:`pending`),yn=_(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:Ye(w({},v.node),{diff:!0}):W.value===v.node.code?v.node:Ye(w({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Ft=t),Vt=e,R=gi();let n=e.createCodeBlockRuntime(R);return!!n&&(P=n.createEditor||P,Ct=n.createDiffEditor||Ct,wt=n.updateCode||wt,Tt=n.updateDiff||Tt,Et=n.finalizeCode||Et,Dt=n.finalizeDiff||Dt,Ot=n.getEditor||Ot,F=n.getEditorView||F,I=n.getDiffEditorView||I,kt=n.cleanupEditor||kt,At=n.safeClean||n.cleanupEditor||At,jt=n.refreshDiffPresentation||jt,It=n.setTheme||It,Mt=n.whenVisualReady||null,at.value=!0,!0)}let G=_(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=_(G.value),Sn=_(null),Cn=_(null),wn=_(null),Tn=_(null),En=g(()=>{let e=G.value,t=K.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),Dn=g(()=>{let e=v.codeBlockOptions?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=K.value;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:12}),On=g(()=>{let e=v.codeBlockOptions?.lineHeight;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Dn.value===12?18:Math.max(12,Math.round(1.5*Dn.value))}),kn=g(()=>On.value),An=g(()=>{let e=v.codeBlockOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),jn=g(()=>{let e=v.codeBlockOptions?.padding,t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:8;return{top:t,bottom:t}}),Mn=g(()=>Ye(w({},Ce(v.codeBlockOptions)),{fontSize:Dn.value,lineHeight:kn.value,maxHeight:zr(),padding:jn.value.top,paddingBottom:jn.value.bottom,tabSize:An.value})),Nn=g(()=>{let e=v.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Pn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(zr()))}function Fn(){return!z.value&&!1!==v.stream&&!1!==v.loading}let In=_(Fn());function Ln(){return Fn()||In.value}let Rn=g(()=>z.value?null:Nn.value==null||Ln()?Math.ceil((e=>{let t=String(e??``);if(!t)return 1;let n=1;for(let e=0;e<t.length;e++)t[e]===`
|
|
1
|
+
import{C as e,E as t,I as n,L as r,M as i,P as a,Q as o,T as s,U as c,Y as l,Z as u,_ as d,at as f,b as p,ct as ee,d as m,dt as te,g as h,h as g,it as _,k as ne,l as re,m as v,q as ie,st as ae,ut as oe,v as se,y as ce,z as le}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{E as ue,G as de,U as fe,W as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,c as be,d as xe,et as Se,ft as Ce,g as we,it as Te,lt as Ee,n as De,nt as Oe,ot as ke,rt as Ae,ut as je,v as Me,w as Ne,x as Pe}from"./MarkdownMessage-Cz2a-heW.js";import{n as Fe,r as Ie,t as Le}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-B4p5wP0S.js";import{n as Re,t as y}from"./safeRaf-BDp3SJMs.js";import{a as ze}from"./index-Ce8bdxwG.js";var b=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Be=!1,Ve=null,He=null,Ue=null;function We(){return b(this,null,function*(){if(Ue)return Ue;Ue=b(null,null,function*(){if(!He)try{if(He=function(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),detectLanguage:(n?.detectLanguage)?.bind(n),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}(yield ze(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!He)return null}catch{return null}try{return yield function(e){return b(this,null,function*(){if(!Be)return Ve||(Ve=b(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Be=!0}).finally(()=>{Ve=null}),Ve)})}(He),pe(),He}catch{return null}});try{return yield Ue}finally{Ue=null}})}var Ge=Object.defineProperty,Ke=Object.defineProperties,x=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||={})qe.call(t,n)&&Je(e,n,t[n]);if(S)for(var n of S(t))C.call(t,n)&&Je(e,n,t[n]);return e},Ye=(e,t)=>Ke(e,x(t)),T=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),E={class:`html-preview-frame__header`},Xe={class:`html-preview-frame__title`},D={class:`html-preview-frame__label`},O=[`sandbox`,`srcdoc`],Ze=Me(s({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:i}=Pe(),a=g(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?`#020617`:`#ffffff`};\n color: ${t.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),o=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function s(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return n(()=>{typeof window<`u`&&window.addEventListener(`keydown`,s)}),r(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,s)}),(e,n)=>(le(),d(v,{to:`body`},[h(`div`,{class:ee([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:n[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:n[1]||=m(()=>{},[`stop`])},[h(`div`,E,[h(`div`,Xe,[n[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,D,te(t.title||ae(i)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:n[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:o.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,O)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Qe=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],$e={class:`code-header-main`},et=[`innerHTML`],tt={class:`code-header-copy`},nt={class:`code-header-title`},rt={key:0,class:`code-header-caption`},it=[`data-markstream-host-hidden`],k=Me(s({__name:`CodeBlockNode`,props:{node:{},codeBlockOptions:{},clipboardWriter:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(s,{emit:m}){let v=s,pe=m,Me=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),ze=ie(),b=ne(me,null),Be=ne(`markstreamHostScrollManaged`,null),Ve=ne(we,void 0),He=g(()=>be(v,ze)),Ue=t(),Ge=g(()=>{let e=Ue?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Ke}=Pe(),x=_(null),S=_(null),qe=_(!1),C=_(Hr(v.node.language,v.node.code,Vr())),Je=g(()=>ge(C.value)),E=g(()=>Je.value===`plaintext`?`text`:Je.value),Xe=g(()=>Je.value===`plaintext`),D=_(!1),O=_(!1),k=_(!1),A=_(!1),j=_(!1),at=_(!1),M=!1,ot=!1,st=null,ct=null,lt=null,ut=0,dt=!1,ft=``,pt=_(null),mt=0,ht=!1,gt=De(),_t=ue(),vt=xe(),yt=f(null),N=_(typeof window>`u`||!vt.value),bt=t()?.vnode.el?.textContent??``,xt=typeof window<`u`&&String(v.node.code??``).length>0&&bt.includes(String(v.node.code)),St=_(!xt);n(()=>{St.value=!0}),typeof window<`u`&&l([()=>S.value,vt],([e,t],n,r)=>{var i;if((i=yt.value)==null||i.destroy(),yt.value=null,!t||N.value)return void(N.value=!0);if(!e)return void(N.value=!1);let a=!0,o=_t?.value.heavyBlockMargin??_t?.value.rootMargin??`0px`,s=gt(e,{rootMargin:o,allowIdle:!1});yt.value=s,N.value=N.value||s.isVisible.value,s.whenVisible.then(()=>{a&&yt.value===s&&(N.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),yt.value===s&&(yt.value=null)})},{immediate:!0}),a(()=>{var e;M=!0,function(){let e=ft;b&&e&&(ft=``,b.markSettled(e))}(),(e=yt.value)==null||e.destroy(),yt.value=null});let P=null,Ct=null,wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>{},Ot=()=>null,F=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),kt=()=>{},At=()=>{},jt=()=>{},Mt=null,L=null,Nt=null,Pt=null,Ft=()=>String(v.node.language??`plaintext`),It=()=>T(null,null,function*(){}),Lt=!1,Rt=null,zt=[],Bt=[],R=null,Vt=null,z=g(()=>Ae(v.node)),Ht=_({removed:0,added:0}),Ut=g(()=>`-${Ht.value.removed} +${Ht.value.added}`);function Wt(e,t){return{original:e,updated:t}}function Gt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function Kt(e){return String(e?.message??e).includes(`no diff result available`)}function qt(){if(!$())try{let e=jt();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=w({},v.codeBlockOptions||{});for(let t of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`,`maxHeight`,`padding`,`tabSize`])delete e[t];if(!z.value)return e;let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n={diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return Ye(w(w({},n),e),{parseDiffOptions:w(w({},n.parseDiffOptions),t)})}),Yt=g(()=>{return(v.theme===void 0?!fi(v.darkTheme,v.lightTheme):(e=v.theme)&&typeof e==`object`&&`light`in e&&`dark`in e)?!!v.isDark:function(e){let t=di(e)??``;return Te(t,!0===v.isDark)}(pi());var e}),Xt=g(()=>(z.value,Yt.value?`dark`:`light`)),Zt=g(()=>z.value?Xt.value===`dark`:Yt.value),B=g(()=>je({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=_(Qt.value),V=_(!1),H=_(!1),en=_(!1),U=_(!1),tn=_(null),nn=_(0),rn=_(0),an=_(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>ke(Jt.value));function fn(e){return!0===Be?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let pn=g(()=>fn(S.value)),mn=g(()=>!(V.value||!U.value&&H.value)),hn=g(()=>mn.value),gn=g(()=>mn.value&&!en.value),_n=g(()=>!V.value&&!U.value&&mn.value),vn=g(()=>H.value&&!V.value?`ready`:U.value?`fallback`:`pending`),yn=_(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:Ye(w({},v.node),{diff:!0}):W.value===v.node.code?v.node:Ye(w({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Ft=t),Vt=e,R=gi();let n=e.createCodeBlockRuntime(R);return!!n&&(P=n.createEditor||P,Ct=n.createDiffEditor||Ct,wt=n.updateCode||wt,Tt=n.updateDiff||Tt,Et=n.finalizeCode||Et,Dt=n.finalizeDiff||Dt,Ot=n.getEditor||Ot,F=n.getEditorView||F,I=n.getDiffEditorView||I,kt=n.cleanupEditor||kt,At=n.safeClean||n.cleanupEditor||At,jt=n.refreshDiffPresentation||jt,It=n.setTheme||It,Mt=n.whenVisualReady||null,at.value=!0,!0)}let G=_(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=_(G.value),Sn=_(null),Cn=_(null),wn=_(null),Tn=_(null),En=g(()=>{let e=G.value,t=K.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),Dn=g(()=>{let e=v.codeBlockOptions?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=K.value;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:12}),On=g(()=>{let e=v.codeBlockOptions?.lineHeight;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Dn.value===12?18:Math.max(12,Math.round(1.5*Dn.value))}),kn=g(()=>On.value),An=g(()=>{let e=v.codeBlockOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),jn=g(()=>{let e=v.codeBlockOptions?.padding,t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:8;return{top:t,bottom:t}}),Mn=g(()=>Ye(w({},Ce(v.codeBlockOptions)),{fontSize:Dn.value,lineHeight:kn.value,maxHeight:zr(),padding:jn.value.top,paddingBottom:jn.value.bottom,tabSize:An.value})),Nn=g(()=>{let e=v.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Pn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(zr()))}function Fn(){return!z.value&&!1!==v.stream&&!1!==v.loading}let In=_(Fn());function Ln(){return Fn()||In.value}let Rn=g(()=>z.value?null:Nn.value==null||Ln()?Math.ceil((e=>{let t=String(e??``);if(!t)return 1;let n=1;for(let e=0;e<t.length;e++)t[e]===`
|
|
2
2
|
`?n++:t[e]===`\r`&&(n++,t[e+1]===`
|
|
3
3
|
`&&e++);return n})(W.value)*kn.value+1):null),zn=g(()=>{if(z.value)return null;let e=Nn.value;return e==null||Ln()?Pn(Rn.value):Pn(e)}),Bn=g(()=>{let e=v.estimatedHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}),Vn=_(null);function Hn(){let e=Vn.value;return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.round(e):null}let Un=g(()=>Hn()??(!z.value&&an.value?null:mn.value||!H.value?zn.value:null));function Wn(e){let t=e?`hsl(152 42% 60%)`:`var(--diff-added-fg)`,n=e?`hsl(0 58% 58%)`:`var(--diff-removed-fg)`,r=e?`color-mix(in lab, #121212 80%, #4d9375)`:`color-mix(in lab, #ffffff 88%, #1e754f)`,i=e?`color-mix(in lab, #121212 80%, #cb7676)`:`color-mix(in lab, #ffffff 88%, #ab5959)`;return{"--markstream-diff-line-number-bg":`var(--markstream-diff-editor-bg)`,"--markstream-diff-added-fg":t,"--markstream-diff-removed-fg":n,"--markstream-diff-added-line":r,"--markstream-diff-removed-line":i,"--markstream-diff-added-line-fill":r,"--markstream-diff-added-number-fill":e?`color-mix(in lab, #121212 85%, #4d9375)`:`color-mix(in lab, #ffffff 91%, #1e754f)`,"--markstream-diff-removed-line-fill":i,"--markstream-diff-removed-number-fill":e?`color-mix(in lab, #121212 85%, #cb7676)`:`color-mix(in lab, #ffffff 91%, #ab5959)`,"--markstream-diff-added-gutter":`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,"--markstream-diff-removed-gutter":`linear-gradient(90deg, ${n} 0 4px, transparent 4px 100%)`,"--markstream-diff-added-inline":e?`hsl(152 42% 60% / 0.28)`:`var(--diff-added-inline-bg)`,"--markstream-diff-removed-inline":e?`hsl(0 58% 58% / 0.28)`:`var(--diff-removed-inline-bg)`}}let Gn=g(()=>{let e=Pn(Nn.value),t=Pn(Rn.value),n=Ln(),r=w({},z.value||e==null||n?z.value||t==null?{}:{minHeight:`${t}px`}:{height:`${e}px`,minHeight:`${e}px`});if(r[`--markstream-code-fallback-bg`]=B.value.background,r[`--markstream-code-fallback-fg`]=B.value.foreground,B.value.builtin&&(r[`--markstream-code-theme-bg`]=B.value.background,r[`--markstream-code-theme-fg`]=B.value.foreground,r[`--markstream-code-theme-line-number`]=B.value.lineNumber),r[`--markstream-pre-line-number-top`]=`${jn.value.top}px`,r[`--markstream-pre-line-number-left`]=`0px`,r[`--markstream-pre-line-number-padding-left`]=`2ch`,r[`--markstream-pre-line-number-padding-right`]=`1ch`,r[`--markstream-pre-line-number-separator-width`]=`2px`,z.value){r[`--markstream-pre-diff-line-height`]=`${kn.value}px`,r[`--markstream-pre-diff-pane-bottom-padding`]=(un.value,`0px`);let e=Tn.value;e!=null&&e>0&&(r.height=`${e}px`,r.minHeight=`${e}px`,r.maxHeight=`${e}px`),Object.assign(r,Wn(Zt.value))}return r}),Kn=g(()=>Un.value!=null&&(!H.value||Hn()!=null)),qn=g(()=>{let e=Un.value;if(e==null)return null;if(z.value)return Math.ceil(e);let t=Bn.value,n=Nn.value;if(t==null||n==null)return Math.ceil(e);let r=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+r)}),Jn=g(()=>{if(z.value&&mn.value)return{};let e=Un.value;return Kn.value&&e!=null?{minHeight:`${e}px`}:{}});function Yn(){Vn.value=null}function Xn(){var e,t,n,r;let i=S.value?.querySelector(`pre.code-pre-fallback`),a=I(),o=i?.scrollTop??0;(t=(e=(a?.getOriginalEditor)?.call(a))?.setScrollTop)==null||t.call(e,o),(r=(n=(a?.getModifiedEditor)?.call(a))?.setScrollTop)==null||r.call(n,o)}function Zn(){return T(this,null,function*(){return z.value?(vr(),er(),X(!0),Xn(),Z(),en.value=!0,yield i(),X(!0),yield q(),X(!0),gr(),er(),!!(yield function(){return T(this,null,function*(){if(!z.value)return!0;for(let e=0;e<4;e++){let e=er();X(!0),Qn(e),$n(e),yield i(),yield q();let t=S.value?.querySelector(`pre.code-pre-fallback`);if(!t)return!1;if(e==null)return jr();let n=t.getBoundingClientRect().height;if(n>0&&Math.abs(n-e)<=2)return!0}return!1})}())&&(H.value=!0,yield i(),er(),X(!0),gr(),Z(),y(()=>{M||y(()=>{M||(function(){let e=S.value?.querySelector(`.code-block-shell-content`),t=S.value?.querySelector(`.code-editor-layer`);e&&t&&(t.style.removeProperty(`height`),t.style.removeProperty(`min-height`),e.style.removeProperty(`height`),e.style.removeProperty(`min-height`))}(),Q(!0))})}),Q(),!0)):!(Mt&&!(yield Mt())||(en.value=!0,yield i(),X(!0),H.value=!0,yield i(),Q(),0))})}function Qn(e){if(!z.value)return;let t=x.value,n=S.value?.querySelector(`pre.code-pre-fallback`);if(!t||!n)return;let r=e??Number.parseFloat(t.style.height||``);if(!Number.isFinite(r)||r<=0)return;let i=Math.ceil(r),a=`${i}px`;Tn.value=i;let o=S.value;o&&(o.dataset.markstreamDiffHandoffHeight=a),n.dataset.markstreamDiffHandoffHeight=a,n.style.setProperty(`height`,a),n.style.setProperty(`min-height`,a)}function $n(e){if(!z.value)return;let t=S.value?.querySelector(`.code-block-shell-content`),n=S.value?.querySelector(`.code-editor-layer`);if(!t||!n)return;let r=typeof e==`number`&&Number.isFinite(e)&&e>0?Math.ceil(e):Number.parseFloat(x.value?.style.height||``);if(!Number.isFinite(r)||r<=0)return;let i=`${r}px`;n.style.height=i,n.style.minHeight=i,t.style.height=i,t.style.minHeight=i}function er(){let e=x.value;if(e&&jr(e)){Z();let t=mr(e);if(t!=null&&t>0){let n=Math.ceil(t),r=Math.ceil(zr()),i=Math.min(n,r),a=`${i}px`;return e.style.height=a,e.style.minHeight=`0px`,e.style.maxHeight=`${r}px`,e.style.overflow=n>r+1?`auto`:`hidden`,mn.value&&(Tn.value=i,Qn(i)),Dr(),i}return Y({preferModelDiffHeight:!0}),Qn(),Dr(),Number.parseFloat(e.style.height||``)||null}return vr()}function tr(e,t=!1,n={}){let r=Math.ceil(e),i=Hn();if(i==null)return r;let a=!0===n.allowBelowEstimatedFloor;return r>=i||a?((t||a)&&j.value&&Yn(),r):i}function q(){return new Promise(e=>{let t=!1,n=null,r=null,i=()=>{t||(t=!0,r!=null&&globalThis.clearTimeout(r),n!=null&&Re(n),e())};r=globalThis.setTimeout(i,50),n=y(i)})}function nr(){try{let e=x.value;if(!e)return null;let t=e.querySelector(`.stream-diffs-shell .stream-diffs-surface`)??e.querySelector(`.stream-diffs-shell`);if(t){let e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch{}return null}function rr(){var e;try{let t=z.value?((e=I())?.getModifiedEditor)?.call(e)??I():F(),n=Ot()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}try{let e=x.value;if(e){let t=e.querySelector(`.stream-diffs-shell .stream-diffs-surface`)??e.querySelector(`.stream-diffs-shell`);if(t)try{if(typeof window<`u`&&typeof window.getComputedStyle==`function`){let e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch{}}}catch{}return null}function ir(e){try{let t=Ot()?.EditorOption?.lineHeight;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n==`number`&&n>0)return n}}catch{}let t=nr();if(t&&t>0)return t;let n=Number.isFinite(K.value)&&K.value>0?K.value:14;return Math.max(12,Math.round(1.35*n))}function ar(){let e=v.codeBlockOptions?.padding;return typeof e==`number`&&Number.isFinite(e)?2*Math.max(0,e):z.value?24:0}function or(e){return!!Xe.value||!!e&&($(e)||Mt!=null)}function sr(){z.value?Ht.value=Oe(String(v.node.originalCode??``),String(v.node.updatedCode??``)):Ht.value={removed:0,added:0}}function cr(){if(Number.isFinite(K.value)&&K.value>0&&Number.isFinite(G.value))return K.value;if(typeof v.codeBlockOptions?.fontSize==`number`)return G.value=v.codeBlockOptions.fontSize,K.value=v.codeBlockOptions.fontSize,v.codeBlockOptions.fontSize;let e=rr();return e&&e>0?(G.value=e,K.value=e,e):(G.value=12,K.value=12,12)}function lr(){let e=cr(),t=Math.min(36,e+1);K.value=t}function ur(){let e=cr(),t=Math.max(10,e-1);K.value=t}function dr(){cr(),Number.isFinite(G.value)&&(K.value=G.value)}function fr(){var e,t,n,r,i;try{let a=z.value?I():null,o=z.value?a:F();if(!o)return null;if(a?.getOriginalEditor&&a?.getModifiedEditor){let i=a.getOriginalEditor?.call(a),o=a.getModifiedEditor?.call(a);(e=i?.layout)==null||e.call(i),(t=o?.layout)==null||t.call(o);let s=(i?.getContentHeight)?.call(i)||0,c=(o?.getContentHeight)?.call(o)||0,l=Math.max(s,c);if(l>0)return Math.ceil(l);let u=((n=(i?.getModel)?.call(i))?.getLineCount)?.call(n)||1,d=((r=(o?.getModel)?.call(o))?.getLineCount)?.call(r)||1,f=Math.max(u,d),p=Math.max(ir(i),ir(o)),ee=ar();return Math.ceil(f*p+ee+0)}if(o?.getContentHeight){(i=o?.layout)==null||i.call(o);let e=o.getContentHeight();if(e>0)return z.value||(an.value=!0),Math.ceil(e)}let s=(o?.getModel)?.call(o),c=1;s&&typeof s.getLineCount==`function`&&(c=s.getLineCount());let l=ir(o);return Math.ceil(c*(l+1.5)+0)}catch{return null}}function pr(){var e;if(z.value)return!1;try{let t=((e=F())?.getContentHeight)?.call(e),n=typeof t==`number`&&Number.isFinite(t)&&t>0;return n&&(an.value=!0),n}catch{return!1}}function mr(e){if(typeof window>`u`)return null;try{if(window.getComputedStyle(e).display===`none`)return null;let t=e.querySelector(`diffs-container`);if(t instanceof HTMLElement){let e=t.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}let n=e.querySelector(`.stream-diffs-shell`);if(n){let e=n.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}return null}catch{return null}}function hr(e){let t=String(e??``).trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];if(n){let e=n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n;return .2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}let r=t.match(/\d+(?:\.\d+)?/g);if(!r||r.length<3)return null;let[i,a,o]=r.slice(0,3).map(Number);return .2126*i+.7152*a+.0722*o}function gr(){var e;if(_r())return;let t=rr();t&&t>0&&(Sn.value=t,K.value=t,G.value=t);try{let t=ir(z.value?((e=I())?.getModifiedEditor)?.call(e)??I():F());t&&t>0&&(Cn.value=t)}catch{}try{let e=nr();e&&e>0&&(Cn.value=e)}catch{}}function _r(){return z.value&&hn.value}function vr(){if(!mn.value)return null;let e=x.value,t=S.value?.querySelector(`pre.code-pre-fallback`);if(!e||!t)return null;let n=Math.ceil(t.getBoundingClientRect().height),r=z.value?mr(e):null,i=Math.max(n,r!=null&&r>0?Math.ceil(r):0),a=Math.ceil(zr()),o=Math.min(i,a);return!Number.isFinite(o)||o<=0?null:(z.value&&o>n&&(Tn.value=o),e.style.height=`${o}px`,e.style.minHeight=`${o}px`,e.style.maxHeight=`${a}px`,e.style.overflow=i>a+1?`auto`:`hidden`,o)}function yr(){let e=x.value,t=S.value;if(!e||!t)return;let n=e;n.style.setProperty(`--markstream-diff-metadata-bg`,B.value.background),n.style.setProperty(`--markstream-diff-metadata-fg`,B.value.lineNumber),n.style.setProperty(`--diffs-tab-size`,String(An.value)),n.style.setProperty(`--diffs-scrollbar-gutter-override`,`0px`),typeof v.codeBlockOptions?.padding==`number`?n.style.setProperty(`--diffs-gap-block`,`${jn.value.top}px`):n.style.removeProperty(`--diffs-gap-block`);let r=e.querySelector(`.stream-diffs-shell`)||e,i=r,a=r,o=null,s=null,c=null;try{typeof window<`u`&&typeof window.getComputedStyle==`function`&&(o=window.getComputedStyle(r),s=i===r?o:window.getComputedStyle(i),c=a===r?o:window.getComputedStyle(a))}catch{o=null,s=null,c=null}let l=String(o?.getPropertyValue(`--vscode-editor-foreground`)??``).trim(),u=String(o?.getPropertyValue(`--vscode-editor-background`)??``).trim(),d=String(o?.getPropertyValue(`--vscode-editor-selectionBackground`)??o?.getPropertyValue(`--vscode-editor-hoverHighlightBackground`)??``).trim(),f=l||String(c?.color??o?.color??``).trim(),p=u||String(s?.backgroundColor??o?.backgroundColor??``).trim(),ee=function(){var e;try{let t=z.value?((e=I())?.getModifiedEditor)?.call(e)??I():F(),n=Ot()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.typicalHalfwidthCharacterWidth;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}return null}();if(ee!=null&&(wn.value=ee),z.value){let e=(e,r)=>{r?(t.style.setProperty(e,r),n.style.setProperty(e,r)):(t.style.removeProperty(e),n.style.removeProperty(e))};for(let[n,r]of Object.entries(Wn(t.classList.contains(`is-dark`))))e(n,r);f?(t.style.setProperty(`--markstream-diff-editor-fg`,f),n.style.setProperty(`--vscode-editor-foreground`,f)):(t.style.removeProperty(`--markstream-diff-editor-fg`),n.style.removeProperty(`--vscode-editor-foreground`)),p?(t.style.setProperty(`--markstream-diff-editor-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg-soft`,p),t.style.setProperty(`--markstream-diff-panel-bg-strong`,p),n.style.setProperty(`--vscode-editor-background`,p),n.style.backgroundColor=p):(t.style.removeProperty(`--markstream-diff-editor-bg`),t.style.removeProperty(`--markstream-diff-panel-bg`),t.style.removeProperty(`--markstream-diff-panel-bg-soft`),t.style.removeProperty(`--markstream-diff-panel-bg-strong`),n.style.removeProperty(`--vscode-editor-background`),n.style.backgroundColor=``),d?n.style.setProperty(`--vscode-editor-selectionBackground`,d):n.style.removeProperty(`--vscode-editor-selectionBackground`)}else{if(function(e,t,n){if(!Xe.value)return!1;let r=hr(e),i=hr(t);return n?r!=null&&r>170||i!=null&&i<110:r!=null&&r<85||i!=null&&i>190}(p,f,t.classList.contains(`is-dark`)))return n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--vscode-editor-background`),void n.style.removeProperty(`--vscode-editor-selectionBackground`);f&&n.style.setProperty(`--vscode-editor-foreground`,f),p&&n.style.setProperty(`--vscode-editor-background`,p),d&&n.style.setProperty(`--vscode-editor-selectionBackground`,d)}}l(()=>[v.stream,v.loading,v.node.loading,z.value],([e,t,n,r])=>{r||!1===e||!1===t||In.value?(r||!1===e)&&In.value&&(In.value=!1):(In.value=!0,Yn())},{immediate:!0});let br=0,xr=0,Sr=/auto|scroll|overlay/i;function J(e,t,n){if(typeof window>`u`||z.value||function(e){return pn.value||fn(e)}(e))return;let r=Math.ceil(n)-Math.ceil(t);if(Math.abs(r)<=1)return;let i=function(e){if(typeof window>`u`)return null;let t=e?.ownerDocument??document,n=t.scrollingElement||t.documentElement||t.body,r=e?.parentElement??null;for(;r&&r!==t.body&&r!==n;){let e=window.getComputedStyle(r),t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();if(Sr.test(t)||Sr.test(n))return r;r=r.parentElement}return n}(e);if(!i)return;let a=e.ownerDocument??document,o=i===a.body||i===a.documentElement||i===a.scrollingElement,s=o?0:i.getBoundingClientRect().top;e.getBoundingClientRect().top-s>=0||(o&&typeof window.scrollBy==`function`?window.scrollBy(0,r):i.scrollTop+=r)}function Cr(){try{let e=x.value;if(!e)return;let t=e.getBoundingClientRect().height,n=fr();if(n!=null&&n>0){let r=tr(n,!0,{allowBelowEstimatedFloor:!z.value&&j.value&&pr()}),i=Hn();e.style.minHeight=i==null?`0px`:`${i}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,J(e,t,r);return}let r=Hn();r!=null&&(e.style.minHeight=`${r}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,J(e,t,r))}catch{}}function wr(){for(var e,t;zt.length>0;)try{(t=(e=zt.pop())?.dispose)==null||t.call(e)}catch{}st!=null&&(Re(st),st=null),ct!=null&&(Re(ct),ct=null),lt!=null&&(Re(lt),lt=null),ut=0,dt=!1}function Tr(){for(var e;Bt.length>0;)try{(e=Bt.pop())==null||e()}catch{}}function Y(e=!1){O.value||(D.value?Cr():function(e={}){try{let t=x.value;if(!t)return;let n=t.getBoundingClientRect().height,r=Math.ceil(n||0),i=zr(),a=r,o=Number.parseFloat(t.style.height||``),s=a>0?a:Number.isFinite(o)&&o>0?Math.ceil(o):0,c=z.value?function(){var e,t;if($())return null;try{let n=I(),r=(n?.getOriginalEditor)?.call(n),i=(n?.getModifiedEditor)?.call(n);if(!r||!i)return null;let a=((e=r.getModel?.call(r))?.getLineCount)?.call(e)||1,o=((t=i.getModel?.call(i))?.getLineCount)?.call(t)||1,s=Math.max(a,o),c=Math.max(ir(r),ir(i)),l=ar(),u=Math.max(r.getContentHeight?.call(r)??0,i.getContentHeight?.call(i)??0);return Math.ceil(Math.max(u,s*c+l+0))}catch{return null}}():null,l=z.value&&jr(t);if(mt>0&&(mt--,pt.value!=null))return void J(t,n,Or(t,pt.value,i,{preserveScrollableOverflow:Ar(t)}));if(z.value&&!l&&mn.value){let e=vr();if(e!=null){let r=Or(t,e,i,{allowBelowEstimatedFloor:!0});X(!0),J(t,n,r);return}}let u=z.value&&!0===e.preferModelDiffHeight,d=z.value?mr(t):null,f=!z.value&&j.value&&pr(),p=z.value&&!1!==v.loading&&(d!=null||c!=null&&a>0&&c<a-1),ee=c!=null,m;if(z.value){if(u){let e=c!=null&&!1===v.loading&&s>0&&c<s-1;m=!1===v.loading&&d!=null?c==null?d:Math.max(d,c):e?c:d!=null&&c!=null?Math.max(d,c,!1===v.loading?0:s):Math.max(d??0,c??0,!1===v.loading?0:s)||null}else m=un.value&&d!=null||d!=null?ee?Math.max(d,c):d:z.value&&!1!==v.loading?c!=null&&s>0&&c<s-1?c:s>0?s:null:c}else m=fr();if(z.value&&m!=null&&s>0&&(!1!==v.loading||!0===e.holdCurrentDiffHeight)&&(m=Math.max(m,s)),m!=null&&m>0)return void J(t,n,Or(t,m,i,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:f||p,preserveScrollableOverflow:Ar(t),renderedStreamingDiffHeight:d}));if(pt.value!=null)return void J(t,n,Or(t,pt.value,i,{preserveScrollableOverflow:Ar(t)}));let te=z.value&&!1!==v.loading?a:Math.max(a,c!=null&&c>0?c:0);if(te>0)return void J(t,n,Or(t,te,i));let h=Hn();if(!(h==null||z.value&&!1!==v.loading&&l))return void J(t,n,Or(t,h,i));let g=Number.parseFloat(t.style.height);!Number.isNaN(g)&&g>0?J(t,n,Or(t,g,i)):z.value||J(t,n,Or(t,i,i))}catch{}}(typeof e==`object`?e:{}))}function Er(){br=0,xr=0}function X(e=!1){if(O.value)return;let t=x.value;if(!t)return;let n=z.value?I():F();if(n&&typeof n.layout==`function`)try{let r=t.getBoundingClientRect?.call(t),i=Math.ceil((r?.width??0)||t.clientWidth||0),a=Math.ceil((r?.height??0)||t.clientHeight||Number.parseFloat(t.style.height||``)||0);if(i>0&&a>0){if(!e&&i===br&&a===xr)return;br=i,xr=a,n.layout({width:i,height:a})}else Er(),n.layout()}catch{}}function Z(){Tr()}function Q(e=!1){if(M||st!=null)return;let t=()=>{M||(Z(),Y(e),X())};st=y(()=>{st=null,t(),ct=y(()=>{ct=null,t()})}),Dr()}function Dr(e=!1){if(!z.value||M||!e&&!1===v.loading||(dt||=e,ut=Math.max(ut,e?18:6),lt!=null))return;let t=()=>{if(lt=null,!z.value||M||ut<=0||!dt&&!1===v.loading)return ut=0,void(dt=!1);ut--,Z(),Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:dt}),X(),ut>0?lt=y(t):dt=!1};lt=y(t)}function Or(e,t,n,r={}){var i;let a=z.value&&!1!==v.loading,o=`renderedStreamingDiffHeight`in r?a&&(i=r.renderedStreamingDiffHeight)!=null?i:null:a?mr(e):null,s=o!=null&&o>t+1?o:t,c=Math.min(s,n),l=!0===r.allowBelowEstimatedFloor,u=tr(c,!0===r.clearEstimatedFloor,{allowBelowEstimatedFloor:l}),d=Hn();e.style.minHeight=d==null||l?`0px`:`${Math.min(d,Math.ceil(n))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(n)}px`;let f=!0===r.preserveScrollableOverflow||s>n+1||kr(e,u);return e.style.overflow=f?`auto`:`hidden`,u}function kr(e,t=0){let n=Math.ceil(e.getBoundingClientRect?.call(e).height||0),r=Math.max(t,e.clientHeight||0,n);return r>0&&e.scrollHeight>r+1}function Ar(e){return ht||kr(e,pt.value??0)}function jr(e=x.value){return $(e)}function Mr(e=x.value){return $(e)}function Nr(){var e;if($())return!0;let t=((e=F())?.getModel)?.call(e);return typeof t?.getValue==`function`&&t.getValue()===W.value}function $(e=x.value){return!!e?.querySelector(`diffs-container`)}function Pr(){return!1!==v.loading||H.value}function Fr(){let e=I();return typeof e?.getOriginalEditor==`function`||typeof e?.getModifiedEditor==`function`||typeof e?.getLineChanges==`function`}function Ir(){return T(this,null,function*(){if(!z.value)return!0;for(let e=0;e<30;e++){if(M)return!1;if($())return yield i(),yield q(),!M&&$();yield i(),yield q()}return!1})}let Lr=``;function Rr(e,t,n){return T(this,null,function*(){let r=`${e}\0${t}\0${n}`;if(Lr!==r){try{yield Tt(e,t,n),Lr=r;return}catch(e){if(!Kt(e))throw e}if(yield i(),yield q(),!M&&z.value)try{yield Tt(e,t,n),Lr=r}catch(e){if(!Kt(e))throw e}}})}function zr(){return v.codeBlockOptions?.maxHeight??500}let Br=g(()=>v.isShowPreview&&(C.value===`html`||C.value===`svg`));function Vr(){return typeof v.node.loading==`boolean`?v.node.loading:!0===v.loading}function Hr(e,t,n){return!n||function(){if(!Vr())return!0;let e=String(v.node.raw??``),t=e.split(/\r\n|\n|\r/,1)[0]?.trimStart()??``;return!/^(?:`{3,}|~{3,})/.test(t)||/\r\n|\n|\r/.test(e)}()&&String(t??``)?fe(String(e??``)):`plain`}function Ur(){return Vr()}let Wr=null,Gr=!1,Kr=0;function qr(){Wr=null,Kr++}function Jr(){return T(this,arguments,function*(e=Kr){if(!Gr){Gr=!0;try{for(;Wr&&!M&&!z.value&&e===Kr;){let e=Wr;Wr=null;try{yield Promise.resolve(wt(e.code,e.language)),yield i(),M||z.value||(Y(!1),X())}catch{}}}finally{Gr=!1,!Wr||M||z.value||Jr()}}})}function Yr(e,t){Wr={code:e,language:t},Jr(Kr)}l(()=>[v.node.language,v.node.code,v.node.raw,v.node.loading,v.loading],([e,t,n,r,i])=>{C.value=Hr(e,t,typeof r==`boolean`?r:!0===i)}),l(()=>[v.node.originalCode,v.node.updatedCode,z.value],()=>{y(()=>sr())},{immediate:!0});let Xr=0;l(()=>[v.node.originalCode,v.node.updatedCode,E.value,z.value,v.stream],e=>T(null,[e],function*([,,,e,t]){let n=++Xr;if(!e||Vr()||!1===t&&!k.value)return;if(!1!==t&&P&&!k.value&&x.value)try{yield ci(x.value)}catch{}let r=Nt;if(r&&!A.value){try{yield r}catch{}if(M||!z.value||n!==Xr)return}if(n!==Xr)return;let a=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``)),o=!1===v.loading;o&&_i();try{if(yield Rr(a.original,a.updated,E.value),M||!z.value||n!==Xr)return;yield i(),X(!0),Z(),Y(!1===v.loading||{preferModelDiffHeight:!0}),X(!0),Q(!0)}catch{return}if(o){if(M||!z.value)return;qt(),Z(),sr(),Q(),Dr(!0)}D.value&&y(()=>Cr())})),l(()=>v.node.code,e=>T(null,null,function*(){if(Vr()||!1===v.stream||(C.value||=fe(Ft(e)),z.value))return;let t=Nt;if(t&&!A.value){try{yield t}catch{}if(M||z.value)return}if(P&&!k.value&&x.value)try{yield ci(x.value)}catch{}Yr(Gt(v.node.code),E.value),D.value&&y(()=>Cr())}));let Zr=g(()=>{let e=C.value;return e?he[e]||e.charAt(0).toUpperCase()+e.slice(1):he[``]||`Plain Text`}),Qr=g(()=>ve(String(v.node.raw??``),Zr.value,z.value)),$r=g(()=>Qr.value.title),ei=g(()=>Qr.value.caption),ti=g(()=>(de.value,Ie(C.value||``,Ve))),ni=g(()=>{let e={};e[`--markstream-code-layout-character-width`]=wn.value==null?`1ch`:`${wn.value}px`,e[`--markstream-code-fallback-bg`]=B.value.background,e[`--markstream-code-fallback-fg`]=B.value.foreground,B.value.builtin&&(e[`--markstream-code-theme-bg`]=B.value.background,e[`--markstream-code-theme-fg`]=B.value.foreground,e[`--markstream-code-theme-line-number`]=B.value.lineNumber),e[`--markstream-diff-added-line-fill`]=B.value.diffAddedLine,e[`--markstream-diff-added-number-fill`]=B.value.diffAddedNumber,e[`--markstream-diff-editor-bg`]=B.value.background,e[`--markstream-diff-removed-line-fill`]=B.value.diffRemovedLine,e[`--markstream-diff-removed-number-fill`]=B.value.diffRemovedNumber,e[`--markstream-diff-shell-bg`]=B.value.background,e[`--markstream-pre-resolved-theme-bg`]=B.value.background,e[`--markstream-pre-resolved-theme-fg`]=B.value.foreground,e[`--markstream-pre-resolved-theme-line-number`]=B.value.lineNumber;let t=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},n=t(v.minWidth),r=t(v.maxWidth);if(n&&(e.minWidth=n),r&&(e.maxWidth=r),Kn.value&&!z.value&&!O.value){let t=qn.value;t!=null&&(e.minHeight=`${t}px`)}return e.color=`var(--markstream-code-fallback-fg, var(--markstream-code-theme-fg, var(--markstream-pre-resolved-theme-fg)))`,e.backgroundColor=`var(--markstream-code-fallback-bg, var(--markstream-code-theme-bg, var(--markstream-pre-resolved-theme-bg)))`,z.value||(e.borderColor=`var(--markstream-code-border-color, var(--code-border))`),e}),ri=g(()=>!1!==v.showTooltips);function ii(){return T(this,null,function*(){let e=v.node.code;try{v.clipboardWriter?yield v.clipboardWriter(e):typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),qe.value=!0,pe(`copy`,e),setTimeout(()=>{qe.value=!1},1e3)}catch(e){console.error(`复制失败:`,e)}})}function ai(){D.value=!D.value;let e=z.value?I():F(),t=x.value;e&&t&&(D.value?(t.style.maxHeight=`none`,t.style.overflow=`visible`,Y(!0)):(t.style.overflow=`auto`,Y(!0)))}function oi(){var e;if(O.value=!O.value,O.value){if(ht=!1,x.value){let t=Math.ceil((e=x.value).getBoundingClientRect?.call(e).height||0);ht=kr(x.value,t)||x.value.style.overflow===`auto`||x.value.style.overflowY===`auto`,t>0&&(pt.value=t)}}else x.value&&pt.value!=null&&(x.value.style.height=`${pt.value}px`),mt=2,i(()=>{O.value||M||(Y(!0),X(!0))})}function si(){if(!Br.value)return;let e=C.value;if(Ge.value){let t=e===`html`?`text/html`:`image/svg+xml`,n=e===`html`?Ke(`artifacts.htmlPreviewTitle`)||`HTML Preview`:Ke(`artifacts.svgPreviewTitle`)||`SVG Preview`;pe(`previewCode`,{node:v.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`})}else e===`html`&&(yn.value=!yn.value)}function ci(e,t={}){if(!P||M||!1===v.stream&&!1!==v.loading||(Ci(),wi())||V.value||x.value!==e||Ur())return null;if(L)return L;if(k.value&&j.value)return Promise.resolve();let n=xi(),r=nn.value,a=!1;k.value=!0,function(){let e=He.value;b&&e&&ft!==e&&(ft&&b.markSettled(ft),ft=e,b.markPending(e))}();let o=T(null,null,function*(){try{yield function(e){return T(this,null,function*(){var t;if(!P||M)return;ot=!1;let n=Qt.value;if(ln=!1,U.value=!1,tn.value=null,A.value=!1,H.value=!1,en.value=!1,Sn.value=null,Cn.value=null,wn.value=null,Tn.value=null,Er(),function(){if(an.value=!1,Ln())return void(Vn.value=null);let e=zn.value;Vn.value=j.value||e==null?null:e}(),wr(),Tr(),function(e){e.replaceChildren()}(e),_i(),yield ye(hi()),M)return;let r=T(null,null,function*(){if(n===`diff`){(function(){if(Lt||typeof window>`u`)return;Lt=!0;let e=e=>{Kt(`reason`in e?e.reason:e.error??e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener(`error`,e,!0),window.addEventListener(`unhandledrejection`,e,!0),Rt=()=>{window.removeEventListener(`error`,e,!0),window.removeEventListener(`unhandledrejection`,e,!0),Lt=!1,Rt=null}})(),At();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));Ct?yield Ct(e,t.original,t.updated,E.value):yield P(e,v.node.code,E.value)}else yield P(e,W.value,E.value);A.value=!0}).finally(()=>{Nt===r&&(Nt=null)});if(Nt=r,yield function(e){return T(this,null,function*(){if(!z.value)return void(yield e);let t,n=!1;for(e.then(()=>{n=!0},e=>{n=!0,t=e});;){if(M)return;if(n){if(t)throw t;return}if(jr()&&Fr())return;yield i(),yield q()}})}(r),M||Qt.value!==n)return;A.value=!0;let a=v.codeBlockOptions?.fontSize;if(typeof a==`number`&&Number.isFinite(a)&&a>0){let e=n===`diff`?I():F();(t=e?.updateOptions)==null||t.call(e,{fontSize:a}),G.value=a,K.value=a}else if(!_r()){let e=rr();e&&e>0?(G.value=e,K.value=e):(G.value=12,K.value=12)}for(gr();ot;)if(ot=!1,yield mi(),M)return;D.value||O.value||Y(!1),j.value=!0,$t.value=n,function(){if(wr(),z.value){let e=I(),t=(e?.getOriginalEditor)?.call(e),n=(e?.getModifiedEditor)?.call(e),r=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>Q());r&&zt.push(r)}catch{}};try{let t=(e?.onDidUpdateDiff)?.call(e,()=>{Q(),y(()=>sr())});t&&zt.push(t)}catch{}r(t,`onDidContentSizeChange`),r(n,`onDidContentSizeChange`);let i=x.value;if(i&&typeof MutationObserver<`u`){let e=`diffs-container,.stream-diffs-shell,.stream-diffs-surface`,t=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!(n?.closest)?.call(n,e)},n=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!((n?.closest)?.call(n,e)||(n?.querySelector)?.call(n,e))},r=new MutationObserver(e=>{z.value&&Pr()&&e.some(e=>t(e.target)||Array.from(e.addedNodes).some(n)||Array.from(e.removedNodes).some(t))&&(Z(),Y({preferModelDiffHeight:!0}),X(),Dr())});r.observe(i,{attributeFilter:[`class`],attributes:!0,childList:!0,characterData:!0,subtree:!0}),zt.push({dispose:()=>r.disconnect()})}if(i&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{if(!z.value||(X(),!Pr()))return;let e=mr(i);e!=null&&(Math.ceil(i.getBoundingClientRect().height||0)<=e+1||(Z(),Y({preferModelDiffHeight:!0}),X()))});e.observe(i),zt.push({dispose:()=>e.disconnect()})}return}let e=F();try{let t=(e?.onDidContentSizeChange)?.call(e,()=>Q());t&&zt.push(t)}catch{}try{let t=(e?.onDidLayoutChange)?.call(e,()=>Q());t&&zt.push(t)}catch{}}(),yr(),gr(),Z(),sr(),Q(),yield i();let o=null;Mt&&(o=yield Mt(),o&&(yield i(),yield q()));let s=o??(n===`diff`?yield Ir():yield function(){return T(this,null,function*(){if($())return yield i(),yield q(),$();for(let e=0;e<30;e++){if(M||z.value)return!1;let e=x.value,t=Nr(),n=Mr(e),r=!W.value.trim()||or(e);if(t&&n&&r&&(yield i(),yield q(),!M&&!z.value&&Nr()&&Mr(x.value)&&(!W.value.trim()||or(x.value))))return!0;yield i(),yield q()}return!1})}());M||(s?(gr(),er(),(yield Zn())||Ti()):Ti())})}(e),on=null}catch(e){let i=xi(),o=r!==nn.value,s=!1!==t.allowStaleContentRetry&&o&&on!==i;if(n!==i||s)return s&&(on=i),a=!0,k.value=!1,j.value=!1,A.value=!1,void(H.value=!1);throw Ti(n),e}}).finally(()=>{L===o&&(L=null),function(){let e=ft;b&&e&&(ft=``,i(()=>{if(!M){let t=S.value?.offsetHeight??0;t>0&&b.reportHeight(e,t)}b.markSettled(e)}))}(),a&&!M&&queueMicrotask(()=>{var e;let t=x.value;t&&!M&&((e=ci(t))==null||e.catch(e=>{j.value=!1,H.value=!1,Ti()}))})});return L=o,o}l(ri,e=>{e||Ne()}),l(()=>K.value,(e,t)=>{var n;let r=z.value?I():F();r&&typeof e==`number`&&Number.isFinite(e)&&e>0&&((n=r.updateOptions)==null||n.call(r,{fontSize:e}),O.value||Y(!0))},{flush:`post`,immediate:!1});let li=0,ui=l(()=>[x.value,z.value,v.stream,v.loading,at.value,N.value,v.node.language,v.node.raw,v.node.code,v.node.loading],e=>T(null,[e],function*([e,t,n,r,i,a]){let o=++li;if(!e||!a||Vr()||sn||!1===n&&!1!==r||!P&&(yield function(){return T(this,null,function*(){if(typeof window>`u`||M||at.value||V.value)return;if(Pt)return Pt;let e=T(null,null,function*(){try{let e=yield We();if(M)return;if(!e)return void(V.value=!0);xn(e)}catch{if(M)return;V.value=!0}}).finally(()=>{Pt===e&&(Pt=null)});return Pt=e,e})}(),o!==li||!1===v.stream&&!1!==v.loading||Ur()||!N.value||!P||V.value||k.value||wi()||M||x.value!==e)||Ur())return;let s=ci(e);if(s){try{yield s}catch{j.value=!1,H.value=!1,Ti()}j.value&&H.value&&ui()}}));function di(e){return typeof e==`string`?e:null}function fi(e,t){if(e===t)return!0;let n=di(e),r=di(t);return!!n&&n===r}function pi(){return Ee({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})}function mi(){return T(this,arguments,function*(e={}){_i();let t=()=>{z.value&&qt(),y(()=>{yr(),Q()})};if(e.appearanceOnly)return void t();let n=pi();if(n)try{yield ye(hi()),yield It(n),t()}catch{}else t()})}function hi(){let e=v.themes;return e&&typeof e[0]==`string`&&typeof e[1]==`string`?{dark:e[0],light:e[1]}:pi()}function gi(){let e=Mn.value,t=Ye(w({},Jt.value||{}),{wordWrap:e.overflow===`wrap`?`on`:`off`,overflow:e.overflow,themes:v.themes,stream:!1,MAX_HEIGHT:v.codeBlockOptions?.maxHeight??500,fontSize:Dn.value,lineHeight:kn.value,theme:pi(),themeType:v.isDark?`dark`:`light`,disableLineNumbers:!Me.value,disableFileHeader:!0,workerManager:Jt.value?.workerManager??_e()??void 0,onThemeChange(){yr()}}),n=function(){let e=Jt.value?.fontFamily;return typeof e==`string`&&e.trim()?e.trim():z.value?function(){if(typeof window>`u`)return;let e=S.value?.querySelector(`pre.code-pre-fallback`);if(e)return window.getComputedStyle(e).fontFamily.trim()||void 0}():void 0}();n&&(t.fontFamily??=n);let r=typeof t.unsafeCSS==`string`?t.unsafeCSS:``;return t.unsafeCSS=Se(e.overflow,r),t}function _i(){let e=gi();if(!R)return R=e,R;for(let t of Object.keys(R))t in e||delete R[t];return Object.assign(R,e),R}l(Qt,(e,t)=>T(null,null,function*(){if(e===t||U.value||sn||(qr(),!P||!x.value)||!k.value||!1===v.stream&&!1!==v.loading||!N.value)return;let n=L;if(n){try{yield n}catch{}if(M||!x.value)return}if($t.value!==e||!k.value||!j.value)try{j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),yield i(),yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}}));let vi=_(0),yi=g(()=>String(vi.value)),bi=!1;function xi(){let e=pi();return JSON.stringify({kind:Qt.value,language:E.value,structural:yi.value,optionsRevision:vi.value,settledContentGeneration:rn.value,theme:di(e)??(e==null?null:`custom`),isDark:v.isDark})}l(()=>v.codeBlockOptions?.fontSize,e=>{let t=typeof e==`number`&&Number.isFinite(e)&&e>0?e:12;G.value=t,K.value=t,Sn.value=null,Cn.value=null,wn.value=null}),l(()=>[v.codeBlockOptions,v.showLineNumbers],()=>{vi.value+=1,!1===v.stream&&!1!==v.loading&&(bi=!0)},{deep:!0}),l(()=>[W.value,v.node.originalCode,v.node.updatedCode],()=>{nn.value+=1,Vr()||(rn.value+=1)});let Si=g(()=>xi());function Ci(){U.value&&tn.value!==Si.value&&(U.value=!1,tn.value=null,on=null,cn=null,k.value=!1,j.value=!1,A.value=!1,H.value=!1,en.value=!1)}function wi(){return Ci(),U.value&&tn.value===Si.value}function Ti(e=Si.value){tn.value=e,U.value=!0,en.value=!1}return l(Si,()=>T(null,null,function*(){if(sn||!U.value||tn.value===Si.value||!P||!x.value||V.value||M||!N.value||!1===v.stream&&!1!==v.loading||Ur())return;let e=Si.value;sn=!0;try{if(Ci(),U.value)return;yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}finally{cn=e,yield i(),sn=!1}})),l(()=>[v.codeBlockOptions,N.value],()=>{var e;if(_i(),!P||!N.value)return;let t=z.value?I():F(),n=typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:Number.isFinite(K.value)?K.value:void 0;typeof n==`number`&&Number.isFinite(n)&&n>0&&((e=t?.updateOptions)==null||e.call(t,{fontSize:n})),Y(!1)},{deep:!0}),l(()=>[pi(),Xt.value,at.value,k.value,N.value],([e,t],n)=>{if(!at.value||!N.value)return;let r=n!=null&&fi(e,n[0]),i=n!=null&&t!==n[1];j.value?(ot=!1,mi({appearanceOnly:r})):r&&!i||(ot=!0)},{flush:`post`}),l(()=>[yi.value,at.value,N.value],(e,t)=>T(null,[e,t],function*([e,t,n],[r]){if(_i(),!t||!n||!P||!x.value||!k.value||e===r)return;if(!1===v.stream&&!1!==v.loading)return void(bi=!0);bi=!1;let a=L;if(a){try{yield a}catch{}if(M||!x.value)return}try{j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),Vt&&xn(Vt),yield i(),yield ci(x.value,{allowStaleContentRetry:!1})}catch{j.value=!1,H.value=!1,Ti()}}),{flush:`post`}),l(()=>[v.loading,N.value],([e,t])=>{!1===e&&t&&bi&&(bi=!1,vi.value+=1)},{flush:`post`}),l(()=>[v.loading,N.value],(e,t)=>T(null,[e,t],function*([e,t],n){if(!t)return;let r=n?.[0];if(!1===r&&!1!==e&&z.value&&k.value&&(yield i(),y(()=>{T(null,null,function*(){let e=L;if(e)try{yield e}catch{}!M&&z.value&&!1!==v.loading&&(_i(),qt(),Q())})})),e)return;let a=r!==void 0&&!1!==r;yield i(),y(()=>{T(null,null,function*(){try{if(a&&(yield function(){return T(this,null,function*(){if(!U.value||!P||!x.value||V.value||M||!N.value)return!1;if(cn===Si.value)return!0;sn=!0;try{U.value=!1,tn.value=null,on=null,k.value=!1,j.value=!1,A.value=!1,H.value=!1,wr(),Tr(),At(),Vt&&xn(Vt),yield i();try{yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}}finally{yield i(),sn=!1}return!0})}()))return void Y(!1);if(a&&z.value&&k.value&&ln&&x.value)return ln=!1,j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),yield i(),yield ci(x.value,{allowStaleContentRetry:!1}),void Dr(!0);if(a&&k.value){if(z.value&&x.value){let e=L;if(e)try{yield e}catch{}_i();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));if(yield Rr(t.original,t.updated,E.value),M||!z.value)return;yield Promise.resolve(Dt()),qt(),X(!0),Xn(),Z(),sr();let n=yield Ir();M||!n||H.value||(yield Zn()),Q(),Dr(!0)}else qr(),Yr(W.value,E.value),yield new Promise(e=>{let t=()=>{M?e():Gr||Wr?setTimeout(t,16):e()};t()}),M||z.value||(yield Promise.resolve(Et()))}a&&z.value?(Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),Dr(!0)):Y(!1)}catch{}})})}),{immediate:!0,flush:`post`}),r(()=>{wr(),Tr(),kt(),Rt?.()}),(t,n)=>{var r;return V.value?(le(),d(Le,{key:0,style:oe(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Me.value,"diff-inline":un.value,"diff-hide-unchanged-regions":dn.value,"code-block-options":v.codeBlockOptions,"resolved-visual-options":Mn.value,"reserved-height-px":z.value&&(r=Tn.value)!=null?r:void 0,"is-dark":v.isDark,theme:v.theme,"dark-theme":v.darkTheme,"light-theme":v.lightTheme,themes:v.themes,"show-header":v.showHeader,"show-copy-button":v.showCopyButton,"clipboard-writer":v.clipboardWriter,"show-tooltips":v.showTooltips,onCopy:n[0]||=e=>pe(`copy`,e)},p({_:2},[t.$slots[`header-left`]?{name:`header-left`,fn:u(()=>[c(t.$slots,`header-left`,{},void 0,!0)]),key:`0`}:void 0,t.$slots[`header-right`]?{name:`header-right`,fn:u(()=>[c(t.$slots,`header-right`,{},void 0,!0)]),key:`1`}:void 0]),1032,[`style`,`node`,`loading`,`show-line-numbers`,`diff-inline`,`diff-hide-unchanged-regions`,`code-block-options`,`resolved-visual-options`,`reserved-height-px`,`is-dark`,`theme`,`dark-theme`,`light-theme`,`themes`,`show-header`,`show-copy-button`,`clipboard-writer`,`show-tooltips`])):(le(),ce(`div`,{key:1,ref_key:`container`,ref:S,style:oe(ni.value),class:ee([`code-block-container rounded-lg border`,[{dark:v.isDark,"is-rendering":v.loading,"is-dark":Zt.value,"is-diff":z.value,"is-plain-text":Xe.value}]]),"data-markstream-code-block":`1`,"data-markstream-enhanced":H.value&&!V.value?`true`:`false`,"data-markstream-enhancement-state":vn.value,"data-markstream-code-block-state":Vr()?`streaming`:`settled`,"data-markstream-pending":_n.value?`true`:void 0,"data-markstream-viewport-pending":St.value&&ae(vt)&&!N.value?`true`:void 0},[e(Fe,{"show-header":v.showHeader,"show-collapse-button":v.showCollapseButton,"show-font-size-buttons":v.showFontSizeButtons,"enable-font-size-control":v.enableFontSizeControl,"show-copy-button":v.showCopyButton,"show-expand-button":v.showExpandButton,"show-preview-button":v.showPreviewButton,"show-tooltips":v.showTooltips,"is-dark":v.isDark,loading:v.loading,stream:s.stream,"is-collapsed":O.value,"is-expanded":D.value,"copy-text":qe.value,"is-previewable":Br.value,"code-font-size":K.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":G.value,"font-baseline-ready":En.value,"diff-stats":z.value?Ht.value:null,"diff-stats-aria-label":Ut.value,onToggleCollapse:oi,onDecreaseFont:ur,onResetFont:dr,onIncreaseFont:lr,onCopy:ii,onToggleExpand:ai,onPreview:si},p({"header-left":u(()=>[c(t.$slots,`header-left`,{},()=>[h(`div`,$e,[h(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`,innerHTML:ti.value},null,8,et),h(`div`,tt,[h(`div`,nt,te($r.value),1),ei.value?(le(),ce(`div`,rt,te(ei.value),1)):se(``,!0)])])],!0)]),loading:u(()=>[c(t.$slots,`loading`,{loading:s.loading,stream:s.stream},()=>[n[1]||=h(`div`,{class:`loading-skeleton`},[h(`div`,{class:`skeleton-line`}),h(`div`,{class:`skeleton-line`}),h(`div`,{class:`skeleton-line short`})],-1)],!0)]),default:u(()=>{var e;return[o(h(`div`,{class:ee([`code-editor-layer`,{"code-editor-layer--collapsed":O.value}])},[h(`div`,{ref_key:`codeEditor`,ref:x,class:ee([`code-editor-container`,s.stream?``:`code-height-placeholder`]),"data-markstream-host-hidden":gn.value?`true`:void 0,style:oe(Jn.value)},null,14,it),hn.value?(le(),d(Le,{key:0,style:oe(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Me.value,"diff-inline":un.value,"diff-hide-unchanged-regions":dn.value,"code-block-options":v.codeBlockOptions,"resolved-visual-options":Mn.value,"reserved-height-px":z.value&&(e=Tn.value)!=null?e:void 0,"is-dark":v.isDark,theme:v.theme,"dark-theme":v.darkTheme,"light-theme":v.lightTheme,themes:v.themes,"show-toolbar":!1},null,8,[`style`,`node`,`loading`,`show-line-numbers`,`diff-inline`,`diff-hide-unchanged-regions`,`code-block-options`,`resolved-visual-options`,`reserved-height-px`,`is-dark`,`theme`,`dark-theme`,`light-theme`,`themes`])):se(``,!0)],2),[[re,!!s.stream||!s.loading]]),yn.value&&!Ge.value&&Br.value&&C.value===`html`?(le(),d(Ze,{key:0,code:v.node.code,"html-preview-allow-scripts":v.htmlPreviewAllowScripts,"html-preview-sandbox":v.htmlPreviewSandbox,"is-dark":v.isDark,"on-close":()=>yn.value=!1},null,8,[`code`,`html-preview-allow-scripts`,`html-preview-sandbox`,`is-dark`,`on-close`])):se(``,!0)]}),_:2},[t.$slots[`header-right`]?{name:`header-right`,fn:u(()=>[c(t.$slots,`header-right`,{},void 0,!0)]),key:`0`}:void 0]),1032,[`show-header`,`show-collapse-button`,`show-font-size-buttons`,`enable-font-size-control`,`show-copy-button`,`show-expand-button`,`show-preview-button`,`show-tooltips`,`is-dark`,`loading`,`stream`,`is-collapsed`,`is-expanded`,`copy-text`,`is-previewable`,`code-font-size`,`default-code-font-size`,`font-baseline-ready`,`diff-stats`,`diff-stats-aria-label`])],14,Qe))}}}),[[`__scopeId`,`data-v-f293a87c`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,I as n,M as r,Q as i,S as a,T as o,Y as s,c,ct as l,d as u,dt as d,f,g as p,h as m,it as h,v as g,y as _,z as v}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{
|
|
1
|
+
import{C as e,H as t,I as n,M as r,Q as i,S as a,T as o,Y as s,c,ct as l,d as u,dt as d,f,g as p,h as m,it as h,v as g,y as _,z as v}from"./vue.runtime.esm-bundler-DmQNwI70.js";import{v as y,y as b}from"./index-Ce8bdxwG.js";var x={class:`cc-input-row`},S=[`placeholder`],C={class:`cc-tabs`,role:`tablist`},w=[`aria-selected`,`disabled`,`onClick`],T={class:`cc-list`,role:`listbox`},E={key:0,class:`cc-empty`},D={key:1,class:`cc-empty`},O=[`aria-selected`,`onClick`,`onPointerenter`],k={class:`cc-item-body`},A={class:`cc-item-title`},j={key:0,class:`cc-item-sub`},M={key:0,class:`cc-badge`},N={key:1,class:`cc-kbd`},P=o({__name:`CommandCenter`,props:{workspaces:{},hosts:{},activeAgent:{},actions:{},api:{type:Function}},emits:[`close`,`selectWorkspace`,`openFile`,`restoreArchived`],setup(o,{emit:P}){let F=o,I=P,L=h(null),R=h(null);y(L,()=>I(`close`));let z=h(`workspaces`),B=h(``),V=h(0),H=m(()=>new Map(F.hosts.map(e=>[e.id,e.label]))),U=h([]),W=h(!1);async function G(){if(W.value)return;W.value=!0;let e=F.hosts.filter(e=>e.state===`connected`),t=await Promise.allSettled(e.map(e=>F.api(`/hosts/${encodeURIComponent(e.id)}/archived-workspaces`))),n=[];for(let e of t)e.status===`fulfilled`&&Array.isArray(e.value)&&n.push(...e.value);n.sort((e,t)=>Date.parse(t.archivedAt)-Date.parse(e.archivedAt)),U.value=n}let K=h([]),q=h(!1),J,Y=0;async function X(){let e=F.activeAgent;if(!e){K.value=[];return}let t=++Y;q.value=!0;try{let n=await F.api(`/hosts/${encodeURIComponent(e.hostId)}/fs/search?cwd=${encodeURIComponent(e.cwd)}&q=${encodeURIComponent(B.value.trim())}&limit=40`);t===Y&&(K.value=Array.isArray(n.files)?n.files:[])}catch{t===Y&&(K.value=[])}finally{t===Y&&(q.value=!1)}}s([z,B],([e,t])=>{V.value=0,e===`files`?(clearTimeout(J),J=setTimeout(()=>void X(),t?120:0)):e===`workspaces`&&t.trim().length>=2&&G()});let Z=m(()=>{let e=B.value.trim().toLowerCase(),t=e.split(/\s+/).filter(Boolean),n=e=>!t.length||t.every(t=>e.toLowerCase().includes(t));if(z.value===`workspaces`){let t=F.workspaces.filter(e=>n(`${e.name} ${e.project} ${e.branch??``} ${(e.labels??[]).join(` `)} ${H.value.get(e.hostId)??``}`)).slice(0,30).map(e=>({key:`ws:`+e.key,icon:`chat`,title:e.name,sub:[e.project,e.branch,F.hosts.length>1?H.value.get(e.hostId):``].filter(Boolean).join(` · `),badge:e.attention?`needs input`:e.state===`running`?`running`:void 0,run:()=>{I(`selectWorkspace`,e.key),I(`close`)}})),r=e?U.value.filter(e=>e.workspaceId&&n(`${e.name} ${e.project} ${H.value.get(e.hostId)??``}`)).slice(0,12).map(e=>({key:`arch:${e.hostId}:${e.workspaceId}`,icon:`archive`,title:e.name,sub:`${e.project} · archived`,badge:`restore`,run:()=>{e.workspaceId&&I(`restoreArchived`,e.hostId,e.workspaceId),I(`close`)}})):[];return[...t,...r]}return z.value===`files`?K.value.map(e=>({key:`file:`+e,icon:`file`,title:e.split(`/`).pop()||e,sub:e,run:()=>{I(`openFile`,e),I(`close`)}})):F.actions.filter(e=>n(`${e.label} ${e.sub??``}`)).map(e=>({key:`act:`+e.id,icon:e.icon,title:e.label,sub:e.sub??``,shortcut:e.shortcut,run:()=>{I(`close`),e.run()}}))}),Q=[{id:`workspaces`,label:`Workspaces`},{id:`files`,label:`Files`},{id:`actions`,label:`Actions`}];function $(e){if(e.key===`Tab`){e.preventDefault();let t=Q.findIndex(e=>e.id===z.value),n=Q[(t+(e.shiftKey?Q.length-1:1))%Q.length];z.value=n.id}else e.key===`ArrowDown`&&Z.value.length?(e.preventDefault(),V.value=(V.value+1)%Z.value.length):e.key===`ArrowUp`&&Z.value.length?(e.preventDefault(),V.value=(V.value-1+Z.value.length)%Z.value.length):e.key===`Enter`&&Z.value[V.value]&&(e.preventDefault(),Z.value[V.value].run())}return n(()=>{r(()=>R.value?.focus())}),(n,r)=>(v(),_(`div`,{class:`overlay cc-overlay`,onMousedown:r[1]||=u(e=>I(`close`),[`self`])},[p(`section`,{ref_key:`sheet`,ref:L,class:`sheet cc-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Command center`,tabindex:`-1`,onKeydown:$},[p(`div`,x,[e(b,{name:`search`,size:16,class:`cc-search-icon`}),i(p(`input`,{ref_key:`inputEl`,ref:R,"onUpdate:modelValue":r[0]||=e=>B.value=e,type:`search`,class:`cc-input`,placeholder:z.value===`workspaces`?`Jump to workspace or archived session…`:z.value===`files`?`Search files in current workspace…`:`Run an action…`,"aria-label":`Command center search`},null,8,S),[[c,B.value]]),r[2]||=p(`kbd`,{class:`cc-kbd`},`Esc`,-1)]),p(`div`,C,[(v(),_(f,null,t(Q,e=>p(`button`,{key:e.id,type:`button`,role:`tab`,class:l([`cc-tab`,{chosen:z.value===e.id}]),"aria-selected":z.value===e.id,disabled:e.id===`files`&&!o.activeAgent,onClick:t=>{z.value=e.id,R.value?.focus()}},d(e.label),11,w)),64)),r[3]||=p(`span`,{class:`cc-hint`},`Tab to switch`,-1)]),p(`div`,T,[z.value===`files`&&q.value&&!Z.value.length?(v(),_(`p`,E,[...r[4]||=[p(`span`,{class:`spinner spinner-sm`},null,-1),a(` Searching files…`,-1)]])):Z.value.length?g(``,!0):(v(),_(`p`,D,d(z.value===`files`&&!o.activeAgent?`Open a conversation to search its files.`:`No matches.`),1)),(v(!0),_(f,null,t(Z.value,(t,n)=>(v(),_(`button`,{key:t.key,type:`button`,role:`option`,class:l([`cc-item`,{active:n===V.value}]),"aria-selected":n===V.value,onClick:e=>t.run(),onPointerenter:e=>V.value=n},[e(b,{name:t.icon,size:15,class:`cc-item-icon`},null,8,[`name`]),p(`span`,k,[p(`span`,A,d(t.title),1),t.sub?(v(),_(`span`,j,d(t.sub),1)):g(``,!0)]),t.badge?(v(),_(`span`,M,d(t.badge),1)):g(``,!0),t.shortcut?(v(),_(`kbd`,N,d(t.shortcut),1)):g(``,!0)],42,O))),128))])],544)],32))}});export{P as default};
|
|
Binary file
|
|
Binary file
|