@brucesantos/design-space 0.8.0 → 0.9.1

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