@pygmalionjs/pygmalion 0.2.17 → 0.2.18

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,5 +1,5 @@
1
- import { jsxs as R, jsx as w } from "react/jsx-runtime";
2
- import { b as Q, m as Ke, v as qe, c as Ge, i as Je, g as Le, e as K, d as Ve, a as We, f as Qe, h as Xe, j as Ye, k as Ze, l as et, n as tt, o as nt, p as rt, q as ot, r as st, t as it, u as se, S as at, A as ct, w as xe, x as lt, y as dt, z as ft, B as ut, C as pt, D as ht, E as mt, G as Pe } from "./App-CiSnd2mV.js";
1
+ import { jsxs as R, jsx as b } from "react/jsx-runtime";
2
+ import { b as Q, m as Ke, v as qe, c as Ge, i as Je, g as Le, e as K, d as Ve, a as We, f as Qe, h as Xe, j as Ye, k as Ze, l as et, n as tt, o as nt, p as rt, q as ot, r as it, t as st, u as ie, S as at, A as ct, w as xe, x as lt, y as dt, z as ft, B as ut, C as pt, D as ht, E as mt, G as Pe } from "./App-CiSnd2mV.js";
3
3
  import { H as kn, I as Dn, J as zn, K as _n, L as Fn, M as jn, O as Bn, P as Un, Q as Hn, R as Kn, T as qn, U as Gn, V as Jn, W as Ln, X as Vn, Y as Wn, Z as Qn } from "./App-CiSnd2mV.js";
4
4
  import { createElement as Ee, useMemo as le, useState as ee, useRef as Ne, useCallback as W, useEffect as te } from "react";
5
5
  function we(e, t = /* @__PURE__ */ new Set()) {
@@ -79,93 +79,93 @@ function bt(e) {
79
79
  var re, oe;
80
80
  const t = [], r = [], n = /* @__PURE__ */ new Map();
81
81
  for (const c of e.screens) {
82
- const f = c.id.trim();
83
- if (!f || n.has(f)) {
82
+ const d = c.id.trim();
83
+ if (!d || n.has(d)) {
84
84
  t.push({
85
85
  code: "duplicate-screen-id",
86
86
  severity: "error",
87
- message: f ? `Multiple storyboard screens use the id "${f}".` : "A storyboard screen has an empty id.",
88
- screenId: f || void 0
87
+ message: d ? `Multiple storyboard screens use the id "${d}".` : "A storyboard screen has an empty id.",
88
+ screenId: d || void 0
89
89
  });
90
90
  continue;
91
91
  }
92
- const l = f === c.id ? c : { ...c, id: f };
93
- n.set(f, l), r.push(l);
92
+ const l = d === c.id ? c : { ...c, id: d };
93
+ n.set(d, l), r.push(l);
94
94
  }
95
- const o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
95
+ const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
96
96
  for (const c of r) {
97
- let f;
97
+ let d;
98
98
  try {
99
- if (f = (e.recipeKey ?? gt)(c), !f.trim()) throw new Error("Recipe keys cannot be empty.");
99
+ if (d = (e.recipeKey ?? gt)(c), !d.trim()) throw new Error("Recipe keys cannot be empty.");
100
100
  } catch (u) {
101
- s.add(c.id), t.push({
101
+ i.add(c.id), t.push({
102
102
  code: "invalid-recipe",
103
103
  severity: "error",
104
104
  message: u instanceof Error ? u.message : "Storyboard recipe identity could not be created.",
105
105
  screenId: c.id
106
- }), f = `invalid:${c.id}`;
106
+ }), d = `invalid:${c.id}`;
107
107
  }
108
- const l = o.get(f);
109
- l ? l.screens.push(c) : o.set(f, { recipeKey: f, screens: [c] });
108
+ const l = o.get(d);
109
+ l ? l.screens.push(c) : o.set(d, { recipeKey: d, screens: [c] });
110
110
  }
111
- const i = [...o.values()].map(wt).sort((c, f) => c.id.localeCompare(f.id)), a = {};
112
- for (const c of i)
113
- for (const f of c.screenIds) a[f] = c.id;
114
- const d = new Map(i.map((c) => [c.id, c])), g = /* @__PURE__ */ new Map();
111
+ const s = [...o.values()].map(wt).sort((c, d) => c.id.localeCompare(d.id)), a = {};
112
+ for (const c of s)
113
+ for (const d of c.screenIds) a[d] = c.id;
114
+ const f = new Map(s.map((c) => [c.id, c])), m = /* @__PURE__ */ new Map();
115
115
  for (const c of e.assets ?? []) {
116
- const f = g.get(c.pageId);
117
- f ? f.push(c) : g.set(c.pageId, [c]);
116
+ const d = m.get(c.pageId);
117
+ d ? d.push(c) : m.set(c.pageId, [c]);
118
118
  }
119
- const p = i.map((c) => {
120
- const f = c.screenIds.flatMap(
121
- (l) => g.get(l) ?? []
119
+ const p = s.map((c) => {
120
+ const d = c.screenIds.flatMap(
121
+ (l) => m.get(l) ?? []
122
122
  );
123
123
  return {
124
124
  ...c,
125
125
  scenarioIds: z([
126
126
  ...c.scenarioIds,
127
- ...f.map((l) => l.scenarioId)
127
+ ...d.map((l) => l.scenarioId)
128
128
  ]),
129
129
  sourceKeys: z([
130
130
  ...c.sourceKeys,
131
- ...f.map((l) => l.sourcePath)
131
+ ...d.map((l) => l.sourcePath)
132
132
  ])
133
133
  };
134
- }), m = /* @__PURE__ */ new Map();
134
+ }), y = /* @__PURE__ */ new Map();
135
135
  for (const c of p)
136
- for (const f of c.routes) {
137
- const l = m.get(f);
138
- l ? l.push(c.id) : m.set(f, [c.id]);
136
+ for (const d of c.routes) {
137
+ const l = y.get(d);
138
+ l ? l.push(c.id) : y.set(d, [c.id]);
139
139
  }
140
- const S = (c, f, l) => {
141
- const u = c.trim(), I = a[u] ?? (d.has(u) ? u : null);
142
- if (I) return I;
143
- const v = z(m.get(u) ?? []);
144
- return v.length === 1 ? v[0] : v.length > 1 ? (t.push({
140
+ const g = (c, d, l) => {
141
+ const u = c.trim(), x = a[u] ?? (f.has(u) ? u : null);
142
+ if (x) return x;
143
+ const I = z(y.get(u) ?? []);
144
+ return I.length === 1 ? I[0] : I.length > 1 ? (t.push({
145
145
  code: l === "source" ? "ambiguous-edge-source" : "ambiguous-edge-target",
146
146
  severity: "error",
147
- message: `Storyboard edge "${f}" references an ambiguous ${l} route.`,
148
- edgeId: f,
147
+ message: `Storyboard edge "${d}" references an ambiguous ${l} route.`,
148
+ edgeId: d,
149
149
  screenId: u || void 0
150
150
  }), null) : (t.push({
151
151
  code: l === "source" ? "unknown-edge-source" : "unknown-edge-target",
152
152
  severity: "error",
153
- message: `Storyboard edge "${f}" references an unknown ${l}.`,
154
- edgeId: f,
153
+ message: `Storyboard edge "${d}" references an unknown ${l}.`,
154
+ edgeId: d,
155
155
  screenId: u || void 0
156
156
  }), null);
157
- }, P = [], y = /* @__PURE__ */ new Map(), N = [
157
+ }, v = [], w = /* @__PURE__ */ new Map(), N = [
158
158
  ["explicit", e.explicitEdges ?? []],
159
159
  ["inferred", e.inferredEdges ?? []]
160
160
  ];
161
161
  let h = 0;
162
- for (const [c, f] of N)
163
- for (const l of f) {
162
+ for (const [c, d] of N)
163
+ for (const l of d) {
164
164
  const u = yt(l, h);
165
165
  h += 1;
166
- const I = S(l.from, u, "source"), v = S(l.to, u, "target");
167
- if (!I || !v || I === v) continue;
168
- const M = `${I}\0${v}`, C = y.get(M);
166
+ const x = g(l.from, u, "source"), I = g(l.to, u, "target");
167
+ if (!x || !I || x === I) continue;
168
+ const M = `${x}\0${I}`, C = w.get(M);
169
169
  if (C) {
170
170
  if (!C.sourceEdgeIds.includes(u)) {
171
171
  const q = {
@@ -175,42 +175,42 @@ function bt(e) {
175
175
  u
176
176
  ])
177
177
  };
178
- y.set(M, q);
179
- const H = P.indexOf(C);
180
- H >= 0 && (P[H] = q);
178
+ w.set(M, q);
179
+ const H = v.indexOf(C);
180
+ H >= 0 && (v[H] = q);
181
181
  }
182
182
  continue;
183
183
  }
184
184
  const L = {
185
185
  id: u,
186
- from: I,
187
- to: v,
186
+ from: x,
187
+ to: I,
188
188
  kind: ((re = l.kind) == null ? void 0 : re.trim()) || void 0,
189
189
  label: ((oe = l.label) == null ? void 0 : oe.trim()) || void 0,
190
190
  origin: c,
191
191
  sourceEdgeIds: [u]
192
192
  };
193
- y.set(M, L), P.push(L);
193
+ w.set(M, L), v.push(L);
194
194
  }
195
- P.sort(
196
- (c, f) => `${c.from}:${c.to}:${c.id}`.localeCompare(`${f.from}:${f.to}:${f.id}`)
195
+ v.sort(
196
+ (c, d) => `${c.from}:${c.to}:${c.id}`.localeCompare(`${d.from}:${d.to}:${d.id}`)
197
197
  );
198
198
  const O = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
199
- for (const c of P) {
200
- const f = A.get(c.from);
201
- f ? f.push(c) : A.set(c.from, [c]);
199
+ for (const c of v) {
200
+ const d = A.get(c.from);
201
+ d ? d.push(c) : A.set(c.from, [c]);
202
202
  const l = O.get(c.to);
203
203
  l ? l.push(c) : O.set(c.to, [c]);
204
204
  }
205
205
  const $ = [];
206
206
  for (const c of e.startScreenIds ?? []) {
207
- const f = c.trim(), l = a[f] ?? (d.has(f) ? f : null);
207
+ const d = c.trim(), l = a[d] ?? (f.has(d) ? d : null);
208
208
  if (!l) {
209
209
  t.push({
210
210
  code: "unknown-start-screen",
211
211
  severity: "error",
212
- message: `Storyboard start references an unknown screen "${f}".`,
213
- screenId: f || void 0
212
+ message: `Storyboard start references an unknown screen "${d}".`,
213
+ screenId: d || void 0
214
214
  });
215
215
  continue;
216
216
  }
@@ -219,57 +219,57 @@ function bt(e) {
219
219
  const T = new Set($);
220
220
  let k = z($);
221
221
  k.length || (k = p.filter((c) => {
222
- var f;
223
- return (((f = O.get(c.id)) == null ? void 0 : f.length) ?? 0) === 0;
224
- }).map((c) => c.id).sort((c, f) => c.localeCompare(f))), !k.length && p.length && (k = [p[0].id]);
225
- const b = /* @__PURE__ */ new Set(), x = [...k];
226
- for (; x.length; ) {
227
- const c = x.shift();
228
- if (!b.has(c)) {
229
- b.add(c);
230
- for (const f of A.get(c) ?? []) x.push(f.to);
222
+ var d;
223
+ return (((d = O.get(c.id)) == null ? void 0 : d.length) ?? 0) === 0;
224
+ }).map((c) => c.id).sort((c, d) => c.localeCompare(d))), !k.length && p.length && (k = [p[0].id]);
225
+ const S = /* @__PURE__ */ new Set(), P = [...k];
226
+ for (; P.length; ) {
227
+ const c = P.shift();
228
+ if (!S.has(c)) {
229
+ S.add(c);
230
+ for (const d of A.get(c) ?? []) P.push(d.to);
231
231
  }
232
232
  }
233
233
  const D = p.filter((c) => {
234
234
  var l, u;
235
- const f = (((l = O.get(c.id)) == null ? void 0 : l.length) ?? 0) === 0 && (((u = A.get(c.id)) == null ? void 0 : u.length) ?? 0) === 0 && !T.has(c.id);
236
- return !b.has(c.id) || f && p.length > 1;
235
+ const d = (((l = O.get(c.id)) == null ? void 0 : l.length) ?? 0) === 0 && (((u = A.get(c.id)) == null ? void 0 : u.length) ?? 0) === 0 && !T.has(c.id);
236
+ return !S.has(c.id) || d && p.length > 1;
237
237
  });
238
238
  for (const c of D)
239
- for (const f of c.screenIds)
239
+ for (const d of c.screenIds)
240
240
  t.push({
241
241
  code: "disconnected-screen",
242
242
  severity: "warning",
243
- message: `Storyboard screen "${f}" is not connected to a graph branch.`,
244
- screenId: f,
243
+ message: `Storyboard screen "${d}" is not connected to a graph branch.`,
244
+ screenId: d,
245
245
  nodeId: c.id
246
246
  });
247
247
  const j = /* @__PURE__ */ new Map();
248
248
  for (const c of p)
249
- for (const f of c.sourceKeys) {
250
- const l = j.get(f) ?? {
249
+ for (const d of c.sourceKeys) {
250
+ const l = j.get(d) ?? {
251
251
  nodeIds: /* @__PURE__ */ new Set(),
252
252
  screenIds: /* @__PURE__ */ new Set()
253
253
  };
254
254
  l.nodeIds.add(c.id);
255
255
  for (const u of c.screenIds) l.screenIds.add(u);
256
- j.set(f, l);
256
+ j.set(d, l);
257
257
  }
258
- const Y = [...j.entries()].map(([c, f]) => ({
258
+ const Y = [...j.entries()].map(([c, d]) => ({
259
259
  sourceKey: c,
260
- nodeIds: [...f.nodeIds].sort((l, u) => l.localeCompare(u)),
261
- screenIds: [...f.screenIds].sort((l, u) => l.localeCompare(u)),
262
- shared: f.nodeIds.size > 1
263
- })).sort((c, f) => c.sourceKey.localeCompare(f.sourceKey)), J = p.map((c) => {
264
- const f = [...A.get(c.id) ?? []].sort(
260
+ nodeIds: [...d.nodeIds].sort((l, u) => l.localeCompare(u)),
261
+ screenIds: [...d.screenIds].sort((l, u) => l.localeCompare(u)),
262
+ shared: d.nodeIds.size > 1
263
+ })).sort((c, d) => c.sourceKey.localeCompare(d.sourceKey)), J = p.map((c) => {
264
+ const d = [...A.get(c.id) ?? []].sort(
265
265
  (l, u) => l.id.localeCompare(u.id)
266
266
  );
267
267
  return {
268
268
  nodeId: c.id,
269
- edgeIds: f.map((l) => l.id),
270
- targetNodeIds: z(f.map((l) => l.to))
269
+ edgeIds: d.map((l) => l.id),
270
+ targetNodeIds: z(d.map((l) => l.to))
271
271
  };
272
- }).filter((c) => c.targetNodeIds.length > 1).sort((c, f) => c.nodeId.localeCompare(f.nodeId)), V = new Set(
272
+ }).filter((c) => c.targetNodeIds.length > 1).sort((c, d) => c.nodeId.localeCompare(d.nodeId)), V = new Set(
273
273
  p.flatMap((c) => c.scenarioIds)
274
274
  ), E = new Set(
275
275
  (e.nonVisualScenarioIds ?? []).map((c) => c.trim())
@@ -286,15 +286,15 @@ function bt(e) {
286
286
  scenarioId: c
287
287
  });
288
288
  t.sort(
289
- (c, f) => Re(c).localeCompare(Re(f))
289
+ (c, d) => Re(c).localeCompare(Re(d))
290
290
  );
291
291
  const ne = z(
292
292
  D.flatMap((c) => c.screenIds)
293
- ), ie = {
293
+ ), se = {
294
294
  screens: r.length,
295
295
  canonicalNodes: p.length,
296
296
  mergedScreens: Math.max(0, r.length - p.length),
297
- edges: P.length,
297
+ edges: v.length,
298
298
  connectedNodes: p.length - D.length,
299
299
  disconnectedScreens: ne,
300
300
  codeScenarios: B.length,
@@ -302,20 +302,20 @@ function bt(e) {
302
302
  (c) => V.has(c)
303
303
  ).length,
304
304
  missingScenarios: _,
305
- complete: ne.length === 0 && _.length === 0 && !t.some((c) => c.severity === "error") && s.size === 0
305
+ complete: ne.length === 0 && _.length === 0 && !t.some((c) => c.severity === "error") && i.size === 0
306
306
  };
307
307
  return {
308
308
  version: 1,
309
309
  nodes: p,
310
- edges: P,
310
+ edges: v,
311
311
  aliases: Object.fromEntries(
312
- Object.entries(a).sort(([c], [f]) => c.localeCompare(f))
312
+ Object.entries(a).sort(([c], [d]) => c.localeCompare(d))
313
313
  ),
314
314
  sourceGroups: Y,
315
315
  startNodeIds: k,
316
316
  branches: J,
317
317
  warnings: t,
318
- coverage: ie
318
+ coverage: se
319
319
  };
320
320
  }
321
321
  function St(e) {
@@ -352,12 +352,12 @@ function De(e) {
352
352
  function Ie(e, t) {
353
353
  const r = e.split("/").filter(Boolean), n = t.split("/").filter(Boolean);
354
354
  let o = 0;
355
- for (let s = 0; s < r.length; s += 1) {
356
- const i = r[s];
357
- if (i === "*" || i.startsWith("*")) return !0;
355
+ for (let i = 0; i < r.length; i += 1) {
356
+ const s = r[i];
357
+ if (s === "*" || s.startsWith("*")) return !0;
358
358
  const a = n[o];
359
- if (!(i.endsWith("?") && a == null)) {
360
- if (a == null || !i.startsWith(":") && i !== a) return !1;
359
+ if (!(s.endsWith("?") && a == null)) {
360
+ if (a == null || !s.startsWith(":") && s !== a) return !1;
361
361
  o += 1;
362
362
  }
363
363
  }
@@ -371,7 +371,7 @@ function Ae(e, t) {
371
371
  ...new Set(
372
372
  [...t.entries()].filter(([o]) => Ie(r, o)).map(([, o]) => o)
373
373
  )
374
- ].sort((o, s) => o.localeCompare(s));
374
+ ].sort((o, i) => o.localeCompare(i));
375
375
  }
376
376
  function It(e) {
377
377
  var r;
@@ -389,18 +389,18 @@ function It(e) {
389
389
  }
390
390
  function xt(e, t, r) {
391
391
  return (e ?? []).flatMap((n, o) => {
392
- var p, m, S;
393
- const s = (p = n.from) == null ? void 0 : p.trim(), i = (m = n.to) == null ? void 0 : m.trim();
394
- if (!s || !i || n.unresolvedTarget) return [];
395
- const a = r.has(s) ? [s] : Ae(s, t), d = r.has(i) ? [i] : Ae(i, t);
396
- if (!a.length || !d.length) return [];
397
- const g = ((S = n.id) == null ? void 0 : S.trim()) || `discovery-edge:${o + 1}`;
392
+ var p, y, g;
393
+ const i = (p = n.from) == null ? void 0 : p.trim(), s = (y = n.to) == null ? void 0 : y.trim();
394
+ if (!i || !s || n.unresolvedTarget) return [];
395
+ const a = r.has(i) ? [i] : Ae(i, t), f = r.has(s) ? [s] : Ae(s, t);
396
+ if (!a.length || !f.length) return [];
397
+ const m = ((g = n.id) == null ? void 0 : g.trim()) || `discovery-edge:${o + 1}`;
398
398
  return a.flatMap(
399
- (P, y) => d.map((N, h) => {
399
+ (v, w) => f.map((N, h) => {
400
400
  var O, A;
401
401
  return {
402
- id: a.length === 1 && d.length === 1 ? g : `${g}:${y + 1}:${h + 1}`,
403
- from: P,
402
+ id: a.length === 1 && f.length === 1 ? m : `${m}:${w + 1}:${h + 1}`,
403
+ from: v,
404
404
  to: N,
405
405
  kind: ((O = n.kind) == null ? void 0 : O.trim()) || void 0,
406
406
  label: ((A = n.label) == null ? void 0 : A.trim()) || void 0
@@ -414,63 +414,63 @@ function Pt(e, t, r) {
414
414
  if (!n) return [];
415
415
  const o = t.filter(
416
416
  (a) => {
417
- const d = U(a.route);
418
- return d ? Ie(d, n) : !1;
417
+ const f = U(a.route);
418
+ return f ? Ie(f, n) : !1;
419
419
  }
420
420
  );
421
421
  if (!o.length) return [];
422
- const s = Ce(
422
+ const i = Ce(
423
423
  Ke(r, e.environment)
424
- ), i = o.filter(
425
- (a) => Ce(a.environment) === s
424
+ ), s = o.filter(
425
+ (a) => Ce(a.environment) === i
426
426
  );
427
427
  return [
428
428
  ...new Set(
429
- i.map((a) => {
430
- var d;
431
- return (d = a.scenarioId) == null ? void 0 : d.trim();
429
+ s.map((a) => {
430
+ var f;
431
+ return (f = a.scenarioId) == null ? void 0 : f.trim();
432
432
  }).filter((a) => !!a)
433
433
  )
434
- ].sort((a, d) => a.localeCompare(d));
434
+ ].sort((a, f) => a.localeCompare(f));
435
435
  }
436
436
  function Et(e, t) {
437
- const r = e.some((s) => s.importKind != null), n = t.candidates ?? [], o = _e(t);
437
+ const r = e.some((i) => i.importKind != null), n = t.candidates ?? [], o = _e(t);
438
438
  return e.filter(
439
- (s) => r ? s.importKind === "screens" : !!s.route
440
- ).map((s) => ({
441
- id: s.id,
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: Pt(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((i, a) => i.localeCompare(a))[0]
439
+ (i) => r ? i.importKind === "screens" : !!i.route
440
+ ).map((i) => ({
441
+ id: i.id,
442
+ name: i.name,
443
+ section: i.section ?? i.canvas ?? "Screens",
444
+ componentName: i.componentName,
445
+ gallery: i.gallery,
446
+ route: i.route,
447
+ path: i.path,
448
+ publish: i.publish,
449
+ width: i.width,
450
+ height: i.height,
451
+ frameSizeMode: i.frameSizeMode,
452
+ heightMode: i.heightMode,
453
+ maxHeight: i.maxHeight,
454
+ flow: i.flow,
455
+ scenario: i.scenario,
456
+ state: i.state,
457
+ scenarioId: i.scenarioId,
458
+ scenarioIds: Pt(i, n, o),
459
+ interactions: i.interactions,
460
+ environment: i.environment,
461
+ preset: i.preset,
462
+ assertions: i.assertions,
463
+ sourcePath: [...i.sourcePaths ?? []].filter(Boolean).sort((s, a) => s.localeCompare(a))[0]
464
464
  }));
465
465
  }
466
466
  function me(e, t) {
467
- var a, d, g, p;
468
- const r = (((a = e.interactions) == null ? void 0 : a.length) ?? 0) - (((d = t.interactions) == null ? void 0 : d.length) ?? 0);
467
+ var a, f, m, p;
468
+ const r = (((a = e.interactions) == null ? void 0 : a.length) ?? 0) - (((f = t.interactions) == null ? void 0 : f.length) ?? 0);
469
469
  if (r !== 0) return r;
470
- const n = (g = e.scenarioIds) != null && g.includes("environment:baseline") ? 0 : 1, o = (p = t.scenarioIds) != null && p.includes("environment:baseline") ? 0 : 1;
470
+ const n = (m = e.scenarioIds) != null && m.includes("environment:baseline") ? 0 : 1, o = (p = t.scenarioIds) != null && p.includes("environment:baseline") ? 0 : 1;
471
471
  if (n !== o) return n - o;
472
- const s = !e.environment && !e.preset ? 0 : 1, i = !t.environment && !t.preset ? 0 : 1;
473
- return s !== i ? s - i : e.id.localeCompare(t.id);
472
+ const i = !e.environment && !e.preset ? 0 : 1, s = !t.environment && !t.preset ? 0 : 1;
473
+ return i !== s ? i - s : e.id.localeCompare(t.id);
474
474
  }
475
475
  function Nt(e) {
476
476
  const t = /* @__PURE__ */ new Map();
@@ -514,15 +514,15 @@ function At(e, t) {
514
514
  for (const n of e) {
515
515
  const o = U(n.route);
516
516
  if (!o) continue;
517
- const s = `${o}\0${ze(n).join("")}`, i = r.get(s);
518
- i ? i.push(n) : r.set(s, [n]);
517
+ const i = `${o}\0${ze(n).join("")}`, s = r.get(i);
518
+ s ? s.push(n) : r.set(i, [n]);
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), i = n.find((a) => a.id === s) ?? [...n].sort(me)[0];
523
- return n.filter((a) => a.id !== i.id).sort((a, d) => a.id.localeCompare(d.id)).map((a) => ({
524
- id: `discovery-variant:${encodeURIComponent(i.id)}:${encodeURIComponent(a.id)}`,
525
- from: i.id,
522
+ const o = U(n[0].route), i = t.get(o), s = n.find((a) => a.id === i) ?? [...n].sort(me)[0];
523
+ return n.filter((a) => a.id !== s.id).sort((a, f) => a.id.localeCompare(f.id)).map((a) => ({
524
+ id: `discovery-variant:${encodeURIComponent(s.id)}:${encodeURIComponent(a.id)}`,
525
+ from: s.id,
526
526
  to: a.id,
527
527
  kind: "variant"
528
528
  }));
@@ -533,45 +533,45 @@ function Ot(e, t) {
533
533
  for (const n of e) {
534
534
  const o = U(n.route);
535
535
  if (!o) continue;
536
- const s = r.get(o);
537
- s ? s.push(n) : r.set(o, [n]);
536
+ const i = r.get(o);
537
+ i ? i.push(n) : r.set(o, [n]);
538
538
  }
539
539
  return [...r.entries()].flatMap(([n, o]) => {
540
- const s = new Map(
541
- o.map((d) => [d.id, ze(d)])
542
- ), i = t.get(n), a = o.find(
543
- (d) => d.id === i
540
+ const i = new Map(
541
+ o.map((f) => [f.id, ze(f)])
542
+ ), s = t.get(n), a = o.find(
543
+ (f) => f.id === s
544
544
  );
545
- return o.flatMap((d) => {
546
- const g = s.get(d.id);
547
- if (!g.length) return [];
548
- const m = o.filter(
549
- (S) => Ct(
550
- s.get(S.id),
551
- g
545
+ return o.flatMap((f) => {
546
+ const m = i.get(f.id);
547
+ if (!m.length) return [];
548
+ const y = o.filter(
549
+ (g) => Ct(
550
+ i.get(g.id),
551
+ m
552
552
  )
553
- ).sort((S, P) => {
554
- const y = s.get(P.id).length - s.get(S.id).length;
555
- if (y !== 0) return y;
556
- const N = S.flow && S.flow === d.flow ? 0 : 1, h = P.flow && P.flow === d.flow ? 0 : 1;
553
+ ).sort((g, v) => {
554
+ const w = i.get(v.id).length - i.get(g.id).length;
555
+ if (w !== 0) return w;
556
+ const N = g.flow && g.flow === f.flow ? 0 : 1, h = v.flow && v.flow === f.flow ? 0 : 1;
557
557
  if (N !== h) return N - h;
558
- const O = S.section && S.section === d.section ? 0 : 1, A = P.section && P.section === d.section ? 0 : 1;
558
+ const O = g.section && g.section === f.section ? 0 : 1, A = v.section && v.section === f.section ? 0 : 1;
559
559
  if (O !== A) return O - A;
560
- const $ = S.id === i ? 0 : 1, T = P.id === i ? 0 : 1;
561
- return $ !== T ? $ - T : me(S, P);
560
+ const $ = g.id === s ? 0 : 1, T = v.id === s ? 0 : 1;
561
+ return $ !== T ? $ - T : me(g, v);
562
562
  })[0];
563
- return m ? [
563
+ return y ? [
564
564
  {
565
- id: `discovery-recipe:${encodeURIComponent(m.id)}:${encodeURIComponent(d.id)}`,
566
- from: m.id,
567
- to: d.id,
565
+ id: `discovery-recipe:${encodeURIComponent(y.id)}:${encodeURIComponent(f.id)}`,
566
+ from: y.id,
567
+ to: f.id,
568
568
  kind: "recipe-step"
569
569
  }
570
- ] : a && a.id !== d.id && s.get(a.id).join("") !== g.join("") ? [
570
+ ] : a && a.id !== f.id && i.get(a.id).join("") !== m.join("") ? [
571
571
  {
572
- id: `discovery-route-case:${encodeURIComponent(a.id)}:${encodeURIComponent(d.id)}`,
572
+ id: `discovery-route-case:${encodeURIComponent(a.id)}:${encodeURIComponent(f.id)}`,
573
573
  from: a.id,
574
- to: d.id,
574
+ to: f.id,
575
575
  kind: "route-case"
576
576
  }
577
577
  ] : [];
@@ -584,19 +584,19 @@ function $t(e) {
584
584
  for (const n of e) {
585
585
  const o = (r = n.flow) == null ? void 0 : r.trim();
586
586
  if (!o) continue;
587
- const s = t.get(o);
588
- s ? s.push(n) : t.set(o, [n]);
587
+ const i = t.get(o);
588
+ i ? i.push(n) : t.set(o, [n]);
589
589
  }
590
590
  return [...t.values()].flatMap((n) => {
591
- const o = n[0], s = /* @__PURE__ */ new Map();
592
- for (const i of n) {
593
- const a = U(i.route);
591
+ const o = n[0], i = /* @__PURE__ */ new Map();
592
+ for (const s of n) {
593
+ const a = U(s.route);
594
594
  if (!a) continue;
595
- const d = s.get(a);
596
- d ? d.push(i) : s.set(a, [i]);
595
+ const f = i.get(a);
596
+ f ? f.push(s) : i.set(a, [s]);
597
597
  }
598
- return s.size < 2 ? [] : [...s.values()].flatMap((i) => {
599
- const a = [...i].sort(
598
+ return i.size < 2 ? [] : [...i.values()].flatMap((s) => {
599
+ const a = [...s].sort(
600
600
  me
601
601
  )[0];
602
602
  return a.id === o.id ? [] : [
@@ -615,74 +615,74 @@ function Mt(e, t, r) {
615
615
  (t.routes ?? []).map((o) => U(o.path)).filter((o) => !!o)
616
616
  );
617
617
  return e.map((o) => {
618
- const s = U(o.route);
619
- if (!s || r.get(s) !== o.id)
618
+ const i = U(o.route);
619
+ if (!i || r.get(i) !== o.id)
620
620
  return o;
621
- const i = [...n].filter(
622
- (a) => Ie(a, s)
621
+ const s = [...n].filter(
622
+ (a) => Ie(a, i)
623
623
  );
624
- return i.length ? {
624
+ return s.length ? {
625
625
  ...o,
626
626
  scenarioIds: [
627
627
  .../* @__PURE__ */ new Set([
628
628
  ...o.scenarioIds ?? [],
629
- ...i.map(De)
629
+ ...s.map(De)
630
630
  ])
631
- ].sort((a, d) => a.localeCompare(d))
631
+ ].sort((a, f) => a.localeCompare(f))
632
632
  } : o;
633
633
  });
634
634
  }
635
635
  function Tt(e, t) {
636
- var g, p, m, S, P;
637
- const r = new Set(e.map((y) => y.id)), n = new Map(
638
- e.map((y, N) => [y.id, N])
639
- ), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
640
- for (const y of r)
641
- o.set(y, /* @__PURE__ */ new Set()), s.set(y, /* @__PURE__ */ new Set()), i.set(y, /* @__PURE__ */ new Set());
642
- for (const y of t)
643
- !r.has(y.from) || !r.has(y.to) || ((g = o.get(y.to)) == null || g.add(y.from), (p = s.get(y.from)) == null || p.add(y.to), (m = i.get(y.from)) == null || m.add(y.to), (S = i.get(y.to)) == null || S.add(y.from));
644
- const a = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
645
- for (const y of r) {
646
- if (d.has(y)) continue;
647
- const N = [], h = [y];
636
+ var m, p, y, g, v;
637
+ const r = new Set(e.map((w) => w.id)), n = new Map(
638
+ e.map((w, N) => [w.id, N])
639
+ ), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
640
+ for (const w of r)
641
+ o.set(w, /* @__PURE__ */ new Set()), i.set(w, /* @__PURE__ */ new Set()), s.set(w, /* @__PURE__ */ new Set());
642
+ for (const w of t)
643
+ !r.has(w.from) || !r.has(w.to) || ((m = o.get(w.to)) == null || m.add(w.from), (p = i.get(w.from)) == null || p.add(w.to), (y = s.get(w.from)) == null || y.add(w.to), (g = s.get(w.to)) == null || g.add(w.from));
644
+ const a = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
645
+ for (const w of r) {
646
+ if (f.has(w)) continue;
647
+ const N = [], h = [w];
648
648
  for (; h.length; ) {
649
- const b = h.shift();
650
- if (!d.has(b)) {
651
- d.add(b), N.push(b);
652
- for (const x of i.get(b) ?? [])
653
- d.has(x) || h.push(x);
649
+ const S = h.shift();
650
+ if (!f.has(S)) {
651
+ f.add(S), N.push(S);
652
+ for (const P of s.get(S) ?? [])
653
+ f.has(P) || h.push(P);
654
654
  }
655
655
  }
656
- if (N.length === 1 && (((P = i.get(N[0])) == null ? void 0 : P.size) ?? 0) === 0)
656
+ if (N.length === 1 && (((v = s.get(N[0])) == null ? void 0 : v.size) ?? 0) === 0)
657
657
  continue;
658
- const O = N.filter((b) => {
659
- var x;
660
- return (((x = o.get(b)) == null ? void 0 : x.size) ?? 0) === 0;
658
+ const O = N.filter((S) => {
659
+ var P;
660
+ return (((P = o.get(S)) == null ? void 0 : P.size) ?? 0) === 0;
661
661
  }).sort(
662
- (b, x) => (n.get(b) ?? Number.MAX_SAFE_INTEGER) - (n.get(x) ?? Number.MAX_SAFE_INTEGER) || b.localeCompare(x)
662
+ (S, P) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(P) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(P)
663
663
  ), A = [...N].sort(
664
- (b, x) => (n.get(b) ?? Number.MAX_SAFE_INTEGER) - (n.get(x) ?? Number.MAX_SAFE_INTEGER) || b.localeCompare(x)
664
+ (S, P) => (n.get(S) ?? Number.MAX_SAFE_INTEGER) - (n.get(P) ?? Number.MAX_SAFE_INTEGER) || S.localeCompare(P)
665
665
  )[0];
666
666
  if (!A) continue;
667
- const $ = [A], T = /* @__PURE__ */ new Set(), k = (b) => {
668
- const x = [b];
669
- for (; x.length; ) {
670
- const D = x.shift();
667
+ const $ = [A], T = /* @__PURE__ */ new Set(), k = (S) => {
668
+ const P = [S];
669
+ for (; P.length; ) {
670
+ const D = P.shift();
671
671
  if (!T.has(D)) {
672
672
  T.add(D);
673
- for (const j of s.get(D) ?? [])
674
- T.has(j) || x.push(j);
673
+ for (const j of i.get(D) ?? [])
674
+ T.has(j) || P.push(j);
675
675
  }
676
676
  }
677
677
  };
678
678
  k(A);
679
- for (const b of O)
680
- T.has(b) || ($.push(b), k(b));
681
- for (const b of $)
682
- a.add(b);
679
+ for (const S of O)
680
+ T.has(S) || ($.push(S), k(S));
681
+ for (const S of $)
682
+ a.add(S);
683
683
  }
684
684
  return [...a].sort(
685
- (y, N) => (n.get(y) ?? Number.MAX_SAFE_INTEGER) - (n.get(N) ?? Number.MAX_SAFE_INTEGER) || y.localeCompare(N)
685
+ (w, N) => (n.get(w) ?? Number.MAX_SAFE_INTEGER) - (n.get(N) ?? Number.MAX_SAFE_INTEGER) || w.localeCompare(N)
686
686
  );
687
687
  }
688
688
  function _e(e) {
@@ -701,11 +701,11 @@ function kt(e) {
701
701
  t,
702
702
  e.manifest,
703
703
  r
704
- ), s = [
704
+ ), i = [
705
705
  ...xt(
706
706
  e.manifest.edges,
707
707
  r,
708
- new Set(n.map((i) => i.id))
708
+ new Set(n.map((s) => s.id))
709
709
  ),
710
710
  ...At(n, r),
711
711
  ...Ot(n, r),
@@ -715,12 +715,12 @@ function kt(e) {
715
715
  screens: n,
716
716
  assets: e.assets,
717
717
  scenarios: It(e.manifest.routes),
718
- inferredEdges: s,
719
- startScreenIds: Tt(n, s)
718
+ inferredEdges: i,
719
+ startScreenIds: Tt(n, i)
720
720
  });
721
721
  }
722
722
  async function Fe(e) {
723
- const r = await (e.fetcher ?? ((o, s) => fetch(o, s)))(e.endpoint, {
723
+ const r = await (e.fetcher ?? ((o, i) => fetch(o, i)))(e.endpoint, {
724
724
  headers: { accept: "application/json" },
725
725
  cache: "no-store",
726
726
  signal: e.signal
@@ -799,11 +799,11 @@ function qt(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 = X(n);
803
- if (t.has(s))
804
- throw new TypeError(`Duplicate preview recipe identity: ${s}`);
805
- return t.add(s), {
806
- id: s,
802
+ const i = X(n);
803
+ if (t.has(i))
804
+ throw new TypeError(`Duplicate preview recipe identity: ${i}`);
805
+ return t.add(i), {
806
+ id: i,
807
807
  recipe: be(o)
808
808
  };
809
809
  });
@@ -815,11 +815,11 @@ function wn({
815
815
  recipeVersion: r,
816
816
  scope: n = Dt
817
817
  }) {
818
- const o = X(n), s = X(
818
+ const o = X(n), i = X(
819
819
  e,
820
820
  zt
821
- ), i = Ht(r), a = qt(t);
822
- return `${o}:${encodeURIComponent(s)}:recipe-v${i}:${a}`;
821
+ ), s = Ht(r), a = qt(t);
822
+ return `${o}:${encodeURIComponent(i)}:recipe-v${s}:${a}`;
823
823
  }
824
824
  function bn(e) {
825
825
  return {
@@ -858,23 +858,23 @@ function Gt({
858
858
  throw new TypeError(
859
859
  "Preview artifact endpoint must be a non-empty string."
860
860
  );
861
- const o = t ?? ((s, i) => fetch(s, i));
862
- return async (s) => {
863
- const i = new URLSearchParams({
864
- namespace: s.namespace,
865
- sourceRevision: s.sourceRevision
866
- }), a = s.captureBaseUrl ?? r;
867
- a && i.set("captureBaseUrl", a);
868
- const d = n.includes("?") ? "&" : "?", g = await o(
869
- `${n}${d}${i}`,
861
+ const o = t ?? ((i, s) => fetch(i, s));
862
+ return async (i) => {
863
+ const s = new URLSearchParams({
864
+ namespace: i.namespace,
865
+ sourceRevision: i.sourceRevision
866
+ }), a = i.captureBaseUrl ?? r;
867
+ a && s.set("captureBaseUrl", a);
868
+ const f = n.includes("?") ? "&" : "?", m = await o(
869
+ `${n}${f}${s}`,
870
870
  {
871
871
  method: "GET",
872
872
  headers: { accept: "application/json" },
873
873
  cache: "no-store",
874
- signal: s.signal
874
+ signal: i.signal
875
875
  }
876
876
  );
877
- return g.ok ? g.json().catch(() => null) : null;
877
+ return m.ok ? m.json().catch(() => null) : null;
878
878
  };
879
879
  }
880
880
  function fe(e) {
@@ -983,21 +983,21 @@ async function Qt({
983
983
  namespace: X(e),
984
984
  sourceRevision: X(t)
985
985
  };
986
- let s;
986
+ let i;
987
987
  try {
988
- s = await r({ ...o, signal: n });
988
+ i = await r({ ...o, signal: n });
989
989
  } catch (a) {
990
990
  if (n != null && n.aborted) throw a;
991
991
  return { status: "unavailable", artifact: null, error: a };
992
992
  }
993
- if (s == null)
993
+ if (i == null)
994
994
  return { status: "unavailable", artifact: null };
995
- const i = Wt(s, o);
996
- return i.valid ? { status: "accepted", artifact: i.artifact } : {
995
+ const s = Wt(i, o);
996
+ return s.valid ? { status: "accepted", artifact: s.artifact } : {
997
997
  status: "rejected",
998
998
  artifact: null,
999
- reason: i.reason,
1000
- errors: i.errors
999
+ reason: s.reason,
1000
+ errors: s.errors
1001
1001
  };
1002
1002
  }
1003
1003
  const ue = "var(--pygmalion-catalog-surface, #ffffff)", pe = "var(--pygmalion-catalog-canvas, #f5f5f5)", Se = "var(--pygmalion-catalog-border, #e5e7eb)", he = "var(--pygmalion-catalog-text, #202124)", F = "var(--pygmalion-catalog-muted, #6b7280)", Xt = "var(--pygmalion-catalog-header, #11182f)", Yt = "var(--pygmalion-catalog-accent, #7c6cf2)";
@@ -1007,11 +1007,11 @@ function Sn({
1007
1007
  description: r,
1008
1008
  version: n,
1009
1009
  meta: o,
1010
- children: s,
1011
- headerBackground: i = Xt,
1010
+ children: i,
1011
+ headerBackground: s = Xt,
1012
1012
  headerColor: a = "#ffffff",
1013
- bodyBackground: d = ue,
1014
- bodyGap: g = 40
1013
+ bodyBackground: f = ue,
1014
+ bodyGap: m = 40
1015
1015
  }) {
1016
1016
  return /* @__PURE__ */ R(
1017
1017
  "section",
@@ -1026,7 +1026,7 @@ function Sn({
1026
1026
  flexDirection: "column",
1027
1027
  overflow: "visible",
1028
1028
  color: he,
1029
- background: d,
1029
+ background: f,
1030
1030
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
1031
1031
  },
1032
1032
  children: [
@@ -1041,11 +1041,11 @@ function Sn({
1041
1041
  gap: 48,
1042
1042
  padding: "44px 48px 48px",
1043
1043
  color: a,
1044
- background: i
1044
+ background: s
1045
1045
  },
1046
1046
  children: [
1047
1047
  /* @__PURE__ */ R("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
1048
- t ? /* @__PURE__ */ w(
1048
+ t ? /* @__PURE__ */ b(
1049
1049
  "div",
1050
1050
  {
1051
1051
  style: {
@@ -1058,7 +1058,7 @@ function Sn({
1058
1058
  children: t
1059
1059
  }
1060
1060
  ) : null,
1061
- /* @__PURE__ */ w(
1061
+ /* @__PURE__ */ b(
1062
1062
  "h1",
1063
1063
  {
1064
1064
  style: {
@@ -1072,7 +1072,7 @@ function Sn({
1072
1072
  children: e
1073
1073
  }
1074
1074
  ),
1075
- r ? /* @__PURE__ */ w(
1075
+ r ? /* @__PURE__ */ b(
1076
1076
  "div",
1077
1077
  {
1078
1078
  style: {
@@ -1097,15 +1097,15 @@ function Sn({
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__ */ b("span", { children: n }) : null,
1101
+ o ? /* @__PURE__ */ b("span", { children: o }) : null
1102
1102
  ]
1103
1103
  }
1104
1104
  ) : null
1105
1105
  ]
1106
1106
  }
1107
1107
  ),
1108
- /* @__PURE__ */ w(
1108
+ /* @__PURE__ */ b(
1109
1109
  "div",
1110
1110
  {
1111
1111
  "data-pygmalion-catalog-document-body": "",
@@ -1114,11 +1114,11 @@ function Sn({
1114
1114
  display: "inline-flex",
1115
1115
  flexDirection: "column",
1116
1116
  alignItems: "flex-start",
1117
- gap: g,
1117
+ gap: m,
1118
1118
  padding: 48,
1119
- background: d
1119
+ background: f
1120
1120
  },
1121
- children: s
1121
+ children: i
1122
1122
  }
1123
1123
  )
1124
1124
  ]
@@ -1148,7 +1148,7 @@ function vn({
1148
1148
  },
1149
1149
  children: [
1150
1150
  /* @__PURE__ */ R("header", { style: { display: "flex", alignItems: "baseline", gap: 8 }, children: [
1151
- /* @__PURE__ */ w(
1151
+ /* @__PURE__ */ b(
1152
1152
  "h2",
1153
1153
  {
1154
1154
  style: {
@@ -1160,9 +1160,9 @@ function vn({
1160
1160
  children: e
1161
1161
  }
1162
1162
  ),
1163
- typeof t == "number" ? /* @__PURE__ */ w("span", { style: { color: F, fontSize: 11 }, children: t }) : null
1163
+ typeof t == "number" ? /* @__PURE__ */ b("span", { style: { color: F, fontSize: 11 }, children: t }) : null
1164
1164
  ] }),
1165
- r ? /* @__PURE__ */ w("div", { style: { marginTop: -10, color: F, fontSize: 11 }, children: r }) : null,
1165
+ r ? /* @__PURE__ */ b("div", { style: { marginTop: -10, color: F, fontSize: 11 }, children: r }) : null,
1166
1166
  n
1167
1167
  ]
1168
1168
  }
@@ -1173,12 +1173,12 @@ function In({
1173
1173
  columns: t,
1174
1174
  cornerLabel: r,
1175
1175
  renderCell: n,
1176
- renderRowLabel: o = (d) => d,
1177
- renderColumnLabel: s = (d) => d,
1178
- boundary: i = !0,
1176
+ renderRowLabel: o = (f) => f,
1177
+ renderColumnLabel: i = (f) => f,
1178
+ boundary: s = !0,
1179
1179
  cellStyle: a
1180
1180
  }) {
1181
- return /* @__PURE__ */ w(
1181
+ return /* @__PURE__ */ b(
1182
1182
  "div",
1183
1183
  {
1184
1184
  "data-pygmalion-catalog-matrix": "",
@@ -1186,9 +1186,9 @@ function In({
1186
1186
  boxSizing: "border-box",
1187
1187
  display: "inline-block",
1188
1188
  width: "max-content",
1189
- padding: i ? 16 : 0,
1190
- border: i ? `1px dashed ${Yt}` : void 0,
1191
- borderRadius: i ? 4 : void 0
1189
+ padding: s ? 16 : 0,
1190
+ border: s ? `1px dashed ${Yt}` : void 0,
1191
+ borderRadius: s ? 4 : void 0
1192
1192
  },
1193
1193
  children: /* @__PURE__ */ R(
1194
1194
  "table",
@@ -1199,8 +1199,8 @@ function In({
1199
1199
  borderSpacing: 0
1200
1200
  },
1201
1201
  children: [
1202
- /* @__PURE__ */ w("thead", { children: /* @__PURE__ */ R("tr", { children: [
1203
- /* @__PURE__ */ w(
1202
+ /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ R("tr", { children: [
1203
+ /* @__PURE__ */ b(
1204
1204
  "th",
1205
1205
  {
1206
1206
  style: {
@@ -1214,7 +1214,7 @@ function In({
1214
1214
  children: r
1215
1215
  }
1216
1216
  ),
1217
- t.map((d) => /* @__PURE__ */ w(
1217
+ t.map((f) => /* @__PURE__ */ b(
1218
1218
  "th",
1219
1219
  {
1220
1220
  style: {
@@ -1225,13 +1225,13 @@ function In({
1225
1225
  textAlign: "center",
1226
1226
  whiteSpace: "nowrap"
1227
1227
  },
1228
- children: s(d)
1228
+ children: i(f)
1229
1229
  },
1230
- d
1230
+ f
1231
1231
  ))
1232
1232
  ] }) }),
1233
- /* @__PURE__ */ w("tbody", { children: e.map((d) => /* @__PURE__ */ R("tr", { children: [
1234
- /* @__PURE__ */ w(
1233
+ /* @__PURE__ */ b("tbody", { children: e.map((f) => /* @__PURE__ */ R("tr", { children: [
1234
+ /* @__PURE__ */ b(
1235
1235
  "th",
1236
1236
  {
1237
1237
  style: {
@@ -1242,10 +1242,10 @@ function In({
1242
1242
  textAlign: "left",
1243
1243
  whiteSpace: "nowrap"
1244
1244
  },
1245
- children: o(d)
1245
+ children: o(f)
1246
1246
  }
1247
1247
  ),
1248
- t.map((g) => /* @__PURE__ */ w(
1248
+ t.map((m) => /* @__PURE__ */ b(
1249
1249
  "td",
1250
1250
  {
1251
1251
  style: {
@@ -1254,11 +1254,11 @@ function In({
1254
1254
  verticalAlign: "middle",
1255
1255
  ...a
1256
1256
  },
1257
- children: n(d, g)
1257
+ children: n(f, m)
1258
1258
  },
1259
- g
1259
+ m
1260
1260
  ))
1261
- ] }, d)) })
1261
+ ] }, f)) })
1262
1262
  ]
1263
1263
  }
1264
1264
  )
@@ -1317,13 +1317,13 @@ function tn({
1317
1317
  },
1318
1318
  children: [
1319
1319
  /* @__PURE__ */ R("header", { style: { marginBottom: 24 }, children: [
1320
- /* @__PURE__ */ w("h1", { style: { margin: 0, fontSize: 24, lineHeight: 1.35 }, children: e.name }),
1320
+ /* @__PURE__ */ b("h1", { style: { margin: 0, fontSize: 24, lineHeight: 1.35 }, children: e.name }),
1321
1321
  /* @__PURE__ */ R("p", { style: { margin: "6px 0 0", color: F, fontSize: 13 }, children: [
1322
1322
  t.length,
1323
1323
  " assets"
1324
1324
  ] })
1325
1325
  ] }),
1326
- /* @__PURE__ */ w(
1326
+ /* @__PURE__ */ b(
1327
1327
  "div",
1328
1328
  {
1329
1329
  style: {
@@ -1331,10 +1331,10 @@ function tn({
1331
1331
  gridTemplateColumns: "repeat(6, max-content)",
1332
1332
  gap: 16
1333
1333
  },
1334
- children: t.map((s) => /* @__PURE__ */ R(
1334
+ children: t.map((i) => /* @__PURE__ */ R(
1335
1335
  "article",
1336
1336
  {
1337
- "data-pygmalion-catalog-item": s.id,
1337
+ "data-pygmalion-catalog-item": i.id,
1338
1338
  style: {
1339
1339
  minWidth: o,
1340
1340
  width: o,
@@ -1344,7 +1344,7 @@ function tn({
1344
1344
  background: ue
1345
1345
  },
1346
1346
  children: [
1347
- /* @__PURE__ */ w(
1347
+ /* @__PURE__ */ b(
1348
1348
  "div",
1349
1349
  {
1350
1350
  style: {
@@ -1354,10 +1354,10 @@ function tn({
1354
1354
  justifyContent: "center",
1355
1355
  overflow: "hidden"
1356
1356
  },
1357
- children: r(s)
1357
+ children: r(i)
1358
1358
  }
1359
1359
  ),
1360
- /* @__PURE__ */ w(
1360
+ /* @__PURE__ */ b(
1361
1361
  "div",
1362
1362
  {
1363
1363
  style: {
@@ -1368,11 +1368,11 @@ function tn({
1368
1368
  textOverflow: "ellipsis",
1369
1369
  whiteSpace: "nowrap"
1370
1370
  },
1371
- title: s.name,
1372
- children: s.name
1371
+ title: i.name,
1372
+ children: i.name
1373
1373
  }
1374
1374
  ),
1375
- n ? /* @__PURE__ */ w("div", { style: { marginTop: 4, color: F, fontSize: 11, lineHeight: 1.45 }, children: n(s) }) : s.codeName ? /* @__PURE__ */ w(
1375
+ n ? /* @__PURE__ */ b("div", { style: { marginTop: 4, color: F, fontSize: 11, lineHeight: 1.45 }, children: n(i) }) : i.codeName ? /* @__PURE__ */ b(
1376
1376
  "div",
1377
1377
  {
1378
1378
  style: {
@@ -1384,13 +1384,13 @@ function tn({
1384
1384
  textOverflow: "ellipsis",
1385
1385
  whiteSpace: "nowrap"
1386
1386
  },
1387
- title: s.codeName,
1388
- children: s.codeName
1387
+ title: i.codeName,
1388
+ children: i.codeName
1389
1389
  }
1390
1390
  ) : null
1391
1391
  ]
1392
1392
  },
1393
- s.id
1393
+ i.id
1394
1394
  ))
1395
1395
  }
1396
1396
  )
@@ -1402,26 +1402,26 @@ function xn(e) {
1402
1402
  He(e.items);
1403
1403
  const t = /* @__PURE__ */ new Map();
1404
1404
  for (const o of e.items) {
1405
- const s = e.pageFor(o), i = t.get(s.id);
1406
- if (i) {
1407
- if (i.page.name !== s.name || i.page.section !== s.section)
1408
- throw new Error(`Conflicting design catalog page descriptor: ${s.id}`);
1409
- i.items.push(o);
1405
+ const i = e.pageFor(o), s = t.get(i.id);
1406
+ if (s) {
1407
+ if (s.page.name !== i.name || s.page.section !== i.section)
1408
+ throw new Error(`Conflicting design catalog page descriptor: ${i.id}`);
1409
+ s.items.push(o);
1410
1410
  continue;
1411
1411
  }
1412
- t.set(s.id, {
1413
- page: s,
1412
+ t.set(i.id, {
1413
+ page: i,
1414
1414
  items: [o],
1415
1415
  registryName: Be(
1416
1416
  e.kind,
1417
- s.id,
1417
+ i.id,
1418
1418
  e.registryPrefix
1419
1419
  )
1420
1420
  });
1421
1421
  }
1422
1422
  const r = {}, n = [];
1423
1423
  for (const o of t.values()) {
1424
- const s = () => /* @__PURE__ */ w(
1424
+ const i = () => /* @__PURE__ */ b(
1425
1425
  tn,
1426
1426
  {
1427
1427
  page: o.page,
@@ -1432,16 +1432,16 @@ function xn(e) {
1432
1432
  }
1433
1433
  );
1434
1434
  r[o.registryName] = {
1435
- component: s,
1435
+ component: i,
1436
1436
  children: "none"
1437
1437
  };
1438
- const i = en(e.frame, o.page, o.items);
1438
+ const s = en(e.frame, o.page, o.items);
1439
1439
  n.push({
1440
1440
  ...o.page,
1441
1441
  componentName: o.registryName,
1442
- width: (i == null ? void 0 : i.width) ?? 1,
1443
- height: (i == null ? void 0 : i.height) ?? 1,
1444
- frameSizeMode: i ? "fixed" : "content"
1442
+ width: (s == null ? void 0 : s.width) ?? 1,
1443
+ height: (s == null ? void 0 : s.height) ?? 1,
1444
+ frameSizeMode: s ? "fixed" : "content"
1445
1445
  });
1446
1446
  }
1447
1447
  return {
@@ -1454,11 +1454,11 @@ function xn(e) {
1454
1454
  };
1455
1455
  }
1456
1456
  function nn(e, t = 60) {
1457
- const r = Object.entries((e == null ? void 0 : e.props) ?? {}).filter(([, a]) => a.length > 0).sort(([a, d], [g, p]) => p.length - d.length || a.localeCompare(g)), n = r[0], o = r[1], s = Math.max(1, (n == null ? void 0 : n[1].length) ?? 1), i = 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(([, a]) => a.length > 0).sort(([a, f], [m, p]) => p.length - f.length || a.localeCompare(m)), n = r[0], o = r[1], i = Math.max(1, (n == null ? void 0 : n[1].length) ?? 1), s = o == null ? void 0 : o[1].slice(0, Math.max(1, Math.floor(t / i)));
1458
1458
  return {
1459
1459
  row: n,
1460
- column: o ? [o[0], i ?? []] : void 0,
1461
- fixed: r.slice(2).map(([a, d]) => [a, d[0]]),
1460
+ column: o ? [o[0], s ?? []] : void 0,
1461
+ fixed: r.slice(2).map(([a, f]) => [a, f[0]]),
1462
1462
  additional: r.slice(2)
1463
1463
  };
1464
1464
  }
@@ -1475,7 +1475,7 @@ function on({
1475
1475
  entry: t,
1476
1476
  maxVariantCells: r
1477
1477
  }) {
1478
- var a, d;
1478
+ var a, f;
1479
1479
  if (!t)
1480
1480
  return /* @__PURE__ */ R(
1481
1481
  "section",
@@ -1491,12 +1491,12 @@ function on({
1491
1491
  background: pe
1492
1492
  },
1493
1493
  children: [
1494
- /* @__PURE__ */ w("strong", { children: e.name }),
1495
- /* @__PURE__ */ w("p", { style: { color: F }, children: "The component is not registered." })
1494
+ /* @__PURE__ */ b("strong", { children: e.name }),
1495
+ /* @__PURE__ */ b("p", { style: { color: F }, children: "The component is not registered." })
1496
1496
  ]
1497
1497
  }
1498
1498
  );
1499
- const n = nn(t, r), o = ((a = n.row) == null ? void 0 : a[1]) ?? [void 0], s = ((d = n.column) == null ? void 0 : d[1]) ?? [void 0], i = t.component;
1499
+ const n = nn(t, r), o = ((a = n.row) == null ? void 0 : a[1]) ?? [void 0], i = ((f = n.column) == null ? void 0 : f[1]) ?? [void 0], s = t.component;
1500
1500
  return /* @__PURE__ */ R(
1501
1501
  "section",
1502
1502
  {
@@ -1513,21 +1513,21 @@ function on({
1513
1513
  },
1514
1514
  children: [
1515
1515
  /* @__PURE__ */ R("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: F, fontSize: 12 }, children: e.sourcePath }) : null
1516
+ /* @__PURE__ */ b("h1", { style: { margin: 0, fontSize: 24 }, children: e.name }),
1517
+ e.sourcePath ? /* @__PURE__ */ b("p", { style: { margin: "6px 0 0", color: F, fontSize: 12 }, children: e.sourcePath }) : null
1518
1518
  ] }),
1519
- /* @__PURE__ */ w(
1519
+ /* @__PURE__ */ b(
1520
1520
  "div",
1521
1521
  {
1522
1522
  style: {
1523
1523
  display: "inline-grid",
1524
- gridTemplateColumns: `repeat(${s.length}, max-content)`,
1524
+ gridTemplateColumns: `repeat(${i.length}, max-content)`,
1525
1525
  gap: 12
1526
1526
  },
1527
1527
  children: o.flatMap(
1528
- (g) => s.map((p) => {
1529
- const m = rn(t, n, g, p), S = [
1530
- n.row && g ? `${n.row[0]}=${g}` : "",
1528
+ (m) => i.map((p) => {
1529
+ const y = rn(t, n, m, p), g = [
1530
+ n.row && m ? `${n.row[0]}=${m}` : "",
1531
1531
  n.column && p ? `${n.column[0]}=${p}` : ""
1532
1532
  ].filter(Boolean).join(" · ");
1533
1533
  return /* @__PURE__ */ R(
@@ -1541,23 +1541,23 @@ function on({
1541
1541
  background: ue
1542
1542
  },
1543
1543
  children: [
1544
- S ? /* @__PURE__ */ w("div", { style: { marginBottom: 12, color: F, fontSize: 11 }, children: S }) : null,
1545
- /* @__PURE__ */ w("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: Ee(
1546
- i,
1547
- m,
1544
+ g ? /* @__PURE__ */ b("div", { style: { marginBottom: 12, color: F, fontSize: 11 }, children: g }) : null,
1545
+ /* @__PURE__ */ b("div", { style: { display: "flex", minHeight: 44, alignItems: "center" }, children: Ee(
1546
+ s,
1547
+ y,
1548
1548
  t.children === "text" ? t.defaultChildren ?? e.name : void 0
1549
1549
  ) })
1550
1550
  ]
1551
1551
  },
1552
- `${g ?? "default"}:${p ?? "default"}`
1552
+ `${m ?? "default"}:${p ?? "default"}`
1553
1553
  );
1554
1554
  })
1555
1555
  )
1556
1556
  }
1557
1557
  ),
1558
- n.additional.map(([g, p]) => /* @__PURE__ */ R("section", { style: { marginTop: 20 }, children: [
1559
- /* @__PURE__ */ w("h2", { style: { margin: "0 0 10px", color: F, fontSize: 12 }, children: g }),
1560
- /* @__PURE__ */ w("div", { style: { display: "flex", flexWrap: "wrap", gap: 12 }, children: p.map((m) => /* @__PURE__ */ R(
1558
+ n.additional.map(([m, p]) => /* @__PURE__ */ R("section", { style: { marginTop: 20 }, children: [
1559
+ /* @__PURE__ */ b("h2", { style: { margin: "0 0 10px", color: F, fontSize: 12 }, children: m }),
1560
+ /* @__PURE__ */ b("div", { style: { display: "flex", flexWrap: "wrap", gap: 12 }, children: p.map((y) => /* @__PURE__ */ R(
1561
1561
  "article",
1562
1562
  {
1563
1563
  style: {
@@ -1567,17 +1567,17 @@ function on({
1567
1567
  background: ue
1568
1568
  },
1569
1569
  children: [
1570
- /* @__PURE__ */ w("div", { style: { marginBottom: 12, color: F, fontSize: 11 }, children: m }),
1570
+ /* @__PURE__ */ b("div", { style: { marginBottom: 12, color: F, fontSize: 11 }, children: y }),
1571
1571
  Ee(
1572
- i,
1573
- { ...t.defaultProps, [g]: m },
1572
+ s,
1573
+ { ...t.defaultProps, [m]: y },
1574
1574
  t.children === "text" ? t.defaultChildren ?? e.name : void 0
1575
1575
  )
1576
1576
  ]
1577
1577
  },
1578
- m
1578
+ y
1579
1579
  )) })
1580
- ] }, g))
1580
+ ] }, m))
1581
1581
  ]
1582
1582
  }
1583
1583
  );
@@ -1585,30 +1585,30 @@ function on({
1585
1585
  function Pn(e) {
1586
1586
  He(e.items);
1587
1587
  const t = {}, r = [], n = [], o = e.maxVariantCells ?? 60;
1588
- for (const s of e.items) {
1589
- const i = Be(
1588
+ for (const i of e.items) {
1589
+ const s = Be(
1590
1590
  e.kind,
1591
- s.id,
1591
+ i.id,
1592
1592
  e.registryPrefix
1593
- ), a = e.registry[s.name], d = () => /* @__PURE__ */ w(
1593
+ ), a = e.registry[i.name], f = () => /* @__PURE__ */ b(
1594
1594
  on,
1595
1595
  {
1596
- item: s,
1596
+ item: i,
1597
1597
  entry: a,
1598
1598
  maxVariantCells: o
1599
1599
  }
1600
1600
  );
1601
- t[i] = { component: d, children: "none" }, r.push({
1602
- id: s.id,
1603
- name: s.name,
1604
- section: s.section,
1605
- componentName: i,
1601
+ t[s] = { component: f, children: "none" }, r.push({
1602
+ id: i.id,
1603
+ name: i.name,
1604
+ section: i.section,
1605
+ componentName: s,
1606
1606
  // The seed exists only long enough to mount the intrinsic max-content
1607
1607
  // catalog root. The editor replaces it with actual rendered DOM bounds.
1608
1608
  width: 1,
1609
1609
  height: 1,
1610
1610
  frameSizeMode: "content"
1611
- }), n.push(Ue(s, s.id));
1611
+ }), n.push(Ue(i, i.id));
1612
1612
  }
1613
1613
  return {
1614
1614
  registry: t,
@@ -1664,28 +1664,28 @@ function ln(e, t) {
1664
1664
  if (typeof r.id != "string" || !r.id) return null;
1665
1665
  const n = ge(r), o = ge(r.before) ?? n;
1666
1666
  if (!o) return null;
1667
- const s = ge(r.after);
1668
- if (t === "changed" && !s) return null;
1669
- const i = s ? cn(r.pixelDiff) : null;
1667
+ const i = ge(r.after);
1668
+ if (t === "changed" && !i) return null;
1669
+ const s = i ? cn(r.pixelDiff) : null;
1670
1670
  return {
1671
1671
  id: r.id,
1672
1672
  before: o,
1673
- ...s ? { after: s } : {},
1674
- ...s ? {
1675
- domChanged: o.domStructureHash !== s.domStructureHash,
1676
- screenshotChanged: o.screenshotHash !== s.screenshotHash
1673
+ ...i ? { after: i } : {},
1674
+ ...i ? {
1675
+ domChanged: o.domStructureHash !== i.domStructureHash,
1676
+ screenshotChanged: o.screenshotHash !== i.screenshotHash
1677
1677
  } : {},
1678
- ...i ? { pixelDiff: i } : {}
1678
+ ...s ? { pixelDiff: s } : {}
1679
1679
  };
1680
1680
  }
1681
1681
  function dn(e, t = []) {
1682
- const r = new Set(t), n = r.size > 0, o = /* @__PURE__ */ new Set(), s = [
1683
- ...e.styles.map((i) => i.affectedFrames ?? []),
1684
- ...e.texts.map((i) => i.affectedFrames ?? []),
1685
- ...e.operations.map((i) => i.affectedFrames ?? [])
1682
+ const r = new Set(t), n = r.size > 0, o = /* @__PURE__ */ new Set(), i = [
1683
+ ...e.styles.map((s) => s.affectedFrames ?? []),
1684
+ ...e.texts.map((s) => s.affectedFrames ?? []),
1685
+ ...e.operations.map((s) => s.affectedFrames ?? [])
1686
1686
  ];
1687
- for (const i of s)
1688
- for (const a of i) {
1687
+ for (const s of i)
1688
+ for (const a of s) {
1689
1689
  if (n && an.test(a.id) && !r.has(a.id))
1690
1690
  throw new Error(
1691
1691
  `"Impact Screen"${a.name}"This internal editor ID (${a.id}) is used. A canonical screen ID is required.`
@@ -1706,17 +1706,17 @@ async function Te(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((p) => ln(p, r.phase)).filter((p) => p != null) : [], i = Array.isArray(o.failures) ? o.failures.map((p) => {
1709
+ const i = Array.isArray(o.frames) ? o.frames.map((p) => ln(p, r.phase)).filter((p) => p != null) : [], s = Array.isArray(o.failures) ? o.failures.map((p) => {
1710
1710
  if (!p || typeof p != "object" || Array.isArray(p)) return null;
1711
- const m = p;
1712
- return typeof m.id == "string" && typeof m.error == "string" ? { id: m.id, error: m.error } : null;
1713
- }).filter((p) => p != null) : [], a = new Set(r.frameIds), g = new Set(s.map((p) => p.id)).size === s.length && s.every((p) => a.has(p.id)) && i.every((p) => a.has(p.id));
1711
+ const y = p;
1712
+ return typeof y.id == "string" && typeof y.error == "string" ? { id: y.id, error: y.error } : null;
1713
+ }).filter((p) => p != null) : [], a = new Set(r.frameIds), m = new Set(i.map((p) => p.id)).size === i.length && i.every((p) => a.has(p.id)) && s.every((p) => a.has(p.id));
1714
1714
  return {
1715
1715
  phase: r.phase,
1716
1716
  baselineId: o.baselineId,
1717
- complete: o.complete !== !1 && g && i.length === 0 && s.length === r.frameIds.length,
1718
- frames: s,
1719
- failures: i
1717
+ complete: o.complete !== !1 && m && s.length === 0 && i.length === r.frameIds.length,
1718
+ frames: i,
1719
+ failures: s
1720
1720
  };
1721
1721
  }
1722
1722
  const ye = {
@@ -1749,20 +1749,20 @@ async function G(e) {
1749
1749
  return t;
1750
1750
  }
1751
1751
  function En(e = {}) {
1752
- var ie, re, oe, c, f;
1752
+ var se, re, oe, c, d;
1753
1753
  const {
1754
1754
  sessionId: t,
1755
1755
  sessionStorageKey: r = fn,
1756
1756
  autoStart: n = !0,
1757
1757
  fetcher: o = fetch,
1758
- formatApplyMessage: s
1759
- } = e, i = ((ie = e.endpoints) == null ? void 0 : ie.mirror) ?? ye.mirror, a = ((re = e.endpoints) == null ? void 0 : re.sessions) ?? ye.sessions, d = ((oe = e.endpoints) == null ? void 0 : oe.inspect) ?? ye.inspect, g = e.visualQa != null, p = ((c = e.visualQa) == null ? void 0 : c.endpoint) ?? un, m = JSON.stringify(((f = e.visualQa) == null ? void 0 : f.eligibleFrameIds) ?? []), S = le(
1760
- () => JSON.parse(m),
1761
- [m]
1762
- ), P = le(
1758
+ formatApplyMessage: i
1759
+ } = e, s = ((se = e.endpoints) == null ? void 0 : se.mirror) ?? ye.mirror, a = ((re = e.endpoints) == null ? void 0 : re.sessions) ?? ye.sessions, f = ((oe = e.endpoints) == null ? void 0 : oe.inspect) ?? ye.inspect, m = e.visualQa != null, p = ((c = e.visualQa) == null ? void 0 : c.endpoint) ?? un, y = JSON.stringify(((d = e.visualQa) == null ? void 0 : d.eligibleFrameIds) ?? []), g = le(
1760
+ () => JSON.parse(y),
1761
+ [y]
1762
+ ), v = le(
1763
1763
  () => pn(t, r),
1764
1764
  [t, r]
1765
- ), [y, N] = ee({
1765
+ ), [w, N] = ee({
1766
1766
  state: "idle",
1767
1767
  commit: null,
1768
1768
  shortCommit: null,
@@ -1776,31 +1776,31 @@ function En(e = {}) {
1776
1776
  refs: [],
1777
1777
  defaultRef: null,
1778
1778
  worktreeRef: null
1779
- }), b = Ne(null), x = Ne(null), D = W(
1779
+ }), S = Ne(null), P = Ne(null), D = W(
1780
1780
  async (l = !0, u) => {
1781
- if (u != null && b.current && await b.current.catch(() => {
1782
- }), b.current) return b.current;
1783
- const I = (async () => {
1784
- N((v) => ({ ...v, state: "syncing", error: null }));
1781
+ if (u != null && S.current && await S.current.catch(() => {
1782
+ }), S.current) return S.current;
1783
+ const x = (async () => {
1784
+ N((I) => ({ ...I, state: "syncing", error: null }));
1785
1785
  try {
1786
- const v = u != null;
1787
- let M = await o(`${i}/${l || v ? "refresh" : "status"}`, {
1788
- method: l || v ? "POST" : "GET",
1789
- ...v ? {
1786
+ const I = u != null;
1787
+ let M = await o(`${s}/${l || I ? "refresh" : "status"}`, {
1788
+ method: l || I ? "POST" : "GET",
1789
+ ...I ? {
1790
1790
  headers: { "content-type": "application/json" },
1791
1791
  body: JSON.stringify({ ref: u })
1792
1792
  } : {}
1793
1793
  }), C = await G(M);
1794
1794
  const L = Date.now();
1795
1795
  for (; !l && C.state === "syncing" && Date.now() - L < 12e4; )
1796
- await new Promise((Z) => window.setTimeout(Z, 500)), M = await o(`${i}/status`), C = await G(M);
1796
+ await new Promise((Z) => window.setTimeout(Z, 500)), M = await o(`${s}/status`), C = await G(M);
1797
1797
  if (C.state !== "ready" || !C.appOrigin || !C.commit)
1798
1798
  throw new Error(C.error ?? "Pygmalion could not prepare the source preview");
1799
1799
  const q = await G(
1800
1800
  await o(`${a}/open`, {
1801
1801
  method: "POST",
1802
1802
  headers: { "content-type": "application/json" },
1803
- body: JSON.stringify({ sessionId: P, baseDevSha: C.commit })
1803
+ body: JSON.stringify({ sessionId: v, baseDevSha: C.commit })
1804
1804
  })
1805
1805
  );
1806
1806
  if (!q.ok || !q.session)
@@ -1819,26 +1819,26 @@ function En(e = {}) {
1819
1819
  H = Z.session;
1820
1820
  }
1821
1821
  N(C), O(H), $(H.appOrigin ?? C.appOrigin);
1822
- } catch (v) {
1822
+ } catch (I) {
1823
1823
  N((M) => ({
1824
1824
  ...M,
1825
1825
  state: "error",
1826
- error: v instanceof Error ? v.message : String(v)
1826
+ error: I instanceof Error ? I.message : String(I)
1827
1827
  }));
1828
1828
  }
1829
1829
  })();
1830
- b.current = I;
1830
+ S.current = x;
1831
1831
  try {
1832
- await I;
1832
+ await x;
1833
1833
  } finally {
1834
- b.current === I && (b.current = null);
1834
+ S.current === x && (S.current = null);
1835
1835
  }
1836
1836
  },
1837
- [o, i, a, P]
1837
+ [o, s, a, v]
1838
1838
  ), j = W(async () => {
1839
1839
  try {
1840
1840
  const l = await G(
1841
- await o(`${i}/refs`)
1841
+ await o(`${s}/refs`)
1842
1842
  ), u = {
1843
1843
  refs: l.refs ?? [],
1844
1844
  defaultRef: l.defaultRef ?? null,
@@ -1848,7 +1848,7 @@ function En(e = {}) {
1848
1848
  } catch {
1849
1849
  return T;
1850
1850
  }
1851
- }, [o, i, T]), Y = W(
1851
+ }, [o, s, T]), Y = W(
1852
1852
  async (l, u) => {
1853
1853
  if (h != null && h.branchName && !(u != null && u.discardEdits))
1854
1854
  throw new Error(
@@ -1861,10 +1861,10 @@ function En(e = {}) {
1861
1861
  async (l) => {
1862
1862
  var C;
1863
1863
  if (!h) throw new Error("Pygmalion design session is not ready");
1864
- const u = x.current;
1864
+ const u = P.current;
1865
1865
  if (u && (u.sessionId !== h.id || u.baseDevSha !== h.baseDevSha || u.revision !== h.revision || u.fingerprint !== JSON.stringify(l)))
1866
1866
  throw new Error("The code diff you checked is out of date. Please check the diff for the current changes again.");
1867
- const I = await G(
1867
+ const x = await G(
1868
1868
  await o(`${a}/apply-visual`, {
1869
1869
  method: "POST",
1870
1870
  headers: { "content-type": "application/json" },
@@ -1877,17 +1877,17 @@ function En(e = {}) {
1877
1877
  })
1878
1878
  })
1879
1879
  );
1880
- if (!I.ok || !I.session)
1881
- throw new Error(I.error ?? "Pygmalion could not apply the visual changes");
1882
- O(I.session), I.session.appOrigin && $(I.session.appOrigin);
1883
- const v = I.applied ?? l.styles.length + l.texts.length + l.operations.length;
1880
+ if (!x.ok || !x.session)
1881
+ throw new Error(x.error ?? "Pygmalion could not apply the visual changes");
1882
+ O(x.session), x.session.appOrigin && $(x.session.appOrigin);
1883
+ const I = x.applied ?? l.styles.length + l.texts.length + l.operations.length;
1884
1884
  let M;
1885
- if (u != null && u.qaBaselineId && ((C = u.qaFrameIds) != null && C.length) && I.session.appOrigin)
1885
+ if (u != null && u.qaBaselineId && ((C = u.qaFrameIds) != null && C.length) && x.session.appOrigin)
1886
1886
  try {
1887
1887
  M = await Te(o, p, {
1888
1888
  phase: "changed",
1889
1889
  baselineId: u.qaBaselineId,
1890
- basePath: $e(I.session.appOrigin, window.location.origin),
1890
+ basePath: $e(x.session.appOrigin, window.location.origin),
1891
1891
  frameIds: u.qaFrameIds
1892
1892
  });
1893
1893
  } catch (L) {
@@ -1900,20 +1900,20 @@ function En(e = {}) {
1900
1900
  failures: u.qaFrameIds.map((H) => ({ id: H, error: q }))
1901
1901
  };
1902
1902
  }
1903
- return x.current = null, {
1904
- applied: v,
1905
- branch: I.session.branchName ?? void 0,
1906
- integration: I.session.integration.state,
1907
- message: s == null ? void 0 : s(I.session, v),
1903
+ return P.current = null, {
1904
+ applied: I,
1905
+ branch: x.session.branchName ?? void 0,
1906
+ integration: x.session.integration.state,
1907
+ message: i == null ? void 0 : i(x.session, I),
1908
1908
  ...M ? { qa: M } : {}
1909
1909
  };
1910
1910
  },
1911
- [o, s, p, h, a]
1911
+ [o, i, p, h, a]
1912
1912
  ), V = W(
1913
1913
  async (l) => {
1914
1914
  var C;
1915
1915
  if (!h) throw new Error("Pygmalion design session is not ready");
1916
- x.current = null;
1916
+ P.current = null;
1917
1917
  const u = await G(
1918
1918
  await o(`${a}/preview-visual`, {
1919
1919
  method: "POST",
@@ -1928,48 +1928,48 @@ function En(e = {}) {
1928
1928
  );
1929
1929
  if (!u.ok || !Number.isSafeInteger(u.revision))
1930
1930
  throw new Error(u.error ?? "Pygmalion could not preview the visual changes");
1931
- const I = g ? dn(l, S) : [];
1932
- let v;
1933
- const M = h.appOrigin ?? y.appOrigin;
1934
- if (I.length > 0) {
1931
+ const x = m ? dn(l, g) : [];
1932
+ let I;
1933
+ const M = h.appOrigin ?? w.appOrigin;
1934
+ if (x.length > 0) {
1935
1935
  if (!M)
1936
1936
  throw new Error("Impact screen QA baseline preview not ready");
1937
- if (v = await Te(o, p, {
1937
+ if (I = await Te(o, p, {
1938
1938
  phase: "baseline",
1939
1939
  basePath: $e(M, window.location.origin),
1940
- frameIds: I
1941
- }), !v.complete)
1940
+ frameIds: x
1941
+ }), !I.complete)
1942
1942
  throw new Error(
1943
- ((C = v.failures[0]) == null ? void 0 : C.error) ?? `Failed to capture ${I.length - v.frames.length} affected frames`
1943
+ ((C = I.failures[0]) == null ? void 0 : C.error) ?? `Failed to capture ${x.length - I.frames.length} affected frames`
1944
1944
  );
1945
1945
  }
1946
- return x.current = {
1946
+ return P.current = {
1947
1947
  sessionId: h.id,
1948
1948
  baseDevSha: h.baseDevSha,
1949
1949
  revision: u.revision,
1950
1950
  fingerprint: JSON.stringify(l),
1951
- ...v ? { qaBaselineId: v.baselineId, qaFrameIds: I } : {}
1951
+ ...I ? { qaBaselineId: I.baselineId, qaFrameIds: x } : {}
1952
1952
  }, {
1953
1953
  revision: u.revision,
1954
1954
  files: Array.isArray(u.files) ? u.files : [],
1955
1955
  affectedFiles: Array.isArray(u.affectedFiles) ? u.affectedFiles : [],
1956
- ...v ? { qa: v } : {}
1956
+ ...I ? { qa: I } : {}
1957
1957
  };
1958
1958
  },
1959
1959
  [
1960
1960
  o,
1961
- y.appOrigin,
1962
- S,
1961
+ w.appOrigin,
1962
+ g,
1963
1963
  p,
1964
1964
  h,
1965
1965
  a,
1966
- g
1966
+ m
1967
1967
  ]
1968
1968
  ), E = W(
1969
1969
  async (l) => {
1970
1970
  if (l.length === 0) return { files: [] };
1971
1971
  const u = await G(
1972
- await o(`${d}/impact`, {
1972
+ await o(`${f}/impact`, {
1973
1973
  method: "POST",
1974
1974
  headers: { "content-type": "application/json" },
1975
1975
  body: JSON.stringify({ componentFiles: l })
@@ -1979,7 +1979,7 @@ function En(e = {}) {
1979
1979
  throw new Error(u.error ?? "Pygmalion could not calculate source impact");
1980
1980
  return { files: Array.isArray(u.files) ? u.files : [] };
1981
1981
  },
1982
- [o, d]
1982
+ [o, f]
1983
1983
  ), B = W(async () => {
1984
1984
  if (!(h != null && h.canRevert) || !h.headSha)
1985
1985
  throw new Error("There are no reversible changes applied");
@@ -1997,7 +1997,7 @@ function En(e = {}) {
1997
1997
  );
1998
1998
  if (!l.ok || l.reverted !== !0 || !l.operation || l.operation.kind !== "visual-revert" || !l.session)
1999
1999
  throw new Error(l.error ?? "Pygmalion could not revert the last visual change");
2000
- return x.current = null, O(l.session), l.session.appOrigin && $(l.session.appOrigin), {
2000
+ return P.current = null, O(l.session), l.session.appOrigin && $(l.session.appOrigin), {
2001
2001
  reverted: !0,
2002
2002
  operation: l.operation,
2003
2003
  session: l.session
@@ -2008,9 +2008,9 @@ function En(e = {}) {
2008
2008
  }, [n, D]), te(() => {
2009
2009
  n && j();
2010
2010
  }, [n]);
2011
- const _ = (h == null ? void 0 : h.appOrigin) ?? y.appOrigin ?? A, ne = (h == null ? void 0 : h.headSha) ?? (h == null ? void 0 : h.baseDevSha) ?? y.commit ?? "pending";
2011
+ const _ = (h == null ? void 0 : h.appOrigin) ?? w.appOrigin ?? A, ne = (h == null ? void 0 : h.headSha) ?? (h == null ? void 0 : h.baseDevSha) ?? w.commit ?? "pending";
2012
2012
  return {
2013
- mirror: y,
2013
+ mirror: w,
2014
2014
  session: h,
2015
2015
  ready: A != null,
2016
2016
  appOrigin: _,
@@ -2032,52 +2032,76 @@ function Nn({
2032
2032
  onChange: r,
2033
2033
  busy: n = !1,
2034
2034
  defaultRef: o = null,
2035
- worktreeRef: s = null,
2036
- label: i = "Source",
2037
- className: a
2035
+ worktreeRef: i = null,
2036
+ label: s = "Source revision",
2037
+ children: a,
2038
+ className: f
2038
2039
  }) {
2039
- const d = le(
2040
+ const m = le(
2040
2041
  () => ({
2041
- local: t.filter((m) => m.kind === "local"),
2042
- remote: t.filter((m) => m.kind === "remote")
2042
+ local: t.filter((g) => g.kind === "local"),
2043
+ remote: t.filter((g) => g.kind === "remote")
2043
2044
  }),
2044
2045
  [t]
2045
- ), g = le(() => {
2046
- const m = new Set(t.map((S) => S.name));
2047
- return o && m.add(o), s && m.add(s), m;
2048
- }, [o, t, s]), p = e ?? o ?? "";
2049
- return /* @__PURE__ */ R("label", { className: a, "data-pygmalion-source-ref": "", title: p || i, children: [
2050
- /* @__PURE__ */ w("span", { "data-pygmalion-source-ref-label": "", children: i }),
2051
- /* @__PURE__ */ R(
2052
- "select",
2053
- {
2054
- value: p,
2055
- disabled: n,
2056
- "aria-label": i,
2057
- onChange: (m) => {
2058
- const S = m.target.value;
2059
- S && S !== p && r(S);
2060
- },
2061
- children: [
2062
- p && !g.has(p) ? /* @__PURE__ */ w("option", { value: p, children: p }) : null,
2063
- s ? /* @__PURE__ */ R("option", { value: s, children: [
2064
- s,
2065
- " · uncommitted work"
2066
- ] }) : null,
2067
- d.local.length > 0 ? /* @__PURE__ */ w("optgroup", { label: "local", children: d.local.map((m) => /* @__PURE__ */ R("option", { value: m.name, children: [
2068
- m.name,
2069
- " · ",
2070
- m.commit
2071
- ] }, m.fullName)) }) : null,
2072
- d.remote.length > 0 ? /* @__PURE__ */ w("optgroup", { label: "remote", children: d.remote.map((m) => /* @__PURE__ */ R("option", { value: m.name, children: [
2073
- m.name,
2074
- " · ",
2075
- m.commit
2076
- ] }, m.fullName)) }) : null
2077
- ]
2078
- }
2079
- )
2080
- ] });
2046
+ ), p = le(() => {
2047
+ const g = new Set(t.map((v) => v.name));
2048
+ return o && g.add(o), i && g.add(i), g;
2049
+ }, [o, t, i]), y = e ?? o ?? "";
2050
+ return /* @__PURE__ */ R(
2051
+ "span",
2052
+ {
2053
+ className: f,
2054
+ "data-pygmalion-source-ref": "",
2055
+ "data-busy": n ? "" : void 0,
2056
+ style: { position: "relative", display: "inline-flex", alignItems: "center" },
2057
+ children: [
2058
+ a ?? /* @__PURE__ */ b("span", { "data-pygmalion-source-ref-value": "", children: y || s }),
2059
+ /* @__PURE__ */ R(
2060
+ "select",
2061
+ {
2062
+ value: y,
2063
+ disabled: n,
2064
+ "aria-label": s,
2065
+ "data-pygmalion-source-ref-select": "",
2066
+ onChange: (g) => {
2067
+ const v = g.target.value;
2068
+ v && v !== y && r(v);
2069
+ },
2070
+ style: {
2071
+ position: "absolute",
2072
+ inset: 0,
2073
+ width: "100%",
2074
+ height: "100%",
2075
+ opacity: 0,
2076
+ cursor: n ? "default" : "pointer",
2077
+ // The native menu stays reachable; only the painted trigger is the host's.
2078
+ appearance: "none",
2079
+ border: 0,
2080
+ padding: 0,
2081
+ margin: 0
2082
+ },
2083
+ children: [
2084
+ y && !p.has(y) ? /* @__PURE__ */ b("option", { value: y, children: y }) : null,
2085
+ i ? /* @__PURE__ */ R("option", { value: i, children: [
2086
+ i,
2087
+ " · uncommitted work"
2088
+ ] }) : null,
2089
+ m.local.length > 0 ? /* @__PURE__ */ b("optgroup", { label: "local", children: m.local.map((g) => /* @__PURE__ */ R("option", { value: g.name, children: [
2090
+ g.name,
2091
+ " · ",
2092
+ g.commit
2093
+ ] }, g.fullName)) }) : null,
2094
+ m.remote.length > 0 ? /* @__PURE__ */ b("optgroup", { label: "remote", children: m.remote.map((g) => /* @__PURE__ */ R("option", { value: g.name, children: [
2095
+ g.name,
2096
+ " · ",
2097
+ g.commit
2098
+ ] }, g.fullName)) }) : null
2099
+ ]
2100
+ }
2101
+ )
2102
+ ]
2103
+ }
2104
+ );
2081
2105
  }
2082
2106
  const Rn = {
2083
2107
  editor: K,
@@ -2100,16 +2124,16 @@ function $n({
2100
2124
  initialPages: r,
2101
2125
  designImport: n,
2102
2126
  onTokensChange: o,
2103
- appOrigin: s,
2104
- previewRevision: i,
2127
+ appOrigin: i,
2128
+ previewRevision: s,
2105
2129
  previewCacheNamespace: a,
2106
- previewArtifacts: d,
2107
- previewArtifactEndpoint: g,
2130
+ previewArtifacts: f,
2131
+ previewArtifactEndpoint: m,
2108
2132
  previewConcurrency: p,
2109
- previewOpen: m,
2110
- onPreviewOpenChange: S,
2111
- flowCanvas: P,
2112
- onApply: y,
2133
+ previewOpen: y,
2134
+ onPreviewOpenChange: g,
2135
+ flowCanvas: v,
2136
+ onApply: w,
2113
2137
  onDesignChange: N,
2114
2138
  onInspectApply: h,
2115
2139
  onInspectPreview: O,
@@ -2117,17 +2141,17 @@ function $n({
2117
2141
  storyboardDiscovery: $ = !0,
2118
2142
  storyboardDiscoveryEndpoint: T = at
2119
2143
  }) {
2120
- const [k, b] = ee(!$), [x, D] = ee();
2144
+ const [k, S] = ee(!$), [P, D] = ee();
2121
2145
  n && (n.assertComplete(), Ve(n));
2122
2146
  const j = e ?? (n == null ? void 0 : n.getRegistry()), Y = t ?? (n == null ? void 0 : n.getTokens()), J = r ?? (n == null ? void 0 : n.getInitialPages());
2123
- j && We(j), Y && Qe(Y), lt(o ?? null), s != null && Xe(s), i != null && Ye(i), Ze(a);
2124
- const V = x ?? d;
2147
+ j && We(j), Y && Qe(Y), lt(o ?? null), i != null && Xe(i), s != null && Ye(s), Ze(a);
2148
+ const V = P ?? f;
2125
2149
  return V && J && k && et(V, {
2126
2150
  namespace: a ?? "",
2127
2151
  previewRevision: ft(),
2128
2152
  appOrigin: dt(),
2129
2153
  baselineEnvironment: tt(),
2130
- allowStaleIdentity: x == null && !!g,
2154
+ allowStaleIdentity: P == null && !!m,
2131
2155
  pages: J.flatMap(
2132
2156
  (E) => E.route && E.importPageId ? [
2133
2157
  {
@@ -2142,41 +2166,41 @@ function $n({
2142
2166
  }
2143
2167
  ] : []
2144
2168
  )
2145
- }), p != null && nt(p), ut(S ?? null), P != null && rt(P), pt(y ?? null), ht(h ?? null), ot(O ?? null), mt(A ?? null), J && K.initPagesFromComponents(J), te(() => {
2169
+ }), p != null && nt(p), ut(g ?? null), v != null && rt(v), pt(w ?? null), ht(h ?? null), ot(O ?? null), mt(A ?? null), J && K.initPagesFromComponents(J), te(() => {
2146
2170
  Pe(N ?? null);
2147
- const E = st(K);
2171
+ const E = it(K);
2148
2172
  return () => {
2149
2173
  E(), Pe(null);
2150
2174
  };
2151
2175
  }, [N]), te(() => {
2152
- if (D(void 0), !k || !g || !(a != null && a.trim()) || !(i != null && i.trim()))
2176
+ if (D(void 0), !k || !m || !(a != null && a.trim()) || !(s != null && s.trim()))
2153
2177
  return;
2154
2178
  const E = new AbortController();
2155
2179
  return Qt({
2156
2180
  namespace: a,
2157
- sourceRevision: it(i),
2181
+ sourceRevision: st(s),
2158
2182
  transport: Gt({
2159
- endpoint: g,
2160
- captureBaseUrl: s
2183
+ endpoint: m,
2184
+ captureBaseUrl: i
2161
2185
  }),
2162
2186
  signal: E.signal
2163
2187
  }).then((B) => {
2164
2188
  !E.signal.aborted && B.status === "accepted" && D(B.artifact);
2165
2189
  }), () => E.abort();
2166
2190
  }, [
2167
- g,
2191
+ m,
2168
2192
  a,
2169
- i,
2170
2193
  s,
2194
+ i,
2171
2195
  k
2172
2196
  ]), te(() => {
2173
2197
  let E = !0;
2174
2198
  if (!$)
2175
- return se(void 0), b(!0), () => {
2199
+ return ie(void 0), S(!0), () => {
2176
2200
  E = !1;
2177
2201
  };
2178
2202
  const B = new AbortController();
2179
- return b(!1), se(void 0), Q(null), Fe({
2203
+ return S(!1), ie(void 0), Q(null), Fe({
2180
2204
  endpoint: T,
2181
2205
  signal: B.signal,
2182
2206
  pages: K.pages.map((_) => ({
@@ -2186,13 +2210,13 @@ function $n({
2186
2210
  })),
2187
2211
  assets: (n == null ? void 0 : n.getAssets("screens")) ?? []
2188
2212
  }).then((_) => {
2189
- E && (se(_.baselineEnvironment), Q(_.graph));
2213
+ E && (ie(_.baselineEnvironment), Q(_.graph));
2190
2214
  }).catch(() => {
2191
- E && (se(void 0), Q(null));
2215
+ E && (ie(void 0), Q(null));
2192
2216
  }).finally(() => {
2193
- E && b(!0);
2217
+ E && S(!0);
2194
2218
  }), () => {
2195
- E = !1, B.abort(), se(void 0), Q(null);
2219
+ E = !1, B.abort(), ie(void 0), Q(null);
2196
2220
  };
2197
2221
  }, [
2198
2222
  n,
@@ -2200,8 +2224,8 @@ function $n({
2200
2224
  $,
2201
2225
  T
2202
2226
  ]), te(() => {
2203
- m == null || m === K.previewOpen || (m ? K.openPreview({ notifyHost: !1 }) : K.closePreview({ notifyHost: !1 }));
2204
- }, [m]), k ? /* @__PURE__ */ w(ct, {}) : /* @__PURE__ */ w(
2227
+ y == null || y === K.previewOpen || (y ? K.openPreview({ notifyHost: !1 }) : K.closePreview({ notifyHost: !1 }));
2228
+ }, [y]), k ? /* @__PURE__ */ b(ct, {}) : /* @__PURE__ */ b(
2205
2229
  "div",
2206
2230
  {
2207
2231
  "data-pygmalion-storyboard-loading": "",
@@ -2268,7 +2292,7 @@ export {
2268
2292
  Xe as setPygmalionAppOrigin,
2269
2293
  nt as setPygmalionPreviewConcurrency,
2270
2294
  Ye as setPygmalionPreviewRevision,
2271
- se as setStoryboardBaselineEnvironment,
2295
+ ie as setStoryboardBaselineEnvironment,
2272
2296
  Q as setStoryboardGraph,
2273
2297
  Qe as setTokens,
2274
2298
  gt as storyboardScreenRecipeKey,