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