@popcorn245/cornfield-components 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/around-BcnegEdS.js +99 -0
  3. package/dist/chunks/connection-KDiWvV19.js +23 -0
  4. package/dist/chunks/{engine-HIgX35hE.js → engine-xmHJvQY9.js} +1360 -1343
  5. package/dist/chunks/{layers-n1mJVJs8.js → layers-ho10a2y7.js} +68 -68
  6. package/dist/chunks/{map-CeP9M2_w.js → map-DbfPgQRe.js} +736 -705
  7. package/dist/chunks/node-panel-CC8UrSzJ.js +410 -0
  8. package/dist/chunks/panel-review-ih7RlfkH.js +884 -0
  9. package/dist/chunks/review-pieces-DtRxCDMr.js +2523 -0
  10. package/dist/chunks/{review-source-DWisOXyR.js → review-source-CmbwaPCM.js} +1 -1
  11. package/dist/chunks/scope-2m2VmJXn.js +185 -0
  12. package/dist/chunks/scope-proposal-T06ndbin.js +116 -0
  13. package/dist/chunks/sheets-BWANwtZP.js +209 -0
  14. package/dist/chunks/source-address-DXanAREm.js +57 -0
  15. package/dist/chunks/{status-CsFpnQxw.js → status-DM-iIEsg.js} +57 -56
  16. package/dist/corn-changes.js +43 -0
  17. package/dist/corn-decision.js +52 -0
  18. package/dist/corn-layers.js +275 -1
  19. package/dist/corn-map.js +125 -1
  20. package/dist/corn-node-panel.js +42 -1
  21. package/dist/corn-proposal.js +50 -0
  22. package/dist/corn-review.js +425 -1
  23. package/dist/corn-scope.js +33 -9
  24. package/dist/corn-search.js +484 -1
  25. package/dist/index.js +11 -8
  26. package/dist/manifest.json +95 -70
  27. package/dist/tokens.css +6 -0
  28. package/dist/types/components.d.ts +111 -5
  29. package/dist/types/corn-changes.d.ts +2 -0
  30. package/dist/types/corn-decision.d.ts +2 -0
  31. package/dist/types/corn-proposal.d.ts +2 -0
  32. package/dist/types/index.d.ts +3 -0
  33. package/dist/version.json +1 -1
  34. package/package.json +17 -5
  35. package/dist/chunks/around-D7aqHejs.js +0 -78
  36. package/dist/chunks/corn-layers-g9AprK6G.js +0 -275
  37. package/dist/chunks/corn-map-DE-pg-A0.js +0 -125
  38. package/dist/chunks/corn-node-panel-CdtFb9IZ.js +0 -42
  39. package/dist/chunks/corn-review-9krtLSPK.js +0 -2900
  40. package/dist/chunks/corn-search-BY1Po63S.js +0 -484
  41. package/dist/chunks/node-panel-CY5xnuKC.js +0 -1291
  42. package/dist/chunks/scope-CUhp8mkf.js +0 -137
  43. package/dist/chunks/sheets-TFCL_dIn.js +0 -204
  44. package/dist/chunks/source-address-C70zNPIj.js +0 -79
@@ -1,2900 +0,0 @@
1
- import { n as e, r as t, t as n } from "./runtime-DFu6W5g-.js";
2
- import { A as r, An as i, B as a, Cn as o, Dn as s, Dt as c, En as l, F as u, Gt as d, I as f, It as p, L as m, Nt as h, On as g, R as _, Tn as v, Wt as y, at as b, c as x, en as S, gn as C, gt as w, ht as T, it as E, kn as D, l as O, ln as k, lt as A, ot as j, pn as M, t as N, tn as P, un as F, vn as I, w as L, wn as R, z } from "./engine-HIgX35hE.js";
3
- import { i as B, n as V, r as H, t as U } from "./map-CeP9M2_w.js";
4
- import { A as W, C as G, D as K, E as q, O as J, S as ee, T as Y, _ as te, a as ne, b as re, c as X, d as ie, f as ae, g as oe, h as se, i as ce, k as le, l as Z, m as Q, o as ue, p as de, r as fe, s as pe, t as me, u as he, v as ge, w as _e, x as ve, y as ye } from "./node-panel-CY5xnuKC.js";
5
- import { c as be, d as xe, i as Se, l as Ce, n as we, o as Te, r as Ee, s as De, t as Oe } from "./sheets-TFCL_dIn.js";
6
- import { c as ke, d as Ae, f as je, i as Me, l as Ne, m as Pe, n as Fe, p as Ie, r as Le, t as Re } from "./layers-n1mJVJs8.js";
7
- import { a as ze, i as Be, n as Ve, r as He } from "./source-address-C70zNPIj.js";
8
- // ../explorer/engine/proposal.js
9
- var $ = (e) => e.slot("proposal", () => ({
10
- pinnedSource: !1,
11
- listing: null,
12
- listingProblem: null,
13
- forgeProblem: null,
14
- listingAt: 0,
15
- watchers: /* @__PURE__ */ new Set(),
16
- openToken: 0,
17
- message: null
18
- })), Ue = (e) => e.proposal && typeof e.proposal.title == "string" && e.proposal.title || e.proposalSlug || "Proposal", We = (e) => e.ask("proposal:specs-list") === !1 ? null : {
19
- label: D(e, "openSpecsList"),
20
- way: "specs"
21
- };
22
- function Ge(e) {
23
- let t = $(e);
24
- return {
25
- entries: t.listing,
26
- problem: t.listingProblem,
27
- forgeProblem: t.forgeProblem,
28
- at: t.listingAt
29
- };
30
- }
31
- async function Ke(e) {
32
- let t = $(e), n = Be(e);
33
- try {
34
- let r;
35
- try {
36
- r = await n("/proposals", { cache: "no-store" });
37
- } catch {
38
- throw Error(e.offline() ? "You are offline." : "cornfield could not be reached. Check that it is still running.");
39
- }
40
- if (!r.ok) throw Error(`The server could not list them (error ${r.status}).`);
41
- let i;
42
- try {
43
- i = await r.json();
44
- } catch {
45
- throw Error("cornfield sent a list this page could not read.");
46
- }
47
- if (!Array.isArray(i)) throw Error("cornfield sent something that is not a list of proposals.");
48
- t.listing = i, t.listingProblem = null;
49
- let a = r.headers.get("X-Proposals-Forge-Error");
50
- t.forgeProblem = a ? decodeURIComponent(a) : null;
51
- } catch (e) {
52
- t.listing = null, t.forgeProblem = null, t.listingProblem = e.message || "cornfield did not answer.";
53
- }
54
- t.listingAt = Date.now(), e.emit("proposal:listing");
55
- for (let e of [...t.watchers]) e();
56
- return t.listing;
57
- }
58
- function qe(e, t, n = !1, r = []) {
59
- let i = $(e);
60
- i.message = {
61
- text: t,
62
- isError: n,
63
- ways: r
64
- }, e.emit("proposal:message", i.message);
65
- }
66
- var Je = (e) => $(e).message;
67
- async function Ye(e, t, n = null) {
68
- let r = $(e), i = ++r.openToken;
69
- if (!te(t)) {
70
- let r = re(t);
71
- return qe(e, r, !0, []), e.emit("proposal:failed", {
72
- slug: t,
73
- source: n,
74
- status: 0,
75
- notFound: !1,
76
- message: r
77
- }), !1;
78
- }
79
- qe(e, `Opening ${t} …`);
80
- try {
81
- let r;
82
- try {
83
- r = await Be(e)(`/proposals/${encodeURIComponent(t)}.json${n ? `?source=${encodeURIComponent(n)}` : ""}`, { cache: "no-store" });
84
- } catch {
85
- throw Error(e.offline() ? `${t} could not be opened: you are offline.` : `${t} could not be opened: cornfield could not be reached.`);
86
- }
87
- if (!r.ok) {
88
- let i = "";
89
- try {
90
- i = (await r.json()).error || "";
91
- } catch {}
92
- let a = r.status === 401 || r.status === 403;
93
- a && e.emit("auth", {
94
- status: r.status,
95
- during: "proposal"
96
- });
97
- let o = a ? r.status === 403 ? "this is for the project's maintainers." : "you are not signed in." : `the server had a problem (error ${r.status}).`, s = Error(r.status === 404 ? ve(t, n) : `${t} could not be opened: ${typeof i == "string" && i ? i : o}`);
98
- throw s.notFound = r.status === 404, s.status = r.status, s;
99
- }
100
- let i = r.headers.get("X-Proposal-Source"), a;
101
- try {
102
- a = await r.json();
103
- } catch {
104
- throw Error(`${t} could not be opened: cornfield sent a file this page could not read.`);
105
- }
106
- let o = r.headers.get("X-Proposal-Sha256");
107
- return !e.ended && (Xe(e, a, {
108
- slug: t,
109
- source: n || (i ? decodeURIComponent(i) : null),
110
- pinSource: !!n,
111
- view: "diff",
112
- fit: !0,
113
- sha256: o
114
- }), d(e, [e.ask("changes:opened-line", Ue(e.state)), Ae(e)].filter(Boolean).join(" ")), !0);
115
- } catch (a) {
116
- if (e.ended) return !1;
117
- console.error("Opening the proposal failed", a);
118
- let o = a.message || `${t} could not be opened.`;
119
- if (qe(e, o, !0, a.notFound ? [We(e)].filter(Boolean) : [{
120
- label: "Retry",
121
- way: "retry",
122
- slug: t,
123
- source: n
124
- }, {
125
- label: "Close",
126
- way: "close"
127
- }]), a.notFound && i === r.openToken) {
128
- await Ke(e);
129
- let a = new Set((Array.isArray(r.listing) ? r.listing : []).map((e) => e && e.source));
130
- i === r.openToken && (o = ve(t, n, a), qe(e, o, !0, [...ee(r.listing, t, n).map((e) => ({
131
- label: e.label,
132
- way: "open",
133
- slug: e.slug,
134
- source: e.source
135
- })), We(e)].filter(Boolean)));
136
- }
137
- return i === r.openToken && e.emit("proposal:failed", {
138
- slug: t,
139
- source: n,
140
- status: a.status || 0,
141
- notFound: !!a.notFound,
142
- message: o
143
- }), !1;
144
- }
145
- }
146
- function Xe(e, t, { slug: n = null, source: r = null, pinSource: i = !1, view: a, fit: o = !0, sha256: s = null } = {}) {
147
- let { state: c } = e;
148
- c.proposal = t, Fe(e), c.proposalSlug = n, c.proposalSource = r, c.proposalSha256 = typeof s == "string" && /^[0-9a-f]{64}$/.test(s) ? s : null, $(e).pinnedSource = i, a ? c.proposalView = a : Q.includes(c.proposalView) || (c.proposalView = "diff");
149
- let l = e.ask("proposal:effective", t);
150
- $e(e, l === void 0 ? t : l, { fit: o }), Ze(e, "opened");
151
- }
152
- function Ze(e, t) {
153
- let { state: n } = e;
154
- e.emit("proposal", {
155
- change: t,
156
- slug: n.proposalSlug || null,
157
- source: n.proposalSource || null,
158
- pinSource: $(e).pinnedSource,
159
- view: n.proposalView,
160
- proposal: n.proposal || null
161
- });
162
- }
163
- function Qe(e) {
164
- let t = !!e.state.proposal;
165
- e.emit("proposal:draw", { open: t }), e.emit("proposal:bar", { open: t });
166
- }
167
- function $e(e, t, { fit: n = !1 } = {}) {
168
- let { state: r } = e;
169
- if (t === void 0) {
170
- let n = e.ask("proposal:effective", r.proposal);
171
- t = n === void 0 ? r.proposal : n;
172
- }
173
- let i = {
174
- nodes: r.baseNodes,
175
- edges: r.baseEdges
176
- }, a;
177
- r.effectiveProposal = t;
178
- try {
179
- r.proposalErrors = he(i, t).errors, a = X(i, t), e.emit("proposal:mark", {
180
- applied: a,
181
- effective: t,
182
- proposal: r.proposal
183
- });
184
- } catch (e) {
185
- r.proposalErrors = [{
186
- path: "",
187
- message: `This proposal could not be read: ${e.message}`
188
- }], a = {
189
- nodes: r.baseNodes.map((e) => ({
190
- ...e,
191
- mark: "none"
192
- })),
193
- edges: r.baseEdges.map((e) => ({
194
- ...e,
195
- mark: "none"
196
- }))
197
- };
198
- }
199
- nt(e, a.nodes, a.edges), Qe(e), Ne(e), n && rt(e), e.map.render(), e.map.ensureFlowLoop();
200
- }
201
- function et(e) {
202
- let { state: t } = e;
203
- return e.ask("proposal:before-close") !== !1 && (t.proposal = null, t.effectiveProposal = null, t.proposalSlug = null, t.proposalSource = null, t.proposalSha256 = null, t.proposalErrors = [], Me(e), nt(e, t.baseNodes.map((e) => ({ ...e })), t.baseEdges), e.map.fitGraphToViewport(e.map.fitPadding()), e.map.render(), e.map.ensureFlowLoop(), Qe(e), Ze(e, "closed"), !0);
204
- }
205
- function tt(e, t, { quiet: n = !1 } = {}) {
206
- let { state: r } = e;
207
- r.proposal && Q.includes(t) && r.proposalView !== t && (r.proposalView = t, e.touchScene(), r.selectedNode && !e.map.isNodeVisible(r.selectedNode) && S(e, { source: "api" }), t === "diff" && rt(e), e.map.render(), Qe(e), Ze(e, "view"), n || d(e, Y(t)));
208
- }
209
- function nt(e, t, n) {
210
- let { state: r } = e, i = r.selectedNode ? r.selectedNode.id : null;
211
- if (e.ask("map:set", {
212
- nodes: t,
213
- edges: n
214
- }) || (r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n), r.selectedEdge = null, i) {
215
- let t = r.nodes.find((e) => e.id === i);
216
- t ? r.selectedNode = t : S(e, { source: "api" });
217
- }
218
- e.touchScene();
219
- }
220
- function rt(e) {
221
- let { state: t, map: n } = e, { touched: r } = h(t.nodes, e.viewEdges()), i = t.nodes.filter((e) => r.has(e.id) && n.isNodeVisible(e)), a = M(e), o = {
222
- padding: n.fitPadding(),
223
- maxZoom: 1,
224
- minZoom: n.getMinZoom()
225
- }, s = pe(i, a, {
226
- ...o,
227
- minZoom: Math.max(o.minZoom, ne)
228
- }), c = i.length ? I(s, a, o) : null;
229
- c ? (Object.assign(t.camera, c), n.render()) : n.fitGraphToViewport(n.fitPadding());
230
- }
231
- var it = (e, t) => (e.nodes.find((e) => e.id === t) || { label: t }).label, at = (e) => e.kind || (e.dashed ? "usage" : "ownership");
232
- function ot(e, t, n, { select: r = !0 } = {}) {
233
- let { state: i, map: a } = e, o = t === "edge" ? i.edges.find((e) => Z(e) === n) : i.nodes.find((e) => e.id === n);
234
- if (!o) return;
235
- let s = (t === "edge" ? [i.nodes.find((e) => e.id === o.from), i.nodes.find((e) => e.id === o.to)] : [o]).filter(Boolean);
236
- if (!s.length) return;
237
- i.proposalView !== "diff" && s.some((e) => !a.isNodeVisible(e)) && tt(e, "diff", { quiet: !0 }), r && (t === "edge" ? ct(e, o) : P(e, o));
238
- let c = I(s, M(e), {
239
- padding: a.fitPadding(),
240
- maxZoom: Math.max(1, i.camera.zoom),
241
- minZoom: a.getMinZoom()
242
- });
243
- c && Object.assign(i.camera, c), a.render(), d(e, ge(de[o.mark] || o.mark, t === "edge" ? `${it(i, o.from)} to ${it(i, o.to)}` : o.label));
244
- }
245
- function st(e, t, n, r) {
246
- let i = null, a = r;
247
- for (let r of e.map.getScene().edges) if (r.mark !== "none") for (let e = 0; e <= 1; e += 1 / 20) {
248
- let o = L(r, e), s = Math.hypot(o.x - t, o.y - n);
249
- s <= a && (i = r, a = s);
250
- }
251
- return i && e.viewEdges().find((e) => e.from === i.from && e.to === i.to && at(e) === i.kind) || null;
252
- }
253
- function ct(e, t) {
254
- S(e, { source: "api" }), e.state.selectedEdge = t, e.emit("node:show-edge", { edge: t }), e.touchScene(), e.map.render();
255
- }
256
- function lt(e, t) {
257
- let n = e.state.canvas;
258
- if (!n) return () => {};
259
- let r = null, i = [t(n, "mousedown", (e) => {
260
- r = {
261
- x: e.clientX,
262
- y: e.clientY
263
- };
264
- }), t(n, "click", (t) => {
265
- let { state: i } = e;
266
- if (!i.proposal || i.proposalView === "before" || r && Math.hypot(t.clientX - r.x, t.clientY - r.y) > 5) return;
267
- let a = n.getBoundingClientRect(), o = e.map.screenToWorld(t.clientX - a.left, t.clientY - a.top), s = i.camera.zoom;
268
- if (i.nodes.some((t) => e.map.isNodeVisible(t) && Math.hypot(t.x - o.x, t.y - o.y) <= t.r + 6 / s)) return;
269
- let c = st(e, o.x, o.y, 8 / s);
270
- c && ct(e, c);
271
- })];
272
- return () => i.forEach((e) => e());
273
- }
274
- var ut = (e) => $(e).pinnedSource, dt = ({ edit: e = !0 } = {}) => ({
275
- bar: "<section id=\"proposal-bar\" class=\"hx-proposal-bar glass\" aria-label=\"Open proposal\" hidden data-corn=\"proposal-bar\"><p id=\"proposal-message\" class=\"hx-proposal-message\" data-corn=\"message\" role=\"status\" hidden></p><div id=\"proposal-ways\" class=\"hx-proposal-ways\" role=\"group\" aria-label=\"Ways on\" data-corn=\"proposal-ways\" hidden></div><div id=\"proposal-body\"><div class=\"hx-proposal-head\" data-corn=\"proposal-head\" role=\"group\" aria-label=\"Proposal actions\"><h2 id=\"proposal-title\" class=\"hx-proposal-name\" data-corn=\"proposal-title\"></h2><a id=\"proposal-source\" class=\"hx-proposal-source\" data-corn=\"proposal-source\" hidden></a><div class=\"hx-proposal-counts\"><div id=\"proposal-chip\" class=\"hx-proposal-chip\" data-corn=\"proposal-counts\"></div><p id=\"proposal-peek\" class=\"hx-proposal-peek\"></p><button type=\"button\" id=\"proposal-mode\" class=\"hx-proposal-mode\" data-corn=\"proposal-mode\" data-action=\"toggle-proposal-mode\" data-peek-ok aria-expanded=\"false\" aria-controls=\"proposal-seg\" title=\"Before, Diff or After\"></button></div><div id=\"proposal-seg\" class=\"hx-seg\" data-corn=\"compare\" role=\"group\" aria-label=\"Compare\"><button data-corn=\"compare-option\" type=\"button\" class=\"hx-seg-btn\" data-action=\"proposal-view\" data-view=\"before\" aria-pressed=\"false\" data-corn-string=\"before\">Before</button><button data-corn=\"compare-option\" type=\"button\" class=\"hx-seg-btn\" data-action=\"proposal-view\" data-view=\"diff\" aria-pressed=\"true\" data-corn-string=\"diff\">Diff</button><button data-corn=\"compare-option\" type=\"button\" class=\"hx-seg-btn\" data-action=\"proposal-view\" data-view=\"after\" aria-pressed=\"false\" data-corn-string=\"after\">After</button></div><div class=\"hx-proposal-tools\"><button data-corn=\"whole-map\" data-corn-kind=\"secondary\" type=\"button\" id=\"proposal-whole\" class=\"hx-btn\" data-action=\"proposal-whole\" aria-pressed=\"false\" aria-label=\"Show the whole map\" title=\"Show the whole map\" data-peek-ok data-corn-string=\"wholeMap\" data-corn-string-aria-label=\"showWholeMap\">Whole map</button>" + (e ? "<button data-corn-kind=\"secondary\" type=\"button\" id=\"proposal-myedits\" class=\"hx-btn\" aria-pressed=\"true\" data-peek-ok data-corn-string=\"myEdits\" hidden>My edits</button><button data-corn-kind=\"secondary\" type=\"button\" id=\"proposal-edit\" class=\"hx-btn\" aria-expanded=\"false\" aria-controls=\"whatif\" title=\"Try a change: add a node or an edge, reword a scenario\">Edit</button>" : "") + "</div><div class=\"hx-proposal-more\"><button type=\"button\" id=\"proposal-more\" class=\"hx-btn hx-btn--icon\" data-action=\"toggle-proposal-more\" aria-haspopup=\"menu\" aria-expanded=\"false\" aria-controls=\"proposal-more-menu\" aria-label=\"More\" data-corn-kind=\"icon\"><svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\"><circle cx=\"3\" cy=\"8\" r=\"1.5\"/><circle cx=\"8\" cy=\"8\" r=\"1.5\"/><circle cx=\"13\" cy=\"8\" r=\"1.5\"/></svg></button><div id=\"proposal-more-menu\" class=\"hx-proposal-more-menu glass\" data-corn=\"proposal-menu\" role=\"menu\" aria-label=\"More\" hidden><button type=\"button\" role=\"menuitem\" class=\"hx-btn hx-btn--quiet\" data-action=\"close-proposal\" title=\"Close the proposal and go back to the map\" data-corn-kind=\"quiet\" data-corn-string=\"closeProposal\">Close</button></div></div></div><details id=\"proposal-errors\" class=\"hx-proposal-errors\" data-corn=\"proposal-errors\" hidden><summary data-corn=\"summary\" id=\"proposal-errors-count\"></summary><ul id=\"proposal-errors-list\"></ul><p class=\"hx-faint\">The map shows what it can.</p></details></div></section>",
276
- menu: "<div id=\"proposal-wrap\"><button type=\"button\" id=\"proposal-btn\" class=\"hx-account-item\" data-action=\"toggle-proposals-menu\" aria-haspopup=\"true\" aria-expanded=\"false\" title=\"Open a proposal: what a change would add, change and remove\" data-corn=\"proposals-button\"><span data-corn-string=\"proposals\">Proposals</span><span class=\"hx-faint\" aria-hidden=\"true\">▾</span></button><div id=\"proposal-menu\" class=\"hx-menu hx-menu--proposals\" hidden data-corn=\"proposals-menu\"></div></div>"
277
- });
278
- function ft(e, t = 8) {
279
- let n = e.slice(0, t).map((e) => `<li>${e.path ? `<code class="hx-code">${y(e.path)}</code> ` : ""}${y(e.message)}</li>`);
280
- return e.length > t && n.push(`<li class="hx-faint">and ${e.length - t} more</li>`), n.join("");
281
- }
282
- var pt = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, mt = (e) => typeof e == "string" && /^https?:\/\//i.test(e) ? e : null;
283
- function ht(e) {
284
- return e.pull ? `Spec PR #${e.pull.number}${e.pull.draft ? " (draft)" : ""}${e.pull.author ? ` by ${e.pull.author}` : ""}` : e.source === "checkout" ? "In the checkout" : `In worktree ${e.source}`;
285
- }
286
- function gt(e, t) {
287
- let n = t && t.slug === e.slug && t.source === e.source, r = `<span class="hx-proposal-title">${y(e.title || e.slug)}</span>`, i = [`<span class="hx-proposal-where">${y(ht(e))}</span>`];
288
- if (e.spec && i.push(`<span>spec ${y(e.spec)}</span>`), e.error) return `<div class="hx-proposal-item is-broken" data-corn="row">${r}<span class="hx-proposal-sum hx-error-text">${y(e.error)}</span><span class="hx-proposal-meta">${i.join("")}</span></div>`;
289
- e.counts && i.push(`<span>${y(oe(e.counts))}</span>`);
290
- let a = z(e.review, Date.now());
291
- return a && i.push(`<span class="hx-proposal-reviewed">${y(a)}</span>`), e.errors && i.push(`<span class="hx-warn">${y(pt(e.errors, "problem"))}</span>`), `<button type="button" class="hx-proposal-item${n ? " is-current" : ""}" data-action="open-proposal" data-slug="${y(e.slug)}" data-source="${y(e.source)}" data-corn="row">${r}${e.summary ? `<span class="hx-proposal-sum">${y(e.summary)}</span>` : ""}<span class="hx-proposal-meta">${i.join("")}</span></button>`;
292
- }
293
- function _t(e, t, n = {}) {
294
- let { state: i } = t, a = v(t), s = dt({ edit: n.edit !== !1 }), c = [...R(t, e, s.bar, n.slots, "bar"), ...R(t, e, s.menu, n.slots, "menu")], l = (e) => {
295
- for (let t of c) {
296
- if (t.id === e) return t;
297
- let n = t.querySelector(`[id="${e}"]`);
298
- if (n) return n;
299
- }
300
- return null;
301
- };
302
- a.keepParts(...c);
303
- let u = l("proposal-bar"), f = null, p = null, m = !1;
304
- function h({ text: e, isError: t, ways: n }) {
305
- u.hidden = !1, u.classList.toggle("is-error", t), l("proposal-body").hidden = !0;
306
- let r = l("proposal-message");
307
- r.hidden = !1, r.textContent = e;
308
- let i = l("proposal-ways");
309
- i.hidden = n.length === 0, i.innerHTML = n.map((e) => `<button type="button" class="hx-btn" data-action="proposal-way" data-way="${y(e.way)}"${e.slug ? ` data-slug="${y(e.slug)}"` : ""}${e.source ? ` data-source="${y(e.source)}"` : ""} data-peek-ok data-corn-kind="quiet">${y(e.label)}</button>`).join(""), o(i);
310
- }
311
- let g = t.slot("proposal-pulls", () => /* @__PURE__ */ new Map()), _ = null;
312
- function b() {
313
- let e = l("proposal-source"), n = i.proposal ? i.proposalSource : null;
314
- if (e.hidden = !n, !n) return;
315
- let r = G(n), a = r ? g.get(r) : null, o = Ge(t).entries, s = r && Array.isArray(o) ? o.find((e) => e.slug === i.proposalSlug && e.source === n) : null, c = _e(n, a && a.pull || s && s.pull || null, a ? a.checks : null);
316
- e.textContent = c.text, c.state ? e.dataset.cornState = c.state : delete e.dataset.cornState;
317
- let u = mt(c.href);
318
- u ? (e.setAttribute("href", u), e.setAttribute("target", "_blank"), e.setAttribute("rel", "noreferrer"), e.title = "Open this pull request") : (e.removeAttribute("href"), e.removeAttribute("target"), e.removeAttribute("rel"), e.title = c.label);
319
- let d = `${n}/${i.proposalSlug}`;
320
- r && _ !== d && (_ = d, S(r));
321
- }
322
- async function S(e) {
323
- try {
324
- let n = await Be(t)(`/api/forge/pulls/${e}`), r = n.ok ? await n.json() : null;
325
- if (m) return;
326
- r && r.ok !== !1 && r.pull && g.set(e, {
327
- pull: r.pull,
328
- checks: Array.isArray(r.checks) ? r.checks : null
329
- }), r && r.pull && G(i.proposalSource) === e && t.emit("proposal:pull-head", r.pull.head && typeof r.pull.head.sha == "string" ? r.pull.head.sha : "");
330
- } catch {}
331
- !m && i.proposal && G(i.proposalSource) === e && b();
332
- }
333
- function C({ open: e = !!i.proposal } = {}) {
334
- if (u.hidden = !e, !e) {
335
- A(), M(!1), we(t, "proposal");
336
- return;
337
- }
338
- u.classList.remove("is-error"), l("proposal-message").hidden = !0, l("proposal-body").hidden = !1;
339
- let n = i.proposal, r = l("proposal-title");
340
- r.textContent = n && typeof n.title == "string" && n.title || i.proposalSlug || "Proposal", b(), r.title = n && typeof n.summary == "string" && n.summary || "";
341
- let a = l("proposal-chip");
342
- a.innerHTML = se(ie(n)).map((e) => {
343
- let t = e.mark ? `<span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${W(e.mark)} aria-hidden="true"></span>` : "";
344
- return !e.mark && /scenarios?$/.test(e.text) ? `<button type="button" class="hx-proposal-count" data-action="review-show-scenarios" data-corn-kind="quiet" title="Show the personas and their scenarios">${y(e.text)}</button>` : `<button type="button" class="hx-proposal-count" data-action="review-show-changes" data-corn-kind="quiet" title="Show the list of changes">${t}${y(e.text)}</button>`;
345
- }).join("<span class=\"hx-proposal-sep\" aria-hidden=\"true\"> · </span>");
346
- let s = q(i.whatIf && i.whatIf.edits, !!i.whatIfOff);
347
- s && a.insertAdjacentHTML("beforeend", `<span class="hx-proposal-sep" aria-hidden="true"> · </span><span class="hx-proposal-count hx-proposal-yours"><span class="hx-mark-dot hx-mark-dot--edit" data-corn="mark-dot" data-corn-state="edit" aria-hidden="true"></span>${y(s)}</span>`), o(a), l("proposal-mode").textContent = D(t, i.proposalView);
348
- for (let e of u.querySelectorAll("[data-action=\"proposal-view\"]")) {
349
- let t = e.dataset.view === i.proposalView;
350
- e.setAttribute("aria-pressed", String(t)), e.classList.toggle("is-on", t);
351
- }
352
- let c = l("proposal-whole"), d = !!(i.review && i.review.whole);
353
- c.setAttribute("aria-pressed", String(d)), c.title = D(t, "showWholeMap"), c.classList.toggle("hx-btn--active", d);
354
- let f = i.proposalErrors || [], p = l("proposal-errors");
355
- p.hidden = f.length === 0, f.length && (l("proposal-errors-count").textContent = `${pt(f.length, "problem")} in this proposal`, l("proposal-errors-list").innerHTML = ft(f));
356
- }
357
- function w() {
358
- let e = l("proposal-body");
359
- if (f && f.isConnected) return f;
360
- f = t.doc.createElement("p"), f.className = "hx-waiting-line", f.dataset.corn = "waiting-line", f.setAttribute("part", "waiting-line"), f.dataset.cornState = "waiting", f.hidden = !0, f.innerHTML = "<span data-waiting-words></span> <button type=\"button\" class=\"hx-btn hx-forge-act\" data-waiting-answer data-peek-ok data-corn-kind=\"secondary\"></button>";
361
- let n = e.querySelector(".hx-proposal-head");
362
- return n ? n.after(f) : e.append(f), f;
363
- }
364
- function T(e, n) {
365
- let r = w();
366
- if (r.hidden = !e, !e) {
367
- p = null;
368
- return;
369
- }
370
- let i = K(e);
371
- r.querySelector("[data-waiting-words]").textContent = i;
372
- let a = r.querySelector("[data-waiting-answer]");
373
- a.textContent = D(t, "answer"), a.dataset.waitingAnswer = e.runId, a.setAttribute("aria-label", `${D(t, "answer")}: ${i}`);
374
- let o = `${n}|${e.runId}`;
375
- p !== o && (p = o, d(t, i));
376
- }
377
- let E = () => [...u.querySelectorAll("#proposal-more-menu [role=\"menuitem\"]")], k = () => {
378
- let e = l("proposal-more-menu");
379
- return !!e && !e.hidden;
380
- };
381
- function A(e = !1) {
382
- l("proposal-more-menu").hidden = !0;
383
- let t = l("proposal-more");
384
- t.setAttribute("aria-expanded", "false"), e && t.focus();
385
- }
386
- function j(e = "first") {
387
- l("proposal-more-menu").hidden = !1, l("proposal-more").setAttribute("aria-expanded", "true");
388
- let t = E();
389
- (e === "last" ? t[t.length - 1] : t[0])?.focus();
390
- }
391
- function M(e) {
392
- let t = typeof e == "boolean" ? e : u.dataset.modeOpen !== "true";
393
- u.dataset.modeOpen = String(t), l("proposal-mode").setAttribute("aria-expanded", String(t));
394
- }
395
- function N(e) {
396
- let n = l("proposal-more");
397
- if (e.target === n && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
398
- e.preventDefault(), j(e.key === "ArrowUp" ? "last" : "first");
399
- return;
400
- }
401
- if (!k()) return;
402
- if (e.key === "Escape") {
403
- e.preventDefault(), A(!0);
404
- return;
405
- }
406
- if (e.key === "Tab") {
407
- A();
408
- return;
409
- }
410
- let r = E(), i = r.indexOf(t.active());
411
- if (i < 0) return;
412
- let a = {
413
- ArrowDown: (i + 1) % r.length,
414
- ArrowUp: (i - 1 + r.length) % r.length,
415
- Home: 0,
416
- End: r.length - 1
417
- }[e.key];
418
- a !== void 0 && (e.preventDefault(), r[a].focus());
419
- }
420
- let P = () => {
421
- let e = l("proposal-menu");
422
- return !!e && !e.hidden;
423
- };
424
- function F() {
425
- l("proposal-menu").hidden = !0, l("proposal-btn").setAttribute("aria-expanded", "false");
426
- }
427
- async function I() {
428
- let e = l("proposal-menu");
429
- if (P()) return F();
430
- e.hidden = !1, l("proposal-btn").setAttribute("aria-expanded", "true"), Ge(t).entries || L(!0), await Ke(t);
431
- }
432
- function L(e = !1) {
433
- let n = l("proposal-menu"), { entries: r, problem: a, forgeProblem: s } = Ge(t), c = i.proposal ? {
434
- slug: i.proposalSlug,
435
- source: i.proposalSource
436
- } : null, u;
437
- u = e && !r ? "<p class=\"hx-faint hx-proposal-empty\">Looking for proposals …</p>" : a ? `<p class="hx-error-text hx-proposal-empty">The list could not be loaded: ${y(a)}</p>` : !r || r.length === 0 ? "<p class=\"hx-faint hx-proposal-empty\">No proposals</p>" : `<div class="hx-proposal-list" role="list">${r.map((e) => `<div role="listitem">${gt(e, c)}</div>`).join("")}</div>`;
438
- let d = s && !a ? `<p class="hx-error-text hx-proposal-empty">The spec PRs could not be listed: ${y(s)}</p>` : "";
439
- n.innerHTML = `<div class="hx-menu-title hx-menu-head" data-corn="menu-title"><span>${y(D(t, "proposals"))}</span></div>${d}${u}`, o(n);
440
- }
441
- async function z(e, n) {
442
- let r = await Ye(t, e, n);
443
- if (m) return;
444
- let i = r ? l("proposal-title") : u.querySelector("#proposal-ways [data-way=\"retry\"]");
445
- i && (r && (i.tabIndex = -1), i.focus());
446
- }
447
- function B() {
448
- et(t), i.canvas && i.canvas.focus();
449
- }
450
- function V() {
451
- t.ask("work:open-specs") !== !0 && (P() || I());
452
- }
453
- let H = {
454
- "toggle-proposals-menu": () => I(),
455
- "open-proposal": (e) => Ye(t, e.dataset.slug, e.dataset.source || null),
456
- "close-proposal": () => et(t),
457
- "proposal-whole": () => {
458
- Pe(t, !(i.review && i.review.whole)), Qe(t);
459
- },
460
- "proposal-view": (e) => {
461
- tt(t, e.dataset.view), M(!1);
462
- },
463
- "toggle-proposal-mode": () => M(),
464
- "toggle-proposal-more": () => k() ? A() : j(),
465
- "review-show-changes": () => t.emit("changes:show", "changes"),
466
- "review-show-scenarios": () => t.emit("changes:show", "scenarios"),
467
- "proposal-way": (e) => e.dataset.way === "open" ? Ye(t, e.dataset.slug, e.dataset.source || null) : e.dataset.way === "retry" ? z(e.dataset.slug, e.dataset.source || null) : e.dataset.way === "close" ? B() : V()
468
- };
469
- a.listen(t.root, "click", (e) => {
470
- let t = e.target.closest ? e.target.closest("[data-action]") : null, n = t && Object.hasOwn(H, t.dataset.action) && H[t.dataset.action];
471
- n && n(t), k() && !(t && t.dataset.action === "toggle-proposal-more") && A(!!(t && t.closest("#proposal-more-menu")));
472
- let r = l("proposal-wrap");
473
- P() && r && !r.contains(e.target) && !(t && t.dataset.action === "proposal-way") && F();
474
- }), a.listen(u, "click", (e) => {
475
- let n = e.target.closest && e.target.closest("[data-waiting-answer]");
476
- n && (e.preventDefault(), e.stopPropagation(), t.emit("work:answer", { run: n.dataset.waitingAnswer }));
477
- }, !0);
478
- let U = (e) => {
479
- let t = l("proposal-wrap");
480
- t && (t.hidden = !!e);
481
- };
482
- a.on("work:available", ({ on: e }) => U(e)), t.ask("work:on") && U(!0), a.listen(t.root, "keydown", (e) => {
483
- e.key === "Escape" && P() && F(), N(e);
484
- });
485
- function J() {
486
- let e = t.tokenElement();
487
- if (!e || !e.style) return;
488
- let { mark: n } = x(r(i.theme), O(t).get());
489
- for (let t of Object.keys(n)) e.style.setProperty(`--hx-mark-${t}`, n[t].color);
490
- }
491
- J(), a.on("theme", J), a.own(O(t).onChange(() => J())), a.on("proposal:draw", ({ open: e }) => C({ open: e })), a.on("changes:peek", (e) => {
492
- l("proposal-peek").textContent = e;
493
- }), a.on("proposal:focus-title", () => {
494
- let e = l("proposal-title");
495
- e.tabIndex = -1, e.focus();
496
- }), a.on("proposal:message", (e) => h(e)), a.on("proposal:listing", () => {
497
- L(), i.proposal && b();
498
- }), a.on("proposal:waiting", ({ run: e, key: t }) => T(e, t)), a.on("proposal:waiting-reset", () => {
499
- p = null, f = null;
500
- }), a.on("proposal", ({ change: e }) => {
501
- e === "opened" && F();
502
- }), a.own(lt(t, (e, t, n) => a.listen(e, t, n))), Se(t), be(t, "proposal", u, { stub: () => ({ title: l("proposal-title") && l("proposal-title").textContent || "Proposal" }) }), a.own(() => xe(t, "proposal")), a.own(() => {
503
- m = !0, c.forEach((e) => e.remove());
504
- }), C();
505
- let ee = Je(t);
506
- return ee && !i.proposal && h(ee), {
507
- elements: c,
508
- renderBar: () => Qe(t),
509
- paintWaitingLine: T,
510
- toggleMenu: I,
511
- closeMenu: F,
512
- setMessage: (e, n, r) => qe(t, e, n, r),
513
- sayBadLink: (e) => {
514
- let n = ye(e);
515
- return n && qe(t, n, !0, [{
516
- label: D(t, "openSpecsList"),
517
- way: "specs"
518
- }]), !!n;
519
- },
520
- update(e) {
521
- if (!e || !("proposal" in e || "view" in e)) {
522
- Qe(t);
523
- return;
524
- }
525
- let n;
526
- if ("proposal" in e) {
527
- let r = e.proposal;
528
- r === null ? et(t) : typeof r == "string" ? n = i.proposal && i.proposalSlug === r && (e.source || null) === (i.proposalSource || null) && i.proposal ? Promise.resolve(!0) : Ye(t, r, e.source || null) : r && typeof r == "object" && Xe(t, r, {
529
- slug: e.slug || null,
530
- source: e.source || null,
531
- pinSource: !!e.source,
532
- view: Q.includes(e.view) ? e.view : "diff",
533
- sha256: e.sha256 || null
534
- });
535
- }
536
- return "view" in e && Q.includes(e.view) && !(typeof e.proposal == "string" && n) ? tt(t, e.view, { quiet: !0 }) : "view" in e && n && (n = n.then((n) => (n && Q.includes(e.view) && tt(t, e.view, { quiet: !0 }), n))), n;
537
- },
538
- pinnedSource: () => ut(t),
539
- destroy: () => a.destroy()
540
- };
541
- }
542
- var vt = (e) => e === void 0 ? null : Array.isArray(e) ? e : [e], yt = (e) => !e.kind && !e.dashed;
543
- function bt(e, t) {
544
- if (!t) return null;
545
- let n = c(t);
546
- return e.find((e) => e.type === "persona" && (e.id === n || e.id === t)) || null;
547
- }
548
- function xt(e) {
549
- return e.account === !1 ? { account: !1 } : {
550
- role: e.role,
551
- groups: Array.isArray(e.groups) ? [...e.groups] : []
552
- };
553
- }
554
- var St = (e) => e ? e.codeLabel || e.label || e.id : "";
555
- function Ct(e, t) {
556
- let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
557
- for (let e of t) yt(e) && !r.has(e.to) && r.set(e.to, e.from);
558
- return {
559
- nodes: e,
560
- byId: n,
561
- owner: r
562
- };
563
- }
564
- function wt(e, t) {
565
- let n = e.byId.get(t);
566
- return n ? n.type === "table" && (n.table || n.label) || null : typeof t == "string" && t.startsWith("table-") ? t.slice(6) : null;
567
- }
568
- function Tt(e, t, n) {
569
- return !t || t.type !== "page" || !Array.isArray(t.methods) || t.methods.length === 0 ? !1 : !n || !Array.isArray(n.apps) || n.apps.includes(e.owner.get(t.id));
570
- }
571
- function Et(e, t, n) {
572
- let r = vt(e && e.check);
573
- if (r) return r.map((e) => ({ ...e }));
574
- if (!e) return [];
575
- if (e.node !== void 0) {
576
- let r = t.byId.get(e.node);
577
- if (!Tt(t, r, n)) return [];
578
- let i = r.methods.map((e) => String(e).toUpperCase());
579
- return [{
580
- route: r.label,
581
- method: i.includes("GET") ? "GET" : i[0]
582
- }];
583
- }
584
- if (e.edge && e.edge.kind === "writes") {
585
- let n = wt(t, e.edge.to);
586
- return n ? [{
587
- table: n,
588
- op: "write"
589
- }] : [];
590
- }
591
- if (e.edge && e.edge.kind === "reads") {
592
- let n = wt(t, e.edge.from);
593
- return n ? [{
594
- table: n,
595
- op: "read"
596
- }] : [];
597
- }
598
- return [];
599
- }
600
- function Dt(e, t, n, { as: r = null } = {}) {
601
- let i = [], a = [];
602
- return (e && Array.isArray(e.steps) ? e.steps : []).forEach((o, s) => {
603
- let c = r || o.actor || e.actor || null, l = {
604
- index: s,
605
- actor: c,
606
- actorLabel: "",
607
- kind: "none",
608
- checks: [],
609
- expect: o.expect
610
- };
611
- if (i.push(l), !c) return;
612
- let u = bt(t.nodes, c);
613
- if (l.actorLabel = u ? St(u) : c, !u) {
614
- l.kind = "unchecked", l.why = `no persona "${c}" on the map`;
615
- return;
616
- }
617
- let d = Et(o, t, n);
618
- if (d.length === 0) {
619
- l.kind = "unchecked", l.why = Array.isArray(o.check) ? "this step is not a permission question" : "nothing in this step to ask";
620
- return;
621
- }
622
- l.kind = "ask";
623
- let f = xt(u);
624
- l.checks = d.map((e, t) => ({
625
- id: `s${s + 1}-${t + 1}`,
626
- ...e
627
- })), l.checks.forEach((e) => a.push({
628
- ...e,
629
- actor: f
630
- }));
631
- }), {
632
- steps: i,
633
- items: a,
634
- key: JSON.stringify(a)
635
- };
636
- }
637
- function Ot(e, t = {}) {
638
- let n = Error(t.message || e);
639
- return n.reason = e, Object.assign(n, t), n;
640
- }
641
- async function kt(e, t, { signal: n } = {}) {
642
- let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
643
- if (!e) throw Ot("no-checker", { message: "no permission checker" });
644
- let a = e.max > 0 ? e.max : 100, o = t.slice();
645
- for (; o.length;) {
646
- let t = o.slice(0, a), s;
647
- try {
648
- s = await e.check(t, { signal: n });
649
- } catch (e) {
650
- let n = e && e.reason === "bad-check" ? e.checkId : null;
651
- if (n && t.some((e) => e.id === n)) {
652
- i.set(n, e.message || "the checker refused this check"), o = o.filter((e) => e.id !== n);
653
- continue;
654
- }
655
- throw e;
656
- }
657
- for (let e of s || []) e && typeof e.id == "string" && r.set(e.id, e);
658
- o = o.slice(t.length);
659
- }
660
- return {
661
- results: r,
662
- bad: i
663
- };
664
- }
665
- function At(e, t) {
666
- let n = {
667
- mismatch: !1,
668
- actor: e ? e.actorLabel : "",
669
- checks: []
670
- };
671
- if (!e || e.kind === "none") return {
672
- ...n,
673
- state: "none"
674
- };
675
- if (e.expect && (n.expect = e.expect), e.kind === "unchecked") return {
676
- ...n,
677
- state: "unchecked",
678
- why: e.why
679
- };
680
- if (!t || t.status === "idle" || t.status === "pending") return {
681
- ...n,
682
- state: "pending",
683
- checks: e.checks
684
- };
685
- if (t.status === "failed") return {
686
- ...n,
687
- state: "unavailable",
688
- why: jt(t.error),
689
- checks: e.checks
690
- };
691
- let r = e.checks.map((e) => ({
692
- ...e,
693
- result: t.results.get(e.id) || null
694
- })), i = e.checks.find((e) => t.bad && t.bad.has(e.id));
695
- if (i) return {
696
- ...n,
697
- state: "unchecked",
698
- why: t.bad.get(i.id),
699
- checks: r
700
- };
701
- if (r.some((e) => !e.result)) return {
702
- ...n,
703
- state: "unavailable",
704
- why: "the checker gave no answer for this step",
705
- checks: r
706
- };
707
- let a = r.find((e) => e.result.allowed !== !0), o = a ? "refused" : "allowed", s = {
708
- ...n,
709
- state: o,
710
- checks: r
711
- };
712
- return a && (s.reason = a.result.reason || `refused (${a.result.status})`, a.result.rule && (s.rule = a.result.rule)), s.mismatch = !!e.expect && e.expect !== o, s;
713
- }
714
- function jt(e) {
715
- let t = e && e.reason;
716
- return t === "no-checker" ? "no permission checker" : t === "no-token" ? `no token${e.hint ? ` (${e.hint})` : ""}` : t === "forbidden" ? "the token is not an admin's" : "the checker is not answering";
717
- }
718
- function Mt(e) {
719
- return e.route === void 0 ? [
720
- e.table,
721
- e.op,
722
- e.row
723
- ].filter(Boolean).join(" · ") : `${String(e.method || "").toUpperCase()} ${e.route}`;
724
- }
725
- function Nt(e) {
726
- if (!e || e.state === "none") return null;
727
- let t = e.actor ? ` as ${e.actor}` : "", n = e.checks.map(Mt).join(", "), r = n ? `${n}${t}` : e.actor ? `As ${e.actor}` : "", i = () => `${e.reason}${e.rule ? ` (${e.rule})` : ""}`;
728
- if (e.state === "pending") return {
729
- tone: "pending",
730
- pill: "Checking…",
731
- line: `Checking${t}…`,
732
- detail: r
733
- };
734
- if (e.state === "unchecked") return {
735
- tone: "unchecked",
736
- pill: "Not checked",
737
- line: `Not checked: ${e.why}`,
738
- detail: r
739
- };
740
- if (e.state === "unavailable") return {
741
- tone: "unavailable",
742
- pill: "Unavailable",
743
- line: `Not checked: live layer unavailable (${e.why})`,
744
- detail: r
745
- };
746
- if (e.mismatch) {
747
- let t = e.state === "refused" ? `Expected allowed, but refused: ${i()}` : "Expected refused, but allowed";
748
- return {
749
- tone: "mismatch",
750
- pill: `Expected ${e.expect}`,
751
- line: t,
752
- detail: r
753
- };
754
- }
755
- return e.state === "refused" ? {
756
- tone: "refused",
757
- pill: "✕ Refused",
758
- line: `Refused: ${i()}`,
759
- detail: r
760
- } : {
761
- tone: "allowed",
762
- pill: "✓ Allowed",
763
- line: "Allowed",
764
- detail: r
765
- };
766
- }
767
- // ../explorer/engine/checks.js
768
- var Pt = (e) => !!e && (!!e.actor || Array.isArray(e.steps) && e.steps.some((e) => e && e.actor));
769
- function Ft(e, t = {}) {
770
- let { state: n } = e, r = t.checker || null, i = null, a = 0, s = /* @__PURE__ */ new WeakMap(), c = [];
771
- function l() {
772
- i && i.controller && i.controller.abort(), i = null, a++;
773
- }
774
- function u(e) {
775
- e ||= null, e !== r && l(), r = e;
776
- }
777
- function d() {
778
- let e = i;
779
- if (!e) return;
780
- e.controller && e.controller.abort();
781
- let t = e.plan.items;
782
- if (t.length === 0) {
783
- e.answer = {
784
- status: "ok",
785
- results: /* @__PURE__ */ new Map(),
786
- bad: /* @__PURE__ */ new Map()
787
- }, a++;
788
- return;
789
- }
790
- let n = new AbortController();
791
- e.controller = n, e.answer = { status: "pending" }, a++, kt(r, t, { signal: n.signal }).then(({ results: t, bad: r }) => f(e, n, {
792
- status: "ok",
793
- results: t,
794
- bad: r
795
- }), (t) => {
796
- n.signal.aborted || f(e, n, {
797
- status: "failed",
798
- error: t
799
- });
800
- });
801
- }
802
- function f(e, t, n) {
803
- i === e && e.controller === t && (e.controller = null, e.answer = n, a++, e.onChange());
804
- }
805
- function p(e, t = !1) {
806
- let o = i;
807
- if (!o || !t && o.scenario === e && o.nodes === n.nodes && o.plan) return;
808
- let s = o.plan ? o.plan.key : null;
809
- o.scenario = e, o.nodes = n.nodes, o.plan = Dt(e, Ct(n.nodes, n.edges), r, { as: o.as }), a++, (t || o.plan.key !== s) && d();
810
- }
811
- function m(t, r = () => {}) {
812
- i && i.scenario && t && i.scenario.id === t.id ? (i.onChange = r, p(t)) : (l(), i = {
813
- scenario: null,
814
- as: null,
815
- nodes: null,
816
- plan: null,
817
- answer: { status: "idle" },
818
- controller: null,
819
- onChange: r
820
- }, Pt(t) && b(n).persona !== !0 && je(e, "persona", !0, { scenario: !0 }), p(t));
821
- }
822
- function h(e, t) {
823
- if (!i) return e;
824
- p(t);
825
- let n = i.plan.steps[e.index];
826
- return e.verdict = At(n, i.answer), i.as && n && n.actor && (e.current.actor = n.actor), e;
827
- }
828
- function g() {
829
- return !i || !i.plan ? [] : i.plan.steps.map((e) => At(e, i.answer));
830
- }
831
- function _(e) {
832
- i && (i.as = e || null, p(i.scenario, !0), i.onChange());
833
- }
834
- function v() {
835
- i && (p(i.scenario, !0), i.onChange());
836
- }
837
- function x(t) {
838
- let n = e.doc, r = n.createElement("span");
839
- r.className = "hx-player-verdict", r.dataset.corn = "state-pill", r.hidden = !0;
840
- let i = t.querySelector(".hx-player-text");
841
- i ? i.append(" ", r) : t.prepend(r);
842
- let a = n.createElement("p");
843
- a.className = "hx-player-check", a.dataset.corn = "scenario-check", a.hidden = !0;
844
- let s = n.createElement("div");
845
- s.className = "hx-player-as", s.innerHTML = "\n <label class=\"hx-player-as-label\">As <select data-corn=\"control\" class=\"hx-player-speed hx-player-as-menu\" data-check=\"as\" aria-label=\"Act every step as\"></select></label>\n <button data-corn-kind=\"secondary\" type=\"button\" class=\"hx-btn\" data-check=\"recheck\">Check again</button>\n <span class=\"hx-player-as-sum hx-faint\"></span>";
846
- let l = t.querySelector(".hx-player-track");
847
- l ? (l.before(a), l.before(s)) : (t.appendChild(a), t.appendChild(s));
848
- for (let e of [
849
- r,
850
- a,
851
- s
852
- ]) e.hasAttribute("data-corn") && e.setAttribute("part", e.getAttribute("data-corn"));
853
- o(s);
854
- let u = s.querySelector("[data-check=as]"), d = s.querySelector("[data-check=recheck]"), f = (e) => _(e.target.value);
855
- u.addEventListener("change", f), d.addEventListener("click", v), c.push(() => {
856
- u.removeEventListener("change", f), d.removeEventListener("click", v);
857
- });
858
- }
859
- function S() {
860
- let e = c;
861
- c = [], e.forEach((e) => e());
862
- }
863
- function C(e) {
864
- let t = [{
865
- value: "",
866
- label: "As written"
867
- }, ...n.nodes.filter((e) => e.type === "persona").map((e) => ({
868
- value: e.id.replace(/^persona-/, ""),
869
- label: St(e)
870
- }))], r = t.map((e) => `${e.value}\u0000${e.label}`).join("");
871
- e.dataset.key !== r && (e.innerHTML = t.map((e) => `<option value="${y(e.value)}">${y(e.label)}</option>`).join(""), e.dataset.key = r), e.value = i && i.as ? i.as : "";
872
- }
873
- function w() {
874
- let e = g(), t = e.reduce((e, t) => e + t.checks.length, 0);
875
- if (!i || i.answer.status === "pending") return t ? `Checking ${t}…` : "";
876
- if (i.answer.status === "failed") return "";
877
- let n = e.filter((e) => e.state === "refused").length, r = e.filter((e) => e.mismatch).length, a = [`${t} ${t === 1 ? "check" : "checks"}`];
878
- return n && a.push(`${n} refused`), r && a.push(`${r} not as expected`), t ? a.join(" · ") : "No permission questions";
879
- }
880
- function T(e, t) {
881
- if (!e || !i) return;
882
- if (!e.querySelector(".hx-player-as")) {
883
- if (!Pt(i.scenario)) return;
884
- x(e);
885
- }
886
- let n = e.querySelector(".hx-player-verdict"), r = e.querySelector(".hx-player-check"), a = e.querySelector(".hx-player-as");
887
- if (!n || !r || !a) return;
888
- let o = t.done ? null : Nt(t.verdict);
889
- if (n.hidden = !o, r.hidden = !o, o) {
890
- n.dataset.tone = o.tone, le(o.tone) ? n.dataset.cornState = le(o.tone) : delete n.dataset.cornState, n.textContent = o.pill, n.title = o.line, r.dataset.tone = o.tone;
891
- let e = `${y(o.line)}${o.detail ? ` <span class="hx-player-check-detail">${y(o.detail)}</span>` : ""}`;
892
- s.get(r) !== e && (s.set(r, e), r.innerHTML = e);
893
- }
894
- C(a.querySelector("[data-check=as]")), a.querySelector("[data-check=recheck]").disabled = i.answer.status === "pending", a.querySelector(".hx-player-as-sum").textContent = w();
895
- }
896
- return {
897
- setChecker: u,
898
- open: m,
899
- close: l,
900
- decorate: h,
901
- paint: T,
902
- unmount: S,
903
- verdicts: g,
904
- chooseActor: _,
905
- recheck: v,
906
- version: () => a,
907
- checkedScenarioId: () => i && i.scenario ? i.scenario.id : null
908
- };
909
- }
910
- // ../explorer/scenario.js
911
- var It = 5e3, Lt = "topology.scenarioSpeed", Rt = [
912
- {
913
- value: "2000",
914
- label: "2 s"
915
- },
916
- {
917
- value: "5000",
918
- label: "5 s"
919
- },
920
- {
921
- value: "10000",
922
- label: "10 s"
923
- },
924
- {
925
- value: "manual",
926
- label: "Manual"
927
- }
928
- ];
929
- function zt(e) {
930
- let t = Rt.find((t) => t.value === e);
931
- return t ? t.value === "manual" ? "manual" : Number(t.value) : It;
932
- }
933
- function Bt(e, t = It) {
934
- let n = e && e.ms;
935
- return typeof n == "number" && n > 0 && Number.isFinite(n) ? n : t;
936
- }
937
- var Vt = (e) => e && Array.isArray(e.steps) ? e.steps : [];
938
- function Ht(e) {
939
- let t = e && Array.isArray(e.down) ? e.down : [];
940
- return [...new Set(t.filter((e) => typeof e == "string" && e !== ""))];
941
- }
942
- function Ut(e, t) {
943
- return t && t.actor || e && e.actor || null;
944
- }
945
- function Wt(e, t = {}) {
946
- let n = e, r = t.stepMs, i = () => r === "manual", a = () => n.stepMs ?? (typeof r == "number" && r > 0 ? r : 5e3), o = t.maxFrameMs ?? Infinity, s = 0, c = !1, l = Vt(e).length === 0, u = 0, d = null, f = null, p = () => Vt(n), m = () => p().length - 1, h = (e) => Bt(p()[e], a()), g = (e) => Math.max(0, Math.min(Math.max(0, m()), e)), _ = () => {
947
- s = 0, l = p().length === 0, u = 0, d = null, f = null;
948
- }, v = () => {
949
- c = !1, d = null, f = null;
950
- };
951
- return {
952
- play() {
953
- p().length === 0 || i() || (l && _(), c || (c = !0, d = null));
954
- },
955
- pause() {
956
- v();
957
- },
958
- isPlaying: () => c,
959
- next() {
960
- v(), s < m() ? (s++, u = 0) : p().length && (l = !0);
961
- },
962
- prev() {
963
- v(), l = !1, s > 0 && (s--, u = 0);
964
- },
965
- goTo(e) {
966
- if (v(), !Number.isFinite(e)) return;
967
- let t = g(Math.floor(e));
968
- t !== s && (s = t, u = 0), l = !1;
969
- },
970
- stop() {
971
- v(), _();
972
- },
973
- setSpeed(e) {
974
- r = e, i() && v();
975
- },
976
- scenario: () => n,
977
- setScenario(e) {
978
- n = e, s = g(s), p().length === 0 && (l = !0);
979
- },
980
- tick(e) {
981
- if (!c || i()) return;
982
- if (d === null) {
983
- d = e, f = e - u;
984
- return;
985
- }
986
- let t = Math.max(0, e - d);
987
- for (u += Math.min(t, o), t > o && (f = e - u), d = e; u >= h(s);) {
988
- if (s >= m()) {
989
- u = h(s), l = !0, v();
990
- return;
991
- }
992
- u -= h(s), f += h(s), s++;
993
- }
994
- },
995
- snapshot() {
996
- let e = p(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = [];
997
- for (let n = 0; n <= s && n < e.length; n++) {
998
- let i = e[n];
999
- if (i.node !== void 0 && t.add(i.node), i.at !== void 0 && t.add(i.at), i.edge) {
1000
- t.add(i.edge.from), t.add(i.edge.to);
1001
- let e = Z(i.edge);
1002
- r.has(e) || (r.add(e), a.push({ ...i.edge }));
1003
- }
1004
- }
1005
- let o = e[s], d = { text: o ? String(o.text ?? "") : "" };
1006
- o && o.node !== void 0 && (d.node = o.node), o && o.edge && (d.edge = { ...o.edge }, d.edgeKey = Z(o.edge));
1007
- let m = Ut(n, o);
1008
- m && (d.actor = m), o && o.at !== void 0 && (d.at = o.at), o && o.check !== void 0 && (d.check = JSON.parse(JSON.stringify(o.check))), o && o.expect !== void 0 && (d.expect = o.expect);
1009
- let g = h(s);
1010
- return {
1011
- id: n.id,
1012
- title: n.title,
1013
- total: e.length,
1014
- index: s,
1015
- playing: c,
1016
- done: l,
1017
- visited: {
1018
- nodes: t,
1019
- edges: r,
1020
- edgeList: a
1021
- },
1022
- current: d,
1023
- progress: l ? 1 : i() ? 0 : Math.min(1, u / g),
1024
- manual: i(),
1025
- stepMs: g,
1026
- stepStartMs: f,
1027
- linkNodes: !!n.linkNodes,
1028
- down: Ht(n)
1029
- };
1030
- }
1031
- };
1032
- }
1033
- function Gt(e, t, n, r, i = 60, a = C) {
1034
- if (!n.width || !n.height) return null;
1035
- let o = e.node === void 0 ? e.edge ? [e.edge.from, e.edge.to] : [] : [e.node], s = o.map((e) => r.get(e));
1036
- if (s.length === 0 || s.some((e) => !e)) return null;
1037
- e.at !== void 0 && r.has(e.at) && !o.includes(e.at) && s.push(r.get(e.at));
1038
- let c = {
1039
- x: n.x || 0,
1040
- y: n.y || 0,
1041
- width: n.width,
1042
- height: n.height
1043
- }, l = I(s, c, {
1044
- padding: i,
1045
- maxZoom: Math.max(1, t.zoom),
1046
- minZoom: a
1047
- }), u = Math.min(i, c.width / 4, c.height / 4);
1048
- return ue(s, t, c, u) && t.zoom >= l.zoom - .001 ? null : l;
1049
- }
1050
- // ../explorer/outage-scenario.js
1051
- function Kt(e, t) {
1052
- if (!e) return [];
1053
- let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Set();
1054
- for (let t of [...e.down, ...e.hits.keys()]) {
1055
- let e = n.get(t);
1056
- e && r.add(e.type === "external" ? p(e) : e.type);
1057
- }
1058
- return [...r];
1059
- }
1060
- var qt = 3, Jt = " (in the visitor's browser)";
1061
- function Yt(e) {
1062
- if (e.length < 2) return e.join("");
1063
- let t = e.some((e) => e.includes(" and ")) ? ", and " : " and ";
1064
- return `${e.slice(0, -1).join(", ")}${t}${e[e.length - 1]}`;
1065
- }
1066
- function Xt(e) {
1067
- let t = /* @__PURE__ */ new Map();
1068
- for (let n of e) t.has(n.type) || t.set(n.type, []), t.get(n.type).push(n);
1069
- return Yt([...t].sort(([e, t], [n, r]) => r.length - t.length || w(e) - w(n) || e.localeCompare(n)).map(([e, t]) => {
1070
- let n = ce(e, t.length);
1071
- if (t.length > qt) {
1072
- let e = t.filter((e) => e.browser).length;
1073
- return `${t.length} ${n}${e === t.length ? Jt : e ? ` (${e} in the visitor's browser)` : ""}`;
1074
- }
1075
- return `the ${n} ${Yt(t.map((e) => `${e.label}${e.browser ? Jt : ""}`))}`;
1076
- }));
1077
- }
1078
- function Zt(e, t, n) {
1079
- let r = new Map(t.map((e) => [e.id, e])), i = String(e.label || e.id), a = T([e.id], t, n), o = (e) => (t) => a.hits.has(t.id) && a.hits.get(t.id).when === e, s = new Map(fe(e, t, n).map((e) => [e.when, e.types.flatMap((e) => e.items).filter(o(e.when)).map((e) => ({
1080
- ...e,
1081
- browser: a.hits.get(e.id).browser
1082
- }))])), c = [
1083
- `${i} is down.`,
1084
- e.breaks ? String(e.breaks) : "",
1085
- a.groups.length ? "" : "Nothing on the map uses it."
1086
- ].filter(Boolean).join(" "), l = [{
1087
- node: e.id,
1088
- text: c
1089
- }];
1090
- for (let t of a.groups) {
1091
- let n = s.get(t.when) || [], i = new Set(n.map((e) => e.id)), o = t.ids.filter((e) => !i.has(e)).map((e) => {
1092
- let t = r.get(e);
1093
- return {
1094
- id: e,
1095
- label: String(t.label || e),
1096
- type: t.type,
1097
- browser: a.hits.get(e).browser
1098
- };
1099
- }), c;
1100
- c = n.length ? `${t.title}: ${Xt(n)}.${o.length ? ` Through ${n.length === 1 ? "it" : "them"}: ${Xt(o)}.` : ""}` : `${t.title}, through what uses it: ${Xt(o)}.`, l.push(n.length ? {
1101
- edge: {
1102
- from: n[0].id,
1103
- to: e.id,
1104
- kind: "calls"
1105
- },
1106
- text: c
1107
- } : {
1108
- node: t.ids[0],
1109
- text: c
1110
- });
1111
- }
1112
- return {
1113
- id: `outage-${e.id}`,
1114
- title: `${i} is down`,
1115
- down: [e.id],
1116
- steps: l
1117
- };
1118
- }
1119
- // ../explorer/scenario-list-model.js
1120
- var Qt = (e) => Array.isArray(e) ? e : [], $t = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, en = (e) => String(e ?? "").replace(/[^A-Za-z0-9_-]+/g, "_") || "_", tn = (e) => String(e.id).replace(/^persona-/, ""), nn = (e) => e.codeLabel || e.label || tn(e);
1121
- function rn(e, t, n) {
1122
- let r = new Set([
1123
- "add",
1124
- "change",
1125
- "remove"
1126
- ].flatMap((e) => Qt(n?.edges?.[e]).map(Z))), i = (t) => (e.find((e) => e.id === t) || { label: t }).label || t, a = [];
1127
- for (let n of [...ae, "edit"]) {
1128
- for (let t of e.filter((e) => e.mark === n)) a.push({
1129
- kind: "node",
1130
- key: t.id,
1131
- mark: n,
1132
- word: de[n],
1133
- name: String(t.label ?? t.id),
1134
- type: String(t.type ?? "")
1135
- });
1136
- for (let e of t.filter((e) => e.mark === n && r.has(Z(e)))) a.push({
1137
- kind: "edge",
1138
- key: Z(e),
1139
- mark: n,
1140
- word: de[n],
1141
- name: `${i(e.from)} → ${i(e.to)}`,
1142
- type: String(e.kind || "ownership")
1143
- });
1144
- }
1145
- return a;
1146
- }
1147
- function an(e) {
1148
- let t = [], n = (e) => {
1149
- typeof e == "string" && e && !t.includes(e) && t.push(e);
1150
- };
1151
- n(e?.actor);
1152
- for (let t of Qt(e?.steps)) n(t?.actor);
1153
- return t;
1154
- }
1155
- function on(e, t = {}) {
1156
- let n = t.notChecked || "Not checked";
1157
- return !e || e.state === "none" ? null : e.state === "pending" ? {
1158
- words: "Checking…",
1159
- state: "",
1160
- tone: "pending"
1161
- } : e.state === "unchecked" ? {
1162
- words: `${n}: ${e.why || "nothing to ask"}`,
1163
- state: "",
1164
- tone: "unchecked"
1165
- } : e.state === "unavailable" ? {
1166
- words: `${n}: the checker did not answer${e.why ? ` (${e.why})` : ""}`,
1167
- state: "",
1168
- tone: "unavailable"
1169
- } : e.mismatch ? {
1170
- words: e.state === "refused" ? `Expected allowed, was refused${e.reason ? `: ${e.reason}` : ""}` : "Expected refused, was allowed",
1171
- state: "failure",
1172
- tone: "mismatch"
1173
- } : e.state === "refused" ? {
1174
- words: `Refused: ${e.reason || "no reason given"}`,
1175
- state: e.expect === "refused" ? "success" : "failure",
1176
- tone: "refused"
1177
- } : {
1178
- words: "Allowed",
1179
- state: "success",
1180
- tone: "allowed"
1181
- };
1182
- }
1183
- function sn(e, t) {
1184
- return Qt(e.steps).map((n, r) => {
1185
- let i = n && n.actor || e.actor || null, a = "", o = "", s = [];
1186
- if (n && n.edge) {
1187
- a = `${t.label(n.edge.from)} → ${t.label(n.edge.to)}`, s = [
1188
- `edge:${Z(n.edge)}`,
1189
- `node:${n.edge.from}`,
1190
- `node:${n.edge.to}`
1191
- ];
1192
- let e = t.edges.find((e) => Z(e) === Z(n.edge));
1193
- e && e.mark && e.mark !== "none" && t.changeKeys.has(`edge:${Z(e)}`) && (o = e.mark);
1194
- } else if (n && n.node !== void 0) {
1195
- a = t.label(n.node), s = [`node:${n.node}`];
1196
- let e = t.nodes.find((e) => e.id === n.node);
1197
- e && e.mark && e.mark !== "none" && (o = e.mark);
1198
- }
1199
- let c = t.verdicts ? on(t.verdicts[r], t.words) : null, l = !!t.hidden && s.some((e) => e.startsWith("node:") && t.hidden(e.slice(5)));
1200
- return {
1201
- index: r,
1202
- number: r + 1,
1203
- actor: i,
1204
- actorLabel: i ? t.personaLabel(i) : "",
1205
- where: a,
1206
- mark: o,
1207
- markWord: o && de[o] || "",
1208
- text: String((n && n.text) ?? ""),
1209
- verdict: i ? c : null,
1210
- layerOff: l,
1211
- touched: s
1212
- };
1213
- });
1214
- }
1215
- function cn(e, t) {
1216
- let n = [
1217
- e.where,
1218
- e.markWord,
1219
- e.layerOff ? "on a layer that is off" : ""
1220
- ].filter(Boolean).join(", ");
1221
- return [
1222
- `Step ${e.number} of ${t}${e.actorLabel ? `, as ${e.actorLabel}` : ""}${n ? `: ${n}` : ""}.`,
1223
- e.text,
1224
- e.verdict ? `${e.verdict.words}${/[.!?…]$/.test(e.verdict.words) ? "" : "."}` : ""
1225
- ].filter(Boolean).join(" ");
1226
- }
1227
- function ln({ snap: e, nodes: t, edges: n, words: r = {} }) {
1228
- let i = e.current || {}, a = (e) => String((t.find((t) => t.id === e) || { label: e }).label ?? e), o = i.actor ? t.find((e) => e.type === "persona" && (e.id === `persona-${i.actor}` || e.id === i.actor)) : null, s = "", c = "";
1229
- if (i.edge) {
1230
- s = `${a(i.edge.from)} → ${a(i.edge.to)}`;
1231
- let e = n.find((e) => Z(e) === Z(i.edge));
1232
- e && e.mark && e.mark !== "none" && (c = e.mark);
1233
- } else if (i.node !== void 0) {
1234
- s = a(i.node);
1235
- let e = t.find((e) => e.id === i.node);
1236
- e && e.mark && e.mark !== "none" && (c = e.mark);
1237
- }
1238
- let l = i.actor ? on(e.verdict, r) : null;
1239
- return cn({
1240
- number: e.index + 1,
1241
- actorLabel: i.actor ? o ? nn(o) : String(i.actor) : "",
1242
- where: s,
1243
- markWord: c && de[c] || "",
1244
- text: String(i.text ?? ""),
1245
- verdict: l
1246
- }, e.total);
1247
- }
1248
- function un(e) {
1249
- let t = (t) => e.filter((e) => e.verdict && e.verdict.tone === t).length;
1250
- return [
1251
- [t("allowed"), "allowed"],
1252
- [t("refused"), "refused"],
1253
- [t("mismatch"), "not as expected"]
1254
- ].filter(([e]) => e > 0).map(([e, t]) => `${e} ${t}`).join(" · ");
1255
- }
1256
- function dn({ scenarios: e, nodes: t, edges: n, proposal: r = null, verdicts: i = null, seen: a = null, words: o = {}, hidden: s = null }) {
1257
- let c = Qt(e), l = t.filter((e) => e.type === "persona"), u = new Map(l.map((e) => [tn(e), e])), d = (e) => String((t.find((t) => t.id === e) || { label: e }).label ?? e), f = (e) => u.has(e) ? nn(u.get(e)) : String(e), p = rn(t, n, r), m = new Set(p.map((e) => `${e.kind}:${e.key}`)), h = new Set(Qt(a?.played)), g = new Set(Qt(a?.read)), _ = c.map((e, r) => {
1258
- let a = i && i.get(e.id), c = sn(e, {
1259
- nodes: t,
1260
- edges: n,
1261
- changeKeys: m,
1262
- verdicts: a || null,
1263
- words: o,
1264
- label: d,
1265
- personaLabel: f,
1266
- hidden: s
1267
- }), l = new Set(c.flatMap((e) => e.touched).filter((e) => m.has(e))), u = c.length, p = [$t(u, "step")];
1268
- m.size > 0 && p.push(`walks ${l.size} of ${$t(m.size, "change")}`);
1269
- let _ = un(c);
1270
- return {
1271
- index: r,
1272
- id: String(e.id ?? ""),
1273
- key: `${r}-${en(e.id)}`,
1274
- title: String(e.title ?? e.id ?? ""),
1275
- actors: an(e),
1276
- steps: c,
1277
- stepCount: u,
1278
- summary: p.join(" · "),
1279
- verdictSummary: _,
1280
- seen: h.has(String(e.id)) ? "played" : g.has(String(e.id)) ? "read" : ""
1281
- };
1282
- }), v = [...u.keys()];
1283
- for (let e of _) for (let t of e.actors) v.includes(t) || v.push(t);
1284
- let y = [];
1285
- for (let e of v) {
1286
- let t = _.filter((t) => t.actors.includes(e));
1287
- if (!t.length) continue;
1288
- let n = f(e);
1289
- y.push({
1290
- key: en(e),
1291
- persona: e,
1292
- label: n,
1293
- anyone: !1,
1294
- heading: `${n} · ${$t(t.length, "scenario")}`,
1295
- scenarios: t
1296
- });
1297
- }
1298
- let b = _.filter((e) => e.actors.length === 0);
1299
- b.length && y.push({
1300
- key: "anyone",
1301
- persona: null,
1302
- label: "Anyone",
1303
- anyone: !0,
1304
- heading: `Anyone · ${$t(b.length, "scenario")}`,
1305
- scenarios: b
1306
- });
1307
- let x = new Set(_.flatMap((e) => e.actors)), S = _.length ? l.filter((e) => !x.has(tn(e))).map(nn) : [], C = _.filter((e) => e.seen === "played").length;
1308
- return {
1309
- total: _.length,
1310
- personaCount: y.filter((e) => !e.anyone).length,
1311
- groups: y,
1312
- notInAny: S,
1313
- coverage: S.length ? `Not in any scenario: ${S.join(", ")}` : "",
1314
- playedLine: _.length && C ? `${C} of ${_.length} ${_.length === 1 ? "scenario" : "scenarios"} played` : ""
1315
- };
1316
- }
1317
- function fn(e, t) {
1318
- let n = [$t(e, "change")];
1319
- return t.total > 0 && n.push(`${$t(t.total, "scenario")}${t.personaCount > 0 ? ` for ${$t(t.personaCount, "persona")}` : ""}`), n.join(" · ");
1320
- }
1321
- function pn(e, t, n) {
1322
- return `Opened ${e}: ${fn(t, n).replace(" · ", ", ")}.`;
1323
- }
1324
- var mn = (e, t, n = "") => `cornfield.seen.${e || "checkout"}/${t || ""}@${n || ""}`;
1325
- function hn(e, t) {
1326
- let n = {
1327
- played: [],
1328
- read: []
1329
- };
1330
- try {
1331
- let r = e && e.getItem(t);
1332
- if (!r) return n;
1333
- let i = JSON.parse(r), a = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, 200) : [];
1334
- return {
1335
- played: a(i && i.played),
1336
- read: a(i && i.read)
1337
- };
1338
- } catch {
1339
- return n;
1340
- }
1341
- }
1342
- function gn(e, t, n, r, i = null) {
1343
- let a = i ? {
1344
- played: [...Qt(i.played)],
1345
- read: [...Qt(i.read)]
1346
- } : hn(e, t), o = String(n);
1347
- r === "played" ? (a.played.includes(o) || a.played.push(o), a.read = a.read.filter((e) => e !== o)) : !a.read.includes(o) && !a.played.includes(o) && a.read.push(o);
1348
- try {
1349
- e && e.setItem(t, JSON.stringify(a));
1350
- } catch {}
1351
- return a;
1352
- }
1353
- // ../explorer/engine/player.js
1354
- var _n = 250, vn = 140;
1355
- function yn(e, t) {
1356
- let { state: n } = e;
1357
- if (!t || n.view === "dataflow" || n.view === "house") return [];
1358
- let r = b(n), i = (e) => r[e] !== !1, a = t.type;
1359
- if (a === "root" || A(n, t)) return [];
1360
- let o = j(n, t);
1361
- if (o) return i(o) ? [] : [o];
1362
- if (a === "core") return [...i("core") ? [] : ["core"], ...r.pkg || r.atom ? [] : ["pkg"]];
1363
- if (a === "store") return ["flow", "store"].filter((e) => !i(e));
1364
- if (a === "rom") return ["rom", "flow"].filter((e) => !i(e));
1365
- if (a === "floor" || a === "room") return i("house") ? [] : ["house"];
1366
- let s = a === "external" ? p(t) : a;
1367
- return i(s) ? [] : [s];
1368
- }
1369
- var bn = (e) => (Array.isArray(e?.steps) ? e.steps : []).flatMap((e) => e?.edge ? [e.edge.from, e.edge.to] : e && e.node !== void 0 ? [e.node] : []), xn = "input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]", Sn = (e) => !!(e && e.closest && e.closest(xn));
1370
- function Cn(e, t) {
1371
- let n = new Set(e.map((e) => e.id)), r = (t) => (e.find((e) => e.id === t) || { label: t }).label, i = t.filter((e) => (e.kind || e.dashed) && n.has(e.from) && n.has(e.to) && e.from !== e.to);
1372
- if (!i.length) return null;
1373
- let a = /* @__PURE__ */ new Map();
1374
- for (let e of i) a.has(e.from) || a.set(e.from, []), a.get(e.from).push(e);
1375
- let o = [...a.keys()].sort((e, t) => a.get(t).length - a.get(e).length || e.localeCompare(t))[0], s = [{
1376
- node: o,
1377
- text: `It starts at ${r(o)}.`
1378
- }], c = /* @__PURE__ */ new Set([o]), l = o;
1379
- for (let e = 0; e < 3; e++) {
1380
- let e = (a.get(l) || []).find((e) => !c.has(e.to));
1381
- if (!e) break;
1382
- let t = {
1383
- from: e.from,
1384
- to: e.to,
1385
- ...e.kind ? { kind: e.kind } : {},
1386
- ...e.kind === "flow" ? { flow: e.flow } : {}
1387
- };
1388
- s.push({
1389
- edge: t,
1390
- text: `${r(e.from)} ${e.label || e.kind || "uses"} ${r(e.to)}.`
1391
- }), s.push({
1392
- node: e.to,
1393
- text: `Now at ${r(e.to)}.`
1394
- }), c.add(e.to), l = e.to;
1395
- }
1396
- return s.length < 2 ? null : {
1397
- id: "demo",
1398
- title: "A walk over the map",
1399
- steps: s
1400
- };
1401
- }
1402
- function wn(e, t, n) {
1403
- let { state: r } = e, i = null, a = null, s = "", c = null, l = !1, u = -1, f = null, p = -1, m = null, h = null, g = null, _ = null, v = /* @__PURE__ */ new Set(), b = [], x = (t) => {
1404
- for (let e of [...v]) e(t);
1405
- e.emit("scenario:player", t);
1406
- }, S = () => r.canvas ? r.canvas.parentElement : null, C = () => e.map.render();
1407
- function w() {
1408
- let t = e.active();
1409
- return t && t !== e.doc.body && !t.closest?.(".hx-player") && !t.closest?.("#review-column") && t !== r.canvas ? t : null;
1410
- }
1411
- function O() {
1412
- let t = e.active();
1413
- return !!t && t !== e.doc.body && !Sn(t);
1414
- }
1415
- function k() {
1416
- let t = m;
1417
- m = null;
1418
- let n = (t) => !t || !t.isConnected || t.hidden || t.disabled || t.closest("[hidden]") ? !1 : (t.focus(), e.active() === t);
1419
- n(h && h()) || n(t) || n(r.canvas);
1420
- }
1421
- function A(t) {
1422
- t && Array.isArray(t.down) && t.down.length && Kt(T(t.down, r.nodes, r.edges), r.nodes).forEach((t) => {
1423
- E(r, t) || je(e, t, !0, { scenario: !0 });
1424
- });
1425
- }
1426
- function j(t) {
1427
- let n = new Map(r.nodes.map((e) => [e.id, e])), i = [];
1428
- for (let r of bn(t)) for (let t of yn(e, n.get(r))) i.includes(t) || i.push(t);
1429
- if (!i.length) return;
1430
- for (let t of i) je(e, t, !0, { scenario: !0 });
1431
- let a = i.map((e) => (Re.find((t) => t.key === e) || (r.projectLayers || []).find((t) => t.key === e) || { label: e }).label);
1432
- d(e, `Turned on ${a.length > 1 ? `${a.slice(0, -1).join(", ")} and ${a[a.length - 1]}` : a[0]} to show this scenario's steps.`);
1433
- }
1434
- function N(t, r = {}) {
1435
- let o = w(), s = O() && r.focus !== !1;
1436
- F({ keepChecks: !0 }), m = o;
1437
- let c = r.stepMs ?? U();
1438
- if (i = Wt(t, {
1439
- stepMs: c,
1440
- maxFrameMs: _n
1441
- }), Number.isFinite(r.step) && r.step > 0 && i.goTo(r.step), H(c), n.open(t, () => {
1442
- L(), C();
1443
- }), A(t), j(t), r.autoplay !== !1 && !(r.step > 0) && i.play(), L(!0), C(), e.map.ensureFlowLoop(), s && a) {
1444
- let e = a.querySelector("[data-action=scenario-toggle]");
1445
- e && !e.disabled ? e.focus() : a.querySelector("[data-action=scenario-next]")?.focus();
1446
- }
1447
- return i;
1448
- }
1449
- function P(e) {
1450
- let t = r.nodes.find((t) => t.id === e);
1451
- return !t || t.type !== "external" || t.kind !== "cloud" ? null : N(Zt(t, r.nodes, r.edges));
1452
- }
1453
- function F({ keepChecks: t = !1, closing: o = !1 } = {}) {
1454
- let l = !!i || !!r.scenario;
1455
- l && Le(e), i = null, c = null, s = "", r.scenario = null, t || n.close(), f &&= (f.disconnect(), null), a &&= (xe(e, "player"), b.forEach((e) => e()), b = [], n.unmount(), a.remove(), null), l && (!t || o) && x(null);
1456
- }
1457
- function I() {
1458
- if (!i && !r.scenario) return;
1459
- let t = e.active(), n = !!a && a.contains(t) || !!t?.closest?.("#review-column");
1460
- F({
1461
- keepChecks: !!i && !!g && g(i.scenario().id),
1462
- closing: !0
1463
- }), e.touchScene(), C();
1464
- let o = e.active();
1465
- n || !o || o === e.doc.body ? k() : m = null;
1466
- }
1467
- function L(t = !1) {
1468
- if (!i) return !1;
1469
- let a = n.decorate(i.snapshot(), i.scenario());
1470
- r.scenario = a;
1471
- let o = `${a.index}|${a.playing}|${a.done}|${a.stepStartMs}|${a.stepMs}|${a.manual}|${n.version()}`, c = t || o !== s;
1472
- if (c) {
1473
- let n = t || o.split("|")[0] !== s.split("|")[0];
1474
- s = o, e.touchScene(), n && (l = !1, R(a));
1475
- }
1476
- return K(a), c && x({
1477
- id: a.id,
1478
- index: a.index,
1479
- total: a.total,
1480
- done: a.done,
1481
- playing: a.playing,
1482
- checks: n.version()
1483
- }), c;
1484
- }
1485
- function R(t) {
1486
- let n = /* @__PURE__ */ new Map();
1487
- r.nodes.forEach((t) => {
1488
- e.map.isNodeVisible(t) && n.set(t.id, t);
1489
- });
1490
- let i = M(e);
1491
- u = a ? a.offsetHeight : 0;
1492
- let o = Gt({
1493
- node: t.current.node,
1494
- edge: t.current.edge,
1495
- at: t.current.at,
1496
- text: t.current.text
1497
- }, r.camera, i, n, 60, e.map.getMinZoom());
1498
- o && (e.reducedMotion ? (Object.assign(r.camera, o), c = null, C()) : (c = {
1499
- to: o,
1500
- last: null
1501
- }, e.map.ensureFlowLoop()));
1502
- }
1503
- function z(e) {
1504
- if (!c) return;
1505
- let t = c.last === null ? 16 : Math.min(e - c.last, 100);
1506
- c.last = e;
1507
- let n = 1 - Math.exp(-t / vn), i = r.camera;
1508
- i.x += (c.to.x - i.x) * n, i.y += (c.to.y - i.y) * n, i.zoom += (c.to.zoom - i.zoom) * n, Math.abs(c.to.x - i.x) < .5 && Math.abs(c.to.y - i.y) < .5 && Math.abs(c.to.zoom - i.zoom) < .002 && (Object.assign(i, c.to), c = null);
1509
- }
1510
- let B = () => !!i && (i.isPlaying() || !!c);
1511
- function V(e) {
1512
- i && (i.tick(e), L(), z(e));
1513
- }
1514
- t.own(e.map.addFrameClient({
1515
- wants: B,
1516
- tick: V
1517
- }));
1518
- function H(t) {
1519
- let n = S();
1520
- if (!n) return;
1521
- a = e.doc.createElement("div"), a.className = "hx-player glass", a.dataset.corn = "scenario-player", a.setAttribute("part", "scenario-player"), a.setAttribute("role", "region"), a.setAttribute("aria-label", "Scenario player"), a.innerHTML = `
1522
- <span class="hx-player-title hx-sr-only"></span>
1523
- <div class="hx-player-controls" role="group">
1524
- <button data-corn-kind="secondary" type="button" class="hx-btn hx-player-prev" data-action="scenario-prev" data-peek-ok><span class="hx-player-label"></span></button>
1525
- <button type="button" class="hx-btn hx-btn--active hx-player-toggle" data-action="scenario-toggle" data-peek-ok data-corn-kind="primary"><span class="hx-player-label"></span></button>
1526
- <button data-corn-kind="secondary" type="button" class="hx-btn hx-player-next" data-action="scenario-next" data-peek-ok><span class="hx-player-label"></span></button>
1527
- <button data-corn-kind="secondary" type="button" class="hx-btn hx-player-next-scenario" data-action="scenario-next-scenario" data-peek-ok hidden></button>
1528
- </div>
1529
- <p class="hx-player-text"><span class="hx-player-count" data-corn="count"></span><span class="hx-player-sep" aria-hidden="true"> · </span><span class="hx-player-who"></span><span class="hx-player-step"></span></p>
1530
- <span class="hx-player-says hx-sr-only" role="status" aria-live="polite"></span>
1531
- <div class="hx-player-side">
1532
- <select data-corn="control" class="hx-player-speed" data-action="scenario-speed" aria-label="Time for each step" title="Time for each step">${Rt.map((e) => `<option value="${y(String(e.value))}">${y(e.label)}</option>`).join("")}</select>
1533
- <button type="button" class="hx-close" data-action="scenario-close" aria-label="Close the scenario" data-corn-kind="icon">✕</button>
1534
- </div>
1535
- <div class="hx-player-track" data-corn="scenario-track" aria-hidden="true"><span class="hx-player-fill" data-corn="scenario-fill"></span></div>`, o(a), a.querySelector(".hx-player-controls").setAttribute("aria-label", D(e, "steps")), a.querySelector(".hx-player-prev .hx-player-label").textContent = D(e, "previousStep"), a.querySelector(".hx-player-next .hx-player-label").textContent = D(e, "nextStep"), a.querySelector(".hx-player-next-scenario").textContent = D(e, "nextScenario");
1536
- let s = (e) => {
1537
- let t = e.target.closest("[data-action]");
1538
- t && G(t.dataset.action);
1539
- }, c = a.querySelector(".hx-player-speed"), d = (e) => W(e.target.value), p = a;
1540
- p.addEventListener("click", s), c.value = String(t), c.addEventListener("change", d), b.push(() => {
1541
- p.removeEventListener("click", s), c.removeEventListener("change", d);
1542
- });
1543
- let m = e.el("sheet-dock"), h = e.el("spec-drawer");
1544
- m && h && h.parentElement === m ? m.insertBefore(a, h) : (m || n).appendChild(a), be(e, "player", a), Oe(e);
1545
- let g = e.win && e.win.ResizeObserver;
1546
- typeof g == "function" && (f = new g(() => {
1547
- a && i && r.scenario && !l && a.offsetHeight !== u && R(i.snapshot());
1548
- }), f.observe(a));
1549
- }
1550
- let U = () => zt(e.store.get(Lt));
1551
- function W(t) {
1552
- let n = zt(t);
1553
- e.store.set(Lt, String(n)), i && (i.setSpeed(n), L(), C(), e.map.ensureFlowLoop());
1554
- }
1555
- function G(t) {
1556
- if (i) {
1557
- if (t === "scenario-close") return I();
1558
- if (t === "scenario-next-scenario") {
1559
- let e = _ ? _(i.scenario().id) : null;
1560
- e && N(e);
1561
- } else {
1562
- if (t === "scenario-toggle") {
1563
- let t = i.snapshot();
1564
- t.playing ? i.pause() : i.play(), d(e, t.playing ? "Paused" : t.done ? "Playing again" : t.index > 0 || t.progress > 0 ? "Resumed" : "Playing");
1565
- } else if (t === "scenario-prev") i.prev();
1566
- else if (t === "scenario-next") i.next();
1567
- else return;
1568
- L(), C(), e.map.ensureFlowLoop();
1569
- }
1570
- }
1571
- }
1572
- function K(t) {
1573
- if (!a) return;
1574
- let i = (e) => a.querySelector(e), o = (e, t) => {
1575
- let n = i(e);
1576
- n.textContent !== t && (n.textContent = t);
1577
- };
1578
- o(".hx-player-title", t.title), a.setAttribute("aria-label", `Scenario player: ${t.title}`), o(".hx-player-count", `${Math.min(t.index + 1, Math.max(t.total, 1))} of ${t.total}`);
1579
- let s = t.current.actor ? St(bt(r.nodes, t.current.actor)) || t.current.actor : "";
1580
- o(".hx-player-who", s && !t.done ? `As ${s} · ` : ""), o(".hx-player-step", t.done ? "Played to the end" : t.current.text), a.dataset.done = String(!!t.done);
1581
- let c = i("[data-action=scenario-toggle]");
1582
- o("[data-action=scenario-toggle] .hx-player-label", t.playing ? D(e, "pause") : t.done ? D(e, "playAgain") : D(e, "play")), c.dataset.state = t.playing ? "playing" : t.done ? "done" : "paused", c.disabled = t.total === 0 || t.manual, c.title = t.manual ? "The time for each step is Manual: use Next" : "", i("[data-action=scenario-prev]").disabled = t.index === 0 && !t.done;
1583
- let l = i("[data-action=scenario-next]");
1584
- l.disabled = t.done || t.total === 0;
1585
- let u = t.done && _ ? _(t.id) : null;
1586
- i("[data-action=scenario-next-scenario]").hidden = !u, l.hidden = !!u, o(".hx-player-says", t.done ? `${t.title}: played to the end.` : ln({
1587
- snap: t,
1588
- nodes: r.nodes,
1589
- edges: r.edges,
1590
- words: { notChecked: D(e, "notChecked") }
1591
- }));
1592
- let d = t.total ? Math.round((t.done ? t.total : t.index + t.progress) / t.total * 1e3) / 10 : 0;
1593
- d !== p && (p = d, i(".hx-player-fill").style.width = `${d}%`), n.paint(a, t);
1594
- }
1595
- function q() {
1596
- return !!e.root.querySelector("#legend-dropdown:not([hidden]), #proposal-more-menu:not([hidden]), [data-corn=\"dialog-scrim\"]:not([hidden]), .hx-mockup-dialog");
1597
- }
1598
- t.listen(e.root, "keydown", (e) => {
1599
- if (e.key === "Escape" && !e.defaultPrevented && !e.ctrlKey && !e.metaKey && !e.altKey && i && !Sn(e.target) && !q()) {
1600
- e.preventDefault(), I();
1601
- return;
1602
- }
1603
- if (!i || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey || Sn(e.target) || (e.key === " " || e.code === "Space") && e.target.closest?.("#review-column")) return;
1604
- let t = e.key === " " || e.code === "Space" ? "scenario-toggle" : e.key === "ArrowLeft" ? "scenario-prev" : e.key === "ArrowRight" ? "scenario-next" : null;
1605
- t && (e.preventDefault(), G(t));
1606
- }), t.listen(e.root, "keyup", (e) => {
1607
- i && (e.key === " " || e.code === "Space") && !Sn(e.target) && e.preventDefault();
1608
- }), t.own(Te(e, () => {
1609
- i && r.scenario && R(i.snapshot());
1610
- }));
1611
- for (let n of [
1612
- "pointerdown",
1613
- "wheel",
1614
- "touchstart",
1615
- "mousedown"
1616
- ]) t.listen(e.root, n, (e) => {
1617
- e.target === r.canvas && (c = null, l = !0);
1618
- }, {
1619
- passive: !0,
1620
- capture: !0
1621
- });
1622
- return t.on("scenario:clear", () => F()), t.own(() => {
1623
- F({ keepChecks: !1 }), v.clear();
1624
- }), {
1625
- play: N,
1626
- stop: I,
1627
- clear: F,
1628
- tick: V,
1629
- playOutage: P,
1630
- getPlayer: () => i,
1631
- bar: () => a,
1632
- wantsFrames: B,
1633
- onChange(e) {
1634
- return v.add(e), () => v.delete(e);
1635
- },
1636
- setCloseFocus(e) {
1637
- h = typeof e == "function" ? e : null;
1638
- },
1639
- setNextScenario(e) {
1640
- _ = typeof e == "function" ? e : null;
1641
- },
1642
- setKeepChecksOnClose(e) {
1643
- g = typeof e == "function" ? e : null;
1644
- },
1645
- demo(e = !0) {
1646
- if (!e) return !1;
1647
- let t = Cn(r.nodes, r.edges);
1648
- return t ? (N(t), !0) : (console.warn("scenario-demo: the map has none of the nodes the demo walks over"), !1);
1649
- }
1650
- };
1651
- }
1652
- // ../explorer/pieces/changes.js
1653
- var Tn = "cornfield.reviewTab", En = 1360, Dn = () => ({ column: "<aside id=\"review-column\" class=\"hx-review-column glass\" aria-label=\"Review\" data-corn=\"review-column\" hidden><div class=\"hx-rc-scroll\"><p id=\"proposal-summary\" class=\"hx-proposal-summary\" hidden></p><div id=\"review-lists\" class=\"hx-rc-lists\"></div></div><!--corn-piece:decision/foot--></aside>" }), On = (e, t) => `${y(e)}<span aria-hidden="true"> · </span><span class="hx-sr-only">, </span><span data-corn="count">${t}</span>`;
1654
- function kn(e) {
1655
- let t = `${e.word} ${e.name}, ${e.type}`;
1656
- return `<li><button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="${e.kind}" data-key="${y(e.key)}" data-focus-key="ch:${y(e.kind)}:${y(e.key)}" data-corn="row" aria-label="${y(t)}"><span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${W(e.mark)} aria-hidden="true"></span><span class="hx-change-what">${y(e.word)}</span><span class="hx-name">${y(e.name)}</span><span class="hx-faint">${y(e.type)}</span></button></li>`;
1657
- }
1658
- function An(e, t, n = {}) {
1659
- let { state: r } = t, i = v(t), a = R(t, e, Dn().column, n.slots, "column"), s = (e) => {
1660
- for (let t of a) {
1661
- if (t.id === e) return t;
1662
- let n = t.querySelector(`[id="${e}"]`);
1663
- if (n) return n;
1664
- }
1665
- return null;
1666
- };
1667
- i.keepParts(...a);
1668
- let c = s("review-column"), l = !1, u = Ft(t, { checker: n.checker }), d = wn(t, i, u);
1669
- i.own(() => u.close());
1670
- let f = {
1671
- checks: 0,
1672
- open: null,
1673
- tab: null,
1674
- tabNow: null,
1675
- tabFor: "",
1676
- openFor: "",
1677
- head: "",
1678
- headFor: "",
1679
- current: null,
1680
- lastStep: null,
1681
- seen: {
1682
- played: [],
1683
- read: []
1684
- },
1685
- seenFor: "",
1686
- pending: []
1687
- }, p = {
1688
- getItem: (e) => t.store.get(e),
1689
- setItem: (e, n) => t.store.set(e, n)
1690
- }, m = t.store.get(Tn);
1691
- (m === "changes" || m === "scenarios") && (f.tab = m);
1692
- let h = () => {
1693
- let e = r.effectiveProposal || r.proposal;
1694
- return e && Array.isArray(e.scenarios) ? e.scenarios : [];
1695
- }, g = () => `${r.proposalSource || ""}/${r.proposalSlug || ""}`;
1696
- function _() {
1697
- return G(r.proposalSource) ? f.headFor === g() && f.head ? mn(r.proposalSource, r.proposalSlug, f.head) : null : mn(r.proposalSource, r.proposalSlug, "");
1698
- }
1699
- function b() {
1700
- let e = _(), t = e || `pending:${g()}`;
1701
- if (f.seenFor === t) return;
1702
- let n = f.seenFor;
1703
- if (f.seenFor = t, !e) f.seen = {
1704
- played: [],
1705
- read: []
1706
- }, f.pending = [];
1707
- else {
1708
- if (f.seen = hn(p, e), n === `pending:${g()}`) for (let [t, n] of f.pending) f.seen = gn(p, e, t, n);
1709
- f.pending = [];
1710
- }
1711
- }
1712
- function x(e, t) {
1713
- b(), f.seenFor.startsWith("pending:") ? (f.pending.push([String(e), t]), f.seen = gn(null, "", e, t, f.seen)) : f.seen = gn(p, f.seenFor, e, t);
1714
- }
1715
- function C(e) {
1716
- let t = typeof e == "string" ? e : "";
1717
- (t !== f.head || f.headFor !== g()) && (f.head = t, f.headFor = g(), r.proposal && z());
1718
- }
1719
- function w() {
1720
- b();
1721
- let e = /* @__PURE__ */ new Map(), n = u.checkedScenarioId();
1722
- n !== null && e.set(n, u.verdicts());
1723
- let i = r.effectiveProposal || r.proposal, a = { notChecked: D(t, "notChecked") }, o = new Map(r.nodes.map((e) => [e.id, e]));
1724
- return dn({
1725
- scenarios: h(),
1726
- nodes: r.nodes,
1727
- edges: r.edges,
1728
- proposal: i,
1729
- verdicts: e,
1730
- seen: f.seen,
1731
- words: a,
1732
- hidden: (e) => o.has(e) && yn(t, o.get(e)).length > 0
1733
- });
1734
- }
1735
- let T = (e) => rn(r.nodes, r.edges, e).filter((e) => e.mark !== "edit");
1736
- function E(e) {
1737
- let t = r.effectiveProposal || r.proposal;
1738
- return pn(e, T(t).length, w());
1739
- }
1740
- function O() {
1741
- let e = r.effectiveProposal || r.proposal;
1742
- return fn(T(e).length, w());
1743
- }
1744
- function A(e, t, n, r) {
1745
- let i = f.current && f.current.index === e.index && f.current.step === t.index && f.current.id === e.id, a = t.verdict ? `<span class="hx-step-verdict" data-corn="state-pill" data-tone="${y(t.verdict.tone)}"${t.verdict.state ? ` data-corn-state="${t.verdict.state}"` : ""}>${y(t.verdict.words)}</span>` : "", o = t.mark ? `<span class="hx-step-mark"><span class="hx-mark-dot hx-mark-dot--${t.mark}" data-corn="mark-dot"${W(t.mark)} aria-hidden="true"></span>${y(t.markWord)}</span>` : "", s = t.actorLabel ? `<span class="hx-step-who">As ${y(t.actorLabel)}</span>` : "";
1746
- return `<li><button type="button" class="hx-step" data-corn="step" data-action="scenario-step" data-scenario-index="${e.index}" data-step-index="${t.index}" data-focus-key="st:${n.key}:${e.key}:${t.index}" aria-label="${y(cn(t, r))}"${i ? " aria-current=\"step\"" : ""}><span class="hx-step-n" aria-hidden="true">${t.number}</span><span class="hx-step-body"><span class="hx-step-line">${s}<span class="hx-step-where">${y(t.where)}</span>${o}${t.layerOff ? "<span class=\"hx-step-off\">Layer off: shown when played</span>" : ""}</span><span class="hx-step-text">${y(t.text)}</span></span>${a}</button></li>`;
1747
- }
1748
- function j(e, n) {
1749
- let r = f.open === e.id, i = `rc-steps-${n.key}-${e.key}`, a = e.seen ? `<span class="hx-sc-seen" data-seen="${e.seen}">${e.seen === "played" ? "✓ Played" : "✓ Read"}</span>` : "", o = e.verdictSummary ? ` · ${y(e.verdictSummary)}` : "", s = r && V(e.id) && e.steps.some((e) => e.actor) ? "<p class=\"hx-faint hx-rc-note hx-sc-waits\" data-corn=\"notice\">Not checked while another scenario plays. Close the player, or choose a step here to play this one.</p>" : "";
1750
- return `<li class="hx-sc" data-open="${r}"><button type="button" class="hx-sc-row" data-corn="row" data-action="scenario-open" data-scenario-index="${e.index}" data-focus-key="sc:${n.key}:${e.key}" aria-expanded="${r}" aria-controls="${i}"><span class="hx-sc-caret" aria-hidden="true">${r ? "▾" : "▸"}</span><span class="hx-sc-main"><span class="hx-sc-title">${y(e.title)}</span><span class="hx-sc-meta">${y(e.summary)}${o}</span></span>${a}</button>${s}<ol class="hx-steps" id="${i}" data-corn="step-list" aria-label="${y(D(t, "steps"))}: ${y(e.title)}"${r ? "" : " hidden"}>${r ? e.steps.map((t) => A(e, t, n, e.steps.length)).join("") : ""}</ol></li>`;
1751
- }
1752
- function M(e) {
1753
- let n = e.scenarios.length, r = e.anyone ? D(t, "anyone") : e.label, i = `${y(r)}<span aria-hidden="true"> · </span><span class="hx-sr-only">, </span>${n} ${n === 1 ? "scenario" : "scenarios"}`;
1754
- return `<div class="hx-persona" data-corn="persona-group" data-persona="${y(e.key)}"><h4 class="hx-persona-name">${i}</h4><ul class="hx-sc-list">${e.scenarios.map((t) => j(t, e)).join("")}</ul></div>`;
1755
- }
1756
- function N() {
1757
- let e = r.effectiveProposal || r.proposal, n = rn(r.nodes, r.edges, e), i = n.filter((e) => e.mark !== "edit"), a = n.filter((e) => e.mark === "edit"), o = w(), s = k(t);
1758
- f.tabFor !== g() && (f.tabFor = g(), f.tabNow = o.total ? f.tab || "scenarios" : "changes");
1759
- let c = f.tabNow || "changes", l = r.nodes.some((e) => e.type === "persona"), u = `<div class="hx-rc-tabs" role="tablist" aria-label="Review" data-corn="tabs"${s ? "" : " hidden"}><button type="button" role="tab" id="rc-tab-changes" class="hx-rc-tab" data-corn="tab" data-action="review-tab" data-tab="changes" aria-selected="${c === "changes"}" aria-controls="rc-changes" tabindex="${c === "changes" ? 0 : -1}">${y(D(t, "changes"))} · ${i.length}</button><button type="button" role="tab" id="rc-tab-scenarios" class="hx-rc-tab" data-corn="tab" data-action="review-tab" data-tab="scenarios" aria-selected="${c === "scenarios"}" aria-controls="rc-scenarios" tabindex="${c === "scenarios" ? 0 : -1}">${y(D(t, "scenarios"))} · ${o.total}</button></div>`, d = `<section id="rc-changes" class="hx-rc-section" data-corn="proposal-changes"${s ? ` role="tabpanel" aria-labelledby="rc-tab-changes"${c === "changes" ? "" : " hidden"}` : " aria-labelledby=\"rc-changes-h\""}><h3 id="rc-changes-h" class="hx-rc-h" tabindex="-1">${On(D(t, "changes"), i.length)}</h3>` + (a.length ? `<h4 class="hx-rc-sub">${On(D(t, "yourEdits"), a.length)}</h4><ul class="hx-change-list">${a.map(kn).join("")}</ul>` : "") + (i.length ? `<ul class="hx-change-list">${i.map(kn).join("")}</ul>` : "<p class=\"hx-faint hx-rc-empty\">This proposal changes nothing on the map.</p>") + "</section>", p;
1760
- return o.total ? (p = o.groups.map(M).join(""), l || (p += `<p class="hx-faint hx-rc-note">This map has no personas (topology.personas.json), so every scenario is listed under ${y(D(t, "anyone"))}.</p>`), o.coverage && (p += `<p class="hx-rc-coverage" data-corn="notice">${y(D(t, "notInAnyScenario"))}: ${o.notInAny.map(y).join(", ")}</p>`)) : p = "<p class=\"hx-faint hx-rc-empty\">This proposal has no scenarios: there is nothing to walk through, and its changes are all it shows.</p>", `${u}${d}${`<section id="rc-scenarios" class="hx-rc-section" data-corn="scenario-list"${s ? ` role="tabpanel" aria-labelledby="rc-tab-scenarios"${c === "scenarios" ? "" : " hidden"}` : " aria-labelledby=\"rc-scenarios-h\""}><h3 id="rc-scenarios-h" class="hx-rc-h" tabindex="-1">${On(D(t, "personasAndScenarios"), o.total)}</h3><div class="hx-rc-sbody">${p}</div></section>`}`;
1761
- }
1762
- function P() {
1763
- let e = t.el("sheet-dock"), n = t.el("proposal-body");
1764
- if (k(t) && n) c.parentElement !== n && n.appendChild(c);
1765
- else if (e) {
1766
- let n = t.el("proposal-bar");
1767
- n && c.parentElement !== e && n.after(c);
1768
- }
1769
- return c;
1770
- }
1771
- function F() {
1772
- let e = t.el("proposal-bar");
1773
- !e || k(t) || e.hidden || c.style.setProperty("--hx-column-top", `${Math.round(e.offsetTop + e.offsetHeight + 8)}px`);
1774
- }
1775
- function I() {
1776
- if (l) return;
1777
- P();
1778
- let e = !!r.proposal;
1779
- if (c.hidden = !e, !e) {
1780
- f.open = null, f.current = null, f.lastStep = null, H();
1781
- let e = s("review-lists");
1782
- e && (e.innerHTML = "");
1783
- } else z(), F();
1784
- }
1785
- function L() {
1786
- let e = s("review-lists"), n = s("rc-scenarios");
1787
- if (!e || !n || c.hidden || k(t)) return;
1788
- let r = e.clientHeight;
1789
- if (!r) return;
1790
- let i = parseFloat(t.win.getComputedStyle(e).rowGap) || 0, a = n.querySelector(".hx-rc-h"), o = n.querySelector(".hx-rc-sbody"), l = Math.ceil((a ? a.offsetHeight + (parseFloat(t.win.getComputedStyle(a).marginBottom) || 0) : 0) + (o ? o.scrollHeight : 0));
1791
- c.style.setProperty("--hx-scenarios-need", `${l}px`), c.style.setProperty("--hx-changes-max", `${Math.floor(Math.max(.4 * r, r - l - i))}px`);
1792
- }
1793
- function z() {
1794
- let e = s("review-lists");
1795
- if (l || !e || !r.proposal) return;
1796
- f.openFor !== g() && (f.openFor = g(), d.getPlayer() || (f.open = null, f.current = null, f.lastStep = null)), f.open !== null && !h().some((e) => e.id === f.open) && (f.open = null);
1797
- let n = f.open !== null && !d.getPlayer() ? h().find((e) => e.id === f.open) : null;
1798
- n && u.checkedScenarioId() === n.id && u.open(n, () => z());
1799
- let i = t.active(), a = i && e.contains(i) && i.getAttribute ? i.getAttribute("data-focus-key") : null, c = e.scrollTop;
1800
- e.innerHTML = N(), o(e);
1801
- let p = r.proposal, m = s("proposal-summary");
1802
- if (m.textContent = p && typeof p.summary == "string" && p.summary || "", m.hidden = !m.textContent, e.scrollTop = c, t.emit("changes:peek", O()), a) {
1803
- let t = [...e.querySelectorAll("[data-focus-key]")].find((e) => e.getAttribute("data-focus-key") === a);
1804
- t && t.focus();
1805
- }
1806
- L(), t.emit("changes:paint");
1807
- }
1808
- let B = (e) => h()[Number(e.dataset.scenarioIndex)] || null, V = (e) => {
1809
- let t = d.getPlayer();
1810
- return !!t && t.scenario().id !== e;
1811
- };
1812
- function H() {
1813
- d.getPlayer() || u.close();
1814
- }
1815
- function U(e) {
1816
- f.open === e.id ? (f.open = null, d.getPlayer() || u.close()) : (f.open = e.id, x(e.id, "read"), V(e.id) || u.open(e, () => z())), z();
1817
- }
1818
- function K(e, n) {
1819
- f.open = e.id;
1820
- let i = t.el("spec-drawer"), a = r.canvas && r.canvas.parentElement;
1821
- !k(t) && i && i.classList.contains("drawer-open") && a && a.clientWidth < En && S(t, { source: "api" }), d.play(e, {
1822
- autoplay: !1,
1823
- step: n,
1824
- focus: k(t)
1825
- }), z();
1826
- }
1827
- function q(e, { focus: n = !1 } = {}) {
1828
- f.tab = e, f.tabNow = e, f.tabFor = g(), t.store.set(Tn, e), z(), n && s(`rc-tab-${e}`)?.focus();
1829
- }
1830
- function J(e) {
1831
- if (!r.proposal) return;
1832
- k(t) && (q(e), Ee(t, "proposal"));
1833
- let n = s(e === "scenarios" ? "rc-scenarios" : "rc-changes"), i = s(e === "scenarios" ? "rc-scenarios-h" : "rc-changes-h");
1834
- n && typeof n.scrollIntoView == "function" && n.scrollIntoView({ block: "start" }), i && i.focus();
1835
- }
1836
- i.listen(c, "click", (e) => {
1837
- let n = e.target.closest ? e.target.closest("[data-action]") : null;
1838
- if (!n) return;
1839
- let r = n.dataset.action;
1840
- if (r === "scenario-open") {
1841
- let e = B(n);
1842
- e && U(e);
1843
- } else if (r === "scenario-step") {
1844
- let e = B(n);
1845
- e && K(e, Number(n.dataset.stepIndex));
1846
- } else r === "review-tab" ? q(n.dataset.tab, { focus: !1 }) : r === "proposal-focus" && ot(t, n.dataset.kind, n.dataset.key);
1847
- }), i.listen(c, "keydown", (e) => {
1848
- let t = e.target.closest ? e.target.closest("[role=\"tab\"]") : null;
1849
- t && [
1850
- "ArrowLeft",
1851
- "ArrowRight",
1852
- "Home",
1853
- "End"
1854
- ].includes(e.key) && (e.preventDefault(), q(t.dataset.tab === "changes" ? "scenarios" : "changes", { focus: !0 }));
1855
- });
1856
- function ee(e) {
1857
- if (!e) {
1858
- let e = f.open !== null && r.proposal && f.openFor === g() ? h().find((e) => e.id === f.open) : null;
1859
- e && u.open(e, () => z()), (f.current || e) && (f.current = null, z());
1860
- return;
1861
- }
1862
- let t = h().findIndex((t) => t.id === e.id), n = {
1863
- id: e.id,
1864
- index: t,
1865
- step: Math.min(e.index, Math.max(e.total - 1, 0))
1866
- };
1867
- f.lastStep = n, e.done && (b(), f.seen.played.includes(e.id) || x(e.id, "played"));
1868
- let i = f.current && f.current.id === n.id && f.current.step === n.step;
1869
- f.current = n, f.open !== e.id && (f.open = e.id), (!i || e.done || e.checks !== f.checks) && (f.checks = e.checks, z());
1870
- }
1871
- function Y() {
1872
- let e = f.lastStep;
1873
- if (!e) return null;
1874
- k(t) && Ee(t, "proposal");
1875
- let n = s("review-lists");
1876
- return n ? n.querySelector(`[data-action="scenario-step"][data-scenario-index="${e.index}"][data-step-index="${e.step}"]`) : null;
1877
- }
1878
- function te(e) {
1879
- let t = [];
1880
- for (let e of w().groups) for (let n of e.scenarios) t.includes(n.id) || t.push(n.id);
1881
- let n = t.indexOf(e), r = n >= 0 ? t[n + 1] : void 0;
1882
- return r === void 0 ? null : h().find((e) => String(e.id) === r) || null;
1883
- }
1884
- i.own(d.onChange(ee)), d.setCloseFocus(Y), d.setNextScenario(te), d.setKeepChecksOnClose((e) => f.open === e && !!r.proposal), i.own(ke(t, () => {
1885
- r.proposal && z();
1886
- })), i.on("proposal:draw", () => I()), i.on("proposal:pull-head", (e) => C(e)), i.on("changes:show", (e) => J(e));
1887
- let ne = t.win && t.win.ResizeObserver, re = (e, t) => {
1888
- if (e && typeof ne == "function") {
1889
- let n = new ne(t);
1890
- n.observe(e), i.own(() => n.disconnect());
1891
- }
1892
- };
1893
- return re(t.el("proposal-bar"), () => F()), re(c, () => L()), i.own(De(t, () => {
1894
- r.proposal && I();
1895
- })), i.own(() => {
1896
- l = !0, a.forEach((e) => e.remove());
1897
- }), I(), i.on("changes:opened-line", (e) => r.proposal ? E(e) : void 0), i.on("changes:played-line", () => r.proposal ? w().playedLine : ""), {
1898
- elements: a,
1899
- playScenario: d.play,
1900
- stopScenario: d.stop,
1901
- clearScenario: d.clear,
1902
- playOutage: d.playOutage,
1903
- getPlayer: d.getPlayer,
1904
- wantsFrames: d.wantsFrames,
1905
- setCloseFocus: d.setCloseFocus,
1906
- setNextScenario: d.setNextScenario,
1907
- setKeepChecksOnClose: d.setKeepChecksOnClose,
1908
- tickScenario: d.tick,
1909
- demo: d.demo,
1910
- layersHiding: (e) => yn(t, e),
1911
- checks: u,
1912
- renderColumn: I,
1913
- shareRoom: L,
1914
- setPullHead: C,
1915
- openedLine: E,
1916
- peekLine: O,
1917
- update(e) {
1918
- e && "checker" in e && u.setChecker(e.checker), r.proposal && z();
1919
- },
1920
- destroy: () => i.destroy()
1921
- };
1922
- }
1923
- // ../explorer/decision-model.js
1924
- var jn = 5e3, Mn = 3, Nn = 40, Pn = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Fn = (e) => String(e).replace(/\s+/g, " ").trim(), In = (e) => {
1925
- let t = Fn(e);
1926
- return t.length > Nn ? `${t.slice(0, 39)}…` : t;
1927
- };
1928
- function Ln(e) {
1929
- let t = e.slice(0, Mn).map(In), n = e.length - t.length;
1930
- return n > 0 ? `${t.join(", ")} and ${n} more` : t.length < 2 ? t.join("") : `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}`;
1931
- }
1932
- var Rn = (e) => e && e.checks && Array.isArray(e.checks.failed) ? e.checks.failed : [], zn = (e) => e && e.checks && e.checks.running || 0, Bn = (e) => `${Ln(e)} failed`;
1933
- function Vn(e, t) {
1934
- if (!e) return "";
1935
- let n = [
1936
- "code",
1937
- "summary",
1938
- "brief",
1939
- "proposal"
1940
- ].includes(e.kind) ? e.kind : "code", r = n === "code" ? "a code run" : `a ${n} run`;
1941
- if (e.open) return `No new run is asked for: ${typeof e.open == "string" ? `run ${Fn(e.open).slice(0, 40)} is` : "one is"} still open on it.`;
1942
- if (e.fired) return `No new run is asked for: ${r} was asked for at this head already.`;
1943
- let i = `Then ${r} is asked for.`;
1944
- if (e.transport !== "pull") return `${i} The request is posted for your runner.`;
1945
- if (e.runner === "online") return `${i} A runner is online.`;
1946
- let a = typeof e.lastSeen == "string" ? Date.parse(e.lastSeen) : NaN;
1947
- return e.runner === "quiet" && Number.isFinite(a) ? `${i} No runner has polled for ${J(t - a)}: the run will wait.` : `${i} No runner has polled yet: the run will wait.`;
1948
- }
1949
- var Hn = (e) => e > 0 ? `Your ${Pn(e, "edit")} ${e === 1 ? "goes" : "go"} in the comment, for the agent to fold in.` : "";
1950
- function Un(e) {
1951
- let t = e.pull.number, n = !!e.lands;
1952
- if (e.pull.draft) return n ? `PR #${t} is a draft. Approve posts an approval; it lands only if the PR is marked ready within 60 minutes.` : `PR #${t} is a draft. Approve posts an approval on it.`;
1953
- let r = `Approve posts an approval on PR #${t}.`, i = e.checks, a = Rn(e), o = zn(e);
1954
- return a.length ? n ? `${r} It will not land: ${Bn(a)}.` : `${r} ${Bn(a)}.` : i && i.total === 0 ? n ? `${r} It will not land: the PR has no checks.` : `${r} It does not land it.` : o ? n ? `${r} It lands once ${o === 1 ? "1 running check passes" : `${o} running checks pass`}.` : `${r} ${o === 1 ? "1 check is" : `${o} checks are`} still running.` : i && !i.passed ? n ? `${r} It will not land: no check has passed.` : `${r} It does not land it.` : n ? `Approve posts an approval on PR #${t} and lands it.` : `${r} It does not land it.`;
1955
- }
1956
- function Wn(e, t) {
1957
- return `An approval of this version of PR #${e} stands.${t && t.landing ? " Its landing waits for the checks." : ""} A push makes Approve live again.`;
1958
- }
1959
- function Gn({ facts: e, edits: t = 0, form: n = null }) {
1960
- let r = [];
1961
- if (e && e.pull) {
1962
- let t = Rn(e);
1963
- t.length && r.push({
1964
- key: "failed",
1965
- text: `${Bn(t)} on PR #${e.pull.number}.`
1966
- }), e.pull.draft && r.push({
1967
- key: "draft",
1968
- text: `PR #${e.pull.number} is a draft: its author has not marked it ready.`
1969
- });
1970
- }
1971
- return n && r.push({
1972
- key: "form",
1973
- text: `Your ${Fn(n.name)} form is not added.`
1974
- }), e && e.pull && e.lands && t > 0 && r.push({
1975
- key: "edits",
1976
- text: `PR #${e.pull.number} lands as written; your ${Pn(t, "edit")} only go${t === 1 ? "es" : ""} in the comment.`
1977
- }), r;
1978
- }
1979
- function Kn(e, t = "Approve") {
1980
- if (!e.length) return "";
1981
- let n = e.length === 1 ? e[0] : null, r = n && n.key === "form" ? `${t} without it?` : `${t} anyway?`;
1982
- return `${e.map((e) => e.text).join(" ")} ${r}`;
1983
- }
1984
- var qn = (e, t) => e.filter((e) => !t.includes(e.key)), Jn = "Shown to read only: there is no cornfield server here to send an approval or a send back to.";
1985
- function Yn({ source: e, facts: t, factsState: n, review: r = null, edits: i = 0, form: a = null, played: o = "", now: s = Date.now() }) {
1986
- let c = G(e), l = (...e) => e.filter(Boolean).join(" ");
1987
- if (!c) return {
1988
- line: `Draft in ${!e || e === "checkout" ? "the checkout" : `worktree ${Fn(e)}`}: push it as a spec PR to review it here.`,
1989
- approve: "refused",
1990
- reasons: [],
1991
- ask: ""
1992
- };
1993
- let u = !!r && r.verdict === "approved" && r.current === !0;
1994
- if (n === "loading" || !t && n !== "unread") return {
1995
- line: l(`Reading PR #${c} …`, o),
1996
- approve: u ? "done" : "reading",
1997
- reasons: [],
1998
- ask: ""
1999
- };
2000
- if (!t || n === "unread") return {
2001
- line: l(`Could not read PR #${c}'s checks. Approve posts an approval on it.`, Hn(i), o),
2002
- approve: u ? "done" : "allowed",
2003
- reasons: Gn({
2004
- facts: null,
2005
- edits: i,
2006
- form: a
2007
- }),
2008
- ask: ""
2009
- };
2010
- let d = Gn({
2011
- facts: t,
2012
- edits: i,
2013
- form: a
2014
- }), f = t.run ? Vn(t.run, s) : "", p = l(Un(t), f, Hn(i), o);
2015
- return u ? {
2016
- line: l(Wn(c, t), o),
2017
- approve: "done",
2018
- reasons: d,
2019
- ask: ""
2020
- } : {
2021
- line: p,
2022
- approve: d.length ? "asks" : "allowed",
2023
- reasons: d,
2024
- ask: Kn(d)
2025
- };
2026
- }
2027
- function Xn({ source: e, edits: t = 0 }) {
2028
- let n = G(e);
2029
- return n ? `Posts ${t > 0 ? `your note and ${Pn(t, "edit")}` : "your note"} on PR #${n} for the drafting agent. No run is asked for.` : "";
2030
- }
2031
- function Zn({ form: e = null }) {
2032
- let t = Gn({
2033
- facts: null,
2034
- edits: 0,
2035
- form: e
2036
- });
2037
- return {
2038
- asks: t.length > 0,
2039
- reasons: t,
2040
- ask: Kn(t, "Send back")
2041
- };
2042
- }
2043
- function Qn(e, t = "") {
2044
- if (e === 401) return "Your sign-in has ended. Sign in again: your edits are kept here.";
2045
- let n = Fn(t);
2046
- return e === 403 || e === 409 ? n || "The review was not posted." : `The review was not posted. ${n || `The server answered ${e}.`}`;
2047
- }
2048
- var $n = (e, t) => `${e === "approved" ? "Approving" : "Sending back"} in ${Math.max(0, Math.ceil(t))} s`, er = (e, t) => `${e === "approved" ? "Approving" : "Sending back"} in ${Pn(Math.ceil(t), "second")}. Undo to stop it; nothing has been sent.`;
2049
- function tr(e, t) {
2050
- let n = e === "approved" ? "The approval" : "The send back";
2051
- return `${{
2052
- undo: `${n} was undone.`,
2053
- escape: `${n} was undone.`,
2054
- closed: `${n} was stopped: the proposal was closed.`,
2055
- other: `${n} was stopped: another proposal was opened.`,
2056
- hidden: `${n} was stopped: this tab was hidden.`,
2057
- offline: `${n} was stopped: you are offline.`,
2058
- edits: `${n} was stopped: your edits changed.`,
2059
- pushed: `${n} was stopped: the PR was pushed to while it was held, so it is not what you looked at. Look again before you decide.`
2060
- }[t] || `${n} was stopped.`} Nothing was sent.`;
2061
- }
2062
- var nr = (e) => `Sent with ${Pn(e, "edit")}`, rr = 3e4, ir = 3e4, ar = "cornfield.reviewNote.", or = () => ({ foot: "<div id=\"review-decision\" class=\"hx-rc-foot\" data-corn=\"decision\" role=\"group\" aria-label=\"Decision\"><div id=\"review\" class=\"hx-review\" data-corn=\"review-bar\"><p class=\"hx-review-status\" data-review-status hidden><span data-review-verdict role=\"status\"></span><span data-review-when></span></p><div class=\"hx-review-form\" id=\"review-form\" data-review-form hidden><label class=\"hx-review-label\" for=\"review-note\" data-corn=\"review-label\"></label><textarea data-corn=\"review-note\" id=\"review-note\" class=\"hx-review-note\" rows=\"2\" maxlength=\"20000\"></textarea><p class=\"hx-review-line\" id=\"review-sendback-line\" data-review-sendback-line></p><div class=\"hx-review-row\"><button type=\"button\" class=\"hx-btn hx-btn--quiet\" data-review-cancel data-corn-kind=\"quiet\">Cancel</button></div></div><p class=\"hx-review-msg\" data-review-loadfail role=\"alert\" hidden data-corn=\"message\" data-corn-state=\"failure\"><span data-review-loadfail-text></span> <button type=\"button\" class=\"hx-btn hx-btn--quiet\" data-review-retry data-corn-kind=\"quiet\">Retry</button></p><p class=\"hx-review-msg\" data-review-msg role=\"alert\" hidden></p><p class=\"hx-review-line\" id=\"review-hint\" data-review-hint role=\"status\" hidden></p><details class=\"hx-sent-edits\" data-corn=\"sent-edits\" data-review-sent hidden><summary data-corn=\"summary\" data-review-sent-summary></summary><ul class=\"hx-whatif-list\" data-review-sent-list></ul></details><div class=\"hx-review-landing\" data-corn=\"notice\" data-corn-state=\"waiting\" data-review-landing hidden><p data-review-landing-text></p><button type=\"button\" class=\"hx-btn hx-btn--quiet\" data-review-cancel-landing data-corn-kind=\"quiet\"></button></div><p class=\"hx-review-ask\" id=\"review-ask\" data-corn=\"message\" data-corn-state=\"waiting\" data-review-ask role=\"alert\" hidden></p><p class=\"hx-decision-line\" id=\"review-line\" data-review-line></p><div class=\"hx-hold\" data-review-hold hidden aria-hidden=\"true\"><span class=\"hx-hold-fill\" data-review-hold-fill></span></div><p class=\"hx-sr-only\" data-review-hold-live role=\"status\"></p></div><div class=\"hx-proposal-actions\"><button data-corn-kind=\"secondary\" type=\"button\" class=\"hx-btn\" data-review=\"notes\" data-peek-ok title=\"Send it back to the drafting agent with a note and your edits\" data-corn-string=\"sendBack\">Send back</button><button type=\"button\" class=\"hx-btn hx-review-undo\" data-review-undo data-corn-kind=\"secondary\" hidden></button><button type=\"button\" class=\"hx-btn hx-btn--approve\" data-review=\"approved\" data-peek-ok title=\"Sign this proposal off\" data-corn-kind=\"approve\" data-corn-string=\"approve\">Approve</button></div></div>" });
2063
- function sr(e, t, n = {}) {
2064
- let { state: r } = t, i = v(t), o = typeof n.now == "function" ? n.now : () => Date.now(), s = typeof n.unnamed == "string" && n.unnamed ? n.unnamed : "", c = Be(t), l = R(t, e, or().foot, n.slots, "foot");
2065
- i.keepParts(...l);
2066
- let p = l[0], h = p.querySelector("#review"), g = p.querySelector(".hx-proposal-actions"), y = !1, b = {
2067
- key: null,
2068
- reviewable: !1,
2069
- review: null,
2070
- loadFailed: !1,
2071
- busy: !1,
2072
- noting: !1,
2073
- message: "",
2074
- hint: "",
2075
- facts: null,
2076
- factsState: "loading",
2077
- factsAt: 0,
2078
- asking: null,
2079
- hold: null,
2080
- sent: null
2081
- }, x = () => r.proposalSlug || null, S = () => r.proposal && x() ? `${r.proposalSource || ""}/${x()}` : null, C = () => r.proposalSource ? `?source=${encodeURIComponent(r.proposalSource)}` : "", w = () => `/proposals/${encodeURIComponent(x())}/review${C()}`, T = (e) => `/proposals/${encodeURIComponent(x())}/decision${C()}${e ? "&fresh=1" : ""}`, E = (e) => h.querySelector(e), O = (e) => p.querySelector(`[data-review="${e}"]`), A = () => p.querySelector("[data-review-undo]"), j = () => {
2082
- let e = t.ask("whatif:edits");
2083
- return Array.isArray(e) ? e : [];
2084
- }, M = () => {
2085
- let e = t.ask("whatif:form");
2086
- return e === void 0 ? null : e;
2087
- }, N = () => {
2088
- let e = t.ask("changes:played-line");
2089
- return typeof e == "string" ? e : "";
2090
- }, P = () => r.whatIf ? r.whatIf.edits.length : 0;
2091
- function F() {
2092
- return Yn({
2093
- source: r.proposalSource,
2094
- facts: b.facts,
2095
- factsState: b.factsState,
2096
- review: b.review,
2097
- edits: P(),
2098
- form: M(),
2099
- played: N(),
2100
- now: o()
2101
- });
2102
- }
2103
- function I() {
2104
- if (y) return;
2105
- let e = E("[data-review-status]"), { verdict: n, when: i } = _(b.review, o()), a = E("[data-review-verdict]");
2106
- a.textContent !== n && (a.textContent = n), E("[data-review-when]").textContent = i ? ` ${i}` : "", e.hidden = !n;
2107
- let c = E("[data-review-loadfail]");
2108
- c.hidden = !b.loadFailed, E("[data-review-loadfail-text]").textContent = b.loadFailed ? `Could not load this proposal's reviews.${t.offline() ? " You are offline." : ""} It may already be approved or sent back; try again before you decide.` : "";
2109
- let l = F(), u = "";
2110
- if (b.asking && !b.hold) {
2111
- if (b.asking.verdict === "approved") u = l.reasons.length ? Kn(l.reasons) : "";
2112
- else {
2113
- let e = Zn({ form: M() });
2114
- u = e.asks ? e.ask : "";
2115
- }
2116
- u || (b.asking = null);
2117
- }
2118
- let d = b.hold, f = O("approved"), m = O("notes"), h = b.asking && b.asking.verdict === "approved" ? "anyway" : d && d.verdict === "approved" ? "hold" : l.approve === "done" ? "done" : "plain", v = b.asking && b.asking.verdict === "notes" ? "anyway" : d && d.verdict === "notes" ? "hold" : "plain", x = E("[data-review-line]"), S = !b.key && !!r.proposal && !!s;
2119
- x.textContent = b.key ? l.line : S ? s : "", x.hidden = !b.key && !S || !!u, g.hidden = S;
2120
- let C = E("[data-review-ask]");
2121
- C.textContent !== u && (C.textContent = u), C.hidden = !u, E("[data-review-sendback-line]").textContent = Xn({
2122
- source: r.proposalSource,
2123
- edits: P()
2124
- });
2125
- let w = b.key && l.approve === "refused";
2126
- for (let e of p.querySelectorAll("[data-review]")) !b.reviewable || b.busy || d || e === f && (l.approve === "done" || l.approve === "reading") ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.disabled = !1, b.key && e === f ? e.setAttribute("aria-describedby", u ? "review-ask" : "review-line") : b.key && !b.noting && e === m && w ? e.setAttribute("aria-describedby", "review-line") : b.key && b.noting && e === m ? e.setAttribute("aria-describedby", "review-sendback-line") : e.removeAttribute("aria-describedby");
2127
- f && (f.textContent = h === "hold" ? $n("approved", d.left) : h === "anyway" ? D(t, "approveAnyway") : h === "done" ? D(t, "approved") : D(t, "approve"), f.dataset.holding = h === "hold" ? "true" : "false"), m && (m.textContent = v === "hold" ? $n("notes", d.left) : v === "anyway" ? D(t, "sendBackAnyway") : b.noting ? D(t, "sendBackWithNote") : D(t, "sendBack"), m.setAttribute("aria-expanded", String(b.noting)), m.setAttribute("aria-controls", "review-form"), m.dataset.holding = v === "hold" ? "true" : "false");
2128
- let T = A();
2129
- T && (T.hidden = !d, T.textContent = D(t, "undo"));
2130
- let k = E("[data-review-hold]");
2131
- k.hidden = !d, E("[data-review-form]").hidden = !b.noting, E("[data-review-cancel]").disabled = b.busy || !!d;
2132
- let j = E("#review-note");
2133
- j.disabled = !b.reviewable, j.readOnly = !!d;
2134
- for (let [e, t] of [["[data-review-msg]", b.message], ["[data-review-hint]", b.reviewable ? b.hint : ""]]) {
2135
- let n = E(e);
2136
- n.hidden = !t, n.textContent = t;
2137
- }
2138
- let N = E("[data-review-sent]");
2139
- if (N.hidden = !b.sent, b.sent) {
2140
- E("[data-review-sent-summary]").textContent = nr(b.sent.lines.length);
2141
- let e = E("[data-review-sent-list]");
2142
- e.dataset.for !== b.sent.key && (e.dataset.for = b.sent.key, e.replaceChildren(...b.sent.lines.map((e) => {
2143
- let n = t.doc.createElement("li");
2144
- return n.className = "hx-whatif-edit", n.textContent = e, n;
2145
- })));
2146
- }
2147
- let I = E("[data-review-landing]"), L = b.reviewable && b.facts && b.facts.landing ? b.facts.landing : null;
2148
- I.hidden = !L, L && (E("[data-review-landing-text]").textContent = `Landing on approval waits for PR #${b.facts.pull.number} to be ready and green.`);
2149
- }
2150
- E(".hx-review-label").textContent = D(t, "reviewNoteLabel"), E("#review-note").setAttribute("placeholder", D(t, "reviewNotePlaceholder")), E("[data-review-cancel-landing]").textContent = D(t, "cancelLanding"), A().textContent = D(t, "undo");
2151
- function L() {
2152
- b.noting = !0, b.message = "", I(), k(t) && Ee(t, "proposal"), E("#review-note").focus();
2153
- let e = O("notes");
2154
- k(t) && e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
2155
- }
2156
- function z() {
2157
- b.noting = !1, b.asking = null, b.message = "", E("#review-note").value = "", q(b.key), I();
2158
- let e = O("notes");
2159
- e && e.focus();
2160
- }
2161
- function B({ open: e }) {
2162
- let t = e ? S() : null;
2163
- if (h.hidden = !(t || e && s), t === b.key) {
2164
- I();
2165
- return;
2166
- }
2167
- b.hold && X(e ? "other" : "closed", { quiet: !1 }), b.key = t, b.reviewable = !!t && f(r.proposalSource), b.review = null, b.loadFailed = !1, b.busy = !1, b.noting = !1, b.asking = null, b.sent = null, b.facts = null, b.factsState = b.reviewable ? "loading" : "ready", b.message = b.hint = "";
2168
- let n = E("#review-note"), i = t && b.reviewable ? K(t) : "";
2169
- n && (n.value = i), i && (b.noting = !0), I(), t && b.reviewable && (Y(t), H());
2170
- }
2171
- let V = (e, n) => {
2172
- (e === 401 || e === 403) && t.emit("auth", {
2173
- status: e,
2174
- during: n
2175
- });
2176
- };
2177
- async function H({ fresh: e = !1 } = {}) {
2178
- let t = b.key;
2179
- if (!t || !b.reviewable || !G(r.proposalSource)) return;
2180
- b.factsAt = o();
2181
- let n = null;
2182
- try {
2183
- let t = await c(T(e), { cache: "no-store" });
2184
- t.ok ? n = await t.json() : V(t.status, "facts");
2185
- } catch {
2186
- n = null;
2187
- }
2188
- if (y || t !== b.key) return;
2189
- let i = n && n.pull ? n.pull.head : null, a = b.facts && b.facts.pull ? b.facts.pull.head : null;
2190
- b.facts = n && n.pull ? n : null, b.factsState = b.facts ? "ready" : "unread", i && a && i !== a && Y(t), I();
2191
- }
2192
- let U = () => {
2193
- try {
2194
- return t.win.sessionStorage;
2195
- } catch {
2196
- return null;
2197
- }
2198
- };
2199
- function W(e, t) {
2200
- if (e) try {
2201
- t && t.trim() ? U().setItem(ar + e, t.slice(0, 2e4)) : U().removeItem(ar + e);
2202
- } catch {}
2203
- }
2204
- function K(e) {
2205
- try {
2206
- return U().getItem(ar + e) || "";
2207
- } catch {
2208
- return "";
2209
- }
2210
- }
2211
- function q(e) {
2212
- if (e) try {
2213
- U().removeItem(ar + e);
2214
- } catch {}
2215
- }
2216
- function J(e = 0) {
2217
- b.key && b.reviewable && !b.hold && !b.busy && (t.hidden() || o() - b.factsAt < e || H());
2218
- }
2219
- function ee() {
2220
- let e = t.active(), n = !!e && h.contains(e) && e.matches("[data-review-retry]");
2221
- b.loadFailed = !1, I(), n && t.emit("proposal:focus-title");
2222
- }
2223
- async function Y(e) {
2224
- try {
2225
- let t = await c(w(), { cache: "no-store" });
2226
- if (y || e !== b.key) return;
2227
- if (t.status === 404) {
2228
- b.review = null, ee();
2229
- return;
2230
- }
2231
- if (!t.ok) throw V(t.status, "review"), Error(`The server answered ${t.status}.`);
2232
- let n = await t.json();
2233
- if (y || e !== b.key) return;
2234
- n && typeof n.verdict == "string" && (b.review = {
2235
- verdict: n.verdict,
2236
- at: n.at,
2237
- current: n.current === !0
2238
- }), ee();
2239
- } catch {
2240
- !y && e === b.key && (b.loadFailed = !0, I());
2241
- }
2242
- }
2243
- function te(e) {
2244
- if (!e.target.closest || e.detail > 1 && e.target.closest("[data-review], [data-review-undo]")) return;
2245
- if (e.target.closest("[data-review-undo]")) {
2246
- b.hold && X("undo");
2247
- return;
2248
- }
2249
- if (b.hold || b.busy) return;
2250
- if (e.target.closest("[data-review-cancel-landing]")) {
2251
- ae();
2252
- return;
2253
- }
2254
- if (e.target.closest("[data-review-cancel]")) {
2255
- z();
2256
- return;
2257
- }
2258
- if (e.target.closest("[data-review-retry]")) {
2259
- E("[data-review-loadfail-text]").textContent = "Reading the reviews again …", Y(b.key);
2260
- return;
2261
- }
2262
- let t = e.target.closest("[data-review]");
2263
- if (!t) return;
2264
- let n = t.dataset.review;
2265
- b.asking && b.asking.verdict !== n && (b.asking = null, I()), t.getAttribute("aria-disabled") !== "true" && b.reviewable && (n === "notes" && !b.noting ? L() : ne(n));
2266
- }
2267
- function ne(e) {
2268
- if (b.message = "", b.hint = "", b.sent = null, t.offline()) {
2269
- b.asking = null, b.message = ze(t, e === "approved" ? "Your approval" : "Your send back"), I();
2270
- return;
2271
- }
2272
- let n = [];
2273
- if (e === "notes") {
2274
- let e = a(E("#review-note").value);
2275
- if (e) {
2276
- b.message = e, b.noting = !0, I(), k(t) && Ee(t, "proposal"), E("#review-note").focus();
2277
- return;
2278
- }
2279
- let r = Zn({ form: M() });
2280
- if (r.asks && !(b.asking && b.asking.verdict === "notes")) {
2281
- b.asking = {
2282
- verdict: "notes",
2283
- answered: []
2284
- }, I(), d(t, r.ask);
2285
- return;
2286
- }
2287
- n = r.reasons.map((e) => e.key);
2288
- } else {
2289
- let e = F();
2290
- if (e.approve === "refused" || e.approve === "done" || e.approve === "reading") {
2291
- I();
2292
- return;
2293
- }
2294
- if (e.approve === "asks" && !(b.asking && b.asking.verdict === "approved")) {
2295
- b.asking = {
2296
- verdict: "approved",
2297
- answered: []
2298
- }, I();
2299
- return;
2300
- }
2301
- n = e.reasons.map((e) => e.key);
2302
- }
2303
- re(e, n);
2304
- }
2305
- function re(e, t) {
2306
- let n = {
2307
- ...r.proposalSha256 ? { sha256: r.proposalSha256 } : {},
2308
- ...b.facts && b.facts.pull && b.facts.pull.head ? { headSha: b.facts.pull.head } : {}
2309
- }, i = {
2310
- ...m(e, e === "notes" ? E("#review-note").value : "", j()),
2311
- ...n
2312
- };
2313
- b.asking = null;
2314
- let a = {
2315
- verdict: e,
2316
- body: i,
2317
- answered: t,
2318
- left: jn / 1e3,
2319
- tick: null,
2320
- end: null
2321
- };
2322
- b.hold = a, a.tick = setInterval(() => {
2323
- a.left = Math.max(0, a.left - 1), I();
2324
- }, 1e3), a.end = setTimeout(() => {
2325
- ie(a);
2326
- }, jn), E("[data-review-hold-fill]").style.animationDuration = `${jn}ms`, I(), E("[data-review-hold-live]").textContent = er(e, jn / 1e3);
2327
- let o = A();
2328
- o && o.focus();
2329
- }
2330
- function X(e, { quiet: n = !1 } = {}) {
2331
- let r = b.hold;
2332
- if (!r) return;
2333
- clearInterval(r.tick), clearTimeout(r.end), b.hold = null;
2334
- let i = tr(r.verdict, e);
2335
- if (e === "closed" || e === "other" ? n || d(t, i) : b.message = i, y) return;
2336
- I();
2337
- let a = E("[data-review-hold-live]");
2338
- a && (a.textContent = e === "closed" || e === "other" ? "" : i), e !== "closed" && e !== "other" && O(r.verdict)?.focus();
2339
- }
2340
- async function ie(e) {
2341
- if (b.hold !== e) return;
2342
- if (clearInterval(e.tick), t.offline()) {
2343
- X("offline");
2344
- return;
2345
- }
2346
- if (t.hidden()) {
2347
- X("hidden");
2348
- return;
2349
- }
2350
- let n = b.key;
2351
- if (e.verdict === "approved" && b.reviewable && await H({ fresh: !0 }), y || b.hold !== e || n !== b.key) return;
2352
- let r = b.facts && b.facts.pull ? b.facts.pull.head : null;
2353
- if (e.verdict === "approved" && e.body.headSha && r && r !== e.body.headSha) {
2354
- X("pushed");
2355
- return;
2356
- }
2357
- if (e.verdict === "approved" && qn(Gn({
2358
- facts: b.facts,
2359
- edits: e.body.edits.length,
2360
- form: M()
2361
- }), e.answered).length) {
2362
- b.hold = null, b.asking = {
2363
- verdict: "approved",
2364
- answered: e.answered
2365
- }, I(), O("approved")?.focus();
2366
- return;
2367
- }
2368
- b.hold = null;
2369
- let i = E("[data-review-hold-live]");
2370
- i && (i.textContent = ""), await oe(e.verdict, { body: e.body });
2371
- }
2372
- async function ae() {
2373
- let e = G(r.proposalSource);
2374
- if (!e) return;
2375
- b.busy = !0, I();
2376
- let n = "";
2377
- try {
2378
- let t = await c(`/api/forge/pulls/${e}/landing/cancel`, {
2379
- method: "POST",
2380
- headers: { "Content-Type": "application/json" },
2381
- body: "{}"
2382
- });
2383
- if (!t.ok) {
2384
- V(t.status, "landing");
2385
- let e = "";
2386
- try {
2387
- e = (await t.json()).error || "";
2388
- } catch {}
2389
- n = Qn(t.status, e);
2390
- }
2391
- } catch {
2392
- n = ze(t, "Cancelling the landing");
2393
- }
2394
- y || (b.busy = !1, b.message = n, await H({ fresh: !0 }), y || (I(), n || d(t, "Landing cancelled. The approval stands and the PR stays open."), (O("approved") || O("notes"))?.focus()));
2395
- }
2396
- async function oe(e, n = {}) {
2397
- if (y || !r.proposal || !x() || !b.reviewable) return !1;
2398
- let i = E("#review-note"), o = e === "notes" ? i.value : "";
2399
- if (b.hint = "", e === "notes" && !n.body) {
2400
- let e = a(o);
2401
- if (e) return b.message = e, b.noting = !0, I(), k(t) && Ee(t, "proposal"), i.focus(), !1;
2402
- }
2403
- b.message = "", b.busy = !0, I();
2404
- let s = b.key, l = x(), d = r.proposalSource || null, f = n.body || m(e, o, j()), p = t.ask("whatif:describe"), h = e === "notes" && Array.isArray(p) ? p : [], g, _ = e === "approved" ? "Your approval" : "Your send back", v;
2405
- try {
2406
- v = await c(w(), {
2407
- method: "PUT",
2408
- headers: { "Content-Type": "application/json" },
2409
- body: JSON.stringify(f)
2410
- });
2411
- } catch {
2412
- return y || (b.busy = !1, b.message = ze(t, _), I()), !1;
2413
- }
2414
- if (y) return !1;
2415
- try {
2416
- let e = null;
2417
- try {
2418
- e = await v.json();
2419
- } catch {}
2420
- if (v.status === 401 || v.redirected) throw Object.assign(/* @__PURE__ */ Error(""), { status: 401 });
2421
- if (!v.ok) throw Object.assign(Error(e && e.error || ""), { status: v.status });
2422
- g = e;
2423
- } catch (e) {
2424
- return y || (b.busy = !1, b.message = Qn(e.status || v.status, e.message), I(), V(e.status || v.status, "send"), (v.status === 409 || v.status === 429) && s === b.key && (Y(s), H({ fresh: !0 }))), !1;
2425
- }
2426
- if (b.busy = !1, s !== b.key) return t.emit("decision", {
2427
- outcome: e,
2428
- review: g,
2429
- slug: l,
2430
- source: d,
2431
- open: !1
2432
- }), !0;
2433
- b.review = {
2434
- verdict: g.verdict,
2435
- at: g.at,
2436
- current: g.verdict === "approved"
2437
- }, b.hint = e === "approved" ? u(e, f.edits.length) : "", g.posted === !1 && (b.hint = `It was approved already${g.by ? ` by ${g.by}` : ""}; nothing new was posted.`), q(s), e === "notes" && h.length && (b.sent = {
2438
- key: `${g.at}`,
2439
- lines: h
2440
- }), i.value = "";
2441
- let S = b.noting;
2442
- b.noting = !1, I();
2443
- let C = t.active(), T = !C || C === t.doc.body || !C.isConnected || C.hidden;
2444
- return e === "approved" ? T && O("approved")?.focus() : (S || T) && O("notes")?.focus(), t.emit("decision", {
2445
- outcome: e,
2446
- review: g,
2447
- slug: l,
2448
- source: d,
2449
- open: !0
2450
- }), t.emit("mockups:refresh"), e === "notes" && t.emit("whatif:clear"), H({ fresh: !0 }), !0;
2451
- }
2452
- i.listen(p, "click", te), i.listen(h, "input", (e) => {
2453
- e.target && e.target.id === "review-note" && W(b.key, e.target.value), b.message && (b.message = "", I());
2454
- }), i.listen(h, "keydown", (e) => {
2455
- e.key === "Escape" && b.noting && !b.asking && !b.hold && (e.stopPropagation(), z());
2456
- }), i.listen(t.root, "keydown", (e) => {
2457
- e.repeat && (e.key === "Enter" || e.key === " ") && e.target && e.target.closest && e.target.closest("#review-decision [data-review], #review-decision [data-review-undo]") ? (e.preventDefault(), e.stopPropagation()) : e.key === "Escape" && b.key && (b.hold ? (e.stopPropagation(), e.preventDefault(), X("escape")) : b.asking && (e.stopPropagation(), e.preventDefault(), b.asking = null, I()));
2458
- }, !0), i.own(t.onNetwork((e) => {
2459
- e ? b.hold && X("offline") : b.loadFailed && b.key && Y(b.key);
2460
- })), i.own(t.onWindowFocus(() => J(5e3))), i.own(t.onPageHide(() => {
2461
- b.hold && X("closed", { quiet: !0 });
2462
- })), i.own(t.onHide(() => {
2463
- b.hold && X("hidden");
2464
- })), i.own(t.onShown(() => J(5e3))), i.on("proposal:bar", B), i.on("whatif:edits-changed", () => {
2465
- b.hold && X("edits"), I();
2466
- }), i.on("changes:paint", () => I());
2467
- let se = setInterval(() => {
2468
- b.review && I();
2469
- }, rr), ce = setInterval(() => J(), ir);
2470
- return i.own(() => {
2471
- clearInterval(se), clearInterval(ce);
2472
- }), i.own(() => {
2473
- y = !0, b.hold &&= (clearInterval(b.hold.tick), clearTimeout(b.hold.end), null), l.forEach((e) => e.remove());
2474
- }), B({ open: !!r.proposal }), {
2475
- elements: l,
2476
- sendReview: oe,
2477
- loadFacts: H,
2478
- paint: I,
2479
- update() {
2480
- B({ open: !!r.proposal });
2481
- },
2482
- destroy: () => i.destroy()
2483
- };
2484
- }
2485
- // ../explorer/pieces/review.js
2486
- var cr = "Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Enter goes to the selected node's panel, Escape closes it.", lr = [
2487
- "map",
2488
- "orbit",
2489
- "dataflow"
2490
- ], ur = "There is no map to show: the topology has no nodes.", dr = "<div class=\"hx-stage\" data-corn=\"stage\"><!--corn-piece:map/stage--><div id=\"sheet-dock\" class=\"hx-dock\" data-corn=\"dock\"><!--corn-piece:proposal/bar--><!--corn-piece:changes/column--><!--corn-piece:node-panel/drawer--></div><!--corn-piece:node-panel/backdrop--><p class=\"hx-review-empty\" data-corn=\"empty\" role=\"status\" hidden></p></div><div class=\"hx-review-spare\" hidden><!--corn-piece:proposal/menu--></div>";
2491
- function fr(e, t) {
2492
- let n = {}, r = e.createTreeWalker(t, 128);
2493
- for (let e = r.nextNode(); e; e = r.nextNode()) e.data.startsWith("corn-piece:") && (n[e.data.slice(11)] = e);
2494
- return n;
2495
- }
2496
- function pr(e, t, n = {}) {
2497
- let r = e.ownerDocument || e, a = r.createElement("div");
2498
- a.setAttribute("data-corn", "review"), a.setAttribute("part", "review"), a.setAttribute("role", "region"), a.setAttribute("aria-label", typeof n.label == "string" && n.label.trim() ? n.label.trim() : "Proposal review"), a.innerHTML = l(dr), e.append(a);
2499
- let o = !t, c = o && typeof n.src == "string" ? n.src !== "" : o && n.src !== void 0 && n.src !== null, u = c ? Ve(n.src) : null, d = !!u && !u.ok;
2500
- o ? t = i({
2501
- root: a,
2502
- base: u ? u.ok ? u.base : "" : n.base || "",
2503
- fetch: d ? () => Promise.reject(/* @__PURE__ */ TypeError("The review has no server: its src is not an address.")) : n.fetch,
2504
- strings: n.strings
2505
- }) : n.strings !== void 0 && g(t, n.strings);
2506
- let { state: f } = t;
2507
- Ce(t, a), s(t, a);
2508
- let p = !1, m = !1, h = !0, _ = !1, v = !1, y = () => {
2509
- if (_ || v || p || !m || !h) return;
2510
- let e = t.map;
2511
- if (!e || typeof e.onPaint != "function") {
2512
- _ = !0, n.onReady && n.onReady();
2513
- return;
2514
- }
2515
- v = !0;
2516
- let r = e.onPaint(() => {
2517
- r(), v = !1, _ || p || !h || (_ = !0, n.onReady && n.onReady());
2518
- });
2519
- e.render();
2520
- }, b = fr(r, a), x = U(a, t, {
2521
- slots: { stage: b["map/stage"] },
2522
- measureCovered: () => F(t),
2523
- keysHelp: cr,
2524
- renderer: n.renderer,
2525
- theme: n.theme,
2526
- tokens: n.tokens,
2527
- onSelect: n.onSelect,
2528
- onReady: () => {
2529
- m = !0, y();
2530
- }
2531
- }), S = me(a, t, { slots: {
2532
- drawer: b["node-panel/drawer"],
2533
- backdrop: b["node-panel/backdrop"]
2534
- } }), C = _t(a, t, {
2535
- slots: {
2536
- bar: b["proposal/bar"],
2537
- menu: b["proposal/menu"]
2538
- },
2539
- edit: !1
2540
- }), w = An(a, t, {
2541
- slots: { column: b["changes/column"] },
2542
- checker: n.checker
2543
- }), T = fr(r, a)["decision/foot"], E = sr(a, t, {
2544
- slots: { foot: T },
2545
- now: n.now,
2546
- unnamed: Jn
2547
- }), D = t.on("map:set", ({ nodes: e, edges: n }) => (H(t, e, n), !0)), O = !n.base && !n.fetch && !(u && u.ok), k = {
2548
- topology: void 0,
2549
- proposal: null,
2550
- source: null,
2551
- slug: null,
2552
- sha256: null,
2553
- proposalView: null,
2554
- shown: null,
2555
- hasTopology: !1,
2556
- held: !1
2557
- }, A = () => {
2558
- C.update(), w.update(), E.update(), S.update();
2559
- };
2560
- function j() {
2561
- if (p) return;
2562
- let e = k.proposal;
2563
- if (e == null || e === "") {
2564
- k.held = !1, k.shown = null, h = !0, f.proposal && et(t), y();
2565
- return;
2566
- }
2567
- if (!k.hasTopology) {
2568
- k.held = !0, h = !1;
2569
- return;
2570
- }
2571
- k.held = !1;
2572
- let n = k.proposalView;
2573
- if (typeof e == "string" && d) {
2574
- h = !0, y();
2575
- return;
2576
- }
2577
- if (typeof e == "string" && O) {
2578
- let n = te(e) ? `${e} cannot be opened here: there is no cornfield server to read it from (the review has no src).` : re(e);
2579
- k.shown = null, qe(t, n, !0, []), t.emit("proposal:failed", {
2580
- slug: e,
2581
- source: k.source,
2582
- status: 0,
2583
- notFound: !1,
2584
- message: n
2585
- }), h = !0, y();
2586
- return;
2587
- }
2588
- if (typeof e == "string") {
2589
- if (f.proposal && f.proposalSlug === e && (!k.source || k.source === f.proposalSource)) {
2590
- k.shown = `${e}\u0000${k.source || ""}`, Q.includes(n) && f.proposalView !== n && C.update({ view: n }), h = !0;
2591
- return;
2592
- }
2593
- let t = `${e}\u0000${k.source || ""}`;
2594
- if (k.shown === t && f.proposal) return;
2595
- k.shown = t, h = !1;
2596
- let r = C.update({
2597
- proposal: e,
2598
- source: k.source,
2599
- view: n
2600
- });
2601
- return Promise.resolve(r).then(() => {
2602
- k.shown === t && (h = !0, y());
2603
- }), r;
2604
- }
2605
- if (k.shown === e && f.proposal) return;
2606
- k.shown = e;
2607
- let r = O ? {} : {
2608
- source: k.source,
2609
- slug: k.slug,
2610
- sha256: k.sha256
2611
- };
2612
- C.update({
2613
- proposal: e,
2614
- ...r,
2615
- view: n
2616
- }), h = !0, y();
2617
- }
2618
- function M(e) {
2619
- k.hasTopology = B(t, e);
2620
- let n = a.querySelector(".hx-review-empty");
2621
- n.textContent = k.hasTopology ? "" : ur, n.hidden = k.hasTopology, k.hasTopology ? (V(t), f.proposal ? $e(t, void 0, { fit: !0 }) : x.fit(), t.map.render(), t.map.ensureFlowLoop(), k.held && j()) : t.map.render();
2622
- }
2623
- function N(e) {
2624
- let n = e === "dataflow" ? "dataflow" : "orbit";
2625
- f.view !== n && (f.view = n, t.emit("scenario:clear"), t.touchScene(), f.nodes.length && (H(t, f.mapNodes, f.mapEdges), x.fit(), t.map.ensureFlowLoop()), t.emit("view", f.view));
2626
- }
2627
- function P(e) {
2628
- Q.includes(e) ? (k.proposalView = e, f.proposal && C.update({ view: e })) : lr.includes(e) && N(e);
2629
- }
2630
- function I(e) {
2631
- e && typeof e == "object" && ("layers" in e && Ie(t, e.layers), e.theme && x.applyTheme(e.theme));
2632
- }
2633
- function L(e) {
2634
- e !== k.topology && (k.topology = e, M(e));
2635
- }
2636
- let R = {}, z = null, W = (e) => {
2637
- z ? z.provide(e) : c && Object.assign(R, e);
2638
- };
2639
- k.useTheme = !!n.useTheme, k.theme = n.theme, c && n.strings !== void 0 && W({ strings: n.strings });
2640
- let G = () => t.base ? He(t.base, typeof n.pageUrl == "function" ? n.pageUrl() : "") : "", K = [], q = "";
2641
- K.push(t.on("auth", ({ status: e, during: t }) => {
2642
- let r = G();
2643
- if (z && z.showSignIn({
2644
- status: e,
2645
- signIn: r
2646
- }), t === "facts") {
2647
- if (q === `${e}`) return;
2648
- q = `${e}`;
2649
- } else q = "";
2650
- n.onAuth && n.onAuth({
2651
- status: e,
2652
- signIn: r,
2653
- during: t
2654
- });
2655
- })), K.push(t.on("decision", () => {
2656
- q = "", z && z.clearSignIn();
2657
- })), n.onDecision && K.push(t.on("decision", ({ outcome: e, review: t, slug: r, source: i, open: a }) => n.onDecision({
2658
- outcome: e,
2659
- proposal: r,
2660
- source: i,
2661
- open: a,
2662
- review: t
2663
- }))), n.onNavigate && K.push(t.on("proposal", ({ change: e, slug: t, source: r, pinSource: i, view: a }) => n.onNavigate({
2664
- proposal: t,
2665
- source: i ? r : null,
2666
- view: e === "closed" ? null : a,
2667
- change: e
2668
- }))), n.onError && K.push(t.on("proposal:failed", ({ message: e }) => n.onError({
2669
- kind: "proposal",
2670
- message: e
2671
- }))), K.push(t.on("proposal:specs-list", () => !1)), c && import("./review-source-DWisOXyR.js").then(({ attachSource: r }) => {
2672
- p || (z = r(t, {
2673
- root: e,
2674
- stage: a.querySelector("[data-corn=\"stage\"]"),
2675
- parsed: u,
2676
- tokens: n.tokens,
2677
- version: n.version,
2678
- pageUrl: n.pageUrl,
2679
- useTheme: k.useTheme,
2680
- theme: k.theme,
2681
- topology: R.topology,
2682
- config: R.config,
2683
- strings: R.strings,
2684
- onTopology: (e) => L(e),
2685
- onConfig: () => {
2686
- s(t, a), A();
2687
- },
2688
- onAuth: (e) => {
2689
- n.onAuth && n.onAuth(e);
2690
- },
2691
- onError: (e) => {
2692
- n.onError && n.onError(e);
2693
- },
2694
- onMode: () => x.refresh(),
2695
- focusMap: () => {
2696
- f.canvas && f.canvas.focus();
2697
- }
2698
- }));
2699
- }, (e) => {
2700
- !p && n.onError && n.onError({
2701
- kind: "offline",
2702
- message: `the review's loader did not load: ${e && e.message ? e.message : e}`
2703
- });
2704
- });
2705
- function J(e = {}) {
2706
- if (p) return;
2707
- let n = !1;
2708
- "strings" in e && (g(t, e.strings), s(t, a), n = !0, W({ strings: e.strings })), "useTheme" in e && (k.useTheme = !!e.useTheme, z && z.setUseTheme(k.useTheme)), "config" in e && (c ? W({ config: e.config || null }) : I(e.config)), "theme" in e && (x.update({ theme: e.theme }), k.theme = e.theme, z && z.setTheme(e.theme)), "checker" in e && w.update({ checker: e.checker }), "topology" in e && (c ? W({ topology: e.topology || null }) : L(e.topology));
2709
- let r, i = [
2710
- "proposal",
2711
- "source",
2712
- "slug",
2713
- "sha256"
2714
- ].some((t) => t in e);
2715
- return i && ("source" in e && (k.source = e.source || null), "slug" in e && (k.slug = e.slug || null), "sha256" in e && (k.sha256 = e.sha256 || null), "proposal" in e && (k.proposal = e.proposal, k.shown = null), "view" in e && Q.includes(e.view) && (k.proposalView = e.view), r = j()), "view" in e && !(i && Q.includes(e.view)) && P(e.view), "node" in e && x.update({ node: e.node }), n && A(), r;
2716
- }
2717
- function ee() {
2718
- if (!p) {
2719
- p = !0, D(), K.forEach((e) => e()), z && z.destroy(), z = null;
2720
- for (let e of [
2721
- E,
2722
- w,
2723
- C,
2724
- S,
2725
- x
2726
- ]) e.destroy();
2727
- Ce(t, null), a.remove(), o && t.destroy();
2728
- }
2729
- }
2730
- let Y = {};
2731
- for (let e of [
2732
- "config",
2733
- "topology",
2734
- "proposal",
2735
- "source",
2736
- "slug",
2737
- "sha256",
2738
- "view",
2739
- "node"
2740
- ]) n[e] !== void 0 && (Y[e] = n[e]);
2741
- if (c) for (let e of ["topology", "config"]) e in Y && (W({ [e]: Y[e] || null }), delete Y[e]);
2742
- return J(Y), {
2743
- inst: t,
2744
- elements: [a],
2745
- map: x,
2746
- proposal: C,
2747
- changes: w,
2748
- decision: E,
2749
- nodePanel: S,
2750
- update: J,
2751
- destroy: ee,
2752
- fit: () => x.fit(),
2753
- focusNode: (e) => x.focusNode(e),
2754
- refresh: () => x.refresh()
2755
- };
2756
- }
2757
- // \0stencil-css:/home/runner/work/CornField/CornField/components/src/components/corn-review/corn-review?tag=corn-review&encapsulation=shadow&__ext=css
2758
- var mr = () => ":host{contain:layout;min-width:0;height:100%;color:var(--corn-text);font-family:var(--corn-font);display:block}:host([hidden]){display:none!important}", hr = () => "*,:before,:after{box-sizing:border-box}*{--hx-control-h:var(--corn-control-height);--hx-seg-inner:calc(var(--hx-control-h) - var(--corn-space-1) - 2 * var(--corn-border))}@container corn-box (width<=767px){*{--hx-control-h:max(44px, var(--corn-control-height));--hx-seg-inner:var(--hx-control-h)}}img{image-rendering:var(--hx-pixelated,auto)}[hidden]{display:none!important}button{font:inherit;color:inherit;cursor:pointer}h1,h2,h3,p{margin:0}.glass{background:var(--corn-surface-1);-webkit-backdrop-filter:blur(var(--corn-blur));border:var(--corn-border) solid var(--corn-line);box-shadow:var(--corn-shadow)}.glass-header{background:color-mix(in srgb, var(--corn-ground) 88%, transparent);-webkit-backdrop-filter:blur(var(--corn-blur));border-bottom:var(--corn-border) solid var(--corn-line)}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--corn-text) 18%, transparent);border-radius:var(--corn-radius-pill)}::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb, var(--corn-text) 28%, transparent)}.hx-faint{color:var(--corn-text-3)}.hx-mono{font-family:var(--corn-mono);font-size:var(--corn-text-2xs)}.hx-strong{color:var(--corn-text-2)}.hx-bold{font-weight:700}.hx-name{color:var(--corn-text-2)}.hx-accent{color:var(--corn-accent-text)}.hx-good{color:var(--corn-ok)}.hx-warn{color:var(--corn-warn)}.hx-rom{color:var(--corn-hue-fuchsia)}.hx-link{color:var(--corn-info);text-decoration:underline}.hx-link-faint{color:var(--corn-text-3);font-family:var(--corn-mono);font-size:var(--corn-text-2xs)}.hx-link-faint:hover{color:var(--corn-warn)}.hx-code{color:var(--corn-warn);font-family:var(--corn-mono);font-size:var(--corn-text-2xs)}.hx-chips{gap:var(--corn-space-1);padding-top:var(--corn-space-1);flex-wrap:wrap;display:flex}.hx-pt{padding-top:var(--corn-space-3)}.hx-switch{border-radius:var(--corn-radius-pill);border:var(--corn-border) solid var(--corn-line);background:var(--corn-surface-3);flex:none;width:28px;height:16px;position:relative}.hx-switch:after{content:\"\";background:var(--corn-text-3);border-radius:50%;width:10px;height:10px;transition:transform .15s;position:absolute;top:2px;left:2px}[aria-checked=true]>.hx-switch{background:var(--corn-accent);border-color:var(--corn-accent)}[aria-checked=true]>.hx-switch:after{background:var(--corn-text-on-accent);transform:translate(12px)}@media (prefers-reduced-motion:reduce){.hx-switch:after{transition:none}}.hx-btn{align-items:center;gap:var(--corn-space-2);padding:var(--corn-space-1) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:var(--corn-surface-2);color:var(--corn-text-2);font-size:var(--corn-text-xs);white-space:nowrap;font-weight:600;transition:background .15s,color .15s,border-color .15s;display:inline-flex}.hx-btn:hover{background:var(--corn-surface-3);color:var(--corn-text)}.hx-btn:focus-visible,.hx-textbtn:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-btn--active,.hx-btn--active:hover{background:var(--corn-accent);border-color:var(--corn-accent-text);color:var(--corn-text-on-accent);box-shadow:var(--corn-shadow-sm)}.hx-btn--quiet{color:var(--corn-text-3);font-weight:500}.hx-btn--icon{width:28px;height:28px;font-size:var(--corn-text-base);justify-content:center;padding:0}.hx-btn--rom{width:100%;margin-top:var(--corn-space-1);padding:var(--corn-space-2);background:color-mix(in srgb, var(--corn-hue-fuchsia) 20%, transparent);border-color:color-mix(in srgb, var(--corn-hue-fuchsia) 40%, transparent);color:color-mix(in srgb, var(--corn-hue-fuchsia) 60%, var(--corn-text));justify-content:center;font-weight:700}.hx-btn--rom:hover{background:color-mix(in srgb, var(--corn-hue-fuchsia) 30%, transparent)}.hx-input{width:128px;padding:var(--corn-space-1) var(--corn-space-3) var(--corn-space-1) var(--corn-space-6);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text);font:inherit;font-size:var(--corn-text-sm);user-select:text;outline:none;transition:width .2s,border-color .2s}.hx-input:focus{border-color:var(--corn-focus);width:208px}.hx-input::placeholder{color:var(--corn-text-3)}.hx-input--wide,.hx-input--wide:focus{flex:1;width:100%}.hx-menu-wrap{flex:none;position:relative}.hx-menu{margin-top:var(--corn-space-3);width:288px;max-width:calc(100cqw - 24px);max-height:calc(100cqh - 80px);padding:var(--corn-space-4);border-radius:var(--corn-radius-lg);font-size:var(--corn-text-xs);z-index:50;user-select:none;position:absolute;top:100%;left:0;overflow-y:auto}.hx-textbtn{padding:calc(var(--corn-space-1) / 2) var(--corn-space-1);border-radius:var(--corn-radius-xs);color:var(--corn-text-3);font-size:var(--corn-text-2xs);background:0 0;border:0;font-weight:600}.hx-textbtn:hover{background:var(--corn-line-soft);color:var(--corn-text-2)}.hx-textbtn--accent{color:var(--corn-accent-text)}.hx-close{width:var(--hx-control-h);height:var(--hx-control-h);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text-3);font-weight:700;font-size:var(--corn-text-base);border:0;flex:none}.hx-close:hover{color:var(--corn-text)}.hx-mark-dot{width:12px;height:12px;margin-right:var(--corn-space-2);border:var(--corn-border-strong) solid var(--corn-changed);vertical-align:-2px;border-radius:50%;flex:none;display:inline-block}.hx-mark-dot--added{border-color:var(--corn-added);border-style:dashed}.hx-mark-dot--changed{border-color:var(--corn-changed)}.hx-mark-dot--removed{border-color:var(--corn-removed);background:color-mix(in srgb, var(--corn-removed) 25%, transparent)}.hx-mark-dot--edit{border-color:var(--corn-edit);border-style:dotted}.hx-glyph{color:color-mix(in srgb, var(--glyph) var(--corn-glyph-mix), var(--corn-text))}.hx-sr-only{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;overflow:hidden;position:absolute!important}:where(button,a[href],summary,select,textarea,[tabindex]):focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}@media (prefers-reduced-motion:reduce){.hx-input,.hx-btn,.hx-menu{transition:none;animation:none}}.hx-btn[aria-disabled=true]{opacity:.6;cursor:progress}@container corn-box (width<=767px){.hx-textbtn{min-width:44px;min-height:44px}}@media (pointer:coarse){.hx-textbtn{min-width:44px;min-height:44px}}", gr = () => "@container corn-box (width<=767px){.hx-stage .hx-hint{top:68px}}#graph-canvas{cursor:grab;touch-action:none;width:100%;height:100%;display:block}#graph-canvas:active{cursor:grabbing}#label-canvas{pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.hx-overlay{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.hx-hint{align-items:center;gap:var(--corn-space-2);max-width:85cqw;padding:var(--corn-space-1) var(--corn-space-4);border-radius:var(--corn-radius-pill);font-size:var(--corn-text-2xs);color:var(--corn-text-2);pointer-events:none;z-index:10;white-space:nowrap;display:flex;position:absolute;top:12px;left:50%;transform:translate(-50%)}.hx-hint span:last-child{text-overflow:ellipsis;overflow:hidden}@container corn-box (width>=640px){.hx-hint{font-size:var(--corn-text-xs)}}.hx-state{color:var(--corn-text-3);font-size:var(--corn-text-md);z-index:5;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.hx-state--error{align-items:center;gap:var(--corn-space-3);width:min(440px,100cqw - 32px);padding:var(--corn-space-6);border-radius:var(--corn-radius-lg);color:var(--corn-text-2);user-select:text;flex-direction:column;display:flex}.hx-state--error strong{color:var(--corn-bad);font-size:var(--corn-text-lg)}.hx-state--error p{font-size:var(--corn-text-sm);line-height:1.5}.hx-state--error #error-message{font-family:var(--corn-mono);color:var(--corn-warn);word-break:break-word}#graph-canvas.is-drawing-edge{touch-action:none}#graph-canvas:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1)}.hx-run-overlay{z-index:2;pointer-events:none;position:absolute;inset:0;overflow:hidden}.hx-run-overlay[hidden]{display:none}.hx-run-mark{--r:14px;width:0;height:0;position:absolute}.hx-run-ring{left:calc(var(--r) * -1);top:calc(var(--r) * -1);width:calc(var(--r) * 2);height:calc(var(--r) * 2);box-sizing:border-box;border:var(--corn-border-strong) solid var(--corn-added);border-radius:50%;position:absolute}.hx-run-mark--flight .hx-run-ring{animation:1.8s ease-out infinite hx-run-pulse}@keyframes hx-run-pulse{0%{opacity:1;transform:scale(.9)}to{opacity:.1;transform:scale(1.55)}}.hx-run-overlay.is-static .hx-run-ring{opacity:1;border-width:calc(var(--corn-border-strong) + var(--corn-border));animation:none;transform:none}@media (prefers-reduced-motion:reduce){.hx-run-ring{opacity:1;border-width:calc(var(--corn-border-strong) + var(--corn-border));transform:none;animation:none!important}}.hx-run-mark--collision .hx-run-ring{border:calc(var(--corn-border-strong) + var(--corn-border)) dashed var(--corn-map-collision);animation:none}.hx-run-tag{left:0;top:calc(var(--r) + 4px);white-space:nowrap;padding:calc(var(--corn-space-1) / 2) var(--corn-space-2);border-radius:var(--corn-radius-pill);border:var(--corn-border) solid var(--corn-map-collision);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-map-collision);font-size:var(--corn-text-xs);font-weight:700;position:absolute;transform:translate(-50%)}.hx-run-swatch{box-sizing:border-box;border:var(--corn-border-strong) solid var(--corn-added);border-radius:50%;flex:none;width:14px;height:14px;display:inline-block}.hx-run-swatch--collision{border:var(--corn-border-strong) dashed var(--corn-map-collision)}", _r = () => ".hx-var{color:var(--corn-hue-pink);font-family:var(--corn-mono);font-size:var(--corn-text-2xs);background:color-mix(in srgb, var(--corn-ground) 55%, transparent);padding:0 var(--corn-space-1);border-radius:var(--corn-radius-xs)}.hx-drawer-title{font-family:var(--corn-font-display)}.hx-backdrop{z-index:40;background:var(--corn-scrim);backdrop-filter:blur(calc(var(--corn-blur) / 4));position:fixed;inset:0}@container corn-box (width>=768px){.hx-backdrop{display:none}}.hx-drawer{z-index:40;border-color:var(--corn-line);box-shadow:var(--corn-shadow-lg);pointer-events:none;touch-action:pan-y;flex-direction:column;transition:transform .2s ease-out;display:flex}.hx-drawer *{touch-action:pan-y}.hx-drawer.drawer-open{pointer-events:auto}.hx-drawer:not(.drawer-open){box-shadow:none}@container corn-box (width<=767px){.hx-drawer{border-radius:var(--corn-radius-lg) var(--corn-radius-lg) 0 0;z-index:auto;border-left:0;width:100%;position:relative;transform:none}.hx-drawer:not(.drawer-open){display:none}}@container corn-box (width>=768px){.hx-drawer{width:480px;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.hx-drawer.drawer-open{transform:translate(0)}}.hx-drawer-handle{padding:var(--corn-space-3) 0 var(--corn-space-1);justify-content:center;display:flex}.hx-drawer-handle span{border-radius:var(--corn-radius-pill);background:var(--corn-surface-3);width:48px;height:6px}.hx-drawer-body{gap:var(--corn-space-5);padding:var(--corn-panel-pad);user-select:text;flex-direction:column;flex:1;display:flex;overflow-y:auto}.hx-drawer-head{justify-content:space-between;align-items:flex-start;gap:var(--corn-space-3);display:flex}.hx-drawer-title{font-size:var(--corn-text-lg);color:var(--corn-text);overflow-wrap:anywhere;font-weight:700}.hx-lead{font-size:var(--corn-text-base);color:var(--corn-text-2);line-height:1.5}.hx-block{gap:var(--corn-space-3);flex-direction:column;display:flex}.hx-meta{gap:var(--corn-space-5);font-size:var(--corn-text-md);color:var(--corn-text-2);overflow-wrap:anywhere;flex-direction:column;display:flex}.hx-meta>:empty{display:none}.hx-sec{margin-top:var(--corn-space-2);padding-top:var(--corn-space-2);border-top:var(--corn-border) solid var(--corn-line)}.hx-line{align-items:flex-start;gap:var(--corn-space-2);padding:calc(var(--corn-space-1) / 2) 0;display:flex}.hx-linkbtn{margin-left:var(--corn-space-1);color:var(--corn-hue-fuchsia);font-size:inherit;background:0 0;border:0;padding:0;text-decoration:underline}.hx-sim{gap:var(--corn-space-2);padding-top:var(--corn-space-1);font-family:var(--corn-font);flex-direction:column;display:flex}.hx-field-label{font-size:var(--corn-text-2xs);color:var(--corn-text-3)}.hx-field{width:100%;padding:var(--corn-space-1) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text-2);font-family:var(--corn-mono);font-size:var(--corn-text-xs)}.hx-sim-result{font-size:var(--corn-text-xs)}.hx-error-text{padding-top:var(--corn-space-3);color:var(--corn-bad)}.hx-ms{text-align:right;width:56px;color:var(--corn-hue-fuchsia);flex:none}.hx-file{padding:calc(var(--corn-space-1) / 2) 0}.hx-sandbox{gap:var(--corn-space-4);padding:var(--corn-space-5);border-radius:var(--corn-radius);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);flex-direction:column;display:flex}.hx-sandbox-title{font-size:var(--corn-text-2xs);text-transform:uppercase;letter-spacing:.05em;color:var(--corn-text-3);justify-content:space-between;align-items:center;font-weight:700;display:flex}.hx-sandbox-name{align-items:center;gap:var(--corn-space-2);display:flex}.hx-sandbox-stage{min-height:90px;padding:var(--corn-space-5);border-radius:var(--corn-radius-sm);border:var(--corn-border) dashed var(--corn-surface-2);background:var(--corn-ground);justify-content:center;align-items:center;display:flex;overflow-x:auto}.hx-sandbox-controls{gap:var(--corn-space-2);padding-top:var(--corn-space-3);border-top:var(--corn-border) solid var(--corn-line);font-size:var(--corn-text-xs);flex-direction:column;display:flex}.hx-ctl-row{align-items:center;gap:var(--corn-space-2);color:var(--corn-text-2);flex-wrap:wrap;display:flex}.hx-check{align-items:center;gap:var(--corn-space-1);margin-right:var(--corn-space-3);cursor:pointer;display:inline-flex}.hx-chip{padding:calc(var(--corn-space-1) / 2) var(--corn-space-3);border-radius:var(--corn-radius-xs);font-size:var(--corn-text-xs);color:var(--corn-text-on-accent);border:0;font-weight:500}.hx-chip--ghost{background:var(--corn-surface-2);color:var(--corn-text-2)}.hx-chip--outline{background:var(--corn-surface-2);color:var(--corn-accent-text)}.hx-chip--primary{background:var(--corn-accent)}.hx-chip--danger{background:var(--corn-bad)}.hx-chip--success{background:var(--corn-ok)}.hx-chip--warning{background:var(--corn-warn)}.hx-chip--danger,.hx-chip--success,.hx-chip--warning{color:var(--corn-ground)}.hx-drawer-foot{align-items:stretch;gap:var(--corn-space-3);padding:var(--corn-space-4) var(--corn-space-5) calc(var(--corn-space-4) + env(safe-area-inset-bottom,0px));border-top:var(--corn-border) solid var(--corn-line-soft);flex:none;display:flex}.hx-open{justify-content:center;align-items:center;gap:var(--corn-space-2);min-height:var(--hx-control-h);padding:0 var(--corn-space-4);border-radius:var(--corn-radius-sm);background:var(--corn-accent);color:var(--corn-text-on-accent);font-size:var(--corn-text-sm);text-align:center;flex:auto;font-weight:600;text-decoration:none;transition:background .15s;display:flex}.hx-open:hover{background:var(--corn-accent-hover)}.hx-proposal-sec{padding:var(--corn-space-3) var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-left-width:var(--corn-border-strong);border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-ground) 55%, transparent);margin:0 0 var(--corn-space-2);font-family:var(--corn-font)}.hx-proposal-sec--added{border-left-color:var(--corn-added)}.hx-proposal-sec--changed{border-left-color:var(--corn-changed)}.hx-proposal-sec--removed{border-left-color:var(--corn-removed)}.hx-proposal-sec--edit{border-left-color:var(--corn-edit)}.hx-why{margin:var(--corn-space-1) 0 var(--corn-space-2);color:var(--corn-text-2);font-size:var(--corn-text-sm);line-height:1.5}.hx-change{align-items:baseline;gap:calc(var(--corn-space-1) / 2) var(--corn-space-3);padding:var(--corn-space-1) 0;border-top:var(--corn-border) solid var(--corn-line-soft);font-family:var(--corn-mono);font-size:var(--corn-text-xs);flex-wrap:wrap;display:flex}.hx-change-field{min-width:64px;color:var(--corn-text-3);flex:none}.hx-change-before{color:var(--corn-bad);text-decoration:line-through;text-decoration-color:color-mix(in srgb, var(--corn-bad) 50%, transparent);overflow-wrap:anywhere}.hx-change-arrow{color:var(--corn-text-3)}.hx-change-after{color:var(--corn-ok);overflow-wrap:anywhere}.hx-change em{color:var(--corn-text-3);text-decoration:none}.hx-mockup-list{margin:var(--corn-space-1) 0 0;gap:var(--corn-space-2);flex-direction:column;padding:0;list-style:none;display:flex}.hx-mockup-item{align-items:center;gap:var(--corn-space-1) var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-mockup-open{white-space:normal;text-align:left;max-width:100%}.hx-mockup-state{font-size:var(--corn-text-xs);color:var(--corn-text-2);margin:0}.hx-mockup-state--approved{color:var(--corn-added-text)}.hx-mockup-state--changed{color:var(--corn-warn);font-weight:600}.hx-mockup-state--missing{color:var(--corn-bad)}@container corn-box (width<=767px){.hx-backdrop{display:none}.hx-drawer{max-height:60cqh}}.hx-cloud-browser{color:var(--corn-text-3);font-size:var(--corn-text-sm)}.hx-drawer-title:focus{outline:none}.hx-drawer-title:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-drawer-id{flex:1;min-width:0}.hx-kicker{margin:0 0 var(--corn-space-2);font-size:var(--corn-text-sm);color:var(--corn-text-3);flex-wrap:wrap;align-items:center;display:flex}.hx-kicker [data-corn=badge]{overflow-wrap:anywhere;min-width:0;max-width:100%}#drawer-host{white-space:pre}.hx-diffpill{margin-left:var(--corn-space-3);padding:0 var(--corn-space-3);border-radius:var(--corn-radius-pill);border:var(--corn-border) dashed var(--corn-added);color:var(--corn-added-text);font-size:var(--corn-text-xs)}.hx-drawer-id .hx-drawer-title.hx-mono{font-family:var(--corn-mono)}.hx-facts{gap:var(--corn-space-2);flex-direction:column;display:flex}.hx-fact{gap:var(--corn-space-4);grid-template-columns:96px minmax(0,1fr);display:grid}.hx-fact-k{color:var(--corn-text-3)}.hx-fact-v{min-width:0;color:var(--corn-text)}.hx-fact-v .hx-line{padding:0}.hx-fact-v .hx-name{color:var(--corn-text)}.hx-fact-v .hx-code{color:var(--corn-text-2);font-size:var(--corn-text-sm)}.hx-fact-v .hx-chips{padding-top:0}.hx-sec-block{gap:var(--corn-space-3);flex-direction:column;display:flex}.hx-sec-title{font-size:var(--corn-text-sm);color:var(--corn-text-3);margin:0;font-weight:600}.hx-drawer .hx-mockups{border:0;margin:0;padding:0}.hx-rows{gap:var(--corn-space-2);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.hx-row{align-items:center;gap:var(--corn-space-4);width:100%;min-height:36px;padding:var(--corn-space-3) var(--corn-space-4);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text);font:inherit;text-align:left;display:flex}.hx-row:hover{background:var(--corn-accent-soft)}.hx-row:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-row-title{overflow-wrap:anywhere;flex:1;min-width:0}.hx-row-meta{font-size:var(--corn-text-sm);color:var(--corn-text-3);font-variant-numeric:tabular-nums;flex:none}.hx-drawer .hx-mockup-list{margin:var(--corn-space-3) 0 0}.hx-drawer .hx-mockup-item{gap:var(--corn-space-4);padding:var(--corn-space-1) var(--corn-space-1) var(--corn-space-1) 0;border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);flex-wrap:nowrap}.hx-drawer .hx-mockup-open{min-width:0;min-height:36px;color:var(--corn-text);background:0 0;border:0;flex:1;font-weight:400}.hx-drawer .hx-mockup-state{padding-right:var(--corn-space-3);color:var(--corn-text-3);flex:none}.hx-drawer .hx-mockup-state--approved{color:var(--corn-added-text)}.hx-drawer .hx-mockup-state--changed{color:var(--corn-warn)}.hx-drawer .hx-mockup-state--missing{color:var(--corn-bad)}.hx-textact{background:0 0;border:0;align-self:flex-start;padding-left:0}.hx-diff{gap:var(--corn-space-1) var(--corn-space-4);padding:var(--corn-space-1) 0 var(--corn-space-1) var(--corn-space-4);border-left:var(--corn-border-strong) solid var(--corn-changed);font-family:var(--corn-mono);font-size:var(--corn-text-sm);color:var(--corn-text-2);grid-template-columns:70px minmax(0,1fr);display:grid}.hx-diff--added{border-left-color:var(--corn-added)}.hx-diff--removed{border-left-color:var(--corn-removed)}.hx-diff--edit{border-left-color:var(--corn-edit)}.hx-diff-k{color:var(--corn-text-3)}.hx-diff-v{overflow-wrap:anywhere;min-width:0}.hx-drawer .hx-why{margin:0}.hx-drawer-foot .hx-open[hidden],.hx-drawer-foot .hx-foot-btn[hidden]{display:none}.hx-foot-btn{min-height:var(--hx-control-h);padding:0 var(--corn-space-4);justify-content:center}@container corn-box (width<=767px){.hx-drawer-foot{flex-direction:column}.hx-drawer-foot .hx-open,.hx-foot-btn,.hx-drawer .hx-row,.hx-drawer .hx-mockup-open,.hx-textact,.hx-drawer .hx-whatif-drawer .hx-btn,.hx-cloud-play{min-height:44px}.hx-drawer .hx-close{width:44px;height:44px}}.hx-cloud-play{align-self:flex-start}.hx-drawer-foot .hx-btn--quiet{background:0 0;border-color:#0000;text-decoration:none}.hx-more{display:contents}.hx-more[hidden]{display:none}.hx-more-btn{margin-top:var(--corn-space-1);min-height:0;font-size:var(--corn-text-sm);padding:0;display:block}@container corn-box (width<=767px){.hx-more-btn{min-height:44px}}.hx-drawer-body{scroll-padding-block:calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1))}.hx-ms,.hx-row-meta{font-family:var(--corn-font-num);font-variant-numeric:tabular-nums}@media (prefers-reduced-motion:reduce){.hx-drawer{transition:none;animation:none}}.hx-fact-v{overflow-wrap:break-word;word-break:normal}.hx-drawer-foot .hx-forge-result{flex-basis:100%}.hx-lines{gap:var(--corn-space-2);flex-direction:column;display:flex}.hx-lines .hx-chips{padding-top:0}.hx-lines-kind{align-items:baseline;gap:var(--corn-space-1);min-height:28px;padding:0 var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-pill);color:var(--corn-text-2);font:inherit;font-size:var(--corn-text-xs);cursor:pointer;background:0 0;font-weight:600;display:inline-flex}.hx-lines-kind:hover{background:var(--corn-surface-3);color:var(--corn-text)}.hx-lines-kind[aria-pressed=true]{border-color:var(--corn-accent);background:var(--corn-accent-soft);color:var(--corn-accent-text)}.hx-lines-kind:focus-visible,.hx-lines-switch input:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-lines-count{font-variant-numeric:tabular-nums;color:var(--corn-text-3)}.hx-lines-list{align-items:flex-start;gap:calc(var(--corn-space-1) / 2);flex-direction:column;display:flex}.hx-lines-list .hx-linkbtn{text-align:left;overflow-wrap:anywhere;margin-left:0}.hx-lines-switch{align-items:center;gap:var(--corn-space-2);min-height:28px;font-size:var(--corn-text-sm);color:var(--corn-text-2);cursor:pointer;display:flex}.hx-lines-reach{align-items:center;gap:var(--corn-space-3);font-size:var(--corn-text-sm);color:var(--corn-text-2);font-variant-numeric:tabular-nums;flex-wrap:wrap;display:flex}@container corn-box (width<=767px){.hx-lines-kind,.hx-lines-switch,.hx-lines-list .hx-linkbtn,.hx-lines-reach .hx-btn{min-height:44px}.hx-lines-kind{align-items:center}.hx-lines-switch input{width:24px;height:24px}}@media (pointer:coarse){.hx-lines-kind,.hx-lines-switch,.hx-lines-list .hx-linkbtn,.hx-lines-reach .hx-btn{min-height:44px}.hx-lines-kind{align-items:center}.hx-lines-switch input{width:24px;height:24px}}.hx-drawer-title{font-size:var(--corn-text-lg);letter-spacing:normal;font-weight:700;line-height:1.25}.hx-drawer-head{min-height:var(--corn-panel-head-height)}", vr = () => ".hx-menu--proposals{width:360px}.hx-proposal-list{gap:var(--corn-space-1);flex-direction:column;display:flex}.hx-proposal-empty{padding:var(--corn-space-3) calc(var(--corn-space-1) / 2);font-size:var(--corn-text-sm)}.hx-proposal-item{align-items:flex-start;gap:var(--corn-space-1);width:100%;padding:var(--corn-space-3) var(--corn-space-3);border-radius:var(--corn-radius);border:var(--corn-border) solid var(--corn-line);background:var(--corn-surface-2);color:var(--corn-text);text-align:left;font-size:var(--corn-text-xs);flex-direction:column;display:flex}button.hx-proposal-item:hover{background:var(--corn-surface-3)}button.hx-proposal-item:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-proposal-item.is-current{border-color:var(--corn-added-text);background:color-mix(in srgb, var(--corn-added) 12%, transparent)}.hx-proposal-item.is-broken{opacity:.8;cursor:default}.hx-proposal-title{font-size:var(--corn-text-sm);color:var(--corn-text);overflow-wrap:anywhere;font-weight:600}.hx-proposal-sum{color:var(--corn-text-2);line-height:1.4}.hx-proposal-meta{gap:calc(var(--corn-space-1) / 2) var(--corn-space-3);color:var(--corn-text-3);font-size:var(--corn-text-2xs);flex-wrap:wrap;display:flex}.hx-proposal-where{color:var(--corn-added-text)}.hx-proposal-bar{width:min(960px,100% - 24px);padding:var(--corn-space-3) var(--corn-space-3);border-radius:var(--corn-radius-lg);font-size:var(--corn-text-sm);z-index:15;user-select:text;position:absolute;top:48px;left:12px}.hx-proposal-bar.is-error{border-color:color-mix(in srgb, var(--corn-removed) 50%, transparent)}.hx-proposal-message{color:var(--corn-text-2)}.hx-proposal-bar.is-error .hx-proposal-message{color:var(--corn-bad)}.hx-proposal-count:focus-visible,.hx-proposal-mode:focus-visible,.hx-seg-btn:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-proposal-summary{margin-top:var(--corn-space-2);color:var(--corn-text-2);line-height:1.5}.hx-seg{padding:calc(var(--corn-space-1) / 2);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 55%, transparent);display:inline-flex}.hx-seg-btn{height:var(--hx-seg-inner);padding:0 var(--corn-space-4);border-radius:var(--corn-radius-sm);color:var(--corn-text-3);font-size:var(--corn-text-sm);background:0 0;border:0;font-weight:500}.hx-seg-btn:hover{color:var(--corn-text)}.hx-seg-btn.is-on,.hx-seg-btn[aria-pressed=true]{background:var(--corn-accent);color:var(--corn-text-on-accent)}.hx-proposal-errors{margin-top:var(--corn-space-2);padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-removed) 10%, transparent);border:var(--corn-border) solid color-mix(in srgb, var(--corn-removed) 30%, transparent);color:var(--corn-text-2)}.hx-proposal-errors summary{cursor:pointer;color:var(--corn-bad);font-weight:600}.hx-proposal-errors ul{margin:var(--corn-space-2) 0 var(--corn-space-1);padding-left:var(--corn-space-5);line-height:1.5}.hx-proposal-errors p{margin-top:var(--corn-space-1);font-size:var(--corn-text-xs)}@container corn-box (width>=768px){.hx-stage:has(.drawer-open) .hx-proposal-bar{width:min(960px,100% - 504px)}}@container corn-box (width<=639px){.hx-menu--proposals{width:auto;max-width:none;position:fixed;top:60px;left:12px;right:12px}}.hx-proposal-reviewed{color:var(--corn-added-text)}.hx-proposal-head{align-items:center;gap:var(--corn-space-3) var(--corn-space-4);flex-wrap:wrap;display:flex}.hx-proposal-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:28ch;color:var(--corn-text);flex:0 auto;overflow:hidden}.hx-proposal-counts{display:contents}.hx-proposal-chip{color:var(--corn-text-2);font-size:var(--corn-text-sm);font-variant-numeric:tabular-nums;white-space:nowrap;flex-wrap:wrap;align-items:center;display:inline-flex}.hx-proposal-count{min-height:var(--hx-control-h);padding:var(--corn-space-1) var(--corn-space-2);border-radius:var(--corn-radius-sm);color:inherit;font:inherit;white-space:inherit;cursor:pointer;background:0 0;border:0;align-items:center;display:inline-flex}.hx-proposal-count:hover{color:var(--corn-text);text-decoration:underline}.hx-proposal-peek{margin:0;display:none}.hx-proposal-chip .hx-mark-dot{margin:0 var(--corn-space-2) 0 0}h2.hx-proposal-name{margin:0}.hx-proposal-sep{margin:0 var(--corn-space-2);color:var(--corn-text-3)}.hx-proposal-mode{display:none}.hx-proposal-tools{align-items:center;gap:var(--corn-space-3);display:flex}.hx-proposal-tools .hx-btn{height:var(--hx-control-h);font-size:var(--corn-text-sm);font-weight:500}#proposal-edit.hx-btn--active{background:var(--corn-edit-text);border-color:var(--corn-edit);color:var(--corn-ground)}.hx-proposal-more{position:relative}.hx-proposal-more .hx-btn--icon{width:var(--hx-control-h);height:var(--hx-control-h);color:var(--corn-text-3);background:0 0;border-color:#0000}.hx-proposal-more .hx-btn--icon:hover,.hx-proposal-more .hx-btn--icon[aria-expanded=true]{background:var(--corn-surface-3);color:var(--corn-text)}.hx-proposal-more-menu{z-index:20;min-width:160px;margin-top:var(--corn-space-2);padding:var(--corn-space-2);border-radius:var(--corn-radius);border:var(--corn-border) solid var(--corn-line);box-shadow:var(--corn-shadow);flex-direction:column;display:flex;position:absolute;top:100%;right:0}.hx-proposal-more-menu[hidden]{display:none}.hx-proposal-more-menu .hx-btn{width:100%;height:var(--hx-control-h);color:var(--corn-text-2);font-size:var(--corn-text-sm);background:0 0;border-color:#0000}.hx-proposal-more-menu .hx-btn:hover{background:var(--corn-surface-3);color:var(--corn-text)}@container corn-box (width<=767px){.hx-proposal-head{gap:var(--corn-space-2) var(--corn-space-3);grid-template-columns:1fr auto;display:grid}.hx-proposal-name{order:1;grid-column:1/-1;max-width:none}.hx-proposal-counts{align-items:center;column-gap:var(--corn-space-2);flex-wrap:wrap;order:2;grid-column:1/-1;display:flex}.hx-proposal-count,.hx-proposal-mode{min-height:44px}.hx-proposal-mode{align-items:center;gap:var(--corn-space-2);padding:0 var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text);font-size:var(--corn-text-sm);font-weight:600;display:inline-flex}.hx-proposal-mode:after{content:\"\";background:currentColor;width:10px;height:10px;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E\") 50%/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E\") 50%/contain no-repeat}.hx-proposal-mode[aria-expanded=true]:after{transform:rotate(180deg)}.hx-seg{order:3;grid-column:1/-1}.hx-proposal-bar:not([data-mode-open=true]) .hx-seg{display:none}.hx-seg-btn{height:var(--hx-seg-inner);font-size:var(--corn-text-md);flex:1}.hx-proposal-tools{order:5}.hx-proposal-tools .hx-btn{height:auto;min-height:44px;padding:0 var(--corn-space-5);font-size:var(--corn-text-md)}.hx-proposal-more{display:contents}.hx-proposal-more .hx-btn--icon{width:var(--hx-control-h);height:var(--hx-control-h);order:6}.hx-proposal-more-menu{box-shadow:none;order:7;grid-column:1/-1;position:static}.hx-proposal-more-menu .hx-btn{height:auto;min-height:44px;font-size:var(--corn-text-md)}.hx-proposal-bar{max-height:50cqh;padding:0 var(--corn-space-4) var(--corn-space-3);overflow-y:auto}}@container corn-box (width>=768px){.hx-stage:has(.forge-open) .hx-proposal-bar{left:calc(var(--hx-forge-w) + 12px);width:min(960px, calc(100% - var(--hx-forge-w) - 36px))}.hx-stage:has(.forge-open):has(.drawer-open) .hx-proposal-bar{width:min(960px, calc(100% - var(--hx-forge-w) - 540px))}}.hx-proposal-bar{scroll-padding-block:calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1))}@media (forced-colors:active){.hx-proposal-mode:after{background:canvastext}}.hx-proposal-source{min-width:0;max-width:100%;padding:calc(var(--corn-space-1) / 2) var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-pill);background:var(--corn-surface-2);color:var(--corn-text-2);font-size:var(--corn-text-xs);overflow-wrap:anywhere;align-items:center;line-height:1.4;text-decoration:none;display:inline-flex}.hx-proposal-source[hidden]{display:none}a.hx-proposal-source{min-height:24px}a.hx-proposal-source:hover{color:var(--corn-text);text-decoration:underline}a.hx-proposal-source:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-proposal-source[data-corn-state=draft]{border-color:color-mix(in srgb, var(--corn-changed) 50%, transparent)}.hx-proposal-ways{gap:var(--corn-space-2) var(--corn-space-3);margin-top:var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-proposal-ways[hidden]{display:none}.hx-proposal-ways .hx-btn{height:auto;min-height:32px;padding:var(--corn-space-1) var(--corn-space-4);white-space:normal;text-align:left}@container corn-box (width<=767px){.hx-proposal-source{order:1;grid-column:1/-1;justify-self:start}.hx-proposal-ways .hx-btn,a.hx-proposal-source{min-height:44px}.hx-proposal-source{background:0 0;border:0;border-radius:0;padding:0}a.hx-proposal-source{text-underline-offset:3px;text-decoration:underline}.hx-proposal-bar:has(.hx-review-form:not([hidden])) :is(.hx-proposal-name,.hx-proposal-source,.hx-proposal-counts,.hx-proposal-tools,.hx-proposal-more,.hx-review-status,.hx-review-line,.hx-rc-scroll,.hx-rc-tabs,.hx-proposal-peek){display:none}.hx-proposal-bar{overflow-wrap:anywhere;overflow-x:hidden}.hx-proposal-head{grid-template-columns:minmax(0,1fr) auto}.hx-proposal-chip{white-space:normal;text-align:left;flex-wrap:wrap;max-width:100%}.hx-proposal-counts{min-width:0}.hx-proposal-chip{white-space:normal;text-align:left;flex-wrap:wrap}.hx-proposal-count{white-space:normal;text-align:left}}@media (pointer:coarse){.hx-proposal-chip{white-space:normal;text-align:left;flex-wrap:wrap}.hx-proposal-count{white-space:normal;text-align:left}}.hx-proposal-summary{-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;flex:none;margin:0;display:-webkit-box;overflow:hidden}@container corn-box (width<=767px){.hx-proposal-summary{display:none}}.hx-waiting-line{align-items:center;gap:var(--corn-space-2) var(--corn-space-3);margin:var(--corn-space-2) 0 0;padding:var(--corn-space-1) var(--corn-space-3);border-left:calc(var(--corn-border-strong) * 2) solid var(--corn-run-waiting);border-radius:var(--corn-radius-sm);background:var(--corn-surface-2);color:var(--corn-text);overflow-wrap:anywhere;flex-wrap:wrap;line-height:1.4;display:flex}.hx-waiting-line[hidden]{display:none}@container corn-box (width<=767px){.hx-waiting-line .hx-btn{min-width:44px;min-height:44px}}.hx-proposal-yours{align-items:center;gap:var(--corn-space-1);color:var(--corn-text-2);display:inline-flex}.hx-proposal-tools [aria-pressed=false]:not([data-corn=whole-map]){opacity:.8}.hx-proposal-name{font-size:var(--corn-text-lg);letter-spacing:normal;font-weight:700;line-height:1.25}@container corn-box (width>=768px){.hx-proposal-tools{display:contents}.hx-proposal-name,.hx-proposal-source{order:-2}:where(.hx-proposal-head) [data-corn=whole-map]{margin-block:calc((var(--corn-space-6) - var(--hx-control-h)) / 2);order:-1}}", yr = () => ".hx-change-row:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-change-row{align-items:center;gap:var(--corn-space-3);width:100%;padding:var(--corn-space-1) var(--corn-space-2);border-radius:var(--corn-radius-sm);text-align:left;font-size:var(--corn-text-xs);background:0 0;border:0;display:flex}.hx-change-row:hover{background:var(--corn-line-soft)}.hx-change-what{width:56px;color:var(--corn-text-3);flex:none}.hx-change-row .hx-name{overflow-wrap:anywhere;min-width:0}.hx-change-row .hx-mark-dot{margin-right:0}.hx-player{left:calc(var(--hx-col-w,0px) + 24px);align-items:center;gap:var(--corn-space-2) var(--corn-space-4);padding:var(--corn-space-3) var(--corn-space-4);border-radius:var(--corn-radius-lg);z-index:25;flex-wrap:wrap;display:flex;position:absolute;bottom:12px;right:12px;overflow:hidden}.hx-player .hx-close{width:var(--hx-control-h);height:var(--hx-control-h);font-size:var(--corn-text-sm)}.hx-player-speed{height:var(--hx-control-h);padding:0 var(--corn-space-2);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text);font:inherit;font-size:var(--corn-text-sm);cursor:pointer;flex:none}.hx-player-speed:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-offset) / 2)}.hx-player-text{min-width:0;font-size:var(--corn-text-base);color:var(--corn-text);user-select:text;overflow-wrap:anywhere;flex:18em;margin:0;line-height:1.4}.hx-player-who{color:var(--corn-text-2);font-weight:600}.hx-player-text .hx-player-verdict{margin-left:var(--corn-space-2)}.hx-player-count{color:var(--corn-accent-text);white-space:nowrap;font-weight:600}.hx-player-controls{gap:var(--corn-space-3);flex:none;display:flex}.hx-player-side{align-items:center;gap:var(--corn-space-3);flex:none;margin-left:auto;display:flex}.hx-player-controls .hx-btn{white-space:nowrap;justify-content:center}.hx-player-controls .hx-btn[hidden]{display:none}.hx-player-prev:before{content:\"◀\" / \"\";margin-right:var(--corn-space-2)}.hx-player-next:after{content:\"▶\" / \"\";margin-left:var(--corn-space-2)}.hx-player-toggle[data-state=playing]:before{content:\"\" / \"\";box-sizing:border-box;width:1em;height:1em;margin-right:var(--corn-space-2);border-left:calc(var(--corn-border-strong) * 1.5) solid currentColor;border-right:calc(var(--corn-border-strong) * 1.5) solid currentColor;display:inline-block}.hx-player-toggle[data-state=paused]:before{content:\"▶\" / \"\";margin-right:var(--corn-space-2)}.hx-player-toggle[data-state=done]:before{content:\"↻\" / \"\";margin-right:var(--corn-space-2)}.hx-player-controls .hx-btn:disabled{opacity:.4;cursor:default}.hx-player-track{background:var(--corn-line-soft);height:3px;position:absolute;bottom:0;left:0;right:0}.hx-player-fill{background:var(--corn-accent-text);width:0;height:100%;display:block}@container corn-box (width<=767px){.hx-player{gap:0 var(--corn-space-3);max-height:50cqh;padding:0 var(--corn-space-4) var(--corn-space-3);--sheet-pb:var(--corn-space-3);flex-wrap:wrap;position:relative;bottom:auto;left:auto;right:auto;overflow:hidden}}.hx-player-verdict{padding:calc(var(--corn-space-1) / 2) var(--corn-space-3);border-radius:var(--corn-radius-pill);font-size:var(--corn-text-xs);white-space:nowrap;border:var(--corn-border) solid var(--corn-line);color:var(--corn-text-2);background:color-mix(in srgb, var(--corn-text-3) 12%, transparent);flex:none;font-weight:600}.hx-player-check{padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);font-size:var(--corn-text-md);color:var(--corn-text-2);background:color-mix(in srgb, var(--corn-text-3) 10%, transparent);border-left:var(--corn-border-strong) solid color-mix(in srgb, var(--corn-text-3) 50%, transparent);user-select:text;margin:0;line-height:1.4}.hx-player-check-detail{font-size:var(--corn-text-xs);color:var(--corn-text-3);display:block}.hx-player-verdict[data-tone=allowed],.hx-player-check[data-tone=allowed]{color:var(--corn-ok);background:var(--corn-ok-soft);border-color:color-mix(in srgb, var(--corn-ok) 60%, transparent)}.hx-player-verdict[data-tone=refused],.hx-player-check[data-tone=refused]{color:var(--corn-bad);background:color-mix(in srgb, var(--corn-removed) 16%, transparent);border-color:color-mix(in srgb, var(--corn-removed) 70%, transparent)}.hx-player-verdict[data-tone=mismatch],.hx-player-check[data-tone=mismatch]{color:var(--corn-warn);background:color-mix(in srgb, var(--corn-changed) 16%, transparent);border-color:color-mix(in srgb, var(--corn-changed) 70%, transparent)}.hx-player-verdict[data-tone=pending]{opacity:.75}.hx-player-as{align-items:center;gap:var(--corn-space-3);font-size:var(--corn-text-sm);color:var(--corn-text-2);flex-wrap:wrap;display:flex}.hx-player-as-label{align-items:center;gap:var(--corn-space-2);display:inline-flex}.hx-player-as .hx-btn{padding:var(--corn-space-1) var(--corn-space-3);font-size:var(--corn-text-sm)}.hx-player-as .hx-btn:disabled{opacity:.4;cursor:default}.hx-player-as-sum{font-size:var(--corn-text-xs);margin-left:auto}.hx-player-as[hidden],.hx-player-verdict[hidden],.hx-player-check[hidden]{display:none}.hx-rc-scroll{scroll-padding-block:calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1))}.hx-player-count{font-family:var(--corn-font-num);font-variant-numeric:tabular-nums}@container corn-box (width<=767px){.hx-player-controls .hx-btn{min-width:44px;min-height:44px;padding:0 var(--corn-space-3);white-space:nowrap}.hx-player-prev .hx-player-label,.hx-player-next .hx-player-label,.hx-player-toggle .hx-player-label{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.hx-player-prev:before,.hx-player-next:after,.hx-player-toggle:before{margin:0}.hx-player-next-scenario{font-size:var(--corn-text-sm)}.hx-player-controls{gap:var(--corn-space-2)}}.hx-change-row{min-height:28px}@container corn-box (width<=767px){.hx-change-row,.hx-sc-row,.hx-step,.hx-rc-tab,.hx-player-speed,.hx-player .hx-close{min-height:44px}.hx-player-speed,.hx-player .hx-close{min-width:44px}}@media (pointer:coarse){.hx-change-row,.hx-sc-row,.hx-step,.hx-rc-tab,.hx-player-speed,.hx-player .hx-close{min-height:44px}.hx-player-speed,.hx-player .hx-close{min-width:44px}}.hx-review-column{bottom:12px;left:12px;top:var(--hx-column-top,150px);z-index:14;border-radius:var(--corn-radius-lg);width:400px;font-size:var(--corn-text-sm);user-select:text;flex-direction:column;display:flex;position:absolute;overflow:hidden}.hx-review-column[hidden]{display:none}@container corn-box (width<=1023px){.hx-review-column{width:320px}}@container corn-box (width>=1280px){.hx-stage:has(.forge-open) .hx-review-column{left:calc(var(--hx-forge-w) + 12px)}}@container corn-box (width>=768px) and (width<=1023px){.hx-stage:has(.drawer-open) .hx-review-column{width:min(320px,100% - 504px)}}.hx-rc-scroll{gap:var(--corn-space-2);min-height:0;padding:var(--corn-space-3) var(--corn-space-4);flex-direction:column;flex:1;display:flex;overflow:hidden}.hx-rc-lists{gap:var(--corn-space-4);flex-direction:column;flex:1;min-height:0;display:flex}.hx-rc-section{flex-direction:column;min-height:0;display:flex}#rc-changes{max-height:var(--hx-changes-max,40%);flex:0 auto}#rc-scenarios{min-height:min(12em, var(--hx-scenarios-need,12em));flex:1 1 0}.hx-change-list,.hx-rc-sbody{min-height:0;scroll-padding-block:var(--corn-space-2);overflow-y:auto}.hx-rc-h{flex:none}.hx-rc-tabs{gap:var(--corn-space-2);display:flex}.hx-rc-tabs[hidden]{display:none}.hx-rc-tab{min-height:var(--hx-control-h);padding:0 var(--corn-space-3);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-sm);color:var(--corn-text-3);font:inherit;cursor:pointer;background:0 0;flex:1;font-weight:600}.hx-rc-tab[aria-selected=true]{background:var(--corn-accent);border-color:var(--corn-accent);color:var(--corn-text-on-accent)}.hx-rc-tab:focus-visible,.hx-sc-row:focus-visible,.hx-step:focus-visible,.hx-rc-h:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}.hx-rc-section[hidden]{display:none}.hx-rc-h{margin:0 0 var(--corn-space-2);font-size:var(--corn-text-sm);color:var(--corn-text);font-weight:700}.hx-rc-h [data-corn=count]{color:var(--corn-text-3);font-variant-numeric:tabular-nums}.hx-rc-empty,.hx-rc-note,.hx-rc-coverage{margin:var(--corn-space-2) 0 0;line-height:1.5}.hx-rc-coverage{color:var(--corn-text-2)}.hx-change-list,.hx-sc-list,.hx-steps{margin:0;padding:0;list-style:none}.hx-change-list{gap:calc(var(--corn-space-1) / 2);flex-direction:column;display:flex}.hx-persona{margin-top:var(--corn-space-4)}.hx-persona:first-of-type{margin-top:0}.hx-persona-name{margin:0 0 var(--corn-space-1);font-size:var(--corn-text-xs);letter-spacing:.02em;color:var(--corn-text-3);overflow-wrap:anywhere;font-weight:600}.hx-sc-list{gap:var(--corn-space-1);flex-direction:column;display:flex}.hx-sc-row{align-items:flex-start;gap:var(--corn-space-3);width:100%;padding:var(--corn-space-2) var(--corn-space-2);border:var(--corn-border) solid var(--corn-line-soft);border-radius:var(--corn-radius-sm);color:var(--corn-text);font:inherit;text-align:left;cursor:pointer;background:0 0;display:flex}.hx-sc-row:hover{background:color-mix(in srgb, var(--corn-accent-hover) 18%, transparent)}.hx-sc-caret{width:1em;color:var(--corn-text-3);flex:none}.hx-sc-main{gap:calc(var(--corn-space-1) / 2);flex-direction:column;flex:1;min-width:0;display:flex}.hx-sc-title{overflow-wrap:anywhere;font-weight:600}.hx-sc-meta{font-size:var(--corn-text-xs);color:var(--corn-text-3)}.hx-sc-seen{font-size:var(--corn-text-xs);color:var(--corn-added-text);white-space:nowrap;flex:none}.hx-steps{margin:var(--corn-space-1) 0 var(--corn-space-2) var(--corn-space-4);gap:calc(var(--corn-space-1) / 2);flex-direction:column;display:flex}.hx-steps[hidden]{display:none}.hx-step{align-items:flex-start;gap:var(--corn-space-3);width:100%;padding:var(--corn-space-2) var(--corn-space-2);border:0;border-left:var(--corn-border-strong) solid transparent;border-radius:var(--corn-radius-sm);color:var(--corn-text);font:inherit;font-size:var(--corn-text-xs);text-align:left;cursor:pointer;background:0 0;display:flex}.hx-step:hover{background:var(--corn-line-soft)}.hx-step[aria-current=step]{border-left-color:var(--corn-accent-text);background:color-mix(in srgb, var(--corn-accent-hover) 22%, transparent)}.hx-step-n{min-width:1.4em;color:var(--corn-accent-text);font-variant-numeric:tabular-nums;flex:none;font-weight:600}.hx-step-body{gap:calc(var(--corn-space-1) / 2);flex-direction:column;flex:1;min-width:0;display:flex}.hx-step-line{align-items:baseline;gap:0 var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-step-who{color:var(--corn-text-2);font-weight:600}.hx-step-where{overflow-wrap:anywhere;font-weight:600}.hx-step-mark{align-items:center;gap:var(--corn-space-1);color:var(--corn-text-3);display:inline-flex}.hx-step-mark .hx-mark-dot{margin:0}.hx-step-text{color:var(--corn-text-2);overflow-wrap:anywhere;line-height:1.4}.hx-step-off{color:var(--corn-text-3);font-style:italic}.hx-step-verdict{white-space:normal;text-align:right;overflow-wrap:anywhere;align-self:flex-start;max-width:40%}@container corn-box (width<=767px){.hx-review-column{width:auto;max-height:none;box-shadow:none;-webkit-backdrop-filter:none;background:0 0;border:0;border-radius:0;position:static;overflow:visible}.hx-rc-scroll,.hx-rc-lists,.hx-rc-section,.hx-change-list,.hx-rc-sbody{min-height:0;max-height:none;display:block;overflow:visible}.hx-rc-scroll{padding:var(--corn-space-2) 0}.hx-rc-section[hidden]{display:none}#rc-changes,#rc-scenarios{flex:none;min-height:0;max-height:none}.hx-rc-lists{flex-direction:column;display:flex}.hx-change-list{display:flex}.hx-step,.hx-sc-row,.hx-rc-tab{min-height:44px}.hx-step-verdict{max-width:45%}}@container corn-box (width>=768px){.hx-stage:has(.drawer-open) .hx-player{right:504px}}.hx-player-as,.hx-player-check{flex:1 0 100%}.hx-player-speed[data-corn=control]{color:var(--corn-text)}.hx-rc-sub{margin:var(--corn-space-2) 0 var(--corn-space-1);font-size:var(--corn-text-sm);color:var(--corn-text);font-weight:600}", br = () => ".hx-review{gap:var(--corn-space-2);flex-direction:column;flex:1 0 100%;order:1;display:flex}.hx-review[hidden],.hx-review:not(:has(>:not([hidden]))){display:none}.hx-review-form{gap:var(--corn-space-2);flex-direction:column;display:flex}.hx-review-form[hidden]{display:none}.hx-review-label{color:var(--corn-text-3);font-size:var(--corn-text-xs)}.hx-review-note{resize:vertical;width:100%;min-height:44px;padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);background:color-mix(in srgb, var(--corn-ground) 80%, transparent);color:var(--corn-text);font:inherit;font-size:var(--corn-text-sm);user-select:text;line-height:1.4}.hx-review-note:focus{outline:var(--corn-focus-width) solid var(--corn-added-text);outline-offset:calc(var(--corn-focus-offset) / 2)}.hx-review-row{align-items:center;gap:var(--corn-space-2) var(--corn-space-3);flex-wrap:wrap;display:flex}.hx-btn--approve{border-color:color-mix(in srgb, var(--corn-added) 50%, transparent);color:var(--corn-added-text)}.hx-btn--approve:hover{background:color-mix(in srgb, var(--corn-added) 20%, transparent);color:var(--corn-added-text)}.hx-review-status{color:var(--corn-added-text);font-variant-numeric:tabular-nums;margin:0}.hx-review-status[hidden],.hx-review-msg[hidden],.hx-review-line[hidden]{display:none}.hx-review-msg{padding:var(--corn-space-1) var(--corn-space-3);border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-removed) 12%, transparent);border:var(--corn-border) solid color-mix(in srgb, var(--corn-removed) 35%, transparent);color:var(--corn-bad);margin:0;line-height:1.4}.hx-review-line{color:var(--corn-text-2);margin:0;line-height:1.4}.hx-proposal-actions{align-items:center;gap:var(--corn-space-3);margin-left:auto;display:flex}.hx-proposal-actions .hx-btn{height:var(--hx-control-h);padding:0 var(--corn-space-5);font-size:var(--corn-text-sm);justify-content:center;font-weight:500}.hx-proposal-actions .hx-btn--approve,.hx-proposal-actions .hx-btn--approve:hover{background:var(--corn-accent);border-color:var(--corn-accent);color:var(--corn-text-on-accent);font-weight:600}.hx-proposal-actions .hx-btn:disabled{opacity:.4;cursor:default}@container corn-box (width<=767px){.hx-review{order:3;grid-column:1/-1}.hx-proposal-actions{gap:var(--corn-space-3);order:4;grid-column:1/-1;grid-template-columns:1fr 1fr;margin-left:0;display:grid}.hx-proposal-actions .hx-btn{height:auto;min-height:44px;padding:var(--corn-space-2) var(--corn-space-3);white-space:normal;text-align:center;font-size:var(--corn-text-md)}.hx-review .hx-btn{min-height:44px}}.hx-forge-cta .hx-btn--approve{flex:1}@container corn-box (width<=767px){.hx-proposal-bar:has(.hx-review-form:not([hidden])) .hx-proposal-actions{order:4;grid-template-columns:1fr}.hx-proposal-bar:has(.hx-review-form:not([hidden])) .hx-proposal-actions .hx-btn--approve{display:none}}.hx-rc-foot{gap:var(--corn-space-2);padding:var(--corn-space-3) var(--corn-space-4);border-top:var(--corn-border) solid var(--corn-line);flex-direction:column;flex:none;display:flex}.hx-rc-foot .hx-review{flex:none;order:0}.hx-rc-foot .hx-proposal-actions{margin-left:auto}@container corn-box (width<=767px){.hx-rc-foot{padding:var(--corn-space-3) 0 0}.hx-rc-foot .hx-proposal-actions{width:100%;margin-left:0}}.hx-decision-line{color:var(--corn-text-2);font-size:var(--corn-text-sm);margin:0;line-height:1.5}.hx-decision-line[hidden],.hx-review-ask[hidden],.hx-hold[hidden],.hx-review-landing[hidden],.hx-sent-edits[hidden]{display:none}.hx-review-ask{padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid color-mix(in srgb, var(--corn-warn) 55%, transparent);background:color-mix(in srgb, var(--corn-warn) 14%, transparent);color:var(--corn-text);margin:0;line-height:1.4}.hx-review-landing{justify-content:space-between;align-items:center;gap:var(--corn-space-3);padding:var(--corn-space-2) var(--corn-space-3);border-radius:var(--corn-radius-sm);border:var(--corn-border) solid var(--corn-line);color:var(--corn-text-2);display:flex}.hx-review-landing p{margin:0;line-height:1.4}.hx-sent-edits{color:var(--corn-text-2)}.hx-sent-edits summary{cursor:pointer;min-height:24px}.hx-hold{border-radius:var(--corn-radius-sm);background:color-mix(in srgb, var(--corn-accent) 22%, transparent);height:3px;overflow:hidden}.hx-hold-fill{background:var(--corn-accent);transform-origin:0;width:100%;height:100%;animation-name:hx-hold-drain;animation-timing-function:linear;animation-fill-mode:forwards;display:block}@keyframes hx-hold-drain{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.hx-proposal-actions .hx-btn[aria-disabled=true]{opacity:.55;cursor:default}.hx-proposal-actions .hx-btn[data-holding=true]{opacity:1;font-variant-numeric:tabular-nums}.hx-review-undo[hidden]{display:none}@container corn-box (width<=767px){.hx-review-undo{order:1;grid-column:1/-1;min-width:44px;min-height:44px}.hx-review-landing .hx-btn{min-height:44px}.hx-proposal-bar:has(.hx-review-form:not([hidden])) .hx-decision-line{display:none}}@media (prefers-reduced-motion:reduce){.hx-hold{display:none}.hx-hold-fill{animation:none}}", xr = () => ".hx-dock{display:contents}.hx-sheet-handle{display:none}@keyframes hx-sheet-in{0%{opacity:0;transform:translateY(28px)}}@container corn-box (width<=767px){.hx-dock{z-index:45;pointer-events:none;flex-direction:column;justify-content:flex-end;display:flex;position:absolute;bottom:0;left:0;right:0}.hx-dock>*{pointer-events:auto}.hx-dock>.hx-sheet{border-radius:var(--corn-radius-lg) var(--corn-radius-lg) 0 0;width:100%;max-width:none;box-shadow:var(--corn-shadow-sheet);overscroll-behavior:contain;--sheet-pb:var(--corn-space-3);border-bottom:0;margin:0;animation:.2s ease-out hx-sheet-in;position:relative;inset:auto;transform:none}.hx-dock>.hx-sheet[data-sheet-last]:not(.hx-drawer){padding-bottom:calc(var(--sheet-pb) + env(safe-area-inset-bottom,0px))}.hx-sheet-handle{cursor:grab;touch-action:none;background:0 0;border:0;flex:none;justify-content:center;align-items:center;width:100%;height:22px;padding:0;display:flex}.hx-sheet-handle span{border-radius:var(--corn-radius-pill);background:var(--corn-surface-3);width:40px;height:5px}.hx-sheet-handle:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1);border-radius:var(--corn-radius)}.hx-player>.hx-sheet-handle{flex:0 0 100%}}@media (prefers-reduced-motion:reduce){.hx-dock>.hx-sheet{animation:none}.hx-sheet,.hx-dock>.hx-sheet{transition:none;animation:none}}@container corn-box (width<=767px){.hx-sheet-handle{height:44px}}@media (pointer:coarse){.hx-sheet-handle{height:44px}}.hx-sheet-stub{display:none}@container corn-box (width<=767px){.hx-dock>.hx-sheet[data-sheet-away]{display:none}.hx-dock>.hx-sheet[data-sheet-state=stub]{min-height:44px;max-height:44px;padding-top:0;padding-bottom:0;overflow:hidden}.hx-dock>.hx-sheet[data-sheet-state=stub]>:not(.hx-sheet-stub){display:none!important}.hx-sheet-stub{align-items:center;gap:var(--corn-space-3);width:100%;min-height:44px;padding:0 var(--corn-space-1);color:var(--corn-text);font:inherit;text-align:left;background:0 0;border:0;font-weight:600;display:flex}.hx-sheet-stub[hidden]{display:none}.hx-sheet-stub:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1);border-radius:var(--corn-radius)}.hx-sheet-stub-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.hx-proposal-bar[data-sheet-state=peek] .hx-review>:not([data-review-hint]):not([data-review-msg]):not([data-review-line]):not([data-review-ask]):not([data-review-hold]):not([data-review-hold-live]):not([data-review-landing]),.hx-dock:has(>.hx-player) .hx-proposal-bar[data-sheet-state=peek] .hx-rc-foot{display:none}.hx-proposal-bar[data-sheet-state=expanded] .hx-whatif-panel{max-height:none;overflow:visible}.hx-proposal-bar[data-sheet-state=peek]>:not(.hx-sheet-handle):not(#proposal-message):not(#proposal-ways):not(#proposal-body),.hx-proposal-bar[data-sheet-state=peek] #proposal-body>:not(.hx-proposal-head),.hx-proposal-bar[data-sheet-state=peek] .hx-proposal-head>:is(.hx-proposal-tools,.hx-proposal-more,.hx-proposal-more-menu){display:none}@container corn-page (height<=480px){.hx-proposal-bar[data-sheet-state=expanded]{max-height:calc(100cqh - var(--corn-space-3))}}.hx-proposal-bar[data-sheet-state=peek] .hx-proposal-chip{display:none}.hx-proposal-bar[data-sheet-state=expanded]{max-height:62cqh}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-chip,.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-summary{display:none}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-counts{order:3;grid-column:1}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-tools{order:4;grid-column:2}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-head{grid-template-columns:minmax(0,1fr) auto auto}.hx-proposal-bar[data-sheet-state=expanded] .hx-proposal-more .hx-btn--icon{order:4;grid-column:3}.hx-proposal-bar[data-sheet-state=peek] .hx-proposal-peek{color:var(--corn-text-2);display:block}@container corn-page (height>=481px){.hx-dock>.hx-proposal-bar[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,50cqh), 50cqh)}}.hx-player[data-sheet-state=expanded]{overflow-y:auto}.hx-player[data-sheet-state=peek]>:not(.hx-sheet-handle):not(.hx-player-controls):not(.hx-player-text):not(.hx-player-side):not(.hx-player-track):not(.hx-player-says){display:none}.hx-player[data-sheet-state=peek] .hx-player-text{align-items:center;gap:var(--corn-space-2);min-height:44px;font-size:var(--corn-text-md);white-space:nowrap;flex:1 1 0;display:flex;overflow:hidden}.hx-player[data-sheet-state=peek] .hx-player-step,.hx-player[data-sheet-state=peek] .hx-player-who,.hx-player[data-sheet-state=peek] .hx-player-sep,.hx-player[data-sheet-state=peek] .hx-player-side .hx-player-speed{display:none}.hx-player[data-sheet-state=expanded] .hx-player-text{flex:1 0 100%;order:3}.hx-player[data-sheet-state=expanded] .hx-player-title{clip:auto;clip-path:none;width:auto;height:auto;font-size:var(--corn-text-sm);color:var(--corn-text-2);flex:0 0 100%;order:0;font-weight:600;position:static;overflow:visible}@container corn-page (height<=480px){.hx-player[data-sheet-state=expanded]{max-height:calc(100cqh - var(--corn-space-3))}}.hx-proposal-bar[data-sheet-state=peek] #proposal-body>.hx-review-column{display:flex}.hx-proposal-bar[data-sheet-state=peek] .hx-review-column>:not(.hx-rc-foot){display:none}@container corn-page (height>=481px){.hx-dock>.hx-player[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,50cqh), 50cqh)}}.hx-dock>.hx-drawer[data-sheet-last][data-sheet-state=peek]{padding-bottom:calc(var(--sheet-pb) + env(safe-area-inset-bottom,0px))}.hx-stage[data-sheet-open=drawer] .hx-backdrop:not([hidden]){-webkit-backdrop-filter:none;background:0 0;display:block}.hx-drawer[data-sheet-state=peek] .hx-drawer-body{padding:0 var(--corn-space-5) var(--corn-space-3);flex:none;gap:0;overflow:hidden}.hx-drawer[data-sheet-state=peek] .hx-drawer-body>:not(.hx-drawer-head),.hx-drawer[data-sheet-state=peek] .hx-drawer-foot{display:none}.hx-drawer[data-sheet-state=peek] .hx-drawer-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@container corn-page (height<=480px){.hx-drawer[data-sheet-state=peek] .hx-drawer-title{text-overflow:clip;white-space:normal;overflow:visible}}@container corn-page (height>=481px){.hx-dock>.hx-drawer[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,60cqh), 60cqh)}}.hx-forge[data-sheet-state=peek] .hx-forge-body{padding:0 var(--corn-space-5) var(--corn-space-3);gap:var(--corn-space-1);flex:none;overflow:hidden}.hx-forge[data-sheet-state=peek] .hx-forge-body>:not(.hx-forge-top):not(#forge-bar),.hx-forge[data-sheet-state=peek] #forge-filter-chip,.hx-forge[data-sheet-state=peek] .hx-forge-tabs{display:none}.hx-forge[data-sheet-state=peek] .hx-forge-head{border-bottom:0;padding-bottom:0}.hx-forge[data-sheet-state=peek] .hx-forge-head .hx-btn{display:none}@container corn-page (height>=481px){.hx-dock>.hx-forge[data-sheet-state=expanded]{max-height:min(var(--hx-sheet-cap,60cqh), 60cqh)}}}", Sr = () => "[data-corn=review]{all:initial;box-sizing:border-box;contain:layout;background-color:var(--corn-ground);background-image:var(--corn-ground-image);width:100%;height:100%;min-height:24rem;color:var(--corn-text);font-family:var(--corn-font);-webkit-font-smoothing:antialiased;user-select:none;flex-direction:column;display:flex;position:relative;overflow:hidden;container:corn-box corn-page/size}.hx-stage{flex:1;width:100%;min-height:0;position:relative;overflow:hidden}@container corn-box (width>=768px){.hx-stage:has(.hx-review-column:not([hidden])){--hx-col-w:400px}}@container corn-box (width>=768px) and (width<=1023px){.hx-stage:has(.hx-review-column:not([hidden])){--hx-col-w:320px}}.hx-review-empty{z-index:1;padding:var(--corn-space-5);text-align:center;color:var(--corn-text-2);font-size:var(--corn-text-md);pointer-events:none;justify-content:center;align-items:center;margin:0;display:flex;position:absolute;inset:0}.hx-proposal-bar{top:12px}[data-corn=review] canvas{border:0}[data-corn=review] :is(p,h1,h2,h3,h4){text-indent:0;font-variant:normal}[data-corn=review] [data-corn=source-status],[data-corn=review] [data-corn=source-notice]{z-index:50}", Cr = () => "[data-corn=source-status]{z-index:2;box-sizing:border-box;align-items:center;gap:var(--corn-space-3);width:min(26rem, calc(100% - var(--corn-space-6) * 2));padding:var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-lg);background:var(--corn-surface-1);color:var(--corn-text-2);box-shadow:var(--corn-shadow);text-align:center;font-family:var(--corn-font);font-size:var(--corn-text-md);flex-direction:column;line-height:1.5;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}[data-corn=source-status][hidden]{display:none}[data-corn=source-status]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-status][data-corn-state=running]{box-shadow:none;color:var(--corn-text-3);background:0 0;border-color:#0000;padding:0}[data-corn=source-status][data-corn-state=running] [data-corn=source-title]{font-size:var(--corn-text-md);color:var(--corn-text-3);font-weight:400}[data-corn=source-status][data-corn-state=failure] [data-corn=source-title]{color:var(--corn-bad)}[data-corn=source-status][data-corn-state=waiting] [data-corn=source-title]{color:var(--corn-accent-text)}[data-corn=source-title],[data-corn=source-text]{margin:0}[data-corn=source-title]{font-size:var(--corn-text-lg);color:var(--corn-text);font-weight:600}[data-corn=source-text]{overflow-wrap:anywhere;user-select:text}[data-corn=source-origin]{font-family:var(--corn-mono);color:var(--corn-warn);overflow-wrap:anywhere;user-select:all}[data-corn=source-sign-in],[data-corn=source-retry]{box-sizing:border-box;min-height:max(var(--corn-control-height), 2.75rem);padding:0 var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius);background:var(--corn-surface-2);color:var(--corn-text);font-family:inherit;font-size:inherit;cursor:pointer;justify-content:center;align-items:center;text-decoration:none;display:inline-flex}[data-corn=source-sign-in]{border-color:var(--corn-accent);background:var(--corn-accent);color:var(--corn-text-on-accent);font-weight:600}[data-corn=source-sign-in]:hover{background:var(--corn-accent-hover)}[data-corn=source-retry]:hover{background:var(--corn-surface-3)}[data-corn=source-sign-in]:focus-visible,[data-corn=source-retry]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-notice]{z-index:2;box-sizing:border-box;padding:var(--corn-space-3) var(--corn-space-6);background:var(--corn-surface-1);border-top:var(--corn-border) solid var(--corn-line-soft);color:var(--corn-text-2);font-family:var(--corn-font);font-size:var(--corn-text-sm);text-align:center;overflow-wrap:anywhere;margin:0;position:absolute;bottom:0;left:0;right:0}[data-corn=source-notice][hidden]{display:none}", wr = class extends n {
2759
- constructor(t) {
2760
- super(), t !== !1 && this.__registerHost(), this.__attachShadow(), this.cornReady = e(this, "cornReady", 7), this.cornSelect = e(this, "cornSelect", 7), this.cornNavigate = e(this, "cornNavigate", 7), this.cornDecision = e(this, "cornDecision", 7), this.cornAuth = e(this, "cornAuth", 7), this.cornError = e(this, "cornError", 7);
2761
- }
2762
- get el() {
2763
- return this;
2764
- }
2765
- src;
2766
- proposal;
2767
- source;
2768
- view;
2769
- node;
2770
- theme;
2771
- useTheme = !1;
2772
- topology;
2773
- config;
2774
- strings;
2775
- checker;
2776
- cornReady;
2777
- cornSelect;
2778
- cornNavigate;
2779
- cornDecision;
2780
- cornAuth;
2781
- cornError;
2782
- piece = null;
2783
- loaded = !1;
2784
- changes = {};
2785
- connectedCallback() {
2786
- this.loaded && this.mountPiece();
2787
- }
2788
- componentDidLoad() {
2789
- this.loaded = !0, this.mountPiece();
2790
- }
2791
- disconnectedCallback() {
2792
- this.unmountPiece();
2793
- }
2794
- unmountPiece() {
2795
- this.piece && this.piece.destroy(), this.piece = null;
2796
- }
2797
- remount() {
2798
- this.unmountPiece(), this.loaded && this.el.isConnected && this.mountPiece();
2799
- }
2800
- mountPiece() {
2801
- !this.piece && this.el.shadowRoot && (this.changes = {}, this.piece = pr(this.el.shadowRoot, null, {
2802
- src: this.src,
2803
- useTheme: this.useTheme,
2804
- version: "0.52.0",
2805
- pageUrl: () => typeof location > "u" ? "" : location.href,
2806
- tokens: N,
2807
- topology: this.topology,
2808
- config: this.config,
2809
- strings: this.strings,
2810
- checker: this.checker,
2811
- proposal: this.proposal,
2812
- source: this.source,
2813
- view: this.view,
2814
- node: this.node,
2815
- theme: this.theme,
2816
- onSelect: (e) => {
2817
- this.node = e.kind === "node" ? e.id : null, delete this.changes.node, this.cornSelect.emit(e);
2818
- },
2819
- onNavigate: (e) => {
2820
- e.view && (this.view = e.view, delete this.changes.view), e.change === "closed" && (this.proposal = null, delete this.changes.proposal), e.change === "opened" && e.proposal && (this.proposal = e.proposal, delete this.changes.proposal), this.cornNavigate.emit(e);
2821
- },
2822
- onDecision: (e) => this.cornDecision.emit(e),
2823
- onAuth: (e) => this.cornAuth.emit(e),
2824
- onError: (e) => this.cornError.emit(e),
2825
- onReady: () => this.cornReady.emit()
2826
- }));
2827
- }
2828
- componentDidRender() {
2829
- let e = this.changes;
2830
- this.changes = {}, this.piece && Object.keys(e).length && this.piece.update(e);
2831
- }
2832
- changed(e, t, n) {
2833
- this.changes[n] = e;
2834
- }
2835
- addressChanged() {
2836
- this.piece && this.remount();
2837
- }
2838
- async fit() {
2839
- this.piece && this.piece.fit();
2840
- }
2841
- async focusNode(e) {
2842
- this.piece && this.piece.focusNode(e);
2843
- }
2844
- async refresh() {
2845
- this.piece && this.piece.refresh();
2846
- }
2847
- static get watchers() {
2848
- return {
2849
- proposal: [{ changed: 0 }],
2850
- source: [{ changed: 0 }],
2851
- view: [{ changed: 0 }],
2852
- node: [{ changed: 0 }],
2853
- theme: [{ changed: 0 }],
2854
- useTheme: [{ changed: 0 }],
2855
- topology: [{ changed: 0 }],
2856
- config: [{ changed: 0 }],
2857
- strings: [{ changed: 0 }],
2858
- checker: [{ changed: 0 }],
2859
- src: [{ addressChanged: 0 }]
2860
- };
2861
- }
2862
- static get style() {
2863
- return mr() + hr() + gr() + _r() + vr() + yr() + br() + xr() + Sr() + Cr();
2864
- }
2865
- };
2866
- t(wr, [
2867
- 513,
2868
- "corn-review",
2869
- {
2870
- src: [1],
2871
- proposal: [1025],
2872
- source: [1],
2873
- view: [1537],
2874
- node: [1537],
2875
- theme: [513],
2876
- useTheme: [4, "use-theme"],
2877
- topology: [16],
2878
- config: [16],
2879
- strings: [16],
2880
- checker: [16],
2881
- fit: [64],
2882
- focusNode: [64],
2883
- refresh: [64]
2884
- },
2885
- void 0,
2886
- {
2887
- proposal: [{ changed: 0 }],
2888
- source: [{ changed: 0 }],
2889
- view: [{ changed: 0 }],
2890
- node: [{ changed: 0 }],
2891
- theme: [{ changed: 0 }],
2892
- useTheme: [{ changed: 0 }],
2893
- topology: [{ changed: 0 }],
2894
- config: [{ changed: 0 }],
2895
- strings: [{ changed: 0 }],
2896
- checker: [{ changed: 0 }],
2897
- src: [{ addressChanged: 0 }]
2898
- }
2899
- ]);
2900
- export { wr as t };