@pygmalionjs/pygmalion 0.2.14 → 0.2.16

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.
@@ -1,7 +1,7 @@
1
- import { jsxs as A, jsx as w } from "react/jsx-runtime";
2
- import { b as L, m as He, v as Ke, c as qe, i as Ge, g as Le, e as H, 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 st, u as Y, S as it, A as at, w as ve, x as ct, y as lt, z as dt, B as ft, C as ut, D as pt, E as ht, G as Ie } from "./App-CiSnd2mV.js";
3
- import { 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, Z as Jn } from "./App-CiSnd2mV.js";
4
- import { createElement as xe, useMemo as Pe, useState as te, useRef as Ee, useCallback as Z, useEffect as ee } from "react";
1
+ import { jsxs as O, jsx as y } from "react/jsx-runtime";
2
+ import { b as V, m as He, v as Ke, c as qe, i as Ge, g as Je, e as K, d as Le, a as Ve, 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 st, u as ee, S as it, A as at, w as ve, x as ct, y as lt, z as dt, B as ft, C as ut, D as ht, E as pt, G as Ie } from "./App-CiSnd2mV.js";
3
+ import { H as Mn, I as Tn, J as Dn, K as kn, L as zn, M as _n, O as Fn, P as jn, Q as Bn, R as Un, T as Hn, U as Kn, V as qn, W as Gn, X as Jn, Y as Ln, Z as Vn } from "./App-CiSnd2mV.js";
4
+ import { createElement as xe, useMemo as Pe, useState as ne, useRef as Ee, useCallback as X, useEffect as te } from "react";
5
5
  function pe(e, t = /* @__PURE__ */ new Set()) {
6
6
  if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
7
7
  return e;
@@ -39,7 +39,7 @@ function mt(e) {
39
39
  })
40
40
  );
41
41
  }
42
- function z(e) {
42
+ function k(e) {
43
43
  return [...new Set([...e].map((t) => t == null ? void 0 : t.trim()).filter(Boolean))].sort((t, r) => t.localeCompare(r));
44
44
  }
45
45
  function gt(e, t) {
@@ -52,21 +52,21 @@ function yt(e) {
52
52
  id: `story:${r}`,
53
53
  canonicalScreenId: r,
54
54
  screenIds: t.map((n) => n.id),
55
- names: z(t.map((n) => n.name)),
55
+ names: k(t.map((n) => n.name)),
56
56
  recipeKey: e.recipeKey,
57
- routes: z(t.map((n) => n.route)),
58
- scenarioIds: z(
57
+ routes: k(t.map((n) => n.route)),
58
+ scenarioIds: k(
59
59
  t.flatMap((n) => [
60
60
  n.scenarioId,
61
61
  ...n.scenarioIds ?? []
62
62
  ])
63
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))
64
+ sourceKeys: k(t.map((n) => n.sourcePath)),
65
+ flows: k(t.map((n) => n.flow)),
66
+ states: k(t.map((n) => n.state))
67
67
  };
68
68
  }
69
- function Re(e) {
69
+ function Ne(e) {
70
70
  return [
71
71
  e.code,
72
72
  e.edgeId,
@@ -76,7 +76,7 @@ function Re(e) {
76
76
  ].join(":");
77
77
  }
78
78
  function wt(e) {
79
- var v, g;
79
+ var Z, S;
80
80
  const t = [], r = [], n = /* @__PURE__ */ new Map();
81
81
  for (const i of e.screens) {
82
82
  const l = i.id.trim();
@@ -97,11 +97,11 @@ function wt(e) {
97
97
  let l;
98
98
  try {
99
99
  if (l = (e.recipeKey ?? mt)(i), !l.trim()) throw new Error("Recipe keys cannot be empty.");
100
- } catch (y) {
100
+ } catch (g) {
101
101
  s.add(i.id), t.push({
102
102
  code: "invalid-recipe",
103
103
  severity: "error",
104
- message: y instanceof Error ? y.message : "Storyboard recipe identity could not be created.",
104
+ message: g instanceof Error ? g.message : "Storyboard recipe identity could not be created.",
105
105
  screenId: i.id
106
106
  }), l = `invalid:${i.id}`;
107
107
  }
@@ -111,96 +111,96 @@ function wt(e) {
111
111
  const a = [...o.values()].map(yt).sort((i, l) => i.id.localeCompare(l.id)), c = {};
112
112
  for (const i of a)
113
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();
114
+ const d = new Map(a.map((i) => [i.id, i])), p = /* @__PURE__ */ new Map();
115
115
  for (const i of e.assets ?? []) {
116
- const l = h.get(i.pageId);
117
- l ? l.push(i) : h.set(i.pageId, [i]);
116
+ const l = p.get(i.pageId);
117
+ l ? l.push(i) : p.set(i.pageId, [i]);
118
118
  }
119
- const u = a.map((i) => {
119
+ const h = a.map((i) => {
120
120
  const l = i.screenIds.flatMap(
121
- (f) => h.get(f) ?? []
121
+ (f) => p.get(f) ?? []
122
122
  );
123
123
  return {
124
124
  ...i,
125
- scenarioIds: z([
125
+ scenarioIds: k([
126
126
  ...i.scenarioIds,
127
127
  ...l.map((f) => f.scenarioId)
128
128
  ]),
129
- sourceKeys: z([
129
+ sourceKeys: k([
130
130
  ...i.sourceKeys,
131
131
  ...l.map((f) => f.sourcePath)
132
132
  ])
133
133
  };
134
134
  }), b = /* @__PURE__ */ new Map();
135
- for (const i of u)
135
+ for (const i of h)
136
136
  for (const l of i.routes) {
137
137
  const f = b.get(l);
138
138
  f ? f.push(i.id) : b.set(l, [i.id]);
139
139
  }
140
- const x = (i, l, f) => {
141
- const y = i.trim(), T = c[y] ?? (d.has(y) ? y : null);
142
- if (T) return T;
143
- const D = z(b.get(y) ?? []);
140
+ const I = (i, l, f) => {
141
+ const g = i.trim(), N = c[g] ?? (d.has(g) ? g : null);
142
+ if (N) return N;
143
+ const D = k(b.get(g) ?? []);
144
144
  return D.length === 1 ? D[0] : D.length > 1 ? (t.push({
145
145
  code: f === "source" ? "ambiguous-edge-source" : "ambiguous-edge-target",
146
146
  severity: "error",
147
147
  message: `Storyboard edge "${l}" references an ambiguous ${f} route.`,
148
148
  edgeId: l,
149
- screenId: y || void 0
149
+ screenId: g || void 0
150
150
  }), null) : (t.push({
151
151
  code: f === "source" ? "unknown-edge-source" : "unknown-edge-target",
152
152
  severity: "error",
153
153
  message: `Storyboard edge "${l}" references an unknown ${f}.`,
154
154
  edgeId: l,
155
- screenId: y || void 0
155
+ screenId: g || void 0
156
156
  }), null);
157
- }, P = [], m = /* @__PURE__ */ new Map(), E = [
157
+ }, x = [], m = /* @__PURE__ */ new Map(), P = [
158
158
  ["explicit", e.explicitEdges ?? []],
159
159
  ["inferred", e.inferredEdges ?? []]
160
160
  ];
161
- let p = 0;
162
- for (const [i, l] of E)
161
+ let u = 0;
162
+ for (const [i, l] of P)
163
163
  for (const f of l) {
164
- const y = gt(f, p);
165
- p += 1;
166
- const T = x(f.from, y, "source"), D = x(f.to, y, "target");
167
- if (!T || !D || T === D) continue;
168
- const Q = `${T}\0${D}`, X = m.get(Q);
169
- if (X) {
170
- if (!X.sourceEdgeIds.includes(y)) {
164
+ const g = gt(f, u);
165
+ u += 1;
166
+ const N = I(f.from, g, "source"), D = I(f.to, g, "target");
167
+ if (!N || !D || N === D) continue;
168
+ const H = `${N}\0${D}`, z = m.get(H);
169
+ if (z) {
170
+ if (!z.sourceEdgeIds.includes(g)) {
171
171
  const be = {
172
- ...X,
173
- sourceEdgeIds: z([
174
- ...X.sourceEdgeIds,
175
- y
172
+ ...z,
173
+ sourceEdgeIds: k([
174
+ ...z.sourceEdgeIds,
175
+ g
176
176
  ])
177
177
  };
178
- m.set(Q, be);
179
- const Se = P.indexOf(X);
180
- Se >= 0 && (P[Se] = be);
178
+ m.set(H, be);
179
+ const Se = x.indexOf(z);
180
+ Se >= 0 && (x[Se] = be);
181
181
  }
182
182
  continue;
183
183
  }
184
- const we = {
185
- id: y,
186
- from: T,
184
+ const q = {
185
+ id: g,
186
+ from: N,
187
187
  to: D,
188
- kind: ((v = f.kind) == null ? void 0 : v.trim()) || void 0,
189
- label: ((g = f.label) == null ? void 0 : g.trim()) || void 0,
188
+ kind: ((Z = f.kind) == null ? void 0 : Z.trim()) || void 0,
189
+ label: ((S = f.label) == null ? void 0 : S.trim()) || void 0,
190
190
  origin: i,
191
- sourceEdgeIds: [y]
191
+ sourceEdgeIds: [g]
192
192
  };
193
- m.set(Q, we), P.push(we);
193
+ m.set(H, q), x.push(q);
194
194
  }
195
- P.sort(
195
+ x.sort(
196
196
  (i, l) => `${i.from}:${i.to}:${i.id}`.localeCompare(`${l.from}:${l.to}:${l.id}`)
197
197
  );
198
- const O = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
199
- for (const i of P) {
200
- const l = N.get(i.from);
201
- l ? l.push(i) : N.set(i.from, [i]);
202
- const f = O.get(i.to);
203
- f ? f.push(i) : O.set(i.to, [i]);
198
+ const $ = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
199
+ for (const i of x) {
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
204
  }
205
205
  const M = [];
206
206
  for (const i of e.startScreenIds ?? []) {
@@ -216,24 +216,24 @@ function wt(e) {
216
216
  }
217
217
  M.push(f);
218
218
  }
219
- const $ = new Set(M);
220
- let C = z(M);
221
- C.length || (C = u.filter((i) => {
219
+ const C = new Set(M);
220
+ let A = k(M);
221
+ A.length || (A = h.filter((i) => {
222
222
  var l;
223
- return (((l = O.get(i.id)) == null ? void 0 : l.length) ?? 0) === 0;
224
- }).map((i) => i.id).sort((i, l) => i.localeCompare(l))), !C.length && u.length && (C = [u[0].id]);
225
- const S = /* @__PURE__ */ new Set(), R = [...C];
226
- for (; R.length; ) {
227
- const i = R.shift();
228
- if (!S.has(i)) {
229
- S.add(i);
230
- for (const l of N.get(i) ?? []) R.push(l.to);
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 && h.length && (A = [h[0].id]);
225
+ const w = /* @__PURE__ */ new Set(), E = [...A];
226
+ for (; E.length; ) {
227
+ const i = E.shift();
228
+ if (!w.has(i)) {
229
+ w.add(i);
230
+ for (const l of R.get(i) ?? []) E.push(l.to);
231
231
  }
232
232
  }
233
- const F = u.filter((i) => {
234
- var f, y;
235
- const l = (((f = O.get(i.id)) == null ? void 0 : f.length) ?? 0) === 0 && (((y = N.get(i.id)) == null ? void 0 : y.length) ?? 0) === 0 && !$.has(i.id);
236
- return !S.has(i.id) || l && u.length > 1;
233
+ const F = h.filter((i) => {
234
+ var f, g;
235
+ const l = (((f = $.get(i.id)) == null ? void 0 : f.length) ?? 0) === 0 && (((g = R.get(i.id)) == null ? void 0 : g.length) ?? 0) === 0 && !C.has(i.id);
236
+ return !w.has(i.id) || l && h.length > 1;
237
237
  });
238
238
  for (const i of F)
239
239
  for (const l of i.screenIds)
@@ -244,41 +244,41 @@ function wt(e) {
244
244
  screenId: l,
245
245
  nodeId: i.id
246
246
  });
247
- const j = /* @__PURE__ */ new Map();
248
- for (const i of u)
247
+ const B = /* @__PURE__ */ new Map();
248
+ for (const i of h)
249
249
  for (const l of i.sourceKeys) {
250
- const f = j.get(l) ?? {
250
+ const f = B.get(l) ?? {
251
251
  nodeIds: /* @__PURE__ */ new Set(),
252
252
  screenIds: /* @__PURE__ */ new Set()
253
253
  };
254
254
  f.nodeIds.add(i.id);
255
- for (const y of i.screenIds) f.screenIds.add(y);
256
- j.set(l, f);
255
+ for (const g of i.screenIds) f.screenIds.add(g);
256
+ B.set(l, f);
257
257
  }
258
- const J = [...j.entries()].map(([i, l]) => ({
258
+ const Q = [...B.entries()].map(([i, l]) => ({
259
259
  sourceKey: i,
260
- nodeIds: [...l.nodeIds].sort((f, y) => f.localeCompare(y)),
261
- screenIds: [...l.screenIds].sort((f, y) => f.localeCompare(y)),
260
+ nodeIds: [...l.nodeIds].sort((f, g) => f.localeCompare(g)),
261
+ screenIds: [...l.screenIds].sort((f, g) => f.localeCompare(g)),
262
262
  shared: l.nodeIds.size > 1
263
- })).sort((i, l) => i.sourceKey.localeCompare(l.sourceKey)), K = u.map((i) => {
264
- const l = [...N.get(i.id) ?? []].sort(
265
- (f, y) => f.id.localeCompare(y.id)
263
+ })).sort((i, l) => i.sourceKey.localeCompare(l.sourceKey)), G = h.map((i) => {
264
+ const l = [...R.get(i.id) ?? []].sort(
265
+ (f, g) => f.id.localeCompare(g.id)
266
266
  );
267
267
  return {
268
268
  nodeId: i.id,
269
269
  edgeIds: l.map((f) => f.id),
270
- targetNodeIds: z(l.map((f) => f.to))
270
+ targetNodeIds: k(l.map((f) => f.to))
271
271
  };
272
- }).filter((i) => i.targetNodeIds.length > 1).sort((i, l) => i.nodeId.localeCompare(l.nodeId)), q = new Set(
273
- u.flatMap((i) => i.scenarioIds)
274
- ), I = new Set(
272
+ }).filter((i) => i.targetNodeIds.length > 1).sort((i, l) => i.nodeId.localeCompare(l.nodeId)), L = new Set(
273
+ h.flatMap((i) => i.scenarioIds)
274
+ ), v = new Set(
275
275
  (e.nonVisualScenarioIds ?? []).map((i) => i.trim())
276
- ), B = z(
276
+ ), j = k(
277
277
  (e.scenarios ?? []).map((i) => i.id)
278
- ), k = B.filter(
279
- (i) => !q.has(i) && !I.has(i)
278
+ ), T = j.filter(
279
+ (i) => !L.has(i) && !v.has(i)
280
280
  );
281
- for (const i of k)
281
+ for (const i of T)
282
282
  t.push({
283
283
  code: "missing-code-scenario",
284
284
  severity: "warning",
@@ -286,51 +286,51 @@ function wt(e) {
286
286
  scenarioId: i
287
287
  });
288
288
  t.sort(
289
- (i, l) => Re(i).localeCompare(Re(l))
289
+ (i, l) => Ne(i).localeCompare(Ne(l))
290
290
  );
291
- const W = z(
291
+ const Y = k(
292
292
  F.flatMap((i) => i.screenIds)
293
- ), ne = {
293
+ ), re = {
294
294
  screens: r.length,
295
- canonicalNodes: u.length,
296
- mergedScreens: Math.max(0, r.length - u.length),
297
- edges: P.length,
298
- connectedNodes: u.length - F.length,
299
- disconnectedScreens: W,
300
- codeScenarios: B.length,
301
- representedScenarios: B.filter(
302
- (i) => q.has(i)
295
+ canonicalNodes: h.length,
296
+ mergedScreens: Math.max(0, r.length - h.length),
297
+ edges: x.length,
298
+ connectedNodes: h.length - F.length,
299
+ disconnectedScreens: Y,
300
+ codeScenarios: j.length,
301
+ representedScenarios: j.filter(
302
+ (i) => L.has(i)
303
303
  ).length,
304
- missingScenarios: k,
305
- complete: W.length === 0 && k.length === 0 && !t.some((i) => i.severity === "error") && s.size === 0
304
+ missingScenarios: T,
305
+ complete: Y.length === 0 && T.length === 0 && !t.some((i) => i.severity === "error") && s.size === 0
306
306
  };
307
307
  return {
308
308
  version: 1,
309
- nodes: u,
310
- edges: P,
309
+ nodes: h,
310
+ edges: x,
311
311
  aliases: Object.fromEntries(
312
312
  Object.entries(c).sort(([i], [l]) => i.localeCompare(l))
313
313
  ),
314
- sourceGroups: J,
315
- startNodeIds: C,
316
- branches: K,
314
+ sourceGroups: Q,
315
+ startNodeIds: A,
316
+ branches: G,
317
317
  warnings: t,
318
- coverage: ne
318
+ coverage: re
319
319
  };
320
320
  }
321
321
  function bt(e) {
322
322
  return e ? JSON.parse(JSON.stringify(e)) : void 0;
323
323
  }
324
- function se(e) {
325
- if (Array.isArray(e)) return e.map(se);
324
+ function ie(e) {
325
+ if (Array.isArray(e)) return e.map(ie);
326
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, se(n)]).filter(([, r]) => r !== void 0);
327
+ const t = Object.entries(e).filter(([, r]) => r !== void 0).sort(([r], [n]) => r.localeCompare(n)).map(([r, n]) => [r, ie(n)]).filter(([, r]) => r !== void 0);
328
328
  return t.length ? Object.fromEntries(t) : void 0;
329
329
  }
330
330
  return e;
331
331
  }
332
- function Ne(e) {
333
- return JSON.stringify(se(e ?? null));
332
+ function Re(e) {
333
+ return JSON.stringify(ie(e ?? null));
334
334
  }
335
335
  function St(e) {
336
336
  return !!(e && typeof e == "object" && !Array.isArray(e));
@@ -349,7 +349,7 @@ function U(e) {
349
349
  function De(e) {
350
350
  return `source-route:${encodeURIComponent(e)}`;
351
351
  }
352
- function ye(e, t) {
352
+ function we(e, t) {
353
353
  const r = e.split("/").filter(Boolean), n = t.split("/").filter(Boolean);
354
354
  let o = 0;
355
355
  for (let s = 0; s < r.length; s += 1) {
@@ -369,7 +369,7 @@ function Ce(e, t) {
369
369
  const n = t.get(r);
370
370
  return n && !/[:*]/.test(r) ? [n] : [
371
371
  ...new Set(
372
- [...t.entries()].filter(([o]) => ye(r, o)).map(([, o]) => o)
372
+ [...t.entries()].filter(([o]) => we(r, o)).map(([, o]) => o)
373
373
  )
374
374
  ].sort((o, s) => o.localeCompare(s));
375
375
  }
@@ -389,21 +389,21 @@ function vt(e) {
389
389
  }
390
390
  function It(e, t, r) {
391
391
  return (e ?? []).flatMap((n, o) => {
392
- var u, b, x;
393
- const s = (u = n.from) == null ? void 0 : u.trim(), a = (b = n.to) == null ? void 0 : b.trim();
392
+ var h, b, I;
393
+ const s = (h = n.from) == null ? void 0 : h.trim(), a = (b = n.to) == null ? void 0 : b.trim();
394
394
  if (!s || !a || n.unresolvedTarget) return [];
395
395
  const c = r.has(s) ? [s] : Ce(s, t), d = r.has(a) ? [a] : Ce(a, t);
396
396
  if (!c.length || !d.length) return [];
397
- const h = ((x = n.id) == null ? void 0 : x.trim()) || `discovery-edge:${o + 1}`;
397
+ const p = ((I = n.id) == null ? void 0 : I.trim()) || `discovery-edge:${o + 1}`;
398
398
  return c.flatMap(
399
- (P, m) => d.map((E, p) => {
400
- var O, N;
399
+ (x, m) => d.map((P, u) => {
400
+ var $, R;
401
401
  return {
402
- id: c.length === 1 && d.length === 1 ? h : `${h}:${m + 1}:${p + 1}`,
403
- from: P,
404
- to: E,
405
- kind: ((O = n.kind) == null ? void 0 : O.trim()) || void 0,
406
- label: ((N = n.label) == null ? void 0 : N.trim()) || void 0
402
+ id: c.length === 1 && d.length === 1 ? p : `${p}:${m + 1}:${u + 1}`,
403
+ from: x,
404
+ to: P,
405
+ kind: (($ = n.kind) == null ? void 0 : $.trim()) || void 0,
406
+ label: ((R = n.label) == null ? void 0 : R.trim()) || void 0
407
407
  };
408
408
  })
409
409
  );
@@ -415,14 +415,14 @@ function xt(e, t, r) {
415
415
  const o = t.filter(
416
416
  (c) => {
417
417
  const d = U(c.route);
418
- return d ? ye(d, n) : !1;
418
+ return d ? we(d, n) : !1;
419
419
  }
420
420
  );
421
421
  if (!o.length) return [];
422
- const s = Ne(
422
+ const s = Re(
423
423
  He(r, e.environment)
424
424
  ), a = o.filter(
425
- (c) => Ne(c.environment) === s
425
+ (c) => Re(c.environment) === s
426
426
  );
427
427
  return [
428
428
  ...new Set(
@@ -463,11 +463,11 @@ function Pt(e, t) {
463
463
  sourcePath: [...s.sourcePaths ?? []].filter(Boolean).sort((a, c) => a.localeCompare(c))[0]
464
464
  }));
465
465
  }
466
- function de(e, t) {
467
- var c, d, h, u;
466
+ function fe(e, t) {
467
+ var c, d, p, h;
468
468
  const r = (((c = e.interactions) == null ? void 0 : c.length) ?? 0) - (((d = t.interactions) == null ? void 0 : d.length) ?? 0);
469
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;
470
+ const n = (p = e.scenarioIds) != null && p.includes("environment:baseline") ? 0 : 1, o = (h = t.scenarioIds) != null && h.includes("environment:baseline") ? 0 : 1;
471
471
  if (n !== o) return n - o;
472
472
  const s = !e.environment && !e.preset ? 0 : 1, a = !t.environment && !t.preset ? 0 : 1;
473
473
  return s !== a ? s - a : e.id.localeCompare(t.id);
@@ -482,14 +482,14 @@ function Et(e) {
482
482
  }
483
483
  return new Map(
484
484
  [...t.entries()].map(([r, n]) => {
485
- const o = [...n].sort(de);
485
+ const o = [...n].sort(fe);
486
486
  return [r, o[0].id];
487
487
  })
488
488
  );
489
489
  }
490
- function Rt(e) {
490
+ function Nt(e) {
491
491
  return e.action === "wait" ? null : JSON.stringify(
492
- se({
492
+ ie({
493
493
  action: e.action,
494
494
  selector: e.selector,
495
495
  text: e.text,
@@ -504,9 +504,9 @@ function Rt(e) {
504
504
  );
505
505
  }
506
506
  function ke(e) {
507
- return (e.interactions ?? []).map(Rt).filter((t) => t != null);
507
+ return (e.interactions ?? []).map(Nt).filter((t) => t != null);
508
508
  }
509
- function Nt(e, t) {
509
+ function Rt(e, t) {
510
510
  return e.length < t.length && e.every((r, n) => r === t[n]);
511
511
  }
512
512
  function Ct(e, t) {
@@ -519,7 +519,7 @@ function Ct(e, t) {
519
519
  }
520
520
  return [...r.values()].flatMap((n) => {
521
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(de)[0];
522
+ const o = U(n[0].route), s = t.get(o), a = n.find((c) => c.id === s) ?? [...n].sort(fe)[0];
523
523
  return n.filter((c) => c.id !== a.id).sort((c, d) => c.id.localeCompare(d.id)).map((c) => ({
524
524
  id: `discovery-variant:${encodeURIComponent(a.id)}:${encodeURIComponent(c.id)}`,
525
525
  from: a.id,
@@ -543,22 +543,22 @@ function At(e, t) {
543
543
  (d) => d.id === a
544
544
  );
545
545
  return o.flatMap((d) => {
546
- const h = s.get(d.id);
547
- if (!h.length) return [];
546
+ const p = s.get(d.id);
547
+ if (!p.length) return [];
548
548
  const b = o.filter(
549
- (x) => Nt(
550
- s.get(x.id),
551
- h
549
+ (I) => Rt(
550
+ s.get(I.id),
551
+ p
552
552
  )
553
- ).sort((x, P) => {
554
- const m = s.get(P.id).length - s.get(x.id).length;
553
+ ).sort((I, x) => {
554
+ const m = s.get(x.id).length - s.get(I.id).length;
555
555
  if (m !== 0) return m;
556
- const E = x.flow && x.flow === d.flow ? 0 : 1, p = P.flow && P.flow === d.flow ? 0 : 1;
557
- if (E !== p) return E - p;
558
- const O = x.section && x.section === d.section ? 0 : 1, N = P.section && P.section === d.section ? 0 : 1;
559
- if (O !== N) return O - N;
560
- const M = x.id === a ? 0 : 1, $ = P.id === a ? 0 : 1;
561
- return M !== $ ? M - $ : de(x, P);
556
+ const P = I.flow && I.flow === d.flow ? 0 : 1, u = x.flow && x.flow === d.flow ? 0 : 1;
557
+ if (P !== u) return P - u;
558
+ const $ = I.section && I.section === d.section ? 0 : 1, R = x.section && x.section === d.section ? 0 : 1;
559
+ if ($ !== R) return $ - R;
560
+ const M = I.id === a ? 0 : 1, C = x.id === a ? 0 : 1;
561
+ return M !== C ? M - C : fe(I, x);
562
562
  })[0];
563
563
  return b ? [
564
564
  {
@@ -567,7 +567,7 @@ function At(e, t) {
567
567
  to: d.id,
568
568
  kind: "recipe-step"
569
569
  }
570
- ] : c && c.id !== d.id && s.get(c.id).join("") !== h.join("") ? [
570
+ ] : c && c.id !== d.id && s.get(c.id).join("") !== p.join("") ? [
571
571
  {
572
572
  id: `discovery-route-case:${encodeURIComponent(c.id)}:${encodeURIComponent(d.id)}`,
573
573
  from: c.id,
@@ -597,7 +597,7 @@ function Ot(e) {
597
597
  }
598
598
  return s.size < 2 ? [] : [...s.values()].flatMap((a) => {
599
599
  const c = [...a].sort(
600
- de
600
+ fe
601
601
  )[0];
602
602
  return c.id === o.id ? [] : [
603
603
  {
@@ -619,7 +619,7 @@ function $t(e, t, r) {
619
619
  if (!s || r.get(s) !== o.id)
620
620
  return o;
621
621
  const a = [...n].filter(
622
- (c) => ye(c, s)
622
+ (c) => we(c, s)
623
623
  );
624
624
  return a.length ? {
625
625
  ...o,
@@ -633,56 +633,56 @@ function $t(e, t, r) {
633
633
  });
634
634
  }
635
635
  function Mt(e, t) {
636
- var h, u, b, x, P;
636
+ var p, h, b, I, x;
637
637
  const r = new Set(e.map((m) => m.id)), n = new Map(
638
- e.map((m, E) => [m.id, E])
638
+ e.map((m, P) => [m.id, P])
639
639
  ), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
640
640
  for (const m of r)
641
641
  o.set(m, /* @__PURE__ */ new Set()), s.set(m, /* @__PURE__ */ new Set()), a.set(m, /* @__PURE__ */ new Set());
642
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), (x = a.get(m.to)) == null || x.add(m.from));
643
+ !r.has(m.from) || !r.has(m.to) || ((p = o.get(m.to)) == null || p.add(m.from), (h = s.get(m.from)) == null || h.add(m.to), (b = a.get(m.from)) == null || b.add(m.to), (I = a.get(m.to)) == null || I.add(m.from));
644
644
  const c = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
645
645
  for (const m of r) {
646
646
  if (d.has(m)) continue;
647
- const E = [], p = [m];
648
- for (; p.length; ) {
649
- const S = p.shift();
650
- if (!d.has(S)) {
651
- d.add(S), E.push(S);
652
- for (const R of a.get(S) ?? [])
653
- d.has(R) || p.push(R);
647
+ const P = [], u = [m];
648
+ for (; u.length; ) {
649
+ const w = u.shift();
650
+ if (!d.has(w)) {
651
+ d.add(w), P.push(w);
652
+ for (const E of a.get(w) ?? [])
653
+ d.has(E) || u.push(E);
654
654
  }
655
655
  }
656
- if (E.length === 1 && (((P = a.get(E[0])) == null ? void 0 : P.size) ?? 0) === 0)
656
+ if (P.length === 1 && (((x = a.get(P[0])) == null ? void 0 : x.size) ?? 0) === 0)
657
657
  continue;
658
- const O = E.filter((S) => {
659
- var R;
660
- return (((R = o.get(S)) == null ? void 0 : R.size) ?? 0) === 0;
658
+ const $ = P.filter((w) => {
659
+ var E;
660
+ return (((E = o.get(w)) == null ? void 0 : E.size) ?? 0) === 0;
661
661
  }).sort(
662
- (S, R) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(R) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(R)
663
- ), N = [...E].sort(
664
- (S, R) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(R) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(R)
662
+ (w, E) => (n.get(w) ?? Number.MAX_SAFE_INTEGER) - (n.get(E) ?? Number.MAX_SAFE_INTEGER) || w.localeCompare(E)
663
+ ), R = [...P].sort(
664
+ (w, E) => (n.get(w) ?? Number.MAX_SAFE_INTEGER) - (n.get(E) ?? Number.MAX_SAFE_INTEGER) || w.localeCompare(E)
665
665
  )[0];
666
- if (!N) continue;
667
- const M = [N], $ = /* @__PURE__ */ new Set(), C = (S) => {
668
- const R = [S];
669
- for (; R.length; ) {
670
- const F = R.shift();
671
- if (!$.has(F)) {
672
- $.add(F);
673
- for (const j of s.get(F) ?? [])
674
- $.has(j) || R.push(j);
666
+ if (!R) continue;
667
+ const M = [R], C = /* @__PURE__ */ new Set(), A = (w) => {
668
+ const E = [w];
669
+ for (; E.length; ) {
670
+ const F = E.shift();
671
+ if (!C.has(F)) {
672
+ C.add(F);
673
+ for (const B of s.get(F) ?? [])
674
+ C.has(B) || E.push(B);
675
675
  }
676
676
  }
677
677
  };
678
- C(N);
679
- for (const S of O)
680
- $.has(S) || (M.push(S), C(S));
681
- for (const S of M)
682
- c.add(S);
678
+ A(R);
679
+ for (const w of $)
680
+ C.has(w) || (M.push(w), A(w));
681
+ for (const w of M)
682
+ c.add(w);
683
683
  }
684
684
  return [...c].sort(
685
- (m, E) => (n.get(m) ?? Number.MAX_SAFE_INTEGER) - (n.get(E) ?? Number.MAX_SAFE_INTEGER) || m.localeCompare(E)
685
+ (m, P) => (n.get(m) ?? Number.MAX_SAFE_INTEGER) - (n.get(P) ?? Number.MAX_SAFE_INTEGER) || m.localeCompare(P)
686
686
  );
687
687
  }
688
688
  function ze(e) {
@@ -741,23 +741,23 @@ async function _e(e) {
741
741
  };
742
742
  }
743
743
  async function gn(e) {
744
- L(null);
744
+ V(null);
745
745
  try {
746
746
  const t = await _e(e);
747
- return L(t.graph), t;
747
+ return V(t.graph), t;
748
748
  } catch (t) {
749
- throw L(null), t;
749
+ throw V(null), t;
750
750
  }
751
751
  }
752
- const Dt = "pygmalion-preview", kt = "unknown", zt = 512, _t = 2048, Ft = 8 * 1024 * 1024, Bt = 128 * 1024 * 1024, jt = /* @__PURE__ */ new Set([
752
+ const Dt = "pygmalion-preview", kt = "unknown", zt = 512, _t = 2048, Ft = 8 * 1024 * 1024, jt = 128 * 1024 * 1024, Bt = /* @__PURE__ */ new Set([
753
753
  "__proto__",
754
754
  "constructor",
755
755
  "prototype"
756
756
  ]);
757
- function V(e, t) {
757
+ function W(e, t) {
758
758
  const r = e.trim();
759
759
  if (!r && t != null) return t;
760
- if (oe(r)) return r;
760
+ if (se(r)) return r;
761
761
  throw new TypeError("Preview identity must be a non-empty bounded string.");
762
762
  }
763
763
  function Ut(e) {
@@ -768,7 +768,7 @@ function Ut(e) {
768
768
  );
769
769
  return t;
770
770
  }
771
- function he(e, t = /* @__PURE__ */ new Set()) {
771
+ function me(e, t = /* @__PURE__ */ new Set()) {
772
772
  if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
773
773
  return e;
774
774
  if (typeof e != "object") return null;
@@ -777,13 +777,13 @@ function he(e, t = /* @__PURE__ */ new Set()) {
777
777
  "Preview recipe identity cannot contain circular values."
778
778
  );
779
779
  if (t.add(e), Array.isArray(e)) {
780
- const n = e.map((o) => he(o, t));
780
+ const n = e.map((o) => me(o, t));
781
781
  return t.delete(e), n;
782
782
  }
783
783
  const r = {};
784
784
  for (const n of Object.keys(e).sort()) {
785
785
  const o = e[n];
786
- o !== void 0 && (r[n] = he(o, t));
786
+ o !== void 0 && (r[n] = me(o, t));
787
787
  }
788
788
  return t.delete(e), r;
789
789
  }
@@ -799,12 +799,12 @@ function Kt(e) {
799
799
  if (!Array.isArray(e))
800
800
  throw new TypeError("Preview recipes must be an array.");
801
801
  const t = /* @__PURE__ */ new Set(), r = e.map(({ id: n, recipe: o }) => {
802
- const s = V(n);
802
+ const s = W(n);
803
803
  if (t.has(s))
804
804
  throw new TypeError(`Duplicate preview recipe identity: ${s}`);
805
805
  return t.add(s), {
806
806
  id: s,
807
- recipe: he(o)
807
+ recipe: me(o)
808
808
  };
809
809
  });
810
810
  return Ht(JSON.stringify(r));
@@ -815,7 +815,7 @@ function yn({
815
815
  recipeVersion: r,
816
816
  scope: n = Dt
817
817
  }) {
818
- const o = V(n), s = V(
818
+ const o = W(n), s = W(
819
819
  e,
820
820
  kt
821
821
  ), a = Ut(r), c = Kt(t);
@@ -865,7 +865,7 @@ function qt({
865
865
  sourceRevision: s.sourceRevision
866
866
  }), c = s.captureBaseUrl ?? r;
867
867
  c && a.set("captureBaseUrl", c);
868
- const d = n.includes("?") ? "&" : "?", h = await o(
868
+ const d = n.includes("?") ? "&" : "?", p = await o(
869
869
  `${n}${d}${a}`,
870
870
  {
871
871
  method: "GET",
@@ -874,10 +874,10 @@ function qt({
874
874
  signal: s.signal
875
875
  }
876
876
  );
877
- return h.ok ? h.json().catch(() => null) : null;
877
+ return p.ok ? p.json().catch(() => null) : null;
878
878
  };
879
879
  }
880
- function ie(e) {
880
+ function ae(e) {
881
881
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
882
882
  const t = Object.getPrototypeOf(e);
883
883
  return t === Object.prototype || t === null;
@@ -885,8 +885,8 @@ function ie(e) {
885
885
  function Fe(e) {
886
886
  return new TextEncoder().encode(e).byteLength;
887
887
  }
888
- function oe(e) {
889
- return typeof e == "string" && e.length > 0 && e.length <= zt && e === e.trim() && !jt.has(e);
888
+ function se(e) {
889
+ return typeof e == "string" && e.length > 0 && e.length <= zt && e === e.trim() && !Bt.has(e);
890
890
  }
891
891
  function Gt(e) {
892
892
  const t = /(?:expression\s*\(|-moz-binding\s*:|(?:^|[;{])\s*behavior\s*:)/i;
@@ -898,14 +898,14 @@ function Gt(e) {
898
898
  if (t.test(r[1] ?? r[2] ?? r[3] ?? "")) return !0;
899
899
  return !1;
900
900
  }
901
- function Lt(e) {
901
+ function Jt(e) {
902
902
  return typeof e != "string" || e.length === 0 || Fe(e) > Ft ? !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
903
  e
904
904
  ) || Gt(e));
905
905
  }
906
- function Vt(e) {
906
+ function Lt(e) {
907
907
  const t = [];
908
- if (!ie(e) || e.version !== 1)
908
+ if (!ae(e) || e.version !== 1)
909
909
  return {
910
910
  valid: !1,
911
911
  artifact: null,
@@ -913,16 +913,16 @@ function Vt(e) {
913
913
  "Preview artifact must be a version 1, version 2, or version 3 bundle."
914
914
  ]
915
915
  };
916
- if (oe(e.namespace) || t.push("Preview artifact namespace is invalid."), e.sourceRevision != null && !oe(e.sourceRevision) && t.push("Preview artifact source revision is invalid."), !ie(e.snapshots))
916
+ if (se(e.namespace) || t.push("Preview artifact namespace is invalid."), e.sourceRevision != null && !se(e.sourceRevision) && t.push("Preview artifact source revision is invalid."), !ae(e.snapshots))
917
917
  t.push("Preview artifact snapshots must be a record.");
918
918
  else {
919
919
  const r = Object.entries(e.snapshots);
920
920
  r.length > _t && t.push("Preview artifact has too many frames.");
921
921
  for (const [n, o] of r)
922
- (!oe(n) || !Lt(o)) && t.push(`Preview artifact frame "${n}" is invalid.`);
922
+ (!se(n) || !Jt(o)) && t.push(`Preview artifact frame "${n}" is invalid.`);
923
923
  }
924
924
  try {
925
- Fe(JSON.stringify(e)) > Bt && t.push("Preview artifact exceeds the bundle byte limit.");
925
+ Fe(JSON.stringify(e)) > jt && t.push("Preview artifact exceeds the bundle byte limit.");
926
926
  } catch {
927
927
  t.push("Preview artifact is not serializable.");
928
928
  }
@@ -932,35 +932,35 @@ function Vt(e) {
932
932
  errors: t
933
933
  };
934
934
  }
935
- function Jt(e, t) {
936
- const r = ie(e) && e.version === 3 ? (() => {
935
+ function Vt(e, t) {
936
+ const r = ae(e) && e.version === 3 ? (() => {
937
937
  const n = Ke(e);
938
938
  return {
939
939
  valid: n.valid,
940
940
  artifact: n.valid ? e : null,
941
941
  errors: n.errors
942
942
  };
943
- })() : ie(e) && e.version === 2 ? (() => {
943
+ })() : ae(e) && e.version === 2 ? (() => {
944
944
  const n = qe(e);
945
945
  return {
946
946
  valid: n.valid,
947
947
  artifact: n.valid ? e : null,
948
948
  errors: n.errors
949
949
  };
950
- })() : Vt(e);
950
+ })() : Lt(e);
951
951
  return !r.valid || !r.artifact ? {
952
952
  valid: !1,
953
953
  artifact: null,
954
954
  reason: "invalid-bundle",
955
955
  errors: r.errors
956
- } : t && r.artifact.namespace !== V(t.namespace) ? {
956
+ } : t && r.artifact.namespace !== W(t.namespace) ? {
957
957
  valid: !1,
958
958
  artifact: null,
959
959
  reason: "namespace-mismatch",
960
960
  errors: [
961
961
  "Preview artifact namespace does not match the runtime namespace."
962
962
  ]
963
- } : t && r.artifact.sourceRevision !== V(t.sourceRevision) ? {
963
+ } : t && r.artifact.sourceRevision !== W(t.sourceRevision) ? {
964
964
  valid: !1,
965
965
  artifact: null,
966
966
  reason: "revision-mismatch",
@@ -980,8 +980,8 @@ async function Wt({
980
980
  signal: n
981
981
  }) {
982
982
  const o = {
983
- namespace: V(e),
984
- sourceRevision: V(t)
983
+ namespace: W(e),
984
+ sourceRevision: W(t)
985
985
  };
986
986
  let s;
987
987
  try {
@@ -992,7 +992,7 @@ async function Wt({
992
992
  }
993
993
  if (s == null)
994
994
  return { status: "unavailable", artifact: null };
995
- const a = Jt(s, o);
995
+ const a = Vt(s, o);
996
996
  return a.valid ? { status: "accepted", artifact: a.artifact } : {
997
997
  status: "rejected",
998
998
  artifact: null,
@@ -1000,7 +1000,7 @@ async function Wt({
1000
1000
  errors: a.errors
1001
1001
  };
1002
1002
  }
1003
- const ae = "var(--pygmalion-catalog-surface, #ffffff)", ce = "var(--pygmalion-catalog-canvas, #f5f5f5)", me = "var(--pygmalion-catalog-border, #e5e7eb)", le = "var(--pygmalion-catalog-text, #202124)", _ = "var(--pygmalion-catalog-muted, #6b7280)", Qt = "var(--pygmalion-catalog-header, #11182f)", Xt = "var(--pygmalion-catalog-accent, #7c6cf2)";
1003
+ const ce = "var(--pygmalion-catalog-surface, #ffffff)", le = "var(--pygmalion-catalog-canvas, #f5f5f5)", ge = "var(--pygmalion-catalog-border, #e5e7eb)", de = "var(--pygmalion-catalog-text, #202124)", _ = "var(--pygmalion-catalog-muted, #6b7280)", Qt = "var(--pygmalion-catalog-header, #11182f)", Xt = "var(--pygmalion-catalog-accent, #7c6cf2)";
1004
1004
  function bn({
1005
1005
  title: e,
1006
1006
  eyebrow: t,
@@ -1010,10 +1010,10 @@ function bn({
1010
1010
  children: s,
1011
1011
  headerBackground: a = Qt,
1012
1012
  headerColor: c = "#ffffff",
1013
- bodyBackground: d = ae,
1014
- bodyGap: h = 40
1013
+ bodyBackground: d = ce,
1014
+ bodyGap: p = 40
1015
1015
  }) {
1016
- return /* @__PURE__ */ A(
1016
+ return /* @__PURE__ */ O(
1017
1017
  "section",
1018
1018
  {
1019
1019
  "data-pygmalion-catalog-document": "",
@@ -1025,12 +1025,12 @@ function bn({
1025
1025
  maxWidth: "none",
1026
1026
  flexDirection: "column",
1027
1027
  overflow: "visible",
1028
- color: le,
1028
+ color: de,
1029
1029
  background: d,
1030
1030
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
1031
1031
  },
1032
1032
  children: [
1033
- /* @__PURE__ */ A(
1033
+ /* @__PURE__ */ O(
1034
1034
  "header",
1035
1035
  {
1036
1036
  style: {
@@ -1044,8 +1044,8 @@ function bn({
1044
1044
  background: a
1045
1045
  },
1046
1046
  children: [
1047
- /* @__PURE__ */ A("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1048
- t ? /* @__PURE__ */ w(
1047
+ /* @__PURE__ */ O("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1048
+ t ? /* @__PURE__ */ y(
1049
1049
  "div",
1050
1050
  {
1051
1051
  style: {
@@ -1058,7 +1058,7 @@ function bn({
1058
1058
  children: t
1059
1059
  }
1060
1060
  ) : null,
1061
- /* @__PURE__ */ w(
1061
+ /* @__PURE__ */ y(
1062
1062
  "h1",
1063
1063
  {
1064
1064
  style: {
@@ -1072,7 +1072,7 @@ function bn({
1072
1072
  children: e
1073
1073
  }
1074
1074
  ),
1075
- r ? /* @__PURE__ */ w(
1075
+ r ? /* @__PURE__ */ y(
1076
1076
  "div",
1077
1077
  {
1078
1078
  style: {
@@ -1085,7 +1085,7 @@ function bn({
1085
1085
  }
1086
1086
  ) : null
1087
1087
  ] }),
1088
- n || o ? /* @__PURE__ */ A(
1088
+ n || o ? /* @__PURE__ */ O(
1089
1089
  "div",
1090
1090
  {
1091
1091
  style: {
@@ -1097,15 +1097,15 @@ function bn({
1097
1097
  whiteSpace: "nowrap"
1098
1098
  },
1099
1099
  children: [
1100
- n ? /* @__PURE__ */ w("span", { children: n }) : null,
1101
- o ? /* @__PURE__ */ w("span", { children: o }) : null
1100
+ n ? /* @__PURE__ */ y("span", { children: n }) : null,
1101
+ o ? /* @__PURE__ */ y("span", { children: o }) : null
1102
1102
  ]
1103
1103
  }
1104
1104
  ) : null
1105
1105
  ]
1106
1106
  }
1107
1107
  ),
1108
- /* @__PURE__ */ w(
1108
+ /* @__PURE__ */ y(
1109
1109
  "div",
1110
1110
  {
1111
1111
  "data-pygmalion-catalog-document-body": "",
@@ -1114,7 +1114,7 @@ function bn({
1114
1114
  display: "inline-flex",
1115
1115
  flexDirection: "column",
1116
1116
  alignItems: "flex-start",
1117
- gap: h,
1117
+ gap: p,
1118
1118
  padding: 48,
1119
1119
  background: d
1120
1120
  },
@@ -1132,7 +1132,7 @@ function Sn({
1132
1132
  children: n,
1133
1133
  tone: o = "tinted"
1134
1134
  }) {
1135
- return /* @__PURE__ */ A(
1135
+ return /* @__PURE__ */ O(
1136
1136
  "section",
1137
1137
  {
1138
1138
  "data-pygmalion-catalog-section": "",
@@ -1144,11 +1144,11 @@ function Sn({
1144
1144
  alignItems: "flex-start",
1145
1145
  gap: 18,
1146
1146
  padding: o === "tinted" ? 24 : 0,
1147
- background: o === "tinted" ? ce : "transparent"
1147
+ background: o === "tinted" ? le : "transparent"
1148
1148
  },
1149
1149
  children: [
1150
- /* @__PURE__ */ A("header", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
1151
- /* @__PURE__ */ w(
1150
+ /* @__PURE__ */ O("header", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
1151
+ /* @__PURE__ */ y(
1152
1152
  "h2",
1153
1153
  {
1154
1154
  style: {
@@ -1160,9 +1160,9 @@ function Sn({
1160
1160
  children: e
1161
1161
  }
1162
1162
  ),
1163
- typeof t == "number" ? /* @__PURE__ */ w("span", { style: { color: _, fontSize: 11 }, children: t }) : null
1163
+ typeof t == "number" ? /* @__PURE__ */ y("span", { style: { color: _, fontSize: 11 }, children: t }) : null
1164
1164
  ] }),
1165
- r ? /* @__PURE__ */ w("div", { style: { marginTop: -10, color: _, fontSize: 11 }, children: r }) : null,
1165
+ r ? /* @__PURE__ */ y("div", { style: { marginTop: -10, color: _, fontSize: 11 }, children: r }) : null,
1166
1166
  n
1167
1167
  ]
1168
1168
  }
@@ -1178,7 +1178,7 @@ function vn({
1178
1178
  boundary: a = !0,
1179
1179
  cellStyle: c
1180
1180
  }) {
1181
- return /* @__PURE__ */ w(
1181
+ return /* @__PURE__ */ y(
1182
1182
  "div",
1183
1183
  {
1184
1184
  "data-pygmalion-catalog-matrix": "",
@@ -1190,7 +1190,7 @@ function vn({
1190
1190
  border: a ? `1px dashed ${Xt}` : void 0,
1191
1191
  borderRadius: a ? 4 : void 0
1192
1192
  },
1193
- children: /* @__PURE__ */ A(
1193
+ children: /* @__PURE__ */ O(
1194
1194
  "table",
1195
1195
  {
1196
1196
  style: {
@@ -1199,8 +1199,8 @@ function vn({
1199
1199
  borderSpacing: 0
1200
1200
  },
1201
1201
  children: [
1202
- /* @__PURE__ */ w("thead", { children: /* @__PURE__ */ A("tr", { children: [
1203
- /* @__PURE__ */ w(
1202
+ /* @__PURE__ */ y("thead", { children: /* @__PURE__ */ O("tr", { children: [
1203
+ /* @__PURE__ */ y(
1204
1204
  "th",
1205
1205
  {
1206
1206
  style: {
@@ -1214,7 +1214,7 @@ function vn({
1214
1214
  children: r
1215
1215
  }
1216
1216
  ),
1217
- t.map((d) => /* @__PURE__ */ w(
1217
+ t.map((d) => /* @__PURE__ */ y(
1218
1218
  "th",
1219
1219
  {
1220
1220
  style: {
@@ -1230,8 +1230,8 @@ function vn({
1230
1230
  d
1231
1231
  ))
1232
1232
  ] }) }),
1233
- /* @__PURE__ */ w("tbody", { children: e.map((d) => /* @__PURE__ */ A("tr", { children: [
1234
- /* @__PURE__ */ w(
1233
+ /* @__PURE__ */ y("tbody", { children: e.map((d) => /* @__PURE__ */ O("tr", { children: [
1234
+ /* @__PURE__ */ y(
1235
1235
  "th",
1236
1236
  {
1237
1237
  style: {
@@ -1245,7 +1245,7 @@ function vn({
1245
1245
  children: o(d)
1246
1246
  }
1247
1247
  ),
1248
- t.map((h) => /* @__PURE__ */ w(
1248
+ t.map((p) => /* @__PURE__ */ y(
1249
1249
  "td",
1250
1250
  {
1251
1251
  style: {
@@ -1254,9 +1254,9 @@ function vn({
1254
1254
  verticalAlign: "middle",
1255
1255
  ...c
1256
1256
  },
1257
- children: n(d, h)
1257
+ children: n(d, p)
1258
1258
  },
1259
- h
1259
+ p
1260
1260
  ))
1261
1261
  ] }, d)) })
1262
1262
  ]
@@ -1268,11 +1268,11 @@ function vn({
1268
1268
  function Yt(e) {
1269
1269
  return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase() || "page";
1270
1270
  }
1271
- function Be(e, t, r = "PygmalionCatalog") {
1271
+ function je(e, t, r = "PygmalionCatalog") {
1272
1272
  const n = (o) => Yt(o).replace(/-/g, "_");
1273
1273
  return `${r}_${n(e)}_${n(t)}`;
1274
1274
  }
1275
- function je(e, t) {
1275
+ function Be(e, t) {
1276
1276
  return {
1277
1277
  id: e.id,
1278
1278
  name: e.name,
@@ -1301,7 +1301,7 @@ function en({
1301
1301
  secondaryLabel: n,
1302
1302
  minimumColumnWidth: o
1303
1303
  }) {
1304
- return /* @__PURE__ */ A(
1304
+ return /* @__PURE__ */ O(
1305
1305
  "section",
1306
1306
  {
1307
1307
  "data-pygmalion-catalog-page": e.id,
@@ -1311,19 +1311,19 @@ function en({
1311
1311
  display: "inline-block",
1312
1312
  width: "max-content",
1313
1313
  padding: 32,
1314
- color: le,
1315
- background: ce,
1314
+ color: de,
1315
+ background: le,
1316
1316
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
1317
1317
  },
1318
1318
  children: [
1319
- /* @__PURE__ */ A("header", { style: { marginBottom: 24 }, children: [
1320
- /* @__PURE__ */ w("h1", { style: { margin: 0, fontSize: 24, lineHeight: 1.35 }, children: e.name }),
1321
- /* @__PURE__ */ A("p", { style: { margin: "6px 0 0", color: _, fontSize: 13 }, children: [
1319
+ /* @__PURE__ */ O("header", { style: { marginBottom: 24 }, children: [
1320
+ /* @__PURE__ */ y("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
1322
  t.length,
1323
1323
  " assets"
1324
1324
  ] })
1325
1325
  ] }),
1326
- /* @__PURE__ */ w(
1326
+ /* @__PURE__ */ y(
1327
1327
  "div",
1328
1328
  {
1329
1329
  style: {
@@ -1331,7 +1331,7 @@ function en({
1331
1331
  gridTemplateColumns: "repeat(6, max-content)",
1332
1332
  gap: 16
1333
1333
  },
1334
- children: t.map((s) => /* @__PURE__ */ A(
1334
+ children: t.map((s) => /* @__PURE__ */ O(
1335
1335
  "article",
1336
1336
  {
1337
1337
  "data-pygmalion-catalog-item": s.id,
@@ -1339,12 +1339,12 @@ function en({
1339
1339
  minWidth: o,
1340
1340
  width: o,
1341
1341
  padding: 16,
1342
- border: `1px solid ${me}`,
1342
+ border: `1px solid ${ge}`,
1343
1343
  borderRadius: 12,
1344
- background: ae
1344
+ background: ce
1345
1345
  },
1346
1346
  children: [
1347
- /* @__PURE__ */ w(
1347
+ /* @__PURE__ */ y(
1348
1348
  "div",
1349
1349
  {
1350
1350
  style: {
@@ -1357,7 +1357,7 @@ function en({
1357
1357
  children: r(s)
1358
1358
  }
1359
1359
  ),
1360
- /* @__PURE__ */ w(
1360
+ /* @__PURE__ */ y(
1361
1361
  "div",
1362
1362
  {
1363
1363
  style: {
@@ -1372,7 +1372,7 @@ function en({
1372
1372
  children: s.name
1373
1373
  }
1374
1374
  ),
1375
- n ? /* @__PURE__ */ w("div", { style: { marginTop: 4, color: _, fontSize: 11, lineHeight: 1.45 }, children: n(s) }) : s.codeName ? /* @__PURE__ */ w(
1375
+ n ? /* @__PURE__ */ y("div", { style: { marginTop: 4, color: _, fontSize: 11, lineHeight: 1.45 }, children: n(s) }) : s.codeName ? /* @__PURE__ */ y(
1376
1376
  "div",
1377
1377
  {
1378
1378
  style: {
@@ -1412,7 +1412,7 @@ function In(e) {
1412
1412
  t.set(s.id, {
1413
1413
  page: s,
1414
1414
  items: [o],
1415
- registryName: Be(
1415
+ registryName: je(
1416
1416
  e.kind,
1417
1417
  s.id,
1418
1418
  e.registryPrefix
@@ -1421,7 +1421,7 @@ function In(e) {
1421
1421
  }
1422
1422
  const r = {}, n = [];
1423
1423
  for (const o of t.values()) {
1424
- const s = () => /* @__PURE__ */ w(
1424
+ const s = () => /* @__PURE__ */ y(
1425
1425
  en,
1426
1426
  {
1427
1427
  page: o.page,
@@ -1448,13 +1448,13 @@ function In(e) {
1448
1448
  registry: r,
1449
1449
  collection: {
1450
1450
  expectedCount: e.expectedCount ?? e.items.length,
1451
- assets: e.items.map((o) => je(o, e.pageFor(o).id)),
1451
+ assets: e.items.map((o) => Be(o, e.pageFor(o).id)),
1452
1452
  pages: n
1453
1453
  }
1454
1454
  };
1455
1455
  }
1456
1456
  function tn(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)));
1457
+ const r = Object.entries((e == null ? void 0 : e.props) ?? {}).filter(([, c]) => c.length > 0).sort(([c, d], [p, h]) => h.length - d.length || c.localeCompare(p)), 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
1458
  return {
1459
1459
  row: n,
1460
1460
  column: o ? [o[0], a ?? []] : void 0,
@@ -1477,7 +1477,7 @@ function rn({
1477
1477
  }) {
1478
1478
  var c, d;
1479
1479
  if (!t)
1480
- return /* @__PURE__ */ A(
1480
+ return /* @__PURE__ */ O(
1481
1481
  "section",
1482
1482
  {
1483
1483
  "data-pygmalion-catalog-component": e.id,
@@ -1487,17 +1487,17 @@ function rn({
1487
1487
  display: "inline-block",
1488
1488
  width: "max-content",
1489
1489
  padding: 32,
1490
- color: le,
1491
- background: ce
1490
+ color: de,
1491
+ background: le
1492
1492
  },
1493
1493
  children: [
1494
- /* @__PURE__ */ w("strong", { children: e.name }),
1495
- /* @__PURE__ */ w("p", { style: { color: _ }, children: "The component is not registered." })
1494
+ /* @__PURE__ */ y("strong", { children: e.name }),
1495
+ /* @__PURE__ */ y("p", { style: { color: _ }, children: "The component is not registered." })
1496
1496
  ]
1497
1497
  }
1498
1498
  );
1499
1499
  const n = tn(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__ */ A(
1500
+ return /* @__PURE__ */ O(
1501
1501
  "section",
1502
1502
  {
1503
1503
  "data-pygmalion-catalog-component": e.id,
@@ -1507,16 +1507,16 @@ function rn({
1507
1507
  display: "inline-block",
1508
1508
  width: "max-content",
1509
1509
  padding: 32,
1510
- color: le,
1511
- background: ce,
1510
+ color: de,
1511
+ background: le,
1512
1512
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
1513
1513
  },
1514
1514
  children: [
1515
- /* @__PURE__ */ A("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
1515
+ /* @__PURE__ */ O("header", { style: { marginBottom: 24 }, children: [
1516
+ /* @__PURE__ */ y("h1", { style: { margin: 0, fontSize: 24 }, children: e.name }),
1517
+ e.sourcePath ? /* @__PURE__ */ y("p", { style: { margin: "6px 0 0", color: _, fontSize: 12 }, children: e.sourcePath }) : null
1518
1518
  ] }),
1519
- /* @__PURE__ */ w(
1519
+ /* @__PURE__ */ y(
1520
1520
  "div",
1521
1521
  {
1522
1522
  style: {
@@ -1525,59 +1525,59 @@ function rn({
1525
1525
  gap: 12
1526
1526
  },
1527
1527
  children: o.flatMap(
1528
- (h) => s.map((u) => {
1529
- const b = nn(t, n, h, u), x = [
1530
- n.row && h ? `${n.row[0]}=${h}` : "",
1531
- n.column && u ? `${n.column[0]}=${u}` : ""
1528
+ (p) => s.map((h) => {
1529
+ const b = nn(t, n, p, h), I = [
1530
+ n.row && p ? `${n.row[0]}=${p}` : "",
1531
+ n.column && h ? `${n.column[0]}=${h}` : ""
1532
1532
  ].filter(Boolean).join(" · ");
1533
- return /* @__PURE__ */ A(
1533
+ return /* @__PURE__ */ O(
1534
1534
  "article",
1535
1535
  {
1536
1536
  style: {
1537
1537
  width: "max-content",
1538
1538
  padding: 16,
1539
- border: `1px solid ${me}`,
1539
+ border: `1px solid ${ge}`,
1540
1540
  borderRadius: 10,
1541
- background: ae
1541
+ background: ce
1542
1542
  },
1543
1543
  children: [
1544
- x ? /* @__PURE__ */ w("div", { style: { marginBottom: 12, color: _, fontSize: 11 }, children: x }) : null,
1545
- /* @__PURE__ */ w("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: xe(
1544
+ I ? /* @__PURE__ */ y("div", { style: { marginBottom: 12, color: _, fontSize: 11 }, children: I }) : null,
1545
+ /* @__PURE__ */ y("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: xe(
1546
1546
  a,
1547
1547
  b,
1548
1548
  t.children === "text" ? t.defaultChildren ?? e.name : void 0
1549
1549
  ) })
1550
1550
  ]
1551
1551
  },
1552
- `${h ?? "default"}:${u ?? "default"}`
1552
+ `${p ?? "default"}:${h ?? "default"}`
1553
1553
  );
1554
1554
  })
1555
1555
  )
1556
1556
  }
1557
1557
  ),
1558
- n.additional.map(([h, u]) => /* @__PURE__ */ A("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__ */ A(
1558
+ n.additional.map(([p, h]) => /* @__PURE__ */ O("section", { style: { marginTop: 20 }, children: [
1559
+ /* @__PURE__ */ y("h2", { style: { margin: "0 0 10px", color: _, fontSize: 12 }, children: p }),
1560
+ /* @__PURE__ */ y("div", { style: { display: "flex", flexWrap: "wrap", gap: 12 }, children: h.map((b) => /* @__PURE__ */ O(
1561
1561
  "article",
1562
1562
  {
1563
1563
  style: {
1564
1564
  padding: 16,
1565
- border: `1px solid ${me}`,
1565
+ border: `1px solid ${ge}`,
1566
1566
  borderRadius: 10,
1567
- background: ae
1567
+ background: ce
1568
1568
  },
1569
1569
  children: [
1570
- /* @__PURE__ */ w("div", { style: { marginBottom: 12, color: _, fontSize: 11 }, children: b }),
1570
+ /* @__PURE__ */ y("div", { style: { marginBottom: 12, color: _, fontSize: 11 }, children: b }),
1571
1571
  xe(
1572
1572
  a,
1573
- { ...t.defaultProps, [h]: b },
1573
+ { ...t.defaultProps, [p]: b },
1574
1574
  t.children === "text" ? t.defaultChildren ?? e.name : void 0
1575
1575
  )
1576
1576
  ]
1577
1577
  },
1578
1578
  b
1579
1579
  )) })
1580
- ] }, h))
1580
+ ] }, p))
1581
1581
  ]
1582
1582
  }
1583
1583
  );
@@ -1586,11 +1586,11 @@ function xn(e) {
1586
1586
  Ue(e.items);
1587
1587
  const t = {}, r = [], n = [], o = e.maxVariantCells ?? 60;
1588
1588
  for (const s of e.items) {
1589
- const a = Be(
1589
+ const a = je(
1590
1590
  e.kind,
1591
1591
  s.id,
1592
1592
  e.registryPrefix
1593
- ), c = e.registry[s.name], d = () => /* @__PURE__ */ w(
1593
+ ), c = e.registry[s.name], d = () => /* @__PURE__ */ y(
1594
1594
  rn,
1595
1595
  {
1596
1596
  item: s,
@@ -1608,7 +1608,7 @@ function xn(e) {
1608
1608
  width: 1,
1609
1609
  height: 1,
1610
1610
  frameSizeMode: "content"
1611
- }), n.push(je(s, s.id));
1611
+ }), n.push(Be(s, s.id));
1612
1612
  }
1613
1613
  return {
1614
1614
  registry: t,
@@ -1620,20 +1620,20 @@ function xn(e) {
1620
1620
  };
1621
1621
  }
1622
1622
  const Ae = /^[a-f0-9]{64}$/, on = /^\/__pygmalion-qa\/artifacts\/[A-Za-z0-9_-]{8,120}\.png$/, sn = /^p\d+$/;
1623
- function ge(e) {
1623
+ function ye(e) {
1624
1624
  return typeof e == "string" && on.test(e) ? e : void 0;
1625
1625
  }
1626
1626
  function Oe(e, t) {
1627
1627
  const r = new URL(e, t);
1628
1628
  return r.search = "", r.hash = "", r.pathname.endsWith("/") || (r.pathname = `${r.pathname}/`), r.href;
1629
1629
  }
1630
- function fe(e) {
1630
+ function ue(e) {
1631
1631
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1632
1632
  const t = e;
1633
1633
  return typeof t.domStructureHash != "string" || !Ae.test(t.domStructureHash) || typeof t.screenshotHash != "string" || !Ae.test(t.screenshotHash) ? null : {
1634
1634
  domStructureHash: t.domStructureHash,
1635
1635
  screenshotHash: t.screenshotHash,
1636
- ...ge(t.screenshotUrl) ? { screenshotUrl: ge(t.screenshotUrl) } : {}
1636
+ ...ye(t.screenshotUrl) ? { screenshotUrl: ye(t.screenshotUrl) } : {}
1637
1637
  };
1638
1638
  }
1639
1639
  function $e(e) {
@@ -1646,7 +1646,7 @@ function an(e) {
1646
1646
  const t = e, r = $e(t.before), n = $e(t.after);
1647
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
1648
  return null;
1649
- const o = t.heatmapUrl == null ? null : ge(t.heatmapUrl) ?? null;
1649
+ const o = t.heatmapUrl == null ? null : ye(t.heatmapUrl) ?? null;
1650
1650
  return {
1651
1651
  before: r,
1652
1652
  after: n,
@@ -1662,9 +1662,9 @@ function cn(e, t) {
1662
1662
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1663
1663
  const r = e;
1664
1664
  if (typeof r.id != "string" || !r.id) return null;
1665
- const n = fe(r), o = fe(r.before) ?? n;
1665
+ const n = ue(r), o = ue(r.before) ?? n;
1666
1666
  if (!o) return null;
1667
- const s = fe(r.after);
1667
+ const s = ue(r.after);
1668
1668
  if (t === "changed" && !s) return null;
1669
1669
  const a = s ? an(r.pixelDiff) : null;
1670
1670
  return {
@@ -1706,302 +1706,319 @@ async function Me(e, t, r) {
1706
1706
  );
1707
1707
  if (typeof o.baselineId != "string" || !o.baselineId)
1708
1708
  throw new Error("Pygmalion visual QA response has no baselineId");
1709
- const s = Array.isArray(o.frames) ? o.frames.map((u) => cn(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;
1709
+ const s = Array.isArray(o.frames) ? o.frames.map((h) => cn(h, r.phase)).filter((h) => h != null) : [], a = Array.isArray(o.failures) ? o.failures.map((h) => {
1710
+ if (!h || typeof h != "object" || Array.isArray(h)) return null;
1711
+ const b = h;
1712
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));
1713
+ }).filter((h) => h != null) : [], c = new Set(r.frameIds), p = new Set(s.map((h) => h.id)).size === s.length && s.every((h) => c.has(h.id)) && a.every((h) => c.has(h.id));
1714
1714
  return {
1715
1715
  phase: r.phase,
1716
1716
  baselineId: o.baselineId,
1717
- complete: o.complete !== !1 && h && a.length === 0 && s.length === r.frameIds.length,
1717
+ complete: o.complete !== !1 && p && a.length === 0 && s.length === r.frameIds.length,
1718
1718
  frames: s,
1719
1719
  failures: a
1720
1720
  };
1721
1721
  }
1722
- const ue = {
1722
+ const he = {
1723
1723
  mirror: "/__pygmalion-dev-control",
1724
1724
  sessions: "/__pygmalion-design-session",
1725
1725
  inspect: "/__pygmalion-inspect"
1726
- }, dn = "pygmalion.designSessionId", fn = "/__pygmalion-qa", re = /* @__PURE__ */ new Map();
1726
+ }, dn = "pygmalion.designSessionId", fn = "/__pygmalion-qa", oe = /* @__PURE__ */ new Map();
1727
1727
  function Te() {
1728
1728
  var e;
1729
1729
  return typeof window < "u" && ((e = window.crypto) != null && e.randomUUID) ? window.crypto.randomUUID() : `pygmalion-${Date.now()}-${Math.random().toString(36).slice(2)}`;
1730
1730
  }
1731
1731
  function un(e, t) {
1732
1732
  if (e) return e;
1733
- const r = re.get(t);
1733
+ const r = oe.get(t);
1734
1734
  if (r) return r;
1735
1735
  try {
1736
1736
  const n = window.localStorage.getItem(t);
1737
1737
  if (n)
1738
- return re.set(t, n), n;
1738
+ return oe.set(t, n), n;
1739
1739
  const o = Te();
1740
- return window.localStorage.setItem(t, o), re.set(t, o), o;
1740
+ return window.localStorage.setItem(t, o), oe.set(t, o), o;
1741
1741
  } catch {
1742
1742
  const n = Te();
1743
- return re.set(t, n), n;
1743
+ return oe.set(t, n), n;
1744
1744
  }
1745
1745
  }
1746
- async function G(e) {
1746
+ async function J(e) {
1747
1747
  const t = await e.json();
1748
1748
  if (!e.ok) throw new Error(t.error ?? `Pygmalion request failed (${e.status})`);
1749
1749
  return t;
1750
1750
  }
1751
1751
  function Pn(e = {}) {
1752
- var I, B, k, W, ne;
1752
+ var j, T, Y, re, Z;
1753
1753
  const {
1754
1754
  sessionId: t,
1755
1755
  sessionStorageKey: r = dn,
1756
1756
  autoStart: n = !0,
1757
1757
  fetcher: o = fetch,
1758
1758
  formatApplyMessage: s
1759
- } = e, a = ((I = e.endpoints) == null ? void 0 : I.mirror) ?? ue.mirror, c = ((B = e.endpoints) == null ? void 0 : B.sessions) ?? ue.sessions, d = ((k = e.endpoints) == null ? void 0 : k.inspect) ?? ue.inspect, h = e.visualQa != null, u = ((W = e.visualQa) == null ? void 0 : W.endpoint) ?? fn, b = JSON.stringify(((ne = e.visualQa) == null ? void 0 : ne.eligibleFrameIds) ?? []), x = Pe(
1759
+ } = e, a = ((j = e.endpoints) == null ? void 0 : j.mirror) ?? he.mirror, c = ((T = e.endpoints) == null ? void 0 : T.sessions) ?? he.sessions, d = ((Y = e.endpoints) == null ? void 0 : Y.inspect) ?? he.inspect, p = e.visualQa != null, h = ((re = e.visualQa) == null ? void 0 : re.endpoint) ?? fn, b = JSON.stringify(((Z = e.visualQa) == null ? void 0 : Z.eligibleFrameIds) ?? []), I = Pe(
1760
1760
  () => JSON.parse(b),
1761
1761
  [b]
1762
- ), P = Pe(
1762
+ ), x = Pe(
1763
1763
  () => un(t, r),
1764
1764
  [t, r]
1765
- ), [m, E] = te({
1765
+ ), [m, P] = ne({
1766
1766
  state: "idle",
1767
1767
  commit: null,
1768
1768
  shortCommit: null,
1769
+ sourceRef: null,
1769
1770
  syncedAt: null,
1770
1771
  updated: !1,
1771
1772
  warning: null,
1772
1773
  error: null,
1773
1774
  appOrigin: null
1774
- }), [p, O] = te(null), [N, M] = te(null), $ = Ee(null), C = Ee(null), S = Z(
1775
- async (v = !0) => {
1776
- if ($.current) return $.current;
1777
- const g = (async () => {
1778
- E((i) => ({ ...i, state: "syncing", error: null }));
1775
+ }), [u, $] = ne(null), [R, M] = ne(null), C = Ee(null), A = Ee(null), w = X(
1776
+ async (S = !0, i) => {
1777
+ if (i != null && C.current && await C.current.catch(() => {
1778
+ }), C.current) return C.current;
1779
+ const l = (async () => {
1780
+ P((f) => ({ ...f, state: "syncing", error: null }));
1779
1781
  try {
1780
- let i = await o(`${a}/${v ? "refresh" : "status"}`, {
1781
- method: v ? "POST" : "GET"
1782
- }), l = await G(i);
1783
- const f = Date.now();
1784
- for (; !v && l.state === "syncing" && Date.now() - f < 12e4; )
1785
- await new Promise((D) => window.setTimeout(D, 500)), i = await o(`${a}/status`), l = await G(i);
1786
- if (l.state !== "ready" || !l.appOrigin || !l.commit)
1787
- throw new Error(l.error ?? "Pygmalion could not prepare the source preview");
1788
- const y = await G(
1782
+ const f = i != null;
1783
+ let g = await o(`${a}/${S || f ? "refresh" : "status"}`, {
1784
+ method: S || f ? "POST" : "GET",
1785
+ ...f ? {
1786
+ headers: { "content-type": "application/json" },
1787
+ body: JSON.stringify({ ref: i })
1788
+ } : {}
1789
+ }), N = await J(g);
1790
+ const D = Date.now();
1791
+ for (; !S && N.state === "syncing" && Date.now() - D < 12e4; )
1792
+ await new Promise((q) => window.setTimeout(q, 500)), g = await o(`${a}/status`), N = await J(g);
1793
+ if (N.state !== "ready" || !N.appOrigin || !N.commit)
1794
+ throw new Error(N.error ?? "Pygmalion could not prepare the source preview");
1795
+ const H = await J(
1789
1796
  await o(`${c}/open`, {
1790
1797
  method: "POST",
1791
1798
  headers: { "content-type": "application/json" },
1792
- body: JSON.stringify({ sessionId: P, baseDevSha: l.commit })
1799
+ body: JSON.stringify({ sessionId: x, baseDevSha: N.commit })
1793
1800
  })
1794
1801
  );
1795
- if (!y.ok || !y.session)
1796
- throw new Error(y.error ?? "Pygmalion could not open the design session");
1797
- let T = y.session;
1798
- if (T.branchName) {
1799
- const D = await G(
1802
+ if (!H.ok || !H.session)
1803
+ throw new Error(H.error ?? "Pygmalion could not open the design session");
1804
+ let z = H.session;
1805
+ if (z.branchName) {
1806
+ const q = await J(
1800
1807
  await o(`${c}/check`, {
1801
1808
  method: "POST",
1802
1809
  headers: { "content-type": "application/json" },
1803
- body: JSON.stringify({ sessionId: T.id })
1810
+ body: JSON.stringify({ sessionId: z.id })
1804
1811
  })
1805
1812
  );
1806
- if (!D.ok || !D.session)
1807
- throw new Error(D.error ?? "Pygmalion could not check the design session");
1808
- T = D.session;
1813
+ if (!q.ok || !q.session)
1814
+ throw new Error(q.error ?? "Pygmalion could not check the design session");
1815
+ z = q.session;
1809
1816
  }
1810
- E(l), O(T), M(T.appOrigin ?? l.appOrigin);
1811
- } catch (i) {
1812
- E((l) => ({
1813
- ...l,
1817
+ P(N), $(z), M(z.appOrigin ?? N.appOrigin);
1818
+ } catch (f) {
1819
+ P((g) => ({
1820
+ ...g,
1814
1821
  state: "error",
1815
- error: i instanceof Error ? i.message : String(i)
1822
+ error: f instanceof Error ? f.message : String(f)
1816
1823
  }));
1817
1824
  }
1818
1825
  })();
1819
- $.current = g;
1826
+ C.current = l;
1820
1827
  try {
1821
- await g;
1828
+ await l;
1822
1829
  } finally {
1823
- $.current === g && ($.current = null);
1830
+ C.current === l && (C.current = null);
1824
1831
  }
1825
1832
  },
1826
- [o, a, c, P]
1827
- ), R = Z(
1828
- async (v) => {
1829
- var y;
1830
- if (!p) throw new Error("Pygmalion design session is not ready");
1831
- const g = C.current;
1832
- if (g && (g.sessionId !== p.id || g.baseDevSha !== p.baseDevSha || g.revision !== p.revision || g.fingerprint !== JSON.stringify(v)))
1833
+ [o, a, c, x]
1834
+ ), E = X(
1835
+ async (S, i) => {
1836
+ if (u != null && u.branchName && !(i != null && i.discardEdits))
1837
+ throw new Error(
1838
+ "This design session has unapplied edits against the current source. Apply or revert them, or pass discardEdits to switch anyway."
1839
+ );
1840
+ await w(!0, S);
1841
+ },
1842
+ [w, u == null ? void 0 : u.branchName]
1843
+ ), F = X(
1844
+ async (S) => {
1845
+ var N;
1846
+ if (!u) throw new Error("Pygmalion design session is not ready");
1847
+ const i = A.current;
1848
+ if (i && (i.sessionId !== u.id || i.baseDevSha !== u.baseDevSha || i.revision !== u.revision || i.fingerprint !== JSON.stringify(S)))
1833
1849
  throw new Error("The code diff you checked is out of date. Please check the diff for the current changes again.");
1834
- const i = await G(
1850
+ const l = await J(
1835
1851
  await o(`${c}/apply-visual`, {
1836
1852
  method: "POST",
1837
1853
  headers: { "content-type": "application/json" },
1838
1854
  body: JSON.stringify({
1839
- sessionId: p.id,
1840
- baseDevSha: p.baseDevSha,
1841
- expectedRevision: p.revision,
1842
- ...g ? { previewRevision: g.revision } : {},
1843
- changes: v
1855
+ sessionId: u.id,
1856
+ baseDevSha: u.baseDevSha,
1857
+ expectedRevision: u.revision,
1858
+ ...i ? { previewRevision: i.revision } : {},
1859
+ changes: S
1844
1860
  })
1845
1861
  })
1846
1862
  );
1847
- if (!i.ok || !i.session)
1848
- throw new Error(i.error ?? "Pygmalion could not apply the visual changes");
1849
- O(i.session), i.session.appOrigin && M(i.session.appOrigin);
1850
- const l = i.applied ?? v.styles.length + v.texts.length + v.operations.length;
1851
- let f;
1852
- if (g != null && g.qaBaselineId && ((y = g.qaFrameIds) != null && y.length) && i.session.appOrigin)
1863
+ if (!l.ok || !l.session)
1864
+ throw new Error(l.error ?? "Pygmalion could not apply the visual changes");
1865
+ $(l.session), l.session.appOrigin && M(l.session.appOrigin);
1866
+ const f = l.applied ?? S.styles.length + S.texts.length + S.operations.length;
1867
+ let g;
1868
+ if (i != null && i.qaBaselineId && ((N = i.qaFrameIds) != null && N.length) && l.session.appOrigin)
1853
1869
  try {
1854
- f = await Me(o, u, {
1870
+ g = await Me(o, h, {
1855
1871
  phase: "changed",
1856
- baselineId: g.qaBaselineId,
1857
- basePath: Oe(i.session.appOrigin, window.location.origin),
1858
- frameIds: g.qaFrameIds
1872
+ baselineId: i.qaBaselineId,
1873
+ basePath: Oe(l.session.appOrigin, window.location.origin),
1874
+ frameIds: i.qaFrameIds
1859
1875
  });
1860
- } catch (T) {
1861
- const D = T instanceof Error ? T.message : String(T);
1862
- f = {
1876
+ } catch (D) {
1877
+ const H = D instanceof Error ? D.message : String(D);
1878
+ g = {
1863
1879
  phase: "changed",
1864
- baselineId: g.qaBaselineId,
1880
+ baselineId: i.qaBaselineId,
1865
1881
  complete: !1,
1866
1882
  frames: [],
1867
- failures: g.qaFrameIds.map((Q) => ({ id: Q, error: D }))
1883
+ failures: i.qaFrameIds.map((z) => ({ id: z, error: H }))
1868
1884
  };
1869
1885
  }
1870
- return C.current = null, {
1871
- applied: l,
1872
- branch: i.session.branchName ?? void 0,
1873
- integration: i.session.integration.state,
1874
- message: s == null ? void 0 : s(i.session, l),
1875
- ...f ? { qa: f } : {}
1886
+ return A.current = null, {
1887
+ applied: f,
1888
+ branch: l.session.branchName ?? void 0,
1889
+ integration: l.session.integration.state,
1890
+ message: s == null ? void 0 : s(l.session, f),
1891
+ ...g ? { qa: g } : {}
1876
1892
  };
1877
1893
  },
1878
- [o, s, u, p, c]
1879
- ), F = Z(
1880
- async (v) => {
1881
- var y;
1882
- if (!p) throw new Error("Pygmalion design session is not ready");
1883
- C.current = null;
1884
- const g = await G(
1894
+ [o, s, h, u, c]
1895
+ ), B = X(
1896
+ async (S) => {
1897
+ var N;
1898
+ if (!u) throw new Error("Pygmalion design session is not ready");
1899
+ A.current = null;
1900
+ const i = await J(
1885
1901
  await o(`${c}/preview-visual`, {
1886
1902
  method: "POST",
1887
1903
  headers: { "content-type": "application/json" },
1888
1904
  body: JSON.stringify({
1889
- sessionId: p.id,
1890
- baseDevSha: p.baseDevSha,
1891
- expectedRevision: p.revision,
1892
- changes: v
1905
+ sessionId: u.id,
1906
+ baseDevSha: u.baseDevSha,
1907
+ expectedRevision: u.revision,
1908
+ changes: S
1893
1909
  })
1894
1910
  })
1895
1911
  );
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 ? ln(v, x) : [];
1899
- let l;
1900
- const f = p.appOrigin ?? m.appOrigin;
1901
- if (i.length > 0) {
1902
- if (!f)
1912
+ if (!i.ok || !Number.isSafeInteger(i.revision))
1913
+ throw new Error(i.error ?? "Pygmalion could not preview the visual changes");
1914
+ const l = p ? ln(S, I) : [];
1915
+ let f;
1916
+ const g = u.appOrigin ?? m.appOrigin;
1917
+ if (l.length > 0) {
1918
+ if (!g)
1903
1919
  throw new Error("Impact screen QA baseline preview not ready");
1904
- if (l = await Me(o, u, {
1920
+ if (f = await Me(o, h, {
1905
1921
  phase: "baseline",
1906
- basePath: Oe(f, window.location.origin),
1907
- frameIds: i
1908
- }), !l.complete)
1922
+ basePath: Oe(g, window.location.origin),
1923
+ frameIds: l
1924
+ }), !f.complete)
1909
1925
  throw new Error(
1910
- ((y = l.failures[0]) == null ? void 0 : y.error) ?? `Failed to capture ${i.length - l.frames.length} affected frames`
1926
+ ((N = f.failures[0]) == null ? void 0 : N.error) ?? `Failed to capture ${l.length - f.frames.length} affected frames`
1911
1927
  );
1912
1928
  }
1913
- return C.current = {
1914
- sessionId: p.id,
1915
- baseDevSha: p.baseDevSha,
1916
- revision: g.revision,
1917
- fingerprint: JSON.stringify(v),
1918
- ...l ? { qaBaselineId: l.baselineId, qaFrameIds: i } : {}
1929
+ return A.current = {
1930
+ sessionId: u.id,
1931
+ baseDevSha: u.baseDevSha,
1932
+ revision: i.revision,
1933
+ fingerprint: JSON.stringify(S),
1934
+ ...f ? { qaBaselineId: f.baselineId, qaFrameIds: l } : {}
1919
1935
  }, {
1920
- revision: g.revision,
1921
- files: Array.isArray(g.files) ? g.files : [],
1922
- affectedFiles: Array.isArray(g.affectedFiles) ? g.affectedFiles : [],
1923
- ...l ? { qa: l } : {}
1936
+ revision: i.revision,
1937
+ files: Array.isArray(i.files) ? i.files : [],
1938
+ affectedFiles: Array.isArray(i.affectedFiles) ? i.affectedFiles : [],
1939
+ ...f ? { qa: f } : {}
1924
1940
  };
1925
1941
  },
1926
1942
  [
1927
1943
  o,
1928
1944
  m.appOrigin,
1929
- x,
1945
+ I,
1946
+ h,
1930
1947
  u,
1931
- p,
1932
1948
  c,
1933
- h
1949
+ p
1934
1950
  ]
1935
- ), j = Z(
1936
- async (v) => {
1937
- if (v.length === 0) return { files: [] };
1938
- const g = await G(
1951
+ ), Q = X(
1952
+ async (S) => {
1953
+ if (S.length === 0) return { files: [] };
1954
+ const i = await J(
1939
1955
  await o(`${d}/impact`, {
1940
1956
  method: "POST",
1941
1957
  headers: { "content-type": "application/json" },
1942
- body: JSON.stringify({ componentFiles: v })
1958
+ body: JSON.stringify({ componentFiles: S })
1943
1959
  })
1944
1960
  );
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 : [] };
1961
+ if (i.error || i.ok === !1)
1962
+ throw new Error(i.error ?? "Pygmalion could not calculate source impact");
1963
+ return { files: Array.isArray(i.files) ? i.files : [] };
1948
1964
  },
1949
1965
  [o, d]
1950
- ), J = Z(async () => {
1951
- if (!(p != null && p.canRevert) || !p.headSha)
1966
+ ), G = X(async () => {
1967
+ if (!(u != null && u.canRevert) || !u.headSha)
1952
1968
  throw new Error("There are no reversible changes applied");
1953
- const v = await G(
1969
+ const S = await J(
1954
1970
  await o(`${c}/revert-visual`, {
1955
1971
  method: "POST",
1956
1972
  headers: { "content-type": "application/json" },
1957
1973
  body: JSON.stringify({
1958
- sessionId: p.id,
1959
- baseDevSha: p.baseDevSha,
1960
- expectedRevision: p.revision,
1961
- expectedHeadSha: p.headSha
1974
+ sessionId: u.id,
1975
+ baseDevSha: u.baseDevSha,
1976
+ expectedRevision: u.revision,
1977
+ expectedHeadSha: u.headSha
1962
1978
  })
1963
1979
  })
1964
1980
  );
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 C.current = null, O(v.session), v.session.appOrigin && M(v.session.appOrigin), {
1981
+ if (!S.ok || S.reverted !== !0 || !S.operation || S.operation.kind !== "visual-revert" || !S.session)
1982
+ throw new Error(S.error ?? "Pygmalion could not revert the last visual change");
1983
+ return A.current = null, $(S.session), S.session.appOrigin && M(S.session.appOrigin), {
1968
1984
  reverted: !0,
1969
- operation: v.operation,
1970
- session: v.session
1985
+ operation: S.operation,
1986
+ session: S.session
1971
1987
  };
1972
- }, [o, p, c]);
1973
- ee(() => {
1974
- n && S(!1);
1975
- }, [n, S]);
1976
- const K = (p == null ? void 0 : p.appOrigin) ?? m.appOrigin ?? N, q = (p == null ? void 0 : p.headSha) ?? (p == null ? void 0 : p.baseDevSha) ?? m.commit ?? "pending";
1988
+ }, [o, u, c]);
1989
+ te(() => {
1990
+ n && w(!1);
1991
+ }, [n, w]);
1992
+ const L = (u == null ? void 0 : u.appOrigin) ?? m.appOrigin ?? R, v = (u == null ? void 0 : u.headSha) ?? (u == null ? void 0 : u.baseDevSha) ?? m.commit ?? "pending";
1977
1993
  return {
1978
1994
  mirror: m,
1979
- session: p,
1980
- ready: N != null,
1981
- appOrigin: K,
1982
- previewRevision: `${q}:${(p == null ? void 0 : p.revision) ?? 0}`,
1983
- previewSourceRevision: q,
1984
- refresh: S,
1985
- previewVisual: F,
1986
- inspectImpact: j,
1987
- applyVisual: R,
1988
- revertLastVisual: J
1995
+ session: u,
1996
+ ready: R != null,
1997
+ appOrigin: L,
1998
+ previewRevision: `${v}:${(u == null ? void 0 : u.revision) ?? 0}`,
1999
+ previewSourceRevision: v,
2000
+ refresh: w,
2001
+ switchSource: E,
2002
+ previewVisual: B,
2003
+ inspectImpact: Q,
2004
+ applyVisual: F,
2005
+ revertLastVisual: G
1989
2006
  };
1990
2007
  }
1991
2008
  const En = {
1992
- editor: H,
1993
- getObserverTree: Le,
2009
+ editor: K,
2010
+ getObserverTree: Je,
1994
2011
  isObservableProp: Ge
1995
2012
  };
1996
- function Rn(e) {
1997
- H.navigateToPageByName(e);
2013
+ function Nn(e) {
2014
+ K.navigateToPageByName(e);
1998
2015
  }
1999
- function Nn() {
2000
- H.openPreview();
2016
+ function Rn() {
2017
+ K.openPreview();
2001
2018
  }
2002
2019
  function Cn() {
2003
2020
  const e = ve.entries.length > 0;
2004
- return e && ve.discardPending(), H.resetCurrentEdits() || e;
2021
+ return e && ve.discardPending(), K.resetCurrentEdits() || e;
2005
2022
  }
2006
2023
  function An({
2007
2024
  registry: e,
@@ -2013,104 +2030,104 @@ function An({
2013
2030
  previewRevision: a,
2014
2031
  previewCacheNamespace: c,
2015
2032
  previewArtifacts: d,
2016
- previewArtifactEndpoint: h,
2017
- previewConcurrency: u,
2033
+ previewArtifactEndpoint: p,
2034
+ previewConcurrency: h,
2018
2035
  previewOpen: b,
2019
- onPreviewOpenChange: x,
2020
- flowCanvas: P,
2036
+ onPreviewOpenChange: I,
2037
+ flowCanvas: x,
2021
2038
  onApply: m,
2022
- onDesignChange: E,
2023
- onInspectApply: p,
2024
- onInspectPreview: O,
2025
- onInspectImpact: N,
2039
+ onDesignChange: P,
2040
+ onInspectApply: u,
2041
+ onInspectPreview: $,
2042
+ onInspectImpact: R,
2026
2043
  storyboardDiscovery: M = !0,
2027
- storyboardDiscoveryEndpoint: $ = it
2044
+ storyboardDiscoveryEndpoint: C = it
2028
2045
  }) {
2029
- const [C, S] = te(!M), [R, F] = te();
2030
- n && (n.assertComplete(), Ve(n));
2031
- const j = e ?? (n == null ? void 0 : n.getRegistry()), J = t ?? (n == null ? void 0 : n.getTokens()), K = r ?? (n == null ? void 0 : n.getInitialPages());
2032
- j && Je(j), J && We(J), ct(o ?? null), s != null && Qe(s), a != null && Xe(a), Ye(c);
2033
- const q = R ?? d;
2034
- return q && K && C && Ze(q, {
2046
+ const [A, w] = ne(!M), [E, F] = ne();
2047
+ n && (n.assertComplete(), Le(n));
2048
+ const B = e ?? (n == null ? void 0 : n.getRegistry()), Q = t ?? (n == null ? void 0 : n.getTokens()), G = r ?? (n == null ? void 0 : n.getInitialPages());
2049
+ B && Ve(B), Q && We(Q), ct(o ?? null), s != null && Qe(s), a != null && Xe(a), Ye(c);
2050
+ const L = E ?? d;
2051
+ return L && G && A && Ze(L, {
2035
2052
  namespace: c ?? "",
2036
2053
  previewRevision: dt(),
2037
2054
  appOrigin: lt(),
2038
2055
  baselineEnvironment: et(),
2039
- allowStaleIdentity: R == null && !!h,
2040
- pages: K.flatMap(
2041
- (I) => I.route && I.importPageId ? [
2056
+ allowStaleIdentity: E == null && !!p,
2057
+ pages: G.flatMap(
2058
+ (v) => v.route && v.importPageId ? [
2042
2059
  {
2043
- canonicalId: I.importPageId,
2044
- route: I.route,
2045
- width: I.width,
2046
- height: I.height,
2047
- environment: I.environment,
2048
- preset: I.preset,
2049
- interactions: I.interactions,
2050
- assertions: I.assertions
2060
+ canonicalId: v.importPageId,
2061
+ route: v.route,
2062
+ width: v.width,
2063
+ height: v.height,
2064
+ environment: v.environment,
2065
+ preset: v.preset,
2066
+ interactions: v.interactions,
2067
+ assertions: v.assertions
2051
2068
  }
2052
2069
  ] : []
2053
2070
  )
2054
- }), u != null && tt(u), ft(x ?? null), P != null && nt(P), ut(m ?? null), pt(p ?? null), rt(O ?? null), ht(N ?? null), K && H.initPagesFromComponents(K), ee(() => {
2055
- Ie(E ?? null);
2056
- const I = ot(H);
2071
+ }), h != null && tt(h), ft(I ?? null), x != null && nt(x), ut(m ?? null), ht(u ?? null), rt($ ?? null), pt(R ?? null), G && K.initPagesFromComponents(G), te(() => {
2072
+ Ie(P ?? null);
2073
+ const v = ot(K);
2057
2074
  return () => {
2058
- I(), Ie(null);
2075
+ v(), Ie(null);
2059
2076
  };
2060
- }, [E]), ee(() => {
2061
- if (F(void 0), !C || !h || !(c != null && c.trim()) || !(a != null && a.trim()))
2077
+ }, [P]), te(() => {
2078
+ if (F(void 0), !A || !p || !(c != null && c.trim()) || !(a != null && a.trim()))
2062
2079
  return;
2063
- const I = new AbortController();
2080
+ const v = new AbortController();
2064
2081
  return Wt({
2065
2082
  namespace: c,
2066
2083
  sourceRevision: st(a),
2067
2084
  transport: qt({
2068
- endpoint: h,
2085
+ endpoint: p,
2069
2086
  captureBaseUrl: s
2070
2087
  }),
2071
- signal: I.signal
2072
- }).then((B) => {
2073
- !I.signal.aborted && B.status === "accepted" && F(B.artifact);
2074
- }), () => I.abort();
2088
+ signal: v.signal
2089
+ }).then((j) => {
2090
+ !v.signal.aborted && j.status === "accepted" && F(j.artifact);
2091
+ }), () => v.abort();
2075
2092
  }, [
2076
- h,
2093
+ p,
2077
2094
  c,
2078
2095
  a,
2079
2096
  s,
2080
- C
2081
- ]), ee(() => {
2082
- let I = !0;
2097
+ A
2098
+ ]), te(() => {
2099
+ let v = !0;
2083
2100
  if (!M)
2084
- return Y(void 0), S(!0), () => {
2085
- I = !1;
2101
+ return ee(void 0), w(!0), () => {
2102
+ v = !1;
2086
2103
  };
2087
- const B = new AbortController();
2088
- return S(!1), Y(void 0), L(null), _e({
2089
- endpoint: $,
2090
- signal: B.signal,
2091
- pages: H.pages.map((k) => ({
2092
- ...k,
2093
- id: k.importPageId ?? k.id,
2094
- importKind: k.importKind
2104
+ const j = new AbortController();
2105
+ return w(!1), ee(void 0), V(null), _e({
2106
+ endpoint: C,
2107
+ signal: j.signal,
2108
+ pages: K.pages.map((T) => ({
2109
+ ...T,
2110
+ id: T.importPageId ?? T.id,
2111
+ importKind: T.importKind
2095
2112
  })),
2096
2113
  assets: (n == null ? void 0 : n.getAssets("screens")) ?? []
2097
- }).then((k) => {
2098
- I && (Y(k.baselineEnvironment), L(k.graph));
2114
+ }).then((T) => {
2115
+ v && (ee(T.baselineEnvironment), V(T.graph));
2099
2116
  }).catch(() => {
2100
- I && (Y(void 0), L(null));
2117
+ v && (ee(void 0), V(null));
2101
2118
  }).finally(() => {
2102
- I && S(!0);
2119
+ v && w(!0);
2103
2120
  }), () => {
2104
- I = !1, B.abort(), Y(void 0), L(null);
2121
+ v = !1, j.abort(), ee(void 0), V(null);
2105
2122
  };
2106
2123
  }, [
2107
2124
  n,
2108
2125
  r,
2109
2126
  M,
2110
- $
2111
- ]), ee(() => {
2112
- b == null || b === H.previewOpen || (b ? H.openPreview({ notifyHost: !1 }) : H.closePreview({ notifyHost: !1 }));
2113
- }, [b]), C ? /* @__PURE__ */ w(at, {}) : /* @__PURE__ */ w(
2127
+ C
2128
+ ]), te(() => {
2129
+ b == null || b === K.previewOpen || (b ? K.openPreview({ notifyHost: !1 }) : K.closePreview({ notifyHost: !1 }));
2130
+ }, [b]), A ? /* @__PURE__ */ y(at, {}) : /* @__PURE__ */ y(
2114
2131
  "div",
2115
2132
  {
2116
2133
  "data-pygmalion-storyboard-loading": "",
@@ -2152,10 +2169,10 @@ export {
2152
2169
  wt as createStoryboardGraph,
2153
2170
  Tt as createStoryboardGraphFromDiscovery,
2154
2171
  Fn as createStoryboardGraphViewModel,
2155
- Bn as createStoryboardRouteUrl,
2172
+ jn as createStoryboardRouteUrl,
2156
2173
  Yt as designCatalogKey,
2157
- Be as designCatalogRegistryName,
2158
- jn as expandDesignScreenCasesViewports,
2174
+ je as designCatalogRegistryName,
2175
+ Bn as expandDesignScreenCasesViewports,
2159
2176
  Un as expandDesignScreenCollectionViewports,
2160
2177
  Hn as getRecommendedPygmalionPreviewConcurrency,
2161
2178
  et as getStoryboardBaselineEnvironment,
@@ -2165,23 +2182,23 @@ export {
2165
2182
  qn as mergeScreenPresets,
2166
2183
  He as mergeStoryboardEnvironment,
2167
2184
  gn as publishStoryboardDiscovery,
2168
- Rn as pygmalionNavigate,
2169
- Nn as pygmalionOpenPreview,
2185
+ Nn as pygmalionNavigate,
2186
+ Rn as pygmalionOpenPreview,
2170
2187
  Cn as pygmalionResetCurrentEdits,
2171
2188
  Gn as reconstructRoutePreviewArtifactScreenshotV3,
2172
- Ln as reconstructRoutePreviewArtifactSnapshotV3,
2173
- Vn as resetTokenOverrides,
2189
+ Jn as reconstructRoutePreviewArtifactSnapshotV3,
2190
+ Ln as resetTokenOverrides,
2174
2191
  Pt as resolveStoryboardScreenCases,
2175
- Je as setComponentRegistry,
2192
+ Ve as setComponentRegistry,
2176
2193
  Qe as setPygmalionAppOrigin,
2177
2194
  tt as setPygmalionPreviewConcurrency,
2178
2195
  Xe as setPygmalionPreviewRevision,
2179
- Y as setStoryboardBaselineEnvironment,
2180
- L as setStoryboardGraph,
2196
+ ee as setStoryboardBaselineEnvironment,
2197
+ V as setStoryboardGraph,
2181
2198
  We as setTokens,
2182
2199
  mt as storyboardScreenRecipeKey,
2183
- Jn as subscribeStoryboardGraph,
2200
+ Vn as subscribeStoryboardGraph,
2184
2201
  Pn as usePygmalionProject,
2185
- Jt as validatePreviewArtifactBundle,
2202
+ Vt as validatePreviewArtifactBundle,
2186
2203
  Ke as validateRoutePreviewArtifactV3Browser
2187
2204
  };