@brucesantos/design-space 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const k = [
1
+ const C = [
2
2
  "success",
3
3
  "loading",
4
4
  "empty",
@@ -21,13 +21,13 @@ function I(e, r) {
21
21
  return o.length !== t.length ? null : a;
22
22
  }
23
23
  function P(e, r) {
24
- const o = [...e].sort((t, a) => j(a.path) - j(t.path));
24
+ const o = [...e].sort((t, a) => O(a.path) - O(t.path));
25
25
  for (const t of o) {
26
26
  const a = I(t.path, r);
27
27
  if (a) return { definition: t, params: a };
28
28
  }
29
29
  }
30
- function T(e, r = {}) {
30
+ function z(e, r = {}) {
31
31
  const o = (a) => {
32
32
  const s = r[a];
33
33
  return typeof s == "string" && s.length > 0 ? s : void 0;
@@ -43,7 +43,7 @@ function T(e, r = {}) {
43
43
  }
44
44
  return `/${t.join("/")}`;
45
45
  }
46
- function j(e) {
46
+ function O(e) {
47
47
  const r = e.split("/").filter(Boolean);
48
48
  let o = r.length;
49
49
  for (const t of r)
@@ -58,20 +58,20 @@ function M(e) {
58
58
  return r;
59
59
  }
60
60
  }
61
- const R = /^[a-z0-9]+([.\-][a-z0-9]+)*$/, q = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/;
61
+ const R = /^[a-z0-9]+([.\-][a-z0-9]+)*$/, T = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/;
62
62
  function u(e) {
63
63
  return typeof e == "string" && e.trim().length > 0;
64
64
  }
65
- function E(e, r) {
65
+ function q(e, r) {
66
66
  const o = [], t = u(e?.id) ? `scenario:${e.id}` : `scenario[${r ?? "?"}]`, a = (c) => o.push({ level: "error", where: t, message: c }), s = (c) => o.push({ level: "warning", where: t, message: c });
67
67
  return u(e?.id) ? R.test(e.id) || a(
68
68
  "`id` deve ser minúsculo, em kebab-case, com pontos opcionais: `requests.approve-blocked` ou `approve-blocked`."
69
- ) : a("`id` é obrigatório."), u(e?.title) || a("`title` é obrigatório e deve usar o vocabulário do negócio."), u(e?.route) ? e.route.startsWith("/") || a("`route` deve começar com `/`.") : a("`route` é obrigatório."), e?.persona !== void 0 && !u(e.persona) && a("`persona`, quando informada, deve ser o id de uma persona registrada."), u(e?.fixture) || a("`fixture` é obrigatório. O padrão do ambiente é dado sintético (D-05)."), e?.components !== void 0 && !Array.isArray(e.components) && a("`components`, quando informado, deve ser uma lista de ids de componente."), e?.network && !k.includes(e.network) && a(`\`network\` deve ser um de: ${k.join(", ")}.`), e?.expected?.length || s(
69
+ ) : a("`id` é obrigatório."), u(e?.title) || a("`title` é obrigatório e deve usar o vocabulário do negócio."), u(e?.route) ? e.route.startsWith("/") || a("`route` deve começar com `/`.") : a("`route` é obrigatório."), e?.persona !== void 0 && !u(e.persona) && a("`persona`, quando informada, deve ser o id de uma persona registrada."), u(e?.fixture) || a("`fixture` é obrigatório. O padrão do ambiente é dado sintético (D-05)."), e?.components !== void 0 && !Array.isArray(e.components) && a("`components`, quando informado, deve ser uma lista de ids de componente."), e?.network && !C.includes(e.network) && a(`\`network\` deve ser um de: ${C.join(", ")}.`), e?.expected?.length || s(
70
70
  "Sem `expected`, o cenário não vira caso verificável no handoff — é tela bonita sem critério (risco: prototype theater)."
71
71
  ), o;
72
72
  }
73
- function G(e) {
74
- const r = [], o = (d, n, i) => r.push({ level: d, where: n, message: i }), t = new Set(e.personas?.map((d) => d.id) ?? []), a = new Set(e.fixtures?.map((d) => d.id) ?? []), s = new Set(e.rules?.map((d) => d.id) ?? []), c = /* @__PURE__ */ new Set();
73
+ function Q(e) {
74
+ const r = [], o = (l, n, i) => r.push({ level: l, where: n, message: i }), t = new Set(e.personas?.map((l) => l.id) ?? []), a = new Set(e.fixtures?.map((l) => l.id) ?? []), s = new Set(e.rules?.map((l) => l.id) ?? []), c = /* @__PURE__ */ new Set();
75
75
  u(e.id) || o("error", "product", "`id` é obrigatório."), u(e.name) || o("error", "product", "`name` é obrigatório."), !e.routes?.length && e.scenarios?.length && o("error", "product", "`routes` está vazio: nenhum cenário conseguirá renderizar."), e.defaultPersona !== void 0 && !t.has(e.defaultPersona) && o(
76
76
  "error",
77
77
  "product",
@@ -82,8 +82,8 @@ function G(e) {
82
82
  "`modules` foi removido na 0.8.0 e é ignorado: cada rota é uma tela, e os cenários da rota são as variações dela."
83
83
  );
84
84
  const m = /* @__PURE__ */ new Set();
85
- for (const [d, n] of (e.routes ?? []).entries()) {
86
- const i = `route:${n?.path ?? d}`;
85
+ for (const [l, n] of (e.routes ?? []).entries()) {
86
+ const i = `route:${n?.path ?? l}`;
87
87
  if (!u(n?.path)) {
88
88
  o("error", i, "`path` é obrigatório.");
89
89
  continue;
@@ -91,8 +91,8 @@ function G(e) {
91
91
  n.path.startsWith("/") || o("error", i, "`path` deve começar com `/`."), m.has(n.path) && o("error", i, `\`path\` duplicado: ${n.path}. Cada rota é uma tela.`), m.add(n.path), typeof n.screen != "function" && typeof n.screen != "object" && o("error", i, "`screen` é obrigatório."), n.name !== void 0 && !u(n.name) && o("warning", i, "`name` vazio: a tela aparece com o título do primeiro cenário."), n.group !== void 0 && !u(n.group) && o("warning", i, "`group` vazio: a tela aparece fora de qualquer fluxo."), n.expected !== void 0 && !Array.isArray(n.expected) && o("error", i, "`expected`, quando informado, deve ser uma lista de frases."), n.components !== void 0 && !Array.isArray(n.components) && o("error", i, "`components`, quando informado, deve ser uma lista de ids de componente."), n.controls !== void 0 && (Array.isArray(n.controls) ? L(n.controls, i, o) : o("error", i, "`controls`, quando informado, deve ser uma lista de grupos de controles."));
92
92
  }
93
93
  const f = /* @__PURE__ */ new Set();
94
- for (const [d, n] of (e.components ?? []).entries()) {
95
- const i = `component:${n?.id ?? d}`;
94
+ for (const [l, n] of (e.components ?? []).entries()) {
95
+ const i = `component:${n?.id ?? l}`;
96
96
  u(n?.id) ? R.test(n.id) ? f.has(n.id) ? o("error", i, `\`id\` duplicado: ${n.id}.`) : f.add(n.id) : o("error", i, "`id` deve ser minúsculo em kebab-case ou usar pontos para agrupamento.") : o("error", i, "`id` é obrigatório."), u(n?.name) || o("error", i, "`name` é obrigatório."), typeof n?.preview != "function" && typeof n?.preview != "object" && o("error", i, "`preview` é obrigatório."), n?.source !== void 0 && typeof n.source != "string" && o("error", i, "`source`, quando informado, é texto livre.");
97
97
  const p = /* @__PURE__ */ new Set();
98
98
  for (const [b, v] of (n?.fixtures ?? []).entries()) {
@@ -109,26 +109,26 @@ function G(e) {
109
109
  `\`defaultFixture\` aponta para fixture inexistente: \`${n.defaultFixture}\`.`
110
110
  );
111
111
  }
112
- for (const d of e.routes ?? []) {
113
- if (!u(d?.path)) continue;
114
- const n = `route:${d.path}`;
115
- B(e, d, n, o);
116
- for (const i of Array.isArray(d.components) ? d.components : [])
112
+ for (const l of e.routes ?? []) {
113
+ if (!u(l?.path)) continue;
114
+ const n = `route:${l.path}`;
115
+ W(e, l, n, o);
116
+ for (const i of Array.isArray(l.components) ? l.components : [])
117
117
  f.has(i) || o(
118
118
  "warning",
119
119
  n,
120
120
  `Componente não registrado: \`${i}\`. Ele não aparece em "Componentes usados".`
121
121
  );
122
- for (const i of Array.isArray(d.controls) ? d.controls : [])
122
+ for (const i of Array.isArray(l.controls) ? l.controls : [])
123
123
  i?.component !== void 0 && !f.has(i.component) && o(
124
124
  "warning",
125
125
  `${n}/group:${i.id}`,
126
126
  `Componente não registrado: \`${i.component}\`. O grupo aparece sem link para o catálogo.`
127
127
  );
128
128
  }
129
- for (const [d, n] of (e.scenarios ?? []).entries()) {
130
- r.push(...E(n, d));
131
- const i = `scenario:${n?.id ?? d}`;
129
+ for (const [l, n] of (e.scenarios ?? []).entries()) {
130
+ r.push(...q(n, l));
131
+ const i = `scenario:${n?.id ?? l}`;
132
132
  n?.id && (c.has(n.id) && o("error", i, `\`id\` duplicado: ${n.id}.`), c.add(n.id)), n?.persona && !t.has(n.persona) && o("error", i, `Persona não registrada: \`${n.persona}\`.`), n?.fixture && !a.has(n.fixture) && o("error", i, `Fixture não registrada: \`${n.fixture}\`.`);
133
133
  for (const p of n?.rules ?? [])
134
134
  s.has(p) || o("error", i, `Regra não registrada: \`${p}\`.`);
@@ -148,12 +148,12 @@ function G(e) {
148
148
  h
149
149
  ])
150
150
  );
151
- for (const [h, C] of Object.entries(n.controls)) {
151
+ for (const [h, j] of Object.entries(n.controls)) {
152
152
  const x = v.get(h);
153
- x ? (x.options ?? []).some((A) => A?.value === C) || o(
153
+ x ? (x.options ?? []).some((A) => A?.value === j) || o(
154
154
  "error",
155
155
  i,
156
- `Valor \`${C}\` não é opção do controle \`${h}\`. Opções: ${(x.options ?? []).map((A) => `\`${A?.value}\``).join(", ")}.`
156
+ `Valor \`${j}\` não é opção do controle \`${h}\`. Opções: ${(x.options ?? []).map((A) => `\`${A?.value}\``).join(", ")}.`
157
157
  ) : o(
158
158
  "error",
159
159
  i,
@@ -162,14 +162,14 @@ function G(e) {
162
162
  }
163
163
  }
164
164
  }
165
- n?.route && !W(n.route, e) && o(
165
+ n?.route && !_(n.route, e) && o(
166
166
  "error",
167
167
  i,
168
168
  `Rota \`${n.route}\` não casa com nenhuma rota declarada. O deep link abriria a tela de rota inexistente.`
169
169
  );
170
170
  }
171
- const l = e.dataSources?.default;
172
- return l && l !== "fixtures" && (new Set(e.dataSources?.adapters?.map((n) => n.id) ?? []).has(l) || o("error", "product", `\`dataSources.default\` aponta para adapter inexistente: \`${l}\`.`), o(
171
+ const d = e.dataSources?.default;
172
+ return d && d !== "fixtures" && (new Set(e.dataSources?.adapters?.map((n) => n.id) ?? []).has(d) || o("error", "product", `\`dataSources.default\` aponta para adapter inexistente: \`${d}\`.`), o(
173
173
  "warning",
174
174
  "product",
175
175
  "A fonte padrão não é `fixtures`. O padrão do ambiente é dado sintético e determinístico (D-05); API real entra como adapter opcional, com justificativa."
@@ -183,63 +183,63 @@ function L(e, r, o) {
183
183
  o("error", m, "`controls` do grupo deve ser uma lista.");
184
184
  continue;
185
185
  }
186
- for (const [f, l] of c.controls.entries()) {
187
- const d = `${m}/control:${l?.id ?? f}`;
188
- u(l?.id) ? q.test(l.id) ? a.has(l.id) ? o("error", d, `\`id\` de controle duplicado na tela: \`${l.id}\`.`) : a.add(l.id) : o(
186
+ for (const [f, d] of c.controls.entries()) {
187
+ const l = `${m}/control:${d?.id ?? f}`;
188
+ u(d?.id) ? T.test(d.id) ? a.has(d.id) ? o("error", l, `\`id\` de controle duplicado na tela: \`${d.id}\`.`) : a.add(d.id) : o(
189
189
  "error",
190
- d,
191
- `Id de controle inválido: \`${l.id}\`. Use letras, números, \`-\`, \`_\` ou \`.\`, sem espaço: ele vira \`c.<id>\` na URL.`
192
- ) : o("error", d, "`id` do controle é obrigatório."), u(l?.label) || o("error", d, "`label` do controle é obrigatório.");
193
- const n = Array.isArray(l?.options) ? l.options : [];
190
+ l,
191
+ `Id de controle inválido: \`${d.id}\`. Use letras, números, \`-\`, \`_\` ou \`.\`, sem espaço: ele vira \`c.<id>\` na URL.`
192
+ ) : o("error", l, "`id` do controle é obrigatório."), u(d?.label) || o("error", l, "`label` do controle é obrigatório.");
193
+ const n = Array.isArray(d?.options) ? d.options : [];
194
194
  if (n.length === 0) {
195
- o("error", d, "`options` precisa de ao menos uma opção.");
195
+ o("error", l, "`options` precisa de ao menos uma opção.");
196
196
  continue;
197
197
  }
198
198
  const i = /* @__PURE__ */ new Set();
199
199
  for (const p of n)
200
- u(p?.value) ? i.has(p.value) ? o("error", d, `Opção duplicada: \`${p.value}\`.`) : i.add(p.value) : o("error", d, "Toda opção precisa de `value`."), u(p?.label) || o("error", d, `A opção \`${p?.value ?? "?"}\` precisa de \`label\`.`);
201
- l.default !== void 0 && !i.has(l.default) && o(
200
+ u(p?.value) ? i.has(p.value) ? o("error", l, `Opção duplicada: \`${p.value}\`.`) : i.add(p.value) : o("error", l, "Toda opção precisa de `value`."), u(p?.label) || o("error", l, `A opção \`${p?.value ?? "?"}\` precisa de \`label\`.`);
201
+ d.default !== void 0 && !i.has(d.default) && o(
202
202
  "error",
203
- d,
204
- `\`default\` não é uma das opções: \`${l.default}\`. Opções: ${[...i].map((p) => `\`${p}\``).join(", ")}.`
203
+ l,
204
+ `\`default\` não é uma das opções: \`${d.default}\`. Opções: ${[...i].map((p) => `\`${p}\``).join(", ")}.`
205
205
  );
206
206
  }
207
207
  }
208
208
  }
209
- function B(e, r, o, t) {
209
+ function W(e, r, o, t) {
210
210
  const a = r.path.split("/").filter((f) => f.startsWith(":") || f === "*").map((f) => f === "*" ? "*" : f.slice(1)), s = r.params;
211
211
  if (s !== void 0 && (!s || typeof s != "object" || Array.isArray(s))) {
212
212
  t("error", o, "`params`, quando informado, é um objeto de nome do parâmetro → valor de exemplo.");
213
213
  return;
214
214
  }
215
215
  const c = s ?? {};
216
- for (const [f, l] of Object.entries(c))
217
- a.includes(f) ? u(l) || t("warning", o, `\`params.${f}\` vazio: a tela abre com \`:${f}\` literal.`) : t("warning", o, `\`params.${f}\` não é parâmetro de \`${r.path}\` e é ignorado.`);
216
+ for (const [f, d] of Object.entries(c))
217
+ a.includes(f) ? u(d) || t("warning", o, `\`params.${f}\` vazio: a tela abre com \`:${f}\` literal.`) : t("warning", o, `\`params.${f}\` não é parâmetro de \`${r.path}\` e é ignorado.`);
218
218
  const m = a.filter((f) => f !== "*" && !u(c[f]));
219
219
  if (m.length > 0) {
220
220
  (e.scenarios ?? []).some(
221
- (l) => u(l?.route) && P(e.routes ?? [], l.route.split("?")[0] ?? l.route)?.definition.path === r.path
221
+ (d) => u(d?.route) && P(e.routes ?? [], d.route.split("?")[0] ?? d.route)?.definition.path === r.path
222
222
  ) || t(
223
223
  "warning",
224
224
  o,
225
- `Sem exemplo para ${m.map((l) => `\`:${l}\``).join(", ")} e sem cenário na rota: a tela abre no caminho literal \`${r.path}\`. Declare \`params: { ${m.map((l) => `${l}: "…"`).join(", ")} }\`.`
225
+ `Sem exemplo para ${m.map((d) => `\`:${d}\``).join(", ")} e sem cenário na rota: a tela abre no caminho literal \`${r.path}\`. Declare \`params: { ${m.map((d) => `${d}: "…"`).join(", ")} }\`.`
226
226
  );
227
227
  return;
228
228
  }
229
229
  if (a.length > 0) {
230
- const f = T(r.path, c), l = P(e.routes ?? [], f);
231
- l && l.definition.path !== r.path && t(
230
+ const f = z(r.path, c), d = P(e.routes ?? [], f);
231
+ d && d.definition.path !== r.path && t(
232
232
  "warning",
233
233
  o,
234
- `Os exemplos de \`params\` montam \`${f}\`, que abre a rota \`${l.definition.path}\`, não esta.`
234
+ `Os exemplos de \`params\` montam \`${f}\`, que abre a rota \`${d.definition.path}\`, não esta.`
235
235
  );
236
236
  }
237
237
  }
238
- function W(e, r) {
238
+ function _(e, r) {
239
239
  const o = e.split("?")[0] ?? e;
240
- return (r.routes ?? []).some((t) => _(t.path, o));
240
+ return (r.routes ?? []).some((t) => B(t.path, o));
241
241
  }
242
- function _(e, r) {
242
+ function B(e, r) {
243
243
  const o = e.split("/").filter(Boolean), t = r.split("/").filter(Boolean);
244
244
  for (const [a, s] of o.entries()) {
245
245
  if (s === "*") return !0;
@@ -250,10 +250,10 @@ function _(e, r) {
250
250
  }
251
251
  return o.length === t.length;
252
252
  }
253
- function Q(e) {
253
+ function X(e) {
254
254
  return e.some((r) => r.level === "error");
255
255
  }
256
- function X(e) {
256
+ function Y(e) {
257
257
  return e.length === 0 ? "Nenhum problema encontrado." : e.map((r) => `${r.level === "error" ? "✖" : "▲"} ${r.where}
258
258
  ${r.message}`).join(`
259
259
  `);
@@ -264,9 +264,9 @@ const $ = {
264
264
  route: "allowRoute",
265
265
  component: "allowComponent"
266
266
  };
267
- function Y(e) {
267
+ function J(e) {
268
268
  if (e.get($.enabled) === "1")
269
- return O({
269
+ return k({
270
270
  scenarios: e.getAll($.scenario),
271
271
  routes: e.getAll($.route),
272
272
  components: e.getAll($.component)
@@ -276,12 +276,12 @@ function N(e, r) {
276
276
  for (const t of Object.values($)) e.delete(t);
277
277
  if (!r) return;
278
278
  e.set($.enabled, "1");
279
- const o = O(r);
279
+ const o = k(r);
280
280
  for (const t of o.scenarios ?? []) e.append($.scenario, t);
281
281
  for (const t of o.routes ?? []) e.append($.route, t);
282
282
  for (const t of o.components ?? []) e.append($.component, t);
283
283
  }
284
- function O(e) {
284
+ function k(e) {
285
285
  const r = S(e.scenarios), o = S(e.routes), t = S(e.components);
286
286
  return {
287
287
  ...r.length ? { scenarios: r } : {},
@@ -292,10 +292,10 @@ function O(e) {
292
292
  function D(e, r) {
293
293
  return !e || !!(r && e.scenarios?.includes(r));
294
294
  }
295
- function J(e, r) {
295
+ function ee(e, r) {
296
296
  return !e || !!(r && e.components?.includes(r));
297
297
  }
298
- function ee(e, r, o = []) {
298
+ function oe(e, r, o = []) {
299
299
  return !e || r === "/" ? !0 : [
300
300
  ...e.routes ?? [],
301
301
  ...o.filter((a) => D(e, a.id)).map((a) => a.route)
@@ -321,21 +321,27 @@ const g = {
321
321
  panelTab: "tab",
322
322
  zoom: "zoom",
323
323
  rotated: "rotate"
324
- }, y = "c.";
325
- function oe(e) {
324
+ }, w = "c.", H = /* @__PURE__ */ new Set([
325
+ ...Object.values(g),
326
+ ...Object.values($)
327
+ ]);
328
+ function re(e) {
329
+ return e.startsWith(w) || H.has(e);
330
+ }
331
+ function te(e) {
326
332
  const r = typeof e == "string" ? new URLSearchParams(e) : e, o = {};
327
333
  for (const [t, a] of r) {
328
- if (!t.startsWith(y)) continue;
329
- const s = t.slice(y.length);
334
+ if (!t.startsWith(w)) continue;
335
+ const s = t.slice(w.length);
330
336
  s && (o[s] = a);
331
337
  }
332
338
  return o;
333
339
  }
334
- function re(e) {
340
+ function ne(e) {
335
341
  for (const r of [...e.keys()])
336
- r.startsWith(y) && e.delete(r);
342
+ r.startsWith(w) && e.delete(r);
337
343
  }
338
- function H(e) {
344
+ function G(e) {
339
345
  return typeof e == "boolean" ? e ? "1" : "0" : String(e);
340
346
  }
341
347
  function F(e, r = {}) {
@@ -347,14 +353,14 @@ function F(e, r = {}) {
347
353
  }
348
354
  if (o === "screenControls") {
349
355
  for (const [s, c] of Object.entries(t))
350
- e.set(`${y}${s}`, c);
356
+ e.set(`${w}${s}`, c);
351
357
  continue;
352
358
  }
353
359
  const a = g[o];
354
- a && e.set(a, H(t));
360
+ a && e.set(a, G(t));
355
361
  }
356
362
  }
357
- const w = "ds-frame", K = "data-ds-frame", z = [
363
+ const y = "ds-frame", K = "data-ds-frame", E = [
358
364
  g.chromeTheme,
359
365
  g.chrome,
360
366
  g.inspector,
@@ -362,25 +368,25 @@ const w = "ds-frame", K = "data-ds-frame", z = [
362
368
  g.zoom,
363
369
  g.rotated
364
370
  ];
365
- function te(e, r) {
371
+ function ae(e, r) {
366
372
  const o = new URLSearchParams(r);
367
- for (const t of z) o.delete(t);
368
- return o.delete(w), o.set(w, "1"), `${e || "/"}?${o.toString()}`;
373
+ for (const t of E) o.delete(t);
374
+ return o.delete(y), o.set(y, "1"), `${e || "/"}?${o.toString()}`;
369
375
  }
370
- function ne(e) {
376
+ function ie(e) {
371
377
  const r = new URL(e, "http://design-space.invalid");
372
- r.searchParams.delete(w);
378
+ r.searchParams.delete(y);
373
379
  const o = r.searchParams.toString();
374
380
  return { path: r.pathname || "/", search: o ? `?${o}` : "" };
375
381
  }
376
- function ae(e) {
382
+ function se(e) {
377
383
  const r = new URL(e, "http://design-space.invalid");
378
384
  return `${r.pathname}|${r.searchParams.get(g.component) ?? ""}`;
379
385
  }
380
- function ie(e, r) {
386
+ function ce(e, r) {
381
387
  const o = new URLSearchParams(e), t = new URLSearchParams(r);
382
- o.delete(w);
383
- for (const s of z) {
388
+ o.delete(y);
389
+ for (const s of E) {
384
390
  o.delete(s);
385
391
  const c = t.get(s);
386
392
  c !== null && o.set(s, c);
@@ -404,19 +410,19 @@ function V(e) {
404
410
  return !1;
405
411
  }
406
412
  }
407
- function se(e, r) {
413
+ function le(e, r) {
408
414
  if (e.origin === r.origin && !(!r.source || e.source !== r.source))
409
415
  return V(e.data) ? e.data : void 0;
410
416
  }
411
- function ce(e, r, o) {
417
+ function de(e, r, o) {
412
418
  try {
413
419
  e?.postMessage(r, o);
414
420
  } catch {
415
421
  }
416
422
  }
417
- function de(e = typeof window > "u" ? void 0 : window) {
423
+ function fe(e = typeof window > "u" ? void 0 : window) {
418
424
  if (!e) return !1;
419
- if (new URLSearchParams(e.location.search).get(w) === "1") return !0;
425
+ if (new URLSearchParams(e.location.search).get(y) === "1") return !0;
420
426
  try {
421
427
  return !!e.frameElement?.hasAttribute(K);
422
428
  } catch {
@@ -440,51 +446,52 @@ function Z(e, r = {}) {
440
446
  const o = r.origin ?? U().origin, t = new URL(e.route, o);
441
447
  return t.searchParams.set(g.scenario, e.id), e.persona && t.searchParams.set(g.persona, e.persona), t.searchParams.set(g.fixture, e.fixture), e.network && e.network !== "success" && t.searchParams.set(g.network, e.network), F(t.searchParams, r.overrides), t.toString();
442
448
  }
443
- function le(e, r = {}) {
449
+ function ue(e, r = {}) {
444
450
  const o = r.origin ?? U().origin, t = new URL("/", o), a = r.fixture ?? e.fixtures?.find((s) => s.id === e.defaultFixture)?.id ?? e.fixtures?.[0]?.id;
445
451
  return t.searchParams.set(g.component, e.id), a && t.searchParams.set(g.fixture, a), F(t.searchParams, r.overrides), t.toString();
446
452
  }
447
- function fe(e, r) {
453
+ function pe(e, r) {
448
454
  const o = r.commit ?? U().commit;
449
455
  if (!o) return;
450
456
  const t = r.template.replaceAll("{shortCommit}", o.slice(0, 7)).replaceAll("{commit}", o);
451
457
  return Z(e, { origin: t });
452
458
  }
453
459
  export {
454
- I as A,
455
- O as B,
456
- y as C,
457
- H as D,
458
- E,
459
- K as F,
460
+ X as A,
461
+ I as B,
462
+ w as C,
463
+ k as D,
464
+ G as E,
465
+ y as F,
466
+ q as G,
460
467
  $ as H,
461
- k as N,
468
+ C as N,
462
469
  g as P,
463
- J as a,
464
- ee as b,
465
- oe as c,
470
+ ee as a,
471
+ oe as b,
472
+ te as c,
466
473
  N as d,
467
- ce as e,
468
- ne as f,
469
- se as g,
474
+ de as e,
475
+ ie as f,
476
+ le as g,
470
477
  D as h,
471
478
  re as i,
472
- Z as j,
473
- F as k,
474
- z as l,
475
- ae as m,
476
- de as n,
477
- U as o,
478
- Y as p,
479
- ie as q,
479
+ ne as j,
480
+ Z as k,
481
+ F as l,
482
+ E as m,
483
+ se as n,
484
+ K as o,
485
+ J as p,
486
+ fe as q,
480
487
  P as r,
481
- T as s,
482
- te as t,
483
- w as u,
484
- G as v,
485
- fe as w,
486
- le as x,
487
- X as y,
488
- Q as z
488
+ z as s,
489
+ ae as t,
490
+ U as u,
491
+ Q as v,
492
+ ce as w,
493
+ pe as x,
494
+ ue as y,
495
+ Y as z
489
496
  };
490
- //# sourceMappingURL=index-Bj69Oe2X.js.map
497
+ //# sourceMappingURL=index-BnTStnNk.js.map