@popcorn245/cornfield-components 0.52.0 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{around-D7aqHejs.js → around-BFqYTZ0K.js} +10 -10
- package/dist/chunks/{corn-layers-g9AprK6G.js → corn-layers-Cni5rISZ.js} +95 -95
- package/dist/chunks/{corn-map-DE-pg-A0.js → corn-map-B2-YxiEL.js} +3 -3
- package/dist/chunks/{corn-node-panel-CdtFb9IZ.js → corn-node-panel-BkvJThlp.js} +3 -3
- package/dist/chunks/{corn-review-9krtLSPK.js → corn-review-5wf7AT4o.js} +889 -889
- package/dist/chunks/{corn-search-BY1Po63S.js → corn-search-CXs5d06S.js} +39 -39
- package/dist/chunks/{engine-HIgX35hE.js → engine-BmXtSISH.js} +415 -400
- package/dist/chunks/{layers-n1mJVJs8.js → layers-Bj4Tluxe.js} +50 -50
- package/dist/chunks/{map-CeP9M2_w.js → map-BZRFOYkt.js} +749 -718
- package/dist/chunks/{node-panel-CY5xnuKC.js → node-panel-BdvFvWCE.js} +332 -332
- package/dist/chunks/{review-source-DWisOXyR.js → review-source-CK5tYIqk.js} +1 -1
- package/dist/chunks/{scope-CUhp8mkf.js → scope-CqPbHcKL.js} +19 -19
- package/dist/chunks/sheets-D-sMZzSs.js +204 -0
- package/dist/chunks/{status-CsFpnQxw.js → status-DI5QLlAp.js} +55 -55
- package/dist/corn-layers.js +1 -1
- package/dist/corn-map.js +1 -1
- package/dist/corn-node-panel.js +1 -1
- package/dist/corn-review.js +1 -1
- package/dist/corn-scope.js +3 -3
- package/dist/corn-search.js +1 -1
- package/dist/index.js +6 -6
- package/dist/manifest.json +43 -43
- package/dist/version.json +1 -1
- package/package.json +1 -1
- package/dist/chunks/sheets-TFCL_dIn.js +0 -204
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./runtime-DFu6W5g-.js";
|
|
2
|
-
import {
|
|
3
|
-
import { i as
|
|
4
|
-
import { A as
|
|
5
|
-
import { c as
|
|
6
|
-
import { c as
|
|
7
|
-
import { a as
|
|
2
|
+
import { An as r, B as i, Dn as a, En as o, Ft as s, I as c, Kt as l, L as u, Mn as d, On as f, R as p, Rt as m, T as h, Tn as g, V as _, _t as v, bn as y, c as b, ct as x, dn as S, dt as C, fn as w, hn as T, j as E, jn as D, kn as O, kt as k, l as A, nn as j, ot as M, qt as N, rn as ee, st as P, t as F, vn as I, vt as L, z as R } from "./engine-BmXtSISH.js";
|
|
3
|
+
import { i as z, n as B, r as V, t as H } from "./map-BZRFOYkt.js";
|
|
4
|
+
import { A as U, C as W, D as G, E as K, O as q, S as te, T as J, _ as ne, a as re, b as ie, c as Y, d as ae, f as oe, g as se, h as ce, i as le, k as ue, l as X, m as Z, o as de, p as fe, r as pe, s as me, t as he, u as ge, v as _e, w as ve, x as ye, y as be } from "./node-panel-BdvFvWCE.js";
|
|
5
|
+
import { c as xe, d as Se, i as Ce, l as we, n as Te, o as Ee, r as De, s as Oe, t as ke } from "./sheets-D-sMZzSs.js";
|
|
6
|
+
import { c as Ae, d as je, f as Me, i as Ne, l as Pe, m as Fe, n as Ie, p as Le, r as Re, t as ze } from "./layers-Bj4Tluxe.js";
|
|
7
|
+
import { a as Be, i as Ve, n as He, r as Ue } from "./source-address-C70zNPIj.js";
|
|
8
8
|
// ../explorer/engine/proposal.js
|
|
9
|
-
var
|
|
9
|
+
var Q = (e) => e.slot("proposal", () => ({
|
|
10
10
|
pinnedSource: !1,
|
|
11
11
|
listing: null,
|
|
12
12
|
listingProblem: null,
|
|
@@ -15,12 +15,12 @@ var $ = (e) => e.slot("proposal", () => ({
|
|
|
15
15
|
watchers: /* @__PURE__ */ new Set(),
|
|
16
16
|
openToken: 0,
|
|
17
17
|
message: null
|
|
18
|
-
})),
|
|
18
|
+
})), We = (e) => e.proposal && typeof e.proposal.title == "string" && e.proposal.title || e.proposalSlug || "Proposal", Ge = (e) => e.ask("proposal:specs-list") === !1 ? null : {
|
|
19
19
|
label: D(e, "openSpecsList"),
|
|
20
20
|
way: "specs"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
22
|
+
function Ke(e) {
|
|
23
|
+
let t = Q(e);
|
|
24
24
|
return {
|
|
25
25
|
entries: t.listing,
|
|
26
26
|
problem: t.listingProblem,
|
|
@@ -28,8 +28,8 @@ function Ge(e) {
|
|
|
28
28
|
at: t.listingAt
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
async function
|
|
32
|
-
let t =
|
|
31
|
+
async function qe(e) {
|
|
32
|
+
let t = Q(e), n = Ve(e);
|
|
33
33
|
try {
|
|
34
34
|
let r;
|
|
35
35
|
try {
|
|
@@ -55,20 +55,20 @@ async function Ke(e) {
|
|
|
55
55
|
for (let e of [...t.watchers]) e();
|
|
56
56
|
return t.listing;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let i =
|
|
58
|
+
function Je(e, t, n = !1, r = []) {
|
|
59
|
+
let i = Q(e);
|
|
60
60
|
i.message = {
|
|
61
61
|
text: t,
|
|
62
62
|
isError: n,
|
|
63
63
|
ways: r
|
|
64
64
|
}, e.emit("proposal:message", i.message);
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
async function
|
|
68
|
-
let r =
|
|
69
|
-
if (!
|
|
70
|
-
let r =
|
|
71
|
-
return
|
|
66
|
+
var Ye = (e) => Q(e).message;
|
|
67
|
+
async function Xe(e, t, n = null) {
|
|
68
|
+
let r = Q(e), i = ++r.openToken;
|
|
69
|
+
if (!ne(t)) {
|
|
70
|
+
let r = ie(t);
|
|
71
|
+
return Je(e, r, !0, []), e.emit("proposal:failed", {
|
|
72
72
|
slug: t,
|
|
73
73
|
source: n,
|
|
74
74
|
status: 0,
|
|
@@ -76,11 +76,11 @@ async function Ye(e, t, n = null) {
|
|
|
76
76
|
message: r
|
|
77
77
|
}), !1;
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
Je(e, `Opening ${t} …`);
|
|
80
80
|
try {
|
|
81
81
|
let r;
|
|
82
82
|
try {
|
|
83
|
-
r = await
|
|
83
|
+
r = await Ve(e)(`/proposals/${encodeURIComponent(t)}.json${n ? `?source=${encodeURIComponent(n)}` : ""}`, { cache: "no-store" });
|
|
84
84
|
} catch {
|
|
85
85
|
throw Error(e.offline() ? `${t} could not be opened: you are offline.` : `${t} could not be opened: cornfield could not be reached.`);
|
|
86
86
|
}
|
|
@@ -94,7 +94,7 @@ async function Ye(e, t, n = null) {
|
|
|
94
94
|
status: r.status,
|
|
95
95
|
during: "proposal"
|
|
96
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 ?
|
|
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 ? ye(t, n) : `${t} could not be opened: ${typeof i == "string" && i ? i : o}`);
|
|
98
98
|
throw s.notFound = r.status === 404, s.status = r.status, s;
|
|
99
99
|
}
|
|
100
100
|
let i = r.headers.get("X-Proposal-Source"), a;
|
|
@@ -104,19 +104,19 @@ async function Ye(e, t, n = null) {
|
|
|
104
104
|
throw Error(`${t} could not be opened: cornfield sent a file this page could not read.`);
|
|
105
105
|
}
|
|
106
106
|
let o = r.headers.get("X-Proposal-Sha256");
|
|
107
|
-
return !e.ended && (
|
|
107
|
+
return !e.ended && (Ze(e, a, {
|
|
108
108
|
slug: t,
|
|
109
109
|
source: n || (i ? decodeURIComponent(i) : null),
|
|
110
110
|
pinSource: !!n,
|
|
111
111
|
view: "diff",
|
|
112
112
|
fit: !0,
|
|
113
113
|
sha256: o
|
|
114
|
-
}),
|
|
114
|
+
}), N(e, [e.ask("changes:opened-line", We(e.state)), je(e)].filter(Boolean).join(" ")), !0);
|
|
115
115
|
} catch (a) {
|
|
116
116
|
if (e.ended) return !1;
|
|
117
117
|
console.error("Opening the proposal failed", a);
|
|
118
118
|
let o = a.message || `${t} could not be opened.`;
|
|
119
|
-
if (
|
|
119
|
+
if (Je(e, o, !0, a.notFound ? [Ge(e)].filter(Boolean) : [{
|
|
120
120
|
label: "Retry",
|
|
121
121
|
way: "retry",
|
|
122
122
|
slug: t,
|
|
@@ -125,14 +125,14 @@ async function Ye(e, t, n = null) {
|
|
|
125
125
|
label: "Close",
|
|
126
126
|
way: "close"
|
|
127
127
|
}]), a.notFound && i === r.openToken) {
|
|
128
|
-
await
|
|
128
|
+
await qe(e);
|
|
129
129
|
let a = new Set((Array.isArray(r.listing) ? r.listing : []).map((e) => e && e.source));
|
|
130
|
-
i === r.openToken && (o =
|
|
130
|
+
i === r.openToken && (o = ye(t, n, a), Je(e, o, !0, [...te(r.listing, t, n).map((e) => ({
|
|
131
131
|
label: e.label,
|
|
132
132
|
way: "open",
|
|
133
133
|
slug: e.slug,
|
|
134
134
|
source: e.source
|
|
135
|
-
})),
|
|
135
|
+
})), Ge(e)].filter(Boolean)));
|
|
136
136
|
}
|
|
137
137
|
return i === r.openToken && e.emit("proposal:failed", {
|
|
138
138
|
slug: t,
|
|
@@ -143,28 +143,28 @@ async function Ye(e, t, n = null) {
|
|
|
143
143
|
}), !1;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Ze(e, t, { slug: n = null, source: r = null, pinSource: i = !1, view: a, fit: o = !0, sha256: s = null } = {}) {
|
|
147
147
|
let { state: c } = e;
|
|
148
|
-
c.proposal = t,
|
|
148
|
+
c.proposal = t, Ie(e), c.proposalSlug = n, c.proposalSource = r, c.proposalSha256 = typeof s == "string" && /^[0-9a-f]{64}$/.test(s) ? s : null, Q(e).pinnedSource = i, a ? c.proposalView = a : Z.includes(c.proposalView) || (c.proposalView = "diff");
|
|
149
149
|
let l = e.ask("proposal:effective", t);
|
|
150
|
-
|
|
150
|
+
et(e, l === void 0 ? t : l, { fit: o }), Qe(e, "opened");
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Qe(e, t) {
|
|
153
153
|
let { state: n } = e;
|
|
154
154
|
e.emit("proposal", {
|
|
155
155
|
change: t,
|
|
156
156
|
slug: n.proposalSlug || null,
|
|
157
157
|
source: n.proposalSource || null,
|
|
158
|
-
pinSource:
|
|
158
|
+
pinSource: Q(e).pinnedSource,
|
|
159
159
|
view: n.proposalView,
|
|
160
160
|
proposal: n.proposal || null
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function $e(e) {
|
|
164
164
|
let t = !!e.state.proposal;
|
|
165
165
|
e.emit("proposal:draw", { open: t }), e.emit("proposal:bar", { open: t });
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function et(e, t, { fit: n = !1 } = {}) {
|
|
168
168
|
let { state: r } = e;
|
|
169
169
|
if (t === void 0) {
|
|
170
170
|
let n = e.ask("proposal:effective", r.proposal);
|
|
@@ -176,7 +176,7 @@ function $e(e, t, { fit: n = !1 } = {}) {
|
|
|
176
176
|
}, a;
|
|
177
177
|
r.effectiveProposal = t;
|
|
178
178
|
try {
|
|
179
|
-
r.proposalErrors =
|
|
179
|
+
r.proposalErrors = ge(i, t).errors, a = Y(i, t), e.emit("proposal:mark", {
|
|
180
180
|
applied: a,
|
|
181
181
|
effective: t,
|
|
182
182
|
proposal: r.proposal
|
|
@@ -196,64 +196,64 @@ function $e(e, t, { fit: n = !1 } = {}) {
|
|
|
196
196
|
}))
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
rt(e, a.nodes, a.edges), $e(e), Pe(e), n && it(e), e.map.render(), e.map.ensureFlowLoop();
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function tt(e) {
|
|
202
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 = [],
|
|
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 = [], Ne(e), rt(e, t.baseNodes.map((e) => ({ ...e })), t.baseEdges), e.map.fitGraphToViewport(e.map.fitPadding()), e.map.render(), e.map.ensureFlowLoop(), $e(e), Qe(e, "closed"), !0);
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function nt(e, t, { quiet: n = !1 } = {}) {
|
|
206
206
|
let { state: r } = e;
|
|
207
|
-
r.proposal &&
|
|
207
|
+
r.proposal && Z.includes(t) && r.proposalView !== t && (r.proposalView = t, e.touchScene(), r.selectedNode && !e.map.isNodeVisible(r.selectedNode) && j(e, { source: "api" }), t === "diff" && it(e), e.map.render(), $e(e), Qe(e, "view"), n || N(e, J(t)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function rt(e, t, n) {
|
|
210
210
|
let { state: r } = e, i = r.selectedNode ? r.selectedNode.id : null;
|
|
211
211
|
if (e.ask("map:set", {
|
|
212
212
|
nodes: t,
|
|
213
213
|
edges: n
|
|
214
214
|
}) || (r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n), r.selectedEdge = null, i) {
|
|
215
215
|
let t = r.nodes.find((e) => e.id === i);
|
|
216
|
-
t ? r.selectedNode = t :
|
|
216
|
+
t ? r.selectedNode = t : j(e, { source: "api" });
|
|
217
217
|
}
|
|
218
218
|
e.touchScene();
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
let { state: t, map: n } = e, { touched: r } =
|
|
220
|
+
function it(e) {
|
|
221
|
+
let { state: t, map: n } = e, { touched: r } = s(t.nodes, e.viewEdges()), i = t.nodes.filter((e) => r.has(e.id) && n.isNodeVisible(e)), a = T(e), o = {
|
|
222
222
|
padding: n.fitPadding(),
|
|
223
223
|
maxZoom: 1,
|
|
224
224
|
minZoom: n.getMinZoom()
|
|
225
|
-
},
|
|
225
|
+
}, c = me(i, a, {
|
|
226
226
|
...o,
|
|
227
|
-
minZoom: Math.max(o.minZoom,
|
|
228
|
-
}),
|
|
229
|
-
|
|
227
|
+
minZoom: Math.max(o.minZoom, re)
|
|
228
|
+
}), l = i.length ? y(c, a, o) : null;
|
|
229
|
+
l ? (Object.assign(t.camera, l), n.render()) : n.fitGraphToViewport(n.fitPadding());
|
|
230
230
|
}
|
|
231
|
-
var
|
|
232
|
-
function
|
|
233
|
-
let { state: i, map: a } = e, o = t === "edge" ? i.edges.find((e) =>
|
|
231
|
+
var at = (e, t) => (e.nodes.find((e) => e.id === t) || { label: t }).label, ot = (e) => e.kind || (e.dashed ? "usage" : "ownership");
|
|
232
|
+
function st(e, t, n, { select: r = !0 } = {}) {
|
|
233
|
+
let { state: i, map: a } = e, o = t === "edge" ? i.edges.find((e) => X(e) === n) : i.nodes.find((e) => e.id === n);
|
|
234
234
|
if (!o) return;
|
|
235
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
236
|
if (!s.length) return;
|
|
237
|
-
i.proposalView !== "diff" && s.some((e) => !a.isNodeVisible(e)) &&
|
|
238
|
-
let c =
|
|
237
|
+
i.proposalView !== "diff" && s.some((e) => !a.isNodeVisible(e)) && nt(e, "diff", { quiet: !0 }), r && (t === "edge" ? lt(e, o) : ee(e, o));
|
|
238
|
+
let c = y(s, T(e), {
|
|
239
239
|
padding: a.fitPadding(),
|
|
240
240
|
maxZoom: Math.max(1, i.camera.zoom),
|
|
241
241
|
minZoom: a.getMinZoom()
|
|
242
242
|
});
|
|
243
|
-
c && Object.assign(i.camera, c), a.render(),
|
|
243
|
+
c && Object.assign(i.camera, c), a.render(), N(e, _e(fe[o.mark] || o.mark, t === "edge" ? `${at(i, o.from)} to ${at(i, o.to)}` : o.label));
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function ct(e, t, n, r) {
|
|
246
246
|
let i = null, a = r;
|
|
247
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 =
|
|
248
|
+
let o = h(r, e), s = Math.hypot(o.x - t, o.y - n);
|
|
249
249
|
s <= a && (i = r, a = s);
|
|
250
250
|
}
|
|
251
|
-
return i && e.viewEdges().find((e) => e.from === i.from && e.to === i.to &&
|
|
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();
|
|
251
|
+
return i && e.viewEdges().find((e) => e.from === i.from && e.to === i.to && ot(e) === i.kind) || null;
|
|
255
252
|
}
|
|
256
253
|
function lt(e, t) {
|
|
254
|
+
j(e, { source: "api" }), e.state.selectedEdge = t, e.emit("node:show-edge", { edge: t }), e.touchScene(), e.map.render();
|
|
255
|
+
}
|
|
256
|
+
function ut(e, t) {
|
|
257
257
|
let n = e.state.canvas;
|
|
258
258
|
if (!n) return () => {};
|
|
259
259
|
let r = null, i = [t(n, "mousedown", (e) => {
|
|
@@ -266,32 +266,32 @@ function lt(e, t) {
|
|
|
266
266
|
if (!i.proposal || i.proposalView === "before" || r && Math.hypot(t.clientX - r.x, t.clientY - r.y) > 5) return;
|
|
267
267
|
let a = n.getBoundingClientRect(), o = e.map.screenToWorld(t.clientX - a.left, t.clientY - a.top), s = i.camera.zoom;
|
|
268
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 =
|
|
270
|
-
c &&
|
|
269
|
+
let c = ct(e, o.x, o.y, 8 / s);
|
|
270
|
+
c && lt(e, c);
|
|
271
271
|
})];
|
|
272
272
|
return () => i.forEach((e) => e());
|
|
273
273
|
}
|
|
274
|
-
var
|
|
274
|
+
var dt = (e) => Q(e).pinnedSource, ft = ({ edit: e = !0 } = {}) => ({
|
|
275
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
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
277
|
});
|
|
278
|
-
function
|
|
279
|
-
let n = e.slice(0, t).map((e) => `<li>${e.path ? `<code class="hx-code">${
|
|
278
|
+
function pt(e, t = 8) {
|
|
279
|
+
let n = e.slice(0, t).map((e) => `<li>${e.path ? `<code class="hx-code">${l(e.path)}</code> ` : ""}${l(e.message)}</li>`);
|
|
280
280
|
return e.length > t && n.push(`<li class="hx-faint">and ${e.length - t} more</li>`), n.join("");
|
|
281
281
|
}
|
|
282
|
-
var
|
|
283
|
-
function
|
|
282
|
+
var mt = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, ht = (e) => typeof e == "string" && /^https?:\/\//i.test(e) ? e : null;
|
|
283
|
+
function gt(e) {
|
|
284
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
285
|
}
|
|
286
|
-
function
|
|
287
|
-
let n = t && t.slug === e.slug && t.source === e.source, r = `<span class="hx-proposal-title">${
|
|
288
|
-
if (e.spec &&
|
|
289
|
-
e.counts &&
|
|
290
|
-
let
|
|
291
|
-
return
|
|
286
|
+
function _t(e, t) {
|
|
287
|
+
let n = t && t.slug === e.slug && t.source === e.source, r = `<span class="hx-proposal-title">${l(e.title || e.slug)}</span>`, a = [`<span class="hx-proposal-where">${l(gt(e))}</span>`];
|
|
288
|
+
if (e.spec && a.push(`<span>spec ${l(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">${l(e.error)}</span><span class="hx-proposal-meta">${a.join("")}</span></div>`;
|
|
289
|
+
e.counts && a.push(`<span>${l(se(e.counts))}</span>`);
|
|
290
|
+
let o = i(e.review, Date.now());
|
|
291
|
+
return o && a.push(`<span class="hx-proposal-reviewed">${l(o)}</span>`), e.errors && a.push(`<span class="hx-warn">${l(mt(e.errors, "problem"))}</span>`), `<button type="button" class="hx-proposal-item${n ? " is-current" : ""}" data-action="open-proposal" data-slug="${l(e.slug)}" data-source="${l(e.source)}" data-corn="row">${r}${e.summary ? `<span class="hx-proposal-sum">${l(e.summary)}</span>` : ""}<span class="hx-proposal-meta">${a.join("")}</span></button>`;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
let { state:
|
|
293
|
+
function vt(e, t, n = {}) {
|
|
294
|
+
let { state: r } = t, i = a(t), s = ft({ edit: n.edit !== !1 }), c = [...o(t, e, s.bar, n.slots, "bar"), ...o(t, e, s.menu, n.slots, "menu")], u = (e) => {
|
|
295
295
|
for (let t of c) {
|
|
296
296
|
if (t.id === e) return t;
|
|
297
297
|
let n = t.querySelector(`[id="${e}"]`);
|
|
@@ -299,115 +299,115 @@ function _t(e, t, n = {}) {
|
|
|
299
299
|
}
|
|
300
300
|
return null;
|
|
301
301
|
};
|
|
302
|
-
|
|
303
|
-
let
|
|
302
|
+
i.keepParts(...c);
|
|
303
|
+
let d = u("proposal-bar"), f = null, p = null, m = !1;
|
|
304
304
|
function h({ text: e, isError: t, ways: n }) {
|
|
305
|
-
|
|
306
|
-
let r =
|
|
305
|
+
d.hidden = !1, d.classList.toggle("is-error", t), u("proposal-body").hidden = !0;
|
|
306
|
+
let r = u("proposal-message");
|
|
307
307
|
r.hidden = !1, r.textContent = e;
|
|
308
|
-
let i =
|
|
309
|
-
i.hidden = n.length === 0, i.innerHTML = n.map((e) => `<button type="button" class="hx-btn" data-action="proposal-way" data-way="${
|
|
308
|
+
let i = u("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="${l(e.way)}"${e.slug ? ` data-slug="${l(e.slug)}"` : ""}${e.source ? ` data-source="${l(e.source)}"` : ""} data-peek-ok data-corn-kind="quiet">${l(e.label)}</button>`).join(""), g(i);
|
|
310
310
|
}
|
|
311
|
-
let
|
|
312
|
-
function
|
|
313
|
-
let e =
|
|
311
|
+
let _ = t.slot("proposal-pulls", () => /* @__PURE__ */ new Map()), v = null;
|
|
312
|
+
function y() {
|
|
313
|
+
let e = u("proposal-source"), n = r.proposal ? r.proposalSource : null;
|
|
314
314
|
if (e.hidden = !n, !n) return;
|
|
315
|
-
let
|
|
315
|
+
let i = W(n), a = i ? _.get(i) : null, o = Ke(t).entries, s = i && Array.isArray(o) ? o.find((e) => e.slug === r.proposalSlug && e.source === n) : null, c = ve(n, a && a.pull || s && s.pull || null, a ? a.checks : null);
|
|
316
316
|
e.textContent = c.text, c.state ? e.dataset.cornState = c.state : delete e.dataset.cornState;
|
|
317
|
-
let
|
|
318
|
-
|
|
319
|
-
let d = `${n}/${
|
|
320
|
-
|
|
317
|
+
let l = ht(c.href);
|
|
318
|
+
l ? (e.setAttribute("href", l), 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}/${r.proposalSlug}`;
|
|
320
|
+
i && v !== d && (v = d, x(i));
|
|
321
321
|
}
|
|
322
|
-
async function
|
|
322
|
+
async function x(e) {
|
|
323
323
|
try {
|
|
324
|
-
let n = await
|
|
324
|
+
let n = await Ve(t)(`/api/forge/pulls/${e}`), i = n.ok ? await n.json() : null;
|
|
325
325
|
if (m) return;
|
|
326
|
-
|
|
327
|
-
pull:
|
|
328
|
-
checks: Array.isArray(
|
|
329
|
-
}),
|
|
326
|
+
i && i.ok !== !1 && i.pull && _.set(e, {
|
|
327
|
+
pull: i.pull,
|
|
328
|
+
checks: Array.isArray(i.checks) ? i.checks : null
|
|
329
|
+
}), i && i.pull && W(r.proposalSource) === e && t.emit("proposal:pull-head", i.pull.head && typeof i.pull.head.sha == "string" ? i.pull.head.sha : "");
|
|
330
330
|
} catch {}
|
|
331
|
-
!m &&
|
|
331
|
+
!m && r.proposal && W(r.proposalSource) === e && y();
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
if (
|
|
335
|
-
|
|
333
|
+
function S({ open: e = !!r.proposal } = {}) {
|
|
334
|
+
if (d.hidden = !e, !e) {
|
|
335
|
+
k(), M(!1), Te(t, "proposal");
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
|
-
|
|
339
|
-
let n =
|
|
340
|
-
|
|
341
|
-
let a =
|
|
342
|
-
a.innerHTML =
|
|
343
|
-
let t = e.mark ? `<span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${
|
|
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">${
|
|
338
|
+
d.classList.remove("is-error"), u("proposal-message").hidden = !0, u("proposal-body").hidden = !1;
|
|
339
|
+
let n = r.proposal, i = u("proposal-title");
|
|
340
|
+
i.textContent = n && typeof n.title == "string" && n.title || r.proposalSlug || "Proposal", y(), i.title = n && typeof n.summary == "string" && n.summary || "";
|
|
341
|
+
let a = u("proposal-chip");
|
|
342
|
+
a.innerHTML = ce(ae(n)).map((e) => {
|
|
343
|
+
let t = e.mark ? `<span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${U(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">${l(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}${l(e.text)}</button>`;
|
|
345
345
|
}).join("<span class=\"hx-proposal-sep\" aria-hidden=\"true\"> · </span>");
|
|
346
|
-
let
|
|
347
|
-
|
|
348
|
-
for (let e of
|
|
349
|
-
let t = e.dataset.view ===
|
|
346
|
+
let o = K(r.whatIf && r.whatIf.edits, !!r.whatIfOff);
|
|
347
|
+
o && 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>${l(o)}</span>`), g(a), u("proposal-mode").textContent = D(t, r.proposalView);
|
|
348
|
+
for (let e of d.querySelectorAll("[data-action=\"proposal-view\"]")) {
|
|
349
|
+
let t = e.dataset.view === r.proposalView;
|
|
350
350
|
e.setAttribute("aria-pressed", String(t)), e.classList.toggle("is-on", t);
|
|
351
351
|
}
|
|
352
|
-
let
|
|
353
|
-
|
|
354
|
-
let f =
|
|
355
|
-
p.hidden = f.length === 0, f.length && (
|
|
352
|
+
let s = u("proposal-whole"), c = !!(r.review && r.review.whole);
|
|
353
|
+
s.setAttribute("aria-pressed", String(c)), s.title = D(t, "showWholeMap"), s.classList.toggle("hx-btn--active", c);
|
|
354
|
+
let f = r.proposalErrors || [], p = u("proposal-errors");
|
|
355
|
+
p.hidden = f.length === 0, f.length && (u("proposal-errors-count").textContent = `${mt(f.length, "problem")} in this proposal`, u("proposal-errors-list").innerHTML = pt(f));
|
|
356
356
|
}
|
|
357
|
-
function
|
|
358
|
-
let e =
|
|
357
|
+
function C() {
|
|
358
|
+
let e = u("proposal-body");
|
|
359
359
|
if (f && f.isConnected) return f;
|
|
360
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
361
|
let n = e.querySelector(".hx-proposal-head");
|
|
362
362
|
return n ? n.after(f) : e.append(f), f;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
365
|
-
let r =
|
|
364
|
+
function w(e, n) {
|
|
365
|
+
let r = C();
|
|
366
366
|
if (r.hidden = !e, !e) {
|
|
367
367
|
p = null;
|
|
368
368
|
return;
|
|
369
369
|
}
|
|
370
|
-
let i =
|
|
370
|
+
let i = G(e);
|
|
371
371
|
r.querySelector("[data-waiting-words]").textContent = i;
|
|
372
372
|
let a = r.querySelector("[data-waiting-answer]");
|
|
373
373
|
a.textContent = D(t, "answer"), a.dataset.waitingAnswer = e.runId, a.setAttribute("aria-label", `${D(t, "answer")}: ${i}`);
|
|
374
374
|
let o = `${n}|${e.runId}`;
|
|
375
|
-
p !== o && (p = o,
|
|
375
|
+
p !== o && (p = o, N(t, i));
|
|
376
376
|
}
|
|
377
|
-
let
|
|
378
|
-
let e =
|
|
377
|
+
let T = () => [...d.querySelectorAll("#proposal-more-menu [role=\"menuitem\"]")], O = () => {
|
|
378
|
+
let e = u("proposal-more-menu");
|
|
379
379
|
return !!e && !e.hidden;
|
|
380
380
|
};
|
|
381
|
-
function
|
|
382
|
-
|
|
383
|
-
let t =
|
|
381
|
+
function k(e = !1) {
|
|
382
|
+
u("proposal-more-menu").hidden = !0;
|
|
383
|
+
let t = u("proposal-more");
|
|
384
384
|
t.setAttribute("aria-expanded", "false"), e && t.focus();
|
|
385
385
|
}
|
|
386
386
|
function j(e = "first") {
|
|
387
|
-
|
|
388
|
-
let t =
|
|
387
|
+
u("proposal-more-menu").hidden = !1, u("proposal-more").setAttribute("aria-expanded", "true");
|
|
388
|
+
let t = T();
|
|
389
389
|
(e === "last" ? t[t.length - 1] : t[0])?.focus();
|
|
390
390
|
}
|
|
391
391
|
function M(e) {
|
|
392
|
-
let t = typeof e == "boolean" ? e :
|
|
393
|
-
|
|
392
|
+
let t = typeof e == "boolean" ? e : d.dataset.modeOpen !== "true";
|
|
393
|
+
d.dataset.modeOpen = String(t), u("proposal-mode").setAttribute("aria-expanded", String(t));
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
let n =
|
|
395
|
+
function ee(e) {
|
|
396
|
+
let n = u("proposal-more");
|
|
397
397
|
if (e.target === n && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
398
398
|
e.preventDefault(), j(e.key === "ArrowUp" ? "last" : "first");
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
|
-
if (!
|
|
401
|
+
if (!O()) return;
|
|
402
402
|
if (e.key === "Escape") {
|
|
403
|
-
e.preventDefault(),
|
|
403
|
+
e.preventDefault(), k(!0);
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
if (e.key === "Tab") {
|
|
407
|
-
|
|
407
|
+
k();
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
|
-
let r =
|
|
410
|
+
let r = T(), i = r.indexOf(t.active());
|
|
411
411
|
if (i < 0) return;
|
|
412
412
|
let a = {
|
|
413
413
|
ArrowDown: (i + 1) % r.length,
|
|
@@ -418,163 +418,163 @@ function _t(e, t, n = {}) {
|
|
|
418
418
|
a !== void 0 && (e.preventDefault(), r[a].focus());
|
|
419
419
|
}
|
|
420
420
|
let P = () => {
|
|
421
|
-
let e =
|
|
421
|
+
let e = u("proposal-menu");
|
|
422
422
|
return !!e && !e.hidden;
|
|
423
423
|
};
|
|
424
424
|
function F() {
|
|
425
|
-
|
|
425
|
+
u("proposal-menu").hidden = !0, u("proposal-btn").setAttribute("aria-expanded", "false");
|
|
426
426
|
}
|
|
427
427
|
async function I() {
|
|
428
|
-
let e =
|
|
428
|
+
let e = u("proposal-menu");
|
|
429
429
|
if (P()) return F();
|
|
430
|
-
e.hidden = !1,
|
|
430
|
+
e.hidden = !1, u("proposal-btn").setAttribute("aria-expanded", "true"), Ke(t).entries || L(!0), await qe(t);
|
|
431
431
|
}
|
|
432
432
|
function L(e = !1) {
|
|
433
|
-
let n =
|
|
434
|
-
slug:
|
|
435
|
-
source:
|
|
436
|
-
} : null,
|
|
437
|
-
|
|
438
|
-
let d =
|
|
439
|
-
n.innerHTML = `<div class="hx-menu-title hx-menu-head" data-corn="menu-title"><span>${
|
|
440
|
-
}
|
|
441
|
-
async function
|
|
442
|
-
let r = await
|
|
433
|
+
let n = u("proposal-menu"), { entries: i, problem: a, forgeProblem: o } = Ke(t), s = r.proposal ? {
|
|
434
|
+
slug: r.proposalSlug,
|
|
435
|
+
source: r.proposalSource
|
|
436
|
+
} : null, c;
|
|
437
|
+
c = e && !i ? "<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: ${l(a)}</p>` : !i || i.length === 0 ? "<p class=\"hx-faint hx-proposal-empty\">No proposals</p>" : `<div class="hx-proposal-list" role="list">${i.map((e) => `<div role="listitem">${_t(e, s)}</div>`).join("")}</div>`;
|
|
438
|
+
let d = o && !a ? `<p class="hx-error-text hx-proposal-empty">The spec PRs could not be listed: ${l(o)}</p>` : "";
|
|
439
|
+
n.innerHTML = `<div class="hx-menu-title hx-menu-head" data-corn="menu-title"><span>${l(D(t, "proposals"))}</span></div>${d}${c}`, g(n);
|
|
440
|
+
}
|
|
441
|
+
async function R(e, n) {
|
|
442
|
+
let r = await Xe(t, e, n);
|
|
443
443
|
if (m) return;
|
|
444
|
-
let i = r ?
|
|
444
|
+
let i = r ? u("proposal-title") : d.querySelector("#proposal-ways [data-way=\"retry\"]");
|
|
445
445
|
i && (r && (i.tabIndex = -1), i.focus());
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
|
|
447
|
+
function z() {
|
|
448
|
+
tt(t), r.canvas && r.canvas.focus();
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function B() {
|
|
451
451
|
t.ask("work:open-specs") !== !0 && (P() || I());
|
|
452
452
|
}
|
|
453
|
-
let
|
|
453
|
+
let V = {
|
|
454
454
|
"toggle-proposals-menu": () => I(),
|
|
455
|
-
"open-proposal": (e) =>
|
|
456
|
-
"close-proposal": () =>
|
|
455
|
+
"open-proposal": (e) => Xe(t, e.dataset.slug, e.dataset.source || null),
|
|
456
|
+
"close-proposal": () => tt(t),
|
|
457
457
|
"proposal-whole": () => {
|
|
458
|
-
|
|
458
|
+
Fe(t, !(r.review && r.review.whole)), $e(t);
|
|
459
459
|
},
|
|
460
460
|
"proposal-view": (e) => {
|
|
461
|
-
|
|
461
|
+
nt(t, e.dataset.view), M(!1);
|
|
462
462
|
},
|
|
463
463
|
"toggle-proposal-mode": () => M(),
|
|
464
|
-
"toggle-proposal-more": () =>
|
|
464
|
+
"toggle-proposal-more": () => O() ? k() : j(),
|
|
465
465
|
"review-show-changes": () => t.emit("changes:show", "changes"),
|
|
466
466
|
"review-show-scenarios": () => t.emit("changes:show", "scenarios"),
|
|
467
|
-
"proposal-way": (e) => e.dataset.way === "open" ?
|
|
467
|
+
"proposal-way": (e) => e.dataset.way === "open" ? Xe(t, e.dataset.slug, e.dataset.source || null) : e.dataset.way === "retry" ? R(e.dataset.slug, e.dataset.source || null) : e.dataset.way === "close" ? z() : B()
|
|
468
468
|
};
|
|
469
|
-
|
|
470
|
-
let t = e.target.closest ? e.target.closest("[data-action]") : null, n = t && Object.hasOwn(
|
|
471
|
-
n && n(t),
|
|
472
|
-
let r =
|
|
469
|
+
i.listen(t.root, "click", (e) => {
|
|
470
|
+
let t = e.target.closest ? e.target.closest("[data-action]") : null, n = t && Object.hasOwn(V, t.dataset.action) && V[t.dataset.action];
|
|
471
|
+
n && n(t), O() && !(t && t.dataset.action === "toggle-proposal-more") && k(!!(t && t.closest("#proposal-more-menu")));
|
|
472
|
+
let r = u("proposal-wrap");
|
|
473
473
|
P() && r && !r.contains(e.target) && !(t && t.dataset.action === "proposal-way") && F();
|
|
474
|
-
}),
|
|
474
|
+
}), i.listen(d, "click", (e) => {
|
|
475
475
|
let n = e.target.closest && e.target.closest("[data-waiting-answer]");
|
|
476
476
|
n && (e.preventDefault(), e.stopPropagation(), t.emit("work:answer", { run: n.dataset.waitingAnswer }));
|
|
477
477
|
}, !0);
|
|
478
|
-
let
|
|
479
|
-
let t =
|
|
478
|
+
let H = (e) => {
|
|
479
|
+
let t = u("proposal-wrap");
|
|
480
480
|
t && (t.hidden = !!e);
|
|
481
481
|
};
|
|
482
|
-
|
|
483
|
-
e.key === "Escape" && P() && F(),
|
|
482
|
+
i.on("work:available", ({ on: e }) => H(e)), t.ask("work:on") && H(!0), i.listen(t.root, "keydown", (e) => {
|
|
483
|
+
e.key === "Escape" && P() && F(), ee(e);
|
|
484
484
|
});
|
|
485
|
-
function
|
|
485
|
+
function q() {
|
|
486
486
|
let e = t.tokenElement();
|
|
487
487
|
if (!e || !e.style) return;
|
|
488
|
-
let { mark: n } =
|
|
488
|
+
let { mark: n } = b(E(r.theme), A(t).get());
|
|
489
489
|
for (let t of Object.keys(n)) e.style.setProperty(`--hx-mark-${t}`, n[t].color);
|
|
490
490
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}),
|
|
494
|
-
let e =
|
|
491
|
+
q(), i.on("theme", q), i.own(A(t).onChange(() => q())), i.on("proposal:draw", ({ open: e }) => S({ open: e })), i.on("changes:peek", (e) => {
|
|
492
|
+
u("proposal-peek").textContent = e;
|
|
493
|
+
}), i.on("proposal:focus-title", () => {
|
|
494
|
+
let e = u("proposal-title");
|
|
495
495
|
e.tabIndex = -1, e.focus();
|
|
496
|
-
}),
|
|
497
|
-
L(),
|
|
498
|
-
}),
|
|
496
|
+
}), i.on("proposal:message", (e) => h(e)), i.on("proposal:listing", () => {
|
|
497
|
+
L(), r.proposal && y();
|
|
498
|
+
}), i.on("proposal:waiting", ({ run: e, key: t }) => w(e, t)), i.on("proposal:waiting-reset", () => {
|
|
499
499
|
p = null, f = null;
|
|
500
|
-
}),
|
|
500
|
+
}), i.on("proposal", ({ change: e }) => {
|
|
501
501
|
e === "opened" && F();
|
|
502
|
-
}),
|
|
502
|
+
}), i.own(ut(t, (e, t, n) => i.listen(e, t, n))), Ce(t), xe(t, "proposal", d, { stub: () => ({ title: u("proposal-title") && u("proposal-title").textContent || "Proposal" }) }), i.own(() => Se(t, "proposal")), i.own(() => {
|
|
503
503
|
m = !0, c.forEach((e) => e.remove());
|
|
504
|
-
}),
|
|
505
|
-
let
|
|
506
|
-
return
|
|
504
|
+
}), S();
|
|
505
|
+
let te = Ye(t);
|
|
506
|
+
return te && !r.proposal && h(te), {
|
|
507
507
|
elements: c,
|
|
508
|
-
renderBar: () =>
|
|
509
|
-
paintWaitingLine:
|
|
508
|
+
renderBar: () => $e(t),
|
|
509
|
+
paintWaitingLine: w,
|
|
510
510
|
toggleMenu: I,
|
|
511
511
|
closeMenu: F,
|
|
512
|
-
setMessage: (e, n, r) =>
|
|
512
|
+
setMessage: (e, n, r) => Je(t, e, n, r),
|
|
513
513
|
sayBadLink: (e) => {
|
|
514
|
-
let n =
|
|
515
|
-
return n &&
|
|
514
|
+
let n = be(e);
|
|
515
|
+
return n && Je(t, n, !0, [{
|
|
516
516
|
label: D(t, "openSpecsList"),
|
|
517
517
|
way: "specs"
|
|
518
518
|
}]), !!n;
|
|
519
519
|
},
|
|
520
520
|
update(e) {
|
|
521
521
|
if (!e || !("proposal" in e || "view" in e)) {
|
|
522
|
-
|
|
522
|
+
$e(t);
|
|
523
523
|
return;
|
|
524
524
|
}
|
|
525
525
|
let n;
|
|
526
526
|
if ("proposal" in e) {
|
|
527
|
-
let
|
|
528
|
-
|
|
527
|
+
let i = e.proposal;
|
|
528
|
+
i === null ? tt(t) : typeof i == "string" ? n = r.proposal && r.proposalSlug === i && (e.source || null) === (r.proposalSource || null) && r.proposal ? Promise.resolve(!0) : Xe(t, i, e.source || null) : i && typeof i == "object" && Ze(t, i, {
|
|
529
529
|
slug: e.slug || null,
|
|
530
530
|
source: e.source || null,
|
|
531
531
|
pinSource: !!e.source,
|
|
532
|
-
view:
|
|
532
|
+
view: Z.includes(e.view) ? e.view : "diff",
|
|
533
533
|
sha256: e.sha256 || null
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
|
-
return "view" in e &&
|
|
536
|
+
return "view" in e && Z.includes(e.view) && !(typeof e.proposal == "string" && n) ? nt(t, e.view, { quiet: !0 }) : "view" in e && n && (n = n.then((n) => (n && Z.includes(e.view) && nt(t, e.view, { quiet: !0 }), n))), n;
|
|
537
537
|
},
|
|
538
|
-
pinnedSource: () =>
|
|
539
|
-
destroy: () =>
|
|
538
|
+
pinnedSource: () => dt(t),
|
|
539
|
+
destroy: () => i.destroy()
|
|
540
540
|
};
|
|
541
541
|
}
|
|
542
|
-
var
|
|
543
|
-
function
|
|
542
|
+
var yt = (e) => e === void 0 ? null : Array.isArray(e) ? e : [e], bt = (e) => !e.kind && !e.dashed;
|
|
543
|
+
function xt(e, t) {
|
|
544
544
|
if (!t) return null;
|
|
545
|
-
let n =
|
|
545
|
+
let n = k(t);
|
|
546
546
|
return e.find((e) => e.type === "persona" && (e.id === n || e.id === t)) || null;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function St(e) {
|
|
549
549
|
return e.account === !1 ? { account: !1 } : {
|
|
550
550
|
role: e.role,
|
|
551
551
|
groups: Array.isArray(e.groups) ? [...e.groups] : []
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
var
|
|
555
|
-
function
|
|
554
|
+
var Ct = (e) => e ? e.codeLabel || e.label || e.id : "";
|
|
555
|
+
function wt(e, t) {
|
|
556
556
|
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
|
|
557
|
-
for (let e of t)
|
|
557
|
+
for (let e of t) bt(e) && !r.has(e.to) && r.set(e.to, e.from);
|
|
558
558
|
return {
|
|
559
559
|
nodes: e,
|
|
560
560
|
byId: n,
|
|
561
561
|
owner: r
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Tt(e, t) {
|
|
565
565
|
let n = e.byId.get(t);
|
|
566
566
|
return n ? n.type === "table" && (n.table || n.label) || null : typeof t == "string" && t.startsWith("table-") ? t.slice(6) : null;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function Et(e, t, n) {
|
|
569
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
570
|
}
|
|
571
|
-
function
|
|
572
|
-
let r =
|
|
571
|
+
function Dt(e, t, n) {
|
|
572
|
+
let r = yt(e && e.check);
|
|
573
573
|
if (r) return r.map((e) => ({ ...e }));
|
|
574
574
|
if (!e) return [];
|
|
575
575
|
if (e.node !== void 0) {
|
|
576
576
|
let r = t.byId.get(e.node);
|
|
577
|
-
if (!
|
|
577
|
+
if (!Et(t, r, n)) return [];
|
|
578
578
|
let i = r.methods.map((e) => String(e).toUpperCase());
|
|
579
579
|
return [{
|
|
580
580
|
route: r.label,
|
|
@@ -582,14 +582,14 @@ function Et(e, t, n) {
|
|
|
582
582
|
}];
|
|
583
583
|
}
|
|
584
584
|
if (e.edge && e.edge.kind === "writes") {
|
|
585
|
-
let n =
|
|
585
|
+
let n = Tt(t, e.edge.to);
|
|
586
586
|
return n ? [{
|
|
587
587
|
table: n,
|
|
588
588
|
op: "write"
|
|
589
589
|
}] : [];
|
|
590
590
|
}
|
|
591
591
|
if (e.edge && e.edge.kind === "reads") {
|
|
592
|
-
let n =
|
|
592
|
+
let n = Tt(t, e.edge.from);
|
|
593
593
|
return n ? [{
|
|
594
594
|
table: n,
|
|
595
595
|
op: "read"
|
|
@@ -597,7 +597,7 @@ function Et(e, t, n) {
|
|
|
597
597
|
}
|
|
598
598
|
return [];
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Ot(e, t, n, { as: r = null } = {}) {
|
|
601
601
|
let i = [], a = [];
|
|
602
602
|
return (e && Array.isArray(e.steps) ? e.steps : []).forEach((o, s) => {
|
|
603
603
|
let c = r || o.actor || e.actor || null, l = {
|
|
@@ -609,18 +609,18 @@ function Dt(e, t, n, { as: r = null } = {}) {
|
|
|
609
609
|
expect: o.expect
|
|
610
610
|
};
|
|
611
611
|
if (i.push(l), !c) return;
|
|
612
|
-
let u =
|
|
613
|
-
if (l.actorLabel = u ?
|
|
612
|
+
let u = xt(t.nodes, c);
|
|
613
|
+
if (l.actorLabel = u ? Ct(u) : c, !u) {
|
|
614
614
|
l.kind = "unchecked", l.why = `no persona "${c}" on the map`;
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
|
-
let d =
|
|
617
|
+
let d = Dt(o, t, n);
|
|
618
618
|
if (d.length === 0) {
|
|
619
619
|
l.kind = "unchecked", l.why = Array.isArray(o.check) ? "this step is not a permission question" : "nothing in this step to ask";
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
622
|
l.kind = "ask";
|
|
623
|
-
let f =
|
|
623
|
+
let f = St(u);
|
|
624
624
|
l.checks = d.map((e, t) => ({
|
|
625
625
|
id: `s${s + 1}-${t + 1}`,
|
|
626
626
|
...e
|
|
@@ -634,13 +634,13 @@ function Dt(e, t, n, { as: r = null } = {}) {
|
|
|
634
634
|
key: JSON.stringify(a)
|
|
635
635
|
};
|
|
636
636
|
}
|
|
637
|
-
function
|
|
637
|
+
function kt(e, t = {}) {
|
|
638
638
|
let n = Error(t.message || e);
|
|
639
639
|
return n.reason = e, Object.assign(n, t), n;
|
|
640
640
|
}
|
|
641
|
-
async function
|
|
641
|
+
async function At(e, t, { signal: n } = {}) {
|
|
642
642
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
643
|
-
if (!e) throw
|
|
643
|
+
if (!e) throw kt("no-checker", { message: "no permission checker" });
|
|
644
644
|
let a = e.max > 0 ? e.max : 100, o = t.slice();
|
|
645
645
|
for (; o.length;) {
|
|
646
646
|
let t = o.slice(0, a), s;
|
|
@@ -662,7 +662,7 @@ async function kt(e, t, { signal: n } = {}) {
|
|
|
662
662
|
bad: i
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function jt(e, t) {
|
|
666
666
|
let n = {
|
|
667
667
|
mismatch: !1,
|
|
668
668
|
actor: e ? e.actorLabel : "",
|
|
@@ -685,7 +685,7 @@ function At(e, t) {
|
|
|
685
685
|
if (t.status === "failed") return {
|
|
686
686
|
...n,
|
|
687
687
|
state: "unavailable",
|
|
688
|
-
why:
|
|
688
|
+
why: Mt(t.error),
|
|
689
689
|
checks: e.checks
|
|
690
690
|
};
|
|
691
691
|
let r = e.checks.map((e) => ({
|
|
@@ -711,20 +711,20 @@ function At(e, t) {
|
|
|
711
711
|
};
|
|
712
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
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function Mt(e) {
|
|
715
715
|
let t = e && e.reason;
|
|
716
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
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Nt(e) {
|
|
719
719
|
return e.route === void 0 ? [
|
|
720
720
|
e.table,
|
|
721
721
|
e.op,
|
|
722
722
|
e.row
|
|
723
723
|
].filter(Boolean).join(" · ") : `${String(e.method || "").toUpperCase()} ${e.route}`;
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Pt(e) {
|
|
726
726
|
if (!e || e.state === "none") return null;
|
|
727
|
-
let t = e.actor ? ` as ${e.actor}` : "", n = e.checks.map(
|
|
727
|
+
let t = e.actor ? ` as ${e.actor}` : "", n = e.checks.map(Nt).join(", "), r = n ? `${n}${t}` : e.actor ? `As ${e.actor}` : "", i = () => `${e.reason}${e.rule ? ` (${e.rule})` : ""}`;
|
|
728
728
|
if (e.state === "pending") return {
|
|
729
729
|
tone: "pending",
|
|
730
730
|
pill: "Checking…",
|
|
@@ -765,14 +765,14 @@ function Nt(e) {
|
|
|
765
765
|
};
|
|
766
766
|
}
|
|
767
767
|
// ../explorer/engine/checks.js
|
|
768
|
-
var
|
|
769
|
-
function
|
|
770
|
-
let { state: n } = e, r = t.checker || null, i = null, a = 0,
|
|
771
|
-
function
|
|
768
|
+
var Ft = (e) => !!e && (!!e.actor || Array.isArray(e.steps) && e.steps.some((e) => e && e.actor));
|
|
769
|
+
function It(e, t = {}) {
|
|
770
|
+
let { state: n } = e, r = t.checker || null, i = null, a = 0, o = /* @__PURE__ */ new WeakMap(), s = [];
|
|
771
|
+
function c() {
|
|
772
772
|
i && i.controller && i.controller.abort(), i = null, a++;
|
|
773
773
|
}
|
|
774
774
|
function u(e) {
|
|
775
|
-
e ||= null, e !== r &&
|
|
775
|
+
e ||= null, e !== r && c(), r = e;
|
|
776
776
|
}
|
|
777
777
|
function d() {
|
|
778
778
|
let e = i;
|
|
@@ -788,7 +788,7 @@ function Ft(e, t = {}) {
|
|
|
788
788
|
return;
|
|
789
789
|
}
|
|
790
790
|
let n = new AbortController();
|
|
791
|
-
e.controller = n, e.answer = { status: "pending" }, a++,
|
|
791
|
+
e.controller = n, e.answer = { status: "pending" }, a++, At(r, t, { signal: n.signal }).then(({ results: t, bad: r }) => f(e, n, {
|
|
792
792
|
status: "ok",
|
|
793
793
|
results: t,
|
|
794
794
|
bad: r
|
|
@@ -806,10 +806,10 @@ function Ft(e, t = {}) {
|
|
|
806
806
|
let o = i;
|
|
807
807
|
if (!o || !t && o.scenario === e && o.nodes === n.nodes && o.plan) return;
|
|
808
808
|
let s = o.plan ? o.plan.key : null;
|
|
809
|
-
o.scenario = e, o.nodes = n.nodes, o.plan =
|
|
809
|
+
o.scenario = e, o.nodes = n.nodes, o.plan = Ot(e, wt(n.nodes, n.edges), r, { as: o.as }), a++, (t || o.plan.key !== s) && d();
|
|
810
810
|
}
|
|
811
811
|
function m(t, r = () => {}) {
|
|
812
|
-
i && i.scenario && t && i.scenario.id === t.id ? (i.onChange = r, p(t)) : (
|
|
812
|
+
i && i.scenario && t && i.scenario.id === t.id ? (i.onChange = r, p(t)) : (c(), i = {
|
|
813
813
|
scenario: null,
|
|
814
814
|
as: null,
|
|
815
815
|
nodes: null,
|
|
@@ -817,98 +817,98 @@ function Ft(e, t = {}) {
|
|
|
817
817
|
answer: { status: "idle" },
|
|
818
818
|
controller: null,
|
|
819
819
|
onChange: r
|
|
820
|
-
},
|
|
820
|
+
}, Ft(t) && P(n).persona !== !0 && Me(e, "persona", !0, { scenario: !0 }), p(t));
|
|
821
821
|
}
|
|
822
822
|
function h(e, t) {
|
|
823
823
|
if (!i) return e;
|
|
824
824
|
p(t);
|
|
825
825
|
let n = i.plan.steps[e.index];
|
|
826
|
-
return e.verdict =
|
|
826
|
+
return e.verdict = jt(n, i.answer), i.as && n && n.actor && (e.current.actor = n.actor), e;
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
return !i || !i.plan ? [] : i.plan.steps.map((e) =>
|
|
828
|
+
function _() {
|
|
829
|
+
return !i || !i.plan ? [] : i.plan.steps.map((e) => jt(e, i.answer));
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function v(e) {
|
|
832
832
|
i && (i.as = e || null, p(i.scenario, !0), i.onChange());
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function y() {
|
|
835
835
|
i && (p(i.scenario, !0), i.onChange());
|
|
836
836
|
}
|
|
837
|
-
function
|
|
837
|
+
function b(t) {
|
|
838
838
|
let n = e.doc, r = n.createElement("span");
|
|
839
839
|
r.className = "hx-player-verdict", r.dataset.corn = "state-pill", r.hidden = !0;
|
|
840
840
|
let i = t.querySelector(".hx-player-text");
|
|
841
841
|
i ? i.append(" ", r) : t.prepend(r);
|
|
842
842
|
let a = n.createElement("p");
|
|
843
843
|
a.className = "hx-player-check", a.dataset.corn = "scenario-check", a.hidden = !0;
|
|
844
|
-
let
|
|
845
|
-
|
|
846
|
-
let
|
|
847
|
-
|
|
844
|
+
let o = n.createElement("div");
|
|
845
|
+
o.className = "hx-player-as", o.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 c = t.querySelector(".hx-player-track");
|
|
847
|
+
c ? (c.before(a), c.before(o)) : (t.appendChild(a), t.appendChild(o));
|
|
848
848
|
for (let e of [
|
|
849
849
|
r,
|
|
850
850
|
a,
|
|
851
|
-
|
|
851
|
+
o
|
|
852
852
|
]) e.hasAttribute("data-corn") && e.setAttribute("part", e.getAttribute("data-corn"));
|
|
853
|
-
o
|
|
854
|
-
let
|
|
855
|
-
|
|
856
|
-
|
|
853
|
+
g(o);
|
|
854
|
+
let l = o.querySelector("[data-check=as]"), u = o.querySelector("[data-check=recheck]"), d = (e) => v(e.target.value);
|
|
855
|
+
l.addEventListener("change", d), u.addEventListener("click", y), s.push(() => {
|
|
856
|
+
l.removeEventListener("change", d), u.removeEventListener("click", y);
|
|
857
857
|
});
|
|
858
858
|
}
|
|
859
|
-
function
|
|
860
|
-
let e =
|
|
861
|
-
|
|
859
|
+
function x() {
|
|
860
|
+
let e = s;
|
|
861
|
+
s = [], e.forEach((e) => e());
|
|
862
862
|
}
|
|
863
|
-
function
|
|
863
|
+
function S(e) {
|
|
864
864
|
let t = [{
|
|
865
865
|
value: "",
|
|
866
866
|
label: "As written"
|
|
867
867
|
}, ...n.nodes.filter((e) => e.type === "persona").map((e) => ({
|
|
868
868
|
value: e.id.replace(/^persona-/, ""),
|
|
869
|
-
label:
|
|
869
|
+
label: Ct(e)
|
|
870
870
|
}))], r = t.map((e) => `${e.value}\u0000${e.label}`).join("");
|
|
871
|
-
e.dataset.key !== r && (e.innerHTML = t.map((e) => `<option value="${
|
|
871
|
+
e.dataset.key !== r && (e.innerHTML = t.map((e) => `<option value="${l(e.value)}">${l(e.label)}</option>`).join(""), e.dataset.key = r), e.value = i && i.as ? i.as : "";
|
|
872
872
|
}
|
|
873
|
-
function
|
|
874
|
-
let e =
|
|
873
|
+
function C() {
|
|
874
|
+
let e = _(), t = e.reduce((e, t) => e + t.checks.length, 0);
|
|
875
875
|
if (!i || i.answer.status === "pending") return t ? `Checking ${t}…` : "";
|
|
876
876
|
if (i.answer.status === "failed") return "";
|
|
877
877
|
let n = e.filter((e) => e.state === "refused").length, r = e.filter((e) => e.mismatch).length, a = [`${t} ${t === 1 ? "check" : "checks"}`];
|
|
878
878
|
return n && a.push(`${n} refused`), r && a.push(`${r} not as expected`), t ? a.join(" · ") : "No permission questions";
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function w(e, t) {
|
|
881
881
|
if (!e || !i) return;
|
|
882
882
|
if (!e.querySelector(".hx-player-as")) {
|
|
883
|
-
if (!
|
|
884
|
-
|
|
883
|
+
if (!Ft(i.scenario)) return;
|
|
884
|
+
b(e);
|
|
885
885
|
}
|
|
886
886
|
let n = e.querySelector(".hx-player-verdict"), r = e.querySelector(".hx-player-check"), a = e.querySelector(".hx-player-as");
|
|
887
887
|
if (!n || !r || !a) return;
|
|
888
|
-
let
|
|
889
|
-
if (n.hidden = !
|
|
890
|
-
n.dataset.tone =
|
|
891
|
-
let e = `${
|
|
892
|
-
|
|
888
|
+
let s = t.done ? null : Pt(t.verdict);
|
|
889
|
+
if (n.hidden = !s, r.hidden = !s, s) {
|
|
890
|
+
n.dataset.tone = s.tone, ue(s.tone) ? n.dataset.cornState = ue(s.tone) : delete n.dataset.cornState, n.textContent = s.pill, n.title = s.line, r.dataset.tone = s.tone;
|
|
891
|
+
let e = `${l(s.line)}${s.detail ? ` <span class="hx-player-check-detail">${l(s.detail)}</span>` : ""}`;
|
|
892
|
+
o.get(r) !== e && (o.set(r, e), r.innerHTML = e);
|
|
893
893
|
}
|
|
894
|
-
|
|
894
|
+
S(a.querySelector("[data-check=as]")), a.querySelector("[data-check=recheck]").disabled = i.answer.status === "pending", a.querySelector(".hx-player-as-sum").textContent = C();
|
|
895
895
|
}
|
|
896
896
|
return {
|
|
897
897
|
setChecker: u,
|
|
898
898
|
open: m,
|
|
899
|
-
close:
|
|
899
|
+
close: c,
|
|
900
900
|
decorate: h,
|
|
901
|
-
paint:
|
|
902
|
-
unmount:
|
|
903
|
-
verdicts:
|
|
904
|
-
chooseActor:
|
|
905
|
-
recheck:
|
|
901
|
+
paint: w,
|
|
902
|
+
unmount: x,
|
|
903
|
+
verdicts: _,
|
|
904
|
+
chooseActor: v,
|
|
905
|
+
recheck: y,
|
|
906
906
|
version: () => a,
|
|
907
907
|
checkedScenarioId: () => i && i.scenario ? i.scenario.id : null
|
|
908
908
|
};
|
|
909
909
|
}
|
|
910
910
|
// ../explorer/scenario.js
|
|
911
|
-
var
|
|
911
|
+
var Lt = 5e3, Rt = "topology.scenarioSpeed", zt = [
|
|
912
912
|
{
|
|
913
913
|
value: "2000",
|
|
914
914
|
label: "2 s"
|
|
@@ -926,24 +926,24 @@ var It = 5e3, Lt = "topology.scenarioSpeed", Rt = [
|
|
|
926
926
|
label: "Manual"
|
|
927
927
|
}
|
|
928
928
|
];
|
|
929
|
-
function
|
|
930
|
-
let t =
|
|
931
|
-
return t ? t.value === "manual" ? "manual" : Number(t.value) :
|
|
929
|
+
function Bt(e) {
|
|
930
|
+
let t = zt.find((t) => t.value === e);
|
|
931
|
+
return t ? t.value === "manual" ? "manual" : Number(t.value) : Lt;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function Vt(e, t = Lt) {
|
|
934
934
|
let n = e && e.ms;
|
|
935
935
|
return typeof n == "number" && n > 0 && Number.isFinite(n) ? n : t;
|
|
936
936
|
}
|
|
937
|
-
var
|
|
938
|
-
function
|
|
937
|
+
var Ht = (e) => e && Array.isArray(e.steps) ? e.steps : [];
|
|
938
|
+
function Ut(e) {
|
|
939
939
|
let t = e && Array.isArray(e.down) ? e.down : [];
|
|
940
940
|
return [...new Set(t.filter((e) => typeof e == "string" && e !== ""))];
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function Wt(e, t) {
|
|
943
943
|
return t && t.actor || e && e.actor || null;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
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 =
|
|
945
|
+
function Gt(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 = Ht(e).length === 0, u = 0, d = null, f = null, p = () => Ht(n), m = () => p().length - 1, h = (e) => Vt(p()[e], a()), g = (e) => Math.max(0, Math.min(Math.max(0, m()), e)), _ = () => {
|
|
947
947
|
s = 0, l = p().length === 0, u = 0, d = null, f = null;
|
|
948
948
|
}, v = () => {
|
|
949
949
|
c = !1, d = null, f = null;
|
|
@@ -998,13 +998,13 @@ function Wt(e, t = {}) {
|
|
|
998
998
|
let i = e[n];
|
|
999
999
|
if (i.node !== void 0 && t.add(i.node), i.at !== void 0 && t.add(i.at), i.edge) {
|
|
1000
1000
|
t.add(i.edge.from), t.add(i.edge.to);
|
|
1001
|
-
let e =
|
|
1001
|
+
let e = X(i.edge);
|
|
1002
1002
|
r.has(e) || (r.add(e), a.push({ ...i.edge }));
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
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 =
|
|
1007
|
-
let m =
|
|
1006
|
+
o && o.node !== void 0 && (d.node = o.node), o && o.edge && (d.edge = { ...o.edge }, d.edgeKey = X(o.edge));
|
|
1007
|
+
let m = Wt(n, o);
|
|
1008
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
1009
|
let g = h(s);
|
|
1010
1010
|
return {
|
|
@@ -1025,12 +1025,12 @@ function Wt(e, t = {}) {
|
|
|
1025
1025
|
stepMs: g,
|
|
1026
1026
|
stepStartMs: f,
|
|
1027
1027
|
linkNodes: !!n.linkNodes,
|
|
1028
|
-
down:
|
|
1028
|
+
down: Ut(n)
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Kt(e, t, n, r, i = 60, a = I) {
|
|
1034
1034
|
if (!n.width || !n.height) return null;
|
|
1035
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
1036
|
if (s.length === 0 || s.some((e) => !e)) return null;
|
|
@@ -1040,43 +1040,43 @@ function Gt(e, t, n, r, i = 60, a = C) {
|
|
|
1040
1040
|
y: n.y || 0,
|
|
1041
1041
|
width: n.width,
|
|
1042
1042
|
height: n.height
|
|
1043
|
-
}, l =
|
|
1043
|
+
}, l = y(s, c, {
|
|
1044
1044
|
padding: i,
|
|
1045
1045
|
maxZoom: Math.max(1, t.zoom),
|
|
1046
1046
|
minZoom: a
|
|
1047
1047
|
}), u = Math.min(i, c.width / 4, c.height / 4);
|
|
1048
|
-
return
|
|
1048
|
+
return de(s, t, c, u) && t.zoom >= l.zoom - .001 ? null : l;
|
|
1049
1049
|
}
|
|
1050
1050
|
// ../explorer/outage-scenario.js
|
|
1051
|
-
function
|
|
1051
|
+
function qt(e, t) {
|
|
1052
1052
|
if (!e) return [];
|
|
1053
1053
|
let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Set();
|
|
1054
1054
|
for (let t of [...e.down, ...e.hits.keys()]) {
|
|
1055
1055
|
let e = n.get(t);
|
|
1056
|
-
e && r.add(e.type === "external" ?
|
|
1056
|
+
e && r.add(e.type === "external" ? m(e) : e.type);
|
|
1057
1057
|
}
|
|
1058
1058
|
return [...r];
|
|
1059
1059
|
}
|
|
1060
|
-
var
|
|
1061
|
-
function
|
|
1060
|
+
var Jt = 3, Yt = " (in the visitor's browser)";
|
|
1061
|
+
function Xt(e) {
|
|
1062
1062
|
if (e.length < 2) return e.join("");
|
|
1063
1063
|
let t = e.some((e) => e.includes(" and ")) ? ", and " : " and ";
|
|
1064
1064
|
return `${e.slice(0, -1).join(", ")}${t}${e[e.length - 1]}`;
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function Zt(e) {
|
|
1067
1067
|
let t = /* @__PURE__ */ new Map();
|
|
1068
1068
|
for (let n of e) t.has(n.type) || t.set(n.type, []), t.get(n.type).push(n);
|
|
1069
|
-
return
|
|
1070
|
-
let n =
|
|
1071
|
-
if (t.length >
|
|
1069
|
+
return Xt([...t].sort(([e, t], [n, r]) => r.length - t.length || L(e) - L(n) || e.localeCompare(n)).map(([e, t]) => {
|
|
1070
|
+
let n = le(e, t.length);
|
|
1071
|
+
if (t.length > Jt) {
|
|
1072
1072
|
let e = t.filter((e) => e.browser).length;
|
|
1073
|
-
return `${t.length} ${n}${e === t.length ?
|
|
1073
|
+
return `${t.length} ${n}${e === t.length ? Yt : e ? ` (${e} in the visitor's browser)` : ""}`;
|
|
1074
1074
|
}
|
|
1075
|
-
return `the ${n} ${
|
|
1075
|
+
return `the ${n} ${Xt(t.map((e) => `${e.label}${e.browser ? Yt : ""}`))}`;
|
|
1076
1076
|
}));
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1079
|
-
let r = new Map(t.map((e) => [e.id, e])), i = String(e.label || e.id), a =
|
|
1078
|
+
function Qt(e, t, n) {
|
|
1079
|
+
let r = new Map(t.map((e) => [e.id, e])), i = String(e.label || e.id), a = v([e.id], t, n), o = (e) => (t) => a.hits.has(t.id) && a.hits.get(t.id).when === e, s = new Map(pe(e, t, n).map((e) => [e.when, e.types.flatMap((e) => e.items).filter(o(e.when)).map((e) => ({
|
|
1080
1080
|
...e,
|
|
1081
1081
|
browser: a.hits.get(e.id).browser
|
|
1082
1082
|
}))])), c = [
|
|
@@ -1097,7 +1097,7 @@ function Zt(e, t, n) {
|
|
|
1097
1097
|
browser: a.hits.get(e).browser
|
|
1098
1098
|
};
|
|
1099
1099
|
}), c;
|
|
1100
|
-
c = n.length ? `${t.title}: ${
|
|
1100
|
+
c = n.length ? `${t.title}: ${Zt(n)}.${o.length ? ` Through ${n.length === 1 ? "it" : "them"}: ${Zt(o)}.` : ""}` : `${t.title}, through what uses it: ${Zt(o)}.`, l.push(n.length ? {
|
|
1101
1101
|
edge: {
|
|
1102
1102
|
from: n[0].id,
|
|
1103
1103
|
to: e.id,
|
|
@@ -1117,27 +1117,27 @@ function Zt(e, t, n) {
|
|
|
1117
1117
|
};
|
|
1118
1118
|
}
|
|
1119
1119
|
// ../explorer/scenario-list-model.js
|
|
1120
|
-
var
|
|
1120
|
+
var $ = (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
1121
|
function rn(e, t, n) {
|
|
1122
1122
|
let r = new Set([
|
|
1123
1123
|
"add",
|
|
1124
1124
|
"change",
|
|
1125
1125
|
"remove"
|
|
1126
|
-
].flatMap((e) =>
|
|
1127
|
-
for (let n of [...
|
|
1126
|
+
].flatMap((e) => $(n?.edges?.[e]).map(X))), i = (t) => (e.find((e) => e.id === t) || { label: t }).label || t, a = [];
|
|
1127
|
+
for (let n of [...oe, "edit"]) {
|
|
1128
1128
|
for (let t of e.filter((e) => e.mark === n)) a.push({
|
|
1129
1129
|
kind: "node",
|
|
1130
1130
|
key: t.id,
|
|
1131
1131
|
mark: n,
|
|
1132
|
-
word:
|
|
1132
|
+
word: fe[n],
|
|
1133
1133
|
name: String(t.label ?? t.id),
|
|
1134
1134
|
type: String(t.type ?? "")
|
|
1135
1135
|
});
|
|
1136
|
-
for (let e of t.filter((e) => e.mark === n && r.has(
|
|
1136
|
+
for (let e of t.filter((e) => e.mark === n && r.has(X(e)))) a.push({
|
|
1137
1137
|
kind: "edge",
|
|
1138
|
-
key:
|
|
1138
|
+
key: X(e),
|
|
1139
1139
|
mark: n,
|
|
1140
|
-
word:
|
|
1140
|
+
word: fe[n],
|
|
1141
1141
|
name: `${i(e.from)} → ${i(e.to)}`,
|
|
1142
1142
|
type: String(e.kind || "ownership")
|
|
1143
1143
|
});
|
|
@@ -1149,7 +1149,7 @@ function an(e) {
|
|
|
1149
1149
|
typeof e == "string" && e && !t.includes(e) && t.push(e);
|
|
1150
1150
|
};
|
|
1151
1151
|
n(e?.actor);
|
|
1152
|
-
for (let t of
|
|
1152
|
+
for (let t of $(e?.steps)) n(t?.actor);
|
|
1153
1153
|
return t;
|
|
1154
1154
|
}
|
|
1155
1155
|
function on(e, t = {}) {
|
|
@@ -1181,16 +1181,16 @@ function on(e, t = {}) {
|
|
|
1181
1181
|
};
|
|
1182
1182
|
}
|
|
1183
1183
|
function sn(e, t) {
|
|
1184
|
-
return
|
|
1184
|
+
return $(e.steps).map((n, r) => {
|
|
1185
1185
|
let i = n && n.actor || e.actor || null, a = "", o = "", s = [];
|
|
1186
1186
|
if (n && n.edge) {
|
|
1187
1187
|
a = `${t.label(n.edge.from)} → ${t.label(n.edge.to)}`, s = [
|
|
1188
|
-
`edge:${
|
|
1188
|
+
`edge:${X(n.edge)}`,
|
|
1189
1189
|
`node:${n.edge.from}`,
|
|
1190
1190
|
`node:${n.edge.to}`
|
|
1191
1191
|
];
|
|
1192
|
-
let e = t.edges.find((e) =>
|
|
1193
|
-
e && e.mark && e.mark !== "none" && t.changeKeys.has(`edge:${
|
|
1192
|
+
let e = t.edges.find((e) => X(e) === X(n.edge));
|
|
1193
|
+
e && e.mark && e.mark !== "none" && t.changeKeys.has(`edge:${X(e)}`) && (o = e.mark);
|
|
1194
1194
|
} else if (n && n.node !== void 0) {
|
|
1195
1195
|
a = t.label(n.node), s = [`node:${n.node}`];
|
|
1196
1196
|
let e = t.nodes.find((e) => e.id === n.node);
|
|
@@ -1204,7 +1204,7 @@ function sn(e, t) {
|
|
|
1204
1204
|
actorLabel: i ? t.personaLabel(i) : "",
|
|
1205
1205
|
where: a,
|
|
1206
1206
|
mark: o,
|
|
1207
|
-
markWord: o &&
|
|
1207
|
+
markWord: o && fe[o] || "",
|
|
1208
1208
|
text: String((n && n.text) ?? ""),
|
|
1209
1209
|
verdict: i ? c : null,
|
|
1210
1210
|
layerOff: l,
|
|
@@ -1228,7 +1228,7 @@ function ln({ snap: e, nodes: t, edges: n, words: r = {} }) {
|
|
|
1228
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
1229
|
if (i.edge) {
|
|
1230
1230
|
s = `${a(i.edge.from)} → ${a(i.edge.to)}`;
|
|
1231
|
-
let e = n.find((e) =>
|
|
1231
|
+
let e = n.find((e) => X(e) === X(i.edge));
|
|
1232
1232
|
e && e.mark && e.mark !== "none" && (c = e.mark);
|
|
1233
1233
|
} else if (i.node !== void 0) {
|
|
1234
1234
|
s = a(i.node);
|
|
@@ -1240,7 +1240,7 @@ function ln({ snap: e, nodes: t, edges: n, words: r = {} }) {
|
|
|
1240
1240
|
number: e.index + 1,
|
|
1241
1241
|
actorLabel: i.actor ? o ? nn(o) : String(i.actor) : "",
|
|
1242
1242
|
where: s,
|
|
1243
|
-
markWord: c &&
|
|
1243
|
+
markWord: c && fe[c] || "",
|
|
1244
1244
|
text: String(i.text ?? ""),
|
|
1245
1245
|
verdict: l
|
|
1246
1246
|
}, e.total);
|
|
@@ -1254,7 +1254,7 @@ function un(e) {
|
|
|
1254
1254
|
].filter(([e]) => e > 0).map(([e, t]) => `${e} ${t}`).join(" · ");
|
|
1255
1255
|
}
|
|
1256
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 =
|
|
1257
|
+
let c = $(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($(a?.played)), g = new Set($(a?.read)), _ = c.map((e, r) => {
|
|
1258
1258
|
let a = i && i.get(e.id), c = sn(e, {
|
|
1259
1259
|
nodes: t,
|
|
1260
1260
|
edges: n,
|
|
@@ -1341,8 +1341,8 @@ function hn(e, t) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
function gn(e, t, n, r, i = null) {
|
|
1343
1343
|
let a = i ? {
|
|
1344
|
-
played: [
|
|
1345
|
-
read: [
|
|
1344
|
+
played: [...$(i.played)],
|
|
1345
|
+
read: [...$(i.read)]
|
|
1346
1346
|
} : hn(e, t), o = String(n);
|
|
1347
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
1348
|
try {
|
|
@@ -1355,15 +1355,15 @@ var _n = 250, vn = 140;
|
|
|
1355
1355
|
function yn(e, t) {
|
|
1356
1356
|
let { state: n } = e;
|
|
1357
1357
|
if (!t || n.view === "dataflow" || n.view === "house") return [];
|
|
1358
|
-
let r =
|
|
1359
|
-
if (a === "root" ||
|
|
1360
|
-
let o =
|
|
1358
|
+
let r = P(n), i = (e) => r[e] !== !1, a = t.type;
|
|
1359
|
+
if (a === "root" || C(n, t)) return [];
|
|
1360
|
+
let o = x(n, t);
|
|
1361
1361
|
if (o) return i(o) ? [] : [o];
|
|
1362
1362
|
if (a === "core") return [...i("core") ? [] : ["core"], ...r.pkg || r.atom ? [] : ["pkg"]];
|
|
1363
1363
|
if (a === "store") return ["flow", "store"].filter((e) => !i(e));
|
|
1364
1364
|
if (a === "rom") return ["rom", "flow"].filter((e) => !i(e));
|
|
1365
1365
|
if (a === "floor" || a === "room") return i("house") ? [] : ["house"];
|
|
1366
|
-
let s = a === "external" ?
|
|
1366
|
+
let s = a === "external" ? m(t) : a;
|
|
1367
1367
|
return i(s) ? [] : [s];
|
|
1368
1368
|
}
|
|
1369
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));
|
|
@@ -1400,122 +1400,122 @@ function Cn(e, t) {
|
|
|
1400
1400
|
};
|
|
1401
1401
|
}
|
|
1402
1402
|
function wn(e, t, n) {
|
|
1403
|
-
let { state: r } = e, i = null, a = null,
|
|
1404
|
-
for (let e of [...
|
|
1403
|
+
let { state: r } = e, i = null, a = null, o = "", s = null, c = !1, u = -1, d = null, f = -1, p = null, m = null, h = null, _ = null, y = /* @__PURE__ */ new Set(), b = [], x = (t) => {
|
|
1404
|
+
for (let e of [...y]) e(t);
|
|
1405
1405
|
e.emit("scenario:player", t);
|
|
1406
1406
|
}, S = () => r.canvas ? r.canvas.parentElement : null, C = () => e.map.render();
|
|
1407
1407
|
function w() {
|
|
1408
1408
|
let t = e.active();
|
|
1409
1409
|
return t && t !== e.doc.body && !t.closest?.(".hx-player") && !t.closest?.("#review-column") && t !== r.canvas ? t : null;
|
|
1410
1410
|
}
|
|
1411
|
-
function
|
|
1411
|
+
function E() {
|
|
1412
1412
|
let t = e.active();
|
|
1413
1413
|
return !!t && t !== e.doc.body && !Sn(t);
|
|
1414
1414
|
}
|
|
1415
|
-
function
|
|
1416
|
-
let t =
|
|
1417
|
-
|
|
1415
|
+
function O() {
|
|
1416
|
+
let t = p;
|
|
1417
|
+
p = null;
|
|
1418
1418
|
let n = (t) => !t || !t.isConnected || t.hidden || t.disabled || t.closest("[hidden]") ? !1 : (t.focus(), e.active() === t);
|
|
1419
|
-
n(
|
|
1419
|
+
n(m && m()) || n(t) || n(r.canvas);
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1422
|
-
t && Array.isArray(t.down) && t.down.length &&
|
|
1423
|
-
|
|
1421
|
+
function k(t) {
|
|
1422
|
+
t && Array.isArray(t.down) && t.down.length && qt(v(t.down, r.nodes, r.edges), r.nodes).forEach((t) => {
|
|
1423
|
+
M(r, t) || Me(e, t, !0, { scenario: !0 });
|
|
1424
1424
|
});
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1426
|
+
function A(t) {
|
|
1427
1427
|
let n = new Map(r.nodes.map((e) => [e.id, e])), i = [];
|
|
1428
1428
|
for (let r of bn(t)) for (let t of yn(e, n.get(r))) i.includes(t) || i.push(t);
|
|
1429
1429
|
if (!i.length) return;
|
|
1430
|
-
for (let t of i)
|
|
1431
|
-
let a = i.map((e) => (
|
|
1432
|
-
|
|
1433
|
-
}
|
|
1434
|
-
function
|
|
1435
|
-
let o = w(), s =
|
|
1436
|
-
|
|
1437
|
-
let c = r.stepMs ??
|
|
1438
|
-
if (i =
|
|
1430
|
+
for (let t of i) Me(e, t, !0, { scenario: !0 });
|
|
1431
|
+
let a = i.map((e) => (ze.find((t) => t.key === e) || (r.projectLayers || []).find((t) => t.key === e) || { label: e }).label);
|
|
1432
|
+
N(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 j(t, r = {}) {
|
|
1435
|
+
let o = w(), s = E() && r.focus !== !1;
|
|
1436
|
+
P({ keepChecks: !0 }), p = o;
|
|
1437
|
+
let c = r.stepMs ?? H();
|
|
1438
|
+
if (i = Gt(t, {
|
|
1439
1439
|
stepMs: c,
|
|
1440
1440
|
maxFrameMs: _n
|
|
1441
|
-
}), Number.isFinite(r.step) && r.step > 0 && i.goTo(r.step),
|
|
1442
|
-
|
|
1443
|
-
}),
|
|
1441
|
+
}), Number.isFinite(r.step) && r.step > 0 && i.goTo(r.step), V(c), n.open(t, () => {
|
|
1442
|
+
I(), C();
|
|
1443
|
+
}), k(t), A(t), r.autoplay !== !1 && !(r.step > 0) && i.play(), I(!0), C(), e.map.ensureFlowLoop(), s && a) {
|
|
1444
1444
|
let e = a.querySelector("[data-action=scenario-toggle]");
|
|
1445
1445
|
e && !e.disabled ? e.focus() : a.querySelector("[data-action=scenario-next]")?.focus();
|
|
1446
1446
|
}
|
|
1447
1447
|
return i;
|
|
1448
1448
|
}
|
|
1449
|
-
function
|
|
1449
|
+
function ee(e) {
|
|
1450
1450
|
let t = r.nodes.find((t) => t.id === e);
|
|
1451
|
-
return !t || t.type !== "external" || t.kind !== "cloud" ? null :
|
|
1451
|
+
return !t || t.type !== "external" || t.kind !== "cloud" ? null : j(Qt(t, r.nodes, r.edges));
|
|
1452
1452
|
}
|
|
1453
|
-
function
|
|
1453
|
+
function P({ keepChecks: t = !1, closing: c = !1 } = {}) {
|
|
1454
1454
|
let l = !!i || !!r.scenario;
|
|
1455
|
-
l &&
|
|
1455
|
+
l && Re(e), i = null, s = null, o = "", r.scenario = null, t || n.close(), d &&= (d.disconnect(), null), a &&= (Se(e, "player"), b.forEach((e) => e()), b = [], n.unmount(), a.remove(), null), l && (!t || c) && x(null);
|
|
1456
1456
|
}
|
|
1457
|
-
function
|
|
1457
|
+
function F() {
|
|
1458
1458
|
if (!i && !r.scenario) return;
|
|
1459
1459
|
let t = e.active(), n = !!a && a.contains(t) || !!t?.closest?.("#review-column");
|
|
1460
|
-
|
|
1461
|
-
keepChecks: !!i && !!
|
|
1460
|
+
P({
|
|
1461
|
+
keepChecks: !!i && !!h && h(i.scenario().id),
|
|
1462
1462
|
closing: !0
|
|
1463
1463
|
}), e.touchScene(), C();
|
|
1464
1464
|
let o = e.active();
|
|
1465
|
-
n || !o || o === e.doc.body ?
|
|
1465
|
+
n || !o || o === e.doc.body ? O() : p = null;
|
|
1466
1466
|
}
|
|
1467
|
-
function
|
|
1467
|
+
function I(t = !1) {
|
|
1468
1468
|
if (!i) return !1;
|
|
1469
1469
|
let a = n.decorate(i.snapshot(), i.scenario());
|
|
1470
1470
|
r.scenario = a;
|
|
1471
|
-
let
|
|
1472
|
-
if (
|
|
1473
|
-
let n = t ||
|
|
1474
|
-
|
|
1471
|
+
let s = `${a.index}|${a.playing}|${a.done}|${a.stepStartMs}|${a.stepMs}|${a.manual}|${n.version()}`, l = t || s !== o;
|
|
1472
|
+
if (l) {
|
|
1473
|
+
let n = t || s.split("|")[0] !== o.split("|")[0];
|
|
1474
|
+
o = s, e.touchScene(), n && (c = !1, L(a));
|
|
1475
1475
|
}
|
|
1476
|
-
return
|
|
1476
|
+
return G(a), l && x({
|
|
1477
1477
|
id: a.id,
|
|
1478
1478
|
index: a.index,
|
|
1479
1479
|
total: a.total,
|
|
1480
1480
|
done: a.done,
|
|
1481
1481
|
playing: a.playing,
|
|
1482
1482
|
checks: n.version()
|
|
1483
|
-
}),
|
|
1483
|
+
}), l;
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function L(t) {
|
|
1486
1486
|
let n = /* @__PURE__ */ new Map();
|
|
1487
1487
|
r.nodes.forEach((t) => {
|
|
1488
1488
|
e.map.isNodeVisible(t) && n.set(t.id, t);
|
|
1489
1489
|
});
|
|
1490
|
-
let i =
|
|
1490
|
+
let i = T(e);
|
|
1491
1491
|
u = a ? a.offsetHeight : 0;
|
|
1492
|
-
let o =
|
|
1492
|
+
let o = Kt({
|
|
1493
1493
|
node: t.current.node,
|
|
1494
1494
|
edge: t.current.edge,
|
|
1495
1495
|
at: t.current.at,
|
|
1496
1496
|
text: t.current.text
|
|
1497
1497
|
}, r.camera, i, n, 60, e.map.getMinZoom());
|
|
1498
|
-
o && (e.reducedMotion ? (Object.assign(r.camera, o),
|
|
1498
|
+
o && (e.reducedMotion ? (Object.assign(r.camera, o), s = null, C()) : (s = {
|
|
1499
1499
|
to: o,
|
|
1500
1500
|
last: null
|
|
1501
1501
|
}, e.map.ensureFlowLoop()));
|
|
1502
1502
|
}
|
|
1503
|
-
function
|
|
1504
|
-
if (!
|
|
1505
|
-
let t =
|
|
1506
|
-
|
|
1503
|
+
function R(e) {
|
|
1504
|
+
if (!s) return;
|
|
1505
|
+
let t = s.last === null ? 16 : Math.min(e - s.last, 100);
|
|
1506
|
+
s.last = e;
|
|
1507
1507
|
let n = 1 - Math.exp(-t / vn), i = r.camera;
|
|
1508
|
-
i.x += (
|
|
1508
|
+
i.x += (s.to.x - i.x) * n, i.y += (s.to.y - i.y) * n, i.zoom += (s.to.zoom - i.zoom) * n, Math.abs(s.to.x - i.x) < .5 && Math.abs(s.to.y - i.y) < .5 && Math.abs(s.to.zoom - i.zoom) < .002 && (Object.assign(i, s.to), s = null);
|
|
1509
1509
|
}
|
|
1510
|
-
let
|
|
1511
|
-
function
|
|
1512
|
-
i && (i.tick(e),
|
|
1510
|
+
let z = () => !!i && (i.isPlaying() || !!s);
|
|
1511
|
+
function B(e) {
|
|
1512
|
+
i && (i.tick(e), I(), R(e));
|
|
1513
1513
|
}
|
|
1514
1514
|
t.own(e.map.addFrameClient({
|
|
1515
|
-
wants:
|
|
1516
|
-
tick:
|
|
1515
|
+
wants: z,
|
|
1516
|
+
tick: B
|
|
1517
1517
|
}));
|
|
1518
|
-
function
|
|
1518
|
+
function V(t) {
|
|
1519
1519
|
let n = S();
|
|
1520
1520
|
if (!n) return;
|
|
1521
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 = `
|
|
@@ -1529,54 +1529,54 @@ function wn(e, t, n) {
|
|
|
1529
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
1530
|
<span class="hx-player-says hx-sr-only" role="status" aria-live="polite"></span>
|
|
1531
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">${
|
|
1532
|
+
<select data-corn="control" class="hx-player-speed" data-action="scenario-speed" aria-label="Time for each step" title="Time for each step">${zt.map((e) => `<option value="${l(String(e.value))}">${l(e.label)}</option>`).join("")}</select>
|
|
1533
1533
|
<button type="button" class="hx-close" data-action="scenario-close" aria-label="Close the scenario" data-corn-kind="icon">✕</button>
|
|
1534
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>`,
|
|
1536
|
-
let
|
|
1535
|
+
<div class="hx-player-track" data-corn="scenario-track" aria-hidden="true"><span class="hx-player-fill" data-corn="scenario-fill"></span></div>`, g(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 o = (e) => {
|
|
1537
1537
|
let t = e.target.closest("[data-action]");
|
|
1538
|
-
t &&
|
|
1539
|
-
},
|
|
1540
|
-
p.addEventListener("click",
|
|
1541
|
-
p.removeEventListener("click",
|
|
1538
|
+
t && W(t.dataset.action);
|
|
1539
|
+
}, s = a.querySelector(".hx-player-speed"), f = (e) => U(e.target.value), p = a;
|
|
1540
|
+
p.addEventListener("click", o), s.value = String(t), s.addEventListener("change", f), b.push(() => {
|
|
1541
|
+
p.removeEventListener("click", o), s.removeEventListener("change", f);
|
|
1542
1542
|
});
|
|
1543
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),
|
|
1545
|
-
let
|
|
1546
|
-
typeof
|
|
1547
|
-
a && i && r.scenario && !
|
|
1548
|
-
}),
|
|
1544
|
+
m && h && h.parentElement === m ? m.insertBefore(a, h) : (m || n).appendChild(a), xe(e, "player", a), ke(e);
|
|
1545
|
+
let _ = e.win && e.win.ResizeObserver;
|
|
1546
|
+
typeof _ == "function" && (d = new _(() => {
|
|
1547
|
+
a && i && r.scenario && !c && a.offsetHeight !== u && L(i.snapshot());
|
|
1548
|
+
}), d.observe(a));
|
|
1549
1549
|
}
|
|
1550
|
-
let
|
|
1551
|
-
function
|
|
1552
|
-
let n =
|
|
1553
|
-
e.store.set(
|
|
1550
|
+
let H = () => Bt(e.store.get(Rt));
|
|
1551
|
+
function U(t) {
|
|
1552
|
+
let n = Bt(t);
|
|
1553
|
+
e.store.set(Rt, String(n)), i && (i.setSpeed(n), I(), C(), e.map.ensureFlowLoop());
|
|
1554
1554
|
}
|
|
1555
|
-
function
|
|
1555
|
+
function W(t) {
|
|
1556
1556
|
if (i) {
|
|
1557
|
-
if (t === "scenario-close") return
|
|
1557
|
+
if (t === "scenario-close") return F();
|
|
1558
1558
|
if (t === "scenario-next-scenario") {
|
|
1559
1559
|
let e = _ ? _(i.scenario().id) : null;
|
|
1560
|
-
e &&
|
|
1560
|
+
e && j(e);
|
|
1561
1561
|
} else {
|
|
1562
1562
|
if (t === "scenario-toggle") {
|
|
1563
1563
|
let t = i.snapshot();
|
|
1564
|
-
t.playing ? i.pause() : i.play(),
|
|
1564
|
+
t.playing ? i.pause() : i.play(), N(e, t.playing ? "Paused" : t.done ? "Playing again" : t.index > 0 || t.progress > 0 ? "Resumed" : "Playing");
|
|
1565
1565
|
} else if (t === "scenario-prev") i.prev();
|
|
1566
1566
|
else if (t === "scenario-next") i.next();
|
|
1567
1567
|
else return;
|
|
1568
|
-
|
|
1568
|
+
I(), C(), e.map.ensureFlowLoop();
|
|
1569
1569
|
}
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
function
|
|
1572
|
+
function G(t) {
|
|
1573
1573
|
if (!a) return;
|
|
1574
1574
|
let i = (e) => a.querySelector(e), o = (e, t) => {
|
|
1575
1575
|
let n = i(e);
|
|
1576
1576
|
n.textContent !== t && (n.textContent = t);
|
|
1577
1577
|
};
|
|
1578
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 ?
|
|
1579
|
+
let s = t.current.actor ? Ct(xt(r.nodes, t.current.actor)) || t.current.actor : "";
|
|
1580
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
1581
|
let c = i("[data-action=scenario-toggle]");
|
|
1582
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;
|
|
@@ -1590,23 +1590,23 @@ function wn(e, t, n) {
|
|
|
1590
1590
|
words: { notChecked: D(e, "notChecked") }
|
|
1591
1591
|
}));
|
|
1592
1592
|
let d = t.total ? Math.round((t.done ? t.total : t.index + t.progress) / t.total * 1e3) / 10 : 0;
|
|
1593
|
-
d !==
|
|
1593
|
+
d !== f && (f = d, i(".hx-player-fill").style.width = `${d}%`), n.paint(a, t);
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function K() {
|
|
1596
1596
|
return !!e.root.querySelector("#legend-dropdown:not([hidden]), #proposal-more-menu:not([hidden]), [data-corn=\"dialog-scrim\"]:not([hidden]), .hx-mockup-dialog");
|
|
1597
1597
|
}
|
|
1598
1598
|
t.listen(e.root, "keydown", (e) => {
|
|
1599
|
-
if (e.key === "Escape" && !e.defaultPrevented && !e.ctrlKey && !e.metaKey && !e.altKey && i && !Sn(e.target) && !
|
|
1600
|
-
e.preventDefault(),
|
|
1599
|
+
if (e.key === "Escape" && !e.defaultPrevented && !e.ctrlKey && !e.metaKey && !e.altKey && i && !Sn(e.target) && !K()) {
|
|
1600
|
+
e.preventDefault(), F();
|
|
1601
1601
|
return;
|
|
1602
1602
|
}
|
|
1603
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
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(),
|
|
1605
|
+
t && (e.preventDefault(), W(t));
|
|
1606
1606
|
}), t.listen(e.root, "keyup", (e) => {
|
|
1607
1607
|
i && (e.key === " " || e.code === "Space") && !Sn(e.target) && e.preventDefault();
|
|
1608
|
-
}), t.own(
|
|
1609
|
-
i && r.scenario &&
|
|
1608
|
+
}), t.own(Ee(e, () => {
|
|
1609
|
+
i && r.scenario && L(i.snapshot());
|
|
1610
1610
|
}));
|
|
1611
1611
|
for (let n of [
|
|
1612
1612
|
"pointerdown",
|
|
@@ -1614,60 +1614,60 @@ function wn(e, t, n) {
|
|
|
1614
1614
|
"touchstart",
|
|
1615
1615
|
"mousedown"
|
|
1616
1616
|
]) t.listen(e.root, n, (e) => {
|
|
1617
|
-
e.target === r.canvas && (
|
|
1617
|
+
e.target === r.canvas && (s = null, c = !0);
|
|
1618
1618
|
}, {
|
|
1619
1619
|
passive: !0,
|
|
1620
1620
|
capture: !0
|
|
1621
1621
|
});
|
|
1622
|
-
return t.on("scenario:clear", () =>
|
|
1623
|
-
|
|
1622
|
+
return t.on("scenario:clear", () => P()), t.own(() => {
|
|
1623
|
+
P({ keepChecks: !1 }), y.clear();
|
|
1624
1624
|
}), {
|
|
1625
|
-
play:
|
|
1626
|
-
stop:
|
|
1627
|
-
clear:
|
|
1628
|
-
tick:
|
|
1629
|
-
playOutage:
|
|
1625
|
+
play: j,
|
|
1626
|
+
stop: F,
|
|
1627
|
+
clear: P,
|
|
1628
|
+
tick: B,
|
|
1629
|
+
playOutage: ee,
|
|
1630
1630
|
getPlayer: () => i,
|
|
1631
1631
|
bar: () => a,
|
|
1632
|
-
wantsFrames:
|
|
1632
|
+
wantsFrames: z,
|
|
1633
1633
|
onChange(e) {
|
|
1634
|
-
return
|
|
1634
|
+
return y.add(e), () => y.delete(e);
|
|
1635
1635
|
},
|
|
1636
1636
|
setCloseFocus(e) {
|
|
1637
|
-
|
|
1637
|
+
m = typeof e == "function" ? e : null;
|
|
1638
1638
|
},
|
|
1639
1639
|
setNextScenario(e) {
|
|
1640
1640
|
_ = typeof e == "function" ? e : null;
|
|
1641
1641
|
},
|
|
1642
1642
|
setKeepChecksOnClose(e) {
|
|
1643
|
-
|
|
1643
|
+
h = typeof e == "function" ? e : null;
|
|
1644
1644
|
},
|
|
1645
1645
|
demo(e = !0) {
|
|
1646
1646
|
if (!e) return !1;
|
|
1647
1647
|
let t = Cn(r.nodes, r.edges);
|
|
1648
|
-
return t ? (
|
|
1648
|
+
return t ? (j(t), !0) : (console.warn("scenario-demo: the map has none of the nodes the demo walks over"), !1);
|
|
1649
1649
|
}
|
|
1650
1650
|
};
|
|
1651
1651
|
}
|
|
1652
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) => `${
|
|
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) => `${l(e)}<span aria-hidden="true"> · </span><span class="hx-sr-only">, </span><span data-corn="count">${t}</span>`;
|
|
1654
1654
|
function kn(e) {
|
|
1655
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="${
|
|
1656
|
+
return `<li><button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="${e.kind}" data-key="${l(e.key)}" data-focus-key="ch:${l(e.kind)}:${l(e.key)}" data-corn="row" aria-label="${l(t)}"><span class="hx-mark-dot hx-mark-dot--${e.mark}" data-corn="mark-dot"${U(e.mark)} aria-hidden="true"></span><span class="hx-change-what">${l(e.word)}</span><span class="hx-name">${l(e.name)}</span><span class="hx-faint">${l(e.type)}</span></button></li>`;
|
|
1657
1657
|
}
|
|
1658
1658
|
function An(e, t, n = {}) {
|
|
1659
|
-
let { state: r } = t, i =
|
|
1660
|
-
for (let t of
|
|
1659
|
+
let { state: r } = t, i = a(t), s = o(t, e, Dn().column, n.slots, "column"), c = (e) => {
|
|
1660
|
+
for (let t of s) {
|
|
1661
1661
|
if (t.id === e) return t;
|
|
1662
1662
|
let n = t.querySelector(`[id="${e}"]`);
|
|
1663
1663
|
if (n) return n;
|
|
1664
1664
|
}
|
|
1665
1665
|
return null;
|
|
1666
1666
|
};
|
|
1667
|
-
i.keepParts(...
|
|
1668
|
-
let
|
|
1669
|
-
i.own(() =>
|
|
1670
|
-
let
|
|
1667
|
+
i.keepParts(...s);
|
|
1668
|
+
let u = c("review-column"), d = !1, f = It(t, { checker: n.checker }), p = wn(t, i, f);
|
|
1669
|
+
i.own(() => f.close());
|
|
1670
|
+
let m = {
|
|
1671
1671
|
checks: 0,
|
|
1672
1672
|
open: null,
|
|
1673
1673
|
tab: null,
|
|
@@ -1684,238 +1684,238 @@ function An(e, t, n = {}) {
|
|
|
1684
1684
|
},
|
|
1685
1685
|
seenFor: "",
|
|
1686
1686
|
pending: []
|
|
1687
|
-
},
|
|
1687
|
+
}, h = {
|
|
1688
1688
|
getItem: (e) => t.store.get(e),
|
|
1689
1689
|
setItem: (e, n) => t.store.set(e, n)
|
|
1690
|
-
},
|
|
1691
|
-
(
|
|
1692
|
-
let
|
|
1690
|
+
}, _ = t.store.get(Tn);
|
|
1691
|
+
(_ === "changes" || _ === "scenarios") && (m.tab = _);
|
|
1692
|
+
let v = () => {
|
|
1693
1693
|
let e = r.effectiveProposal || r.proposal;
|
|
1694
1694
|
return e && Array.isArray(e.scenarios) ? e.scenarios : [];
|
|
1695
|
-
},
|
|
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
|
-
}
|
|
1695
|
+
}, y = () => `${r.proposalSource || ""}/${r.proposalSlug || ""}`;
|
|
1699
1696
|
function b() {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1697
|
+
return W(r.proposalSource) ? m.headFor === y() && m.head ? mn(r.proposalSource, r.proposalSlug, m.head) : null : mn(r.proposalSource, r.proposalSlug, "");
|
|
1698
|
+
}
|
|
1699
|
+
function x() {
|
|
1700
|
+
let e = b(), t = e || `pending:${y()}`;
|
|
1701
|
+
if (m.seenFor === t) return;
|
|
1702
|
+
let n = m.seenFor;
|
|
1703
|
+
if (m.seenFor = t, !e) m.seen = {
|
|
1704
1704
|
played: [],
|
|
1705
1705
|
read: []
|
|
1706
|
-
},
|
|
1706
|
+
}, m.pending = [];
|
|
1707
1707
|
else {
|
|
1708
|
-
if (
|
|
1709
|
-
|
|
1708
|
+
if (m.seen = hn(h, e), n === `pending:${y()}`) for (let [t, n] of m.pending) m.seen = gn(h, e, t, n);
|
|
1709
|
+
m.pending = [];
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
|
-
function
|
|
1713
|
-
|
|
1712
|
+
function C(e, t) {
|
|
1713
|
+
x(), m.seenFor.startsWith("pending:") ? (m.pending.push([String(e), t]), m.seen = gn(null, "", e, t, m.seen)) : m.seen = gn(h, m.seenFor, e, t);
|
|
1714
1714
|
}
|
|
1715
|
-
function
|
|
1715
|
+
function w(e) {
|
|
1716
1716
|
let t = typeof e == "string" ? e : "";
|
|
1717
|
-
(t !==
|
|
1717
|
+
(t !== m.head || m.headFor !== y()) && (m.head = t, m.headFor = y(), r.proposal && R());
|
|
1718
1718
|
}
|
|
1719
|
-
function
|
|
1720
|
-
|
|
1721
|
-
let e = /* @__PURE__ */ new Map(), n =
|
|
1722
|
-
n !== null && e.set(n,
|
|
1719
|
+
function T() {
|
|
1720
|
+
x();
|
|
1721
|
+
let e = /* @__PURE__ */ new Map(), n = f.checkedScenarioId();
|
|
1722
|
+
n !== null && e.set(n, f.verdicts());
|
|
1723
1723
|
let i = r.effectiveProposal || r.proposal, a = { notChecked: D(t, "notChecked") }, o = new Map(r.nodes.map((e) => [e.id, e]));
|
|
1724
1724
|
return dn({
|
|
1725
|
-
scenarios:
|
|
1725
|
+
scenarios: v(),
|
|
1726
1726
|
nodes: r.nodes,
|
|
1727
1727
|
edges: r.edges,
|
|
1728
1728
|
proposal: i,
|
|
1729
1729
|
verdicts: e,
|
|
1730
|
-
seen:
|
|
1730
|
+
seen: m.seen,
|
|
1731
1731
|
words: a,
|
|
1732
1732
|
hidden: (e) => o.has(e) && yn(t, o.get(e)).length > 0
|
|
1733
1733
|
});
|
|
1734
1734
|
}
|
|
1735
|
-
let
|
|
1736
|
-
function
|
|
1735
|
+
let E = (e) => rn(r.nodes, r.edges, e).filter((e) => e.mark !== "edit");
|
|
1736
|
+
function O(e) {
|
|
1737
1737
|
let t = r.effectiveProposal || r.proposal;
|
|
1738
|
-
return pn(e,
|
|
1738
|
+
return pn(e, E(t).length, T());
|
|
1739
1739
|
}
|
|
1740
|
-
function
|
|
1740
|
+
function k() {
|
|
1741
1741
|
let e = r.effectiveProposal || r.proposal;
|
|
1742
|
-
return fn(
|
|
1742
|
+
return fn(E(e).length, T());
|
|
1743
1743
|
}
|
|
1744
1744
|
function A(e, t, n, r) {
|
|
1745
|
-
let i =
|
|
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="${
|
|
1745
|
+
let i = m.current && m.current.index === e.index && m.current.step === t.index && m.current.id === e.id, a = t.verdict ? `<span class="hx-step-verdict" data-corn="state-pill" data-tone="${l(t.verdict.tone)}"${t.verdict.state ? ` data-corn-state="${t.verdict.state}"` : ""}>${l(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"${U(t.mark)} aria-hidden="true"></span>${l(t.markWord)}</span>` : "", s = t.actorLabel ? `<span class="hx-step-who">As ${l(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="${l(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">${l(t.where)}</span>${o}${t.layerOff ? "<span class=\"hx-step-off\">Layer off: shown when played</span>" : ""}</span><span class="hx-step-text">${l(t.text)}</span></span>${a}</button></li>`;
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1749
|
-
let r =
|
|
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">${
|
|
1748
|
+
function M(e, n) {
|
|
1749
|
+
let r = m.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 ? ` · ${l(e.verdictSummary)}` : "", s = r && B(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">${l(e.title)}</span><span class="hx-sc-meta">${l(e.summary)}${o}</span></span>${a}</button>${s}<ol class="hx-steps" id="${i}" data-corn="step-list" aria-label="${l(D(t, "steps"))}: ${l(e.title)}"${r ? "" : " hidden"}>${r ? e.steps.map((t) => A(e, t, n, e.steps.length)).join("") : ""}</ol></li>`;
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1753
|
-
let n = e.scenarios.length, r = e.anyone ? D(t, "anyone") : e.label, i = `${
|
|
1754
|
-
return `<div class="hx-persona" data-corn="persona-group" data-persona="${
|
|
1752
|
+
function N(e) {
|
|
1753
|
+
let n = e.scenarios.length, r = e.anyone ? D(t, "anyone") : e.label, i = `${l(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="${l(e.key)}"><h4 class="hx-persona-name">${i}</h4><ul class="hx-sc-list">${e.scenarios.map((t) => M(t, e)).join("")}</ul></div>`;
|
|
1755
1755
|
}
|
|
1756
|
-
function
|
|
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 =
|
|
1758
|
-
|
|
1759
|
-
let c =
|
|
1760
|
-
return o.total ? (p = o.groups.map(
|
|
1756
|
+
function ee() {
|
|
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 = T(), s = S(t);
|
|
1758
|
+
m.tabFor !== y() && (m.tabFor = y(), m.tabNow = o.total ? m.tab || "scenarios" : "changes");
|
|
1759
|
+
let c = m.tabNow || "changes", u = r.nodes.some((e) => e.type === "persona"), d = `<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}">${l(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}">${l(D(t, "scenarios"))} · ${o.total}</button></div>`, f = `<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(N).join(""), u || (p += `<p class="hx-faint hx-rc-note">This map has no personas (topology.personas.json), so every scenario is listed under ${l(D(t, "anyone"))}.</p>`), o.coverage && (p += `<p class="hx-rc-coverage" data-corn="notice">${l(D(t, "notInAnyScenario"))}: ${o.notInAny.map(l).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>", `${d}${f}${`<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
1761
|
}
|
|
1762
1762
|
function P() {
|
|
1763
1763
|
let e = t.el("sheet-dock"), n = t.el("proposal-body");
|
|
1764
|
-
if (
|
|
1764
|
+
if (S(t) && n) u.parentElement !== n && n.appendChild(u);
|
|
1765
1765
|
else if (e) {
|
|
1766
1766
|
let n = t.el("proposal-bar");
|
|
1767
|
-
n &&
|
|
1767
|
+
n && u.parentElement !== e && n.after(u);
|
|
1768
1768
|
}
|
|
1769
|
-
return
|
|
1769
|
+
return u;
|
|
1770
1770
|
}
|
|
1771
1771
|
function F() {
|
|
1772
1772
|
let e = t.el("proposal-bar");
|
|
1773
|
-
!e ||
|
|
1773
|
+
!e || S(t) || e.hidden || u.style.setProperty("--hx-column-top", `${Math.round(e.offsetTop + e.offsetHeight + 8)}px`);
|
|
1774
1774
|
}
|
|
1775
1775
|
function I() {
|
|
1776
|
-
if (
|
|
1776
|
+
if (d) return;
|
|
1777
1777
|
P();
|
|
1778
1778
|
let e = !!r.proposal;
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
1781
|
-
let e =
|
|
1779
|
+
if (u.hidden = !e, !e) {
|
|
1780
|
+
m.open = null, m.current = null, m.lastStep = null, V();
|
|
1781
|
+
let e = c("review-lists");
|
|
1782
1782
|
e && (e.innerHTML = "");
|
|
1783
|
-
} else
|
|
1783
|
+
} else R(), F();
|
|
1784
1784
|
}
|
|
1785
1785
|
function L() {
|
|
1786
|
-
let e =
|
|
1787
|
-
if (!e || !n ||
|
|
1786
|
+
let e = c("review-lists"), n = c("rc-scenarios");
|
|
1787
|
+
if (!e || !n || u.hidden || S(t)) return;
|
|
1788
1788
|
let r = e.clientHeight;
|
|
1789
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"),
|
|
1791
|
-
|
|
1792
|
-
}
|
|
1793
|
-
function
|
|
1794
|
-
let e =
|
|
1795
|
-
if (
|
|
1796
|
-
|
|
1797
|
-
let n =
|
|
1798
|
-
n &&
|
|
1799
|
-
let i = t.active(), a = i && e.contains(i) && i.getAttribute ? i.getAttribute("data-focus-key") : null,
|
|
1800
|
-
e.innerHTML =
|
|
1801
|
-
let
|
|
1802
|
-
if (
|
|
1790
|
+
let i = parseFloat(t.win.getComputedStyle(e).rowGap) || 0, a = n.querySelector(".hx-rc-h"), o = n.querySelector(".hx-rc-sbody"), s = Math.ceil((a ? a.offsetHeight + (parseFloat(t.win.getComputedStyle(a).marginBottom) || 0) : 0) + (o ? o.scrollHeight : 0));
|
|
1791
|
+
u.style.setProperty("--hx-scenarios-need", `${s}px`), u.style.setProperty("--hx-changes-max", `${Math.floor(Math.max(.4 * r, r - s - i))}px`);
|
|
1792
|
+
}
|
|
1793
|
+
function R() {
|
|
1794
|
+
let e = c("review-lists");
|
|
1795
|
+
if (d || !e || !r.proposal) return;
|
|
1796
|
+
m.openFor !== y() && (m.openFor = y(), p.getPlayer() || (m.open = null, m.current = null, m.lastStep = null)), m.open !== null && !v().some((e) => e.id === m.open) && (m.open = null);
|
|
1797
|
+
let n = m.open !== null && !p.getPlayer() ? v().find((e) => e.id === m.open) : null;
|
|
1798
|
+
n && f.checkedScenarioId() === n.id && f.open(n, () => R());
|
|
1799
|
+
let i = t.active(), a = i && e.contains(i) && i.getAttribute ? i.getAttribute("data-focus-key") : null, o = e.scrollTop;
|
|
1800
|
+
e.innerHTML = ee(), g(e);
|
|
1801
|
+
let s = r.proposal, l = c("proposal-summary");
|
|
1802
|
+
if (l.textContent = s && typeof s.summary == "string" && s.summary || "", l.hidden = !l.textContent, e.scrollTop = o, t.emit("changes:peek", k()), a) {
|
|
1803
1803
|
let t = [...e.querySelectorAll("[data-focus-key]")].find((e) => e.getAttribute("data-focus-key") === a);
|
|
1804
1804
|
t && t.focus();
|
|
1805
1805
|
}
|
|
1806
1806
|
L(), t.emit("changes:paint");
|
|
1807
1807
|
}
|
|
1808
|
-
let
|
|
1809
|
-
let t =
|
|
1808
|
+
let z = (e) => v()[Number(e.dataset.scenarioIndex)] || null, B = (e) => {
|
|
1809
|
+
let t = p.getPlayer();
|
|
1810
1810
|
return !!t && t.scenario().id !== e;
|
|
1811
1811
|
};
|
|
1812
|
-
function
|
|
1813
|
-
|
|
1812
|
+
function V() {
|
|
1813
|
+
p.getPlayer() || f.close();
|
|
1814
1814
|
}
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1815
|
+
function H(e) {
|
|
1816
|
+
m.open === e.id ? (m.open = null, p.getPlayer() || f.close()) : (m.open = e.id, C(e.id, "read"), B(e.id) || f.open(e, () => R())), R();
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1819
|
-
|
|
1818
|
+
function G(e, n) {
|
|
1819
|
+
m.open = e.id;
|
|
1820
1820
|
let i = t.el("spec-drawer"), a = r.canvas && r.canvas.parentElement;
|
|
1821
|
-
!
|
|
1821
|
+
!S(t) && i && i.classList.contains("drawer-open") && a && a.clientWidth < En && j(t, { source: "api" }), p.play(e, {
|
|
1822
1822
|
autoplay: !1,
|
|
1823
1823
|
step: n,
|
|
1824
|
-
focus:
|
|
1825
|
-
}),
|
|
1824
|
+
focus: S(t)
|
|
1825
|
+
}), R();
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1828
|
-
|
|
1827
|
+
function K(e, { focus: n = !1 } = {}) {
|
|
1828
|
+
m.tab = e, m.tabNow = e, m.tabFor = y(), t.store.set(Tn, e), R(), n && c(`rc-tab-${e}`)?.focus();
|
|
1829
1829
|
}
|
|
1830
|
-
function
|
|
1830
|
+
function q(e) {
|
|
1831
1831
|
if (!r.proposal) return;
|
|
1832
|
-
|
|
1833
|
-
let n =
|
|
1832
|
+
S(t) && (K(e), De(t, "proposal"));
|
|
1833
|
+
let n = c(e === "scenarios" ? "rc-scenarios" : "rc-changes"), i = c(e === "scenarios" ? "rc-scenarios-h" : "rc-changes-h");
|
|
1834
1834
|
n && typeof n.scrollIntoView == "function" && n.scrollIntoView({ block: "start" }), i && i.focus();
|
|
1835
1835
|
}
|
|
1836
|
-
i.listen(
|
|
1836
|
+
i.listen(u, "click", (e) => {
|
|
1837
1837
|
let n = e.target.closest ? e.target.closest("[data-action]") : null;
|
|
1838
1838
|
if (!n) return;
|
|
1839
1839
|
let r = n.dataset.action;
|
|
1840
1840
|
if (r === "scenario-open") {
|
|
1841
|
-
let e =
|
|
1842
|
-
e &&
|
|
1841
|
+
let e = z(n);
|
|
1842
|
+
e && H(e);
|
|
1843
1843
|
} else if (r === "scenario-step") {
|
|
1844
|
-
let e =
|
|
1845
|
-
e &&
|
|
1846
|
-
} else r === "review-tab" ?
|
|
1847
|
-
}), i.listen(
|
|
1844
|
+
let e = z(n);
|
|
1845
|
+
e && G(e, Number(n.dataset.stepIndex));
|
|
1846
|
+
} else r === "review-tab" ? K(n.dataset.tab, { focus: !1 }) : r === "proposal-focus" && st(t, n.dataset.kind, n.dataset.key);
|
|
1847
|
+
}), i.listen(u, "keydown", (e) => {
|
|
1848
1848
|
let t = e.target.closest ? e.target.closest("[role=\"tab\"]") : null;
|
|
1849
1849
|
t && [
|
|
1850
1850
|
"ArrowLeft",
|
|
1851
1851
|
"ArrowRight",
|
|
1852
1852
|
"Home",
|
|
1853
1853
|
"End"
|
|
1854
|
-
].includes(e.key) && (e.preventDefault(),
|
|
1854
|
+
].includes(e.key) && (e.preventDefault(), K(t.dataset.tab === "changes" ? "scenarios" : "changes", { focus: !0 }));
|
|
1855
1855
|
});
|
|
1856
|
-
function
|
|
1856
|
+
function te(e) {
|
|
1857
1857
|
if (!e) {
|
|
1858
|
-
let e =
|
|
1859
|
-
e &&
|
|
1858
|
+
let e = m.open !== null && r.proposal && m.openFor === y() ? v().find((e) => e.id === m.open) : null;
|
|
1859
|
+
e && f.open(e, () => R()), (m.current || e) && (m.current = null, R());
|
|
1860
1860
|
return;
|
|
1861
1861
|
}
|
|
1862
|
-
let t =
|
|
1862
|
+
let t = v().findIndex((t) => t.id === e.id), n = {
|
|
1863
1863
|
id: e.id,
|
|
1864
1864
|
index: t,
|
|
1865
1865
|
step: Math.min(e.index, Math.max(e.total - 1, 0))
|
|
1866
1866
|
};
|
|
1867
|
-
|
|
1868
|
-
let i =
|
|
1869
|
-
|
|
1867
|
+
m.lastStep = n, e.done && (x(), m.seen.played.includes(e.id) || C(e.id, "played"));
|
|
1868
|
+
let i = m.current && m.current.id === n.id && m.current.step === n.step;
|
|
1869
|
+
m.current = n, m.open !== e.id && (m.open = e.id), (!i || e.done || e.checks !== m.checks) && (m.checks = e.checks, R());
|
|
1870
1870
|
}
|
|
1871
|
-
function
|
|
1872
|
-
let e =
|
|
1871
|
+
function J() {
|
|
1872
|
+
let e = m.lastStep;
|
|
1873
1873
|
if (!e) return null;
|
|
1874
|
-
|
|
1875
|
-
let n =
|
|
1874
|
+
S(t) && De(t, "proposal");
|
|
1875
|
+
let n = c("review-lists");
|
|
1876
1876
|
return n ? n.querySelector(`[data-action="scenario-step"][data-scenario-index="${e.index}"][data-step-index="${e.step}"]`) : null;
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function ne(e) {
|
|
1879
1879
|
let t = [];
|
|
1880
|
-
for (let e of
|
|
1880
|
+
for (let e of T().groups) for (let n of e.scenarios) t.includes(n.id) || t.push(n.id);
|
|
1881
1881
|
let n = t.indexOf(e), r = n >= 0 ? t[n + 1] : void 0;
|
|
1882
|
-
return r === void 0 ? null :
|
|
1883
|
-
}
|
|
1884
|
-
i.own(
|
|
1885
|
-
r.proposal &&
|
|
1886
|
-
})), i.on("proposal:draw", () => I()), i.on("proposal:pull-head", (e) =>
|
|
1887
|
-
let
|
|
1888
|
-
if (e && typeof
|
|
1889
|
-
let n = new
|
|
1882
|
+
return r === void 0 ? null : v().find((e) => String(e.id) === r) || null;
|
|
1883
|
+
}
|
|
1884
|
+
i.own(p.onChange(te)), p.setCloseFocus(J), p.setNextScenario(ne), p.setKeepChecksOnClose((e) => m.open === e && !!r.proposal), i.own(Ae(t, () => {
|
|
1885
|
+
r.proposal && R();
|
|
1886
|
+
})), i.on("proposal:draw", () => I()), i.on("proposal:pull-head", (e) => w(e)), i.on("changes:show", (e) => q(e));
|
|
1887
|
+
let re = t.win && t.win.ResizeObserver, ie = (e, t) => {
|
|
1888
|
+
if (e && typeof re == "function") {
|
|
1889
|
+
let n = new re(t);
|
|
1890
1890
|
n.observe(e), i.own(() => n.disconnect());
|
|
1891
1891
|
}
|
|
1892
1892
|
};
|
|
1893
|
-
return
|
|
1893
|
+
return ie(t.el("proposal-bar"), () => F()), ie(u, () => L()), i.own(Oe(t, () => {
|
|
1894
1894
|
r.proposal && I();
|
|
1895
1895
|
})), i.own(() => {
|
|
1896
|
-
|
|
1897
|
-
}), I(), i.on("changes:opened-line", (e) => r.proposal ?
|
|
1898
|
-
elements:
|
|
1899
|
-
playScenario:
|
|
1900
|
-
stopScenario:
|
|
1901
|
-
clearScenario:
|
|
1902
|
-
playOutage:
|
|
1903
|
-
getPlayer:
|
|
1904
|
-
wantsFrames:
|
|
1905
|
-
setCloseFocus:
|
|
1906
|
-
setNextScenario:
|
|
1907
|
-
setKeepChecksOnClose:
|
|
1908
|
-
tickScenario:
|
|
1909
|
-
demo:
|
|
1896
|
+
d = !0, s.forEach((e) => e.remove());
|
|
1897
|
+
}), I(), i.on("changes:opened-line", (e) => r.proposal ? O(e) : void 0), i.on("changes:played-line", () => r.proposal ? T().playedLine : ""), {
|
|
1898
|
+
elements: s,
|
|
1899
|
+
playScenario: p.play,
|
|
1900
|
+
stopScenario: p.stop,
|
|
1901
|
+
clearScenario: p.clear,
|
|
1902
|
+
playOutage: p.playOutage,
|
|
1903
|
+
getPlayer: p.getPlayer,
|
|
1904
|
+
wantsFrames: p.wantsFrames,
|
|
1905
|
+
setCloseFocus: p.setCloseFocus,
|
|
1906
|
+
setNextScenario: p.setNextScenario,
|
|
1907
|
+
setKeepChecksOnClose: p.setKeepChecksOnClose,
|
|
1908
|
+
tickScenario: p.tick,
|
|
1909
|
+
demo: p.demo,
|
|
1910
1910
|
layersHiding: (e) => yn(t, e),
|
|
1911
|
-
checks:
|
|
1911
|
+
checks: f,
|
|
1912
1912
|
renderColumn: I,
|
|
1913
1913
|
shareRoom: L,
|
|
1914
|
-
setPullHead:
|
|
1915
|
-
openedLine:
|
|
1916
|
-
peekLine:
|
|
1914
|
+
setPullHead: w,
|
|
1915
|
+
openedLine: O,
|
|
1916
|
+
peekLine: k,
|
|
1917
1917
|
update(e) {
|
|
1918
|
-
e && "checker" in e &&
|
|
1918
|
+
e && "checker" in e && f.setChecker(e.checker), r.proposal && R();
|
|
1919
1919
|
},
|
|
1920
1920
|
destroy: () => i.destroy()
|
|
1921
1921
|
};
|
|
@@ -1944,7 +1944,7 @@ function Vn(e, t) {
|
|
|
1944
1944
|
if (e.transport !== "pull") return `${i} The request is posted for your runner.`;
|
|
1945
1945
|
if (e.runner === "online") return `${i} A runner is online.`;
|
|
1946
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 ${
|
|
1947
|
+
return e.runner === "quiet" && Number.isFinite(a) ? `${i} No runner has polled for ${q(t - a)}: the run will wait.` : `${i} No runner has polled yet: the run will wait.`;
|
|
1948
1948
|
}
|
|
1949
1949
|
var Hn = (e) => e > 0 ? `Your ${Pn(e, "edit")} ${e === 1 ? "goes" : "go"} in the comment, for the agent to fold in.` : "";
|
|
1950
1950
|
function Un(e) {
|
|
@@ -1983,7 +1983,7 @@ function Kn(e, t = "Approve") {
|
|
|
1983
1983
|
}
|
|
1984
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
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 =
|
|
1986
|
+
let c = W(e), l = (...e) => e.filter(Boolean).join(" ");
|
|
1987
1987
|
if (!c) return {
|
|
1988
1988
|
line: `Draft in ${!e || e === "checkout" ? "the checkout" : `worktree ${Fn(e)}`}: push it as a spec PR to review it here.`,
|
|
1989
1989
|
approve: "refused",
|
|
@@ -2025,7 +2025,7 @@ function Yn({ source: e, facts: t, factsState: n, review: r = null, edits: i = 0
|
|
|
2025
2025
|
};
|
|
2026
2026
|
}
|
|
2027
2027
|
function Xn({ source: e, edits: t = 0 }) {
|
|
2028
|
-
let n =
|
|
2028
|
+
let n = W(e);
|
|
2029
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
2030
|
}
|
|
2031
2031
|
function Zn({ form: e = null }) {
|
|
@@ -2061,9 +2061,9 @@ function tr(e, t) {
|
|
|
2061
2061
|
}
|
|
2062
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
2063
|
function sr(e, t, n = {}) {
|
|
2064
|
-
let { state: r } = t, i =
|
|
2065
|
-
i.keepParts(...
|
|
2066
|
-
let
|
|
2064
|
+
let { state: r } = t, i = a(t), s = typeof n.now == "function" ? n.now : () => Date.now(), l = typeof n.unnamed == "string" && n.unnamed ? n.unnamed : "", d = Ve(t), f = o(t, e, or().foot, n.slots, "foot");
|
|
2065
|
+
i.keepParts(...f);
|
|
2066
|
+
let m = f[0], h = m.querySelector("#review"), g = m.querySelector(".hx-proposal-actions"), v = !1, y = {
|
|
2067
2067
|
key: null,
|
|
2068
2068
|
reviewable: !1,
|
|
2069
2069
|
review: null,
|
|
@@ -2078,239 +2078,239 @@ function sr(e, t, n = {}) {
|
|
|
2078
2078
|
asking: null,
|
|
2079
2079
|
hold: null,
|
|
2080
2080
|
sent: null
|
|
2081
|
-
},
|
|
2081
|
+
}, b = () => r.proposalSlug || null, x = () => r.proposal && b() ? `${r.proposalSource || ""}/${b()}` : null, C = () => r.proposalSource ? `?source=${encodeURIComponent(r.proposalSource)}` : "", w = () => `/proposals/${encodeURIComponent(b())}/review${C()}`, T = (e) => `/proposals/${encodeURIComponent(b())}/decision${C()}${e ? "&fresh=1" : ""}`, E = (e) => h.querySelector(e), O = (e) => m.querySelector(`[data-review="${e}"]`), k = () => m.querySelector("[data-review-undo]"), A = () => {
|
|
2082
2082
|
let e = t.ask("whatif:edits");
|
|
2083
2083
|
return Array.isArray(e) ? e : [];
|
|
2084
|
-
},
|
|
2084
|
+
}, j = () => {
|
|
2085
2085
|
let e = t.ask("whatif:form");
|
|
2086
2086
|
return e === void 0 ? null : e;
|
|
2087
|
-
},
|
|
2087
|
+
}, M = () => {
|
|
2088
2088
|
let e = t.ask("changes:played-line");
|
|
2089
2089
|
return typeof e == "string" ? e : "";
|
|
2090
|
-
},
|
|
2091
|
-
function
|
|
2090
|
+
}, ee = () => r.whatIf ? r.whatIf.edits.length : 0;
|
|
2091
|
+
function P() {
|
|
2092
2092
|
return Yn({
|
|
2093
2093
|
source: r.proposalSource,
|
|
2094
|
-
facts:
|
|
2095
|
-
factsState:
|
|
2096
|
-
review:
|
|
2097
|
-
edits:
|
|
2098
|
-
form:
|
|
2099
|
-
played:
|
|
2100
|
-
now:
|
|
2094
|
+
facts: y.facts,
|
|
2095
|
+
factsState: y.factsState,
|
|
2096
|
+
review: y.review,
|
|
2097
|
+
edits: ee(),
|
|
2098
|
+
form: j(),
|
|
2099
|
+
played: M(),
|
|
2100
|
+
now: s()
|
|
2101
2101
|
});
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2104
|
-
if (
|
|
2105
|
-
let e = E("[data-review-status]"), { verdict: n, when: i } =
|
|
2103
|
+
function F() {
|
|
2104
|
+
if (v) return;
|
|
2105
|
+
let e = E("[data-review-status]"), { verdict: n, when: i } = R(y.review, s()), a = E("[data-review-verdict]");
|
|
2106
2106
|
a.textContent !== n && (a.textContent = n), E("[data-review-when]").textContent = i ? ` ${i}` : "", e.hidden = !n;
|
|
2107
|
-
let
|
|
2108
|
-
|
|
2109
|
-
let
|
|
2110
|
-
if (
|
|
2111
|
-
if (
|
|
2107
|
+
let o = E("[data-review-loadfail]");
|
|
2108
|
+
o.hidden = !y.loadFailed, E("[data-review-loadfail-text]").textContent = y.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 c = P(), u = "";
|
|
2110
|
+
if (y.asking && !y.hold) {
|
|
2111
|
+
if (y.asking.verdict === "approved") u = c.reasons.length ? Kn(c.reasons) : "";
|
|
2112
2112
|
else {
|
|
2113
|
-
let e = Zn({ form:
|
|
2113
|
+
let e = Zn({ form: j() });
|
|
2114
2114
|
u = e.asks ? e.ask : "";
|
|
2115
2115
|
}
|
|
2116
|
-
u || (
|
|
2116
|
+
u || (y.asking = null);
|
|
2117
2117
|
}
|
|
2118
|
-
let d =
|
|
2119
|
-
|
|
2120
|
-
let
|
|
2121
|
-
|
|
2118
|
+
let d = y.hold, f = O("approved"), p = O("notes"), h = y.asking && y.asking.verdict === "approved" ? "anyway" : d && d.verdict === "approved" ? "hold" : c.approve === "done" ? "done" : "plain", _ = y.asking && y.asking.verdict === "notes" ? "anyway" : d && d.verdict === "notes" ? "hold" : "plain", b = E("[data-review-line]"), x = !y.key && !!r.proposal && !!l;
|
|
2119
|
+
b.textContent = y.key ? c.line : x ? l : "", b.hidden = !y.key && !x || !!u, g.hidden = x;
|
|
2120
|
+
let S = E("[data-review-ask]");
|
|
2121
|
+
S.textContent !== u && (S.textContent = u), S.hidden = !u, E("[data-review-sendback-line]").textContent = Xn({
|
|
2122
2122
|
source: r.proposalSource,
|
|
2123
|
-
edits:
|
|
2123
|
+
edits: ee()
|
|
2124
2124
|
});
|
|
2125
|
-
let
|
|
2126
|
-
for (let e of
|
|
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"),
|
|
2128
|
-
let
|
|
2129
|
-
|
|
2130
|
-
let
|
|
2131
|
-
|
|
2132
|
-
let
|
|
2133
|
-
|
|
2134
|
-
for (let [e, t] of [["[data-review-msg]",
|
|
2125
|
+
let C = y.key && c.approve === "refused";
|
|
2126
|
+
for (let e of m.querySelectorAll("[data-review]")) !y.reviewable || y.busy || d || e === f && (c.approve === "done" || c.approve === "reading") ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.disabled = !1, y.key && e === f ? e.setAttribute("aria-describedby", u ? "review-ask" : "review-line") : y.key && !y.noting && e === p && C ? e.setAttribute("aria-describedby", "review-line") : y.key && y.noting && e === p ? 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"), p && (p.textContent = _ === "hold" ? $n("notes", d.left) : _ === "anyway" ? D(t, "sendBackAnyway") : y.noting ? D(t, "sendBackWithNote") : D(t, "sendBack"), p.setAttribute("aria-expanded", String(y.noting)), p.setAttribute("aria-controls", "review-form"), p.dataset.holding = _ === "hold" ? "true" : "false");
|
|
2128
|
+
let w = k();
|
|
2129
|
+
w && (w.hidden = !d, w.textContent = D(t, "undo"));
|
|
2130
|
+
let T = E("[data-review-hold]");
|
|
2131
|
+
T.hidden = !d, E("[data-review-form]").hidden = !y.noting, E("[data-review-cancel]").disabled = y.busy || !!d;
|
|
2132
|
+
let A = E("#review-note");
|
|
2133
|
+
A.disabled = !y.reviewable, A.readOnly = !!d;
|
|
2134
|
+
for (let [e, t] of [["[data-review-msg]", y.message], ["[data-review-hint]", y.reviewable ? y.hint : ""]]) {
|
|
2135
2135
|
let n = E(e);
|
|
2136
2136
|
n.hidden = !t, n.textContent = t;
|
|
2137
2137
|
}
|
|
2138
|
-
let
|
|
2139
|
-
if (
|
|
2140
|
-
E("[data-review-sent-summary]").textContent = nr(
|
|
2138
|
+
let M = E("[data-review-sent]");
|
|
2139
|
+
if (M.hidden = !y.sent, y.sent) {
|
|
2140
|
+
E("[data-review-sent-summary]").textContent = nr(y.sent.lines.length);
|
|
2141
2141
|
let e = E("[data-review-sent-list]");
|
|
2142
|
-
e.dataset.for !==
|
|
2142
|
+
e.dataset.for !== y.sent.key && (e.dataset.for = y.sent.key, e.replaceChildren(...y.sent.lines.map((e) => {
|
|
2143
2143
|
let n = t.doc.createElement("li");
|
|
2144
2144
|
return n.className = "hx-whatif-edit", n.textContent = e, n;
|
|
2145
2145
|
})));
|
|
2146
2146
|
}
|
|
2147
|
-
let
|
|
2148
|
-
|
|
2147
|
+
let N = E("[data-review-landing]"), F = y.reviewable && y.facts && y.facts.landing ? y.facts.landing : null;
|
|
2148
|
+
N.hidden = !F, F && (E("[data-review-landing-text]").textContent = `Landing on approval waits for PR #${y.facts.pull.number} to be ready and green.`);
|
|
2149
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"),
|
|
2151
|
-
function
|
|
2152
|
-
|
|
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"), k().textContent = D(t, "undo");
|
|
2151
|
+
function I() {
|
|
2152
|
+
y.noting = !0, y.message = "", F(), S(t) && De(t, "proposal"), E("#review-note").focus();
|
|
2153
2153
|
let e = O("notes");
|
|
2154
|
-
|
|
2154
|
+
S(t) && e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
2155
2155
|
}
|
|
2156
|
-
function
|
|
2157
|
-
|
|
2156
|
+
function L() {
|
|
2157
|
+
y.noting = !1, y.asking = null, y.message = "", E("#review-note").value = "", K(y.key), F();
|
|
2158
2158
|
let e = O("notes");
|
|
2159
2159
|
e && e.focus();
|
|
2160
2160
|
}
|
|
2161
|
-
function
|
|
2162
|
-
let t = e ?
|
|
2163
|
-
if (h.hidden = !(t || e &&
|
|
2164
|
-
|
|
2161
|
+
function z({ open: e }) {
|
|
2162
|
+
let t = e ? x() : null;
|
|
2163
|
+
if (h.hidden = !(t || e && l), t === y.key) {
|
|
2164
|
+
F();
|
|
2165
2165
|
return;
|
|
2166
2166
|
}
|
|
2167
|
-
|
|
2168
|
-
let n = E("#review-note"), i = t &&
|
|
2169
|
-
n && (n.value = i), i && (
|
|
2167
|
+
y.hold && Y(e ? "other" : "closed", { quiet: !1 }), y.key = t, y.reviewable = !!t && u(r.proposalSource), y.review = null, y.loadFailed = !1, y.busy = !1, y.noting = !1, y.asking = null, y.sent = null, y.facts = null, y.factsState = y.reviewable ? "loading" : "ready", y.message = y.hint = "";
|
|
2168
|
+
let n = E("#review-note"), i = t && y.reviewable ? G(t) : "";
|
|
2169
|
+
n && (n.value = i), i && (y.noting = !0), F(), t && y.reviewable && (J(t), V());
|
|
2170
2170
|
}
|
|
2171
|
-
let
|
|
2171
|
+
let B = (e, n) => {
|
|
2172
2172
|
(e === 401 || e === 403) && t.emit("auth", {
|
|
2173
2173
|
status: e,
|
|
2174
2174
|
during: n
|
|
2175
2175
|
});
|
|
2176
2176
|
};
|
|
2177
|
-
async function
|
|
2178
|
-
let t =
|
|
2179
|
-
if (!t || !
|
|
2180
|
-
|
|
2177
|
+
async function V({ fresh: e = !1 } = {}) {
|
|
2178
|
+
let t = y.key;
|
|
2179
|
+
if (!t || !y.reviewable || !W(r.proposalSource)) return;
|
|
2180
|
+
y.factsAt = s();
|
|
2181
2181
|
let n = null;
|
|
2182
2182
|
try {
|
|
2183
|
-
let t = await
|
|
2184
|
-
t.ok ? n = await t.json() :
|
|
2183
|
+
let t = await d(T(e), { cache: "no-store" });
|
|
2184
|
+
t.ok ? n = await t.json() : B(t.status, "facts");
|
|
2185
2185
|
} catch {
|
|
2186
2186
|
n = null;
|
|
2187
2187
|
}
|
|
2188
|
-
if (
|
|
2189
|
-
let i = n && n.pull ? n.pull.head : null, a =
|
|
2190
|
-
|
|
2188
|
+
if (v || t !== y.key) return;
|
|
2189
|
+
let i = n && n.pull ? n.pull.head : null, a = y.facts && y.facts.pull ? y.facts.pull.head : null;
|
|
2190
|
+
y.facts = n && n.pull ? n : null, y.factsState = y.facts ? "ready" : "unread", i && a && i !== a && J(t), F();
|
|
2191
2191
|
}
|
|
2192
|
-
let
|
|
2192
|
+
let H = () => {
|
|
2193
2193
|
try {
|
|
2194
2194
|
return t.win.sessionStorage;
|
|
2195
2195
|
} catch {
|
|
2196
2196
|
return null;
|
|
2197
2197
|
}
|
|
2198
2198
|
};
|
|
2199
|
-
function
|
|
2199
|
+
function U(e, t) {
|
|
2200
2200
|
if (e) try {
|
|
2201
|
-
t && t.trim() ?
|
|
2201
|
+
t && t.trim() ? H().setItem(ar + e, t.slice(0, 2e4)) : H().removeItem(ar + e);
|
|
2202
2202
|
} catch {}
|
|
2203
2203
|
}
|
|
2204
|
-
function
|
|
2204
|
+
function G(e) {
|
|
2205
2205
|
try {
|
|
2206
|
-
return
|
|
2206
|
+
return H().getItem(ar + e) || "";
|
|
2207
2207
|
} catch {
|
|
2208
2208
|
return "";
|
|
2209
2209
|
}
|
|
2210
2210
|
}
|
|
2211
|
-
function
|
|
2211
|
+
function K(e) {
|
|
2212
2212
|
if (e) try {
|
|
2213
|
-
|
|
2213
|
+
H().removeItem(ar + e);
|
|
2214
2214
|
} catch {}
|
|
2215
2215
|
}
|
|
2216
|
-
function
|
|
2217
|
-
|
|
2216
|
+
function q(e = 0) {
|
|
2217
|
+
y.key && y.reviewable && !y.hold && !y.busy && (t.hidden() || s() - y.factsAt < e || V());
|
|
2218
2218
|
}
|
|
2219
|
-
function
|
|
2219
|
+
function te() {
|
|
2220
2220
|
let e = t.active(), n = !!e && h.contains(e) && e.matches("[data-review-retry]");
|
|
2221
|
-
|
|
2221
|
+
y.loadFailed = !1, F(), n && t.emit("proposal:focus-title");
|
|
2222
2222
|
}
|
|
2223
|
-
async function
|
|
2223
|
+
async function J(e) {
|
|
2224
2224
|
try {
|
|
2225
|
-
let t = await
|
|
2226
|
-
if (
|
|
2225
|
+
let t = await d(w(), { cache: "no-store" });
|
|
2226
|
+
if (v || e !== y.key) return;
|
|
2227
2227
|
if (t.status === 404) {
|
|
2228
|
-
|
|
2228
|
+
y.review = null, te();
|
|
2229
2229
|
return;
|
|
2230
2230
|
}
|
|
2231
|
-
if (!t.ok) throw
|
|
2231
|
+
if (!t.ok) throw B(t.status, "review"), Error(`The server answered ${t.status}.`);
|
|
2232
2232
|
let n = await t.json();
|
|
2233
|
-
if (
|
|
2234
|
-
n && typeof n.verdict == "string" && (
|
|
2233
|
+
if (v || e !== y.key) return;
|
|
2234
|
+
n && typeof n.verdict == "string" && (y.review = {
|
|
2235
2235
|
verdict: n.verdict,
|
|
2236
2236
|
at: n.at,
|
|
2237
2237
|
current: n.current === !0
|
|
2238
|
-
}),
|
|
2238
|
+
}), te();
|
|
2239
2239
|
} catch {
|
|
2240
|
-
!
|
|
2240
|
+
!v && e === y.key && (y.loadFailed = !0, F());
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
|
-
function
|
|
2243
|
+
function ne(e) {
|
|
2244
2244
|
if (!e.target.closest || e.detail > 1 && e.target.closest("[data-review], [data-review-undo]")) return;
|
|
2245
2245
|
if (e.target.closest("[data-review-undo]")) {
|
|
2246
|
-
|
|
2246
|
+
y.hold && Y("undo");
|
|
2247
2247
|
return;
|
|
2248
2248
|
}
|
|
2249
|
-
if (
|
|
2249
|
+
if (y.hold || y.busy) return;
|
|
2250
2250
|
if (e.target.closest("[data-review-cancel-landing]")) {
|
|
2251
|
-
|
|
2251
|
+
oe();
|
|
2252
2252
|
return;
|
|
2253
2253
|
}
|
|
2254
2254
|
if (e.target.closest("[data-review-cancel]")) {
|
|
2255
|
-
|
|
2255
|
+
L();
|
|
2256
2256
|
return;
|
|
2257
2257
|
}
|
|
2258
2258
|
if (e.target.closest("[data-review-retry]")) {
|
|
2259
|
-
E("[data-review-loadfail-text]").textContent = "Reading the reviews again …",
|
|
2259
|
+
E("[data-review-loadfail-text]").textContent = "Reading the reviews again …", J(y.key);
|
|
2260
2260
|
return;
|
|
2261
2261
|
}
|
|
2262
2262
|
let t = e.target.closest("[data-review]");
|
|
2263
2263
|
if (!t) return;
|
|
2264
2264
|
let n = t.dataset.review;
|
|
2265
|
-
|
|
2265
|
+
y.asking && y.asking.verdict !== n && (y.asking = null, F()), t.getAttribute("aria-disabled") !== "true" && y.reviewable && (n === "notes" && !y.noting ? I() : re(n));
|
|
2266
2266
|
}
|
|
2267
|
-
function
|
|
2268
|
-
if (
|
|
2269
|
-
|
|
2267
|
+
function re(e) {
|
|
2268
|
+
if (y.message = "", y.hint = "", y.sent = null, t.offline()) {
|
|
2269
|
+
y.asking = null, y.message = Be(t, e === "approved" ? "Your approval" : "Your send back"), F();
|
|
2270
2270
|
return;
|
|
2271
2271
|
}
|
|
2272
2272
|
let n = [];
|
|
2273
2273
|
if (e === "notes") {
|
|
2274
|
-
let e =
|
|
2274
|
+
let e = _(E("#review-note").value);
|
|
2275
2275
|
if (e) {
|
|
2276
|
-
|
|
2276
|
+
y.message = e, y.noting = !0, F(), S(t) && De(t, "proposal"), E("#review-note").focus();
|
|
2277
2277
|
return;
|
|
2278
2278
|
}
|
|
2279
|
-
let r = Zn({ form:
|
|
2280
|
-
if (r.asks && !(
|
|
2281
|
-
|
|
2279
|
+
let r = Zn({ form: j() });
|
|
2280
|
+
if (r.asks && !(y.asking && y.asking.verdict === "notes")) {
|
|
2281
|
+
y.asking = {
|
|
2282
2282
|
verdict: "notes",
|
|
2283
2283
|
answered: []
|
|
2284
|
-
},
|
|
2284
|
+
}, F(), N(t, r.ask);
|
|
2285
2285
|
return;
|
|
2286
2286
|
}
|
|
2287
2287
|
n = r.reasons.map((e) => e.key);
|
|
2288
2288
|
} else {
|
|
2289
|
-
let e =
|
|
2289
|
+
let e = P();
|
|
2290
2290
|
if (e.approve === "refused" || e.approve === "done" || e.approve === "reading") {
|
|
2291
|
-
|
|
2291
|
+
F();
|
|
2292
2292
|
return;
|
|
2293
2293
|
}
|
|
2294
|
-
if (e.approve === "asks" && !(
|
|
2295
|
-
|
|
2294
|
+
if (e.approve === "asks" && !(y.asking && y.asking.verdict === "approved")) {
|
|
2295
|
+
y.asking = {
|
|
2296
2296
|
verdict: "approved",
|
|
2297
2297
|
answered: []
|
|
2298
|
-
},
|
|
2298
|
+
}, F();
|
|
2299
2299
|
return;
|
|
2300
2300
|
}
|
|
2301
2301
|
n = e.reasons.map((e) => e.key);
|
|
2302
2302
|
}
|
|
2303
|
-
|
|
2303
|
+
ie(e, n);
|
|
2304
2304
|
}
|
|
2305
|
-
function
|
|
2305
|
+
function ie(e, t) {
|
|
2306
2306
|
let n = {
|
|
2307
2307
|
...r.proposalSha256 ? { sha256: r.proposalSha256 } : {},
|
|
2308
|
-
...
|
|
2308
|
+
...y.facts && y.facts.pull && y.facts.pull.head ? { headSha: y.facts.pull.head } : {}
|
|
2309
2309
|
}, i = {
|
|
2310
|
-
...
|
|
2310
|
+
...p(e, e === "notes" ? E("#review-note").value : "", A()),
|
|
2311
2311
|
...n
|
|
2312
2312
|
};
|
|
2313
|
-
|
|
2313
|
+
y.asking = null;
|
|
2314
2314
|
let a = {
|
|
2315
2315
|
verdict: e,
|
|
2316
2316
|
body: i,
|
|
@@ -2319,69 +2319,69 @@ function sr(e, t, n = {}) {
|
|
|
2319
2319
|
tick: null,
|
|
2320
2320
|
end: null
|
|
2321
2321
|
};
|
|
2322
|
-
|
|
2323
|
-
a.left = Math.max(0, a.left - 1),
|
|
2322
|
+
y.hold = a, a.tick = setInterval(() => {
|
|
2323
|
+
a.left = Math.max(0, a.left - 1), F();
|
|
2324
2324
|
}, 1e3), a.end = setTimeout(() => {
|
|
2325
|
-
|
|
2326
|
-
}, jn), E("[data-review-hold-fill]").style.animationDuration = `${jn}ms`,
|
|
2327
|
-
let o =
|
|
2325
|
+
ae(a);
|
|
2326
|
+
}, jn), E("[data-review-hold-fill]").style.animationDuration = `${jn}ms`, F(), E("[data-review-hold-live]").textContent = er(e, jn / 1e3);
|
|
2327
|
+
let o = k();
|
|
2328
2328
|
o && o.focus();
|
|
2329
2329
|
}
|
|
2330
|
-
function
|
|
2331
|
-
let r =
|
|
2330
|
+
function Y(e, { quiet: n = !1 } = {}) {
|
|
2331
|
+
let r = y.hold;
|
|
2332
2332
|
if (!r) return;
|
|
2333
|
-
clearInterval(r.tick), clearTimeout(r.end),
|
|
2333
|
+
clearInterval(r.tick), clearTimeout(r.end), y.hold = null;
|
|
2334
2334
|
let i = tr(r.verdict, e);
|
|
2335
|
-
if (e === "closed" || e === "other" ? n ||
|
|
2336
|
-
|
|
2335
|
+
if (e === "closed" || e === "other" ? n || N(t, i) : y.message = i, v) return;
|
|
2336
|
+
F();
|
|
2337
2337
|
let a = E("[data-review-hold-live]");
|
|
2338
2338
|
a && (a.textContent = e === "closed" || e === "other" ? "" : i), e !== "closed" && e !== "other" && O(r.verdict)?.focus();
|
|
2339
2339
|
}
|
|
2340
|
-
async function
|
|
2341
|
-
if (
|
|
2340
|
+
async function ae(e) {
|
|
2341
|
+
if (y.hold !== e) return;
|
|
2342
2342
|
if (clearInterval(e.tick), t.offline()) {
|
|
2343
|
-
|
|
2343
|
+
Y("offline");
|
|
2344
2344
|
return;
|
|
2345
2345
|
}
|
|
2346
2346
|
if (t.hidden()) {
|
|
2347
|
-
|
|
2347
|
+
Y("hidden");
|
|
2348
2348
|
return;
|
|
2349
2349
|
}
|
|
2350
|
-
let n =
|
|
2351
|
-
if (e.verdict === "approved" &&
|
|
2352
|
-
let r =
|
|
2350
|
+
let n = y.key;
|
|
2351
|
+
if (e.verdict === "approved" && y.reviewable && await V({ fresh: !0 }), v || y.hold !== e || n !== y.key) return;
|
|
2352
|
+
let r = y.facts && y.facts.pull ? y.facts.pull.head : null;
|
|
2353
2353
|
if (e.verdict === "approved" && e.body.headSha && r && r !== e.body.headSha) {
|
|
2354
|
-
|
|
2354
|
+
Y("pushed");
|
|
2355
2355
|
return;
|
|
2356
2356
|
}
|
|
2357
2357
|
if (e.verdict === "approved" && qn(Gn({
|
|
2358
|
-
facts:
|
|
2358
|
+
facts: y.facts,
|
|
2359
2359
|
edits: e.body.edits.length,
|
|
2360
|
-
form:
|
|
2360
|
+
form: j()
|
|
2361
2361
|
}), e.answered).length) {
|
|
2362
|
-
|
|
2362
|
+
y.hold = null, y.asking = {
|
|
2363
2363
|
verdict: "approved",
|
|
2364
2364
|
answered: e.answered
|
|
2365
|
-
},
|
|
2365
|
+
}, F(), O("approved")?.focus();
|
|
2366
2366
|
return;
|
|
2367
2367
|
}
|
|
2368
|
-
|
|
2368
|
+
y.hold = null;
|
|
2369
2369
|
let i = E("[data-review-hold-live]");
|
|
2370
|
-
i && (i.textContent = ""), await
|
|
2370
|
+
i && (i.textContent = ""), await se(e.verdict, { body: e.body });
|
|
2371
2371
|
}
|
|
2372
|
-
async function
|
|
2373
|
-
let e =
|
|
2372
|
+
async function oe() {
|
|
2373
|
+
let e = W(r.proposalSource);
|
|
2374
2374
|
if (!e) return;
|
|
2375
|
-
|
|
2375
|
+
y.busy = !0, F();
|
|
2376
2376
|
let n = "";
|
|
2377
2377
|
try {
|
|
2378
|
-
let t = await
|
|
2378
|
+
let t = await d(`/api/forge/pulls/${e}/landing/cancel`, {
|
|
2379
2379
|
method: "POST",
|
|
2380
2380
|
headers: { "Content-Type": "application/json" },
|
|
2381
2381
|
body: "{}"
|
|
2382
2382
|
});
|
|
2383
2383
|
if (!t.ok) {
|
|
2384
|
-
|
|
2384
|
+
B(t.status, "landing");
|
|
2385
2385
|
let e = "";
|
|
2386
2386
|
try {
|
|
2387
2387
|
e = (await t.json()).error || "";
|
|
@@ -2389,95 +2389,95 @@ function sr(e, t, n = {}) {
|
|
|
2389
2389
|
n = Qn(t.status, e);
|
|
2390
2390
|
}
|
|
2391
2391
|
} catch {
|
|
2392
|
-
n =
|
|
2392
|
+
n = Be(t, "Cancelling the landing");
|
|
2393
2393
|
}
|
|
2394
|
-
|
|
2395
|
-
}
|
|
2396
|
-
async function
|
|
2397
|
-
if (
|
|
2398
|
-
let i = E("#review-note"),
|
|
2399
|
-
if (
|
|
2400
|
-
let e = a
|
|
2401
|
-
if (e) return
|
|
2394
|
+
v || (y.busy = !1, y.message = n, await V({ fresh: !0 }), v || (F(), n || N(t, "Landing cancelled. The approval stands and the PR stays open."), (O("approved") || O("notes"))?.focus()));
|
|
2395
|
+
}
|
|
2396
|
+
async function se(e, n = {}) {
|
|
2397
|
+
if (v || !r.proposal || !b() || !y.reviewable) return !1;
|
|
2398
|
+
let i = E("#review-note"), a = e === "notes" ? i.value : "";
|
|
2399
|
+
if (y.hint = "", e === "notes" && !n.body) {
|
|
2400
|
+
let e = _(a);
|
|
2401
|
+
if (e) return y.message = e, y.noting = !0, F(), S(t) && De(t, "proposal"), i.focus(), !1;
|
|
2402
2402
|
}
|
|
2403
|
-
|
|
2404
|
-
let
|
|
2403
|
+
y.message = "", y.busy = !0, F();
|
|
2404
|
+
let o = y.key, s = b(), l = r.proposalSource || null, u = n.body || p(e, a, A()), f = t.ask("whatif:describe"), m = e === "notes" && Array.isArray(f) ? f : [], h, g = e === "approved" ? "Your approval" : "Your send back", x;
|
|
2405
2405
|
try {
|
|
2406
|
-
|
|
2406
|
+
x = await d(w(), {
|
|
2407
2407
|
method: "PUT",
|
|
2408
2408
|
headers: { "Content-Type": "application/json" },
|
|
2409
|
-
body: JSON.stringify(
|
|
2409
|
+
body: JSON.stringify(u)
|
|
2410
2410
|
});
|
|
2411
2411
|
} catch {
|
|
2412
|
-
return
|
|
2412
|
+
return v || (y.busy = !1, y.message = Be(t, g), F()), !1;
|
|
2413
2413
|
}
|
|
2414
|
-
if (
|
|
2414
|
+
if (v) return !1;
|
|
2415
2415
|
try {
|
|
2416
2416
|
let e = null;
|
|
2417
2417
|
try {
|
|
2418
|
-
e = await
|
|
2418
|
+
e = await x.json();
|
|
2419
2419
|
} catch {}
|
|
2420
|
-
if (
|
|
2421
|
-
if (!
|
|
2422
|
-
|
|
2420
|
+
if (x.status === 401 || x.redirected) throw Object.assign(/* @__PURE__ */ Error(""), { status: 401 });
|
|
2421
|
+
if (!x.ok) throw Object.assign(Error(e && e.error || ""), { status: x.status });
|
|
2422
|
+
h = e;
|
|
2423
2423
|
} catch (e) {
|
|
2424
|
-
return
|
|
2424
|
+
return v || (y.busy = !1, y.message = Qn(e.status || x.status, e.message), F(), B(e.status || x.status, "send"), (x.status === 409 || x.status === 429) && o === y.key && (J(o), V({ fresh: !0 }))), !1;
|
|
2425
2425
|
}
|
|
2426
|
-
if (
|
|
2426
|
+
if (y.busy = !1, o !== y.key) return t.emit("decision", {
|
|
2427
2427
|
outcome: e,
|
|
2428
|
-
review:
|
|
2429
|
-
slug:
|
|
2430
|
-
source:
|
|
2428
|
+
review: h,
|
|
2429
|
+
slug: s,
|
|
2430
|
+
source: l,
|
|
2431
2431
|
open: !1
|
|
2432
2432
|
}), !0;
|
|
2433
|
-
|
|
2434
|
-
verdict:
|
|
2435
|
-
at:
|
|
2436
|
-
current:
|
|
2437
|
-
},
|
|
2438
|
-
key: `${
|
|
2439
|
-
lines:
|
|
2433
|
+
y.review = {
|
|
2434
|
+
verdict: h.verdict,
|
|
2435
|
+
at: h.at,
|
|
2436
|
+
current: h.verdict === "approved"
|
|
2437
|
+
}, y.hint = e === "approved" ? c(e, u.edits.length) : "", h.posted === !1 && (y.hint = `It was approved already${h.by ? ` by ${h.by}` : ""}; nothing new was posted.`), K(o), e === "notes" && m.length && (y.sent = {
|
|
2438
|
+
key: `${h.at}`,
|
|
2439
|
+
lines: m
|
|
2440
2440
|
}), i.value = "";
|
|
2441
|
-
let
|
|
2442
|
-
|
|
2443
|
-
let
|
|
2444
|
-
return e === "approved" ?
|
|
2441
|
+
let C = y.noting;
|
|
2442
|
+
y.noting = !1, F();
|
|
2443
|
+
let T = t.active(), D = !T || T === t.doc.body || !T.isConnected || T.hidden;
|
|
2444
|
+
return e === "approved" ? D && O("approved")?.focus() : (C || D) && O("notes")?.focus(), t.emit("decision", {
|
|
2445
2445
|
outcome: e,
|
|
2446
|
-
review:
|
|
2447
|
-
slug:
|
|
2448
|
-
source:
|
|
2446
|
+
review: h,
|
|
2447
|
+
slug: s,
|
|
2448
|
+
source: l,
|
|
2449
2449
|
open: !0
|
|
2450
|
-
}), t.emit("mockups:refresh"), e === "notes" && t.emit("whatif:clear"),
|
|
2450
|
+
}), t.emit("mockups:refresh"), e === "notes" && t.emit("whatif:clear"), V({ fresh: !0 }), !0;
|
|
2451
2451
|
}
|
|
2452
|
-
i.listen(
|
|
2453
|
-
e.target && e.target.id === "review-note" &&
|
|
2452
|
+
i.listen(m, "click", ne), i.listen(h, "input", (e) => {
|
|
2453
|
+
e.target && e.target.id === "review-note" && U(y.key, e.target.value), y.message && (y.message = "", F());
|
|
2454
2454
|
}), i.listen(h, "keydown", (e) => {
|
|
2455
|
-
e.key === "Escape" &&
|
|
2455
|
+
e.key === "Escape" && y.noting && !y.asking && !y.hold && (e.stopPropagation(), L());
|
|
2456
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" &&
|
|
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" && y.key && (y.hold ? (e.stopPropagation(), e.preventDefault(), Y("escape")) : y.asking && (e.stopPropagation(), e.preventDefault(), y.asking = null, F()));
|
|
2458
2458
|
}, !0), i.own(t.onNetwork((e) => {
|
|
2459
|
-
e ?
|
|
2460
|
-
})), i.own(t.onWindowFocus(() =>
|
|
2461
|
-
|
|
2459
|
+
e ? y.hold && Y("offline") : y.loadFailed && y.key && J(y.key);
|
|
2460
|
+
})), i.own(t.onWindowFocus(() => q(5e3))), i.own(t.onPageHide(() => {
|
|
2461
|
+
y.hold && Y("closed", { quiet: !0 });
|
|
2462
2462
|
})), i.own(t.onHide(() => {
|
|
2463
|
-
|
|
2464
|
-
})), i.own(t.onShown(() =>
|
|
2465
|
-
|
|
2466
|
-
}), i.on("changes:paint", () =>
|
|
2467
|
-
let
|
|
2468
|
-
|
|
2469
|
-
}, rr),
|
|
2463
|
+
y.hold && Y("hidden");
|
|
2464
|
+
})), i.own(t.onShown(() => q(5e3))), i.on("proposal:bar", z), i.on("whatif:edits-changed", () => {
|
|
2465
|
+
y.hold && Y("edits"), F();
|
|
2466
|
+
}), i.on("changes:paint", () => F());
|
|
2467
|
+
let ce = setInterval(() => {
|
|
2468
|
+
y.review && F();
|
|
2469
|
+
}, rr), le = setInterval(() => q(), ir);
|
|
2470
2470
|
return i.own(() => {
|
|
2471
|
-
clearInterval(
|
|
2471
|
+
clearInterval(ce), clearInterval(le);
|
|
2472
2472
|
}), i.own(() => {
|
|
2473
|
-
|
|
2474
|
-
}),
|
|
2475
|
-
elements:
|
|
2476
|
-
sendReview:
|
|
2477
|
-
loadFacts:
|
|
2478
|
-
paint:
|
|
2473
|
+
v = !0, y.hold &&= (clearInterval(y.hold.tick), clearTimeout(y.hold.end), null), f.forEach((e) => e.remove());
|
|
2474
|
+
}), z({ open: !!r.proposal }), {
|
|
2475
|
+
elements: f,
|
|
2476
|
+
sendReview: se,
|
|
2477
|
+
loadFacts: V,
|
|
2478
|
+
paint: F,
|
|
2479
2479
|
update() {
|
|
2480
|
-
|
|
2480
|
+
z({ open: !!r.proposal });
|
|
2481
2481
|
},
|
|
2482
2482
|
destroy: () => i.destroy()
|
|
2483
2483
|
};
|
|
@@ -2494,57 +2494,57 @@ function fr(e, t) {
|
|
|
2494
2494
|
return n;
|
|
2495
2495
|
}
|
|
2496
2496
|
function pr(e, t, n = {}) {
|
|
2497
|
-
let
|
|
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 =
|
|
2499
|
-
let o = !t,
|
|
2500
|
-
o ? t =
|
|
2497
|
+
let i = e.ownerDocument || e, a = i.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 = f(dr), e.append(a);
|
|
2499
|
+
let o = !t, s = o && typeof n.src == "string" ? n.src !== "" : o && n.src !== void 0 && n.src !== null, c = s ? He(n.src) : null, l = !!c && !c.ok;
|
|
2500
|
+
o ? t = d({
|
|
2501
2501
|
root: a,
|
|
2502
|
-
base:
|
|
2503
|
-
fetch:
|
|
2502
|
+
base: c ? c.ok ? c.base : "" : n.base || "",
|
|
2503
|
+
fetch: l ? () => Promise.reject(/* @__PURE__ */ TypeError("The review has no server: its src is not an address.")) : n.fetch,
|
|
2504
2504
|
strings: n.strings
|
|
2505
|
-
}) : n.strings !== void 0 &&
|
|
2506
|
-
let { state:
|
|
2507
|
-
|
|
2508
|
-
let p = !1, m = !1, h = !0,
|
|
2509
|
-
if (
|
|
2505
|
+
}) : n.strings !== void 0 && r(t, n.strings);
|
|
2506
|
+
let { state: u } = t;
|
|
2507
|
+
we(t, a), O(t, a);
|
|
2508
|
+
let p = !1, m = !1, h = !0, g = !1, _ = !1, v = () => {
|
|
2509
|
+
if (g || _ || p || !m || !h) return;
|
|
2510
2510
|
let e = t.map;
|
|
2511
2511
|
if (!e || typeof e.onPaint != "function") {
|
|
2512
|
-
|
|
2512
|
+
g = !0, n.onReady && n.onReady();
|
|
2513
2513
|
return;
|
|
2514
2514
|
}
|
|
2515
|
-
|
|
2515
|
+
_ = !0;
|
|
2516
2516
|
let r = e.onPaint(() => {
|
|
2517
|
-
r(),
|
|
2517
|
+
r(), _ = !1, g || p || !h || (g = !0, n.onReady && n.onReady());
|
|
2518
2518
|
});
|
|
2519
2519
|
e.render();
|
|
2520
|
-
},
|
|
2521
|
-
slots: { stage:
|
|
2522
|
-
measureCovered: () =>
|
|
2520
|
+
}, y = fr(i, a), b = H(a, t, {
|
|
2521
|
+
slots: { stage: y["map/stage"] },
|
|
2522
|
+
measureCovered: () => w(t),
|
|
2523
2523
|
keysHelp: cr,
|
|
2524
2524
|
renderer: n.renderer,
|
|
2525
2525
|
theme: n.theme,
|
|
2526
2526
|
tokens: n.tokens,
|
|
2527
2527
|
onSelect: n.onSelect,
|
|
2528
2528
|
onReady: () => {
|
|
2529
|
-
m = !0,
|
|
2529
|
+
m = !0, v();
|
|
2530
2530
|
}
|
|
2531
|
-
}),
|
|
2532
|
-
drawer:
|
|
2533
|
-
backdrop:
|
|
2534
|
-
} }),
|
|
2531
|
+
}), x = he(a, t, { slots: {
|
|
2532
|
+
drawer: y["node-panel/drawer"],
|
|
2533
|
+
backdrop: y["node-panel/backdrop"]
|
|
2534
|
+
} }), S = vt(a, t, {
|
|
2535
2535
|
slots: {
|
|
2536
|
-
bar:
|
|
2537
|
-
menu:
|
|
2536
|
+
bar: y["proposal/bar"],
|
|
2537
|
+
menu: y["proposal/menu"]
|
|
2538
2538
|
},
|
|
2539
2539
|
edit: !1
|
|
2540
|
-
}),
|
|
2541
|
-
slots: { column:
|
|
2540
|
+
}), C = An(a, t, {
|
|
2541
|
+
slots: { column: y["changes/column"] },
|
|
2542
2542
|
checker: n.checker
|
|
2543
|
-
}), T = fr(
|
|
2543
|
+
}), T = fr(i, a)["decision/foot"], E = sr(a, t, {
|
|
2544
2544
|
slots: { foot: T },
|
|
2545
2545
|
now: n.now,
|
|
2546
2546
|
unnamed: Jn
|
|
2547
|
-
}), D = t.on("map:set", ({ nodes: e, edges: n }) => (
|
|
2547
|
+
}), D = t.on("map:set", ({ nodes: e, edges: n }) => (V(t, e, n), !0)), k = !n.base && !n.fetch && !(c && c.ok), A = {
|
|
2548
2548
|
topology: void 0,
|
|
2549
2549
|
proposal: null,
|
|
2550
2550
|
source: null,
|
|
@@ -2554,136 +2554,136 @@ function pr(e, t, n = {}) {
|
|
|
2554
2554
|
shown: null,
|
|
2555
2555
|
hasTopology: !1,
|
|
2556
2556
|
held: !1
|
|
2557
|
-
},
|
|
2558
|
-
|
|
2557
|
+
}, j = () => {
|
|
2558
|
+
S.update(), C.update(), E.update(), x.update();
|
|
2559
2559
|
};
|
|
2560
|
-
function
|
|
2560
|
+
function M() {
|
|
2561
2561
|
if (p) return;
|
|
2562
|
-
let e =
|
|
2562
|
+
let e = A.proposal;
|
|
2563
2563
|
if (e == null || e === "") {
|
|
2564
|
-
|
|
2564
|
+
A.held = !1, A.shown = null, h = !0, u.proposal && tt(t), v();
|
|
2565
2565
|
return;
|
|
2566
2566
|
}
|
|
2567
|
-
if (!
|
|
2568
|
-
|
|
2567
|
+
if (!A.hasTopology) {
|
|
2568
|
+
A.held = !0, h = !1;
|
|
2569
2569
|
return;
|
|
2570
2570
|
}
|
|
2571
|
-
|
|
2572
|
-
let n =
|
|
2573
|
-
if (typeof e == "string" &&
|
|
2574
|
-
h = !0,
|
|
2571
|
+
A.held = !1;
|
|
2572
|
+
let n = A.proposalView;
|
|
2573
|
+
if (typeof e == "string" && l) {
|
|
2574
|
+
h = !0, v();
|
|
2575
2575
|
return;
|
|
2576
2576
|
}
|
|
2577
|
-
if (typeof e == "string" &&
|
|
2578
|
-
let n =
|
|
2579
|
-
|
|
2577
|
+
if (typeof e == "string" && k) {
|
|
2578
|
+
let n = ne(e) ? `${e} cannot be opened here: there is no cornfield server to read it from (the review has no src).` : ie(e);
|
|
2579
|
+
A.shown = null, Je(t, n, !0, []), t.emit("proposal:failed", {
|
|
2580
2580
|
slug: e,
|
|
2581
|
-
source:
|
|
2581
|
+
source: A.source,
|
|
2582
2582
|
status: 0,
|
|
2583
2583
|
notFound: !1,
|
|
2584
2584
|
message: n
|
|
2585
|
-
}), h = !0,
|
|
2585
|
+
}), h = !0, v();
|
|
2586
2586
|
return;
|
|
2587
2587
|
}
|
|
2588
2588
|
if (typeof e == "string") {
|
|
2589
|
-
if (
|
|
2590
|
-
|
|
2589
|
+
if (u.proposal && u.proposalSlug === e && (!A.source || A.source === u.proposalSource)) {
|
|
2590
|
+
A.shown = `${e}\u0000${A.source || ""}`, Z.includes(n) && u.proposalView !== n && S.update({ view: n }), h = !0;
|
|
2591
2591
|
return;
|
|
2592
2592
|
}
|
|
2593
|
-
let t = `${e}\u0000${
|
|
2594
|
-
if (
|
|
2595
|
-
|
|
2596
|
-
let r =
|
|
2593
|
+
let t = `${e}\u0000${A.source || ""}`;
|
|
2594
|
+
if (A.shown === t && u.proposal) return;
|
|
2595
|
+
A.shown = t, h = !1;
|
|
2596
|
+
let r = S.update({
|
|
2597
2597
|
proposal: e,
|
|
2598
|
-
source:
|
|
2598
|
+
source: A.source,
|
|
2599
2599
|
view: n
|
|
2600
2600
|
});
|
|
2601
2601
|
return Promise.resolve(r).then(() => {
|
|
2602
|
-
|
|
2602
|
+
A.shown === t && (h = !0, v());
|
|
2603
2603
|
}), r;
|
|
2604
2604
|
}
|
|
2605
|
-
if (
|
|
2606
|
-
|
|
2607
|
-
let r =
|
|
2608
|
-
source:
|
|
2609
|
-
slug:
|
|
2610
|
-
sha256:
|
|
2605
|
+
if (A.shown === e && u.proposal) return;
|
|
2606
|
+
A.shown = e;
|
|
2607
|
+
let r = k ? {} : {
|
|
2608
|
+
source: A.source,
|
|
2609
|
+
slug: A.slug,
|
|
2610
|
+
sha256: A.sha256
|
|
2611
2611
|
};
|
|
2612
|
-
|
|
2612
|
+
S.update({
|
|
2613
2613
|
proposal: e,
|
|
2614
2614
|
...r,
|
|
2615
2615
|
view: n
|
|
2616
|
-
}), h = !0,
|
|
2616
|
+
}), h = !0, v();
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2619
|
-
|
|
2618
|
+
function N(e) {
|
|
2619
|
+
A.hasTopology = z(t, e);
|
|
2620
2620
|
let n = a.querySelector(".hx-review-empty");
|
|
2621
|
-
n.textContent =
|
|
2621
|
+
n.textContent = A.hasTopology ? "" : ur, n.hidden = A.hasTopology, A.hasTopology ? (B(t), u.proposal ? et(t, void 0, { fit: !0 }) : b.fit(), t.map.render(), t.map.ensureFlowLoop(), A.held && M()) : t.map.render();
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2623
|
+
function ee(e) {
|
|
2624
2624
|
let n = e === "dataflow" ? "dataflow" : "orbit";
|
|
2625
|
-
|
|
2625
|
+
u.view !== n && (u.view = n, t.emit("scenario:clear"), t.touchScene(), u.nodes.length && (V(t, u.mapNodes, u.mapEdges), b.fit(), t.map.ensureFlowLoop()), t.emit("view", u.view));
|
|
2626
2626
|
}
|
|
2627
2627
|
function P(e) {
|
|
2628
|
-
|
|
2628
|
+
Z.includes(e) ? (A.proposalView = e, u.proposal && S.update({ view: e })) : lr.includes(e) && ee(e);
|
|
2629
2629
|
}
|
|
2630
|
-
function
|
|
2631
|
-
e && typeof e == "object" && ("layers" in e &&
|
|
2630
|
+
function F(e) {
|
|
2631
|
+
e && typeof e == "object" && ("layers" in e && Le(t, e.layers), e.theme && b.applyTheme(e.theme));
|
|
2632
2632
|
}
|
|
2633
|
-
function
|
|
2634
|
-
e !==
|
|
2633
|
+
function I(e) {
|
|
2634
|
+
e !== A.topology && (A.topology = e, N(e));
|
|
2635
2635
|
}
|
|
2636
|
-
let
|
|
2637
|
-
|
|
2636
|
+
let L = {}, R = null, U = (e) => {
|
|
2637
|
+
R ? R.provide(e) : s && Object.assign(L, e);
|
|
2638
2638
|
};
|
|
2639
|
-
|
|
2640
|
-
let
|
|
2641
|
-
|
|
2642
|
-
let r =
|
|
2643
|
-
if (
|
|
2639
|
+
A.useTheme = !!n.useTheme, A.theme = n.theme, s && n.strings !== void 0 && U({ strings: n.strings });
|
|
2640
|
+
let W = () => t.base ? Ue(t.base, typeof n.pageUrl == "function" ? n.pageUrl() : "") : "", G = [], K = "";
|
|
2641
|
+
G.push(t.on("auth", ({ status: e, during: t }) => {
|
|
2642
|
+
let r = W();
|
|
2643
|
+
if (R && R.showSignIn({
|
|
2644
2644
|
status: e,
|
|
2645
2645
|
signIn: r
|
|
2646
2646
|
}), t === "facts") {
|
|
2647
|
-
if (
|
|
2648
|
-
|
|
2649
|
-
} else
|
|
2647
|
+
if (K === `${e}`) return;
|
|
2648
|
+
K = `${e}`;
|
|
2649
|
+
} else K = "";
|
|
2650
2650
|
n.onAuth && n.onAuth({
|
|
2651
2651
|
status: e,
|
|
2652
2652
|
signIn: r,
|
|
2653
2653
|
during: t
|
|
2654
2654
|
});
|
|
2655
|
-
})),
|
|
2656
|
-
|
|
2657
|
-
})), n.onDecision &&
|
|
2655
|
+
})), G.push(t.on("decision", () => {
|
|
2656
|
+
K = "", R && R.clearSignIn();
|
|
2657
|
+
})), n.onDecision && G.push(t.on("decision", ({ outcome: e, review: t, slug: r, source: i, open: a }) => n.onDecision({
|
|
2658
2658
|
outcome: e,
|
|
2659
2659
|
proposal: r,
|
|
2660
2660
|
source: i,
|
|
2661
2661
|
open: a,
|
|
2662
2662
|
review: t
|
|
2663
|
-
}))), n.onNavigate &&
|
|
2663
|
+
}))), n.onNavigate && G.push(t.on("proposal", ({ change: e, slug: t, source: r, pinSource: i, view: a }) => n.onNavigate({
|
|
2664
2664
|
proposal: t,
|
|
2665
2665
|
source: i ? r : null,
|
|
2666
2666
|
view: e === "closed" ? null : a,
|
|
2667
2667
|
change: e
|
|
2668
|
-
}))), n.onError &&
|
|
2668
|
+
}))), n.onError && G.push(t.on("proposal:failed", ({ message: e }) => n.onError({
|
|
2669
2669
|
kind: "proposal",
|
|
2670
2670
|
message: e
|
|
2671
|
-
}))),
|
|
2672
|
-
p || (
|
|
2671
|
+
}))), G.push(t.on("proposal:specs-list", () => !1)), s && import("./review-source-CK5tYIqk.js").then(({ attachSource: r }) => {
|
|
2672
|
+
p || (R = r(t, {
|
|
2673
2673
|
root: e,
|
|
2674
2674
|
stage: a.querySelector("[data-corn=\"stage\"]"),
|
|
2675
|
-
parsed:
|
|
2675
|
+
parsed: c,
|
|
2676
2676
|
tokens: n.tokens,
|
|
2677
2677
|
version: n.version,
|
|
2678
2678
|
pageUrl: n.pageUrl,
|
|
2679
|
-
useTheme:
|
|
2680
|
-
theme:
|
|
2681
|
-
topology:
|
|
2682
|
-
config:
|
|
2683
|
-
strings:
|
|
2684
|
-
onTopology: (e) =>
|
|
2679
|
+
useTheme: A.useTheme,
|
|
2680
|
+
theme: A.theme,
|
|
2681
|
+
topology: L.topology,
|
|
2682
|
+
config: L.config,
|
|
2683
|
+
strings: L.strings,
|
|
2684
|
+
onTopology: (e) => I(e),
|
|
2685
2685
|
onConfig: () => {
|
|
2686
|
-
|
|
2686
|
+
O(t, a), j();
|
|
2687
2687
|
},
|
|
2688
2688
|
onAuth: (e) => {
|
|
2689
2689
|
n.onAuth && n.onAuth(e);
|
|
@@ -2691,9 +2691,9 @@ function pr(e, t, n = {}) {
|
|
|
2691
2691
|
onError: (e) => {
|
|
2692
2692
|
n.onError && n.onError(e);
|
|
2693
2693
|
},
|
|
2694
|
-
onMode: () =>
|
|
2694
|
+
onMode: () => b.refresh(),
|
|
2695
2695
|
focusMap: () => {
|
|
2696
|
-
|
|
2696
|
+
u.canvas && u.canvas.focus();
|
|
2697
2697
|
}
|
|
2698
2698
|
}));
|
|
2699
2699
|
}, (e) => {
|
|
@@ -2702,32 +2702,32 @@ function pr(e, t, n = {}) {
|
|
|
2702
2702
|
message: `the review's loader did not load: ${e && e.message ? e.message : e}`
|
|
2703
2703
|
});
|
|
2704
2704
|
});
|
|
2705
|
-
function
|
|
2705
|
+
function q(e = {}) {
|
|
2706
2706
|
if (p) return;
|
|
2707
2707
|
let n = !1;
|
|
2708
|
-
"strings" in e && (
|
|
2709
|
-
let
|
|
2708
|
+
"strings" in e && (r(t, e.strings), O(t, a), n = !0, U({ strings: e.strings })), "useTheme" in e && (A.useTheme = !!e.useTheme, R && R.setUseTheme(A.useTheme)), "config" in e && (s ? U({ config: e.config || null }) : F(e.config)), "theme" in e && (b.update({ theme: e.theme }), A.theme = e.theme, R && R.setTheme(e.theme)), "checker" in e && C.update({ checker: e.checker }), "topology" in e && (s ? U({ topology: e.topology || null }) : I(e.topology));
|
|
2709
|
+
let i, o = [
|
|
2710
2710
|
"proposal",
|
|
2711
2711
|
"source",
|
|
2712
2712
|
"slug",
|
|
2713
2713
|
"sha256"
|
|
2714
2714
|
].some((t) => t in e);
|
|
2715
|
-
return
|
|
2715
|
+
return o && ("source" in e && (A.source = e.source || null), "slug" in e && (A.slug = e.slug || null), "sha256" in e && (A.sha256 = e.sha256 || null), "proposal" in e && (A.proposal = e.proposal, A.shown = null), "view" in e && Z.includes(e.view) && (A.proposalView = e.view), i = M()), "view" in e && !(o && Z.includes(e.view)) && P(e.view), "node" in e && b.update({ node: e.node }), n && j(), i;
|
|
2716
2716
|
}
|
|
2717
|
-
function
|
|
2717
|
+
function te() {
|
|
2718
2718
|
if (!p) {
|
|
2719
|
-
p = !0, D(),
|
|
2719
|
+
p = !0, D(), G.forEach((e) => e()), R && R.destroy(), R = null;
|
|
2720
2720
|
for (let e of [
|
|
2721
2721
|
E,
|
|
2722
|
-
w,
|
|
2723
2722
|
C,
|
|
2724
2723
|
S,
|
|
2725
|
-
x
|
|
2724
|
+
x,
|
|
2725
|
+
b
|
|
2726
2726
|
]) e.destroy();
|
|
2727
|
-
|
|
2727
|
+
we(t, null), a.remove(), o && t.destroy();
|
|
2728
2728
|
}
|
|
2729
2729
|
}
|
|
2730
|
-
let
|
|
2730
|
+
let J = {};
|
|
2731
2731
|
for (let e of [
|
|
2732
2732
|
"config",
|
|
2733
2733
|
"topology",
|
|
@@ -2737,21 +2737,21 @@ function pr(e, t, n = {}) {
|
|
|
2737
2737
|
"sha256",
|
|
2738
2738
|
"view",
|
|
2739
2739
|
"node"
|
|
2740
|
-
]) n[e] !== void 0 && (
|
|
2741
|
-
if (
|
|
2742
|
-
return J
|
|
2740
|
+
]) n[e] !== void 0 && (J[e] = n[e]);
|
|
2741
|
+
if (s) for (let e of ["topology", "config"]) e in J && (U({ [e]: J[e] || null }), delete J[e]);
|
|
2742
|
+
return q(J), {
|
|
2743
2743
|
inst: t,
|
|
2744
2744
|
elements: [a],
|
|
2745
|
-
map:
|
|
2746
|
-
proposal:
|
|
2747
|
-
changes:
|
|
2745
|
+
map: b,
|
|
2746
|
+
proposal: S,
|
|
2747
|
+
changes: C,
|
|
2748
2748
|
decision: E,
|
|
2749
|
-
nodePanel:
|
|
2750
|
-
update:
|
|
2751
|
-
destroy:
|
|
2752
|
-
fit: () =>
|
|
2753
|
-
focusNode: (e) =>
|
|
2754
|
-
refresh: () =>
|
|
2749
|
+
nodePanel: x,
|
|
2750
|
+
update: q,
|
|
2751
|
+
destroy: te,
|
|
2752
|
+
fit: () => b.fit(),
|
|
2753
|
+
focusNode: (e) => b.focusNode(e),
|
|
2754
|
+
refresh: () => b.refresh()
|
|
2755
2755
|
};
|
|
2756
2756
|
}
|
|
2757
2757
|
// \0stencil-css:/home/runner/work/CornField/CornField/components/src/components/corn-review/corn-review?tag=corn-review&encapsulation=shadow&__ext=css
|
|
@@ -2801,9 +2801,9 @@ var mr = () => ":host{contain:layout;min-width:0;height:100%;color:var(--corn-te
|
|
|
2801
2801
|
!this.piece && this.el.shadowRoot && (this.changes = {}, this.piece = pr(this.el.shadowRoot, null, {
|
|
2802
2802
|
src: this.src,
|
|
2803
2803
|
useTheme: this.useTheme,
|
|
2804
|
-
version: "0.52.
|
|
2804
|
+
version: "0.52.1",
|
|
2805
2805
|
pageUrl: () => typeof location > "u" ? "" : location.href,
|
|
2806
|
-
tokens:
|
|
2806
|
+
tokens: F,
|
|
2807
2807
|
topology: this.topology,
|
|
2808
2808
|
config: this.config,
|
|
2809
2809
|
strings: this.strings,
|