@brucesantos/design-space 0.8.0 → 0.9.0

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