@brucesantos/design-space 0.6.0 → 0.8.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,518 +1,415 @@
1
- import { jsxs as l, jsx as t, Fragment as A } from "react/jsx-runtime";
2
- import { useState as F, useEffect as D, useMemo as T, useCallback as R, useContext as Ne, createContext as Se, useRef as re, forwardRef as xe } from "react";
3
- import { S as be, h as ee, v as ye, a as te, p as _e, P as w, b as oe, N as ve, s as Me, c as Ce, g as Te, d as Ae, r as Pe } from "./contrast-B8xa1UIu.js";
4
- import { C as It, H as Bt, e as Ht, f as Wt, i as zt, j as Ut, k as jt, l as Kt, m as Vt, n as qt, o as Gt, q as Yt, t as Jt, u as Qt, w as Xt, x as Zt, y as eo, z as to } from "./contrast-B8xa1UIu.js";
5
- function Le(e) {
6
- const o = new Map(e.scenarios.map((s) => [s.id, s])), a = new Map(
7
- (e.components ?? []).map((s) => [s.id, s])
8
- ), i = new Map(e.personas.map((s) => [s.id, s])), d = new Map(e.fixtures.map((s) => [s.id, s])), r = new Map((e.rules ?? []).map((s) => [s.id, s])), n = new Map(e.modules.map((s) => [s.id, s])), c = new Map(
9
- e.modules.flatMap((s) => (s.flows ?? []).map((m) => [m.id, m]))
10
- ), h = e.modules.map((s) => ({
11
- module: s,
12
- scenarios: e.scenarios.filter((m) => m.id.split(".")[0] === s.id)
13
- })), u = new Set(h.flatMap((s) => s.scenarios.map((m) => m.id))), g = e.scenarios.filter((s) => !u.has(s.id)), f = (s) => s ? o.get(s) : void 0, p = (s) => s ? i.get(s) : void 0, b = (s, m) => {
14
- if (!(!s || !m))
15
- return a.get(s)?.fixtures?.find((k) => k.id === m);
16
- }, S = (s = {}) => e.scenarios.filter(
17
- (m) => te(s.handoff, m.id) && (s.includePorted || (s.view === "ported" ? m.status === "ported" : m.status !== "ported") || s.view === void 0 && m.id === s.activeScenario)
18
- ), _ = (s) => s ? s.permissions ? s.permissions : p(s.persona)?.permissions ?? [] : [];
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);
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
27
+ });
28
+ }
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))
40
+ })).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));
19
44
  return {
20
45
  product: e,
21
- tree: h,
22
- orphans: g,
23
- issues: ye(e),
24
- scenario: f,
25
- component: (s) => s ? a.get(s) : void 0,
26
- componentFixture: b,
27
- resolveComponentFixture: (s, m) => {
28
- const k = s ? a.get(s) : void 0, M = b(s, m), y = b(s, k?.defaultFixture) ?? k?.fixtures?.[0];
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];
29
53
  return {
30
- fixture: M ?? y,
54
+ fixture: E ?? N,
31
55
  requestedId: m,
32
- didFallback: !!(m && !M)
56
+ didFallback: !!(m && !E)
33
57
  };
34
58
  },
35
- persona: p,
36
- fixture: (s) => s ? d.get(s) : void 0,
37
- rule: (s) => s ? r.get(s) : void 0,
38
- module: (s) => s ? n.get(s) : void 0,
39
- flow: (s) => s ? c.get(s) : void 0,
40
- rulesOf: (s) => (s?.rules ?? []).map((m) => r.get(m)).filter((m) => !!m),
59
+ persona: d,
60
+ fixture: (i) => i ? c.get(i) : void 0,
61
+ rule: (i) => i ? p.get(i) : void 0,
62
+ screen: (i) => i ? M.get(i) : void 0,
63
+ screenForPath: L,
64
+ screenOf: (i) => {
65
+ const m = i ? w.get(i.id) : void 0;
66
+ return m ? M.get(m) : void 0;
67
+ },
68
+ screensFor: T,
69
+ rulesOf: (i) => (i?.rules ?? []).map((m) => p.get(m)).filter((m) => !!m),
41
70
  permissionsOf: _,
42
- scenariosForRoute: (s, m) => {
43
- const k = s.split("?")[0];
44
- return S(m).filter((M) => M.route.split("?")[0] === k);
71
+ scenariosForRoute: (i, m) => {
72
+ const v = L(i);
73
+ return v ? v.variations.filter((E) => Q(m?.handoff, E.id)) : [];
45
74
  },
46
75
  activeScenarios: S,
47
- treeFor: (s) => {
48
- const m = new Set(S(s).map((k) => k.id));
49
- return h.map((k) => ({
50
- ...k,
51
- scenarios: k.scenarios.filter((M) => m.has(M.id))
52
- }));
76
+ search: (i, m) => {
77
+ const v = G(i), E = S(m);
78
+ return v ? E.filter(
79
+ (N) => G(
80
+ [
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(" ")
88
+ ].join(" ")
89
+ ).includes(v)
90
+ ) : E;
53
91
  },
54
- orphansFor: (s) => {
55
- const m = new Set(S(s).map((k) => k.id));
56
- return g.filter((k) => m.has(k.id));
92
+ searchScreens: (i, m) => {
93
+ const v = G(i), E = T(m);
94
+ return v ? E.filter(
95
+ (N) => G(
96
+ [
97
+ N.name,
98
+ N.description ?? "",
99
+ N.id,
100
+ ...N.variations.flatMap((O) => [
101
+ O.title,
102
+ O.id,
103
+ (O.tags ?? []).join(" ")
104
+ ])
105
+ ].join(" ")
106
+ ).includes(v)
107
+ ) : E;
57
108
  },
58
- search: (s, m) => {
59
- const k = pe(s), M = S(m);
60
- return k ? M.filter((y) => {
61
- const E = n.get(y.id.split(".")[0] ?? "")?.name ?? "";
62
- return pe(
109
+ searchComponents: (i, m) => {
110
+ const v = G(i), E = $(m);
111
+ return v ? E.filter(
112
+ (N) => G(
63
113
  [
64
- y.title,
65
- y.id,
66
- y.intent ?? "",
67
- y.route,
68
- E,
69
- i.get(y.persona)?.name ?? "",
70
- (y.tags ?? []).join(" "),
71
- (y.expected ?? []).join(" ")
114
+ N.name,
115
+ N.description ?? "",
116
+ N.group ?? "",
117
+ N.id,
118
+ N.source ?? ""
72
119
  ].join(" ")
73
- ).includes(k);
74
- }) : M;
120
+ ).includes(v)
121
+ ) : E;
75
122
  },
76
- byStatus: (s, m) => S({ ...m, includePorted: !0 }).filter((k) => k.status === s),
77
- componentsFor: (s) => (e.components ?? []).filter(
78
- (m) => ee(s, m.id)
79
- ),
80
- coverage: (s) => {
81
- const m = Object.fromEntries(
82
- be.map((k) => [k, 0])
83
- );
84
- for (const k of S(s)) m[k.status] += 1;
85
- return m;
86
- }
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);
129
+ },
130
+ usagesOf: (i, m) => i ? T(m).filter(
131
+ (v) => v.variations.some((E) => E.components?.includes(i))
132
+ ) : []
87
133
  };
88
134
  }
89
- function pe(e) {
90
- return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim();
135
+ function G(e) {
136
+ return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g, "").trim();
91
137
  }
92
- const ge = [
138
+ function at(e) {
139
+ const n = e.split("/").filter(Boolean);
140
+ return n[n.length - 1] === "*" && n.pop(), `/${n.join("/")}`;
141
+ }
142
+ const it = [
143
+ { id: "mobile", label: "Celular", width: 375, height: 812 },
144
+ { id: "tablet", label: "Tablet", width: 768, height: 1024 },
145
+ { id: "desktop", label: "Desktop", width: 1280, height: 800 },
93
146
  { id: "fit", label: "Ajustar" },
94
- { id: "mobile", label: "Celular", width: 390, height: 844 },
95
- { id: "tablet", label: "Tablet", width: 834, height: 1112 },
96
- { id: "desktop", label: "Desktop", width: 1440, height: 900 },
97
147
  { id: "custom", label: "Personalizado" }
98
- ], Fe = [1, 1.25, 1.5, 2];
99
- function $e(e, o) {
100
- const a = new URLSearchParams(e), i = _e(a), d = a.get(w.component) ?? void 0, r = ee(i, d) ? o.component(d) : void 0, n = a.get(w.scenario) ?? void 0, c = r || !te(i, n) ? void 0 : o.scenario(n), h = a.get(w.fixture) ?? void 0, u = r ? h ?? o.componentFixture(r.id, r.defaultFixture)?.id ?? r.fixtures?.[0]?.id : void 0, g = a.get(w.network), f = Number(a.get(w.textScale)), p = a.get(w.view), b = c?.status === "ported" || p === "ported" || a.get(w.showPorted) === "1" ? "ported" : "active";
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);
101
151
  return {
102
152
  scenario: c?.id,
103
- handoff: i,
104
- view: b,
105
- showPorted: b === "ported",
106
- component: r?.id,
107
- persona: a.get(w.persona) ?? c?.persona,
108
- fixture: r ? u : h ?? c?.fixture,
109
- network: De(g) ? g : c?.network ?? "success",
110
- viewport: a.get(w.viewport) ?? "fit",
111
- customWidth: Ie(a.get(w.customWidth)),
112
- themeMode: a.get(w.themeMode) ?? o.product.theme?.modes?.[0],
113
- locale: a.get(w.locale) ?? o.product.theme?.locales?.[0],
114
- dataSource: a.get(w.dataSource) ?? o.product.dataSources?.default ?? "fixtures",
115
- chromeTheme: Oe(a.get(w.chromeTheme)) ? a.get(w.chromeTheme) : "dark",
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",
163
+ // Sem parâmetro, o tema do chrome fica em aberto: o shell resolve pela
164
+ // última escolha da pessoa e, na falta dela, pelo sistema.
165
+ chromeTheme: dt(o.get(C.chromeTheme)) ? o.get(C.chromeTheme) : void 0,
116
166
  // Chrome visível por padrão. `?chrome=0` é o modo de revisão limpa e captura
117
167
  // de tela, então precisa ser explícito para não sumir sem pedido.
118
- chrome: a.get(w.chrome) !== "0",
119
- keyboardMode: a.get(w.keyboardMode) === "1",
120
- reducedMotion: a.get(w.reducedMotion) === "1",
121
- textScale: Fe.includes(f) ? f : 1,
122
- inspector: a.get(w.inspector) !== "0"
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"
123
173
  };
124
174
  }
125
- function X(e, o) {
126
- const a = new URLSearchParams(), i = o.scenario(e.scenario);
127
- e.component ? a.set(w.component, e.component) : e.scenario && a.set(w.scenario, e.scenario), ce(e) === "ported" && a.set(w.view, "ported"), e.persona && e.persona !== i?.persona && a.set(w.persona, e.persona), e.component && e.fixture ? a.set(w.fixture, e.fixture) : e.fixture && e.fixture !== i?.fixture && a.set(w.fixture, e.fixture), e.network !== (i?.network ?? "success") && a.set(w.network, e.network), e.viewport !== "fit" && a.set(w.viewport, e.viewport), e.viewport === "custom" && e.customWidth && a.set(w.customWidth, String(e.customWidth));
128
- const d = o.product.theme?.modes?.[0];
129
- e.themeMode && e.themeMode !== d && a.set(w.themeMode, e.themeMode);
130
- const r = o.product.theme?.locales?.[0];
131
- e.locale && e.locale !== r && a.set(w.locale, e.locale);
132
- const n = o.product.dataSources?.default ?? "fixtures";
133
- e.dataSource && e.dataSource !== n && a.set(w.dataSource, e.dataSource), e.chromeTheme === "light" && a.set(w.chromeTheme, "light"), e.chrome || a.set(w.chrome, "0"), e.keyboardMode && a.set(w.keyboardMode, "1"), e.reducedMotion && a.set(w.reducedMotion, "1"), e.textScale !== 1 && a.set(w.textScale, String(e.textScale)), e.inspector || a.set(w.inspector, "0"), oe(a, e.handoff);
134
- const c = a.toString();
135
- return c ? `?${c}` : "";
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}` : "";
136
188
  }
137
- function Ee(e) {
138
- const [o, a] = F(() => ue());
139
- D(() => {
140
- const f = () => a(ue());
141
- return window.addEventListener("popstate", f), () => window.removeEventListener("popstate", f);
142
- }, []);
143
- const i = T(() => $e(o.search, e), [o.search, e]), d = R((f, p, b = !1) => {
144
- const S = `${f}${p}`;
145
- b ? window.history.replaceState(null, "", S) : window.history.pushState(null, "", S), a({ path: f, search: p });
146
- }, []), r = R(
147
- (f) => {
148
- const p = f.view ?? (f.showPorted === void 0 ? void 0 : f.showPorted ? "ported" : "active"), b = {
149
- ...i,
150
- ...f,
151
- ...p ? { view: p, showPorted: p === "ported" } : {}
152
- };
153
- d(o.path, X(b, e), !0);
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: $ });
201
+ };
202
+ window.addEventListener("message", h);
203
+ const S = de();
204
+ return ne(
205
+ 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(
215
+ window.parent === window ? void 0 : window.parent,
216
+ { ds: 1, type: "navigate", url: T, replace: S },
217
+ window.location.origin
218
+ );
219
+ return;
220
+ }
221
+ const L = `${d}${h}`;
222
+ S ? window.history.replaceState(null, "", L) : window.history.pushState(null, "", L), r({ path: d, search: h });
154
223
  },
155
- [i, o.path, d, e]
156
- ), n = R(
157
- (f) => {
158
- const p = e.scenario(i.scenario), b = !p || (f === "ported" ? p.status === "ported" : p.status !== "ported"), S = {
159
- ...i,
160
- view: f,
161
- showPorted: f === "ported",
162
- ...b ? {} : {
163
- scenario: void 0,
164
- persona: void 0,
165
- fixture: void 0,
166
- network: "success"
167
- }
168
- };
169
- d(b ? o.path : "/", X(S, e), !1);
224
+ [o]
225
+ ), p = W(
226
+ (d) => {
227
+ const h = { ...u, ...d };
228
+ c(a.path, J(h, e), !0);
170
229
  },
171
- [i, o.path, d, e]
172
- ), c = R(
173
- (f, p) => {
174
- const [b, S] = f.split("?"), _ = b || "/", s = new URLSearchParams(S ?? o.search);
175
- i.handoff && oe(s, i.handoff);
176
- const m = s.toString(), k = m ? `?${m}` : "";
177
- d(_, k, p?.replace ?? !1);
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);
178
237
  },
179
- [i.handoff, o.search, d]
180
- ), h = R(
181
- (f) => {
182
- const p = e.scenario(f);
183
- if (!p || !te(i.handoff, f)) return;
184
- const b = {
185
- ...i,
186
- scenario: p.id,
187
- view: p.status === "ported" ? "ported" : "active",
188
- showPorted: p.status === "ported",
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,
189
246
  component: void 0,
190
- persona: p.persona,
191
- fixture: p.fixture,
192
- network: p.network ?? "success"
247
+ persona: h.persona,
248
+ fixture: h.fixture,
249
+ network: h.network ?? "success"
250
+ };
251
+ c(h.route, J(S, e), !1);
252
+ },
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,
260
+ scenario: void 0,
261
+ component: S.id,
262
+ persona: void 0,
263
+ fixture: void 0,
264
+ network: "success"
193
265
  };
194
- d(p.route, X(b, e), !1);
266
+ L.fixture = e.componentFixture(S.id, S.defaultFixture)?.id ?? S.fixtures?.[0]?.id, c("/", J(L, e), h?.replace ?? !1);
195
267
  },
196
- [i, d, e]
197
- ), u = R(
198
- (f) => {
199
- const p = e.component(f);
200
- if (!p || !ee(i.handoff, f)) return;
201
- const b = {
202
- ...i,
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,
278
+ component: void 0,
279
+ persona: L.persona,
280
+ fixture: L.fixture,
281
+ network: L.network ?? "success"
282
+ };
283
+ c(L.route, J(_, e), h?.replace ?? !1);
284
+ return;
285
+ }
286
+ const T = {
287
+ ...u,
203
288
  scenario: void 0,
204
- component: p.id,
289
+ component: void 0,
205
290
  persona: void 0,
206
291
  fixture: void 0,
207
292
  network: "success"
208
293
  };
209
- b.fixture = e.componentFixture(p.id, p.defaultFixture)?.id ?? p.fixtures?.[0]?.id, d("/", X(b, e), !1);
294
+ c(S.href, J(T, e), h?.replace ?? !1);
210
295
  },
211
- [i, d, e]
212
- ), g = T(() => Re(i), [i]);
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]);
213
301
  return {
214
- location: o,
215
- controls: i,
216
- viewport: g,
217
- setControls: r,
218
- setScenarioView: n,
219
- navigate: c,
220
- openScenario: h,
221
- openComponent: u
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
222
311
  };
223
312
  }
224
- function ce(e) {
225
- return e.view ?? (e.showPorted ? "ported" : "active");
313
+ function ct(e) {
314
+ if (e.viewport === "custom")
315
+ return { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 };
316
+ const n = it.find((o) => o.id === e.viewport) ?? {
317
+ id: "fit",
318
+ label: "Ajustar"
319
+ };
320
+ return e.rotated && n.width && n.height ? { ...n, width: n.height, height: n.width } : { ...n };
226
321
  }
227
- function Re(e) {
228
- const o = ge.find((a) => a.id === e.viewport);
229
- return e.viewport === "custom" ? { id: "custom", label: "Personalizado", width: e.customWidth ?? 1024 } : o ?? { id: "fit", label: "Ajustar" };
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;
230
326
  }
231
- function ue() {
327
+ function de() {
232
328
  return typeof window > "u" ? { path: "/", search: "" } : { path: window.location.pathname, search: window.location.search };
233
329
  }
234
- function De(e) {
235
- return e !== null && ve.includes(e);
330
+ function lt(e) {
331
+ return e !== null && Fe.includes(e);
236
332
  }
237
- function Oe(e) {
333
+ function dt(e) {
238
334
  return e === "dark" || e === "light";
239
335
  }
240
- function Ie(e) {
241
- if (!e) return;
242
- const o = Number.parseInt(e, 10);
243
- return Number.isFinite(o) && o > 0 ? o : void 0;
244
- }
245
- const Be = 2500;
246
- class He extends Error {
247
- constructor(o) {
248
- super(`Falha de rede simulada no cenário "${o}".`), this.name = "SimulatedNetworkError";
249
- }
250
- }
251
- function se(e) {
252
- if (e)
253
- return typeof e.data == "function" ? e.data() : e.data;
254
- }
255
- const ie = {
256
- id: "fixtures",
257
- label: "Fixtures",
258
- load: async ({ scenario: e, fixture: o, network: a }) => {
259
- switch (a) {
260
- case "empty":
261
- return null;
262
- case "error":
263
- throw new He(e.id);
264
- case "loading":
265
- return new Promise(() => {
266
- });
267
- case "slow":
268
- return await We(Be), se(o);
269
- default:
270
- return se(o);
271
- }
272
- }
273
- };
274
- function Ct(e) {
275
- const { id: o, label: a, baseUrl: i, path: d, init: r, fallbackToFixture: n = !0 } = e;
276
- return {
277
- id: o,
278
- label: a,
279
- load: async (c) => {
280
- const h = new URL(d ? d(c) : c.scenario.route, i);
281
- try {
282
- const u = await fetch(h, r);
283
- if (!u.ok) throw new Error(`${u.status} ${u.statusText}`);
284
- return await u.json();
285
- } catch (u) {
286
- if (n) return se(c.fixture);
287
- throw new Error(`Adapter "${o}" falhou em ${h.toString()}`, { cause: u });
288
- }
289
- }
290
- };
336
+ function ut(e) {
337
+ return e === "variations" || e === "info";
291
338
  }
292
- function We(e) {
293
- return new Promise((o) => setTimeout(o, e));
294
- }
295
- function ze(e) {
296
- const { scenario: o, fixture: a, network: i, adapter: d } = e, [r, n] = F({
297
- data: void 0,
298
- isLoading: !!o,
299
- error: void 0
300
- });
301
- return D(() => {
302
- if (!o) {
303
- n({ data: void 0, isLoading: !1, error: void 0 });
304
- return;
305
- }
306
- let c = !0;
307
- n({ data: void 0, isLoading: !0, error: void 0 });
308
- const h = d ?? ie;
309
- return Promise.resolve(h.load({ scenario: o, fixture: a, network: i })).then((u) => {
310
- c && n({ data: u, isLoading: !1, error: void 0 });
311
- }).catch((u) => {
312
- c && n({
313
- data: void 0,
314
- isLoading: !1,
315
- error: u instanceof Error ? u : new Error(String(u))
316
- });
317
- }), () => {
318
- c = !1;
319
- };
320
- }, [o, a, i, d]), r;
339
+ function ht(e) {
340
+ if (!e) return;
341
+ const n = Number.parseInt(e, 10);
342
+ return Number.isFinite(n) && n > 0 ? n : void 0;
321
343
  }
322
- const Ue = {
323
- a: "link",
324
- article: "article",
325
- aside: "complementary",
326
- button: "button",
327
- dialog: "dialog",
328
- fieldset: "group",
329
- footer: "contentinfo",
330
- form: "form",
331
- h1: "heading",
332
- h2: "heading",
333
- h3: "heading",
334
- h4: "heading",
335
- h5: "heading",
336
- h6: "heading",
337
- header: "banner",
338
- hr: "separator",
339
- img: "img",
340
- li: "listitem",
341
- main: "main",
342
- nav: "navigation",
343
- ol: "list",
344
- option: "option",
345
- output: "status",
346
- progress: "progressbar",
347
- section: "region",
348
- select: "combobox",
349
- table: "table",
350
- tbody: "rowgroup",
351
- td: "cell",
352
- textarea: "textbox",
353
- th: "columnheader",
354
- tr: "row",
355
- ul: "list"
356
- }, je = {
357
- button: "button",
358
- checkbox: "checkbox",
359
- email: "textbox",
360
- image: "button",
361
- number: "spinbutton",
362
- radio: "radio",
363
- range: "slider",
364
- reset: "button",
365
- search: "searchbox",
366
- submit: "button",
367
- tel: "textbox",
368
- text: "textbox",
369
- url: "textbox"
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" })
348
+ ] }),
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" })
352
+ ] }),
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" })
356
+ ] }),
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" })
361
+ ] }),
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" })
367
+ ] }),
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" })
373
+ ] }),
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" })
378
+ ] }),
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" })
382
+ ] }),
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" })
387
+ ] }),
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" })
391
+ ] })
370
392
  };
371
- function Ke(e) {
372
- if (!e || !(e instanceof HTMLElement)) return;
373
- const { name: o, nameFrom: a } = qe(e);
374
- return {
375
- role: Ve(e),
376
- name: o,
377
- nameFrom: a,
378
- description: Ge(e),
379
- states: Ye(e),
380
- selector: Xe(e),
381
- hiddenFromTabOrder: e.tabIndex < 0,
382
- hiddenFromAssistiveTech: Je(e)
383
- };
384
- }
385
- function Ve(e) {
386
- const o = e.getAttribute("role");
387
- if (o) return o.split(/\s+/)[0] ?? o;
388
- const a = e.tagName.toLowerCase();
389
- if (a === "input") {
390
- const i = e.type.toLowerCase();
391
- return je[i] ?? "textbox";
392
- }
393
- return a === "a" && !e.hasAttribute("href") ? "generic" : Ue[a] ?? "generic";
394
- }
395
- function qe(e) {
396
- const o = e.getAttribute("aria-labelledby");
397
- if (o) {
398
- const n = o.split(/\s+/).map((c) => e.ownerDocument.getElementById(c)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
399
- if (n) return { name: n, nameFrom: "aria-labelledby" };
400
- }
401
- const a = e.getAttribute("aria-label")?.trim();
402
- if (a) return { name: a, nameFrom: "aria-label" };
403
- if (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) {
404
- const n = Array.from(e.labels ?? []).map((c) => c.textContent?.trim() ?? "").filter(Boolean);
405
- if (n.length) return { name: n.join(" "), nameFrom: "label" };
406
- }
407
- if (e instanceof HTMLImageElement) {
408
- const n = e.getAttribute("alt");
409
- if (n !== null) return { name: n, nameFrom: "alt" };
410
- }
411
- const i = e.getAttribute("title")?.trim(), d = Qe(e);
412
- return d ? { name: d, nameFrom: "content" } : i ? { name: i, nameFrom: "title" } : e instanceof HTMLInputElement && e.value ? { name: e.value, nameFrom: "value" } : e.getAttribute("placeholder")?.trim() ? { name: "", nameFrom: "none" } : { name: "", nameFrom: "none" };
413
- }
414
- function Ge(e) {
415
- const o = e.getAttribute("aria-describedby");
416
- if (o) {
417
- const a = o.split(/\s+/).map((i) => e.ownerDocument.getElementById(i)?.textContent?.trim() ?? "").filter(Boolean).join(" ");
418
- if (a) return a;
419
- }
420
- return e.getAttribute("aria-description")?.trim() || void 0;
421
- }
422
- function Ye(e) {
423
- const o = [], a = (i, d = i.replace("aria-", "")) => {
424
- const r = e.getAttribute(i);
425
- r !== null && r !== "false" && o.push(r === "true" || r === "" ? d : `${d}=${r}`);
426
- };
427
- return e.disabled && o.push("disabled"), e.getAttribute("aria-disabled") === "true" && o.push("disabled"), e.required && o.push("required"), e.readOnly && o.push("readonly"), e.checked && o.push("checked"), a("aria-expanded"), a("aria-selected"), a("aria-checked"), a("aria-pressed"), a("aria-current"), a("aria-invalid"), a("aria-busy"), a("aria-live"), a("aria-haspopup"), a("aria-level", "level"), e.ownerDocument.activeElement === e && o.push("focused"), [...new Set(o)];
428
- }
429
- function Je(e) {
430
- let o = e;
431
- for (; o; ) {
432
- if (o.getAttribute("aria-hidden") === "true" || o.hasAttribute("hidden")) return !0;
433
- o = o.parentElement;
434
- }
435
- return !1;
436
- }
437
- function Qe(e) {
438
- const o = e.cloneNode(!0);
439
- for (const a of o.querySelectorAll("[aria-hidden='true'],[hidden]"))
440
- a.remove();
441
- return (o.textContent ?? "").replace(/\s+/g, " ").trim().slice(0, 160);
442
- }
443
- function Xe(e) {
444
- const o = e.tagName.toLowerCase();
445
- if (e.id) return `${o}#${e.id}`;
446
- const a = e.getAttribute("data-testid");
447
- if (a) return `${o}[data-testid="${a}"]`;
448
- const i = Array.from(e.classList).slice(0, 2);
449
- return i.length ? `${o}.${i.join(".")}` : o;
450
- }
451
- function Ze(e = document) {
452
- const o = [
453
- "a[href]",
454
- "button",
455
- "input",
456
- "select",
457
- "textarea",
458
- "summary",
459
- "[tabindex]",
460
- "[contenteditable='true']"
461
- ].join(",");
462
- return Array.from(e.querySelectorAll(o)).filter((a) => {
463
- if (a.tabIndex < 0 || a.disabled || a.getAttribute("aria-hidden") === "true") return !1;
464
- const i = window.getComputedStyle(a);
465
- return i.display === "none" || i.visibility === "hidden" ? !1 : a.offsetWidth > 0 || a.offsetHeight > 0 || a === document.activeElement;
466
- });
467
- }
468
- function et(e, o) {
469
- const [a, i] = F(), [d, r] = F([]), n = R(() => {
470
- const c = o.current;
471
- if (!c) {
472
- r([]);
473
- return;
474
- }
475
- r(
476
- Ze(c).map((h, u) => ({
477
- index: u + 1,
478
- element: h,
479
- rect: h.getBoundingClientRect(),
480
- forcedOrder: h.tabIndex > 0
481
- }))
482
- );
483
- }, [o]);
484
- return D(() => {
485
- if (!e) {
486
- i(void 0), r([]);
487
- return;
393
+ function H({ name: e, size: n = 16 }) {
394
+ return /* @__PURE__ */ t(
395
+ "svg",
396
+ {
397
+ className: "ds-icon",
398
+ width: n,
399
+ height: n,
400
+ viewBox: "0 0 24 24",
401
+ fill: "none",
402
+ stroke: "currentColor",
403
+ strokeWidth: 1.75,
404
+ strokeLinecap: "round",
405
+ strokeLinejoin: "round",
406
+ "aria-hidden": "true",
407
+ focusable: "false",
408
+ children: pt[e]
488
409
  }
489
- const c = () => i(Ke(document.activeElement));
490
- document.addEventListener("focusin", c), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), c(), n();
491
- const h = o.current, u = h ? new MutationObserver(() => n()) : void 0;
492
- return u?.observe(h, { childList: !0, subtree: !0, attributes: !0 }), () => {
493
- document.removeEventListener("focusin", c), window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0), u?.disconnect();
494
- };
495
- }, [e, n, o]), { focused: a, tabStops: d, refresh: n };
410
+ );
496
411
  }
497
- const L = {
498
- status: {
499
- ported: "Portado — não validado",
500
- proposed: "Proposta",
501
- "in-review": "Em revisão",
502
- approved: "Aprovado",
503
- "in-implementation": "Em implementação",
504
- implemented: "Implementado",
505
- superseded: "Superado"
506
- },
507
- statusMeaning: {
508
- ported: "Veio do sistema existente, mas não foi validado e não representa compromisso de implementação.",
509
- proposed: "Exploração ainda não aprovada.",
510
- "in-review": "Aberto para validação de design, negócio ou cliente.",
511
- approved: "Referência autorizada, registrada por URL de commit.",
512
- "in-implementation": "Ligado a um trabalho ativo de engenharia.",
513
- implemented: "Disponível no produto real e validado.",
514
- superseded: "Mantido para histórico ou substituído por outra decisão."
515
- },
412
+ const Y = {
516
413
  network: {
517
414
  success: "Sucesso",
518
415
  loading: "Carregando",
@@ -520,11 +417,6 @@ const L = {
520
417
  error: "Erro",
521
418
  slow: "Lento"
522
419
  },
523
- keyboard: {
524
- full: "Jornada completável só por teclado",
525
- partial: "Parcialmente operável por teclado",
526
- "not-applicable": "Não se aplica"
527
- },
528
420
  viewport: {
529
421
  fit: "Ajustar",
530
422
  mobile: "Celular",
@@ -533,174 +425,119 @@ const L = {
533
425
  custom: "Personalizado"
534
426
  },
535
427
  topbar: {
536
- homeTitle: (e) => `Ir para a página inicial de ${e}`,
537
- toggleNav: "Mostrar ou ocultar a navegação",
428
+ region: "Barra do Design Space",
429
+ viewportGroup: "Viewport",
430
+ rotate: "Girar",
431
+ zoomOut: "Diminuir zoom",
432
+ zoomIn: "Aumentar zoom",
433
+ zoomReset: "Voltar o zoom para 100%",
434
+ zoomValue: (e) => `${e}%`,
538
435
  copyLink: "Copiar link",
539
436
  copied: "Link copiado",
540
- copyPrompt: "Copie o link do cenário:",
541
- cleanReview: "Revisão limpa",
542
- cleanReviewTitle: "Abrir a situação em uma nova aba, sem o chrome do Design Space",
543
- panel: "Painel",
544
- lightMode: "Modo claro",
545
- darkMode: "Modo escuro",
437
+ copyPrompt: "Copie o link:",
438
+ cleanReview: "Revisão limpa (Shift+C)",
439
+ lightMode: "Tema claro",
440
+ darkMode: "Tema escuro",
441
+ engineVersion: (e) => `Design Space ${e}`,
442
+ diagnostics: (e, n) => `Diagnóstico: ${e} ${e === 1 ? "erro" : "erros"}, ${n} ${n === 1 ? "aviso" : "avisos"}`,
546
443
  branchTitle: (e) => `Branch: ${e}`,
547
444
  commitTitle: (e) => `Commit: ${e}`,
548
445
  envTitle: (e) => `Ambiente: ${e}`
549
446
  },
550
447
  sidebar: {
551
- region: "Cenários do produto",
552
- flowsTab: "Fluxos",
448
+ region: "Navegação",
449
+ tabs: "Telas e componentes",
450
+ screensTab: "Telas",
553
451
  componentsTab: "Componentes",
554
- searchPlaceholder: "Buscar situação…",
555
- searchLabel: "Buscar cenário pelo vocabulário do produto",
556
- componentSearchPlaceholder: "Buscar componente…",
557
- componentSearchLabel: "Buscar componente do produto",
452
+ searchPlaceholder: "Buscar",
453
+ searchLabel: "Buscar telas e componentes",
558
454
  searchShortcut: "⌘K",
559
- noMatch: (e) => `Nenhuma situação para "${e}".`,
560
- matchCount: (e) => `${e} ${e === 1 ? "situação" : "situações"}.`,
561
- noComponentMatch: (e) => `Nenhum componente para "${e}".`,
562
- componentMatchCount: (e) => `${e} ${e === 1 ? "componente" : "componentes"}.`,
563
- activeWork: "Trabalho ativo",
564
- portedReferences: (e) => `Referências portadas · ${e}`,
565
- viewPorted: (e) => `Ver ${e} ${e === 1 ? "referência portada" : "referências portadas"}`,
566
- backToActive: "Voltar ao trabalho ativo",
567
- currentView: (e) => `Visão atual: ${e}`,
568
- noActiveWork: "Não há cenários no trabalho ativo.",
569
- noPortedReferences: "Não há referências portadas.",
570
- showPorted: "Mostrar portados",
571
- activePorted: "Aberto por link direto; oculto do trabalho ativo",
572
- emptyModule: "Nenhum cenário ainda.",
455
+ noMatch: (e) => `Nada encontrado para "${e}".`,
456
+ emptyScreens: "Nenhuma tela neste branch. Telas de feature entram por PR, enquanto estão em desenho.",
573
457
  emptyComponents: "O produto ainda não registrou componentes.",
574
- withoutModule: "Sem módulo",
575
- scope: "Escopo ativo",
576
- scopeData: "Dados",
577
- scopePersona: "Persona",
578
- scopeNetwork: "Rede"
458
+ ungrouped: "Outros",
459
+ toggleGroup: (e) => `Mostrar ou ocultar ${e}`,
460
+ resize: "Redimensionar a navegação"
579
461
  },
580
- controls: {
581
- region: "Controles do cenário",
462
+ panel: {
463
+ region: "Painel",
464
+ searchPlaceholder: "Filtrar",
465
+ searchLabel: "Filtrar variações e informações",
466
+ searchShortcut: "⌘F",
467
+ noMatch: (e) => `Nada neste painel para "${e}".`,
468
+ tabs: "Variações e informações",
469
+ variationsTab: "Variações",
470
+ infoTab: "Informações",
471
+ resize: "Redimensionar o painel",
472
+ variationsList: "Variações da tela",
473
+ defaultVariation: "Padrão",
474
+ defaultVariationHint: "A tela sem cenário declarado, sem fixture.",
475
+ noVariations: "Esta tela não tem variações.",
476
+ noComponentVariations: "Este componente não declara variações de dados.",
477
+ nothingSelected: "Escolha uma tela ou um componente na navegação.",
582
478
  persona: "Persona",
583
- fixture: "Dados",
584
- componentFixture: "Dados do componente",
585
- network: "Rede",
586
- viewport: "Viewport",
587
- customWidth: "Largura personalizada em pixels",
479
+ network: "Estado de rede",
588
480
  theme: "Tema",
589
481
  locale: "Idioma",
590
- dataSource: "Fonte",
482
+ dataSource: "Fonte de dados",
591
483
  fixturesOption: "Fixtures",
592
- a11y: "Acessibilidade",
593
- keyboardMode: "Teclado",
594
- keyboardModeTitle: "Percorrer a jornada só por teclado, com foco visível e ordem de tabulação evidenciada",
595
- reducedMotion: "Movimento",
596
- reducedMotionTitle: "Reduzir movimento dentro do palco",
597
- textScale: "Ampliação de texto",
598
- none: "—"
484
+ none: "—",
485
+ fixtureFallback: (e, n) => `A variação \`${e}\` não existe neste componente. Exibindo \`${n}\`.`
599
486
  },
600
- inspector: {
601
- region: "Painel de contexto",
602
- tabScenario: "Cenário",
603
- tabA11y: "Acessibilidade",
604
- tabDiagnostics: "Diagnóstico",
605
- diagnosticsWithErrors: (e) => `Diagnóstico (${e})`,
606
- noScenario: "Nenhum cenário ativo. Escolha uma situação na navegação para ver contexto, regras e critérios.",
607
- componentReference: "Componente",
608
- componentGroup: "Grupo",
609
- componentFixture: "Fixture ativa",
610
- componentFixtureDescription: "Descrição da fixture",
611
- componentFixtureFallback: (e, o) => `A fixture \`${e}\` não existe neste componente. Exibindo \`${o}\` como fallback.`,
612
- taskScope: "Dados desta tarefa",
613
- taskScopeDescription: "Contrato e estado autorizados para a situação ativa.",
614
- inheritedScope: "Contexto herdado do produto e da persona",
615
- inheritedScopeDescription: "Informações compartilhadas que ajudam a interpretar a tarefa, mas não pertencem só a ela.",
616
- screenScope: "Inspeção da tela atual",
617
- screenScopeDescription: "Leitura ao vivo do que está renderizado no palco agora.",
618
- productScope: "Verificações gerais do produto",
619
- productScopeDescription: "Resultados compartilhados por todo o catálogo, não só por esta tarefa.",
620
- situation: "Situação",
621
- reproduction: "Reprodução",
487
+ info: {
488
+ screen: "Tela",
489
+ variation: "Variação",
490
+ component: "Componente",
491
+ name: "Nome",
622
492
  id: "Id",
493
+ group: "Grupo",
494
+ description: "Descrição",
495
+ source: "Origem",
496
+ usedIn: "Usado em",
497
+ notUsed: "Nenhuma tela declara este componente.",
623
498
  route: "Rota",
624
499
  persona: "Persona",
625
- personaSwapped: "trocada",
626
- data: "Dados",
627
- network: "Rede",
628
- goal: (e) => `Objetivo: ${e}`,
629
- permissions: "Permissões efetivas",
500
+ permissions: "Permissões",
501
+ intent: "Intenção",
630
502
  preconditions: "Pré-condições",
503
+ actions: "Ações",
504
+ expected: "Comportamento esperado",
631
505
  rules: "Regras",
632
- actions: "Ações disponíveis",
633
- expected: "Critérios de aceite",
634
- approval: "Aprovação",
635
- approvalPendingStatus: "Aprovado — registro pendente",
636
- approvalPendingMeaning: "O status foi marcado como aprovado, mas ainda não há URL de commit que registre a versão autorizada.",
637
- approvalMissing: "A aprovação ainda não está completamente registrada. Preencha approvedAt com a URL imutável do commit aprovado.",
638
- openApproved: "Abrir a versão aprovada",
639
- engineering: "Engenharia",
640
- a11yContract: "Contrato do cenário",
641
- keyboard: "Teclado",
642
- contrast: "Contraste",
643
- contrastTarget: (e) => `WCAG 2.2 ${e}`,
644
- announces: "Precisa ser anunciado:",
645
- focusedElement: "Elemento em foco",
646
- keyboardModeOff: "Ligue o modo teclado na barra de controles para inspecionar a árvore acessível.",
647
- pressTab: (e) => `Pressione Tab dentro do palco. ${e} paradas de tabulação foram encontradas.`,
648
- role: "Papel",
649
- name: "Nome",
650
- noAccessibleName: "sem nome acessível",
651
- nameFrom: "Nome vem de",
652
- description: "Descrição",
653
- selector: "Seletor",
654
- focusableButHidden: "Este elemento é focável mas está escondido de tecnologia assistiva. Um leitor de tela recebe foco sem receber conteúdo.",
655
- tabStopsInStage: (e) => `${e} paradas de tabulação no palco.`,
656
- tokenContrast: "Contraste dos tokens",
657
- noContrastPairs: "O produto não declarou pares de contraste em theme.contrastPairs. Contraste é propriedade de par de cores: declarar aqui valida na origem, uma vez.",
658
- pair: "Par",
659
- ratio: "Razão",
660
- pairsFailing: (e) => `${e} ${e === 1 ? "par" : "pares"} fora do alvo. O teste de tokens do produto falha o build por isso.`,
661
- automatedIsFloor: "Verificação automática é piso, não teto. Ordem de leitura confusa, rótulo tecnicamente presente mas sem sentido e fluxo impossível de completar com leitor de tela passam no axe.",
662
- coverage: "Cobertura por status",
663
- scenariosRegistered: (e) => `${e} cenários registrados.`,
664
- scenarioContract: "Contrato de cenário",
506
+ components: "Componentes usados",
507
+ ticket: "Ticket",
508
+ copyForPr: "Copiar para o PR",
509
+ copiedForPr: "Copiado",
510
+ copyPrompt: "Copie o texto para o PR:"
511
+ },
512
+ diagnostics: {
513
+ title: "Diagnóstico",
665
514
  noIssues: "Nenhum problema encontrado.",
666
- diagnosticsProductNotice: "Este diagnóstico avalia o catálogo inteiro do produto, inclusive itens fora da tarefa e do handoff ativos."
515
+ error: "Erro",
516
+ warning: "Aviso",
517
+ close: "Fechar diagnóstico"
667
518
  },
668
- home: {
669
- lead: (e) => `Especificação executável: cada situação abaixo abre por link, com persona, dados e regras próprios. ${e} ${e === 1 ? "situação registrada" : "situações registradas"}.`,
670
- statusLegend: "Legenda dos status",
671
- withoutModule: "Sem módulo",
672
- withoutModuleHint: "O prefixo do id não corresponde a nenhum módulo registrado, então estas situações não aparecem na navegação por módulo.",
673
- emptyModule: "Nenhuma situação registrada neste módulo ainda.",
674
- keyboardBadge: "teclado",
675
- noActiveWork: "Não há cenários no trabalho ativo.",
676
- noPortedReferences: "Não há referências portadas nesta coleção."
519
+ pr: {
520
+ variations: "Variações",
521
+ components: "Componentes",
522
+ component: "Componente",
523
+ source: "Origem",
524
+ expected: "Comportamento esperado",
525
+ commit: (e) => `Commit \`${e}\``,
526
+ immutableLink: "link deste deployment",
527
+ noExpected: "Sem comportamento esperado declarado.",
528
+ empty: "—"
677
529
  },
678
530
  shell: {
679
- restoreChrome: "Mostrar controles",
531
+ restoreChrome: "Mostrar o chrome (Shift+C)",
532
+ frameTitle: (e) => `Pré-visualização de ${e}`,
680
533
  noRoute: "Nenhuma rota para este endereço",
681
- noRouteHint: "não casa com nenhuma rota declarada. Escolha uma situação na navegação.",
534
+ noRouteHint: "não casa com nenhuma rota declarada. Escolha uma tela na navegação.",
682
535
  outsideHandoff: "Fora do escopo deste handoff",
683
- outsideHandoffHint: "Este link permite revisar somente os cenários, rotas e componentes listados no handoff. Escolha um item disponível na navegação."
536
+ outsideHandoffHint: "Este link permite revisar somente os cenários, rotas e componentes listados no handoff. Escolha um item disponível na navegação.",
537
+ empty: "Nada para mostrar ainda",
538
+ emptyHint: "O produto ainda não registrou telas nem componentes."
684
539
  }
685
- }, Tt = {
686
- status: {
687
- ported: "Ported — not validated",
688
- proposed: "Proposed",
689
- "in-review": "In review",
690
- approved: "Approved",
691
- "in-implementation": "In implementation",
692
- implemented: "Implemented",
693
- superseded: "Superseded"
694
- },
695
- statusMeaning: {
696
- ported: "Imported from the existing system, but not validated and not an implementation commitment.",
697
- proposed: "Exploration that has not been approved yet.",
698
- "in-review": "Open for design, business, or client validation.",
699
- approved: "Authorized reference, recorded with a commit URL.",
700
- "in-implementation": "Linked to active engineering work.",
701
- implemented: "Available in the real product and validated.",
702
- superseded: "Kept for history or replaced by another decision."
703
- },
540
+ }, jt = {
704
541
  network: {
705
542
  success: "Success",
706
543
  loading: "Loading",
@@ -708,11 +545,6 @@ const L = {
708
545
  error: "Error",
709
546
  slow: "Slow"
710
547
  },
711
- keyboard: {
712
- full: "Journey can be completed with keyboard only",
713
- partial: "Partially operable with keyboard",
714
- "not-applicable": "Not applicable"
715
- },
716
548
  viewport: {
717
549
  fit: "Fit",
718
550
  mobile: "Mobile",
@@ -721,1576 +553,1496 @@ const L = {
721
553
  custom: "Custom"
722
554
  },
723
555
  topbar: {
724
- homeTitle: (e) => `Go to ${e} home`,
725
- toggleNav: "Show or hide navigation",
556
+ region: "Design Space bar",
557
+ viewportGroup: "Viewport",
558
+ rotate: "Rotate",
559
+ zoomOut: "Zoom out",
560
+ zoomIn: "Zoom in",
561
+ zoomReset: "Reset zoom to 100%",
562
+ zoomValue: (e) => `${e}%`,
726
563
  copyLink: "Copy link",
727
564
  copied: "Link copied",
728
- copyPrompt: "Copy the scenario link:",
729
- cleanReview: "Clean review",
730
- cleanReviewTitle: "Open this state in a new tab without the Design Space chrome",
731
- panel: "Panel",
732
- lightMode: "Light mode",
733
- darkMode: "Dark mode",
565
+ copyPrompt: "Copy the link:",
566
+ cleanReview: "Clean review (Shift+C)",
567
+ lightMode: "Light theme",
568
+ darkMode: "Dark theme",
569
+ engineVersion: (e) => `Design Space ${e}`,
570
+ diagnostics: (e, n) => `Diagnostics: ${e} ${e === 1 ? "error" : "errors"}, ${n} ${n === 1 ? "warning" : "warnings"}`,
734
571
  branchTitle: (e) => `Branch: ${e}`,
735
572
  commitTitle: (e) => `Commit: ${e}`,
736
573
  envTitle: (e) => `Environment: ${e}`
737
574
  },
738
575
  sidebar: {
739
- region: "Product scenarios",
740
- flowsTab: "Flows",
576
+ region: "Navigation",
577
+ tabs: "Screens and components",
578
+ screensTab: "Screens",
741
579
  componentsTab: "Components",
742
- searchPlaceholder: "Search scenarios…",
743
- searchLabel: "Search scenarios using product language",
744
- componentSearchPlaceholder: "Search components…",
745
- componentSearchLabel: "Search product components",
580
+ searchPlaceholder: "Search",
581
+ searchLabel: "Search screens and components",
746
582
  searchShortcut: "⌘K",
747
- noMatch: (e) => `No scenarios found for "${e}".`,
748
- matchCount: (e) => `${e} ${e === 1 ? "scenario" : "scenarios"}.`,
749
- noComponentMatch: (e) => `No components found for "${e}".`,
750
- componentMatchCount: (e) => `${e} ${e === 1 ? "component" : "components"}.`,
751
- activeWork: "Active work",
752
- portedReferences: (e) => `Ported references · ${e}`,
753
- viewPorted: (e) => `View ${e} ported ${e === 1 ? "reference" : "references"}`,
754
- backToActive: "Back to active work",
755
- currentView: (e) => `Current view: ${e}`,
756
- noActiveWork: "There are no scenarios in active work.",
757
- noPortedReferences: "There are no ported references.",
758
- showPorted: "Show ported",
759
- activePorted: "Opened by direct link; hidden from active work",
760
- emptyModule: "No scenarios yet.",
583
+ noMatch: (e) => `Nothing found for "${e}".`,
584
+ emptyScreens: "No screens on this branch. Feature screens come in through a pull request while they are being designed.",
761
585
  emptyComponents: "The product has not registered any components yet.",
762
- withoutModule: "No module",
763
- scope: "Active scope",
764
- scopeData: "Data",
765
- scopePersona: "Persona",
766
- scopeNetwork: "Network"
586
+ ungrouped: "Other",
587
+ toggleGroup: (e) => `Show or hide ${e}`,
588
+ resize: "Resize navigation"
767
589
  },
768
- controls: {
769
- region: "Scenario controls",
590
+ panel: {
591
+ region: "Panel",
592
+ searchPlaceholder: "Filter",
593
+ searchLabel: "Filter variations and details",
594
+ searchShortcut: "⌘F",
595
+ noMatch: (e) => `Nothing in this panel for "${e}".`,
596
+ tabs: "Variations and information",
597
+ variationsTab: "Variations",
598
+ infoTab: "Information",
599
+ resize: "Resize panel",
600
+ variationsList: "Screen variations",
601
+ defaultVariation: "Default",
602
+ defaultVariationHint: "The screen without a declared scenario or fixture.",
603
+ noVariations: "This screen has no variations.",
604
+ noComponentVariations: "This component does not declare data variations.",
605
+ nothingSelected: "Choose a screen or a component in the navigation.",
770
606
  persona: "Persona",
771
- fixture: "Data",
772
- componentFixture: "Component data",
773
- network: "Network",
774
- viewport: "Viewport",
775
- customWidth: "Custom width in pixels",
607
+ network: "Network state",
776
608
  theme: "Theme",
777
609
  locale: "Language",
778
- dataSource: "Source",
610
+ dataSource: "Data source",
779
611
  fixturesOption: "Fixtures",
780
- a11y: "Accessibility",
781
- keyboardMode: "Keyboard",
782
- keyboardModeTitle: "Complete the journey with keyboard only, showing focus and tab order",
783
- reducedMotion: "Motion",
784
- reducedMotionTitle: "Reduce motion inside the stage",
785
- textScale: "Text size",
786
- none: "—"
612
+ none: "—",
613
+ fixtureFallback: (e, n) => `Variation \`${e}\` does not exist for this component. Showing \`${n}\`.`
787
614
  },
788
- inspector: {
789
- region: "Context panel",
790
- tabScenario: "Scenario",
791
- tabA11y: "Accessibility",
792
- tabDiagnostics: "Diagnostics",
793
- diagnosticsWithErrors: (e) => `Diagnostics (${e})`,
794
- noScenario: "No active scenario. Choose a state in the navigation to see its context, rules, and criteria.",
795
- componentReference: "Component",
796
- componentGroup: "Group",
797
- componentFixture: "Active fixture",
798
- componentFixtureDescription: "Fixture description",
799
- componentFixtureFallback: (e, o) => `Fixture \`${e}\` does not exist for this component. Showing \`${o}\` as fallback.`,
800
- taskScope: "This task",
801
- taskScopeDescription: "The contract and authorized state for the active scenario.",
802
- inheritedScope: "Inherited product and persona context",
803
- inheritedScopeDescription: "Shared information that helps interpret the task but does not belong only to it.",
804
- screenScope: "Current screen inspection",
805
- screenScopeDescription: "A live reading of what is rendered in the stage now.",
806
- productScope: "Product-wide checks",
807
- productScopeDescription: "Results shared across the catalog, not only this task.",
808
- situation: "State",
809
- reproduction: "Reproduction",
615
+ info: {
616
+ screen: "Screen",
617
+ variation: "Variation",
618
+ component: "Component",
619
+ name: "Name",
810
620
  id: "ID",
621
+ group: "Group",
622
+ description: "Description",
623
+ source: "Source",
624
+ usedIn: "Used in",
625
+ notUsed: "No screen declares this component.",
811
626
  route: "Route",
812
627
  persona: "Persona",
813
- personaSwapped: "changed",
814
- data: "Data",
815
- network: "Network",
816
- goal: (e) => `Goal: ${e}`,
817
- permissions: "Effective permissions",
628
+ permissions: "Permissions",
629
+ intent: "Intent",
818
630
  preconditions: "Preconditions",
631
+ actions: "Actions",
632
+ expected: "Expected behavior",
819
633
  rules: "Rules",
820
- actions: "Available actions",
821
- expected: "Acceptance criteria",
822
- approval: "Approval",
823
- approvalPendingStatus: "Approved — record pending",
824
- approvalPendingMeaning: "The status is approved, but there is no commit URL recording the authorized version yet.",
825
- approvalMissing: "Approval is not fully recorded yet. Fill approvedAt with the immutable URL of the approved commit.",
826
- openApproved: "Open approved version",
827
- engineering: "Engineering",
828
- a11yContract: "Scenario contract",
829
- keyboard: "Keyboard",
830
- contrast: "Contrast",
831
- contrastTarget: (e) => `WCAG 2.2 ${e}`,
832
- announces: "Must be announced:",
833
- focusedElement: "Focused element",
834
- keyboardModeOff: "Turn on keyboard mode in the controls to inspect the accessibility tree.",
835
- pressTab: (e) => `Press Tab inside the stage. ${e} tab ${e === 1 ? "stop was" : "stops were"} found.`,
836
- role: "Role",
837
- name: "Name",
838
- noAccessibleName: "no accessible name",
839
- nameFrom: "Name source",
840
- description: "Description",
841
- selector: "Selector",
842
- focusableButHidden: "This element is focusable but hidden from assistive technology. A screen reader receives focus without receiving content.",
843
- tabStopsInStage: (e) => `${e} tab ${e === 1 ? "stop" : "stops"} in the stage.`,
844
- tokenContrast: "Token contrast",
845
- noContrastPairs: "The product has not declared contrast pairs in theme.contrastPairs. Contrast belongs to a pair of colors; declaring pairs here validates them once, at the source.",
846
- pair: "Pair",
847
- ratio: "Ratio",
848
- pairsFailing: (e) => `${e} ${e === 1 ? "pair is" : "pairs are"} below the target. The product token test fails the build for this.`,
849
- automatedIsFloor: "Automated checks are a floor, not a ceiling. Confusing reading order, technically present but meaningless labels, and journeys that cannot be completed with a screen reader can still pass automated tools.",
850
- coverage: "Coverage by status",
851
- scenariosRegistered: (e) => `${e} ${e === 1 ? "scenario" : "scenarios"} registered.`,
852
- scenarioContract: "Scenario contract",
634
+ components: "Components used",
635
+ ticket: "Ticket",
636
+ copyForPr: "Copy for PR",
637
+ copiedForPr: "Copied",
638
+ copyPrompt: "Copy the text for the PR:"
639
+ },
640
+ diagnostics: {
641
+ title: "Diagnostics",
853
642
  noIssues: "No issues found.",
854
- diagnosticsProductNotice: "These diagnostics evaluate the entire product catalog, including items outside the active task and handoff."
643
+ error: "Error",
644
+ warning: "Warning",
645
+ close: "Close diagnostics"
855
646
  },
856
- home: {
857
- lead: (e) => `Executable specification: each state below opens from a link with its own persona, data, and rules. ${e} ${e === 1 ? "state registered" : "states registered"}.`,
858
- statusLegend: "Status legend",
859
- withoutModule: "No module",
860
- withoutModuleHint: "The ID prefix does not match a registered module, so these states do not appear in module navigation.",
861
- emptyModule: "No states have been registered in this module yet.",
862
- keyboardBadge: "keyboard",
863
- noActiveWork: "There are no scenarios in active work.",
864
- noPortedReferences: "There are no ported references in this collection."
647
+ pr: {
648
+ variations: "Variations",
649
+ components: "Components",
650
+ component: "Component",
651
+ source: "Source",
652
+ expected: "Expected behavior",
653
+ commit: (e) => `Commit \`${e}\``,
654
+ immutableLink: "this deployment",
655
+ noExpected: "No expected behavior declared.",
656
+ empty: "—"
865
657
  },
866
658
  shell: {
867
- restoreChrome: "Show controls",
659
+ restoreChrome: "Show chrome (Shift+C)",
660
+ frameTitle: (e) => `${e} preview`,
868
661
  noRoute: "No route for this address",
869
- noRouteHint: "does not match any declared route. Choose a state from the navigation.",
662
+ noRouteHint: "does not match any declared route. Choose a screen from the navigation.",
870
663
  outsideHandoff: "Outside this handoff scope",
871
- outsideHandoffHint: "This link only allows review of the scenarios, routes, and components listed in the handoff. Choose an available item from the navigation."
664
+ outsideHandoffHint: "This link only allows review of the scenarios, routes, and components listed in the handoff. Choose an available item from the navigation.",
665
+ empty: "Nothing to show yet",
666
+ emptyHint: "The product has not registered any screens or components yet."
872
667
  }
873
668
  };
874
- function tt(e) {
875
- if (!e) return L;
876
- const o = { ...L };
877
- for (const a of Object.keys(L)) {
878
- const i = e[a];
879
- i && (o[a] = { ...L[a], ...i });
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 });
880
675
  }
881
- return o;
676
+ return n;
882
677
  }
883
- const we = Se(L);
884
- function P() {
885
- return Ne(we);
678
+ const De = Ye(Y);
679
+ function q() {
680
+ return Ze(De);
886
681
  }
887
- const At = L.status, Pt = L.statusMeaning, Lt = L.network, Ft = L.keyboard;
888
- function ot({
889
- registry: e,
890
- activeScenario: o,
891
- activeComponent: a,
892
- controls: i,
893
- onOpenScenario: d,
894
- onOpenComponent: r,
895
- onViewChange: n
682
+ const Gt = Y.network, wt = [
683
+ { id: "mobile", icon: "mobile" },
684
+ { id: "tablet", icon: "tablet" },
685
+ { id: "desktop", icon: "desktop" },
686
+ { 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;
690
+ }
691
+ function gt({
692
+ productName: e,
693
+ viewportId: n,
694
+ viewport: o,
695
+ zoom: a,
696
+ 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
896
705
  }) {
897
- const c = P(), [h, u] = F(a ? "components" : "flows"), [g, f] = F(""), [p, b] = F(/* @__PURE__ */ new Set()), S = re(null), _ = re(/* @__PURE__ */ new Map()), s = ce(i), m = i.handoff, k = e.byStatus("ported", { handoff: m }).length, M = e.activeScenarios({ view: s, handoff: m }).length, y = s === "ported" ? c.sidebar.portedReferences(k) : c.sidebar.activeWork;
898
- D(() => {
899
- a ? u("components") : o && u("flows");
900
- }, [a, o]), D(() => {
901
- const v = (x) => {
902
- rt(x) && (x.preventDefault(), S.current?.focus(), S.current?.select());
903
- };
904
- return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
905
- }, []);
906
- const E = T(() => {
907
- if (g.trim())
908
- return new Set(
909
- e.search(g, { view: s, handoff: m }).map((v) => v.id)
910
- );
911
- }, [m, g, e, s]), $ = T(() => {
912
- const v = me(g);
913
- return e.componentsFor(m).filter(
914
- (x) => me([x.name, x.id, x.group, x.description].join(" ")).includes(
915
- v
706
+ const M = q(), y = M.topbar, [d, h] = z(!1), S = (n === "mobile" || n === "tablet") && !!(o.width && o.height), L = async () => {
707
+ try {
708
+ await navigator.clipboard.writeText(c);
709
+ } catch {
710
+ window.prompt(y.copyPrompt, c);
711
+ }
712
+ h(!0), window.setTimeout(() => h(!1), 1600);
713
+ };
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(
718
+ "a",
719
+ {
720
+ className: "ds-topbar__version",
721
+ href: `https://www.npmjs.com/package/${mt}/v/${xe}`,
722
+ target: "_blank",
723
+ rel: "noreferrer",
724
+ children: y.engineVersion(xe)
725
+ }
916
726
  )
917
- );
918
- }, [m, g, e]), O = (v) => E ? v.filter((x) => E.has(x.id)) : v, G = {
919
- view: s,
920
- handoff: m
921
- }, I = e.treeFor(G).map((v) => ({ ...v, scenarios: O(v.scenarios) })).filter((v) => v.scenarios.length > 0), B = O(e.orphansFor(G)), U = I.reduce((v, x) => v + x.scenarios.length, 0) + B.length, H = nt($), j = h === "flows" ? [...I.flatMap((v) => v.scenarios), ...B].map((v) => v.id) : $.map((v) => v.id), Y = (v, x) => {
922
- if (j.length === 0) return;
923
- const N = st(j, v, x);
924
- N && _.current.get(N)?.focus();
925
- }, K = (v) => {
926
- v.key === "ArrowDown" ? (v.preventDefault(), Y(void 0, 1)) : v.key === "Escape" && f("");
927
- }, V = (v, x) => {
928
- x.key !== "ArrowDown" && x.key !== "ArrowUp" || (x.preventDefault(), Y(v, x.key === "ArrowDown" ? 1 : -1));
929
- }, q = (v, x) => {
930
- x ? _.current.set(v, x) : _.current.delete(v);
931
- }, J = (v) => b((x) => {
932
- const N = new Set(x);
933
- return N.has(v) ? N.delete(v) : N.add(v), N;
934
- });
935
- return /* @__PURE__ */ l("nav", { className: "ds-chrome ds-sidebar", "aria-label": c.sidebar.region, children: [
936
- /* @__PURE__ */ l("div", { className: "ds-sidebar__tabs", role: "tablist", children: [
727
+ ] }),
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(
733
+ "button",
734
+ {
735
+ type: "button",
736
+ 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 })
742
+ },
743
+ T.id
744
+ );
745
+ }),
746
+ /* @__PURE__ */ t(
747
+ "button",
748
+ {
749
+ type: "button",
750
+ className: "ds-btn ds-btn--icon",
751
+ "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" })
757
+ }
758
+ )
759
+ ] }),
760
+ /* @__PURE__ */ g("div", { className: "ds-group", role: "group", children: [
761
+ /* @__PURE__ */ t(
762
+ "button",
763
+ {
764
+ type: "button",
765
+ 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" })
771
+ }
772
+ ),
773
+ /* @__PURE__ */ t(
774
+ "button",
775
+ {
776
+ type: "button",
777
+ className: "ds-btn ds-btn--zoom",
778
+ "aria-label": y.zoomReset,
779
+ title: y.zoomReset,
780
+ onClick: () => w(ie),
781
+ children: y.zoomValue(a)
782
+ }
783
+ ),
784
+ /* @__PURE__ */ t(
785
+ "button",
786
+ {
787
+ type: "button",
788
+ 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" })
794
+ }
795
+ )
796
+ ] }),
937
797
  /* @__PURE__ */ t(
938
798
  "button",
939
799
  {
940
800
  type: "button",
941
- role: "tab",
942
- "aria-selected": h === "flows",
943
- onClick: () => {
944
- u("flows"), f("");
945
- },
946
- children: c.sidebar.flowsTab
801
+ 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" })
947
806
  }
948
- ),
807
+ )
808
+ ] }),
809
+ /* @__PURE__ */ g("div", { className: "ds-topbar__tools", children: [
949
810
  /* @__PURE__ */ t(
950
811
  "button",
951
812
  {
952
813
  type: "button",
953
- role: "tab",
954
- "aria-selected": h === "components",
955
- onClick: () => {
956
- u("components"), f("");
957
- },
958
- children: c.sidebar.componentsTab
814
+ 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" })
959
819
  }
960
- )
961
- ] }),
962
- /* @__PURE__ */ l("div", { className: "ds-sidebar__search", children: [
820
+ ),
963
821
  /* @__PURE__ */ t(
964
- "input",
822
+ "button",
965
823
  {
966
- ref: S,
967
- className: "ds-input ds-input--search",
968
- type: "search",
969
- value: g,
970
- placeholder: h === "flows" ? c.sidebar.searchPlaceholder : c.sidebar.componentSearchPlaceholder,
971
- "aria-label": h === "flows" ? c.sidebar.searchLabel : c.sidebar.componentSearchLabel,
972
- onChange: (v) => f(v.target.value),
973
- onKeyDown: K
824
+ type: "button",
825
+ 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" })
974
830
  }
975
831
  ),
976
- /* @__PURE__ */ t("kbd", { children: c.sidebar.searchShortcut })
977
- ] }),
978
- /* @__PURE__ */ l(
979
- "div",
832
+ u.length > 0 && /* @__PURE__ */ t(bt, { issues: u })
833
+ ] })
834
+ ] });
835
+ }
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);
844
+ };
845
+ return window.addEventListener("pointerdown", p), window.addEventListener("keydown", l), () => {
846
+ window.removeEventListener("pointerdown", p), window.removeEventListener("keydown", l);
847
+ };
848
+ }, [o]), /* @__PURE__ */ g("div", { className: "ds-diagnostics", ref: r, children: [
849
+ /* @__PURE__ */ g(
850
+ "button",
980
851
  {
981
- className: "ds-sidebar__tree",
982
- role: "tabpanel",
983
- "aria-label": h === "flows" ? c.sidebar.currentView(y) : void 0,
852
+ type: "button",
853
+ 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),
984
859
  children: [
985
- h === "flows" && /* @__PURE__ */ l("header", { className: "ds-sidebar__view-header", children: [
986
- /* @__PURE__ */ t("h2", { children: y }),
987
- s === "ported" && /* @__PURE__ */ t(
988
- "button",
989
- {
990
- type: "button",
991
- className: "ds-text-action",
992
- onClick: () => n("active"),
993
- children: c.sidebar.backToActive
994
- }
995
- )
996
- ] }),
997
- g.trim() !== "" && /* @__PURE__ */ t("p", { className: "ds-sidebar__empty", role: "status", children: h === "flows" ? U === 0 ? c.sidebar.noMatch(g) : c.sidebar.matchCount(U) : $.length === 0 ? c.sidebar.noComponentMatch(g) : c.sidebar.componentMatchCount($.length) }),
998
- h === "flows" && g.trim() === "" && M === 0 ? /* @__PURE__ */ l("div", { className: "ds-sidebar__view-empty", children: [
999
- /* @__PURE__ */ t("p", { children: s === "ported" ? c.sidebar.noPortedReferences : c.sidebar.noActiveWork }),
1000
- s === "active" && k > 0 && /* @__PURE__ */ t(
1001
- "button",
1002
- {
1003
- type: "button",
1004
- className: "ds-text-action",
1005
- onClick: () => n("ported"),
1006
- children: c.sidebar.viewPorted(k)
1007
- }
1008
- )
1009
- ] }) : h === "flows" ? /* @__PURE__ */ t(
1010
- at,
1011
- {
1012
- nodes: I,
1013
- orphans: B,
1014
- matches: E,
1015
- collapsed: p,
1016
- activeScenario: o?.id,
1017
- withoutModuleLabel: c.sidebar.withoutModule,
1018
- onToggle: J,
1019
- onOpen: d,
1020
- onKeyDown: V,
1021
- setItemRef: q
1022
- }
1023
- ) : H.length === 0 && !g ? /* @__PURE__ */ t("p", { className: "ds-sidebar__empty", children: c.sidebar.emptyComponents }) : H.map(([v, x]) => /* @__PURE__ */ l("section", { className: "ds-component-group", children: [
1024
- /* @__PURE__ */ t("h2", { children: v }),
1025
- /* @__PURE__ */ t("ul", { children: x.map((N) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
1026
- "button",
1027
- {
1028
- ref: (C) => q(N.id, C),
1029
- type: "button",
1030
- className: "ds-component-item",
1031
- "aria-current": N.id === a,
1032
- onClick: () => r(N.id),
1033
- onKeyDown: (C) => V(N.id, C),
1034
- children: [
1035
- /* @__PURE__ */ t("span", { children: N.name }),
1036
- N.description && /* @__PURE__ */ t("small", { children: N.description })
1037
- ]
1038
- }
1039
- ) }, N.id)) })
1040
- ] }, v))
860
+ /* @__PURE__ */ t(H, { name: "alert" }),
861
+ /* @__PURE__ */ t("span", { children: s > 0 ? s : u })
1041
862
  ]
1042
863
  }
1043
864
  ),
1044
- h === "flows" && s === "active" && M > 0 && k > 0 && /* @__PURE__ */ t("div", { className: "ds-sidebar__view-footer", children: /* @__PURE__ */ t(
1045
- "button",
1046
- {
1047
- type: "button",
1048
- className: "ds-text-action",
1049
- onClick: () => n("ported"),
1050
- children: c.sidebar.viewPorted(k)
1051
- }
1052
- ) }),
1053
- h === "flows" && o && /* @__PURE__ */ l("aside", { className: "ds-sidebar__scope", "aria-label": c.sidebar.scope, children: [
1054
- /* @__PURE__ */ t("h2", { children: c.sidebar.scope }),
1055
- /* @__PURE__ */ l("dl", { children: [
1056
- /* @__PURE__ */ t("dt", { children: c.sidebar.scopeData }),
1057
- /* @__PURE__ */ t("dd", { children: e.fixture(i.fixture ?? o.fixture)?.label ?? c.controls.none }),
1058
- /* @__PURE__ */ t("dt", { children: c.sidebar.scopePersona }),
1059
- /* @__PURE__ */ t("dd", { children: e.persona(i.persona ?? o.persona)?.name ?? c.controls.none }),
1060
- /* @__PURE__ */ t("dt", { children: c.sidebar.scopeNetwork }),
1061
- /* @__PURE__ */ t("dd", { children: c.network[i.network] })
1062
- ] })
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 })
869
+ ] }),
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}`)) })
1063
875
  ] })
1064
876
  ] });
1065
877
  }
1066
- function at(e) {
1067
- return /* @__PURE__ */ l(A, { children: [
1068
- e.nodes.map((o) => {
1069
- const a = !e.collapsed.has(o.module.id) || !!e.matches;
1070
- return /* @__PURE__ */ l("section", { className: "ds-module", children: [
1071
- /* @__PURE__ */ l(
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 };
883
+ try {
884
+ b.currentTarget.setPointerCapture(b.pointerId);
885
+ } catch {
886
+ }
887
+ r?.();
888
+ }
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?.());
893
+ };
894
+ return /* @__PURE__ */ t(
895
+ "div",
896
+ {
897
+ className: "ds-resizer",
898
+ "data-side": e,
899
+ role: "separator",
900
+ "aria-orientation": "vertical",
901
+ "aria-label": n,
902
+ "aria-valuenow": o,
903
+ 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);
914
+ }
915
+ }
916
+ );
917
+ }
918
+ function yt({
919
+ registry: e,
920
+ handoff: n,
921
+ activeScreen: o,
922
+ activeComponent: a,
923
+ onOpenScreen: r,
924
+ onOpenComponent: s,
925
+ width: u,
926
+ onResize: c,
927
+ onResizeStart: p,
928
+ onResizeEnd: l
929
+ }) {
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"
932
+ );
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());
940
+ };
941
+ return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
942
+ }, []);
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;
952
+ });
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(
957
+ "input",
958
+ {
959
+ ref: h,
960
+ className: "ds-input ds-search__input",
961
+ 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("");
968
+ }
969
+ }
970
+ ),
971
+ /* @__PURE__ */ t("kbd", { className: "ds-kbd", "aria-hidden": "true", children: f.searchShortcut })
972
+ ] }),
973
+ /* @__PURE__ */ g("div", { className: "ds-tabs", role: "tablist", "aria-label": f.tabs, children: [
974
+ /* @__PURE__ */ t(
975
+ Te,
976
+ {
977
+ selected: m === "screens",
978
+ label: f.screensTab,
979
+ count: O ? v.length : void 0,
980
+ onSelect: () => i("screens")
981
+ }
982
+ ),
983
+ /* @__PURE__ */ t(
984
+ Te,
985
+ {
986
+ selected: m === "components",
987
+ label: f.componentsTab,
988
+ count: O ? E.length : void 0,
989
+ onSelect: () => i("components")
990
+ }
991
+ )
992
+ ] }),
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(
1072
1005
  "button",
1073
1006
  {
1074
1007
  type: "button",
1075
- className: "ds-module__header",
1076
- "aria-expanded": a,
1077
- onClick: () => e.onToggle(o.module.id),
1008
+ className: "ds-group-section__head",
1009
+ "aria-expanded": !F,
1010
+ "aria-label": f.toggleGroup(k),
1011
+ onClick: () => x(k),
1078
1012
  children: [
1079
- /* @__PURE__ */ t("span", { className: "ds-module__chevron", "aria-hidden": "true", children: "▶" }),
1080
- /* @__PURE__ */ t("span", { children: o.module.name }),
1081
- /* @__PURE__ */ t("span", { className: "ds-module__count", children: o.scenarios.length })
1013
+ /* @__PURE__ */ t(H, { name: "chevron", size: 12 }),
1014
+ /* @__PURE__ */ t("span", { children: k }),
1015
+ /* @__PURE__ */ t("span", { className: "ds-count", children: P.length })
1082
1016
  ]
1083
1017
  }
1084
1018
  ),
1085
- a && /* @__PURE__ */ t("ul", { className: "ds-module__scenarios", children: o.scenarios.map((i) => /* @__PURE__ */ t(he, { scenario: i, ...e }, i.id)) })
1086
- ] }, o.module.id);
1087
- }),
1088
- e.orphans.length > 0 && /* @__PURE__ */ l("section", { className: "ds-module", children: [
1089
- /* @__PURE__ */ l("div", { className: "ds-module__header", "aria-hidden": "true", children: [
1090
- /* @__PURE__ */ t("span", { className: "ds-module__chevron", children: "▶" }),
1091
- /* @__PURE__ */ t("span", { children: e.withoutModuleLabel }),
1092
- /* @__PURE__ */ t("span", { className: "ds-module__count", children: e.orphans.length })
1093
- ] }),
1094
- /* @__PURE__ */ t("ul", { className: "ds-module__scenarios", children: e.orphans.map((o) => /* @__PURE__ */ t(he, { scenario: o, ...e }, o.id)) })
1095
- ] })
1019
+ !F && /* @__PURE__ */ t("ul", { className: "ds-items", children: P.map((A) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1020
+ "button",
1021
+ {
1022
+ type: "button",
1023
+ 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 })
1027
+ }
1028
+ ) }, A.id)) })
1029
+ ] }, k);
1030
+ }) : /* @__PURE__ */ t("p", { className: "ds-empty", children: f.emptyComponents }) }),
1031
+ /* @__PURE__ */ t(
1032
+ Ke,
1033
+ {
1034
+ side: "left",
1035
+ label: f.resize,
1036
+ value: u,
1037
+ onChange: c,
1038
+ onStart: p,
1039
+ onEnd: l
1040
+ }
1041
+ )
1096
1042
  ] });
1097
1043
  }
1098
- function he({
1099
- scenario: e,
1100
- activeScenario: o,
1101
- onOpen: a,
1102
- onKeyDown: i,
1103
- setItemRef: d
1044
+ function Te({
1045
+ selected: e,
1046
+ label: n,
1047
+ count: o,
1048
+ onSelect: a
1104
1049
  }) {
1105
- const r = P(), n = e.status === "approved" && !e.approvedAt, c = n ? r.inspector.approvalPendingStatus : r.status[e.status];
1106
- return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
1050
+ return /* @__PURE__ */ g(
1107
1051
  "button",
1108
1052
  {
1109
- ref: (h) => d(e.id, h),
1110
1053
  type: "button",
1111
- className: "ds-scenario",
1112
- "aria-current": e.id === o,
1113
- onClick: () => a(e.id),
1114
- onKeyDown: (h) => i(e.id, h),
1054
+ role: "tab",
1055
+ className: "ds-tab",
1056
+ "aria-selected": e,
1057
+ tabIndex: e ? 0 : -1,
1058
+ onClick: a,
1115
1059
  children: [
1116
- /* @__PURE__ */ t(
1117
- "span",
1118
- {
1119
- className: "ds-status-dot",
1120
- "data-status": e.status,
1121
- "data-approval": n ? "incomplete" : void 0,
1122
- title: c
1123
- }
1124
- ),
1125
- /* @__PURE__ */ t("span", { className: "ds-scenario__title", children: e.title }),
1126
- /* @__PURE__ */ t("span", { className: "ds-visually-hidden", children: c })
1060
+ /* @__PURE__ */ t("span", { children: n }),
1061
+ o !== void 0 && /* @__PURE__ */ t("span", { className: "ds-count", children: o })
1127
1062
  ]
1128
1063
  }
1129
- ) });
1130
- }
1131
- function nt(e) {
1132
- const o = /* @__PURE__ */ new Map();
1133
- for (const a of e) {
1134
- const i = a.group ?? "Componentes";
1135
- o.set(i, [...o.get(i) ?? [], a]);
1136
- }
1137
- return [...o.entries()];
1138
- }
1139
- function me(e) {
1140
- return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim();
1064
+ );
1141
1065
  }
1142
- function rt(e) {
1143
- const o = e.key.toLowerCase();
1144
- return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && (o === "k" || o === "f");
1066
+ function kt({
1067
+ screen: e,
1068
+ active: n,
1069
+ onOpen: o
1070
+ }) {
1071
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ g(
1072
+ "button",
1073
+ {
1074
+ type: "button",
1075
+ className: "ds-item",
1076
+ "aria-current": n ? "true" : void 0,
1077
+ onClick: () => o(e.id),
1078
+ 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 })
1081
+ ]
1082
+ }
1083
+ ) });
1084
+ }
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);
1090
+ }
1091
+ return [...o].map(([a, r]) => ({ group: a, items: r }));
1145
1092
  }
1146
- function st(e, o, a) {
1147
- if (e.length === 0) return;
1148
- const i = o ? e.indexOf(o) : -1, d = Math.max(0, Math.min(e.length - 1, i + a));
1149
- return e[d];
1093
+ function Nt(e) {
1094
+ return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "k";
1150
1095
  }
1151
- function it({
1152
- product: e,
1153
- scenario: o,
1096
+ function xt({
1097
+ screen: e,
1098
+ variations: n,
1099
+ components: o,
1154
1100
  deploy: a,
1155
- inspectorOpen: i,
1156
- chromeTheme: d,
1157
- view: r,
1158
- handoff: n,
1159
- onToggleInspector: c,
1160
- onToggleChromeTheme: h
1101
+ labels: r,
1102
+ overrides: s
1161
1103
  }) {
1162
- const u = P().topbar, [g, f] = F(!1), p = async () => {
1163
- const _ = o ? Me(o, {
1164
- origin: a.origin,
1165
- overrides: {
1166
- ...d === "light" ? { chromeTheme: d } : {},
1167
- ...r === "ported" ? { view: r } : {},
1168
- ...n ? { handoff: n } : {}
1169
- }
1170
- }) : `${a.origin}${window.location.pathname}${window.location.search}`;
1171
- try {
1172
- await navigator.clipboard.writeText(_);
1173
- } catch {
1174
- window.prompt(u.copyPrompt, _);
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()})`);
1110
+ }
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);
1119
+ }
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} |`);
1175
1125
  }
1176
- f(!0), window.setTimeout(() => f(!1), 1600);
1177
- }, b = ct(
1178
- typeof window > "u" ? `${a.origin}/` : window.location.href
1179
- ), S = dt(a.origin, d, r, n);
1180
- return /* @__PURE__ */ l("header", { className: "ds-chrome ds-topbar", children: [
1181
- /* @__PURE__ */ l("div", { className: "ds-topbar__product", children: [
1126
+ c.push("");
1127
+ }
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}`);
1132
+ else
1133
+ c.push(u.noExpected);
1134
+ c.push("");
1135
+ }
1136
+ return `${c.join(`
1137
+ `).trimEnd()}
1138
+ `;
1139
+ }
1140
+ function Ee(e) {
1141
+ return e.replace(/\|/g, "\\|").replace(/\n/g, " ");
1142
+ }
1143
+ function Ct(e) {
1144
+ return e.replace(/([[\]])/g, "\\$1");
1145
+ }
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());
1151
+ };
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,
1158
+ {
1159
+ side: "right",
1160
+ label: c.resize,
1161
+ value: a,
1162
+ onChange: r,
1163
+ onStart: s,
1164
+ onEnd: u
1165
+ }
1166
+ ),
1167
+ /* @__PURE__ */ g("div", { className: "ds-search", children: [
1168
+ /* @__PURE__ */ t(H, { name: "search", size: 14 }),
1182
1169
  /* @__PURE__ */ t(
1183
- "a",
1170
+ "input",
1184
1171
  {
1185
- className: "ds-topbar__home",
1186
- href: S,
1187
- "aria-label": u.homeTitle(e.name),
1188
- title: u.homeTitle(e.name),
1189
- children: e.name
1172
+ ref: w,
1173
+ className: "ds-input ds-search__input",
1174
+ 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("");
1181
+ }
1190
1182
  }
1191
1183
  ),
1192
- e.tagline && /* @__PURE__ */ t("span", { className: "ds-topbar__tagline", children: e.tagline })
1184
+ /* @__PURE__ */ t("kbd", { className: "ds-kbd", "aria-hidden": "true", children: c.searchShortcut })
1193
1185
  ] }),
1194
- /* @__PURE__ */ t("div", { className: "ds-topbar__spacer" }),
1195
- /* @__PURE__ */ l("div", { className: "ds-topbar__meta", children: [
1196
- a.branch && /* @__PURE__ */ t("code", { title: u.branchTitle(a.branch), children: a.branch.length > 28 ? `${a.branch.slice(0, 27)}…` : a.branch }),
1197
- a.commit && /* @__PURE__ */ t("code", { title: u.commitTitle(a.commit), children: a.shortCommit }),
1198
- /* @__PURE__ */ t("code", { title: u.envTitle(a.env), children: a.env })
1186
+ /* @__PURE__ */ g("div", { className: "ds-tabs", role: "tablist", "aria-label": c.tabs, children: [
1187
+ /* @__PURE__ */ t(
1188
+ "button",
1189
+ {
1190
+ type: "button",
1191
+ role: "tab",
1192
+ className: "ds-tab",
1193
+ "aria-selected": n === "variations",
1194
+ tabIndex: n === "variations" ? 0 : -1,
1195
+ onClick: () => o("variations"),
1196
+ children: c.variationsTab
1197
+ }
1198
+ ),
1199
+ /* @__PURE__ */ t(
1200
+ "button",
1201
+ {
1202
+ type: "button",
1203
+ role: "tab",
1204
+ className: "ds-tab",
1205
+ "aria-selected": n === "info",
1206
+ tabIndex: n === "info" ? 0 : -1,
1207
+ onClick: () => o("info"),
1208
+ children: c.infoTab
1209
+ }
1210
+ )
1199
1211
  ] }),
1200
- /* @__PURE__ */ t(
1201
- "button",
1202
- {
1203
- type: "button",
1204
- className: "ds-btn ds-btn--icon",
1205
- "aria-pressed": d === "light",
1206
- "aria-label": d === "dark" ? u.lightMode : u.darkMode,
1207
- title: d === "dark" ? u.lightMode : u.darkMode,
1208
- onClick: h,
1209
- children: /* @__PURE__ */ t(lt, { theme: d })
1210
- }
1211
- ),
1212
- /* @__PURE__ */ t("button", { type: "button", className: "ds-btn", onClick: p, children: g ? u.copied : u.copyLink }),
1213
- /* @__PURE__ */ t(
1214
- "a",
1215
- {
1216
- className: "ds-btn",
1217
- href: b,
1218
- target: "_blank",
1219
- rel: "noreferrer",
1220
- title: u.cleanReviewTitle,
1221
- children: u.cleanReview
1222
- }
1223
- ),
1224
- /* @__PURE__ */ t(
1225
- "button",
1226
- {
1227
- type: "button",
1228
- className: "ds-btn",
1229
- "aria-pressed": i,
1230
- onClick: c,
1231
- children: u.panel
1232
- }
1233
- )
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) })
1215
+ ] })
1234
1216
  ] });
1235
1217
  }
1236
- function ct(e) {
1237
- const o = new URL(e);
1238
- return o.searchParams.set(w.chrome, "0"), o.toString();
1239
- }
1240
- function dt(e, o, a = "active", i) {
1241
- const d = new URL("/", e);
1242
- return o === "light" && d.searchParams.set(w.chromeTheme, o), a === "ported" && d.searchParams.set(w.view, "ported"), oe(d.searchParams, i), d.toString();
1243
- }
1244
- function lt({ theme: e }) {
1245
- const o = {
1246
- width: 15,
1247
- height: 15,
1248
- viewBox: "0 0 24 24",
1249
- fill: "none",
1250
- stroke: "currentColor",
1251
- strokeWidth: 2,
1252
- strokeLinecap: "round",
1253
- strokeLinejoin: "round",
1254
- "aria-hidden": !0
1255
- };
1256
- return e === "dark" ? /* @__PURE__ */ l("svg", { ...o, children: [
1257
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "4" }),
1258
- /* @__PURE__ */ t("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.42" })
1259
- ] }) : /* @__PURE__ */ t("svg", { ...o, children: /* @__PURE__ */ t("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
1260
- }
1261
- function pt({
1218
+ function Tt({
1262
1219
  registry: e,
1263
- controls: o,
1264
- scenarioActive: a,
1265
- component: i,
1266
- componentFixture: d,
1267
- onChange: r
1220
+ controls: n,
1221
+ screen: o,
1222
+ variation: a,
1223
+ component: r,
1224
+ componentFixture: s,
1225
+ onOpenScenario: u,
1226
+ onChange: c
1268
1227
  }) {
1269
- const n = P(), c = n.controls, { product: h } = e, u = h.dataSources?.adapters ?? [], g = h.theme?.modes ?? [], f = h.theme?.locales ?? [];
1270
- return /* @__PURE__ */ l("div", { className: "ds-chrome ds-controls", role: "group", "aria-label": c.region, children: [
1271
- i?.fixtures?.length ? /* @__PURE__ */ l("div", { className: "ds-field", children: [
1272
- /* @__PURE__ */ t("label", { htmlFor: "ds-component-fixture", children: c.componentFixture }),
1273
- /* @__PURE__ */ t(
1274
- "select",
1228
+ const p = q(), l = p.panel;
1229
+ 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(
1234
+ "button",
1275
1235
  {
1276
- id: "ds-component-fixture",
1277
- className: "ds-select",
1278
- value: d?.fixture?.id ?? "",
1279
- onChange: (p) => r({ fixture: p.target.value || void 0 }),
1280
- children: i.fixtures.map((p) => /* @__PURE__ */ t("option", { value: p.id, children: p.label }, p.id))
1236
+ type: "button",
1237
+ className: "ds-item ds-item--stacked",
1238
+ "aria-current": s.fixture?.id === h.id ? "true" : void 0,
1239
+ onClick: () => c({ fixture: h.id }),
1240
+ 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 })
1243
+ ]
1281
1244
  }
1282
- )
1283
- ] }) : null,
1284
- a && /* @__PURE__ */ l("div", { className: "ds-field", children: [
1285
- /* @__PURE__ */ t("label", { htmlFor: "ds-persona", children: c.persona }),
1286
- /* @__PURE__ */ l(
1245
+ ) }, h.id)) })
1246
+ ] });
1247
+ }
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(
1287
1269
  "select",
1288
1270
  {
1289
- id: "ds-persona",
1290
1271
  className: "ds-select",
1291
- value: o.persona ?? "",
1292
- onChange: (p) => r({ persona: p.target.value || void 0 }),
1272
+ value: n.persona ?? "",
1273
+ onChange: (d) => c({ persona: d.target.value || void 0 }),
1293
1274
  children: [
1294
- /* @__PURE__ */ t("option", { value: "", children: c.none }),
1295
- h.personas.map((p) => /* @__PURE__ */ t("option", { value: p.id, children: p.name }, p.id))
1275
+ /* @__PURE__ */ t("option", { value: "", children: l.none }),
1276
+ f.personas.map((d) => /* @__PURE__ */ t("option", { value: d.id, children: d.name }, d.id))
1296
1277
  ]
1297
1278
  }
1298
- )
1299
- ] }),
1300
- a && /* @__PURE__ */ l("div", { className: "ds-field", children: [
1301
- /* @__PURE__ */ t("span", { className: "ds-field__label", id: "ds-network-label", children: c.network }),
1302
- /* @__PURE__ */ t("div", { className: "ds-segmented", role: "group", "aria-labelledby": "ds-network-label", children: ve.map((p) => /* @__PURE__ */ t(
1303
- "button",
1304
- {
1305
- type: "button",
1306
- "aria-pressed": o.network === p,
1307
- onClick: () => r({ network: p }),
1308
- children: n.network[p]
1309
- },
1310
- p
1311
- )) })
1312
- ] }),
1313
- /* @__PURE__ */ l("div", { className: "ds-field", children: [
1314
- /* @__PURE__ */ t("span", { className: "ds-field__label", id: "ds-viewport-label", children: c.viewport }),
1315
- /* @__PURE__ */ t("div", { className: "ds-segmented", role: "group", "aria-labelledby": "ds-viewport-label", children: ge.map((p) => /* @__PURE__ */ t(
1316
- "button",
1317
- {
1318
- type: "button",
1319
- className: "ds-icon-button",
1320
- "aria-pressed": o.viewport === p.id,
1321
- "aria-label": n.viewport[p.id] ?? p.label,
1322
- title: n.viewport[p.id] ?? p.label,
1323
- onClick: () => r({ viewport: p.id }),
1324
- children: /* @__PURE__ */ t(ut, { id: p.id })
1325
- },
1326
- p.id
1327
- )) }),
1328
- o.viewport === "custom" && /* @__PURE__ */ t(
1329
- "input",
1279
+ ) }),
1280
+ /* @__PURE__ */ t(ee, { label: l.network, children: /* @__PURE__ */ t(
1281
+ "select",
1330
1282
  {
1331
- className: "ds-input",
1332
- type: "number",
1333
- min: 240,
1334
- max: 3840,
1335
- step: 10,
1336
- style: { width: 88 },
1337
- "aria-label": c.customWidth,
1338
- value: o.customWidth ?? 1024,
1339
- onChange: (p) => r({ customWidth: Number(p.target.value) || void 0 })
1283
+ 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))
1340
1287
  }
1341
- )
1342
- ] }),
1343
- g.length > 1 && /* @__PURE__ */ l("div", { className: "ds-field", children: [
1344
- /* @__PURE__ */ t("label", { htmlFor: "ds-theme", children: c.theme }),
1345
- /* @__PURE__ */ t(
1288
+ ) }),
1289
+ b.length > 1 && /* @__PURE__ */ t(ee, { label: l.theme, children: /* @__PURE__ */ t(
1346
1290
  "select",
1347
1291
  {
1348
- id: "ds-theme",
1349
1292
  className: "ds-select",
1350
- value: o.themeMode ?? g[0],
1351
- onChange: (p) => r({ themeMode: p.target.value }),
1352
- children: g.map((p) => /* @__PURE__ */ t("option", { value: p, children: p }, p))
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))
1353
1296
  }
1354
- )
1355
- ] }),
1356
- f.length > 1 && /* @__PURE__ */ l("div", { className: "ds-field", children: [
1357
- /* @__PURE__ */ t("label", { htmlFor: "ds-locale", children: c.locale }),
1358
- /* @__PURE__ */ t(
1297
+ ) }),
1298
+ M.length > 1 && /* @__PURE__ */ t(ee, { label: l.locale, children: /* @__PURE__ */ t(
1359
1299
  "select",
1360
1300
  {
1361
- id: "ds-locale",
1362
1301
  className: "ds-select",
1363
- value: o.locale ?? f[0],
1364
- onChange: (p) => r({ locale: p.target.value }),
1365
- children: f.map((p) => /* @__PURE__ */ t("option", { value: p, children: p }, p))
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))
1366
1305
  }
1367
- )
1368
- ] }),
1369
- a && u.length > 0 && /* @__PURE__ */ l("div", { className: "ds-field", children: [
1370
- /* @__PURE__ */ t("label", { htmlFor: "ds-source", children: c.dataSource }),
1371
- /* @__PURE__ */ l(
1306
+ ) }),
1307
+ y.length > 0 && /* @__PURE__ */ t(ee, { label: l.dataSource, children: /* @__PURE__ */ g(
1372
1308
  "select",
1373
1309
  {
1374
- id: "ds-source",
1375
1310
  className: "ds-select",
1376
- value: o.dataSource ?? "fixtures",
1377
- onChange: (p) => r({ dataSource: p.target.value }),
1311
+ value: n.dataSource ?? "fixtures",
1312
+ onChange: (d) => c({ dataSource: d.target.value }),
1378
1313
  children: [
1379
- /* @__PURE__ */ t("option", { value: "fixtures", children: c.fixturesOption }),
1380
- u.filter((p) => p.id !== "fixtures").map((p) => /* @__PURE__ */ t("option", { value: p.id, children: p.label }, p.id))
1314
+ /* @__PURE__ */ t("option", { value: "fixtures", children: l.fixturesOption }),
1315
+ y.map((d) => /* @__PURE__ */ t("option", { value: d.id, children: d.label }, d.id))
1381
1316
  ]
1382
1317
  }
1383
- )
1318
+ ) })
1384
1319
  ] })
1385
1320
  ] });
1386
1321
  }
1387
- function ut({ id: e }) {
1388
- const o = {
1389
- width: 16,
1390
- height: 16,
1391
- viewBox: "0 0 24 24",
1392
- fill: "none",
1393
- stroke: "currentColor",
1394
- strokeWidth: 2,
1395
- strokeLinecap: "round",
1396
- strokeLinejoin: "round",
1397
- "aria-hidden": !0
1398
- };
1399
- return e === "fit" ? /* @__PURE__ */ t("svg", { ...o, children: /* @__PURE__ */ t("path", { d: "M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 1 2 2v3M8 21H5a2 2 0 0 1-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3" }) }) : e === "mobile" ? /* @__PURE__ */ l("svg", { ...o, children: [
1400
- /* @__PURE__ */ t("rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }),
1401
- /* @__PURE__ */ t("path", { d: "M12 18h.01" })
1402
- ] }) : e === "tablet" ? /* @__PURE__ */ l("svg", { ...o, children: [
1403
- /* @__PURE__ */ t("rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2" }),
1404
- /* @__PURE__ */ t("path", { d: "M12 18h.01" })
1405
- ] }) : e === "desktop" ? /* @__PURE__ */ l("svg", { ...o, children: [
1406
- /* @__PURE__ */ t("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
1407
- /* @__PURE__ */ t("path", { d: "M8 21h8M12 17v4" })
1408
- ] }) : /* @__PURE__ */ t("svg", { ...o, children: /* @__PURE__ */ t("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" }) });
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
1326
+ ] });
1409
1327
  }
1410
- function ht({
1328
+ function Et({
1411
1329
  registry: e,
1412
- scenario: o,
1413
- component: a,
1414
- componentFixture: i,
1415
- controls: d,
1416
- focusedNode: r,
1417
- tabStopCount: n
1330
+ controls: n,
1331
+ deploy: o,
1332
+ screen: a,
1333
+ variation: r,
1334
+ component: s,
1335
+ onOpenScenario: u,
1336
+ onOpenComponent: c
1418
1337
  }) {
1419
- const c = P().inspector, [h, u] = F("scenario"), g = e.issues.filter((f) => f.level === "error").length;
1420
- return /* @__PURE__ */ l("aside", { className: "ds-chrome ds-inspector", "aria-label": c.region, children: [
1421
- /* @__PURE__ */ l("div", { className: "ds-inspector__tabs", role: "tablist", children: [
1422
- /* @__PURE__ */ t(ne, { id: "scenario", current: h, onSelect: u, children: a ? c.componentReference : c.tabScenario }),
1423
- /* @__PURE__ */ t(ne, { id: "a11y", current: h, onSelect: u, children: c.tabA11y }),
1424
- /* @__PURE__ */ t(ne, { id: "diagnostics", current: h, onSelect: u, children: g > 0 ? c.diagnosticsWithErrors(g) : c.tabDiagnostics })
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 }) })
1348
+ ] }),
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(
1353
+ "button",
1354
+ {
1355
+ type: "button",
1356
+ className: "ds-link",
1357
+ onClick: () => L && u(L.id),
1358
+ children: S.name
1359
+ }
1360
+ ),
1361
+ /* @__PURE__ */ t("code", { className: "ds-muted", children: S.id })
1362
+ ] }, S.id);
1363
+ }) }) })
1364
+ ] });
1365
+ }
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
1375
+ });
1376
+ try {
1377
+ await navigator.clipboard.writeText(h);
1378
+ } catch {
1379
+ window.prompt(l.copyPrompt, h);
1380
+ }
1381
+ f(!0), window.setTimeout(() => f(!1), 1600);
1382
+ };
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 })
1425
1388
  ] }),
1426
- /* @__PURE__ */ l("div", { className: "ds-inspector__body", role: "tabpanel", children: [
1427
- h === "scenario" && /* @__PURE__ */ t(
1428
- mt,
1429
- {
1430
- registry: e,
1431
- scenario: o,
1432
- component: a,
1433
- componentFixture: i,
1434
- controls: d
1435
- }
1436
- ),
1437
- h === "a11y" && /* @__PURE__ */ t(
1438
- ft,
1439
- {
1440
- registry: e,
1441
- scenario: o,
1442
- focusedNode: r,
1443
- keyboardMode: d.keyboardMode,
1444
- tabStopCount: n
1445
- }
1446
- ),
1447
- h === "diagnostics" && /* @__PURE__ */ t(bt, { registry: e })
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 }) })
1399
+ ] }),
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 })
1448
1407
  ] })
1449
1408
  ] });
1450
1409
  }
1451
- function ne({
1452
- id: e,
1453
- current: o,
1454
- onSelect: a,
1455
- children: i
1456
- }) {
1457
- return /* @__PURE__ */ t(
1458
- "button",
1459
- {
1460
- type: "button",
1461
- role: "tab",
1462
- "aria-selected": o === e,
1463
- onClick: () => a(e),
1464
- children: i
1465
- }
1466
- );
1467
- }
1468
- function mt({
1469
- registry: e,
1470
- scenario: o,
1471
- component: a,
1472
- componentFixture: i,
1473
- controls: d
1474
- }) {
1475
- const r = P(), n = r.inspector;
1476
- if (!o)
1477
- return a ? /* @__PURE__ */ l("div", { className: "ds-block", children: [
1478
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.componentReference }),
1479
- /* @__PURE__ */ t("p", { style: { color: "var(--ds-fg)", fontSize: 15, fontWeight: 600 }, children: a.name }),
1480
- a.description && /* @__PURE__ */ t("p", { children: a.description }),
1481
- /* @__PURE__ */ l("dl", { className: "ds-kv", style: { marginTop: 14 }, children: [
1482
- /* @__PURE__ */ t("dt", { children: n.id }),
1483
- /* @__PURE__ */ t("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: a.id }),
1484
- a.group && /* @__PURE__ */ l(A, { children: [
1485
- /* @__PURE__ */ t("dt", { children: n.componentGroup }),
1486
- /* @__PURE__ */ t("dd", { children: a.group })
1487
- ] }),
1488
- i?.fixture && /* @__PURE__ */ l(A, { children: [
1489
- /* @__PURE__ */ t("dt", { children: n.componentFixture }),
1490
- /* @__PURE__ */ l("dd", { children: [
1491
- i.fixture.label,
1492
- " ",
1493
- /* @__PURE__ */ t("code", { children: i.fixture.id })
1494
- ] }),
1495
- i.fixture.description && /* @__PURE__ */ l(A, { children: [
1496
- /* @__PURE__ */ t("dt", { children: n.componentFixtureDescription }),
1497
- /* @__PURE__ */ t("dd", { children: i.fixture.description })
1498
- ] })
1499
- ] })
1500
- ] }),
1501
- i?.didFallback && i.fixture && /* @__PURE__ */ t("p", { className: "ds-note", "data-tone": "warn", children: n.componentFixtureFallback(
1502
- i.requestedId ?? "",
1503
- i.fixture.id
1504
- ) })
1505
- ] }) : /* @__PURE__ */ t("p", { className: "ds-block", children: n.noScenario });
1506
- const c = e.persona(d.persona ?? o.persona), h = d.persona ? e.persona(d.persona)?.permissions ?? [] : e.permissionsOf(o), u = e.rulesOf(o), g = e.fixture(d.fixture ?? o.fixture), f = !!(d.persona && d.persona !== o.persona), p = o.status !== "approved" || !!o.approvedAt;
1507
- return /* @__PURE__ */ l(A, { children: [
1508
- /* @__PURE__ */ l(
1509
- z,
1510
- {
1511
- scope: "task",
1512
- title: n.taskScope,
1513
- description: n.taskScopeDescription,
1514
- children: [
1515
- /* @__PURE__ */ l("div", { className: "ds-block", children: [
1516
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.situation }),
1517
- /* @__PURE__ */ t("p", { style: { color: "var(--ds-fg)", fontSize: 14, fontWeight: 600 }, children: o.title }),
1518
- o.intent && /* @__PURE__ */ t("p", { children: o.intent }),
1519
- /* @__PURE__ */ l("div", { className: "ds-chips", children: [
1520
- /* @__PURE__ */ t("span", { className: "ds-chip", "data-tone": gt(o), children: p ? r.status[o.status] : n.approvalPendingStatus }),
1521
- (o.tags ?? []).map((b) => /* @__PURE__ */ t("span", { className: "ds-chip", children: b }, b))
1522
- ] }),
1523
- /* @__PURE__ */ t("p", { style: { marginTop: 6 }, children: p ? r.statusMeaning[o.status] : n.approvalPendingMeaning })
1524
- ] }),
1525
- /* @__PURE__ */ l("div", { className: "ds-block", children: [
1526
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.reproduction }),
1527
- /* @__PURE__ */ l("dl", { className: "ds-kv", children: [
1528
- /* @__PURE__ */ t("dt", { children: n.id }),
1529
- /* @__PURE__ */ t("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: o.id }),
1530
- /* @__PURE__ */ t("dt", { children: n.route }),
1531
- /* @__PURE__ */ t("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: o.route }),
1532
- /* @__PURE__ */ t("dt", { children: n.data }),
1533
- /* @__PURE__ */ t("dd", { children: g?.label ?? "—" }),
1534
- /* @__PURE__ */ t("dt", { children: n.network }),
1535
- /* @__PURE__ */ t("dd", { children: r.network[d.network] })
1536
- ] })
1537
- ] }),
1538
- o.preconditions?.length ? /* @__PURE__ */ l("div", { className: "ds-block", children: [
1539
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.preconditions }),
1540
- /* @__PURE__ */ t("ul", { className: "ds-list", children: o.preconditions.map((b) => /* @__PURE__ */ t("li", { children: b }, b)) })
1541
- ] }) : null,
1542
- u.length > 0 && /* @__PURE__ */ l("div", { className: "ds-block", children: [
1543
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.rules }),
1544
- u.map((b) => /* @__PURE__ */ l("div", { className: "ds-rule", children: [
1545
- /* @__PURE__ */ t("span", { className: "ds-rule__id", children: b.id }),
1546
- /* @__PURE__ */ t("span", { className: "ds-rule__statement", children: b.statement }),
1547
- b.rationale && /* @__PURE__ */ t("p", { className: "ds-rule__rationale", children: b.rationale })
1548
- ] }, b.id))
1549
- ] }),
1550
- o.actions?.length ? /* @__PURE__ */ l("div", { className: "ds-block", children: [
1551
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.actions }),
1552
- /* @__PURE__ */ t("ul", { className: "ds-list", children: o.actions.map((b) => /* @__PURE__ */ t("li", { children: b }, b)) })
1553
- ] }) : null,
1554
- o.expected?.length ? /* @__PURE__ */ l("div", { className: "ds-block", children: [
1555
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.expected }),
1556
- /* @__PURE__ */ t("ul", { className: "ds-list", children: o.expected.map((b) => /* @__PURE__ */ t("li", { children: b }, b)) })
1557
- ] }) : null,
1558
- (o.status === "approved" || o.approvedAt) && /* @__PURE__ */ l("div", { className: "ds-block", children: [
1559
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.approval }),
1560
- o.approvedAt ? /* @__PURE__ */ l(A, { children: [
1561
- /* @__PURE__ */ l("p", { children: [
1562
- o.approvedAt.date,
1563
- " · ",
1564
- /* @__PURE__ */ t("code", { children: o.approvedAt.commit.slice(0, 7) })
1565
- ] }),
1566
- /* @__PURE__ */ t("a", { href: o.approvedAt.url, target: "_blank", rel: "noreferrer", children: n.openApproved })
1567
- ] }) : /* @__PURE__ */ t("p", { className: "ds-note", "data-tone": "warn", role: "alert", children: n.approvalMissing })
1568
- ] }),
1569
- o.ticket && /* @__PURE__ */ l("div", { className: "ds-block", children: [
1570
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.engineering }),
1571
- /* @__PURE__ */ t("p", { children: o.ticket })
1572
- ] })
1573
- ]
1574
- }
1575
- ),
1576
- /* @__PURE__ */ l(
1577
- z,
1578
- {
1579
- scope: "inherited",
1580
- title: n.inheritedScope,
1581
- description: n.inheritedScopeDescription,
1582
- children: [
1583
- /* @__PURE__ */ l("div", { className: "ds-block", children: [
1584
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.persona }),
1585
- /* @__PURE__ */ l("p", { style: { color: "var(--ds-fg)", fontWeight: 600 }, children: [
1586
- c?.name ?? "—",
1587
- f && /* @__PURE__ */ t("span", { className: "ds-chip", "data-tone": "warn", style: { marginLeft: 6 }, children: n.personaSwapped })
1588
- ] }),
1589
- c?.goal && /* @__PURE__ */ t("p", { children: n.goal(c.goal) })
1590
- ] }),
1591
- h.length > 0 && /* @__PURE__ */ l("div", { className: "ds-block", children: [
1592
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.permissions }),
1593
- /* @__PURE__ */ t("div", { className: "ds-chips", children: h.map((b) => /* @__PURE__ */ t("span", { className: "ds-chip", children: b }, b)) })
1594
- ] })
1595
- ]
1596
- }
1597
- )
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 })
1598
1414
  ] });
1599
1415
  }
1600
- function ft({
1601
- registry: e,
1602
- scenario: o,
1603
- focusedNode: a,
1604
- keyboardMode: i,
1605
- tabStopCount: d
1606
- }) {
1607
- const r = P(), n = r.inspector, c = Ce(e.product.theme?.contrastPairs), h = c.filter((u) => u.passes !== !0);
1608
- return /* @__PURE__ */ l(A, { children: [
1609
- o && /* @__PURE__ */ t(
1610
- z,
1611
- {
1612
- scope: "task",
1613
- title: n.taskScope,
1614
- description: n.taskScopeDescription,
1615
- children: /* @__PURE__ */ l("div", { className: "ds-block", children: [
1616
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.a11yContract }),
1617
- /* @__PURE__ */ l("dl", { className: "ds-kv", children: [
1618
- /* @__PURE__ */ t("dt", { children: n.keyboard }),
1619
- /* @__PURE__ */ t("dd", { children: r.keyboard[o.a11y.keyboard] }),
1620
- /* @__PURE__ */ t("dt", { children: n.contrast }),
1621
- /* @__PURE__ */ t("dd", { children: n.contrastTarget(o.a11y.contrast) })
1622
- ] }),
1623
- o.a11y.announces?.length ? /* @__PURE__ */ l(A, { children: [
1624
- /* @__PURE__ */ t("p", { style: { marginTop: 8 }, children: n.announces }),
1625
- /* @__PURE__ */ t("div", { className: "ds-chips", children: o.a11y.announces.map((u) => /* @__PURE__ */ t("span", { className: "ds-chip", children: u }, u)) })
1626
- ] }) : null,
1627
- o.a11y.notes && /* @__PURE__ */ t("p", { style: { marginTop: 8 }, children: o.a11y.notes })
1628
- ] })
1629
- }
1630
- ),
1631
- /* @__PURE__ */ t(
1632
- z,
1633
- {
1634
- scope: "screen",
1635
- title: n.screenScope,
1636
- description: n.screenScopeDescription,
1637
- children: /* @__PURE__ */ l("div", { className: "ds-block", children: [
1638
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.focusedElement }),
1639
- i ? a ? /* @__PURE__ */ l(A, { children: [
1640
- /* @__PURE__ */ l("dl", { className: "ds-kv", children: [
1641
- /* @__PURE__ */ t("dt", { children: n.role }),
1642
- /* @__PURE__ */ t("dd", { children: a.role }),
1643
- /* @__PURE__ */ t("dt", { children: n.name }),
1644
- /* @__PURE__ */ t("dd", { children: a.name ? a.name : /* @__PURE__ */ t("span", { style: { color: "var(--ds-err)" }, children: n.noAccessibleName }) }),
1645
- /* @__PURE__ */ t("dt", { children: n.nameFrom }),
1646
- /* @__PURE__ */ t("dd", { children: a.nameFrom }),
1647
- a.description ? /* @__PURE__ */ l(A, { children: [
1648
- /* @__PURE__ */ t("dt", { children: n.description }),
1649
- /* @__PURE__ */ t("dd", { children: a.description })
1650
- ] }) : null,
1651
- /* @__PURE__ */ t("dt", { children: n.selector }),
1652
- /* @__PURE__ */ t("dd", { style: { fontFamily: "var(--ds-mono)", fontSize: 11 }, children: a.selector })
1653
- ] }),
1654
- a.states.length > 0 && /* @__PURE__ */ t("div", { className: "ds-chips", style: { marginTop: 8 }, children: a.states.map((u) => /* @__PURE__ */ t("span", { className: "ds-chip", children: u }, u)) }),
1655
- a.hiddenFromAssistiveTech && /* @__PURE__ */ t("p", { className: "ds-note", style: { marginTop: 8 }, children: n.focusableButHidden }),
1656
- /* @__PURE__ */ t("p", { style: { marginTop: 8 }, children: n.tabStopsInStage(d) })
1657
- ] }) : /* @__PURE__ */ t("p", { children: n.pressTab(d) }) : /* @__PURE__ */ t("p", { children: n.keyboardModeOff })
1658
- ] })
1659
- }
1660
- ),
1661
- /* @__PURE__ */ l(
1662
- z,
1663
- {
1664
- scope: "product",
1665
- title: n.productScope,
1666
- description: n.productScopeDescription,
1667
- children: [
1668
- /* @__PURE__ */ l("div", { className: "ds-block", children: [
1669
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: n.tokenContrast }),
1670
- c.length === 0 ? /* @__PURE__ */ t("p", { children: n.noContrastPairs }) : /* @__PURE__ */ l("table", { className: "ds-contrast", children: [
1671
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { children: [
1672
- /* @__PURE__ */ t("th", { scope: "col", children: n.pair }),
1673
- /* @__PURE__ */ t("th", { scope: "col", children: n.ratio })
1674
- ] }) }),
1675
- /* @__PURE__ */ t("tbody", { children: c.map((u) => /* @__PURE__ */ l("tr", { children: [
1676
- /* @__PURE__ */ l("td", { children: [
1677
- /* @__PURE__ */ t(
1678
- "span",
1679
- {
1680
- className: "ds-swatch",
1681
- style: { background: u.pair.background },
1682
- "aria-hidden": "true"
1683
- }
1684
- ),
1685
- /* @__PURE__ */ t(
1686
- "span",
1687
- {
1688
- className: "ds-swatch",
1689
- style: { background: u.pair.foreground },
1690
- "aria-hidden": "true"
1691
- }
1692
- ),
1693
- u.pair.name
1694
- ] }),
1695
- /* @__PURE__ */ t(
1696
- "td",
1697
- {
1698
- style: {
1699
- color: u.passes === !0 ? "var(--ds-ok)" : u.passes === !1 ? "var(--ds-err)" : "var(--ds-warn)"
1700
- },
1701
- children: u.label
1702
- }
1703
- )
1704
- ] }, u.pair.name)) })
1705
- ] }),
1706
- h.length > 0 && /* @__PURE__ */ t("p", { className: "ds-note", style: { marginTop: 8 }, children: n.pairsFailing(h.length) })
1707
- ] }),
1708
- /* @__PURE__ */ t("p", { className: "ds-note", children: n.automatedIsFloor })
1709
- ]
1710
- }
1711
- )
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 })
1712
1420
  ] });
1713
1421
  }
1714
- function bt({ registry: e }) {
1715
- const o = P(), a = o.inspector, i = e.coverage({ includePorted: !0 }), { issues: d } = e;
1716
- return /* @__PURE__ */ t(A, { children: /* @__PURE__ */ l(
1717
- z,
1718
- {
1719
- scope: "product",
1720
- title: a.productScope,
1721
- description: a.diagnosticsProductNotice,
1722
- children: [
1723
- /* @__PURE__ */ l("div", { className: "ds-block", children: [
1724
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: a.coverage }),
1725
- /* @__PURE__ */ t("dl", { className: "ds-kv", children: Object.entries(i).filter(([, r]) => r > 0).map(([r, n]) => /* @__PURE__ */ l("div", { style: { display: "contents" }, children: [
1726
- /* @__PURE__ */ t("dt", { children: o.status[r] }),
1727
- /* @__PURE__ */ t("dd", { style: { fontVariantNumeric: "tabular-nums" }, children: n })
1728
- ] }, r)) }),
1729
- /* @__PURE__ */ t("p", { style: { marginTop: 8 }, children: a.scenariosRegistered(e.product.scenarios.length) })
1730
- ] }),
1731
- /* @__PURE__ */ l("div", { className: "ds-block", children: [
1732
- /* @__PURE__ */ t("h2", { className: "ds-block__title", children: a.scenarioContract }),
1733
- d.length === 0 ? /* @__PURE__ */ t("p", { children: a.noIssues }) : d.map((r, n) => /* @__PURE__ */ l("div", { className: "ds-issue", "data-level": r.level, children: [
1734
- /* @__PURE__ */ t("span", { className: "ds-issue__where", children: r.where }),
1735
- r.message
1736
- ] }, `${r.where}-${n}`))
1737
- ] })
1738
- ]
1739
- }
1740
- ) });
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)) }) })
1426
+ ] }) : null;
1741
1427
  }
1742
- const vt = {
1743
- ported: void 0,
1744
- proposed: "warn",
1745
- "in-review": "warn",
1746
- approved: "ok",
1747
- "in-implementation": void 0,
1748
- implemented: "ok",
1749
- superseded: void 0
1750
- };
1751
- function gt(e) {
1752
- return e.status === "approved" && !e.approvedAt ? "warn" : vt[e.status];
1428
+ function Lt(e) {
1429
+ return (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f";
1753
1430
  }
1754
- function z({
1755
- scope: e,
1756
- title: o,
1757
- description: a,
1758
- children: i
1759
- }) {
1760
- return /* @__PURE__ */ l("section", { className: "ds-scope-group", "data-scope": e, children: [
1761
- /* @__PURE__ */ l("header", { className: "ds-scope-group__header", children: [
1762
- /* @__PURE__ */ t("h2", { children: o }),
1763
- /* @__PURE__ */ t("p", { children: a })
1764
- ] }),
1765
- i
1766
- ] });
1767
- }
1768
- const wt = xe(function({ viewport: o, textScale: a, reducedMotion: i, keyboardMode: d, children: r }, n) {
1769
- return /* @__PURE__ */ t("div", { className: "ds-stage-scroll", children: /* @__PURE__ */ t(
1770
- "div",
1771
- {
1772
- ref: n,
1773
- className: "ds-stage",
1774
- "data-viewport": o.id,
1775
- "data-keyboard-mode": d,
1776
- "data-reduced-motion": i,
1777
- style: {
1778
- width: o.width ? `${o.width}px` : "100%",
1779
- minHeight: o.height ? `${o.height}px` : void 0,
1780
- // A ampliação é aplicada no `font-size` do contêiner, não com
1781
- // `transform: scale`. É a diferença entre testar se o layout aguenta
1782
- // texto grande e só dar zoom na captura de tela.
1783
- fontSize: a === 1 ? void 0 : `${a * 100}%`
1784
- },
1785
- children: r
1431
+ function Rt(e, n) {
1432
+ 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);
1436
+ 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)) {
1439
+ r.hidden = !1;
1440
+ for (const c of s) c.hidden = !1;
1441
+ continue;
1786
1442
  }
1787
- ) });
1788
- });
1789
- function kt({ stops: e }) {
1790
- return e.length === 0 ? null : /* @__PURE__ */ t("div", { className: "ds-chrome ds-taborder", "aria-hidden": "true", children: e.map((o) => /* @__PURE__ */ t(
1791
- "span",
1792
- {
1793
- className: "ds-taborder__badge",
1794
- "data-forced": o.forcedOrder,
1795
- style: { top: o.rect.top, left: o.rect.left },
1796
- children: o.index
1797
- },
1798
- `${o.index}-${o.rect.top}-${o.rect.left}`
1799
- )) });
1800
- }
1801
- function fe({ title: e, children: o }) {
1802
- return /* @__PURE__ */ l("div", { className: "ds-chrome ds-stage-empty", children: [
1803
- /* @__PURE__ */ t("h2", { children: e }),
1804
- o
1805
- ] });
1443
+ r.hidden = o.length > 0 && s.every((c) => c.hidden);
1444
+ }
1445
+ return o.length > 0 && a.length > 0 && a.every((r) => r.hidden);
1806
1446
  }
1807
- function Nt({
1808
- registry: e,
1809
- onOpenScenario: o,
1810
- view: a,
1811
- onViewChange: i,
1812
- handoff: d,
1813
- showPorted: r = !1
1447
+ const _t = 24;
1448
+ function Pt({
1449
+ location: e,
1450
+ viewport: n,
1451
+ zoom: o,
1452
+ title: a,
1453
+ resizing: r,
1454
+ onFrameNavigate: s,
1455
+ onShortcut: u,
1456
+ onEffectiveZoom: c
1814
1457
  }) {
1815
- const n = P(), { product: c } = e, h = a ?? (r ? "ported" : "active"), u = { view: h, handoff: d }, g = e.coverage(u), f = e.activeScenarios(u).length, p = e.treeFor(u).filter((s) => s.scenarios.length > 0), b = e.orphansFor(u), S = e.byStatus("ported", { handoff: d }).length, _ = h === "ported" ? n.sidebar.portedReferences(S) : n.sidebar.activeWork;
1816
- return /* @__PURE__ */ l("div", { className: "ds-chrome ds-home", children: [
1817
- /* @__PURE__ */ l("header", { className: "ds-home__header", children: [
1818
- /* @__PURE__ */ t("p", { className: "ds-home__view", "aria-live": "polite", children: _ }),
1819
- /* @__PURE__ */ t("h1", { children: c.name }),
1820
- c.tagline && /* @__PURE__ */ t("p", { className: "ds-home__tagline", children: c.tagline }),
1821
- /* @__PURE__ */ t("p", { className: "ds-home__lead", children: n.home.lead(f) }),
1822
- /* @__PURE__ */ t("div", { className: "ds-chips", children: Object.entries(g).filter(([, s]) => s > 0).map(([s, m]) => /* @__PURE__ */ l("span", { className: "ds-chip", children: [
1823
- n.status[s],
1824
- ": ",
1825
- m
1826
- ] }, s)) }),
1827
- f > 0 && h === "active" && S > 0 && /* @__PURE__ */ t(
1828
- "button",
1829
- {
1830
- type: "button",
1831
- className: "ds-text-action ds-home__view-action",
1832
- onClick: () => i?.("ported"),
1833
- children: n.sidebar.viewPorted(S)
1834
- }
1835
- ),
1836
- h === "ported" && /* @__PURE__ */ t(
1837
- "button",
1838
- {
1839
- type: "button",
1840
- className: "ds-text-action ds-home__view-action",
1841
- onClick: () => i?.("active"),
1842
- children: n.sidebar.backToActive
1843
- }
1844
- )
1845
- ] }),
1846
- /* @__PURE__ */ l("section", { className: "ds-home__legend", "aria-labelledby": "ds-status-legend-title", children: [
1847
- /* @__PURE__ */ t("h2", { id: "ds-status-legend-title", children: n.home.statusLegend }),
1848
- /* @__PURE__ */ t("ul", { children: be.map((s) => /* @__PURE__ */ l("li", { children: [
1849
- /* @__PURE__ */ t("span", { className: "ds-status-dot", "data-status": s, "aria-hidden": "true" }),
1850
- /* @__PURE__ */ l("span", { children: [
1851
- /* @__PURE__ */ t("strong", { children: n.status[s] }),
1852
- /* @__PURE__ */ t("small", { children: n.statusMeaning[s] })
1853
- ] })
1854
- ] }, s)) })
1855
- ] }),
1856
- f === 0 && /* @__PURE__ */ l("section", { className: "ds-home__empty", "aria-label": n.sidebar.currentView(_), children: [
1857
- /* @__PURE__ */ t("p", { children: h === "ported" ? n.home.noPortedReferences : n.home.noActiveWork }),
1858
- h === "active" && S > 0 && /* @__PURE__ */ t(
1859
- "button",
1860
- {
1861
- type: "button",
1862
- className: "ds-text-action",
1863
- onClick: () => i?.("ported"),
1864
- children: n.sidebar.viewPorted(S)
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;
1462
+ try {
1463
+ O?.location.replace(new URL(N, d).toString());
1464
+ } catch {
1465
+ l.current && (l.current.src = N);
1466
+ }
1467
+ },
1468
+ [d]
1469
+ );
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
1479
+ });
1480
+ if (x)
1481
+ switch (x.type) {
1482
+ 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
1489
+ );
1490
+ return;
1491
+ }
1492
+ M.current = x.url, y.current = x.url, s(x.url, !0);
1493
+ return;
1494
+ }
1495
+ case "navigate":
1496
+ M.current = x.url, s(x.url, x.replace);
1497
+ return;
1498
+ case "shortcut":
1499
+ u(x.key);
1500
+ return;
1501
+ default:
1502
+ return;
1865
1503
  }
1866
- )
1867
- ] }),
1868
- p.map(({ module: s, scenarios: m }) => /* @__PURE__ */ t(
1869
- St,
1870
- {
1871
- module: s,
1872
- scenarios: m,
1873
- registry: e,
1874
- view: h,
1875
- handoff: d,
1876
- onOpenScenario: o
1877
- },
1878
- s.id
1879
- )),
1880
- b.length > 0 && /* @__PURE__ */ l("section", { className: "ds-home__module", children: [
1881
- /* @__PURE__ */ t("h2", { children: n.home.withoutModule }),
1882
- /* @__PURE__ */ t("p", { className: "ds-home__hint", children: n.home.withoutModuleHint }),
1883
- /* @__PURE__ */ t(
1884
- ke,
1504
+ };
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(
1513
+ "div",
1514
+ {
1515
+ className: "ds-canvas__box",
1516
+ style: { width: Math.floor(v * m), height: Math.floor(E * m) },
1517
+ children: /* @__PURE__ */ t(
1518
+ "iframe",
1885
1519
  {
1886
- scenarios: b,
1887
- registry: e,
1888
- onOpenScenario: o
1520
+ ref: l,
1521
+ [et]: "",
1522
+ className: "ds-frame",
1523
+ src: b,
1524
+ title: a,
1525
+ style: {
1526
+ width: Math.floor(v),
1527
+ height: Math.floor(E),
1528
+ transform: m === 1 ? void 0 : `scale(${m})`,
1529
+ pointerEvents: r ? "none" : void 0
1530
+ }
1889
1531
  }
1890
1532
  )
1891
- ] })
1892
- ] });
1533
+ }
1534
+ ) });
1893
1535
  }
1894
- function St({
1895
- module: e,
1896
- scenarios: o,
1897
- registry: a,
1898
- view: i,
1899
- handoff: d,
1900
- onOpenScenario: r
1901
- }) {
1902
- return /* @__PURE__ */ l("section", { className: "ds-home__module", children: [
1903
- /* @__PURE__ */ t("h2", { children: e.name }),
1904
- e.description && /* @__PURE__ */ t("p", { className: "ds-home__hint", children: e.description }),
1905
- (e.flows ?? []).map((n) => /* @__PURE__ */ t(
1906
- xt,
1907
- {
1908
- flow: n,
1909
- registry: a,
1910
- view: i,
1911
- handoff: d,
1912
- onOpenScenario: r
1913
- },
1914
- n.id
1915
- )),
1916
- /* @__PURE__ */ t(ke, { scenarios: o, registry: a, onOpenScenario: r })
1917
- ] });
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;
1541
+ 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 }
1545
+ );
1546
+ };
1547
+ if (r(), typeof ResizeObserver > "u")
1548
+ 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;
1918
1552
  }
1919
- function xt({
1920
- flow: e,
1921
- registry: o,
1922
- view: a,
1923
- handoff: i,
1924
- onOpenScenario: d
1925
- }) {
1926
- const r = e.steps.filter((n) => {
1927
- const c = o.scenario(n.scenario);
1928
- return c && (!i || i.scenarios?.includes(c.id)) && (a === "ported" ? c.status === "ported" : c.status !== "ported");
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";
1557
+ }
1558
+ }
1559
+ function fe(e) {
1560
+ if (e)
1561
+ return typeof e.data == "function" ? e.data() : e.data;
1562
+ }
1563
+ const we = {
1564
+ id: "fixtures",
1565
+ label: "Fixtures",
1566
+ load: async ({ scenario: e, fixture: n, network: o }) => {
1567
+ switch (o) {
1568
+ case "empty":
1569
+ return null;
1570
+ case "error":
1571
+ throw new zt(e.id);
1572
+ case "loading":
1573
+ return new Promise(() => {
1574
+ });
1575
+ case "slow":
1576
+ return await Ot(Ft), fe(n);
1577
+ default:
1578
+ return fe(n);
1579
+ }
1580
+ }
1581
+ };
1582
+ function qt(e) {
1583
+ const { id: n, label: o, baseUrl: a, path: r, init: s, fallbackToFixture: u = !0 } = e;
1584
+ return {
1585
+ id: n,
1586
+ label: o,
1587
+ load: async (c) => {
1588
+ const p = new URL(r ? r(c) : c.scenario.route, a);
1589
+ 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 });
1596
+ }
1597
+ }
1598
+ };
1599
+ }
1600
+ function Ot(e) {
1601
+ return new Promise((n) => setTimeout(n, e));
1602
+ }
1603
+ function At(e) {
1604
+ const { scenario: n, fixture: o, network: a, adapter: r } = e, [s, u] = z({
1605
+ data: void 0,
1606
+ isLoading: !!n,
1607
+ error: void 0
1929
1608
  });
1930
- return r.length === 0 ? null : /* @__PURE__ */ l("div", { className: "ds-flow", children: [
1931
- /* @__PURE__ */ t("h3", { children: e.title }),
1932
- e.description && /* @__PURE__ */ t("p", { className: "ds-home__hint", children: e.description }),
1933
- /* @__PURE__ */ t("ol", { className: "ds-flow__steps", children: r.map((n, c) => {
1934
- const h = o.scenario(n.scenario), u = Object.entries(n.branches ?? {}).filter(([, g]) => {
1935
- const f = o.scenario(g);
1936
- return f && (!i || i.scenarios?.includes(f.id)) && (a === "ported" ? f.status === "ported" : f.status !== "ported");
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({
1621
+ data: void 0,
1622
+ isLoading: !1,
1623
+ error: l instanceof Error ? l : new Error(String(l))
1937
1624
  });
1938
- return /* @__PURE__ */ l("li", { children: [
1939
- /* @__PURE__ */ t("button", { type: "button", className: "ds-flow__step", onClick: () => d(n.scenario), children: n.label ?? h?.title ?? n.scenario }),
1940
- n.decision && /* @__PURE__ */ t("p", { className: "ds-flow__decision", children: n.decision }),
1941
- u.length > 0 && /* @__PURE__ */ t("ul", { className: "ds-flow__branches", children: u.map(([g, f]) => /* @__PURE__ */ l("li", { children: [
1942
- /* @__PURE__ */ t("span", { className: "ds-flow__branch-label", children: g }),
1943
- /* @__PURE__ */ t(
1944
- "button",
1945
- {
1946
- type: "button",
1947
- className: "ds-flow__step",
1948
- onClick: () => d(f),
1949
- children: o.scenario(f)?.title ?? f
1950
- }
1951
- )
1952
- ] }, g)) })
1953
- ] }, `${n.scenario}-${c}`);
1954
- }) })
1955
- ] });
1625
+ }), () => {
1626
+ c = !1;
1627
+ };
1628
+ }, [n, o, a, r]), s;
1956
1629
  }
1957
- function ke({
1958
- scenarios: e,
1959
- registry: o,
1960
- onOpenScenario: a
1961
- }) {
1962
- const i = P();
1963
- return /* @__PURE__ */ t("ul", { className: "ds-home__grid", children: e.map((d) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("button", { type: "button", className: "ds-home__card", onClick: () => a(d.id), children: [
1964
- /* @__PURE__ */ l("span", { className: "ds-home__card-head", children: [
1965
- /* @__PURE__ */ t(
1966
- "span",
1967
- {
1968
- className: "ds-status-dot",
1969
- "data-status": d.status,
1970
- "data-approval": d.status === "approved" && !d.approvedAt ? "incomplete" : void 0
1971
- }
1972
- ),
1973
- /* @__PURE__ */ t("span", { className: "ds-home__card-title", children: d.title })
1974
- ] }),
1975
- d.intent && /* @__PURE__ */ t("span", { className: "ds-home__card-intent", children: d.intent }),
1976
- /* @__PURE__ */ l("span", { className: "ds-home__card-meta", children: [
1977
- o.persona(d.persona)?.name ?? d.persona,
1978
- " · ",
1979
- d.status === "approved" && !d.approvedAt ? i.inspector.approvalPendingStatus : i.status[d.status],
1980
- d.a11y.keyboard === "full" ? ` · ${i.home.keyboardBadge}` : ""
1981
- ] })
1982
- ] }) }, d.id)) });
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
1634
+ ] });
1983
1635
  }
1984
- function $t({ product: e }) {
1985
- const o = T(() => Le(e), [e]), a = T(() => tt(e.theme?.labels), [e.theme?.labels]), i = T(() => Te(e.deploy), [e.deploy]), {
1986
- location: d,
1987
- controls: r,
1988
- viewport: n,
1989
- setControls: c,
1990
- setScenarioView: h,
1991
- navigate: u,
1992
- openScenario: g,
1993
- openComponent: f
1994
- } = Ee(o), p = ce(r), b = re(null), { focused: S, tabStops: _ } = et(r.keyboardMode, b);
1995
- D(() => {
1996
- const N = b.current;
1997
- if (!N || !r.handoff) return;
1998
- const C = () => {
1999
- for (const de of N.querySelectorAll("a[href]")) {
2000
- const Q = de.getAttribute("href");
2001
- if (!Q || Q.startsWith("#")) continue;
2002
- let W;
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;
1648
+ try {
1649
+ A = new URL(F, window.location.href);
1650
+ } catch {
1651
+ return;
1652
+ }
1653
+ A.origin === window.location.origin && (k.preventDefault(), u(`${A.pathname}${A.search}`));
1654
+ };
1655
+ return document.addEventListener("click", x), () => document.removeEventListener("click", x);
1656
+ }, [u]), K(() => {
1657
+ const x = (k) => {
1658
+ 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));
1663
+ };
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
1673
  try {
2004
- W = new URL(Q, window.location.href);
1674
+ B = new URL(A, window.location.href);
2005
1675
  } catch {
2006
1676
  continue;
2007
1677
  }
2008
- if (W.origin !== window.location.origin) continue;
2009
- oe(W.searchParams, r.handoff);
2010
- const le = `${W.pathname}${W.search}${W.hash}`;
2011
- Q !== le && de.setAttribute("href", le);
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);
2012
1682
  }
2013
1683
  };
2014
- C();
2015
- const ae = new MutationObserver(C);
2016
- return ae.observe(N, {
2017
- subtree: !0,
2018
- childList: !0,
2019
- attributes: !0,
2020
- attributeFilter: ["href"]
2021
- }), () => ae.disconnect();
1684
+ k();
1685
+ const P = new MutationObserver(k);
1686
+ return P.observe(x, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["href"] }), () => P.disconnect();
2022
1687
  }, [r.handoff]);
2023
- const s = o.scenario(r.scenario), m = o.component(r.component), k = T(() => {
2024
- const N = new URLSearchParams(d.search);
1688
+ const l = n.scenario(r.scenario), w = n.component(r.component), f = D(() => {
1689
+ const x = new URLSearchParams(a.search);
2025
1690
  return {
2026
- scenario: N.get(w.scenario) ?? void 0,
2027
- component: N.get(w.component) ?? void 0
2028
- };
2029
- }, [d.search]), M = !!(r.handoff && (k.scenario && !te(r.handoff, k.scenario) || k.component && !ee(r.handoff, k.component) || !k.component && !Ae(
2030
- r.handoff,
2031
- d.path,
2032
- e.scenarios
2033
- ))), y = T(
2034
- () => o.resolveComponentFixture(m?.id, m ? r.fixture : void 0),
2035
- [m, r.fixture, o]
2036
- ), E = T(() => {
2037
- const N = y.fixture?.data;
2038
- return typeof N == "function" ? N() : N;
2039
- }, [y.fixture]), $ = o.persona(r.persona ?? s?.persona), O = o.fixture(r.fixture ?? s?.fixture), G = T(() => {
2040
- const N = r.dataSource ?? "fixtures";
2041
- return N === "fixtures" ? ie : e.dataSources?.adapters?.find((C) => C.id === N) ?? ie;
2042
- }, [r.dataSource, e.dataSources?.adapters]), { data: I, isLoading: B, error: U } = ze({ scenario: s, fixture: O, network: r.network, adapter: G });
2043
- D(() => {
2044
- const N = (C) => {
2045
- if (!(!C.shiftKey || C.metaKey || C.ctrlKey || C.altKey || C.target?.matches("input, textarea, select, [contenteditable='true']"))) {
2046
- switch (C.key) {
2047
- case "K":
2048
- c({ keyboardMode: !r.keyboardMode });
2049
- break;
2050
- case "P":
2051
- c({ inspector: !r.inspector });
2052
- break;
2053
- default:
2054
- return;
2055
- }
2056
- C.preventDefault();
2057
- }
1691
+ scenario: x.get(C.scenario) ?? void 0,
1692
+ component: x.get(C.component) ?? void 0
2058
1693
  };
2059
- return window.addEventListener("keydown", N), () => window.removeEventListener("keydown", N);
2060
- }, [r.keyboardMode, r.inspector, c]);
2061
- const H = T(() => r.persona && r.persona !== s?.persona ? o.persona(r.persona)?.permissions ?? [] : o.permissionsOf(s), [r.persona, o, s]), j = T(
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,
1706
+ 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(
2062
1709
  () => ({
2063
- scenario: s,
2064
- persona: $,
2065
- permissions: H,
2066
- can: (N) => H.includes(N),
2067
- data: I,
2068
- fixture: O,
1710
+ scenario: l,
1711
+ persona: d,
1712
+ permissions: $,
1713
+ can: (x) => $.includes(x),
1714
+ data: L,
1715
+ fixture: h,
2069
1716
  network: r.network,
2070
- isLoading: B,
2071
- error: U,
2072
- rules: o.rulesOf(s),
2073
- viewport: n,
1717
+ isLoading: T,
1718
+ error: _,
1719
+ rules: n.rulesOf(l),
1720
+ viewport: s,
2074
1721
  themeMode: r.themeMode,
2075
1722
  locale: r.locale,
2076
- a11y: {
2077
- keyboardMode: r.keyboardMode,
2078
- reducedMotion: r.reducedMotion,
2079
- textScale: r.textScale
2080
- },
2081
- navigate: u,
2082
- openScenario: g
1723
+ navigate: (x) => u(x),
1724
+ openScenario: c
2083
1725
  }),
2084
1726
  [
2085
- s,
1727
+ l,
1728
+ d,
2086
1729
  $,
2087
- H,
2088
- I,
2089
- O,
1730
+ L,
1731
+ h,
2090
1732
  r.network,
2091
1733
  r.themeMode,
2092
1734
  r.locale,
2093
- r.keyboardMode,
2094
- r.reducedMotion,
2095
- r.textScale,
2096
- B,
2097
- U,
2098
- o,
1735
+ T,
1736
+ _,
2099
1737
  n,
1738
+ s,
2100
1739
  u,
2101
- g
1740
+ c
2102
1741
  ]
2103
- ), Y = !M && !s && !m && d.path === "/", K = Pe(e.routes, d.path), V = e.wrapper, q = e.notFound, J = m?.preview, v = M ? /* @__PURE__ */ t(fe, { title: a.shell.outsideHandoff, children: /* @__PURE__ */ t("p", { children: a.shell.outsideHandoffHint }) }) : J ? /* @__PURE__ */ t(
2104
- J,
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,
2105
1744
  {
2106
- fixture: y.fixture,
2107
- data: E,
2108
- viewport: n,
1745
+ fixture: M.fixture,
1746
+ data: y,
1747
+ viewport: s,
2109
1748
  themeMode: r.themeMode ?? "default",
2110
- locale: r.locale ?? "default",
2111
- a11y: {
2112
- keyboardMode: r.keyboardMode,
2113
- reducedMotion: r.reducedMotion,
2114
- textScale: r.textScale
2115
- }
1749
+ locale: r.locale ?? "default"
2116
1750
  }
2117
- ) : K ? /* @__PURE__ */ t(K.definition.screen, { params: K.params, context: j }) : q ? /* @__PURE__ */ t(q, { path: d.path }) : /* @__PURE__ */ t(fe, { title: a.shell.noRoute, children: /* @__PURE__ */ l("p", { children: [
2118
- /* @__PURE__ */ t("code", { children: d.path }),
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 }),
2119
1753
  " ",
2120
- a.shell.noRouteHint
2121
- ] }) }), x = V && !M ? /* @__PURE__ */ t(V, { context: j, children: v }) : v;
2122
- return /* @__PURE__ */ t(we.Provider, { value: a, children: /* @__PURE__ */ l(
1754
+ o.shell.noRouteHint
1755
+ ] }) });
1756
+ return (
1757
+ // `display: contents` deixa o layout do produto como se este nó não
1758
+ // 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 })
1760
+ );
1761
+ }
1762
+ function Kt(e) {
1763
+ if (!e.altKey) {
1764
+ if (e.shiftKey && !e.metaKey && !e.ctrlKey && e.key === "C") return "C";
1765
+ 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";
1769
+ }
1770
+ }
1771
+ }
1772
+ const ae = {
1773
+ leftWidth: "ds:left-width",
1774
+ rightWidth: "ds:right-width",
1775
+ appearance: "ds:appearance"
1776
+ };
1777
+ function Ve(e) {
1778
+ try {
1779
+ return window.localStorage.getItem(e) ?? void 0;
1780
+ } catch {
1781
+ return;
1782
+ }
1783
+ }
1784
+ function Ie(e, n) {
1785
+ try {
1786
+ window.localStorage.setItem(e, n);
1787
+ } catch {
1788
+ }
1789
+ }
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));
1801
+ },
1802
+ [e, a, o]
1803
+ );
1804
+ return [r, u];
1805
+ }
1806
+ function Vt() {
1807
+ const e = "(prefers-color-scheme: dark)", n = () => {
1808
+ try {
1809
+ return window.matchMedia(e).matches ? "dark" : "light";
1810
+ } catch {
1811
+ return "light";
1812
+ }
1813
+ }, [o, a] = z(n);
1814
+ return K(() => {
1815
+ let r;
1816
+ try {
1817
+ r = window.matchMedia(e);
1818
+ } catch {
1819
+ return;
1820
+ }
1821
+ const s = () => a(r?.matches ? "dark" : "light");
1822
+ return r.addEventListener?.("change", s), () => r?.removeEventListener?.("change", s);
1823
+ }, []), o;
1824
+ }
1825
+ function It() {
1826
+ const e = Ve(ae.appearance);
1827
+ return e === "dark" || e === "light" ? e : void 0;
1828
+ }
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();
1864
+ return;
1865
+ }
1866
+ window.dispatchEvent(new KeyboardEvent("keydown", { key: R.toLowerCase(), metaKey: !0 }));
1867
+ },
1868
+ [Z]
1869
+ );
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));
1873
+ };
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 });
1880
+ },
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(
2123
1887
  "div",
2124
1888
  {
2125
1889
  className: "ds-root",
2126
- "data-chrome": r.chrome ? "visible" : "hidden",
2127
- "data-appearance": r.chromeTheme ?? "dark",
2128
- "data-inspector": r.inspector ? "open" : "closed",
2129
- "data-viewport": n.id,
1890
+ "data-appearance": h,
1891
+ "data-chrome": s.chrome ? "visible" : "hidden",
1892
+ "data-resizing": $ ? "true" : void 0,
1893
+ "data-viewport": u.id,
2130
1894
  children: [
2131
- r.chrome && /* @__PURE__ */ t(
2132
- it,
1895
+ s.chrome && /* @__PURE__ */ t(
1896
+ gt,
2133
1897
  {
2134
- product: e,
2135
- scenario: s,
2136
- deploy: i,
2137
- inspectorOpen: r.inspector,
2138
- chromeTheme: r.chromeTheme ?? "dark",
2139
- view: p,
2140
- handoff: r.handoff,
2141
- onToggleInspector: () => c({ inspector: !r.inspector }),
2142
- onToggleChromeTheme: () => c({ chromeTheme: r.chromeTheme === "light" ? "dark" : "light" })
1898
+ 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
2143
1912
  }
2144
1913
  ),
2145
- r.chrome && /* @__PURE__ */ t(
2146
- ot,
2147
- {
2148
- registry: o,
2149
- activeScenario: s,
2150
- activeComponent: r.component,
2151
- controls: r,
2152
- onOpenScenario: g,
2153
- onOpenComponent: f,
2154
- onViewChange: h
2155
- }
2156
- ),
2157
- /* @__PURE__ */ l("div", { className: "ds-stage-area", children: [
2158
- Y ? /* @__PURE__ */ t("div", { className: "ds-stage-scroll", children: /* @__PURE__ */ t(
2159
- Nt,
1914
+ /* @__PURE__ */ g("div", { className: "ds-body", children: [
1915
+ s.chrome && /* @__PURE__ */ t(
1916
+ yt,
2160
1917
  {
2161
- registry: o,
2162
- view: p,
2163
- handoff: r.handoff,
2164
- onViewChange: h,
2165
- onOpenScenario: g
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)
2166
1928
  }
2167
- ) }) : /* @__PURE__ */ t(
2168
- wt,
1929
+ ),
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,
2169
1935
  {
2170
- ref: b,
2171
- viewport: n,
2172
- textScale: r.textScale,
2173
- reducedMotion: r.reducedMotion,
2174
- keyboardMode: r.keyboardMode,
2175
- children: x
1936
+ 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
2176
1944
  }
2177
- ),
2178
- r.chrome && /* @__PURE__ */ t(
2179
- pt,
1945
+ ) }),
1946
+ s.chrome && /* @__PURE__ */ t(
1947
+ Mt,
2180
1948
  {
2181
- registry: o,
2182
- controls: r,
2183
- scenarioActive: !!s,
2184
- component: m,
2185
- componentFixture: y,
2186
- onChange: c
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)
2187
1965
  }
2188
1966
  )
2189
1967
  ] }),
2190
- r.chrome && /* @__PURE__ */ t(
2191
- ht,
2192
- {
2193
- registry: o,
2194
- scenario: s,
2195
- component: m,
2196
- componentFixture: y,
2197
- controls: r,
2198
- focusedNode: S,
2199
- tabStopCount: _.length
2200
- }
2201
- ),
2202
- r.keyboardMode && /* @__PURE__ */ t(kt, { stops: _ }),
2203
- !r.chrome && /* @__PURE__ */ t(
1968
+ !s.chrome && /* @__PURE__ */ t(
2204
1969
  "button",
2205
1970
  {
2206
1971
  type: "button",
2207
- className: "ds-chrome ds-restore",
2208
- onClick: () => c({ chrome: !0 }),
2209
- children: a.shell.restoreChrome
1972
+ 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" })
2210
1977
  }
2211
1978
  )
2212
1979
  ]
2213
1980
  }
2214
- ) });
1981
+ );
2215
1982
  }
2216
- function Z(e) {
1983
+ function se(e) {
2217
1984
  return new Date(e.length === 10 ? `${e}T00:00:00` : e);
2218
1985
  }
2219
- function Et(e, o) {
2220
- const a = Z(e), i = Z(o);
2221
- let d = i.getFullYear() - a.getFullYear();
2222
- const r = i.getMonth() - a.getMonth();
2223
- return (r < 0 || r === 0 && i.getDate() < a.getDate()) && (d -= 1), d;
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;
2224
1991
  }
2225
- function Rt(e, o) {
2226
- const a = Z(e), i = Z(o);
2227
- return Math.floor((i.getTime() - a.getTime()) / 864e5);
1992
+ function Qt(e, n) {
1993
+ const o = se(e), a = se(n);
1994
+ return Math.floor((a.getTime() - o.getTime()) / 864e5);
2228
1995
  }
2229
1996
  export {
2230
- It as CONTRAST_THRESHOLDS,
2231
- L as DEFAULT_LABELS,
2232
- $t as DesignSpace,
2233
- Tt as EN_US_LABELS,
2234
- Bt as HANDOFF_PARAM,
2235
- Nt as Home,
2236
- Ft as KEYBOARD_LABELS,
2237
- Lt as NETWORK_LABELS,
2238
- ve as NETWORK_STATES,
2239
- w as PARAM,
2240
- be as SCENARIO_STATUSES,
2241
- Be as SLOW_NETWORK_DELAY_MS,
2242
- At as STATUS_LABELS,
2243
- Pt as STATUS_MEANING,
2244
- He as SimulatedNetworkError,
2245
- wt as Stage,
2246
- fe as StageEmpty,
2247
- Fe as TEXT_SCALES,
2248
- kt as TabOrderOverlay,
2249
- ge as VIEWPORTS,
2250
- Et as ageInYears,
2251
- oe as applyHandoffScope,
2252
- Ht as applyOverrides,
2253
- Wt as assertContrastPairs,
2254
- zt as checkContrastPair,
2255
- Ce as checkContrastPairs,
2256
- Ut as commitUrl,
2257
- jt as componentUrl,
2258
- Ve as computeRole,
2259
- Kt as contrastRatio,
2260
- Ct as createHttpAdapter,
2261
- Le as createRegistry,
2262
- Rt as daysBetween,
2263
- Ke as describeElement,
2264
- ie as fixtureAdapter,
2265
- Vt as flatten,
2266
- qt as formatIssues,
2267
- Te as getDeployContext,
2268
- ee as handoffAllowsComponent,
2269
- Ae as handoffAllowsPath,
2270
- te as handoffAllowsScenario,
2271
- Gt as hasErrors,
2272
- Yt as matchPath,
2273
- Jt as normalizeHandoffScope,
2274
- Qt as parseColor,
2275
- $e as parseControls,
2276
- _e as parseHandoffScope,
2277
- Z as parseIsoDate,
2278
- Xt as readCssVariable,
2279
- Zt as relativeLuminance,
2280
- se as resolveFixture,
2281
- tt as resolveLabels,
2282
- Pe as resolveRoute,
2283
- Re as resolveViewport,
2284
- Me as scenarioUrl,
2285
- X as serializeControls,
2286
- eo as serializeValue,
2287
- Xe as shortSelector,
2288
- Ze as tabbableElements,
2289
- Ee as useDesignSpaceState,
2290
- et as useKeyboardMode,
2291
- P as useLabels,
2292
- ze as useScenarioData,
2293
- ye as validateProduct,
2294
- to as validateScenario
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
2295
2047
  };
2296
2048
  //# sourceMappingURL=index.js.map