@pygmalionjs/pygmalion 0.2.11 → 0.2.13
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/README.ko.md +36 -10
- package/README.md +36 -10
- package/dist-lib/{App-CyLtIqGh.js → App-BpS2IDVb.js} +7992 -6049
- package/dist-lib/pygmalion.js +2044 -361
- package/dist-lib/style.css +1 -1
- package/dist-lib/testing.js +1 -1
- package/node/dev-mirror.mjs +68 -1
- package/node/dev-view.vite.mjs +7 -0
- package/node/inspect-plugin.mjs +8 -1
- package/node/preview-artifact-plugin.mjs +296 -0
- package/node/qa-capture-plugin.mjs +1226 -0
- package/node/route-preview-artifact-v3.mjs +584 -0
- package/node/source-revision.mjs +83 -0
- package/node/storyboard-capture-runtime.mjs +1165 -0
- package/node/storyboard-capture-scheduler.mjs +226 -0
- package/node/storyboard.mjs +44 -0
- package/node/vite.mjs +116 -14
- package/package.json +16 -1
- package/qa.d.ts +201 -0
- package/storyboard.d.ts +298 -0
- package/types.d.ts +724 -40
- package/vite.d.ts +102 -20
package/dist-lib/pygmalion.js
CHANGED
|
@@ -1,151 +1,1768 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const e
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { jsxs as O, jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { b as V, m as He, v as Ke, c as qe, i as Ge, g as Le, e as K, d as Ve, a as Je, f as We, h as Qe, j as Xe, k as Ye, l as Ze, n as et, o as tt, p as nt, q as rt, r as ot, t as Y, S as st, A as it, u as ve, w as at, x as ct, y as lt, z as dt, B as ft, C as ut, D as pt, E as Ie } from "./App-BpS2IDVb.js";
|
|
3
|
+
import { G as $n, H as Mn, I as Tn, J as Dn, K as kn, L as zn, M as _n, O as Fn, P as Bn, Q as jn, R as Un, T as Hn, U as Kn, V as qn, W as Gn, X as Ln, Y as Vn } from "./App-BpS2IDVb.js";
|
|
4
|
+
import { createElement as xe, useMemo as Pe, useState as te, useRef as Ee, useCallback as Z, useEffect as ee } from "react";
|
|
5
|
+
function pe(e, t = /* @__PURE__ */ new Set()) {
|
|
6
|
+
if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
|
|
7
|
+
return e;
|
|
8
|
+
if (Array.isArray(e))
|
|
9
|
+
return e.map((n) => pe(n, t));
|
|
10
|
+
if (typeof e != "object") return null;
|
|
11
|
+
if (t.has(e))
|
|
12
|
+
throw new Error("A storyboard recipe cannot contain circular references.");
|
|
13
|
+
t.add(e);
|
|
14
|
+
const r = {};
|
|
15
|
+
for (const n of Object.keys(e).sort()) {
|
|
16
|
+
const o = e[n];
|
|
17
|
+
o !== void 0 && (r[n] = pe(o, t));
|
|
18
|
+
}
|
|
19
|
+
return t.delete(e), r;
|
|
20
|
+
}
|
|
21
|
+
function ht(e) {
|
|
22
|
+
return JSON.stringify(
|
|
23
|
+
pe({
|
|
24
|
+
version: 1,
|
|
25
|
+
route: e.route ?? null,
|
|
26
|
+
componentName: e.componentName ?? null,
|
|
27
|
+
gallery: e.gallery ?? [],
|
|
28
|
+
viewport: {
|
|
29
|
+
width: e.width ?? null,
|
|
30
|
+
height: e.height ?? null,
|
|
31
|
+
frameSizeMode: e.frameSizeMode ?? null,
|
|
32
|
+
heightMode: e.heightMode ?? null,
|
|
33
|
+
maxHeight: e.maxHeight ?? null
|
|
34
|
+
},
|
|
35
|
+
environment: e.environment ?? null,
|
|
36
|
+
preset: e.preset ?? null,
|
|
37
|
+
interactions: e.interactions ?? [],
|
|
38
|
+
assertions: e.assertions ?? []
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function z(e) {
|
|
43
|
+
return [...new Set([...e].map((t) => t == null ? void 0 : t.trim()).filter(Boolean))].sort((t, r) => t.localeCompare(r));
|
|
44
|
+
}
|
|
45
|
+
function mt(e, t) {
|
|
46
|
+
var n;
|
|
47
|
+
return ((n = e.id) == null ? void 0 : n.trim()) || `edge:${t + 1}`;
|
|
48
|
+
}
|
|
49
|
+
function gt(e) {
|
|
50
|
+
const t = [...e.screens].sort((n, o) => n.id.localeCompare(o.id)), r = t[0].id;
|
|
51
|
+
return {
|
|
52
|
+
id: `story:${r}`,
|
|
53
|
+
canonicalScreenId: r,
|
|
54
|
+
screenIds: t.map((n) => n.id),
|
|
55
|
+
names: z(t.map((n) => n.name)),
|
|
56
|
+
recipeKey: e.recipeKey,
|
|
57
|
+
routes: z(t.map((n) => n.route)),
|
|
58
|
+
scenarioIds: z(
|
|
59
|
+
t.flatMap((n) => [
|
|
60
|
+
n.scenarioId,
|
|
61
|
+
...n.scenarioIds ?? []
|
|
62
|
+
])
|
|
63
|
+
),
|
|
64
|
+
sourceKeys: z(t.map((n) => n.sourcePath)),
|
|
65
|
+
flows: z(t.map((n) => n.flow)),
|
|
66
|
+
states: z(t.map((n) => n.state))
|
|
20
67
|
};
|
|
21
68
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
69
|
+
function Ne(e) {
|
|
70
|
+
return [
|
|
71
|
+
e.code,
|
|
72
|
+
e.edgeId,
|
|
73
|
+
e.nodeId,
|
|
74
|
+
e.screenId,
|
|
75
|
+
e.scenarioId
|
|
76
|
+
].join(":");
|
|
26
77
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
78
|
+
function yt(e) {
|
|
79
|
+
var g, I;
|
|
80
|
+
const t = [], r = [], n = /* @__PURE__ */ new Map();
|
|
81
|
+
for (const i of e.screens) {
|
|
82
|
+
const l = i.id.trim();
|
|
83
|
+
if (!l || n.has(l)) {
|
|
84
|
+
t.push({
|
|
85
|
+
code: "duplicate-screen-id",
|
|
86
|
+
severity: "error",
|
|
87
|
+
message: l ? `Multiple storyboard screens use the id "${l}".` : "A storyboard screen has an empty id.",
|
|
88
|
+
screenId: l || void 0
|
|
89
|
+
});
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const f = l === i.id ? i : { ...i, id: l };
|
|
93
|
+
n.set(l, f), r.push(f);
|
|
94
|
+
}
|
|
95
|
+
const o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
96
|
+
for (const i of r) {
|
|
97
|
+
let l;
|
|
98
|
+
try {
|
|
99
|
+
if (l = (e.recipeKey ?? ht)(i), !l.trim()) throw new Error("Recipe keys cannot be empty.");
|
|
100
|
+
} catch (y) {
|
|
101
|
+
s.add(i.id), t.push({
|
|
102
|
+
code: "invalid-recipe",
|
|
103
|
+
severity: "error",
|
|
104
|
+
message: y instanceof Error ? y.message : "Storyboard recipe identity could not be created.",
|
|
105
|
+
screenId: i.id
|
|
106
|
+
}), l = `invalid:${i.id}`;
|
|
107
|
+
}
|
|
108
|
+
const f = o.get(l);
|
|
109
|
+
f ? f.screens.push(i) : o.set(l, { recipeKey: l, screens: [i] });
|
|
110
|
+
}
|
|
111
|
+
const a = [...o.values()].map(gt).sort((i, l) => i.id.localeCompare(l.id)), c = {};
|
|
112
|
+
for (const i of a)
|
|
113
|
+
for (const l of i.screenIds) c[l] = i.id;
|
|
114
|
+
const d = new Map(a.map((i) => [i.id, i])), h = /* @__PURE__ */ new Map();
|
|
115
|
+
for (const i of e.assets ?? []) {
|
|
116
|
+
const l = h.get(i.pageId);
|
|
117
|
+
l ? l.push(i) : h.set(i.pageId, [i]);
|
|
118
|
+
}
|
|
119
|
+
const u = a.map((i) => {
|
|
120
|
+
const l = i.screenIds.flatMap(
|
|
121
|
+
(f) => h.get(f) ?? []
|
|
122
|
+
);
|
|
123
|
+
return {
|
|
124
|
+
...i,
|
|
125
|
+
scenarioIds: z([
|
|
126
|
+
...i.scenarioIds,
|
|
127
|
+
...l.map((f) => f.scenarioId)
|
|
128
|
+
]),
|
|
129
|
+
sourceKeys: z([
|
|
130
|
+
...i.sourceKeys,
|
|
131
|
+
...l.map((f) => f.sourcePath)
|
|
132
|
+
])
|
|
133
|
+
};
|
|
134
|
+
}), b = /* @__PURE__ */ new Map();
|
|
135
|
+
for (const i of u)
|
|
136
|
+
for (const l of i.routes) {
|
|
137
|
+
const f = b.get(l);
|
|
138
|
+
f ? f.push(i.id) : b.set(l, [i.id]);
|
|
139
|
+
}
|
|
140
|
+
const P = (i, l, f) => {
|
|
141
|
+
const y = i.trim(), D = c[y] ?? (d.has(y) ? y : null);
|
|
142
|
+
if (D) return D;
|
|
143
|
+
const H = z(b.get(y) ?? []);
|
|
144
|
+
return H.length === 1 ? H[0] : H.length > 1 ? (t.push({
|
|
145
|
+
code: f === "source" ? "ambiguous-edge-source" : "ambiguous-edge-target",
|
|
146
|
+
severity: "error",
|
|
147
|
+
message: `Storyboard edge "${l}" references an ambiguous ${f} route.`,
|
|
148
|
+
edgeId: l,
|
|
149
|
+
screenId: y || void 0
|
|
150
|
+
}), null) : (t.push({
|
|
151
|
+
code: f === "source" ? "unknown-edge-source" : "unknown-edge-target",
|
|
152
|
+
severity: "error",
|
|
153
|
+
message: `Storyboard edge "${l}" references an unknown ${f}.`,
|
|
154
|
+
edgeId: l,
|
|
155
|
+
screenId: y || void 0
|
|
156
|
+
}), null);
|
|
157
|
+
}, E = [], m = /* @__PURE__ */ new Map(), N = [
|
|
158
|
+
["explicit", e.explicitEdges ?? []],
|
|
159
|
+
["inferred", e.inferredEdges ?? []]
|
|
160
|
+
];
|
|
161
|
+
let p = 0;
|
|
162
|
+
for (const [i, l] of N)
|
|
163
|
+
for (const f of l) {
|
|
164
|
+
const y = mt(f, p);
|
|
165
|
+
p += 1;
|
|
166
|
+
const D = P(f.from, y, "source"), H = P(f.to, y, "target");
|
|
167
|
+
if (!D || !H || D === H) continue;
|
|
168
|
+
const de = `${D}\0${H}`, X = m.get(de);
|
|
169
|
+
if (X) {
|
|
170
|
+
if (!X.sourceEdgeIds.includes(y)) {
|
|
171
|
+
const be = {
|
|
172
|
+
...X,
|
|
173
|
+
sourceEdgeIds: z([
|
|
174
|
+
...X.sourceEdgeIds,
|
|
175
|
+
y
|
|
176
|
+
])
|
|
177
|
+
};
|
|
178
|
+
m.set(de, be);
|
|
179
|
+
const Se = E.indexOf(X);
|
|
180
|
+
Se >= 0 && (E[Se] = be);
|
|
181
|
+
}
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const we = {
|
|
185
|
+
id: y,
|
|
186
|
+
from: D,
|
|
187
|
+
to: H,
|
|
188
|
+
kind: ((g = f.kind) == null ? void 0 : g.trim()) || void 0,
|
|
189
|
+
label: ((I = f.label) == null ? void 0 : I.trim()) || void 0,
|
|
190
|
+
origin: i,
|
|
191
|
+
sourceEdgeIds: [y]
|
|
192
|
+
};
|
|
193
|
+
m.set(de, we), E.push(we);
|
|
194
|
+
}
|
|
195
|
+
E.sort(
|
|
196
|
+
(i, l) => `${i.from}:${i.to}:${i.id}`.localeCompare(`${l.from}:${l.to}:${l.id}`)
|
|
197
|
+
);
|
|
198
|
+
const $ = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const i of E) {
|
|
200
|
+
const l = R.get(i.from);
|
|
201
|
+
l ? l.push(i) : R.set(i.from, [i]);
|
|
202
|
+
const f = $.get(i.to);
|
|
203
|
+
f ? f.push(i) : $.set(i.to, [i]);
|
|
204
|
+
}
|
|
205
|
+
const T = [];
|
|
206
|
+
for (const i of e.startScreenIds ?? []) {
|
|
207
|
+
const l = i.trim(), f = c[l] ?? (d.has(l) ? l : null);
|
|
208
|
+
if (!f) {
|
|
209
|
+
t.push({
|
|
210
|
+
code: "unknown-start-screen",
|
|
211
|
+
severity: "error",
|
|
212
|
+
message: `Storyboard start references an unknown screen "${l}".`,
|
|
213
|
+
screenId: l || void 0
|
|
214
|
+
});
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
T.push(f);
|
|
218
|
+
}
|
|
219
|
+
const M = new Set(T);
|
|
220
|
+
let A = z(T);
|
|
221
|
+
A.length || (A = u.filter((i) => {
|
|
222
|
+
var l;
|
|
223
|
+
return (((l = $.get(i.id)) == null ? void 0 : l.length) ?? 0) === 0;
|
|
224
|
+
}).map((i) => i.id).sort((i, l) => i.localeCompare(l))), !A.length && u.length && (A = [u[0].id]);
|
|
225
|
+
const S = /* @__PURE__ */ new Set(), C = [...A];
|
|
226
|
+
for (; C.length; ) {
|
|
227
|
+
const i = C.shift();
|
|
228
|
+
if (!S.has(i)) {
|
|
229
|
+
S.add(i);
|
|
230
|
+
for (const l of R.get(i) ?? []) C.push(l.to);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const F = u.filter((i) => {
|
|
234
|
+
var f, y;
|
|
235
|
+
const l = (((f = $.get(i.id)) == null ? void 0 : f.length) ?? 0) === 0 && (((y = R.get(i.id)) == null ? void 0 : y.length) ?? 0) === 0 && !M.has(i.id);
|
|
236
|
+
return !S.has(i.id) || l && u.length > 1;
|
|
237
|
+
});
|
|
238
|
+
for (const i of F)
|
|
239
|
+
for (const l of i.screenIds)
|
|
240
|
+
t.push({
|
|
241
|
+
code: "disconnected-screen",
|
|
242
|
+
severity: "warning",
|
|
243
|
+
message: `Storyboard screen "${l}" is not connected to a graph branch.`,
|
|
244
|
+
screenId: l,
|
|
245
|
+
nodeId: i.id
|
|
246
|
+
});
|
|
247
|
+
const j = /* @__PURE__ */ new Map();
|
|
248
|
+
for (const i of u)
|
|
249
|
+
for (const l of i.sourceKeys) {
|
|
250
|
+
const f = j.get(l) ?? {
|
|
251
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
252
|
+
screenIds: /* @__PURE__ */ new Set()
|
|
253
|
+
};
|
|
254
|
+
f.nodeIds.add(i.id);
|
|
255
|
+
for (const y of i.screenIds) f.screenIds.add(y);
|
|
256
|
+
j.set(l, f);
|
|
257
|
+
}
|
|
258
|
+
const W = [...j.entries()].map(([i, l]) => ({
|
|
259
|
+
sourceKey: i,
|
|
260
|
+
nodeIds: [...l.nodeIds].sort((f, y) => f.localeCompare(y)),
|
|
261
|
+
screenIds: [...l.screenIds].sort((f, y) => f.localeCompare(y)),
|
|
262
|
+
shared: l.nodeIds.size > 1
|
|
263
|
+
})).sort((i, l) => i.sourceKey.localeCompare(l.sourceKey)), q = u.map((i) => {
|
|
264
|
+
const l = [...R.get(i.id) ?? []].sort(
|
|
265
|
+
(f, y) => f.id.localeCompare(y.id)
|
|
266
|
+
);
|
|
267
|
+
return {
|
|
268
|
+
nodeId: i.id,
|
|
269
|
+
edgeIds: l.map((f) => f.id),
|
|
270
|
+
targetNodeIds: z(l.map((f) => f.to))
|
|
271
|
+
};
|
|
272
|
+
}).filter((i) => i.targetNodeIds.length > 1).sort((i, l) => i.nodeId.localeCompare(l.nodeId)), G = new Set(
|
|
273
|
+
u.flatMap((i) => i.scenarioIds)
|
|
274
|
+
), x = new Set(
|
|
275
|
+
(e.nonVisualScenarioIds ?? []).map((i) => i.trim())
|
|
276
|
+
), B = z(
|
|
277
|
+
(e.scenarios ?? []).map((i) => i.id)
|
|
278
|
+
), k = B.filter(
|
|
279
|
+
(i) => !G.has(i) && !x.has(i)
|
|
280
|
+
);
|
|
281
|
+
for (const i of k)
|
|
282
|
+
t.push({
|
|
283
|
+
code: "missing-code-scenario",
|
|
284
|
+
severity: "warning",
|
|
285
|
+
message: `Code scenario "${i}" is not represented in the storyboard.`,
|
|
286
|
+
scenarioId: i
|
|
287
|
+
});
|
|
288
|
+
t.sort(
|
|
289
|
+
(i, l) => Ne(i).localeCompare(Ne(l))
|
|
290
|
+
);
|
|
291
|
+
const Q = z(
|
|
292
|
+
F.flatMap((i) => i.screenIds)
|
|
293
|
+
), v = {
|
|
294
|
+
screens: r.length,
|
|
295
|
+
canonicalNodes: u.length,
|
|
296
|
+
mergedScreens: Math.max(0, r.length - u.length),
|
|
297
|
+
edges: E.length,
|
|
298
|
+
connectedNodes: u.length - F.length,
|
|
299
|
+
disconnectedScreens: Q,
|
|
300
|
+
codeScenarios: B.length,
|
|
301
|
+
representedScenarios: B.filter(
|
|
302
|
+
(i) => G.has(i)
|
|
303
|
+
).length,
|
|
304
|
+
missingScenarios: k,
|
|
305
|
+
complete: Q.length === 0 && k.length === 0 && !t.some((i) => i.severity === "error") && s.size === 0
|
|
306
|
+
};
|
|
33
307
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
308
|
+
version: 1,
|
|
309
|
+
nodes: u,
|
|
310
|
+
edges: E,
|
|
311
|
+
aliases: Object.fromEntries(
|
|
312
|
+
Object.entries(c).sort(([i], [l]) => i.localeCompare(l))
|
|
313
|
+
),
|
|
314
|
+
sourceGroups: W,
|
|
315
|
+
startNodeIds: A,
|
|
316
|
+
branches: q,
|
|
317
|
+
warnings: t,
|
|
318
|
+
coverage: v
|
|
42
319
|
};
|
|
43
320
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
321
|
+
function wt(e) {
|
|
322
|
+
return e ? JSON.parse(JSON.stringify(e)) : void 0;
|
|
323
|
+
}
|
|
324
|
+
function oe(e) {
|
|
325
|
+
if (Array.isArray(e)) return e.map(oe);
|
|
326
|
+
if (e && typeof e == "object") {
|
|
327
|
+
const t = Object.entries(e).filter(([, r]) => r !== void 0).sort(([r], [n]) => r.localeCompare(n)).map(([r, n]) => [r, oe(n)]).filter(([, r]) => r !== void 0);
|
|
328
|
+
return t.length ? Object.fromEntries(t) : void 0;
|
|
329
|
+
}
|
|
330
|
+
return e;
|
|
331
|
+
}
|
|
332
|
+
function Ce(e) {
|
|
333
|
+
return JSON.stringify(oe(e ?? null));
|
|
334
|
+
}
|
|
335
|
+
function bt(e) {
|
|
336
|
+
return !!(e && typeof e == "object" && !Array.isArray(e));
|
|
337
|
+
}
|
|
338
|
+
function U(e) {
|
|
339
|
+
const t = e == null ? void 0 : e.trim();
|
|
49
340
|
if (!t) return null;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
341
|
+
let r = t;
|
|
342
|
+
try {
|
|
343
|
+
/^[a-z][a-z\d+.-]*:\/\//i.test(t) && (r = new URL(t).pathname);
|
|
344
|
+
} catch {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
return r = r.split(/[?#]/, 1)[0].replace(/\/{2,}/g, "/"), r.startsWith("/") || (r = `/${r}`), r.length > 1 && (r = r.replace(/\/+$/, "")), r || "/";
|
|
348
|
+
}
|
|
349
|
+
function De(e) {
|
|
350
|
+
return `source-route:${encodeURIComponent(e)}`;
|
|
351
|
+
}
|
|
352
|
+
function ye(e, t) {
|
|
353
|
+
const r = e.split("/").filter(Boolean), n = t.split("/").filter(Boolean);
|
|
354
|
+
let o = 0;
|
|
355
|
+
for (let s = 0; s < r.length; s += 1) {
|
|
356
|
+
const a = r[s];
|
|
357
|
+
if (a === "*" || a.startsWith("*")) return !0;
|
|
358
|
+
const c = n[o];
|
|
359
|
+
if (!(a.endsWith("?") && c == null)) {
|
|
360
|
+
if (c == null || !a.startsWith(":") && a !== c) return !1;
|
|
361
|
+
o += 1;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return o === n.length;
|
|
365
|
+
}
|
|
366
|
+
function Re(e, t) {
|
|
367
|
+
const r = U(e);
|
|
368
|
+
if (!r) return [];
|
|
369
|
+
const n = t.get(r);
|
|
370
|
+
return n && !/[:*]/.test(r) ? [n] : [
|
|
371
|
+
...new Set(
|
|
372
|
+
[...t.entries()].filter(([o]) => ye(r, o)).map(([, o]) => o)
|
|
373
|
+
)
|
|
374
|
+
].sort((o, s) => o.localeCompare(s));
|
|
375
|
+
}
|
|
376
|
+
function St(e) {
|
|
377
|
+
var r;
|
|
378
|
+
const t = /* @__PURE__ */ new Map();
|
|
379
|
+
for (const n of e ?? []) {
|
|
380
|
+
const o = U(n.path);
|
|
381
|
+
!o || t.has(o) || t.set(o, {
|
|
382
|
+
id: De(o),
|
|
383
|
+
name: o,
|
|
384
|
+
section: "Source routes",
|
|
385
|
+
codeName: ((r = n.id) == null ? void 0 : r.trim()) || void 0
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
return [...t.values()].sort((n, o) => n.id.localeCompare(o.id));
|
|
389
|
+
}
|
|
390
|
+
function vt(e, t, r) {
|
|
391
|
+
return (e ?? []).flatMap((n, o) => {
|
|
392
|
+
var u, b, P;
|
|
393
|
+
const s = (u = n.from) == null ? void 0 : u.trim(), a = (b = n.to) == null ? void 0 : b.trim();
|
|
394
|
+
if (!s || !a || n.unresolvedTarget) return [];
|
|
395
|
+
const c = r.has(s) ? [s] : Re(s, t), d = r.has(a) ? [a] : Re(a, t);
|
|
396
|
+
if (!c.length || !d.length) return [];
|
|
397
|
+
const h = ((P = n.id) == null ? void 0 : P.trim()) || `discovery-edge:${o + 1}`;
|
|
398
|
+
return c.flatMap(
|
|
399
|
+
(E, m) => d.map((N, p) => {
|
|
400
|
+
var $, R;
|
|
401
|
+
return {
|
|
402
|
+
id: c.length === 1 && d.length === 1 ? h : `${h}:${m + 1}:${p + 1}`,
|
|
403
|
+
from: E,
|
|
404
|
+
to: N,
|
|
405
|
+
kind: (($ = n.kind) == null ? void 0 : $.trim()) || void 0,
|
|
406
|
+
label: ((R = n.label) == null ? void 0 : R.trim()) || void 0
|
|
407
|
+
};
|
|
408
|
+
})
|
|
409
|
+
);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function It(e, t, r) {
|
|
413
|
+
const n = U(e.route);
|
|
414
|
+
if (!n) return [];
|
|
415
|
+
const o = t.filter(
|
|
416
|
+
(c) => {
|
|
417
|
+
const d = U(c.route);
|
|
418
|
+
return d ? ye(d, n) : !1;
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
if (!o.length) return [];
|
|
422
|
+
const s = Ce(
|
|
423
|
+
He(r, e.environment)
|
|
424
|
+
), a = o.filter(
|
|
425
|
+
(c) => Ce(c.environment) === s
|
|
426
|
+
);
|
|
427
|
+
return [
|
|
428
|
+
...new Set(
|
|
429
|
+
a.map((c) => {
|
|
430
|
+
var d;
|
|
431
|
+
return (d = c.scenarioId) == null ? void 0 : d.trim();
|
|
432
|
+
}).filter((c) => !!c)
|
|
433
|
+
)
|
|
434
|
+
].sort((c, d) => c.localeCompare(d));
|
|
435
|
+
}
|
|
436
|
+
function xt(e, t) {
|
|
437
|
+
const r = e.some((s) => s.importKind != null), n = t.candidates ?? [], o = ze(t);
|
|
438
|
+
return e.filter(
|
|
439
|
+
(s) => r ? s.importKind === "screens" : !!s.route
|
|
440
|
+
).map((s) => ({
|
|
54
441
|
id: s.id,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
442
|
+
name: s.name,
|
|
443
|
+
section: s.section ?? s.canvas ?? "Screens",
|
|
444
|
+
componentName: s.componentName,
|
|
445
|
+
gallery: s.gallery,
|
|
446
|
+
route: s.route,
|
|
447
|
+
path: s.path,
|
|
448
|
+
publish: s.publish,
|
|
449
|
+
width: s.width,
|
|
450
|
+
height: s.height,
|
|
451
|
+
frameSizeMode: s.frameSizeMode,
|
|
452
|
+
heightMode: s.heightMode,
|
|
453
|
+
maxHeight: s.maxHeight,
|
|
454
|
+
flow: s.flow,
|
|
455
|
+
scenario: s.scenario,
|
|
456
|
+
state: s.state,
|
|
457
|
+
scenarioId: s.scenarioId,
|
|
458
|
+
scenarioIds: It(s, n, o),
|
|
459
|
+
interactions: s.interactions,
|
|
460
|
+
environment: s.environment,
|
|
461
|
+
preset: s.preset,
|
|
462
|
+
assertions: s.assertions,
|
|
463
|
+
sourcePath: [...s.sourcePaths ?? []].filter(Boolean).sort((a, c) => a.localeCompare(c))[0]
|
|
464
|
+
}));
|
|
465
|
+
}
|
|
466
|
+
function le(e, t) {
|
|
467
|
+
var c, d, h, u;
|
|
468
|
+
const r = (((c = e.interactions) == null ? void 0 : c.length) ?? 0) - (((d = t.interactions) == null ? void 0 : d.length) ?? 0);
|
|
469
|
+
if (r !== 0) return r;
|
|
470
|
+
const n = (h = e.scenarioIds) != null && h.includes("environment:baseline") ? 0 : 1, o = (u = t.scenarioIds) != null && u.includes("environment:baseline") ? 0 : 1;
|
|
471
|
+
if (n !== o) return n - o;
|
|
472
|
+
const s = !e.environment && !e.preset ? 0 : 1, a = !t.environment && !t.preset ? 0 : 1;
|
|
473
|
+
return s !== a ? s - a : e.id.localeCompare(t.id);
|
|
474
|
+
}
|
|
475
|
+
function Pt(e) {
|
|
476
|
+
const t = /* @__PURE__ */ new Map();
|
|
477
|
+
for (const r of e) {
|
|
478
|
+
const n = U(r.route);
|
|
479
|
+
if (!n) continue;
|
|
480
|
+
const o = t.get(n);
|
|
481
|
+
o ? o.push(r) : t.set(n, [r]);
|
|
482
|
+
}
|
|
483
|
+
return new Map(
|
|
484
|
+
[...t.entries()].map(([r, n]) => {
|
|
485
|
+
const o = [...n].sort(le);
|
|
486
|
+
return [r, o[0].id];
|
|
487
|
+
})
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
function Et(e) {
|
|
491
|
+
return e.action === "wait" ? null : JSON.stringify(
|
|
492
|
+
oe({
|
|
493
|
+
action: e.action,
|
|
494
|
+
selector: e.selector,
|
|
495
|
+
text: e.text,
|
|
496
|
+
exact: e.exact,
|
|
497
|
+
index: e.index,
|
|
498
|
+
waitState: e.waitState,
|
|
499
|
+
value: e.value,
|
|
500
|
+
key: e.key,
|
|
501
|
+
storage: e.storage,
|
|
502
|
+
optional: e.optional
|
|
503
|
+
})
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
function ke(e) {
|
|
507
|
+
return (e.interactions ?? []).map(Et).filter((t) => t != null);
|
|
508
|
+
}
|
|
509
|
+
function Nt(e, t) {
|
|
510
|
+
return e.length < t.length && e.every((r, n) => r === t[n]);
|
|
511
|
+
}
|
|
512
|
+
function Ct(e, t) {
|
|
513
|
+
const r = /* @__PURE__ */ new Map();
|
|
514
|
+
for (const n of e) {
|
|
515
|
+
const o = U(n.route);
|
|
516
|
+
if (!o) continue;
|
|
517
|
+
const s = `${o}\0${ke(n).join("")}`, a = r.get(s);
|
|
518
|
+
a ? a.push(n) : r.set(s, [n]);
|
|
519
|
+
}
|
|
520
|
+
return [...r.values()].flatMap((n) => {
|
|
521
|
+
if (n.length < 2) return [];
|
|
522
|
+
const o = U(n[0].route), s = t.get(o), a = n.find((c) => c.id === s) ?? [...n].sort(le)[0];
|
|
523
|
+
return n.filter((c) => c.id !== a.id).sort((c, d) => c.id.localeCompare(d.id)).map((c) => ({
|
|
524
|
+
id: `discovery-variant:${encodeURIComponent(a.id)}:${encodeURIComponent(c.id)}`,
|
|
525
|
+
from: a.id,
|
|
526
|
+
to: c.id,
|
|
527
|
+
kind: "variant"
|
|
528
|
+
}));
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
function Rt(e, t) {
|
|
532
|
+
const r = /* @__PURE__ */ new Map();
|
|
533
|
+
for (const n of e) {
|
|
534
|
+
const o = U(n.route);
|
|
535
|
+
if (!o) continue;
|
|
536
|
+
const s = r.get(o);
|
|
537
|
+
s ? s.push(n) : r.set(o, [n]);
|
|
538
|
+
}
|
|
539
|
+
return [...r.entries()].flatMap(([n, o]) => {
|
|
540
|
+
const s = new Map(
|
|
541
|
+
o.map((d) => [d.id, ke(d)])
|
|
542
|
+
), a = t.get(n), c = o.find(
|
|
543
|
+
(d) => d.id === a
|
|
544
|
+
);
|
|
545
|
+
return o.flatMap((d) => {
|
|
546
|
+
const h = s.get(d.id);
|
|
547
|
+
if (!h.length) return [];
|
|
548
|
+
const b = o.filter(
|
|
549
|
+
(P) => Nt(
|
|
550
|
+
s.get(P.id),
|
|
551
|
+
h
|
|
552
|
+
)
|
|
553
|
+
).sort((P, E) => {
|
|
554
|
+
const m = s.get(E.id).length - s.get(P.id).length;
|
|
555
|
+
if (m !== 0) return m;
|
|
556
|
+
const N = P.flow && P.flow === d.flow ? 0 : 1, p = E.flow && E.flow === d.flow ? 0 : 1;
|
|
557
|
+
if (N !== p) return N - p;
|
|
558
|
+
const $ = P.section && P.section === d.section ? 0 : 1, R = E.section && E.section === d.section ? 0 : 1;
|
|
559
|
+
if ($ !== R) return $ - R;
|
|
560
|
+
const T = P.id === a ? 0 : 1, M = E.id === a ? 0 : 1;
|
|
561
|
+
return T !== M ? T - M : le(P, E);
|
|
562
|
+
})[0];
|
|
563
|
+
return b ? [
|
|
564
|
+
{
|
|
565
|
+
id: `discovery-recipe:${encodeURIComponent(b.id)}:${encodeURIComponent(d.id)}`,
|
|
566
|
+
from: b.id,
|
|
567
|
+
to: d.id,
|
|
568
|
+
kind: "recipe-step"
|
|
569
|
+
}
|
|
570
|
+
] : c && c.id !== d.id && s.get(c.id).join("") !== h.join("") ? [
|
|
571
|
+
{
|
|
572
|
+
id: `discovery-route-case:${encodeURIComponent(c.id)}:${encodeURIComponent(d.id)}`,
|
|
573
|
+
from: c.id,
|
|
574
|
+
to: d.id,
|
|
575
|
+
kind: "route-case"
|
|
576
|
+
}
|
|
577
|
+
] : [];
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function At(e) {
|
|
582
|
+
var r;
|
|
583
|
+
const t = /* @__PURE__ */ new Map();
|
|
584
|
+
for (const n of e) {
|
|
585
|
+
const o = (r = n.flow) == null ? void 0 : r.trim();
|
|
586
|
+
if (!o) continue;
|
|
587
|
+
const s = t.get(o);
|
|
588
|
+
s ? s.push(n) : t.set(o, [n]);
|
|
589
|
+
}
|
|
590
|
+
return [...t.values()].flatMap((n) => {
|
|
591
|
+
const o = n[0], s = /* @__PURE__ */ new Map();
|
|
592
|
+
for (const a of n) {
|
|
593
|
+
const c = U(a.route);
|
|
594
|
+
if (!c) continue;
|
|
595
|
+
const d = s.get(c);
|
|
596
|
+
d ? d.push(a) : s.set(c, [a]);
|
|
597
|
+
}
|
|
598
|
+
return s.size < 2 ? [] : [...s.values()].flatMap((a) => {
|
|
599
|
+
const c = [...a].sort(
|
|
600
|
+
le
|
|
601
|
+
)[0];
|
|
602
|
+
return c.id === o.id ? [] : [
|
|
603
|
+
{
|
|
604
|
+
id: `discovery-flow-route:${encodeURIComponent(o.id)}:${encodeURIComponent(c.id)}`,
|
|
605
|
+
from: o.id,
|
|
606
|
+
to: c.id,
|
|
607
|
+
kind: "flow-route"
|
|
608
|
+
}
|
|
609
|
+
];
|
|
610
|
+
});
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
function Ot(e, t, r) {
|
|
614
|
+
const n = new Set(
|
|
615
|
+
(t.routes ?? []).map((o) => U(o.path)).filter((o) => !!o)
|
|
616
|
+
);
|
|
617
|
+
return e.map((o) => {
|
|
618
|
+
const s = U(o.route);
|
|
619
|
+
if (!s || r.get(s) !== o.id)
|
|
620
|
+
return o;
|
|
621
|
+
const a = [...n].filter(
|
|
622
|
+
(c) => ye(c, s)
|
|
623
|
+
);
|
|
624
|
+
return a.length ? {
|
|
625
|
+
...o,
|
|
626
|
+
scenarioIds: [
|
|
627
|
+
.../* @__PURE__ */ new Set([
|
|
628
|
+
...o.scenarioIds ?? [],
|
|
629
|
+
...a.map(De)
|
|
630
|
+
])
|
|
631
|
+
].sort((c, d) => c.localeCompare(d))
|
|
632
|
+
} : o;
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
function $t(e, t) {
|
|
636
|
+
var h, u, b, P, E;
|
|
637
|
+
const r = new Set(e.map((m) => m.id)), n = new Map(
|
|
638
|
+
e.map((m, N) => [m.id, N])
|
|
639
|
+
), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
640
|
+
for (const m of r)
|
|
641
|
+
o.set(m, /* @__PURE__ */ new Set()), s.set(m, /* @__PURE__ */ new Set()), a.set(m, /* @__PURE__ */ new Set());
|
|
642
|
+
for (const m of t)
|
|
643
|
+
!r.has(m.from) || !r.has(m.to) || ((h = o.get(m.to)) == null || h.add(m.from), (u = s.get(m.from)) == null || u.add(m.to), (b = a.get(m.from)) == null || b.add(m.to), (P = a.get(m.to)) == null || P.add(m.from));
|
|
644
|
+
const c = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
645
|
+
for (const m of r) {
|
|
646
|
+
if (d.has(m)) continue;
|
|
647
|
+
const N = [], p = [m];
|
|
648
|
+
for (; p.length; ) {
|
|
649
|
+
const S = p.shift();
|
|
650
|
+
if (!d.has(S)) {
|
|
651
|
+
d.add(S), N.push(S);
|
|
652
|
+
for (const C of a.get(S) ?? [])
|
|
653
|
+
d.has(C) || p.push(C);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (N.length === 1 && (((E = a.get(N[0])) == null ? void 0 : E.size) ?? 0) === 0)
|
|
657
|
+
continue;
|
|
658
|
+
const $ = N.filter((S) => {
|
|
659
|
+
var C;
|
|
660
|
+
return (((C = o.get(S)) == null ? void 0 : C.size) ?? 0) === 0;
|
|
661
|
+
}).sort(
|
|
662
|
+
(S, C) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(C) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(C)
|
|
663
|
+
), R = [...N].sort(
|
|
664
|
+
(S, C) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(C) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(C)
|
|
665
|
+
)[0];
|
|
666
|
+
if (!R) continue;
|
|
667
|
+
const T = [R], M = /* @__PURE__ */ new Set(), A = (S) => {
|
|
668
|
+
const C = [S];
|
|
669
|
+
for (; C.length; ) {
|
|
670
|
+
const F = C.shift();
|
|
671
|
+
if (!M.has(F)) {
|
|
672
|
+
M.add(F);
|
|
673
|
+
for (const j of s.get(F) ?? [])
|
|
674
|
+
M.has(j) || C.push(j);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
A(R);
|
|
679
|
+
for (const S of $)
|
|
680
|
+
M.has(S) || (T.push(S), A(S));
|
|
681
|
+
for (const S of T)
|
|
682
|
+
c.add(S);
|
|
683
|
+
}
|
|
684
|
+
return [...c].sort(
|
|
685
|
+
(m, N) => (n.get(m) ?? Number.MAX_SAFE_INTEGER) - (n.get(N) ?? Number.MAX_SAFE_INTEGER) || m.localeCompare(N)
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
function ze(e) {
|
|
689
|
+
var t, r;
|
|
690
|
+
return wt(
|
|
691
|
+
(r = (t = e.scenarios) == null ? void 0 : t.find(
|
|
692
|
+
(n) => n.id === "environment:baseline"
|
|
693
|
+
)) == null ? void 0 : r.environment
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
function Mt(e) {
|
|
697
|
+
const t = xt(
|
|
698
|
+
e.pages,
|
|
699
|
+
e.manifest
|
|
700
|
+
), r = Pt(t), n = Ot(
|
|
701
|
+
t,
|
|
702
|
+
e.manifest,
|
|
703
|
+
r
|
|
704
|
+
), s = [
|
|
705
|
+
...vt(
|
|
706
|
+
e.manifest.edges,
|
|
707
|
+
r,
|
|
708
|
+
new Set(n.map((a) => a.id))
|
|
709
|
+
),
|
|
710
|
+
...Ct(n, r),
|
|
711
|
+
...Rt(n, r),
|
|
712
|
+
...At(n)
|
|
713
|
+
];
|
|
714
|
+
return yt({
|
|
715
|
+
screens: n,
|
|
716
|
+
assets: e.assets,
|
|
717
|
+
scenarios: St(e.manifest.routes),
|
|
718
|
+
inferredEdges: s,
|
|
719
|
+
startScreenIds: $t(n, s)
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
async function _e(e) {
|
|
723
|
+
const r = await (e.fetcher ?? ((o, s) => fetch(o, s)))(e.endpoint, {
|
|
724
|
+
headers: { accept: "application/json" },
|
|
725
|
+
cache: "no-store",
|
|
726
|
+
signal: e.signal
|
|
727
|
+
});
|
|
728
|
+
if (!r.ok)
|
|
729
|
+
throw new Error(`Storyboard discovery failed (${r.status})`);
|
|
730
|
+
const n = await r.json();
|
|
731
|
+
if (!bt(n))
|
|
732
|
+
throw new Error("Storyboard discovery returned an invalid manifest.");
|
|
733
|
+
return {
|
|
734
|
+
manifest: n,
|
|
735
|
+
baselineEnvironment: ze(n),
|
|
736
|
+
graph: Mt({
|
|
737
|
+
manifest: n,
|
|
738
|
+
pages: e.pages,
|
|
739
|
+
assets: e.assets
|
|
740
|
+
})
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
async function mn(e) {
|
|
744
|
+
V(null);
|
|
745
|
+
try {
|
|
746
|
+
const t = await _e(e);
|
|
747
|
+
return V(t.graph), t;
|
|
748
|
+
} catch (t) {
|
|
749
|
+
throw V(null), t;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const Tt = "pygmalion-preview", Dt = "unknown", kt = 512, zt = 2048, _t = 8 * 1024 * 1024, Ft = 128 * 1024 * 1024, Bt = /* @__PURE__ */ new Set([
|
|
753
|
+
"__proto__",
|
|
754
|
+
"constructor",
|
|
755
|
+
"prototype"
|
|
756
|
+
]);
|
|
757
|
+
function J(e, t) {
|
|
758
|
+
const r = e.trim();
|
|
759
|
+
if (!r && t != null) return t;
|
|
760
|
+
if (re(r)) return r;
|
|
761
|
+
throw new TypeError("Preview identity must be a non-empty bounded string.");
|
|
762
|
+
}
|
|
763
|
+
function jt(e) {
|
|
764
|
+
const t = e ?? 1;
|
|
765
|
+
if (!Number.isSafeInteger(t) || t < 1)
|
|
766
|
+
throw new TypeError(
|
|
767
|
+
"Preview recipe version must be a positive safe integer."
|
|
768
|
+
);
|
|
769
|
+
return t;
|
|
770
|
+
}
|
|
771
|
+
function he(e, t = /* @__PURE__ */ new Set()) {
|
|
772
|
+
if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
|
|
773
|
+
return e;
|
|
774
|
+
if (typeof e != "object") return null;
|
|
775
|
+
if (t.has(e))
|
|
776
|
+
throw new TypeError(
|
|
777
|
+
"Preview recipe identity cannot contain circular values."
|
|
778
|
+
);
|
|
779
|
+
if (t.add(e), Array.isArray(e)) {
|
|
780
|
+
const n = e.map((o) => he(o, t));
|
|
781
|
+
return t.delete(e), n;
|
|
782
|
+
}
|
|
783
|
+
const r = {};
|
|
784
|
+
for (const n of Object.keys(e).sort()) {
|
|
785
|
+
const o = e[n];
|
|
786
|
+
o !== void 0 && (r[n] = he(o, t));
|
|
787
|
+
}
|
|
788
|
+
return t.delete(e), r;
|
|
789
|
+
}
|
|
790
|
+
function Ut(e) {
|
|
791
|
+
let t = 2166136261, r = 2654435769;
|
|
792
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
793
|
+
const o = e.charCodeAt(n);
|
|
794
|
+
t = Math.imul(t ^ o, 16777619), r = Math.imul(r ^ o + n, 2246822507);
|
|
795
|
+
}
|
|
796
|
+
return `${(t >>> 0).toString(16).padStart(8, "0")}${(r >>> 0).toString(16).padStart(8, "0")}`;
|
|
797
|
+
}
|
|
798
|
+
function Ht(e) {
|
|
799
|
+
if (!Array.isArray(e))
|
|
800
|
+
throw new TypeError("Preview recipes must be an array.");
|
|
801
|
+
const t = /* @__PURE__ */ new Set(), r = e.map(({ id: n, recipe: o }) => {
|
|
802
|
+
const s = J(n);
|
|
803
|
+
if (t.has(s))
|
|
804
|
+
throw new TypeError(`Duplicate preview recipe identity: ${s}`);
|
|
805
|
+
return t.add(s), {
|
|
806
|
+
id: s,
|
|
807
|
+
recipe: he(o)
|
|
808
|
+
};
|
|
809
|
+
});
|
|
810
|
+
return Ut(JSON.stringify(r));
|
|
811
|
+
}
|
|
812
|
+
function gn({
|
|
813
|
+
sourceRevision: e,
|
|
814
|
+
recipes: t,
|
|
815
|
+
recipeVersion: r,
|
|
816
|
+
scope: n = Tt
|
|
817
|
+
}) {
|
|
818
|
+
const o = J(n), s = J(
|
|
819
|
+
e,
|
|
820
|
+
Dt
|
|
821
|
+
), a = jt(r), c = Ht(t);
|
|
822
|
+
return `${o}:${encodeURIComponent(s)}:recipe-v${a}:${c}`;
|
|
823
|
+
}
|
|
824
|
+
function yn(e) {
|
|
825
|
+
return {
|
|
826
|
+
route: e.route,
|
|
827
|
+
path: e.path,
|
|
828
|
+
componentName: e.componentName,
|
|
829
|
+
gallery: e.gallery,
|
|
830
|
+
width: e.width,
|
|
831
|
+
height: e.height,
|
|
832
|
+
environment: e.environment,
|
|
833
|
+
preset: e.preset,
|
|
834
|
+
interactions: (e.interactions ?? []).map((t) => ({
|
|
835
|
+
action: t.action,
|
|
836
|
+
selector: t.selector,
|
|
837
|
+
text: t.text,
|
|
838
|
+
exact: t.exact,
|
|
839
|
+
index: t.index,
|
|
840
|
+
value: t.value,
|
|
841
|
+
key: t.key,
|
|
842
|
+
storage: t.storage,
|
|
843
|
+
optional: t.optional,
|
|
844
|
+
settleMs: t.settleMs,
|
|
845
|
+
timeoutMs: t.timeoutMs,
|
|
846
|
+
waitState: t.waitState
|
|
847
|
+
})),
|
|
848
|
+
assertions: e.assertions
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function Kt({
|
|
852
|
+
endpoint: e,
|
|
853
|
+
fetcher: t,
|
|
854
|
+
captureBaseUrl: r
|
|
855
|
+
}) {
|
|
856
|
+
const n = e.trim();
|
|
857
|
+
if (!n)
|
|
858
|
+
throw new TypeError(
|
|
859
|
+
"Preview artifact endpoint must be a non-empty string."
|
|
860
|
+
);
|
|
861
|
+
const o = t ?? ((s, a) => fetch(s, a));
|
|
862
|
+
return async (s) => {
|
|
863
|
+
const a = new URLSearchParams({
|
|
864
|
+
namespace: s.namespace,
|
|
865
|
+
sourceRevision: s.sourceRevision
|
|
866
|
+
}), c = s.captureBaseUrl ?? r;
|
|
867
|
+
c && a.set("captureBaseUrl", c);
|
|
868
|
+
const d = n.includes("?") ? "&" : "?", h = await o(
|
|
869
|
+
`${n}${d}${a}`,
|
|
870
|
+
{
|
|
871
|
+
method: "GET",
|
|
872
|
+
headers: { accept: "application/json" },
|
|
873
|
+
cache: "no-store",
|
|
874
|
+
signal: s.signal
|
|
875
|
+
}
|
|
876
|
+
);
|
|
877
|
+
return h.ok ? h.json().catch(() => null) : null;
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
function se(e) {
|
|
881
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return !1;
|
|
882
|
+
const t = Object.getPrototypeOf(e);
|
|
883
|
+
return t === Object.prototype || t === null;
|
|
884
|
+
}
|
|
885
|
+
function Fe(e) {
|
|
886
|
+
return new TextEncoder().encode(e).byteLength;
|
|
887
|
+
}
|
|
888
|
+
function re(e) {
|
|
889
|
+
return typeof e == "string" && e.length > 0 && e.length <= kt && e === e.trim() && !Bt.has(e);
|
|
890
|
+
}
|
|
891
|
+
function qt(e) {
|
|
892
|
+
const t = /(?:expression\s*\(|-moz-binding\s*:|(?:^|[;{])\s*behavior\s*:)/i;
|
|
893
|
+
for (const r of e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi))
|
|
894
|
+
if (t.test(r[1] ?? "")) return !0;
|
|
895
|
+
for (const r of e.matchAll(
|
|
896
|
+
/\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi
|
|
897
|
+
))
|
|
898
|
+
if (t.test(r[1] ?? r[2] ?? r[3] ?? "")) return !0;
|
|
899
|
+
return !1;
|
|
900
|
+
}
|
|
901
|
+
function Gt(e) {
|
|
902
|
+
return typeof e != "string" || e.length === 0 || Fe(e) > _t ? !1 : !(/<\s*(?:script|iframe|object|embed|applet|portal)\b/i.test(e) || /<\s*meta\b[^>]*http-equiv\s*=\s*["']?\s*refresh\b/i.test(e) || /\s(?:on[a-z][\w:-]*|srcdoc)\s*=/i.test(e) || /\s(?:href|src|action|formaction|xlink:href)\s*=\s*(?:"\s*|'?\s*)(?:javascript|vbscript|data\s*:\s*text\/html)\s*:/i.test(
|
|
903
|
+
e
|
|
904
|
+
) || qt(e));
|
|
905
|
+
}
|
|
906
|
+
function Lt(e) {
|
|
907
|
+
const t = [];
|
|
908
|
+
if (!se(e) || e.version !== 1)
|
|
909
|
+
return {
|
|
910
|
+
valid: !1,
|
|
911
|
+
artifact: null,
|
|
912
|
+
errors: [
|
|
913
|
+
"Preview artifact must be a version 1, version 2, or version 3 bundle."
|
|
914
|
+
]
|
|
915
|
+
};
|
|
916
|
+
if (re(e.namespace) || t.push("Preview artifact namespace is invalid."), e.sourceRevision != null && !re(e.sourceRevision) && t.push("Preview artifact source revision is invalid."), !se(e.snapshots))
|
|
917
|
+
t.push("Preview artifact snapshots must be a record.");
|
|
918
|
+
else {
|
|
919
|
+
const r = Object.entries(e.snapshots);
|
|
920
|
+
r.length > zt && t.push("Preview artifact has too many frames.");
|
|
921
|
+
for (const [n, o] of r)
|
|
922
|
+
(!re(n) || !Gt(o)) && t.push(`Preview artifact frame "${n}" is invalid.`);
|
|
923
|
+
}
|
|
924
|
+
try {
|
|
925
|
+
Fe(JSON.stringify(e)) > Ft && t.push("Preview artifact exceeds the bundle byte limit.");
|
|
926
|
+
} catch {
|
|
927
|
+
t.push("Preview artifact is not serializable.");
|
|
928
|
+
}
|
|
929
|
+
return {
|
|
930
|
+
valid: t.length === 0,
|
|
931
|
+
artifact: t.length === 0 ? e : null,
|
|
932
|
+
errors: t
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
function Vt(e, t) {
|
|
936
|
+
const r = se(e) && e.version === 3 ? (() => {
|
|
937
|
+
const n = Ke(e);
|
|
938
|
+
return {
|
|
939
|
+
valid: n.valid,
|
|
940
|
+
artifact: n.valid ? e : null,
|
|
941
|
+
errors: n.errors
|
|
942
|
+
};
|
|
943
|
+
})() : se(e) && e.version === 2 ? (() => {
|
|
944
|
+
const n = qe(e);
|
|
945
|
+
return {
|
|
946
|
+
valid: n.valid,
|
|
947
|
+
artifact: n.valid ? e : null,
|
|
948
|
+
errors: n.errors
|
|
949
|
+
};
|
|
950
|
+
})() : Lt(e);
|
|
951
|
+
return !r.valid || !r.artifact ? {
|
|
952
|
+
valid: !1,
|
|
953
|
+
artifact: null,
|
|
954
|
+
reason: "invalid-bundle",
|
|
955
|
+
errors: r.errors
|
|
956
|
+
} : t && r.artifact.namespace !== J(t.namespace) ? {
|
|
957
|
+
valid: !1,
|
|
958
|
+
artifact: null,
|
|
959
|
+
reason: "namespace-mismatch",
|
|
960
|
+
errors: [
|
|
961
|
+
"Preview artifact namespace does not match the runtime namespace."
|
|
962
|
+
]
|
|
963
|
+
} : t && r.artifact.sourceRevision !== J(t.sourceRevision) ? {
|
|
964
|
+
valid: !1,
|
|
965
|
+
artifact: null,
|
|
966
|
+
reason: "revision-mismatch",
|
|
967
|
+
errors: [
|
|
968
|
+
"Preview artifact source revision does not match the runtime revision."
|
|
969
|
+
]
|
|
970
|
+
} : {
|
|
971
|
+
valid: !0,
|
|
972
|
+
artifact: r.artifact,
|
|
973
|
+
errors: []
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
async function Jt({
|
|
977
|
+
namespace: e,
|
|
978
|
+
sourceRevision: t,
|
|
979
|
+
transport: r,
|
|
980
|
+
signal: n
|
|
981
|
+
}) {
|
|
982
|
+
const o = {
|
|
983
|
+
namespace: J(e),
|
|
984
|
+
sourceRevision: J(t)
|
|
985
|
+
};
|
|
986
|
+
let s;
|
|
987
|
+
try {
|
|
988
|
+
s = await r({ ...o, signal: n });
|
|
989
|
+
} catch (c) {
|
|
990
|
+
if (n != null && n.aborted) throw c;
|
|
991
|
+
return { status: "unavailable", artifact: null, error: c };
|
|
992
|
+
}
|
|
993
|
+
if (s == null)
|
|
994
|
+
return { status: "unavailable", artifact: null };
|
|
995
|
+
const a = Vt(s, o);
|
|
996
|
+
return a.valid ? { status: "accepted", artifact: a.artifact } : {
|
|
997
|
+
status: "rejected",
|
|
998
|
+
artifact: null,
|
|
999
|
+
reason: a.reason,
|
|
1000
|
+
errors: a.errors
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
const ie = "var(--pygmalion-catalog-surface, #ffffff)", ae = "var(--pygmalion-catalog-canvas, #f5f5f5)", me = "var(--pygmalion-catalog-border, #e5e7eb)", ce = "var(--pygmalion-catalog-text, #202124)", _ = "var(--pygmalion-catalog-muted, #6b7280)", Wt = "var(--pygmalion-catalog-header, #11182f)", Qt = "var(--pygmalion-catalog-accent, #7c6cf2)";
|
|
1004
|
+
function wn({
|
|
1005
|
+
title: e,
|
|
1006
|
+
eyebrow: t,
|
|
1007
|
+
description: r,
|
|
1008
|
+
version: n,
|
|
1009
|
+
meta: o,
|
|
1010
|
+
children: s,
|
|
1011
|
+
headerBackground: a = Wt,
|
|
1012
|
+
headerColor: c = "#ffffff",
|
|
1013
|
+
bodyBackground: d = ie,
|
|
1014
|
+
bodyGap: h = 40
|
|
1015
|
+
}) {
|
|
1016
|
+
return /* @__PURE__ */ O(
|
|
1017
|
+
"section",
|
|
1018
|
+
{
|
|
1019
|
+
"data-pygmalion-catalog-document": "",
|
|
1020
|
+
"data-pygmalion-content-bounds": "",
|
|
1021
|
+
style: {
|
|
1022
|
+
boxSizing: "border-box",
|
|
1023
|
+
display: "inline-flex",
|
|
1024
|
+
width: "max-content",
|
|
1025
|
+
maxWidth: "none",
|
|
1026
|
+
flexDirection: "column",
|
|
1027
|
+
overflow: "visible",
|
|
1028
|
+
color: ce,
|
|
1029
|
+
background: d,
|
|
1030
|
+
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
|
|
1031
|
+
},
|
|
1032
|
+
children: [
|
|
1033
|
+
/* @__PURE__ */ O(
|
|
1034
|
+
"header",
|
|
1035
|
+
{
|
|
1036
|
+
style: {
|
|
1037
|
+
boxSizing: "border-box",
|
|
1038
|
+
display: "flex",
|
|
1039
|
+
alignItems: "flex-end",
|
|
1040
|
+
justifyContent: "space-between",
|
|
1041
|
+
gap: 48,
|
|
1042
|
+
padding: "44px 48px 48px",
|
|
1043
|
+
color: c,
|
|
1044
|
+
background: a
|
|
1045
|
+
},
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ O("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
1048
|
+
t ? /* @__PURE__ */ w(
|
|
1049
|
+
"div",
|
|
1050
|
+
{
|
|
1051
|
+
style: {
|
|
1052
|
+
color: "color-mix(in srgb, currentColor 68%, transparent)",
|
|
1053
|
+
fontSize: 12,
|
|
1054
|
+
fontWeight: 700,
|
|
1055
|
+
letterSpacing: "0.12em",
|
|
1056
|
+
textTransform: "uppercase"
|
|
1057
|
+
},
|
|
1058
|
+
children: t
|
|
1059
|
+
}
|
|
1060
|
+
) : null,
|
|
1061
|
+
/* @__PURE__ */ w(
|
|
1062
|
+
"h1",
|
|
1063
|
+
{
|
|
1064
|
+
style: {
|
|
1065
|
+
margin: 0,
|
|
1066
|
+
fontSize: 60,
|
|
1067
|
+
fontWeight: 700,
|
|
1068
|
+
letterSpacing: "-0.045em",
|
|
1069
|
+
lineHeight: 0.96,
|
|
1070
|
+
whiteSpace: "nowrap"
|
|
1071
|
+
},
|
|
1072
|
+
children: e
|
|
1073
|
+
}
|
|
1074
|
+
),
|
|
1075
|
+
r ? /* @__PURE__ */ w(
|
|
1076
|
+
"div",
|
|
1077
|
+
{
|
|
1078
|
+
style: {
|
|
1079
|
+
maxWidth: 640,
|
|
1080
|
+
color: "color-mix(in srgb, currentColor 72%, transparent)",
|
|
1081
|
+
fontSize: 13,
|
|
1082
|
+
lineHeight: 1.55
|
|
1083
|
+
},
|
|
1084
|
+
children: r
|
|
1085
|
+
}
|
|
1086
|
+
) : null
|
|
1087
|
+
] }),
|
|
1088
|
+
n || o ? /* @__PURE__ */ O(
|
|
1089
|
+
"div",
|
|
1090
|
+
{
|
|
1091
|
+
style: {
|
|
1092
|
+
display: "flex",
|
|
1093
|
+
alignItems: "flex-end",
|
|
1094
|
+
gap: 24,
|
|
1095
|
+
color: "color-mix(in srgb, currentColor 72%, transparent)",
|
|
1096
|
+
fontSize: 12,
|
|
1097
|
+
whiteSpace: "nowrap"
|
|
1098
|
+
},
|
|
1099
|
+
children: [
|
|
1100
|
+
n ? /* @__PURE__ */ w("span", { children: n }) : null,
|
|
1101
|
+
o ? /* @__PURE__ */ w("span", { children: o }) : null
|
|
1102
|
+
]
|
|
1103
|
+
}
|
|
1104
|
+
) : null
|
|
1105
|
+
]
|
|
1106
|
+
}
|
|
1107
|
+
),
|
|
1108
|
+
/* @__PURE__ */ w(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
"data-pygmalion-catalog-document-body": "",
|
|
1112
|
+
style: {
|
|
1113
|
+
boxSizing: "border-box",
|
|
1114
|
+
display: "inline-flex",
|
|
1115
|
+
flexDirection: "column",
|
|
1116
|
+
alignItems: "flex-start",
|
|
1117
|
+
gap: h,
|
|
1118
|
+
padding: 48,
|
|
1119
|
+
background: d
|
|
1120
|
+
},
|
|
1121
|
+
children: s
|
|
1122
|
+
}
|
|
1123
|
+
)
|
|
1124
|
+
]
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
function bn({
|
|
1129
|
+
title: e,
|
|
1130
|
+
count: t,
|
|
1131
|
+
description: r,
|
|
1132
|
+
children: n,
|
|
1133
|
+
tone: o = "tinted"
|
|
1134
|
+
}) {
|
|
1135
|
+
return /* @__PURE__ */ O(
|
|
1136
|
+
"section",
|
|
1137
|
+
{
|
|
1138
|
+
"data-pygmalion-catalog-section": "",
|
|
1139
|
+
style: {
|
|
1140
|
+
boxSizing: "border-box",
|
|
1141
|
+
display: "inline-flex",
|
|
1142
|
+
width: "max-content",
|
|
1143
|
+
flexDirection: "column",
|
|
1144
|
+
alignItems: "flex-start",
|
|
1145
|
+
gap: 18,
|
|
1146
|
+
padding: o === "tinted" ? 24 : 0,
|
|
1147
|
+
background: o === "tinted" ? ae : "transparent"
|
|
1148
|
+
},
|
|
1149
|
+
children: [
|
|
1150
|
+
/* @__PURE__ */ O("header", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
|
|
1151
|
+
/* @__PURE__ */ w(
|
|
1152
|
+
"h2",
|
|
1153
|
+
{
|
|
1154
|
+
style: {
|
|
1155
|
+
margin: 0,
|
|
1156
|
+
fontSize: 15,
|
|
1157
|
+
fontWeight: 700,
|
|
1158
|
+
letterSpacing: "-0.01em"
|
|
1159
|
+
},
|
|
1160
|
+
children: e
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
typeof t == "number" ? /* @__PURE__ */ w("span", { style: { color: _, fontSize: 11 }, children: t }) : null
|
|
1164
|
+
] }),
|
|
1165
|
+
r ? /* @__PURE__ */ w("div", { style: { marginTop: -10, color: _, fontSize: 11 }, children: r }) : null,
|
|
1166
|
+
n
|
|
1167
|
+
]
|
|
1168
|
+
}
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
function Sn({
|
|
1172
|
+
rows: e,
|
|
1173
|
+
columns: t,
|
|
1174
|
+
cornerLabel: r,
|
|
1175
|
+
renderCell: n,
|
|
1176
|
+
renderRowLabel: o = (d) => d,
|
|
1177
|
+
renderColumnLabel: s = (d) => d,
|
|
1178
|
+
boundary: a = !0,
|
|
1179
|
+
cellStyle: c
|
|
1180
|
+
}) {
|
|
1181
|
+
return /* @__PURE__ */ w(
|
|
1182
|
+
"div",
|
|
1183
|
+
{
|
|
1184
|
+
"data-pygmalion-catalog-matrix": "",
|
|
1185
|
+
style: {
|
|
1186
|
+
boxSizing: "border-box",
|
|
1187
|
+
display: "inline-block",
|
|
1188
|
+
width: "max-content",
|
|
1189
|
+
padding: a ? 16 : 0,
|
|
1190
|
+
border: a ? `1px dashed ${Qt}` : void 0,
|
|
1191
|
+
borderRadius: a ? 4 : void 0
|
|
1192
|
+
},
|
|
1193
|
+
children: /* @__PURE__ */ O(
|
|
1194
|
+
"table",
|
|
1195
|
+
{
|
|
1196
|
+
style: {
|
|
1197
|
+
width: "max-content",
|
|
1198
|
+
borderCollapse: "separate",
|
|
1199
|
+
borderSpacing: 0
|
|
1200
|
+
},
|
|
1201
|
+
children: [
|
|
1202
|
+
/* @__PURE__ */ w("thead", { children: /* @__PURE__ */ O("tr", { children: [
|
|
1203
|
+
/* @__PURE__ */ w(
|
|
1204
|
+
"th",
|
|
1205
|
+
{
|
|
1206
|
+
style: {
|
|
1207
|
+
padding: "0 16px 12px 0",
|
|
1208
|
+
color: _,
|
|
1209
|
+
fontSize: 10,
|
|
1210
|
+
fontWeight: 600,
|
|
1211
|
+
textAlign: "left",
|
|
1212
|
+
whiteSpace: "nowrap"
|
|
1213
|
+
},
|
|
1214
|
+
children: r
|
|
1215
|
+
}
|
|
1216
|
+
),
|
|
1217
|
+
t.map((d) => /* @__PURE__ */ w(
|
|
1218
|
+
"th",
|
|
1219
|
+
{
|
|
1220
|
+
style: {
|
|
1221
|
+
padding: "0 16px 12px",
|
|
1222
|
+
color: _,
|
|
1223
|
+
fontSize: 10,
|
|
1224
|
+
fontWeight: 600,
|
|
1225
|
+
textAlign: "center",
|
|
1226
|
+
whiteSpace: "nowrap"
|
|
1227
|
+
},
|
|
1228
|
+
children: s(d)
|
|
1229
|
+
},
|
|
1230
|
+
d
|
|
1231
|
+
))
|
|
1232
|
+
] }) }),
|
|
1233
|
+
/* @__PURE__ */ w("tbody", { children: e.map((d) => /* @__PURE__ */ O("tr", { children: [
|
|
1234
|
+
/* @__PURE__ */ w(
|
|
1235
|
+
"th",
|
|
1236
|
+
{
|
|
1237
|
+
style: {
|
|
1238
|
+
padding: "12px 16px 12px 0",
|
|
1239
|
+
color: _,
|
|
1240
|
+
fontSize: 10,
|
|
1241
|
+
fontWeight: 600,
|
|
1242
|
+
textAlign: "left",
|
|
1243
|
+
whiteSpace: "nowrap"
|
|
1244
|
+
},
|
|
1245
|
+
children: o(d)
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
t.map((h) => /* @__PURE__ */ w(
|
|
1249
|
+
"td",
|
|
1250
|
+
{
|
|
1251
|
+
style: {
|
|
1252
|
+
padding: "12px 16px",
|
|
1253
|
+
textAlign: "center",
|
|
1254
|
+
verticalAlign: "middle",
|
|
1255
|
+
...c
|
|
1256
|
+
},
|
|
1257
|
+
children: n(d, h)
|
|
1258
|
+
},
|
|
1259
|
+
h
|
|
1260
|
+
))
|
|
1261
|
+
] }, d)) })
|
|
1262
|
+
]
|
|
1263
|
+
}
|
|
1264
|
+
)
|
|
1265
|
+
}
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
function Xt(e) {
|
|
1269
|
+
return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase() || "page";
|
|
1270
|
+
}
|
|
1271
|
+
function Be(e, t, r = "PygmalionCatalog") {
|
|
1272
|
+
const n = (o) => Xt(o).replace(/-/g, "_");
|
|
1273
|
+
return `${r}_${n(e)}_${n(t)}`;
|
|
1274
|
+
}
|
|
1275
|
+
function je(e, t) {
|
|
1276
|
+
return {
|
|
1277
|
+
id: e.id,
|
|
1278
|
+
name: e.name,
|
|
1279
|
+
section: e.section,
|
|
1280
|
+
pageId: t,
|
|
1281
|
+
sourcePath: e.sourcePath,
|
|
1282
|
+
codeName: e.codeName,
|
|
1283
|
+
description: e.description
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
function Ue(e) {
|
|
1287
|
+
const t = /* @__PURE__ */ new Set();
|
|
1288
|
+
for (const r of e) {
|
|
1289
|
+
if (t.has(r.id))
|
|
1290
|
+
throw new Error(`Duplicate design catalog item id: ${r.id}`);
|
|
1291
|
+
t.add(r.id);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
function Yt(e, t, r) {
|
|
1295
|
+
return typeof e == "function" ? e(t, r) : e;
|
|
1296
|
+
}
|
|
1297
|
+
function Zt({
|
|
1298
|
+
page: e,
|
|
1299
|
+
items: t,
|
|
1300
|
+
renderPreview: r,
|
|
1301
|
+
secondaryLabel: n,
|
|
1302
|
+
minimumColumnWidth: o
|
|
1303
|
+
}) {
|
|
1304
|
+
return /* @__PURE__ */ O(
|
|
1305
|
+
"section",
|
|
1306
|
+
{
|
|
1307
|
+
"data-pygmalion-catalog-page": e.id,
|
|
1308
|
+
"data-pygmalion-content-bounds": "",
|
|
1309
|
+
style: {
|
|
1310
|
+
boxSizing: "border-box",
|
|
1311
|
+
display: "inline-block",
|
|
1312
|
+
width: "max-content",
|
|
1313
|
+
padding: 32,
|
|
1314
|
+
color: ce,
|
|
1315
|
+
background: ae,
|
|
1316
|
+
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
|
|
1317
|
+
},
|
|
1318
|
+
children: [
|
|
1319
|
+
/* @__PURE__ */ O("header", { style: { marginBottom: 24 }, children: [
|
|
1320
|
+
/* @__PURE__ */ w("h1", { style: { margin: 0, fontSize: 24, lineHeight: 1.35 }, children: e.name }),
|
|
1321
|
+
/* @__PURE__ */ O("p", { style: { margin: "6px 0 0", color: _, fontSize: 13 }, children: [
|
|
1322
|
+
t.length,
|
|
1323
|
+
" assets"
|
|
1324
|
+
] })
|
|
1325
|
+
] }),
|
|
1326
|
+
/* @__PURE__ */ w(
|
|
1327
|
+
"div",
|
|
1328
|
+
{
|
|
1329
|
+
style: {
|
|
1330
|
+
display: "inline-grid",
|
|
1331
|
+
gridTemplateColumns: "repeat(6, max-content)",
|
|
1332
|
+
gap: 16
|
|
1333
|
+
},
|
|
1334
|
+
children: t.map((s) => /* @__PURE__ */ O(
|
|
1335
|
+
"article",
|
|
1336
|
+
{
|
|
1337
|
+
"data-pygmalion-catalog-item": s.id,
|
|
1338
|
+
style: {
|
|
1339
|
+
minWidth: o,
|
|
1340
|
+
width: o,
|
|
1341
|
+
padding: 16,
|
|
1342
|
+
border: `1px solid ${me}`,
|
|
1343
|
+
borderRadius: 12,
|
|
1344
|
+
background: ie
|
|
1345
|
+
},
|
|
1346
|
+
children: [
|
|
1347
|
+
/* @__PURE__ */ w(
|
|
1348
|
+
"div",
|
|
1349
|
+
{
|
|
1350
|
+
style: {
|
|
1351
|
+
display: "flex",
|
|
1352
|
+
minHeight: 64,
|
|
1353
|
+
alignItems: "center",
|
|
1354
|
+
justifyContent: "center",
|
|
1355
|
+
overflow: "hidden"
|
|
1356
|
+
},
|
|
1357
|
+
children: r(s)
|
|
1358
|
+
}
|
|
1359
|
+
),
|
|
1360
|
+
/* @__PURE__ */ w(
|
|
1361
|
+
"div",
|
|
1362
|
+
{
|
|
1363
|
+
style: {
|
|
1364
|
+
marginTop: 12,
|
|
1365
|
+
overflow: "hidden",
|
|
1366
|
+
fontSize: 13,
|
|
1367
|
+
fontWeight: 600,
|
|
1368
|
+
textOverflow: "ellipsis",
|
|
1369
|
+
whiteSpace: "nowrap"
|
|
1370
|
+
},
|
|
1371
|
+
title: s.name,
|
|
1372
|
+
children: s.name
|
|
1373
|
+
}
|
|
1374
|
+
),
|
|
1375
|
+
n ? /* @__PURE__ */ w("div", { style: { marginTop: 4, color: _, fontSize: 11, lineHeight: 1.45 }, children: n(s) }) : s.codeName ? /* @__PURE__ */ w(
|
|
1376
|
+
"div",
|
|
1377
|
+
{
|
|
1378
|
+
style: {
|
|
1379
|
+
marginTop: 4,
|
|
1380
|
+
overflow: "hidden",
|
|
1381
|
+
color: _,
|
|
1382
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
1383
|
+
fontSize: 11,
|
|
1384
|
+
textOverflow: "ellipsis",
|
|
1385
|
+
whiteSpace: "nowrap"
|
|
1386
|
+
},
|
|
1387
|
+
title: s.codeName,
|
|
1388
|
+
children: s.codeName
|
|
1389
|
+
}
|
|
1390
|
+
) : null
|
|
1391
|
+
]
|
|
1392
|
+
},
|
|
1393
|
+
s.id
|
|
1394
|
+
))
|
|
1395
|
+
}
|
|
1396
|
+
)
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
function vn(e) {
|
|
1402
|
+
Ue(e.items);
|
|
1403
|
+
const t = /* @__PURE__ */ new Map();
|
|
1404
|
+
for (const o of e.items) {
|
|
1405
|
+
const s = e.pageFor(o), a = t.get(s.id);
|
|
1406
|
+
if (a) {
|
|
1407
|
+
if (a.page.name !== s.name || a.page.section !== s.section)
|
|
1408
|
+
throw new Error(`Conflicting design catalog page descriptor: ${s.id}`);
|
|
1409
|
+
a.items.push(o);
|
|
1410
|
+
continue;
|
|
1411
|
+
}
|
|
1412
|
+
t.set(s.id, {
|
|
1413
|
+
page: s,
|
|
1414
|
+
items: [o],
|
|
1415
|
+
registryName: Be(
|
|
1416
|
+
e.kind,
|
|
1417
|
+
s.id,
|
|
1418
|
+
e.registryPrefix
|
|
1419
|
+
)
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
const r = {}, n = [];
|
|
1423
|
+
for (const o of t.values()) {
|
|
1424
|
+
const s = () => /* @__PURE__ */ w(
|
|
1425
|
+
Zt,
|
|
1426
|
+
{
|
|
1427
|
+
page: o.page,
|
|
1428
|
+
items: o.items,
|
|
1429
|
+
renderPreview: e.renderPreview,
|
|
1430
|
+
secondaryLabel: e.secondaryLabel,
|
|
1431
|
+
minimumColumnWidth: e.minimumColumnWidth ?? 152
|
|
1432
|
+
}
|
|
1433
|
+
);
|
|
1434
|
+
r[o.registryName] = {
|
|
1435
|
+
component: s,
|
|
1436
|
+
children: "none"
|
|
1437
|
+
};
|
|
1438
|
+
const a = Yt(e.frame, o.page, o.items);
|
|
1439
|
+
n.push({
|
|
1440
|
+
...o.page,
|
|
1441
|
+
componentName: o.registryName,
|
|
1442
|
+
width: (a == null ? void 0 : a.width) ?? 1,
|
|
1443
|
+
height: (a == null ? void 0 : a.height) ?? 1,
|
|
1444
|
+
frameSizeMode: a ? "fixed" : "content"
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
return {
|
|
1448
|
+
registry: r,
|
|
1449
|
+
collection: {
|
|
1450
|
+
expectedCount: e.expectedCount ?? e.items.length,
|
|
1451
|
+
assets: e.items.map((o) => je(o, e.pageFor(o).id)),
|
|
1452
|
+
pages: n
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
function en(e, t = 60) {
|
|
1457
|
+
const r = Object.entries((e == null ? void 0 : e.props) ?? {}).filter(([, c]) => c.length > 0).sort(([c, d], [h, u]) => u.length - d.length || c.localeCompare(h)), n = r[0], o = r[1], s = Math.max(1, (n == null ? void 0 : n[1].length) ?? 1), a = o == null ? void 0 : o[1].slice(0, Math.max(1, Math.floor(t / s)));
|
|
1458
|
+
return {
|
|
1459
|
+
row: n,
|
|
1460
|
+
column: o ? [o[0], a ?? []] : void 0,
|
|
1461
|
+
fixed: r.slice(2).map(([c, d]) => [c, d[0]]),
|
|
1462
|
+
additional: r.slice(2)
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
function tn(e, t, r, n) {
|
|
1466
|
+
return {
|
|
1467
|
+
...e.defaultProps,
|
|
1468
|
+
...Object.fromEntries(t.fixed),
|
|
1469
|
+
...t.row && r ? { [t.row[0]]: r } : {},
|
|
1470
|
+
...t.column && n ? { [t.column[0]]: n } : {}
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
function nn({
|
|
1474
|
+
item: e,
|
|
1475
|
+
entry: t,
|
|
1476
|
+
maxVariantCells: r
|
|
1477
|
+
}) {
|
|
1478
|
+
var c, d;
|
|
1479
|
+
if (!t)
|
|
1480
|
+
return /* @__PURE__ */ O(
|
|
1481
|
+
"section",
|
|
1482
|
+
{
|
|
1483
|
+
"data-pygmalion-catalog-component": e.id,
|
|
1484
|
+
"data-pygmalion-content-bounds": "",
|
|
1485
|
+
style: {
|
|
1486
|
+
boxSizing: "border-box",
|
|
1487
|
+
display: "inline-block",
|
|
1488
|
+
width: "max-content",
|
|
1489
|
+
padding: 32,
|
|
1490
|
+
color: ce,
|
|
1491
|
+
background: ae
|
|
1492
|
+
},
|
|
1493
|
+
children: [
|
|
1494
|
+
/* @__PURE__ */ w("strong", { children: e.name }),
|
|
1495
|
+
/* @__PURE__ */ w("p", { style: { color: _ }, children: "The component is not registered." })
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
);
|
|
1499
|
+
const n = en(t, r), o = ((c = n.row) == null ? void 0 : c[1]) ?? [void 0], s = ((d = n.column) == null ? void 0 : d[1]) ?? [void 0], a = t.component;
|
|
1500
|
+
return /* @__PURE__ */ O(
|
|
1501
|
+
"section",
|
|
1502
|
+
{
|
|
1503
|
+
"data-pygmalion-catalog-component": e.id,
|
|
1504
|
+
"data-pygmalion-content-bounds": "",
|
|
1505
|
+
style: {
|
|
1506
|
+
boxSizing: "border-box",
|
|
1507
|
+
display: "inline-block",
|
|
1508
|
+
width: "max-content",
|
|
1509
|
+
padding: 32,
|
|
1510
|
+
color: ce,
|
|
1511
|
+
background: ae,
|
|
1512
|
+
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
|
|
1513
|
+
},
|
|
1514
|
+
children: [
|
|
1515
|
+
/* @__PURE__ */ O("header", { style: { marginBottom: 24 }, children: [
|
|
1516
|
+
/* @__PURE__ */ w("h1", { style: { margin: 0, fontSize: 24 }, children: e.name }),
|
|
1517
|
+
e.sourcePath ? /* @__PURE__ */ w("p", { style: { margin: "6px 0 0", color: _, fontSize: 12 }, children: e.sourcePath }) : null
|
|
1518
|
+
] }),
|
|
1519
|
+
/* @__PURE__ */ w(
|
|
1520
|
+
"div",
|
|
1521
|
+
{
|
|
1522
|
+
style: {
|
|
1523
|
+
display: "inline-grid",
|
|
1524
|
+
gridTemplateColumns: `repeat(${s.length}, max-content)`,
|
|
1525
|
+
gap: 12
|
|
1526
|
+
},
|
|
1527
|
+
children: o.flatMap(
|
|
1528
|
+
(h) => s.map((u) => {
|
|
1529
|
+
const b = tn(t, n, h, u), P = [
|
|
1530
|
+
n.row && h ? `${n.row[0]}=${h}` : "",
|
|
1531
|
+
n.column && u ? `${n.column[0]}=${u}` : ""
|
|
1532
|
+
].filter(Boolean).join(" · ");
|
|
1533
|
+
return /* @__PURE__ */ O(
|
|
1534
|
+
"article",
|
|
1535
|
+
{
|
|
1536
|
+
style: {
|
|
1537
|
+
width: "max-content",
|
|
1538
|
+
padding: 16,
|
|
1539
|
+
border: `1px solid ${me}`,
|
|
1540
|
+
borderRadius: 10,
|
|
1541
|
+
background: ie
|
|
1542
|
+
},
|
|
1543
|
+
children: [
|
|
1544
|
+
P ? /* @__PURE__ */ w("div", { style: { marginBottom: 12, color: _, fontSize: 11 }, children: P }) : null,
|
|
1545
|
+
/* @__PURE__ */ w("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: xe(
|
|
1546
|
+
a,
|
|
1547
|
+
b,
|
|
1548
|
+
t.children === "text" ? t.defaultChildren ?? e.name : void 0
|
|
1549
|
+
) })
|
|
1550
|
+
]
|
|
1551
|
+
},
|
|
1552
|
+
`${h ?? "default"}:${u ?? "default"}`
|
|
1553
|
+
);
|
|
1554
|
+
})
|
|
1555
|
+
)
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1558
|
+
n.additional.map(([h, u]) => /* @__PURE__ */ O("section", { style: { marginTop: 20 }, children: [
|
|
1559
|
+
/* @__PURE__ */ w("h2", { style: { margin: "0 0 10px", color: _, fontSize: 12 }, children: h }),
|
|
1560
|
+
/* @__PURE__ */ w("div", { style: { display: "flex", flexWrap: "wrap", gap: 12 }, children: u.map((b) => /* @__PURE__ */ O(
|
|
1561
|
+
"article",
|
|
1562
|
+
{
|
|
1563
|
+
style: {
|
|
1564
|
+
padding: 16,
|
|
1565
|
+
border: `1px solid ${me}`,
|
|
1566
|
+
borderRadius: 10,
|
|
1567
|
+
background: ie
|
|
1568
|
+
},
|
|
1569
|
+
children: [
|
|
1570
|
+
/* @__PURE__ */ w("div", { style: { marginBottom: 12, color: _, fontSize: 11 }, children: b }),
|
|
1571
|
+
xe(
|
|
1572
|
+
a,
|
|
1573
|
+
{ ...t.defaultProps, [h]: b },
|
|
1574
|
+
t.children === "text" ? t.defaultChildren ?? e.name : void 0
|
|
1575
|
+
)
|
|
1576
|
+
]
|
|
1577
|
+
},
|
|
1578
|
+
b
|
|
1579
|
+
)) })
|
|
1580
|
+
] }, h))
|
|
1581
|
+
]
|
|
1582
|
+
}
|
|
1583
|
+
);
|
|
1584
|
+
}
|
|
1585
|
+
function In(e) {
|
|
1586
|
+
Ue(e.items);
|
|
1587
|
+
const t = {}, r = [], n = [], o = e.maxVariantCells ?? 60;
|
|
1588
|
+
for (const s of e.items) {
|
|
1589
|
+
const a = Be(
|
|
1590
|
+
e.kind,
|
|
1591
|
+
s.id,
|
|
1592
|
+
e.registryPrefix
|
|
1593
|
+
), c = e.registry[s.name], d = () => /* @__PURE__ */ w(
|
|
1594
|
+
nn,
|
|
1595
|
+
{
|
|
1596
|
+
item: s,
|
|
1597
|
+
entry: c,
|
|
1598
|
+
maxVariantCells: o
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
t[a] = { component: d, children: "none" }, r.push({
|
|
1602
|
+
id: s.id,
|
|
1603
|
+
name: s.name,
|
|
1604
|
+
section: s.section,
|
|
1605
|
+
componentName: a,
|
|
1606
|
+
// The seed exists only long enough to mount the intrinsic max-content
|
|
1607
|
+
// catalog root. The editor replaces it with actual rendered DOM bounds.
|
|
1608
|
+
width: 1,
|
|
1609
|
+
height: 1,
|
|
1610
|
+
frameSizeMode: "content"
|
|
1611
|
+
}), n.push(je(s, s.id));
|
|
1612
|
+
}
|
|
1613
|
+
return {
|
|
1614
|
+
registry: t,
|
|
1615
|
+
collection: {
|
|
1616
|
+
expectedCount: e.expectedCount ?? e.items.length,
|
|
1617
|
+
assets: n,
|
|
1618
|
+
pages: r
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
const Ae = /^[a-f0-9]{64}$/, rn = /^\/__pygmalion-qa\/artifacts\/[A-Za-z0-9_-]{8,120}\.png$/, on = /^p\d+$/;
|
|
1623
|
+
function ge(e) {
|
|
1624
|
+
return typeof e == "string" && rn.test(e) ? e : void 0;
|
|
1625
|
+
}
|
|
1626
|
+
function Oe(e, t) {
|
|
1627
|
+
const r = new URL(e, t);
|
|
1628
|
+
return r.search = "", r.hash = "", r.pathname.endsWith("/") || (r.pathname = `${r.pathname}/`), r.href;
|
|
1629
|
+
}
|
|
1630
|
+
function fe(e) {
|
|
1631
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
1632
|
+
const t = e;
|
|
1633
|
+
return typeof t.domStructureHash != "string" || !Ae.test(t.domStructureHash) || typeof t.screenshotHash != "string" || !Ae.test(t.screenshotHash) ? null : {
|
|
1634
|
+
domStructureHash: t.domStructureHash,
|
|
1635
|
+
screenshotHash: t.screenshotHash,
|
|
1636
|
+
...ge(t.screenshotUrl) ? { screenshotUrl: ge(t.screenshotUrl) } : {}
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
function $e(e) {
|
|
1640
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
1641
|
+
const t = e;
|
|
1642
|
+
return !Number.isSafeInteger(t.width) || !Number.isSafeInteger(t.height) || Number(t.width) < 1 || Number(t.height) < 1 || Number(t.width) > 65536 || Number(t.height) > 65536 ? null : { width: Number(t.width), height: Number(t.height) };
|
|
1643
|
+
}
|
|
1644
|
+
function sn(e) {
|
|
1645
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
1646
|
+
const t = e, r = $e(t.before), n = $e(t.after);
|
|
1647
|
+
if (!r || !n || !Number.isSafeInteger(t.changedPixels) || !Number.isSafeInteger(t.totalPixels) || Number(t.changedPixels) < 0 || Number(t.totalPixels) < 1 || Number(t.changedPixels) > Number(t.totalPixels) || typeof t.threshold != "number" || !Number.isFinite(t.threshold) || t.threshold < 0 || t.threshold > 1)
|
|
1648
|
+
return null;
|
|
1649
|
+
const o = t.heatmapUrl == null ? null : ge(t.heatmapUrl) ?? null;
|
|
1650
|
+
return {
|
|
1651
|
+
before: r,
|
|
1652
|
+
after: n,
|
|
1653
|
+
dimensionsMatch: r.width === n.width && r.height === n.height,
|
|
1654
|
+
changedPixels: Number(t.changedPixels),
|
|
1655
|
+
totalPixels: Number(t.totalPixels),
|
|
1656
|
+
diffRatio: Number(t.changedPixels) / Number(t.totalPixels),
|
|
1657
|
+
threshold: t.threshold,
|
|
1658
|
+
heatmapUrl: o
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
function an(e, t) {
|
|
1662
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
1663
|
+
const r = e;
|
|
1664
|
+
if (typeof r.id != "string" || !r.id) return null;
|
|
1665
|
+
const n = fe(r), o = fe(r.before) ?? n;
|
|
1666
|
+
if (!o) return null;
|
|
1667
|
+
const s = fe(r.after);
|
|
1668
|
+
if (t === "changed" && !s) return null;
|
|
1669
|
+
const a = s ? sn(r.pixelDiff) : null;
|
|
1670
|
+
return {
|
|
1671
|
+
id: r.id,
|
|
1672
|
+
before: o,
|
|
1673
|
+
...s ? { after: s } : {},
|
|
1674
|
+
...s ? {
|
|
1675
|
+
domChanged: o.domStructureHash !== s.domStructureHash,
|
|
1676
|
+
screenshotChanged: o.screenshotHash !== s.screenshotHash
|
|
60
1677
|
} : {},
|
|
61
|
-
...
|
|
1678
|
+
...a ? { pixelDiff: a } : {}
|
|
62
1679
|
};
|
|
63
1680
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
...
|
|
67
|
-
...
|
|
68
|
-
...
|
|
1681
|
+
function cn(e, t = []) {
|
|
1682
|
+
const r = new Set(t), n = r.size > 0, o = /* @__PURE__ */ new Set(), s = [
|
|
1683
|
+
...e.styles.map((a) => a.affectedFrames ?? []),
|
|
1684
|
+
...e.texts.map((a) => a.affectedFrames ?? []),
|
|
1685
|
+
...e.operations.map((a) => a.affectedFrames ?? [])
|
|
69
1686
|
];
|
|
70
|
-
for (const
|
|
71
|
-
for (const
|
|
72
|
-
if (
|
|
1687
|
+
for (const a of s)
|
|
1688
|
+
for (const c of a) {
|
|
1689
|
+
if (n && on.test(c.id) && !r.has(c.id))
|
|
73
1690
|
throw new Error(
|
|
74
|
-
`"Impact Screen"${
|
|
1691
|
+
`"Impact Screen"${c.name}"This internal editor ID (${c.id}) is used. A canonical screen ID is required.`
|
|
75
1692
|
);
|
|
76
|
-
!
|
|
1693
|
+
!c.id || n && !r.has(c.id) || o.add(c.id);
|
|
77
1694
|
}
|
|
78
|
-
return [...
|
|
1695
|
+
return [...o].sort();
|
|
79
1696
|
}
|
|
80
|
-
async function
|
|
81
|
-
const
|
|
1697
|
+
async function Me(e, t, r) {
|
|
1698
|
+
const n = await e(`${t.replace(/\/$/, "")}/capture`, {
|
|
82
1699
|
method: "POST",
|
|
83
1700
|
headers: { "content-type": "application/json" },
|
|
84
|
-
body: JSON.stringify(
|
|
85
|
-
}),
|
|
86
|
-
if (!
|
|
1701
|
+
body: JSON.stringify(r)
|
|
1702
|
+
}), o = await n.json();
|
|
1703
|
+
if (!n.ok || o.ok === !1)
|
|
87
1704
|
throw new Error(
|
|
88
|
-
typeof
|
|
1705
|
+
typeof o.error == "string" ? o.error : `Pygmalion visual QA capture failed (${n.status})`
|
|
89
1706
|
);
|
|
90
|
-
if (typeof
|
|
1707
|
+
if (typeof o.baselineId != "string" || !o.baselineId)
|
|
91
1708
|
throw new Error("Pygmalion visual QA response has no baselineId");
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
94
|
-
const
|
|
95
|
-
return typeof
|
|
96
|
-
}).filter((
|
|
1709
|
+
const s = Array.isArray(o.frames) ? o.frames.map((u) => an(u, r.phase)).filter((u) => u != null) : [], a = Array.isArray(o.failures) ? o.failures.map((u) => {
|
|
1710
|
+
if (!u || typeof u != "object" || Array.isArray(u)) return null;
|
|
1711
|
+
const b = u;
|
|
1712
|
+
return typeof b.id == "string" && typeof b.error == "string" ? { id: b.id, error: b.error } : null;
|
|
1713
|
+
}).filter((u) => u != null) : [], c = new Set(r.frameIds), h = new Set(s.map((u) => u.id)).size === s.length && s.every((u) => c.has(u.id)) && a.every((u) => c.has(u.id));
|
|
97
1714
|
return {
|
|
98
|
-
phase:
|
|
99
|
-
baselineId:
|
|
100
|
-
complete:
|
|
101
|
-
frames:
|
|
102
|
-
failures:
|
|
1715
|
+
phase: r.phase,
|
|
1716
|
+
baselineId: o.baselineId,
|
|
1717
|
+
complete: o.complete !== !1 && h && a.length === 0 && s.length === r.frameIds.length,
|
|
1718
|
+
frames: s,
|
|
1719
|
+
failures: a
|
|
103
1720
|
};
|
|
104
1721
|
}
|
|
105
|
-
const
|
|
1722
|
+
const ue = {
|
|
106
1723
|
mirror: "/__pygmalion-dev-control",
|
|
107
1724
|
sessions: "/__pygmalion-design-session",
|
|
108
1725
|
inspect: "/__pygmalion-inspect"
|
|
109
|
-
},
|
|
110
|
-
function
|
|
111
|
-
var
|
|
112
|
-
return typeof window < "u" && ((
|
|
1726
|
+
}, ln = "pygmalion.designSessionId", dn = "/__pygmalion-qa", ne = /* @__PURE__ */ new Map();
|
|
1727
|
+
function Te() {
|
|
1728
|
+
var e;
|
|
1729
|
+
return typeof window < "u" && ((e = window.crypto) != null && e.randomUUID) ? window.crypto.randomUUID() : `pygmalion-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
113
1730
|
}
|
|
114
|
-
function
|
|
1731
|
+
function fn(e, t) {
|
|
1732
|
+
if (e) return e;
|
|
1733
|
+
const r = ne.get(t);
|
|
115
1734
|
if (r) return r;
|
|
116
|
-
const s = J.get(e);
|
|
117
|
-
if (s) return s;
|
|
118
1735
|
try {
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
121
|
-
return
|
|
122
|
-
const
|
|
123
|
-
return window.localStorage.setItem(
|
|
1736
|
+
const n = window.localStorage.getItem(t);
|
|
1737
|
+
if (n)
|
|
1738
|
+
return ne.set(t, n), n;
|
|
1739
|
+
const o = Te();
|
|
1740
|
+
return window.localStorage.setItem(t, o), ne.set(t, o), o;
|
|
124
1741
|
} catch {
|
|
125
|
-
const
|
|
126
|
-
return
|
|
1742
|
+
const n = Te();
|
|
1743
|
+
return ne.set(t, n), n;
|
|
127
1744
|
}
|
|
128
1745
|
}
|
|
129
|
-
async function
|
|
130
|
-
const
|
|
131
|
-
if (!
|
|
132
|
-
return
|
|
1746
|
+
async function L(e) {
|
|
1747
|
+
const t = await e.json();
|
|
1748
|
+
if (!e.ok) throw new Error(t.error ?? `Pygmalion request failed (${e.status})`);
|
|
1749
|
+
return t;
|
|
133
1750
|
}
|
|
134
|
-
function
|
|
135
|
-
var
|
|
1751
|
+
function xn(e = {}) {
|
|
1752
|
+
var G, x, B, k, Q;
|
|
136
1753
|
const {
|
|
137
|
-
sessionId:
|
|
138
|
-
sessionStorageKey:
|
|
139
|
-
autoStart:
|
|
140
|
-
fetcher:
|
|
141
|
-
formatApplyMessage:
|
|
142
|
-
} =
|
|
143
|
-
() => JSON.parse(
|
|
144
|
-
[
|
|
145
|
-
),
|
|
146
|
-
() =>
|
|
147
|
-
[
|
|
148
|
-
), [
|
|
1754
|
+
sessionId: t,
|
|
1755
|
+
sessionStorageKey: r = ln,
|
|
1756
|
+
autoStart: n = !0,
|
|
1757
|
+
fetcher: o = fetch,
|
|
1758
|
+
formatApplyMessage: s
|
|
1759
|
+
} = e, a = ((G = e.endpoints) == null ? void 0 : G.mirror) ?? ue.mirror, c = ((x = e.endpoints) == null ? void 0 : x.sessions) ?? ue.sessions, d = ((B = e.endpoints) == null ? void 0 : B.inspect) ?? ue.inspect, h = e.visualQa != null, u = ((k = e.visualQa) == null ? void 0 : k.endpoint) ?? dn, b = JSON.stringify(((Q = e.visualQa) == null ? void 0 : Q.eligibleFrameIds) ?? []), P = Pe(
|
|
1760
|
+
() => JSON.parse(b),
|
|
1761
|
+
[b]
|
|
1762
|
+
), E = Pe(
|
|
1763
|
+
() => fn(t, r),
|
|
1764
|
+
[t, r]
|
|
1765
|
+
), [m, N] = te({
|
|
149
1766
|
state: "idle",
|
|
150
1767
|
commit: null,
|
|
151
1768
|
shortCommit: null,
|
|
@@ -154,309 +1771,345 @@ function Je(r = {}) {
|
|
|
154
1771
|
warning: null,
|
|
155
1772
|
error: null,
|
|
156
1773
|
appOrigin: null
|
|
157
|
-
}), [
|
|
158
|
-
async (
|
|
159
|
-
if (
|
|
160
|
-
const
|
|
161
|
-
|
|
1774
|
+
}), [p, $] = te(null), [R, T] = te(null), M = Ee(null), A = Ee(null), S = Z(
|
|
1775
|
+
async (v = !0) => {
|
|
1776
|
+
if (M.current) return M.current;
|
|
1777
|
+
const g = (async () => {
|
|
1778
|
+
N((I) => ({ ...I, state: "syncing", error: null }));
|
|
162
1779
|
try {
|
|
163
|
-
let
|
|
164
|
-
method:
|
|
165
|
-
}),
|
|
166
|
-
const
|
|
167
|
-
for (; !
|
|
168
|
-
await new Promise((
|
|
169
|
-
if (
|
|
170
|
-
throw new Error(
|
|
171
|
-
const
|
|
172
|
-
await
|
|
1780
|
+
let I = await o(`${a}/${v ? "refresh" : "status"}`, {
|
|
1781
|
+
method: v ? "POST" : "GET"
|
|
1782
|
+
}), i = await L(I);
|
|
1783
|
+
const l = Date.now();
|
|
1784
|
+
for (; !v && i.state === "syncing" && Date.now() - l < 12e4; )
|
|
1785
|
+
await new Promise((D) => window.setTimeout(D, 500)), I = await o(`${a}/status`), i = await L(I);
|
|
1786
|
+
if (i.state !== "ready" || !i.appOrigin || !i.commit)
|
|
1787
|
+
throw new Error(i.error ?? "Pygmalion could not prepare the source preview");
|
|
1788
|
+
const f = await L(
|
|
1789
|
+
await o(`${c}/open`, {
|
|
173
1790
|
method: "POST",
|
|
174
1791
|
headers: { "content-type": "application/json" },
|
|
175
|
-
body: JSON.stringify({ sessionId:
|
|
1792
|
+
body: JSON.stringify({ sessionId: E, baseDevSha: i.commit })
|
|
176
1793
|
})
|
|
177
1794
|
);
|
|
178
|
-
if (!
|
|
179
|
-
throw new Error(
|
|
180
|
-
let
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
await
|
|
1795
|
+
if (!f.ok || !f.session)
|
|
1796
|
+
throw new Error(f.error ?? "Pygmalion could not open the design session");
|
|
1797
|
+
let y = f.session;
|
|
1798
|
+
if (y.branchName) {
|
|
1799
|
+
const D = await L(
|
|
1800
|
+
await o(`${c}/check`, {
|
|
184
1801
|
method: "POST",
|
|
185
1802
|
headers: { "content-type": "application/json" },
|
|
186
|
-
body: JSON.stringify({ sessionId:
|
|
1803
|
+
body: JSON.stringify({ sessionId: y.id })
|
|
187
1804
|
})
|
|
188
1805
|
);
|
|
189
|
-
if (!
|
|
190
|
-
throw new Error(
|
|
191
|
-
|
|
1806
|
+
if (!D.ok || !D.session)
|
|
1807
|
+
throw new Error(D.error ?? "Pygmalion could not check the design session");
|
|
1808
|
+
y = D.session;
|
|
192
1809
|
}
|
|
193
|
-
|
|
194
|
-
} catch (
|
|
195
|
-
|
|
196
|
-
...
|
|
1810
|
+
N(i), $(y), T(y.appOrigin ?? i.appOrigin);
|
|
1811
|
+
} catch (I) {
|
|
1812
|
+
N((i) => ({
|
|
1813
|
+
...i,
|
|
197
1814
|
state: "error",
|
|
198
|
-
error:
|
|
1815
|
+
error: I instanceof Error ? I.message : String(I)
|
|
199
1816
|
}));
|
|
200
1817
|
}
|
|
201
1818
|
})();
|
|
202
|
-
|
|
1819
|
+
M.current = g;
|
|
203
1820
|
try {
|
|
204
|
-
await
|
|
1821
|
+
await g;
|
|
205
1822
|
} finally {
|
|
206
|
-
|
|
1823
|
+
M.current === g && (M.current = null);
|
|
207
1824
|
}
|
|
208
1825
|
},
|
|
209
|
-
[
|
|
210
|
-
),
|
|
211
|
-
async (
|
|
212
|
-
var
|
|
213
|
-
if (!
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
1826
|
+
[o, a, c, E]
|
|
1827
|
+
), C = Z(
|
|
1828
|
+
async (v) => {
|
|
1829
|
+
var f;
|
|
1830
|
+
if (!p) throw new Error("Pygmalion design session is not ready");
|
|
1831
|
+
const g = A.current;
|
|
1832
|
+
if (g && (g.sessionId !== p.id || g.baseDevSha !== p.baseDevSha || g.revision !== p.revision || g.fingerprint !== JSON.stringify(v)))
|
|
216
1833
|
throw new Error("The code diff you checked is out of date. Please check the diff for the current changes again.");
|
|
217
|
-
const
|
|
218
|
-
await
|
|
1834
|
+
const I = await L(
|
|
1835
|
+
await o(`${c}/apply-visual`, {
|
|
219
1836
|
method: "POST",
|
|
220
1837
|
headers: { "content-type": "application/json" },
|
|
221
1838
|
body: JSON.stringify({
|
|
222
|
-
sessionId:
|
|
223
|
-
baseDevSha:
|
|
224
|
-
expectedRevision:
|
|
225
|
-
...
|
|
226
|
-
changes:
|
|
1839
|
+
sessionId: p.id,
|
|
1840
|
+
baseDevSha: p.baseDevSha,
|
|
1841
|
+
expectedRevision: p.revision,
|
|
1842
|
+
...g ? { previewRevision: g.revision } : {},
|
|
1843
|
+
changes: v
|
|
227
1844
|
})
|
|
228
1845
|
})
|
|
229
1846
|
);
|
|
230
|
-
if (!
|
|
231
|
-
throw new Error(
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
let
|
|
235
|
-
if (
|
|
1847
|
+
if (!I.ok || !I.session)
|
|
1848
|
+
throw new Error(I.error ?? "Pygmalion could not apply the visual changes");
|
|
1849
|
+
$(I.session), I.session.appOrigin && T(I.session.appOrigin);
|
|
1850
|
+
const i = I.applied ?? v.styles.length + v.texts.length + v.operations.length;
|
|
1851
|
+
let l;
|
|
1852
|
+
if (g != null && g.qaBaselineId && ((f = g.qaFrameIds) != null && f.length) && I.session.appOrigin)
|
|
236
1853
|
try {
|
|
237
|
-
|
|
1854
|
+
l = await Me(o, u, {
|
|
238
1855
|
phase: "changed",
|
|
239
|
-
baselineId:
|
|
240
|
-
basePath:
|
|
241
|
-
frameIds:
|
|
1856
|
+
baselineId: g.qaBaselineId,
|
|
1857
|
+
basePath: Oe(I.session.appOrigin, window.location.origin),
|
|
1858
|
+
frameIds: g.qaFrameIds
|
|
242
1859
|
});
|
|
243
|
-
} catch (
|
|
244
|
-
const
|
|
245
|
-
|
|
1860
|
+
} catch (y) {
|
|
1861
|
+
const D = y instanceof Error ? y.message : String(y);
|
|
1862
|
+
l = {
|
|
246
1863
|
phase: "changed",
|
|
247
|
-
baselineId:
|
|
1864
|
+
baselineId: g.qaBaselineId,
|
|
248
1865
|
complete: !1,
|
|
249
1866
|
frames: [],
|
|
250
|
-
failures:
|
|
1867
|
+
failures: g.qaFrameIds.map((H) => ({ id: H, error: D }))
|
|
251
1868
|
};
|
|
252
1869
|
}
|
|
253
|
-
return
|
|
254
|
-
applied:
|
|
255
|
-
branch:
|
|
256
|
-
integration:
|
|
257
|
-
message:
|
|
258
|
-
...
|
|
1870
|
+
return A.current = null, {
|
|
1871
|
+
applied: i,
|
|
1872
|
+
branch: I.session.branchName ?? void 0,
|
|
1873
|
+
integration: I.session.integration.state,
|
|
1874
|
+
message: s == null ? void 0 : s(I.session, i),
|
|
1875
|
+
...l ? { qa: l } : {}
|
|
259
1876
|
};
|
|
260
1877
|
},
|
|
261
|
-
[
|
|
262
|
-
),
|
|
263
|
-
async (
|
|
264
|
-
var
|
|
265
|
-
if (!
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
await
|
|
1878
|
+
[o, s, u, p, c]
|
|
1879
|
+
), F = Z(
|
|
1880
|
+
async (v) => {
|
|
1881
|
+
var f;
|
|
1882
|
+
if (!p) throw new Error("Pygmalion design session is not ready");
|
|
1883
|
+
A.current = null;
|
|
1884
|
+
const g = await L(
|
|
1885
|
+
await o(`${c}/preview-visual`, {
|
|
269
1886
|
method: "POST",
|
|
270
1887
|
headers: { "content-type": "application/json" },
|
|
271
1888
|
body: JSON.stringify({
|
|
272
|
-
sessionId:
|
|
273
|
-
baseDevSha:
|
|
274
|
-
expectedRevision:
|
|
275
|
-
changes:
|
|
1889
|
+
sessionId: p.id,
|
|
1890
|
+
baseDevSha: p.baseDevSha,
|
|
1891
|
+
expectedRevision: p.revision,
|
|
1892
|
+
changes: v
|
|
276
1893
|
})
|
|
277
1894
|
})
|
|
278
1895
|
);
|
|
279
|
-
if (!
|
|
280
|
-
throw new Error(
|
|
281
|
-
const
|
|
282
|
-
let
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
285
|
-
if (!
|
|
1896
|
+
if (!g.ok || !Number.isSafeInteger(g.revision))
|
|
1897
|
+
throw new Error(g.error ?? "Pygmalion could not preview the visual changes");
|
|
1898
|
+
const I = h ? cn(v, P) : [];
|
|
1899
|
+
let i;
|
|
1900
|
+
const l = p.appOrigin ?? m.appOrigin;
|
|
1901
|
+
if (I.length > 0) {
|
|
1902
|
+
if (!l)
|
|
286
1903
|
throw new Error("Impact screen QA baseline preview not ready");
|
|
287
|
-
if (
|
|
1904
|
+
if (i = await Me(o, u, {
|
|
288
1905
|
phase: "baseline",
|
|
289
|
-
basePath:
|
|
290
|
-
frameIds:
|
|
291
|
-
}), !
|
|
1906
|
+
basePath: Oe(l, window.location.origin),
|
|
1907
|
+
frameIds: I
|
|
1908
|
+
}), !i.complete)
|
|
292
1909
|
throw new Error(
|
|
293
|
-
((
|
|
1910
|
+
((f = i.failures[0]) == null ? void 0 : f.error) ?? `Failed to capture ${I.length - i.frames.length} affected frames`
|
|
294
1911
|
);
|
|
295
1912
|
}
|
|
296
|
-
return
|
|
297
|
-
sessionId:
|
|
298
|
-
baseDevSha:
|
|
299
|
-
revision:
|
|
300
|
-
fingerprint: JSON.stringify(
|
|
301
|
-
...
|
|
1913
|
+
return A.current = {
|
|
1914
|
+
sessionId: p.id,
|
|
1915
|
+
baseDevSha: p.baseDevSha,
|
|
1916
|
+
revision: g.revision,
|
|
1917
|
+
fingerprint: JSON.stringify(v),
|
|
1918
|
+
...i ? { qaBaselineId: i.baselineId, qaFrameIds: I } : {}
|
|
302
1919
|
}, {
|
|
303
|
-
revision:
|
|
304
|
-
files: Array.isArray(
|
|
305
|
-
affectedFiles: Array.isArray(
|
|
306
|
-
...
|
|
1920
|
+
revision: g.revision,
|
|
1921
|
+
files: Array.isArray(g.files) ? g.files : [],
|
|
1922
|
+
affectedFiles: Array.isArray(g.affectedFiles) ? g.affectedFiles : [],
|
|
1923
|
+
...i ? { qa: i } : {}
|
|
307
1924
|
};
|
|
308
1925
|
},
|
|
309
1926
|
[
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
c,
|
|
314
|
-
n,
|
|
1927
|
+
o,
|
|
1928
|
+
m.appOrigin,
|
|
1929
|
+
P,
|
|
315
1930
|
u,
|
|
316
|
-
|
|
1931
|
+
p,
|
|
1932
|
+
c,
|
|
1933
|
+
h
|
|
317
1934
|
]
|
|
318
|
-
),
|
|
319
|
-
async (
|
|
320
|
-
if (
|
|
321
|
-
const
|
|
322
|
-
await
|
|
1935
|
+
), j = Z(
|
|
1936
|
+
async (v) => {
|
|
1937
|
+
if (v.length === 0) return { files: [] };
|
|
1938
|
+
const g = await L(
|
|
1939
|
+
await o(`${d}/impact`, {
|
|
323
1940
|
method: "POST",
|
|
324
1941
|
headers: { "content-type": "application/json" },
|
|
325
|
-
body: JSON.stringify({ componentFiles:
|
|
1942
|
+
body: JSON.stringify({ componentFiles: v })
|
|
326
1943
|
})
|
|
327
1944
|
);
|
|
328
|
-
if (
|
|
329
|
-
throw new Error(
|
|
330
|
-
return { files: Array.isArray(
|
|
1945
|
+
if (g.error || g.ok === !1)
|
|
1946
|
+
throw new Error(g.error ?? "Pygmalion could not calculate source impact");
|
|
1947
|
+
return { files: Array.isArray(g.files) ? g.files : [] };
|
|
331
1948
|
},
|
|
332
|
-
[
|
|
333
|
-
),
|
|
334
|
-
if (!(
|
|
1949
|
+
[o, d]
|
|
1950
|
+
), W = Z(async () => {
|
|
1951
|
+
if (!(p != null && p.canRevert) || !p.headSha)
|
|
335
1952
|
throw new Error("There are no reversible changes applied");
|
|
336
|
-
const
|
|
337
|
-
await
|
|
1953
|
+
const v = await L(
|
|
1954
|
+
await o(`${c}/revert-visual`, {
|
|
338
1955
|
method: "POST",
|
|
339
1956
|
headers: { "content-type": "application/json" },
|
|
340
1957
|
body: JSON.stringify({
|
|
341
|
-
sessionId:
|
|
342
|
-
baseDevSha:
|
|
343
|
-
expectedRevision:
|
|
344
|
-
expectedHeadSha:
|
|
1958
|
+
sessionId: p.id,
|
|
1959
|
+
baseDevSha: p.baseDevSha,
|
|
1960
|
+
expectedRevision: p.revision,
|
|
1961
|
+
expectedHeadSha: p.headSha
|
|
345
1962
|
})
|
|
346
1963
|
})
|
|
347
1964
|
);
|
|
348
|
-
if (!
|
|
349
|
-
throw new Error(
|
|
350
|
-
return
|
|
1965
|
+
if (!v.ok || v.reverted !== !0 || !v.operation || v.operation.kind !== "visual-revert" || !v.session)
|
|
1966
|
+
throw new Error(v.error ?? "Pygmalion could not revert the last visual change");
|
|
1967
|
+
return A.current = null, $(v.session), v.session.appOrigin && T(v.session.appOrigin), {
|
|
351
1968
|
reverted: !0,
|
|
352
|
-
operation:
|
|
353
|
-
session:
|
|
1969
|
+
operation: v.operation,
|
|
1970
|
+
session: v.session
|
|
354
1971
|
};
|
|
355
|
-
}, [
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}, [
|
|
359
|
-
const
|
|
1972
|
+
}, [o, p, c]);
|
|
1973
|
+
ee(() => {
|
|
1974
|
+
n && S(!1);
|
|
1975
|
+
}, [n, S]);
|
|
1976
|
+
const q = (p == null ? void 0 : p.appOrigin) ?? m.appOrigin ?? R;
|
|
360
1977
|
return {
|
|
361
|
-
mirror:
|
|
362
|
-
session:
|
|
1978
|
+
mirror: m,
|
|
1979
|
+
session: p,
|
|
363
1980
|
ready: R != null,
|
|
364
|
-
appOrigin:
|
|
365
|
-
previewRevision: `${(
|
|
366
|
-
refresh:
|
|
367
|
-
previewVisual:
|
|
368
|
-
inspectImpact:
|
|
369
|
-
applyVisual:
|
|
370
|
-
revertLastVisual:
|
|
1981
|
+
appOrigin: q,
|
|
1982
|
+
previewRevision: `${(p == null ? void 0 : p.headSha) ?? (p == null ? void 0 : p.baseDevSha) ?? m.commit ?? "pending"}:${(p == null ? void 0 : p.revision) ?? 0}`,
|
|
1983
|
+
refresh: S,
|
|
1984
|
+
previewVisual: F,
|
|
1985
|
+
inspectImpact: j,
|
|
1986
|
+
applyVisual: C,
|
|
1987
|
+
revertLastVisual: W
|
|
371
1988
|
};
|
|
372
1989
|
}
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
function
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
1990
|
+
const Pn = {
|
|
1991
|
+
editor: K,
|
|
1992
|
+
getObserverTree: Le,
|
|
1993
|
+
isObservableProp: Ge
|
|
1994
|
+
};
|
|
1995
|
+
function En(e) {
|
|
1996
|
+
K.navigateToPageByName(e);
|
|
1997
|
+
}
|
|
1998
|
+
function Nn() {
|
|
1999
|
+
K.openPreview();
|
|
2000
|
+
}
|
|
2001
|
+
function Cn() {
|
|
2002
|
+
const e = ve.entries.length > 0;
|
|
2003
|
+
return e && ve.discardPending(), K.resetCurrentEdits() || e;
|
|
2004
|
+
}
|
|
2005
|
+
function Rn({
|
|
2006
|
+
registry: e,
|
|
2007
|
+
tokens: t,
|
|
2008
|
+
initialPages: r,
|
|
2009
|
+
designImport: n,
|
|
2010
|
+
onTokensChange: o,
|
|
2011
|
+
appOrigin: s,
|
|
2012
|
+
previewRevision: a,
|
|
2013
|
+
previewCacheNamespace: c,
|
|
2014
|
+
previewArtifacts: d,
|
|
2015
|
+
previewArtifactEndpoint: h,
|
|
2016
|
+
previewConcurrency: u,
|
|
2017
|
+
previewOpen: b,
|
|
2018
|
+
onPreviewOpenChange: P,
|
|
2019
|
+
flowCanvas: E,
|
|
2020
|
+
onApply: m,
|
|
2021
|
+
onDesignChange: N,
|
|
2022
|
+
onInspectApply: p,
|
|
2023
|
+
onInspectPreview: $,
|
|
2024
|
+
onInspectImpact: R,
|
|
2025
|
+
storyboardDiscovery: T = !0,
|
|
2026
|
+
storyboardDiscoveryEndpoint: M = st
|
|
405
2027
|
}) {
|
|
406
|
-
const [
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
2028
|
+
const [A, S] = te(!T), [C, F] = te();
|
|
2029
|
+
n && (n.assertComplete(), Ve(n));
|
|
2030
|
+
const j = e ?? (n == null ? void 0 : n.getRegistry()), W = t ?? (n == null ? void 0 : n.getTokens()), q = r ?? (n == null ? void 0 : n.getInitialPages());
|
|
2031
|
+
j && Je(j), W && We(W), at(o ?? null), s != null && Qe(s), a != null && Xe(a), Ye(c);
|
|
2032
|
+
const G = C ?? d;
|
|
2033
|
+
return G && q && A && Ze(G, {
|
|
2034
|
+
namespace: c ?? "",
|
|
2035
|
+
previewRevision: lt(),
|
|
2036
|
+
appOrigin: ct(),
|
|
2037
|
+
baselineEnvironment: et(),
|
|
2038
|
+
allowStaleIdentity: C == null && !!h,
|
|
2039
|
+
pages: q.flatMap(
|
|
2040
|
+
(x) => x.route && x.importPageId ? [
|
|
415
2041
|
{
|
|
416
|
-
canonicalId:
|
|
417
|
-
route:
|
|
418
|
-
width:
|
|
419
|
-
height:
|
|
420
|
-
environment:
|
|
421
|
-
preset:
|
|
422
|
-
interactions:
|
|
423
|
-
assertions:
|
|
2042
|
+
canonicalId: x.importPageId,
|
|
2043
|
+
route: x.route,
|
|
2044
|
+
width: x.width,
|
|
2045
|
+
height: x.height,
|
|
2046
|
+
environment: x.environment,
|
|
2047
|
+
preset: x.preset,
|
|
2048
|
+
interactions: x.interactions,
|
|
2049
|
+
assertions: x.assertions
|
|
424
2050
|
}
|
|
425
2051
|
] : []
|
|
426
2052
|
)
|
|
427
|
-
}),
|
|
428
|
-
|
|
429
|
-
const
|
|
2053
|
+
}), u != null && tt(u), dt(P ?? null), E != null && nt(E), ft(m ?? null), ut(p ?? null), rt($ ?? null), pt(R ?? null), q && K.initPagesFromComponents(q), ee(() => {
|
|
2054
|
+
Ie(N ?? null);
|
|
2055
|
+
const x = ot(K);
|
|
430
2056
|
return () => {
|
|
431
|
-
|
|
2057
|
+
x(), Ie(null);
|
|
432
2058
|
};
|
|
433
|
-
}, [
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
2059
|
+
}, [N]), ee(() => {
|
|
2060
|
+
if (F(void 0), !A || !h || !(c != null && c.trim()) || !(a != null && a.trim()))
|
|
2061
|
+
return;
|
|
2062
|
+
const x = new AbortController();
|
|
2063
|
+
return Jt({
|
|
2064
|
+
namespace: c,
|
|
2065
|
+
sourceRevision: a,
|
|
2066
|
+
transport: Kt({
|
|
2067
|
+
endpoint: h,
|
|
2068
|
+
captureBaseUrl: s
|
|
2069
|
+
}),
|
|
2070
|
+
signal: x.signal
|
|
2071
|
+
}).then((B) => {
|
|
2072
|
+
!x.signal.aborted && B.status === "accepted" && F(B.artifact);
|
|
2073
|
+
}), () => x.abort();
|
|
2074
|
+
}, [
|
|
2075
|
+
h,
|
|
2076
|
+
c,
|
|
2077
|
+
a,
|
|
2078
|
+
s,
|
|
2079
|
+
A
|
|
2080
|
+
]), ee(() => {
|
|
2081
|
+
let x = !0;
|
|
2082
|
+
if (!T)
|
|
2083
|
+
return Y(void 0), S(!0), () => {
|
|
2084
|
+
x = !1;
|
|
2085
|
+
};
|
|
2086
|
+
const B = new AbortController();
|
|
2087
|
+
return S(!1), Y(void 0), V(null), _e({
|
|
2088
|
+
endpoint: M,
|
|
2089
|
+
signal: B.signal,
|
|
2090
|
+
pages: K.pages.map((k) => ({
|
|
2091
|
+
...k,
|
|
2092
|
+
id: k.importPageId ?? k.id,
|
|
2093
|
+
importKind: k.importKind
|
|
2094
|
+
})),
|
|
2095
|
+
assets: (n == null ? void 0 : n.getAssets("screens")) ?? []
|
|
2096
|
+
}).then((k) => {
|
|
2097
|
+
x && (Y(k.baselineEnvironment), V(k.graph));
|
|
448
2098
|
}).catch(() => {
|
|
449
|
-
|
|
2099
|
+
x && (Y(void 0), V(null));
|
|
450
2100
|
}).finally(() => {
|
|
451
|
-
|
|
2101
|
+
x && S(!0);
|
|
452
2102
|
}), () => {
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
2103
|
+
x = !1, B.abort(), Y(void 0), V(null);
|
|
2104
|
+
};
|
|
2105
|
+
}, [
|
|
2106
|
+
n,
|
|
2107
|
+
r,
|
|
2108
|
+
T,
|
|
2109
|
+
M
|
|
2110
|
+
]), ee(() => {
|
|
2111
|
+
b == null || b === K.previewOpen || (b ? K.openPreview({ notifyHost: !1 }) : K.closePreview({ notifyHost: !1 }));
|
|
2112
|
+
}, [b]), A ? /* @__PURE__ */ w(it, {}) : /* @__PURE__ */ w(
|
|
460
2113
|
"div",
|
|
461
2114
|
{
|
|
462
2115
|
"data-pygmalion-storyboard-loading": "",
|
|
@@ -475,29 +2128,59 @@ function ze({
|
|
|
475
2128
|
);
|
|
476
2129
|
}
|
|
477
2130
|
export {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
2131
|
+
$n as DESIGN_IMPORT_KINDS,
|
|
2132
|
+
wn as PygmalionCatalogDocument,
|
|
2133
|
+
Sn as PygmalionCatalogMatrix,
|
|
2134
|
+
bn as PygmalionCatalogSection,
|
|
2135
|
+
Rn as PygmalionEditor,
|
|
2136
|
+
st as STORYBOARD_ENVIRONMENT_CONTROL,
|
|
2137
|
+
Mn as STORYBOARD_ENVIRONMENT_QUERY,
|
|
2138
|
+
Pn as __debug,
|
|
2139
|
+
Tn as applyTokenOverride,
|
|
2140
|
+
Jt as bootstrapPreviewArtifact,
|
|
2141
|
+
Dn as clearPygmalionPreviewCache,
|
|
2142
|
+
In as createDesignComponentCatalog,
|
|
2143
|
+
en as createDesignComponentVariantMatrix,
|
|
2144
|
+
vn as createDesignGalleryCatalog,
|
|
2145
|
+
kn as createDesignImportController,
|
|
2146
|
+
zn as createDesignScreenCollection,
|
|
2147
|
+
Kt as createPreviewArtifactHttpTransport,
|
|
2148
|
+
gn as createPreviewCacheNamespace,
|
|
2149
|
+
Ht as createPreviewRecipeFingerprint,
|
|
2150
|
+
yn as createStoryboardCaptureRecipeIdentity,
|
|
2151
|
+
yt as createStoryboardGraph,
|
|
2152
|
+
Mt as createStoryboardGraphFromDiscovery,
|
|
2153
|
+
_n as createStoryboardGraphViewModel,
|
|
2154
|
+
Fn as createStoryboardRouteUrl,
|
|
2155
|
+
Xt as designCatalogKey,
|
|
2156
|
+
Be as designCatalogRegistryName,
|
|
2157
|
+
Bn as expandDesignScreenCasesViewports,
|
|
2158
|
+
jn as expandDesignScreenCollectionViewports,
|
|
2159
|
+
Un as getRecommendedPygmalionPreviewConcurrency,
|
|
2160
|
+
et as getStoryboardBaselineEnvironment,
|
|
2161
|
+
ze as getStoryboardDiscoveryBaselineEnvironment,
|
|
2162
|
+
Hn as getStoryboardGraph,
|
|
2163
|
+
_e as loadStoryboardDiscovery,
|
|
2164
|
+
Kn as mergeScreenPresets,
|
|
2165
|
+
He as mergeStoryboardEnvironment,
|
|
2166
|
+
mn as publishStoryboardDiscovery,
|
|
2167
|
+
En as pygmalionNavigate,
|
|
2168
|
+
Nn as pygmalionOpenPreview,
|
|
2169
|
+
Cn as pygmalionResetCurrentEdits,
|
|
2170
|
+
qn as reconstructRoutePreviewArtifactScreenshotV3,
|
|
2171
|
+
Gn as reconstructRoutePreviewArtifactSnapshotV3,
|
|
2172
|
+
Ln as resetTokenOverrides,
|
|
2173
|
+
xt as resolveStoryboardScreenCases,
|
|
2174
|
+
Je as setComponentRegistry,
|
|
2175
|
+
Qe as setPygmalionAppOrigin,
|
|
2176
|
+
tt as setPygmalionPreviewConcurrency,
|
|
2177
|
+
Xe as setPygmalionPreviewRevision,
|
|
2178
|
+
Y as setStoryboardBaselineEnvironment,
|
|
2179
|
+
V as setStoryboardGraph,
|
|
2180
|
+
We as setTokens,
|
|
2181
|
+
ht as storyboardScreenRecipeKey,
|
|
2182
|
+
Vn as subscribeStoryboardGraph,
|
|
2183
|
+
xn as usePygmalionProject,
|
|
2184
|
+
Vt as validatePreviewArtifactBundle,
|
|
2185
|
+
Ke as validateRoutePreviewArtifactV3Browser
|
|
503
2186
|
};
|