glimmervoid 0.48.4-next.365 → 0.48.4-next.367
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/glimmervoid.js +4 -4
- package/dist/chunks/config-store-Bp-9Hnv1.js +1 -0
- package/dist/chunks/{config-store-C4F1jFS5.js → config-store-_A681WTh.js} +19 -19
- package/dist/chunks/{main-DBmWw1C0.js → main-zC1ZiLto.js} +3 -3
- package/dist/chunks/{pair-cli-C3fWhIAi.js → pair-cli-39Abgbgj.js} +2 -2
- package/dist/chunks/{pairings-store-f7H7GLth.js → pairings-store-DshCT7KO.js} +1 -1
- package/dist/chunks/{settings-cli-DjwrypAR.js → settings-cli-B4708aPa.js} +2 -2
- package/dist/chunks/{settings-readout-core-ysijObpZ.js → settings-readout-core-iX9Lmx9C.js} +1 -1
- package/dist/chunks/{why-cli-QAQcKDac.js → why-cli-D368n3Uj.js} +1 -1
- package/dist/client/assets/{action-status-Cmp0b1QX.js → action-status-SSA4xM57.js} +1 -1
- package/dist/client/assets/action-status-SSA4xM57.js.br +0 -0
- package/dist/client/assets/{benchmark-panel-DMaFTHSy.js → benchmark-panel-BrGfFoNE.js} +1 -1
- package/dist/client/assets/benchmark-panel-BrGfFoNE.js.br +0 -0
- package/dist/client/assets/{boards-view-jsQ244-X.js → boards-view-2D1xKQgq.js} +1 -1
- package/dist/client/assets/boards-view-2D1xKQgq.js.br +0 -0
- package/dist/client/assets/{card-registry-D5EJa_tx.js → card-registry-CLrAbqh5.js} +1 -1
- package/dist/client/assets/card-registry-CLrAbqh5.js.br +0 -0
- package/dist/client/assets/{community-panel-DN6PVvRA.js → community-panel-DqxgjCLq.js} +1 -1
- package/dist/client/assets/community-panel-DqxgjCLq.js.br +0 -0
- package/dist/client/assets/{control-ws-2skDxNtN.js → control-ws-ByEqbpGM.js} +1 -1
- package/dist/client/assets/control-ws-ByEqbpGM.js.br +0 -0
- package/dist/client/assets/{dialogs-Ctm9a5ta.js → dialogs-CzCxA5Ux.js} +1 -1
- package/dist/client/assets/dialogs-CzCxA5Ux.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-DE53uQW7.js → doc-editor-ui-CyYkJPMj.js} +1 -1
- package/dist/client/assets/doc-editor-ui-CyYkJPMj.js.br +0 -0
- package/dist/client/assets/{feature-hint-Bp3VFbjC.js → feature-hint-BNhdPlzZ.js} +1 -1
- package/dist/client/assets/feature-hint-BNhdPlzZ.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-qDEdXCt8.js → first-run-checklist-CbdanmwZ.js} +1 -1
- package/dist/client/assets/first-run-checklist-CbdanmwZ.js.br +0 -0
- package/dist/client/assets/{hooks-panel-BXs4d-tU.js → hooks-panel-B6JRtpmJ.js} +1 -1
- package/dist/client/assets/hooks-panel-B6JRtpmJ.js.br +0 -0
- package/dist/client/assets/{index-D3RHreq_.js → index-Bq8I2EvJ.js} +5 -5
- package/dist/client/assets/index-Bq8I2EvJ.js.br +0 -0
- package/dist/client/assets/{index-BXAPBja3.css → index-PKZ4_A2u.css} +1 -1
- package/dist/client/assets/index-PKZ4_A2u.css.br +0 -0
- package/dist/client/assets/{issues-panel-9mOE8zXL.js → issues-panel-G4mEB3dK.js} +1 -1
- package/dist/client/assets/issues-panel-G4mEB3dK.js.br +0 -0
- package/dist/client/assets/{my-prs-panel-CcX-pAqY.js → my-prs-panel-DOdmzv68.js} +1 -1
- package/dist/client/assets/my-prs-panel-DOdmzv68.js.br +0 -0
- package/dist/client/assets/{nyan-cat-DFh3nMzF.js → nyan-cat-DlhEx1mZ.js} +1 -1
- package/dist/client/assets/nyan-cat-DlhEx1mZ.js.br +0 -0
- package/dist/client/assets/{phone-shell-BmSQhOSG.js → phone-shell-fB6lPELg.js} +1 -1
- package/dist/client/assets/phone-shell-fB6lPELg.js.br +0 -0
- package/dist/client/assets/{plan-face-BzW_2CvO.js → plan-face-tBYo_PZH.js} +1 -1
- package/dist/client/assets/plan-face-tBYo_PZH.js.br +0 -0
- package/dist/client/assets/{plan-render-DfvVjoYs.js → plan-render-6sWMbnSt.js} +1 -1
- package/dist/client/assets/plan-render-6sWMbnSt.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-o6lNWYO5.js → pr-queue-columns-DxnG1qNa.js} +1 -1
- package/dist/client/assets/pr-queue-columns-DxnG1qNa.js.br +0 -0
- package/dist/client/assets/{radar-panel-DZJSXX1b.js → radar-panel-D55NzF80.js} +1 -1
- package/dist/client/assets/radar-panel-D55NzF80.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-D6yAfKwN.js → repo-roots-adder-v6aAPuPt.js} +1 -1
- package/dist/client/assets/repo-roots-adder-v6aAPuPt.js.br +0 -0
- package/dist/client/assets/{resume-dialog-BPU5jXiM.js → resume-dialog-Dw2z4Ojb.js} +1 -1
- package/dist/client/assets/resume-dialog-Dw2z4Ojb.js.br +0 -0
- package/dist/client/assets/{review-queue-panel-CbOYFuvl.js → review-queue-panel-BNKkooZu.js} +1 -1
- package/dist/client/assets/review-queue-panel-BNKkooZu.js.br +0 -0
- package/dist/client/assets/{session-tick-DbbSgMSO.js → session-tick-D6kuntKS.js} +1 -1
- package/dist/client/assets/settings-panel-4KwHrqDp.js +4 -0
- package/dist/client/assets/settings-panel-4KwHrqDp.js.br +0 -0
- package/dist/client/assets/{settings-panel-01vd9F5E.css → settings-panel-CeivRs_R.css} +1 -1
- package/dist/client/assets/settings-panel-CeivRs_R.css.br +0 -0
- package/dist/client/assets/{shown-lightbox-jZTpX__5.js → shown-lightbox-C7TDDwJJ.js} +1 -1
- package/dist/client/assets/shown-lightbox-C7TDDwJJ.js.br +0 -0
- package/dist/client/assets/{team-review-panel-D4ozz-bx.js → team-review-panel-fzO8k-mj.js} +1 -1
- package/dist/client/assets/team-review-panel-fzO8k-mj.js.br +0 -0
- package/dist/client/assets/{trace-panel-B9Tav9zL.js → trace-panel-CF81yqIl.js} +1 -1
- package/dist/client/assets/trace-panel-CF81yqIl.js.br +0 -0
- package/dist/client/assets/updates-view-core-Qkm1ZY4B.js +1 -0
- package/dist/client/assets/updates-view-core-Qkm1ZY4B.js.br +0 -0
- package/dist/client/assets/{usage-panel-CqXJelGp.js → usage-panel-myBGax-F.js} +1 -1
- package/dist/client/assets/usage-panel-myBGax-F.js.br +0 -0
- package/dist/client/assets/{your-day-tip-CRxJwRI6.js → your-day-tip-CqIuEa1V.js} +1 -1
- package/dist/client/assets/your-day-tip-CqIuEa1V.js.br +5 -0
- package/dist/client/index.html +7 -7
- package/dist/client/index.html.br +0 -0
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/config-store-BCRofrnq.js +0 -1
- package/dist/client/assets/action-status-Cmp0b1QX.js.br +0 -0
- package/dist/client/assets/benchmark-panel-DMaFTHSy.js.br +0 -0
- package/dist/client/assets/boards-view-jsQ244-X.js.br +0 -0
- package/dist/client/assets/card-registry-D5EJa_tx.js.br +0 -0
- package/dist/client/assets/community-panel-DN6PVvRA.js.br +0 -0
- package/dist/client/assets/control-ws-2skDxNtN.js.br +0 -0
- package/dist/client/assets/dialogs-Ctm9a5ta.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-DE53uQW7.js.br +0 -0
- package/dist/client/assets/feature-hint-Bp3VFbjC.js.br +0 -0
- package/dist/client/assets/first-run-checklist-qDEdXCt8.js.br +0 -0
- package/dist/client/assets/hooks-panel-BXs4d-tU.js.br +0 -0
- package/dist/client/assets/index-BXAPBja3.css.br +0 -0
- package/dist/client/assets/index-D3RHreq_.js.br +0 -0
- package/dist/client/assets/issues-panel-9mOE8zXL.js.br +0 -0
- package/dist/client/assets/my-prs-panel-CcX-pAqY.js.br +0 -0
- package/dist/client/assets/nyan-cat-DFh3nMzF.js.br +0 -0
- package/dist/client/assets/phone-shell-BmSQhOSG.js.br +0 -0
- package/dist/client/assets/plan-face-BzW_2CvO.js.br +0 -0
- package/dist/client/assets/plan-render-DfvVjoYs.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-o6lNWYO5.js.br +0 -4
- package/dist/client/assets/radar-panel-DZJSXX1b.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-D6yAfKwN.js.br +0 -0
- package/dist/client/assets/resume-dialog-BPU5jXiM.js.br +0 -0
- package/dist/client/assets/review-queue-panel-CbOYFuvl.js.br +0 -0
- package/dist/client/assets/settings-panel-01vd9F5E.css.br +0 -0
- package/dist/client/assets/settings-panel-BmaoW0X9.js +0 -4
- package/dist/client/assets/settings-panel-BmaoW0X9.js.br +0 -0
- package/dist/client/assets/shown-lightbox-jZTpX__5.js.br +0 -0
- package/dist/client/assets/team-review-panel-D4ozz-bx.js.br +0 -0
- package/dist/client/assets/trace-panel-B9Tav9zL.js.br +0 -0
- package/dist/client/assets/updates-view-core-4oGJ3ZXL.js +0 -1
- package/dist/client/assets/updates-view-core-4oGJ3ZXL.js.br +0 -0
- package/dist/client/assets/usage-panel-CqXJelGp.js.br +0 -0
- package/dist/client/assets/your-day-tip-CRxJwRI6.js.br +0 -0
package/dist/bin/glimmervoid.js
CHANGED
|
@@ -63,7 +63,7 @@ var OWNED_COMMAND_RUNNERS = {
|
|
|
63
63
|
return await runDoctor() ? 0 : 1;
|
|
64
64
|
},
|
|
65
65
|
pair: async ({ values }) => {
|
|
66
|
-
const { runPairCli } = await import("../chunks/pair-cli-
|
|
66
|
+
const { runPairCli } = await import("../chunks/pair-cli-39Abgbgj.js");
|
|
67
67
|
return runPairCli({
|
|
68
68
|
isListing: values.list === true,
|
|
69
69
|
revokeDeviceId: typeof values.revoke === "string" ? values.revoke : null,
|
|
@@ -75,11 +75,11 @@ var OWNED_COMMAND_RUNNERS = {
|
|
|
75
75
|
return runAgentSetupCli();
|
|
76
76
|
},
|
|
77
77
|
settings: async (parsed) => {
|
|
78
|
-
const { runParsedSettingsCli } = await import("../chunks/settings-cli-
|
|
78
|
+
const { runParsedSettingsCli } = await import("../chunks/settings-cli-B4708aPa.js");
|
|
79
79
|
return runParsedSettingsCli(parsed);
|
|
80
80
|
},
|
|
81
81
|
why: async ({ positionals }) => {
|
|
82
|
-
const { runWhyCli } = await import("../chunks/why-cli-
|
|
82
|
+
const { runWhyCli } = await import("../chunks/why-cli-D368n3Uj.js");
|
|
83
83
|
return runWhyCli({ targetArgument: positionals[0] ?? "" });
|
|
84
84
|
},
|
|
85
85
|
"ssh-sign": async ({ rawArgs }) => {
|
|
@@ -176,7 +176,7 @@ async function readDeclaredCustomAgents() {
|
|
|
176
176
|
declared: [],
|
|
177
177
|
error: null
|
|
178
178
|
};
|
|
179
|
-
const { loadConfigFile } = await import("../chunks/config-store-
|
|
179
|
+
const { loadConfigFile } = await import("../chunks/config-store-Bp-9Hnv1.js");
|
|
180
180
|
try {
|
|
181
181
|
const loaded = loadConfigFile(decided.path, { exitOnError: false });
|
|
182
182
|
if (!loaded.config) return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { c as loadConfigFile } from "./config-store-_A681WTh.js";
|
|
@@ -914,7 +914,7 @@ var SECTIONS = Object.freeze([
|
|
|
914
914
|
sectionId: "browser-appearance",
|
|
915
915
|
settingId: "alert-sounds-enabled"
|
|
916
916
|
}],
|
|
917
|
-
description: "Play a sound when a session needs you
|
|
917
|
+
description: "Play a sound when a session needs you, like the note button in the header.",
|
|
918
918
|
control: "toggle",
|
|
919
919
|
keywords: [
|
|
920
920
|
"audio",
|
|
@@ -933,7 +933,7 @@ var SECTIONS = Object.freeze([
|
|
|
933
933
|
sectionId: "browser-appearance",
|
|
934
934
|
settingId: "alert-sound"
|
|
935
935
|
}],
|
|
936
|
-
description: "Sound played when a session needs you
|
|
936
|
+
description: "Sound played when a session needs you, including files you add to ~/.glimmervoid/sounds/.",
|
|
937
937
|
control: "select",
|
|
938
938
|
optionsFrom: "sounds",
|
|
939
939
|
keywords: [
|
|
@@ -982,7 +982,7 @@ var SECTIONS = Object.freeze([
|
|
|
982
982
|
id: "telegram-chat-id",
|
|
983
983
|
path: "telegram.chatId",
|
|
984
984
|
title: "Chat id",
|
|
985
|
-
description: "Chat the bot posts to
|
|
985
|
+
description: "Chat the bot posts to, read as message.chat.id from its getUpdates page after you message it.",
|
|
986
986
|
control: "text",
|
|
987
987
|
keywords: ["destination", "channel"],
|
|
988
988
|
defaultValue: "",
|
|
@@ -1032,7 +1032,7 @@ var SECTIONS = Object.freeze([
|
|
|
1032
1032
|
id: "tab-order",
|
|
1033
1033
|
path: "viewTabOrder",
|
|
1034
1034
|
title: "Tab order",
|
|
1035
|
-
description: "Order of the dashboard tabs
|
|
1035
|
+
description: "Order of the dashboard tabs, also set by dragging tabs in the header.",
|
|
1036
1036
|
control: "tab-order",
|
|
1037
1037
|
keywords: [
|
|
1038
1038
|
"tabs",
|
|
@@ -1180,7 +1180,7 @@ var SECTIONS = Object.freeze([
|
|
|
1180
1180
|
id: "sane-yolo-unreadable-paths",
|
|
1181
1181
|
path: "saneYoloUnreadablePaths",
|
|
1182
1182
|
title: "Unreadable folders",
|
|
1183
|
-
description: "Extra files and folders agents may not read
|
|
1183
|
+
description: "Extra files and folders agents may not read, where ~ is your home folder.",
|
|
1184
1184
|
control: "list",
|
|
1185
1185
|
keywords: [
|
|
1186
1186
|
"guardrails",
|
|
@@ -1298,7 +1298,7 @@ var SECTIONS = Object.freeze([
|
|
|
1298
1298
|
id: "usage-your-day",
|
|
1299
1299
|
path: "usage.yourDay",
|
|
1300
1300
|
title: "Your day",
|
|
1301
|
-
description: "Recap yesterday and suggest a pace for today
|
|
1301
|
+
description: "Recap yesterday and suggest a pace for today when usage tracking is on.",
|
|
1302
1302
|
control: "toggle",
|
|
1303
1303
|
keywords: [
|
|
1304
1304
|
"burnout",
|
|
@@ -1325,7 +1325,7 @@ var SECTIONS = Object.freeze([
|
|
|
1325
1325
|
id: "usage-daily-budget",
|
|
1326
1326
|
path: "usage.budget.dailyUsd",
|
|
1327
1327
|
title: "Daily budget",
|
|
1328
|
-
description: "Alert at 50%, 75% and 100% of this estimated daily spend
|
|
1328
|
+
description: "Alert at 50%, 75% and 100% of this estimated daily spend, or never at zero.",
|
|
1329
1329
|
control: "number",
|
|
1330
1330
|
range: USAGE_BUDGET_RANGE,
|
|
1331
1331
|
unit: USD,
|
|
@@ -1341,7 +1341,7 @@ var SECTIONS = Object.freeze([
|
|
|
1341
1341
|
id: "usage-monthly-budget",
|
|
1342
1342
|
path: "usage.budget.monthlyUsd",
|
|
1343
1343
|
title: "Monthly budget",
|
|
1344
|
-
description: "Alert at 50%, 75% and 100% of this estimated monthly spend
|
|
1344
|
+
description: "Alert at 50%, 75% and 100% of this estimated monthly spend, or never at zero.",
|
|
1345
1345
|
control: "number",
|
|
1346
1346
|
range: USAGE_BUDGET_RANGE,
|
|
1347
1347
|
unit: USD,
|
|
@@ -1396,7 +1396,7 @@ var SECTIONS = Object.freeze([
|
|
|
1396
1396
|
id: "posthog-projects",
|
|
1397
1397
|
path: "posthog.projects",
|
|
1398
1398
|
title: "Projects",
|
|
1399
|
-
description: "Project ids to watch,
|
|
1399
|
+
description: "Project ids to watch, where empty watches all and none watches none.",
|
|
1400
1400
|
control: "list",
|
|
1401
1401
|
keywords: ["project ids", "filter"],
|
|
1402
1402
|
defaultValue: "all",
|
|
@@ -1457,7 +1457,7 @@ var SECTIONS = Object.freeze([
|
|
|
1457
1457
|
id: "posthog-auto-fix",
|
|
1458
1458
|
path: "posthog.autoFix",
|
|
1459
1459
|
title: "Attempt fixes for major issues",
|
|
1460
|
-
description: "Let an agent fix an issue on a local branch
|
|
1460
|
+
description: "Let an agent fix an issue on a local branch, opening a pull request only after you approve.",
|
|
1461
1461
|
control: "toggle",
|
|
1462
1462
|
keywords: ["automatic", "pull request"],
|
|
1463
1463
|
danger: true,
|
|
@@ -1478,7 +1478,7 @@ var SECTIONS = Object.freeze([
|
|
|
1478
1478
|
id: "team-review-enabled",
|
|
1479
1479
|
path: "teamReview.enabled",
|
|
1480
1480
|
title: "Enable team review",
|
|
1481
|
-
description: "Draft a review of each open team pull request
|
|
1481
|
+
description: "Draft a review of each open team pull request, posting nothing until you approve or comment.",
|
|
1482
1482
|
control: "toggle",
|
|
1483
1483
|
keywords: ["pull requests", "github"],
|
|
1484
1484
|
defaultValue: true,
|
|
@@ -1532,7 +1532,7 @@ var SECTIONS = Object.freeze([
|
|
|
1532
1532
|
id: "team-review-skill",
|
|
1533
1533
|
path: "teamReview.skill",
|
|
1534
1534
|
title: "Review skill",
|
|
1535
|
-
description: "Skill Claude Code follows for each review
|
|
1535
|
+
description: "Skill Claude Code follows for each review, or none when empty.",
|
|
1536
1536
|
control: "text",
|
|
1537
1537
|
keywords: [
|
|
1538
1538
|
"skill",
|
|
@@ -1547,7 +1547,7 @@ var SECTIONS = Object.freeze([
|
|
|
1547
1547
|
id: "team-review-reviewer-model",
|
|
1548
1548
|
path: "teamReview.reviewer.model",
|
|
1549
1549
|
title: "Review model",
|
|
1550
|
-
description: "Model for reviews
|
|
1550
|
+
description: "Model for reviews, or the agent's default when empty.",
|
|
1551
1551
|
control: "text",
|
|
1552
1552
|
keywords: [
|
|
1553
1553
|
"model",
|
|
@@ -1563,7 +1563,7 @@ var SECTIONS = Object.freeze([
|
|
|
1563
1563
|
id: "team-review-reviewer-effort",
|
|
1564
1564
|
path: "teamReview.reviewer.effort",
|
|
1565
1565
|
title: "Review effort",
|
|
1566
|
-
description: "Effort for reviews
|
|
1566
|
+
description: "Effort for reviews, or the agent's default when empty.",
|
|
1567
1567
|
control: "text",
|
|
1568
1568
|
keywords: [
|
|
1569
1569
|
"effort",
|
|
@@ -1721,7 +1721,7 @@ var SECTIONS = Object.freeze([
|
|
|
1721
1721
|
id: "workflows-rules",
|
|
1722
1722
|
path: "status:workflow-rules",
|
|
1723
1723
|
title: "Workflow rules",
|
|
1724
|
-
description: "Turn each rule on or off.
|
|
1724
|
+
description: "Turn each workflow rule on or off.",
|
|
1725
1725
|
control: "readonly",
|
|
1726
1726
|
keywords: [
|
|
1727
1727
|
"pull requests",
|
|
@@ -1744,7 +1744,7 @@ var SECTIONS = Object.freeze([
|
|
|
1744
1744
|
id: "benchmarks-enabled",
|
|
1745
1745
|
path: "benchmarks.enabled",
|
|
1746
1746
|
title: "Enable benchmarks",
|
|
1747
|
-
description: "Show the Bench tab
|
|
1747
|
+
description: "Show the Bench tab, where nothing runs until you start it.",
|
|
1748
1748
|
control: "toggle",
|
|
1749
1749
|
keywords: [
|
|
1750
1750
|
"eval",
|
|
@@ -1765,7 +1765,7 @@ var SECTIONS = Object.freeze([
|
|
|
1765
1765
|
id: "coherence-enabled",
|
|
1766
1766
|
path: "coherence.enabled",
|
|
1767
1767
|
title: "Show session Coherence",
|
|
1768
|
-
description: "Show each session's Coherence hook status and decisions
|
|
1768
|
+
description: "Show each session's Coherence hook status and decisions (needs @posthog/coherence 1.8 or newer).",
|
|
1769
1769
|
control: "toggle",
|
|
1770
1770
|
keywords: [
|
|
1771
1771
|
"experimental",
|
|
@@ -1824,7 +1824,7 @@ var SECTIONS = Object.freeze([
|
|
|
1824
1824
|
id: "community-skill",
|
|
1825
1825
|
path: "community.skill",
|
|
1826
1826
|
title: "Research skill",
|
|
1827
|
-
description: "Skill the research agent follows
|
|
1827
|
+
description: "Skill the research agent follows, or none when empty.",
|
|
1828
1828
|
control: "text",
|
|
1829
1829
|
keywords: [
|
|
1830
1830
|
"skill",
|
|
@@ -1867,7 +1867,7 @@ var SECTIONS = Object.freeze([
|
|
|
1867
1867
|
id: "community-discord-channels",
|
|
1868
1868
|
path: "community.discordChannels",
|
|
1869
1869
|
title: "Discord channels",
|
|
1870
|
-
description: "Discord channels to watch for questions, without the
|
|
1870
|
+
description: "Discord channels to watch for questions, without the #, or none to skip Discord.",
|
|
1871
1871
|
control: "list",
|
|
1872
1872
|
keywords: [
|
|
1873
1873
|
"discord",
|
|
@@ -18,15 +18,15 @@ import { r as knownWriteHookInput } from "./posthog-read-gate-core-CeSY56AB.js";
|
|
|
18
18
|
import { a as readPageTitle, c as planSteps$1, i as filesAfterRetention, l as unitsOf, n as decideShownKind, o as shownMimeForFilename, r as describeOverCap, s as findDependencyCycle, t as SHOWN_SNIFF_BYTES } from "./shown-files-core-B6ovU6SV.js";
|
|
19
19
|
import { n as shellQuote } from "./hook-command-core-qTNK-xMF.js";
|
|
20
20
|
import { C as parseCgroupBytes, D as DEFAULT_MAX_MS, E as DEFAULT_BASE_MS, O as nextBackoffMs, S as memoryReserveBytes, T as parseMemAvailableBytes, _ as createSpawnGate, a as jsonStateLoadError, b as cgroupLimitBytes, c as loadedJsonValue, d as writeJsonAtomicSync, g as createSerialQueue, h as createMemoryAdmission, i as createJsonStateWriter, m as createKeyedSerialQueue, n as appendJsonLines, o as loadJsonStateFile, p as writeTextAtomicSync, r as createJsonStateStore, s as loadJsonStateFileSync, t as appendJsonLine, u as writeJsonAtomic, v as isQueueAdmissionTimeout, w as parseCgroupV2Path, x as headroomFromReadings, y as cgroupAncestorPaths } from "./json-file-AKRVPqG1.js";
|
|
21
|
-
import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-
|
|
21
|
+
import { $ as stableConfigKey, B as buildPersonProperties, F as TELEMETRY_FLAGS_URL, G as decideRemoteTelemetryState, H as claudeAccountUuidOf, I as adapterBucket, J as nodeMajorVersion, K as decideTelemetryConsent, L as buildAiGenerationEvents, M as isExperimentalSetting, N as FIRST_RUN_NOTICE, P as TELEMETRY_BATCH_URL, R as buildBrowserExceptionProperties, U as codexUserIdOf, V as classifySessionExit, W as decideIsDevInstall, X as resolveProjectToken, Y as parsePosthogReleaseId, _ as settingsBlockSpecFor, a as ensureProjectIds, at as sessionIdFromBranch, ct as canonicalizePath, f as DEFAULT_TIMER_FNS, g as mergeSettingsBlock, i as createConfigStore, it as planWorktreeGc, k as valueAtPath, lt as comparableDirectoryPath, n as DEFAULT_CONFIG, nt as matchedPrefix, o as generateProjectId, ot as usablePrefixes, p as unrefTimer, q as exceptionFingerprint, rt as planBranchGc, s as glimmervoidHomeDir$1, st as worktreeIntegrationTips, t as ABORT_CONFIG_SAVE, tt as DEFAULT_BRANCH_GC_PREFIXES, ut as isSameDirectoryPath, v as validateSettingsBlock, y as SETTINGS_INDEX, z as buildExceptionProperties } from "./config-store-_A681WTh.js";
|
|
22
22
|
import { _ as TelemetryState, a as DEEP_HISTORY_SCROLLBACK_LINES, c as describeDataAttach, d as DashboardTelemetryReport, h as TELEMETRY_EVENT_SCHEMAS, i as HookEnvelope, l as parseDataAttach, m as PendingCrashReport, r as HTTP_URL_RE, s as LOGGED_FAST_CLOSE_COUNTS, u as parseDataClientMessage } from "./build-channel-CgXyvO8w.js";
|
|
23
23
|
import { i as resolveArgvCommandMatches } from "./kimi-DGnMgNsj.js";
|
|
24
24
|
import { $ as grokHomes, A as decideUploadType, B as containmentRefusalReason, C as parseRegistryLatest, Ct as shouldReplace, D as openContainedFile, Dt as claudeCode, E as shortSha$1, Et as HOOK_TOOLS, F as planUploadRetention, G as codexFallbackRoots, H as planContiguousRead, I as MAX_TRANSCRIPT_READ_BYTES, J as codexSessionIdFromPath, K as codexHomes, L as TRACE_TAIL_SCAN_BYTES, M as framePathPaste, N as imageMimeForUploadFilename, O as MAX_UPLOAD_BYTES, P as isSafePathSegment, Q as expandTilde, R as committedOffsetFromTraceTailOrNull, S as parseRegistryDeprecation, St as parseUsageLine, T as pickNewestPublished, Tt as vendorUsageEntry, U as resumeOffsetFrom, V as isOversizedPartialLine, W as withCommittedOffset, X as decideFileRead, Y as continuationDelayMs, Z as dedupeCodexFiles, _ as decideInstallFlavor, _t as foldReplacementIntoGenerationRollup, a as describeAgentResolvability, at as scopedClaudeRoots, b as normalizeSha, bt as mergeGenerationRollups, c as isKnownAgentId, ct as shouldPersistWarehouse, d as resolveAdapter, dt as parseKimiUsageLine, et as isUsageFile, f as setCustomAgents, ft as addEntryToTotals, g as NODE_PTY_INSTALL_SCRIPT_FLAG, gt as foldEntryIntoGenerationRollup, h as requestCodexAppServer, ht as expandAdvisorIterations, i as customAgentFingerprint, it as resolveProjectsDirs, j as exceedsUploadCap, k as buildUploadFilename, l as listAgentIds, lt as splitLines, m as readHostCodexVersion, mt as emptyTotals, n as cachedAgentResolvability, nt as passOutcome, o as getAdapter, ot as sessionsRootCandidates, p as codex, pt as dedupKeys, q as codexRootCandidates, r as commandFor, rt as projectDirCandidates, s as hookProfileOf, st as shouldEvaluateDespiteIoFailures, t as DEFAULT_AGENT_ID$1, tt as kimiHomes, u as resetCommandCache, ut as kimiDedupIdentity, v as decideUpdateStatus, vt as identityFromRelPath, w as parseResolvedSha, wt as totalTokensOf$1, x as normalizeUpdateChannel, xt as parseJsonLine, y as isCheckFresh, yt as isWithinGenerationRecencyWindow, z as completeLineBytes } from "./adapters-BDT8SItf.js";
|
|
25
25
|
import { c as CODEX_HOME_PROFILE, l as KIMI_HOME_PROFILE } from "./agent-home-core-DgW3orTE.js";
|
|
26
26
|
import { d as releaseSessionLock, f as sessionIdOfLockFile, l as releaseUnheldAgentHomeSecrets, n as generatedAgentHomePath, p as trashSessionTempFolderOnceUnheld, s as realAgentHome, u as createHeldSessionTempFolder } from "./agent-home-BzANIIVe.js";
|
|
27
27
|
import { a as formatSshPublicKey, c as orderAgentSockets, i as commitSigningShimText, l as parseSshPublicKey, n as NO_AGENT_HOLDS_KEY, o as isForwardedAgentDirName, r as agentListsKey, s as isSignableGitObject, t as COMMIT_SIGNING_SHIM_NAME } from "./ssh-signing-core-CRhVVWNW.js";
|
|
28
|
-
import { a as defaultPairingsPath, c as decideDeviceAuth, i as createSeenStore, l as deviceNameFromUserAgent, n as configSiblingPath, o as defaultSeenPath, r as createPairingsStore, s as DEFAULT_DEVICE_MAX_AGE_MS, u as hashSecret } from "./pairings-store-
|
|
29
|
-
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-
|
|
28
|
+
import { a as defaultPairingsPath, c as decideDeviceAuth, i as createSeenStore, l as deviceNameFromUserAgent, n as configSiblingPath, o as defaultSeenPath, r as createPairingsStore, s as DEFAULT_DEVICE_MAX_AGE_MS, u as hashSecret } from "./pairings-store-DshCT7KO.js";
|
|
29
|
+
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-iX9Lmx9C.js";
|
|
30
30
|
import { n as normalizeRemoteConfig, r as validateRemoteConfig, t as decideBindHost } from "./remote-config-Dcejfz01.js";
|
|
31
31
|
import { g as runGit, h as runGh, i as createCommitSessions, m as runCommand, p as gitCommandFailure, t as COMMIT_SESSIONS_FOLDER_NAME } from "./commit-sessions-DdXZUMYK.js";
|
|
32
32
|
import { createRequire } from "node:module";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as errorMessage } from "./text-DoirglWV.js";
|
|
2
|
-
import { l as resolveConfigPath } from "./config-store-
|
|
3
|
-
import { a as defaultPairingsPath, i as createSeenStore, o as defaultSeenPath, r as createPairingsStore, t as REVOCATION_PROPAGATION_SECONDS } from "./pairings-store-
|
|
2
|
+
import { l as resolveConfigPath } from "./config-store-_A681WTh.js";
|
|
3
|
+
import { a as defaultPairingsPath, i as createSeenStore, o as defaultSeenPath, r as createPairingsStore, t as REVOCATION_PROPAGATION_SECONDS } from "./pairings-store-DshCT7KO.js";
|
|
4
4
|
import { n as normalizeRemoteConfig } from "./remote-config-Dcejfz01.js";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
//#region server/text-format.ts
|
|
@@ -2,7 +2,7 @@ import { n as errorLabel, r as errorMessage } from "./text-DoirglWV.js";
|
|
|
2
2
|
import { l as equalsIgnoringCaseOnWindows } from "./runtime-paths-D_ZjJLE0.js";
|
|
3
3
|
import { n as isRecord } from "./coerce-oz_Z_6E7.js";
|
|
4
4
|
import { a as jsonStateLoadError, d as writeJsonAtomicSync, l as sleepSync, s as loadJsonStateFileSync, u as writeJsonAtomic } from "./json-file-AKRVPqG1.js";
|
|
5
|
-
import { ct as canonicalizePath, f as DEFAULT_TIMER_FNS, p as unrefTimer, s as glimmervoidHomeDir } from "./config-store-
|
|
5
|
+
import { ct as canonicalizePath, f as DEFAULT_TIMER_FNS, p as unrefTimer, s as glimmervoidHomeDir } from "./config-store-_A681WTh.js";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import crypto from "node:crypto";
|
|
@@ -4,8 +4,8 @@ import { m as AgentSettingsReply } from "./session-CmkfJxzB.js";
|
|
|
4
4
|
import { r as BrowserConfig } from "./config-ClFP3R54.js";
|
|
5
5
|
import { n as isRecord } from "./coerce-oz_Z_6E7.js";
|
|
6
6
|
import { t as renderTable } from "./ascii-figure-core-pDAwtlKO.js";
|
|
7
|
-
import { E as setValueAtPath, Q as readEnvSecrets, T as scoreSettingsSearch, Z as ENV_SECRET_BINDINGS, b as cloneValue, c as loadConfigFile, d as validateConfig, et as withEnvSecrets, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, r as IS_EXPERIMENTAL_BUILD, u as saveConfigFileOnce, w as parsePosthogProjectSelection, x as deleteValueAtPath } from "./config-store-
|
|
8
|
-
import { a as fail, c as listSettings, d as renderSectionTables, f as requireConfigFileSetting, g as valueText, h as succeed, i as describeSetting, l as readSetting, m as settingsRequestForServer, n as configFileViewOf, o as fitColumn, p as sectionOf, r as defaultText, s as getSetting, t as availableSettings } from "./settings-readout-core-
|
|
7
|
+
import { E as setValueAtPath, Q as readEnvSecrets, T as scoreSettingsSearch, Z as ENV_SECRET_BINDINGS, b as cloneValue, c as loadConfigFile, d as validateConfig, et as withEnvSecrets, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, r as IS_EXPERIMENTAL_BUILD, u as saveConfigFileOnce, w as parsePosthogProjectSelection, x as deleteValueAtPath } from "./config-store-_A681WTh.js";
|
|
8
|
+
import { a as fail, c as listSettings, d as renderSectionTables, f as requireConfigFileSetting, g as valueText, h as succeed, i as describeSetting, l as readSetting, m as settingsRequestForServer, n as configFileViewOf, o as fitColumn, p as sectionOf, r as defaultText, s as getSetting, t as availableSettings } from "./settings-readout-core-iX9Lmx9C.js";
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
//#region server/settings-cli.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h as AgentSettingsRequest } from "./session-CmkfJxzB.js";
|
|
2
2
|
import { t as renderTable } from "./ascii-figure-core-pDAwtlKO.js";
|
|
3
|
-
import { A as FILE_ONLY_GROUPS, C as hasScaledUnit, D as settingsGroupOf, O as settingsOf, Q as readEnvSecrets, S as displayText, b as cloneValue, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, y as SETTINGS_INDEX } from "./config-store-
|
|
3
|
+
import { A as FILE_ONLY_GROUPS, C as hasScaledUnit, D as settingsGroupOf, O as settingsOf, Q as readEnvSecrets, S as displayText, b as cloneValue, j as SETTINGS_REGISTRY, k as valueAtPath, m as isSettingAvailable, y as SETTINGS_INDEX } from "./config-store-_A681WTh.js";
|
|
4
4
|
//#region server/core/settings-readout-core.ts
|
|
5
5
|
var VALUE_COLUMN_WIDTH = 40;
|
|
6
6
|
var SECTION_BY_SETTING_ID = new Map([...SETTINGS_REGISTRY.sections.flatMap((section) => section.settings.map((setting) => [setting.id, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as firstLine } from "./text-core-rXHoQWP9.js";
|
|
2
|
-
import { n as configSiblingPath } from "./pairings-store-
|
|
2
|
+
import { n as configSiblingPath } from "./pairings-store-DshCT7KO.js";
|
|
3
3
|
import { a as gitCommonDirectoryOf, c as findRecord, d as parseCommitLog, f as parseWhyTarget, g as runGit, l as formatWhy, n as GIT_MAX_BUFFER, o as patchIdsOfBatch, r as GIT_TIMEOUT_MS, s as storePathFor, t as COMMIT_SESSIONS_FOLDER_NAME, u as lastPromptBefore } from "./commit-sessions-DdXZUMYK.js";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as e,H as t,n}from"./updates-view-core-
|
|
1
|
+
import{G as e,H as t,n}from"./updates-view-core-Qkm1ZY4B.js";import{S as r,s as i}from"./dom-helpers-DBbFg1c_.js";import{c as a,d as o,u as s}from"./control-ws-ByEqbpGM.js";var c=`http://www.w3.org/2000/svg`;function l(e,t){let n=document.createElementNS(c,e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}function u(e,t){let n=document.createElementNS(c,`svg`);return n.setAttribute(`width`,String(e)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 ${e} ${t}`),n.setAttribute(`aria-hidden`,`true`),n}var d=`M4 4L12 12M12 4L4 12`,f=`M10 3L5 8L10 13`,p=`M3 8h0.01M8 8h0.01M13 8h0.01`,m=`M8 2.5v6M5 5.5h6M5 12.5h6`,h=`M4.5 12.5h7a3 3 0 0 0 0.4-5.97a4 4 0 0 0-7.7 0.57a2.7 2.7 0 0 0 0.3 5.4z`,g=`M8 1.8l5.2 2v4c0 3.2-2.2 5.4-5.2 6.4c-3-1-5.2-3.2-5.2-6.4v-4z`,_=`M9.2 1.5L3.5 9h4.3l-1 5.5L12.5 7H8.2z`,v=`M8.7 4.2L5.6 8.6h2.5l-.6 3.2l3.1-4.4H8.1z`,y=`M3 13V9M8 13V3M13 13V6.5`;function b(e,t=`2`){let n=u(16,16);return n.classList.add(`line-icon`),n.append(l(`path`,{d:e,fill:`none`,stroke:`currentColor`,"stroke-width":t,"stroke-linecap":`round`,"stroke-linejoin":`round`})),n}function x(e,t){let{class:n,...r}=t,i=u(16,16);return n!==void 0&&i.classList.add(n),i.append(l(e,r)),i}function S(e){let t=document.createElement(`span`);t.className=`status-icon`,t.dataset.icon=e;for(let n of r[e])t.append(x(n.tag,n.attributes));return t}function C(e,t){e.dataset.icon!==t&&(e.dataset.icon=t,e.replaceChildren(S(t)))}var w={busy:`text-text-muted`,ok:`text-state-done`,error:`text-state-failed`},T=15e3,E=`Something went wrong. Details are hidden in streamer mode.`;function D(e,t){return e!==`error`||t.startsWith(`Not connected to the server. Reconnecting.`)?t:document.documentElement.hasAttribute(`data-streamer`)?E:t}var O={busy:`working`,ok:`complete`,error:`failed`};function k(e){let t=e.querySelector(`:scope > .action-status-icon`),n=e.querySelector(`:scope > .action-status-text`);if(t&&n&&e.childNodes.length===2)return{iconElement:t,textElement:n};let r=i(`span`,`action-status-icon`);r.setAttribute(`aria-hidden`,`true`);let a=i(`span`,`action-status-text`);return e.replaceChildren(r,a),{iconElement:r,textElement:a}}function A(e){e.replaceChildren(),delete e.dataset.tone}function j(e,t,n){if(!n){A(e);return}if(!t){A(e),e.textContent=n;return}e.dataset.tone=t;let{iconElement:r,textElement:i}=k(e);C(r,O[t]),i.textContent=D(t,n)}function M(e=`action-status`){let t=i(`p`,e);return t.setAttribute(`role`,`status`),t.hidden=!0,{element:t,show:(n,r)=>{t.className=`${e} text-meta ${w[n]}`,j(t,n,r),t.hidden=!r},clear:()=>{t.hidden=!0,A(t)}}}function N(e,t){return s(e)?!0:(t.show(`error`,n),!1)}function P(e,t){let n=e instanceof Error?e.message:``;return n===`Request timed out`?`The server did not answer within ${Math.round(t/1e3)} s.`:n||`Not connected to the server. Reconnecting.`}async function F(e,t,n,{busyText:r,timeoutMs:i=T}={}){r&&n.show(`busy`,r);try{let r=await o(e,t,{timeoutMs:i});return n.clear(),r}catch(e){return n.show(`error`,P(e,i)),null}}var I=null,L=3e4,R=null;function z(){let e=document.getElementById(`header-status`),t=document.getElementById(`header-status-text`),n=document.getElementById(`header-status-age`),r=document.getElementById(`header-status-dismiss`);return!e||!t||!n||!r?null:(r.dataset.wired===void 0&&(r.dataset.wired=``,r.addEventListener(`click`,W)),{line:e,text:t,age:n})}function B(){let n=z();if(!n||!I)return;let r=e(Date.now()-I.raisedAt,{...t,justNowBelowSeconds:60});n.age.textContent!==r&&(n.age.textContent=r)}function V({source:e,sessionId:t,message:n,hidesInStreamerMode:r=!0}){a(e,n);let o=z();if(!o)return;let s=r?D(`error`,n):n,c=i(`strong`,`header-status-source`,e);o.text.replaceChildren(c,` ${s}`),o.text.title=`${e}: ${s}`,I={source:e,sessionId:t??null,raisedAt:Date.now()},B(),R??=window.setInterval(B,L),o.line.hidden=!1}function H(e,t){I?.source===e&&(t===void 0||I.sessionId===t)&&W()}function U(e){I?.sessionId===e&&W()}function W(){I=null,R!==null&&window.clearInterval(R),R=null;let e=z();e&&(e.line.hidden=!0,e.text.replaceChildren(),e.text.title=``,e.age.textContent=``)}export{l as S,v as _,j as a,b,F as c,f as d,_ as f,p as g,h,M as i,N as l,d as m,H as n,V as o,m as p,U as r,P as s,T as t,C as u,g as v,u as x,y};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./updates-view-core-
|
|
1
|
+
import"./updates-view-core-Qkm1ZY4B.js";import{n as e,r as t,s as n}from"./dom-helpers-DBbFg1c_.js";import{$ as r,Q as i,et as a}from"./index-Bq8I2EvJ.js";var o={mine:`Mine`,run:`Run`,cancel:`Cancel`},s=null;function c(e){return e===null?`n/a`:`${Math.round(e*100)}%`}function l(e){if(e===null)return`n/a`;let t=Math.round(e*100);return t>0?`+${t}`:String(t)}function u(e,t,i){let a=n(`button`,`bench-action-button`,o[t]);return a.type=`button`,a.disabled=i,a.addEventListener(`click`,()=>r(e.id,t)),a}function d(e,t){let n=e.inFlight;if(!n||n.suiteId!==t.id)return``;let r=n.caseId?`case ${n.caseId}, `:``;return`Cell ${n.cellIndex+1} of ${n.cellCount}: ${r}arm ${n.armId}, trial ${n.trial}, ${n.phase}.`}function f(e){let t=n(`td`,`bench-score`,c(e?.recall??null));return e&&e.invalid>0&&(t.title=`${e.invalid} invalid or failed cell(s)`),e&&e.degraded>0&&(t.dataset.degraded=`true`),t}function p(e){let t=e.armIds.filter(t=>t!==e.baselineArm),r=n(`table`,`bench-table`),i=n(`tr`);i.append(n(`th`,null,`Case`),...e.armIds.map(t=>n(`th`,null,t===e.baselineArm?`${t} (baseline)`:t))),i.append(...t.map(e=>n(`th`,null,`${e} vs baseline`))),r.append(i);for(let i of e.rows){let a=n(`tr`);a.append(n(`td`,`bench-case`,i.caseId),...e.armIds.map(e=>f(i.arms[e]))),a.append(...t.map(e=>n(`td`,`bench-delta`,l(i.deltaVsBaseline[e]??null)))),r.append(a)}let a=[...new Set(e.armIds.flatMap(t=>Object.keys(e.totals[t]?.recallByTag??{})))].sort(),o=n(`tr`,`bench-total`);o.append(n(`td`,`bench-case`,`Paired recall`),...e.armIds.map(t=>f(e.totals[t]))),r.append(o);for(let t of a){let i=n(`tr`,`bench-total`);i.append(n(`td`,`bench-case`,`Recall, ${t}`),...e.armIds.map(r=>n(`td`,`bench-score`,c(e.totals[r]?.recallByTag[t]??null)))),r.append(i)}return r}function m(e,r){let{isServerConnected:a,pendingActionBySuite:o,outcomeBySuite:s}=i(),c=n(`div`,`bench-suite`),l=e.inFlight?.suiteId===r.id,f=!!e.inFlight&&!l,m=o.has(r.id)||!a,h=n(`div`,`bench-summary`);h.append(n(`span`,`bench-suite-title`,r.title),t(`bench`,r.caseCount===1?`case`:`cases`,String(r.caseCount)),t(`bench`,r.candidateCount===1?`candidate`:`candidates`,String(r.candidateCount)),t(`bench`,`arms`,String(r.armIds.length))),c.append(h);let g=n(`div`,`bench-controls`),_=e.configured===!0&&r.error===null;g.append(u(r,`mine`,!_||m||l),u(r,`run`,!_||m||l||f||r.caseCount===0),u(r,`cancel`,m||!l));let v=n(`span`,`bench-status`,(a?``:`Not connected to the server. Reconnecting.`)||d(e,r)||s.get(r.id)||``);if(v.setAttribute(`role`,`status`),g.append(v),c.append(g),r.error)return c.append(n(`p`,`bench-error`,r.error)),c;let y=r.latestReport;return y?(c.append(n(`p`,`bench-run-line`,`Latest run ${y.runId}: ${y.status}. Only cases every arm scored count toward paired recall.`)),y.rows.length>0&&c.append(p(y)),c):(c.append(n(`p`,`bench-empty`,r.caseCount===0?`Move approved candidates into the cases folder, then choose Run.`:`No run yet.`)),c)}function h(){if(!s)return;s.textContent=``;let{status:t}=i(),r=e(`bench`,`Benchmarks`,`Suites from the benchmarks folder of the Glimmervoid home, one run at a time.`);if(s.append(r),!t)s.append(n(`p`,`bench-empty`,`Waiting for the server.`));else if(!t.configured)s.append(n(`p`,`bench-empty`,t.reason||`Benchmarks are off.`));else if(t.suites.length===0)s.append(n(`p`,`bench-empty`,`No suites yet. Create a folder holding suite.json under benchmarks in the Glimmervoid home.`));else for(let e of t.suites)s.append(m(t,e))}function g(e){s||(s=n(`div`,`bench-content`),e.append(s),a(h),h())}var _={mount:g};export{_ as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bt as e}from"./updates-view-core-4oGJ3ZXL.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-D5EJa_tx.js";import{i}from"./action-status-Cmp0b1QX.js";import{a,n as o}from"./modal-USMHOKBI.js";import{$r as s,Sn as c,ai as l,bi as u,ci as d,ei as f,ii as p,li as m,ni as h,oi as g,ri as _,si as v,ti as y,xi as ee,yi as te}from"./index-D3RHreq_.js";var ne=4,re=200,ie=2e4,ae=1.1,oe=[`wire`,`note`,`frame`,`box`,`unit`];function b(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function x(){return document.documentElement.dataset.layout===`phone`}function se(e){return e instanceof Element?e.closest(`[data-linked-board-id]`)?.dataset.linkedBoardId??null:null}function ce(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(ie,Math.max(re,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function ee(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function te(){c={kind:`pinch`,distance:ee(),viewWidth:s.width}}function b(t){if(t.button!==0||l)return;let r=se(t.target);if(r){e.onOpenLinkedBoard(r);return}if(a.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.setPointerCapture(t.pointerId),a.size===2){te();return}let o=i.elementFromTarget(t.target),s=o?.kind===`box`&&!x()?y(o.id):null;if(o&&s){c={kind:`drag`,pointerId:t.pointerId,boxId:o.id,origin:f(t.clientX,t.clientY),start:s,hasMoved:!1,isAdditive:t.shiftKey};return}if(o&&!x()){_(o.id,t.shiftKey);return}let u=o?.kind===`box`?o.id:null;c={kind:`pan`,pointerId:t.pointerId,lastClient:{x:t.clientX,y:t.clientY},hasMoved:!1,tappedBoxId:u}}function ce(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<ne*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function S(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<ne||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function le(e){let t=ee();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function C(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?le(c):c?.kind===`drag`&&c.pointerId===e.pointerId?ce(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&S(c,e))}async function w(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a=i.layout()?.pinnedOffsetY??0,o={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y-a)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:o}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ue(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?w(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&x()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function de(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function fe(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ae:1/ae):h(-e.deltaX,-e.deltaY)}function T(){let e=l;l=null,e?.remove()}function pe(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;T();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),T(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();T(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,T),d.focus(),d.select()}function E(e){if(x())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&pe(t.id)}function D(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=oe.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function me(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),D()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,b),n.addEventListener(`pointermove`,C),n.addEventListener(`pointerup`,ue),n.addEventListener(`pointercancel`,de),n.addEventListener(`wheel`,fe,{passive:!1}),n.addEventListener(`dblclick`,E),n.addEventListener(`keydown`,me),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:T}}var S=40,le=44,C=220,w=90,ue=30,de=20,fe=18,T=20,pe=26,E=18,D=26,me=170,he=21,ge=17,_e=10,ve=22,ye=24,be=16,xe=16,Se=26,Ce=24,we=8,Te=10,Ee=14,De=4,Oe=14,ke=8,O=6,Ae=4,je=6,Me=12,Ne=10,Pe=6.6,k=5,A=10,Fe=2,Ie=100,Le=120,Re=4,ze=40,Be=[.5,.35,.65,.2,.8],Ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function j(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function He(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:Ve[n.color]}:null}function Ue(e,t){let n=j(t.title,T),r=t.lines.flatMap(e=>j(e.text,pe-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=He(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*de+r.length*fe+(i?26:0)}}function M(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function We(e){let t=j(e.text,he);return{lines:t,height:24+(t.length+1)*ge}}function Ge(e){let t=new Map;for(let n of M(e,`note`)){let e=t.get(n.on),r=We(n).height;t.set(n.on,e===void 0?r:e+_e+r)}return t}function Ke(e){return e.columns.map(e=>e.title?j(e.title,ye):[])}function qe(e){return(Math.max(1,...e.map(e=>e.length))-1)*be}function N(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function Je(e,t){let n=M(e,`box`).filter(e=>!e.at),r=new Set(n.filter(e=>t.has(e.id)).map(e=>e.column)),i=new Set(M(e,`frame`).flatMap(e=>e.contains)),a=new Set(n.filter(e=>i.has(e.id)).map(e=>e.column)),o=e=>Te+(e!==void 0&&a.has(e)?E:0);return e.columns.map((t,n)=>{let i=r.has(t.id);return{left:i?156:o(t.id),right:o(e.columns[n+1]?.id),minimumWidth:i?Math.max(w,186):w}})}function Ye(e,t,n){return e.map((e,r)=>{let i=t[r]??0,a=n[r]??0,o=i>0?e.left+e.right+(i+1)*Ee:0,s=a>0?e.left+e.right+a+20:0;return Math.max(e.minimumWidth,o,s)})}function Xe(e,t){let n=[],r=S;for(let[i]of e.columns.entries())n.push(r),r+=C+(t[i]??w);return n}function Ze(e,t,n){return e.map((e,r)=>{let i=n[r]??{left:Te,right:Te,minimumWidth:w},a=e+C+(t[r]??w);return{left:e+C+i.left,right:a-i.right}})}function Qe(e,t,n,r){if(!t.at)return Math.max(0,e.columns.findIndex(e=>e.id===t.column));let i=n.x+n.width/2,a=r.findLastIndex(e=>e<=i);return Math.max(0,a)}function $e(e){let t=new Map;for(let n of M(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function et(e,t){return e===t?0:(e?E:0)+(t?44:0)}function tt(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=$e(e),c=M(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=Ue(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+et(o.get(l.column)??null,d),p=l.at??{x:t[c]??S,y:f};if(!l.at){let e=(r.get(l.id)??0)-we;a.set(l.column,f+Math.max(u.height,e)+ue),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:C,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function nt(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function rt(e,t){return M(e,`frame`).flatMap(e=>{let n=nt(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function it(e){return e===`left`||e===`right`}function P(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function at(e,t,n,r){let i=e.y<t.y?e:t,a=i===e?t:e;return[...r.boxesById.values()].some(o=>o.id!==e.id&&o.id!==t.id&&r.columnIndexByBoxId.get(o.id)===n&&o.y<a.y&&o.y+o.height>i.y+i.height)}function ot(e,t,n){let r=n.columnIndexByBoxId.get(e.id)??0,i=n.columnIndexByBoxId.get(t.id)??0;if(r===i){if(e.id!==t.id&&!at(e,t,r,n)){let n=t.y>e.y;return{shape:`straight`,exitSide:n?`bottom`:`top`,entrySide:n?`top`:`bottom`,sourceGap:-1,targetGap:-1}}return{shape:`channel`,exitSide:`right`,entrySide:`right`,sourceGap:r,targetGap:r}}return i>r?{shape:i===r+1?`channel`:`long`,exitSide:`right`,entrySide:`left`,sourceGap:r,targetGap:i-1}:{shape:i===r-1?`channel`:`long`,exitSide:`left`,entrySide:`right`,sourceGap:r-1,targetGap:i}}function st(e){let t=e.wires.flatMap(t=>{let n=e.boxesById.get(t.from),r=e.boxesById.get(t.to);if(!n||!r)return[];let i=t.tone===`lane`?n.lane?.hex??null:null,a=P(n);return[{wire:t,from:n,to:r,strokeHex:i,styleKey:`${t.dashed}|${t.tone}|${i}`,...ot(n,r,e),busKey:null,start:a,end:P(r),crossingY:a.y}]}),n=new Map,r=e=>`${e.to.id}|${e.entrySide}|${e.styleKey}`;for(let e of t)e.shape!==`straight`&&n.set(r(e),(n.get(r(e))??0)+1);for(let e of t)e.shape!==`straight`&&(n.get(r(e))??0)>1&&(e.busKey=r(e));return t}function ct(e,t,n){let r=Array.from({length:n},(e,t)=>t);if(it(t)){let i=t===`left`?e.x:e.x+e.width,a=Math.min(Oe,(e.height-16)/Math.max(n-1,1)),o=e.y+Math.min(e.height/2,40)-(n-1)*a/2,s=Math.max(e.y+ke,Math.min(o,e.y+e.height-ke-(n-1)*a));return r.map(e=>({x:i,y:Math.round(s+e*a)}))}let i=t===`top`?e.y:e.y+e.height,a=e.x+e.width/2-(n-1)*Oe/2;return r.map(e=>({x:Math.round(a+e*Oe),y:i}))}function lt(e){return N(e.flatMap(e=>[{box:e.from,side:e.exitSide,groupKey:`exit|${e.styleKey}`,wireId:e.wire.id,farPoint:P(e.to),assign:t=>{e.start=t}},{box:e.to,side:e.entrySide,groupKey:e.busKey?`bus|${e.busKey}`:`entry|${e.wire.id}`,wireId:e.wire.id,farPoint:P(e.from),assign:t=>{e.end=t}}]),e=>`${e.box.id}|${e.side}`)}function ut(e){return new Map([...e.entries()].map(([e,t])=>[e,[...N(t,e=>e.groupKey).entries()].map(([e,t])=>({groupKey:e,firstWireId:t.map(e=>e.wireId).sort()[0]??e,farCoordinate:t.reduce((e,t)=>e+(it(t.side)?t.farPoint.y:t.farPoint.x),0)/t.length})).sort((e,t)=>e.farCoordinate-t.farCoordinate||e.firstWireId.localeCompare(t.firstWireId)||e.groupKey.localeCompare(t.groupKey)).map(e=>e.groupKey)]))}function dt(e,t){for(let[n,r]of e){let e=r[0],i=t.get(n)??[];if(!e)continue;let a=ct(e.box,e.side,i.length);for(let e of r){let t=a[i.indexOf(e.groupKey)];t&&e.assign(t)}}}function ft(e,t){let n=t[e.sourceGap]??{left:e.start.x,right:e.start.x},r=t[e.targetGap]??{left:e.end.x,right:e.end.x};return{left:Math.min(n.left,r.left),right:Math.max(n.right,r.right)}}function pt(e,t,n){return[...[...n.boxesById.values()].filter(t=>t.id!==e.from.id&&t.id!==e.to.id),...n.obstacles].filter(e=>e.x<t.right&&e.x+e.width>t.left)}function mt(e,t){return!t.some(t=>e>t.y-O&&e<t.y+t.height+O)}function ht(e){let t=e.map(e=>({top:e.y-O,bottom:e.y+e.height+O})).sort((e,t)=>e.top-t.top),n=[];for(let e of t){let t=n.at(-1);t&&e.top<=t.bottom?t.bottom=Math.max(t.bottom,e.bottom):n.push({...e})}return n.slice(1).flatMap((e,t)=>{let r=n[t];return!r||e.top-r.bottom<Ae?[]:[{top:r.bottom,bottom:e.top}]})}function gt(e,t){return e.left<t.right&&t.left<e.right}function _t(e,t){let n=[];return e.forEach((r,i)=>{let a=e.slice(0,i).flatMap((e,i)=>t(r,e)?[n[i]??0]:[]);n.push(a.length>0?Math.max(...a)+1:0)}),n}function vt(e,t){let n=[],r=[];for(let i of e){if(i.shape!==`long`)continue;let e=ft(i,t.gaps),a=pt(i,e,t),o=[i.start.y,i.end.y].find(e=>mt(e,a));if(o!==void 0){i.crossingY=o;continue}let s=(i.start.y+i.end.y)/2,c=ht(a).sort((e,t)=>Math.abs((e.top+e.bottom)/2-s)-Math.abs((t.top+t.bottom)/2-s))[0];c?n.push({plan:i,interval:c,span:e}):r.push({plan:i,span:e})}let i=N(n,e=>`${Math.round(e.interval.top)}|${Math.round(e.interval.bottom)}`);for(let e of i.values()){let t=[...e].sort((e,t)=>e.plan.start.y-t.plan.start.y||e.plan.wire.id.localeCompare(t.plan.wire.id)),n=_t(t,(e,t)=>gt(e.span,t.span)),i=t[0]?.interval??{top:0,bottom:0},a=i.bottom-i.top,o=Math.max(1,Math.floor(a/je)-1),s=Math.min(o,Math.max(...n)+1);t.forEach((e,t)=>{let c=n[t]??0;c>=o?r.push({plan:e.plan,span:e.span}):e.plan.crossingY=Math.round(i.top+a*(c+1)/(s+1))})}let a=[...r].sort((e,t)=>t.span.right-t.span.left-(e.span.right-e.span.left)||e.plan.wire.id.localeCompare(t.plan.wire.id)),o=_t(a,(e,t)=>gt(e.span,t.span)).map(e=>a.length-1-e);return a.forEach(({plan:e},n)=>{e.crossingY=t.topBandBottom-(o[n]??0)*Me}),r.length>0?Math.max(...o)+1:0}function yt(e,t){return t<=e?`left`:`right`}function bt(e,t){return{key:e,gap:t,top:1/0,bottom:-1/0,leftYs:[],rightYs:[],track:-1,x:0}}function F(e,t,n){(t===`left`?e.leftYs:e.rightYs).push(n),e.top=Math.min(e.top,n),e.bottom=Math.max(e.bottom,n)}function I(e){return e.busKey?`bus|${e.busKey}`:`wire|${e.wire.id}|target`}function xt(e,t){let n=new Map,r=(e,t)=>{let r=n.get(e);if(r)return r;let i=bt(e,t);return n.set(e,i),i},i=new Set;for(let n of e){if(n.shape===`straight`)continue;let e=t.columnIndexByBoxId.get(n.from.id)??0,a=t.columnIndexByBoxId.get(n.to.id)??0,o=n.exitSide===`right`&&n.entrySide===`left`,s=r(I(n),n.targetGap);if(n.shape===`channel`&&F(s,yt(n.targetGap,e),n.start.y),n.shape===`long`){let t=r(`wire|${n.wire.id}|source`,n.sourceGap);F(t,yt(n.sourceGap,e),n.start.y),F(t,o?`right`:`left`,n.crossingY),F(s,o?`left`:`right`,n.crossingY)}i.has(s.key)||(i.add(s.key),F(s,yt(n.targetGap,a),n.end.y))}return n}function St(e,t){return e.filter(e=>e>t.top&&e<t.bottom).length}function Ct(e,t){return St(t.leftYs,e)+St(e.rightYs,t)}function wt(e,t){let n=t.map(()=>0),r=N([...e.values()].filter(e=>e.bottom>e.top),e=>e.gap);for(let[e,i]of r){let r=[...i].sort((e,t)=>Ct(e,t)-Ct(t,e)||e.top-t.top||e.key.localeCompare(t.key)),a=_t(r,(e,t)=>e.top<t.bottom+De&&t.top<e.bottom+De),o=Math.max(...a)+1;n[e]=o;let s=t[e]??{left:0,right:0};r.forEach((e,t)=>{e.track=a[t]??0,e.x=Math.round(s.left+(s.right-s.left)*(e.track+1)/(o+1))})}for(let n of e.values()){if(n.track>=0)continue;let e=t[n.gap]??{left:0,right:0};n.x=Math.round((e.left+e.right)/2)}return n}function Tt(e){let t=e.filter((t,n)=>{let r=e[n-1];return!r||r.x!==t.x||r.y!==t.y});return t.filter((e,n)=>{let r=t[n-1],i=t[n+1];return!r||!i||!(r.x===e.x&&e.x===i.x||r.y===e.y&&e.y===i.y)})}function Et(e){return e.slice(1).flatMap((t,n)=>{let r=e[n];return r?[{from:r,to:t}]:[]})}function Dt(e){if(e.start.x===e.end.x)return[e.start,e.end];let t=Math.round((e.start.y+e.end.y)/2);return[e.start,{x:e.start.x,y:t},{x:e.end.x,y:t},e.end]}function Ot(e,t){if(e.shape===`straight`)return Dt(e);let n=t.get(I(e))?.x??e.end.x,r=e.shape===`long`?e.crossingY:e.start.y,i=t.get(`wire|${e.wire.id}|source`)?.x??n,a=e.shape===`long`?[e.start,{x:i,y:e.start.y},{x:i,y:r},{x:n,y:r}]:[e.start,{x:n,y:r}];return e.busKey?a:[...a,{x:n,y:e.end.y},e.end]}function kt(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function At(e,t){let n=new Map;for(let t of[...e].sort((e,t)=>e.wire.id.localeCompare(t.wire.id)))t.busKey&&!n.has(t.busKey)&&n.set(t.busKey,t.wire.id);return e.map(e=>{let r=Tt(Ot(e,t)),i=e.busKey?t.get(I(e)):void 0,a=e.busKey!==null&&n.get(e.busKey)===e.wire.id,o=i&&a?[{from:{x:i.x,y:i.top},to:{x:i.x,y:i.bottom}},{from:{x:i.x,y:e.end.y},to:e.end}].filter(e=>e.from.x!==e.to.x||e.from.y!==e.to.y):[];return{plan:e,points:r,trunk:o,segments:[...Et(r),...o]}})}function L(e){return e.from.y===e.to.y}function jt(e,t){let n=t.x+t.width,r=t.y+t.height;if(L(e)){let i=e.from.y;return t.y<i&&i<r&&Math.min(e.from.x,e.to.x)<n&&Math.max(e.from.x,e.to.x)>t.x}let i=e.from.x;return t.x<i&&i<n&&Math.min(e.from.y,e.to.y)<r&&Math.max(e.from.y,e.to.y)>t.y}function Mt(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function Nt(e){return Math.ceil(e.length*Pe)}function Pt(e,t){return{x:e.x-t/2,y:e.y-A,width:t,height:13}}function Ft(e){return Math.abs(e.from.x-e.to.x)+Math.abs(e.from.y-e.to.y)}function It(e,t){let n=[...e].sort((e,t)=>Ft(t)-Ft(e));return[...e.slice(0,1),...n].flatMap(e=>[...Be.flatMap(n=>{let r=e.from.x+(e.to.x-e.from.x)*n,i=e.from.y+(e.to.y-e.from.y)*n;return L(e)?[{x:r,y:i-k},{x:r,y:i+k+A}]:[{x:r+k+t/2,y:i+A/2},{x:r-k-t/2,y:i+A/2}]}),...Lt(e,t)])}function Lt(e,t){if(!L(e))return[];let n=e.from.y;return[Math.min(e.from.x,e.to.x)+k+t/2,Math.max(e.from.x,e.to.x)-k-t/2].flatMap(e=>[{x:e,y:n-k},{x:e,y:n+k+A}])}function Rt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function zt(e,t,n){let r=new Map,i=e.flatMap(e=>e.segments),a=[...t.boxesById.values(),...t.obstacles];for(let o of e){let e=o.plan.wire.label;if(!e)continue;let s=Nt(e),c=It(o.segments,s),l=c.find(e=>{let n=Pt(e,s);if(n.y<t.contentTop)return!1;let o=Rt(n,Fe);return i.some(e=>jt(e,o))||a.some(e=>Mt(n,e))?!1:![...r.values()].some(e=>Mt(n,e.bounds))}),u=l??c[0]??P(o.plan.from);l||n.push(`wire ${o.plan.wire.id} label "${e}" has no clear spot`),r.set(o.plan.wire.id,{at:{x:Math.round(u.x),y:Math.round(u.y)},bounds:Pt(u,s)})}return r}function Bt(e,t,n){return e>Math.min(t,n)+.5&&e<Math.max(t,n)-.5}function Vt(e,t){if(L(e)===L(t))return!1;let n=L(e)?e:t,r=n===e?t:e;return Bt(r.from.x,n.from.x,n.to.x)&&Bt(n.from.y,r.from.y,r.to.y)}function Ht(e,t){if(L(e)!==L(t))return!1;let n=L(e),r=e=>n?e.from.y:e.from.x,i=e=>Math.min(n?e.from.x:e.from.y,n?e.to.x:e.to.y),a=e=>Math.max(n?e.from.x:e.from.y,n?e.to.x:e.to.y);return r(e)===r(t)&&Math.min(a(e),a(t))-Math.max(i(e),i(t))>1}function Ut(e,t){return e.plan.styleKey===t.plan.styleKey&&e.plan.start.x===t.plan.start.x&&e.plan.start.y===t.plan.start.y}function Wt(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(e=>{if(t.plan.busKey!==null&&t.plan.busKey===e.plan.busKey)return[];let n=t.segments.flatMap(t=>e.segments.map(e=>[t,e]));return n.some(([e,t])=>Vt(e,t))?[`wire ${t.plan.wire.id} crosses wire ${e.plan.wire.id}`]:Ut(t,e)?[]:n.some(([e,t])=>Ht(e,t))?[`wire ${t.plan.wire.id} overlaps wire ${e.plan.wire.id}`]:[]}))}function Gt(e,t){let n=[...t.boxesById.values()];return e.flatMap(e=>n.flatMap(t=>{if(t.id===e.plan.from.id||t.id===e.plan.to.id)return[];let n=Rt(t,-2);return e.segments.some(e=>jt(e,n))?[`wire ${e.plan.wire.id} runs through box ${t.id}`]:[]}))}function Kt(t){if(t.length<=e.layoutWarnings)return[...t];let n=t.slice(0,e.layoutWarnings-1);return[...n,`and ${t.length-n.length} more`]}function qt(e,t){let n=t.map(()=>0);for(let t of e)t.wire.label&&t.shape===`channel`&&(n[t.targetGap]=Math.max(n[t.targetGap]??0,Nt(t.wire.label)));return n}function Jt(e,t){return nt([...e.flatMap(e=>e.segments.flatMap(e=>[e.from,e.to])).map(e=>({x:e.x,y:e.y,width:0,height:0})),...t])}function Yt(e,t,n,r){dt(n,r);let i=vt(e,t),a=xt(e,t),o=wt(a,t.gaps),s=At(e,a);return{runsByKey:a,tracksByGap:o,topTrackCount:i,drawn:s,crossingCost:Gt(s,t).length*Ie+Wt(s).length}}function Xt(e,t){let n=e[t],r=e[t+1];n!==void 0&&r!==void 0&&(e[t]=r,e[t+1]=n)}function Zt(e,t){let n=lt(e),r=ut(n),i=Yt(e,t,n,r).crossingCost,a=e.length<=Le;for(let o of r.values())for(let s=0;a&&i>0&&s+1<o.length;s+=1){Xt(o,s);let a=Yt(e,t,n,r).crossingCost;a<i?i=a:Xt(o,s)}return Yt(e,t,n,r)}function Qt(e){let t=st(e),{runsByKey:n,tracksByGap:r,topTrackCount:i,drawn:a}=Zt(t,e),o=[],s=zt(a,e,o),c=a.map(({plan:e,points:t,trunk:r})=>{let i=t.at(-1)??e.end,a=e.busKey?n.get(I(e)):void 0,o=r.length>0,c=a!==void 0&&i.y>a.top&&i.y<a.bottom;return{kind:`wire`,id:e.wire.id,path:[kt(t),...r.map(e=>kt([e.from,e.to]))].join(` `),start:e.start,end:o||!e.busKey?e.end:i,label:e.wire.label,labelAt:s.get(e.wire.id)?.at??P(e.from),isDashed:e.wire.dashed,strokeHex:e.strokeHex,tone:e.wire.tone,hasArrowhead:e.busKey===null||o,joinAt:c?i:null}}),l=[...s.values()].map(e=>e.bounds);return{wires:c,tracksByGap:r,topTrackCount:i,labelWidthByGap:qt(t,e.gaps),warnings:Kt([...Gt(a,e),...Wt(a),...o]),extent:Jt(a,l)}}function $t(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function en(e,t){let n=new Map;return M(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=We(e),o=n.get(e.on)??r.y-we;return n.set(e.on,o+a+_e),[{kind:`note`,id:e.id,x:r.x+r.width-Ce,y:o,width:me,height:a,lines:i,byline:$t(e),isResolved:e.resolvedBy!==null}]})}function tn(e,t,n,r){let i=e.flatMap(e=>e.kind===`wire`?[]:[e]),a=(n.at(-1)??S)+C,o=nt([...i,...t?[t]:[],{x:0,y:0,width:a,height:r}]);return o?{x:Math.min(0,o.x-S),y:Math.min(0,o.y-S),width:o.width+80,height:o.height+80}:{x:0,y:0,width:a+S,height:80}}function nn(e,t){let n=Xe(e,t.gapWidths),r=tt(e,n,t.boxesTop,t.stackHeightByBoxId),i=rt(e,r),a=en(e,r),o=new Map(M(e,`box`).flatMap(t=>{let i=r.get(t.id);return i?[[t.id,Qe(e,t,i,n)]]:[]}));return{columnLeftEdges:n,boxesById:r,frames:i,notes:a,routing:Qt({wires:M(e,`wire`),boxesById:r,columnIndexByBoxId:o,obstacles:[...a,...i.map(e=>({x:e.x,y:e.y,width:e.width,height:D}))],gaps:Ze(n,t.gapWidths,t.reserves),topBandBottom:t.boxesTop-Ne,contentTop:t.contentTop})}}function rn(e,t){return Array.from({length:Math.max(e.length,t.length)},(n,r)=>Math.max(e[r]??0,t[r]??0))}function an(e,t,n){let r=t.tracksByGap,i=t.topTrackCount;for(let a=1;;a+=1){let o=Ye(n.reserves,r,t.labelWidthByGap),s=n.headerBoxesTop+fn(i),c=nn(e,{gapWidths:o,reserves:n.reserves,boxesTop:s,contentTop:n.contentTop,stackHeightByBoxId:n.stackHeightByBoxId}),l=c.routing.topTrackCount>i,u=c.routing.tracksByGap.some((e,t)=>e>(r[t]??0));if(a>=Re||!l&&!u)return{placed:c,boxesTop:s};i=Math.max(i,c.routing.topTrackCount),r=rn(r,c.routing.tracksByGap)}}function on(e){let t=j(e.title,T),n=e.lines.flatMap(e=>j(e.text,pe)),r=+!!e.linkedBoardId;return{titleLines:t,bodyLines:n,height:42+t.length*de+(n.length+r)*fe}}function sn(e){let t=new Map,n=new Map;for(let r of m(e)){let i=e.elements[r.unitId];if(i?.kind!==`unit`)continue;let a=on(i),o=n.get(r.level)??70;n.set(r.level,o+a.height+ue),t.set(i.id,{kind:`unit`,id:i.id,x:S+(r.level-1)*310,y:o,width:C,height:a.height,label:r.label,titleLines:a.titleLines,bodyLines:a.bodyLines,linkedBoardId:i.linkedBoardId})}return t}function cn(e,t){let n={x:e.x+e.width,y:e.y+Math.round(e.height/2)},r={x:t.x,y:t.y+Math.round(t.height/2)},i=t.x-Math.round(w/2);return kt(Tt([n,{x:i,y:n.y},{x:i,y:r.y},r]))}function ln(e,t){return M(e,`unit`).flatMap(e=>{let n=t.get(e.id);return n?e.after.flatMap(e=>{let r=t.get(e);return r?[cn(r,n)]:[]}):[]})}function un(e){return e.size===0?S:Math.max(...[...e.values()].map(e=>e.y+e.height))+ze}function dn(e,t){if(t===0)return e;let n=Object.fromEntries(Object.entries(e.elements).map(([e,n])=>n.kind!==`box`||!n.at?[e,n]:[e,{...n,at:{x:n.at.x,y:n.at.y+t}}]));return{...e,elements:n}}function fn(e){return e>0?e*Me+Ne:0}function pn(e){let t=sn(e),n=un(t),r=n-S,i=dn(e,r),a=Ge(i),o=Ke(i),s=qe(o),c=n+Se+s,l=n+le+s,u=Je(i,a),{placed:d,boxesTop:f}=an(i,nn(i,{gapWidths:Ye(u,[],[]),reserves:u,boxesTop:l,contentTop:c,stackHeightByBoxId:a}).routing,{reserves:u,headerBoxesTop:l,contentTop:c,stackHeightByBoxId:a}),{columnLeftEdges:p}=d,m=[...d.frames,...d.routing.wires,...d.boxesById.values(),...d.notes,...t.values()],h=tn(m,d.routing.extent,p,f),g=h.y+h.height,_=i.lanes.map((e,t)=>({label:e.label||e.id,hex:Ve[e.color],x:S,y:g+t*ve})),v=g+_.length*ve+(_.length>0?12:0),y=i.caption?{text:i.caption,x:S,y:v}:null,ee=_.length*ve+(y?30:0)+(_.length>0?12:0);return{columns:i.columns.map((e,t)=>({id:e.id,titleLines:o[t]??[],titleBaselineY:n+xe,ruleY:c,x:p[t]??S,width:C})),elements:m,legend:_,caption:y,pinnedOffsetY:r,plan:t.size>0?{titleAt:{x:S,y:56},arrowPaths:ln(i,t)}:null,bounds:{...h,height:h.height+ee},warnings:d.routing.warnings}}function mn(e){return JSON.stringify(e)}var hn=`http://www.w3.org/2000/svg`,R=12,gn=26,_n=20,vn=18,yn=17,bn=14,xn=16,Sn=24,Cn=18,wn=`Plan`,Tn=`open linked board`;function z(e,t={},n=``){let r=document.createElementNS(hn,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function B(e,t,n,r){let i=z(`text`,{x:t,y:n},r);return i.textContent=e,i}function V(e,t){let n=z(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function En(e){let t=V(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(B(n,e.x+R,e.y+gn+r*_n,`wb-box-title`))});let r=e.y+gn+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{let a=e.x+R+(n.muted?bn:0);t.append(B(n.text,a,r+i*vn,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=z(`rect`,{x:e.x+R,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=B(e.lane.label,e.x+R+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Dn(e){let t=V(e,`wb-frame`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),B(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function On(e){let t=V(e,`wb-wire wb-tone-${e.tone}`),n=z(`path`,{d:e.path},`wb-wire-hit`),r=z(`path`,e.hasArrowhead?{d:e.path,"marker-end":`url(#wb-arrow)`}:{d:e.path},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,z(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.joinAt&&t.append(z(`circle`,{cx:e.joinAt.x,cy:e.joinAt.y,r:3},`wb-wire-dot`)),e.label&&t.append(B(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function kn(e){let t=V(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(B(n,e.x+10,e.y+22+r*yn,`wb-note-text`))}),e.byline&&t.append(B(e.byline,e.x+10,e.y+22+e.lines.length*yn,`wb-note-byline`)),t}function An(e){let t=V(e,`wb-unit`);t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-unit-outline`),B(e.label,e.x+R,e.y+Sn,`wb-unit-label`));let n=e.y+Sn+Cn;e.titleLines.forEach((r,i)=>{t.append(B(r,e.x+R,n+i*_n,`wb-box-title`))});let r=n+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{t.append(B(n,e.x+R,r+i*vn,`wb-box-line`))}),!e.linkedBoardId)return t;let i=B(Tn,e.x+R,r+e.bodyLines.length*vn,`wb-unit-link`);return i.dataset.linkedBoardId=e.linkedBoardId,t.append(i),t}var jn={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`,unit:`units`},Mn=[`box`,`frame`,`wire`,`note`,`unit`];function Nn(e){switch(e.kind){case`box`:return En(e);case`frame`:return Dn(e);case`wire`:return On(e);case`note`:return kn(e);case`unit`:return An(e)}}function Pn(e){let t=z(`g`,{},`wb-chrome`);if(e.plan){t.append(B(wn,e.plan.titleAt.x,e.plan.titleAt.y,`wb-column-title`));for(let n of e.plan.arrowPaths)t.append(z(`path`,{d:n,"marker-end":`url(#wb-arrow)`},`wb-wire-line`))}for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(B(e,n.x,n.titleBaselineY+r*xn,`wb-column-title`))}),t.append(z(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=z(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,B(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(B(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function Fn(){let e=z(`defs`),t=z(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(z(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function In(e){let t={frames:z(`g`,{},`wb-layer`),wires:z(`g`,{},`wb-layer`),boxes:z(`g`,{},`wb-layer`),notes:z(`g`,{},`wb-layer`),units:z(`g`,{},`wb-layer`)},n=z(`g`);e.replaceChildren(Fn(),n,t.frames,t.wires,t.boxes,t.notes,t.units);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=pn(e),s=Pn(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=mn(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Nn(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[jn[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Mn.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=z(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var Ln=`http://www.w3.org/2000/svg`,Rn=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,zn=`Pick a board above.`,H=null,U=null,W=null,G=null,Bn=!0,K=null,q=i(`action-status wb-status`),J=i(`action-status wb-status`);function Y(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function X(){return H?g(H):null}function Vn(){return s().find(e=>e.id===H)??null}async function Hn(e){if(!H||e.length===0)return!1;let t=await v(H,e);return t.ok?(q.clear(),!0):(q.show(`error`,t.error),!1)}async function Un(e){if(!H)return`No board is open.`;let t=await v(H,e);return t.ok?null:t.error}function Wn(e){let t=r(e);return t?n(t):`closed session`}function Z(e){let t=X();return[...G?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function Gn(){if(!U)return;let e=X(),t=Z(`box`).length,n=G?.selectedIds().size??0;U.buttons.box.disabled=!e,U.buttons.wire.disabled=t!==2,U.buttons.note.disabled=t!==1,U.buttons.frame.disabled=t===0,U.buttons.unit.disabled=!e,U.buttons.fit.disabled=!e,U.buttons.remove.disabled=!e,U.toolbar.dataset.selectedCount=String(n)}function Kn(){if(!U)return;let e=s();H&&!e.some(e=>e.id===H)&&(H=null),!H&&e[0]&&Q(e[0].id),U.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===H)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),qn()}function qn(){if(!U)return;let e=Vn(),n=s().length>0;U.boardHead.hidden=!e,U.canvas.hidden=!e,U.empty.hidden=!!e,U.empty.textContent=n?zn:Rn,e&&(U.boardMeta.textContent=`v${e.version}`,U.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,Wn(e)))),e.connectedSessionIds.length===0&&U.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),Gn(),Yn())}function Jn(e,t){let n=Wn(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function Yn(){if(!U||!K)return;let e=Vn();U.dockQueued.textContent=Jn(e,K),U.sendToAgent.disabled=!e?.connectedSessionIds.includes(K)}async function Xn(){if(!U||!H||!K)return;U.sendToAgent.disabled=!0,J.show(`busy`,`sending`);let e=await h(H,K);Yn(),e.ok?J.show(`ok`,`sent; the agent reads the board when it is ready`):J.show(`error`,e.error)}function Zn(){if(!W)return;let e=X();e?(W.render(e),G?.pruneSelection(e),Bn&&=(G?.fit(),!1),Gn()):W.clear()}function Q(e){H!==e&&(H=e,Bn=!0,G?.clearSelection(),G?.closeTitleInput(),W?.clear(),q.clear(),Kn(),l(e).then(Zn))}function Qn(){let t=X();if(!t)return;let n=Z(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),Y({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`box`,id:b(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function $n(){let t=X();if(!t)return;let n=s().filter(e=>e.id!==t.id),r=[{value:``,text:`No linked board`},...n.map(e=>({value:e.id,text:e.title}))];Y({title:`Add a unit`,label:`Unit title`,placeholder:`index the diffs`,maxLength:e.title,confirmLabel:`Add unit`,choices:n.length>0?{label:`Linked board`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`unit`,id:b(`unit`),title:e,lines:[],after:[],linkedBoardId:t||null}}])})}function er(t){Y({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>Un([{op:`add`,element:{kind:`note`,id:b(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function tr(){let[e,t]=Z(`box`);e&&t&&(G?.clearSelection(),Hn([{op:`add`,element:{kind:`wire`,id:b(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function nr(){let t=Z(`box`).map(e=>e.id);t.length!==0&&Y({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await Un([{op:`add`,element:{kind:`frame`,id:b(`frame`),title:e,contains:t}}]);return n||G?.clearSelection(),n}})}function rr(){let e=Vn();if(!e)return;let t=e.connectedSessionIds.map(Wn),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{y(e.id).then(e=>{e.ok||q.show(`error`,e.error)})}})}function ir(){Y({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await f(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ar(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`);let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`span`,`wb-board-meta`),s=t(`div`,`wb-presence`);a.append(o,s);let c=t(`div`,`wb-toolbar`),l={box:$(`box`,Qn),wire:$(`wire`,tr),note:$(`note`,()=>{let[e]=Z(`box`);e&&er(e.id)}),frame:$(`frame`,nr),unit:$(`unit`,$n),fit:$(`fit`,()=>G?.fit()),remove:$(`delete board`,rr,`wb-button-danger`)};l.fit.dataset.phoneVisible=``,c.append(l.box,l.wire,l.note,l.frame,l.unit,l.fit,l.remove,q.element),i.append(a,c),n.append(r,$(`new board`,ir),i);let u=t(`div`,`wb-canvas`),d=document.createElementNS(Ln,`svg`);d.setAttribute(`class`,`wb-svg`),d.setAttribute(`role`,`img`),d.setAttribute(`aria-label`,`Whiteboard`),d.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),u.append(d);let f=t(`p`,`wb-empty`,Rn),m=t(`div`,`wb-dock`);m.hidden=!0;let h=t(`span`,`wb-dock-queued`),g=$(`send to agent`,()=>void Xn()),v=t(`div`,`wb-dock-bar`);v.append(h,g,J.element),m.append(v),e.replaceChildren(n,u,f,m),U={list:r,boardHead:i,boardMeta:o,presence:s,toolbar:c,canvas:u,empty:f,dock:m,dockQueued:h,sendToAgent:g,buttons:l};let y=In(d);W=y,G=ce({svg:d,canvas:u,renderer:y,currentBoard:X,sendOps:Hn,onSelectionChange:Gn,onPhoneTapBox:er,onOpenLinkedBoard:Q}),p(Kn),_(e=>{e===H&&Zn()}),Kn()}function or(){return document.documentElement.dataset.layout===`phone`}function sr(){K&&u()===K&&ee(),K=null,U&&(U.dock.hidden=!0)}function cr(e){if(!U||or())return;let t=r(e);t&&(K=e,U.dock.hidden=!1,J.clear(),Yn(),te(t,e,U.dock,{className:`wb-docked-card`}),c(t,e,!0))}function lr(){let e=d();e&&(Q(e.boardId),e.dockSessionId&&cr(e.dockSessionId)),Kn(),H&&l(H).then(Zn)}var ur={mount:ar,refresh:lr,deactivate:sr};export{ur as view};
|
|
1
|
+
import{bt as e}from"./updates-view-core-Qkm1ZY4B.js";import{s as t}from"./dom-helpers-DBbFg1c_.js";import{a as n,r}from"./card-registry-CLrAbqh5.js";import{i}from"./action-status-SSA4xM57.js";import{a,n as o}from"./modal-USMHOKBI.js";import{$r as s,Sn as c,ai as l,bi as u,ci as d,ei as f,ii as p,li as m,ni as h,oi as g,ri as _,si as v,ti as y,xi as ee,yi as te}from"./index-Bq8I2EvJ.js";var ne=4,re=200,ie=2e4,ae=1.1,oe=[`wire`,`note`,`frame`,`box`,`unit`];function b(e){let t=Math.random().toString(36).slice(2,8);return`${e}-${Date.now().toString(36)}${t}`}function x(){return document.documentElement.dataset.layout===`phone`}function se(e){return e instanceof Element?e.closest(`[data-linked-board-id]`)?.dataset.linkedBoardId??null:null}function ce(e){let{svg:n,canvas:r,renderer:i}=e,a=new Map,o=new Set,s={x:0,y:0,width:1e3,height:600},c=null,l=null;function u(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function d(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},u();return}let o=Math.max(1,t.width/r,t.height/a),c=r*o;s={x:t.x-(c-t.width)/2,y:t.y,width:c,height:a*o},u()}function f(e,t){let r=n.getScreenCTM();if(!r)return{x:e,y:t};let i=new DOMPoint(e,t).matrixTransform(r.inverse());return{x:i.x,y:i.y}}function p(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function m(e,t){let n=Math.min(ie,Math.max(re,s.width*t)),r=n/s.width;s={x:e.x-(e.x-s.x)*r,y:e.y-(e.y-s.y)*r,width:n,height:s.height*r},u()}function h(e,t){let n=p();s={...s,x:s.x-e*n,y:s.y-t*n},u()}function g(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function _(e,t){if(!t){g(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),g(n)}function v(e){let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&g(t)}function y(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function ee(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function te(){c={kind:`pinch`,distance:ee(),viewWidth:s.width}}function b(t){if(t.button!==0||l)return;let r=se(t.target);if(r){e.onOpenLinkedBoard(r);return}if(a.set(t.pointerId,{x:t.clientX,y:t.clientY}),n.setPointerCapture(t.pointerId),a.size===2){te();return}let o=i.elementFromTarget(t.target),s=o?.kind===`box`&&!x()?y(o.id):null;if(o&&s){c={kind:`drag`,pointerId:t.pointerId,boxId:o.id,origin:f(t.clientX,t.clientY),start:s,hasMoved:!1,isAdditive:t.shiftKey};return}if(o&&!x()){_(o.id,t.shiftKey);return}let u=o?.kind===`box`?o.id:null;c={kind:`pan`,pointerId:t.pointerId,lastClient:{x:t.clientX,y:t.clientY},hasMoved:!1,tappedBoxId:u}}function ce(e,t){let n=f(t.clientX,t.clientY),r=n.x-e.origin.x,a=n.y-e.origin.y;!e.hasMoved&&Math.hypot(r,a)<ne*p()||(e.hasMoved=!0,i.nodeOf(e.boxId)?.setAttribute(`transform`,`translate(${r} ${a})`))}function S(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<ne||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},h(n,r))}function le(e){let t=ee();if(t<=0||e.distance<=0)return;let n=[...a.values()];m(f(n.reduce((e,t)=>e+t.x,0)/n.length,n.reduce((e,t)=>e+t.y,0)/n.length),e.viewWidth*(e.distance/t)/s.width)}function C(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?le(c):c?.kind===`drag`&&c.pointerId===e.pointerId?ce(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&S(c,e))}async function w(t,n){if(!t.hasMoved){_(t.boxId,t.isAdditive);return}let r=f(n.clientX,n.clientY),a=i.layout()?.pinnedOffsetY??0,o={x:Math.round(t.start.x+r.x-t.origin.x),y:Math.round(t.start.y+r.y-t.origin.y-a)};await e.sendOps([{op:`set`,id:t.boxId,fields:{at:o}}])||i.nodeOf(t.boxId)?.removeAttribute(`transform`)}function ue(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?w(n,t):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&x()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||g(new Set)))}function de(e){a.delete(e.pointerId),c?.kind===`drag`&&i.nodeOf(c.boxId)?.removeAttribute(`transform`),c=null}function fe(e){e.preventDefault(),e.ctrlKey||e.metaKey?m(f(e.clientX,e.clientY),e.deltaY>0?ae:1/ae):h(-e.deltaX,-e.deltaY)}function T(){let e=l;l=null,e?.remove()}function pe(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;T();let c=r.getBoundingClientRect(),u=s.getBoundingClientRect(),d=t(`input`,`wb-title-input`);d.type=`text`,d.value=o.title,d.maxLength=80,d.setAttribute(`aria-label`,`Box title`),d.style.left=`${u.left-c.left}px`,d.style.top=`${u.top-c.top}px`,d.style.width=`${Math.max(160,u.width)}px`,l=d,r.append(d),d.addEventListener(`keydown`,t=>{if(t.key===`Escape`){t.preventDefault(),T(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();T(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,T),d.focus(),d.select()}function E(e){if(x())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&pe(t.id)}function D(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=oe.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));g(new Set),e.sendOps(r)}function me(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),D()):e.key===`Escape`&&g(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,b),n.addEventListener(`pointermove`,C),n.addEventListener(`pointerup`,ue),n.addEventListener(`pointercancel`,de),n.addEventListener(`wheel`,fe,{passive:!1}),n.addEventListener(`dblclick`,E),n.addEventListener(`keydown`,me),{fit:d,selectedIds:()=>o,clearSelection:()=>g(new Set),pruneSelection:v,closeTitleInput:T}}var S=40,le=44,C=220,w=90,ue=30,de=20,fe=18,T=20,pe=26,E=18,D=26,me=170,he=21,ge=17,_e=10,ve=22,ye=24,be=16,xe=16,Se=26,Ce=24,we=8,Te=10,Ee=14,De=4,Oe=14,ke=8,O=6,Ae=4,je=6,Me=12,Ne=10,Pe=6.6,k=5,A=10,Fe=2,Ie=100,Le=120,Re=4,ze=40,Be=[.5,.35,.65,.2,.8],Ve=Object.freeze({blue:`#60a5fa`,green:`#4ade80`,orange:`#fb923c`,pink:`#f472b6`,cyan:`#22d3ee`,yellow:`#facc15`});function j(e,t){let n=e.split(/\s+/).filter(Boolean),r=[],i=``;for(let e of n){let n=e.match(RegExp(`.{1,${t}}`,`g`))??[e];for(let e of n){let n=i?`${i} ${e}`:e;n.length<=t?i=n:(r.push(i),i=e)}}return i&&r.push(i),r.length>0?r:[``]}function He(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:Ve[n.color]}:null}function Ue(e,t){let n=j(t.title,T),r=t.lines.flatMap(e=>j(e.text,pe-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=He(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*de+r.length*fe+(i?26:0)}}function M(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function We(e){let t=j(e.text,he);return{lines:t,height:24+(t.length+1)*ge}}function Ge(e){let t=new Map;for(let n of M(e,`note`)){let e=t.get(n.on),r=We(n).height;t.set(n.on,e===void 0?r:e+_e+r)}return t}function Ke(e){return e.columns.map(e=>e.title?j(e.title,ye):[])}function qe(e){return(Math.max(1,...e.map(e=>e.length))-1)*be}function N(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i?i.push(r):n.set(e,[r])}return n}function Je(e,t){let n=M(e,`box`).filter(e=>!e.at),r=new Set(n.filter(e=>t.has(e.id)).map(e=>e.column)),i=new Set(M(e,`frame`).flatMap(e=>e.contains)),a=new Set(n.filter(e=>i.has(e.id)).map(e=>e.column)),o=e=>Te+(e!==void 0&&a.has(e)?E:0);return e.columns.map((t,n)=>{let i=r.has(t.id);return{left:i?156:o(t.id),right:o(e.columns[n+1]?.id),minimumWidth:i?Math.max(w,186):w}})}function Ye(e,t,n){return e.map((e,r)=>{let i=t[r]??0,a=n[r]??0,o=i>0?e.left+e.right+(i+1)*Ee:0,s=a>0?e.left+e.right+a+20:0;return Math.max(e.minimumWidth,o,s)})}function Xe(e,t){let n=[],r=S;for(let[i]of e.columns.entries())n.push(r),r+=C+(t[i]??w);return n}function Ze(e,t,n){return e.map((e,r)=>{let i=n[r]??{left:Te,right:Te,minimumWidth:w},a=e+C+(t[r]??w);return{left:e+C+i.left,right:a-i.right}})}function Qe(e,t,n,r){if(!t.at)return Math.max(0,e.columns.findIndex(e=>e.id===t.column));let i=n.x+n.width/2,a=r.findLastIndex(e=>e<=i);return Math.max(0,a)}function $e(e){let t=new Map;for(let n of M(e,`frame`))for(let e of n.contains)t.has(e)||t.set(e,n.id);return t}function et(e,t){return e===t?0:(e?E:0)+(t?44:0)}function tt(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=$e(e),c=M(e,`box`).map((e,t)=>({box:e,index:t})).sort((e,t)=>e.box.order-t.box.order||e.index-t.index);for(let{box:l}of c){let c=Math.max(0,e.columns.findIndex(e=>e.id===l.column)),u=Ue(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+et(o.get(l.column)??null,d),p=l.at??{x:t[c]??S,y:f};if(!l.at){let e=(r.get(l.id)??0)-we;a.set(l.column,f+Math.max(u.height,e)+ue),o.set(l.column,d)}i.set(l.id,{kind:`box`,id:l.id,x:p.x,y:p.y,width:C,height:u.height,titleLines:u.titleLines,bodyLines:u.bodyLines,lane:u.lane,isGhost:l.ghost})}return i}function nt(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.width)),i=Math.max(...e.map(e=>e.y+e.height));return{x:t,y:n,width:r-t,height:i-n}}function rt(e,t){return M(e,`frame`).flatMap(e=>{let n=nt(e.contains.flatMap(e=>t.get(e)??[]));return n?[{kind:`frame`,id:e.id,title:e.title,x:n.x-E,y:n.y-E-D,width:n.width+36,height:n.height+36+D}]:[]})}function it(e){return e===`left`||e===`right`}function P(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function at(e,t,n,r){let i=e.y<t.y?e:t,a=i===e?t:e;return[...r.boxesById.values()].some(o=>o.id!==e.id&&o.id!==t.id&&r.columnIndexByBoxId.get(o.id)===n&&o.y<a.y&&o.y+o.height>i.y+i.height)}function ot(e,t,n){let r=n.columnIndexByBoxId.get(e.id)??0,i=n.columnIndexByBoxId.get(t.id)??0;if(r===i){if(e.id!==t.id&&!at(e,t,r,n)){let n=t.y>e.y;return{shape:`straight`,exitSide:n?`bottom`:`top`,entrySide:n?`top`:`bottom`,sourceGap:-1,targetGap:-1}}return{shape:`channel`,exitSide:`right`,entrySide:`right`,sourceGap:r,targetGap:r}}return i>r?{shape:i===r+1?`channel`:`long`,exitSide:`right`,entrySide:`left`,sourceGap:r,targetGap:i-1}:{shape:i===r-1?`channel`:`long`,exitSide:`left`,entrySide:`right`,sourceGap:r-1,targetGap:i}}function st(e){let t=e.wires.flatMap(t=>{let n=e.boxesById.get(t.from),r=e.boxesById.get(t.to);if(!n||!r)return[];let i=t.tone===`lane`?n.lane?.hex??null:null,a=P(n);return[{wire:t,from:n,to:r,strokeHex:i,styleKey:`${t.dashed}|${t.tone}|${i}`,...ot(n,r,e),busKey:null,start:a,end:P(r),crossingY:a.y}]}),n=new Map,r=e=>`${e.to.id}|${e.entrySide}|${e.styleKey}`;for(let e of t)e.shape!==`straight`&&n.set(r(e),(n.get(r(e))??0)+1);for(let e of t)e.shape!==`straight`&&(n.get(r(e))??0)>1&&(e.busKey=r(e));return t}function ct(e,t,n){let r=Array.from({length:n},(e,t)=>t);if(it(t)){let i=t===`left`?e.x:e.x+e.width,a=Math.min(Oe,(e.height-16)/Math.max(n-1,1)),o=e.y+Math.min(e.height/2,40)-(n-1)*a/2,s=Math.max(e.y+ke,Math.min(o,e.y+e.height-ke-(n-1)*a));return r.map(e=>({x:i,y:Math.round(s+e*a)}))}let i=t===`top`?e.y:e.y+e.height,a=e.x+e.width/2-(n-1)*Oe/2;return r.map(e=>({x:Math.round(a+e*Oe),y:i}))}function lt(e){return N(e.flatMap(e=>[{box:e.from,side:e.exitSide,groupKey:`exit|${e.styleKey}`,wireId:e.wire.id,farPoint:P(e.to),assign:t=>{e.start=t}},{box:e.to,side:e.entrySide,groupKey:e.busKey?`bus|${e.busKey}`:`entry|${e.wire.id}`,wireId:e.wire.id,farPoint:P(e.from),assign:t=>{e.end=t}}]),e=>`${e.box.id}|${e.side}`)}function ut(e){return new Map([...e.entries()].map(([e,t])=>[e,[...N(t,e=>e.groupKey).entries()].map(([e,t])=>({groupKey:e,firstWireId:t.map(e=>e.wireId).sort()[0]??e,farCoordinate:t.reduce((e,t)=>e+(it(t.side)?t.farPoint.y:t.farPoint.x),0)/t.length})).sort((e,t)=>e.farCoordinate-t.farCoordinate||e.firstWireId.localeCompare(t.firstWireId)||e.groupKey.localeCompare(t.groupKey)).map(e=>e.groupKey)]))}function dt(e,t){for(let[n,r]of e){let e=r[0],i=t.get(n)??[];if(!e)continue;let a=ct(e.box,e.side,i.length);for(let e of r){let t=a[i.indexOf(e.groupKey)];t&&e.assign(t)}}}function ft(e,t){let n=t[e.sourceGap]??{left:e.start.x,right:e.start.x},r=t[e.targetGap]??{left:e.end.x,right:e.end.x};return{left:Math.min(n.left,r.left),right:Math.max(n.right,r.right)}}function pt(e,t,n){return[...[...n.boxesById.values()].filter(t=>t.id!==e.from.id&&t.id!==e.to.id),...n.obstacles].filter(e=>e.x<t.right&&e.x+e.width>t.left)}function mt(e,t){return!t.some(t=>e>t.y-O&&e<t.y+t.height+O)}function ht(e){let t=e.map(e=>({top:e.y-O,bottom:e.y+e.height+O})).sort((e,t)=>e.top-t.top),n=[];for(let e of t){let t=n.at(-1);t&&e.top<=t.bottom?t.bottom=Math.max(t.bottom,e.bottom):n.push({...e})}return n.slice(1).flatMap((e,t)=>{let r=n[t];return!r||e.top-r.bottom<Ae?[]:[{top:r.bottom,bottom:e.top}]})}function gt(e,t){return e.left<t.right&&t.left<e.right}function _t(e,t){let n=[];return e.forEach((r,i)=>{let a=e.slice(0,i).flatMap((e,i)=>t(r,e)?[n[i]??0]:[]);n.push(a.length>0?Math.max(...a)+1:0)}),n}function vt(e,t){let n=[],r=[];for(let i of e){if(i.shape!==`long`)continue;let e=ft(i,t.gaps),a=pt(i,e,t),o=[i.start.y,i.end.y].find(e=>mt(e,a));if(o!==void 0){i.crossingY=o;continue}let s=(i.start.y+i.end.y)/2,c=ht(a).sort((e,t)=>Math.abs((e.top+e.bottom)/2-s)-Math.abs((t.top+t.bottom)/2-s))[0];c?n.push({plan:i,interval:c,span:e}):r.push({plan:i,span:e})}let i=N(n,e=>`${Math.round(e.interval.top)}|${Math.round(e.interval.bottom)}`);for(let e of i.values()){let t=[...e].sort((e,t)=>e.plan.start.y-t.plan.start.y||e.plan.wire.id.localeCompare(t.plan.wire.id)),n=_t(t,(e,t)=>gt(e.span,t.span)),i=t[0]?.interval??{top:0,bottom:0},a=i.bottom-i.top,o=Math.max(1,Math.floor(a/je)-1),s=Math.min(o,Math.max(...n)+1);t.forEach((e,t)=>{let c=n[t]??0;c>=o?r.push({plan:e.plan,span:e.span}):e.plan.crossingY=Math.round(i.top+a*(c+1)/(s+1))})}let a=[...r].sort((e,t)=>t.span.right-t.span.left-(e.span.right-e.span.left)||e.plan.wire.id.localeCompare(t.plan.wire.id)),o=_t(a,(e,t)=>gt(e.span,t.span)).map(e=>a.length-1-e);return a.forEach(({plan:e},n)=>{e.crossingY=t.topBandBottom-(o[n]??0)*Me}),r.length>0?Math.max(...o)+1:0}function yt(e,t){return t<=e?`left`:`right`}function bt(e,t){return{key:e,gap:t,top:1/0,bottom:-1/0,leftYs:[],rightYs:[],track:-1,x:0}}function F(e,t,n){(t===`left`?e.leftYs:e.rightYs).push(n),e.top=Math.min(e.top,n),e.bottom=Math.max(e.bottom,n)}function I(e){return e.busKey?`bus|${e.busKey}`:`wire|${e.wire.id}|target`}function xt(e,t){let n=new Map,r=(e,t)=>{let r=n.get(e);if(r)return r;let i=bt(e,t);return n.set(e,i),i},i=new Set;for(let n of e){if(n.shape===`straight`)continue;let e=t.columnIndexByBoxId.get(n.from.id)??0,a=t.columnIndexByBoxId.get(n.to.id)??0,o=n.exitSide===`right`&&n.entrySide===`left`,s=r(I(n),n.targetGap);if(n.shape===`channel`&&F(s,yt(n.targetGap,e),n.start.y),n.shape===`long`){let t=r(`wire|${n.wire.id}|source`,n.sourceGap);F(t,yt(n.sourceGap,e),n.start.y),F(t,o?`right`:`left`,n.crossingY),F(s,o?`left`:`right`,n.crossingY)}i.has(s.key)||(i.add(s.key),F(s,yt(n.targetGap,a),n.end.y))}return n}function St(e,t){return e.filter(e=>e>t.top&&e<t.bottom).length}function Ct(e,t){return St(t.leftYs,e)+St(e.rightYs,t)}function wt(e,t){let n=t.map(()=>0),r=N([...e.values()].filter(e=>e.bottom>e.top),e=>e.gap);for(let[e,i]of r){let r=[...i].sort((e,t)=>Ct(e,t)-Ct(t,e)||e.top-t.top||e.key.localeCompare(t.key)),a=_t(r,(e,t)=>e.top<t.bottom+De&&t.top<e.bottom+De),o=Math.max(...a)+1;n[e]=o;let s=t[e]??{left:0,right:0};r.forEach((e,t)=>{e.track=a[t]??0,e.x=Math.round(s.left+(s.right-s.left)*(e.track+1)/(o+1))})}for(let n of e.values()){if(n.track>=0)continue;let e=t[n.gap]??{left:0,right:0};n.x=Math.round((e.left+e.right)/2)}return n}function Tt(e){let t=e.filter((t,n)=>{let r=e[n-1];return!r||r.x!==t.x||r.y!==t.y});return t.filter((e,n)=>{let r=t[n-1],i=t[n+1];return!r||!i||!(r.x===e.x&&e.x===i.x||r.y===e.y&&e.y===i.y)})}function Et(e){return e.slice(1).flatMap((t,n)=>{let r=e[n];return r?[{from:r,to:t}]:[]})}function Dt(e){if(e.start.x===e.end.x)return[e.start,e.end];let t=Math.round((e.start.y+e.end.y)/2);return[e.start,{x:e.start.x,y:t},{x:e.end.x,y:t},e.end]}function Ot(e,t){if(e.shape===`straight`)return Dt(e);let n=t.get(I(e))?.x??e.end.x,r=e.shape===`long`?e.crossingY:e.start.y,i=t.get(`wire|${e.wire.id}|source`)?.x??n,a=e.shape===`long`?[e.start,{x:i,y:e.start.y},{x:i,y:r},{x:n,y:r}]:[e.start,{x:n,y:r}];return e.busKey?a:[...a,{x:n,y:e.end.y},e.end]}function kt(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function At(e,t){let n=new Map;for(let t of[...e].sort((e,t)=>e.wire.id.localeCompare(t.wire.id)))t.busKey&&!n.has(t.busKey)&&n.set(t.busKey,t.wire.id);return e.map(e=>{let r=Tt(Ot(e,t)),i=e.busKey?t.get(I(e)):void 0,a=e.busKey!==null&&n.get(e.busKey)===e.wire.id,o=i&&a?[{from:{x:i.x,y:i.top},to:{x:i.x,y:i.bottom}},{from:{x:i.x,y:e.end.y},to:e.end}].filter(e=>e.from.x!==e.to.x||e.from.y!==e.to.y):[];return{plan:e,points:r,trunk:o,segments:[...Et(r),...o]}})}function L(e){return e.from.y===e.to.y}function jt(e,t){let n=t.x+t.width,r=t.y+t.height;if(L(e)){let i=e.from.y;return t.y<i&&i<r&&Math.min(e.from.x,e.to.x)<n&&Math.max(e.from.x,e.to.x)>t.x}let i=e.from.x;return t.x<i&&i<n&&Math.min(e.from.y,e.to.y)<r&&Math.max(e.from.y,e.to.y)>t.y}function Mt(e,t){return e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height}function Nt(e){return Math.ceil(e.length*Pe)}function Pt(e,t){return{x:e.x-t/2,y:e.y-A,width:t,height:13}}function Ft(e){return Math.abs(e.from.x-e.to.x)+Math.abs(e.from.y-e.to.y)}function It(e,t){let n=[...e].sort((e,t)=>Ft(t)-Ft(e));return[...e.slice(0,1),...n].flatMap(e=>[...Be.flatMap(n=>{let r=e.from.x+(e.to.x-e.from.x)*n,i=e.from.y+(e.to.y-e.from.y)*n;return L(e)?[{x:r,y:i-k},{x:r,y:i+k+A}]:[{x:r+k+t/2,y:i+A/2},{x:r-k-t/2,y:i+A/2}]}),...Lt(e,t)])}function Lt(e,t){if(!L(e))return[];let n=e.from.y;return[Math.min(e.from.x,e.to.x)+k+t/2,Math.max(e.from.x,e.to.x)-k-t/2].flatMap(e=>[{x:e,y:n-k},{x:e,y:n+k+A}])}function Rt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function zt(e,t,n){let r=new Map,i=e.flatMap(e=>e.segments),a=[...t.boxesById.values(),...t.obstacles];for(let o of e){let e=o.plan.wire.label;if(!e)continue;let s=Nt(e),c=It(o.segments,s),l=c.find(e=>{let n=Pt(e,s);if(n.y<t.contentTop)return!1;let o=Rt(n,Fe);return i.some(e=>jt(e,o))||a.some(e=>Mt(n,e))?!1:![...r.values()].some(e=>Mt(n,e.bounds))}),u=l??c[0]??P(o.plan.from);l||n.push(`wire ${o.plan.wire.id} label "${e}" has no clear spot`),r.set(o.plan.wire.id,{at:{x:Math.round(u.x),y:Math.round(u.y)},bounds:Pt(u,s)})}return r}function Bt(e,t,n){return e>Math.min(t,n)+.5&&e<Math.max(t,n)-.5}function Vt(e,t){if(L(e)===L(t))return!1;let n=L(e)?e:t,r=n===e?t:e;return Bt(r.from.x,n.from.x,n.to.x)&&Bt(n.from.y,r.from.y,r.to.y)}function Ht(e,t){if(L(e)!==L(t))return!1;let n=L(e),r=e=>n?e.from.y:e.from.x,i=e=>Math.min(n?e.from.x:e.from.y,n?e.to.x:e.to.y),a=e=>Math.max(n?e.from.x:e.from.y,n?e.to.x:e.to.y);return r(e)===r(t)&&Math.min(a(e),a(t))-Math.max(i(e),i(t))>1}function Ut(e,t){return e.plan.styleKey===t.plan.styleKey&&e.plan.start.x===t.plan.start.x&&e.plan.start.y===t.plan.start.y}function Wt(e){return e.flatMap((t,n)=>e.slice(n+1).flatMap(e=>{if(t.plan.busKey!==null&&t.plan.busKey===e.plan.busKey)return[];let n=t.segments.flatMap(t=>e.segments.map(e=>[t,e]));return n.some(([e,t])=>Vt(e,t))?[`wire ${t.plan.wire.id} crosses wire ${e.plan.wire.id}`]:Ut(t,e)?[]:n.some(([e,t])=>Ht(e,t))?[`wire ${t.plan.wire.id} overlaps wire ${e.plan.wire.id}`]:[]}))}function Gt(e,t){let n=[...t.boxesById.values()];return e.flatMap(e=>n.flatMap(t=>{if(t.id===e.plan.from.id||t.id===e.plan.to.id)return[];let n=Rt(t,-2);return e.segments.some(e=>jt(e,n))?[`wire ${e.plan.wire.id} runs through box ${t.id}`]:[]}))}function Kt(t){if(t.length<=e.layoutWarnings)return[...t];let n=t.slice(0,e.layoutWarnings-1);return[...n,`and ${t.length-n.length} more`]}function qt(e,t){let n=t.map(()=>0);for(let t of e)t.wire.label&&t.shape===`channel`&&(n[t.targetGap]=Math.max(n[t.targetGap]??0,Nt(t.wire.label)));return n}function Jt(e,t){return nt([...e.flatMap(e=>e.segments.flatMap(e=>[e.from,e.to])).map(e=>({x:e.x,y:e.y,width:0,height:0})),...t])}function Yt(e,t,n,r){dt(n,r);let i=vt(e,t),a=xt(e,t),o=wt(a,t.gaps),s=At(e,a);return{runsByKey:a,tracksByGap:o,topTrackCount:i,drawn:s,crossingCost:Gt(s,t).length*Ie+Wt(s).length}}function Xt(e,t){let n=e[t],r=e[t+1];n!==void 0&&r!==void 0&&(e[t]=r,e[t+1]=n)}function Zt(e,t){let n=lt(e),r=ut(n),i=Yt(e,t,n,r).crossingCost,a=e.length<=Le;for(let o of r.values())for(let s=0;a&&i>0&&s+1<o.length;s+=1){Xt(o,s);let a=Yt(e,t,n,r).crossingCost;a<i?i=a:Xt(o,s)}return Yt(e,t,n,r)}function Qt(e){let t=st(e),{runsByKey:n,tracksByGap:r,topTrackCount:i,drawn:a}=Zt(t,e),o=[],s=zt(a,e,o),c=a.map(({plan:e,points:t,trunk:r})=>{let i=t.at(-1)??e.end,a=e.busKey?n.get(I(e)):void 0,o=r.length>0,c=a!==void 0&&i.y>a.top&&i.y<a.bottom;return{kind:`wire`,id:e.wire.id,path:[kt(t),...r.map(e=>kt([e.from,e.to]))].join(` `),start:e.start,end:o||!e.busKey?e.end:i,label:e.wire.label,labelAt:s.get(e.wire.id)?.at??P(e.from),isDashed:e.wire.dashed,strokeHex:e.strokeHex,tone:e.wire.tone,hasArrowhead:e.busKey===null||o,joinAt:c?i:null}}),l=[...s.values()].map(e=>e.bounds);return{wires:c,tracksByGap:r,topTrackCount:i,labelWidthByGap:qt(t,e.gaps),warnings:Kt([...Gt(a,e),...Wt(a),...o]),extent:Jt(a,l)}}function $t(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function en(e,t){let n=new Map;return M(e,`note`).flatMap(e=>{let r=t.get(e.on);if(!r)return[];let{lines:i,height:a}=We(e),o=n.get(e.on)??r.y-we;return n.set(e.on,o+a+_e),[{kind:`note`,id:e.id,x:r.x+r.width-Ce,y:o,width:me,height:a,lines:i,byline:$t(e),isResolved:e.resolvedBy!==null}]})}function tn(e,t,n,r){let i=e.flatMap(e=>e.kind===`wire`?[]:[e]),a=(n.at(-1)??S)+C,o=nt([...i,...t?[t]:[],{x:0,y:0,width:a,height:r}]);return o?{x:Math.min(0,o.x-S),y:Math.min(0,o.y-S),width:o.width+80,height:o.height+80}:{x:0,y:0,width:a+S,height:80}}function nn(e,t){let n=Xe(e,t.gapWidths),r=tt(e,n,t.boxesTop,t.stackHeightByBoxId),i=rt(e,r),a=en(e,r),o=new Map(M(e,`box`).flatMap(t=>{let i=r.get(t.id);return i?[[t.id,Qe(e,t,i,n)]]:[]}));return{columnLeftEdges:n,boxesById:r,frames:i,notes:a,routing:Qt({wires:M(e,`wire`),boxesById:r,columnIndexByBoxId:o,obstacles:[...a,...i.map(e=>({x:e.x,y:e.y,width:e.width,height:D}))],gaps:Ze(n,t.gapWidths,t.reserves),topBandBottom:t.boxesTop-Ne,contentTop:t.contentTop})}}function rn(e,t){return Array.from({length:Math.max(e.length,t.length)},(n,r)=>Math.max(e[r]??0,t[r]??0))}function an(e,t,n){let r=t.tracksByGap,i=t.topTrackCount;for(let a=1;;a+=1){let o=Ye(n.reserves,r,t.labelWidthByGap),s=n.headerBoxesTop+fn(i),c=nn(e,{gapWidths:o,reserves:n.reserves,boxesTop:s,contentTop:n.contentTop,stackHeightByBoxId:n.stackHeightByBoxId}),l=c.routing.topTrackCount>i,u=c.routing.tracksByGap.some((e,t)=>e>(r[t]??0));if(a>=Re||!l&&!u)return{placed:c,boxesTop:s};i=Math.max(i,c.routing.topTrackCount),r=rn(r,c.routing.tracksByGap)}}function on(e){let t=j(e.title,T),n=e.lines.flatMap(e=>j(e.text,pe)),r=+!!e.linkedBoardId;return{titleLines:t,bodyLines:n,height:42+t.length*de+(n.length+r)*fe}}function sn(e){let t=new Map,n=new Map;for(let r of m(e)){let i=e.elements[r.unitId];if(i?.kind!==`unit`)continue;let a=on(i),o=n.get(r.level)??70;n.set(r.level,o+a.height+ue),t.set(i.id,{kind:`unit`,id:i.id,x:S+(r.level-1)*310,y:o,width:C,height:a.height,label:r.label,titleLines:a.titleLines,bodyLines:a.bodyLines,linkedBoardId:i.linkedBoardId})}return t}function cn(e,t){let n={x:e.x+e.width,y:e.y+Math.round(e.height/2)},r={x:t.x,y:t.y+Math.round(t.height/2)},i=t.x-Math.round(w/2);return kt(Tt([n,{x:i,y:n.y},{x:i,y:r.y},r]))}function ln(e,t){return M(e,`unit`).flatMap(e=>{let n=t.get(e.id);return n?e.after.flatMap(e=>{let r=t.get(e);return r?[cn(r,n)]:[]}):[]})}function un(e){return e.size===0?S:Math.max(...[...e.values()].map(e=>e.y+e.height))+ze}function dn(e,t){if(t===0)return e;let n=Object.fromEntries(Object.entries(e.elements).map(([e,n])=>n.kind!==`box`||!n.at?[e,n]:[e,{...n,at:{x:n.at.x,y:n.at.y+t}}]));return{...e,elements:n}}function fn(e){return e>0?e*Me+Ne:0}function pn(e){let t=sn(e),n=un(t),r=n-S,i=dn(e,r),a=Ge(i),o=Ke(i),s=qe(o),c=n+Se+s,l=n+le+s,u=Je(i,a),{placed:d,boxesTop:f}=an(i,nn(i,{gapWidths:Ye(u,[],[]),reserves:u,boxesTop:l,contentTop:c,stackHeightByBoxId:a}).routing,{reserves:u,headerBoxesTop:l,contentTop:c,stackHeightByBoxId:a}),{columnLeftEdges:p}=d,m=[...d.frames,...d.routing.wires,...d.boxesById.values(),...d.notes,...t.values()],h=tn(m,d.routing.extent,p,f),g=h.y+h.height,_=i.lanes.map((e,t)=>({label:e.label||e.id,hex:Ve[e.color],x:S,y:g+t*ve})),v=g+_.length*ve+(_.length>0?12:0),y=i.caption?{text:i.caption,x:S,y:v}:null,ee=_.length*ve+(y?30:0)+(_.length>0?12:0);return{columns:i.columns.map((e,t)=>({id:e.id,titleLines:o[t]??[],titleBaselineY:n+xe,ruleY:c,x:p[t]??S,width:C})),elements:m,legend:_,caption:y,pinnedOffsetY:r,plan:t.size>0?{titleAt:{x:S,y:56},arrowPaths:ln(i,t)}:null,bounds:{...h,height:h.height+ee},warnings:d.routing.warnings}}function mn(e){return JSON.stringify(e)}var hn=`http://www.w3.org/2000/svg`,R=12,gn=26,_n=20,vn=18,yn=17,bn=14,xn=16,Sn=24,Cn=18,wn=`Plan`,Tn=`open linked board`;function z(e,t={},n=``){let r=document.createElementNS(hn,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,String(n));return n&&r.setAttribute(`class`,n),r}function B(e,t,n,r){let i=z(`text`,{x:t,y:n},r);return i.textContent=e,i}function V(e,t){let n=z(`g`,{},`wb-element ${t}`);return n.dataset.elementId=e.id,n.dataset.elementKind=e.kind,n}function En(e){let t=V(e,e.isGhost?`wb-box wb-ghost`:`wb-box`),n=z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-box-outline`);e.lane&&(n.style.stroke=e.lane.hex),t.append(n),e.titleLines.forEach((n,r)=>{t.append(B(n,e.x+R,e.y+gn+r*_n,`wb-box-title`))});let r=e.y+gn+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{let a=e.x+R+(n.muted?bn:0);t.append(B(n.text,a,r+i*vn,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),!e.lane)return t;let i=e.y+e.height-28,a=Math.min(e.width-24,16+e.lane.label.length*8),o=z(`rect`,{x:e.x+R,y:i,width:a,height:18,rx:9},`wb-lane-pill`);o.style.stroke=e.lane.hex;let s=B(e.lane.label,e.x+R+8,i+13,`wb-lane-pill-text`);return s.style.fill=e.lane.hex,t.append(o,s),t}function Dn(e){let t=V(e,`wb-frame`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12},`wb-frame-outline`),B(e.title,e.x+14,e.y+18,`wb-frame-title`)),t}function On(e){let t=V(e,`wb-wire wb-tone-${e.tone}`),n=z(`path`,{d:e.path},`wb-wire-hit`),r=z(`path`,e.hasArrowhead?{d:e.path,"marker-end":`url(#wb-arrow)`}:{d:e.path},e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`);return e.strokeHex&&(r.style.stroke=e.strokeHex),t.append(n,r,z(`circle`,{cx:e.start.x,cy:e.start.y,r:3},`wb-wire-dot`)),e.joinAt&&t.append(z(`circle`,{cx:e.joinAt.x,cy:e.joinAt.y,r:3},`wb-wire-dot`)),e.label&&t.append(B(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),t}function kn(e){let t=V(e,e.isResolved?`wb-note wb-resolved`:`wb-note`);return t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4},`wb-note-card`)),e.lines.forEach((n,r)=>{t.append(B(n,e.x+10,e.y+22+r*yn,`wb-note-text`))}),e.byline&&t.append(B(e.byline,e.x+10,e.y+22+e.lines.length*yn,`wb-note-byline`)),t}function An(e){let t=V(e,`wb-unit`);t.append(z(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8},`wb-unit-outline`),B(e.label,e.x+R,e.y+Sn,`wb-unit-label`));let n=e.y+Sn+Cn;e.titleLines.forEach((r,i)=>{t.append(B(r,e.x+R,n+i*_n,`wb-box-title`))});let r=n+e.titleLines.length*_n;if(e.bodyLines.forEach((n,i)=>{t.append(B(n,e.x+R,r+i*vn,`wb-box-line`))}),!e.linkedBoardId)return t;let i=B(Tn,e.x+R,r+e.bodyLines.length*vn,`wb-unit-link`);return i.dataset.linkedBoardId=e.linkedBoardId,t.append(i),t}var jn={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`,unit:`units`},Mn=[`box`,`frame`,`wire`,`note`,`unit`];function Nn(e){switch(e.kind){case`box`:return En(e);case`frame`:return Dn(e);case`wire`:return On(e);case`note`:return kn(e);case`unit`:return An(e)}}function Pn(e){let t=z(`g`,{},`wb-chrome`);if(e.plan){t.append(B(wn,e.plan.titleAt.x,e.plan.titleAt.y,`wb-column-title`));for(let n of e.plan.arrowPaths)t.append(z(`path`,{d:n,"marker-end":`url(#wb-arrow)`},`wb-wire-line`))}for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.append(B(e,n.x,n.titleBaselineY+r*xn,`wb-column-title`))}),t.append(z(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY},`wb-column-rule`)));for(let n of e.legend){let e=z(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3},`wb-legend-swatch`);e.style.fill=n.hex,t.append(e,B(n.label,n.x+22,n.y+12,`wb-legend-text`))}return e.caption&&t.append(B(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),t}function Fn(){let e=z(`defs`),t=z(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`});return t.append(z(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})),e.append(t),e}function In(e){let t={frames:z(`g`,{},`wb-layer`),wires:z(`g`,{},`wb-layer`),boxes:z(`g`,{},`wb-layer`),notes:z(`g`,{},`wb-layer`),units:z(`g`,{},`wb-layer`)},n=z(`g`);e.replaceChildren(Fn(),n,t.frames,t.wires,t.boxes,t.notes,t.units);let r=new Map,i=null,a=new Set;function o(e,t){t.classList.toggle(`is-selected`,a.has(e))}function s(e){let a=pn(e),s=Pn(a);n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=mn(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Nn(e);o(e.id,a),i&&i.node.replaceWith(a),i||t[jn[e.kind]].append(a),r.set(e.id,{signature:n,node:a})}for(let[e,t]of r)c.has(e)||(t.node.remove(),r.delete(e));return i=a,a}function c(e){if(!(e instanceof Element))return null;let t=e.closest(`.wb-element`),n=t?.dataset.elementId,r=Mn.find(e=>e===t?.dataset.elementKind);return!n||!r?null:{id:n,kind:r}}function l(e){a=e;for(let[e,t]of r)o(e,t.node)}function u(){for(let e of r.values())e.node.remove();r.clear();let e=z(`g`);n.replaceWith(e),n=e,i=null}return{render:s,layout:()=>i,elementFromTarget:c,nodeOf:e=>r.get(e)?.node??null,setSelection:l,clear:u}}var Ln=`http://www.w3.org/2000/svg`,Rn=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,zn=`Pick a board above.`,H=null,U=null,W=null,G=null,Bn=!0,K=null,q=i(`action-status wb-status`),J=i(`action-status wb-status`);function Y(e){let{dialog:n,close:r,actions:i,btnCancel:a}=o({title:e.title}),s=t(`input`,`dialog-input`);s.type=`text`,s.placeholder=e.placeholder,s.maxLength=e.maxLength,s.value=e.initialValue??``,s.autocomplete=`off`,s.setAttribute(`aria-label`,e.label);let c=t(`div`,`dialog-error`);c.setAttribute(`role`,`alert`);let l=e.choices?t(`select`,`dialog-input wb-dialog-select`):null;if(l&&e.choices){l.setAttribute(`aria-label`,e.choices.label);for(let n of e.choices.options){let e=t(`option`,null,n.text);e.value=n.value,l.append(e)}}let u=t(`button`,`btn-dialog btn-dialog-confirm`,e.confirmLabel);u.type=`button`,i.append(u),n.append(t(`label`,`dialog-label`,e.label),s,...l?[l]:[],c,i);async function d(){let t=s.value.trim();if(!t){c.textContent=`${e.label} is empty.`;return}u.disabled=!0;let n=await e.onSubmit(t,l?.value??null);u.disabled=!1,n?c.textContent=n:r()}a.addEventListener(`click`,r),u.addEventListener(`click`,()=>void d()),s.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),d())}),requestAnimationFrame(()=>s.focus())}function X(){return H?g(H):null}function Vn(){return s().find(e=>e.id===H)??null}async function Hn(e){if(!H||e.length===0)return!1;let t=await v(H,e);return t.ok?(q.clear(),!0):(q.show(`error`,t.error),!1)}async function Un(e){if(!H)return`No board is open.`;let t=await v(H,e);return t.ok?null:t.error}function Wn(e){let t=r(e);return t?n(t):`closed session`}function Z(e){let t=X();return[...G?.selectedIds()??new Set].flatMap(e=>t?.elements[e]??[]).filter(t=>t.kind===e)}function Gn(){if(!U)return;let e=X(),t=Z(`box`).length,n=G?.selectedIds().size??0;U.buttons.box.disabled=!e,U.buttons.wire.disabled=t!==2,U.buttons.note.disabled=t!==1,U.buttons.frame.disabled=t===0,U.buttons.unit.disabled=!e,U.buttons.fit.disabled=!e,U.buttons.remove.disabled=!e,U.toolbar.dataset.selectedCount=String(n)}function Kn(){if(!U)return;let e=s();H&&!e.some(e=>e.id===H)&&(H=null),!H&&e[0]&&Q(e[0].id),U.list.replaceChildren(...e.map(e=>{let n=t(`button`,`wb-board-tab`,e.title);return n.type=`button`,n.setAttribute(`aria-pressed`,String(e.id===H)),e.connectedSessionIds.length>0&&n.append(t(`span`,`wb-board-tab-count`,String(e.connectedSessionIds.length))),n.addEventListener(`click`,()=>Q(e.id)),n})),qn()}function qn(){if(!U)return;let e=Vn(),n=s().length>0;U.boardHead.hidden=!e,U.canvas.hidden=!e,U.empty.hidden=!!e,U.empty.textContent=n?zn:Rn,e&&(U.boardMeta.textContent=`v${e.version}`,U.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,Wn(e)))),e.connectedSessionIds.length===0&&U.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),Gn(),Yn())}function Jn(e,t){let n=Wn(t);if(!e?.connectedSessionIds.includes(t))return`${n} is not connected to this board`;let r=e.queuedBySessionId[t]??0;return r===0?`${n} has read every change`:`${r} board ${r===1?`edit`:`edits`} queued for ${n}`}function Yn(){if(!U||!K)return;let e=Vn();U.dockQueued.textContent=Jn(e,K),U.sendToAgent.disabled=!e?.connectedSessionIds.includes(K)}async function Xn(){if(!U||!H||!K)return;U.sendToAgent.disabled=!0,J.show(`busy`,`sending`);let e=await h(H,K);Yn(),e.ok?J.show(`ok`,`sent; the agent reads the board when it is ready`):J.show(`error`,e.error)}function Zn(){if(!W)return;let e=X();e?(W.render(e),G?.pruneSelection(e),Bn&&=(G?.fit(),!1),Gn()):W.clear()}function Q(e){H!==e&&(H=e,Bn=!0,G?.clearSelection(),G?.closeTitleInput(),W?.clear(),q.clear(),Kn(),l(e).then(Zn))}function Qn(){let t=X();if(!t)return;let n=Z(`box`)[0],r=t.columns.map(e=>({value:e.id,text:e.title||e.id})),i=n?.column;i&&r.sort((e,t)=>Number(t.value===i)-Number(e.value===i)),Y({title:`Add a box`,label:`Box title`,placeholder:`parse the feed`,maxLength:e.title,confirmLabel:`Add box`,choices:r.length>1?{label:`Column`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`box`,id:b(`box`),title:e,column:t??r[0]?.value??`main`,lines:[],lane:null,ghost:!1,order:0,at:null}}])})}function $n(){let t=X();if(!t)return;let n=s().filter(e=>e.id!==t.id),r=[{value:``,text:`No linked board`},...n.map(e=>({value:e.id,text:e.title}))];Y({title:`Add a unit`,label:`Unit title`,placeholder:`index the diffs`,maxLength:e.title,confirmLabel:`Add unit`,choices:n.length>0?{label:`Linked board`,options:r}:void 0,onSubmit:(e,t)=>Un([{op:`add`,element:{kind:`unit`,id:b(`unit`),title:e,lines:[],after:[],linkedBoardId:t||null}}])})}function er(t){Y({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>Un([{op:`add`,element:{kind:`note`,id:b(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function tr(){let[e,t]=Z(`box`);e&&t&&(G?.clearSelection(),Hn([{op:`add`,element:{kind:`wire`,id:b(`wire`),from:e.id,to:t.id,dashed:!1,tone:`plain`,label:null}}]))}function nr(){let t=Z(`box`).map(e=>e.id);t.length!==0&&Y({title:`Frame the selected boxes`,label:`Frame title`,placeholder:`intake`,maxLength:e.title,confirmLabel:`Add frame`,onSubmit:async e=>{let n=await Un([{op:`add`,element:{kind:`frame`,id:b(`frame`),title:e,contains:t}}]);return n||G?.clearSelection(),n}})}function rr(){let e=Vn();if(!e)return;let t=e.connectedSessionIds.map(Wn),n=t.length>0?` ${t.join(`, `)} ${t.length===1?`is`:`are`} connected and will lose it.`:``;a({title:`Delete board`,message:`Delete "${e.title}" for good?${n}`,confirmLabel:`Delete board`,danger:!0,onConfirm:()=>{y(e.id).then(e=>{e.ok||q.show(`error`,e.error)})}})}function ir(){Y({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await f(e);return t.ok?(Q(t.boardId),null):t.error}})}function $(e,n,r=``){let i=t(`button`,`wb-button ${r}`.trim(),e);return i.type=`button`,i.addEventListener(`click`,n),i}function ar(e){let n=t(`div`,`wb-top`),r=t(`div`,`wb-board-list`);r.setAttribute(`aria-label`,`Boards`);let i=t(`div`,`wb-board-head`),a=t(`div`,`wb-title-row`),o=t(`span`,`wb-board-meta`),s=t(`div`,`wb-presence`);a.append(o,s);let c=t(`div`,`wb-toolbar`),l={box:$(`box`,Qn),wire:$(`wire`,tr),note:$(`note`,()=>{let[e]=Z(`box`);e&&er(e.id)}),frame:$(`frame`,nr),unit:$(`unit`,$n),fit:$(`fit`,()=>G?.fit()),remove:$(`delete board`,rr,`wb-button-danger`)};l.fit.dataset.phoneVisible=``,c.append(l.box,l.wire,l.note,l.frame,l.unit,l.fit,l.remove,q.element),i.append(a,c),n.append(r,$(`new board`,ir),i);let u=t(`div`,`wb-canvas`),d=document.createElementNS(Ln,`svg`);d.setAttribute(`class`,`wb-svg`),d.setAttribute(`role`,`img`),d.setAttribute(`aria-label`,`Whiteboard`),d.setAttribute(`preserveAspectRatio`,`xMidYMin meet`),u.append(d);let f=t(`p`,`wb-empty`,Rn),m=t(`div`,`wb-dock`);m.hidden=!0;let h=t(`span`,`wb-dock-queued`),g=$(`send to agent`,()=>void Xn()),v=t(`div`,`wb-dock-bar`);v.append(h,g,J.element),m.append(v),e.replaceChildren(n,u,f,m),U={list:r,boardHead:i,boardMeta:o,presence:s,toolbar:c,canvas:u,empty:f,dock:m,dockQueued:h,sendToAgent:g,buttons:l};let y=In(d);W=y,G=ce({svg:d,canvas:u,renderer:y,currentBoard:X,sendOps:Hn,onSelectionChange:Gn,onPhoneTapBox:er,onOpenLinkedBoard:Q}),p(Kn),_(e=>{e===H&&Zn()}),Kn()}function or(){return document.documentElement.dataset.layout===`phone`}function sr(){K&&u()===K&&ee(),K=null,U&&(U.dock.hidden=!0)}function cr(e){if(!U||or())return;let t=r(e);t&&(K=e,U.dock.hidden=!1,J.clear(),Yn(),te(t,e,U.dock,{className:`wb-docked-card`}),c(t,e,!0))}function lr(){let e=d();e&&(Q(e.boardId),e.dockSessionId&&cr(e.dockSessionId)),Kn(),H&&l(H).then(Zn)}var ur={mount:ar,refresh:lr,deactivate:sr};export{ur as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ht as e}from"./updates-view-core-
|
|
1
|
+
import{ht as e}from"./updates-view-core-Qkm1ZY4B.js";import{D as t}from"./dom-helpers-DBbFg1c_.js";var n=new Map(Object.entries({WAITING:`now`,COMPLETE:`later`,FAILED:`resting`,IDLE:`resting`,RUNNING:`resting`,STARTING:`resting`,INITIALIZING:`resting`,DORMANT:`resting`,DONE:`resting`}));function r(e){return(typeof e.state==`string`?n.get(e.state):void 0)??`resting`}function i(e,n){return[...e].map(([e,r])=>{let i=r.currentState||t.DORMANT;return{id:e,ui:r,name:n(r),isDormant:i===t.DORMANT,state:i,unseenOutcome:r.unseenOutcome??null,ownerId:r.ownerId??null}})}function a(e){let t=new Set(e.map(({id:e})=>e)),n=e=>e.ownerId&&t.has(e.ownerId)?e.ownerId:null,r=new Map;for(let t of e){let e=n(t);e&&r.set(e,[...r.get(e)??[],t])}return e.flatMap(e=>n(e)?[]:[e,...r.get(e.id)??[]])}function o(e){return a([...e].sort((e,t)=>Number(e.isDormant===!0)-Number(t.isDormant===!0)))}function s({ownerName:e,ownedCount:t}){return e===null?t===1?`Owns 1 session`:t>1?`Owns ${t} sessions`:null:`Owned by ${e}`}function c(e,t,n){if(!e.length)return null;let r=n<0?-1:1,i=t==null?-1:e.indexOf(t);return e[((i===-1?r===1?-1:0:i)+r+e.length)%e.length]}function l({state:n,unseenOutcome:r}){if(n===t.WAITING)return`waiting`;let i=e.safeParse(r);return i.success?i.data:null}function u(e={}){return l(e)!==null}var d=new Map([[`failed`,0],[`waiting`,1],[`finished`,2]]);function f(e){let t=l(e);return t===null?void 0:d.get(t)}function p(e){return e.filter(e=>f(e)!==void 0).sort((e,t)=>(f(e)??0)-(f(t)??0)).map(({id:e})=>e)}function m(e,t){let n=new Map(e.map(e=>[e.id,e]));return p(e).flatMap(e=>{let r=n.get(e),i=r?l(r):null;return!r||i===null||e===t?[]:[{id:e,kind:i,name:r.name??``}]})}var h={headTile:32,tile:26,tileGap:4,overflowSlot:40};function g(e,t){if(t===0)return 0;let{headTile:n,tile:r,tileGap:i,overflowSlot:a}=h,o=r+i;if(n+(t-1)*o<=e)return t;let s=e-a-i-n,c=Math.floor(s/o);return Math.max(1,Math.min(t-1,1+c))}var _={waiting:`waitingCount`,failed:`failedCount`,finished:`finishedCount`};function v(e,t,n){let r=l(t||{});r!==null&&(e[_[r]]+=n)}function y(e){let t={waitingCount:0,finishedCount:0,failedCount:0};for(let n of e||[])v(t,n,1);return t}function b(){return{counts:{waitingCount:0,finishedCount:0,failedCount:0},ownedCountByOwnerId:new Map}}function x(e,t,n){if(v(e.counts,t,n),t.ownerId===null)return;let r=(e.ownedCountByOwnerId.get(t.ownerId)??0)+n;r>0?e.ownedCountByOwnerId.set(t.ownerId,r):e.ownedCountByOwnerId.delete(t.ownerId)}function S(e,t){x(e,t,1)}function C(e,t){x(e,t,-1)}function w({waitingCount:e,finishedCount:t,failedCount:n}){return e+n+t}function T({waitingCount:e,failedCount:t}){return e+t}function E({waitingCount:e,finishedCount:t,failedCount:n}){let r=[];return n>0&&r.push(`${n} FAILED`),e===1&&r.push(`1 NEEDS YOU`),e>1&&r.push(`${e} NEED YOU`),t>0&&r.push(`${t} FINISHED`),r.length===0?`ALL CLEAR`:r.join(`, `)}var D=new Map([[`hand`,2]]),O=1;function k(e){return e?typeof e==`string`&&D.get(e)||O:0}function A(e){let t=!1,n=0;for(let r of e||[]){let e=k(r);e<=n||(t=typeof r!=`string`||r,n=e)}return t}var j=new Map,M=b();function N(e){return e.card?.dataset.session||e.nameEl?.textContent||``}function P(e){return typeof e==`string`?e:String(e)}function F(e){return typeof e==`string`?j.get(e):void 0}var I=document.getElementById(`sessions-container`);export{T as S,c as _,N as a,S as b,E as c,s as d,g as f,o as g,m as h,P as i,i as l,u as m,I as n,j as o,w as p,F as r,h as s,M as t,y as u,A as v,C as x,r as y};
|
|
Binary file
|