glimmervoid 0.48.4-next.373 → 0.48.4-next.374
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-BIr4xVth.js +1 -0
- package/dist/chunks/{config-store-pdqPJdAR.js → config-store-OdyfXb2W.js} +1 -1
- package/dist/chunks/{main-d_CqXlK6.js → main-BTgxpzRg.js} +58 -23
- package/dist/chunks/{pair-cli-BrBfDhjN.js → pair-cli-BGbjIhc8.js} +2 -2
- package/dist/chunks/{pairings-store-Ct1E_XlV.js → pairings-store-BzA3p9oE.js} +1 -1
- package/dist/chunks/{settings-cli-Czo7o7Ug.js → settings-cli-B_Fl0uRl.js} +2 -2
- package/dist/chunks/{settings-readout-core-B8wF5y4U.js → settings-readout-core-Cc5zwF6w.js} +1 -1
- package/dist/chunks/{why-cli-COxYCd2L.js → why-cli-C_AHDxKT.js} +1 -1
- package/dist/client/assets/{benchmark-panel-AmMEjD1b.js → benchmark-panel-C-OXJRrA.js} +1 -1
- package/dist/client/assets/benchmark-panel-C-OXJRrA.js.br +0 -0
- package/dist/client/assets/{boards-view-DAAsUKaw.js → boards-view-BeEaY6C9.js} +1 -1
- package/dist/client/assets/boards-view-BeEaY6C9.js.br +0 -0
- package/dist/client/assets/{community-panel-CkufayQK.js → community-panel-D4AA_Zns.js} +1 -1
- package/dist/client/assets/community-panel-D4AA_Zns.js.br +0 -0
- package/dist/client/assets/{dialogs-DpxOsGP1.js → dialogs-CkneZ7uI.js} +1 -1
- package/dist/client/assets/dialogs-CkneZ7uI.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-FqDJj73l.js → doc-editor-ui-DWxRm4O0.js} +1 -1
- package/dist/client/assets/doc-editor-ui-DWxRm4O0.js.br +0 -0
- package/dist/client/assets/{feature-hint-pJBase4y.js → feature-hint-DQ0b_hs0.js} +1 -1
- package/dist/client/assets/feature-hint-DQ0b_hs0.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-DTp3PoZv.js → first-run-checklist-BX6xdYS_.js} +1 -1
- package/dist/client/assets/first-run-checklist-BX6xdYS_.js.br +0 -0
- package/dist/client/assets/{hooks-panel-Dw4YimGb.js → hooks-panel-C12PxpSE.js} +1 -1
- package/dist/client/assets/hooks-panel-C12PxpSE.js.br +0 -0
- package/dist/client/assets/{index-D7sz1zHA.js → index-CUbWeDtv.js} +5 -5
- package/dist/client/assets/index-CUbWeDtv.js.br +0 -0
- package/dist/client/assets/{issues-panel-DHWKO6XU.js → issues-panel-BvjKIXB5.js} +1 -1
- package/dist/client/assets/issues-panel-BvjKIXB5.js.br +0 -0
- package/dist/client/assets/{my-prs-panel-CBMaU5uX.js → my-prs-panel-CUeDb48b.js} +1 -1
- package/dist/client/assets/my-prs-panel-CUeDb48b.js.br +0 -0
- package/dist/client/assets/{nyan-cat-DamlQsH-.js → nyan-cat-B9bWjC-E.js} +1 -1
- package/dist/client/assets/nyan-cat-B9bWjC-E.js.br +0 -0
- package/dist/client/assets/{phone-shell-DS9hjnbB.js → phone-shell-D3ufCox8.js} +1 -1
- package/dist/client/assets/phone-shell-D3ufCox8.js.br +0 -0
- package/dist/client/assets/{plan-face-3aTxOg6J.js → plan-face-mS3l9wy_.js} +1 -1
- package/dist/client/assets/plan-face-mS3l9wy_.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-jhU6XB4c.js → pr-queue-columns-BcEC1DsD.js} +1 -1
- package/dist/client/assets/pr-queue-columns-BcEC1DsD.js.br +0 -0
- package/dist/client/assets/{radar-panel-BwOaOuUh.js → radar-panel-B9KgQdIN.js} +1 -1
- package/dist/client/assets/radar-panel-B9KgQdIN.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-BhzR3bNR.js → repo-roots-adder-CYO3qVCJ.js} +1 -1
- package/dist/client/assets/repo-roots-adder-CYO3qVCJ.js.br +0 -0
- package/dist/client/assets/{resume-dialog-BZMXTLQF.js → resume-dialog-CEjf4G4s.js} +1 -1
- package/dist/client/assets/resume-dialog-CEjf4G4s.js.br +0 -0
- package/dist/client/assets/{review-queue-panel-BWtXSwQ5.js → review-queue-panel-CJ1TXCwt.js} +1 -1
- package/dist/client/assets/review-queue-panel-CJ1TXCwt.js.br +0 -0
- package/dist/client/assets/{settings-panel-BGM8iJJl.js → settings-panel-Bk33t3uI.js} +2 -2
- package/dist/client/assets/settings-panel-Bk33t3uI.js.br +0 -0
- package/dist/client/assets/{shown-lightbox-DaFVrJho.js → shown-lightbox-CRgREiGD.js} +1 -1
- package/dist/client/assets/shown-lightbox-CRgREiGD.js.br +0 -0
- package/dist/client/assets/{team-review-panel-BRZtQ0UZ.js → team-review-panel-BQX8iKpi.js} +1 -1
- package/dist/client/assets/team-review-panel-BQX8iKpi.js.br +0 -0
- package/dist/client/assets/{trace-panel-BYKbDkOJ.js → trace-panel-B_1sI5bQ.js} +1 -1
- package/dist/client/assets/trace-panel-B_1sI5bQ.js.br +0 -0
- package/dist/client/assets/{usage-panel-D6fPP2UH.js → usage-panel-CwTzRXC-.js} +1 -1
- package/dist/client/assets/usage-panel-CwTzRXC-.js.br +0 -0
- package/dist/client/assets/{your-day-tip-CMVOMR1M.js → your-day-tip-xiaEIrmf.js} +1 -1
- package/dist/client/assets/your-day-tip-xiaEIrmf.js.br +4 -0
- package/dist/client/index.html +1 -1
- 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-B4vUTgoX.js +0 -1
- package/dist/client/assets/benchmark-panel-AmMEjD1b.js.br +0 -0
- package/dist/client/assets/boards-view-DAAsUKaw.js.br +0 -0
- package/dist/client/assets/community-panel-CkufayQK.js.br +0 -0
- package/dist/client/assets/dialogs-DpxOsGP1.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-FqDJj73l.js.br +0 -0
- package/dist/client/assets/feature-hint-pJBase4y.js.br +0 -0
- package/dist/client/assets/first-run-checklist-DTp3PoZv.js.br +0 -0
- package/dist/client/assets/hooks-panel-Dw4YimGb.js.br +0 -0
- package/dist/client/assets/index-D7sz1zHA.js.br +0 -0
- package/dist/client/assets/issues-panel-DHWKO6XU.js.br +0 -0
- package/dist/client/assets/my-prs-panel-CBMaU5uX.js.br +0 -0
- package/dist/client/assets/nyan-cat-DamlQsH-.js.br +0 -0
- package/dist/client/assets/phone-shell-DS9hjnbB.js.br +0 -0
- package/dist/client/assets/plan-face-3aTxOg6J.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-jhU6XB4c.js.br +0 -0
- package/dist/client/assets/radar-panel-BwOaOuUh.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-BhzR3bNR.js.br +0 -0
- package/dist/client/assets/resume-dialog-BZMXTLQF.js.br +0 -0
- package/dist/client/assets/review-queue-panel-BWtXSwQ5.js.br +0 -0
- package/dist/client/assets/settings-panel-BGM8iJJl.js.br +0 -0
- package/dist/client/assets/shown-lightbox-DaFVrJho.js.br +0 -0
- package/dist/client/assets/team-review-panel-BRZtQ0UZ.js.br +0 -0
- package/dist/client/assets/trace-panel-BYKbDkOJ.js.br +0 -0
- package/dist/client/assets/usage-panel-D6fPP2UH.js.br +0 -0
- package/dist/client/assets/your-day-tip-CMVOMR1M.js.br +0 -6
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-BGbjIhc8.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-B_Fl0uRl.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-C_AHDxKT.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-BIr4xVth.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-OdyfXb2W.js";
|
|
@@ -2076,7 +2076,7 @@ var FILE_ONLY_SETTINGS = Object.freeze([
|
|
|
2076
2076
|
path: "worktreeCloneDependencies",
|
|
2077
2077
|
title: "Worktree dependency clone",
|
|
2078
2078
|
group: "machine-detection-sessions",
|
|
2079
|
-
description: "On macOS, clone the main checkout's node_modules into a
|
|
2079
|
+
description: "On macOS, clone the main checkout's node_modules into a session worktree that starts without one, when it matches the worktree's lockfile.",
|
|
2080
2080
|
control: "toggle",
|
|
2081
2081
|
keywords: [
|
|
2082
2082
|
"node_modules",
|
|
@@ -18,15 +18,15 @@ import { r as knownWriteHookInput } from "./posthog-read-gate-core-CeSY56AB.js";
|
|
|
18
18
|
import { a as readPageTitle, c as layoutBoard, d as unitsOf, i as filesAfterRetention, l as findDependencyCycle, n as decideShownKind, o as shownMimeForFilename, r as describeOverCap, s as escapeMarkup, t as SHOWN_SNIFF_BYTES } from "./shown-files-core-nS3KPkN_.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-OdyfXb2W.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-K92w1xip.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-DIW_DqzO.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-BzA3p9oE.js";
|
|
29
|
+
import { n as configFileViewOf, u as readSettingsForAgent } from "./settings-readout-core-Cc5zwF6w.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-T8B0plD9.js";
|
|
32
32
|
import { createRequire } from "node:module";
|
|
@@ -15834,6 +15834,14 @@ var LOCKFILE_BY_KIND = {
|
|
|
15834
15834
|
installState: path.join("node_modules", ".pnpm", "lock.yaml")
|
|
15835
15835
|
}
|
|
15836
15836
|
};
|
|
15837
|
+
var KNOWN_LOCKFILES = [
|
|
15838
|
+
"package-lock.json",
|
|
15839
|
+
"npm-shrinkwrap.json",
|
|
15840
|
+
"pnpm-lock.yaml",
|
|
15841
|
+
"yarn.lock",
|
|
15842
|
+
"bun.lock",
|
|
15843
|
+
"bun.lockb"
|
|
15844
|
+
];
|
|
15837
15845
|
var CLONED_CACHE_DIRS = [
|
|
15838
15846
|
".cache",
|
|
15839
15847
|
".vite",
|
|
@@ -15843,7 +15851,7 @@ var NOTIFYING_REASONS = /* @__PURE__ */ new Set([
|
|
|
15843
15851
|
"not-apfs",
|
|
15844
15852
|
"other-volume",
|
|
15845
15853
|
"install-stale",
|
|
15846
|
-
"
|
|
15854
|
+
"outside-link",
|
|
15847
15855
|
"torn",
|
|
15848
15856
|
"failed"
|
|
15849
15857
|
]);
|
|
@@ -15863,13 +15871,13 @@ function planDependencyClone(facts) {
|
|
|
15863
15871
|
if (!isInstallCurrent(facts.lock)) return skipDependencyClone("install-stale");
|
|
15864
15872
|
const dirs = ["."];
|
|
15865
15873
|
const staleDirs = [];
|
|
15866
|
-
for (const
|
|
15867
|
-
if (dir === ".") continue;
|
|
15868
|
-
if (
|
|
15869
|
-
staleDirs.push(dir);
|
|
15874
|
+
for (const nestedDir of facts.nestedPackageDirs) {
|
|
15875
|
+
if (nestedDir.dir === ".") continue;
|
|
15876
|
+
if (!isNestedInstallCurrent(nestedDir)) {
|
|
15877
|
+
staleDirs.push(nestedDir.dir);
|
|
15870
15878
|
continue;
|
|
15871
15879
|
}
|
|
15872
|
-
dirs.push(dir);
|
|
15880
|
+
dirs.push(nestedDir.dir);
|
|
15873
15881
|
}
|
|
15874
15882
|
return {
|
|
15875
15883
|
action: "clone",
|
|
@@ -15877,6 +15885,15 @@ function planDependencyClone(facts) {
|
|
|
15877
15885
|
staleDirs
|
|
15878
15886
|
};
|
|
15879
15887
|
}
|
|
15888
|
+
function isNestedInstallCurrent({ ownLock, hasAnyLockfile }) {
|
|
15889
|
+
if (ownLock) return isInstallCurrent(ownLock);
|
|
15890
|
+
return !hasAnyLockfile;
|
|
15891
|
+
}
|
|
15892
|
+
function isLinkInsideCheckout(linkPathInCheckout, linkTarget) {
|
|
15893
|
+
if (path.isAbsolute(linkTarget)) return false;
|
|
15894
|
+
const resolvedTarget = path.join(path.dirname(linkPathInCheckout), linkTarget);
|
|
15895
|
+
return resolvedTarget !== ".." && !resolvedTarget.startsWith(`..${path.sep}`) && !path.isAbsolute(resolvedTarget);
|
|
15896
|
+
}
|
|
15880
15897
|
function isInstallCurrent(lock) {
|
|
15881
15898
|
if (lock.mainStateText === null) return false;
|
|
15882
15899
|
return installSatisfiesLockfile(lock.kind, lock.worktreeLockText, lock.mainStateText);
|
|
@@ -15945,7 +15962,7 @@ var SKIP_DESCRIPTIONS = {
|
|
|
15945
15962
|
"not-apfs": "the main checkout is not on APFS, so node_modules was not cloned; install dependencies in the worktree",
|
|
15946
15963
|
"other-volume": "the main checkout and the worktree are on different volumes, so node_modules was not cloned; install dependencies in the worktree",
|
|
15947
15964
|
"install-stale": "the main checkout's node_modules does not match the worktree's lockfile, so it was not cloned; install dependencies in the worktree",
|
|
15948
|
-
"
|
|
15965
|
+
"outside-link": "the main checkout's node_modules holds a link outside the repository (npm link or a file: dependency), so it was not cloned; install dependencies in the worktree",
|
|
15949
15966
|
torn: "the main checkout's node_modules changed during the clone, so the clone was discarded; install dependencies in the worktree",
|
|
15950
15967
|
failed: "cloning node_modules from the main checkout failed; install dependencies in the worktree"
|
|
15951
15968
|
};
|
|
@@ -50101,6 +50118,7 @@ function createRecorder(sessionName, captureConfig, recordSignals = true) {
|
|
|
50101
50118
|
//#region server/git/dependency-clone.ts
|
|
50102
50119
|
var CLONE_TIMEOUT_MS = 6e5;
|
|
50103
50120
|
var NODE_MODULES = "node_modules";
|
|
50121
|
+
var LINK_LIST_MAX_BYTES = 67108864;
|
|
50104
50122
|
var cloneQueue = createSerialQueue();
|
|
50105
50123
|
var seedWorktreeDependencies = ({ mainCheckout, worktreeDir }) => cloneQueue.run(() => cloneDependencies(mainCheckout, worktreeDir).catch(() => skipDependencyClone("failed")));
|
|
50106
50124
|
async function cloneDependencies(mainCheckout, worktreeDir) {
|
|
@@ -50160,7 +50178,7 @@ async function cloneDependencies(mainCheckout, worktreeDir) {
|
|
|
50160
50178
|
};
|
|
50161
50179
|
}
|
|
50162
50180
|
async function stageAll(stagedDirs, markerPath) {
|
|
50163
|
-
for (const { sourcePath, stagingPath } of stagedDirs) {
|
|
50181
|
+
for (const { relativeDir, sourcePath, stagingPath } of stagedDirs) {
|
|
50164
50182
|
await removeTree(stagingPath);
|
|
50165
50183
|
if (!(await runCommand("cp", [
|
|
50166
50184
|
"-Rc",
|
|
@@ -50168,17 +50186,8 @@ async function stageAll(stagedDirs, markerPath) {
|
|
|
50168
50186
|
stagingPath
|
|
50169
50187
|
], { timeoutMs: CLONE_TIMEOUT_MS })).ok) return "failed";
|
|
50170
50188
|
for (const cacheDir of CLONED_CACHE_DIRS) await removeTree(path.join(stagingPath, cacheDir));
|
|
50171
|
-
const
|
|
50172
|
-
|
|
50173
|
-
"-type",
|
|
50174
|
-
"l",
|
|
50175
|
-
"-lname",
|
|
50176
|
-
"/*",
|
|
50177
|
-
"-print",
|
|
50178
|
-
"-quit"
|
|
50179
|
-
], { timeoutMs: CLONE_TIMEOUT_MS });
|
|
50180
|
-
if (!absoluteLinks.ok) return "failed";
|
|
50181
|
-
if (absoluteLinks.out) return "absolute-link";
|
|
50189
|
+
const linkCheck = await findLinkOutsideCheckout(relativeDir, stagingPath);
|
|
50190
|
+
if (linkCheck) return linkCheck;
|
|
50182
50191
|
}
|
|
50183
50192
|
for (const { sourcePath } of stagedDirs) {
|
|
50184
50193
|
const changedDuringClone = await runCommand("find", [
|
|
@@ -50193,6 +50202,25 @@ async function stageAll(stagedDirs, markerPath) {
|
|
|
50193
50202
|
}
|
|
50194
50203
|
return null;
|
|
50195
50204
|
}
|
|
50205
|
+
async function findLinkOutsideCheckout(relativeDir, stagingPath) {
|
|
50206
|
+
const links = await runCommand("find", [
|
|
50207
|
+
stagingPath,
|
|
50208
|
+
"-type",
|
|
50209
|
+
"l",
|
|
50210
|
+
"-print0"
|
|
50211
|
+
], {
|
|
50212
|
+
timeoutMs: CLONE_TIMEOUT_MS,
|
|
50213
|
+
maxBuffer: LINK_LIST_MAX_BYTES,
|
|
50214
|
+
trim: false
|
|
50215
|
+
});
|
|
50216
|
+
if (!links.ok) return "failed";
|
|
50217
|
+
for (const linkPath of links.out.split("\0").filter(Boolean)) {
|
|
50218
|
+
const linkTarget = await fs$1.readlink(linkPath).catch(() => null);
|
|
50219
|
+
if (linkTarget === null) return "failed";
|
|
50220
|
+
if (!isLinkInsideCheckout(path.join(relativeDir, NODE_MODULES, path.relative(stagingPath, linkPath)), linkTarget)) return "outside-link";
|
|
50221
|
+
}
|
|
50222
|
+
return null;
|
|
50223
|
+
}
|
|
50196
50224
|
async function readLock(mainDir, worktreeDir) {
|
|
50197
50225
|
for (const kind of ["npm", "pnpm"]) {
|
|
50198
50226
|
const worktreeLockText = await readTextOrNull(path.join(worktreeDir, LOCKFILE_BY_KIND[kind].lockfile));
|
|
@@ -50222,13 +50250,20 @@ async function listNestedPackageDirs(mainCheckout, worktreeDir) {
|
|
|
50222
50250
|
if (relativeDir === ".") continue;
|
|
50223
50251
|
if (await pathExists(path.join(worktreeDir, relativeDir, NODE_MODULES))) continue;
|
|
50224
50252
|
if (!await pathExists(path.join(mainCheckout, relativeDir, NODE_MODULES))) continue;
|
|
50253
|
+
const mainPackageDir = path.join(mainCheckout, relativeDir);
|
|
50254
|
+
const worktreePackageDir = path.join(worktreeDir, relativeDir);
|
|
50225
50255
|
nestedDirs.push({
|
|
50226
50256
|
dir: relativeDir,
|
|
50227
|
-
ownLock: await readLock(
|
|
50257
|
+
ownLock: await readLock(mainPackageDir, worktreePackageDir),
|
|
50258
|
+
hasAnyLockfile: await hasAnyLockfile([mainPackageDir, worktreePackageDir])
|
|
50228
50259
|
});
|
|
50229
50260
|
}
|
|
50230
50261
|
return nestedDirs;
|
|
50231
50262
|
}
|
|
50263
|
+
async function hasAnyLockfile(packageDirs) {
|
|
50264
|
+
for (const packageDir of packageDirs) for (const lockfile of KNOWN_LOCKFILES) if (await pathExists(path.join(packageDir, lockfile))) return true;
|
|
50265
|
+
return false;
|
|
50266
|
+
}
|
|
50232
50267
|
async function discardStaged(stagedDirs) {
|
|
50233
50268
|
for (const { stagingPath } of stagedDirs) await removeTree(stagingPath);
|
|
50234
50269
|
}
|
|
@@ -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-OdyfXb2W.js";
|
|
3
|
+
import { a as defaultPairingsPath, i as createSeenStore, o as defaultSeenPath, r as createPairingsStore, t as REVOCATION_PROPAGATION_SECONDS } from "./pairings-store-BzA3p9oE.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-OdyfXb2W.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-Dbjq0LnF.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-OdyfXb2W.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-Cc5zwF6w.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-OdyfXb2W.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-BzA3p9oE.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-T8B0plD9.js";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-CUbWeDtv.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-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{t as s}from"./escape-markup-CKuHtFmo.js";import{$r as c,Qr as l,Sn as u,Zr as d,_i as f,ai as p,ei as m,ii as h,ni as g,oi as _,ri as v,si as y,ti as ee,vi as te,yi as ne}from"./index-D7sz1zHA.js";var re=4,ie=200,ae=2e4,oe=1.1,se=[`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 ce(e){return e instanceof SVGCircleElement&&e.classList.contains(`wb-port`)?e:null}function le(e){return e instanceof Element?e.closest(`[data-linked-board-id]`)?.dataset.linkedBoardId??null:null}function ue(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,u=null;function d(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function f(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},d();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},d()}function p(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 m(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function h(e,t){let n=Math.min(ae,Math.max(ie,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},d()}function g(e,t){let n=m();s={...s,x:s.x-e*n,y:s.y-t*n},d()}function _(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function v(e,t){if(!t){_(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),_(n)}function y(e){return{x:Math.round(e.start.x+e.latest.x-e.origin.x),y:Math.round(e.start.y+e.latest.y-e.origin.y-e.pinnedOffsetY)}}function ee(e,t,n){let r=e.elements[t];return r?.kind===`box`?{...e,elements:{...e.elements,[t]:{...r,at:n}}}:e}function te(e){return c?.kind!==`drag`||!c.hasMoved?e:ee(e,c.boxId,y(c))}function ne(){u!==null&&cancelAnimationFrame(u),u=null}function b(){ne();let t=e.currentBoard();t&&i.render(te(t))}function ue(){u===null&&(u=requestAnimationFrame(b))}function S(e){c?.kind===`drag`&&e?.elements[c.boxId]?.kind!==`box`&&(c=null);let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&_(t)}function de(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function C(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function w(){c?.kind===`wire`&&T(c,!1),c={kind:`pinch`,distance:C(),viewWidth:s.width}}function fe(t){if(t.button!==0||l)return;let r=le(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){w();return}let o=i.elementFromTarget(t.target),s=ce(t.target);if(o?.kind===`box`&&s&&!x()){pe(t.pointerId,o.id,s);return}let u=o?.kind===`box`&&!x()?de(o.id):null;if(o&&u){let e=p(t.clientX,t.clientY),n=i.layout()?.pinnedOffsetY??0;c={kind:`drag`,pointerId:t.pointerId,boxId:o.id,origin:e,start:u,pinnedOffsetY:n,latest:e,hasMoved:!1,isAdditive:t.shiftKey};return}if(o&&!x()){v(o.id,t.shiftKey);return}let d=o?.kind===`box`?o.id:null;c={kind:`pan`,pointerId:t.pointerId,lastClient:{x:t.clientX,y:t.clientY},hasMoved:!1,tappedBoxId:d}}function pe(e,t,r){let i={x:r.cx.baseVal.value,y:r.cy.baseVal.value},a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);a.setAttribute(`class`,`wb-wire-line wb-dashed wb-wire-draft`),a.setAttribute(`d`,`M ${i.x} ${i.y} L ${i.x} ${i.y}`),n.append(a),c={kind:`wire`,pointerId:e,fromBoxId:t,start:i,draftLine:a,targetBoxId:null}}function me(e,t){e.targetBoxId&&i.nodeOf(e.targetBoxId)?.classList.remove(`is-wire-target`),e.targetBoxId=t,t&&i.nodeOf(t)?.classList.add(`is-wire-target`)}function he(e,t){let n=p(t.clientX,t.clientY);e.draftLine.setAttribute(`d`,`M ${e.start.x} ${e.start.y} L ${n.x} ${n.y}`);let r=i.elementFromTarget(document.elementFromPoint(t.clientX,t.clientY));me(e,r?.kind===`box`&&r.id!==e.fromBoxId?r.id:null)}function T(t,n){let r=t.targetBoxId;me(t,null),t.draftLine.remove(),n&&r&&e.onConnectBoxes(t.fromBoxId,r)}function E(e,t){let n=p(t.clientX,t.clientY);!e.hasMoved&&Math.hypot(n.x-e.origin.x,n.y-e.origin.y)<re*m()||(e.hasMoved=!0,e.latest=n,ue())}function ge(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<re||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},g(n,r))}function _e(e){let t=C();if(t<=0||e.distance<=0)return;let n=[...a.values()];h(p(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 ve(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?_e(c):c?.kind===`drag`&&c.pointerId===e.pointerId?E(c,e):c?.kind===`wire`&&c.pointerId===e.pointerId?he(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&ge(c,e))}async function ye(t,n){if(!t.hasMoved){v(t.boxId,t.isAdditive);return}ne(),t.latest=p(n.clientX,n.clientY);let r=y(t),a=e.currentBoard();a&&i.render(ee(a,t.boxId,r)),await e.sendOps([{op:`set`,id:t.boxId,fields:{at:r}}])||b()}function be(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?ye(n,t):n?.kind===`wire`?T(n,n.pointerId===t.pointerId):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&x()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||_(new Set)))}function xe(e){a.delete(e.pointerId);let t=c?.kind===`drag`;c?.kind===`wire`&&T(c,!1),c=null,t&&b()}function Se(e){e.preventDefault(),e.ctrlKey||e.metaKey?h(p(e.clientX,e.clientY),e.deltaY>0?oe:1/oe):g(-e.deltaX,-e.deltaY)}function D(){let e=l;l=null,e?.remove()}function Ce(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;D();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(),D(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();D(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,D),d.focus(),d.select()}function we(e){if(x())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&Ce(t.id)}function Te(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=se.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));_(new Set),e.sendOps(r)}function Ee(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),Te()):e.key===`Escape`&&_(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,fe),n.addEventListener(`pointermove`,ve),n.addEventListener(`pointerup`,be),n.addEventListener(`pointercancel`,xe),n.addEventListener(`wheel`,Se,{passive:!1}),n.addEventListener(`dblclick`,we),n.addEventListener(`keydown`,Ee),{fit:f,selectedIds:()=>o,clearSelection:()=>_(new Set),pruneSelection:S,previewOf:te,closeTitleInput:D}}var S=40,de=44,C=220,w=90,fe=30,pe=20,me=18,he=20,T=26,E=18,ge=26,_e=170,ve=21,ye=17,be=10,xe=22,Se=24,D=16,Ce=16,we=26,Te=24,Ee=8,De=10,Oe=14,ke=4,Ae=14,je=8,O=6,Me=4,Ne=6,Pe=12,Fe=10,Ie=6.6,k=5,A=10,Le=2,Re=100,ze=120,Be=4,Ve=40,He=[.5,.35,.65,.2,.8],Ue=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 We(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:Ue[n.color]}:null}function Ge(e,t){let n=j(t.title,he),r=t.lines.flatMap(e=>j(e.text,T-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=We(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*pe+r.length*me+(i?26:0)}}function M(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function Ke(e){let t=j(e.text,ve);return{lines:t,height:24+(t.length+1)*ye}}function qe(e){let t=new Map;for(let n of M(e,`note`)){let e=t.get(n.on),r=Ke(n).height;t.set(n.on,e===void 0?r:e+be+r)}return t}function Je(e){return e.columns.map(e=>e.title?j(e.title,Se):[])}function Ye(e){return(Math.max(1,...e.map(e=>e.length))-1)*D}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 Xe(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=>De+(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 Ze(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)*Oe:0,s=a>0?e.left+e.right+a+20:0;return Math.max(e.minimumWidth,o,s)})}function Qe(e,t){let n=[],r=S;for(let[i]of e.columns.entries())n.push(r),r+=C+(t[i]??w);return n}function $e(e,t,n){return e.map((e,r)=>{let i=n[r]??{left:De,right:De,minimumWidth:w},a=e+C+(t[r]??w);return{left:e+C+i.left,right:a-i.right}})}function et(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 tt(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 nt(e,t){return e===t?0:(e?E:0)+(t?44:0)}function rt(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=tt(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=Ge(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+nt(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)-Ee;a.set(l.column,f+Math.max(u.height,e)+fe),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 it(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 at(e,t){return M(e,`frame`).flatMap(e=>{let n=it(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-ge,width:n.width+36,height:n.height+36+ge}]:[]})}function ot(e){return e===`left`||e===`right`}function P(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function st(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 ct(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&&!st(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 lt(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}`,...ct(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 ut(e,t,n){let r=Array.from({length:n},(e,t)=>t);if(ot(t)){let i=t===`left`?e.x:e.x+e.width,a=Math.min(Ae,(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+je,Math.min(o,e.y+e.height-je-(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)*Ae/2;return r.map(e=>({x:Math.round(a+e*Ae),y:i}))}function dt(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 ft(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+(ot(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 pt(e,t){for(let[n,r]of e){let e=r[0],i=t.get(n)??[];if(!e)continue;let a=ut(e.box,e.side,i.length);for(let e of r){let t=a[i.indexOf(e.groupKey)];t&&e.assign(t)}}}function mt(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 ht(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 gt(e,t){return!t.some(t=>e>t.y-O&&e<t.y+t.height+O)}function _t(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<Me?[]:[{top:r.bottom,bottom:e.top}]})}function vt(e,t){return e.left<t.right&&t.left<e.right}function yt(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 bt(e,t){let n=[],r=[];for(let i of e){if(i.shape!==`long`)continue;let e=mt(i,t.gaps),a=ht(i,e,t),o=[i.start.y,i.end.y].find(e=>gt(e,a));if(o!==void 0){i.crossingY=o;continue}let s=(i.start.y+i.end.y)/2,c=_t(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=yt(t,(e,t)=>vt(e.span,t.span)),i=t[0]?.interval??{top:0,bottom:0},a=i.bottom-i.top,o=Math.max(1,Math.floor(a/Ne)-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=yt(a,(e,t)=>vt(e.span,t.span)).map(e=>a.length-1-e);return a.forEach(({plan:e},n)=>{e.crossingY=t.topBandBottom-(o[n]??0)*Pe}),r.length>0?Math.max(...o)+1:0}function xt(e,t){return t<=e?`left`:`right`}function St(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 Ct(e){return e.busKey?`bus|${e.busKey}`:`wire|${e.wire.id}|target`}function wt(e,t){let n=new Map,r=(e,t)=>{let r=n.get(e);if(r)return r;let i=St(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(Ct(n),n.targetGap);if(n.shape===`channel`&&F(s,xt(n.targetGap,e),n.start.y),n.shape===`long`){let t=r(`wire|${n.wire.id}|source`,n.sourceGap);F(t,xt(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,xt(n.targetGap,a),n.end.y))}return n}function Tt(e,t){return e.filter(e=>e>t.top&&e<t.bottom).length}function Et(e,t){return Tt(t.leftYs,e)+Tt(e.rightYs,t)}function Dt(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)=>Et(e,t)-Et(t,e)||e.top-t.top||e.key.localeCompare(t.key)),a=yt(r,(e,t)=>e.top<t.bottom+ke&&t.top<e.bottom+ke),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 Ot(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 kt(e){return e.slice(1).flatMap((t,n)=>{let r=e[n];return r?[{from:r,to:t}]:[]})}function At(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 jt(e,t){if(e.shape===`straight`)return At(e);let n=t.get(Ct(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 Mt(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function Nt(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=Ot(jt(e,t)),i=e.busKey?t.get(Ct(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:[...kt(r),...o]}})}function I(e){return e.from.y===e.to.y}function Pt(e,t){let n=t.x+t.width,r=t.y+t.height;if(I(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 Ft(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 It(e){return Math.ceil(e.length*Ie)}function Lt(e,t){return{x:e.x-t/2,y:e.y-A,width:t,height:13}}function Rt(e){return Math.abs(e.from.x-e.to.x)+Math.abs(e.from.y-e.to.y)}function zt(e,t){let n=[...e].sort((e,t)=>Rt(t)-Rt(e));return[...e.slice(0,1),...n].flatMap(e=>[...He.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 I(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}]}),...Bt(e,t)])}function Bt(e,t){if(!I(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 Vt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function Ht(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=It(e),c=zt(o.segments,s),l=c.find(e=>{let n=Lt(e,s);if(n.y<t.contentTop)return!1;let o=Vt(n,Le);return i.some(e=>Pt(e,o))||a.some(e=>Ft(n,e))?!1:![...r.values()].some(e=>Ft(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:Lt(u,s)})}return r}function Ut(e,t,n){return e>Math.min(t,n)+.5&&e<Math.max(t,n)-.5}function Wt(e,t){if(I(e)===I(t))return!1;let n=I(e)?e:t,r=n===e?t:e;return Ut(r.from.x,n.from.x,n.to.x)&&Ut(n.from.y,r.from.y,r.to.y)}function Gt(e,t){if(I(e)!==I(t))return!1;let n=I(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 Kt(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 qt(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])=>Wt(e,t))?[`wire ${t.plan.wire.id} crosses wire ${e.plan.wire.id}`]:Kt(t,e)?[]:n.some(([e,t])=>Gt(e,t))?[`wire ${t.plan.wire.id} overlaps wire ${e.plan.wire.id}`]:[]}))}function Jt(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=Vt(t,-2);return e.segments.some(e=>Pt(e,n))?[`wire ${e.plan.wire.id} runs through box ${t.id}`]:[]}))}function Yt(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 Xt(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,It(t.wire.label)));return n}function Zt(e,t){return it([...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 Qt(e,t,n,r){pt(n,r);let i=bt(e,t),a=wt(e,t),o=Dt(a,t.gaps),s=Nt(e,a);return{runsByKey:a,tracksByGap:o,topTrackCount:i,drawn:s,crossingCost:Jt(s,t).length*Re+qt(s).length}}function $t(e,t){let n=e[t],r=e[t+1];n!==void 0&&r!==void 0&&(e[t]=r,e[t+1]=n)}function en(e,t){let n=dt(e),r=ft(n),i=Qt(e,t,n,r).crossingCost,a=e.length<=ze;for(let o of r.values())for(let s=0;a&&i>0&&s+1<o.length;s+=1){$t(o,s);let a=Qt(e,t,n,r).crossingCost;a<i?i=a:$t(o,s)}return Qt(e,t,n,r)}function tn(e){let t=lt(e),{runsByKey:n,tracksByGap:r,topTrackCount:i,drawn:a}=en(t,e),o=[],s=Ht(a,e,o),c=a.map(({plan:e,points:t,trunk:r})=>{let i=t.at(-1)??e.end,a=e.busKey?n.get(Ct(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:[Mt(t),...r.map(e=>Mt([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:Xt(t,e.gaps),warnings:Yt([...Jt(a,e),...qt(a),...o]),extent:Zt(a,l)}}function nn(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function rn(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}=Ke(e),o=n.get(e.on)??r.y-Ee;return n.set(e.on,o+a+be),[{kind:`note`,id:e.id,x:r.x+r.width-Te,y:o,width:_e,height:a,lines:i,byline:nn(e),isResolved:e.resolvedBy!==null}]})}function an(e,t,n,r){let i=e.flatMap(e=>e.kind===`wire`?[]:[e]),a=(n.at(-1)??S)+C,o=it([...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 on(e,t){let n=Qe(e,t.gapWidths),r=rt(e,n,t.boxesTop,t.stackHeightByBoxId),i=at(e,r),a=rn(e,r),o=new Map(M(e,`box`).flatMap(t=>{let i=r.get(t.id);return i?[[t.id,et(e,t,i,n)]]:[]}));return{columnLeftEdges:n,boxesById:r,frames:i,notes:a,routing:tn({wires:M(e,`wire`),boxesById:r,columnIndexByBoxId:o,obstacles:[...a,...i.map(e=>({x:e.x,y:e.y,width:e.width,height:ge}))],gaps:$e(n,t.gapWidths,t.reserves),topBandBottom:t.boxesTop-Fe,contentTop:t.contentTop})}}function sn(e,t){return Array.from({length:Math.max(e.length,t.length)},(n,r)=>Math.max(e[r]??0,t[r]??0))}function cn(e,t,n){let r=t.tracksByGap,i=t.topTrackCount;for(let a=1;;a+=1){let o=Ze(n.reserves,r,t.labelWidthByGap),s=n.headerBoxesTop+hn(i),c=on(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>=Be||!l&&!u)return{placed:c,boxesTop:s};i=Math.max(i,c.routing.topTrackCount),r=sn(r,c.routing.tracksByGap)}}function ln(e){let t=j(e.title,he),n=e.lines.flatMap(e=>j(e.text,T)),r=+!!e.linkedBoardId;return{titleLines:t,bodyLines:n,height:42+t.length*pe+(n.length+r)*me}}function un(e){let t=new Map,n=new Map;for(let r of y(e)){let i=e.elements[r.unitId];if(i?.kind!==`unit`)continue;let a=ln(i),o=n.get(r.level)??70;n.set(r.level,o+a.height+fe),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 dn(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 Mt(Ot([n,{x:i,y:n.y},{x:i,y:r.y},r]))}function fn(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?[dn(r,n)]:[]}):[]})}function pn(e){return e.size===0?S:Math.max(...[...e.values()].map(e=>e.y+e.height))+Ve}function mn(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 hn(e){return e>0?e*Pe+Fe:0}function gn(e){let t=un(e),n=pn(t),r=n-S,i=mn(e,r),a=qe(i),o=Je(i),s=Ye(o),c=n+we+s,l=n+de+s,u=Xe(i,a),{placed:d,boxesTop:f}=cn(i,on(i,{gapWidths:Ze(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=an(m,d.routing.extent,p,f),g=h.y+h.height,_=i.lanes.map((e,t)=>({label:e.label||e.id,hex:Ue[e.color],x:S,y:g+t*xe})),v=g+_.length*xe+(_.length>0?12:0),y=i.caption?{text:i.caption,x:S,y:v}:null,ee=_.length*xe+(y?30:0)+(_.length>0?12:0);return{columns:i.columns.map((e,t)=>({id:e.id,titleLines:o[t]??[],titleBaselineY:n+Ce,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:fn(i,t)}:null,bounds:{...h,height:h.height+ee},warnings:d.routing.warnings}}function _n(e){return JSON.stringify(e)}var vn=`http://www.w3.org/2000/svg`,L=12,yn=26,bn=20,xn=18,Sn=17,Cn=14,wn=16,Tn=24,En=18,Dn=`Plan`,On=`open linked board`,kn=5;function An(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:[` ${e}="${s(t)}"`]).join(``)}function R(e,t,n=``){return`<${e}${An(t)}>${n}</${e}>`}function z(e,t,n,r,i={}){return R(`text`,{x:t,y:n,class:r,...i},s(e))}function B(e,t,n){return R(`g`,{class:`wb-element ${t}`,"data-element-id":e.id,"data-element-kind":e.kind},n.join(``))}function jn(e){return e?`stroke:${e}`:null}function Mn(e){let t=[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8,class:`wb-box-outline`,style:jn(e.lane?.hex)})],n=e.x+e.width/2,r=e.y+e.height/2;for(let[i,a]of[[n,e.y],[e.x+e.width,r],[n,e.y+e.height],[e.x,r]])t.push(R(`circle`,{cx:i,cy:a,r:kn,class:`wb-port`}));e.titleLines.forEach((n,r)=>{t.push(z(n,e.x+L,e.y+yn+r*bn,`wb-box-title`))});let i=e.y+yn+e.titleLines.length*bn;if(e.bodyLines.forEach((n,r)=>{let a=e.x+L+(n.muted?Cn:0);t.push(z(n.text,a,i+r*xn,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),e.lane){let n=e.y+e.height-28,r=Math.min(e.width-24,16+e.lane.label.length*8);t.push(R(`rect`,{x:e.x+L,y:n,width:r,height:18,rx:9,class:`wb-lane-pill`,style:jn(e.lane.hex)}),z(e.lane.label,e.x+L+8,n+13,`wb-lane-pill-text`,{style:`fill:${e.lane.hex}`}))}return B(e,e.isGhost?`wb-box wb-ghost`:`wb-box`,t)}function Nn(e){return B(e,`wb-frame`,[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12,class:`wb-frame-outline`}),z(e.title,e.x+14,e.y+18,`wb-frame-title`)])}function Pn(e){let t=[R(`path`,{d:e.path,class:`wb-wire-hit`}),R(`path`,{d:e.path,"marker-end":e.hasArrowhead?`url(#wb-arrow)`:null,class:e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`,style:jn(e.strokeHex??void 0)}),R(`circle`,{cx:e.start.x,cy:e.start.y,r:3,class:`wb-wire-dot`})];return e.joinAt&&t.push(R(`circle`,{cx:e.joinAt.x,cy:e.joinAt.y,r:3,class:`wb-wire-dot`})),e.label&&t.push(z(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),B(e,`wb-wire wb-tone-${e.tone}`,t)}function Fn(e){let t=[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4,class:`wb-note-card`})];return e.lines.forEach((n,r)=>{t.push(z(n,e.x+10,e.y+22+r*Sn,`wb-note-text`))}),e.byline&&t.push(z(e.byline,e.x+10,e.y+22+e.lines.length*Sn,`wb-note-byline`)),B(e,e.isResolved?`wb-note wb-resolved`:`wb-note`,t)}function In(e){let t=[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8,class:`wb-unit-outline`}),z(e.label,e.x+L,e.y+Tn,`wb-unit-label`)],n=e.y+Tn+En;e.titleLines.forEach((r,i)=>{t.push(z(r,e.x+L,n+i*bn,`wb-box-title`))});let r=n+e.titleLines.length*bn;return e.bodyLines.forEach((n,i)=>{t.push(z(n,e.x+L,r+i*xn,`wb-box-line`))}),e.linkedBoardId&&t.push(z(On,e.x+L,r+e.bodyLines.length*xn,`wb-unit-link`,{"data-linked-board-id":e.linkedBoardId})),B(e,`wb-unit`,t)}function Ln(e){switch(e.kind){case`box`:return Mn(e);case`frame`:return Nn(e);case`wire`:return Pn(e);case`note`:return Fn(e);case`unit`:return In(e)}}function Rn(e){let t=[];if(e.plan){t.push(z(Dn,e.plan.titleAt.x,e.plan.titleAt.y,`wb-column-title`));for(let n of e.plan.arrowPaths)t.push(R(`path`,{d:n,"marker-end":`url(#wb-arrow)`,class:`wb-wire-line`}))}for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.push(z(e,n.x,n.titleBaselineY+r*wn,`wb-column-title`))}),t.push(R(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY,class:`wb-column-rule`})));for(let n of e.legend)t.push(R(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3,class:`wb-legend-swatch`,style:`fill:${n.hex}`}),z(n.label,n.x+22,n.y+12,`wb-legend-text`));return e.caption&&t.push(z(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),R(`g`,{class:`wb-chrome`},t.join(``))}function zn(){return R(`defs`,{},R(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`},R(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})))}function V(e,t=``){let n=document.createElementNS(vn,e);return t&&n.setAttribute(`class`,t),n}function Bn(e){let t=V(`g`);return t.innerHTML=e,[...t.children]}function Vn(e){let[t]=Bn(e);if(!(t instanceof SVGGElement))throw Error(`the whiteboard markup did not draw a group`);return t}var Hn={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`,unit:`units`},Un=[`box`,`frame`,`wire`,`note`,`unit`];function Wn(e){let t={frames:V(`g`,`wb-layer`),wires:V(`g`,`wb-layer`),boxes:V(`g`,`wb-layer`),notes:V(`g`,`wb-layer`),units:V(`g`,`wb-layer`)},n=V(`g`);e.replaceChildren(...Bn(zn()),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=gn(e),s=Vn(Rn(a));n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=_n(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Vn(Ln(e));o(e.id,a),i&&i.node.replaceWith(a),i||t[Hn[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=Un.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=V(`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 Gn=`http://www.w3.org/2000/svg`,Kn=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,qn=`Pick a board above.`,H=null,U=null,W=null,G=null,Jn=!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?h(H):null}function Yn(){return d().find(e=>e.id===H)??null}async function Xn(e){if(!H||e.length===0)return!1;let t=await p(H,e);return t.ok?(q.clear(),!0):(q.show(`error`,t.error),!1)}async function Zn(e){if(!H)return`No board is open.`;let t=await p(H,e);return t.ok?null:t.error}function Qn(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 $n(){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 er(){if(!U)return;let e=d();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})),tr()}function tr(){if(!U)return;let e=Yn(),n=d().length>0;U.boardHead.hidden=!e,U.canvas.hidden=!e,U.empty.hidden=!!e,U.empty.textContent=n?qn:Kn,e&&(U.boardMeta.textContent=`v${e.version}`,U.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,Qn(e)))),e.connectedSessionIds.length===0&&U.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),$n(),rr())}function nr(e,t){let n=Qn(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 rr(){if(!U||!K)return;let e=Yn();U.dockQueued.textContent=nr(e,K),U.sendToAgent.disabled=!e?.connectedSessionIds.includes(K)}async function ir(){if(!U||!H||!K)return;U.sendToAgent.disabled=!0,J.show(`busy`,`sending`);let e=await m(H,K);rr(),e.ok?J.show(`ok`,`sent; the agent reads the board when it is ready`):J.show(`error`,e.error)}function ar(){if(!W)return;let e=X();e?(G?.pruneSelection(e),W.render(G?.previewOf(e)??e),Jn&&=(G?.fit(),!1),$n()):W.clear()}function Q(e){H!==e&&(H=e,Jn=!0,G?.clearSelection(),G?.closeTitleInput(),W?.clear(),q.clear(),er(),v(e).then(ar))}function or(){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)=>Zn([{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 sr(){let t=X();if(!t)return;let n=d().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)=>Zn([{op:`add`,element:{kind:`unit`,id:b(`unit`),title:e,lines:[],after:[],linkedBoardId:t||null}}])})}function cr(t){Y({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>Zn([{op:`add`,element:{kind:`note`,id:b(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function lr(e,t){let n=X();n&&e!==t&&(Object.values(n.elements).some(n=>n.kind===`wire`&&n.from===e&&n.to===t)||Xn([{op:`add`,element:{kind:`wire`,id:b(`wire`),from:e,to:t,dashed:!1,tone:`plain`,label:null}}]))}function ur(){let[e,t]=Z(`box`);e&&t&&(G?.clearSelection(),lr(e.id,t.id))}function dr(){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 Zn([{op:`add`,element:{kind:`frame`,id:b(`frame`),title:e,contains:t}}]);return n||G?.clearSelection(),n}})}function fr(){let e=Yn();if(!e)return;let t=e.connectedSessionIds.map(Qn),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:()=>{c(e.id).then(e=>{e.ok||q.show(`error`,e.error)})}})}function pr(){Y({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await l(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 mr(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`,or),wire:$(`wire`,ur),note:$(`note`,()=>{let[e]=Z(`box`);e&&cr(e.id)}),frame:$(`frame`,dr),unit:$(`unit`,sr),fit:$(`fit`,()=>G?.fit()),remove:$(`delete board`,fr,`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`,pr),i);let u=t(`div`,`wb-canvas`),d=document.createElementNS(Gn,`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`,Kn),p=t(`div`,`wb-dock`);p.hidden=!0;let m=t(`span`,`wb-dock-queued`),h=$(`send to agent`,()=>void ir()),_=t(`div`,`wb-dock-bar`);_.append(m,h,J.element),p.append(_),e.replaceChildren(n,u,f,p),U={list:r,boardHead:i,boardMeta:o,presence:s,toolbar:c,canvas:u,empty:f,dock:p,dockQueued:m,sendToAgent:h,buttons:l};let v=Wn(d);W=v,G=ue({svg:d,canvas:u,renderer:v,currentBoard:X,sendOps:Xn,onSelectionChange:$n,onPhoneTapBox:cr,onOpenLinkedBoard:Q,onConnectBoxes:lr}),g(er),ee(e=>{e===H&&ar()}),er()}function hr(){return document.documentElement.dataset.layout===`phone`}function gr(){K&&te()===K&&ne(),K=null,U&&(U.dock.hidden=!0)}function _r(e){if(!U||hr())return;let t=r(e);t&&(K=e,U.dock.hidden=!1,J.clear(),rr(),f(t,e,U.dock,{className:`wb-docked-card`}),u(t,e,!0))}function vr(){let e=_();e&&(Q(e.boardId),e.dockSessionId&&_r(e.dockSessionId)),er(),H&&v(H).then(ar)}var yr={mount:mr,refresh:vr,deactivate:gr};export{yr 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{t as s}from"./escape-markup-CKuHtFmo.js";import{$r as c,Qr as l,Sn as u,Zr as d,_i as f,ai as p,ei as m,ii as h,ni as g,oi as _,ri as v,si as y,ti as ee,vi as te,yi as ne}from"./index-CUbWeDtv.js";var re=4,ie=200,ae=2e4,oe=1.1,se=[`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 ce(e){return e instanceof SVGCircleElement&&e.classList.contains(`wb-port`)?e:null}function le(e){return e instanceof Element?e.closest(`[data-linked-board-id]`)?.dataset.linkedBoardId??null:null}function ue(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,u=null;function d(){n.setAttribute(`viewBox`,`${s.x} ${s.y} ${s.width} ${s.height}`)}function f(){let e=i.layout();if(!e)return;let{bounds:t}=e,r=n.clientWidth,a=n.clientHeight;if(r===0||a===0){s={...t},d();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},d()}function p(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 m(){let e=n.clientWidth||1,t=n.clientHeight||1;return Math.max(s.width/e,s.height/t)}function h(e,t){let n=Math.min(ae,Math.max(ie,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},d()}function g(e,t){let n=m();s={...s,x:s.x-e*n,y:s.y-t*n},d()}function _(t){o=t,i.setSelection(o),e.onSelectionChange(o)}function v(e,t){if(!t){_(o.has(e)&&o.size===1?new Set:new Set([e]));return}let n=new Set(o);n.delete(e)||n.add(e),_(n)}function y(e){return{x:Math.round(e.start.x+e.latest.x-e.origin.x),y:Math.round(e.start.y+e.latest.y-e.origin.y-e.pinnedOffsetY)}}function ee(e,t,n){let r=e.elements[t];return r?.kind===`box`?{...e,elements:{...e.elements,[t]:{...r,at:n}}}:e}function te(e){return c?.kind!==`drag`||!c.hasMoved?e:ee(e,c.boxId,y(c))}function ne(){u!==null&&cancelAnimationFrame(u),u=null}function b(){ne();let t=e.currentBoard();t&&i.render(te(t))}function ue(){u===null&&(u=requestAnimationFrame(b))}function S(e){c?.kind===`drag`&&e?.elements[c.boxId]?.kind!==`box`&&(c=null);let t=new Set([...o].filter(t=>e?.elements[t]));t.size!==o.size&&_(t)}function de(e){let t=i.layout()?.elements.find(t=>t.id===e);return t?.kind===`box`?t:null}function C(){let[e,t]=[...a.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)}function w(){c?.kind===`wire`&&T(c,!1),c={kind:`pinch`,distance:C(),viewWidth:s.width}}function fe(t){if(t.button!==0||l)return;let r=le(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){w();return}let o=i.elementFromTarget(t.target),s=ce(t.target);if(o?.kind===`box`&&s&&!x()){pe(t.pointerId,o.id,s);return}let u=o?.kind===`box`&&!x()?de(o.id):null;if(o&&u){let e=p(t.clientX,t.clientY),n=i.layout()?.pinnedOffsetY??0;c={kind:`drag`,pointerId:t.pointerId,boxId:o.id,origin:e,start:u,pinnedOffsetY:n,latest:e,hasMoved:!1,isAdditive:t.shiftKey};return}if(o&&!x()){v(o.id,t.shiftKey);return}let d=o?.kind===`box`?o.id:null;c={kind:`pan`,pointerId:t.pointerId,lastClient:{x:t.clientX,y:t.clientY},hasMoved:!1,tappedBoxId:d}}function pe(e,t,r){let i={x:r.cx.baseVal.value,y:r.cy.baseVal.value},a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);a.setAttribute(`class`,`wb-wire-line wb-dashed wb-wire-draft`),a.setAttribute(`d`,`M ${i.x} ${i.y} L ${i.x} ${i.y}`),n.append(a),c={kind:`wire`,pointerId:e,fromBoxId:t,start:i,draftLine:a,targetBoxId:null}}function me(e,t){e.targetBoxId&&i.nodeOf(e.targetBoxId)?.classList.remove(`is-wire-target`),e.targetBoxId=t,t&&i.nodeOf(t)?.classList.add(`is-wire-target`)}function he(e,t){let n=p(t.clientX,t.clientY);e.draftLine.setAttribute(`d`,`M ${e.start.x} ${e.start.y} L ${n.x} ${n.y}`);let r=i.elementFromTarget(document.elementFromPoint(t.clientX,t.clientY));me(e,r?.kind===`box`&&r.id!==e.fromBoxId?r.id:null)}function T(t,n){let r=t.targetBoxId;me(t,null),t.draftLine.remove(),n&&r&&e.onConnectBoxes(t.fromBoxId,r)}function E(e,t){let n=p(t.clientX,t.clientY);!e.hasMoved&&Math.hypot(n.x-e.origin.x,n.y-e.origin.y)<re*m()||(e.hasMoved=!0,e.latest=n,ue())}function ge(e,t){let n=t.clientX-e.lastClient.x,r=t.clientY-e.lastClient.y;!e.hasMoved&&Math.hypot(n,r)<re||(e.hasMoved=!0,e.lastClient={x:t.clientX,y:t.clientY},g(n,r))}function _e(e){let t=C();if(t<=0||e.distance<=0)return;let n=[...a.values()];h(p(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 ve(e){a.has(e.pointerId)&&(a.set(e.pointerId,{x:e.clientX,y:e.clientY}),c?.kind===`pinch`?_e(c):c?.kind===`drag`&&c.pointerId===e.pointerId?E(c,e):c?.kind===`wire`&&c.pointerId===e.pointerId?he(c,e):c?.kind===`pan`&&c.pointerId===e.pointerId&&ge(c,e))}async function ye(t,n){if(!t.hasMoved){v(t.boxId,t.isAdditive);return}ne(),t.latest=p(n.clientX,n.clientY);let r=y(t),a=e.currentBoard();a&&i.render(ee(a,t.boxId,r)),await e.sendOps([{op:`set`,id:t.boxId,fields:{at:r}}])||b()}function be(t){if(!a.delete(t.pointerId))return;let n=c;n?.kind===`pinch`?c=null:(c=null,n?.kind===`drag`&&n.pointerId===t.pointerId?ye(n,t):n?.kind===`wire`?T(n,n.pointerId===t.pointerId):n?.kind!==`pan`||n.hasMoved||(n.tappedBoxId&&x()?e.onPhoneTapBox(n.tappedBoxId):n.tappedBoxId||_(new Set)))}function xe(e){a.delete(e.pointerId);let t=c?.kind===`drag`;c?.kind===`wire`&&T(c,!1),c=null,t&&b()}function Se(e){e.preventDefault(),e.ctrlKey||e.metaKey?h(p(e.clientX,e.clientY),e.deltaY>0?oe:1/oe):g(-e.deltaX,-e.deltaY)}function D(){let e=l;l=null,e?.remove()}function Ce(a){let o=e.currentBoard()?.elements[a],s=i.nodeOf(a);if(o?.kind!==`box`||!s)return;D();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(),D(),n.focus();return}if(t.key!==`Enter`)return;t.preventDefault();let r=d.value.trim();D(),n.focus(),r&&r!==o.title&&e.sendOps([{op:`set`,id:a,fields:{title:r}}])}),d.addEventListener(`blur`,D),d.focus(),d.select()}function we(e){if(x())return;let t=i.elementFromTarget(document.elementFromPoint(e.clientX,e.clientY));t?.kind===`box`&&Ce(t.id)}function Te(){let t=e.currentBoard();if(!t||o.size===0)return;let n=[...o].flatMap(e=>t.elements[e]??[]),r=se.flatMap(e=>n.filter(t=>t.kind===e)).map(e=>({op:`remove`,id:e.id}));_(new Set),e.sendOps(r)}function Ee(e){e.target===n&&(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),Te()):e.key===`Escape`&&_(new Set))}return n.tabIndex=0,n.addEventListener(`pointerdown`,fe),n.addEventListener(`pointermove`,ve),n.addEventListener(`pointerup`,be),n.addEventListener(`pointercancel`,xe),n.addEventListener(`wheel`,Se,{passive:!1}),n.addEventListener(`dblclick`,we),n.addEventListener(`keydown`,Ee),{fit:f,selectedIds:()=>o,clearSelection:()=>_(new Set),pruneSelection:S,previewOf:te,closeTitleInput:D}}var S=40,de=44,C=220,w=90,fe=30,pe=20,me=18,he=20,T=26,E=18,ge=26,_e=170,ve=21,ye=17,be=10,xe=22,Se=24,D=16,Ce=16,we=26,Te=24,Ee=8,De=10,Oe=14,ke=4,Ae=14,je=8,O=6,Me=4,Ne=6,Pe=12,Fe=10,Ie=6.6,k=5,A=10,Le=2,Re=100,ze=120,Be=4,Ve=40,He=[.5,.35,.65,.2,.8],Ue=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 We(e,t){let n=e.lanes.find(e=>e.id===t.lane);return n?{label:n.label||n.id,hex:Ue[n.color]}:null}function Ge(e,t){let n=j(t.title,he),r=t.lines.flatMap(e=>j(e.text,T-(e.muted?2:0)).map(t=>({text:t,muted:e.muted}))),i=We(e,t);return{titleLines:n,bodyLines:r,lane:i,height:24+n.length*pe+r.length*me+(i?26:0)}}function M(e,t){return Object.values(e.elements).filter(e=>e.kind===t)}function Ke(e){let t=j(e.text,ve);return{lines:t,height:24+(t.length+1)*ye}}function qe(e){let t=new Map;for(let n of M(e,`note`)){let e=t.get(n.on),r=Ke(n).height;t.set(n.on,e===void 0?r:e+be+r)}return t}function Je(e){return e.columns.map(e=>e.title?j(e.title,Se):[])}function Ye(e){return(Math.max(1,...e.map(e=>e.length))-1)*D}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 Xe(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=>De+(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 Ze(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)*Oe:0,s=a>0?e.left+e.right+a+20:0;return Math.max(e.minimumWidth,o,s)})}function Qe(e,t){let n=[],r=S;for(let[i]of e.columns.entries())n.push(r),r+=C+(t[i]??w);return n}function $e(e,t,n){return e.map((e,r)=>{let i=n[r]??{left:De,right:De,minimumWidth:w},a=e+C+(t[r]??w);return{left:e+C+i.left,right:a-i.right}})}function et(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 tt(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 nt(e,t){return e===t?0:(e?E:0)+(t?44:0)}function rt(e,t,n,r){let i=new Map,a=new Map,o=new Map,s=tt(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=Ge(e,l),d=s.get(l.id)??null,f=(a.get(l.column)??n)+nt(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)-Ee;a.set(l.column,f+Math.max(u.height,e)+fe),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 it(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 at(e,t){return M(e,`frame`).flatMap(e=>{let n=it(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-ge,width:n.width+36,height:n.height+36+ge}]:[]})}function ot(e){return e===`left`||e===`right`}function P(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function st(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 ct(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&&!st(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 lt(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}`,...ct(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 ut(e,t,n){let r=Array.from({length:n},(e,t)=>t);if(ot(t)){let i=t===`left`?e.x:e.x+e.width,a=Math.min(Ae,(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+je,Math.min(o,e.y+e.height-je-(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)*Ae/2;return r.map(e=>({x:Math.round(a+e*Ae),y:i}))}function dt(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 ft(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+(ot(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 pt(e,t){for(let[n,r]of e){let e=r[0],i=t.get(n)??[];if(!e)continue;let a=ut(e.box,e.side,i.length);for(let e of r){let t=a[i.indexOf(e.groupKey)];t&&e.assign(t)}}}function mt(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 ht(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 gt(e,t){return!t.some(t=>e>t.y-O&&e<t.y+t.height+O)}function _t(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<Me?[]:[{top:r.bottom,bottom:e.top}]})}function vt(e,t){return e.left<t.right&&t.left<e.right}function yt(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 bt(e,t){let n=[],r=[];for(let i of e){if(i.shape!==`long`)continue;let e=mt(i,t.gaps),a=ht(i,e,t),o=[i.start.y,i.end.y].find(e=>gt(e,a));if(o!==void 0){i.crossingY=o;continue}let s=(i.start.y+i.end.y)/2,c=_t(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=yt(t,(e,t)=>vt(e.span,t.span)),i=t[0]?.interval??{top:0,bottom:0},a=i.bottom-i.top,o=Math.max(1,Math.floor(a/Ne)-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=yt(a,(e,t)=>vt(e.span,t.span)).map(e=>a.length-1-e);return a.forEach(({plan:e},n)=>{e.crossingY=t.topBandBottom-(o[n]??0)*Pe}),r.length>0?Math.max(...o)+1:0}function xt(e,t){return t<=e?`left`:`right`}function St(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 Ct(e){return e.busKey?`bus|${e.busKey}`:`wire|${e.wire.id}|target`}function wt(e,t){let n=new Map,r=(e,t)=>{let r=n.get(e);if(r)return r;let i=St(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(Ct(n),n.targetGap);if(n.shape===`channel`&&F(s,xt(n.targetGap,e),n.start.y),n.shape===`long`){let t=r(`wire|${n.wire.id}|source`,n.sourceGap);F(t,xt(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,xt(n.targetGap,a),n.end.y))}return n}function Tt(e,t){return e.filter(e=>e>t.top&&e<t.bottom).length}function Et(e,t){return Tt(t.leftYs,e)+Tt(e.rightYs,t)}function Dt(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)=>Et(e,t)-Et(t,e)||e.top-t.top||e.key.localeCompare(t.key)),a=yt(r,(e,t)=>e.top<t.bottom+ke&&t.top<e.bottom+ke),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 Ot(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 kt(e){return e.slice(1).flatMap((t,n)=>{let r=e[n];return r?[{from:r,to:t}]:[]})}function At(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 jt(e,t){if(e.shape===`straight`)return At(e);let n=t.get(Ct(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 Mt(e){return e.map((e,t)=>`${t===0?`M`:`L`} ${e.x} ${e.y}`).join(` `)}function Nt(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=Ot(jt(e,t)),i=e.busKey?t.get(Ct(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:[...kt(r),...o]}})}function I(e){return e.from.y===e.to.y}function Pt(e,t){let n=t.x+t.width,r=t.y+t.height;if(I(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 Ft(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 It(e){return Math.ceil(e.length*Ie)}function Lt(e,t){return{x:e.x-t/2,y:e.y-A,width:t,height:13}}function Rt(e){return Math.abs(e.from.x-e.to.x)+Math.abs(e.from.y-e.to.y)}function zt(e,t){let n=[...e].sort((e,t)=>Rt(t)-Rt(e));return[...e.slice(0,1),...n].flatMap(e=>[...He.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 I(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}]}),...Bt(e,t)])}function Bt(e,t){if(!I(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 Vt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function Ht(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=It(e),c=zt(o.segments,s),l=c.find(e=>{let n=Lt(e,s);if(n.y<t.contentTop)return!1;let o=Vt(n,Le);return i.some(e=>Pt(e,o))||a.some(e=>Ft(n,e))?!1:![...r.values()].some(e=>Ft(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:Lt(u,s)})}return r}function Ut(e,t,n){return e>Math.min(t,n)+.5&&e<Math.max(t,n)-.5}function Wt(e,t){if(I(e)===I(t))return!1;let n=I(e)?e:t,r=n===e?t:e;return Ut(r.from.x,n.from.x,n.to.x)&&Ut(n.from.y,r.from.y,r.to.y)}function Gt(e,t){if(I(e)!==I(t))return!1;let n=I(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 Kt(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 qt(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])=>Wt(e,t))?[`wire ${t.plan.wire.id} crosses wire ${e.plan.wire.id}`]:Kt(t,e)?[]:n.some(([e,t])=>Gt(e,t))?[`wire ${t.plan.wire.id} overlaps wire ${e.plan.wire.id}`]:[]}))}function Jt(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=Vt(t,-2);return e.segments.some(e=>Pt(e,n))?[`wire ${e.plan.wire.id} runs through box ${t.id}`]:[]}))}function Yt(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 Xt(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,It(t.wire.label)));return n}function Zt(e,t){return it([...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 Qt(e,t,n,r){pt(n,r);let i=bt(e,t),a=wt(e,t),o=Dt(a,t.gaps),s=Nt(e,a);return{runsByKey:a,tracksByGap:o,topTrackCount:i,drawn:s,crossingCost:Jt(s,t).length*Re+qt(s).length}}function $t(e,t){let n=e[t],r=e[t+1];n!==void 0&&r!==void 0&&(e[t]=r,e[t+1]=n)}function en(e,t){let n=dt(e),r=ft(n),i=Qt(e,t,n,r).crossingCost,a=e.length<=ze;for(let o of r.values())for(let s=0;a&&i>0&&s+1<o.length;s+=1){$t(o,s);let a=Qt(e,t,n,r).crossingCost;a<i?i=a:$t(o,s)}return Qt(e,t,n,r)}function tn(e){let t=lt(e),{runsByKey:n,tracksByGap:r,topTrackCount:i,drawn:a}=en(t,e),o=[],s=Ht(a,e,o),c=a.map(({plan:e,points:t,trunk:r})=>{let i=t.at(-1)??e.end,a=e.busKey?n.get(Ct(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:[Mt(t),...r.map(e=>Mt([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:Xt(t,e.gaps),warnings:Yt([...Jt(a,e),...qt(a),...o]),extent:Zt(a,l)}}function nn(e){return e.resolvedBy?`resolved by ${e.resolvedBy}`:e.author?`from ${e.author}`:``}function rn(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}=Ke(e),o=n.get(e.on)??r.y-Ee;return n.set(e.on,o+a+be),[{kind:`note`,id:e.id,x:r.x+r.width-Te,y:o,width:_e,height:a,lines:i,byline:nn(e),isResolved:e.resolvedBy!==null}]})}function an(e,t,n,r){let i=e.flatMap(e=>e.kind===`wire`?[]:[e]),a=(n.at(-1)??S)+C,o=it([...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 on(e,t){let n=Qe(e,t.gapWidths),r=rt(e,n,t.boxesTop,t.stackHeightByBoxId),i=at(e,r),a=rn(e,r),o=new Map(M(e,`box`).flatMap(t=>{let i=r.get(t.id);return i?[[t.id,et(e,t,i,n)]]:[]}));return{columnLeftEdges:n,boxesById:r,frames:i,notes:a,routing:tn({wires:M(e,`wire`),boxesById:r,columnIndexByBoxId:o,obstacles:[...a,...i.map(e=>({x:e.x,y:e.y,width:e.width,height:ge}))],gaps:$e(n,t.gapWidths,t.reserves),topBandBottom:t.boxesTop-Fe,contentTop:t.contentTop})}}function sn(e,t){return Array.from({length:Math.max(e.length,t.length)},(n,r)=>Math.max(e[r]??0,t[r]??0))}function cn(e,t,n){let r=t.tracksByGap,i=t.topTrackCount;for(let a=1;;a+=1){let o=Ze(n.reserves,r,t.labelWidthByGap),s=n.headerBoxesTop+hn(i),c=on(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>=Be||!l&&!u)return{placed:c,boxesTop:s};i=Math.max(i,c.routing.topTrackCount),r=sn(r,c.routing.tracksByGap)}}function ln(e){let t=j(e.title,he),n=e.lines.flatMap(e=>j(e.text,T)),r=+!!e.linkedBoardId;return{titleLines:t,bodyLines:n,height:42+t.length*pe+(n.length+r)*me}}function un(e){let t=new Map,n=new Map;for(let r of y(e)){let i=e.elements[r.unitId];if(i?.kind!==`unit`)continue;let a=ln(i),o=n.get(r.level)??70;n.set(r.level,o+a.height+fe),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 dn(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 Mt(Ot([n,{x:i,y:n.y},{x:i,y:r.y},r]))}function fn(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?[dn(r,n)]:[]}):[]})}function pn(e){return e.size===0?S:Math.max(...[...e.values()].map(e=>e.y+e.height))+Ve}function mn(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 hn(e){return e>0?e*Pe+Fe:0}function gn(e){let t=un(e),n=pn(t),r=n-S,i=mn(e,r),a=qe(i),o=Je(i),s=Ye(o),c=n+we+s,l=n+de+s,u=Xe(i,a),{placed:d,boxesTop:f}=cn(i,on(i,{gapWidths:Ze(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=an(m,d.routing.extent,p,f),g=h.y+h.height,_=i.lanes.map((e,t)=>({label:e.label||e.id,hex:Ue[e.color],x:S,y:g+t*xe})),v=g+_.length*xe+(_.length>0?12:0),y=i.caption?{text:i.caption,x:S,y:v}:null,ee=_.length*xe+(y?30:0)+(_.length>0?12:0);return{columns:i.columns.map((e,t)=>({id:e.id,titleLines:o[t]??[],titleBaselineY:n+Ce,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:fn(i,t)}:null,bounds:{...h,height:h.height+ee},warnings:d.routing.warnings}}function _n(e){return JSON.stringify(e)}var vn=`http://www.w3.org/2000/svg`,L=12,yn=26,bn=20,xn=18,Sn=17,Cn=14,wn=16,Tn=24,En=18,Dn=`Plan`,On=`open linked board`,kn=5;function An(e){return Object.entries(e).flatMap(([e,t])=>t===null?[]:[` ${e}="${s(t)}"`]).join(``)}function R(e,t,n=``){return`<${e}${An(t)}>${n}</${e}>`}function z(e,t,n,r,i={}){return R(`text`,{x:t,y:n,class:r,...i},s(e))}function B(e,t,n){return R(`g`,{class:`wb-element ${t}`,"data-element-id":e.id,"data-element-kind":e.kind},n.join(``))}function jn(e){return e?`stroke:${e}`:null}function Mn(e){let t=[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8,class:`wb-box-outline`,style:jn(e.lane?.hex)})],n=e.x+e.width/2,r=e.y+e.height/2;for(let[i,a]of[[n,e.y],[e.x+e.width,r],[n,e.y+e.height],[e.x,r]])t.push(R(`circle`,{cx:i,cy:a,r:kn,class:`wb-port`}));e.titleLines.forEach((n,r)=>{t.push(z(n,e.x+L,e.y+yn+r*bn,`wb-box-title`))});let i=e.y+yn+e.titleLines.length*bn;if(e.bodyLines.forEach((n,r)=>{let a=e.x+L+(n.muted?Cn:0);t.push(z(n.text,a,i+r*xn,n.muted?`wb-box-line wb-muted`:`wb-box-line`))}),e.lane){let n=e.y+e.height-28,r=Math.min(e.width-24,16+e.lane.label.length*8);t.push(R(`rect`,{x:e.x+L,y:n,width:r,height:18,rx:9,class:`wb-lane-pill`,style:jn(e.lane.hex)}),z(e.lane.label,e.x+L+8,n+13,`wb-lane-pill-text`,{style:`fill:${e.lane.hex}`}))}return B(e,e.isGhost?`wb-box wb-ghost`:`wb-box`,t)}function Nn(e){return B(e,`wb-frame`,[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:12,class:`wb-frame-outline`}),z(e.title,e.x+14,e.y+18,`wb-frame-title`)])}function Pn(e){let t=[R(`path`,{d:e.path,class:`wb-wire-hit`}),R(`path`,{d:e.path,"marker-end":e.hasArrowhead?`url(#wb-arrow)`:null,class:e.isDashed?`wb-wire-line wb-dashed`:`wb-wire-line`,style:jn(e.strokeHex??void 0)}),R(`circle`,{cx:e.start.x,cy:e.start.y,r:3,class:`wb-wire-dot`})];return e.joinAt&&t.push(R(`circle`,{cx:e.joinAt.x,cy:e.joinAt.y,r:3,class:`wb-wire-dot`})),e.label&&t.push(z(e.label,e.labelAt.x,e.labelAt.y,`wb-wire-label`)),B(e,`wb-wire wb-tone-${e.tone}`,t)}function Fn(e){let t=[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:4,class:`wb-note-card`})];return e.lines.forEach((n,r)=>{t.push(z(n,e.x+10,e.y+22+r*Sn,`wb-note-text`))}),e.byline&&t.push(z(e.byline,e.x+10,e.y+22+e.lines.length*Sn,`wb-note-byline`)),B(e,e.isResolved?`wb-note wb-resolved`:`wb-note`,t)}function In(e){let t=[R(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,rx:8,class:`wb-unit-outline`}),z(e.label,e.x+L,e.y+Tn,`wb-unit-label`)],n=e.y+Tn+En;e.titleLines.forEach((r,i)=>{t.push(z(r,e.x+L,n+i*bn,`wb-box-title`))});let r=n+e.titleLines.length*bn;return e.bodyLines.forEach((n,i)=>{t.push(z(n,e.x+L,r+i*xn,`wb-box-line`))}),e.linkedBoardId&&t.push(z(On,e.x+L,r+e.bodyLines.length*xn,`wb-unit-link`,{"data-linked-board-id":e.linkedBoardId})),B(e,`wb-unit`,t)}function Ln(e){switch(e.kind){case`box`:return Mn(e);case`frame`:return Nn(e);case`wire`:return Pn(e);case`note`:return Fn(e);case`unit`:return In(e)}}function Rn(e){let t=[];if(e.plan){t.push(z(Dn,e.plan.titleAt.x,e.plan.titleAt.y,`wb-column-title`));for(let n of e.plan.arrowPaths)t.push(R(`path`,{d:n,"marker-end":`url(#wb-arrow)`,class:`wb-wire-line`}))}for(let n of e.columns)n.titleLines.length!==0&&(n.titleLines.forEach((e,r)=>{t.push(z(e,n.x,n.titleBaselineY+r*wn,`wb-column-title`))}),t.push(R(`line`,{x1:n.x,y1:n.ruleY,x2:n.x+n.width,y2:n.ruleY,class:`wb-column-rule`})));for(let n of e.legend)t.push(R(`rect`,{x:n.x,y:n.y,width:14,height:14,rx:3,class:`wb-legend-swatch`,style:`fill:${n.hex}`}),z(n.label,n.x+22,n.y+12,`wb-legend-text`));return e.caption&&t.push(z(e.caption.text,e.caption.x,e.caption.y+16,`wb-caption`)),R(`g`,{class:`wb-chrome`},t.join(``))}function zn(){return R(`defs`,{},R(`marker`,{id:`wb-arrow`,viewBox:`0 0 10 10`,refX:9,refY:5,markerWidth:8,markerHeight:8,orient:`auto-start-reverse`},R(`path`,{d:`M 0 1 L 10 5 L 0 9 z`,fill:`context-stroke`})))}function V(e,t=``){let n=document.createElementNS(vn,e);return t&&n.setAttribute(`class`,t),n}function Bn(e){let t=V(`g`);return t.innerHTML=e,[...t.children]}function Vn(e){let[t]=Bn(e);if(!(t instanceof SVGGElement))throw Error(`the whiteboard markup did not draw a group`);return t}var Hn={frame:`frames`,wire:`wires`,box:`boxes`,note:`notes`,unit:`units`},Un=[`box`,`frame`,`wire`,`note`,`unit`];function Wn(e){let t={frames:V(`g`,`wb-layer`),wires:V(`g`,`wb-layer`),boxes:V(`g`,`wb-layer`),notes:V(`g`,`wb-layer`),units:V(`g`,`wb-layer`)},n=V(`g`);e.replaceChildren(...Bn(zn()),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=gn(e),s=Vn(Rn(a));n.replaceWith(s),n=s;let c=new Set;for(let e of a.elements){c.add(e.id);let n=_n(e),i=r.get(e.id);if(i?.signature===n)continue;let a=Vn(Ln(e));o(e.id,a),i&&i.node.replaceWith(a),i||t[Hn[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=Un.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=V(`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 Gn=`http://www.w3.org/2000/svg`,Kn=`No boards yet. Make one here, or have an agent run glimmervoid whiteboard new <title>.`,qn=`Pick a board above.`,H=null,U=null,W=null,G=null,Jn=!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?h(H):null}function Yn(){return d().find(e=>e.id===H)??null}async function Xn(e){if(!H||e.length===0)return!1;let t=await p(H,e);return t.ok?(q.clear(),!0):(q.show(`error`,t.error),!1)}async function Zn(e){if(!H)return`No board is open.`;let t=await p(H,e);return t.ok?null:t.error}function Qn(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 $n(){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 er(){if(!U)return;let e=d();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})),tr()}function tr(){if(!U)return;let e=Yn(),n=d().length>0;U.boardHead.hidden=!e,U.canvas.hidden=!e,U.empty.hidden=!!e,U.empty.textContent=n?qn:Kn,e&&(U.boardMeta.textContent=`v${e.version}`,U.presence.replaceChildren(...e.connectedSessionIds.map(e=>t(`span`,`wb-presence-pill`,Qn(e)))),e.connectedSessionIds.length===0&&U.presence.append(t(`span`,`wb-presence-none`,`no sessions connected`)),$n(),rr())}function nr(e,t){let n=Qn(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 rr(){if(!U||!K)return;let e=Yn();U.dockQueued.textContent=nr(e,K),U.sendToAgent.disabled=!e?.connectedSessionIds.includes(K)}async function ir(){if(!U||!H||!K)return;U.sendToAgent.disabled=!0,J.show(`busy`,`sending`);let e=await m(H,K);rr(),e.ok?J.show(`ok`,`sent; the agent reads the board when it is ready`):J.show(`error`,e.error)}function ar(){if(!W)return;let e=X();e?(G?.pruneSelection(e),W.render(G?.previewOf(e)??e),Jn&&=(G?.fit(),!1),$n()):W.clear()}function Q(e){H!==e&&(H=e,Jn=!0,G?.clearSelection(),G?.closeTitleInput(),W?.clear(),q.clear(),er(),v(e).then(ar))}function or(){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)=>Zn([{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 sr(){let t=X();if(!t)return;let n=d().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)=>Zn([{op:`add`,element:{kind:`unit`,id:b(`unit`),title:e,lines:[],after:[],linkedBoardId:t||null}}])})}function cr(t){Y({title:`Pin a note`,label:`Note`,placeholder:`what about retries?`,maxLength:e.noteText,confirmLabel:`Pin note`,onSubmit:e=>Zn([{op:`add`,element:{kind:`note`,id:b(`note`),on:t,text:e,author:``,resolvedBy:null}}])})}function lr(e,t){let n=X();n&&e!==t&&(Object.values(n.elements).some(n=>n.kind===`wire`&&n.from===e&&n.to===t)||Xn([{op:`add`,element:{kind:`wire`,id:b(`wire`),from:e,to:t,dashed:!1,tone:`plain`,label:null}}]))}function ur(){let[e,t]=Z(`box`);e&&t&&(G?.clearSelection(),lr(e.id,t.id))}function dr(){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 Zn([{op:`add`,element:{kind:`frame`,id:b(`frame`),title:e,contains:t}}]);return n||G?.clearSelection(),n}})}function fr(){let e=Yn();if(!e)return;let t=e.connectedSessionIds.map(Qn),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:()=>{c(e.id).then(e=>{e.ok||q.show(`error`,e.error)})}})}function pr(){Y({title:`New board`,label:`Board title`,placeholder:`knowledge writer`,maxLength:e.title,confirmLabel:`Create board`,onSubmit:async e=>{let t=await l(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 mr(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`,or),wire:$(`wire`,ur),note:$(`note`,()=>{let[e]=Z(`box`);e&&cr(e.id)}),frame:$(`frame`,dr),unit:$(`unit`,sr),fit:$(`fit`,()=>G?.fit()),remove:$(`delete board`,fr,`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`,pr),i);let u=t(`div`,`wb-canvas`),d=document.createElementNS(Gn,`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`,Kn),p=t(`div`,`wb-dock`);p.hidden=!0;let m=t(`span`,`wb-dock-queued`),h=$(`send to agent`,()=>void ir()),_=t(`div`,`wb-dock-bar`);_.append(m,h,J.element),p.append(_),e.replaceChildren(n,u,f,p),U={list:r,boardHead:i,boardMeta:o,presence:s,toolbar:c,canvas:u,empty:f,dock:p,dockQueued:m,sendToAgent:h,buttons:l};let v=Wn(d);W=v,G=ue({svg:d,canvas:u,renderer:v,currentBoard:X,sendOps:Xn,onSelectionChange:$n,onPhoneTapBox:cr,onOpenLinkedBoard:Q,onConnectBoxes:lr}),g(er),ee(e=>{e===H&&ar()}),er()}function hr(){return document.documentElement.dataset.layout===`phone`}function gr(){K&&te()===K&&ne(),K=null,U&&(U.dock.hidden=!0)}function _r(e){if(!U||hr())return;let t=r(e);t&&(K=e,U.dock.hidden=!1,J.clear(),rr(),f(t,e,U.dock,{className:`wb-docked-card`}),u(t,e,!0))}function vr(){let e=_();e&&(Q(e.boardId),e.dockSessionId&&_r(e.dockSessionId)),er(),H&&v(H).then(ar)}var yr={mount:mr,refresh:vr,deactivate:gr};export{yr as view};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{d as i,u as a}from"./control-ws-ByEqbpGM.js";import{o}from"./card-registry-CLrAbqh5.js";import{c as s,i as c,s as ee,t as l}from"./action-status-SSA4xM57.js";import{i as u}from"./modal-USMHOKBI.js";import{Bt as d,Ct as f,Dt as p,Lt as m,Nt as h,Pt as g,Rt as _,St as v,Vt as y,Xr as b,Yr as te,_ as ne,bt as x,dn as re,fn as ie,j as ae,jt as oe,lt as se,m as ce,vt as le,wt as ue,x as de,xt as fe,yt as pe}from"./index-D7sz1zHA.js";import{t as me}from"./team-review-panel-BRZtQ0UZ.js";import{t as he}from"./pr-queue-columns-jhU6XB4c.js";import{n as S}from"./setup-step-D0y3riKj.js";var ge={HIGH:`High confidence`,MEDIUM:`Medium confidence`,LOW:`Low confidence`},_e={HIGH:`ok`,MEDIUM:`warn`,LOW:`muted`},C={queued:`Waiting to be researched`,running:`Researching`,error:`Research failed`,aside:`Set aside`},ve={forum:`Forum`,discord:`Discord`};function w(e){return e.status===`ready`&&e.verdict?{text:ge[e.verdict],tone:_e[e.verdict]}:e.status===`ready`?{text:`Researched`,tone:`muted`}:e.status===`error`?{text:C.error,tone:`danger`}:{text:C[e.status],tone:`muted`}}function T(e){let t=ve[e.item.source];return e.item.channel?`${t} #${e.item.channel}`:t}function E(e){return e.entry.item.title||`Untitled question`}function ye(e){return e.status!==`running`&&e.status!==`queued`}function be(e){return e.status!==`aside`}function xe(e){let t=e.find(e=>e.id===`working`)?.items.length??0;return t===0?`No community question needs you right now.`:`No community question needs you right now. ${t} ${t===1?`question is`:`questions are`} being researched.`}function D(e){return e?e.configured===!1?e.reason??`The community lane is not set up yet.`:`No community questions yet. New ones asked after you turned this on show up here.`:`Waiting for the community lane to report.`}function Se(e){return e.filter(e=>!e.isWorkspace&&!e.isEphemeral).map(({id:e,name:t})=>({id:e,name:t})).toSorted((e,t)=>e.name.localeCompare(t.name))}var O=[`key`,`project`,`skill`,`discord`];function Ce(e){let t=e===`finished`?O.length:O.indexOf(e),n=e=>e<t?`done`:e===t?`current`:`upcoming`;return{key:n(0),project:n(1),skill:n(2),discord:n(3)}}function we(e){let t=e.split(/[\s,]+/).map(e=>e.replace(/^#/,``)).filter(Boolean);return[...new Set(t)]}var k=2;function A(e){a({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`onboarding`,action:e}})}function j(){let e=ae().community,t=typeof e==`object`&&e?e:{},n=Array.isArray(t.discordChannels)?t.discordChannels.filter(e=>typeof e==`string`):[];return{projectId:typeof t.projectId==`number`?t.projectId:k,skill:typeof t.skill==`string`?t.skill:``,discordChannels:n}}function Te(e,t,n,i){let a=r(`input`,`dialog-input repo-roots-adder-input`);return a.id=e,a.type=i,a.value=t,a.placeholder=n,a.autocomplete=`off`,a.spellcheck=!1,a}function M(e,t){let n=r(`button`,`btn-dialog btn-dialog-${t}`,e);return n.type=`button`,n}function Ee({onFinish:e}){let t=r(`section`,`first-run-checklist review-setup`);t.setAttribute(`aria-labelledby`,`community-setup-title`);let n=r(`h2`,`first-run-title`,`Answer community questions`);n.id=`community-setup-title`;let a=r(`ol`,`first-run-steps`),o=r(`p`,`first-run-step-hint review-setup-foot`,`Each question gets a researched draft reply. Nothing posts until you post it yourself. `);o.append(ne(`lanes-community`,`community-enabled`,`All community settings`));let s=r(`div`,`first-run-step-actions`),u=M(`Finish setup`,`confirm`);s.append(u),s.hidden=!0,t.append(r(`span`,`first-run-eyebrow`,`SET UP COMMUNITY`),n,a,s,o);let d=null;u.addEventListener(`click`,()=>{A(`finish-community-setup`),d=null,e()});function f(e){d=e,y(),(a.querySelector(`[aria-current="step"] input`)??(s.hidden?null:u))?.focus()}async function p(e,t,n,r){t.disabled=!0,n.show(`busy`,`Saving`);try{let t=await i(`update-settings`,{settings:e},{timeoutMs:l});if(t.type===`settings-error`){n.show(`error`,t.message);return}if(t.type!==`settings-updated`){n.show(`error`,`The server did not confirm the save.`);return}de(t.settings),f(r)}catch(e){n.show(`error`,ee(e,l))}finally{t.disabled=!1}}function m(e){let t=Te(e.inputId,e.initialValue,e.placeholder,e.inputType),n=r(`label`,`repo-roots-adder-label`,e.label);n.htmlFor=t.id;let i=r(`div`,`first-run-step-actions`),a=c(),o=M(e.saveLabel,`confirm`),s=()=>{let n=e.settingsPatch(t.value);typeof n==`string`?a.show(`error`,n):(A(e.action),p(n,o,a,e.nextProgress))};if(o.addEventListener(`click`,s),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(o),e.isSkippable){let t=M(`Skip`,`cancel`);t.addEventListener(`click`,()=>f(e.nextProgress)),i.append(t)}return i.append(a.element),[r(`p`,`first-run-step-text`,e.advice),n,t,i]}let h=()=>m({advice:`Glimmervoid reads new forum and Discord questions through your PostHog personal API key. Create one in PostHog under Settings, Personal API keys. Community needs only the query:read scope on the project that holds the questions. PostHog error monitoring shares this key, so add error tracking read and write if you turn that on.`,label:`PERSONAL API KEY`,inputId:`community-setup-key`,inputType:`password`,initialValue:``,placeholder:`phx_`,saveLabel:`Save key`,action:`save-community-key`,nextProgress:`project`,isSkippable:!1,settingsPatch:e=>e.trim()?{posthog:{apiKey:e.trim()}}:`Paste a PostHog personal API key.`}),g=()=>m({advice:`The PostHog project that holds the synced community forum table and the Discord bot events. PostHog's own community lives in project 2.`,label:`PROJECT ID`,inputId:`community-setup-project`,inputType:`number`,initialValue:String(j().projectId),placeholder:String(k),saveLabel:`Use project`,action:`save-community-project`,nextProgress:`skill`,isSkippable:!1,settingsPatch:e=>{let t=Number(e.trim());return Number.isInteger(t)&&t>0?{community:{projectId:t}}:`Type the project id as a whole number, such as 2.`}}),_=()=>m({advice:`The Claude Code skill the research agent follows for each question, typed by name. A skill that knows your docs and support playbook gives the best drafts. Skip to research with whatever skills the agent has.`,label:`SKILL`,inputId:`community-setup-skill`,inputType:`text`,initialValue:j().skill,placeholder:`skill name`,saveLabel:`Save skill`,action:`save-community-skill`,nextProgress:`discord`,isSkippable:!0,settingsPatch:e=>({community:{skill:e.trim().replace(/^\//,``)}})}),v=()=>m({advice:`Discord questions come from a Discord bot that sends message_sent and thread_created events into the project above. With that bot in place, list the channels to watch by name, without the #. A cheap model picks out the real questions; only those are researched.`,label:`CHANNELS`,inputId:`community-setup-discord`,inputType:`text`,initialValue:j().discordChannels.join(`, `),placeholder:`community-questions, help`,saveLabel:`Save channels`,action:`save-community-discord`,nextProgress:`finished`,isSkippable:!0,settingsPatch:e=>{let t=we(e);return t.length>0?{community:{discordChannels:t}}:`Type at least one channel, or skip.`}});function y(){if(!d)return;let e=Ce(d);a.replaceChildren(S({title:`1. PostHog personal API key`,state:e.key,summary:`Key saved`,badge:`NEEDED`,body:h}),S({title:`2. PostHog project`,state:e.project,summary:`Project ${j().projectId}`,badge:``,body:g}),S({title:`3. Research skill (optional)`,state:e.skill,summary:j().skill||`No skill`,badge:``,body:_}),S({title:`4. Discord (optional)`,state:e.discord,summary:j().discordChannels.map(e=>`#${e}`).join(` `)||`Forum only`,badge:``,body:v})),s.hidden=d!==`finished`}function b(){d=`key`,y()}return{element:t,open:b,isOpen:()=>d!==null}}var N=null,P=null,F=null,I=null,L=[],R=null,z=!1,B=null,V=null,H=``,U=new Map,W=null;function De(){return Se([...o].map(([e,t])=>({id:e,name:t.nameEl.textContent??e,isWorkspace:t.card.dataset.workspace!==void 0,isEphemeral:t.card.dataset.ephemeral!==void 0})))}function G(e,t){let n=r(`button`,`pr-action pr-action-ghost`,e);return n.type=`button`,n.disabled=!b(t),n.addEventListener(`click`,()=>te(t)),n}function K(e,t,n){let i=r(`button`,`pr-action`,e);return i.type=`button`,i.disabled=!t,i.addEventListener(`click`,n),i}function q(e,t,n){let i=r(`ul`,e);i.setAttribute(`aria-label`,t);for(let e of n)i.append(r(`li`,null,e));return i}function Oe(e){let t=r(`div`,`pr-detail-heading`),n=r(`div`,`pr-detail-title`);n.append(r(`h2`,null,e.item.title||`Untitled question`));let i=r(`div`,`pr-detail-meta`),a=Date.parse(e.item.createdAt);return i.append(r(`span`,null,e.item.author),r(`span`,null,T(e))),Number.isNaN(a)||i.append(r(`span`,null,`Asked ${ce(a)}`)),t.append(n,i),t}function ke(e){let t=r(`section`,`community-question`);return t.setAttribute(`aria-label`,`Question as asked`),t.append(r(`h3`,`pr-section-heading`,`Question as asked`),r(`p`,`community-question-body`,e.item.body)),t}function Ae(e){let t=r(`section`,`pr-verdict-box`);t.setAttribute(`aria-label`,`Research`);let n=w(e),i=r(`div`,`pr-verdict-line`),a=r(`strong`,`community-badge`,n.text);if(a.dataset.tone=n.tone,i.append(a),t.append(i),e.error&&t.append(r(`p`,`pr-attention-detail`,e.error)),e.summary&&t.append(r(`p`,`pr-verdict-summary`,e.summary)),e.goal&&t.append(r(`p`,`community-goal`,`Goal: ${e.goal}`)),e.gaps.length>0&&t.append(q(`pr-verdict-gaps`,`Not covered`,e.gaps)),e.checked.length===0)return t;let o=r(`details`,`pr-verdict-checked`);return o.append(r(`summary`,null,`What it checked (${e.checked.length})`),q(`community-checked`,`What it checked`,e.checked)),t.append(o),t}function je(e){if(!e.draft)return null;let t=r(`section`,`community-draft`);t.setAttribute(`aria-label`,`Draft reply`),t.append(r(`h3`,`pr-section-heading`,`Draft reply`),r(`p`,`community-draft-body`,e.draft.body));let n=e.draft.publicLinks.filter(b);if(n.length===0)return t;let i=r(`ul`,`community-links`);for(let e of n){let t=r(`li`);t.append(G(e,e)),i.append(t)}return t.append(i),t}function Me(t,n){let r=t.draft?e(t.draft.body):null;r?r.then(()=>n.show(`ok`,`Draft copied. Post it yourself where the question was asked.`),()=>n.show(`error`,`Copying failed. Select the draft text instead.`)):n.show(`error`,`This browser does not allow copying here. Select the draft text instead.`)}async function Ne(e,t){if(!H){t.show(`error`,`Pick a session to start from first.`);return}let n=await s(`open-community-session`,{key:e.item.key,projectId:H},t,{busyText:`Starting a session with the research.`});n?.type===`open-community-session-result`&&(n.ok?(t.show(`ok`,`Started ${n.sessionName??`a session`}.`),n.sessionId&&se()?.openTerminal(n.sessionId)):t.show(`error`,n.error??`The session did not start.`))}async function J(e,t,n){let r=t===`rerun`?`Queuing the research again.`:`Setting the question aside.`,i=await s(`community-action`,{key:e.item.key,action:t},n,{busyText:r});i?.type===`community-action-result`&&(i.ok||n.show(`error`,i.error??`The change did not apply.`))}function Pe(){let e=r(`select`,`community-session-picker`);e.setAttribute(`aria-label`,`Session to start from`);let t=De();t.some(e=>e.id===H)||(H=t[0]?.id??``);for(let n of t){let t=r(`option`,null,n.name);t.value=n.id,t.selected=n.id===H,e.append(t)}return e.disabled=t.length===0,e.addEventListener(`change`,()=>{H=e.value}),e}function Fe(e){let t=r(`div`,`community-actions`),n=c(`pr-action-status`),i=r(`div`,`community-action-buttons`);return i.append(K(`Copy draft`,e.draft!==null,()=>Me(e,n)),G(`Open thread`,e.item.url),Pe(),K(`Start session`,!0,()=>void Ne(e,n)),K(`Re-run`,ye(e),()=>void J(e,`rerun`,n)),K(`Set aside`,be(e),()=>void J(e,`set-aside`,n))),t.append(i,n.element),t}function Ie(e){let t=r(`article`,`pr-detail community-detail`),n=je(e);return t.append(Oe(e),Fe(e),...n?[n]:[],Ae(e),ke(e)),t}function Y(){if(!F)return;let e=m(L,R),t=e?JSON.stringify(e.entry):`empty:${y(L).length}`;if(t===V)return;if(V=t,e){F.replaceChildren(Ie(e.entry));return}let n=L.some(e=>e.items.length>0);F.replaceChildren(n?me({title:`All caught up`,detail:xe(L)}):r(`p`,`pr-empty`,D(x())))}function Le(e,t){f(h(e))&&t.querySelector(`.pr-queue-unseen`)?.remove()}function X(){if(!I)return;let e=g(L,E);ie(I,p(e),e.filter(e=>e.id!==R))}function Z(e){R=e;for(let[t,n]of U)n.setAttribute(`aria-current`,String(t===e));let t=m(L,e),n=U.get(e);t&&n&&Le(t,n),Y(),X(),N&&(N.dataset.detailOpen=`true`)}function Re(){N&&(N.dataset.detailOpen=`false`),R&&U.get(R)?.focus({preventScroll:!0})}function Q(e){let t=m(L,e);if(!t)return;L.find(e=>e.items.includes(t))?.id===`aside`&&(z=!0),R=e,$(),Z(e);let n=U.get(e);n?.focus({preventScroll:!0}),n?.scrollIntoView({block:`nearest`})}function ze(e){if(e.repeat||e.defaultPrevented||!N||t(N)||u()||n(e)||document.activeElement?.classList.contains(`xterm-helper-textarea`))return;let r=_(e);if(r!==`next-row`&&r!==`previous-row`)return;let i=d([...U.keys()],R,r===`next-row`?1:-1);i&&(e.preventDefault(),i!==R&&Q(i))}function Be(e,t){let n=r(`button`,`pr-queue-row pr-queue-row-quiet`);n.type=`button`,n.dataset.queueKey=e.key,n.setAttribute(`aria-current`,String(e.key===R));let i=w(e.entry),a=r(`span`,`review-queue-action community-badge`,i.text);a.dataset.tone=i.tone;let o=r(`span`,`pr-queue-top`);if(o.append(a,r(`span`,`pr-queue-title`,E(e))),n.append(o,r(`span`,`pr-queue-elapsed`,T(e.entry))),n.title=E(e),t&&v(h(e))){let e=r(`span`,`tab-activity active pr-queue-unseen`);e.setAttribute(`aria-hidden`,`true`),n.append(e)}return n.addEventListener(`click`,()=>Z(e.key)),U.set(e.key,n),n}function Ve(e){let t=r(`h3`,`pr-section-heading review-group-heading`),n=r(`span`,`review-group-count`,String(e.items.length));if(e.id!==`aside`)return t.append(r(`span`,null,e.title),n),t;let i=r(`button`,`review-group-toggle`),a=r(`span`,`review-group-chevron`,`▸`);return a.setAttribute(`aria-hidden`,`true`),i.append(a,e.title),i.type=`button`,i.setAttribute(`aria-expanded`,String(z)),i.addEventListener(`click`,()=>{z=!z,B=null,$()}),t.append(i,n),t}function He(e){let t=r(`section`,`pr-queue-section`);if(t.dataset.group=e.id,t.append(Ve(e)),e.id===`aside`&&!z)return t;for(let n of e.items)t.append(Be(n,e.id===`turn`));return t}function Ue(){if(!N||!W)return!1;x()?.configured===!1&&!W.isOpen()&&W.open();let e=W.isOpen();return N.dataset.setup=String(e),W.element.hidden=!e,e}function $(){if(!P||Ue())return;L=pe(),R=oe(L.filter(e=>e.id!==`aside`||z),R),X();let e=JSON.stringify([L,R,z,fe(),x()?.error??null]);if(e!==B){B=e,U.clear();let t=x()?.error,n=t?[r(`p`,`my-pr-note`,t)]:[],i=L.filter(e=>e.items.length>0).map(He);P.replaceChildren(...n,...i.length>0?i:[r(`p`,`pr-empty`,D(x()))])}Y()}function We(e){if(N)return;N=r(`div`,`pr-content review-queue community-queue`),e.append(N);let n=he({queueLabel:`Community questions`,scopeTabs:null,resizerLabel:`Resize community queue`});P=n.queue,F=r(`div`,`review-queue-detail`);let i=r(`div`,`review-queue-phone-bar`),a=r(`button`,`pr-action pr-action-ghost review-queue-back`,`Back to queue`);a.type=`button`,a.addEventListener(`click`,Re),i.append(a),n.detail.append(i,F),I=re({onJump:()=>{let e=g(L,E).find(e=>e.id!==R)?.id;e&&Q(e)},rowFor:e=>U.get(e)}),I.classList.add(`review-queue-banner`),n.queue.before(I),W=Ee({onFinish:$}),W.element.hidden=!0,N.append(W.element,n.columns),N.dataset.detailOpen=`false`,le(()=>!t(N)),ue(e=>{e.kind===`status`&&$()}),document.addEventListener(`keydown`,ze),$()}var Ge={mount:We,refresh:()=>{V=null,$()}};export{Ge as view};
|
|
1
|
+
import{b as e,d as t,f as n,s as r}from"./dom-helpers-DBbFg1c_.js";import{d as i,u as a}from"./control-ws-ByEqbpGM.js";import{o}from"./card-registry-CLrAbqh5.js";import{c as s,i as c,s as ee,t as l}from"./action-status-SSA4xM57.js";import{i as u}from"./modal-USMHOKBI.js";import{Bt as d,Ct as f,Dt as p,Lt as m,Nt as h,Pt as g,Rt as _,St as v,Vt as y,Xr as b,Yr as te,_ as ne,bt as x,dn as re,fn as ie,j as ae,jt as oe,lt as se,m as ce,vt as le,wt as ue,x as de,xt as fe,yt as pe}from"./index-CUbWeDtv.js";import{t as me}from"./team-review-panel-BQX8iKpi.js";import{t as he}from"./pr-queue-columns-BcEC1DsD.js";import{n as S}from"./setup-step-D0y3riKj.js";var ge={HIGH:`High confidence`,MEDIUM:`Medium confidence`,LOW:`Low confidence`},_e={HIGH:`ok`,MEDIUM:`warn`,LOW:`muted`},C={queued:`Waiting to be researched`,running:`Researching`,error:`Research failed`,aside:`Set aside`},ve={forum:`Forum`,discord:`Discord`};function w(e){return e.status===`ready`&&e.verdict?{text:ge[e.verdict],tone:_e[e.verdict]}:e.status===`ready`?{text:`Researched`,tone:`muted`}:e.status===`error`?{text:C.error,tone:`danger`}:{text:C[e.status],tone:`muted`}}function T(e){let t=ve[e.item.source];return e.item.channel?`${t} #${e.item.channel}`:t}function E(e){return e.entry.item.title||`Untitled question`}function ye(e){return e.status!==`running`&&e.status!==`queued`}function be(e){return e.status!==`aside`}function xe(e){let t=e.find(e=>e.id===`working`)?.items.length??0;return t===0?`No community question needs you right now.`:`No community question needs you right now. ${t} ${t===1?`question is`:`questions are`} being researched.`}function D(e){return e?e.configured===!1?e.reason??`The community lane is not set up yet.`:`No community questions yet. New ones asked after you turned this on show up here.`:`Waiting for the community lane to report.`}function Se(e){return e.filter(e=>!e.isWorkspace&&!e.isEphemeral).map(({id:e,name:t})=>({id:e,name:t})).toSorted((e,t)=>e.name.localeCompare(t.name))}var O=[`key`,`project`,`skill`,`discord`];function Ce(e){let t=e===`finished`?O.length:O.indexOf(e),n=e=>e<t?`done`:e===t?`current`:`upcoming`;return{key:n(0),project:n(1),skill:n(2),discord:n(3)}}function we(e){let t=e.split(/[\s,]+/).map(e=>e.replace(/^#/,``)).filter(Boolean);return[...new Set(t)]}var k=2;function A(e){a({type:`dashboard-telemetry`,event:`operator_action`,properties:{surface:`onboarding`,action:e}})}function j(){let e=ae().community,t=typeof e==`object`&&e?e:{},n=Array.isArray(t.discordChannels)?t.discordChannels.filter(e=>typeof e==`string`):[];return{projectId:typeof t.projectId==`number`?t.projectId:k,skill:typeof t.skill==`string`?t.skill:``,discordChannels:n}}function Te(e,t,n,i){let a=r(`input`,`dialog-input repo-roots-adder-input`);return a.id=e,a.type=i,a.value=t,a.placeholder=n,a.autocomplete=`off`,a.spellcheck=!1,a}function M(e,t){let n=r(`button`,`btn-dialog btn-dialog-${t}`,e);return n.type=`button`,n}function Ee({onFinish:e}){let t=r(`section`,`first-run-checklist review-setup`);t.setAttribute(`aria-labelledby`,`community-setup-title`);let n=r(`h2`,`first-run-title`,`Answer community questions`);n.id=`community-setup-title`;let a=r(`ol`,`first-run-steps`),o=r(`p`,`first-run-step-hint review-setup-foot`,`Each question gets a researched draft reply. Nothing posts until you post it yourself. `);o.append(ne(`lanes-community`,`community-enabled`,`All community settings`));let s=r(`div`,`first-run-step-actions`),u=M(`Finish setup`,`confirm`);s.append(u),s.hidden=!0,t.append(r(`span`,`first-run-eyebrow`,`SET UP COMMUNITY`),n,a,s,o);let d=null;u.addEventListener(`click`,()=>{A(`finish-community-setup`),d=null,e()});function f(e){d=e,y(),(a.querySelector(`[aria-current="step"] input`)??(s.hidden?null:u))?.focus()}async function p(e,t,n,r){t.disabled=!0,n.show(`busy`,`Saving`);try{let t=await i(`update-settings`,{settings:e},{timeoutMs:l});if(t.type===`settings-error`){n.show(`error`,t.message);return}if(t.type!==`settings-updated`){n.show(`error`,`The server did not confirm the save.`);return}de(t.settings),f(r)}catch(e){n.show(`error`,ee(e,l))}finally{t.disabled=!1}}function m(e){let t=Te(e.inputId,e.initialValue,e.placeholder,e.inputType),n=r(`label`,`repo-roots-adder-label`,e.label);n.htmlFor=t.id;let i=r(`div`,`first-run-step-actions`),a=c(),o=M(e.saveLabel,`confirm`),s=()=>{let n=e.settingsPatch(t.value);typeof n==`string`?a.show(`error`,n):(A(e.action),p(n,o,a,e.nextProgress))};if(o.addEventListener(`click`,s),t.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),s())}),i.append(o),e.isSkippable){let t=M(`Skip`,`cancel`);t.addEventListener(`click`,()=>f(e.nextProgress)),i.append(t)}return i.append(a.element),[r(`p`,`first-run-step-text`,e.advice),n,t,i]}let h=()=>m({advice:`Glimmervoid reads new forum and Discord questions through your PostHog personal API key. Create one in PostHog under Settings, Personal API keys. Community needs only the query:read scope on the project that holds the questions. PostHog error monitoring shares this key, so add error tracking read and write if you turn that on.`,label:`PERSONAL API KEY`,inputId:`community-setup-key`,inputType:`password`,initialValue:``,placeholder:`phx_`,saveLabel:`Save key`,action:`save-community-key`,nextProgress:`project`,isSkippable:!1,settingsPatch:e=>e.trim()?{posthog:{apiKey:e.trim()}}:`Paste a PostHog personal API key.`}),g=()=>m({advice:`The PostHog project that holds the synced community forum table and the Discord bot events. PostHog's own community lives in project 2.`,label:`PROJECT ID`,inputId:`community-setup-project`,inputType:`number`,initialValue:String(j().projectId),placeholder:String(k),saveLabel:`Use project`,action:`save-community-project`,nextProgress:`skill`,isSkippable:!1,settingsPatch:e=>{let t=Number(e.trim());return Number.isInteger(t)&&t>0?{community:{projectId:t}}:`Type the project id as a whole number, such as 2.`}}),_=()=>m({advice:`The Claude Code skill the research agent follows for each question, typed by name. A skill that knows your docs and support playbook gives the best drafts. Skip to research with whatever skills the agent has.`,label:`SKILL`,inputId:`community-setup-skill`,inputType:`text`,initialValue:j().skill,placeholder:`skill name`,saveLabel:`Save skill`,action:`save-community-skill`,nextProgress:`discord`,isSkippable:!0,settingsPatch:e=>({community:{skill:e.trim().replace(/^\//,``)}})}),v=()=>m({advice:`Discord questions come from a Discord bot that sends message_sent and thread_created events into the project above. With that bot in place, list the channels to watch by name, without the #. A cheap model picks out the real questions; only those are researched.`,label:`CHANNELS`,inputId:`community-setup-discord`,inputType:`text`,initialValue:j().discordChannels.join(`, `),placeholder:`community-questions, help`,saveLabel:`Save channels`,action:`save-community-discord`,nextProgress:`finished`,isSkippable:!0,settingsPatch:e=>{let t=we(e);return t.length>0?{community:{discordChannels:t}}:`Type at least one channel, or skip.`}});function y(){if(!d)return;let e=Ce(d);a.replaceChildren(S({title:`1. PostHog personal API key`,state:e.key,summary:`Key saved`,badge:`NEEDED`,body:h}),S({title:`2. PostHog project`,state:e.project,summary:`Project ${j().projectId}`,badge:``,body:g}),S({title:`3. Research skill (optional)`,state:e.skill,summary:j().skill||`No skill`,badge:``,body:_}),S({title:`4. Discord (optional)`,state:e.discord,summary:j().discordChannels.map(e=>`#${e}`).join(` `)||`Forum only`,badge:``,body:v})),s.hidden=d!==`finished`}function b(){d=`key`,y()}return{element:t,open:b,isOpen:()=>d!==null}}var N=null,P=null,F=null,I=null,L=[],R=null,z=!1,B=null,V=null,H=``,U=new Map,W=null;function De(){return Se([...o].map(([e,t])=>({id:e,name:t.nameEl.textContent??e,isWorkspace:t.card.dataset.workspace!==void 0,isEphemeral:t.card.dataset.ephemeral!==void 0})))}function G(e,t){let n=r(`button`,`pr-action pr-action-ghost`,e);return n.type=`button`,n.disabled=!b(t),n.addEventListener(`click`,()=>te(t)),n}function K(e,t,n){let i=r(`button`,`pr-action`,e);return i.type=`button`,i.disabled=!t,i.addEventListener(`click`,n),i}function q(e,t,n){let i=r(`ul`,e);i.setAttribute(`aria-label`,t);for(let e of n)i.append(r(`li`,null,e));return i}function Oe(e){let t=r(`div`,`pr-detail-heading`),n=r(`div`,`pr-detail-title`);n.append(r(`h2`,null,e.item.title||`Untitled question`));let i=r(`div`,`pr-detail-meta`),a=Date.parse(e.item.createdAt);return i.append(r(`span`,null,e.item.author),r(`span`,null,T(e))),Number.isNaN(a)||i.append(r(`span`,null,`Asked ${ce(a)}`)),t.append(n,i),t}function ke(e){let t=r(`section`,`community-question`);return t.setAttribute(`aria-label`,`Question as asked`),t.append(r(`h3`,`pr-section-heading`,`Question as asked`),r(`p`,`community-question-body`,e.item.body)),t}function Ae(e){let t=r(`section`,`pr-verdict-box`);t.setAttribute(`aria-label`,`Research`);let n=w(e),i=r(`div`,`pr-verdict-line`),a=r(`strong`,`community-badge`,n.text);if(a.dataset.tone=n.tone,i.append(a),t.append(i),e.error&&t.append(r(`p`,`pr-attention-detail`,e.error)),e.summary&&t.append(r(`p`,`pr-verdict-summary`,e.summary)),e.goal&&t.append(r(`p`,`community-goal`,`Goal: ${e.goal}`)),e.gaps.length>0&&t.append(q(`pr-verdict-gaps`,`Not covered`,e.gaps)),e.checked.length===0)return t;let o=r(`details`,`pr-verdict-checked`);return o.append(r(`summary`,null,`What it checked (${e.checked.length})`),q(`community-checked`,`What it checked`,e.checked)),t.append(o),t}function je(e){if(!e.draft)return null;let t=r(`section`,`community-draft`);t.setAttribute(`aria-label`,`Draft reply`),t.append(r(`h3`,`pr-section-heading`,`Draft reply`),r(`p`,`community-draft-body`,e.draft.body));let n=e.draft.publicLinks.filter(b);if(n.length===0)return t;let i=r(`ul`,`community-links`);for(let e of n){let t=r(`li`);t.append(G(e,e)),i.append(t)}return t.append(i),t}function Me(t,n){let r=t.draft?e(t.draft.body):null;r?r.then(()=>n.show(`ok`,`Draft copied. Post it yourself where the question was asked.`),()=>n.show(`error`,`Copying failed. Select the draft text instead.`)):n.show(`error`,`This browser does not allow copying here. Select the draft text instead.`)}async function Ne(e,t){if(!H){t.show(`error`,`Pick a session to start from first.`);return}let n=await s(`open-community-session`,{key:e.item.key,projectId:H},t,{busyText:`Starting a session with the research.`});n?.type===`open-community-session-result`&&(n.ok?(t.show(`ok`,`Started ${n.sessionName??`a session`}.`),n.sessionId&&se()?.openTerminal(n.sessionId)):t.show(`error`,n.error??`The session did not start.`))}async function J(e,t,n){let r=t===`rerun`?`Queuing the research again.`:`Setting the question aside.`,i=await s(`community-action`,{key:e.item.key,action:t},n,{busyText:r});i?.type===`community-action-result`&&(i.ok||n.show(`error`,i.error??`The change did not apply.`))}function Pe(){let e=r(`select`,`community-session-picker`);e.setAttribute(`aria-label`,`Session to start from`);let t=De();t.some(e=>e.id===H)||(H=t[0]?.id??``);for(let n of t){let t=r(`option`,null,n.name);t.value=n.id,t.selected=n.id===H,e.append(t)}return e.disabled=t.length===0,e.addEventListener(`change`,()=>{H=e.value}),e}function Fe(e){let t=r(`div`,`community-actions`),n=c(`pr-action-status`),i=r(`div`,`community-action-buttons`);return i.append(K(`Copy draft`,e.draft!==null,()=>Me(e,n)),G(`Open thread`,e.item.url),Pe(),K(`Start session`,!0,()=>void Ne(e,n)),K(`Re-run`,ye(e),()=>void J(e,`rerun`,n)),K(`Set aside`,be(e),()=>void J(e,`set-aside`,n))),t.append(i,n.element),t}function Ie(e){let t=r(`article`,`pr-detail community-detail`),n=je(e);return t.append(Oe(e),Fe(e),...n?[n]:[],Ae(e),ke(e)),t}function Y(){if(!F)return;let e=m(L,R),t=e?JSON.stringify(e.entry):`empty:${y(L).length}`;if(t===V)return;if(V=t,e){F.replaceChildren(Ie(e.entry));return}let n=L.some(e=>e.items.length>0);F.replaceChildren(n?me({title:`All caught up`,detail:xe(L)}):r(`p`,`pr-empty`,D(x())))}function Le(e,t){f(h(e))&&t.querySelector(`.pr-queue-unseen`)?.remove()}function X(){if(!I)return;let e=g(L,E);ie(I,p(e),e.filter(e=>e.id!==R))}function Z(e){R=e;for(let[t,n]of U)n.setAttribute(`aria-current`,String(t===e));let t=m(L,e),n=U.get(e);t&&n&&Le(t,n),Y(),X(),N&&(N.dataset.detailOpen=`true`)}function Re(){N&&(N.dataset.detailOpen=`false`),R&&U.get(R)?.focus({preventScroll:!0})}function Q(e){let t=m(L,e);if(!t)return;L.find(e=>e.items.includes(t))?.id===`aside`&&(z=!0),R=e,$(),Z(e);let n=U.get(e);n?.focus({preventScroll:!0}),n?.scrollIntoView({block:`nearest`})}function ze(e){if(e.repeat||e.defaultPrevented||!N||t(N)||u()||n(e)||document.activeElement?.classList.contains(`xterm-helper-textarea`))return;let r=_(e);if(r!==`next-row`&&r!==`previous-row`)return;let i=d([...U.keys()],R,r===`next-row`?1:-1);i&&(e.preventDefault(),i!==R&&Q(i))}function Be(e,t){let n=r(`button`,`pr-queue-row pr-queue-row-quiet`);n.type=`button`,n.dataset.queueKey=e.key,n.setAttribute(`aria-current`,String(e.key===R));let i=w(e.entry),a=r(`span`,`review-queue-action community-badge`,i.text);a.dataset.tone=i.tone;let o=r(`span`,`pr-queue-top`);if(o.append(a,r(`span`,`pr-queue-title`,E(e))),n.append(o,r(`span`,`pr-queue-elapsed`,T(e.entry))),n.title=E(e),t&&v(h(e))){let e=r(`span`,`tab-activity active pr-queue-unseen`);e.setAttribute(`aria-hidden`,`true`),n.append(e)}return n.addEventListener(`click`,()=>Z(e.key)),U.set(e.key,n),n}function Ve(e){let t=r(`h3`,`pr-section-heading review-group-heading`),n=r(`span`,`review-group-count`,String(e.items.length));if(e.id!==`aside`)return t.append(r(`span`,null,e.title),n),t;let i=r(`button`,`review-group-toggle`),a=r(`span`,`review-group-chevron`,`▸`);return a.setAttribute(`aria-hidden`,`true`),i.append(a,e.title),i.type=`button`,i.setAttribute(`aria-expanded`,String(z)),i.addEventListener(`click`,()=>{z=!z,B=null,$()}),t.append(i,n),t}function He(e){let t=r(`section`,`pr-queue-section`);if(t.dataset.group=e.id,t.append(Ve(e)),e.id===`aside`&&!z)return t;for(let n of e.items)t.append(Be(n,e.id===`turn`));return t}function Ue(){if(!N||!W)return!1;x()?.configured===!1&&!W.isOpen()&&W.open();let e=W.isOpen();return N.dataset.setup=String(e),W.element.hidden=!e,e}function $(){if(!P||Ue())return;L=pe(),R=oe(L.filter(e=>e.id!==`aside`||z),R),X();let e=JSON.stringify([L,R,z,fe(),x()?.error??null]);if(e!==B){B=e,U.clear();let t=x()?.error,n=t?[r(`p`,`my-pr-note`,t)]:[],i=L.filter(e=>e.items.length>0).map(He);P.replaceChildren(...n,...i.length>0?i:[r(`p`,`pr-empty`,D(x()))])}Y()}function We(e){if(N)return;N=r(`div`,`pr-content review-queue community-queue`),e.append(N);let n=he({queueLabel:`Community questions`,scopeTabs:null,resizerLabel:`Resize community queue`});P=n.queue,F=r(`div`,`review-queue-detail`);let i=r(`div`,`review-queue-phone-bar`),a=r(`button`,`pr-action pr-action-ghost review-queue-back`,`Back to queue`);a.type=`button`,a.addEventListener(`click`,Re),i.append(a),n.detail.append(i,F),I=re({onJump:()=>{let e=g(L,E).find(e=>e.id!==R)?.id;e&&Q(e)},rowFor:e=>U.get(e)}),I.classList.add(`review-queue-banner`),n.queue.before(I),W=Ee({onFinish:$}),W.element.hidden=!0,N.append(W.element,n.columns),N.dataset.detailOpen=`false`,le(()=>!t(N)),ue(e=>{e.kind===`status`&&$()}),document.addEventListener(`keydown`,ze),$()}var Ge={mount:We,refresh:()=>{V=null,$()}};export{Ge as view};
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-Qkm1ZY4B.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-ByEqbpGM.js";import{i as u,s as d,t as f}from"./action-status-SSA4xM57.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-D6kuntKS.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,fi as w,jr as T,kr as E,m as ee,mi as D,pi as O}from"./index-
|
|
1
|
+
import{C as e,F as t,I as n,L as r,at as i,it as a}from"./updates-view-core-Qkm1ZY4B.js";import{g as o,h as s,s as c}from"./dom-helpers-DBbFg1c_.js";import{d as l}from"./control-ws-ByEqbpGM.js";import{i as u,s as d,t as f}from"./action-status-SSA4xM57.js";import{n as p,r as m,t as h}from"./modal-USMHOKBI.js";import{n as g}from"./session-tick-D6kuntKS.js";import{Ar as _,Dr as v,In as y,Mr as b,Or as x,Tr as S,_r as C,fi as w,jr as T,kr as E,m as ee,mi as D,pi as O}from"./index-CUbWeDtv.js";import{t as te}from"./repo-roots-adder-CYO3qVCJ.js";import{t as ne}from"./sandboxed-frame-D9MEfNuX.js";var re=`<h2 class="dialog-title" id="add-session-title">Add Session</h2>
|
|
2
2
|
<fieldset class="dialog-mode-controls add-session-agent-only" aria-label="Session kind">
|
|
3
3
|
<button type="button" class="dialog-mode-button" id="add-session-single-mode" aria-pressed="true">Single repo</button>
|
|
4
4
|
<button type="button" class="dialog-mode-button" id="add-session-workspace-mode" aria-pressed="false">Workspace</button>
|
|
Binary file
|