@peasant-labs/fairtrade 0.0.6 → 0.0.7
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/LICENSE +202 -21
- package/dist/lib/InUseShell-VRWaysXY.js +2488 -0
- package/dist/lib/commons.js +801 -836
- package/dist/lib/components.css +1 -1
- package/dist/lib/graph.css +1 -1
- package/dist/lib/graph.js +684 -285
- package/dist/lib/types/CommitGraph.d.ts +12 -3
- package/dist/lib/types/MapCanvas.d.ts +45 -2
- package/dist/lib/types/ProviderIcon.d.ts +23 -20
- package/dist/lib/types/commons/providers.d.ts +7 -8
- package/dist/lib/types/commons/types.d.ts +3 -6
- package/dist/lib/types/graph/Changes.d.ts +8 -4
- package/dist/lib/types/graph/CodeMap.d.ts +17 -1
- package/dist/lib/types/graph/CodeMapComposition.d.ts +25 -1
- package/dist/lib/types/graph/CodeMapNavigator.d.ts +35 -0
- package/dist/lib/types/graph/changeGraph.d.ts +12 -0
- package/dist/lib/types/graph/codeMapState.d.ts +136 -0
- package/dist/lib/types/graph/index.d.ts +15 -1
- package/dist/lib/types/graph/timelineNavigation.d.ts +33 -0
- package/dist/lib/types/graph/types.d.ts +67 -440
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/provider-policy.d.ts +27 -0
- package/dist/lib/types/transcript/TranscriptViewer.d.ts +1 -1
- package/dist/lib/types/transcript/adapter.d.ts +5 -40
- package/dist/lib/types/transcript/graph/GraphLegend.d.ts +3 -3
- package/dist/lib/types/transcript/graph/GraphTurnNode.d.ts +2 -2
- package/dist/lib/types/transcript/index.d.ts +3 -1
- package/dist/lib/types/transcript/initial-position.d.ts +80 -0
- package/dist/lib/types/transcript/state-capabilities.d.ts +22 -1
- package/dist/lib/types/transcript/useTranscriptInitialPosition.d.ts +26 -0
- package/dist/lib/types/transcript/view-model.d.ts +16 -16
- package/dist/lib/types/transcript/wire-types.d.ts +46 -308
- package/dist/lib/{ui-TG4XLhWL.js → ui-CKqVB4x2.js} +3395 -3401
- package/dist/lib/ui.js +4 -4
- package/package.json +51 -26
- package/dist/lib/InUseShell-CjtqHauP.js +0 -1532
|
@@ -0,0 +1,2488 @@
|
|
|
1
|
+
import { Fragment as e, useCallback as t, useEffect as n, useId as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
2
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { Check as u, ChevronDown as d, ChevronLeft as f, ChevronRight as p, Eye as m, EyeOff as h, FileCode as g, Folder as _, GitMerge as v, Maximize as ee, Minus as te, Plus as ne, ScrollText as y, Search as re, Star as ie, TriangleAlert as ae, Users as oe, Waypoints as se } from "lucide-react";
|
|
4
|
+
import { AllChangeBindings as ce, AllDiffLineKinds as le, AllEdgeViolationKinds as b, AllFileChangeStatuses as ue, AllMapNodeKinds as de, Harness as fe, isChangeBinding as pe, isDiffLineKind as x, isEdgeViolationKind as me, isFileChangeStatus as S, isHarness as C, isMapNodeKind as w } from "@peasant-labs/schema";
|
|
5
|
+
//#region src/ui/BrandMark.jsx
|
|
6
|
+
var he = {
|
|
7
|
+
claude: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
|
|
8
|
+
gemini: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81",
|
|
9
|
+
openai: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",
|
|
10
|
+
opencode: "M22 24H2V0h20zM17 4.8H7v14.4h10z",
|
|
11
|
+
cursor: "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"
|
|
12
|
+
}, ge = {
|
|
13
|
+
anthropic: "claude",
|
|
14
|
+
"claude-code": "claude",
|
|
15
|
+
google: "gemini",
|
|
16
|
+
googlegemini: "gemini",
|
|
17
|
+
"gemini-cli": "gemini",
|
|
18
|
+
codex: "openai",
|
|
19
|
+
"codex-cli": "openai",
|
|
20
|
+
chatgpt: "openai",
|
|
21
|
+
gpt: "openai"
|
|
22
|
+
}, _e = {
|
|
23
|
+
claude: "Claude",
|
|
24
|
+
gemini: "Gemini",
|
|
25
|
+
openai: "OpenAI",
|
|
26
|
+
cursor: "Cursor",
|
|
27
|
+
opencode: "opencode"
|
|
28
|
+
};
|
|
29
|
+
function ve(e) {
|
|
30
|
+
if (!e) return null;
|
|
31
|
+
let t = String(e).toLowerCase().trim(), n = ge[t] || t;
|
|
32
|
+
return he[n] ? n : null;
|
|
33
|
+
}
|
|
34
|
+
function ye({ name: e, size: t, label: n, className: r = "", ...i }) {
|
|
35
|
+
let a = ve(e);
|
|
36
|
+
if (!a) return null;
|
|
37
|
+
let o = ["brand", r].filter(Boolean).join(" "), s = t == null ? {} : {
|
|
38
|
+
width: t,
|
|
39
|
+
height: t,
|
|
40
|
+
style: {
|
|
41
|
+
width: t,
|
|
42
|
+
height: t
|
|
43
|
+
}
|
|
44
|
+
}, l = n ? {
|
|
45
|
+
role: "img",
|
|
46
|
+
"aria-label": n === !0 ? _e[a] : n,
|
|
47
|
+
focusable: "false"
|
|
48
|
+
} : {
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
focusable: "false"
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ c("svg", {
|
|
53
|
+
className: o,
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
...s,
|
|
56
|
+
...l,
|
|
57
|
+
...i,
|
|
58
|
+
children: /* @__PURE__ */ c("path", { d: he[a] })
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/ui/provider-policy.js
|
|
63
|
+
var be = Object.freeze(Object.values(fe)), xe = Object.freeze({
|
|
64
|
+
"claude-code": "Claude Code",
|
|
65
|
+
"gemini-cli": "Gemini CLI",
|
|
66
|
+
codex: "Codex",
|
|
67
|
+
opencode: "opencode",
|
|
68
|
+
cursor: "Cursor",
|
|
69
|
+
antigravity: "Google Antigravity"
|
|
70
|
+
}), Se = Object.freeze({
|
|
71
|
+
"claude-code": "claude",
|
|
72
|
+
"gemini-cli": "gemini",
|
|
73
|
+
codex: "openai",
|
|
74
|
+
opencode: "opencode",
|
|
75
|
+
cursor: "cursor",
|
|
76
|
+
antigravity: "gemini"
|
|
77
|
+
}), Ce = Object.freeze({
|
|
78
|
+
"claude-code": "amber",
|
|
79
|
+
"gemini-cli": "teal",
|
|
80
|
+
codex: "olive",
|
|
81
|
+
opencode: "mauve",
|
|
82
|
+
cursor: "clay",
|
|
83
|
+
antigravity: "teal"
|
|
84
|
+
});
|
|
85
|
+
function T(e, t) {
|
|
86
|
+
if (C(e)) return;
|
|
87
|
+
let n;
|
|
88
|
+
try {
|
|
89
|
+
n = JSON.stringify(e);
|
|
90
|
+
} catch {
|
|
91
|
+
n = String(e);
|
|
92
|
+
}
|
|
93
|
+
throw TypeError(`Provider harness validation failed for ${n} at src/ui/provider-policy.js during ${t}: the value is outside the canonical @peasant-labs/schema Harness, so Fairtrade cannot select a trustworthy provider identity; the caller must validate its wire boundary and pass one of ${be.join(", ")}.`);
|
|
94
|
+
}
|
|
95
|
+
function E(e) {
|
|
96
|
+
return T(e, "provider display-name resolution"), xe[e];
|
|
97
|
+
}
|
|
98
|
+
function we(e) {
|
|
99
|
+
return T(e, "provider brand resolution"), Se[e];
|
|
100
|
+
}
|
|
101
|
+
function Te(e) {
|
|
102
|
+
return T(e, "provider accent resolution"), Ce[e];
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/ui/ProviderIcon.jsx
|
|
106
|
+
var Ee = be, De = Ce;
|
|
107
|
+
function Oe(e) {
|
|
108
|
+
return `var(--${Te(e)})`;
|
|
109
|
+
}
|
|
110
|
+
function ke({ harness: e, size: t, accent: n = !1, label: r, className: i = "", ...a }) {
|
|
111
|
+
T(e, "ProviderIcon render in src/ui/ProviderIcon.jsx");
|
|
112
|
+
let o = we(e), s = ["pv-icon", i].filter(Boolean).join(" "), l = n ? { color: Oe(e) } : void 0, u = r === !0 ? E(e) : r;
|
|
113
|
+
return /* @__PURE__ */ c("span", {
|
|
114
|
+
className: s,
|
|
115
|
+
style: l,
|
|
116
|
+
...a,
|
|
117
|
+
children: /* @__PURE__ */ c(ye, {
|
|
118
|
+
name: o,
|
|
119
|
+
size: t,
|
|
120
|
+
label: u
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function Ae({ harness: e, accent: t = !1, className: n = "", ...r }) {
|
|
125
|
+
return T(e, "ProviderTag render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ l("span", {
|
|
126
|
+
className: ["pv-tag", n].filter(Boolean).join(" "),
|
|
127
|
+
...r,
|
|
128
|
+
children: [/* @__PURE__ */ c(ke, {
|
|
129
|
+
harness: e,
|
|
130
|
+
accent: t
|
|
131
|
+
}), /* @__PURE__ */ c("span", {
|
|
132
|
+
className: "pv-tag-label",
|
|
133
|
+
children: e
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function je({ harness: e, accent: t = !1, className: n = "", ...r }) {
|
|
138
|
+
return T(e, "ProviderName render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ l("span", {
|
|
139
|
+
className: ["pv-name", n].filter(Boolean).join(" "),
|
|
140
|
+
style: t ? { color: Oe(e) } : void 0,
|
|
141
|
+
...r,
|
|
142
|
+
children: [/* @__PURE__ */ c(ke, { harness: e }), /* @__PURE__ */ c("span", {
|
|
143
|
+
className: "pv-name-label",
|
|
144
|
+
children: e
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function Me({ className: e = "", ...t }) {
|
|
149
|
+
return /* @__PURE__ */ c("ul", {
|
|
150
|
+
className: ["pv-legend", e].filter(Boolean).join(" "),
|
|
151
|
+
...t,
|
|
152
|
+
children: Ee.map((e) => {
|
|
153
|
+
let t = Te(e);
|
|
154
|
+
return /* @__PURE__ */ l("li", {
|
|
155
|
+
className: "pv-legend-row",
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ c(ke, {
|
|
158
|
+
harness: e,
|
|
159
|
+
accent: !0,
|
|
160
|
+
className: "pv-legend-mark"
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ c("span", {
|
|
163
|
+
className: "pv-legend-name",
|
|
164
|
+
children: e
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ c("span", {
|
|
167
|
+
className: "pv-swatch",
|
|
168
|
+
style: { background: `var(--${t})` },
|
|
169
|
+
"aria-hidden": "true"
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ c("span", {
|
|
172
|
+
className: "pv-legend-token",
|
|
173
|
+
children: t
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
}, e);
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/ui/CommitGraph.jsx
|
|
182
|
+
var D = 14, O = 9, k = 7, Ne = 9, Pe = "3 3", A = (e) => O + e * D, Fe = (e) => A(Math.max(e - 1, 0)) + k;
|
|
183
|
+
function Ie({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpenSession: a, hasMore: o = !1, onShowOlder: s, label: u = "commit history", className: f = "", ...p }) {
|
|
184
|
+
let m = i(() => e.reduce((e, t) => Math.max(e, (t.lane ?? 0) + 1), 1), [e]), h = i(() => {
|
|
185
|
+
let t = new Map(e.map((e) => [e.id, e.lane ?? 0])), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
186
|
+
return e.forEach((e, t) => {
|
|
187
|
+
let i = e.lane ?? 0;
|
|
188
|
+
n.has(i) || n.set(i, t), r.set(i, t);
|
|
189
|
+
}), e.map((e, i) => {
|
|
190
|
+
let a = e.lane ?? 0, o = (e.parents ?? []).map((e) => t.get(e)).filter((e) => e !== void 0 && e !== a).map((e) => ({
|
|
191
|
+
from: a,
|
|
192
|
+
to: e
|
|
193
|
+
})), s = [];
|
|
194
|
+
for (let [e, t] of n) e !== a && i >= t && i <= r.get(e) && s.push(e);
|
|
195
|
+
let c = r.get(a);
|
|
196
|
+
return {
|
|
197
|
+
commit: e,
|
|
198
|
+
lane: a,
|
|
199
|
+
joins: o,
|
|
200
|
+
passLanes: s,
|
|
201
|
+
laneUp: i > n.get(a),
|
|
202
|
+
laneDown: i < c
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
}, [e]), g = Fe(m), _ = ["cg", f].filter(Boolean).join(" ");
|
|
206
|
+
return e.length === 0 ? /* @__PURE__ */ c("div", {
|
|
207
|
+
className: _,
|
|
208
|
+
...p,
|
|
209
|
+
children: /* @__PURE__ */ c("p", {
|
|
210
|
+
className: "cg-empty",
|
|
211
|
+
children: "no commits to show."
|
|
212
|
+
})
|
|
213
|
+
}) : /* @__PURE__ */ l("div", {
|
|
214
|
+
className: _,
|
|
215
|
+
role: "list",
|
|
216
|
+
"aria-label": u,
|
|
217
|
+
...p,
|
|
218
|
+
children: [h.map((e) => /* @__PURE__ */ c(Le, {
|
|
219
|
+
row: e,
|
|
220
|
+
width: g,
|
|
221
|
+
selected: e.commit.id === t,
|
|
222
|
+
onNavigate: n,
|
|
223
|
+
onSelect: r,
|
|
224
|
+
onOpenSession: a
|
|
225
|
+
}, e.commit.id)), o && /* @__PURE__ */ l("div", {
|
|
226
|
+
className: "cg-older-band",
|
|
227
|
+
children: [/* @__PURE__ */ c("span", {
|
|
228
|
+
className: "cg-gutter cg-gutter-older",
|
|
229
|
+
style: { width: g },
|
|
230
|
+
"aria-hidden": "true",
|
|
231
|
+
children: /* @__PURE__ */ c("svg", {
|
|
232
|
+
className: "cg-svg",
|
|
233
|
+
width: g,
|
|
234
|
+
height: "100%",
|
|
235
|
+
preserveAspectRatio: "none",
|
|
236
|
+
children: /* @__PURE__ */ c("line", {
|
|
237
|
+
className: "cg-stroke-lane0",
|
|
238
|
+
x1: A(0),
|
|
239
|
+
y1: "0",
|
|
240
|
+
x2: A(0),
|
|
241
|
+
y2: "60%",
|
|
242
|
+
strokeDasharray: Pe
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
}), /* @__PURE__ */ l("button", {
|
|
246
|
+
type: "button",
|
|
247
|
+
className: "cg-older",
|
|
248
|
+
onClick: () => {
|
|
249
|
+
n ? n({ type: "show-older" }) : s?.();
|
|
250
|
+
},
|
|
251
|
+
children: [/* @__PURE__ */ c(d, {
|
|
252
|
+
className: "cg-older-ic",
|
|
253
|
+
"aria-hidden": "true"
|
|
254
|
+
}), "show older"]
|
|
255
|
+
})]
|
|
256
|
+
})]
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function Le({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenSession: a }) {
|
|
260
|
+
let { commit: o, lane: s, joins: u, passLanes: d, laneUp: f, laneDown: p } = e, m = !!o.session, h = [
|
|
261
|
+
"cg-dot",
|
|
262
|
+
m ? "cg-dot-filled" : "cg-dot-hollow",
|
|
263
|
+
n && "cg-dot-sel"
|
|
264
|
+
].filter(Boolean).join(" "), g = ["cg-row", n && "cg-row-sel"].filter(Boolean).join(" ");
|
|
265
|
+
return /* @__PURE__ */ l("div", {
|
|
266
|
+
className: "cg-band",
|
|
267
|
+
role: "listitem",
|
|
268
|
+
children: [/* @__PURE__ */ l("span", {
|
|
269
|
+
className: "cg-gutter",
|
|
270
|
+
style: { width: t },
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ l("svg", {
|
|
274
|
+
className: "cg-svg",
|
|
275
|
+
width: t,
|
|
276
|
+
height: "100%",
|
|
277
|
+
preserveAspectRatio: "none",
|
|
278
|
+
children: [
|
|
279
|
+
f && /* @__PURE__ */ c("line", {
|
|
280
|
+
className: "cg-stroke-self",
|
|
281
|
+
x1: A(s),
|
|
282
|
+
y1: "0",
|
|
283
|
+
x2: A(s),
|
|
284
|
+
y2: "50%"
|
|
285
|
+
}),
|
|
286
|
+
p && /* @__PURE__ */ c("line", {
|
|
287
|
+
className: "cg-stroke-self",
|
|
288
|
+
x1: A(s),
|
|
289
|
+
y1: "50%",
|
|
290
|
+
x2: A(s),
|
|
291
|
+
y2: "100%"
|
|
292
|
+
}),
|
|
293
|
+
d.map((e) => /* @__PURE__ */ c("line", {
|
|
294
|
+
className: e === 0 ? "cg-stroke-lane0" : "cg-stroke-branch",
|
|
295
|
+
x1: A(e),
|
|
296
|
+
y1: "0",
|
|
297
|
+
x2: A(e),
|
|
298
|
+
y2: "100%"
|
|
299
|
+
}, e)),
|
|
300
|
+
u.map((e, t) => /* @__PURE__ */ l("g", {
|
|
301
|
+
className: "cg-elbow",
|
|
302
|
+
children: [/* @__PURE__ */ c("line", {
|
|
303
|
+
className: "cg-stroke-branch",
|
|
304
|
+
x1: A(e.to),
|
|
305
|
+
y1: "50%",
|
|
306
|
+
x2: A(e.to),
|
|
307
|
+
y2: "100%"
|
|
308
|
+
}), /* @__PURE__ */ c("line", {
|
|
309
|
+
className: "cg-stroke-branch",
|
|
310
|
+
x1: A(e.to),
|
|
311
|
+
y1: "50%",
|
|
312
|
+
x2: A(e.from),
|
|
313
|
+
y2: "50%"
|
|
314
|
+
})]
|
|
315
|
+
}, t))
|
|
316
|
+
]
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ c("span", {
|
|
319
|
+
className: h,
|
|
320
|
+
style: {
|
|
321
|
+
left: A(s),
|
|
322
|
+
width: Ne,
|
|
323
|
+
height: Ne
|
|
324
|
+
},
|
|
325
|
+
"data-has-session": m || void 0
|
|
326
|
+
}),
|
|
327
|
+
m && /* @__PURE__ */ c(ie, {
|
|
328
|
+
className: "cg-spark",
|
|
329
|
+
style: { left: A(s) },
|
|
330
|
+
"aria-hidden": "true"
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
}), /* @__PURE__ */ l("div", {
|
|
334
|
+
className: "cg-content",
|
|
335
|
+
children: [/* @__PURE__ */ l("button", {
|
|
336
|
+
type: "button",
|
|
337
|
+
className: g,
|
|
338
|
+
onClick: () => {
|
|
339
|
+
r ? r({
|
|
340
|
+
type: "open-change",
|
|
341
|
+
change: {
|
|
342
|
+
id: o.id,
|
|
343
|
+
branch: o.branch ?? null
|
|
344
|
+
}
|
|
345
|
+
}) : i?.(o);
|
|
346
|
+
},
|
|
347
|
+
children: [/* @__PURE__ */ c("span", {
|
|
348
|
+
className: "cg-msg",
|
|
349
|
+
title: o.message,
|
|
350
|
+
children: o.message
|
|
351
|
+
}), /* @__PURE__ */ l("span", {
|
|
352
|
+
className: "cg-meta",
|
|
353
|
+
children: [
|
|
354
|
+
o.merged && /* @__PURE__ */ l("span", {
|
|
355
|
+
className: "cg-merged",
|
|
356
|
+
children: [/* @__PURE__ */ c(v, {
|
|
357
|
+
className: "cg-merged-ic",
|
|
358
|
+
"aria-hidden": "true"
|
|
359
|
+
}), "merged"]
|
|
360
|
+
}),
|
|
361
|
+
o.tip && /* @__PURE__ */ c("span", {
|
|
362
|
+
className: "cg-tip",
|
|
363
|
+
children: "tip"
|
|
364
|
+
}),
|
|
365
|
+
o.branch && /* @__PURE__ */ c("span", {
|
|
366
|
+
className: "cg-branch",
|
|
367
|
+
children: o.branch
|
|
368
|
+
}),
|
|
369
|
+
m && /* @__PURE__ */ c("span", {
|
|
370
|
+
className: "cg-sr",
|
|
371
|
+
children: "session"
|
|
372
|
+
}),
|
|
373
|
+
o.time && /* @__PURE__ */ c("span", {
|
|
374
|
+
className: "cg-time tnum",
|
|
375
|
+
children: o.time
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
})]
|
|
379
|
+
}), o.sessionRefs?.length > 0 && /* @__PURE__ */ c("div", {
|
|
380
|
+
className: "cg-sessions",
|
|
381
|
+
role: "group",
|
|
382
|
+
"aria-label": `sessions linked to ${o.message}`,
|
|
383
|
+
children: o.sessionRefs.map((e) => /* @__PURE__ */ l("button", {
|
|
384
|
+
type: "button",
|
|
385
|
+
className: "cg-session",
|
|
386
|
+
onClick: () => {
|
|
387
|
+
r ? r({
|
|
388
|
+
type: "open-session",
|
|
389
|
+
sessionId: e.sessionId,
|
|
390
|
+
source: {
|
|
391
|
+
kind: "commit",
|
|
392
|
+
commit: {
|
|
393
|
+
id: o.id,
|
|
394
|
+
branch: o.branch ?? null
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}) : a?.(e.sessionId);
|
|
398
|
+
},
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ c(je, { harness: e.harness }),
|
|
401
|
+
/* @__PURE__ */ c("span", {
|
|
402
|
+
className: "cg-session-title",
|
|
403
|
+
children: e.title || e.sessionId
|
|
404
|
+
}),
|
|
405
|
+
e.startMs != null && /* @__PURE__ */ c("time", {
|
|
406
|
+
className: "cg-session-time tnum",
|
|
407
|
+
dateTime: new Date(e.startMs).toISOString(),
|
|
408
|
+
children: new Date(e.startMs).toLocaleDateString(void 0, {
|
|
409
|
+
month: "short",
|
|
410
|
+
day: "numeric"
|
|
411
|
+
}).toLowerCase()
|
|
412
|
+
})
|
|
413
|
+
]
|
|
414
|
+
}, e.sessionId))
|
|
415
|
+
})]
|
|
416
|
+
})]
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/ui/DiffView.jsx
|
|
421
|
+
function j(e) {
|
|
422
|
+
let t = 0, n = 0;
|
|
423
|
+
for (let r of e) for (let e of r.lines) e.type === "add" ? t++ : e.type === "del" && n++;
|
|
424
|
+
return {
|
|
425
|
+
adds: t,
|
|
426
|
+
dels: n
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function Re({ line: e }) {
|
|
430
|
+
let { type: t, oldNo: n, newNo: r, text: i } = e, a = t === "add" ? ne : t === "del" ? te : null;
|
|
431
|
+
return /* @__PURE__ */ l("div", {
|
|
432
|
+
className: `dv-line dv-${t}`,
|
|
433
|
+
role: "row",
|
|
434
|
+
children: [
|
|
435
|
+
/* @__PURE__ */ c("span", {
|
|
436
|
+
className: "dv-rail",
|
|
437
|
+
"aria-hidden": "true"
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ c("span", {
|
|
440
|
+
className: "dv-num dv-num-old tnum",
|
|
441
|
+
role: "cell",
|
|
442
|
+
children: n ?? ""
|
|
443
|
+
}),
|
|
444
|
+
/* @__PURE__ */ c("span", {
|
|
445
|
+
className: "dv-num dv-num-new tnum",
|
|
446
|
+
role: "cell",
|
|
447
|
+
children: r ?? ""
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ c("span", {
|
|
450
|
+
className: "dv-sign",
|
|
451
|
+
role: "cell",
|
|
452
|
+
"aria-hidden": "true",
|
|
453
|
+
children: a ? /* @__PURE__ */ c(a, { "aria-hidden": "true" }) : null
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ l("span", {
|
|
456
|
+
className: "dv-text",
|
|
457
|
+
role: "cell",
|
|
458
|
+
children: [/* @__PURE__ */ c("span", {
|
|
459
|
+
className: "dv-sr",
|
|
460
|
+
children: t === "add" ? "added: " : t === "del" ? "removed: " : ""
|
|
461
|
+
}), i || "\xA0"]
|
|
462
|
+
})
|
|
463
|
+
]
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
function ze({ match: e }) {
|
|
467
|
+
let { category: t, confidence: n, original: r, replacement: i, oldNo: a, newNo: s } = e, [u, d] = o(!1), f = n < .7, p = n.toFixed(2);
|
|
468
|
+
return /* @__PURE__ */ l("div", {
|
|
469
|
+
className: `dv-match${u ? " dv-match-kept" : ""}`,
|
|
470
|
+
children: [/* @__PURE__ */ l("div", {
|
|
471
|
+
className: "dv-match-head",
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ l("span", {
|
|
474
|
+
className: `dv-badge${f ? " dv-badge-low" : ""}`,
|
|
475
|
+
children: [
|
|
476
|
+
/* @__PURE__ */ c("span", {
|
|
477
|
+
className: "dv-badge-cat",
|
|
478
|
+
children: t
|
|
479
|
+
}),
|
|
480
|
+
/* @__PURE__ */ c("span", {
|
|
481
|
+
className: "dv-badge-dot",
|
|
482
|
+
"aria-hidden": "true",
|
|
483
|
+
children: "·"
|
|
484
|
+
}),
|
|
485
|
+
/* @__PURE__ */ c("span", {
|
|
486
|
+
className: "dv-badge-conf tnum",
|
|
487
|
+
children: p
|
|
488
|
+
})
|
|
489
|
+
]
|
|
490
|
+
}),
|
|
491
|
+
u && /* @__PURE__ */ l("span", {
|
|
492
|
+
className: "dv-kept-flag",
|
|
493
|
+
children: [/* @__PURE__ */ c(h, { "aria-hidden": "true" }), "un-redacted"]
|
|
494
|
+
}),
|
|
495
|
+
/* @__PURE__ */ l("button", {
|
|
496
|
+
type: "button",
|
|
497
|
+
className: "dv-keep",
|
|
498
|
+
"aria-pressed": u,
|
|
499
|
+
onClick: () => d((e) => !e),
|
|
500
|
+
children: [c(u ? m : h, { "aria-hidden": "true" }), u ? "revert" : "keep"]
|
|
501
|
+
})
|
|
502
|
+
]
|
|
503
|
+
}), /* @__PURE__ */ l("div", {
|
|
504
|
+
className: "dv-match-pair",
|
|
505
|
+
role: "rowgroup",
|
|
506
|
+
children: [/* @__PURE__ */ l("div", {
|
|
507
|
+
className: `dv-line dv-del${u ? " dv-line-muted" : ""}`,
|
|
508
|
+
role: "row",
|
|
509
|
+
children: [
|
|
510
|
+
/* @__PURE__ */ c("span", {
|
|
511
|
+
className: "dv-rail",
|
|
512
|
+
"aria-hidden": "true"
|
|
513
|
+
}),
|
|
514
|
+
/* @__PURE__ */ c("span", {
|
|
515
|
+
className: "dv-num dv-num-old tnum",
|
|
516
|
+
role: "cell",
|
|
517
|
+
children: a ?? ""
|
|
518
|
+
}),
|
|
519
|
+
/* @__PURE__ */ c("span", {
|
|
520
|
+
className: "dv-num dv-num-new tnum",
|
|
521
|
+
role: "cell"
|
|
522
|
+
}),
|
|
523
|
+
/* @__PURE__ */ c("span", {
|
|
524
|
+
className: "dv-sign",
|
|
525
|
+
role: "cell",
|
|
526
|
+
"aria-hidden": "true",
|
|
527
|
+
children: /* @__PURE__ */ c(te, { "aria-hidden": "true" })
|
|
528
|
+
}),
|
|
529
|
+
/* @__PURE__ */ l("span", {
|
|
530
|
+
className: "dv-text",
|
|
531
|
+
role: "cell",
|
|
532
|
+
children: [/* @__PURE__ */ c("span", {
|
|
533
|
+
className: "dv-sr",
|
|
534
|
+
children: "original: "
|
|
535
|
+
}), /* @__PURE__ */ c("span", {
|
|
536
|
+
className: "dv-strike",
|
|
537
|
+
children: r
|
|
538
|
+
})]
|
|
539
|
+
})
|
|
540
|
+
]
|
|
541
|
+
}), /* @__PURE__ */ l("div", {
|
|
542
|
+
className: `dv-line dv-add${u ? " dv-line-muted" : ""}`,
|
|
543
|
+
role: "row",
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ c("span", {
|
|
546
|
+
className: "dv-rail",
|
|
547
|
+
"aria-hidden": "true"
|
|
548
|
+
}),
|
|
549
|
+
/* @__PURE__ */ c("span", {
|
|
550
|
+
className: "dv-num dv-num-old tnum",
|
|
551
|
+
role: "cell"
|
|
552
|
+
}),
|
|
553
|
+
/* @__PURE__ */ c("span", {
|
|
554
|
+
className: "dv-num dv-num-new tnum",
|
|
555
|
+
role: "cell",
|
|
556
|
+
children: s ?? ""
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ c("span", {
|
|
559
|
+
className: "dv-sign",
|
|
560
|
+
role: "cell",
|
|
561
|
+
"aria-hidden": "true",
|
|
562
|
+
children: /* @__PURE__ */ c(ne, { "aria-hidden": "true" })
|
|
563
|
+
}),
|
|
564
|
+
/* @__PURE__ */ l("span", {
|
|
565
|
+
className: "dv-text",
|
|
566
|
+
role: "cell",
|
|
567
|
+
children: [/* @__PURE__ */ c("span", {
|
|
568
|
+
className: "dv-sr",
|
|
569
|
+
children: "redacted to: "
|
|
570
|
+
}), i]
|
|
571
|
+
})
|
|
572
|
+
]
|
|
573
|
+
})]
|
|
574
|
+
})]
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
function Be({ file: e, hunks: t = [], matches: n = [], variant: r = "default", className: i = "", ...a }) {
|
|
578
|
+
let o = r === "redaction", s = o ? null : j(t);
|
|
579
|
+
return /* @__PURE__ */ l("figure", {
|
|
580
|
+
className: [
|
|
581
|
+
"dv",
|
|
582
|
+
o && "dv-redaction",
|
|
583
|
+
i
|
|
584
|
+
].filter(Boolean).join(" "),
|
|
585
|
+
...a,
|
|
586
|
+
children: [/* @__PURE__ */ l("figcaption", {
|
|
587
|
+
className: "dv-head",
|
|
588
|
+
children: [/* @__PURE__ */ c("span", {
|
|
589
|
+
className: "dv-file",
|
|
590
|
+
children: e
|
|
591
|
+
}), o ? /* @__PURE__ */ l("span", {
|
|
592
|
+
className: "dv-churn",
|
|
593
|
+
children: [/* @__PURE__ */ c("span", {
|
|
594
|
+
className: "dv-churn-r tnum",
|
|
595
|
+
children: n.length
|
|
596
|
+
}), /* @__PURE__ */ c("span", {
|
|
597
|
+
className: "dv-churn-label",
|
|
598
|
+
children: "redacted"
|
|
599
|
+
})]
|
|
600
|
+
}) : /* @__PURE__ */ l("span", {
|
|
601
|
+
className: "dv-churn",
|
|
602
|
+
children: [/* @__PURE__ */ l("span", {
|
|
603
|
+
className: "dv-churn-add tnum",
|
|
604
|
+
children: ["+", s.adds]
|
|
605
|
+
}), /* @__PURE__ */ l("span", {
|
|
606
|
+
className: "dv-churn-del tnum",
|
|
607
|
+
children: ["−", s.dels]
|
|
608
|
+
})]
|
|
609
|
+
})]
|
|
610
|
+
}), o ? /* @__PURE__ */ c("div", {
|
|
611
|
+
className: "dv-body dv-matches",
|
|
612
|
+
role: "table",
|
|
613
|
+
"aria-label": `redactions in ${e}`,
|
|
614
|
+
children: n.length === 0 ? /* @__PURE__ */ c("p", {
|
|
615
|
+
className: "dv-empty",
|
|
616
|
+
children: "no sensitive content detected. safe to share as-is."
|
|
617
|
+
}) : n.map((e, t) => /* @__PURE__ */ c(ze, { match: e }, e.id ?? t))
|
|
618
|
+
}) : /* @__PURE__ */ c("div", {
|
|
619
|
+
className: "dv-body",
|
|
620
|
+
role: "table",
|
|
621
|
+
"aria-label": `diff of ${e}`,
|
|
622
|
+
children: t.length === 0 ? /* @__PURE__ */ c("p", {
|
|
623
|
+
className: "dv-empty",
|
|
624
|
+
children: "no line changes."
|
|
625
|
+
}) : t.map((e, t) => /* @__PURE__ */ l("div", {
|
|
626
|
+
className: "dv-hunk",
|
|
627
|
+
children: [/* @__PURE__ */ l("div", {
|
|
628
|
+
className: "dv-hunk-head",
|
|
629
|
+
children: [
|
|
630
|
+
/* @__PURE__ */ c("span", {
|
|
631
|
+
className: "dv-hunk-at",
|
|
632
|
+
"aria-hidden": "true",
|
|
633
|
+
children: "@@"
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ c("span", {
|
|
636
|
+
className: "dv-hunk-range tnum",
|
|
637
|
+
children: e.header
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ c("span", {
|
|
640
|
+
className: "dv-hunk-at",
|
|
641
|
+
"aria-hidden": "true",
|
|
642
|
+
children: "@@"
|
|
643
|
+
})
|
|
644
|
+
]
|
|
645
|
+
}), /* @__PURE__ */ c("div", {
|
|
646
|
+
className: "dv-hunk-pair",
|
|
647
|
+
role: "rowgroup",
|
|
648
|
+
children: e.lines.map((e, t) => /* @__PURE__ */ c(Re, { line: e }, t))
|
|
649
|
+
})]
|
|
650
|
+
}, t))
|
|
651
|
+
})]
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region src/ui/graph/types.js
|
|
656
|
+
var Ve = de, He = ce, M = b, N = ue, P = le;
|
|
657
|
+
function F(e, t, n, r, i) {
|
|
658
|
+
if (e(t)) return;
|
|
659
|
+
let a;
|
|
660
|
+
try {
|
|
661
|
+
a = JSON.stringify(t);
|
|
662
|
+
} catch {
|
|
663
|
+
a = String(t);
|
|
664
|
+
}
|
|
665
|
+
throw TypeError(`Graph contract validation failed for ${a} at src/ui/graph/types.js during ${r}: ${n} is outside the canonical @peasant-labs/schema value domain (${i.join(", ")}), so Fairtrade cannot safely render this graph payload; the caller must validate and normalize the local API response before passing it to the cooked graph surface.`);
|
|
666
|
+
}
|
|
667
|
+
function I(e) {
|
|
668
|
+
for (let [t, n] of e.nodes.entries()) F(w, n.kind, `nodes[${t}].kind`, "code-map payload rendering", de);
|
|
669
|
+
for (let [t, n] of e.violations.entries()) F(me, n.kind, `violations[${t}].kind`, "code-map payload rendering", b);
|
|
670
|
+
}
|
|
671
|
+
function L(e) {
|
|
672
|
+
for (let [t, n] of e.files.entries()) F(S, n.status, `files[${t}].status`, "change-detail payload rendering", ue);
|
|
673
|
+
for (let [t, n] of e.work.entries()) F(pe, n.binding, `work[${t}].binding`, "change-detail payload rendering", ce);
|
|
674
|
+
for (let [t, n] of e.slice.nodes.entries()) F(w, n.kind, `slice.nodes[${t}].kind`, "change-detail payload rendering", de);
|
|
675
|
+
for (let [t, n] of e.violations.entries()) F(me, n.kind, `violations[${t}].kind`, "change-detail payload rendering", b);
|
|
676
|
+
}
|
|
677
|
+
function Ue(e) {
|
|
678
|
+
F(S, e.status, "status", "change-diff payload rendering", ue);
|
|
679
|
+
for (let [t, n] of e.hunks.entries()) for (let [e, r] of n.lines.entries()) F(x, r.kind, `hunks[${t}].lines[${e}].kind`, "change-diff payload rendering", le);
|
|
680
|
+
}
|
|
681
|
+
//#endregion
|
|
682
|
+
//#region src/ui/graph/codeMapState.js
|
|
683
|
+
var We = 1, R = Object.freeze({
|
|
684
|
+
min: .35,
|
|
685
|
+
max: 2.4
|
|
686
|
+
});
|
|
687
|
+
function z(e) {
|
|
688
|
+
return typeof e == "number" && Number.isFinite(e) && e >= R.min && e <= R.max;
|
|
689
|
+
}
|
|
690
|
+
var Ge = Object.freeze({
|
|
691
|
+
version: 1,
|
|
692
|
+
presentation: "navigator",
|
|
693
|
+
selectedId: null,
|
|
694
|
+
grain: "package",
|
|
695
|
+
expandedIds: Object.freeze([]),
|
|
696
|
+
navigatorFilter: "",
|
|
697
|
+
navigatorFocusedId: null,
|
|
698
|
+
viewport: null
|
|
699
|
+
}), B = /* @__PURE__ */ new Set(["navigator", "canvas"]), V = /* @__PURE__ */ new Set([
|
|
700
|
+
"project",
|
|
701
|
+
"package",
|
|
702
|
+
"file"
|
|
703
|
+
]), H = Object.freeze({
|
|
704
|
+
project: 0,
|
|
705
|
+
package: 1,
|
|
706
|
+
file: 1
|
|
707
|
+
}), U = H, Ke = Object.freeze([
|
|
708
|
+
"version",
|
|
709
|
+
"presentation",
|
|
710
|
+
"selectedId",
|
|
711
|
+
"grain",
|
|
712
|
+
"expandedIds",
|
|
713
|
+
"navigatorFilter",
|
|
714
|
+
"navigatorFocusedId",
|
|
715
|
+
"viewport"
|
|
716
|
+
]), qe = Object.freeze({
|
|
717
|
+
replace: ["type", "state"],
|
|
718
|
+
hydrate: ["type", "state"],
|
|
719
|
+
"set-presentation": ["type", "presentation"],
|
|
720
|
+
select: ["type", "id"],
|
|
721
|
+
"clear-selection": ["type"],
|
|
722
|
+
focus: ["type", "id"],
|
|
723
|
+
"set-filter": ["type", "filter"],
|
|
724
|
+
"set-expanded": ["type", "ids"],
|
|
725
|
+
"toggle-expanded": ["type", "id"],
|
|
726
|
+
"set-grain": ["type", "grain"],
|
|
727
|
+
"set-viewport": ["type", "viewport"],
|
|
728
|
+
"open-in-map": ["type", "id"],
|
|
729
|
+
reveal: [
|
|
730
|
+
"type",
|
|
731
|
+
"id",
|
|
732
|
+
"grain",
|
|
733
|
+
"expandedIds"
|
|
734
|
+
]
|
|
735
|
+
});
|
|
736
|
+
function W(e = null) {
|
|
737
|
+
if (e !== null && !K(e)) throw G("create state", "seed", "the seed is not an object", "pass an object or omit the seed");
|
|
738
|
+
let t = e ?? {};
|
|
739
|
+
if (Qe(t, Ke, "create state", "seed"), t.version !== void 0 && t.version !== 1) throw G("create state", "version", `version ${String(t.version)} is unsupported`, "use version 1");
|
|
740
|
+
return {
|
|
741
|
+
version: 1,
|
|
742
|
+
presentation: st(t.presentation, B, Ge.presentation, "presentation"),
|
|
743
|
+
selectedId: nt(t.selectedId, "selectedId"),
|
|
744
|
+
grain: st(t.grain, V, Ge.grain, "grain"),
|
|
745
|
+
expandedIds: rt(t.expandedIds, "expandedIds"),
|
|
746
|
+
navigatorFilter: J(t.navigatorFilter, "", "navigatorFilter"),
|
|
747
|
+
navigatorFocusedId: nt(t.navigatorFocusedId, "navigatorFocusedId"),
|
|
748
|
+
viewport: ct(t.viewport)
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
function Je(e, t) {
|
|
752
|
+
let n = W(e), r = W(t);
|
|
753
|
+
return n.version === r.version && n.presentation === r.presentation && n.selectedId === r.selectedId && n.grain === r.grain && n.expandedIds.length === r.expandedIds.length && n.expandedIds.every((e, t) => e === r.expandedIds[t]) && n.navigatorFilter === r.navigatorFilter && n.navigatorFocusedId === r.navigatorFocusedId && ut(n.viewport, r.viewport);
|
|
754
|
+
}
|
|
755
|
+
function Ye(e, t) {
|
|
756
|
+
let n = W(e);
|
|
757
|
+
switch (Ze(t), t.type) {
|
|
758
|
+
case "replace":
|
|
759
|
+
case "hydrate": return W(t.state);
|
|
760
|
+
case "set-presentation": return W({
|
|
761
|
+
...n,
|
|
762
|
+
presentation: Y(t.presentation, B, "presentation")
|
|
763
|
+
});
|
|
764
|
+
case "select": return W({
|
|
765
|
+
...n,
|
|
766
|
+
selectedId: q(t.id, "id"),
|
|
767
|
+
navigatorFocusedId: q(t.id, "id")
|
|
768
|
+
});
|
|
769
|
+
case "clear-selection": return W({
|
|
770
|
+
...n,
|
|
771
|
+
selectedId: null
|
|
772
|
+
});
|
|
773
|
+
case "focus": return W({
|
|
774
|
+
...n,
|
|
775
|
+
navigatorFocusedId: nt(t.id, "id")
|
|
776
|
+
});
|
|
777
|
+
case "set-filter": return W({
|
|
778
|
+
...n,
|
|
779
|
+
navigatorFilter: J(t.filter, "", "filter")
|
|
780
|
+
});
|
|
781
|
+
case "set-expanded": return W({
|
|
782
|
+
...n,
|
|
783
|
+
expandedIds: rt(t.ids, "ids")
|
|
784
|
+
});
|
|
785
|
+
case "toggle-expanded": {
|
|
786
|
+
let e = q(t.id, "id"), r = new Set(n.expandedIds);
|
|
787
|
+
return r.has(e) ? r.delete(e) : r.add(e), W({
|
|
788
|
+
...n,
|
|
789
|
+
expandedIds: [...r]
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
case "set-grain": return W({
|
|
793
|
+
...n,
|
|
794
|
+
grain: Y(t.grain, V, "grain"),
|
|
795
|
+
expandedIds: []
|
|
796
|
+
});
|
|
797
|
+
case "set-viewport": return W({
|
|
798
|
+
...n,
|
|
799
|
+
viewport: ct(t.viewport)
|
|
800
|
+
});
|
|
801
|
+
case "open-in-map": {
|
|
802
|
+
let e = q(t.id, "id");
|
|
803
|
+
return W({
|
|
804
|
+
...n,
|
|
805
|
+
presentation: "canvas",
|
|
806
|
+
selectedId: e,
|
|
807
|
+
navigatorFocusedId: e
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
case "reveal": {
|
|
811
|
+
let e = q(t.id, "id");
|
|
812
|
+
return W({
|
|
813
|
+
...n,
|
|
814
|
+
grain: Y(t.grain, V, "grain"),
|
|
815
|
+
expandedIds: rt(t.expandedIds, "expandedIds"),
|
|
816
|
+
selectedId: e,
|
|
817
|
+
navigatorFocusedId: e
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
default: throw G("reduce state", "action.type", "the action is unsupported", "use a documented CodeMapAction");
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
function Xe(e, t) {
|
|
824
|
+
e && I(e);
|
|
825
|
+
let n = W(t), r = e?.nodes ?? [];
|
|
826
|
+
if (!Array.isArray(r)) throw G("derive view", "payload.nodes", "nodes is not an array", "provide a CodeMapPayload with a nodes array");
|
|
827
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
828
|
+
r.forEach((e, t) => {
|
|
829
|
+
if (!K(e)) throw G("derive view", `payload.nodes[${t}]`, "the node is not an object", "provide a node object");
|
|
830
|
+
let n = q(e.id, `payload.nodes[${t}].id`);
|
|
831
|
+
if (i.has(n)) throw G("derive view", `payload.nodes[${t}].id`, `duplicate node id ${JSON.stringify(n)}`, "give every node one unique nonempty id");
|
|
832
|
+
let r = {
|
|
833
|
+
...e,
|
|
834
|
+
id: n
|
|
835
|
+
};
|
|
836
|
+
r.parent !== void 0 && r.parent !== null && r.parent !== "" ? r.parent = q(r.parent, `payload.nodes[${t}].parent`) : delete r.parent, i.set(n, r), a.set(n, t);
|
|
837
|
+
});
|
|
838
|
+
for (let e of i.values()) if (e.parent && !i.has(e.parent)) throw G("derive view", `node ${JSON.stringify(e.id)} parent`, `parent ${JSON.stringify(e.parent)} does not exist`, "add the parent node or remove the parent reference to make this node a root");
|
|
839
|
+
let o = /* @__PURE__ */ new Map(), s = [];
|
|
840
|
+
for (let e of i.values()) if (e.parent) {
|
|
841
|
+
let t = o.get(e.parent) ?? [];
|
|
842
|
+
t.push(e), o.set(e.parent, t);
|
|
843
|
+
} else s.push(e);
|
|
844
|
+
let c = (e, t) => (Number.isFinite(e.order) ? Number(e.order) : a.get(e.id) ?? 0) - (Number.isFinite(t.order) ? Number(t.order) : a.get(t.id) ?? 0) || et(e.id, t.id);
|
|
845
|
+
s.sort(c);
|
|
846
|
+
for (let e of o.values()) e.sort(c);
|
|
847
|
+
let l = /* @__PURE__ */ new Map(), u = [], d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
|
|
848
|
+
function p(e, t) {
|
|
849
|
+
if (d.has(e.id)) throw G("derive view", `node ${JSON.stringify(e.id)}`, "the parent graph contains a cycle", "remove the cyclic parent reference");
|
|
850
|
+
if (!f.has(e.id)) {
|
|
851
|
+
d.add(e.id), u.push(e.id), l.set(e.id, t);
|
|
852
|
+
for (let n of o.get(e.id) ?? []) p(n, t + 1);
|
|
853
|
+
d.delete(e.id), f.add(e.id);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
for (let e of s) p(e, 0);
|
|
857
|
+
if (f.size !== i.size) {
|
|
858
|
+
let e = [...i.keys()].find((e) => !f.has(e)), t = e ? i.get(e) : void 0;
|
|
859
|
+
t && p(t, 0);
|
|
860
|
+
}
|
|
861
|
+
let m = new Set(n.expandedIds.filter((e) => i.has(e))), h = n.navigatorFilter.trim().toLowerCase(), g = /* @__PURE__ */ new Set();
|
|
862
|
+
if (h) for (let e of i.values()) {
|
|
863
|
+
if (!e.id.toLowerCase().includes(h) && !String(e.name ?? "").toLowerCase().includes(h)) continue;
|
|
864
|
+
let t = e;
|
|
865
|
+
for (; t;) g.add(t.id), t = t.parent ? i.get(t.parent) : null;
|
|
866
|
+
}
|
|
867
|
+
let _ = H[n.grain], v = [];
|
|
868
|
+
function ee(e, t, n = null) {
|
|
869
|
+
if (h && !g.has(e.id)) return;
|
|
870
|
+
let r = o.get(e.id) ?? [], i = r.filter((e) => !h || g.has(e.id)).map((e) => e.id), a = r.length > 0, s = a && (t < _ || m.has(e.id)), c = !!h && i.length > 0;
|
|
871
|
+
if (v.push({
|
|
872
|
+
node: { ...e },
|
|
873
|
+
depth: t,
|
|
874
|
+
parentId: n,
|
|
875
|
+
childIds: i,
|
|
876
|
+
hasChildren: a,
|
|
877
|
+
canExpand: s,
|
|
878
|
+
forcedOpen: c,
|
|
879
|
+
expanded: c || s && m.has(e.id)
|
|
880
|
+
}), h || t < _ || m.has(e.id)) for (let n of r) ee(n, t + 1, e.id);
|
|
881
|
+
}
|
|
882
|
+
for (let e of s) ee(e, 0);
|
|
883
|
+
let te = [];
|
|
884
|
+
function ne(e, t) {
|
|
885
|
+
let n = o.get(e.id) ?? [];
|
|
886
|
+
if (n.length > 0 && (t < _ || m.has(e.id))) for (let e of n) ne(e, t + 1);
|
|
887
|
+
else te.push({ ...e });
|
|
888
|
+
}
|
|
889
|
+
for (let e of s) ne(e, 0);
|
|
890
|
+
let y = n.selectedId ? i.get(n.selectedId) ?? null : null, re = new Set(v.map((e) => e.node.id));
|
|
891
|
+
return {
|
|
892
|
+
state: n,
|
|
893
|
+
rows: v,
|
|
894
|
+
focusedId: n.navigatorFocusedId && re.has(n.navigatorFocusedId) ? n.navigatorFocusedId : v[0]?.node.id ?? null,
|
|
895
|
+
selected: y ? { ...y } : null,
|
|
896
|
+
staleSelectedId: n.selectedId && !y ? n.selectedId : null,
|
|
897
|
+
canvas: {
|
|
898
|
+
allNodes: [...i.values()].map((e) => ({ ...e })),
|
|
899
|
+
nodes: te,
|
|
900
|
+
visibleIds: te.map((e) => e.id),
|
|
901
|
+
selectedId: y?.id ?? null,
|
|
902
|
+
grain: n.grain,
|
|
903
|
+
expandedIds: [...m].sort(et),
|
|
904
|
+
viewport: n.viewport ? { ...n.viewport } : null,
|
|
905
|
+
hierarchy: {
|
|
906
|
+
orderedIds: u,
|
|
907
|
+
rootIds: s.map((e) => e.id),
|
|
908
|
+
childIdsByParent: Object.fromEntries([...o].map(([e, t]) => [e, t.map((e) => e.id)])),
|
|
909
|
+
depthById: Object.fromEntries(l)
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
function Ze(e) {
|
|
915
|
+
if (!K(e) || typeof e.type != "string") throw G("reduce state", "action.type", "the action has no string type", "pass a supported action object");
|
|
916
|
+
let t = qe[e.type];
|
|
917
|
+
if (!t) throw G("reduce state", "action.type", `action ${JSON.stringify(e.type)} is not supported`, `use one of ${Object.keys(qe).join(", ")}`);
|
|
918
|
+
switch ($e(e, t, "reduce state", `action ${e.type}`), e.type) {
|
|
919
|
+
case "replace":
|
|
920
|
+
case "hydrate":
|
|
921
|
+
at(e.state, "state");
|
|
922
|
+
break;
|
|
923
|
+
case "set-presentation":
|
|
924
|
+
Y(e.presentation, B, "presentation");
|
|
925
|
+
break;
|
|
926
|
+
case "select":
|
|
927
|
+
case "toggle-expanded":
|
|
928
|
+
case "open-in-map":
|
|
929
|
+
q(e.id, "id");
|
|
930
|
+
break;
|
|
931
|
+
case "focus":
|
|
932
|
+
tt(e.id, "id");
|
|
933
|
+
break;
|
|
934
|
+
case "set-filter":
|
|
935
|
+
ot(e.filter, "filter");
|
|
936
|
+
break;
|
|
937
|
+
case "set-expanded":
|
|
938
|
+
it(e.ids, "ids");
|
|
939
|
+
break;
|
|
940
|
+
case "set-grain":
|
|
941
|
+
Y(e.grain, V, "grain");
|
|
942
|
+
break;
|
|
943
|
+
case "set-viewport":
|
|
944
|
+
lt(e.viewport, "viewport");
|
|
945
|
+
break;
|
|
946
|
+
case "reveal":
|
|
947
|
+
q(e.id, "id"), Y(e.grain, V, "grain"), it(e.expandedIds, "expandedIds");
|
|
948
|
+
break;
|
|
949
|
+
case "clear-selection": break;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
function G(e, t, n, r) {
|
|
953
|
+
return /* @__PURE__ */ Error(`Code map ${e} failed: what went wrong: invalid ${t}; why: ${n}; where: @peasant-labs/fairtrade/graph ${t}; when: ${e}; what it means: the requested code-map state cannot be used safely; how to fix: ${r}.`);
|
|
954
|
+
}
|
|
955
|
+
function K(e) {
|
|
956
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
957
|
+
}
|
|
958
|
+
function Qe(e, t, n, r) {
|
|
959
|
+
let i = new Set(t), a = Object.keys(e).find((e) => !i.has(e));
|
|
960
|
+
if (a) throw G(n, `${r}.${a}`, `field ${JSON.stringify(a)} is not allowed`, `remove ${JSON.stringify(a)} and use only ${t.join(", ")}`);
|
|
961
|
+
}
|
|
962
|
+
function $e(e, t, n, r) {
|
|
963
|
+
Qe(e, t, n, r);
|
|
964
|
+
let i = t.find((t) => !(t in e));
|
|
965
|
+
if (i) throw G(n, `${r}.${i}`, `required field ${JSON.stringify(i)} is missing`, `provide ${JSON.stringify(i)} for this action`);
|
|
966
|
+
}
|
|
967
|
+
function et(e, t) {
|
|
968
|
+
return e < t ? -1 : +(e > t);
|
|
969
|
+
}
|
|
970
|
+
function q(e, t) {
|
|
971
|
+
if (typeof e != "string" || e.length === 0) throw G("normalize state", t, "the id is not a nonempty string", "provide a nonempty string id");
|
|
972
|
+
return e;
|
|
973
|
+
}
|
|
974
|
+
function tt(e, t) {
|
|
975
|
+
return e === null ? null : q(e, t);
|
|
976
|
+
}
|
|
977
|
+
function nt(e, t) {
|
|
978
|
+
return e == null ? null : q(e, t);
|
|
979
|
+
}
|
|
980
|
+
function rt(e, t) {
|
|
981
|
+
if (e === void 0) return [];
|
|
982
|
+
if (e === null || typeof e == "string" || typeof e[Symbol.iterator] != "function") throw G("normalize state", t, "the value is not an iterable of ids", "provide an array or other iterable of nonempty string ids");
|
|
983
|
+
let n = [...e];
|
|
984
|
+
return [...new Set(n.map((e, n) => q(e, `${t}[${n}]`)))].sort(et);
|
|
985
|
+
}
|
|
986
|
+
function it(e, t) {
|
|
987
|
+
if (e === void 0) throw G("normalize action", t, "the required id iterable is undefined", "provide a non-string iterable of nonempty ids");
|
|
988
|
+
return rt(e, t);
|
|
989
|
+
}
|
|
990
|
+
function at(e, t) {
|
|
991
|
+
if (!K(e)) throw G("normalize action", t, "the required value is not an object", "provide an object");
|
|
992
|
+
return e;
|
|
993
|
+
}
|
|
994
|
+
function ot(e, t) {
|
|
995
|
+
if (typeof e != "string") throw G("normalize action", t, "the required value is not a string", "provide a string");
|
|
996
|
+
return e;
|
|
997
|
+
}
|
|
998
|
+
function J(e, t, n) {
|
|
999
|
+
if (e === void 0) return t;
|
|
1000
|
+
if (typeof e != "string") throw G("normalize state", n, "the value is not a string", "provide a string");
|
|
1001
|
+
return e;
|
|
1002
|
+
}
|
|
1003
|
+
function st(e, t, n, r) {
|
|
1004
|
+
return e === void 0 ? n : Y(e, t, r);
|
|
1005
|
+
}
|
|
1006
|
+
function Y(e, t, n) {
|
|
1007
|
+
if (typeof e != "string" || !t.has(e)) throw G("normalize state", n, `value ${JSON.stringify(e)} is unsupported`, `use one of ${[...t].join(", ")}`);
|
|
1008
|
+
return e;
|
|
1009
|
+
}
|
|
1010
|
+
function ct(e) {
|
|
1011
|
+
if (e == null) return null;
|
|
1012
|
+
if (!K(e)) throw G("normalize state", "viewport", "the viewport is not an object or null", "provide {scale, panX, panY} or null");
|
|
1013
|
+
let { scale: t, panX: n, panY: r } = e;
|
|
1014
|
+
if (!z(t) || typeof n != "number" || typeof r != "number" || !Number.isFinite(n) || !Number.isFinite(r)) throw G("normalize state", "viewport", `scale must be within ${R.min}..${R.max} and pan values must be finite`, `provide finite panX and panY values and a scale within ${R.min}..${R.max}`);
|
|
1015
|
+
return {
|
|
1016
|
+
scale: t,
|
|
1017
|
+
panX: n,
|
|
1018
|
+
panY: r
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
function lt(e, t) {
|
|
1022
|
+
if (e === null) return null;
|
|
1023
|
+
if (e === void 0) throw G("normalize action", t, "the required viewport is undefined", "provide null or a bounded viewport object");
|
|
1024
|
+
return ct(e);
|
|
1025
|
+
}
|
|
1026
|
+
function ut(e, t) {
|
|
1027
|
+
return e === null || t === null ? e === t : e.scale === t.scale && e.panX === t.panX && e.panY === t.panY;
|
|
1028
|
+
}
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region src/ui/MapCanvas.jsx
|
|
1031
|
+
var dt = 56, ft = 104, pt = 248, mt = 132, ht = 28, X = 48, gt = 1200, _t = 1.25, vt = {
|
|
1032
|
+
overview: "project",
|
|
1033
|
+
folders: "package",
|
|
1034
|
+
files: "file"
|
|
1035
|
+
}, yt = Object.fromEntries(Object.entries(vt).map(([e, t]) => [e, U[t]])), bt = [
|
|
1036
|
+
{
|
|
1037
|
+
id: "overview",
|
|
1038
|
+
label: "overview"
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
id: "folders",
|
|
1042
|
+
label: "folders"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
id: "files",
|
|
1046
|
+
label: "files"
|
|
1047
|
+
}
|
|
1048
|
+
], xt = 500, St = 1e4, Ct = 3;
|
|
1049
|
+
function wt(e) {
|
|
1050
|
+
let t = Math.round(Number(e) || 0);
|
|
1051
|
+
return t < 0 ? 0 : t > 4 ? 4 : t;
|
|
1052
|
+
}
|
|
1053
|
+
function Z(e) {
|
|
1054
|
+
let t = String(e ?? ""), n = t.lastIndexOf("/");
|
|
1055
|
+
return n >= 0 ? t.slice(n + 1) : t;
|
|
1056
|
+
}
|
|
1057
|
+
function Tt(e, t) {
|
|
1058
|
+
return e._order === t._order ? e.id < t.id ? -1 : +(e.id > t.id) : e._order - t._order;
|
|
1059
|
+
}
|
|
1060
|
+
function Et(e) {
|
|
1061
|
+
let t = /* @__PURE__ */ new Map();
|
|
1062
|
+
e.forEach((e, n) => {
|
|
1063
|
+
let r = Number.isFinite(e.order) ? e.order : n;
|
|
1064
|
+
t.set(e.id, {
|
|
1065
|
+
...e,
|
|
1066
|
+
_order: r
|
|
1067
|
+
});
|
|
1068
|
+
});
|
|
1069
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [];
|
|
1070
|
+
for (let e of t.values()) {
|
|
1071
|
+
let a = e.parent && t.has(e.parent) ? e.parent : null;
|
|
1072
|
+
if (a) {
|
|
1073
|
+
r.set(e.id, a);
|
|
1074
|
+
let t = n.get(a);
|
|
1075
|
+
t ? t.push(e) : n.set(a, [e]);
|
|
1076
|
+
} else i.push(e);
|
|
1077
|
+
}
|
|
1078
|
+
for (let e of n.values()) e.sort(Tt);
|
|
1079
|
+
i.sort(Tt);
|
|
1080
|
+
let a = /* @__PURE__ */ new Map(), o = [], s = (e, t) => {
|
|
1081
|
+
a.set(e.id, t), o.push(e.id);
|
|
1082
|
+
for (let r of n.get(e.id) ?? []) s(r, t + 1);
|
|
1083
|
+
};
|
|
1084
|
+
for (let e of i) s(e, 0);
|
|
1085
|
+
return {
|
|
1086
|
+
byId: t,
|
|
1087
|
+
children: n,
|
|
1088
|
+
roots: i,
|
|
1089
|
+
parentIdByChild: r,
|
|
1090
|
+
depthById: a,
|
|
1091
|
+
orderedIds: o,
|
|
1092
|
+
canonical: !1
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
function Dt(e, t) {
|
|
1096
|
+
let n = new Map(t.orderedIds.map((e, t) => [e, t])), r = new Map(e.map((e) => [e.id, {
|
|
1097
|
+
...e,
|
|
1098
|
+
_order: n.get(e.id) ?? 2 ** 53 - 1
|
|
1099
|
+
}])), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
1100
|
+
for (let [e, n] of Object.entries(t.childIdsByParent)) {
|
|
1101
|
+
i.set(e, n.map((e) => r.get(e)).filter(Boolean));
|
|
1102
|
+
for (let t of n) a.set(t, e);
|
|
1103
|
+
}
|
|
1104
|
+
return {
|
|
1105
|
+
byId: r,
|
|
1106
|
+
children: i,
|
|
1107
|
+
roots: t.rootIds.map((e) => r.get(e)).filter(Boolean),
|
|
1108
|
+
parentIdByChild: a,
|
|
1109
|
+
depthById: new Map(Object.entries(t.depthById)),
|
|
1110
|
+
orderedIds: [...t.orderedIds],
|
|
1111
|
+
canonical: !0
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
function Ot(e, t) {
|
|
1115
|
+
return t.canonical ? t.depthById.get(e.id) ?? 0 : Number.isFinite(e.layer) ? e.layer : t.depthById.get(e.id) ?? 0;
|
|
1116
|
+
}
|
|
1117
|
+
function kt(e, t, n) {
|
|
1118
|
+
let { children: r, roots: i } = e, a = [], o = (e, i) => {
|
|
1119
|
+
let s = r.get(e.id);
|
|
1120
|
+
if (s && s.length > 0 && (i < t || n.has(e.id))) for (let e of s) o(e, i + 1);
|
|
1121
|
+
else a.push(e);
|
|
1122
|
+
};
|
|
1123
|
+
for (let e of i) o(e, 0);
|
|
1124
|
+
return a;
|
|
1125
|
+
}
|
|
1126
|
+
function At(e, t) {
|
|
1127
|
+
if (e.length === 0) return {
|
|
1128
|
+
positioned: [],
|
|
1129
|
+
width: 0,
|
|
1130
|
+
height: 0
|
|
1131
|
+
};
|
|
1132
|
+
let n = 0;
|
|
1133
|
+
for (let t of e) n = Math.max(n, Math.max(0, Number(t.loc) || 0));
|
|
1134
|
+
let r = (e) => {
|
|
1135
|
+
if (n <= 0) return ft;
|
|
1136
|
+
let t = Math.max(0, Number(e.loc) || 0) / n;
|
|
1137
|
+
return Math.round(ft + t * (pt - ft));
|
|
1138
|
+
}, i = /* @__PURE__ */ new Map();
|
|
1139
|
+
for (let n of e) {
|
|
1140
|
+
let e = Ot(n, t), r = i.get(e);
|
|
1141
|
+
r ? r.push(n) : i.set(e, [n]);
|
|
1142
|
+
}
|
|
1143
|
+
let a = Array.from(i.keys()).sort((e, t) => e - t);
|
|
1144
|
+
for (let e of a) i.get(e).sort(Tt);
|
|
1145
|
+
let o = (e) => e.reduce((e, t) => e + r(t), 0) + ht * (e.length - 1), s = (e) => {
|
|
1146
|
+
let t = [], n = [], i = 0;
|
|
1147
|
+
for (let a of e) {
|
|
1148
|
+
let e = r(a), o = n.length === 0 ? e : e + ht;
|
|
1149
|
+
n.length > 0 && i + o > gt ? (t.push(n), n = [a], i = e) : (n.push(a), i += o);
|
|
1150
|
+
}
|
|
1151
|
+
return n.length > 0 && t.push(n), t;
|
|
1152
|
+
}, c = /* @__PURE__ */ new Map();
|
|
1153
|
+
for (let e of a) c.set(e, s(i.get(e)));
|
|
1154
|
+
let l = 0;
|
|
1155
|
+
for (let e of a) for (let t of c.get(e)) l = Math.max(l, o(t));
|
|
1156
|
+
let u = [], d = 0;
|
|
1157
|
+
for (let e of a) for (let t of c.get(e)) {
|
|
1158
|
+
let e = X + (l - o(t)) / 2, n = X + d * mt;
|
|
1159
|
+
for (let i of t) {
|
|
1160
|
+
let t = r(i);
|
|
1161
|
+
u.push({
|
|
1162
|
+
node: i,
|
|
1163
|
+
x: e,
|
|
1164
|
+
y: n,
|
|
1165
|
+
w: t,
|
|
1166
|
+
h: dt
|
|
1167
|
+
}), e += t + ht;
|
|
1168
|
+
}
|
|
1169
|
+
d += 1;
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
positioned: u,
|
|
1173
|
+
width: l + X * 2,
|
|
1174
|
+
height: (d - 1) * mt + dt + X * 2
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
function jt(e, t) {
|
|
1178
|
+
let n = /* @__PURE__ */ new Map();
|
|
1179
|
+
return (r) => {
|
|
1180
|
+
if (n.has(r)) return n.get(r);
|
|
1181
|
+
let i = r;
|
|
1182
|
+
for (; i != null && !t.has(i);) i = e.get(i) ?? null;
|
|
1183
|
+
return n.set(r, i ?? null), i ?? null;
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
function Mt(e, t, n) {
|
|
1187
|
+
let r = jt(t, n), i = /* @__PURE__ */ new Map();
|
|
1188
|
+
for (let t of e) {
|
|
1189
|
+
let e = r(t.from), n = r(t.to);
|
|
1190
|
+
if (!e || !n || e === n) continue;
|
|
1191
|
+
let a = t.kind === "activity" ? "activity" : "structure", o = `${a}|${e}→${n}`, s = Math.max(0, Number(t.weight) || 1), c = i.get(o);
|
|
1192
|
+
c ? c.weight += s : i.set(o, {
|
|
1193
|
+
from: e,
|
|
1194
|
+
to: n,
|
|
1195
|
+
kind: a,
|
|
1196
|
+
weight: s
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
return Array.from(i.values()).sort((e, t) => e.from === t.from ? e.to < t.to ? -1 : +(e.to > t.to) : e.from < t.from ? -1 : 1);
|
|
1200
|
+
}
|
|
1201
|
+
function Nt(e, t, n) {
|
|
1202
|
+
let r = jt(t, n), i = /* @__PURE__ */ new Map();
|
|
1203
|
+
for (let t of e) {
|
|
1204
|
+
let e = Math.max(0, Number(t.violations) || 0);
|
|
1205
|
+
if (e <= 0) continue;
|
|
1206
|
+
let n = r(t.id);
|
|
1207
|
+
n && i.set(n, (i.get(n) || 0) + e);
|
|
1208
|
+
}
|
|
1209
|
+
return i;
|
|
1210
|
+
}
|
|
1211
|
+
function Pt(e) {
|
|
1212
|
+
let t;
|
|
1213
|
+
for (let n of e) (!t || n.y < t.y || n.y === t.y && n.x < t.x) && (t = n);
|
|
1214
|
+
return t;
|
|
1215
|
+
}
|
|
1216
|
+
function Ft(e, t, n) {
|
|
1217
|
+
let r = e.filter((e) => e.y === t.y).sort((e, t) => e.x - t.x), i = r.findIndex((e) => e.node.id === t.node.id);
|
|
1218
|
+
if (i !== -1) return r[i + n];
|
|
1219
|
+
}
|
|
1220
|
+
function It(e, t, n) {
|
|
1221
|
+
let r;
|
|
1222
|
+
for (let i of e) (i.y - t.y) * n <= 0 || (r === void 0 || (i.y - r) * n < 0) && (r = i.y);
|
|
1223
|
+
if (r === void 0) return;
|
|
1224
|
+
let i = t.x + t.w / 2, a;
|
|
1225
|
+
for (let t of e) if (t.y === r) {
|
|
1226
|
+
if (!a) {
|
|
1227
|
+
a = t;
|
|
1228
|
+
continue;
|
|
1229
|
+
}
|
|
1230
|
+
Math.abs(t.x + t.w / 2 - i) < Math.abs(a.x + a.w / 2 - i) && (a = t);
|
|
1231
|
+
}
|
|
1232
|
+
return a;
|
|
1233
|
+
}
|
|
1234
|
+
function Lt({ data: d = {
|
|
1235
|
+
nodes: [],
|
|
1236
|
+
edges: []
|
|
1237
|
+
}, grain: f = "folders", expandedIds: m, visibleIds: h, hierarchy: v, selectedId: y, highlightedIds: ie, nodeDeltas: oe = {}, edgeDeltas: se = {}, onSelect: ce, onGrainChange: le, onExpandedIdsChange: b, onExpand: ue, height: de = 520, ariaLabel: fe = "code map", className: pe = "", viewport: x, onViewportChange: me, onStateAction: S, canonicalControlled: C = !1 }) {
|
|
1238
|
+
let w = d?.nodes ?? [], he = d?.edges ?? [], ge = r().replace(/[:]/g, ""), _e = `${ge}-live`, ve = `${ge}-list`, [ye, be] = o(yt[f] === void 0 ? "folders" : f), [xe, Se] = o(() => zt(m)), [Ce, T] = o(y ?? null), [E, we] = o(null), [Te, Ee] = o(() => Bt(x?.scale) ? x.scale : 1), [De, Oe] = o(() => ({
|
|
1239
|
+
x: Q(x?.panX, 0),
|
|
1240
|
+
y: Q(x?.panY, 0)
|
|
1241
|
+
})), [ke, Ae] = o(""), [je, Me] = o(!1), D = a(null), O = a(null), [k, Ne] = o(null), Pe = a(null), A = a(!1), Fe = a(x != null), Ie = x && Bt(x.scale) ? `${x.scale}|${Q(x.panX, 0)}|${Q(x.panY, 0)}` : "", Le = a(Ie), j = a(Ie), Re = a(!1), ze = a(f), Be = a(y), Ve = Vt(m), He = Vt(ie), M = C ? yt[f] === void 0 ? "folders" : f : ye, N = i(() => C ? zt(m) : xe, [
|
|
1242
|
+
C,
|
|
1243
|
+
Ve,
|
|
1244
|
+
xe
|
|
1245
|
+
]), P = C ? y ?? null : Ce, F = C && x != null && Bt(x.scale), I = k ? k.scale : F ? x.scale : Te, L = k ? {
|
|
1246
|
+
x: k.panX,
|
|
1247
|
+
y: k.panY
|
|
1248
|
+
} : F ? {
|
|
1249
|
+
x: Q(x.panX, 0),
|
|
1250
|
+
y: Q(x.panY, 0)
|
|
1251
|
+
} : De, Ue = a(I), We = a(L);
|
|
1252
|
+
Ue.current = I, We.current = L, n(() => {
|
|
1253
|
+
if (k && !O.current) {
|
|
1254
|
+
if (F && x.scale === k.scale && Q(x.panX, 0) === k.panX && Q(x.panY, 0) === k.panY) {
|
|
1255
|
+
Ne(null);
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
return Pe.current = setTimeout(() => Ne(null), xt), () => clearTimeout(Pe.current);
|
|
1259
|
+
}
|
|
1260
|
+
}, [
|
|
1261
|
+
k,
|
|
1262
|
+
F,
|
|
1263
|
+
x?.scale,
|
|
1264
|
+
x?.panX,
|
|
1265
|
+
x?.panY
|
|
1266
|
+
]), n(() => {
|
|
1267
|
+
C || f !== ze.current && (ze.current = f, yt[f] !== void 0 && be(f));
|
|
1268
|
+
}, [C, f]), n(() => {
|
|
1269
|
+
!C && m !== void 0 && Se(zt(m));
|
|
1270
|
+
}, [C, Ve]), n(() => {
|
|
1271
|
+
C || y !== Be.current && (Be.current = y, y !== void 0 && T(y));
|
|
1272
|
+
}, [C, y]), n(() => {
|
|
1273
|
+
if (C) {
|
|
1274
|
+
if (!x && j.current !== "") j.current = "", Fe.current = !1, A.current = !1, Ee(1), Oe({
|
|
1275
|
+
x: 0,
|
|
1276
|
+
y: 0
|
|
1277
|
+
});
|
|
1278
|
+
else if (x && Bt(x.scale)) {
|
|
1279
|
+
let e = `${x.scale}|${Q(x.panX, 0)}|${Q(x.panY, 0)}`;
|
|
1280
|
+
e !== j.current && (j.current = e, Fe.current = !0);
|
|
1281
|
+
}
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
if (!x) {
|
|
1285
|
+
if (j.current === "") return;
|
|
1286
|
+
j.current = "", Le.current = "1|0|0", Fe.current = !1, Ee(1), Oe({
|
|
1287
|
+
x: 0,
|
|
1288
|
+
y: 0
|
|
1289
|
+
});
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
if (!Bt(x.scale)) return;
|
|
1293
|
+
let e = `${x.scale}|${Q(x.panX, 0)}|${Q(x.panY, 0)}`;
|
|
1294
|
+
e !== j.current && (j.current = e, Fe.current = !0, Le.current = e, Ee(x.scale), Oe({
|
|
1295
|
+
x: Q(x.panX, 0),
|
|
1296
|
+
y: Q(x.panY, 0)
|
|
1297
|
+
}));
|
|
1298
|
+
}, [
|
|
1299
|
+
C,
|
|
1300
|
+
x,
|
|
1301
|
+
x?.scale,
|
|
1302
|
+
x?.panX,
|
|
1303
|
+
x?.panY
|
|
1304
|
+
]), n(() => {
|
|
1305
|
+
if (C || !me && !S) return;
|
|
1306
|
+
let e = `${I}|${L.x}|${L.y}`;
|
|
1307
|
+
Le.current !== e && (Le.current = e, me?.({
|
|
1308
|
+
scale: I,
|
|
1309
|
+
panX: L.x,
|
|
1310
|
+
panY: L.y
|
|
1311
|
+
}), Re.current && (Re.current = !1, S?.({
|
|
1312
|
+
type: "set-viewport",
|
|
1313
|
+
viewport: {
|
|
1314
|
+
scale: I,
|
|
1315
|
+
panX: L.x,
|
|
1316
|
+
panY: L.y
|
|
1317
|
+
}
|
|
1318
|
+
})));
|
|
1319
|
+
}, [
|
|
1320
|
+
C,
|
|
1321
|
+
S,
|
|
1322
|
+
me,
|
|
1323
|
+
L.x,
|
|
1324
|
+
L.y,
|
|
1325
|
+
I
|
|
1326
|
+
]);
|
|
1327
|
+
let z = i(() => v ? Dt(w, v) : Et(w), [w, v]), Ge = i(() => h === void 0 ? kt(z, yt[M], N) : Array.from(h, (e) => z.byId.get(e)).filter(Boolean), [
|
|
1328
|
+
z,
|
|
1329
|
+
M,
|
|
1330
|
+
N,
|
|
1331
|
+
Vt(h)
|
|
1332
|
+
]), B = i(() => new Set(Ge.map((e) => e.id)), [Ge]), { positioned: V, width: H, height: U } = i(() => At(Ge, z), [Ge, z]), Ke = i(() => {
|
|
1333
|
+
let e = /* @__PURE__ */ new Map();
|
|
1334
|
+
for (let t of V) e.set(t.node.id, t);
|
|
1335
|
+
return e;
|
|
1336
|
+
}, [V]), qe = i(() => {
|
|
1337
|
+
let e = /* @__PURE__ */ new Map();
|
|
1338
|
+
for (let [t, n] of z.children) e.set(t, n.length);
|
|
1339
|
+
return e;
|
|
1340
|
+
}, [z]), W = i(() => Mt(he, z.parentIdByChild, B), [
|
|
1341
|
+
he,
|
|
1342
|
+
z.parentIdByChild,
|
|
1343
|
+
B
|
|
1344
|
+
]), Je = i(() => W.reduce((e, t) => Math.max(e, t.weight), 1), [W]), Ye = i(() => Nt(w, z.parentIdByChild, B), [
|
|
1345
|
+
w,
|
|
1346
|
+
z.parentIdByChild,
|
|
1347
|
+
B
|
|
1348
|
+
]), Xe = i(() => {
|
|
1349
|
+
let e = zt(ie);
|
|
1350
|
+
if (e.size === 0) return e;
|
|
1351
|
+
let t = jt(z.parentIdByChild, B), n = /* @__PURE__ */ new Set();
|
|
1352
|
+
for (let r of e) {
|
|
1353
|
+
let e = t(r);
|
|
1354
|
+
e && n.add(e);
|
|
1355
|
+
}
|
|
1356
|
+
return n;
|
|
1357
|
+
}, [
|
|
1358
|
+
He,
|
|
1359
|
+
z.parentIdByChild,
|
|
1360
|
+
B
|
|
1361
|
+
]), Ze = i(() => {
|
|
1362
|
+
let e = ke.trim().toLowerCase();
|
|
1363
|
+
return e ? w.filter((t) => t.id.toLowerCase().includes(e) || (t.label || "").toLowerCase().includes(e)).slice(0, 8) : [];
|
|
1364
|
+
}, [w, ke]), G = t((e) => {
|
|
1365
|
+
me?.(e), S?.({
|
|
1366
|
+
type: "set-viewport",
|
|
1367
|
+
viewport: e
|
|
1368
|
+
});
|
|
1369
|
+
}, [S, me]), K = t((e, t) => {
|
|
1370
|
+
if (C && t) {
|
|
1371
|
+
G(e);
|
|
1372
|
+
return;
|
|
1373
|
+
}
|
|
1374
|
+
t && (Re.current = !0), Ee(e.scale), Oe({
|
|
1375
|
+
x: e.panX,
|
|
1376
|
+
y: e.panY
|
|
1377
|
+
});
|
|
1378
|
+
}, [C, G]), Qe = t((e = !1) => {
|
|
1379
|
+
let t = D.current;
|
|
1380
|
+
if (!t || H <= 0 || U <= 0) return;
|
|
1381
|
+
let n = t.clientWidth, r = t.clientHeight;
|
|
1382
|
+
if (n <= 0 || r <= 0) return;
|
|
1383
|
+
let i = Math.min(n / H, r / U), a = Math.max(R.min, Math.min(R.max, i));
|
|
1384
|
+
K({
|
|
1385
|
+
scale: a,
|
|
1386
|
+
panX: (n - H * a) / 2,
|
|
1387
|
+
panY: (r - U * a) / 2
|
|
1388
|
+
}, e);
|
|
1389
|
+
}, [
|
|
1390
|
+
K,
|
|
1391
|
+
H,
|
|
1392
|
+
U
|
|
1393
|
+
]), $e = t((e, t = !1) => {
|
|
1394
|
+
let n = D.current;
|
|
1395
|
+
if (!n) return !1;
|
|
1396
|
+
let r = n.clientWidth, i = n.clientHeight;
|
|
1397
|
+
if (r <= 0 || i <= 0) return !1;
|
|
1398
|
+
let a = V.filter((t) => e.has(t.node.id));
|
|
1399
|
+
if (a.length === 0) return !1;
|
|
1400
|
+
let o = Math.min(...a.map((e) => e.x)), s = Math.min(...a.map((e) => e.y)), c = Math.max(...a.map((e) => e.x + e.w)), l = Math.max(...a.map((e) => e.y + e.h)), u = c - o, d = l - s;
|
|
1401
|
+
if (u <= 0 || d <= 0) return !1;
|
|
1402
|
+
let f = Math.min(r / u, i / d), p = Math.max(R.min, Math.min(R.max, f));
|
|
1403
|
+
return K({
|
|
1404
|
+
scale: p,
|
|
1405
|
+
panX: r / 2 - (o + u / 2) * p,
|
|
1406
|
+
panY: i / 2 - (s + d / 2) * p
|
|
1407
|
+
}, t), !0;
|
|
1408
|
+
}, [K, V]), [et, q] = o(!1);
|
|
1409
|
+
n(() => {
|
|
1410
|
+
if (!et) return;
|
|
1411
|
+
let e = window.setTimeout(() => q(!1), 200);
|
|
1412
|
+
return () => window.clearTimeout(e);
|
|
1413
|
+
}, [et]);
|
|
1414
|
+
let tt = i(() => V.map((e) => e.node.id).join("|"), [V]), nt = F ? `canonical|${x.scale}|${Q(x.panX, 0)}|${Q(x.panY, 0)}` : C ? "canonical|auto-fit" : "legacy", rt = a(N);
|
|
1415
|
+
n(() => {
|
|
1416
|
+
let e = rt.current;
|
|
1417
|
+
if (rt.current = N, Fe.current) {
|
|
1418
|
+
Fe.current = !1, A.current = !0;
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
if (!A.current) {
|
|
1422
|
+
A.current = !0, Qe(F);
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
let t = null;
|
|
1426
|
+
for (let n of N) if (!e.has(n)) {
|
|
1427
|
+
t = n;
|
|
1428
|
+
break;
|
|
1429
|
+
}
|
|
1430
|
+
if (t) {
|
|
1431
|
+
let e = /* @__PURE__ */ new Set([t]), n = [t];
|
|
1432
|
+
for (; n.length > 0;) {
|
|
1433
|
+
let t = n.pop();
|
|
1434
|
+
for (let r of z.children.get(t) ?? []) e.add(r.id), n.push(r.id);
|
|
1435
|
+
}
|
|
1436
|
+
let r = [...e].filter((e) => B.has(e));
|
|
1437
|
+
if (q(!0), r.length > 0 && $e(new Set(r), !0)) return;
|
|
1438
|
+
}
|
|
1439
|
+
Qe(F);
|
|
1440
|
+
}, [tt, nt]);
|
|
1441
|
+
let it = t((e) => {
|
|
1442
|
+
let t = D.current, n = t ? t.clientWidth / 2 : 0, r = t ? t.clientHeight / 2 : 0, i = Ue.current, a = Math.max(R.min, Math.min(R.max, i * e));
|
|
1443
|
+
if (a === i) return;
|
|
1444
|
+
let o = We.current;
|
|
1445
|
+
K({
|
|
1446
|
+
scale: a,
|
|
1447
|
+
panX: n - (n - o.x) / i * a,
|
|
1448
|
+
panY: r - (r - o.y) / i * a
|
|
1449
|
+
}, !0);
|
|
1450
|
+
}, [K]), at = t((e) => {
|
|
1451
|
+
if (!(e.ctrlKey || e.metaKey)) return;
|
|
1452
|
+
e.preventDefault();
|
|
1453
|
+
let t = D.current;
|
|
1454
|
+
if (!t) return;
|
|
1455
|
+
let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = Ue.current, o = Math.exp(-e.deltaY * .01), s = Math.max(1 / _t, Math.min(_t, o)), c = Math.max(R.min, Math.min(R.max, a * s));
|
|
1456
|
+
if (c === a) return;
|
|
1457
|
+
let l = We.current;
|
|
1458
|
+
K({
|
|
1459
|
+
scale: c,
|
|
1460
|
+
panX: r - (r - l.x) / a * c,
|
|
1461
|
+
panY: i - (i - l.y) / a * c
|
|
1462
|
+
}, !0);
|
|
1463
|
+
}, [K]);
|
|
1464
|
+
n(() => {
|
|
1465
|
+
let e = D.current;
|
|
1466
|
+
if (e) return e.addEventListener("wheel", at, { passive: !1 }), () => e.removeEventListener("wheel", at);
|
|
1467
|
+
}, [at]);
|
|
1468
|
+
let ot = t((e) => {
|
|
1469
|
+
let t = Ke.get(e), n = D.current;
|
|
1470
|
+
if (!t || !n) return;
|
|
1471
|
+
let r = Math.max(I, 1);
|
|
1472
|
+
K({
|
|
1473
|
+
scale: r,
|
|
1474
|
+
panX: n.clientWidth / 2 - (t.x + t.w / 2) * r,
|
|
1475
|
+
panY: n.clientHeight / 2 - (t.y + t.h / 2) * r
|
|
1476
|
+
}, !0);
|
|
1477
|
+
}, [
|
|
1478
|
+
K,
|
|
1479
|
+
Ke,
|
|
1480
|
+
I
|
|
1481
|
+
]), J = t((e) => {
|
|
1482
|
+
if (C && e === P) return;
|
|
1483
|
+
C || T(e), S?.(e ? {
|
|
1484
|
+
type: "select",
|
|
1485
|
+
id: e
|
|
1486
|
+
} : { type: "clear-selection" });
|
|
1487
|
+
let t = e ? z.byId.get(e) : null;
|
|
1488
|
+
ce?.(e, t ? Rt(t) : null);
|
|
1489
|
+
}, [
|
|
1490
|
+
C,
|
|
1491
|
+
ce,
|
|
1492
|
+
S,
|
|
1493
|
+
P,
|
|
1494
|
+
z.byId
|
|
1495
|
+
]), st = t((e) => {
|
|
1496
|
+
C || (be(e), Se(/* @__PURE__ */ new Set())), S?.({
|
|
1497
|
+
type: "set-grain",
|
|
1498
|
+
grain: vt[e]
|
|
1499
|
+
}), le?.(e), C || b?.([]);
|
|
1500
|
+
}, [
|
|
1501
|
+
C,
|
|
1502
|
+
b,
|
|
1503
|
+
le,
|
|
1504
|
+
S
|
|
1505
|
+
]), [Y, ct] = o(null), [lt, ut] = o("");
|
|
1506
|
+
n(() => {
|
|
1507
|
+
Y && !N.has(Y) && ct(null);
|
|
1508
|
+
}, [Y, N]);
|
|
1509
|
+
let dt = t((e) => {
|
|
1510
|
+
if ((qe.get(e) || 0) === 0) return;
|
|
1511
|
+
let t = z.byId.get(e), n = new Set(N);
|
|
1512
|
+
if (n.has(e)) n.delete(e), ct((t) => {
|
|
1513
|
+
if (t !== e) return t;
|
|
1514
|
+
let r = z.parentIdByChild.get(e) ?? null;
|
|
1515
|
+
return r && n.has(r) ? r : null;
|
|
1516
|
+
}), ut(`closed ${Z(t?.label || e)}`);
|
|
1517
|
+
else {
|
|
1518
|
+
n.add(e), ue?.(e), ct(e);
|
|
1519
|
+
let r = qe.get(e) || 0;
|
|
1520
|
+
ut(`opened ${Z(t?.label || e)}, showing ${r} item${r === 1 ? "" : "s"}`);
|
|
1521
|
+
}
|
|
1522
|
+
C || Se(n), S?.({
|
|
1523
|
+
type: "set-expanded",
|
|
1524
|
+
ids: Array.from(n)
|
|
1525
|
+
}), b?.(Array.from(n));
|
|
1526
|
+
}, [
|
|
1527
|
+
C,
|
|
1528
|
+
qe,
|
|
1529
|
+
N,
|
|
1530
|
+
ue,
|
|
1531
|
+
b,
|
|
1532
|
+
S,
|
|
1533
|
+
z.byId,
|
|
1534
|
+
z.parentIdByChild
|
|
1535
|
+
]), ft = i(() => {
|
|
1536
|
+
if (!Y) return [];
|
|
1537
|
+
let e = [], t = Y;
|
|
1538
|
+
for (; t;) {
|
|
1539
|
+
let n = z.byId.get(t);
|
|
1540
|
+
if (!n) break;
|
|
1541
|
+
e.unshift(n), t = z.parentIdByChild.get(t) ?? null;
|
|
1542
|
+
}
|
|
1543
|
+
return e;
|
|
1544
|
+
}, [Y, z]), pt = t(() => {
|
|
1545
|
+
C || Se(/* @__PURE__ */ new Set()), S?.({
|
|
1546
|
+
type: "set-expanded",
|
|
1547
|
+
ids: []
|
|
1548
|
+
}), b?.([]), ct(null), ut("back to the top level");
|
|
1549
|
+
}, [
|
|
1550
|
+
C,
|
|
1551
|
+
b,
|
|
1552
|
+
S
|
|
1553
|
+
]), mt = t((e) => {
|
|
1554
|
+
let t = ft.slice(0, e + 1), n = t.map((e) => e.id), r = new Set(n);
|
|
1555
|
+
C || Se(r), S?.({
|
|
1556
|
+
type: "set-expanded",
|
|
1557
|
+
ids: n
|
|
1558
|
+
}), b?.(n);
|
|
1559
|
+
let i = t[t.length - 1] ?? null;
|
|
1560
|
+
ct(i?.id ?? null), ut(i ? `back to ${Z(i.label || i.id)}` : "back to the top level");
|
|
1561
|
+
}, [
|
|
1562
|
+
ft,
|
|
1563
|
+
C,
|
|
1564
|
+
b,
|
|
1565
|
+
S
|
|
1566
|
+
]), ht = t((e) => {
|
|
1567
|
+
let t = e.key;
|
|
1568
|
+
if (t === "+" || t === "=") {
|
|
1569
|
+
e.preventDefault(), it(_t);
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
if (t === "-" || t === "_") {
|
|
1573
|
+
e.preventDefault(), it(1 / _t);
|
|
1574
|
+
return;
|
|
1575
|
+
}
|
|
1576
|
+
if (t === "0") {
|
|
1577
|
+
e.preventDefault(), Qe(!0);
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
if (t === "ArrowLeft" || t === "ArrowRight" || t === "ArrowUp" || t === "ArrowDown") {
|
|
1581
|
+
e.preventDefault();
|
|
1582
|
+
let n = E ? Ke.get(E) : void 0;
|
|
1583
|
+
if (!n) {
|
|
1584
|
+
let e = Pt(V);
|
|
1585
|
+
e && we(e.node.id);
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
let r;
|
|
1589
|
+
r = t === "ArrowLeft" ? Ft(V, n, -1) : t === "ArrowRight" ? Ft(V, n, 1) : t === "ArrowUp" ? It(V, n, -1) : It(V, n, 1), r && (we(r.node.id), Gt(r, D.current, I, L, (e) => {
|
|
1590
|
+
K({
|
|
1591
|
+
scale: I,
|
|
1592
|
+
panX: e.x,
|
|
1593
|
+
panY: e.y
|
|
1594
|
+
}, !0);
|
|
1595
|
+
}));
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
if (t === "Enter") {
|
|
1599
|
+
if (!E) return;
|
|
1600
|
+
e.preventDefault(), e.shiftKey ? dt(E) : C ? P !== E && J(E) : J(P === E ? null : E);
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
if (t === "e" || t === "E") {
|
|
1604
|
+
if (!E) return;
|
|
1605
|
+
e.preventDefault(), dt(E);
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
t === "Escape" && P && (e.preventDefault(), J(null));
|
|
1609
|
+
}, [
|
|
1610
|
+
E,
|
|
1611
|
+
V,
|
|
1612
|
+
Ke,
|
|
1613
|
+
P,
|
|
1614
|
+
I,
|
|
1615
|
+
L,
|
|
1616
|
+
C,
|
|
1617
|
+
K,
|
|
1618
|
+
it,
|
|
1619
|
+
Qe,
|
|
1620
|
+
dt,
|
|
1621
|
+
J
|
|
1622
|
+
]), X = t((e) => {
|
|
1623
|
+
let t = O.current;
|
|
1624
|
+
if (!t || e !== t.pointerId) return;
|
|
1625
|
+
O.current = null;
|
|
1626
|
+
let n = D.current;
|
|
1627
|
+
try {
|
|
1628
|
+
n?.releasePointerCapture?.(e);
|
|
1629
|
+
} catch {}
|
|
1630
|
+
C && Ne(null);
|
|
1631
|
+
}, [C]), gt = t((e) => {
|
|
1632
|
+
if (e.button !== 0 || e.target instanceof Element && e.target.closest("button, a, input, select, textarea")) return;
|
|
1633
|
+
if (O.current) {
|
|
1634
|
+
if (Date.now() - O.current.startedAt < St) return;
|
|
1635
|
+
X(O.current.pointerId);
|
|
1636
|
+
}
|
|
1637
|
+
let t = D.current;
|
|
1638
|
+
t && t.setPointerCapture?.(e.pointerId), O.current = {
|
|
1639
|
+
pointerId: e.pointerId,
|
|
1640
|
+
startX: e.clientX,
|
|
1641
|
+
startY: e.clientY,
|
|
1642
|
+
panX: L.x,
|
|
1643
|
+
panY: L.y,
|
|
1644
|
+
moved: !1,
|
|
1645
|
+
nextPan: null,
|
|
1646
|
+
startedAt: Date.now()
|
|
1647
|
+
};
|
|
1648
|
+
}, [L, X]), Ct = t((e) => {
|
|
1649
|
+
let t = O.current;
|
|
1650
|
+
if (!t || e.pointerId !== t.pointerId) return;
|
|
1651
|
+
let n = e.clientX - t.startX, r = e.clientY - t.startY;
|
|
1652
|
+
!t.moved && Math.abs(n) + Math.abs(r) > 3 && (t.moved = !0), t.moved && (t.nextPan = {
|
|
1653
|
+
scale: Ue.current,
|
|
1654
|
+
panX: t.panX + n,
|
|
1655
|
+
panY: t.panY + r
|
|
1656
|
+
}, C ? Ne(t.nextPan) : K(t.nextPan, !0));
|
|
1657
|
+
}, [K, C]), Tt = t((e) => {
|
|
1658
|
+
let t = O.current;
|
|
1659
|
+
if (!t || e.pointerId !== t.pointerId) return;
|
|
1660
|
+
O.current = null;
|
|
1661
|
+
let n = D.current;
|
|
1662
|
+
try {
|
|
1663
|
+
n?.releasePointerCapture?.(e.pointerId);
|
|
1664
|
+
} catch {}
|
|
1665
|
+
t.moved && C && t.nextPan && (K(t.nextPan, !0), Ne({ ...t.nextPan })), !t.moved && e.target === e.currentTarget && J(null);
|
|
1666
|
+
}, [
|
|
1667
|
+
K,
|
|
1668
|
+
C,
|
|
1669
|
+
J
|
|
1670
|
+
]), Ot = t((e) => X(e.pointerId), [X]), Lt = t((e) => X(e.pointerId), [X]), Jt = i(() => {
|
|
1671
|
+
if (!E) return "";
|
|
1672
|
+
let e = z.byId.get(E);
|
|
1673
|
+
return e ? Wt(e, {
|
|
1674
|
+
selected: P === E,
|
|
1675
|
+
expanded: N.has(E),
|
|
1676
|
+
violations: Ye.get(E) || 0
|
|
1677
|
+
}) : "";
|
|
1678
|
+
}, [
|
|
1679
|
+
E,
|
|
1680
|
+
z.byId,
|
|
1681
|
+
P,
|
|
1682
|
+
N,
|
|
1683
|
+
Ye
|
|
1684
|
+
]), $ = i(() => {
|
|
1685
|
+
let e = D.current;
|
|
1686
|
+
if (!e || H <= 0 || U <= 0) return null;
|
|
1687
|
+
let t = e.clientWidth, n = e.clientHeight;
|
|
1688
|
+
return {
|
|
1689
|
+
graphW: H,
|
|
1690
|
+
graphH: U,
|
|
1691
|
+
viewX: -L.x / I,
|
|
1692
|
+
viewY: -L.y / I,
|
|
1693
|
+
viewW: t / I,
|
|
1694
|
+
viewH: n / I
|
|
1695
|
+
};
|
|
1696
|
+
}, [
|
|
1697
|
+
L,
|
|
1698
|
+
I,
|
|
1699
|
+
H,
|
|
1700
|
+
U
|
|
1701
|
+
]), Yt = V.length === 0, Xt = (e) => `${ge}-grain-${e}`;
|
|
1702
|
+
return /* @__PURE__ */ l("div", {
|
|
1703
|
+
className: ["mc", pe].filter(Boolean).join(" "),
|
|
1704
|
+
style: { height: de },
|
|
1705
|
+
role: "application",
|
|
1706
|
+
"aria-label": fe,
|
|
1707
|
+
"aria-roledescription": "code structure map",
|
|
1708
|
+
children: [
|
|
1709
|
+
/* @__PURE__ */ c("div", {
|
|
1710
|
+
id: _e,
|
|
1711
|
+
className: "mc-sr",
|
|
1712
|
+
role: "status",
|
|
1713
|
+
"aria-live": "polite",
|
|
1714
|
+
children: Jt
|
|
1715
|
+
}),
|
|
1716
|
+
/* @__PURE__ */ l("div", {
|
|
1717
|
+
className: "mc-toolbar",
|
|
1718
|
+
children: [/* @__PURE__ */ c("div", {
|
|
1719
|
+
className: "mc-seg",
|
|
1720
|
+
role: "radiogroup",
|
|
1721
|
+
"aria-label": "detail grain",
|
|
1722
|
+
children: bt.map((e) => /* @__PURE__ */ l("button", {
|
|
1723
|
+
id: Xt(e.id),
|
|
1724
|
+
type: "button",
|
|
1725
|
+
role: "radio",
|
|
1726
|
+
"aria-checked": M === e.id,
|
|
1727
|
+
className: "mc-seg-btn mono",
|
|
1728
|
+
"data-active": M === e.id ? "true" : void 0,
|
|
1729
|
+
onClick: () => st(e.id),
|
|
1730
|
+
children: [M === e.id && /* @__PURE__ */ c(u, {
|
|
1731
|
+
className: "lucide",
|
|
1732
|
+
"aria-hidden": "true"
|
|
1733
|
+
}), e.label]
|
|
1734
|
+
}, e.id))
|
|
1735
|
+
}), /* @__PURE__ */ l("div", {
|
|
1736
|
+
className: "mc-search",
|
|
1737
|
+
role: "combobox",
|
|
1738
|
+
"aria-expanded": je && Ze.length > 0,
|
|
1739
|
+
"aria-haspopup": "listbox",
|
|
1740
|
+
"aria-owns": ve,
|
|
1741
|
+
children: [
|
|
1742
|
+
/* @__PURE__ */ c(re, {
|
|
1743
|
+
className: "lucide mc-search-ico",
|
|
1744
|
+
"aria-hidden": "true"
|
|
1745
|
+
}),
|
|
1746
|
+
/* @__PURE__ */ c("input", {
|
|
1747
|
+
className: "mc-search-input mono",
|
|
1748
|
+
type: "text",
|
|
1749
|
+
placeholder: "find a node",
|
|
1750
|
+
"aria-label": "find a node",
|
|
1751
|
+
"aria-controls": ve,
|
|
1752
|
+
"aria-autocomplete": "list",
|
|
1753
|
+
value: ke,
|
|
1754
|
+
onChange: (e) => {
|
|
1755
|
+
Ae(e.target.value), Me(!0);
|
|
1756
|
+
},
|
|
1757
|
+
onFocus: () => Me(!0),
|
|
1758
|
+
onBlur: () => {
|
|
1759
|
+
window.setTimeout(() => Me(!1), 120);
|
|
1760
|
+
},
|
|
1761
|
+
onKeyDown: (e) => {
|
|
1762
|
+
e.key === "Enter" && Ze[0] ? (e.preventDefault(), Zt(Ze[0])) : e.key === "Escape" && Me(!1);
|
|
1763
|
+
}
|
|
1764
|
+
}),
|
|
1765
|
+
je && Ze.length > 0 && /* @__PURE__ */ c("ul", {
|
|
1766
|
+
className: "mc-results",
|
|
1767
|
+
id: ve,
|
|
1768
|
+
role: "listbox",
|
|
1769
|
+
"aria-label": "search results",
|
|
1770
|
+
children: Ze.map((e) => /* @__PURE__ */ l("li", {
|
|
1771
|
+
role: "option",
|
|
1772
|
+
"aria-selected": e.id === P,
|
|
1773
|
+
className: "mc-result mono",
|
|
1774
|
+
onMouseDown: (t) => {
|
|
1775
|
+
t.preventDefault(), Zt(e);
|
|
1776
|
+
},
|
|
1777
|
+
children: [e.kind === "folder" ? /* @__PURE__ */ c(_, {
|
|
1778
|
+
className: "lucide",
|
|
1779
|
+
"aria-hidden": "true"
|
|
1780
|
+
}) : /* @__PURE__ */ c(g, {
|
|
1781
|
+
className: "lucide",
|
|
1782
|
+
"aria-hidden": "true"
|
|
1783
|
+
}), /* @__PURE__ */ c("span", {
|
|
1784
|
+
className: "mc-result-path",
|
|
1785
|
+
children: e.id
|
|
1786
|
+
})]
|
|
1787
|
+
}, e.id))
|
|
1788
|
+
})
|
|
1789
|
+
]
|
|
1790
|
+
})]
|
|
1791
|
+
}),
|
|
1792
|
+
/* @__PURE__ */ c("div", {
|
|
1793
|
+
className: "mc-sr",
|
|
1794
|
+
role: "status",
|
|
1795
|
+
"aria-live": "polite",
|
|
1796
|
+
children: lt
|
|
1797
|
+
}),
|
|
1798
|
+
ft.length > 0 && /* @__PURE__ */ l("nav", {
|
|
1799
|
+
className: "mc-breadcrumb mono",
|
|
1800
|
+
"aria-label": "folder path",
|
|
1801
|
+
children: [/* @__PURE__ */ c("button", {
|
|
1802
|
+
type: "button",
|
|
1803
|
+
className: "mc-breadcrumb-crumb",
|
|
1804
|
+
onClick: pt,
|
|
1805
|
+
children: "top level"
|
|
1806
|
+
}), ft.map((t, n) => /* @__PURE__ */ l(e, { children: [/* @__PURE__ */ c(p, {
|
|
1807
|
+
className: "lucide mc-breadcrumb-sep",
|
|
1808
|
+
"aria-hidden": "true"
|
|
1809
|
+
}), n === ft.length - 1 ? /* @__PURE__ */ c("span", {
|
|
1810
|
+
className: "mc-breadcrumb-crumb mc-breadcrumb-current",
|
|
1811
|
+
"aria-current": "location",
|
|
1812
|
+
children: Z(t.label || t.id)
|
|
1813
|
+
}) : /* @__PURE__ */ c("button", {
|
|
1814
|
+
type: "button",
|
|
1815
|
+
className: "mc-breadcrumb-crumb",
|
|
1816
|
+
onClick: () => mt(n),
|
|
1817
|
+
children: Z(t.label || t.id)
|
|
1818
|
+
})] }, t.id))]
|
|
1819
|
+
}),
|
|
1820
|
+
/* @__PURE__ */ c("div", {
|
|
1821
|
+
className: "mc-viewport",
|
|
1822
|
+
ref: D,
|
|
1823
|
+
tabIndex: 0,
|
|
1824
|
+
role: "group",
|
|
1825
|
+
"aria-label": "map canvas: arrow keys move focus, enter selects, plus and minus zoom, ctrl or cmd plus wheel to zoom",
|
|
1826
|
+
"aria-activedescendant": E && B.has(E) ? `${ge}-node-${Ut(E)}` : void 0,
|
|
1827
|
+
onKeyDown: ht,
|
|
1828
|
+
onPointerDown: gt,
|
|
1829
|
+
onPointerMove: Ct,
|
|
1830
|
+
onPointerUp: Tt,
|
|
1831
|
+
onPointerCancel: Ot,
|
|
1832
|
+
onLostPointerCapture: Lt,
|
|
1833
|
+
children: Yt ? /* @__PURE__ */ c("p", {
|
|
1834
|
+
className: "mc-empty mono",
|
|
1835
|
+
children: "no nodes to map"
|
|
1836
|
+
}) : /* @__PURE__ */ l(s, { children: [
|
|
1837
|
+
/* @__PURE__ */ l("div", {
|
|
1838
|
+
className: ["mc-stage", et ? "mc-stage--auto-fit" : ""].filter(Boolean).join(" "),
|
|
1839
|
+
style: {
|
|
1840
|
+
transform: `translate(${L.x}px, ${L.y}px) scale(${I})`,
|
|
1841
|
+
width: H,
|
|
1842
|
+
height: U
|
|
1843
|
+
},
|
|
1844
|
+
children: [/* @__PURE__ */ c("svg", {
|
|
1845
|
+
className: "mc-edges",
|
|
1846
|
+
width: H,
|
|
1847
|
+
height: U,
|
|
1848
|
+
viewBox: `0 0 ${H} ${U}`,
|
|
1849
|
+
"aria-hidden": "true",
|
|
1850
|
+
children: W.map((e) => {
|
|
1851
|
+
let t = Ke.get(e.from), n = Ke.get(e.to);
|
|
1852
|
+
if (!t || !n) return null;
|
|
1853
|
+
let r = se[Ht(e.from, e.to)] ?? se[Ht(e.from, e.to, "arrow")];
|
|
1854
|
+
return /* @__PURE__ */ c(qt, {
|
|
1855
|
+
a: t,
|
|
1856
|
+
b: n,
|
|
1857
|
+
kind: e.kind,
|
|
1858
|
+
weight: e.weight,
|
|
1859
|
+
maxWeight: Je,
|
|
1860
|
+
delta: r
|
|
1861
|
+
}, `${e.kind}:${e.from}->${e.to}`);
|
|
1862
|
+
})
|
|
1863
|
+
}), V.map((t) => {
|
|
1864
|
+
let n = (qe.get(t.node.id) || 0) > 0, r = N.has(t.node.id);
|
|
1865
|
+
return /* @__PURE__ */ l(e, { children: [/* @__PURE__ */ c(Kt, {
|
|
1866
|
+
domId: `${ge}-node-${Ut(t.node.id)}`,
|
|
1867
|
+
p: t,
|
|
1868
|
+
selected: P === t.node.id,
|
|
1869
|
+
focused: E === t.node.id,
|
|
1870
|
+
highlighted: Xe.has(t.node.id),
|
|
1871
|
+
delta: oe[t.node.id],
|
|
1872
|
+
expandable: n,
|
|
1873
|
+
expanded: r,
|
|
1874
|
+
violations: Ye.get(t.node.id) || 0,
|
|
1875
|
+
onClick: (e) => {
|
|
1876
|
+
e >= 2 || (we(t.node.id), C ? P !== t.node.id && J(t.node.id) : J(P === t.node.id ? null : t.node.id));
|
|
1877
|
+
},
|
|
1878
|
+
onDoubleClick: () => {
|
|
1879
|
+
n && dt(t.node.id);
|
|
1880
|
+
}
|
|
1881
|
+
}), n ? /* @__PURE__ */ c("button", {
|
|
1882
|
+
type: "button",
|
|
1883
|
+
className: "mc-node-disclosure",
|
|
1884
|
+
"aria-label": `${r ? "hide" : "show"} children for ${Z(t.node.label || t.node.id)}`,
|
|
1885
|
+
"aria-expanded": r,
|
|
1886
|
+
style: {
|
|
1887
|
+
left: t.x + t.w,
|
|
1888
|
+
top: t.y + t.h
|
|
1889
|
+
},
|
|
1890
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
1891
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1892
|
+
onClick: (e) => {
|
|
1893
|
+
e.stopPropagation(), dt(t.node.id);
|
|
1894
|
+
},
|
|
1895
|
+
children: /* @__PURE__ */ c(p, { "aria-hidden": "true" })
|
|
1896
|
+
}) : null] }, t.node.id);
|
|
1897
|
+
})]
|
|
1898
|
+
}),
|
|
1899
|
+
/* @__PURE__ */ l("div", {
|
|
1900
|
+
className: "mc-zoom",
|
|
1901
|
+
role: "group",
|
|
1902
|
+
"aria-label": "map zoom",
|
|
1903
|
+
children: [
|
|
1904
|
+
/* @__PURE__ */ c("button", {
|
|
1905
|
+
type: "button",
|
|
1906
|
+
className: "mc-zoom-btn",
|
|
1907
|
+
"aria-label": "zoom in",
|
|
1908
|
+
onClick: () => it(_t),
|
|
1909
|
+
children: /* @__PURE__ */ c(ne, {
|
|
1910
|
+
className: "lucide",
|
|
1911
|
+
"aria-hidden": "true"
|
|
1912
|
+
})
|
|
1913
|
+
}),
|
|
1914
|
+
/* @__PURE__ */ c("button", {
|
|
1915
|
+
type: "button",
|
|
1916
|
+
className: "mc-zoom-btn",
|
|
1917
|
+
"aria-label": "zoom out",
|
|
1918
|
+
onClick: () => it(1 / _t),
|
|
1919
|
+
children: /* @__PURE__ */ c(te, {
|
|
1920
|
+
className: "lucide",
|
|
1921
|
+
"aria-hidden": "true"
|
|
1922
|
+
})
|
|
1923
|
+
}),
|
|
1924
|
+
/* @__PURE__ */ c("button", {
|
|
1925
|
+
type: "button",
|
|
1926
|
+
className: "mc-zoom-btn",
|
|
1927
|
+
"aria-label": "fit map to view",
|
|
1928
|
+
onClick: () => Qe(!0),
|
|
1929
|
+
children: /* @__PURE__ */ c(ee, {
|
|
1930
|
+
className: "lucide",
|
|
1931
|
+
"aria-hidden": "true"
|
|
1932
|
+
})
|
|
1933
|
+
})
|
|
1934
|
+
]
|
|
1935
|
+
}),
|
|
1936
|
+
$ && /* @__PURE__ */ c("div", {
|
|
1937
|
+
className: "mc-minimap",
|
|
1938
|
+
"aria-hidden": "true",
|
|
1939
|
+
children: /* @__PURE__ */ l("svg", {
|
|
1940
|
+
className: "mc-minimap-svg",
|
|
1941
|
+
viewBox: `0 0 ${$.graphW} ${$.graphH}`,
|
|
1942
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
1943
|
+
children: [V.map((e) => /* @__PURE__ */ c("rect", {
|
|
1944
|
+
className: "mc-mini-node",
|
|
1945
|
+
"data-cov": wt(e.node.coverage),
|
|
1946
|
+
x: e.x,
|
|
1947
|
+
y: e.y,
|
|
1948
|
+
width: e.w,
|
|
1949
|
+
height: e.h
|
|
1950
|
+
}, e.node.id)), /* @__PURE__ */ c("rect", {
|
|
1951
|
+
className: "mc-mini-view",
|
|
1952
|
+
x: $.viewX,
|
|
1953
|
+
y: $.viewY,
|
|
1954
|
+
width: $.viewW,
|
|
1955
|
+
height: $.viewH
|
|
1956
|
+
})]
|
|
1957
|
+
})
|
|
1958
|
+
}),
|
|
1959
|
+
/* @__PURE__ */ l("div", {
|
|
1960
|
+
className: "mc-legend mono",
|
|
1961
|
+
"aria-hidden": "true",
|
|
1962
|
+
children: [
|
|
1963
|
+
/* @__PURE__ */ l("span", {
|
|
1964
|
+
className: "mc-legend-item",
|
|
1965
|
+
children: [/* @__PURE__ */ c(_, { className: "lucide" }), " folder"]
|
|
1966
|
+
}),
|
|
1967
|
+
/* @__PURE__ */ l("span", {
|
|
1968
|
+
className: "mc-legend-item",
|
|
1969
|
+
children: [/* @__PURE__ */ c(g, { className: "lucide" }), " file"]
|
|
1970
|
+
}),
|
|
1971
|
+
/* @__PURE__ */ l("span", {
|
|
1972
|
+
className: "mc-legend-item mc-legend-ramp",
|
|
1973
|
+
children: [
|
|
1974
|
+
/* @__PURE__ */ c("span", {
|
|
1975
|
+
className: "mc-ramp-sw",
|
|
1976
|
+
"data-cov": "0"
|
|
1977
|
+
}),
|
|
1978
|
+
/* @__PURE__ */ c("span", {
|
|
1979
|
+
className: "mc-ramp-sw",
|
|
1980
|
+
"data-cov": "1"
|
|
1981
|
+
}),
|
|
1982
|
+
/* @__PURE__ */ c("span", {
|
|
1983
|
+
className: "mc-ramp-sw",
|
|
1984
|
+
"data-cov": "2"
|
|
1985
|
+
}),
|
|
1986
|
+
/* @__PURE__ */ c("span", {
|
|
1987
|
+
className: "mc-ramp-sw",
|
|
1988
|
+
"data-cov": "3"
|
|
1989
|
+
}),
|
|
1990
|
+
/* @__PURE__ */ c("span", {
|
|
1991
|
+
className: "mc-ramp-sw",
|
|
1992
|
+
"data-cov": "4"
|
|
1993
|
+
}),
|
|
1994
|
+
"coverage"
|
|
1995
|
+
]
|
|
1996
|
+
}),
|
|
1997
|
+
/* @__PURE__ */ l("span", {
|
|
1998
|
+
className: "mc-legend-item mc-legend-viol",
|
|
1999
|
+
children: [/* @__PURE__ */ c(ae, { className: "lucide" }), " violation"]
|
|
2000
|
+
})
|
|
2001
|
+
]
|
|
2002
|
+
})
|
|
2003
|
+
] })
|
|
2004
|
+
})
|
|
2005
|
+
]
|
|
2006
|
+
});
|
|
2007
|
+
function Zt(e) {
|
|
2008
|
+
let t = e.kind === "file" && M !== "files" ? "files" : M, n = new Set(t === M ? N : []), r = z.parentIdByChild.get(e.id);
|
|
2009
|
+
for (; r && z.byId.has(r);) n.has(r) || (n.add(r), ue?.(r)), r = z.parentIdByChild.get(r);
|
|
2010
|
+
let i = Array.from(n);
|
|
2011
|
+
C || (be(t), Se(n)), S?.({
|
|
2012
|
+
type: "reveal",
|
|
2013
|
+
id: e.id,
|
|
2014
|
+
grain: vt[t],
|
|
2015
|
+
expandedIds: i
|
|
2016
|
+
}), t !== M && le?.(t), b?.(i), Ae(""), Me(!1), we(e.id), C || T(e.id), ce?.(e.id, Rt(e)), window.requestAnimationFrame(() => {
|
|
2017
|
+
window.requestAnimationFrame(() => ot(e.id));
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
function Rt(e) {
|
|
2022
|
+
let { _order: t, ...n } = e;
|
|
2023
|
+
return n;
|
|
2024
|
+
}
|
|
2025
|
+
function zt(e) {
|
|
2026
|
+
return e ? e instanceof Set ? new Set(e) : new Set(Array.from(e)) : /* @__PURE__ */ new Set();
|
|
2027
|
+
}
|
|
2028
|
+
function Bt(e) {
|
|
2029
|
+
return z(e);
|
|
2030
|
+
}
|
|
2031
|
+
function Q(e, t) {
|
|
2032
|
+
return Number.isFinite(e) ? e : t;
|
|
2033
|
+
}
|
|
2034
|
+
function Vt(e) {
|
|
2035
|
+
return e ? Array.from(e).map(String).sort().join("\0") : "";
|
|
2036
|
+
}
|
|
2037
|
+
function Ht(e, t, n = "plain") {
|
|
2038
|
+
return n === "arrow" ? `${e}->${t}` : `${e}→${t}`;
|
|
2039
|
+
}
|
|
2040
|
+
function Ut(e) {
|
|
2041
|
+
return String(e).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2042
|
+
}
|
|
2043
|
+
function Wt(e, t = {}) {
|
|
2044
|
+
let { selected: n, expanded: r, violations: i = 0 } = t, a = wt(e.coverage), o = `${Z(e.label || e.id)}: ${e.kind} · coverage ${a} of 4`;
|
|
2045
|
+
return e.loc && (o += ` · ${e.loc} loc`), i > 0 && (o += ` · ${i} violation${i === 1 ? "" : "s"}`), n && (o += " · selected"), r && (o += " · expanded"), o;
|
|
2046
|
+
}
|
|
2047
|
+
function Gt(e, t, n, r, i) {
|
|
2048
|
+
if (!t) return;
|
|
2049
|
+
let a = e.x * n + r.x, o = e.y * n + r.y, s = (e.x + e.w) * n + r.x, c = (e.y + e.h) * n + r.y, l = 0, u = 0;
|
|
2050
|
+
a < 24 ? l = 24 - a : s > t.clientWidth - 24 && (l = t.clientWidth - 24 - s), o < 24 ? u = 24 - o : c > t.clientHeight - 24 && (u = t.clientHeight - 24 - c), (l !== 0 || u !== 0) && i({
|
|
2051
|
+
x: r.x + l,
|
|
2052
|
+
y: r.y + u
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
function Kt({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a, expandable: o, expanded: s, violations: u, onClick: d, onDoubleClick: f }) {
|
|
2056
|
+
let p = t.node, m = wt(p.coverage);
|
|
2057
|
+
return /* @__PURE__ */ l("button", {
|
|
2058
|
+
id: e,
|
|
2059
|
+
type: "button",
|
|
2060
|
+
className: "mc-node",
|
|
2061
|
+
"data-cov": m,
|
|
2062
|
+
"data-selected": n ? "true" : void 0,
|
|
2063
|
+
"data-focused": r ? "true" : void 0,
|
|
2064
|
+
"data-highlighted": i ? "true" : void 0,
|
|
2065
|
+
"data-delta": a || void 0,
|
|
2066
|
+
"data-ink-flip": m >= Ct ? "true" : void 0,
|
|
2067
|
+
"aria-label": Wt(p, {
|
|
2068
|
+
selected: n,
|
|
2069
|
+
expanded: s,
|
|
2070
|
+
violations: u
|
|
2071
|
+
}),
|
|
2072
|
+
"aria-pressed": n,
|
|
2073
|
+
"aria-expanded": o ? s : void 0,
|
|
2074
|
+
style: {
|
|
2075
|
+
left: t.x,
|
|
2076
|
+
top: t.y,
|
|
2077
|
+
width: t.w,
|
|
2078
|
+
height: t.h
|
|
2079
|
+
},
|
|
2080
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2081
|
+
onClick: (e) => {
|
|
2082
|
+
e.stopPropagation(), d(e.detail);
|
|
2083
|
+
},
|
|
2084
|
+
onDoubleClick: (e) => {
|
|
2085
|
+
e.stopPropagation(), f();
|
|
2086
|
+
},
|
|
2087
|
+
children: [
|
|
2088
|
+
n && /* @__PURE__ */ c("span", {
|
|
2089
|
+
className: "mc-node-marker",
|
|
2090
|
+
"aria-hidden": "true"
|
|
2091
|
+
}),
|
|
2092
|
+
/* @__PURE__ */ l("span", {
|
|
2093
|
+
className: "mc-node-head",
|
|
2094
|
+
children: [
|
|
2095
|
+
p.kind === "folder" ? /* @__PURE__ */ c(_, {
|
|
2096
|
+
className: "lucide mc-node-ico",
|
|
2097
|
+
"aria-hidden": "true"
|
|
2098
|
+
}) : /* @__PURE__ */ c(g, {
|
|
2099
|
+
className: "lucide mc-node-ico",
|
|
2100
|
+
"aria-hidden": "true"
|
|
2101
|
+
}),
|
|
2102
|
+
/* @__PURE__ */ c("span", {
|
|
2103
|
+
className: "mc-node-name mono",
|
|
2104
|
+
children: Z(p.label || p.id)
|
|
2105
|
+
}),
|
|
2106
|
+
u > 0 && /* @__PURE__ */ l("span", {
|
|
2107
|
+
className: "mc-node-viol mono tnum",
|
|
2108
|
+
"aria-hidden": "true",
|
|
2109
|
+
children: [/* @__PURE__ */ c(ae, {
|
|
2110
|
+
className: "lucide",
|
|
2111
|
+
"aria-hidden": "true"
|
|
2112
|
+
}), u]
|
|
2113
|
+
})
|
|
2114
|
+
]
|
|
2115
|
+
}),
|
|
2116
|
+
/* @__PURE__ */ l("span", {
|
|
2117
|
+
className: "mc-node-meta mono tnum",
|
|
2118
|
+
children: [
|
|
2119
|
+
p.kind === "folder" && o ? s ? "open" : "folder" : "file",
|
|
2120
|
+
p.loc ? ` · ${p.loc} loc` : "",
|
|
2121
|
+
` · cov ${m}/4`
|
|
2122
|
+
]
|
|
2123
|
+
})
|
|
2124
|
+
]
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
function qt({ a: e, b: t, kind: n, weight: r, maxWeight: i, delta: a }) {
|
|
2128
|
+
let o = e.x + e.w / 2, s = e.y + e.h, u = t.x + t.w / 2, d = t.y, f = (s + d) / 2, p = `M ${o} ${s} L ${o} ${f} L ${u} ${f} L ${u} ${d}`, m = 1 + Math.min(r, i) / i * 2;
|
|
2129
|
+
return /* @__PURE__ */ l("g", {
|
|
2130
|
+
className: "mc-edge",
|
|
2131
|
+
"data-kind": n,
|
|
2132
|
+
"data-delta": a || void 0,
|
|
2133
|
+
children: [/* @__PURE__ */ c("path", {
|
|
2134
|
+
className: "mc-edge-path",
|
|
2135
|
+
d: p,
|
|
2136
|
+
style: { strokeWidth: m }
|
|
2137
|
+
}), n === "structure" && /* @__PURE__ */ c("path", {
|
|
2138
|
+
className: "mc-edge-head",
|
|
2139
|
+
d: `M ${u - 4} ${d - 6} L ${u + 4} ${d - 6} L ${u} ${d} Z`
|
|
2140
|
+
})]
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2143
|
+
//#endregion
|
|
2144
|
+
//#region src/ui/RailShell.jsx
|
|
2145
|
+
function Jt({ toolbar: e, children: t, rail: n, railSide: i = "right", sheetTitle: a = "details", sheetMeta: s, className: u = "" }) {
|
|
2146
|
+
let [f, p] = o(!1), m = `rs-sheet-${r()}`;
|
|
2147
|
+
return /* @__PURE__ */ l("div", {
|
|
2148
|
+
className: `rs rs--${i}${u ? ` ${u}` : ""}`,
|
|
2149
|
+
"data-sheet-open": f ? "true" : "false",
|
|
2150
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2151
|
+
className: "rs-frame",
|
|
2152
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2153
|
+
className: "rs-main",
|
|
2154
|
+
children: [e && /* @__PURE__ */ c("div", {
|
|
2155
|
+
className: "rs-toolbar",
|
|
2156
|
+
children: e
|
|
2157
|
+
}), /* @__PURE__ */ c("div", {
|
|
2158
|
+
className: "rs-canvas",
|
|
2159
|
+
children: t
|
|
2160
|
+
})]
|
|
2161
|
+
}), /* @__PURE__ */ c("aside", {
|
|
2162
|
+
className: "rs-rail",
|
|
2163
|
+
"aria-label": a,
|
|
2164
|
+
children: /* @__PURE__ */ c("div", {
|
|
2165
|
+
className: "rs-rail-card",
|
|
2166
|
+
children: n
|
|
2167
|
+
})
|
|
2168
|
+
})]
|
|
2169
|
+
}), /* @__PURE__ */ l("div", {
|
|
2170
|
+
className: "rs-sheet",
|
|
2171
|
+
"aria-label": a,
|
|
2172
|
+
children: [/* @__PURE__ */ l("button", {
|
|
2173
|
+
type: "button",
|
|
2174
|
+
className: "rs-sheet-toggle",
|
|
2175
|
+
"aria-expanded": f,
|
|
2176
|
+
"aria-controls": m,
|
|
2177
|
+
onClick: () => p((e) => !e),
|
|
2178
|
+
children: [/* @__PURE__ */ c("span", {
|
|
2179
|
+
className: "rs-sheet-grip",
|
|
2180
|
+
"aria-hidden": "true"
|
|
2181
|
+
}), /* @__PURE__ */ l("span", {
|
|
2182
|
+
className: "rs-sheet-row",
|
|
2183
|
+
children: [/* @__PURE__ */ c("span", {
|
|
2184
|
+
className: "rs-sheet-title",
|
|
2185
|
+
children: a
|
|
2186
|
+
}), /* @__PURE__ */ l("span", {
|
|
2187
|
+
className: "rs-sheet-end",
|
|
2188
|
+
children: [s && /* @__PURE__ */ c("span", {
|
|
2189
|
+
className: "rs-sheet-meta",
|
|
2190
|
+
children: s
|
|
2191
|
+
}), /* @__PURE__ */ c(d, {
|
|
2192
|
+
className: "rs-sheet-chevron lucide",
|
|
2193
|
+
"aria-hidden": "true"
|
|
2194
|
+
})]
|
|
2195
|
+
})]
|
|
2196
|
+
})]
|
|
2197
|
+
}), /* @__PURE__ */ c("div", {
|
|
2198
|
+
id: m,
|
|
2199
|
+
role: "region",
|
|
2200
|
+
"aria-label": a,
|
|
2201
|
+
className: "rs-sheet-body",
|
|
2202
|
+
hidden: !f,
|
|
2203
|
+
children: n
|
|
2204
|
+
})]
|
|
2205
|
+
})]
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
function $({ title: e, icon: t, meta: n, children: i, collapsible: a = !1, defaultOpen: u = !0, className: d = "" }) {
|
|
2209
|
+
let [f, m] = o(u), h = `rs-sec-${r()}`, g = /* @__PURE__ */ l(s, { children: [
|
|
2210
|
+
t && /* @__PURE__ */ c(t, {
|
|
2211
|
+
className: "rs-sec-icon lucide",
|
|
2212
|
+
"aria-hidden": "true"
|
|
2213
|
+
}),
|
|
2214
|
+
e && /* @__PURE__ */ c("span", {
|
|
2215
|
+
className: "rs-sec-title",
|
|
2216
|
+
children: e
|
|
2217
|
+
}),
|
|
2218
|
+
/* @__PURE__ */ l("span", {
|
|
2219
|
+
className: "rs-sec-end",
|
|
2220
|
+
children: [n && /* @__PURE__ */ c("span", {
|
|
2221
|
+
className: "rs-sec-meta",
|
|
2222
|
+
children: n
|
|
2223
|
+
}), a && /* @__PURE__ */ c(p, {
|
|
2224
|
+
className: "rs-sec-chevron lucide",
|
|
2225
|
+
"aria-hidden": "true"
|
|
2226
|
+
})]
|
|
2227
|
+
})
|
|
2228
|
+
] });
|
|
2229
|
+
return /* @__PURE__ */ l("section", {
|
|
2230
|
+
className: `rs-sec${a ? " rs-sec--collapsible" : ""}${f ? " is-open" : ""}${d ? ` ${d}` : ""}`,
|
|
2231
|
+
children: [a ? /* @__PURE__ */ c("button", {
|
|
2232
|
+
type: "button",
|
|
2233
|
+
className: "rs-sec-head rs-sec-head--button",
|
|
2234
|
+
"aria-expanded": f,
|
|
2235
|
+
"aria-controls": h,
|
|
2236
|
+
onClick: () => m((e) => !e),
|
|
2237
|
+
children: g
|
|
2238
|
+
}) : /* @__PURE__ */ c("div", {
|
|
2239
|
+
className: "rs-sec-head",
|
|
2240
|
+
children: g
|
|
2241
|
+
}), /* @__PURE__ */ c("div", {
|
|
2242
|
+
id: a ? h : void 0,
|
|
2243
|
+
className: "rs-sec-body",
|
|
2244
|
+
hidden: a ? !f : void 0,
|
|
2245
|
+
children: i
|
|
2246
|
+
})]
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
function Yt({ title: e, icon: t, meta: n, children: i, defaultOpen: a = !0 }) {
|
|
2250
|
+
let [s, u] = o(a), d = `rs-split-${r()}`;
|
|
2251
|
+
return /* @__PURE__ */ l("section", {
|
|
2252
|
+
className: `rs-split-panel${s ? " is-open" : ""}`,
|
|
2253
|
+
children: [/* @__PURE__ */ l("button", {
|
|
2254
|
+
type: "button",
|
|
2255
|
+
className: "rs-split-head",
|
|
2256
|
+
"aria-expanded": s,
|
|
2257
|
+
"aria-controls": d,
|
|
2258
|
+
onClick: () => u((e) => !e),
|
|
2259
|
+
children: [
|
|
2260
|
+
t && /* @__PURE__ */ c(t, {
|
|
2261
|
+
className: "rs-sec-icon lucide",
|
|
2262
|
+
"aria-hidden": "true"
|
|
2263
|
+
}),
|
|
2264
|
+
e && /* @__PURE__ */ c("span", {
|
|
2265
|
+
className: "rs-sec-title",
|
|
2266
|
+
children: e
|
|
2267
|
+
}),
|
|
2268
|
+
/* @__PURE__ */ l("span", {
|
|
2269
|
+
className: "rs-sec-end",
|
|
2270
|
+
children: [n && /* @__PURE__ */ c("span", {
|
|
2271
|
+
className: "rs-sec-meta",
|
|
2272
|
+
children: n
|
|
2273
|
+
}), /* @__PURE__ */ c(p, {
|
|
2274
|
+
className: "rs-sec-chevron lucide",
|
|
2275
|
+
"aria-hidden": "true"
|
|
2276
|
+
})]
|
|
2277
|
+
})
|
|
2278
|
+
]
|
|
2279
|
+
}), /* @__PURE__ */ c("div", {
|
|
2280
|
+
id: d,
|
|
2281
|
+
className: "rs-split-body",
|
|
2282
|
+
hidden: !s,
|
|
2283
|
+
children: i
|
|
2284
|
+
})]
|
|
2285
|
+
});
|
|
2286
|
+
}
|
|
2287
|
+
function Xt({ left: e, right: t, leftTitle: n = "outline", rightTitle: r = "filters", leftIcon: i, rightIcon: a, leftMeta: o, rightMeta: s, className: u = "" }) {
|
|
2288
|
+
return /* @__PURE__ */ l("div", {
|
|
2289
|
+
className: `rs-split${u ? ` ${u}` : ""}`,
|
|
2290
|
+
children: [/* @__PURE__ */ c(Yt, {
|
|
2291
|
+
title: n,
|
|
2292
|
+
icon: i,
|
|
2293
|
+
meta: o,
|
|
2294
|
+
children: e
|
|
2295
|
+
}), /* @__PURE__ */ c(Yt, {
|
|
2296
|
+
title: r,
|
|
2297
|
+
icon: a,
|
|
2298
|
+
meta: s,
|
|
2299
|
+
children: t
|
|
2300
|
+
})]
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
//#endregion
|
|
2304
|
+
//#region src/ui/inuse/InUseShell.jsx
|
|
2305
|
+
var Zt = Object.freeze([
|
|
2306
|
+
{
|
|
2307
|
+
id: "transcript",
|
|
2308
|
+
mark: "transcript-browser",
|
|
2309
|
+
icon: y
|
|
2310
|
+
},
|
|
2311
|
+
{
|
|
2312
|
+
id: "commons",
|
|
2313
|
+
mark: "village",
|
|
2314
|
+
icon: oe
|
|
2315
|
+
},
|
|
2316
|
+
{
|
|
2317
|
+
id: "graph",
|
|
2318
|
+
mark: "peasant",
|
|
2319
|
+
icon: se
|
|
2320
|
+
}
|
|
2321
|
+
]), Qt = Object.freeze([
|
|
2322
|
+
{
|
|
2323
|
+
id: "analytics",
|
|
2324
|
+
label: "analytics"
|
|
2325
|
+
},
|
|
2326
|
+
{
|
|
2327
|
+
id: "changes",
|
|
2328
|
+
label: "changes"
|
|
2329
|
+
},
|
|
2330
|
+
{
|
|
2331
|
+
id: "map",
|
|
2332
|
+
label: "code map"
|
|
2333
|
+
}
|
|
2334
|
+
]);
|
|
2335
|
+
function $t(e) {
|
|
2336
|
+
return e && (/(INPUT|TEXTAREA|SELECT)/.test(e.tagName) || e.isContentEditable);
|
|
2337
|
+
}
|
|
2338
|
+
function en({ apps: e = Zt, defaultApp: t, activeApp: n, onAppChange: r, renderApp: i, brand: s = "fairtrade", ariaLabel: u = "the design system in use" }) {
|
|
2339
|
+
let [d, f] = o(t ?? e[0]?.id), p = n ?? d, m = a({}), h = (e) => {
|
|
2340
|
+
n === void 0 && f(e), r?.(e);
|
|
2341
|
+
}, g = e.find((e) => e.id === p) ?? e[0];
|
|
2342
|
+
return /* @__PURE__ */ l("section", {
|
|
2343
|
+
className: "iu",
|
|
2344
|
+
id: "inuse",
|
|
2345
|
+
"aria-label": u,
|
|
2346
|
+
onKeyDown: (t) => {
|
|
2347
|
+
if ($t(t.target)) return;
|
|
2348
|
+
let n = {
|
|
2349
|
+
1: 0,
|
|
2350
|
+
2: 1,
|
|
2351
|
+
3: 2
|
|
2352
|
+
}[t.key];
|
|
2353
|
+
n != null && e[n] && (t.preventDefault(), h(e[n].id));
|
|
2354
|
+
},
|
|
2355
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2356
|
+
className: "iu-bar",
|
|
2357
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2358
|
+
className: "iu-bar-brand",
|
|
2359
|
+
children: [/* @__PURE__ */ c("svg", {
|
|
2360
|
+
className: "logo",
|
|
2361
|
+
width: "18",
|
|
2362
|
+
height: "18",
|
|
2363
|
+
viewBox: "0 0 32 32",
|
|
2364
|
+
"aria-hidden": "true",
|
|
2365
|
+
children: /* @__PURE__ */ c("use", { href: "#logo" })
|
|
2366
|
+
}), /* @__PURE__ */ c("span", { children: s })]
|
|
2367
|
+
}), /* @__PURE__ */ c("div", {
|
|
2368
|
+
className: "iu-switch",
|
|
2369
|
+
role: "tablist",
|
|
2370
|
+
"aria-label": "apps",
|
|
2371
|
+
"aria-orientation": "horizontal",
|
|
2372
|
+
onKeyDown: (t) => {
|
|
2373
|
+
let n = e.map((e) => e.id), r = n.indexOf(g?.id);
|
|
2374
|
+
if (r < 0) return;
|
|
2375
|
+
let i = r;
|
|
2376
|
+
if (t.key === "ArrowRight" || t.key === "ArrowDown") i = (r + 1) % n.length;
|
|
2377
|
+
else if (t.key === "ArrowLeft" || t.key === "ArrowUp") i = (r - 1 + n.length) % n.length;
|
|
2378
|
+
else if (t.key === "Home") i = 0;
|
|
2379
|
+
else if (t.key === "End") i = n.length - 1;
|
|
2380
|
+
else return;
|
|
2381
|
+
t.preventDefault(), h(n[i]), m.current[n[i]]?.focus();
|
|
2382
|
+
},
|
|
2383
|
+
children: e.map((e, t) => {
|
|
2384
|
+
let n = e.icon, r = e.id === g?.id;
|
|
2385
|
+
return /* @__PURE__ */ l("button", {
|
|
2386
|
+
type: "button",
|
|
2387
|
+
role: "tab",
|
|
2388
|
+
id: "iu-tab-" + e.id,
|
|
2389
|
+
"aria-selected": r ? "true" : "false",
|
|
2390
|
+
"aria-controls": "inuse-stage",
|
|
2391
|
+
tabIndex: r ? 0 : -1,
|
|
2392
|
+
ref: (t) => {
|
|
2393
|
+
m.current[e.id] = t;
|
|
2394
|
+
},
|
|
2395
|
+
className: "iu-opt" + (r ? " iu-opt-on" : ""),
|
|
2396
|
+
onClick: () => h(e.id),
|
|
2397
|
+
children: [
|
|
2398
|
+
n ? /* @__PURE__ */ c("span", {
|
|
2399
|
+
className: "iu-opt-ico",
|
|
2400
|
+
children: /* @__PURE__ */ c(n, {
|
|
2401
|
+
size: 16,
|
|
2402
|
+
"aria-hidden": "true"
|
|
2403
|
+
})
|
|
2404
|
+
}) : null,
|
|
2405
|
+
/* @__PURE__ */ c("span", {
|
|
2406
|
+
className: "iu-opt-label",
|
|
2407
|
+
children: e.mark
|
|
2408
|
+
}),
|
|
2409
|
+
/* @__PURE__ */ c("span", {
|
|
2410
|
+
className: "iu-opt-key",
|
|
2411
|
+
"aria-hidden": "true",
|
|
2412
|
+
children: t + 1
|
|
2413
|
+
})
|
|
2414
|
+
]
|
|
2415
|
+
}, e.id);
|
|
2416
|
+
})
|
|
2417
|
+
})]
|
|
2418
|
+
}), /* @__PURE__ */ c("div", {
|
|
2419
|
+
className: "iu-stage",
|
|
2420
|
+
id: "inuse-stage",
|
|
2421
|
+
role: "tabpanel",
|
|
2422
|
+
"aria-labelledby": "iu-tab-" + g?.id,
|
|
2423
|
+
tabIndex: -1,
|
|
2424
|
+
children: /* @__PURE__ */ c("div", {
|
|
2425
|
+
className: "iu-screen",
|
|
2426
|
+
children: g ? i?.(g.id) : null
|
|
2427
|
+
}, g?.id)
|
|
2428
|
+
})]
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
function tn({ sections: e = Qt, activeId: t, activePrimaryId: n, onSectionChange: r, backTo: i, onBack: a, children: o, ariaLabel: s = "peasant sections" }) {
|
|
2432
|
+
let u = n ?? t;
|
|
2433
|
+
return /* @__PURE__ */ l("div", {
|
|
2434
|
+
className: "iu-app-root",
|
|
2435
|
+
children: [/* @__PURE__ */ l("nav", {
|
|
2436
|
+
className: "iu-subnav",
|
|
2437
|
+
"aria-label": s,
|
|
2438
|
+
children: [i ? /* @__PURE__ */ l("button", {
|
|
2439
|
+
type: "button",
|
|
2440
|
+
className: "iu-subnav-back",
|
|
2441
|
+
onClick: () => a ? a(i) : r?.(i),
|
|
2442
|
+
children: [/* @__PURE__ */ c(f, {
|
|
2443
|
+
size: 14,
|
|
2444
|
+
"aria-hidden": "true"
|
|
2445
|
+
}), " back"]
|
|
2446
|
+
}) : null, e.map((e) => /* @__PURE__ */ c("button", {
|
|
2447
|
+
type: "button",
|
|
2448
|
+
className: "iu-subnav-item" + (u === e.id ? " active" : ""),
|
|
2449
|
+
"aria-current": t === e.id ? "page" : void 0,
|
|
2450
|
+
onClick: () => r?.(e.id),
|
|
2451
|
+
children: e.label
|
|
2452
|
+
}, e.id))]
|
|
2453
|
+
}), /* @__PURE__ */ c("div", {
|
|
2454
|
+
className: "iu-view",
|
|
2455
|
+
children: o
|
|
2456
|
+
})]
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
function nn({ sections: e = Qt, activeId: t = void 0, hrefFor: n = void 0, LinkComponent: r = void 0, onSectionChange: i = void 0, className: a = "iu-subnav", itemClassName: o = "iu-subnav-item", activeItemClassName: u = "active", activeMarker: d = null, ariaLabel: f = "peasant sections" }) {
|
|
2460
|
+
return /* @__PURE__ */ c("nav", {
|
|
2461
|
+
className: a,
|
|
2462
|
+
"aria-label": f,
|
|
2463
|
+
children: e.map((e) => {
|
|
2464
|
+
let a = t === e.id, f = o + (a && u ? " " + u : ""), p = /* @__PURE__ */ l(s, { children: [e.label, a ? d : null] }), m = n?.(e);
|
|
2465
|
+
return m && r ? /* @__PURE__ */ c(r, {
|
|
2466
|
+
href: m,
|
|
2467
|
+
className: f,
|
|
2468
|
+
"aria-current": a ? "page" : void 0,
|
|
2469
|
+
title: e.title,
|
|
2470
|
+
children: p
|
|
2471
|
+
}, e.id) : m ? /* @__PURE__ */ c("a", {
|
|
2472
|
+
href: m,
|
|
2473
|
+
className: f,
|
|
2474
|
+
"aria-current": a ? "page" : void 0,
|
|
2475
|
+
title: e.title,
|
|
2476
|
+
children: p
|
|
2477
|
+
}, e.id) : /* @__PURE__ */ c("button", {
|
|
2478
|
+
type: "button",
|
|
2479
|
+
className: f,
|
|
2480
|
+
"aria-current": a ? "page" : void 0,
|
|
2481
|
+
onClick: () => i?.(e.id),
|
|
2482
|
+
children: p
|
|
2483
|
+
}, e.id);
|
|
2484
|
+
})
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
//#endregion
|
|
2488
|
+
export { je as A, Ue as C, Me as D, Ie as E, ve as F, Te as M, E as N, De as O, ye as P, L as S, Be as T, He as _, en as a, N as b, Xt as c, R as d, Je as f, Ye as g, z as h, Zt as i, Ae as j, ke as k, Lt as l, Xe as m, tn as n, $ as o, W as p, nn as r, Jt as s, Qt as t, We as u, P as v, I as w, Ve as x, M as y };
|