@brucesantos/design-space 0.9.3 → 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.
package/dist/index.js CHANGED
@@ -1,152 +1,152 @@
1
- import { jsx as n, jsxs as C, Fragment as Y } from "react/jsx-runtime";
2
- import { useState as V, useRef as q, useCallback as U, useEffect as I, useMemo as D, useContext as ct, createContext as lt, useLayoutEffect as Ue } from "react";
3
- import { r as xe, s as dt, h as oe, v as ut, a as ve, b as Ie, p as ht, P as $, c as We, C as ge, d as Pe, e as ae, t as ue, f as Ne, N as He, g as Be, F as pt, i as mt, j as ft, k as pe, l as ye, m as wt, n as _e, o as vt, q as gt, u as bt, w as St } from "./index-BnTStnNk.js";
4
- import { H as bn, x as Sn, y as kn, z as Cn, A as xn, B as Nn, D as yn, E as $n, G as Mn } from "./index-BnTStnNk.js";
5
- function kt(e) {
6
- const t = e.scenarios ?? [], s = e.routes ?? [], o = e.components ?? [], r = new Map(t.map((c) => [c.id, c])), i = new Map(o.map((c) => [c.id, c])), l = new Map((e.personas ?? []).map((c) => [c.id, c])), a = new Map((e.fixtures ?? []).map((c) => [c.id, c])), p = new Map((e.rules ?? []).map((c) => [c.id, c])), m = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
7
- for (const c of t) {
8
- const v = xe(s, c.route ?? "");
9
- if (!v) continue;
10
- const x = v.definition.path;
11
- h.set(c.id, x);
12
- const M = m.get(x) ?? [];
13
- M.push(c), m.set(x, M);
1
+ import { jsx as n, jsxs as x, Fragment as Y } from "react/jsx-runtime";
2
+ import { useState as V, useRef as j, useCallback as U, useEffect as I, useMemo as D, useContext as ut, createContext as ht, useLayoutEffect as We } from "react";
3
+ import { r as ye, s as pt, h as oe, v as mt, a as ge, b as He, p as ft, P as M, c as Be, C as be, d as Pe, e as re, t as ie, f as he, N as je, g as qe, F as wt, i as Te, j as vt, k as me, l as Ne, m as gt, n as Fe, o as bt, q as St, u as kt, w as Ct } from "./index-BnTStnNk.js";
4
+ import { H as kn, x as Cn, y as xn, z as yn, A as Nn, B as $n, D as Mn, E as Ln, G as Pn } from "./index-BnTStnNk.js";
5
+ function xt(e) {
6
+ const t = e.scenarios ?? [], s = e.routes ?? [], o = e.components ?? [], r = new Map(t.map((a) => [a.id, a])), i = new Map(o.map((a) => [a.id, a])), d = new Map((e.personas ?? []).map((a) => [a.id, a])), l = new Map((e.fixtures ?? []).map((a) => [a.id, a])), w = new Map((e.rules ?? []).map((a) => [a.id, a])), h = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
7
+ for (const a of t) {
8
+ const m = ye(s, a.route ?? "");
9
+ if (!m) continue;
10
+ const C = m.definition.path;
11
+ u.set(a.id, C);
12
+ const L = h.get(C) ?? [];
13
+ L.push(a), h.set(C, L);
14
14
  }
15
- const d = /* @__PURE__ */ new Set(), f = [];
16
- for (const c of s) {
17
- if (d.has(c.path)) continue;
18
- d.add(c.path);
19
- const v = m.get(c.path) ?? [];
20
- f.push({
21
- id: c.path,
22
- name: c.name?.trim() || v[0]?.title || c.path,
23
- description: c.description,
24
- route: c,
25
- href: dt(c.path, c.params),
26
- variations: v,
27
- group: c.group?.trim() || void 0,
28
- controls: Array.isArray(c.controls) ? c.controls : []
15
+ const c = /* @__PURE__ */ new Set(), g = [];
16
+ for (const a of s) {
17
+ if (c.has(a.path)) continue;
18
+ c.add(a.path);
19
+ const m = h.get(a.path) ?? [];
20
+ g.push({
21
+ id: a.path,
22
+ name: a.name?.trim() || m[0]?.title || a.path,
23
+ description: a.description,
24
+ route: a,
25
+ href: pt(a.path, a.params),
26
+ variations: m,
27
+ group: a.group?.trim() || void 0,
28
+ controls: Array.isArray(a.controls) ? a.controls : []
29
29
  });
30
30
  }
31
- const S = new Map(f.map((c) => [c.id, c])), b = (c) => c ? r.get(c) : void 0, L = (c) => c ? l.get(c) : void 0, T = L(e.defaultPersona)?.id, N = (c, v) => {
32
- if (!(!c || !v))
33
- return i.get(c)?.fixtures?.find((x) => x.id === v);
34
- }, w = (c = {}) => t.filter((v) => oe(c.handoff, v.id)), u = (c) => {
35
- const v = xe(s, c);
36
- return v ? S.get(v.definition.path) : void 0;
37
- }, k = (c = {}) => {
38
- const { handoff: v } = c;
39
- return v ? f.map((x) => ({
40
- ...x,
41
- variations: x.variations.filter((M) => oe(v, M.id))
31
+ const k = new Map(g.map((a) => [a.id, a])), b = (a) => a ? r.get(a) : void 0, $ = (a) => a ? d.get(a) : void 0, R = $(e.defaultPersona)?.id, N = (a, m) => {
32
+ if (!(!a || !m))
33
+ return i.get(a)?.fixtures?.find((C) => C.id === m);
34
+ }, P = (a = {}) => t.filter((m) => oe(a.handoff, m.id)), v = (a) => {
35
+ const m = ye(s, a);
36
+ return m ? k.get(m.definition.path) : void 0;
37
+ }, p = (a = {}) => {
38
+ const { handoff: m } = a;
39
+ return m ? g.map((C) => ({
40
+ ...C,
41
+ variations: C.variations.filter((L) => oe(m, L.id))
42
42
  })).filter(
43
- (x) => x.variations.length > 0 || (v.routes ?? []).length > 0 && Ie(v, x.href)
44
- ) : f;
45
- }, g = (c) => c ? c.permissions ? c.permissions : L(c.persona ?? T)?.permissions ?? [] : [], y = (c = {}) => je(k(c)), _ = (c, v) => {
46
- const x = new Set(c?.route.components ?? []), M = v ? [v] : c?.variations ?? [];
47
- for (const F of M)
48
- for (const E of F.components ?? []) x.add(E);
49
- return [...x];
50
- }, z = (c) => o.filter((v) => ve(c, v.id));
43
+ (C) => C.variations.length > 0 || (m.routes ?? []).length > 0 && He(m, C.href)
44
+ ) : g;
45
+ }, f = (a) => a ? a.permissions ? a.permissions : $(a.persona ?? R)?.permissions ?? [] : [], S = (a = {}) => Ge(p(a)), y = (a, m) => {
46
+ const C = new Set(a?.route.components ?? []), L = m ? [m] : a?.variations ?? [];
47
+ for (const O of L)
48
+ for (const _ of O.components ?? []) C.add(_);
49
+ return [...C];
50
+ }, T = (a) => o.filter((m) => ge(a, m.id));
51
51
  return {
52
52
  product: e,
53
- screens: f,
54
- issues: ut(e),
55
- defaultPersona: T,
53
+ screens: g,
54
+ issues: mt(e),
55
+ defaultPersona: R,
56
56
  scenario: b,
57
- component: (c) => c ? i.get(c) : void 0,
57
+ component: (a) => a ? i.get(a) : void 0,
58
58
  componentFixture: N,
59
- resolveComponentFixture: (c, v) => {
60
- const x = c ? i.get(c) : void 0, M = N(c, v), F = N(c, x?.defaultFixture) ?? x?.fixtures?.[0];
59
+ resolveComponentFixture: (a, m) => {
60
+ const C = a ? i.get(a) : void 0, L = N(a, m), O = N(a, C?.defaultFixture) ?? C?.fixtures?.[0];
61
61
  return {
62
- fixture: M ?? F,
63
- requestedId: v,
64
- didFallback: !!(v && !M)
62
+ fixture: L ?? O,
63
+ requestedId: m,
64
+ didFallback: !!(m && !L)
65
65
  };
66
66
  },
67
- persona: L,
68
- fixture: (c) => c ? a.get(c) : void 0,
69
- rule: (c) => c ? p.get(c) : void 0,
70
- screen: (c) => c ? S.get(c) : void 0,
71
- screenForPath: u,
72
- screenOf: (c) => {
73
- const v = c ? h.get(c.id) : void 0;
74
- return v ? S.get(v) : void 0;
67
+ persona: $,
68
+ fixture: (a) => a ? l.get(a) : void 0,
69
+ rule: (a) => a ? w.get(a) : void 0,
70
+ screen: (a) => a ? k.get(a) : void 0,
71
+ screenForPath: v,
72
+ screenOf: (a) => {
73
+ const m = a ? u.get(a.id) : void 0;
74
+ return m ? k.get(m) : void 0;
75
75
  },
76
- screensFor: k,
77
- flows: y,
78
- flowOf: (c, v) => {
79
- if (c)
80
- return y(v).find((x) => x.name === c.group);
76
+ screensFor: p,
77
+ flows: S,
78
+ flowOf: (a, m) => {
79
+ if (a)
80
+ return S(m).find((C) => C.name === a.group);
81
81
  },
82
- controlsOf: (c) => (c?.controls ?? []).flatMap((v) => v.controls ?? []),
83
- resolveControls: (c, v = {}) => Ct(c?.controls ?? [], v),
84
- rulesOf: (c) => (c?.rules ?? []).map((v) => p.get(v)).filter((v) => !!v),
85
- permissionsOf: g,
86
- scenariosForRoute: (c, v) => {
87
- const x = u(c);
88
- return x ? x.variations.filter((M) => oe(v?.handoff, M.id)) : [];
82
+ controlsOf: (a) => (a?.controls ?? []).flatMap((m) => m.controls ?? []),
83
+ resolveControls: (a, m = {}) => yt(a?.controls ?? [], m),
84
+ rulesOf: (a) => (a?.rules ?? []).map((m) => w.get(m)).filter((m) => !!m),
85
+ permissionsOf: f,
86
+ scenariosForRoute: (a, m) => {
87
+ const C = v(a);
88
+ return C ? C.variations.filter((L) => oe(m?.handoff, L.id)) : [];
89
89
  },
90
- activeScenarios: w,
91
- search: (c, v) => {
92
- const x = X(c), M = w(v);
93
- return x ? M.filter(
94
- (F) => X(
90
+ activeScenarios: P,
91
+ search: (a, m) => {
92
+ const C = Q(a), L = P(m);
93
+ return C ? L.filter(
94
+ (O) => Q(
95
95
  [
96
- F.title,
97
- F.id,
98
- F.intent ?? "",
99
- F.route,
100
- L(F.persona)?.name ?? "",
101
- (F.tags ?? []).join(" "),
102
- (F.expected ?? []).join(" ")
96
+ O.title,
97
+ O.id,
98
+ O.intent ?? "",
99
+ O.route,
100
+ $(O.persona)?.name ?? "",
101
+ (O.tags ?? []).join(" "),
102
+ (O.expected ?? []).join(" ")
103
103
  ].join(" ")
104
- ).includes(x)
105
- ) : M;
104
+ ).includes(C)
105
+ ) : L;
106
106
  },
107
- searchScreens: (c, v) => {
108
- const x = X(c), M = k(v);
109
- return x ? M.filter(
110
- (F) => X(
107
+ searchScreens: (a, m) => {
108
+ const C = Q(a), L = p(m);
109
+ return C ? L.filter(
110
+ (O) => Q(
111
111
  [
112
- F.name,
113
- F.description ?? "",
114
- F.id,
115
- F.group ?? "",
116
- ...F.variations.flatMap((E) => [
117
- E.title,
118
- E.id,
119
- (E.tags ?? []).join(" ")
112
+ O.name,
113
+ O.description ?? "",
114
+ O.id,
115
+ O.group ?? "",
116
+ ...O.variations.flatMap((_) => [
117
+ _.title,
118
+ _.id,
119
+ (_.tags ?? []).join(" ")
120
120
  ])
121
121
  ].join(" ")
122
- ).includes(x)
123
- ) : M;
122
+ ).includes(C)
123
+ ) : L;
124
124
  },
125
- searchComponents: (c, v) => {
126
- const x = X(c), M = z(v);
127
- return x ? M.filter(
128
- (F) => X(
125
+ searchComponents: (a, m) => {
126
+ const C = Q(a), L = T(m);
127
+ return C ? L.filter(
128
+ (O) => Q(
129
129
  [
130
- F.name,
131
- F.description ?? "",
132
- F.group ?? "",
133
- F.id,
134
- F.source ?? ""
130
+ O.name,
131
+ O.description ?? "",
132
+ O.group ?? "",
133
+ O.id,
134
+ O.source ?? ""
135
135
  ].join(" ")
136
- ).includes(x)
137
- ) : M;
136
+ ).includes(C)
137
+ ) : L;
138
138
  },
139
- componentsFor: z,
140
- componentsOfScreen: (c, v) => _(c, v).map((x) => i.get(x)).filter((x) => !!x),
141
- usagesOf: (c, v) => c ? k(v).filter(
142
- (x) => x.route.components?.includes(c) || x.variations.some((M) => M.components?.includes(c))
139
+ componentsFor: T,
140
+ componentsOfScreen: (a, m) => y(a, m).map((C) => i.get(C)).filter((C) => !!C),
141
+ usagesOf: (a, m) => a ? p(m).filter(
142
+ (C) => C.route.components?.includes(a) || C.variations.some((L) => L.components?.includes(a))
143
143
  ) : []
144
144
  };
145
145
  }
146
- function X(e) {
146
+ function Q(e) {
147
147
  return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").trim();
148
148
  }
149
- function je(e) {
149
+ function Ge(e) {
150
150
  const t = [], s = /* @__PURE__ */ new Map();
151
151
  for (const r of e) {
152
152
  if (!r.group) {
@@ -159,211 +159,242 @@ function je(e) {
159
159
  const o = [...s].map(([r, i]) => ({ name: r, screens: i }));
160
160
  return t.length > 0 ? [{ name: void 0, screens: t }, ...o] : o;
161
161
  }
162
- function be(e) {
162
+ function Se(e) {
163
163
  const t = e.options ?? [];
164
164
  return e.default !== void 0 && t.some((s) => s.value === e.default) ? e.default : t[0]?.value ?? "";
165
165
  }
166
- function Ct(e, t = {}) {
166
+ function yt(e, t = {}) {
167
167
  const s = {}, o = [], r = /* @__PURE__ */ new Set(), i = t.requested ?? {};
168
- for (const l of e)
169
- for (const a of l.controls ?? []) {
170
- if (r.has(a.id)) continue;
171
- r.add(a.id);
172
- const p = (f) => f !== void 0 && (a.options ?? []).some((S) => S.value === f);
173
- let m = be(a);
174
- const h = t.scenario?.controls?.[a.id];
175
- p(h) && (m = h);
176
- const d = i[a.id];
177
- d !== void 0 && (p(d) ? m = d : o.push({ id: a.id, value: d, reason: "invalid-value", fallback: m })), s[a.id] = m;
168
+ for (const d of e)
169
+ for (const l of d.controls ?? []) {
170
+ if (r.has(l.id)) continue;
171
+ r.add(l.id);
172
+ const w = (g) => g !== void 0 && (l.options ?? []).some((k) => k.value === g);
173
+ let h = Se(l);
174
+ const u = t.scenario?.controls?.[l.id];
175
+ w(u) && (h = u);
176
+ const c = i[l.id];
177
+ c !== void 0 && (w(c) ? h = c : o.push({ id: l.id, value: c, reason: "invalid-value", fallback: h })), s[l.id] = h;
178
178
  }
179
- for (const [l, a] of Object.entries(i))
180
- r.has(l) || o.push({ id: l, value: a, reason: "unknown-control" });
179
+ for (const [d, l] of Object.entries(i))
180
+ r.has(d) || o.push({ id: d, value: l, reason: "unknown-control" });
181
181
  return { values: s, invalid: o };
182
182
  }
183
- function xt(e, t) {
183
+ function Nt(e, t) {
184
184
  return e ? Object.entries(e.controls ?? {}).every(([s, o]) => t?.[s] === o) : !1;
185
185
  }
186
- const Nt = [
186
+ const $t = [
187
187
  { id: "mobile", label: "Celular", width: 375, height: 812 },
188
188
  { id: "tablet", label: "Tablet", width: 768, height: 1024 },
189
189
  { id: "desktop", label: "Desktop", width: 1280, height: 800 },
190
190
  { id: "fit", label: "Ajustar" },
191
191
  { id: "custom", label: "Personalizado" }
192
- ], Te = 25, Ee = 150, me = 100;
193
- function qe(e, t, s) {
192
+ ], Ee = 25, Re = 150, fe = 100;
193
+ function Ze(e, t, s) {
194
194
  const o = s !== void 0 ? e.screenForPath(s) : e.screenOf(t), r = t && o && e.screenOf(t)?.id === o.id ? t : void 0;
195
195
  return { screen: o, scenario: r };
196
196
  }
197
197
  function $e(e, t, s) {
198
- const o = new URLSearchParams(e), r = ht(o), i = o.get($.component) ?? void 0, l = ve(r, i) ? t.component(i) : void 0, a = o.get($.scenario) ?? void 0, p = l || !oe(r, a) ? void 0 : t.scenario(a), m = o.get($.fixture) ?? void 0, h = l ? m ?? t.componentFixture(l.id, l.defaultFixture)?.id ?? l.fixtures?.[0]?.id : void 0, d = o.get($.network), f = l ? void 0 : qe(t, p, s), S = f?.screen && f.screen.controls.length > 0 ? t.resolveControls(f.screen, {
199
- scenario: f.scenario,
200
- requested: We(o)
198
+ const o = new URLSearchParams(e), r = ft(o), i = o.get(M.component) ?? void 0, d = ge(r, i) ? t.component(i) : void 0, l = o.get(M.scenario) ?? void 0, w = d || !oe(r, l) ? void 0 : t.scenario(l), h = o.get(M.fixture) ?? void 0, u = d ? h ?? t.componentFixture(d.id, d.defaultFixture)?.id ?? d.fixtures?.[0]?.id : void 0, c = o.get(M.network), g = d ? void 0 : Ze(t, w, s), k = g?.screen && g.screen.controls.length > 0 ? t.resolveControls(g.screen, {
199
+ scenario: g.scenario,
200
+ requested: Be(o)
201
201
  }).values : void 0;
202
202
  return {
203
- scenario: p?.id,
203
+ scenario: w?.id,
204
204
  handoff: r,
205
- component: l?.id,
205
+ component: d?.id,
206
206
  // Precedência: URL, cenário, padrão do produto. O preview de componente não
207
207
  // tem persona, então o padrão não se aplica a ele.
208
- persona: o.get($.persona) ?? p?.persona ?? (l ? void 0 : t.defaultPersona),
209
- fixture: l ? h : m ?? p?.fixture,
210
- network: Pt(d) ? d : p?.network ?? "success",
211
- viewport: o.get($.viewport) ?? "fit",
212
- customWidth: Rt(o.get($.customWidth)),
213
- themeMode: o.get($.themeMode) ?? t.product.theme?.modes?.[0],
214
- locale: o.get($.locale) ?? t.product.theme?.locales?.[0],
215
- dataSource: o.get($.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
208
+ persona: o.get(M.persona) ?? w?.persona ?? (d ? void 0 : t.defaultPersona),
209
+ fixture: d ? u : h ?? w?.fixture,
210
+ network: Et(c) ? c : w?.network ?? "success",
211
+ viewport: o.get(M.viewport) ?? "fit",
212
+ customWidth: Ft(o.get(M.customWidth)),
213
+ themeMode: o.get(M.themeMode) ?? t.product.theme?.modes?.[0],
214
+ locale: o.get(M.locale) ?? t.product.theme?.locales?.[0],
215
+ dataSource: o.get(M.dataSource) ?? t.product.dataSources?.default ?? "fixtures",
216
216
  // Sem parâmetro, o tema do chrome fica em aberto: o shell resolve pela
217
217
  // última escolha da pessoa e, na falta dela, pelo sistema.
218
- chromeTheme: Tt(o.get($.chromeTheme)) ? o.get($.chromeTheme) : void 0,
218
+ chromeTheme: Rt(o.get(M.chromeTheme)) ? o.get(M.chromeTheme) : void 0,
219
219
  // Chrome visível por padrão. `?chrome=0` é o modo de revisão limpa e captura
220
220
  // de tela, então precisa ser explícito para não sumir sem pedido.
221
- chrome: o.get($.chrome) !== "0",
222
- inspector: o.get($.inspector) !== "0",
223
- panelTab: Et(o.get($.panelTab)) ? o.get($.panelTab) : "variations",
224
- zoom: Ze(o.get($.zoom)),
225
- rotated: o.get($.rotated) === "1",
226
- screenControls: S
221
+ chrome: o.get(M.chrome) !== "0",
222
+ inspector: o.get(M.inspector) !== "0",
223
+ panelTab: _t(o.get(M.panelTab)) ? o.get(M.panelTab) : "variations",
224
+ zoom: Xe(o.get(M.zoom)),
225
+ rotated: o.get(M.rotated) === "1",
226
+ screenControls: k
227
227
  };
228
228
  }
229
- function se(e, t, s) {
229
+ function ae(e, t, s) {
230
230
  const o = new URLSearchParams(), r = t.scenario(e.scenario);
231
- if (e.component ? o.set($.component, e.component) : e.scenario && o.set($.scenario, e.scenario), e.persona && e.persona !== (r?.persona ?? t.defaultPersona) && o.set($.persona, e.persona), e.component && e.fixture ? o.set($.fixture, e.fixture) : e.fixture && e.fixture !== r?.fixture && o.set($.fixture, e.fixture), e.network !== (r?.network ?? "success") && o.set($.network, e.network), e.screenControls && !e.component) {
232
- const h = qe(t, r, s), d = h.screen ? t.resolveControls(h.screen, { scenario: h.scenario }).values : {}, f = h.screen ? t.controlsOf(h.screen).map((S) => S.id) : Object.keys(e.screenControls);
233
- for (const S of f) {
234
- const b = e.screenControls[S];
235
- b !== void 0 && b !== d[S] && o.set(`${ge}${S}`, b);
231
+ if (e.component ? o.set(M.component, e.component) : e.scenario && o.set(M.scenario, e.scenario), e.persona && e.persona !== (r?.persona ?? t.defaultPersona) && o.set(M.persona, e.persona), e.component && e.fixture ? o.set(M.fixture, e.fixture) : e.fixture && e.fixture !== r?.fixture && o.set(M.fixture, e.fixture), e.network !== (r?.network ?? "success") && o.set(M.network, e.network), e.screenControls && !e.component) {
232
+ const u = Ze(t, r, s), c = u.screen ? t.resolveControls(u.screen, { scenario: u.scenario }).values : {}, g = u.screen ? t.controlsOf(u.screen).map((k) => k.id) : Object.keys(e.screenControls);
233
+ for (const k of g) {
234
+ const b = e.screenControls[k];
235
+ b !== void 0 && b !== c[k] && o.set(`${be}${k}`, b);
236
236
  }
237
237
  }
238
- e.viewport !== "fit" && o.set($.viewport, e.viewport), e.viewport === "custom" && e.customWidth && o.set($.customWidth, String(e.customWidth));
238
+ e.viewport !== "fit" && o.set(M.viewport, e.viewport), e.viewport === "custom" && e.customWidth && o.set(M.customWidth, String(e.customWidth));
239
239
  const i = t.product.theme?.modes?.[0];
240
- e.themeMode && e.themeMode !== i && o.set($.themeMode, e.themeMode);
241
- const l = t.product.theme?.locales?.[0];
242
- e.locale && e.locale !== l && o.set($.locale, e.locale);
243
- const a = t.product.dataSources?.default ?? "fixtures";
244
- e.dataSource && e.dataSource !== a && o.set($.dataSource, e.dataSource), e.chromeTheme && o.set($.chromeTheme, e.chromeTheme), e.chrome || o.set($.chrome, "0"), e.inspector || o.set($.inspector, "0"), e.panelTab === "info" && o.set($.panelTab, "info");
245
- const p = Ze(e.zoom === void 0 ? null : String(e.zoom));
246
- p !== me && o.set($.zoom, String(p)), e.rotated && o.set($.rotated, "1"), Pe(o, e.handoff);
247
- const m = o.toString();
248
- return m ? `?${m}` : "";
249
- }
250
- function Ge(e, t = {}) {
251
- const s = !!t.frame, [o, r] = V(() => Se()), i = q(o), l = U((w) => {
252
- i.current = w, r(w);
240
+ e.themeMode && e.themeMode !== i && o.set(M.themeMode, e.themeMode);
241
+ const d = t.product.theme?.locales?.[0];
242
+ e.locale && e.locale !== d && o.set(M.locale, e.locale);
243
+ const l = t.product.dataSources?.default ?? "fixtures";
244
+ e.dataSource && e.dataSource !== l && o.set(M.dataSource, e.dataSource), e.chromeTheme && o.set(M.chromeTheme, e.chromeTheme), e.chrome || o.set(M.chrome, "0"), e.inspector || o.set(M.inspector, "0"), e.panelTab === "info" && o.set(M.panelTab, "info");
245
+ const w = Xe(e.zoom === void 0 ? null : String(e.zoom));
246
+ w !== fe && o.set(M.zoom, String(w)), e.rotated && o.set(M.rotated, "1"), Pe(o, e.handoff);
247
+ const h = o.toString();
248
+ return h ? `?${h}` : "";
249
+ }
250
+ function Ye(e, t = {}) {
251
+ const s = !!t.frame, [o, r] = V(() => ke()), i = j(o), d = U((p) => {
252
+ i.current = p, r(p);
253
+ }, []), l = j(!1), w = U((p) => {
254
+ l.current = !0;
255
+ try {
256
+ window.history.replaceState(null, "", p);
257
+ } finally {
258
+ l.current = !1;
259
+ }
253
260
  }, []);
254
261
  I(() => {
255
- const w = () => l(Se());
256
- return window.addEventListener("popstate", w), () => window.removeEventListener("popstate", w);
257
- }, [l]), I(() => {
262
+ const p = () => d(ke());
263
+ return window.addEventListener("popstate", p), () => window.removeEventListener("popstate", p);
264
+ }, [d]), I(() => {
265
+ if (!s) return;
266
+ const p = window.history, { pushState: f, replaceState: S } = p, y = (T) => {
267
+ const a = i.current;
268
+ if (window.location.pathname !== a.path) return !1;
269
+ const m = Oe(a.search, he(window.location.href).search), C = ie(a.path, m);
270
+ if (`${window.location.pathname}${window.location.search}` !== C && S.call(p, p.state, "", `${C}${window.location.hash}`), m === a.search) return !0;
271
+ const O = { path: a.path, search: m };
272
+ return i.current = O, queueMicrotask(() => {
273
+ i.current === O && (r(O), re(
274
+ window.parent === window ? void 0 : window.parent,
275
+ { ds: 1, type: "navigate", url: C, replace: T },
276
+ window.location.origin
277
+ ));
278
+ }), !0;
279
+ };
280
+ return p.replaceState = function(T, a, m) {
281
+ S.call(p, T, a, m), l.current || y(!0);
282
+ }, p.pushState = function(T, a, m) {
283
+ const C = `${window.location.pathname}${window.location.search}${window.location.hash}`;
284
+ S.call(p, T, a, m), !y(!1) && (S.call(p, p.state, "", C), f.call(p, T, a, m));
285
+ }, y(!0), () => {
286
+ p.pushState = f, p.replaceState = S;
287
+ };
288
+ }, [s]), I(() => {
258
289
  if (!s || window.parent === window) return;
259
- const w = window.location.origin, u = (g) => {
260
- const y = Be(g, { origin: w, source: window.parent });
261
- if (y?.type !== "location") return;
262
- const { path: _, search: z } = Ne(y.url);
263
- window.history.replaceState(null, "", ue(_, z)), l({ path: _, search: z });
290
+ const p = window.location.origin, f = (y) => {
291
+ const T = qe(y, { origin: p, source: window.parent });
292
+ if (T?.type !== "location") return;
293
+ const { path: a, search: m } = he(T.url);
294
+ w(ie(a, m)), d({ path: a, search: m });
264
295
  };
265
- window.addEventListener("message", u);
266
- const k = Se();
267
- return ae(
296
+ window.addEventListener("message", f);
297
+ const S = ke();
298
+ return re(
268
299
  window.parent,
269
- { ds: 1, type: "ready", url: ue(k.path, k.search) },
270
- w
271
- ), () => window.removeEventListener("message", u);
272
- }, [s, l]);
273
- const a = D(
300
+ { ds: 1, type: "ready", url: ie(S.path, S.search) },
301
+ p
302
+ ), () => window.removeEventListener("message", f);
303
+ }, [s, d, w]);
304
+ const h = D(
274
305
  () => $e(o.search, e, o.path),
275
306
  [o.path, o.search, e]
276
- ), p = U(
277
- (w, u, k = !1) => {
307
+ ), u = U(
308
+ (p, f, S = !1) => {
278
309
  if (s) {
279
- const y = ue(w, u), _ = Ne(y);
280
- window.history.replaceState(null, "", y), l(_), ae(
310
+ const T = ie(p, f), a = he(T);
311
+ w(T), d(a), re(
281
312
  window.parent === window ? void 0 : window.parent,
282
- { ds: 1, type: "navigate", url: y, replace: k },
313
+ { ds: 1, type: "navigate", url: T, replace: S },
283
314
  window.location.origin
284
315
  );
285
316
  return;
286
317
  }
287
- const g = `${w}${u}`;
288
- k ? window.history.replaceState(null, "", g) : window.history.pushState(null, "", g), l({ path: w, search: u });
318
+ const y = `${p}${f}`;
319
+ S ? window.history.replaceState(null, "", y) : window.history.pushState(null, "", y), d({ path: p, search: f });
289
320
  },
290
- [s, l]
291
- ), m = U(() => {
292
- const w = i.current;
293
- return w === o ? a : $e(w.search, e, w.path);
294
- }, [a, o, e]), h = U(
295
- (w) => {
296
- const u = i.current, k = { ...m(), ...w }, g = $t(se(k, e, u.path), u.search);
297
- g !== u.search && p(u.path, g, !0);
321
+ [s, d, w]
322
+ ), c = U(() => {
323
+ const p = i.current;
324
+ return p === o ? h : $e(p.search, e, p.path);
325
+ }, [h, o, e]), g = U(
326
+ (p) => {
327
+ const f = i.current, S = { ...c(), ...p }, y = Oe(ae(S, e, f.path), f.search);
328
+ y !== f.search && u(f.path, y, !0);
298
329
  },
299
- [m, p, e]
300
- ), d = U(
301
- (w) => {
302
- const u = m().screenControls ?? {};
303
- Object.entries(w).some(([g, y]) => u[g] !== y) && h({ screenControls: { ...u, ...w } });
330
+ [c, u, e]
331
+ ), k = U(
332
+ (p) => {
333
+ const f = c().screenControls ?? {};
334
+ Object.entries(p).some(([y, T]) => f[y] !== T) && g({ screenControls: { ...f, ...p } });
304
335
  },
305
- [m, h]
306
- ), f = U(
307
- (w, u) => {
308
- const k = yt(w, i.current, e, {
309
- controls: u?.controls
336
+ [c, g]
337
+ ), b = U(
338
+ (p, f) => {
339
+ const S = Mt(p, i.current, e, {
340
+ controls: f?.controls
310
341
  });
311
- p(k.path, k.search, u?.replace ?? !1);
342
+ u(S.path, S.search, f?.replace ?? !1);
312
343
  },
313
- [p, e]
314
- ), S = U(
315
- (w) => {
316
- const u = e.scenario(w);
317
- if (!u || !oe(a.handoff, w)) return;
318
- const k = {
319
- ...a,
320
- scenario: u.id,
344
+ [u, e]
345
+ ), $ = U(
346
+ (p) => {
347
+ const f = e.scenario(p);
348
+ if (!f || !oe(h.handoff, p)) return;
349
+ const S = {
350
+ ...h,
351
+ scenario: f.id,
321
352
  component: void 0,
322
- persona: u.persona,
323
- fixture: u.fixture,
324
- network: u.network ?? "success",
353
+ persona: f.persona,
354
+ fixture: f.fixture,
355
+ network: f.network ?? "success",
325
356
  // Os controles voltam ao que o cenário fixa, sobre os padrões da tela.
326
357
  screenControls: void 0
327
358
  };
328
- p(u.route, se(k, e, u.route), !1);
359
+ u(f.route, ae(S, e, f.route), !1);
329
360
  },
330
- [a, p, e]
331
- ), b = U(
332
- (w, u) => {
333
- const k = e.component(w);
334
- if (!k || !ve(a.handoff, w)) return;
335
- const g = {
336
- ...a,
361
+ [h, u, e]
362
+ ), R = U(
363
+ (p, f) => {
364
+ const S = e.component(p);
365
+ if (!S || !ge(h.handoff, p)) return;
366
+ const y = {
367
+ ...h,
337
368
  scenario: void 0,
338
- component: k.id,
369
+ component: S.id,
339
370
  persona: void 0,
340
371
  fixture: void 0,
341
372
  network: "success",
342
373
  screenControls: void 0
343
374
  };
344
- g.fixture = e.componentFixture(k.id, k.defaultFixture)?.id ?? k.fixtures?.[0]?.id, p("/", se(g, e), u?.replace ?? !1);
375
+ y.fixture = e.componentFixture(S.id, S.defaultFixture)?.id ?? S.fixtures?.[0]?.id, u("/", ae(y, e), f?.replace ?? !1);
345
376
  },
346
- [a, p, e]
347
- ), L = U(
348
- (w, u) => {
349
- const k = e.screensFor({ handoff: a.handoff }).find((_) => _.id === w);
350
- if (!k) return;
351
- const g = k.variations[0];
352
- if (g) {
353
- const _ = {
354
- ...a,
355
- scenario: g.id,
377
+ [h, u, e]
378
+ ), N = U(
379
+ (p, f) => {
380
+ const S = e.screensFor({ handoff: h.handoff }).find((a) => a.id === p);
381
+ if (!S) return;
382
+ const y = S.variations[0];
383
+ if (y) {
384
+ const a = {
385
+ ...h,
386
+ scenario: y.id,
356
387
  component: void 0,
357
- persona: g.persona,
358
- fixture: g.fixture,
359
- network: g.network ?? "success",
388
+ persona: y.persona,
389
+ fixture: y.fixture,
390
+ network: y.network ?? "success",
360
391
  screenControls: void 0
361
392
  };
362
- p(g.route, se(_, e, g.route), u?.replace ?? !1);
393
+ u(y.route, ae(a, e, y.route), f?.replace ?? !1);
363
394
  return;
364
395
  }
365
- const y = {
366
- ...a,
396
+ const T = {
397
+ ...h,
367
398
  scenario: void 0,
368
399
  component: void 0,
369
400
  persona: void 0,
@@ -371,137 +402,146 @@ function Ge(e, t = {}) {
371
402
  network: "success",
372
403
  screenControls: void 0
373
404
  };
374
- p(k.href, se(y, e, k.href), u?.replace ?? !1);
405
+ u(S.href, ae(T, e, S.href), f?.replace ?? !1);
375
406
  },
376
- [a, p, e]
377
- ), T = U(
378
- (w, u, k) => p(w || "/", u, k?.replace ?? !1),
379
- [p]
380
- ), N = D(() => Lt(a), [a]);
407
+ [h, u, e]
408
+ ), P = U(
409
+ (p, f, S) => u(p || "/", f, S?.replace ?? !1),
410
+ [u]
411
+ ), v = D(() => Tt(h), [h]);
381
412
  return {
382
413
  location: o,
383
- controls: a,
384
- viewport: N,
385
- setControls: h,
386
- setScreenControls: d,
387
- navigate: f,
388
- openScenario: S,
389
- openComponent: b,
390
- openScreen: L,
391
- go: T
414
+ controls: h,
415
+ viewport: v,
416
+ setControls: g,
417
+ setScreenControls: k,
418
+ navigate: b,
419
+ openScenario: $,
420
+ openComponent: R,
421
+ openScreen: N,
422
+ go: P
392
423
  };
393
424
  }
394
- function yt(e, t, s, o = {}) {
395
- const r = e.split("#")[0] ?? e, i = r.indexOf("?"), l = (i === -1 ? r : r.slice(0, i)) || "/", a = i === -1 ? void 0 : r.slice(i + 1), p = new URLSearchParams(t.search), m = $e(t.search, s, t.path);
396
- let h;
397
- if (a === void 0 && o.controls === void 0)
398
- h = new URLSearchParams(t.search), s.screenForPath(l)?.id !== s.screenForPath(t.path)?.id && ft(h);
425
+ function Mt(e, t, s, o = {}) {
426
+ const r = e.split("#")[0] ?? e, i = r.indexOf("?"), d = (i === -1 ? r : r.slice(0, i)) || "/", l = i === -1 ? void 0 : r.slice(i + 1), w = new URLSearchParams(t.search), h = $e(t.search, s, t.path), u = !Lt(s, d, t.path);
427
+ let c;
428
+ if (l === void 0 && o.controls === void 0)
429
+ c = new URLSearchParams(t.search), u && (vt(c), Qe(c));
399
430
  else {
400
- const f = new URLSearchParams(a ?? "");
401
- h = new URLSearchParams();
402
- for (const [S, b] of p)
403
- !Mt(S) || f.has(S) || h.append(S, b);
404
- m.scenario && !f.has($.scenario) && m.persona && m.persona !== s.defaultPersona && !h.has($.persona) && !f.has($.persona) && h.set($.persona, m.persona);
405
- for (const [S, b] of f) h.append(S, b);
431
+ const k = new URLSearchParams(l ?? "");
432
+ c = new URLSearchParams();
433
+ for (const [b, $] of w)
434
+ !Pt(b) || k.has(b) || u && !Te(b) || c.append(b, $);
435
+ h.scenario && !k.has(M.scenario) && h.persona && h.persona !== s.defaultPersona && !c.has(M.persona) && !k.has(M.persona) && c.set(M.persona, h.persona);
436
+ for (const [b, $] of k) c.append(b, $);
406
437
  if (o.controls) {
407
- const S = s.screenForPath(l), b = s.scenario(h.get($.scenario) ?? void 0), L = b && S && s.screenOf(b)?.id === S.id ? b : void 0, T = S ? s.resolveControls(S, { scenario: L }).values : {};
408
- for (const [N, w] of Object.entries(o.controls)) {
409
- const u = `${ge}${N}`;
410
- T[N] === w ? h.delete(u) : h.set(u, w);
438
+ const b = s.screenForPath(d), $ = s.scenario(c.get(M.scenario) ?? void 0), R = $ && b && s.screenOf($)?.id === b.id ? $ : void 0, N = b ? s.resolveControls(b, { scenario: R }).values : {};
439
+ for (const [P, v] of Object.entries(o.controls)) {
440
+ const p = `${be}${P}`;
441
+ N[P] === v ? c.delete(p) : c.set(p, v);
411
442
  }
412
443
  }
413
444
  }
414
- m.handoff && Pe(h, m.handoff);
415
- const d = h.toString();
416
- return { path: l, search: d ? `?${d}` : "" };
445
+ h.handoff && Pe(c, h.handoff);
446
+ const g = c.toString();
447
+ return { path: d, search: g ? `?${g}` : "" };
417
448
  }
418
- function $t(e, t) {
449
+ function Oe(e, t) {
419
450
  const s = new URLSearchParams(e);
451
+ Qe(s);
420
452
  for (const [r, i] of new URLSearchParams(t))
421
- r === pt || mt(r) || s.append(r, i);
453
+ r === wt || Te(r) || s.append(r, i);
422
454
  const o = s.toString();
423
455
  return o ? `?${o}` : "";
424
456
  }
425
- function Mt(e) {
426
- return e.startsWith(ge) ? !1 : e !== $.scenario && e !== $.fixture && e !== $.component;
457
+ function Qe(e) {
458
+ for (const t of [...e.keys()])
459
+ Te(t) || e.delete(t);
460
+ }
461
+ function Lt(e, t, s) {
462
+ const o = e.screenForPath(t)?.id, r = e.screenForPath(s)?.id;
463
+ return o === void 0 && r === void 0 ? t === s : o === r;
464
+ }
465
+ function Pt(e) {
466
+ return e.startsWith(be) ? !1 : e !== M.scenario && e !== M.fixture && e !== M.component;
427
467
  }
428
- function Lt(e) {
468
+ function Tt(e) {
429
469
  if (e.viewport === "custom")
430
470
  return { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 };
431
- const t = Nt.find((s) => s.id === e.viewport) ?? {
471
+ const t = $t.find((s) => s.id === e.viewport) ?? {
432
472
  id: "fit",
433
473
  label: "Ajustar"
434
474
  };
435
475
  return e.rotated && t.width && t.height ? { ...t, width: t.height, height: t.width } : { ...t };
436
476
  }
437
- function Ze(e) {
438
- if (e === null) return me;
477
+ function Xe(e) {
478
+ if (e === null) return fe;
439
479
  const t = Number.parseInt(e, 10);
440
- return Number.isFinite(t) ? Math.min(Ee, Math.max(Te, t)) : me;
480
+ return Number.isFinite(t) ? Math.min(Re, Math.max(Ee, t)) : fe;
441
481
  }
442
- function Se() {
482
+ function ke() {
443
483
  return typeof window > "u" ? { path: "/", search: "" } : { path: window.location.pathname, search: window.location.search };
444
484
  }
445
- function Pt(e) {
446
- return e !== null && He.includes(e);
485
+ function Et(e) {
486
+ return e !== null && je.includes(e);
447
487
  }
448
- function Tt(e) {
488
+ function Rt(e) {
449
489
  return e === "dark" || e === "light";
450
490
  }
451
- function Et(e) {
491
+ function _t(e) {
452
492
  return e === "variations" || e === "info";
453
493
  }
454
- function Rt(e) {
494
+ function Ft(e) {
455
495
  if (!e) return;
456
496
  const t = Number.parseInt(e, 10);
457
497
  return Number.isFinite(t) && t > 0 ? t : void 0;
458
498
  }
459
- const _t = "@brucesantos/design-space", Fe = "0.9.3", Ft = {
460
- mobile: /* @__PURE__ */ C(Y, { children: [
499
+ const Ot = "@brucesantos/design-space", ze = "0.10.0", zt = {
500
+ mobile: /* @__PURE__ */ x(Y, { children: [
461
501
  /* @__PURE__ */ n("rect", { x: "7", y: "2.5", width: "10", height: "19", rx: "2" }),
462
502
  /* @__PURE__ */ n("path", { d: "M11 18.5h2" })
463
503
  ] }),
464
- tablet: /* @__PURE__ */ C(Y, { children: [
504
+ tablet: /* @__PURE__ */ x(Y, { children: [
465
505
  /* @__PURE__ */ n("rect", { x: "4.5", y: "2.5", width: "15", height: "19", rx: "2" }),
466
506
  /* @__PURE__ */ n("path", { d: "M11 18.5h2" })
467
507
  ] }),
468
- desktop: /* @__PURE__ */ C(Y, { children: [
508
+ desktop: /* @__PURE__ */ x(Y, { children: [
469
509
  /* @__PURE__ */ n("rect", { x: "2.5", y: "4", width: "19", height: "12.5", rx: "1.5" }),
470
510
  /* @__PURE__ */ n("path", { d: "M8.5 20.5h7M12 16.5v4" })
471
511
  ] }),
472
512
  fit: /* @__PURE__ */ n("path", { d: "M3 12h7M3 12l3-3M3 12l3 3M21 12h-7M21 12l-3-3M21 12l-3 3" }),
473
- rotate: /* @__PURE__ */ C(Y, { children: [
513
+ rotate: /* @__PURE__ */ x(Y, { children: [
474
514
  /* @__PURE__ */ n("path", { d: "M20 12a8 8 0 1 1-2.34-5.66" }),
475
515
  /* @__PURE__ */ n("path", { d: "M20 4v4.5h-4.5" })
476
516
  ] }),
477
517
  minus: /* @__PURE__ */ n("path", { d: "M5 12h14" }),
478
518
  plus: /* @__PURE__ */ n("path", { d: "M5 12h14M12 5v14" }),
479
519
  "arrow-up-right": /* @__PURE__ */ n("path", { d: "M7 17 17 7M8 7h9v9" }),
480
- link: /* @__PURE__ */ C(Y, { children: [
520
+ link: /* @__PURE__ */ x(Y, { children: [
481
521
  /* @__PURE__ */ n("path", { d: "M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1" }),
482
522
  /* @__PURE__ */ n("path", { d: "M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1" })
483
523
  ] }),
484
524
  check: /* @__PURE__ */ n("path", { d: "M5 12.5l4.5 4.5L19 7.5" }),
485
525
  fullscreen: /* @__PURE__ */ n("path", { d: "M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5" }),
486
- sun: /* @__PURE__ */ C(Y, { children: [
526
+ sun: /* @__PURE__ */ x(Y, { children: [
487
527
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
488
528
  /* @__PURE__ */ n("path", { d: "M12 2.5v2M12 19.5v2M4.6 4.6 6 6M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4 6 18M18 6l1.4-1.4" })
489
529
  ] }),
490
530
  moon: /* @__PURE__ */ n("path", { d: "M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5Z" }),
491
- panel: /* @__PURE__ */ C(Y, { children: [
531
+ panel: /* @__PURE__ */ x(Y, { children: [
492
532
  /* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
493
533
  /* @__PURE__ */ n("path", { d: "M15 4v16" })
494
534
  ] }),
495
- alert: /* @__PURE__ */ C(Y, { children: [
535
+ alert: /* @__PURE__ */ x(Y, { children: [
496
536
  /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
497
537
  /* @__PURE__ */ n("path", { d: "M12 7.5v5.5M12 16.2v.3" })
498
538
  ] }),
499
539
  chevron: /* @__PURE__ */ n("path", { d: "M9 6l6 6-6 6" }),
500
- search: /* @__PURE__ */ C(Y, { children: [
540
+ search: /* @__PURE__ */ x(Y, { children: [
501
541
  /* @__PURE__ */ n("circle", { cx: "11", cy: "11", r: "6.5" }),
502
542
  /* @__PURE__ */ n("path", { d: "M20 20l-4.2-4.2" })
503
543
  ] }),
504
- copy: /* @__PURE__ */ C(Y, { children: [
544
+ copy: /* @__PURE__ */ x(Y, { children: [
505
545
  /* @__PURE__ */ n("rect", { x: "8.5", y: "8.5", width: "12", height: "12", rx: "2" }),
506
546
  /* @__PURE__ */ n("path", { d: "M15.5 8.5V5.5a2 2 0 0 0-2-2h-8a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h3" })
507
547
  ] })
@@ -521,7 +561,7 @@ function H({ name: e, size: t = 16 }) {
521
561
  strokeLinejoin: "round",
522
562
  "aria-hidden": "true",
523
563
  focusable: "false",
524
- children: Ft[e]
564
+ children: zt[e]
525
565
  }
526
566
  );
527
567
  }
@@ -666,7 +706,7 @@ const ne = {
666
706
  empty: "Nada para mostrar ainda",
667
707
  emptyHint: "O produto ainda não registrou telas nem componentes."
668
708
  }
669
- }, un = {
709
+ }, pn = {
670
710
  network: {
671
711
  success: "Success",
672
712
  loading: "Loading",
@@ -808,7 +848,7 @@ const ne = {
808
848
  emptyHint: "The product has not registered any screens or components yet."
809
849
  }
810
850
  };
811
- function Ot(e) {
851
+ function At(e) {
812
852
  if (!e) return ne;
813
853
  const t = { ...ne };
814
854
  for (const s of Object.keys(ne)) {
@@ -817,72 +857,72 @@ function Ot(e) {
817
857
  }
818
858
  return t;
819
859
  }
820
- const Ye = lt(ne);
860
+ const Je = ht(ne);
821
861
  function J() {
822
- return ct(Ye);
862
+ return ut(Je);
823
863
  }
824
- const hn = ne.network, zt = [
864
+ const mn = ne.network, Dt = [
825
865
  { id: "mobile", icon: "mobile" },
826
866
  { id: "tablet", icon: "tablet" },
827
867
  { id: "desktop", icon: "desktop" },
828
868
  { id: "fit", icon: "fit" }
829
- ], Oe = [25, 33, 50, 67, 75, 90, 100, 110, 125, 150];
830
- function ze(e, t) {
831
- return t > 0 ? Oe.find((s) => s > e) ?? Ee : [...Oe].reverse().find((s) => s < e) ?? Te;
869
+ ], Ae = [25, 33, 50, 67, 75, 90, 100, 110, 125, 150];
870
+ function De(e, t) {
871
+ return t > 0 ? Ae.find((s) => s > e) ?? Re : [...Ae].reverse().find((s) => s < e) ?? Ee;
832
872
  }
833
- function At({
873
+ function Vt({
834
874
  productName: e,
835
875
  viewportId: t,
836
876
  viewport: s,
837
877
  zoom: o,
838
878
  rotated: r,
839
879
  theme: i,
840
- issues: l,
841
- linkUrl: a,
842
- onViewport: p,
843
- onRotate: m,
844
- onZoom: h,
845
- onCleanReview: d,
846
- onToggleTheme: f
880
+ issues: d,
881
+ linkUrl: l,
882
+ onViewport: w,
883
+ onRotate: h,
884
+ onZoom: u,
885
+ onCleanReview: c,
886
+ onToggleTheme: g
847
887
  }) {
848
- const S = J(), b = S.topbar, [L, T] = V(!1), N = (t === "mobile" || t === "tablet") && !!(s.width && s.height), w = async () => {
888
+ const k = J(), b = k.topbar, [$, R] = V(!1), N = (t === "mobile" || t === "tablet") && !!(s.width && s.height), P = async () => {
849
889
  try {
850
- await navigator.clipboard.writeText(a);
890
+ await navigator.clipboard.writeText(l);
851
891
  } catch {
852
- window.prompt(b.copyPrompt, a);
892
+ window.prompt(b.copyPrompt, l);
853
893
  }
854
- T(!0), window.setTimeout(() => T(!1), 1600);
894
+ R(!0), window.setTimeout(() => R(!1), 1600);
855
895
  };
856
- return /* @__PURE__ */ C("header", { className: "ds-topbar", "aria-label": b.region, children: [
857
- /* @__PURE__ */ C("div", { className: "ds-topbar__product", children: [
896
+ return /* @__PURE__ */ x("header", { className: "ds-topbar", "aria-label": b.region, children: [
897
+ /* @__PURE__ */ x("div", { className: "ds-topbar__product", children: [
858
898
  /* @__PURE__ */ n("span", { className: "ds-topbar__name", children: e }),
859
899
  /* @__PURE__ */ n(
860
900
  "a",
861
901
  {
862
902
  className: "ds-topbar__version",
863
- href: `https://www.npmjs.com/package/${_t}/v/${Fe}`,
903
+ href: `https://www.npmjs.com/package/${Ot}/v/${ze}`,
864
904
  target: "_blank",
865
905
  rel: "noreferrer",
866
- children: b.engineVersion(Fe)
906
+ children: b.engineVersion(ze)
867
907
  }
868
908
  )
869
909
  ] }),
870
- /* @__PURE__ */ C("div", { className: "ds-topbar__view", children: [
871
- /* @__PURE__ */ C("div", { className: "ds-group", role: "group", "aria-label": b.viewportGroup, children: [
872
- zt.map((u) => {
873
- const k = S.viewport[u.id] ?? u.id;
910
+ /* @__PURE__ */ x("div", { className: "ds-topbar__view", children: [
911
+ /* @__PURE__ */ x("div", { className: "ds-group", role: "group", "aria-label": b.viewportGroup, children: [
912
+ Dt.map((v) => {
913
+ const p = k.viewport[v.id] ?? v.id;
874
914
  return /* @__PURE__ */ n(
875
915
  "button",
876
916
  {
877
917
  type: "button",
878
918
  className: "ds-btn ds-btn--icon",
879
- "aria-pressed": t === u.id,
880
- "aria-label": k,
881
- title: k,
882
- onClick: () => p(u.id),
883
- children: /* @__PURE__ */ n(H, { name: u.icon })
919
+ "aria-pressed": t === v.id,
920
+ "aria-label": p,
921
+ title: p,
922
+ onClick: () => w(v.id),
923
+ children: /* @__PURE__ */ n(H, { name: v.icon })
884
924
  },
885
- u.id
925
+ v.id
886
926
  );
887
927
  }),
888
928
  /* @__PURE__ */ n(
@@ -894,12 +934,12 @@ function At({
894
934
  "aria-label": b.rotate,
895
935
  title: b.rotate,
896
936
  disabled: !N,
897
- onClick: m,
937
+ onClick: h,
898
938
  children: /* @__PURE__ */ n(H, { name: "rotate" })
899
939
  }
900
940
  )
901
941
  ] }),
902
- /* @__PURE__ */ C("div", { className: "ds-group", role: "group", children: [
942
+ /* @__PURE__ */ x("div", { className: "ds-group", role: "group", children: [
903
943
  /* @__PURE__ */ n(
904
944
  "button",
905
945
  {
@@ -907,8 +947,8 @@ function At({
907
947
  className: "ds-btn ds-btn--icon",
908
948
  "aria-label": b.zoomOut,
909
949
  title: b.zoomOut,
910
- disabled: o <= Te,
911
- onClick: () => h(ze(o, -1)),
950
+ disabled: o <= Ee,
951
+ onClick: () => u(De(o, -1)),
912
952
  children: /* @__PURE__ */ n(H, { name: "minus" })
913
953
  }
914
954
  ),
@@ -919,7 +959,7 @@ function At({
919
959
  className: "ds-btn ds-btn--zoom",
920
960
  "aria-label": b.zoomReset,
921
961
  title: b.zoomReset,
922
- onClick: () => h(me),
962
+ onClick: () => u(fe),
923
963
  children: b.zoomValue(o)
924
964
  }
925
965
  ),
@@ -930,8 +970,8 @@ function At({
930
970
  className: "ds-btn ds-btn--icon",
931
971
  "aria-label": b.zoomIn,
932
972
  title: b.zoomIn,
933
- disabled: o >= Ee,
934
- onClick: () => h(ze(o, 1)),
973
+ disabled: o >= Re,
974
+ onClick: () => u(De(o, 1)),
935
975
  children: /* @__PURE__ */ n(H, { name: "plus" })
936
976
  }
937
977
  )
@@ -943,21 +983,21 @@ function At({
943
983
  className: "ds-btn ds-btn--icon",
944
984
  "aria-label": b.cleanReview,
945
985
  title: b.cleanReview,
946
- onClick: d,
986
+ onClick: c,
947
987
  children: /* @__PURE__ */ n(H, { name: "fullscreen" })
948
988
  }
949
989
  )
950
990
  ] }),
951
- /* @__PURE__ */ C("div", { className: "ds-topbar__tools", children: [
991
+ /* @__PURE__ */ x("div", { className: "ds-topbar__tools", children: [
952
992
  /* @__PURE__ */ n(
953
993
  "button",
954
994
  {
955
995
  type: "button",
956
996
  className: "ds-btn ds-btn--icon",
957
- "aria-label": L ? b.copied : b.copyLink,
958
- title: L ? b.copied : b.copyLink,
959
- onClick: w,
960
- children: /* @__PURE__ */ n(H, { name: L ? "check" : "link" })
997
+ "aria-label": $ ? b.copied : b.copyLink,
998
+ title: $ ? b.copied : b.copyLink,
999
+ onClick: P,
1000
+ children: /* @__PURE__ */ n(H, { name: $ ? "check" : "link" })
961
1001
  }
962
1002
  ),
963
1003
  /* @__PURE__ */ n(
@@ -967,71 +1007,71 @@ function At({
967
1007
  className: "ds-btn ds-btn--icon",
968
1008
  "aria-label": i === "dark" ? b.lightMode : b.darkMode,
969
1009
  title: i === "dark" ? b.lightMode : b.darkMode,
970
- onClick: f,
1010
+ onClick: g,
971
1011
  children: /* @__PURE__ */ n(H, { name: i === "dark" ? "sun" : "moon" })
972
1012
  }
973
1013
  ),
974
- l.length > 0 && /* @__PURE__ */ n(Dt, { issues: l })
1014
+ d.length > 0 && /* @__PURE__ */ n(Kt, { issues: d })
975
1015
  ] })
976
1016
  ] });
977
1017
  }
978
- function Dt({ issues: e }) {
979
- const t = J(), [s, o] = V(!1), r = q(null), i = e.filter((p) => p.level === "error").length, l = e.length - i, a = t.topbar.diagnostics(i, l);
1018
+ function Kt({ issues: e }) {
1019
+ const t = J(), [s, o] = V(!1), r = j(null), i = e.filter((w) => w.level === "error").length, d = e.length - i, l = t.topbar.diagnostics(i, d);
980
1020
  return I(() => {
981
1021
  if (!s) return;
982
- const p = (h) => {
983
- r.current?.contains(h.target) || o(!1);
984
- }, m = (h) => {
985
- h.key === "Escape" && o(!1);
1022
+ const w = (u) => {
1023
+ r.current?.contains(u.target) || o(!1);
1024
+ }, h = (u) => {
1025
+ u.key === "Escape" && o(!1);
986
1026
  };
987
- return window.addEventListener("pointerdown", p), window.addEventListener("keydown", m), () => {
988
- window.removeEventListener("pointerdown", p), window.removeEventListener("keydown", m);
1027
+ return window.addEventListener("pointerdown", w), window.addEventListener("keydown", h), () => {
1028
+ window.removeEventListener("pointerdown", w), window.removeEventListener("keydown", h);
989
1029
  };
990
- }, [s]), /* @__PURE__ */ C("div", { className: "ds-diagnostics", ref: r, children: [
991
- /* @__PURE__ */ C(
1030
+ }, [s]), /* @__PURE__ */ x("div", { className: "ds-diagnostics", ref: r, children: [
1031
+ /* @__PURE__ */ x(
992
1032
  "button",
993
1033
  {
994
1034
  type: "button",
995
1035
  className: "ds-btn ds-diagnostics__trigger",
996
1036
  "data-level": i > 0 ? "error" : "warning",
997
1037
  "aria-expanded": s,
998
- "aria-label": a,
999
- title: a,
1000
- onClick: () => o((p) => !p),
1038
+ "aria-label": l,
1039
+ title: l,
1040
+ onClick: () => o((w) => !w),
1001
1041
  children: [
1002
1042
  /* @__PURE__ */ n(H, { name: "alert" }),
1003
- /* @__PURE__ */ n("span", { children: i > 0 ? i : l })
1043
+ /* @__PURE__ */ n("span", { children: i > 0 ? i : d })
1004
1044
  ]
1005
1045
  }
1006
1046
  ),
1007
- s && /* @__PURE__ */ C("div", { className: "ds-diagnostics__popover", role: "dialog", "aria-label": t.diagnostics.title, children: [
1008
- /* @__PURE__ */ C("div", { className: "ds-diagnostics__head", children: [
1047
+ s && /* @__PURE__ */ x("div", { className: "ds-diagnostics__popover", role: "dialog", "aria-label": t.diagnostics.title, children: [
1048
+ /* @__PURE__ */ x("div", { className: "ds-diagnostics__head", children: [
1009
1049
  /* @__PURE__ */ n("strong", { children: t.diagnostics.title }),
1010
- /* @__PURE__ */ n("span", { className: "ds-muted", children: a })
1050
+ /* @__PURE__ */ n("span", { className: "ds-muted", children: l })
1011
1051
  ] }),
1012
- /* @__PURE__ */ n("ul", { className: "ds-diagnostics__list", children: e.map((p, m) => /* @__PURE__ */ C("li", { className: "ds-diagnostics__item", "data-level": p.level, children: [
1013
- /* @__PURE__ */ n("span", { className: "ds-diagnostics__level", children: p.level === "error" ? t.diagnostics.error : t.diagnostics.warning }),
1014
- /* @__PURE__ */ n("code", { className: "ds-diagnostics__where", children: p.where }),
1015
- /* @__PURE__ */ n("span", { className: "ds-diagnostics__message", children: p.message })
1016
- ] }, `${p.where}-${m}`)) })
1052
+ /* @__PURE__ */ n("ul", { className: "ds-diagnostics__list", children: e.map((w, h) => /* @__PURE__ */ x("li", { className: "ds-diagnostics__item", "data-level": w.level, children: [
1053
+ /* @__PURE__ */ n("span", { className: "ds-diagnostics__level", children: w.level === "error" ? t.diagnostics.error : t.diagnostics.warning }),
1054
+ /* @__PURE__ */ n("code", { className: "ds-diagnostics__where", children: w.where }),
1055
+ /* @__PURE__ */ n("span", { className: "ds-diagnostics__message", children: w.message })
1056
+ ] }, `${w.where}-${h}`)) })
1017
1057
  ] })
1018
1058
  ] });
1019
1059
  }
1020
- const Vt = 16;
1021
- function Xe({ side: e, label: t, value: s, onChange: o, onStart: r, onEnd: i }) {
1022
- const l = q(void 0), a = e === "left" ? 1 : -1, p = (f) => {
1023
- if (f.button === 0) {
1024
- f.preventDefault(), l.current = { x: f.clientX, width: s };
1060
+ const Ut = 16;
1061
+ function et({ side: e, label: t, value: s, onChange: o, onStart: r, onEnd: i }) {
1062
+ const d = j(void 0), l = e === "left" ? 1 : -1, w = (g) => {
1063
+ if (g.button === 0) {
1064
+ g.preventDefault(), d.current = { x: g.clientX, width: s };
1025
1065
  try {
1026
- f.currentTarget.setPointerCapture(f.pointerId);
1066
+ g.currentTarget.setPointerCapture(g.pointerId);
1027
1067
  } catch {
1028
1068
  }
1029
1069
  r?.();
1030
1070
  }
1031
- }, m = (f) => {
1032
- l.current && o(l.current.width + (f.clientX - l.current.x) * a);
1033
- }, h = () => {
1034
- l.current && (l.current = void 0, i?.());
1071
+ }, h = (g) => {
1072
+ d.current && o(d.current.width + (g.clientX - d.current.x) * l);
1073
+ }, u = () => {
1074
+ d.current && (d.current = void 0, i?.());
1035
1075
  };
1036
1076
  return /* @__PURE__ */ n(
1037
1077
  "div",
@@ -1043,98 +1083,98 @@ function Xe({ side: e, label: t, value: s, onChange: o, onStart: r, onEnd: i })
1043
1083
  "aria-label": t,
1044
1084
  "aria-valuenow": s,
1045
1085
  tabIndex: 0,
1046
- onPointerDown: p,
1047
- onPointerMove: m,
1048
- onPointerUp: h,
1049
- onPointerCancel: h,
1050
- onLostPointerCapture: h,
1051
- onKeyDown: (f) => {
1052
- if (f.key !== "ArrowLeft" && f.key !== "ArrowRight") return;
1053
- f.preventDefault();
1054
- const S = f.key === "ArrowRight" ? 1 : -1;
1055
- o(s + S * a * Vt);
1086
+ onPointerDown: w,
1087
+ onPointerMove: h,
1088
+ onPointerUp: u,
1089
+ onPointerCancel: u,
1090
+ onLostPointerCapture: u,
1091
+ onKeyDown: (g) => {
1092
+ if (g.key !== "ArrowLeft" && g.key !== "ArrowRight") return;
1093
+ g.preventDefault();
1094
+ const k = g.key === "ArrowRight" ? 1 : -1;
1095
+ o(s + k * l * Ut);
1056
1096
  }
1057
1097
  }
1058
1098
  );
1059
1099
  }
1060
- function Kt({
1100
+ function It({
1061
1101
  registry: e,
1062
1102
  handoff: t,
1063
1103
  activeScreen: s,
1064
1104
  activeComponent: o,
1065
1105
  onOpenScreen: r,
1066
1106
  onOpenComponent: i,
1067
- width: l,
1068
- onResize: a,
1069
- onResizeStart: p,
1070
- onResizeEnd: m
1107
+ width: d,
1108
+ onResize: l,
1109
+ onResizeStart: w,
1110
+ onResizeEnd: h
1071
1111
  }) {
1072
- const d = J().sidebar, [f, S] = V(""), [b, L] = V(() => /* @__PURE__ */ new Set()), T = q(null), N = e.screensFor({ handoff: t }), w = e.componentsFor(t), u = N.length > 0, k = w.length > 0, [g, y] = V(
1073
- () => o || !u ? "components" : "screens"
1112
+ const c = J().sidebar, [g, k] = V(""), [b, $] = V(() => /* @__PURE__ */ new Set()), R = j(null), N = e.screensFor({ handoff: t }), P = e.componentsFor(t), v = N.length > 0, p = P.length > 0, [f, S] = V(
1113
+ () => o || !v ? "components" : "screens"
1074
1114
  );
1075
1115
  I(() => {
1076
- o && k ? y("components") : s && u && y("screens");
1077
- }, [o, s, k, u]);
1078
- const _ = g;
1116
+ o && p ? S("components") : s && v && S("screens");
1117
+ }, [o, s, p, v]);
1118
+ const y = f;
1079
1119
  I(() => {
1080
- const E = (K) => {
1081
- Wt(K) && (K.preventDefault(), T.current?.focus(), T.current?.select());
1120
+ const _ = (K) => {
1121
+ Bt(K) && (K.preventDefault(), R.current?.focus(), R.current?.select());
1082
1122
  };
1083
- return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
1123
+ return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
1084
1124
  }, []);
1085
- const z = D(
1086
- () => e.searchScreens(f, { handoff: t }),
1087
- [t, f, e]
1088
- ), c = D(
1089
- () => e.searchComponents(f, t),
1090
- [t, f, e]
1091
- ), v = D(() => It(c, d.ungrouped), [c, d.ungrouped]), x = D(() => je(z), [z]), M = f.trim().length > 0, F = (E) => L((K) => {
1092
- const P = new Set(K);
1093
- return P.has(E) ? P.delete(E) : P.add(E), P;
1125
+ const T = D(
1126
+ () => e.searchScreens(g, { handoff: t }),
1127
+ [t, g, e]
1128
+ ), a = D(
1129
+ () => e.searchComponents(g, t),
1130
+ [t, g, e]
1131
+ ), m = D(() => Ht(a, c.ungrouped), [a, c.ungrouped]), C = D(() => Ge(T), [T]), L = g.trim().length > 0, O = (_) => $((K) => {
1132
+ const E = new Set(K);
1133
+ return E.has(_) ? E.delete(_) : E.add(_), E;
1094
1134
  });
1095
- return /* @__PURE__ */ C("nav", { className: "ds-sidebar", "aria-label": d.region, style: { width: l }, children: [
1096
- /* @__PURE__ */ C("div", { className: "ds-search", children: [
1135
+ return /* @__PURE__ */ x("nav", { className: "ds-sidebar", "aria-label": c.region, style: { width: d }, children: [
1136
+ /* @__PURE__ */ x("div", { className: "ds-search", children: [
1097
1137
  /* @__PURE__ */ n(H, { name: "search", size: 14 }),
1098
1138
  /* @__PURE__ */ n(
1099
1139
  "input",
1100
1140
  {
1101
- ref: T,
1141
+ ref: R,
1102
1142
  className: "ds-input ds-search__input",
1103
1143
  type: "search",
1104
- value: f,
1105
- placeholder: d.searchPlaceholder,
1106
- "aria-label": d.searchLabel,
1107
- onChange: (E) => S(E.target.value),
1108
- onKeyDown: (E) => {
1109
- E.key === "Escape" && S("");
1144
+ value: g,
1145
+ placeholder: c.searchPlaceholder,
1146
+ "aria-label": c.searchLabel,
1147
+ onChange: (_) => k(_.target.value),
1148
+ onKeyDown: (_) => {
1149
+ _.key === "Escape" && k("");
1110
1150
  }
1111
1151
  }
1112
1152
  ),
1113
- /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: d.searchShortcut })
1153
+ /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: c.searchShortcut })
1114
1154
  ] }),
1115
- /* @__PURE__ */ C("div", { className: "ds-tabs", role: "tablist", "aria-label": d.tabs, children: [
1155
+ /* @__PURE__ */ x("div", { className: "ds-tabs", role: "tablist", "aria-label": c.tabs, children: [
1116
1156
  /* @__PURE__ */ n(
1117
- Ae,
1157
+ Ve,
1118
1158
  {
1119
- selected: _ === "screens",
1120
- label: d.screensTab,
1121
- count: M ? z.length : void 0,
1122
- onSelect: () => y("screens")
1159
+ selected: y === "screens",
1160
+ label: c.screensTab,
1161
+ count: L ? T.length : void 0,
1162
+ onSelect: () => S("screens")
1123
1163
  }
1124
1164
  ),
1125
1165
  /* @__PURE__ */ n(
1126
- Ae,
1166
+ Ve,
1127
1167
  {
1128
- selected: _ === "components",
1129
- label: d.componentsTab,
1130
- count: M ? c.length : void 0,
1131
- onSelect: () => y("components")
1168
+ selected: y === "components",
1169
+ label: c.componentsTab,
1170
+ count: L ? a.length : void 0,
1171
+ onSelect: () => S("components")
1132
1172
  }
1133
1173
  )
1134
1174
  ] }),
1135
- /* @__PURE__ */ n("div", { className: "ds-sidebar__list", role: "tabpanel", children: _ === "screens" ? u ? z.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: d.noMatch(f) }) : x.map((E) => {
1136
- const K = /* @__PURE__ */ n("ul", { className: "ds-items", children: E.screens.map((A) => /* @__PURE__ */ n(
1137
- Ut,
1175
+ /* @__PURE__ */ n("div", { className: "ds-sidebar__list", role: "tabpanel", children: y === "screens" ? v ? T.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: c.noMatch(g) }) : C.map((_) => {
1176
+ const K = /* @__PURE__ */ n("ul", { className: "ds-items", children: _.screens.map((A) => /* @__PURE__ */ n(
1177
+ Wt,
1138
1178
  {
1139
1179
  screen: A,
1140
1180
  active: A.id === s && !o,
@@ -1142,76 +1182,76 @@ function Kt({
1142
1182
  },
1143
1183
  A.id
1144
1184
  )) });
1145
- if (E.name === void 0) return /* @__PURE__ */ n("div", { className: "ds-group-section", children: K }, "");
1146
- const P = `screens:${E.name}`, O = b.has(P) && !M;
1147
- return /* @__PURE__ */ C("section", { className: "ds-group-section", children: [
1148
- /* @__PURE__ */ C(
1185
+ if (_.name === void 0) return /* @__PURE__ */ n("div", { className: "ds-group-section", children: K }, "");
1186
+ const E = `screens:${_.name}`, z = b.has(E) && !L;
1187
+ return /* @__PURE__ */ x("section", { className: "ds-group-section", children: [
1188
+ /* @__PURE__ */ x(
1149
1189
  "button",
1150
1190
  {
1151
1191
  type: "button",
1152
1192
  className: "ds-group-section__head",
1153
- "aria-expanded": !O,
1154
- "aria-label": d.toggleGroup(E.name),
1155
- onClick: () => F(P),
1193
+ "aria-expanded": !z,
1194
+ "aria-label": c.toggleGroup(_.name),
1195
+ onClick: () => O(E),
1156
1196
  children: [
1157
1197
  /* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
1158
- /* @__PURE__ */ n("span", { children: E.name }),
1159
- /* @__PURE__ */ n("span", { className: "ds-count", children: E.screens.length })
1198
+ /* @__PURE__ */ n("span", { children: _.name }),
1199
+ /* @__PURE__ */ n("span", { className: "ds-count", children: _.screens.length })
1160
1200
  ]
1161
1201
  }
1162
1202
  ),
1163
- !O && K
1164
- ] }, P);
1165
- }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: d.emptyScreens }) : k ? c.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: d.noMatch(f) }) : v.map(({ group: E, items: K }) => {
1166
- const P = b.has(E) && !M;
1167
- return /* @__PURE__ */ C("section", { className: "ds-group-section", children: [
1168
- /* @__PURE__ */ C(
1203
+ !z && K
1204
+ ] }, E);
1205
+ }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: c.emptyScreens }) : p ? a.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-empty", children: c.noMatch(g) }) : m.map(({ group: _, items: K }) => {
1206
+ const E = b.has(_) && !L;
1207
+ return /* @__PURE__ */ x("section", { className: "ds-group-section", children: [
1208
+ /* @__PURE__ */ x(
1169
1209
  "button",
1170
1210
  {
1171
1211
  type: "button",
1172
1212
  className: "ds-group-section__head",
1173
- "aria-expanded": !P,
1174
- "aria-label": d.toggleGroup(E),
1175
- onClick: () => F(E),
1213
+ "aria-expanded": !E,
1214
+ "aria-label": c.toggleGroup(_),
1215
+ onClick: () => O(_),
1176
1216
  children: [
1177
1217
  /* @__PURE__ */ n(H, { name: "chevron", size: 12 }),
1178
- /* @__PURE__ */ n("span", { children: E }),
1218
+ /* @__PURE__ */ n("span", { children: _ }),
1179
1219
  /* @__PURE__ */ n("span", { className: "ds-count", children: K.length })
1180
1220
  ]
1181
1221
  }
1182
1222
  ),
1183
- !P && /* @__PURE__ */ n("ul", { className: "ds-items", children: K.map((O) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1223
+ !E && /* @__PURE__ */ n("ul", { className: "ds-items", children: K.map((z) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
1184
1224
  "button",
1185
1225
  {
1186
1226
  type: "button",
1187
1227
  className: "ds-item",
1188
- "aria-current": O.id === o ? "true" : void 0,
1189
- onClick: () => i(O.id),
1190
- children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: O.name })
1228
+ "aria-current": z.id === o ? "true" : void 0,
1229
+ onClick: () => i(z.id),
1230
+ children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: z.name })
1191
1231
  }
1192
- ) }, O.id)) })
1193
- ] }, E);
1194
- }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: d.emptyComponents }) }),
1232
+ ) }, z.id)) })
1233
+ ] }, _);
1234
+ }) : /* @__PURE__ */ n("p", { className: "ds-empty", children: c.emptyComponents }) }),
1195
1235
  /* @__PURE__ */ n(
1196
- Xe,
1236
+ et,
1197
1237
  {
1198
1238
  side: "left",
1199
- label: d.resize,
1200
- value: l,
1201
- onChange: a,
1202
- onStart: p,
1203
- onEnd: m
1239
+ label: c.resize,
1240
+ value: d,
1241
+ onChange: l,
1242
+ onStart: w,
1243
+ onEnd: h
1204
1244
  }
1205
1245
  )
1206
1246
  ] });
1207
1247
  }
1208
- function Ae({
1248
+ function Ve({
1209
1249
  selected: e,
1210
1250
  label: t,
1211
1251
  count: s,
1212
1252
  onSelect: o
1213
1253
  }) {
1214
- return /* @__PURE__ */ C(
1254
+ return /* @__PURE__ */ x(
1215
1255
  "button",
1216
1256
  {
1217
1257
  type: "button",
@@ -1227,12 +1267,12 @@ function Ae({
1227
1267
  }
1228
1268
  );
1229
1269
  }
1230
- function Ut({
1270
+ function Wt({
1231
1271
  screen: e,
1232
1272
  active: t,
1233
1273
  onOpen: s
1234
1274
  }) {
1235
- return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ C(
1275
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ x(
1236
1276
  "button",
1237
1277
  {
1238
1278
  type: "button",
@@ -1246,7 +1286,7 @@ function Ut({
1246
1286
  }
1247
1287
  ) });
1248
1288
  }
1249
- function It(e, t) {
1289
+ function Ht(e, t) {
1250
1290
  const s = /* @__PURE__ */ new Map();
1251
1291
  for (const o of e) {
1252
1292
  const r = o.group?.trim() || t, i = s.get(r) ?? [];
@@ -1254,10 +1294,10 @@ function It(e, t) {
1254
1294
  }
1255
1295
  return [...s].map(([o, r]) => ({ group: o, items: r }));
1256
1296
  }
1257
- function Wt(e) {
1297
+ function Bt(e) {
1258
1298
  return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "k";
1259
1299
  }
1260
- function Ht({
1300
+ function jt({
1261
1301
  screen: e,
1262
1302
  variations: t,
1263
1303
  components: s,
@@ -1265,49 +1305,49 @@ function Ht({
1265
1305
  labels: r,
1266
1306
  overrides: i
1267
1307
  }) {
1268
- const l = r.pr, a = [`## ${e.name}`, ""];
1269
- e.description && a.push(e.description, ""), a.push(`\`${e.route.path}\``, "");
1270
- const p = o.deploymentUrl ? `https://${o.deploymentUrl}` : void 0, m = o.shortCommit ? l.commit(o.shortCommit) : void 0;
1271
- if (a.push(`### ${l.variations}`, ""), t.length === 0) {
1272
- const h = new URL(e.href, o.origin);
1273
- ye(h.searchParams, i), a.push(`- [${r.panel.defaultVariation}](${h.toString()})`);
1308
+ const d = r.pr, l = [`## ${e.name}`, ""];
1309
+ e.description && l.push(e.description, ""), l.push(`\`${e.route.path}\``, "");
1310
+ const w = o.deploymentUrl ? `https://${o.deploymentUrl}` : void 0, h = o.shortCommit ? d.commit(o.shortCommit) : void 0;
1311
+ if (l.push(`### ${d.variations}`, ""), t.length === 0) {
1312
+ const u = new URL(e.href, o.origin);
1313
+ Ne(u.searchParams, i), l.push(`- [${r.panel.defaultVariation}](${u.toString()})`);
1274
1314
  }
1275
- for (const h of t) {
1276
- const d = pe(h, { origin: o.origin, overrides: i });
1277
- let f = `- [${Qe(h.title)}](${d})`;
1278
- if (p) {
1279
- const S = pe(h, { origin: p, overrides: i });
1280
- f += ` · [${m ?? l.immutableLink}](${S})`;
1281
- } else m && (f += ` · ${m}`);
1282
- a.push(f);
1315
+ for (const u of t) {
1316
+ const c = me(u, { origin: o.origin, overrides: i });
1317
+ let g = `- [${tt(u.title)}](${c})`;
1318
+ if (w) {
1319
+ const k = me(u, { origin: w, overrides: i });
1320
+ g += ` · [${h ?? d.immutableLink}](${k})`;
1321
+ } else h && (g += ` · ${h}`);
1322
+ l.push(g);
1283
1323
  }
1284
- if (a.push(""), s.length > 0) {
1285
- a.push(`### ${l.components}`, ""), a.push(`| ${l.component} | ${l.source} |`, "| --- | --- |");
1286
- for (const h of s) {
1287
- const d = h.source ? `\`${fe(h.source)}\`` : l.empty;
1288
- a.push(`| ${fe(h.name)} (\`${h.id}\`) | ${d} |`);
1324
+ if (l.push(""), s.length > 0) {
1325
+ l.push(`### ${d.components}`, ""), l.push(`| ${d.component} | ${d.source} |`, "| --- | --- |");
1326
+ for (const u of s) {
1327
+ const c = u.source ? `\`${we(u.source)}\`` : d.empty;
1328
+ l.push(`| ${we(u.name)} (\`${u.id}\`) | ${c} |`);
1289
1329
  }
1290
- a.push("");
1330
+ l.push("");
1291
1331
  }
1292
- a.push(`### ${l.expected}`, ""), t.length === 0 && a.push(`**${r.panel.defaultVariation}**`, "", l.noExpected, "");
1293
- for (const h of t) {
1294
- if (a.push(`**${h.title}**`, ""), h.expected?.length)
1295
- for (const d of h.expected) a.push(`- ${d}`);
1332
+ l.push(`### ${d.expected}`, ""), t.length === 0 && l.push(`**${r.panel.defaultVariation}**`, "", d.noExpected, "");
1333
+ for (const u of t) {
1334
+ if (l.push(`**${u.title}**`, ""), u.expected?.length)
1335
+ for (const c of u.expected) l.push(`- ${c}`);
1296
1336
  else
1297
- a.push(l.noExpected);
1298
- a.push("");
1337
+ l.push(d.noExpected);
1338
+ l.push("");
1299
1339
  }
1300
- return `${a.join(`
1340
+ return `${l.join(`
1301
1341
  `).trimEnd()}
1302
1342
  `;
1303
1343
  }
1304
- function fe(e) {
1344
+ function we(e) {
1305
1345
  return e.replace(/\|/g, "\\|").replace(/\n/g, " ");
1306
1346
  }
1307
- function Qe(e) {
1347
+ function tt(e) {
1308
1348
  return e.replace(/([[\]])/g, "\\$1");
1309
1349
  }
1310
- function Bt({
1350
+ function qt({
1311
1351
  flow: e,
1312
1352
  registry: t,
1313
1353
  open: s,
@@ -1315,116 +1355,116 @@ function Bt({
1315
1355
  labels: r,
1316
1356
  overrides: i
1317
1357
  }) {
1318
- const l = r.pr, a = [`## ${e.name}`, ""], p = o.deploymentUrl ? `https://${o.deploymentUrl}` : void 0, m = o.shortCommit ? l.commit(o.shortCommit) : void 0, h = (d, f) => {
1319
- if (s && s.screen.id === d.id) {
1320
- const L = new URL(s.location.path || "/", f), T = new URLSearchParams(s.location.search);
1321
- for (const N of wt) T.delete(N);
1322
- for (const [N, w] of T) L.searchParams.append(N, w);
1323
- return ye(L.searchParams, i), L.toString();
1358
+ const d = r.pr, l = [`## ${e.name}`, ""], w = o.deploymentUrl ? `https://${o.deploymentUrl}` : void 0, h = o.shortCommit ? d.commit(o.shortCommit) : void 0, u = (c, g) => {
1359
+ if (s && s.screen.id === c.id) {
1360
+ const $ = new URL(s.location.path || "/", g), R = new URLSearchParams(s.location.search);
1361
+ for (const N of gt) R.delete(N);
1362
+ for (const [N, P] of R) $.searchParams.append(N, P);
1363
+ return Ne($.searchParams, i), $.toString();
1324
1364
  }
1325
- const S = d.variations[0];
1326
- if (S) return pe(S, { origin: f, overrides: i });
1327
- const b = new URL(d.href, f);
1328
- return ye(b.searchParams, i), b.toString();
1365
+ const k = c.variations[0];
1366
+ if (k) return me(k, { origin: g, overrides: i });
1367
+ const b = new URL(c.href, g);
1368
+ return Ne(b.searchParams, i), b.toString();
1329
1369
  };
1330
- for (const d of e.screens) {
1331
- a.push(`### ${d.name}`, ""), d.description && a.push(d.description, "");
1332
- let f = `\`${d.route.path}\` · [${l.open}](${h(d, o.origin)})`;
1333
- if (p ? f += ` · [${m ?? l.immutableLink}](${h(d, p)})` : m && (f += ` · ${m}`), a.push(f, ""), d.controls.length > 0) {
1334
- a.push(`**${l.controls}**`, "");
1335
- for (const N of d.controls) {
1336
- a.push(`- ${ce(N.title)} (\`${N.id}\`)`);
1337
- for (const w of N.controls) {
1338
- const u = be(w), k = w.options.map(
1339
- (g) => g.value === u ? `${ce(g.label)} (\`${g.value}\`, ${l.defaultOption})` : `${ce(g.label)} (\`${g.value}\`)`
1370
+ for (const c of e.screens) {
1371
+ l.push(`### ${c.name}`, ""), c.description && l.push(c.description, "");
1372
+ let g = `\`${c.route.path}\` · [${d.open}](${u(c, o.origin)})`;
1373
+ if (w ? g += ` · [${h ?? d.immutableLink}](${u(c, w)})` : h && (g += ` · ${h}`), l.push(g, ""), c.controls.length > 0) {
1374
+ l.push(`**${d.controls}**`, "");
1375
+ for (const N of c.controls) {
1376
+ l.push(`- ${le(N.title)} (\`${N.id}\`)`);
1377
+ for (const P of N.controls) {
1378
+ const v = Se(P), p = P.options.map(
1379
+ (f) => f.value === v ? `${le(f.label)} (\`${f.value}\`, ${d.defaultOption})` : `${le(f.label)} (\`${f.value}\`)`
1340
1380
  ).join(" · ");
1341
- a.push(` - ${ce(w.label)} (\`c.${w.id}\`): ${k}`);
1381
+ l.push(` - ${le(P.label)} (\`c.${P.id}\`): ${p}`);
1342
1382
  }
1343
1383
  }
1344
- a.push("");
1384
+ l.push("");
1345
1385
  }
1346
- if (d.variations.length > 0) {
1347
- a.push(`**${l.shortcuts}**`, "");
1348
- for (const N of d.variations)
1349
- a.push(
1350
- `- [${Qe(N.title)}](${pe(N, { origin: o.origin, overrides: i })})`
1386
+ if (c.variations.length > 0) {
1387
+ l.push(`**${d.shortcuts}**`, "");
1388
+ for (const N of c.variations)
1389
+ l.push(
1390
+ `- [${tt(N.title)}](${me(N, { origin: o.origin, overrides: i })})`
1351
1391
  );
1352
- a.push("");
1392
+ l.push("");
1353
1393
  }
1354
- a.push(`**${l.expected}**`, "");
1355
- const S = s?.screen.id === d.id ? s.variation : void 0, b = S?.expected?.length ? S.expected : d.route.expected, L = d.variations.filter(
1356
- (N) => N.expected?.length && N.id !== S?.id
1394
+ l.push(`**${d.expected}**`, "");
1395
+ const k = s?.screen.id === c.id ? s.variation : void 0, b = k?.expected?.length ? k.expected : c.route.expected, $ = c.variations.filter(
1396
+ (N) => N.expected?.length && N.id !== k?.id
1357
1397
  );
1358
- if (!b?.length && L.length === 0 && a.push(l.noExpected, ""), b?.length) {
1359
- for (const N of b) a.push(`- ${N}`);
1360
- a.push("");
1398
+ if (!b?.length && $.length === 0 && l.push(d.noExpected, ""), b?.length) {
1399
+ for (const N of b) l.push(`- ${N}`);
1400
+ l.push("");
1361
1401
  }
1362
- for (const N of L) {
1363
- a.push(`*${N.title}*`, "");
1364
- for (const w of N.expected ?? []) a.push(`- ${w}`);
1365
- a.push("");
1402
+ for (const N of $) {
1403
+ l.push(`*${N.title}*`, "");
1404
+ for (const P of N.expected ?? []) l.push(`- ${P}`);
1405
+ l.push("");
1366
1406
  }
1367
- const T = t.componentsOfScreen(d);
1368
- if (T.length > 0) {
1369
- a.push(`**${l.components}**`, ""), a.push(`| ${l.component} | ${l.source} |`, "| --- | --- |");
1370
- for (const N of T) {
1371
- const w = N.source ? `\`${fe(N.source)}\`` : l.empty;
1372
- a.push(`| ${fe(N.name)} (\`${N.id}\`) | ${w} |`);
1407
+ const R = t.componentsOfScreen(c);
1408
+ if (R.length > 0) {
1409
+ l.push(`**${d.components}**`, ""), l.push(`| ${d.component} | ${d.source} |`, "| --- | --- |");
1410
+ for (const N of R) {
1411
+ const P = N.source ? `\`${we(N.source)}\`` : d.empty;
1412
+ l.push(`| ${we(N.name)} (\`${N.id}\`) | ${P} |`);
1373
1413
  }
1374
- a.push("");
1414
+ l.push("");
1375
1415
  }
1376
1416
  }
1377
- return `${a.join(`
1417
+ return `${l.join(`
1378
1418
  `).trimEnd()}
1379
1419
  `;
1380
1420
  }
1381
- function ce(e) {
1421
+ function le(e) {
1382
1422
  return e.replace(/([*_[\]`])/g, "\\$1");
1383
1423
  }
1384
- function jt(e) {
1385
- const { tab: t, onTab: s, width: o, onResize: r, onResizeStart: i, onResizeEnd: l } = e, a = J().panel, [p, m] = V(""), h = q(null), d = q(null), [f, S] = V(!1), [b, L] = V(() => /* @__PURE__ */ new Set()), T = (w) => L((u) => {
1386
- const k = new Set(u);
1387
- return k.has(w) ? k.delete(w) : k.add(w), k;
1388
- }), N = p.trim().length > 0;
1424
+ function Gt(e) {
1425
+ const { tab: t, onTab: s, width: o, onResize: r, onResizeStart: i, onResizeEnd: d } = e, l = J().panel, [w, h] = V(""), u = j(null), c = j(null), [g, k] = V(!1), [b, $] = V(() => /* @__PURE__ */ new Set()), R = (P) => $((v) => {
1426
+ const p = new Set(v);
1427
+ return p.has(P) ? p.delete(P) : p.add(P), p;
1428
+ }), N = w.trim().length > 0;
1389
1429
  return I(() => {
1390
- const w = (u) => {
1391
- Zt(u) && (u.preventDefault(), h.current?.focus(), h.current?.select());
1430
+ const P = (v) => {
1431
+ Qt(v) && (v.preventDefault(), u.current?.focus(), u.current?.select());
1392
1432
  };
1393
- return window.addEventListener("keydown", w), () => window.removeEventListener("keydown", w);
1394
- }, []), Ue(() => {
1395
- S(Yt(d.current, p));
1396
- }), /* @__PURE__ */ C("aside", { className: "ds-panel", "aria-label": a.region, style: { width: o }, children: [
1433
+ return window.addEventListener("keydown", P), () => window.removeEventListener("keydown", P);
1434
+ }, []), We(() => {
1435
+ k(Xt(c.current, w));
1436
+ }), /* @__PURE__ */ x("aside", { className: "ds-panel", "aria-label": l.region, style: { width: o }, children: [
1397
1437
  /* @__PURE__ */ n(
1398
- Xe,
1438
+ et,
1399
1439
  {
1400
1440
  side: "right",
1401
- label: a.resize,
1441
+ label: l.resize,
1402
1442
  value: o,
1403
1443
  onChange: r,
1404
1444
  onStart: i,
1405
- onEnd: l
1445
+ onEnd: d
1406
1446
  }
1407
1447
  ),
1408
- /* @__PURE__ */ C("div", { className: "ds-search", children: [
1448
+ /* @__PURE__ */ x("div", { className: "ds-search", children: [
1409
1449
  /* @__PURE__ */ n(H, { name: "search", size: 14 }),
1410
1450
  /* @__PURE__ */ n(
1411
1451
  "input",
1412
1452
  {
1413
- ref: h,
1453
+ ref: u,
1414
1454
  className: "ds-input ds-search__input",
1415
1455
  type: "search",
1416
- value: p,
1417
- placeholder: a.searchPlaceholder,
1418
- "aria-label": a.searchLabel,
1419
- onChange: (w) => m(w.target.value),
1420
- onKeyDown: (w) => {
1421
- w.key === "Escape" && m("");
1456
+ value: w,
1457
+ placeholder: l.searchPlaceholder,
1458
+ "aria-label": l.searchLabel,
1459
+ onChange: (P) => h(P.target.value),
1460
+ onKeyDown: (P) => {
1461
+ P.key === "Escape" && h("");
1422
1462
  }
1423
1463
  }
1424
1464
  ),
1425
- /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: a.searchShortcut })
1465
+ /* @__PURE__ */ n("kbd", { className: "ds-kbd", "aria-hidden": "true", children: l.searchShortcut })
1426
1466
  ] }),
1427
- /* @__PURE__ */ C("div", { className: "ds-tabs", role: "tablist", "aria-label": a.tabs, children: [
1467
+ /* @__PURE__ */ x("div", { className: "ds-tabs", role: "tablist", "aria-label": l.tabs, children: [
1428
1468
  /* @__PURE__ */ n(
1429
1469
  "button",
1430
1470
  {
@@ -1434,7 +1474,7 @@ function jt(e) {
1434
1474
  "aria-selected": t === "variations",
1435
1475
  tabIndex: t === "variations" ? 0 : -1,
1436
1476
  onClick: () => s("variations"),
1437
- children: a.variationsTab
1477
+ children: l.variationsTab
1438
1478
  }
1439
1479
  ),
1440
1480
  /* @__PURE__ */ n(
@@ -1446,146 +1486,146 @@ function jt(e) {
1446
1486
  "aria-selected": t === "info",
1447
1487
  tabIndex: t === "info" ? 0 : -1,
1448
1488
  onClick: () => s("info"),
1449
- children: a.infoTab
1489
+ children: l.infoTab
1450
1490
  }
1451
1491
  )
1452
1492
  ] }),
1453
- /* @__PURE__ */ C("div", { className: "ds-panel__body", role: "tabpanel", ref: d, children: [
1454
- t === "variations" ? /* @__PURE__ */ n(qt, { ...e, collapsed: b, onToggle: T, filtering: N }) : /* @__PURE__ */ n(Gt, { ...e }),
1455
- f && /* @__PURE__ */ n("p", { className: "ds-empty", children: a.noMatch(p) })
1493
+ /* @__PURE__ */ x("div", { className: "ds-panel__body", role: "tabpanel", ref: c, children: [
1494
+ t === "variations" ? /* @__PURE__ */ n(Zt, { ...e, collapsed: b, onToggle: R, filtering: N }) : /* @__PURE__ */ n(Yt, { ...e }),
1495
+ g && /* @__PURE__ */ n("p", { className: "ds-empty", children: l.noMatch(w) })
1456
1496
  ] })
1457
1497
  ] });
1458
1498
  }
1459
- function qt({
1499
+ function Zt({
1460
1500
  registry: e,
1461
1501
  controls: t,
1462
1502
  screen: s,
1463
1503
  variation: o,
1464
1504
  component: r,
1465
1505
  componentFixture: i,
1466
- onOpenScenario: l,
1467
- onOpenComponent: a,
1468
- onChange: p
1506
+ onOpenScenario: d,
1507
+ onOpenComponent: l,
1508
+ onChange: w
1469
1509
  }) {
1470
- const m = J(), h = m.panel;
1510
+ const h = J(), u = h.panel;
1471
1511
  if (r) {
1472
- const u = r.fixtures ?? [];
1473
- if (u.length === 0) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.noComponentVariations });
1474
- const k = i.fixture;
1475
- return /* @__PURE__ */ C("div", { className: "ds-vcards", children: [
1476
- i.didFallback && i.requestedId && k && /* @__PURE__ */ n("p", { className: "ds-notice", children: h.fixtureFallback(i.requestedId, k.id) }),
1477
- /* @__PURE__ */ n(le, { title: r.name, hint: k?.description, children: /* @__PURE__ */ n(
1512
+ const v = r.fixtures ?? [];
1513
+ if (v.length === 0) return /* @__PURE__ */ n("p", { className: "ds-empty", children: u.noComponentVariations });
1514
+ const p = i.fixture;
1515
+ return /* @__PURE__ */ x("div", { className: "ds-vcards", children: [
1516
+ i.didFallback && i.requestedId && p && /* @__PURE__ */ n("p", { className: "ds-notice", children: u.fixtureFallback(i.requestedId, p.id) }),
1517
+ /* @__PURE__ */ n(de, { title: r.name, hint: p?.description, children: /* @__PURE__ */ n(
1478
1518
  ee,
1479
1519
  {
1480
- label: h.componentVariations,
1481
- value: k?.id ?? "",
1482
- options: u.map((g) => ({ value: g.id, label: g.label })),
1483
- onChange: (g) => p({ fixture: g })
1520
+ label: u.componentVariations,
1521
+ value: p?.id ?? "",
1522
+ options: v.map((f) => ({ value: f.id, label: f.label })),
1523
+ onChange: (f) => w({ fixture: f })
1484
1524
  }
1485
1525
  ) })
1486
1526
  ] });
1487
1527
  }
1488
- if (!s) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.nothingSelected });
1489
- const d = s.variations, f = e.product, S = f.theme?.modes ?? [], b = f.theme?.locales ?? [], L = f.dataSources?.adapters ?? [], T = t.screenControls ?? {}, N = o && xt(o, T) ? o : void 0, w = (u, k) => p({ screenControls: { ...T, [u]: k } });
1490
- return /* @__PURE__ */ C("div", { className: "ds-vcards", children: [
1491
- /* @__PURE__ */ C(le, { title: h.context, children: [
1528
+ if (!s) return /* @__PURE__ */ n("p", { className: "ds-empty", children: u.nothingSelected });
1529
+ const c = s.variations, g = e.product, k = g.theme?.modes ?? [], b = g.theme?.locales ?? [], $ = g.dataSources?.adapters ?? [], R = t.screenControls ?? {}, N = o && Nt(o, R) ? o : void 0, P = (v, p) => w({ screenControls: { ...R, [v]: p } });
1530
+ return /* @__PURE__ */ x("div", { className: "ds-vcards", children: [
1531
+ /* @__PURE__ */ x(de, { title: u.context, children: [
1492
1532
  /* @__PURE__ */ n(
1493
1533
  ee,
1494
1534
  {
1495
- label: h.persona,
1535
+ label: u.persona,
1496
1536
  value: t.persona ?? "",
1497
1537
  options: [
1498
1538
  // Com persona padrão, "nenhuma" não é uma situação possível.
1499
- ...e.defaultPersona ? [] : [{ value: "", label: h.none }],
1500
- ...f.personas.map((u) => ({ value: u.id, label: u.name }))
1539
+ ...e.defaultPersona ? [] : [{ value: "", label: u.none }],
1540
+ ...g.personas.map((v) => ({ value: v.id, label: v.name }))
1501
1541
  ],
1502
- onChange: (u) => p({ persona: u || void 0 })
1542
+ onChange: (v) => w({ persona: v || void 0 })
1503
1543
  }
1504
1544
  ),
1505
1545
  /* @__PURE__ */ n(
1506
1546
  ee,
1507
1547
  {
1508
- label: h.network,
1548
+ label: u.network,
1509
1549
  value: t.network,
1510
- options: He.map((u) => ({ value: u, label: m.network[u] })),
1511
- onChange: (u) => p({ network: u })
1550
+ options: je.map((v) => ({ value: v, label: h.network[v] })),
1551
+ onChange: (v) => w({ network: v })
1512
1552
  }
1513
1553
  ),
1514
- S.length > 1 && /* @__PURE__ */ n(
1554
+ k.length > 1 && /* @__PURE__ */ n(
1515
1555
  ee,
1516
1556
  {
1517
- label: h.theme,
1518
- value: t.themeMode ?? S[0],
1519
- options: S.map((u) => ({ value: u, label: u })),
1520
- onChange: (u) => p({ themeMode: u })
1557
+ label: u.theme,
1558
+ value: t.themeMode ?? k[0],
1559
+ options: k.map((v) => ({ value: v, label: v })),
1560
+ onChange: (v) => w({ themeMode: v })
1521
1561
  }
1522
1562
  ),
1523
1563
  b.length > 1 && /* @__PURE__ */ n(
1524
1564
  ee,
1525
1565
  {
1526
- label: h.locale,
1566
+ label: u.locale,
1527
1567
  value: t.locale ?? b[0],
1528
- options: b.map((u) => ({ value: u, label: u })),
1529
- onChange: (u) => p({ locale: u })
1568
+ options: b.map((v) => ({ value: v, label: v })),
1569
+ onChange: (v) => w({ locale: v })
1530
1570
  }
1531
1571
  ),
1532
- L.length > 0 && /* @__PURE__ */ n(
1572
+ $.length > 0 && /* @__PURE__ */ n(
1533
1573
  ee,
1534
1574
  {
1535
- label: h.dataSource,
1575
+ label: u.dataSource,
1536
1576
  value: t.dataSource ?? "fixtures",
1537
1577
  options: [
1538
- { value: "fixtures", label: h.fixturesOption },
1539
- ...L.map((u) => ({ value: u.id, label: u.label }))
1578
+ { value: "fixtures", label: u.fixturesOption },
1579
+ ...$.map((v) => ({ value: v.id, label: v.label }))
1540
1580
  ],
1541
- onChange: (u) => p({ dataSource: u })
1581
+ onChange: (v) => w({ dataSource: v })
1542
1582
  }
1543
1583
  )
1544
1584
  ] }),
1545
- s.controls.map((u) => {
1546
- const k = e.component(u.component);
1585
+ s.controls.map((v) => {
1586
+ const p = e.component(v.component);
1547
1587
  return /* @__PURE__ */ n(
1548
- le,
1588
+ de,
1549
1589
  {
1550
- title: u.title,
1551
- hint: u.note,
1552
- link: k ? { label: h.openComponent(k.name), onOpen: () => a(k.id) } : void 0,
1553
- children: u.controls.map((g) => /* @__PURE__ */ n(
1590
+ title: v.title,
1591
+ hint: v.note,
1592
+ link: p ? { label: u.openComponent(p.name), onOpen: () => l(p.id) } : void 0,
1593
+ children: v.controls.map((f) => /* @__PURE__ */ n(
1554
1594
  ee,
1555
1595
  {
1556
- label: g.label,
1557
- hint: g.description,
1558
- value: T[g.id] ?? be(g),
1559
- options: g.options ?? [],
1560
- onChange: (y) => w(g.id, y)
1596
+ label: f.label,
1597
+ hint: f.description,
1598
+ value: R[f.id] ?? Se(f),
1599
+ options: f.options ?? [],
1600
+ onChange: (S) => P(f.id, S)
1561
1601
  },
1562
- g.id
1602
+ f.id
1563
1603
  ))
1564
1604
  },
1565
- u.id
1605
+ v.id
1566
1606
  );
1567
1607
  }),
1568
- d.length > 0 && /* @__PURE__ */ n(le, { title: h.shortcuts, children: /* @__PURE__ */ n("ul", { className: "ds-items", "aria-label": h.variationsList, children: d.map((u) => /* @__PURE__ */ n("li", { "data-ds-filter": !0, children: /* @__PURE__ */ n(
1608
+ c.length > 0 && /* @__PURE__ */ n(de, { title: u.shortcuts, children: /* @__PURE__ */ n("ul", { className: "ds-items", "aria-label": u.variationsList, children: c.map((v) => /* @__PURE__ */ n("li", { "data-ds-filter": !0, children: /* @__PURE__ */ n(
1569
1609
  "button",
1570
1610
  {
1571
1611
  type: "button",
1572
1612
  className: "ds-item",
1573
- title: u.intent,
1574
- "aria-current": N?.id === u.id ? "true" : void 0,
1575
- onClick: () => l(u.id),
1576
- children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: u.title })
1613
+ title: v.intent,
1614
+ "aria-current": N?.id === v.id ? "true" : void 0,
1615
+ onClick: () => d(v.id),
1616
+ children: /* @__PURE__ */ n("span", { className: "ds-item__title", children: v.title })
1577
1617
  }
1578
- ) }, u.id)) }) })
1618
+ ) }, v.id)) }) })
1579
1619
  ] });
1580
1620
  }
1581
- function le({
1621
+ function de({
1582
1622
  title: e,
1583
1623
  hint: t,
1584
1624
  link: s,
1585
1625
  children: o
1586
1626
  }) {
1587
- return /* @__PURE__ */ C("section", { className: "ds-vcard", "data-ds-filter-group": !0, children: [
1588
- /* @__PURE__ */ C("header", { className: "ds-vcard__head", title: t ? `${e} — ${t}` : e, children: [
1627
+ return /* @__PURE__ */ x("section", { className: "ds-vcard", "data-ds-filter-group": !0, children: [
1628
+ /* @__PURE__ */ x("header", { className: "ds-vcard__head", title: t ? `${e} — ${t}` : e, children: [
1589
1629
  /* @__PURE__ */ n("h3", { className: "ds-vcard__title ds-section__title", "data-ds-filter-title": !0, children: e }),
1590
1630
  s && /* @__PURE__ */ n(
1591
1631
  "button",
@@ -1609,234 +1649,234 @@ function ee({
1609
1649
  options: o,
1610
1650
  onChange: r
1611
1651
  }) {
1612
- return /* @__PURE__ */ C("label", { className: "ds-vcard__field", "data-ds-filter": !0, title: t ? `${e} — ${t}` : e, children: [
1652
+ return /* @__PURE__ */ x("label", { className: "ds-vcard__field", "data-ds-filter": !0, title: t ? `${e} — ${t}` : e, children: [
1613
1653
  /* @__PURE__ */ n("span", { className: "ds-visually-hidden", children: e }),
1614
1654
  /* @__PURE__ */ n("select", { className: "ds-select", value: s, onChange: (i) => r(i.target.value), children: o.map((i) => /* @__PURE__ */ n("option", { value: i.value, children: i.label }, i.value)) })
1615
1655
  ] });
1616
1656
  }
1617
- function Gt({
1657
+ function Yt({
1618
1658
  registry: e,
1619
1659
  controls: t,
1620
1660
  deploy: s,
1621
1661
  location: o,
1622
1662
  screen: r,
1623
1663
  variation: i,
1624
- component: l,
1625
- onOpenScenario: a,
1626
- onOpenComponent: p,
1627
- onOpenScreen: m
1664
+ component: d,
1665
+ onOpenScenario: l,
1666
+ onOpenComponent: w,
1667
+ onOpenScreen: h
1628
1668
  }) {
1629
- const h = J(), d = h.info, [f, S] = V(!1);
1630
- if (l) {
1631
- const g = e.usagesOf(l.id, { handoff: t.handoff });
1632
- return /* @__PURE__ */ C("div", { className: "ds-info", children: [
1633
- /* @__PURE__ */ C(te, { title: d.component, children: [
1634
- /* @__PURE__ */ n(W, { term: d.name, children: l.name }),
1635
- /* @__PURE__ */ n(W, { term: d.id, children: /* @__PURE__ */ n("code", { children: l.id }) }),
1636
- l.group && /* @__PURE__ */ n(W, { term: d.group, children: l.group }),
1637
- l.description && /* @__PURE__ */ n(W, { term: d.description, children: l.description }),
1638
- l.source && /* @__PURE__ */ n(W, { term: d.source, children: /* @__PURE__ */ n("code", { children: l.source }) })
1669
+ const u = J(), c = u.info, [g, k] = V(!1);
1670
+ if (d) {
1671
+ const f = e.usagesOf(d.id, { handoff: t.handoff });
1672
+ return /* @__PURE__ */ x("div", { className: "ds-info", children: [
1673
+ /* @__PURE__ */ x(te, { title: c.component, children: [
1674
+ /* @__PURE__ */ n(W, { term: c.name, children: d.name }),
1675
+ /* @__PURE__ */ n(W, { term: c.id, children: /* @__PURE__ */ n("code", { children: d.id }) }),
1676
+ d.group && /* @__PURE__ */ n(W, { term: c.group, children: d.group }),
1677
+ d.description && /* @__PURE__ */ n(W, { term: c.description, children: d.description }),
1678
+ d.source && /* @__PURE__ */ n(W, { term: c.source, children: /* @__PURE__ */ n("code", { children: d.source }) })
1639
1679
  ] }),
1640
- /* @__PURE__ */ n(te, { title: d.usedIn, children: g.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-muted", children: d.notUsed }) : /* @__PURE__ */ n("ul", { className: "ds-links", children: g.map((y) => {
1641
- const _ = y.variations.find((z) => z.components?.includes(l.id)) ?? y.variations[0];
1642
- return /* @__PURE__ */ C("li", { "data-ds-filter": !0, children: [
1680
+ /* @__PURE__ */ n(te, { title: c.usedIn, children: f.length === 0 ? /* @__PURE__ */ n("p", { className: "ds-muted", children: c.notUsed }) : /* @__PURE__ */ n("ul", { className: "ds-links", children: f.map((S) => {
1681
+ const y = S.variations.find((T) => T.components?.includes(d.id)) ?? S.variations[0];
1682
+ return /* @__PURE__ */ x("li", { "data-ds-filter": !0, children: [
1643
1683
  /* @__PURE__ */ n(
1644
1684
  "button",
1645
1685
  {
1646
1686
  type: "button",
1647
1687
  className: "ds-link",
1648
- onClick: () => _ ? a(_.id) : m?.(y.id),
1649
- children: y.name
1688
+ onClick: () => y ? l(y.id) : h?.(S.id),
1689
+ children: S.name
1650
1690
  }
1651
1691
  ),
1652
- /* @__PURE__ */ n("code", { className: "ds-muted", children: y.id })
1653
- ] }, y.id);
1692
+ /* @__PURE__ */ n("code", { className: "ds-muted", children: S.id })
1693
+ ] }, S.id);
1654
1694
  }) }) })
1655
1695
  ] });
1656
1696
  }
1657
- if (!r) return /* @__PURE__ */ n("p", { className: "ds-empty", children: h.panel.nothingSelected });
1658
- const b = i ? e.componentsOfScreen(r, i) : e.componentsOfScreen(r), L = e.persona(t.persona ?? i?.persona), T = e.rulesOf(i), N = t.screenControls ?? {}, w = i?.expected?.length ? i.expected : r.route.expected, u = t.handoff ? { handoff: t.handoff } : void 0, k = async () => {
1659
- const g = r.group ? e.flowOf(r, { handoff: t.handoff }) : void 0, y = g?.name ? Bt({
1660
- flow: { name: g.name, screens: g.screens },
1697
+ if (!r) return /* @__PURE__ */ n("p", { className: "ds-empty", children: u.panel.nothingSelected });
1698
+ const b = i ? e.componentsOfScreen(r, i) : e.componentsOfScreen(r), $ = e.persona(t.persona ?? i?.persona), R = e.rulesOf(i), N = t.screenControls ?? {}, P = i?.expected?.length ? i.expected : r.route.expected, v = t.handoff ? { handoff: t.handoff } : void 0, p = async () => {
1699
+ const f = r.group ? e.flowOf(r, { handoff: t.handoff }) : void 0, S = f?.name ? qt({
1700
+ flow: { name: f.name, screens: f.screens },
1661
1701
  registry: e,
1662
1702
  open: { screen: r, location: o, variation: i },
1663
1703
  deploy: s,
1664
- labels: h,
1665
- overrides: u
1666
- }) : Ht({
1704
+ labels: u,
1705
+ overrides: v
1706
+ }) : jt({
1667
1707
  screen: r,
1668
1708
  variations: r.variations,
1669
1709
  components: e.componentsOfScreen(r),
1670
1710
  deploy: s,
1671
- labels: h,
1672
- overrides: u
1711
+ labels: u,
1712
+ overrides: v
1673
1713
  });
1674
1714
  try {
1675
- await navigator.clipboard.writeText(y);
1715
+ await navigator.clipboard.writeText(S);
1676
1716
  } catch {
1677
- window.prompt(d.copyPrompt, y);
1717
+ window.prompt(c.copyPrompt, S);
1678
1718
  }
1679
- S(!0), window.setTimeout(() => S(!1), 1600);
1719
+ k(!0), window.setTimeout(() => k(!1), 1600);
1680
1720
  };
1681
- return /* @__PURE__ */ C("div", { className: "ds-info", children: [
1682
- /* @__PURE__ */ C(te, { title: d.screen, children: [
1683
- /* @__PURE__ */ n(W, { term: d.name, children: r.name }),
1684
- /* @__PURE__ */ n(W, { term: d.route, children: /* @__PURE__ */ n("code", { children: r.route.path }) }),
1685
- r.group && /* @__PURE__ */ n(W, { term: d.flow, children: r.group }),
1686
- r.description && /* @__PURE__ */ n(W, { term: d.description, children: r.description }),
1687
- /* @__PURE__ */ n(de, { term: d.expected, items: w })
1721
+ return /* @__PURE__ */ x("div", { className: "ds-info", children: [
1722
+ /* @__PURE__ */ x(te, { title: c.screen, children: [
1723
+ /* @__PURE__ */ n(W, { term: c.name, children: r.name }),
1724
+ /* @__PURE__ */ n(W, { term: c.route, children: /* @__PURE__ */ n("code", { children: r.route.path }) }),
1725
+ r.group && /* @__PURE__ */ n(W, { term: c.flow, children: r.group }),
1726
+ r.description && /* @__PURE__ */ n(W, { term: c.description, children: r.description }),
1727
+ /* @__PURE__ */ n(ue, { term: c.expected, items: P })
1688
1728
  ] }),
1689
- r.controls.length > 0 && /* @__PURE__ */ n(te, { title: d.controls, children: r.controls.flatMap(
1690
- (g) => g.controls.map((y) => {
1691
- const _ = N[y.id] ?? be(y), z = y.options.find((c) => c.value === _);
1692
- return /* @__PURE__ */ C(W, { term: y.label, children: [
1693
- z?.label ?? _,
1729
+ r.controls.length > 0 && /* @__PURE__ */ n(te, { title: c.controls, children: r.controls.flatMap(
1730
+ (f) => f.controls.map((S) => {
1731
+ const y = N[S.id] ?? Se(S), T = S.options.find((a) => a.value === y);
1732
+ return /* @__PURE__ */ x(W, { term: S.label, children: [
1733
+ T?.label ?? y,
1694
1734
  " ",
1695
- /* @__PURE__ */ n("code", { children: `c.${y.id}=${_}` })
1696
- ] }, `${g.id}/${y.id}`);
1735
+ /* @__PURE__ */ n("code", { children: `c.${S.id}=${y}` })
1736
+ ] }, `${f.id}/${S.id}`);
1697
1737
  })
1698
1738
  ) }),
1699
- i && /* @__PURE__ */ C(te, { title: d.variation, children: [
1700
- /* @__PURE__ */ n(W, { term: d.name, children: i.title }),
1701
- /* @__PURE__ */ n(W, { term: d.id, children: /* @__PURE__ */ n("code", { children: i.id }) }),
1702
- L && /* @__PURE__ */ n(W, { term: d.persona, children: L.name }),
1703
- i.intent && /* @__PURE__ */ n(W, { term: d.intent, children: i.intent }),
1704
- /* @__PURE__ */ n(de, { term: d.preconditions, items: i.preconditions }),
1705
- /* @__PURE__ */ n(de, { term: d.actions, items: i.actions }),
1706
- /* @__PURE__ */ n(de, { term: d.rules, items: T.map((g) => g.statement) }),
1707
- i.ticket && /* @__PURE__ */ n(W, { term: d.ticket, children: /* @__PURE__ */ n("code", { children: i.ticket }) })
1739
+ i && /* @__PURE__ */ x(te, { title: c.variation, children: [
1740
+ /* @__PURE__ */ n(W, { term: c.name, children: i.title }),
1741
+ /* @__PURE__ */ n(W, { term: c.id, children: /* @__PURE__ */ n("code", { children: i.id }) }),
1742
+ $ && /* @__PURE__ */ n(W, { term: c.persona, children: $.name }),
1743
+ i.intent && /* @__PURE__ */ n(W, { term: c.intent, children: i.intent }),
1744
+ /* @__PURE__ */ n(ue, { term: c.preconditions, items: i.preconditions }),
1745
+ /* @__PURE__ */ n(ue, { term: c.actions, items: i.actions }),
1746
+ /* @__PURE__ */ n(ue, { term: c.rules, items: R.map((f) => f.statement) }),
1747
+ i.ticket && /* @__PURE__ */ n(W, { term: c.ticket, children: /* @__PURE__ */ n("code", { children: i.ticket }) })
1708
1748
  ] }),
1709
- b.length > 0 && /* @__PURE__ */ n(te, { title: d.components, children: /* @__PURE__ */ n("ul", { className: "ds-links", children: b.map((g) => /* @__PURE__ */ C("li", { "data-ds-filter": !0, children: [
1710
- /* @__PURE__ */ n("button", { type: "button", className: "ds-link", onClick: () => p(g.id), children: g.name }),
1711
- g.source && /* @__PURE__ */ n("code", { className: "ds-muted", children: g.source })
1712
- ] }, g.id)) }) }),
1713
- /* @__PURE__ */ C("button", { type: "button", className: "ds-btn ds-btn--block", onClick: k, children: [
1714
- /* @__PURE__ */ n(H, { name: f ? "check" : "copy", size: 14 }),
1715
- /* @__PURE__ */ n("span", { children: f ? d.copiedForPr : d.copyForPr })
1749
+ b.length > 0 && /* @__PURE__ */ n(te, { title: c.components, children: /* @__PURE__ */ n("ul", { className: "ds-links", children: b.map((f) => /* @__PURE__ */ x("li", { "data-ds-filter": !0, children: [
1750
+ /* @__PURE__ */ n("button", { type: "button", className: "ds-link", onClick: () => w(f.id), children: f.name }),
1751
+ f.source && /* @__PURE__ */ n("code", { className: "ds-muted", children: f.source })
1752
+ ] }, f.id)) }) }),
1753
+ /* @__PURE__ */ x("button", { type: "button", className: "ds-btn ds-btn--block", onClick: p, children: [
1754
+ /* @__PURE__ */ n(H, { name: g ? "check" : "copy", size: 14 }),
1755
+ /* @__PURE__ */ n("span", { children: g ? c.copiedForPr : c.copyForPr })
1716
1756
  ] })
1717
1757
  ] });
1718
1758
  }
1719
1759
  function te({ title: e, children: t }) {
1720
- return /* @__PURE__ */ C("section", { className: "ds-section", "data-ds-filter-group": !0, children: [
1760
+ return /* @__PURE__ */ x("section", { className: "ds-section", "data-ds-filter-group": !0, children: [
1721
1761
  /* @__PURE__ */ n("h2", { className: "ds-section__title", children: e }),
1722
1762
  /* @__PURE__ */ n("div", { className: "ds-defs", children: t })
1723
1763
  ] });
1724
1764
  }
1725
1765
  function W({ term: e, children: t }) {
1726
- return /* @__PURE__ */ C("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1766
+ return /* @__PURE__ */ x("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1727
1767
  /* @__PURE__ */ n("dt", { children: e }),
1728
1768
  /* @__PURE__ */ n("dd", { children: t })
1729
1769
  ] });
1730
1770
  }
1731
- function de({ term: e, items: t }) {
1732
- return t?.length ? /* @__PURE__ */ C("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1771
+ function ue({ term: e, items: t }) {
1772
+ return t?.length ? /* @__PURE__ */ x("dl", { className: "ds-def", "data-ds-filter": !0, children: [
1733
1773
  /* @__PURE__ */ n("dt", { children: e }),
1734
1774
  /* @__PURE__ */ n("dd", { children: /* @__PURE__ */ n("ul", { className: "ds-list", children: t.map((s) => /* @__PURE__ */ n("li", { children: s }, s)) }) })
1735
1775
  ] }) : null;
1736
1776
  }
1737
- function Zt(e) {
1777
+ function Qt(e) {
1738
1778
  return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f";
1739
1779
  }
1740
- function Yt(e, t) {
1780
+ function Xt(e, t) {
1741
1781
  if (!e) return !1;
1742
- const s = X(t), o = [...e.querySelectorAll("[data-ds-filter]")];
1782
+ const s = Q(t), o = [...e.querySelectorAll("[data-ds-filter]")];
1743
1783
  for (const r of o)
1744
- r.hidden = s.length > 0 && !X(r.textContent ?? "").includes(s);
1784
+ r.hidden = s.length > 0 && !Q(r.textContent ?? "").includes(s);
1745
1785
  for (const r of e.querySelectorAll("[data-ds-filter-group]")) {
1746
- const i = [...r.querySelectorAll("[data-ds-filter]")], l = X(
1786
+ const i = [...r.querySelectorAll("[data-ds-filter]")], d = Q(
1747
1787
  r.querySelector("[data-ds-filter-title], .ds-section__title")?.textContent ?? ""
1748
1788
  );
1749
- if (s.length > 0 && l.includes(s)) {
1789
+ if (s.length > 0 && d.includes(s)) {
1750
1790
  r.hidden = !1;
1751
- for (const a of i) a.hidden = !1;
1791
+ for (const l of i) l.hidden = !1;
1752
1792
  continue;
1753
1793
  }
1754
- r.hidden = s.length > 0 && i.every((a) => a.hidden);
1794
+ r.hidden = s.length > 0 && i.every((l) => l.hidden);
1755
1795
  }
1756
1796
  return s.length > 0 && o.length > 0 && o.every((r) => r.hidden);
1757
1797
  }
1758
- const Xt = 24;
1759
- function Qt({
1798
+ const Jt = 24;
1799
+ function en({
1760
1800
  location: e,
1761
1801
  viewport: t,
1762
1802
  zoom: s,
1763
1803
  title: o,
1764
1804
  resizing: r,
1765
1805
  onFrameNavigate: i,
1766
- onShortcut: l,
1767
- onEffectiveZoom: a
1806
+ onShortcut: d,
1807
+ onEffectiveZoom: l
1768
1808
  }) {
1769
- const p = q(null), m = q(null), h = Jt(p), d = ue(e.path, e.search), [f] = V(d), S = q(d), b = q(d), L = typeof window > "u" ? "" : window.location.origin, T = U(
1770
- (v) => {
1771
- b.current = v;
1772
- const x = m.current?.contentWindow;
1809
+ const w = j(null), h = j(null), u = tn(w), c = ie(e.path, e.search), [g] = V(c), k = j(c), b = j(c), $ = typeof window > "u" ? "" : window.location.origin, R = U(
1810
+ (m) => {
1811
+ b.current = m;
1812
+ const C = h.current?.contentWindow;
1773
1813
  try {
1774
- x?.location.replace(new URL(v, L).toString());
1814
+ C?.location.replace(new URL(m, $).toString());
1775
1815
  } catch {
1776
- m.current && (m.current.src = v);
1816
+ h.current && (h.current.src = m);
1777
1817
  }
1778
1818
  },
1779
- [L]
1819
+ [$]
1780
1820
  );
1781
1821
  I(() => {
1782
- if (d === S.current) return;
1783
- const v = S.current;
1784
- S.current = d, _e(v) !== _e(d) ? T(d) : ae(m.current?.contentWindow, { ds: 1, type: "location", url: d }, L);
1785
- }, [d, T, L]), I(() => {
1786
- const v = (x) => {
1787
- const M = Be(x, {
1788
- origin: L,
1789
- source: m.current?.contentWindow
1822
+ if (c === k.current) return;
1823
+ const m = k.current;
1824
+ k.current = c, Fe(m) !== Fe(c) ? R(c) : re(h.current?.contentWindow, { ds: 1, type: "location", url: c }, $);
1825
+ }, [c, R, $]), I(() => {
1826
+ const m = (C) => {
1827
+ const L = qe(C, {
1828
+ origin: $,
1829
+ source: h.current?.contentWindow
1790
1830
  });
1791
- if (M)
1792
- switch (M.type) {
1831
+ if (L)
1832
+ switch (L.type) {
1793
1833
  case "ready": {
1794
- if (M.url === S.current) return;
1795
- if (M.url === b.current) {
1796
- ae(
1797
- m.current?.contentWindow,
1798
- { ds: 1, type: "location", url: S.current },
1799
- L
1834
+ if (L.url === k.current) return;
1835
+ if (L.url === b.current) {
1836
+ re(
1837
+ h.current?.contentWindow,
1838
+ { ds: 1, type: "location", url: k.current },
1839
+ $
1800
1840
  );
1801
1841
  return;
1802
1842
  }
1803
- S.current = M.url, b.current = M.url, i(M.url, !0);
1843
+ k.current = L.url, b.current = L.url, i(L.url, !0);
1804
1844
  return;
1805
1845
  }
1806
1846
  case "navigate":
1807
- S.current = M.url, i(M.url, M.replace);
1847
+ k.current = L.url, i(L.url, L.replace);
1808
1848
  return;
1809
1849
  case "shortcut":
1810
- l(M.key);
1850
+ d(L.key);
1811
1851
  return;
1812
1852
  default:
1813
1853
  return;
1814
1854
  }
1815
1855
  };
1816
- return window.addEventListener("message", v), () => window.removeEventListener("message", v);
1817
- }, [i, l, L]);
1818
- const N = !!t.width, w = N ? Xt : 0, u = Math.max(0, h.width - w * 2), k = Math.max(0, h.height - w * 2), g = !t.width || u === 0 || t.width <= u, y = s === 100 && !g ? Math.max(10, Math.floor(u / t.width * 100)) : s, _ = y / 100;
1856
+ return window.addEventListener("message", m), () => window.removeEventListener("message", m);
1857
+ }, [i, d, $]);
1858
+ const N = !!t.width, P = N ? Jt : 0, v = Math.max(0, u.width - P * 2), p = Math.max(0, u.height - P * 2), f = !t.width || v === 0 || t.width <= v, S = s === 100 && !f ? Math.max(10, Math.floor(v / t.width * 100)) : s, y = S / 100;
1819
1859
  I(() => {
1820
- a?.(y);
1821
- }, [y, a]);
1822
- const z = t.width ?? u / _, c = t.height ?? k / _;
1823
- return /* @__PURE__ */ n("div", { className: "ds-canvas", ref: p, "data-fit": N ? void 0 : "true", children: /* @__PURE__ */ n(
1860
+ l?.(S);
1861
+ }, [S, l]);
1862
+ const T = t.width ?? v / y, a = t.height ?? p / y;
1863
+ return /* @__PURE__ */ n("div", { className: "ds-canvas", ref: w, "data-fit": N ? void 0 : "true", children: /* @__PURE__ */ n(
1824
1864
  "div",
1825
1865
  {
1826
1866
  className: "ds-canvas__box",
1827
- style: { width: Math.floor(z * _), height: Math.floor(c * _) },
1867
+ style: { width: Math.floor(T * y), height: Math.floor(a * y) },
1828
1868
  children: /* @__PURE__ */ n(
1829
1869
  "iframe",
1830
1870
  {
1831
- ref: m,
1832
- [vt]: "",
1871
+ ref: h,
1872
+ [bt]: "",
1833
1873
  className: "ds-frame",
1834
- src: f,
1874
+ src: g,
1835
1875
  title: o,
1836
1876
  style: {
1837
- width: Math.floor(z),
1838
- height: Math.floor(c),
1839
- transform: _ === 1 ? void 0 : `scale(${_})`,
1877
+ width: Math.floor(T),
1878
+ height: Math.floor(a),
1879
+ transform: y === 1 ? void 0 : `scale(${y})`,
1840
1880
  pointerEvents: r ? "none" : void 0
1841
1881
  }
1842
1882
  }
@@ -1844,15 +1884,15 @@ function Qt({
1844
1884
  }
1845
1885
  ) });
1846
1886
  }
1847
- function Jt(e) {
1887
+ function tn(e) {
1848
1888
  const [t, s] = V({ width: 0, height: 0 });
1849
- return Ue(() => {
1889
+ return We(() => {
1850
1890
  const o = e.current;
1851
1891
  if (!o) return;
1852
1892
  const r = () => {
1853
- const l = o.clientWidth, a = o.clientHeight;
1893
+ const d = o.clientWidth, l = o.clientHeight;
1854
1894
  s(
1855
- (p) => p.width === l && p.height === a ? p : { width: l, height: a }
1895
+ (w) => w.width === d && w.height === l ? w : { width: d, height: l }
1856
1896
  );
1857
1897
  };
1858
1898
  if (r(), typeof ResizeObserver > "u")
@@ -1861,8 +1901,8 @@ function Jt(e) {
1861
1901
  return i.observe(o), () => i.disconnect();
1862
1902
  }, [e]), t;
1863
1903
  }
1864
- const Je = 2500;
1865
- class et extends Error {
1904
+ const nt = 2500;
1905
+ class ot extends Error {
1866
1906
  constructor(t) {
1867
1907
  super(`Falha de rede simulada no cenário "${t}".`), this.name = "SimulatedNetworkError";
1868
1908
  }
@@ -1879,40 +1919,40 @@ const Le = {
1879
1919
  case "empty":
1880
1920
  return null;
1881
1921
  case "error":
1882
- throw new et(e.id);
1922
+ throw new ot(e.id);
1883
1923
  case "loading":
1884
1924
  return new Promise(() => {
1885
1925
  });
1886
1926
  case "slow":
1887
- return await en(Je), Me(t);
1927
+ return await nn(nt), Me(t);
1888
1928
  default:
1889
1929
  return Me(t);
1890
1930
  }
1891
1931
  }
1892
1932
  };
1893
- function pn(e) {
1894
- const { id: t, label: s, baseUrl: o, path: r, init: i, fallbackToFixture: l = !0 } = e;
1933
+ function fn(e) {
1934
+ const { id: t, label: s, baseUrl: o, path: r, init: i, fallbackToFixture: d = !0 } = e;
1895
1935
  return {
1896
1936
  id: t,
1897
1937
  label: s,
1898
- load: async (a) => {
1899
- const p = new URL(r ? r(a) : a.scenario.route, o);
1938
+ load: async (l) => {
1939
+ const w = new URL(r ? r(l) : l.scenario.route, o);
1900
1940
  try {
1901
- const m = await fetch(p, i);
1902
- if (!m.ok) throw new Error(`${m.status} ${m.statusText}`);
1903
- return await m.json();
1904
- } catch (m) {
1905
- if (l) return Me(a.fixture);
1906
- throw new Error(`Adapter "${t}" falhou em ${p.toString()}`, { cause: m });
1941
+ const h = await fetch(w, i);
1942
+ if (!h.ok) throw new Error(`${h.status} ${h.statusText}`);
1943
+ return await h.json();
1944
+ } catch (h) {
1945
+ if (d) return Me(l.fixture);
1946
+ throw new Error(`Adapter "${t}" falhou em ${w.toString()}`, { cause: h });
1907
1947
  }
1908
1948
  }
1909
1949
  };
1910
1950
  }
1911
- function en(e) {
1951
+ function nn(e) {
1912
1952
  return new Promise((t) => setTimeout(t, e));
1913
1953
  }
1914
- function tn(e) {
1915
- const { scenario: t, fixture: s, network: o, adapter: r } = e, [i, l] = V({
1954
+ function on(e) {
1955
+ const { scenario: t, fixture: s, network: o, adapter: r } = e, [i, d] = V({
1916
1956
  data: void 0,
1917
1957
  isLoading: !!t || o === "loading" || o === "slow",
1918
1958
  error: void 0
@@ -1921,179 +1961,179 @@ function tn(e) {
1921
1961
  if (!t)
1922
1962
  switch (o) {
1923
1963
  case "loading":
1924
- l({ data: void 0, isLoading: !0, error: void 0 });
1964
+ d({ data: void 0, isLoading: !0, error: void 0 });
1925
1965
  return;
1926
1966
  case "empty":
1927
- l({ data: null, isLoading: !1, error: void 0 });
1967
+ d({ data: null, isLoading: !1, error: void 0 });
1928
1968
  return;
1929
1969
  case "error":
1930
- l({
1970
+ d({
1931
1971
  data: void 0,
1932
1972
  isLoading: !1,
1933
- error: new et(e.screen ?? "—")
1973
+ error: new ot(e.screen ?? "—")
1934
1974
  });
1935
1975
  return;
1936
1976
  case "slow": {
1937
- l({ data: void 0, isLoading: !0, error: void 0 });
1938
- const m = setTimeout(
1939
- () => l({ data: void 0, isLoading: !1, error: void 0 }),
1940
- Je
1977
+ d({ data: void 0, isLoading: !0, error: void 0 });
1978
+ const h = setTimeout(
1979
+ () => d({ data: void 0, isLoading: !1, error: void 0 }),
1980
+ nt
1941
1981
  );
1942
- return () => clearTimeout(m);
1982
+ return () => clearTimeout(h);
1943
1983
  }
1944
1984
  default:
1945
- l({ data: void 0, isLoading: !1, error: void 0 });
1985
+ d({ data: void 0, isLoading: !1, error: void 0 });
1946
1986
  return;
1947
1987
  }
1948
- let a = !0;
1949
- l({ data: void 0, isLoading: !0, error: void 0 });
1950
- const p = r ?? Le;
1951
- return Promise.resolve(p.load({ scenario: t, fixture: s, network: o })).then((m) => {
1952
- a && l({ data: m, isLoading: !1, error: void 0 });
1953
- }).catch((m) => {
1954
- a && l({
1988
+ let l = !0;
1989
+ d({ data: void 0, isLoading: !0, error: void 0 });
1990
+ const w = r ?? Le;
1991
+ return Promise.resolve(w.load({ scenario: t, fixture: s, network: o })).then((h) => {
1992
+ l && d({ data: h, isLoading: !1, error: void 0 });
1993
+ }).catch((h) => {
1994
+ l && d({
1955
1995
  data: void 0,
1956
1996
  isLoading: !1,
1957
- error: m instanceof Error ? m : new Error(String(m))
1997
+ error: h instanceof Error ? h : new Error(String(h))
1958
1998
  });
1959
1999
  }), () => {
1960
- a = !1;
2000
+ l = !1;
1961
2001
  };
1962
2002
  }, [t, s, o, r, e.screen]), i;
1963
2003
  }
1964
- function De({ title: e, children: t }) {
1965
- return /* @__PURE__ */ C("div", { className: "ds-stage-empty", children: [
2004
+ function Ke({ title: e, children: t }) {
2005
+ return /* @__PURE__ */ x("div", { className: "ds-stage-empty", children: [
1966
2006
  /* @__PURE__ */ n("h2", { className: "ds-stage-empty__title", children: e }),
1967
2007
  t
1968
2008
  ] });
1969
2009
  }
1970
- function nn({ product: e, registry: t }) {
1971
- const s = J(), { location: o, controls: r, viewport: i, navigate: l, openScenario: a, setScreenControls: p } = Ge(
2010
+ function rn({ product: e, registry: t }) {
2011
+ const s = J(), { location: o, controls: r, viewport: i, navigate: d, openScenario: l, setScreenControls: w } = Ye(
1972
2012
  t,
1973
2013
  { frame: !0 }
1974
- ), m = q(null);
2014
+ ), h = j(null);
1975
2015
  I(() => {
1976
- const P = (O) => {
1977
- if (O.defaultPrevented || O.button !== 0 || O.metaKey || O.ctrlKey || O.shiftKey || O.altKey) return;
1978
- const A = O.target?.closest?.("a[href]");
2016
+ const E = (z) => {
2017
+ if (z.defaultPrevented || z.button !== 0 || z.metaKey || z.ctrlKey || z.shiftKey || z.altKey) return;
2018
+ const A = z.target?.closest?.("a[href]");
1979
2019
  if (!(A instanceof HTMLAnchorElement) || A.target && A.target !== "_self" || A.hasAttribute("download")) return;
1980
- const j = A.getAttribute("href") ?? "";
1981
- if (j.startsWith("#")) return;
2020
+ const q = A.getAttribute("href") ?? "";
2021
+ if (q.startsWith("#")) return;
1982
2022
  let B;
1983
2023
  try {
1984
- B = new URL(j, window.location.href);
2024
+ B = new URL(q, window.location.href);
1985
2025
  } catch {
1986
2026
  return;
1987
2027
  }
1988
- B.origin === window.location.origin && (O.preventDefault(), l(`${B.pathname}${B.search}`));
2028
+ B.origin === window.location.origin && (z.preventDefault(), d(`${B.pathname}${B.search}`));
1989
2029
  };
1990
- return document.addEventListener("click", P), () => document.removeEventListener("click", P);
1991
- }, [l]), I(() => {
1992
- const P = (O) => {
2030
+ return document.addEventListener("click", E), () => document.removeEventListener("click", E);
2031
+ }, [d]), I(() => {
2032
+ const E = (z) => {
1993
2033
  if (window.parent === window) return;
1994
- const A = on(O);
2034
+ const A = sn(z);
1995
2035
  if (!A) return;
1996
- const j = O.target;
1997
- A === "C" && j?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (O.preventDefault(), ae(window.parent, { ds: 1, type: "shortcut", key: A }, window.location.origin));
2036
+ const q = z.target;
2037
+ A === "C" && q?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (z.preventDefault(), re(window.parent, { ds: 1, type: "shortcut", key: A }, window.location.origin));
1998
2038
  };
1999
- return window.addEventListener("keydown", P), () => window.removeEventListener("keydown", P);
2039
+ return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
2000
2040
  }, []), I(() => {
2001
- const P = m.current;
2002
- if (!P || !r.handoff) return;
2003
- const O = () => {
2004
- for (const j of P.querySelectorAll("a[href]")) {
2005
- const B = j.getAttribute("href");
2041
+ const E = h.current;
2042
+ if (!E || !r.handoff) return;
2043
+ const z = () => {
2044
+ for (const q of E.querySelectorAll("a[href]")) {
2045
+ const B = q.getAttribute("href");
2006
2046
  if (!B || B.startsWith("#")) continue;
2007
- let Q;
2047
+ let X;
2008
2048
  try {
2009
- Q = new URL(B, window.location.href);
2049
+ X = new URL(B, window.location.href);
2010
2050
  } catch {
2011
2051
  continue;
2012
2052
  }
2013
- if (Q.origin !== window.location.origin) continue;
2014
- Pe(Q.searchParams, r.handoff);
2015
- const ie = `${Q.pathname}${Q.search}${Q.hash}`;
2016
- B !== ie && j.setAttribute("href", ie);
2053
+ if (X.origin !== window.location.origin) continue;
2054
+ Pe(X.searchParams, r.handoff);
2055
+ const ce = `${X.pathname}${X.search}${X.hash}`;
2056
+ B !== ce && q.setAttribute("href", ce);
2017
2057
  }
2018
2058
  };
2019
- O();
2020
- const A = new MutationObserver(O);
2021
- return A.observe(P, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => A.disconnect();
2059
+ z();
2060
+ const A = new MutationObserver(z);
2061
+ return A.observe(E, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => A.disconnect();
2022
2062
  }, [r.handoff]);
2023
- const h = t.scenario(r.scenario), d = t.component(r.component), f = D(() => {
2024
- const P = new URLSearchParams(o.search);
2063
+ const u = t.scenario(r.scenario), c = t.component(r.component), g = D(() => {
2064
+ const E = new URLSearchParams(o.search);
2025
2065
  return {
2026
- scenario: P.get($.scenario) ?? void 0,
2027
- component: P.get($.component) ?? void 0
2066
+ scenario: E.get(M.scenario) ?? void 0,
2067
+ component: E.get(M.component) ?? void 0
2028
2068
  };
2029
- }, [o.search]), S = !!(r.handoff && (f.scenario && !oe(r.handoff, f.scenario) || f.component && !ve(r.handoff, f.component) || !f.component && !Ie(r.handoff, o.path, e.scenarios))), b = D(
2030
- () => t.resolveComponentFixture(d?.id, d ? r.fixture : void 0),
2031
- [d, r.fixture, t]
2032
- ), L = D(() => {
2033
- const P = b.fixture?.data;
2034
- return typeof P == "function" ? P() : P;
2035
- }, [b.fixture]), T = t.persona(r.persona ?? h?.persona), N = t.fixture(r.fixture ?? h?.fixture), w = D(() => {
2036
- const P = r.dataSource ?? "fixtures";
2037
- return P === "fixtures" ? Le : e.dataSources?.adapters?.find((O) => O.id === P) ?? Le;
2038
- }, [r.dataSource, e.dataSources?.adapters]), { data: u, isLoading: k, error: g } = tn({
2039
- scenario: h,
2069
+ }, [o.search]), k = !!(r.handoff && (g.scenario && !oe(r.handoff, g.scenario) || g.component && !ge(r.handoff, g.component) || !g.component && !He(r.handoff, o.path, e.scenarios))), b = D(
2070
+ () => t.resolveComponentFixture(c?.id, c ? r.fixture : void 0),
2071
+ [c, r.fixture, t]
2072
+ ), $ = D(() => {
2073
+ const E = b.fixture?.data;
2074
+ return typeof E == "function" ? E() : E;
2075
+ }, [b.fixture]), R = t.persona(r.persona ?? u?.persona), N = t.fixture(r.fixture ?? u?.fixture), P = D(() => {
2076
+ const E = r.dataSource ?? "fixtures";
2077
+ return E === "fixtures" ? Le : e.dataSources?.adapters?.find((z) => z.id === E) ?? Le;
2078
+ }, [r.dataSource, e.dataSources?.adapters]), { data: v, isLoading: p, error: f } = on({
2079
+ scenario: u,
2040
2080
  fixture: N,
2041
2081
  network: r.network,
2042
- adapter: w,
2082
+ adapter: P,
2043
2083
  screen: o.path
2044
- }), y = D(() => h ? r.persona && r.persona !== (h.persona ?? t.defaultPersona) ? t.persona(r.persona)?.permissions ?? [] : t.permissionsOf(h) : t.persona(r.persona)?.permissions ?? [], [r.persona, t, h]), _ = r.screenControls, z = D(() => _ ?? {}, [_]), c = U(
2045
- (P, O) => p({ [P]: O }),
2046
- [p]
2047
- ), v = D(
2084
+ }), S = D(() => u ? r.persona && r.persona !== (u.persona ?? t.defaultPersona) ? t.persona(r.persona)?.permissions ?? [] : t.permissionsOf(u) : t.persona(r.persona)?.permissions ?? [], [r.persona, t, u]), y = r.screenControls, T = D(() => y ?? {}, [y]), a = U(
2085
+ (E, z) => w({ [E]: z }),
2086
+ [w]
2087
+ ), m = D(
2048
2088
  () => ({
2049
- scenario: h,
2050
- persona: T,
2051
- permissions: y,
2052
- can: (P) => y.includes(P),
2053
- data: u,
2089
+ scenario: u,
2090
+ persona: R,
2091
+ permissions: S,
2092
+ can: (E) => S.includes(E),
2093
+ data: v,
2054
2094
  fixture: N,
2055
2095
  network: r.network,
2056
- isLoading: k,
2057
- error: g,
2058
- rules: t.rulesOf(h),
2096
+ isLoading: p,
2097
+ error: f,
2098
+ rules: t.rulesOf(u),
2059
2099
  viewport: i,
2060
2100
  themeMode: r.themeMode,
2061
2101
  locale: r.locale,
2062
- navigate: l,
2063
- openScenario: a,
2064
- controls: z,
2065
- setControl: c,
2066
- setControls: p
2102
+ navigate: d,
2103
+ openScenario: l,
2104
+ controls: T,
2105
+ setControl: a,
2106
+ setControls: w
2067
2107
  }),
2068
2108
  [
2069
- h,
2070
- T,
2071
- y,
2072
2109
  u,
2110
+ R,
2111
+ S,
2112
+ v,
2073
2113
  N,
2074
2114
  r.network,
2075
2115
  r.themeMode,
2076
2116
  r.locale,
2077
- k,
2078
- g,
2117
+ p,
2118
+ f,
2079
2119
  t,
2080
2120
  i,
2121
+ d,
2081
2122
  l,
2123
+ T,
2082
2124
  a,
2083
- z,
2084
- c,
2085
- p
2125
+ w
2086
2126
  ]
2087
- ), x = xe(e.routes ?? [], o.path), M = e.wrapper, F = e.notFound, E = d?.preview, K = S ? /* @__PURE__ */ n(De, { title: s.shell.outsideHandoff, children: /* @__PURE__ */ n("p", { children: s.shell.outsideHandoffHint }) }) : E ? /* @__PURE__ */ n(
2088
- E,
2127
+ ), C = ye(e.routes ?? [], o.path), L = e.wrapper, O = e.notFound, _ = c?.preview, K = k ? /* @__PURE__ */ n(Ke, { title: s.shell.outsideHandoff, children: /* @__PURE__ */ n("p", { children: s.shell.outsideHandoffHint }) }) : _ ? /* @__PURE__ */ n(
2128
+ _,
2089
2129
  {
2090
2130
  fixture: b.fixture,
2091
- data: L,
2131
+ data: $,
2092
2132
  viewport: i,
2093
2133
  themeMode: r.themeMode ?? "default",
2094
2134
  locale: r.locale ?? "default"
2095
2135
  }
2096
- ) : x ? /* @__PURE__ */ n(x.definition.screen, { params: x.params, context: v }) : F ? /* @__PURE__ */ n(F, { path: o.path }) : /* @__PURE__ */ n(De, { title: s.shell.noRoute, children: /* @__PURE__ */ C("p", { children: [
2136
+ ) : C ? /* @__PURE__ */ n(C.definition.screen, { params: C.params, context: m }) : O ? /* @__PURE__ */ n(O, { path: o.path }) : /* @__PURE__ */ n(Ke, { title: s.shell.noRoute, children: /* @__PURE__ */ x("p", { children: [
2097
2137
  /* @__PURE__ */ n("code", { children: o.path }),
2098
2138
  " ",
2099
2139
  s.shell.noRouteHint
@@ -2101,10 +2141,10 @@ function nn({ product: e, registry: t }) {
2101
2141
  return (
2102
2142
  // `display: contents` deixa o layout do produto como se este nó não
2103
2143
  // existisse: ele só serve de raiz para observar os links.
2104
- /* @__PURE__ */ n("div", { ref: m, style: { display: "contents" }, children: M && !S ? /* @__PURE__ */ n(M, { context: v, children: K }) : K })
2144
+ /* @__PURE__ */ n("div", { ref: h, style: { display: "contents" }, children: L && !k ? /* @__PURE__ */ n(L, { context: m, children: K }) : K })
2105
2145
  );
2106
2146
  }
2107
- function on(e) {
2147
+ function sn(e) {
2108
2148
  if (!e.altKey) {
2109
2149
  if (e.shiftKey && !e.metaKey && !e.ctrlKey && e.key === "C") return "C";
2110
2150
  if ((e.metaKey || e.ctrlKey) && !e.shiftKey) {
@@ -2114,41 +2154,41 @@ function on(e) {
2114
2154
  }
2115
2155
  }
2116
2156
  }
2117
- const he = {
2157
+ const pe = {
2118
2158
  leftWidth: "ds:left-width",
2119
2159
  rightWidth: "ds:right-width",
2120
2160
  appearance: "ds:appearance"
2121
2161
  };
2122
- function tt(e) {
2162
+ function rt(e) {
2123
2163
  try {
2124
2164
  return window.localStorage.getItem(e) ?? void 0;
2125
2165
  } catch {
2126
2166
  return;
2127
2167
  }
2128
2168
  }
2129
- function nt(e, t) {
2169
+ function st(e, t) {
2130
2170
  try {
2131
2171
  window.localStorage.setItem(e, t);
2132
2172
  } catch {
2133
2173
  }
2134
2174
  }
2135
- function Ve(e, t, s) {
2175
+ function Ue(e, t, s) {
2136
2176
  return Math.round(Math.min(s, Math.max(t, e)));
2137
2177
  }
2138
- function Ke(e, t, s, o) {
2178
+ function Ie(e, t, s, o) {
2139
2179
  const [r, i] = V(() => {
2140
- const a = Number.parseInt(tt(e) ?? "", 10);
2141
- return Number.isFinite(a) ? Ve(a, s, o) : t;
2142
- }), l = U(
2143
- (a) => {
2144
- const p = Ve(a, s, o);
2145
- i(p), nt(e, String(p));
2180
+ const l = Number.parseInt(rt(e) ?? "", 10);
2181
+ return Number.isFinite(l) ? Ue(l, s, o) : t;
2182
+ }), d = U(
2183
+ (l) => {
2184
+ const w = Ue(l, s, o);
2185
+ i(w), st(e, String(w));
2146
2186
  },
2147
2187
  [e, o, s]
2148
2188
  );
2149
- return [r, l];
2189
+ return [r, d];
2150
2190
  }
2151
- function rn() {
2191
+ function an() {
2152
2192
  const e = "(prefers-color-scheme: dark)", t = () => {
2153
2193
  try {
2154
2194
  return window.matchMedia(e).matches ? "dark" : "light";
@@ -2167,159 +2207,159 @@ function rn() {
2167
2207
  return r.addEventListener?.("change", i), () => r?.removeEventListener?.("change", i);
2168
2208
  }, []), s;
2169
2209
  }
2170
- function sn() {
2171
- const e = tt(he.appearance);
2210
+ function cn() {
2211
+ const e = rt(pe.appearance);
2172
2212
  return e === "dark" || e === "light" ? e : void 0;
2173
2213
  }
2174
- function mn({ product: e }) {
2175
- const t = D(() => kt(e), [e]), s = D(() => Ot(e.theme?.labels), [e.theme?.labels]), [o] = V(() => gt());
2176
- return /* @__PURE__ */ n(Ye.Provider, { value: s, children: o ? /* @__PURE__ */ n(nn, { product: e, registry: t }) : /* @__PURE__ */ n(an, { product: e, registry: t }) });
2177
- }
2178
- const ke = { initial: 290, min: 200, max: 480 }, Ce = { initial: 320, min: 260, max: 560 };
2179
- function an({ product: e, registry: t }) {
2180
- const s = J(), o = D(() => bt(e.deploy), [e.deploy]), { location: r, controls: i, viewport: l, setControls: a, openScenario: p, openComponent: m, openScreen: h, go: d } = Ge(t), f = q(r);
2181
- f.current = r;
2182
- const S = rn(), [b, L] = V(() => sn()), T = i.chromeTheme ?? b ?? S, [N, w] = Ke(
2183
- he.leftWidth,
2184
- ke.initial,
2185
- ke.min,
2186
- ke.max
2187
- ), [u, k] = Ke(
2188
- he.rightWidth,
2214
+ function wn({ product: e }) {
2215
+ const t = D(() => xt(e), [e]), s = D(() => At(e.theme?.labels), [e.theme?.labels]), [o] = V(() => St());
2216
+ return /* @__PURE__ */ n(Je.Provider, { value: s, children: o ? /* @__PURE__ */ n(rn, { product: e, registry: t }) : /* @__PURE__ */ n(ln, { product: e, registry: t }) });
2217
+ }
2218
+ const Ce = { initial: 290, min: 200, max: 480 }, xe = { initial: 320, min: 260, max: 560 };
2219
+ function ln({ product: e, registry: t }) {
2220
+ const s = J(), o = D(() => kt(e.deploy), [e.deploy]), { location: r, controls: i, viewport: d, setControls: l, openScenario: w, openComponent: h, openScreen: u, go: c } = Ye(t), g = j(r);
2221
+ g.current = r;
2222
+ const k = an(), [b, $] = V(() => cn()), R = i.chromeTheme ?? b ?? k, [N, P] = Ie(
2223
+ pe.leftWidth,
2189
2224
  Ce.initial,
2190
2225
  Ce.min,
2191
2226
  Ce.max
2192
- ), [g, y] = V(!1), _ = i.handoff, z = t.component(i.component), c = t.scenario(i.scenario), v = z ? void 0 : t.screensFor({ handoff: _ }).find((R) => R.id === t.screenForPath(r.path)?.id), x = v && c && v.variations.some((R) => R.id === c.id) ? c : void 0, M = D(
2193
- () => t.resolveComponentFixture(z?.id, z ? i.fixture : void 0),
2194
- [z, i.fixture, t]
2195
- ), F = D(() => {
2196
- if (!v || v.controls.length === 0) return t.issues;
2197
- const { invalid: R } = t.resolveControls(v, {
2198
- scenario: x,
2199
- requested: We(r.search)
2227
+ ), [v, p] = Ie(
2228
+ pe.rightWidth,
2229
+ xe.initial,
2230
+ xe.min,
2231
+ xe.max
2232
+ ), [f, S] = V(!1), y = i.handoff, T = t.component(i.component), a = t.scenario(i.scenario), m = T ? void 0 : t.screensFor({ handoff: y }).find((F) => F.id === t.screenForPath(r.path)?.id), C = m && a && m.variations.some((F) => F.id === a.id) ? a : void 0, L = D(
2233
+ () => t.resolveComponentFixture(T?.id, T ? i.fixture : void 0),
2234
+ [T, i.fixture, t]
2235
+ ), O = D(() => {
2236
+ if (!m || m.controls.length === 0) return t.issues;
2237
+ const { invalid: F } = t.resolveControls(m, {
2238
+ scenario: C,
2239
+ requested: Be(r.search)
2200
2240
  });
2201
- return R.length === 0 ? t.issues : [...R.map((Z) => ({
2241
+ return F.length === 0 ? t.issues : [...F.map((Z) => ({
2202
2242
  level: "warning",
2203
- where: `url:${ge}${Z.id}`,
2243
+ where: `url:${be}${Z.id}`,
2204
2244
  message: Z.reason === "invalid-value" ? s.diagnostics.invalidControl(Z.id, Z.value, Z.fallback ?? "") : s.diagnostics.unknownControl(Z.id, Z.value)
2205
2245
  })), ...t.issues];
2206
- }, [s, r.search, t, v, x]), E = t.screensFor({ handoff: _ })[0], K = t.componentsFor(_)[0], P = !E && !K, O = D(() => {
2207
- const R = new URLSearchParams(r.search);
2208
- return R.has($.scenario) || R.has($.component);
2209
- }, [r.search]), A = r.path === "/" && !O && !t.screenForPath("/") && !P;
2246
+ }, [s, r.search, t, m, C]), _ = t.screensFor({ handoff: y })[0], K = t.componentsFor(y)[0], E = !_ && !K, z = D(() => {
2247
+ const F = new URLSearchParams(r.search);
2248
+ return F.has(M.scenario) || F.has(M.component);
2249
+ }, [r.search]), A = r.path === "/" && !z && !t.screenForPath("/") && !E;
2210
2250
  I(() => {
2211
- A && (E ? h(E.id, { replace: !0 }) : K && m(K.id, { replace: !0 }));
2212
- }, [K, E, m, h, A]);
2213
- const j = U(
2214
- () => a({ chrome: !i.chrome }),
2215
- [i.chrome, a]
2251
+ A && (_ ? u(_.id, { replace: !0 }) : K && h(K.id, { replace: !0 }));
2252
+ }, [K, _, h, u, A]);
2253
+ const q = U(
2254
+ () => l({ chrome: !i.chrome }),
2255
+ [i.chrome, l]
2216
2256
  ), B = U(
2217
- (R) => {
2218
- if (R === "C") {
2219
- j();
2257
+ (F) => {
2258
+ if (F === "C") {
2259
+ q();
2220
2260
  return;
2221
2261
  }
2222
- window.dispatchEvent(new KeyboardEvent("keydown", { key: R.toLowerCase(), metaKey: !0 }));
2262
+ window.dispatchEvent(new KeyboardEvent("keydown", { key: F.toLowerCase(), metaKey: !0 }));
2223
2263
  },
2224
- [j]
2264
+ [q]
2225
2265
  );
2226
2266
  I(() => {
2227
- const R = (G) => {
2267
+ const F = (G) => {
2228
2268
  !G.shiftKey || G.metaKey || G.ctrlKey || G.altKey || G.key !== "C" || G.target?.closest?.("input, textarea, select, [contenteditable='true'], [contenteditable='']") || (G.preventDefault(), B(G.key));
2229
2269
  };
2230
- return window.addEventListener("keydown", R), () => window.removeEventListener("keydown", R);
2270
+ return window.addEventListener("keydown", F), () => window.removeEventListener("keydown", F);
2231
2271
  }, [B]);
2232
- const Q = U(
2233
- (R, G) => {
2234
- const { path: Z, search: it } = Ne(R);
2235
- d(Z, St(it, f.current.search), { replace: G });
2272
+ const X = U(
2273
+ (F, G) => {
2274
+ const { path: Z, search: dt } = he(F);
2275
+ c(Z, Ct(dt, g.current.search), { replace: G });
2236
2276
  },
2237
- [d]
2238
- ), ie = () => {
2239
- const R = T === "dark" ? "light" : "dark";
2240
- nt(he.appearance, R), L(R), a({ chromeTheme: R });
2241
- }, re = (R) => a(R), ot = `${o.origin}${r.path}${r.search}`, rt = i.panelTab ?? "variations", Re = i.zoom ?? 100, [st, at] = V(Re);
2242
- return /* @__PURE__ */ C(
2277
+ [c]
2278
+ ), ce = () => {
2279
+ const F = R === "dark" ? "light" : "dark";
2280
+ st(pe.appearance, F), $(F), l({ chromeTheme: F });
2281
+ }, se = (F) => l(F), at = `${o.origin}${r.path}${r.search}`, it = i.panelTab ?? "variations", _e = i.zoom ?? 100, [ct, lt] = V(_e);
2282
+ return /* @__PURE__ */ x(
2243
2283
  "div",
2244
2284
  {
2245
2285
  className: "ds-root",
2246
- "data-appearance": T,
2286
+ "data-appearance": R,
2247
2287
  "data-chrome": i.chrome ? "visible" : "hidden",
2248
- "data-resizing": g ? "true" : void 0,
2249
- "data-viewport": l.id,
2288
+ "data-resizing": f ? "true" : void 0,
2289
+ "data-viewport": d.id,
2250
2290
  children: [
2251
2291
  i.chrome && /* @__PURE__ */ n(
2252
- At,
2292
+ Vt,
2253
2293
  {
2254
2294
  productName: e.name,
2255
2295
  deploy: o,
2256
2296
  viewportId: i.viewport,
2257
- viewport: l,
2258
- zoom: st,
2297
+ viewport: d,
2298
+ zoom: ct,
2259
2299
  rotated: !!i.rotated,
2260
- theme: T,
2261
- issues: F,
2262
- linkUrl: ot,
2263
- onViewport: (R) => re({ viewport: R }),
2264
- onRotate: () => re({ rotated: !i.rotated }),
2265
- onZoom: (R) => re({ zoom: R }),
2266
- onCleanReview: j,
2267
- onToggleTheme: ie
2300
+ theme: R,
2301
+ issues: O,
2302
+ linkUrl: at,
2303
+ onViewport: (F) => se({ viewport: F }),
2304
+ onRotate: () => se({ rotated: !i.rotated }),
2305
+ onZoom: (F) => se({ zoom: F }),
2306
+ onCleanReview: q,
2307
+ onToggleTheme: ce
2268
2308
  }
2269
2309
  ),
2270
- /* @__PURE__ */ C("div", { className: "ds-body", children: [
2310
+ /* @__PURE__ */ x("div", { className: "ds-body", children: [
2271
2311
  i.chrome && /* @__PURE__ */ n(
2272
- Kt,
2312
+ It,
2273
2313
  {
2274
2314
  registry: t,
2275
- handoff: _,
2276
- activeScreen: v?.id,
2277
- activeComponent: z?.id,
2278
- onOpenScreen: (R) => h(R),
2279
- onOpenComponent: (R) => m(R),
2315
+ handoff: y,
2316
+ activeScreen: m?.id,
2317
+ activeComponent: T?.id,
2318
+ onOpenScreen: (F) => u(F),
2319
+ onOpenComponent: (F) => h(F),
2280
2320
  width: N,
2281
- onResize: w,
2282
- onResizeStart: () => y(!0),
2283
- onResizeEnd: () => y(!1)
2321
+ onResize: P,
2322
+ onResizeStart: () => S(!0),
2323
+ onResizeEnd: () => S(!1)
2284
2324
  }
2285
2325
  ),
2286
- /* @__PURE__ */ n("main", { className: "ds-main", children: P ? /* @__PURE__ */ C("div", { className: "ds-chrome-empty", children: [
2326
+ /* @__PURE__ */ n("main", { className: "ds-main", children: E ? /* @__PURE__ */ x("div", { className: "ds-chrome-empty", children: [
2287
2327
  /* @__PURE__ */ n("h1", { className: "ds-chrome-empty__title", children: s.shell.empty }),
2288
2328
  /* @__PURE__ */ n("p", { className: "ds-muted", children: s.shell.emptyHint })
2289
2329
  ] }) : A ? null : /* @__PURE__ */ n(
2290
- Qt,
2330
+ en,
2291
2331
  {
2292
2332
  location: r,
2293
- viewport: l,
2294
- zoom: Re,
2295
- onEffectiveZoom: at,
2333
+ viewport: d,
2334
+ zoom: _e,
2335
+ onEffectiveZoom: lt,
2296
2336
  title: s.shell.frameTitle(e.name),
2297
- resizing: g,
2298
- onFrameNavigate: Q,
2337
+ resizing: f,
2338
+ onFrameNavigate: X,
2299
2339
  onShortcut: B
2300
2340
  }
2301
2341
  ) }),
2302
2342
  i.chrome && /* @__PURE__ */ n(
2303
- jt,
2343
+ Gt,
2304
2344
  {
2305
2345
  registry: t,
2306
2346
  controls: i,
2307
2347
  deploy: o,
2308
2348
  location: r,
2309
- screen: v,
2310
- variation: x,
2311
- component: z,
2312
- componentFixture: M,
2313
- tab: rt,
2314
- onTab: (R) => re({ panelTab: R }),
2315
- onOpenScenario: p,
2316
- onOpenComponent: (R) => m(R),
2317
- onOpenScreen: (R) => h(R),
2318
- onChange: re,
2319
- width: u,
2320
- onResize: k,
2321
- onResizeStart: () => y(!0),
2322
- onResizeEnd: () => y(!1)
2349
+ screen: m,
2350
+ variation: C,
2351
+ component: T,
2352
+ componentFixture: L,
2353
+ tab: it,
2354
+ onTab: (F) => se({ panelTab: F }),
2355
+ onOpenScenario: w,
2356
+ onOpenComponent: (F) => h(F),
2357
+ onOpenScreen: (F) => u(F),
2358
+ onChange: se,
2359
+ width: v,
2360
+ onResize: p,
2361
+ onResizeStart: () => S(!0),
2362
+ onResizeEnd: () => S(!1)
2323
2363
  }
2324
2364
  )
2325
2365
  ] }),
@@ -2330,7 +2370,7 @@ function an({ product: e, registry: t }) {
2330
2370
  className: "ds-restore",
2331
2371
  "aria-label": s.shell.restoreChrome,
2332
2372
  title: s.shell.restoreChrome,
2333
- onClick: j,
2373
+ onClick: q,
2334
2374
  children: /* @__PURE__ */ n("span", { className: "ds-restore__dot", "aria-hidden": "true" })
2335
2375
  }
2336
2376
  )
@@ -2338,70 +2378,70 @@ function an({ product: e, registry: t }) {
2338
2378
  }
2339
2379
  );
2340
2380
  }
2341
- function we(e) {
2381
+ function ve(e) {
2342
2382
  return new Date(e.length === 10 ? `${e}T00:00:00` : e);
2343
2383
  }
2344
- function fn(e, t) {
2345
- const s = we(e), o = we(t);
2384
+ function vn(e, t) {
2385
+ const s = ve(e), o = ve(t);
2346
2386
  let r = o.getFullYear() - s.getFullYear();
2347
2387
  const i = o.getMonth() - s.getMonth();
2348
2388
  return (i < 0 || i === 0 && o.getDate() < s.getDate()) && (r -= 1), r;
2349
2389
  }
2350
- function wn(e, t) {
2351
- const s = we(e), o = we(t);
2390
+ function gn(e, t) {
2391
+ const s = ve(e), o = ve(t);
2352
2392
  return Math.floor((o.getTime() - s.getTime()) / 864e5);
2353
2393
  }
2354
2394
  export {
2355
- ge as CONTROL_PARAM_PREFIX,
2395
+ be as CONTROL_PARAM_PREFIX,
2356
2396
  ne as DEFAULT_LABELS,
2357
- mn as DesignSpace,
2358
- un as EN_US_LABELS,
2359
- vt as FRAME_ATTRIBUTE,
2360
- pt as FRAME_PARAM,
2361
- bn as HANDOFF_PARAM,
2362
- hn as NETWORK_LABELS,
2363
- He as NETWORK_STATES,
2364
- $ as PARAM,
2365
- Je as SLOW_NETWORK_DELAY_MS,
2366
- et as SimulatedNetworkError,
2367
- De as StageEmpty,
2368
- Nt as VIEWPORTS,
2369
- me as ZOOM_DEFAULT,
2370
- Ee as ZOOM_MAX,
2371
- Te as ZOOM_MIN,
2372
- fn as ageInYears,
2397
+ wn as DesignSpace,
2398
+ pn as EN_US_LABELS,
2399
+ bt as FRAME_ATTRIBUTE,
2400
+ wt as FRAME_PARAM,
2401
+ kn as HANDOFF_PARAM,
2402
+ mn as NETWORK_LABELS,
2403
+ je as NETWORK_STATES,
2404
+ M as PARAM,
2405
+ nt as SLOW_NETWORK_DELAY_MS,
2406
+ ot as SimulatedNetworkError,
2407
+ Ke as StageEmpty,
2408
+ $t as VIEWPORTS,
2409
+ fe as ZOOM_DEFAULT,
2410
+ Re as ZOOM_MAX,
2411
+ Ee as ZOOM_MIN,
2412
+ vn as ageInYears,
2373
2413
  Pe as applyHandoffScope,
2374
- ye as applyOverrides,
2375
- Ze as clampZoom,
2376
- Sn as commitUrl,
2377
- kn as componentUrl,
2378
- pn as createHttpAdapter,
2379
- kt as createRegistry,
2380
- wn as daysBetween,
2414
+ Ne as applyOverrides,
2415
+ Xe as clampZoom,
2416
+ Cn as commitUrl,
2417
+ xn as componentUrl,
2418
+ fn as createHttpAdapter,
2419
+ xt as createRegistry,
2420
+ gn as daysBetween,
2381
2421
  Le as fixtureAdapter,
2382
- Cn as formatIssues,
2383
- bt as getDeployContext,
2384
- ve as handoffAllowsComponent,
2385
- Ie as handoffAllowsPath,
2422
+ yn as formatIssues,
2423
+ kt as getDeployContext,
2424
+ ge as handoffAllowsComponent,
2425
+ He as handoffAllowsPath,
2386
2426
  oe as handoffAllowsScenario,
2387
- xn as hasErrors,
2388
- Nn as matchPath,
2389
- yn as normalizeHandoffScope,
2390
- X as normalizeSearch,
2427
+ Nn as hasErrors,
2428
+ $n as matchPath,
2429
+ Mn as normalizeHandoffScope,
2430
+ Q as normalizeSearch,
2391
2431
  $e as parseControls,
2392
- ht as parseHandoffScope,
2393
- we as parseIsoDate,
2432
+ ft as parseHandoffScope,
2433
+ ve as parseIsoDate,
2394
2434
  Me as resolveFixture,
2395
- Ot as resolveLabels,
2396
- xe as resolveRoute,
2397
- Lt as resolveViewport,
2398
- pe as scenarioUrl,
2399
- se as serializeControls,
2400
- $n as serializeValue,
2401
- Ge as useDesignSpaceState,
2435
+ At as resolveLabels,
2436
+ ye as resolveRoute,
2437
+ Tt as resolveViewport,
2438
+ me as scenarioUrl,
2439
+ ae as serializeControls,
2440
+ Ln as serializeValue,
2441
+ Ye as useDesignSpaceState,
2402
2442
  J as useLabels,
2403
- tn as useScenarioData,
2404
- ut as validateProduct,
2405
- Mn as validateScenario
2443
+ on as useScenarioData,
2444
+ mt as validateProduct,
2445
+ Pn as validateScenario
2406
2446
  };
2407
2447
  //# sourceMappingURL=index.js.map