storybook 9.1.0-alpha.0 → 9.1.0-alpha.10

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.
Files changed (112) hide show
  1. package/assets/browser/favicon-wrapper.svg +46 -0
  2. package/assets/browser/favicon.svg +1 -1
  3. package/dist/actions/index.cjs +16 -16
  4. package/dist/actions/index.d.ts +1 -38
  5. package/dist/actions/index.js +12 -12
  6. package/dist/bin/index.cjs +62 -69
  7. package/dist/bin/index.js +43 -50
  8. package/dist/builder-manager/index.cjs +379 -378
  9. package/dist/builder-manager/index.d.ts +567 -2
  10. package/dist/builder-manager/index.js +280 -279
  11. package/dist/cli/bin/index.cjs +945 -945
  12. package/dist/cli/bin/index.js +673 -672
  13. package/dist/cli/index.cjs +14965 -14973
  14. package/dist/cli/index.d.ts +713 -15
  15. package/dist/cli/index.js +13488 -13495
  16. package/dist/common/index.cjs +11211 -11103
  17. package/dist/common/index.d.ts +351 -72
  18. package/dist/common/index.js +18491 -18379
  19. package/dist/components/index.cjs +4606 -4425
  20. package/dist/components/index.d.ts +11 -12
  21. package/dist/components/index.js +3020 -2834
  22. package/dist/controls/index.cjs +16 -16
  23. package/dist/controls/index.d.ts +1 -36
  24. package/dist/core-server/index.cjs +6690 -6624
  25. package/dist/core-server/index.d.ts +14 -2
  26. package/dist/core-server/index.js +6088 -6023
  27. package/dist/core-server/presets/common-manager.js +3582 -3475
  28. package/dist/core-server/presets/common-preset.cjs +85015 -5213
  29. package/dist/core-server/presets/common-preset.js +85107 -5291
  30. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.cjs +28728 -0
  31. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +28729 -0
  32. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.cjs +29339 -0
  33. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +29340 -0
  34. package/dist/csf/index.cjs +3019 -104
  35. package/dist/csf/index.d.ts +301 -18
  36. package/dist/csf/index.js +3031 -98
  37. package/dist/csf-tools/index.cjs +489 -488
  38. package/dist/csf-tools/index.js +311 -309
  39. package/dist/highlight/index.cjs +15 -15
  40. package/dist/highlight/index.d.ts +1 -12
  41. package/dist/highlight/index.js +4 -4
  42. package/dist/instrumenter/index.cjs +1308 -1239
  43. package/dist/instrumenter/index.d.ts +25 -3
  44. package/dist/instrumenter/index.js +1345 -1280
  45. package/dist/manager/globals-module-info.cjs +1 -1
  46. package/dist/manager/globals-module-info.js +1 -1
  47. package/dist/manager/globals-runtime.js +42257 -44665
  48. package/dist/manager/runtime.js +3715 -3536
  49. package/dist/manager-api/index.cjs +74 -74
  50. package/dist/manager-api/index.d.ts +4 -1
  51. package/dist/manager-api/index.js +142 -142
  52. package/dist/node-logger/index.cjs +8520 -994
  53. package/dist/node-logger/index.d.ts +395 -2
  54. package/dist/node-logger/index.js +8535 -995
  55. package/dist/preview/runtime.js +13701 -16331
  56. package/dist/preview-api/index.cjs +1434 -1458
  57. package/dist/preview-api/index.d.ts +13 -10
  58. package/dist/preview-api/index.js +950 -976
  59. package/dist/server-errors.cjs +201 -242
  60. package/dist/server-errors.d.ts +1 -12
  61. package/dist/server-errors.js +182 -223
  62. package/dist/telemetry/index.cjs +1919 -1638
  63. package/dist/telemetry/index.d.ts +4 -2
  64. package/dist/telemetry/index.js +1972 -1690
  65. package/dist/test/index.cjs +9184 -9816
  66. package/dist/test/index.d.ts +8 -1
  67. package/dist/test/index.js +8390 -9029
  68. package/dist/types/index.d.ts +19 -17
  69. package/dist/viewport/index.cjs +17 -24
  70. package/dist/viewport/index.d.ts +9 -532
  71. package/dist/viewport/index.js +9 -16
  72. package/package.json +18 -187
  73. package/templates/mocker-runtime.template.js +89 -0
  74. package/dist/actions/preview.cjs +0 -159
  75. package/dist/actions/preview.d.ts +0 -555
  76. package/dist/actions/preview.js +0 -149
  77. package/dist/backgrounds/index.cjs +0 -148
  78. package/dist/backgrounds/index.d.ts +0 -592
  79. package/dist/backgrounds/index.js +0 -130
  80. package/dist/backgrounds/preview.cjs +0 -143
  81. package/dist/backgrounds/preview.d.ts +0 -555
  82. package/dist/backgrounds/preview.js +0 -127
  83. package/dist/component-testing/index.cjs +0 -23
  84. package/dist/component-testing/index.d.ts +0 -3
  85. package/dist/component-testing/index.js +0 -5
  86. package/dist/component-testing/preview.cjs +0 -40
  87. package/dist/component-testing/preview.d.ts +0 -5
  88. package/dist/component-testing/preview.js +0 -25
  89. package/dist/controls/preview.cjs +0 -26
  90. package/dist/controls/preview.d.ts +0 -555
  91. package/dist/controls/preview.js +0 -9
  92. package/dist/highlight/preview.cjs +0 -590
  93. package/dist/highlight/preview.d.ts +0 -555
  94. package/dist/highlight/preview.js +0 -574
  95. package/dist/measure/index.cjs +0 -476
  96. package/dist/measure/index.d.ts +0 -567
  97. package/dist/measure/index.js +0 -464
  98. package/dist/measure/preview.cjs +0 -466
  99. package/dist/measure/preview.d.ts +0 -560
  100. package/dist/measure/preview.js +0 -450
  101. package/dist/outline/index.cjs +0 -528
  102. package/dist/outline/index.d.ts +0 -567
  103. package/dist/outline/index.js +0 -500
  104. package/dist/outline/preview.cjs +0 -518
  105. package/dist/outline/preview.d.ts +0 -560
  106. package/dist/outline/preview.js +0 -486
  107. package/dist/test/preview.cjs +0 -73
  108. package/dist/test/preview.d.ts +0 -555
  109. package/dist/test/preview.js +0 -66
  110. package/dist/viewport/preview.cjs +0 -35
  111. package/dist/viewport/preview.d.ts +0 -569
  112. package/dist/viewport/preview.js +0 -19
@@ -1,65 +1,65 @@
1
1
  "use strict";
2
- var v = Object.create;
3
- var d = Object.defineProperty;
4
- var j = Object.getOwnPropertyDescriptor;
5
- var _ = Object.getOwnPropertyNames;
6
- var C = Object.getPrototypeOf, E = Object.prototype.hasOwnProperty;
7
- var a = (e, r) => d(e, "name", { value: r, configurable: !0 });
8
- var P = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports), z = (e, r) => {
9
- for (var t in r)
10
- d(e, t, { get: r[t], enumerable: !0 });
11
- }, x = (e, r, t, n) => {
12
- if (r && typeof r == "object" || typeof r == "function")
13
- for (let s of _(r))
14
- !E.call(e, s) && s !== t && d(e, s, { get: () => r[s], enumerable: !(n = j(r, s)) || n.enumerable });
2
+ var Eo = Object.create;
3
+ var oe = Object.defineProperty;
4
+ var Co = Object.getOwnPropertyDescriptor;
5
+ var vo = Object.getOwnPropertyNames;
6
+ var ko = Object.getPrototypeOf, Po = Object.prototype.hasOwnProperty;
7
+ var n = (e, t) => oe(e, "name", { value: t, configurable: !0 });
8
+ var Pt = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Le = (e, t) => {
9
+ for (var r in t)
10
+ oe(e, r, { get: t[r], enumerable: !0 });
11
+ }, Ot = (e, t, r, o) => {
12
+ if (t && typeof t == "object" || typeof t == "function")
13
+ for (let i of vo(t))
14
+ !Po.call(e, i) && i !== r && oe(e, i, { get: () => t[i], enumerable: !(o = Co(t, i)) || o.enumerable });
15
15
  return e;
16
16
  };
17
- var I = (e, r, t) => (t = e != null ? v(C(e)) : {}, x(
17
+ var J = (e, t, r) => (r = e != null ? Eo(ko(e)) : {}, Ot(
18
18
  // If the importer is in node compatibility mode or this is not an ESM
19
19
  // file that has been converted to a CommonJS file using a Babel-
20
20
  // compatible transform (i.e. "__esModule" has not been set), then set
21
21
  // "default" to the CommonJS "module.exports" for node compatibility.
22
- r || !e || !e.__esModule ? d(t, "default", { value: e, enumerable: !0 }) : t,
22
+ t || !e || !e.__esModule ? oe(r, "default", { value: e, enumerable: !0 }) : r,
23
23
  e
24
- )), M = (e) => x(d({}, "__esModule", { value: !0 }), e);
24
+ )), Oo = (e) => Ot(oe({}, "__esModule", { value: !0 }), e);
25
25
 
26
26
  // ../node_modules/@ngard/tiny-isequal/index.js
27
- var w = P((g) => {
28
- Object.defineProperty(g, "__esModule", { value: !0 }), g.isEqual = /* @__PURE__ */ function() {
29
- var e = Object.prototype.toString, r = Object.getPrototypeOf, t = Object.getOwnPropertySymbols ? function(n) {
30
- return Object.keys(n).concat(Object.getOwnPropertySymbols(n));
27
+ var $t = Pt((_e) => {
28
+ Object.defineProperty(_e, "__esModule", { value: !0 }), _e.isEqual = /* @__PURE__ */ function() {
29
+ var e = Object.prototype.toString, t = Object.getPrototypeOf, r = Object.getOwnPropertySymbols ? function(o) {
30
+ return Object.keys(o).concat(Object.getOwnPropertySymbols(o));
31
31
  } : Object.keys;
32
- return function(n, s) {
33
- return (/* @__PURE__ */ a(function l(o, i, p) {
34
- var c, f, u, A = e.call(o), $ = e.call(i);
35
- if (o === i) return !0;
36
- if (o == null || i == null) return !1;
37
- if (p.indexOf(o) > -1 && p.indexOf(i) > -1) return !0;
38
- if (p.push(o, i), A != $ || (c = t(o), f = t(i), c.length != f.length || c.some(function(m) {
39
- return !l(o[m], i[m], p);
32
+ return function(o, i) {
33
+ return (/* @__PURE__ */ n(function s(a, p, c) {
34
+ var l, y, u, h = e.call(a), T = e.call(p);
35
+ if (a === p) return !0;
36
+ if (a == null || p == null) return !1;
37
+ if (c.indexOf(a) > -1 && c.indexOf(p) > -1) return !0;
38
+ if (c.push(a, p), h != T || (l = r(a), y = r(p), l.length != y.length || l.some(function(R) {
39
+ return !s(a[R], p[R], c);
40
40
  }))) return !1;
41
- switch (A.slice(8, -1)) {
41
+ switch (h.slice(8, -1)) {
42
42
  case "Symbol":
43
- return o.valueOf() == i.valueOf();
43
+ return a.valueOf() == p.valueOf();
44
44
  case "Date":
45
45
  case "Number":
46
- return +o == +i || +o != +o && +i != +i;
46
+ return +a == +p || +a != +a && +p != +p;
47
47
  case "RegExp":
48
48
  case "Function":
49
49
  case "String":
50
50
  case "Boolean":
51
- return "" + o == "" + i;
51
+ return "" + a == "" + p;
52
52
  case "Set":
53
53
  case "Map":
54
- c = o.entries(), f = i.entries();
54
+ l = a.entries(), y = p.entries();
55
55
  do
56
- if (!l((u = c.next()).value, f.next().value, p)) return !1;
56
+ if (!s((u = l.next()).value, y.next().value, c)) return !1;
57
57
  while (!u.done);
58
58
  return !0;
59
59
  case "ArrayBuffer":
60
- o = new Uint8Array(o), i = new Uint8Array(i);
60
+ a = new Uint8Array(a), p = new Uint8Array(p);
61
61
  case "DataView":
62
- o = new Uint8Array(o.buffer), i = new Uint8Array(i.buffer);
62
+ a = new Uint8Array(a.buffer), p = new Uint8Array(p.buffer);
63
63
  case "Float32Array":
64
64
  case "Float64Array":
65
65
  case "Int8Array":
@@ -71,109 +71,3024 @@ var w = P((g) => {
71
71
  case "Uint8ClampedArray":
72
72
  case "Arguments":
73
73
  case "Array":
74
- if (o.length != i.length) return !1;
75
- for (u = 0; u < o.length; u++) if ((u in o || u in i) && (u in o != u in i || !l(o[u], i[u], p))) return !1;
74
+ if (a.length != p.length) return !1;
75
+ for (u = 0; u < a.length; u++) if ((u in a || u in p) && (u in a != u in p || !s(a[u], p[u], c))) return !1;
76
76
  return !0;
77
77
  case "Object":
78
- return l(r(o), r(i), p);
78
+ return s(t(a), t(p), c);
79
79
  default:
80
80
  return !1;
81
81
  }
82
- }, "n"))(n, s, []);
82
+ }, "n"))(o, i, []);
83
83
  };
84
84
  }();
85
85
  });
86
86
 
87
+ // ../node_modules/ts-dedent/dist/index.js
88
+ var Q = Pt((ie) => {
89
+ "use strict";
90
+ Object.defineProperty(ie, "__esModule", { value: !0 });
91
+ ie.dedent = void 0;
92
+ function Nt(e) {
93
+ for (var t = [], r = 1; r < arguments.length; r++)
94
+ t[r - 1] = arguments[r];
95
+ var o = Array.from(typeof e == "string" ? [e] : e);
96
+ o[o.length - 1] = o[o.length - 1].replace(/\r?\n([\t ]*)$/, "");
97
+ var i = o.reduce(function(p, c) {
98
+ var l = c.match(/\n([\t ]+|(?!\s).)/g);
99
+ return l ? p.concat(l.map(function(y) {
100
+ var u, h;
101
+ return (h = (u = y.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && h !== void 0 ? h : 0;
102
+ })) : p;
103
+ }, []);
104
+ if (i.length) {
105
+ var s = new RegExp(`
106
+ [ ]{` + Math.min.apply(Math, i) + "}", "g");
107
+ o = o.map(function(p) {
108
+ return p.replace(s, `
109
+ `);
110
+ });
111
+ }
112
+ o[0] = o[0].replace(/^\r?\n/, "");
113
+ var a = o[0];
114
+ return t.forEach(function(p, c) {
115
+ var l = a.match(/(?:^|\n)( *)$/), y = l ? l[1] : "", u = p;
116
+ typeof p == "string" && p.includes(`
117
+ `) && (u = String(p).split(`
118
+ `).map(function(h, T) {
119
+ return T === 0 ? h : "" + y + h;
120
+ }).join(`
121
+ `)), a += u + o[c + 1];
122
+ }), a;
123
+ }
124
+ n(Nt, "dedent");
125
+ ie.dedent = Nt;
126
+ ie.default = Nt;
127
+ });
128
+
87
129
  // src/csf/index.ts
88
- var V = {};
89
- z(V, {
90
- combineTags: () => J,
91
- includeConditionalArg: () => T,
92
- isExportStory: () => F,
93
- isMeta: () => D,
94
- isPreview: () => U,
95
- isStory: () => B,
96
- parseKind: () => G,
97
- sanitize: () => O,
98
- storyNameFromExport: () => q,
99
- toId: () => k
130
+ var Xn = {};
131
+ Le(Xn, {
132
+ combineTags: () => qn,
133
+ definePreview: () => Nn,
134
+ definePreviewAddon: () => jn,
135
+ getCoreAnnotations: () => Ct,
136
+ includeConditionalArg: () => It,
137
+ isExportStory: () => Vn,
138
+ isMeta: () => zn,
139
+ isPreview: () => Bn,
140
+ isStory: () => Gn,
141
+ parseKind: () => Kn,
142
+ sanitize: () => wo,
143
+ storyNameFromExport: () => Yn,
144
+ toId: () => Wn
100
145
  });
101
- module.exports = M(V);
146
+ module.exports = Oo(Xn);
102
147
 
103
148
  // src/csf/toStartCaseStr.ts
104
- function S(e) {
105
- return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (r, t, n, s) => `${t} ${n}${s}`).replace(
106
- /([a-z])([A-Z])/g, (r, t, n) => `${t} ${n}`).replace(/([a-z])([0-9])/gi, (r, t, n) => `${t} ${n}`).replace(/([0-9])([a-z])/gi, (r, t, n) => `${t}\
107
- ${n}`).replace(/(\s|^)(\w)/g, (r, t, n) => `${t}${n.toUpperCase()}`).replace(/ +/g, " ").trim();
149
+ function Mt(e) {
150
+ return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (t, r, o, i) => `${r} ${o}${i}`).replace(
151
+ /([a-z])([A-Z])/g, (t, r, o) => `${r} ${o}`).replace(/([a-z])([0-9])/gi, (t, r, o) => `${r} ${o}`).replace(/([0-9])([a-z])/gi, (t, r, o) => `${r}\
152
+ ${o}`).replace(/(\s|^)(\w)/g, (t, r, o) => `${r}${o.toUpperCase()}`).replace(/ +/g, " ").trim();
108
153
  }
109
- a(S, "toStartCaseStr");
154
+ n(Mt, "toStartCaseStr");
110
155
 
111
156
  // src/csf/includeConditionalArg.ts
112
- var y = I(w(), 1);
113
- var R = /* @__PURE__ */ a((e) => e.map((r) => typeof r < "u").filter(Boolean).length, "count"), N = /* @__PURE__ */ a((e, r) => {
114
- let { exists: t, eq: n, neq: s, truthy: l } = e;
115
- if (R([t, n, s, l]) > 1)
116
- throw new Error(`Invalid conditional test ${JSON.stringify({ exists: t, eq: n, neq: s })}`);
117
- if (typeof n < "u")
118
- return (0, y.isEqual)(r, n);
119
- if (typeof s < "u")
120
- return !(0, y.isEqual)(r, s);
121
- if (typeof t < "u") {
122
- let i = typeof r < "u";
123
- return t ? i : !i;
124
- }
125
- return (typeof l > "u" ? !0 : l) ? !!r : !r;
126
- }, "testValue"), T = /* @__PURE__ */ a((e, r, t) => {
157
+ var De = J($t(), 1);
158
+ var Ft = /* @__PURE__ */ n((e) => e.map((t) => typeof t < "u").filter(Boolean).length, "count"), Mo = /* @__PURE__ */ n((e, t) => {
159
+ let { exists: r, eq: o, neq: i, truthy: s } = e;
160
+ if (Ft([r, o, i, s]) > 1)
161
+ throw new Error(`Invalid conditional test ${JSON.stringify({ exists: r, eq: o, neq: i })}`);
162
+ if (typeof o < "u")
163
+ return (0, De.isEqual)(t, o);
164
+ if (typeof i < "u")
165
+ return !(0, De.isEqual)(t, i);
166
+ if (typeof r < "u") {
167
+ let p = typeof t < "u";
168
+ return r ? p : !p;
169
+ }
170
+ return (typeof s > "u" ? !0 : s) ? !!t : !t;
171
+ }, "testValue"), It = /* @__PURE__ */ n((e, t, r) => {
127
172
  if (!e.if)
128
173
  return !0;
129
- let { arg: n, global: s } = e.if;
130
- if (R([n, s]) !== 1)
131
- throw new Error(`Invalid conditional value ${JSON.stringify({ arg: n, global: s })}`);
132
- let l = n ? r[n] : t[s];
133
- return N(e.if, l);
174
+ let { arg: o, global: i } = e.if;
175
+ if (Ft([o, i]) !== 1)
176
+ throw new Error(`Invalid conditional value ${JSON.stringify({ arg: o, global: i })}`);
177
+ let s = o ? t[o] : r[i];
178
+ return Mo(e.if, s);
134
179
  }, "includeConditionalArg");
135
180
 
136
181
  // src/csf/csf-factories.ts
137
- function U(e) {
182
+ var To = require("storybook/internal/csf");
183
+
184
+ // src/preview-api/modules/addons/main.ts
185
+ var he = require("@storybook/global");
186
+
187
+ // src/preview-api/modules/addons/storybook-channel-mock.ts
188
+ var Lt = require("storybook/internal/channels");
189
+ function _t() {
190
+ let e = {
191
+ setHandler: /* @__PURE__ */ n(() => {
192
+ }, "setHandler"),
193
+ send: /* @__PURE__ */ n(() => {
194
+ }, "send")
195
+ };
196
+ return new Lt.Channel({ transport: e });
197
+ }
198
+ n(_t, "mockChannel");
199
+
200
+ // src/preview-api/modules/addons/main.ts
201
+ var Ne = class {
202
+ constructor() {
203
+ this.getChannel = /* @__PURE__ */ n(() => {
204
+ if (!this.channel) {
205
+ let t = _t();
206
+ return this.setChannel(t), t;
207
+ }
208
+ return this.channel;
209
+ }, "getChannel");
210
+ this.ready = /* @__PURE__ */ n(() => this.promise, "ready");
211
+ this.hasChannel = /* @__PURE__ */ n(() => !!this.channel, "hasChannel");
212
+ this.setChannel = /* @__PURE__ */ n((t) => {
213
+ this.channel = t, this.resolve();
214
+ }, "setChannel");
215
+ this.promise = new Promise((t) => {
216
+ this.resolve = () => t(this.getChannel());
217
+ });
218
+ }
219
+ static {
220
+ n(this, "AddonStore");
221
+ }
222
+ }, He = "__STORYBOOK_ADDONS_PREVIEW";
223
+ function $o() {
224
+ return he.global[He] || (he.global[He] = new Ne()), he.global[He];
225
+ }
226
+ n($o, "getAddonsStore");
227
+ var je = $o();
228
+
229
+ // src/preview-api/modules/addons/hooks.ts
230
+ var Fo = require("storybook/internal/client-logger"), K = require("storybook/internal/core-events"), xe = require("@storybook/global");
231
+ var be = class {
232
+ constructor() {
233
+ this.hookListsMap = void 0;
234
+ this.mountedDecorators = void 0;
235
+ this.prevMountedDecorators = void 0;
236
+ this.currentHooks = void 0;
237
+ this.nextHookIndex = void 0;
238
+ this.currentPhase = void 0;
239
+ this.currentEffects = void 0;
240
+ this.prevEffects = void 0;
241
+ this.currentDecoratorName = void 0;
242
+ this.hasUpdates = void 0;
243
+ this.currentContext = void 0;
244
+ this.renderListener = /* @__PURE__ */ n((t) => {
245
+ t === this.currentContext?.id && (this.triggerEffects(), this.currentContext = null, this.removeRenderListeners());
246
+ }, "renderListener");
247
+ this.init();
248
+ }
249
+ static {
250
+ n(this, "HooksContext");
251
+ }
252
+ init() {
253
+ this.hookListsMap = /* @__PURE__ */ new WeakMap(), this.mountedDecorators = /* @__PURE__ */ new Set(), this.prevMountedDecorators = /* @__PURE__ */ new Set(),
254
+ this.currentHooks = [], this.nextHookIndex = 0, this.currentPhase = "NONE", this.currentEffects = [], this.prevEffects = [], this.currentDecoratorName =
255
+ null, this.hasUpdates = !1, this.currentContext = null;
256
+ }
257
+ clean() {
258
+ this.prevEffects.forEach((t) => {
259
+ t.destroy && t.destroy();
260
+ }), this.init(), this.removeRenderListeners();
261
+ }
262
+ getNextHook() {
263
+ let t = this.currentHooks[this.nextHookIndex];
264
+ return this.nextHookIndex += 1, t;
265
+ }
266
+ triggerEffects() {
267
+ this.prevEffects.forEach((t) => {
268
+ !this.currentEffects.includes(t) && t.destroy && t.destroy();
269
+ }), this.currentEffects.forEach((t) => {
270
+ this.prevEffects.includes(t) || (t.destroy = t.create());
271
+ }), this.prevEffects = this.currentEffects, this.currentEffects = [];
272
+ }
273
+ addRenderListeners() {
274
+ this.removeRenderListeners(), je.getChannel().on(K.STORY_RENDERED, this.renderListener);
275
+ }
276
+ removeRenderListeners() {
277
+ je.getChannel().removeListener(K.STORY_RENDERED, this.renderListener);
278
+ }
279
+ };
280
+ function Dt(e) {
281
+ let t = /* @__PURE__ */ n((...r) => {
282
+ let { hooks: o } = typeof r[0] == "function" ? r[1] : r[0], i = o.currentPhase, s = o.currentHooks, a = o.nextHookIndex, p = o.currentDecoratorName;
283
+ o.currentDecoratorName = e.name, o.prevMountedDecorators.has(e) ? (o.currentPhase = "UPDATE", o.currentHooks = o.hookListsMap.get(e) || []) :
284
+ (o.currentPhase = "MOUNT", o.currentHooks = [], o.hookListsMap.set(e, o.currentHooks), o.prevMountedDecorators.add(e)), o.nextHookIndex =
285
+ 0;
286
+ let c = xe.global.STORYBOOK_HOOKS_CONTEXT;
287
+ xe.global.STORYBOOK_HOOKS_CONTEXT = o;
288
+ let l = e(...r);
289
+ if (xe.global.STORYBOOK_HOOKS_CONTEXT = c, o.currentPhase === "UPDATE" && o.getNextHook() != null)
290
+ throw new Error(
291
+ "Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
292
+ );
293
+ return o.currentPhase = i, o.currentHooks = s, o.nextHookIndex = a, o.currentDecoratorName = p, l;
294
+ }, "hookified");
295
+ return t.originalFn = e, t;
296
+ }
297
+ n(Dt, "hookify");
298
+ var Be = 0, Io = 25, Ht = /* @__PURE__ */ n((e) => (t, r) => {
299
+ let o = e(
300
+ Dt(t),
301
+ r.map((i) => Dt(i))
302
+ );
303
+ return (i) => {
304
+ let { hooks: s } = i;
305
+ s.prevMountedDecorators ??= /* @__PURE__ */ new Set(), s.mountedDecorators = /* @__PURE__ */ new Set([t, ...r]), s.currentContext = i, s.
306
+ hasUpdates = !1;
307
+ let a = o(i);
308
+ for (Be = 1; s.hasUpdates; )
309
+ if (s.hasUpdates = !1, s.currentEffects = [], a = o(i), Be += 1, Be > Io)
310
+ throw new Error(
311
+ "Too many re-renders. Storybook limits the number of renders to prevent an infinite loop."
312
+ );
313
+ return s.addRenderListeners(), a;
314
+ };
315
+ }, "applyHooks");
316
+
317
+ // ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
318
+ function ne(e) {
319
+ if (!e || typeof e != "object")
320
+ return !1;
321
+ let t = Object.getPrototypeOf(e);
322
+ return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(e) === "[object Object]" :
323
+ !1;
324
+ }
325
+ n(ne, "isPlainObject");
326
+
327
+ // ../node_modules/es-toolkit/dist/object/mapValues.mjs
328
+ function G(e, t) {
329
+ let r = {}, o = Object.keys(e);
330
+ for (let i = 0; i < o.length; i++) {
331
+ let s = o[i], a = e[s];
332
+ r[s] = t(a, s, e);
333
+ }
334
+ return r;
335
+ }
336
+ n(G, "mapValues");
337
+
338
+ // ../node_modules/es-toolkit/dist/object/pickBy.mjs
339
+ function ze(e, t) {
340
+ let r = {}, o = Object.keys(e);
341
+ for (let i = 0; i < o.length; i++) {
342
+ let s = o[i], a = e[s];
343
+ t(a, s) && (r[s] = a);
344
+ }
345
+ return r;
346
+ }
347
+ n(ze, "pickBy");
348
+
349
+ // src/preview-api/modules/store/args.ts
350
+ var Lo = require("storybook/internal/client-logger");
351
+ var _o = J(Q(), 1);
352
+ var wi = Symbol("incompatible");
353
+ var Ei = Symbol("Deeply equal");
354
+ var Ue = "UNTARGETED";
355
+ function jt({
356
+ args: e,
357
+ argTypes: t
358
+ }) {
359
+ let r = {};
360
+ return Object.entries(e).forEach(([o, i]) => {
361
+ let { target: s = Ue } = t[o] || {};
362
+ r[s] = r[s] || {}, r[s][o] = i;
363
+ }), r;
364
+ }
365
+ n(jt, "groupArgsByTarget");
366
+
367
+ // src/preview-api/modules/store/csf/getValuesFromArgTypes.ts
368
+ var Bt = /* @__PURE__ */ n((e = {}) => Object.entries(e).reduce((t, [r, { defaultValue: o }]) => (typeof o < "u" && (t[r] = o), t), {}), "ge\
369
+ tValuesFromArgTypes");
370
+
371
+ // src/preview-api/modules/store/csf/normalizeInputTypes.ts
372
+ var Do = /* @__PURE__ */ n((e) => typeof e == "string" ? { name: e } : e, "normalizeType"), Ho = /* @__PURE__ */ n((e) => typeof e == "strin\
373
+ g" ? { type: e } : e, "normalizeControl"), No = /* @__PURE__ */ n((e, t) => {
374
+ let { type: r, control: o, ...i } = e, s = {
375
+ name: t,
376
+ ...i
377
+ };
378
+ return r && (s.type = Do(r)), o ? s.control = Ho(o) : o === !1 && (s.control = { disable: !0 }), s;
379
+ }, "normalizeInputType"), q = /* @__PURE__ */ n((e) => G(e, No), "normalizeInputTypes");
380
+
381
+ // src/preview-api/modules/store/csf/normalizeStory.ts
382
+ var Te = require("storybook/internal/client-logger"), Se = require("storybook/internal/csf"), zt = J(Q(), 1);
383
+
384
+ // src/preview-api/modules/store/csf/normalizeArrays.ts
385
+ var b = /* @__PURE__ */ n((e) => Array.isArray(e) ? e : e ? [e] : [], "normalizeArrays");
386
+
387
+ // src/preview-api/modules/store/csf/normalizeStory.ts
388
+ var jo = zt.dedent`
389
+ CSF .story annotations deprecated; annotate story functions directly:
390
+ - StoryFn.story.name => StoryFn.storyName
391
+ - StoryFn.story.(parameters|decorators) => StoryFn.(parameters|decorators)
392
+ See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations for details and codemod.
393
+ `;
394
+ function Ge(e, t, r) {
395
+ let o = t, i = typeof t == "function" ? t : null, { story: s } = o;
396
+ s && (Te.logger.debug("deprecated story", s), (0, Te.deprecate)(jo));
397
+ let a = (0, Se.storyNameFromExport)(e), p = typeof o != "function" && o.name || o.storyName || s?.name || a, c = [
398
+ ...b(o.decorators),
399
+ ...b(s?.decorators)
400
+ ], l = { ...s?.parameters, ...o.parameters }, y = { ...s?.args, ...o.args }, u = { ...s?.argTypes, ...o.argTypes }, h = [...b(o.loaders), ...b(
401
+ s?.loaders)], T = [
402
+ ...b(o.beforeEach),
403
+ ...b(s?.beforeEach)
404
+ ], R = [
405
+ ...b(o.afterEach),
406
+ ...b(s?.afterEach)
407
+ ], { render: P, play: L, tags: O = [], globals: F = {} } = o, A = l.__id || (0, Se.toId)(r.id, a);
408
+ return {
409
+ moduleExport: t,
410
+ id: A,
411
+ name: p,
412
+ tags: O,
413
+ decorators: c,
414
+ parameters: l,
415
+ args: y,
416
+ argTypes: q(u),
417
+ loaders: h,
418
+ beforeEach: T,
419
+ afterEach: R,
420
+ globals: F,
421
+ ...P && { render: P },
422
+ ...i && { userStoryFn: i },
423
+ ...L && { play: L }
424
+ };
425
+ }
426
+ n(Ge, "normalizeStory");
427
+
428
+ // src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
429
+ var Ut = require("storybook/internal/csf");
430
+ function Gt(e, t = e.title, r) {
431
+ let { id: o, argTypes: i } = e;
432
+ return {
433
+ id: (0, Ut.sanitize)(o || t),
434
+ ...e,
435
+ title: t,
436
+ ...i && { argTypes: q(i) },
437
+ parameters: {
438
+ fileName: r,
439
+ ...e.parameters
440
+ }
441
+ };
442
+ }
443
+ n(Gt, "normalizeComponentAnnotations");
444
+
445
+ // src/preview-api/modules/store/csf/prepareStory.ts
446
+ var Ae = require("storybook/internal/csf"), qt = require("storybook/internal/preview-errors"), Xt = require("@storybook/global"), Zt = require("@storybook/global");
447
+
448
+ // src/preview-api/modules/preview-web/render/mount-utils.ts
449
+ function Yt(e) {
450
+ return e != null && Bo(e).includes("mount");
451
+ }
452
+ n(Yt, "mountDestructured");
453
+ function Bo(e) {
454
+ let t = e.toString().match(/[^(]*\(([^)]*)/);
455
+ if (!t)
456
+ return [];
457
+ let r = Wt(t[1]);
458
+ if (!r.length)
459
+ return [];
460
+ let o = r[0];
461
+ return o.startsWith("{") && o.endsWith("}") ? Wt(o.slice(1, -1).replace(/\s/g, "")).map((s) => s.replace(/:.*|=.*/g, "")) : [];
462
+ }
463
+ n(Bo, "getUsedProps");
464
+ function Wt(e) {
465
+ let t = [], r = [], o = 0;
466
+ for (let s = 0; s < e.length; s++)
467
+ if (e[s] === "{" || e[s] === "[")
468
+ r.push(e[s] === "{" ? "}" : "]");
469
+ else if (e[s] === r[r.length - 1])
470
+ r.pop();
471
+ else if (!r.length && e[s] === ",") {
472
+ let a = e.substring(o, s).trim();
473
+ a && t.push(a), o = s + 1;
474
+ }
475
+ let i = e.substring(o).trim();
476
+ return i && t.push(i), t;
477
+ }
478
+ n(Wt, "splitByComma");
479
+
480
+ // src/preview-api/modules/store/decorators.ts
481
+ function Vt(e, t, r) {
482
+ let o = r(e);
483
+ return (i) => t(o, i);
484
+ }
485
+ n(Vt, "decorateStory");
486
+ function Kt({
487
+ componentId: e,
488
+ title: t,
489
+ kind: r,
490
+ id: o,
491
+ name: i,
492
+ story: s,
493
+ parameters: a,
494
+ initialArgs: p,
495
+ argTypes: c,
496
+ ...l
497
+ } = {}) {
498
+ return l;
499
+ }
500
+ n(Kt, "sanitizeStoryContextUpdate");
501
+ function We(e, t) {
502
+ let r = {}, o = /* @__PURE__ */ n((s) => (a) => {
503
+ if (!r.value)
504
+ throw new Error("Decorated function called without init");
505
+ return r.value = {
506
+ ...r.value,
507
+ ...Kt(a)
508
+ }, s(r.value);
509
+ }, "bindWithContext"), i = t.reduce(
510
+ (s, a) => Vt(s, a, o),
511
+ e
512
+ );
513
+ return (s) => (r.value = s, i(s));
514
+ }
515
+ n(We, "defaultDecorateStory");
516
+
517
+ // src/preview-api/modules/store/parameters.ts
518
+ var _ = /* @__PURE__ */ n((...e) => {
519
+ let t = {}, r = e.filter(Boolean), o = r.reduce((i, s) => (Object.entries(s).forEach(([a, p]) => {
520
+ let c = i[a];
521
+ Array.isArray(p) || typeof c > "u" ? i[a] = p : ne(p) && ne(c) ? t[a] = !0 : typeof p < "u" && (i[a] = p);
522
+ }), i), {});
523
+ return Object.keys(t).forEach((i) => {
524
+ let s = r.filter(Boolean).map((a) => a[i]).filter((a) => typeof a < "u");
525
+ s.every((a) => ne(a)) ? o[i] = _(...s) : o[i] = s[s.length - 1];
526
+ }), o;
527
+ }, "combineParameters");
528
+
529
+ // src/preview-api/modules/store/csf/prepareStory.ts
530
+ function Ye(e, t, r) {
531
+ let { moduleExport: o, id: i, name: s } = e || {}, a = zo(
532
+ e,
533
+ t,
534
+ r
535
+ ), p = /* @__PURE__ */ n(async (w) => {
536
+ let d = {};
537
+ for (let m of [
538
+ b(r.loaders),
539
+ b(t.loaders),
540
+ b(e.loaders)
541
+ ]) {
542
+ if (w.abortSignal.aborted)
543
+ return d;
544
+ let f = await Promise.all(m.map((x) => x(w)));
545
+ Object.assign(d, ...f);
546
+ }
547
+ return d;
548
+ }, "applyLoaders"), c = /* @__PURE__ */ n(async (w) => {
549
+ let d = new Array();
550
+ for (let m of [
551
+ ...b(r.beforeEach),
552
+ ...b(t.beforeEach),
553
+ ...b(e.beforeEach)
554
+ ]) {
555
+ if (w.abortSignal.aborted)
556
+ return d;
557
+ let f = await m(w);
558
+ f && d.push(f);
559
+ }
560
+ return d;
561
+ }, "applyBeforeEach"), l = /* @__PURE__ */ n(async (w) => {
562
+ let d = [
563
+ ...b(r.afterEach),
564
+ ...b(t.afterEach),
565
+ ...b(e.afterEach)
566
+ ].reverse();
567
+ for (let m of d) {
568
+ if (w.abortSignal.aborted)
569
+ return;
570
+ await m(w);
571
+ }
572
+ }, "applyAfterEach"), y = /* @__PURE__ */ n((w) => w.originalStoryFn(w.args, w), "undecoratedStoryFn"), { applyDecorators: u = We, runStep: h } = r,
573
+ T = [
574
+ ...b(e?.decorators),
575
+ ...b(t?.decorators),
576
+ ...b(r?.decorators)
577
+ ], R = e?.userStoryFn || e?.render || t.render || r.render, P = Ht(u)(y, T), L = /* @__PURE__ */ n((w) => P(w), "unboundStoryFn"), O = e?.
578
+ play ?? t?.play, F = Yt(O);
579
+ if (!R && !F)
580
+ throw new qt.NoRenderFunctionError({ id: i });
581
+ let A = /* @__PURE__ */ n((w) => async () => (await w.renderToCanvas(), w.canvas), "defaultMount"), S = e.mount ?? t.mount ?? r.mount ?? A,
582
+ v = r.testingLibraryRender;
583
+ return {
584
+ storyGlobals: {},
585
+ ...a,
586
+ moduleExport: o,
587
+ id: i,
588
+ name: s,
589
+ story: s,
590
+ originalStoryFn: R,
591
+ undecoratedStoryFn: y,
592
+ unboundStoryFn: L,
593
+ applyLoaders: p,
594
+ applyBeforeEach: c,
595
+ applyAfterEach: l,
596
+ playFunction: O,
597
+ runStep: h,
598
+ mount: S,
599
+ testingLibraryRender: v,
600
+ renderToCanvas: r.renderToCanvas,
601
+ usesMount: F
602
+ };
603
+ }
604
+ n(Ye, "prepareStory");
605
+ function zo(e, t, r) {
606
+ let o = ["dev", "test"], i = Zt.global.DOCS_OPTIONS?.autodocs === !0 ? ["autodocs"] : [], s = (0, Ae.combineTags)(
607
+ ...o,
608
+ ...i,
609
+ ...r.tags ?? [],
610
+ ...t.tags ?? [],
611
+ ...e?.tags ?? []
612
+ ), a = _(
613
+ r.parameters,
614
+ t.parameters,
615
+ e?.parameters
616
+ ), { argTypesEnhancers: p = [], argsEnhancers: c = [] } = r, l = _(
617
+ r.argTypes,
618
+ t.argTypes,
619
+ e?.argTypes
620
+ );
621
+ if (e) {
622
+ let O = e?.userStoryFn || e?.render || t.render || r.render;
623
+ a.__isArgsStory = O && O.length > 0;
624
+ }
625
+ let y = {
626
+ ...r.args,
627
+ ...t.args,
628
+ ...e?.args
629
+ }, u = {
630
+ ...t.globals,
631
+ ...e?.globals
632
+ }, h = {
633
+ componentId: t.id,
634
+ title: t.title,
635
+ kind: t.title,
636
+ // Back compat
637
+ id: e?.id || t.id,
638
+ // if there's no story name, we create a fake one since enhancers expect a name
639
+ name: e?.name || "__meta",
640
+ story: e?.name || "__meta",
641
+ // Back compat
642
+ component: t.component,
643
+ subcomponents: t.subcomponents,
644
+ tags: s,
645
+ parameters: a,
646
+ initialArgs: y,
647
+ argTypes: l,
648
+ storyGlobals: u
649
+ };
650
+ h.argTypes = p.reduce(
651
+ (O, F) => F({ ...h, argTypes: O }),
652
+ h.argTypes
653
+ );
654
+ let T = { ...y };
655
+ h.initialArgs = [...c].reduce(
656
+ (O, F) => ({
657
+ ...O,
658
+ ...F({
659
+ ...h,
660
+ initialArgs: O
661
+ })
662
+ }),
663
+ T
664
+ );
665
+ let { name: R, story: P, ...L } = h;
666
+ return L;
667
+ }
668
+ n(zo, "preparePartialAnnotations");
669
+ function Jt(e) {
670
+ let { args: t } = e, r = {
671
+ ...e,
672
+ allArgs: void 0,
673
+ argsByTarget: void 0
674
+ };
675
+ if (Xt.global.FEATURES?.argTypeTargetsV7) {
676
+ let s = jt(e);
677
+ r = {
678
+ ...e,
679
+ allArgs: e.args,
680
+ argsByTarget: s,
681
+ args: s[Ue] || {}
682
+ };
683
+ }
684
+ let o = Object.entries(r.args).reduce((s, [a, p]) => {
685
+ if (!r.argTypes[a]?.mapping)
686
+ return s[a] = p, s;
687
+ let c = /* @__PURE__ */ n((l) => {
688
+ let y = r.argTypes[a].mapping;
689
+ return y && l in y ? y[l] : l;
690
+ }, "mappingFn");
691
+ return s[a] = Array.isArray(p) ? p.map(c) : c(p), s;
692
+ }, {}), i = Object.entries(o).reduce((s, [a, p]) => {
693
+ let c = r.argTypes[a] || {};
694
+ return (0, Ae.includeConditionalArg)(c, o, r.globals) && (s[a] = p), s;
695
+ }, {});
696
+ return { ...r, unmappedArgs: t, args: i };
697
+ }
698
+ n(Jt, "prepareContext");
699
+
700
+ // src/preview-api/modules/store/inferArgTypes.ts
701
+ var Qt = require("storybook/internal/client-logger");
702
+ var er = J(Q(), 1);
703
+ var Ve = /* @__PURE__ */ n((e, t, r) => {
704
+ let o = typeof e;
705
+ switch (o) {
706
+ case "boolean":
707
+ case "string":
708
+ case "number":
709
+ case "function":
710
+ case "symbol":
711
+ return { name: o };
712
+ default:
713
+ break;
714
+ }
715
+ return e ? r.has(e) ? (Qt.logger.warn(er.dedent`
716
+ We've detected a cycle in arg '${t}'. Args should be JSON-serializable.
717
+
718
+ Consider using the mapping feature or fully custom args:
719
+ - Mapping: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
720
+ - Custom args: https://storybook.js.org/docs/essentials/controls#fully-custom-args
721
+ `), { name: "other", value: "cyclic object" }) : (r.add(e), Array.isArray(e) ? { name: "array", value: e.length > 0 ? Ve(e[0], t, new Set(
722
+ r)) : { name: "other", value: "unknown" } } : { name: "object", value: G(e, (s) => Ve(s, t, new Set(r))) }) : { name: "object", value: {} };
723
+ }, "inferType"), Ke = /* @__PURE__ */ n((e) => {
724
+ let { id: t, argTypes: r = {}, initialArgs: o = {} } = e, i = G(o, (a, p) => ({
725
+ name: p,
726
+ type: Ve(a, `${t}.${p}`, /* @__PURE__ */ new Set())
727
+ })), s = G(r, (a, p) => ({
728
+ name: p
729
+ }));
730
+ return _(i, s, r);
731
+ }, "inferArgTypes");
732
+ Ke.secondPass = !0;
733
+
734
+ // src/preview-api/modules/store/inferControls.ts
735
+ var rr = require("storybook/internal/client-logger");
736
+
737
+ // src/preview-api/modules/store/filterArgTypes.ts
738
+ var tr = /* @__PURE__ */ n((e, t) => Array.isArray(t) ? t.includes(e) : e.match(t), "matches"), qe = /* @__PURE__ */ n((e, t, r) => !t && !r ?
739
+ e : e && ze(e, (o, i) => {
740
+ let s = o.name || i.toString();
741
+ return !!(!t || tr(s, t)) && (!r || !tr(s, r));
742
+ }), "filterArgTypes");
743
+
744
+ // src/preview-api/modules/store/inferControls.ts
745
+ var Uo = /* @__PURE__ */ n((e, t, r) => {
746
+ let { type: o, options: i } = e;
747
+ if (o) {
748
+ if (r.color && r.color.test(t)) {
749
+ let s = o.name;
750
+ if (s === "string")
751
+ return { control: { type: "color" } };
752
+ s !== "enum" && rr.logger.warn(
753
+ `Addon controls: Control of type color only supports string, received "${s}" instead`
754
+ );
755
+ }
756
+ if (r.date && r.date.test(t))
757
+ return { control: { type: "date" } };
758
+ switch (o.name) {
759
+ case "array":
760
+ return { control: { type: "object" } };
761
+ case "boolean":
762
+ return { control: { type: "boolean" } };
763
+ case "string":
764
+ return { control: { type: "text" } };
765
+ case "number":
766
+ return { control: { type: "number" } };
767
+ case "enum": {
768
+ let { value: s } = o;
769
+ return { control: { type: s?.length <= 5 ? "radio" : "select" }, options: s };
770
+ }
771
+ case "function":
772
+ case "symbol":
773
+ return null;
774
+ default:
775
+ return { control: { type: i ? "select" : "object" } };
776
+ }
777
+ }
778
+ }, "inferControl"), Re = /* @__PURE__ */ n((e) => {
779
+ let {
780
+ argTypes: t,
781
+ parameters: { __isArgsStory: r, controls: { include: o = null, exclude: i = null, matchers: s = {} } = {} }
782
+ } = e;
783
+ if (!r)
784
+ return t;
785
+ let a = qe(t, o, i), p = G(a, (c, l) => c?.type && Uo(c, l.toString(), s));
786
+ return _(p, a);
787
+ }, "inferControls");
788
+ Re.secondPass = !0;
789
+
790
+ // src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts
791
+ function se({
792
+ argTypes: e,
793
+ globalTypes: t,
794
+ argTypesEnhancers: r,
795
+ decorators: o,
796
+ loaders: i,
797
+ beforeEach: s,
798
+ afterEach: a,
799
+ initialGlobals: p,
800
+ ...c
801
+ }) {
802
+ return {
803
+ ...e && { argTypes: q(e) },
804
+ ...t && { globalTypes: q(t) },
805
+ decorators: b(o),
806
+ loaders: b(i),
807
+ beforeEach: b(s),
808
+ afterEach: b(a),
809
+ argTypesEnhancers: [
810
+ ...r || [],
811
+ Ke,
812
+ // There's an architectural decision to be made regarding embedded addons in core:
813
+ //
814
+ // Option 1: Keep embedded addons but ensure consistency by moving addon-specific code
815
+ // (like inferControls) to live alongside the addon code itself. This maintains the
816
+ // concept of core addons while improving code organization.
817
+ //
818
+ // Option 2: Fully integrate these addons into core, potentially moving UI components
819
+ // into the manager and treating them as core features rather than addons. This is a
820
+ // bigger architectural change requiring careful consideration.
821
+ //
822
+ // For now, we're keeping inferControls here as we need time to properly evaluate
823
+ // these options and their implications. Some features (like Angular's cleanArgsDecorator)
824
+ // currently rely on this behavior.
825
+ //
826
+ // TODO: Make an architectural decision on the handling of core addons
827
+ Re
828
+ ],
829
+ initialGlobals: p,
830
+ ...c
831
+ };
832
+ }
833
+ n(se, "normalizeProjectAnnotations");
834
+
835
+ // src/preview-api/modules/store/csf/composeConfigs.ts
836
+ var nr = require("@storybook/global");
837
+
838
+ // src/preview-api/modules/store/csf/beforeAll.ts
839
+ var or = /* @__PURE__ */ n((e) => async () => {
840
+ let t = [];
841
+ for (let r of e) {
842
+ let o = await r();
843
+ o && t.unshift(o);
844
+ }
845
+ return async () => {
846
+ for (let r of t)
847
+ await r();
848
+ };
849
+ }, "composeBeforeAllHooks");
850
+
851
+ // src/preview-api/modules/store/csf/stepRunners.ts
852
+ function Xe(e) {
853
+ return async (t, r, o) => {
854
+ await e.reduceRight(
855
+ (s, a) => async () => a(t, s, o),
856
+ async () => r(o)
857
+ )();
858
+ };
859
+ }
860
+ n(Xe, "composeStepRunners");
861
+
862
+ // src/preview-api/modules/store/csf/composeConfigs.ts
863
+ function pe(e, t) {
864
+ return e.map((r) => r.default?.[t] ?? r[t]).filter(Boolean);
865
+ }
866
+ n(pe, "getField");
867
+ function Y(e, t, r = {}) {
868
+ return pe(e, t).reduce((o, i) => {
869
+ let s = b(i);
870
+ return r.reverseFileOrder ? [...s, ...o] : [...o, ...s];
871
+ }, []);
872
+ }
873
+ n(Y, "getArrayField");
874
+ function we(e, t) {
875
+ return Object.assign({}, ...pe(e, t));
876
+ }
877
+ n(we, "getObjectField");
878
+ function ae(e, t) {
879
+ return pe(e, t).pop();
880
+ }
881
+ n(ae, "getSingletonField");
882
+ function le(e) {
883
+ let t = Y(e, "argTypesEnhancers"), r = pe(e, "runStep"), o = Y(e, "beforeAll");
884
+ return {
885
+ parameters: _(...pe(e, "parameters")),
886
+ decorators: Y(e, "decorators", {
887
+ reverseFileOrder: !(nr.global.FEATURES?.legacyDecoratorFileOrder ?? !1)
888
+ }),
889
+ args: we(e, "args"),
890
+ argsEnhancers: Y(e, "argsEnhancers"),
891
+ argTypes: we(e, "argTypes"),
892
+ argTypesEnhancers: [
893
+ ...t.filter((i) => !i.secondPass),
894
+ ...t.filter((i) => i.secondPass)
895
+ ],
896
+ initialGlobals: we(e, "initialGlobals"),
897
+ globalTypes: we(e, "globalTypes"),
898
+ loaders: Y(e, "loaders"),
899
+ beforeAll: or(o),
900
+ beforeEach: Y(e, "beforeEach"),
901
+ afterEach: Y(e, "afterEach"),
902
+ render: ae(e, "render"),
903
+ renderToCanvas: ae(e, "renderToCanvas"),
904
+ applyDecorators: ae(e, "applyDecorators"),
905
+ runStep: Xe(r),
906
+ tags: Y(e, "tags"),
907
+ mount: ae(e, "mount"),
908
+ testingLibraryRender: ae(e, "testingLibraryRender")
909
+ };
910
+ }
911
+ n(le, "composeConfigs");
912
+
913
+ // src/preview-api/modules/store/csf/portable-stories.ts
914
+ var Wo = require("storybook/internal/csf"), Yo = require("storybook/internal/csf"), lr = require("storybook/internal/preview-errors"), Vo = J(Q(), 1);
915
+
916
+ // src/preview-api/modules/preview-web/render/animation-utils.ts
917
+ function ir() {
918
+ try {
919
+ return (
920
+ // @ts-expect-error this property exists in certain environments
921
+ !!globalThis.__vitest_browser__ || // @ts-expect-error this property exists in certain environments
922
+ !!globalThis.__playwright__binding__
923
+ );
924
+ } catch {
925
+ return !1;
926
+ }
927
+ }
928
+ n(ir, "isTestEnvironment");
929
+ function sr(e = !0) {
930
+ if (!("document" in globalThis && "createElement" in globalThis.document))
931
+ return () => {
932
+ };
933
+ let t = document.createElement("style");
934
+ t.textContent = `*, *:before, *:after {
935
+ animation: none !important;
936
+ }`, document.head.appendChild(t);
937
+ let r = document.createElement("style");
938
+ return r.textContent = `*, *:before, *:after {
939
+ animation-delay: 0s !important;
940
+ animation-direction: ${e ? "reverse" : "normal"} !important;
941
+ animation-play-state: paused !important;
942
+ transition: none !important;
943
+ }`, document.head.appendChild(r), document.body.clientHeight, document.head.removeChild(t), () => {
944
+ r.parentNode?.removeChild(r);
945
+ };
946
+ }
947
+ n(sr, "pauseAnimations");
948
+ async function ar(e) {
949
+ if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document))
950
+ return;
951
+ let t = !1;
952
+ await Promise.race([
953
+ // After 50ms, retrieve any running animations and wait for them to finish
954
+ // If new animations are created while waiting, we'll wait for them too
955
+ new Promise((r) => {
956
+ setTimeout(() => {
957
+ let o = [globalThis.document, ...pr(globalThis.document)], i = /* @__PURE__ */ n(async () => {
958
+ if (t || e?.aborted)
959
+ return;
960
+ let s = o.flatMap((a) => a?.getAnimations?.() || []).filter((a) => a.playState === "running" && !Go(a));
961
+ s.length > 0 && (await Promise.all(s.map((a) => a.finished)), await i());
962
+ }, "checkAnimationsFinished");
963
+ i().then(r);
964
+ }, 100);
965
+ }),
966
+ // If animations don't finish within the timeout, continue without waiting
967
+ new Promise(
968
+ (r) => setTimeout(() => {
969
+ t = !0, r(void 0);
970
+ }, 5e3)
971
+ )
972
+ ]);
973
+ }
974
+ n(ar, "waitForAnimations");
975
+ function pr(e) {
976
+ return [e, ...e.querySelectorAll("*")].reduce((t, r) => ("shadowRoot" in r && r.shadowRoot && t.push(r.shadowRoot, ...pr(r.shadowRoot)), t),
977
+ []);
978
+ }
979
+ n(pr, "getShadowRoots");
980
+ function Go(e) {
981
+ if (e instanceof CSSAnimation && e.effect instanceof KeyframeEffect && e.effect.target) {
982
+ let t = getComputedStyle(e.effect.target, e.effect.pseudoElement), r = t.animationName?.split(", ").indexOf(e.animationName);
983
+ return t.animationIterationCount.split(", ")[r] === "infinite";
984
+ }
985
+ return !1;
986
+ }
987
+ n(Go, "isInfiniteAnimation");
988
+
989
+ // src/preview-api/modules/store/reporter-api.ts
990
+ var Ee = class {
991
+ constructor() {
992
+ this.reports = [];
993
+ }
994
+ static {
995
+ n(this, "ReporterAPI");
996
+ }
997
+ async addReport(t) {
998
+ this.reports.push(t);
999
+ }
1000
+ };
1001
+
1002
+ // src/preview-api/modules/store/csf/portable-stories.ts
1003
+ var Ko = "ComposedStory", qo = "Unnamed Story";
1004
+ var V = [];
1005
+ function Ze(e, t, r, o, i) {
1006
+ if (e === void 0)
1007
+ throw new Error("Expected a story but received undefined.");
1008
+ t.title = t.title ?? Ko;
1009
+ let s = Gt(t), a = i || e.storyName || e.story?.name || e.name || qo, p = Ge(
1010
+ a,
1011
+ e,
1012
+ s
1013
+ ), c = se(
1014
+ le([
1015
+ o ?? globalThis.globalProjectAnnotations ?? {},
1016
+ r ?? {}
1017
+ ])
1018
+ ), l = Ye(
1019
+ p,
1020
+ s,
1021
+ c
1022
+ ), u = {
1023
+ ...Bt(c.globalTypes),
1024
+ ...c.initialGlobals,
1025
+ ...l.storyGlobals
1026
+ }, h = new Ee(), T = /* @__PURE__ */ n(() => {
1027
+ let A = Jt({
1028
+ hooks: new be(),
1029
+ globals: u,
1030
+ args: { ...l.initialArgs },
1031
+ viewMode: "story",
1032
+ reporting: h,
1033
+ loaded: {},
1034
+ abortSignal: new AbortController().signal,
1035
+ step: /* @__PURE__ */ n((S, v) => l.runStep(S, v, A), "step"),
1036
+ canvasElement: null,
1037
+ canvas: {},
1038
+ userEvent: {},
1039
+ globalTypes: c.globalTypes,
1040
+ ...l,
1041
+ context: null,
1042
+ mount: null
1043
+ });
1044
+ return A.parameters.__isPortableStory = !0, A.context = A, l.renderToCanvas && (A.renderToCanvas = async () => {
1045
+ let S = await l.renderToCanvas?.(
1046
+ {
1047
+ componentId: l.componentId,
1048
+ title: l.title,
1049
+ id: l.id,
1050
+ name: l.name,
1051
+ tags: l.tags,
1052
+ showMain: /* @__PURE__ */ n(() => {
1053
+ }, "showMain"),
1054
+ showError: /* @__PURE__ */ n((v) => {
1055
+ throw new Error(`${v.title}
1056
+ ${v.description}`);
1057
+ }, "showError"),
1058
+ showException: /* @__PURE__ */ n((v) => {
1059
+ throw v;
1060
+ }, "showException"),
1061
+ forceRemount: !0,
1062
+ storyContext: A,
1063
+ storyFn: /* @__PURE__ */ n(() => l.unboundStoryFn(A), "storyFn"),
1064
+ unboundStoryFn: l.unboundStoryFn
1065
+ },
1066
+ A.canvasElement
1067
+ );
1068
+ S && V.push(S);
1069
+ }), A.mount = l.mount(A), A;
1070
+ }, "initializeContext"), R, P = /* @__PURE__ */ n(async (A) => {
1071
+ let S = T();
1072
+ return S.canvasElement ??= globalThis?.document?.body, R && (S.loaded = R.loaded), Object.assign(S, A), l.playFunction(S);
1073
+ }, "play"), L = /* @__PURE__ */ n((A) => {
1074
+ let S = T();
1075
+ return Object.assign(S, A), Xo(l, S);
1076
+ }, "run"), O = l.playFunction ? P : void 0;
1077
+ return Object.assign(
1078
+ /* @__PURE__ */ n(function(S) {
1079
+ let v = T();
1080
+ return R && (v.loaded = R.loaded), v.args = {
1081
+ ...v.initialArgs,
1082
+ ...S
1083
+ }, l.unboundStoryFn(v);
1084
+ }, "storyFn"),
1085
+ {
1086
+ id: l.id,
1087
+ storyName: a,
1088
+ load: /* @__PURE__ */ n(async () => {
1089
+ for (let S of [...V].reverse())
1090
+ await S();
1091
+ V.length = 0;
1092
+ let A = T();
1093
+ A.loaded = await l.applyLoaders(A), V.push(...(await l.applyBeforeEach(A)).filter(Boolean)), R = A;
1094
+ }, "load"),
1095
+ globals: u,
1096
+ args: l.initialArgs,
1097
+ parameters: l.parameters,
1098
+ argTypes: l.argTypes,
1099
+ play: O,
1100
+ run: L,
1101
+ reporting: h,
1102
+ tags: l.tags
1103
+ }
1104
+ );
1105
+ }
1106
+ n(Ze, "composeStory");
1107
+ async function Xo(e, t) {
1108
+ for (let s of [...V].reverse())
1109
+ await s();
1110
+ if (V.length = 0, !t.canvasElement) {
1111
+ let s = document.createElement("div");
1112
+ globalThis?.document?.body?.appendChild(s), t.canvasElement = s, V.push(() => {
1113
+ globalThis?.document?.body?.contains(s) && globalThis?.document?.body?.removeChild(s);
1114
+ });
1115
+ }
1116
+ if (t.loaded = await e.applyLoaders(t), t.abortSignal.aborted)
1117
+ return;
1118
+ V.push(...(await e.applyBeforeEach(t)).filter(Boolean));
1119
+ let r = e.playFunction, o = e.usesMount;
1120
+ if (o || await t.mount(), t.abortSignal.aborted)
1121
+ return;
1122
+ r && (o || (t.mount = async () => {
1123
+ throw new lr.MountMustBeDestructuredError({ playFunction: r.toString() });
1124
+ }), await r(t));
1125
+ let i;
1126
+ ir() ? i = sr() : await ar(t.abortSignal), await e.applyAfterEach(t), await i?.();
1127
+ }
1128
+ n(Xo, "runStory");
1129
+
1130
+ // ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1131
+ var Zo = process.env.NODE_ENV === "production", Je = "Invariant failed";
1132
+ function Ce(e, t) {
1133
+ if (!e) {
1134
+ if (Zo)
1135
+ throw new Error(Je);
1136
+ var r = typeof t == "function" ? t() : t, o = r ? "".concat(Je, ": ").concat(r) : Je;
1137
+ throw new Error(o);
1138
+ }
1139
+ }
1140
+ n(Ce, "invariant");
1141
+
1142
+ // src/actions/preview.ts
1143
+ var Tr = require("storybook/internal/csf");
1144
+
1145
+ // src/actions/addArgs.ts
1146
+ var tt = {};
1147
+ Le(tt, {
1148
+ argsEnhancers: () => en
1149
+ });
1150
+
1151
+ // src/actions/runtime/action.ts
1152
+ var mr = require("storybook/internal/preview-errors"), et = require("@storybook/global"), ur = require("storybook/preview-api");
1153
+
1154
+ // src/actions/constants.ts
1155
+ var Qe = "storybook/actions", ua = `${Qe}/panel`, cr = `${Qe}/action-event`, fa = `${Qe}/action-clear`;
1156
+
1157
+ // src/actions/runtime/configureActions.ts
1158
+ var dr = {
1159
+ depth: 10,
1160
+ clearOnStoryChange: !0,
1161
+ limit: 50
1162
+ };
1163
+
1164
+ // src/actions/runtime/action.ts
1165
+ var fr = /* @__PURE__ */ n((e, t) => {
1166
+ let r = Object.getPrototypeOf(e);
1167
+ return !r || t(r) ? r : fr(r, t);
1168
+ }, "findProto"), Jo = /* @__PURE__ */ n((e) => !!(typeof e == "object" && e && fr(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) &&
1169
+ typeof e.persist == "function"), "isReactSyntheticEvent"), Qo = /* @__PURE__ */ n((e) => {
1170
+ if (Jo(e)) {
1171
+ let t = Object.create(
1172
+ e.constructor.prototype,
1173
+ Object.getOwnPropertyDescriptors(e)
1174
+ );
1175
+ t.persist();
1176
+ let r = Object.getOwnPropertyDescriptor(t, "view"), o = r?.value;
1177
+ return typeof o == "object" && o?.constructor.name === "Window" && Object.defineProperty(t, "view", {
1178
+ ...r,
1179
+ value: Object.create(o.constructor.prototype)
1180
+ }), t;
1181
+ }
1182
+ return e;
1183
+ }, "serializeArg");
1184
+ function ce(e, t = {}) {
1185
+ let r = {
1186
+ ...dr,
1187
+ ...t
1188
+ }, o = /* @__PURE__ */ n(function(...s) {
1189
+ if (t.implicit) {
1190
+ let T = ("__STORYBOOK_PREVIEW__" in et.global ? et.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
1191
+ (R) => R.phase === "playing" || R.phase === "rendering"
1192
+ );
1193
+ if (T) {
1194
+ let R = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, P = new mr.ImplicitActionsDuringRendering({
1195
+ phase: T.phase,
1196
+ name: e,
1197
+ deprecated: R
1198
+ });
1199
+ if (R)
1200
+ console.warn(P);
1201
+ else
1202
+ throw P;
1203
+ }
1204
+ }
1205
+ let a = ur.addons.getChannel(), p = Date.now().toString(36) + Math.random().toString(36).substring(2), c = 5, l = s.map(Qo), y = s.length >
1206
+ 1 ? l : l[0], u = {
1207
+ id: p,
1208
+ count: 0,
1209
+ data: { name: e, args: y },
1210
+ options: {
1211
+ ...r,
1212
+ maxDepth: c + (r.depth || 3)
1213
+ }
1214
+ };
1215
+ a.emit(cr, u);
1216
+ }, "actionHandler");
1217
+ return o.isAction = !0, o.implicit = t.implicit, o;
1218
+ }
1219
+ n(ce, "action");
1220
+
1221
+ // src/actions/addArgsHelpers.ts
1222
+ var yr = /* @__PURE__ */ n((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), gr = /* @__PURE__ */ n((e) => {
1223
+ let {
1224
+ initialArgs: t,
1225
+ argTypes: r,
1226
+ id: o,
1227
+ parameters: { actions: i }
1228
+ } = e;
1229
+ if (!i || i.disable || !i.argTypesRegex || !r)
1230
+ return {};
1231
+ let s = new RegExp(i.argTypesRegex);
1232
+ return Object.entries(r).filter(
1233
+ ([p]) => !!s.test(p)
1234
+ ).reduce((p, [c, l]) => (yr(c, t) && (p[c] = ce(c, { implicit: !0, id: o })), p), {});
1235
+ }, "inferActionsFromArgTypesRegex"), hr = /* @__PURE__ */ n((e) => {
1236
+ let {
1237
+ initialArgs: t,
1238
+ argTypes: r,
1239
+ parameters: { actions: o }
1240
+ } = e;
1241
+ return o?.disable || !r ? {} : Object.entries(r).filter(([s, a]) => !!a.action).reduce((s, [a, p]) => (yr(a, t) && (s[a] = ce(typeof p.action ==
1242
+ "string" ? p.action : a)), s), {});
1243
+ }, "addActionsFromArgTypes");
1244
+
1245
+ // src/actions/addArgs.ts
1246
+ var en = [
1247
+ hr,
1248
+ gr
1249
+ ];
1250
+
1251
+ // src/actions/loaders.ts
1252
+ var rt = {};
1253
+ Le(rt, {
1254
+ loaders: () => rn
1255
+ });
1256
+ var br = require("storybook/test");
1257
+ var xr = !1, tn = /* @__PURE__ */ n((e) => {
1258
+ let { parameters: t } = e;
1259
+ t?.actions?.disable || xr || ((0, br.onMockCall)((r, o) => {
1260
+ let i = r.getMockName();
1261
+ i !== "spy" && (!/^next\/.*::/.test(i) || [
1262
+ "next/router::useRouter()",
1263
+ "next/navigation::useRouter()",
1264
+ "next/navigation::redirect",
1265
+ "next/cache::",
1266
+ "next/headers::cookies().set",
1267
+ "next/headers::cookies().delete",
1268
+ "next/headers::headers().set",
1269
+ "next/headers::headers().delete"
1270
+ ].some((s) => i.startsWith(s))) && ce(i)(o);
1271
+ }), xr = !0);
1272
+ }, "logActionsWhenMockCalled"), rn = [tn];
1273
+
1274
+ // src/actions/preview.ts
1275
+ var ot = /* @__PURE__ */ n(() => (0, Tr.definePreviewAddon)({
1276
+ ...tt,
1277
+ ...rt
1278
+ }), "default");
1279
+
1280
+ // src/backgrounds/preview.ts
1281
+ var kr = require("storybook/internal/csf");
1282
+
1283
+ // src/backgrounds/constants.ts
1284
+ var on = "storybook/background", ee = "backgrounds";
1285
+ var Oa = {
1286
+ UPDATE: `${on}/update`
1287
+ };
1288
+
1289
+ // src/backgrounds/decorator.ts
1290
+ var it = require("storybook/preview-api");
1291
+
1292
+ // src/backgrounds/defaults.ts
1293
+ var Sr = {
1294
+ light: { name: "light", value: "#F8F8F8" },
1295
+ dark: { name: "dark", value: "#333" }
1296
+ };
1297
+
1298
+ // src/backgrounds/utils.ts
1299
+ var { document: B } = globalThis, Ar = /* @__PURE__ */ n(() => globalThis?.matchMedia ? !!globalThis.matchMedia("(prefers-reduced-motion: re\
1300
+ duce)")?.matches : !1, "isReduceMotionEnabled"), nt = /* @__PURE__ */ n((e) => {
1301
+ (Array.isArray(e) ? e : [e]).forEach(nn);
1302
+ }, "clearStyles"), nn = /* @__PURE__ */ n((e) => {
1303
+ if (!B)
1304
+ return;
1305
+ let t = B.getElementById(e);
1306
+ t && t.parentElement && t.parentElement.removeChild(t);
1307
+ }, "clearStyle"), Rr = /* @__PURE__ */ n((e, t) => {
1308
+ if (!B)
1309
+ return;
1310
+ let r = B.getElementById(e);
1311
+ if (r)
1312
+ r.innerHTML !== t && (r.innerHTML = t);
1313
+ else {
1314
+ let o = B.createElement("style");
1315
+ o.setAttribute("id", e), o.innerHTML = t, B.head.appendChild(o);
1316
+ }
1317
+ }, "addGridStyle"), wr = /* @__PURE__ */ n((e, t, r) => {
1318
+ if (!B)
1319
+ return;
1320
+ let o = B.getElementById(e);
1321
+ if (o)
1322
+ o.innerHTML !== t && (o.innerHTML = t);
1323
+ else {
1324
+ let i = B.createElement("style");
1325
+ i.setAttribute("id", e), i.innerHTML = t;
1326
+ let s = `addon-backgrounds-grid${r ? `-docs-${r}` : ""}`, a = B.getElementById(s);
1327
+ a ? a.parentElement?.insertBefore(i, a) : B.head.appendChild(i);
1328
+ }
1329
+ }, "addBackgroundStyle");
1330
+
1331
+ // src/backgrounds/decorator.ts
1332
+ var sn = {
1333
+ cellSize: 100,
1334
+ cellAmount: 10,
1335
+ opacity: 0.8
1336
+ }, Er = "addon-backgrounds", Cr = "addon-backgrounds-grid", an = Ar() ? "" : "transition: background-color 0.3s;", vr = /* @__PURE__ */ n((e, t) => {
1337
+ let { globals: r = {}, parameters: o = {}, viewMode: i, id: s } = t, {
1338
+ options: a = Sr,
1339
+ disable: p,
1340
+ grid: c = sn
1341
+ } = o[ee] || {}, l = r[ee] || {}, y = typeof l == "string" ? l : l?.value, u = y ? a[y] : void 0, h = typeof u == "string" ? u : u?.value ||
1342
+ "transparent", T = typeof l == "string" ? !1 : l.grid || !1, R = !!u && !p, P = i === "docs" ? `#anchor--${s} .docs-story` : ".sb-show-mai\
1343
+ n", L = i === "docs" ? `#anchor--${s} .docs-story` : ".sb-show-main", O = o.layout === void 0 || o.layout === "padded", F = i === "docs" ? 20 :
1344
+ O ? 16 : 0, { cellAmount: A, cellSize: S, opacity: v, offsetX: w = F, offsetY: d = F } = c, m = i === "docs" ? `${Er}-docs-${s}` : `${Er}-\
1345
+ color`, f = i === "docs" ? s : null;
1346
+ (0, it.useEffect)(() => {
1347
+ let g = `
1348
+ ${P} {
1349
+ background: ${h} !important;
1350
+ ${an}
1351
+ }`;
1352
+ if (!R) {
1353
+ nt(m);
1354
+ return;
1355
+ }
1356
+ wr(m, g, f);
1357
+ }, [P, m, f, R, h]);
1358
+ let x = i === "docs" ? `${Cr}-docs-${s}` : `${Cr}`;
1359
+ return (0, it.useEffect)(() => {
1360
+ if (!T) {
1361
+ nt(x);
1362
+ return;
1363
+ }
1364
+ let g = [
1365
+ `${S * A}px ${S * A}px`,
1366
+ `${S * A}px ${S * A}px`,
1367
+ `${S}px ${S}px`,
1368
+ `${S}px ${S}px`
1369
+ ].join(", "), E = `
1370
+ ${L} {
1371
+ background-size: ${g} !important;
1372
+ background-position: ${w}px ${d}px, ${w}px ${d}px, ${w}px ${d}px, ${w}px ${d}px !important;
1373
+ background-blend-mode: difference !important;
1374
+ background-image: linear-gradient(rgba(130, 130, 130, ${v}) 1px, transparent 1px),
1375
+ linear-gradient(90deg, rgba(130, 130, 130, ${v}) 1px, transparent 1px),
1376
+ linear-gradient(rgba(130, 130, 130, ${v / 2}) 1px, transparent 1px),
1377
+ linear-gradient(90deg, rgba(130, 130, 130, ${v / 2}) 1px, transparent 1px) !important;
1378
+ }
1379
+ `;
1380
+ Rr(x, E);
1381
+ }, [A, S, L, x, T, w, d, v]), e();
1382
+ }, "withBackgroundAndGrid");
1383
+
1384
+ // src/backgrounds/preview.ts
1385
+ var pn = globalThis.FEATURES?.backgrounds ? [vr] : [], ln = {
1386
+ [ee]: {
1387
+ grid: {
1388
+ cellSize: 20,
1389
+ opacity: 0.5,
1390
+ cellAmount: 5
1391
+ },
1392
+ disable: !1
1393
+ }
1394
+ }, cn = {
1395
+ [ee]: { value: void 0, grid: !1 }
1396
+ }, st = /* @__PURE__ */ n(() => (0, kr.definePreviewAddon)({
1397
+ decorators: pn,
1398
+ parameters: ln,
1399
+ initialGlobals: cn
1400
+ }), "default");
1401
+
1402
+ // src/component-testing/preview.ts
1403
+ var Pr = require("storybook/internal/csf"), Or = require("storybook/internal/instrumenter");
1404
+ var { step: dn } = (0, Or.instrument)(
1405
+ {
1406
+ // It seems like the label is unused, but the instrumenter has access to it
1407
+ // The context will be bounded later in StoryRender, so that the user can write just:
1408
+ // await step("label", (context) => {
1409
+ // // labeled step
1410
+ // });
1411
+ step: /* @__PURE__ */ n(async (e, t, r) => t(r), "step")
1412
+ },
1413
+ { intercept: !0 }
1414
+ ), at = /* @__PURE__ */ n(() => (0, Pr.definePreviewAddon)({
1415
+ parameters: {
1416
+ throwPlayFunctionExceptions: !1
1417
+ },
1418
+ runStep: dn
1419
+ }), "default");
1420
+
1421
+ // src/highlight/preview.ts
1422
+ var Ur = require("storybook/internal/csf"), ft = require("storybook/preview-api");
1423
+
1424
+ // src/highlight/useHighlights.ts
1425
+ var Br = require("storybook/internal/core-events");
1426
+
1427
+ // src/highlight/constants.ts
1428
+ var ve = "storybook/highlight", Mr = `${ve}/add`, $r = `${ve}/remove`, Fr = `${ve}/reset`, Ir = `${ve}/scroll-into-view`, pt = 2147483647, z = 28;
1429
+
1430
+ // src/highlight/icons.ts
1431
+ var lt = {
1432
+ chevronLeft: [
1433
+ "M9.10355 10.1464C9.29882 10.3417 9.29882 10.6583 9.10355 10.8536C8.90829 11.0488 8.59171 11.0488 8.39645 10.8536L4.89645 7.35355C4.7011\
1434
+ 8 7.15829 4.70118 6.84171 4.89645 6.64645L8.39645 3.14645C8.59171 2.95118 8.90829 2.95118 9.10355 3.14645C9.29882 3.34171 9.29882 3.65829 9.\
1435
+ 10355 3.85355L5.95711 7L9.10355 10.1464Z"
1436
+ ],
1437
+ chevronRight: [
1438
+ "M4.89645 10.1464C4.70118 10.3417 4.70118 10.6583 4.89645 10.8536C5.09171 11.0488 5.40829 11.0488 5.60355 10.8536L9.10355 7.35355C9.2988\
1439
+ 2 7.15829 9.29882 6.84171 9.10355 6.64645L5.60355 3.14645C5.40829 2.95118 5.09171 2.95118 4.89645 3.14645C4.70118 3.34171 4.70118 3.65829 4.\
1440
+ 89645 3.85355L8.04289 7L4.89645 10.1464Z"
1441
+ ],
1442
+ info: [
1443
+ "M7 5.5a.5.5 0 01.5.5v4a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zM7 4.5A.75.75 0 107 3a.75.75 0 000 1.5z",
1444
+ "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z"
1445
+ ],
1446
+ shareAlt: [
1447
+ "M2 1.004a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1v-4.5a.5.5 0 00-1 0v4.5H2v-10h4.5a.5.5 0 000-1H2z",
1448
+ "M7.354 7.357L12 2.711v1.793a.5.5 0 001 0v-3a.5.5 0 00-.5-.5h-3a.5.5 0 100 1h1.793L6.646 6.65a.5.5 0 10.708.707z"
1449
+ ]
1450
+ };
1451
+
1452
+ // src/highlight/utils.ts
1453
+ var mn = "svg,path,rect,circle,line,polyline,polygon,ellipse,text".split(","), M = /* @__PURE__ */ n((e, t = {}, r) => {
1454
+ let o = mn.includes(e) ? document.createElementNS("http://www.w3.org/2000/svg", e) : document.createElement(e);
1455
+ return Object.entries(t).forEach(([i, s]) => {
1456
+ /[A-Z]/.test(i) ? (i === "onClick" && (o.addEventListener("click", s), o.addEventListener("keydown", (a) => {
1457
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), s());
1458
+ })), i === "onMouseEnter" && o.addEventListener("mouseenter", s), i === "onMouseLeave" && o.addEventListener("mouseleave", s)) : o.setAttribute(
1459
+ i, s);
1460
+ }), r?.forEach((i) => {
1461
+ if (!(i == null || i === !1))
1462
+ try {
1463
+ o.appendChild(i);
1464
+ } catch {
1465
+ o.appendChild(document.createTextNode(String(i)));
1466
+ }
1467
+ }), o;
1468
+ }, "createElement"), me = /* @__PURE__ */ n((e) => lt[e] && M(
1469
+ "svg",
1470
+ { width: "14", height: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg" },
1471
+ lt[e].map(
1472
+ (t) => M("path", {
1473
+ fill: "currentColor",
1474
+ "fill-rule": "evenodd",
1475
+ "clip-rule": "evenodd",
1476
+ d: t
1477
+ })
1478
+ )
1479
+ ), "createIcon"), Lr = /* @__PURE__ */ n((e) => {
1480
+ if ("elements" in e) {
1481
+ let { elements: o, color: i, style: s } = e;
1482
+ return {
1483
+ id: void 0,
1484
+ priority: 0,
1485
+ selectors: o,
1486
+ styles: {
1487
+ outline: `2px ${s} ${i}`,
1488
+ outlineOffset: "2px",
1489
+ boxShadow: "0 0 0 6px rgba(255,255,255,0.6)"
1490
+ },
1491
+ menu: void 0
1492
+ };
1493
+ }
1494
+ let { menu: t, ...r } = e;
1495
+ return {
1496
+ id: void 0,
1497
+ priority: 0,
1498
+ styles: {
1499
+ outline: "2px dashed #029cfd"
1500
+ },
1501
+ ...r,
1502
+ menu: Array.isArray(t) ? t.every(Array.isArray) ? t : [t] : void 0
1503
+ };
1504
+ }, "normalizeOptions"), un = /* @__PURE__ */ n((e) => e instanceof Function, "isFunction"), de = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map(),
1505
+ ke = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ n((e) => {
1506
+ let t = Symbol();
1507
+ return X.set(t, []), de.set(t, e), { get: /* @__PURE__ */ n(() => de.get(t), "get"), set: /* @__PURE__ */ n((a) => {
1508
+ let p = de.get(t), c = un(a) ? a(p) : a;
1509
+ c !== p && (de.set(t, c), X.get(t)?.forEach((l) => {
1510
+ ke.get(l)?.(), ke.set(l, l(c));
1511
+ }));
1512
+ }, "set"), subscribe: /* @__PURE__ */ n((a) => (X.get(t)?.push(a), () => {
1513
+ let p = X.get(t);
1514
+ p && X.set(
1515
+ t,
1516
+ p.filter((c) => c !== a)
1517
+ );
1518
+ }), "subscribe"), teardown: /* @__PURE__ */ n(() => {
1519
+ X.get(t)?.forEach((a) => {
1520
+ ke.get(a)?.(), ke.delete(a);
1521
+ }), X.delete(t), de.delete(t);
1522
+ }, "teardown") };
1523
+ }, "useStore"), ct = /* @__PURE__ */ n((e) => {
1524
+ let t = document.getElementById("storybook-root"), r = /* @__PURE__ */ new Map();
1525
+ for (let o of e) {
1526
+ let { priority: i = 0 } = o;
1527
+ for (let s of o.selectors) {
1528
+ let a = [
1529
+ ...document.querySelectorAll(
1530
+ // Elements matching the selector, excluding storybook elements and their descendants.
1531
+ // Necessary to find portaled elements (e.g. children of `body`).
1532
+ `:is(${s}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`
1533
+ ),
1534
+ // Elements matching the selector inside the storybook root, as these were excluded above.
1535
+ ...t?.querySelectorAll(s) || []
1536
+ ];
1537
+ for (let p of a) {
1538
+ let c = r.get(p);
1539
+ (!c || c.priority <= i) && r.set(p, {
1540
+ ...o,
1541
+ priority: i,
1542
+ selectors: Array.from(new Set((c?.selectors || []).concat(s)))
1543
+ });
1544
+ }
1545
+ }
1546
+ }
1547
+ return r;
1548
+ }, "mapElements"), _r = /* @__PURE__ */ n((e) => Array.from(e.entries()).map(([t, { selectors: r, styles: o, hoverStyles: i, focusStyles: s,
1549
+ menu: a }]) => {
1550
+ let { top: p, left: c, width: l, height: y } = t.getBoundingClientRect(), { position: u } = getComputedStyle(t);
1551
+ return {
1552
+ element: t,
1553
+ selectors: r,
1554
+ styles: o,
1555
+ hoverStyles: i,
1556
+ focusStyles: s,
1557
+ menu: a,
1558
+ top: u === "fixed" ? p : p + window.scrollY,
1559
+ left: u === "fixed" ? c : c + window.scrollX,
1560
+ width: l,
1561
+ height: y
1562
+ };
1563
+ }).sort((t, r) => r.width * r.height - t.width * t.height), "mapBoxes"), dt = /* @__PURE__ */ n((e, t) => {
1564
+ let r = e.getBoundingClientRect(), { x: o, y: i } = t;
1565
+ return r?.top && r?.left && o >= r.left && o <= r.left + r.width && i >= r.top && i <= r.top + r.height;
1566
+ }, "isOverMenu"), mt = /* @__PURE__ */ n((e, t, r) => {
1567
+ if (!t || !r)
1568
+ return !1;
1569
+ let { left: o, top: i, width: s, height: a } = e;
1570
+ a < z && (i = i - Math.round((z - a) / 2), a = z), s < z && (o = o - Math.round((z - s) / 2), s = z), t.style.position === "fixed" && (o +=
1571
+ window.scrollX, i += window.scrollY);
1572
+ let { x: p, y: c } = r;
1573
+ return p >= o && p <= o + s && c >= i && c <= i + a;
1574
+ }, "isTargeted"), Dr = /* @__PURE__ */ n((e, t, r = {}) => {
1575
+ let { x: o, y: i } = t, { margin: s = 5, topOffset: a = 0, centered: p = !1 } = r, { scrollX: c, scrollY: l, innerHeight: y, innerWidth: u } = window,
1576
+ h = Math.min(
1577
+ e.style.position === "fixed" ? i - l : i,
1578
+ y - e.clientHeight - s - a + l
1579
+ ), T = p ? e.clientWidth / 2 : 0, R = e.style.position === "fixed" ? Math.max(Math.min(o - c, u - T - s), T + s) : Math.max(
1580
+ Math.min(o, u - T - s + c),
1581
+ T + s + c
1582
+ );
1583
+ Object.assign(e.style, {
1584
+ ...R !== o && { left: `${R}px` },
1585
+ ...h !== i && { top: `${h}px` }
1586
+ });
1587
+ }, "keepInViewport"), ut = /* @__PURE__ */ n((e) => {
1588
+ window.HTMLElement.prototype.hasOwnProperty("showPopover") && e.showPopover();
1589
+ }, "showPopover"), Hr = /* @__PURE__ */ n((e) => {
1590
+ window.HTMLElement.prototype.hasOwnProperty("showPopover") && e.hidePopover();
1591
+ }, "hidePopover"), Nr = /* @__PURE__ */ n((e) => ({
1592
+ top: e.top,
1593
+ left: e.left,
1594
+ width: e.width,
1595
+ height: e.height,
1596
+ selectors: e.selectors,
1597
+ element: {
1598
+ attributes: Object.fromEntries(
1599
+ Array.from(e.element.attributes).map((t) => [t.name, t.value])
1600
+ ),
1601
+ localName: e.element.localName,
1602
+ tagName: e.element.tagName,
1603
+ outerHTML: e.element.outerHTML
1604
+ }
1605
+ }), "getEventDetails");
1606
+
1607
+ // src/highlight/useHighlights.ts
1608
+ var C = "storybook-highlights-menu", jr = "storybook-highlights-root", fn = "storybook-root", zr = /* @__PURE__ */ n((e) => {
1609
+ if (globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED)
1610
+ return;
1611
+ globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED = !0;
1612
+ let { document: t } = globalThis, r = U([]), o = U(/* @__PURE__ */ new Map()), i = U([]), s = U(), a = U(), p = U([]), c = U([]), l = U(),
1613
+ y = U(), u = t.getElementById(jr);
1614
+ r.subscribe(() => {
1615
+ u || (u = M("div", { id: jr }), t.body.appendChild(u));
1616
+ }), r.subscribe((d) => {
1617
+ let m = t.getElementById(fn);
1618
+ if (!m)
1619
+ return;
1620
+ o.set(ct(d));
1621
+ let f = new MutationObserver(() => o.set(ct(d)));
1622
+ return f.observe(m, { subtree: !0, childList: !0 }), () => {
1623
+ f.disconnect();
1624
+ };
1625
+ }), o.subscribe((d) => {
1626
+ let m = /* @__PURE__ */ n(() => requestAnimationFrame(() => i.set(_r(d))), "updateBoxes"), f = new ResizeObserver(m);
1627
+ f.observe(t.body), Array.from(d.keys()).forEach((g) => f.observe(g));
1628
+ let x = Array.from(t.body.querySelectorAll("*")).filter((g) => {
1629
+ let { overflow: E, overflowX: I, overflowY: k } = window.getComputedStyle(g);
1630
+ return ["auto", "scroll"].some((j) => [E, I, k].includes(j));
1631
+ });
1632
+ return x.forEach((g) => g.addEventListener("scroll", m)), () => {
1633
+ f.disconnect(), x.forEach((g) => g.removeEventListener("scroll", m));
1634
+ };
1635
+ }), o.subscribe((d) => {
1636
+ let m = Array.from(d.keys()).filter(({ style: x }) => x.position === "sticky"), f = /* @__PURE__ */ n(() => requestAnimationFrame(() => {
1637
+ i.set(
1638
+ (x) => x.map((g) => {
1639
+ if (m.includes(g.element)) {
1640
+ let { top: E, left: I } = g.element.getBoundingClientRect();
1641
+ return { ...g, top: E + window.scrollY, left: I + window.scrollX };
1642
+ }
1643
+ return g;
1644
+ })
1645
+ );
1646
+ }), "updateBoxes");
1647
+ return t.addEventListener("scroll", f), () => t.removeEventListener("scroll", f);
1648
+ }), o.subscribe((d) => {
1649
+ p.set((m) => m.filter(({ element: f }) => d.has(f)));
1650
+ }), p.subscribe((d) => {
1651
+ d.length ? (y.set((m) => d.some((f) => f.element === m?.element) ? m : void 0), l.set((m) => d.some((f) => f.element === m?.element) ? m :
1652
+ void 0)) : (y.set(void 0), l.set(void 0), s.set(void 0));
1653
+ });
1654
+ let h = new Map(/* @__PURE__ */ new Map());
1655
+ r.subscribe((d) => {
1656
+ d.forEach(({ keyframes: m }) => {
1657
+ if (m) {
1658
+ let f = h.get(m);
1659
+ f || (f = t.createElement("style"), f.setAttribute("data-highlight", "keyframes"), h.set(m, f), t.head.appendChild(f)), f.innerHTML =
1660
+ m;
1661
+ }
1662
+ }), h.forEach((m, f) => {
1663
+ d.some((x) => x.keyframes === f) || (m.remove(), h.delete(f));
1664
+ });
1665
+ });
1666
+ let T = new Map(/* @__PURE__ */ new Map());
1667
+ i.subscribe((d) => {
1668
+ d.forEach((m) => {
1669
+ let f = T.get(m.element);
1670
+ if (u && !f) {
1671
+ let x = {
1672
+ popover: "manual",
1673
+ "data-highlight-dimensions": `w${m.width.toFixed(0)}h${m.height.toFixed(0)}`,
1674
+ "data-highlight-coordinates": `x${m.left.toFixed(0)}y${m.top.toFixed(0)}`
1675
+ };
1676
+ f = u.appendChild(
1677
+ M("div", x, [M("div")])
1678
+ ), T.set(m.element, f);
1679
+ }
1680
+ }), T.forEach((m, f) => {
1681
+ d.some(({ element: x }) => x === f) || (m.remove(), T.delete(f));
1682
+ });
1683
+ }), i.subscribe((d) => {
1684
+ let m = d.filter((x) => x.menu);
1685
+ if (!m.length)
1686
+ return;
1687
+ let f = /* @__PURE__ */ n((x) => {
1688
+ requestAnimationFrame(() => {
1689
+ let g = t.getElementById(C), E = { x: x.pageX, y: x.pageY };
1690
+ if (g && !dt(g, E)) {
1691
+ let I = m.filter((k) => {
1692
+ let j = T.get(k.element);
1693
+ return mt(k, j, E);
1694
+ });
1695
+ s.set(I.length ? E : void 0), p.set(I);
1696
+ }
1697
+ });
1698
+ }, "onClick");
1699
+ return t.addEventListener("click", f), () => t.removeEventListener("click", f);
1700
+ });
1701
+ let R = /* @__PURE__ */ n(() => {
1702
+ let d = t.getElementById(C), m = a.get();
1703
+ !m || d && dt(d, m) || c.set((f) => {
1704
+ let x = i.get().filter((k) => {
1705
+ let j = T.get(k.element);
1706
+ return mt(k, j, m);
1707
+ }), g = f.filter((k) => x.includes(k)), E = x.filter((k) => !f.includes(k)), I = f.length - g.length;
1708
+ return E.length || I ? [...g, ...E] : f;
1709
+ });
1710
+ }, "updateHovered");
1711
+ a.subscribe(R), i.subscribe(R);
1712
+ let P = /* @__PURE__ */ n(() => {
1713
+ let d = y.get(), m = d ? [d] : p.get(), f = m.length === 1 ? m[0] : l.get(), x = s.get() !== void 0;
1714
+ i.get().forEach((g) => {
1715
+ let E = T.get(g.element);
1716
+ if (E) {
1717
+ let I = f === g, k = x ? f ? I : m.includes(g) : c.get()?.includes(g);
1718
+ Object.assign(E.style, {
1719
+ animation: "none",
1720
+ background: "transparent",
1721
+ border: "none",
1722
+ boxSizing: "border-box",
1723
+ outline: "none",
1724
+ outlineOffset: "0px",
1725
+ ...g.styles,
1726
+ ...k ? g.hoverStyles : {},
1727
+ ...I ? g.focusStyles : {},
1728
+ position: getComputedStyle(g.element).position === "fixed" ? "fixed" : "absolute",
1729
+ zIndex: pt - 10,
1730
+ top: `${g.top}px`,
1731
+ left: `${g.left}px`,
1732
+ width: `${g.width}px`,
1733
+ height: `${g.height}px`,
1734
+ margin: 0,
1735
+ padding: 0,
1736
+ cursor: g.menu && k ? "pointer" : "default",
1737
+ pointerEvents: g.menu ? "auto" : "none",
1738
+ display: "flex",
1739
+ alignItems: "center",
1740
+ justifyContent: "center",
1741
+ overflow: "visible"
1742
+ }), Object.assign(E.children[0].style, {
1743
+ width: "100%",
1744
+ height: "100%",
1745
+ minHeight: `${z}px`,
1746
+ minWidth: `${z}px`,
1747
+ boxSizing: "content-box",
1748
+ padding: E.style.outlineWidth || "0px"
1749
+ }), ut(E);
1750
+ }
1751
+ });
1752
+ }, "updateBoxStyles");
1753
+ i.subscribe(P), p.subscribe(P), c.subscribe(P), l.subscribe(P), y.subscribe(P);
1754
+ let L = /* @__PURE__ */ n(() => {
1755
+ if (!u)
1756
+ return;
1757
+ let d = t.getElementById(C);
1758
+ if (d)
1759
+ d.innerHTML = "";
1760
+ else {
1761
+ let g = { id: C, popover: "manual" };
1762
+ d = u.appendChild(M("div", g)), u.appendChild(
1763
+ M("style", {}, [
1764
+ `
1765
+ #${C} {
1766
+ position: absolute;
1767
+ z-index: ${pt};
1768
+ width: 300px;
1769
+ padding: 0px;
1770
+ margin: 15px 0 0 0;
1771
+ transform: translateX(-50%);
1772
+ font-family: "Nunito Sans", -apple-system, ".SFNSText-Regular", "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Ne\
1773
+ ue", Helvetica, Arial, sans-serif;
1774
+ font-size: 12px;
1775
+ background: white;
1776
+ border: none;
1777
+ border-radius: 6px;
1778
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.05), 0 5px 15px 0 rgba(0, 0, 0, 0.1);
1779
+ color: #2E3438;
1780
+ }
1781
+ #${C} ul {
1782
+ list-style: none;
1783
+ margin: 0;
1784
+ padding: 0;
1785
+ }
1786
+ #${C} > ul {
1787
+ max-height: 300px;
1788
+ overflow-y: auto;
1789
+ padding: 4px 0;
1790
+ }
1791
+ #${C} li {
1792
+ padding: 0 4px;
1793
+ margin: 0;
1794
+ }
1795
+ #${C} li > :not(ul) {
1796
+ display: flex;
1797
+ padding: 8px;
1798
+ margin: 0;
1799
+ align-items: center;
1800
+ gap: 8px;
1801
+ border-radius: 4px;
1802
+ }
1803
+ #${C} button {
1804
+ width: 100%;
1805
+ border: 0;
1806
+ background: transparent;
1807
+ color: inherit;
1808
+ text-align: left;
1809
+ font-family: inherit;
1810
+ font-size: inherit;
1811
+ }
1812
+ #${C} button:focus-visible {
1813
+ outline-color: #029CFD;
1814
+ }
1815
+ #${C} button:hover {
1816
+ background: rgba(2, 156, 253, 0.07);
1817
+ color: #029CFD;
1818
+ cursor: pointer;
1819
+ }
1820
+ #${C} li code {
1821
+ white-space: nowrap;
1822
+ overflow: hidden;
1823
+ text-overflow: ellipsis;
1824
+ line-height: 16px;
1825
+ font-size: 11px;
1826
+ }
1827
+ #${C} li svg {
1828
+ flex-shrink: 0;
1829
+ margin: 1px;
1830
+ color: #73828C;
1831
+ }
1832
+ #${C} li > button:hover svg, #${C} li > button:focus-visible svg {
1833
+ color: #029CFD;
1834
+ }
1835
+ #${C} .element-list li svg {
1836
+ display: none;
1837
+ }
1838
+ #${C} li.selectable svg, #${C} li.selected svg {
1839
+ display: block;
1840
+ }
1841
+ #${C} .menu-list {
1842
+ border-top: 1px solid rgba(38, 85, 115, 0.15);
1843
+ }
1844
+ #${C} .menu-list > li:not(:last-child) {
1845
+ padding-bottom: 4px;
1846
+ margin-bottom: 4px;
1847
+ border-bottom: 1px solid rgba(38, 85, 115, 0.15);
1848
+ }
1849
+ #${C} .menu-items, #${C} .menu-items li {
1850
+ padding: 0;
1851
+ }
1852
+ #${C} .menu-item {
1853
+ display: flex;
1854
+ }
1855
+ #${C} .menu-item-content {
1856
+ display: flex;
1857
+ flex-direction: column;
1858
+ flex-grow: 1;
1859
+ }
1860
+ `
1861
+ ])
1862
+ );
1863
+ }
1864
+ let m = y.get(), f = m ? [m] : p.get();
1865
+ if (f.length && (d.style.position = getComputedStyle(f[0].element).position === "fixed" ? "fixed" : "absolute", d.appendChild(
1866
+ M(
1867
+ "ul",
1868
+ { class: "element-list" },
1869
+ f.map((g) => {
1870
+ let E = f.length > 1 && !!g.menu?.some(
1871
+ (j) => j.some(
1872
+ (Z) => !Z.selectors || Z.selectors.some((ge) => g.selectors.includes(ge))
1873
+ )
1874
+ ), I = E ? {
1875
+ class: "selectable",
1876
+ onClick: /* @__PURE__ */ n(() => y.set(g), "onClick"),
1877
+ onMouseEnter: /* @__PURE__ */ n(() => l.set(g), "onMouseEnter"),
1878
+ onMouseLeave: /* @__PURE__ */ n(() => l.set(void 0), "onMouseLeave")
1879
+ } : m ? { class: "selected", onClick: /* @__PURE__ */ n(() => y.set(void 0), "onClick") } : {}, k = E || m;
1880
+ return M("li", I, [
1881
+ M(k ? "button" : "div", k ? { type: "button" } : {}, [
1882
+ m ? me("chevronLeft") : null,
1883
+ M("code", {}, [g.element.outerHTML]),
1884
+ E ? me("chevronRight") : null
1885
+ ])
1886
+ ]);
1887
+ })
1888
+ )
1889
+ )), y.get() || p.get().length === 1) {
1890
+ let g = y.get() || p.get()[0], E = g.menu?.filter(
1891
+ (I) => I.some(
1892
+ (k) => !k.selectors || k.selectors.some((j) => g.selectors.includes(j))
1893
+ )
1894
+ );
1895
+ E?.length && d.appendChild(
1896
+ M(
1897
+ "ul",
1898
+ { class: "menu-list" },
1899
+ E.map(
1900
+ (I) => M("li", {}, [
1901
+ M(
1902
+ "ul",
1903
+ { class: "menu-items" },
1904
+ I.map(
1905
+ ({ id: k, title: j, description: Z, iconLeft: ge, iconRight: vt, clickEvent: kt }) => {
1906
+ let Ie = kt && (() => e.emit(kt, k, Nr(g)));
1907
+ return M("li", {}, [
1908
+ M(
1909
+ Ie ? "button" : "div",
1910
+ Ie ? { class: "menu-item", type: "button", onClick: Ie } : { class: "menu-item" },
1911
+ [
1912
+ ge ? me(ge) : null,
1913
+ M("div", { class: "menu-item-content" }, [
1914
+ M(Z ? "strong" : "span", {}, [j]),
1915
+ Z && M("span", {}, [Z])
1916
+ ]),
1917
+ vt ? me(vt) : null
1918
+ ]
1919
+ )
1920
+ ]);
1921
+ }
1922
+ )
1923
+ )
1924
+ ])
1925
+ )
1926
+ )
1927
+ );
1928
+ }
1929
+ let x = s.get();
1930
+ x ? (Object.assign(d.style, {
1931
+ display: "block",
1932
+ left: `${d.style.position === "fixed" ? x.x - window.scrollX : x.x}px`,
1933
+ top: `${d.style.position === "fixed" ? x.y - window.scrollY : x.y}px`
1934
+ }), ut(d), requestAnimationFrame(() => Dr(d, x, { topOffset: 15, centered: !0 }))) : (Hr(d), Object.assign(d.style, { display: "none" }));
1935
+ }, "renderMenu");
1936
+ p.subscribe(L), y.subscribe(L);
1937
+ let O = /* @__PURE__ */ n((d) => {
1938
+ let m = Lr(d);
1939
+ r.set((f) => {
1940
+ let x = m.id ? f.filter((g) => g.id !== m.id) : f;
1941
+ return m.selectors?.length ? [...x, m] : x;
1942
+ });
1943
+ }, "addHighlight"), F = /* @__PURE__ */ n((d) => {
1944
+ d && r.set((m) => m.filter((f) => f.id !== d));
1945
+ }, "removeHighlight"), A = /* @__PURE__ */ n(() => {
1946
+ r.set([]), o.set(/* @__PURE__ */ new Map()), i.set([]), s.set(void 0), a.set(void 0), p.set([]), c.set([]), l.set(void 0), y.set(void 0);
1947
+ }, "resetState"), S, v = /* @__PURE__ */ n((d, m) => {
1948
+ let f = "scrollIntoView-highlight";
1949
+ clearTimeout(S), F(f);
1950
+ let x = t.querySelector(d);
1951
+ if (!x) {
1952
+ console.warn(`Cannot scroll into view: ${d} not found`);
1953
+ return;
1954
+ }
1955
+ x.scrollIntoView({ behavior: "smooth", block: "center", ...m });
1956
+ let g = `kf-${Math.random().toString(36).substring(2, 15)}`;
1957
+ r.set((E) => [
1958
+ ...E,
1959
+ {
1960
+ id: f,
1961
+ priority: 1e3,
1962
+ selectors: [d],
1963
+ styles: {
1964
+ outline: "2px solid #1EA7FD",
1965
+ outlineOffset: "-1px",
1966
+ animation: `${g} 3s linear forwards`
1967
+ },
1968
+ keyframes: `@keyframes ${g} {
1969
+ 0% { outline: 2px solid #1EA7FD; }
1970
+ 20% { outline: 2px solid #1EA7FD00; }
1971
+ 40% { outline: 2px solid #1EA7FD; }
1972
+ 60% { outline: 2px solid #1EA7FD00; }
1973
+ 80% { outline: 2px solid #1EA7FD; }
1974
+ 100% { outline: 2px solid #1EA7FD00; }
1975
+ }`
1976
+ }
1977
+ ]), S = setTimeout(() => F(f), 3500);
1978
+ }, "scrollIntoView"), w = /* @__PURE__ */ n((d) => {
1979
+ requestAnimationFrame(() => a.set({ x: d.pageX, y: d.pageY }));
1980
+ }, "onMouseMove");
1981
+ t.body.addEventListener("mousemove", w), e.on(Mr, O), e.on($r, F), e.on(Fr, A), e.on(Ir, v), e.on(Br.STORY_RENDER_PHASE_CHANGED, ({ newPhase: d }) => {
1982
+ d === "loading" && A();
1983
+ });
1984
+ }, "useHighlights");
1985
+
1986
+ // src/highlight/preview.ts
1987
+ globalThis?.FEATURES?.highlight && ft.addons?.ready && ft.addons.ready().then(zr);
1988
+ var yt = /* @__PURE__ */ n(() => (0, Ur.definePreviewAddon)({}), "default");
1989
+
1990
+ // src/measure/preview.ts
1991
+ var po = require("storybook/internal/csf");
1992
+
1993
+ // src/measure/constants.ts
1994
+ var Pe = "storybook/measure-addon", ip = `${Pe}/tool`, Gr = "measureEnabled", sp = {
1995
+ RESULT: `${Pe}/result`,
1996
+ REQUEST: `${Pe}/request`,
1997
+ CLEAR: `${Pe}/clear`
1998
+ };
1999
+
2000
+ // src/measure/withMeasure.ts
2001
+ var xt = require("storybook/preview-api");
2002
+
2003
+ // src/measure/box-model/canvas.ts
2004
+ var ue = require("@storybook/global");
2005
+ function Wr() {
2006
+ let e = ue.global.document.documentElement, t = Math.max(e.scrollHeight, e.offsetHeight);
2007
+ return { width: Math.max(e.scrollWidth, e.offsetWidth), height: t };
2008
+ }
2009
+ n(Wr, "getDocumentWidthAndHeight");
2010
+ function yn() {
2011
+ let e = ue.global.document.createElement("canvas");
2012
+ e.id = "storybook-addon-measure";
2013
+ let t = e.getContext("2d");
2014
+ Ce(t != null);
2015
+ let { width: r, height: o } = Wr();
2016
+ return gt(e, t, { width: r, height: o }), e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.zIndex = "21474836\
2017
+ 47", e.style.pointerEvents = "none", ue.global.document.body.appendChild(e), { canvas: e, context: t, width: r, height: o };
2018
+ }
2019
+ n(yn, "createCanvas");
2020
+ function gt(e, t, { width: r, height: o }) {
2021
+ e.style.width = `${r}px`, e.style.height = `${o}px`;
2022
+ let i = ue.global.window.devicePixelRatio;
2023
+ e.width = Math.floor(r * i), e.height = Math.floor(o * i), t.scale(i, i);
2024
+ }
2025
+ n(gt, "setCanvasWidthAndHeight");
2026
+ var $ = {};
2027
+ function Yr() {
2028
+ $.canvas || ($ = yn());
2029
+ }
2030
+ n(Yr, "init");
2031
+ function Vr() {
2032
+ $.context && $.context.clearRect(0, 0, $.width ?? 0, $.height ?? 0);
2033
+ }
2034
+ n(Vr, "clear");
2035
+ function Kr(e) {
2036
+ Vr(), e($.context);
2037
+ }
2038
+ n(Kr, "draw");
2039
+ function qr() {
2040
+ Ce($.canvas, "Canvas should exist in the state."), Ce($.context, "Context should exist in the state."), gt($.canvas, $.context, { width: 0,
2041
+ height: 0 });
2042
+ let { width: e, height: t } = Wr();
2043
+ gt($.canvas, $.context, { width: e, height: t }), $.width = e, $.height = t;
2044
+ }
2045
+ n(qr, "rescale");
2046
+ function Xr() {
2047
+ $.canvas && (Vr(), $.canvas.parentNode?.removeChild($.canvas), $ = {});
2048
+ }
2049
+ n(Xr, "destroy");
2050
+
2051
+ // src/measure/box-model/visualizer.ts
2052
+ var N = require("@storybook/global");
2053
+
2054
+ // src/measure/box-model/labels.ts
2055
+ var te = {
2056
+ margin: "#f6b26b",
2057
+ border: "#ffe599",
2058
+ padding: "#93c47d",
2059
+ content: "#6fa8dc",
2060
+ text: "#232020"
2061
+ }, W = 6;
2062
+ function Zr(e, { x: t, y: r, w: o, h: i, r: s }) {
2063
+ t = t - o / 2, r = r - i / 2, o < 2 * s && (s = o / 2), i < 2 * s && (s = i / 2), e.beginPath(), e.moveTo(t + s, r), e.arcTo(t + o, r, t +
2064
+ o, r + i, s), e.arcTo(t + o, r + i, t, r + i, s), e.arcTo(t, r + i, t, r, s), e.arcTo(t, r, t + o, r, s), e.closePath();
2065
+ }
2066
+ n(Zr, "roundedRect");
2067
+ function gn(e, { padding: t, border: r, width: o, height: i, top: s, left: a }) {
2068
+ let p = o - r.left - r.right - t.left - t.right, c = i - t.top - t.bottom - r.top - r.bottom, l = a + r.left + t.left, y = s + r.top + t.top;
2069
+ return e === "top" ? l += p / 2 : e === "right" ? (l += p, y += c / 2) : e === "bottom" ? (l += p / 2, y += c) : e === "left" ? y += c / 2 :
2070
+ e === "center" && (l += p / 2, y += c / 2), { x: l, y };
2071
+ }
2072
+ n(gn, "positionCoordinate");
2073
+ function hn(e, t, { margin: r, border: o, padding: i }, s, a) {
2074
+ let p = /* @__PURE__ */ n((h) => 0, "shift"), c = 0, l = 0, y = a ? 1 : 0.5, u = a ? s * 2 : 0;
2075
+ return e === "padding" ? p = /* @__PURE__ */ n((h) => i[h] * y + u, "shift") : e === "border" ? p = /* @__PURE__ */ n((h) => i[h] + o[h] *
2076
+ y + u, "shift") : e === "margin" && (p = /* @__PURE__ */ n((h) => i[h] + o[h] + r[h] * y + u, "shift")), t === "top" ? l = -p("top") : t ===
2077
+ "right" ? c = p("right") : t === "bottom" ? l = p("bottom") : t === "left" && (c = -p("left")), { offsetX: c, offsetY: l };
2078
+ }
2079
+ n(hn, "offset");
2080
+ function xn(e, t) {
2081
+ return Math.abs(e.x - t.x) < Math.abs(e.w + t.w) / 2 && Math.abs(e.y - t.y) < Math.abs(e.h + t.h) / 2;
2082
+ }
2083
+ n(xn, "collide");
2084
+ function bn(e, t, r) {
2085
+ return e === "top" ? t.y = r.y - r.h - W : e === "right" ? t.x = r.x + r.w / 2 + W + t.w / 2 : e === "bottom" ? t.y = r.y + r.h + W : e ===
2086
+ "left" && (t.x = r.x - r.w / 2 - W - t.w / 2), { x: t.x, y: t.y };
2087
+ }
2088
+ n(bn, "overlapAdjustment");
2089
+ function Jr(e, t, { x: r, y: o, w: i, h: s }, a) {
2090
+ return Zr(e, { x: r, y: o, w: i, h: s, r: 3 }), e.fillStyle = `${te[t]}dd`, e.fill(), e.strokeStyle = te[t], e.stroke(), e.fillStyle = te.
2091
+ text, e.fillText(a, r, o), Zr(e, { x: r, y: o, w: i, h: s, r: 3 }), e.fillStyle = `${te[t]}dd`, e.fill(), e.strokeStyle = te[t], e.stroke(),
2092
+ e.fillStyle = te.text, e.fillText(a, r, o), { x: r, y: o, w: i, h: s };
2093
+ }
2094
+ n(Jr, "textWithRect");
2095
+ function Qr(e, t) {
2096
+ e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
2097
+ let r = e.measureText(t), o = r.actualBoundingBoxAscent + r.actualBoundingBoxDescent, i = r.width + W * 2, s = o + W * 2;
2098
+ return { w: i, h: s };
2099
+ }
2100
+ n(Qr, "configureText");
2101
+ function Tn(e, t, { type: r, position: o = "center", text: i }, s, a = !1) {
2102
+ let { x: p, y: c } = gn(o, t), { offsetX: l, offsetY: y } = hn(r, o, t, W + 1, a);
2103
+ p += l, c += y;
2104
+ let { w: u, h } = Qr(e, i);
2105
+ if (s && xn({ x: p, y: c, w: u, h }, s)) {
2106
+ let T = bn(o, { x: p, y: c, w: u, h }, s);
2107
+ p = T.x, c = T.y;
2108
+ }
2109
+ return Jr(e, r, { x: p, y: c, w: u, h }, i);
2110
+ }
2111
+ n(Tn, "drawLabel");
2112
+ function Sn(e, { w: t, h: r }) {
2113
+ let o = t * 0.5 + W, i = r * 0.5 + W;
2114
+ return {
2115
+ offsetX: (e.x === "left" ? -1 : 1) * o,
2116
+ offsetY: (e.y === "top" ? -1 : 1) * i
2117
+ };
2118
+ }
2119
+ n(Sn, "floatingOffset");
2120
+ function An(e, t, { type: r, text: o }) {
2121
+ let { floatingAlignment: i, extremities: s } = t, a = s[i.x], p = s[i.y], { w: c, h: l } = Qr(e, o), { offsetX: y, offsetY: u } = Sn(i, {
2122
+ w: c,
2123
+ h: l
2124
+ });
2125
+ return a += y, p += u, Jr(e, r, { x: a, y: p, w: c, h: l }, o);
2126
+ }
2127
+ n(An, "drawFloatingLabel");
2128
+ function fe(e, t, r, o) {
2129
+ let i = [];
2130
+ r.forEach((s, a) => {
2131
+ let p = o && s.position === "center" ? An(e, t, s) : Tn(e, t, s, i[a - 1], o);
2132
+ i[a] = p;
2133
+ });
2134
+ }
2135
+ n(fe, "drawStack");
2136
+ function eo(e, t, r, o) {
2137
+ let i = r.reduce((s, a) => (Object.prototype.hasOwnProperty.call(s, a.position) || (s[a.position] = []), s[a.position]?.push(a), s), {});
2138
+ i.top && fe(e, t, i.top, o), i.right && fe(e, t, i.right, o), i.bottom && fe(e, t, i.bottom, o), i.left && fe(e, t, i.left, o), i.center &&
2139
+ fe(e, t, i.center, o);
2140
+ }
2141
+ n(eo, "labelStacks");
2142
+
2143
+ // src/measure/box-model/visualizer.ts
2144
+ var Oe = {
2145
+ margin: "#f6b26ba8",
2146
+ border: "#ffe599a8",
2147
+ padding: "#93c47d8c",
2148
+ content: "#6fa8dca8"
2149
+ }, to = 30;
2150
+ function H(e) {
2151
+ return parseInt(e.replace("px", ""), 10);
2152
+ }
2153
+ n(H, "pxToNumber");
2154
+ function re(e) {
2155
+ return Number.isInteger(e) ? e : e.toFixed(2);
2156
+ }
2157
+ n(re, "round");
2158
+ function ht(e) {
2159
+ return e.filter((t) => t.text !== 0 && t.text !== "0");
2160
+ }
2161
+ n(ht, "filterZeroValues");
2162
+ function Rn(e) {
2163
+ let t = {
2164
+ top: N.global.window.scrollY,
2165
+ bottom: N.global.window.scrollY + N.global.window.innerHeight,
2166
+ left: N.global.window.scrollX,
2167
+ right: N.global.window.scrollX + N.global.window.innerWidth
2168
+ }, r = {
2169
+ top: Math.abs(t.top - e.top),
2170
+ bottom: Math.abs(t.bottom - e.bottom),
2171
+ left: Math.abs(t.left - e.left),
2172
+ right: Math.abs(t.right - e.right)
2173
+ };
2174
+ return {
2175
+ x: r.left > r.right ? "left" : "right",
2176
+ y: r.top > r.bottom ? "top" : "bottom"
2177
+ };
2178
+ }
2179
+ n(Rn, "floatingAlignment");
2180
+ function wn(e) {
2181
+ let t = N.global.getComputedStyle(e), { top: r, left: o, right: i, bottom: s, width: a, height: p } = e.getBoundingClientRect(), {
2182
+ marginTop: c,
2183
+ marginBottom: l,
2184
+ marginLeft: y,
2185
+ marginRight: u,
2186
+ paddingTop: h,
2187
+ paddingBottom: T,
2188
+ paddingLeft: R,
2189
+ paddingRight: P,
2190
+ borderBottomWidth: L,
2191
+ borderTopWidth: O,
2192
+ borderLeftWidth: F,
2193
+ borderRightWidth: A
2194
+ } = t;
2195
+ r = r + N.global.window.scrollY, o = o + N.global.window.scrollX, s = s + N.global.window.scrollY, i = i + N.global.window.scrollX;
2196
+ let S = {
2197
+ top: H(c),
2198
+ bottom: H(l),
2199
+ left: H(y),
2200
+ right: H(u)
2201
+ }, v = {
2202
+ top: H(h),
2203
+ bottom: H(T),
2204
+ left: H(R),
2205
+ right: H(P)
2206
+ }, w = {
2207
+ top: H(O),
2208
+ bottom: H(L),
2209
+ left: H(F),
2210
+ right: H(A)
2211
+ }, d = {
2212
+ top: r - S.top,
2213
+ bottom: s + S.bottom,
2214
+ left: o - S.left,
2215
+ right: i + S.right
2216
+ };
2217
+ return {
2218
+ margin: S,
2219
+ padding: v,
2220
+ border: w,
2221
+ top: r,
2222
+ left: o,
2223
+ bottom: s,
2224
+ right: i,
2225
+ width: a,
2226
+ height: p,
2227
+ extremities: d,
2228
+ floatingAlignment: Rn(d)
2229
+ };
2230
+ }
2231
+ n(wn, "measureElement");
2232
+ function En(e, { margin: t, width: r, height: o, top: i, left: s, bottom: a, right: p }) {
2233
+ let c = o + t.bottom + t.top;
2234
+ e.fillStyle = Oe.margin, e.fillRect(s, i - t.top, r, t.top), e.fillRect(p, i - t.top, t.right, c), e.fillRect(s, a, r, t.bottom), e.fillRect(
2235
+ s - t.left, i - t.top, t.left, c);
2236
+ let l = [
2237
+ {
2238
+ type: "margin",
2239
+ text: re(t.top),
2240
+ position: "top"
2241
+ },
2242
+ {
2243
+ type: "margin",
2244
+ text: re(t.right),
2245
+ position: "right"
2246
+ },
2247
+ {
2248
+ type: "margin",
2249
+ text: re(t.bottom),
2250
+ position: "bottom"
2251
+ },
2252
+ {
2253
+ type: "margin",
2254
+ text: re(t.left),
2255
+ position: "left"
2256
+ }
2257
+ ];
2258
+ return ht(l);
2259
+ }
2260
+ n(En, "drawMargin");
2261
+ function Cn(e, { padding: t, border: r, width: o, height: i, top: s, left: a, bottom: p, right: c }) {
2262
+ let l = o - r.left - r.right, y = i - t.top - t.bottom - r.top - r.bottom;
2263
+ e.fillStyle = Oe.padding, e.fillRect(a + r.left, s + r.top, l, t.top), e.fillRect(
2264
+ c - t.right - r.right,
2265
+ s + t.top + r.top,
2266
+ t.right,
2267
+ y
2268
+ ), e.fillRect(
2269
+ a + r.left,
2270
+ p - t.bottom - r.bottom,
2271
+ l,
2272
+ t.bottom
2273
+ ), e.fillRect(a + r.left, s + t.top + r.top, t.left, y);
2274
+ let u = [
2275
+ {
2276
+ type: "padding",
2277
+ text: t.top,
2278
+ position: "top"
2279
+ },
2280
+ {
2281
+ type: "padding",
2282
+ text: t.right,
2283
+ position: "right"
2284
+ },
2285
+ {
2286
+ type: "padding",
2287
+ text: t.bottom,
2288
+ position: "bottom"
2289
+ },
2290
+ {
2291
+ type: "padding",
2292
+ text: t.left,
2293
+ position: "left"
2294
+ }
2295
+ ];
2296
+ return ht(u);
2297
+ }
2298
+ n(Cn, "drawPadding");
2299
+ function vn(e, { border: t, width: r, height: o, top: i, left: s, bottom: a, right: p }) {
2300
+ let c = o - t.top - t.bottom;
2301
+ e.fillStyle = Oe.border, e.fillRect(s, i, r, t.top), e.fillRect(s, a - t.bottom, r, t.bottom), e.fillRect(s, i + t.top, t.left, c), e.fillRect(
2302
+ p - t.right, i + t.top, t.right, c);
2303
+ let l = [
2304
+ {
2305
+ type: "border",
2306
+ text: t.top,
2307
+ position: "top"
2308
+ },
2309
+ {
2310
+ type: "border",
2311
+ text: t.right,
2312
+ position: "right"
2313
+ },
2314
+ {
2315
+ type: "border",
2316
+ text: t.bottom,
2317
+ position: "bottom"
2318
+ },
2319
+ {
2320
+ type: "border",
2321
+ text: t.left,
2322
+ position: "left"
2323
+ }
2324
+ ];
2325
+ return ht(l);
2326
+ }
2327
+ n(vn, "drawBorder");
2328
+ function kn(e, { padding: t, border: r, width: o, height: i, top: s, left: a }) {
2329
+ let p = o - r.left - r.right - t.left - t.right, c = i - t.top - t.bottom - r.top - r.bottom;
2330
+ return e.fillStyle = Oe.content, e.fillRect(
2331
+ a + r.left + t.left,
2332
+ s + r.top + t.top,
2333
+ p,
2334
+ c
2335
+ ), [
2336
+ {
2337
+ type: "content",
2338
+ position: "center",
2339
+ text: `${re(p)} x ${re(c)}`
2340
+ }
2341
+ ];
2342
+ }
2343
+ n(kn, "drawContent");
2344
+ function Pn(e) {
2345
+ return (t) => {
2346
+ if (e && t) {
2347
+ let r = wn(e), o = En(t, r), i = Cn(t, r), s = vn(t, r), a = kn(t, r), p = r.width <= to * 3 || r.height <= to;
2348
+ eo(
2349
+ t,
2350
+ r,
2351
+ [...a, ...i, ...s, ...o],
2352
+ p
2353
+ );
2354
+ }
2355
+ };
2356
+ }
2357
+ n(Pn, "drawBoxModel");
2358
+ function ro(e) {
2359
+ Kr(Pn(e));
2360
+ }
2361
+ n(ro, "drawSelectedElement");
2362
+
2363
+ // src/measure/util.ts
2364
+ var oo = require("@storybook/global");
2365
+ var no = /* @__PURE__ */ n((e, t) => {
2366
+ let r = oo.global.document.elementFromPoint(e, t), o = /* @__PURE__ */ n((s) => {
2367
+ if (s && s.shadowRoot) {
2368
+ let a = s.shadowRoot.elementFromPoint(e, t);
2369
+ return s.isEqualNode(a) ? s : a.shadowRoot ? o(a) : a;
2370
+ }
2371
+ return s;
2372
+ }, "crawlShadows");
2373
+ return o(r) || r;
2374
+ }, "deepElementFromPoint");
2375
+
2376
+ // src/measure/withMeasure.ts
2377
+ var io, Me = { x: 0, y: 0 };
2378
+ function so(e, t) {
2379
+ io = no(e, t), ro(io);
2380
+ }
2381
+ n(so, "findAndDrawElement");
2382
+ var ao = /* @__PURE__ */ n((e, t) => {
2383
+ let { measureEnabled: r } = t.globals || {};
2384
+ return (0, xt.useEffect)(() => {
2385
+ if (typeof globalThis.document > "u")
2386
+ return;
2387
+ let o = /* @__PURE__ */ n((i) => {
2388
+ window.requestAnimationFrame(() => {
2389
+ i.stopPropagation(), Me.x = i.clientX, Me.y = i.clientY;
2390
+ });
2391
+ }, "onPointerMove");
2392
+ return globalThis.document.addEventListener("pointermove", o), () => {
2393
+ globalThis.document.removeEventListener("pointermove", o);
2394
+ };
2395
+ }, []), (0, xt.useEffect)(() => {
2396
+ let o = /* @__PURE__ */ n((s) => {
2397
+ window.requestAnimationFrame(() => {
2398
+ s.stopPropagation(), so(s.clientX, s.clientY);
2399
+ });
2400
+ }, "onPointerOver"), i = /* @__PURE__ */ n(() => {
2401
+ window.requestAnimationFrame(() => {
2402
+ qr();
2403
+ });
2404
+ }, "onResize");
2405
+ return t.viewMode === "story" && r && (globalThis.document.addEventListener("pointerover", o), Yr(), globalThis.window.addEventListener(
2406
+ "resize", i), so(Me.x, Me.y)), () => {
2407
+ globalThis.window.removeEventListener("resize", i), Xr();
2408
+ };
2409
+ }, [r, t.viewMode]), e();
2410
+ }, "withMeasure");
2411
+
2412
+ // src/measure/preview.ts
2413
+ var On = globalThis.FEATURES?.measure ? [ao] : [], Mn = {
2414
+ [Gr]: !1
2415
+ }, bt = /* @__PURE__ */ n(() => (0, po.definePreviewAddon)({
2416
+ decorators: On,
2417
+ initialGlobals: Mn
2418
+ }), "default");
2419
+
2420
+ // src/outline/preview.ts
2421
+ var uo = require("storybook/internal/csf");
2422
+
2423
+ // src/outline/constants.ts
2424
+ var $e = "outline";
2425
+
2426
+ // src/outline/withOutline.ts
2427
+ var Fe = require("storybook/preview-api");
2428
+
2429
+ // src/outline/helpers.ts
2430
+ var ye = require("@storybook/global");
2431
+ var Tt = /* @__PURE__ */ n((e) => {
2432
+ (Array.isArray(e) ? e : [e]).forEach($n);
2433
+ }, "clearStyles"), $n = /* @__PURE__ */ n((e) => {
2434
+ let t = typeof e == "string" ? e : e.join(""), r = ye.global.document.getElementById(t);
2435
+ r && r.parentElement && r.parentElement.removeChild(r);
2436
+ }, "clearStyle"), lo = /* @__PURE__ */ n((e, t) => {
2437
+ let r = ye.global.document.getElementById(e);
2438
+ if (r)
2439
+ r.innerHTML !== t && (r.innerHTML = t);
2440
+ else {
2441
+ let o = ye.global.document.createElement("style");
2442
+ o.setAttribute("id", e), o.innerHTML = t, ye.global.document.head.appendChild(o);
2443
+ }
2444
+ }, "addOutlineStyles");
2445
+
2446
+ // src/outline/outlineCSS.ts
2447
+ var co = J(Q(), 1);
2448
+ function St(e) {
2449
+ return co.dedent`
2450
+ ${e} body {
2451
+ outline: 1px solid #2980b9 !important;
2452
+ }
2453
+
2454
+ ${e} article {
2455
+ outline: 1px solid #3498db !important;
2456
+ }
2457
+
2458
+ ${e} nav {
2459
+ outline: 1px solid #0088c3 !important;
2460
+ }
2461
+
2462
+ ${e} aside {
2463
+ outline: 1px solid #33a0ce !important;
2464
+ }
2465
+
2466
+ ${e} section {
2467
+ outline: 1px solid #66b8da !important;
2468
+ }
2469
+
2470
+ ${e} header {
2471
+ outline: 1px solid #99cfe7 !important;
2472
+ }
2473
+
2474
+ ${e} footer {
2475
+ outline: 1px solid #cce7f3 !important;
2476
+ }
2477
+
2478
+ ${e} h1 {
2479
+ outline: 1px solid #162544 !important;
2480
+ }
2481
+
2482
+ ${e} h2 {
2483
+ outline: 1px solid #314e6e !important;
2484
+ }
2485
+
2486
+ ${e} h3 {
2487
+ outline: 1px solid #3e5e85 !important;
2488
+ }
2489
+
2490
+ ${e} h4 {
2491
+ outline: 1px solid #449baf !important;
2492
+ }
2493
+
2494
+ ${e} h5 {
2495
+ outline: 1px solid #c7d1cb !important;
2496
+ }
2497
+
2498
+ ${e} h6 {
2499
+ outline: 1px solid #4371d0 !important;
2500
+ }
2501
+
2502
+ ${e} main {
2503
+ outline: 1px solid #2f4f90 !important;
2504
+ }
2505
+
2506
+ ${e} address {
2507
+ outline: 1px solid #1a2c51 !important;
2508
+ }
2509
+
2510
+ ${e} div {
2511
+ outline: 1px solid #036cdb !important;
2512
+ }
2513
+
2514
+ ${e} p {
2515
+ outline: 1px solid #ac050b !important;
2516
+ }
2517
+
2518
+ ${e} hr {
2519
+ outline: 1px solid #ff063f !important;
2520
+ }
2521
+
2522
+ ${e} pre {
2523
+ outline: 1px solid #850440 !important;
2524
+ }
2525
+
2526
+ ${e} blockquote {
2527
+ outline: 1px solid #f1b8e7 !important;
2528
+ }
2529
+
2530
+ ${e} ol {
2531
+ outline: 1px solid #ff050c !important;
2532
+ }
2533
+
2534
+ ${e} ul {
2535
+ outline: 1px solid #d90416 !important;
2536
+ }
2537
+
2538
+ ${e} li {
2539
+ outline: 1px solid #d90416 !important;
2540
+ }
2541
+
2542
+ ${e} dl {
2543
+ outline: 1px solid #fd3427 !important;
2544
+ }
2545
+
2546
+ ${e} dt {
2547
+ outline: 1px solid #ff0043 !important;
2548
+ }
2549
+
2550
+ ${e} dd {
2551
+ outline: 1px solid #e80174 !important;
2552
+ }
2553
+
2554
+ ${e} figure {
2555
+ outline: 1px solid #ff00bb !important;
2556
+ }
2557
+
2558
+ ${e} figcaption {
2559
+ outline: 1px solid #bf0032 !important;
2560
+ }
2561
+
2562
+ ${e} table {
2563
+ outline: 1px solid #00cc99 !important;
2564
+ }
2565
+
2566
+ ${e} caption {
2567
+ outline: 1px solid #37ffc4 !important;
2568
+ }
2569
+
2570
+ ${e} thead {
2571
+ outline: 1px solid #98daca !important;
2572
+ }
2573
+
2574
+ ${e} tbody {
2575
+ outline: 1px solid #64a7a0 !important;
2576
+ }
2577
+
2578
+ ${e} tfoot {
2579
+ outline: 1px solid #22746b !important;
2580
+ }
2581
+
2582
+ ${e} tr {
2583
+ outline: 1px solid #86c0b2 !important;
2584
+ }
2585
+
2586
+ ${e} th {
2587
+ outline: 1px solid #a1e7d6 !important;
2588
+ }
2589
+
2590
+ ${e} td {
2591
+ outline: 1px solid #3f5a54 !important;
2592
+ }
2593
+
2594
+ ${e} col {
2595
+ outline: 1px solid #6c9a8f !important;
2596
+ }
2597
+
2598
+ ${e} colgroup {
2599
+ outline: 1px solid #6c9a9d !important;
2600
+ }
2601
+
2602
+ ${e} button {
2603
+ outline: 1px solid #da8301 !important;
2604
+ }
2605
+
2606
+ ${e} datalist {
2607
+ outline: 1px solid #c06000 !important;
2608
+ }
2609
+
2610
+ ${e} fieldset {
2611
+ outline: 1px solid #d95100 !important;
2612
+ }
2613
+
2614
+ ${e} form {
2615
+ outline: 1px solid #d23600 !important;
2616
+ }
2617
+
2618
+ ${e} input {
2619
+ outline: 1px solid #fca600 !important;
2620
+ }
2621
+
2622
+ ${e} keygen {
2623
+ outline: 1px solid #b31e00 !important;
2624
+ }
2625
+
2626
+ ${e} label {
2627
+ outline: 1px solid #ee8900 !important;
2628
+ }
2629
+
2630
+ ${e} legend {
2631
+ outline: 1px solid #de6d00 !important;
2632
+ }
2633
+
2634
+ ${e} meter {
2635
+ outline: 1px solid #e8630c !important;
2636
+ }
2637
+
2638
+ ${e} optgroup {
2639
+ outline: 1px solid #b33600 !important;
2640
+ }
2641
+
2642
+ ${e} option {
2643
+ outline: 1px solid #ff8a00 !important;
2644
+ }
2645
+
2646
+ ${e} output {
2647
+ outline: 1px solid #ff9619 !important;
2648
+ }
2649
+
2650
+ ${e} progress {
2651
+ outline: 1px solid #e57c00 !important;
2652
+ }
2653
+
2654
+ ${e} select {
2655
+ outline: 1px solid #e26e0f !important;
2656
+ }
2657
+
2658
+ ${e} textarea {
2659
+ outline: 1px solid #cc5400 !important;
2660
+ }
2661
+
2662
+ ${e} details {
2663
+ outline: 1px solid #33848f !important;
2664
+ }
2665
+
2666
+ ${e} summary {
2667
+ outline: 1px solid #60a1a6 !important;
2668
+ }
2669
+
2670
+ ${e} command {
2671
+ outline: 1px solid #438da1 !important;
2672
+ }
2673
+
2674
+ ${e} menu {
2675
+ outline: 1px solid #449da6 !important;
2676
+ }
2677
+
2678
+ ${e} del {
2679
+ outline: 1px solid #bf0000 !important;
2680
+ }
2681
+
2682
+ ${e} ins {
2683
+ outline: 1px solid #400000 !important;
2684
+ }
2685
+
2686
+ ${e} img {
2687
+ outline: 1px solid #22746b !important;
2688
+ }
2689
+
2690
+ ${e} iframe {
2691
+ outline: 1px solid #64a7a0 !important;
2692
+ }
2693
+
2694
+ ${e} embed {
2695
+ outline: 1px solid #98daca !important;
2696
+ }
2697
+
2698
+ ${e} object {
2699
+ outline: 1px solid #00cc99 !important;
2700
+ }
2701
+
2702
+ ${e} param {
2703
+ outline: 1px solid #37ffc4 !important;
2704
+ }
2705
+
2706
+ ${e} video {
2707
+ outline: 1px solid #6ee866 !important;
2708
+ }
2709
+
2710
+ ${e} audio {
2711
+ outline: 1px solid #027353 !important;
2712
+ }
2713
+
2714
+ ${e} source {
2715
+ outline: 1px solid #012426 !important;
2716
+ }
2717
+
2718
+ ${e} canvas {
2719
+ outline: 1px solid #a2f570 !important;
2720
+ }
2721
+
2722
+ ${e} track {
2723
+ outline: 1px solid #59a600 !important;
2724
+ }
2725
+
2726
+ ${e} map {
2727
+ outline: 1px solid #7be500 !important;
2728
+ }
2729
+
2730
+ ${e} area {
2731
+ outline: 1px solid #305900 !important;
2732
+ }
2733
+
2734
+ ${e} a {
2735
+ outline: 1px solid #ff62ab !important;
2736
+ }
2737
+
2738
+ ${e} em {
2739
+ outline: 1px solid #800b41 !important;
2740
+ }
2741
+
2742
+ ${e} strong {
2743
+ outline: 1px solid #ff1583 !important;
2744
+ }
2745
+
2746
+ ${e} i {
2747
+ outline: 1px solid #803156 !important;
2748
+ }
2749
+
2750
+ ${e} b {
2751
+ outline: 1px solid #cc1169 !important;
2752
+ }
2753
+
2754
+ ${e} u {
2755
+ outline: 1px solid #ff0430 !important;
2756
+ }
2757
+
2758
+ ${e} s {
2759
+ outline: 1px solid #f805e3 !important;
2760
+ }
2761
+
2762
+ ${e} small {
2763
+ outline: 1px solid #d107b2 !important;
2764
+ }
2765
+
2766
+ ${e} abbr {
2767
+ outline: 1px solid #4a0263 !important;
2768
+ }
2769
+
2770
+ ${e} q {
2771
+ outline: 1px solid #240018 !important;
2772
+ }
2773
+
2774
+ ${e} cite {
2775
+ outline: 1px solid #64003c !important;
2776
+ }
2777
+
2778
+ ${e} dfn {
2779
+ outline: 1px solid #b4005a !important;
2780
+ }
2781
+
2782
+ ${e} sub {
2783
+ outline: 1px solid #dba0c8 !important;
2784
+ }
2785
+
2786
+ ${e} sup {
2787
+ outline: 1px solid #cc0256 !important;
2788
+ }
2789
+
2790
+ ${e} time {
2791
+ outline: 1px solid #d6606d !important;
2792
+ }
2793
+
2794
+ ${e} code {
2795
+ outline: 1px solid #e04251 !important;
2796
+ }
2797
+
2798
+ ${e} kbd {
2799
+ outline: 1px solid #5e001f !important;
2800
+ }
2801
+
2802
+ ${e} samp {
2803
+ outline: 1px solid #9c0033 !important;
2804
+ }
2805
+
2806
+ ${e} var {
2807
+ outline: 1px solid #d90047 !important;
2808
+ }
2809
+
2810
+ ${e} mark {
2811
+ outline: 1px solid #ff0053 !important;
2812
+ }
2813
+
2814
+ ${e} bdi {
2815
+ outline: 1px solid #bf3668 !important;
2816
+ }
2817
+
2818
+ ${e} bdo {
2819
+ outline: 1px solid #6f1400 !important;
2820
+ }
2821
+
2822
+ ${e} ruby {
2823
+ outline: 1px solid #ff7b93 !important;
2824
+ }
2825
+
2826
+ ${e} rt {
2827
+ outline: 1px solid #ff2f54 !important;
2828
+ }
2829
+
2830
+ ${e} rp {
2831
+ outline: 1px solid #803e49 !important;
2832
+ }
2833
+
2834
+ ${e} span {
2835
+ outline: 1px solid #cc2643 !important;
2836
+ }
2837
+
2838
+ ${e} br {
2839
+ outline: 1px solid #db687d !important;
2840
+ }
2841
+
2842
+ ${e} wbr {
2843
+ outline: 1px solid #db175b !important;
2844
+ }`;
2845
+ }
2846
+ n(St, "outlineCSS");
2847
+
2848
+ // src/outline/withOutline.ts
2849
+ var mo = /* @__PURE__ */ n((e, t) => {
2850
+ let r = t.globals || {}, o = [!0, "true"].includes(r[$e]), i = t.viewMode === "docs", s = (0, Fe.useMemo)(() => St(i ? '[data-story-block=\
2851
+ "true"]' : ".sb-show-main"), [t]);
2852
+ return (0, Fe.useEffect)(() => {
2853
+ let a = i ? `addon-outline-docs-${t.id}` : "addon-outline";
2854
+ return o ? lo(a, s) : Tt(a), () => {
2855
+ Tt(a);
2856
+ };
2857
+ }, [o, s, t]), e();
2858
+ }, "withOutline");
2859
+
2860
+ // src/outline/preview.ts
2861
+ var Fn = globalThis.FEATURES?.outline ? [mo] : [], In = {
2862
+ [$e]: !1
2863
+ }, At = /* @__PURE__ */ n(() => (0, uo.definePreviewAddon)({ decorators: Fn, initialGlobals: In }), "default");
2864
+
2865
+ // src/test/preview.ts
2866
+ var yo = require("storybook/internal/csf"), go = require("storybook/internal/instrumenter"), D = require("storybook/test");
2867
+ var Ln = /* @__PURE__ */ n(({ parameters: e }) => {
2868
+ e?.test?.mockReset === !0 ? (0, D.resetAllMocks)() : e?.test?.clearMocks === !0 ? (0, D.clearAllMocks)() : e?.test?.restoreMocks !== !1 &&
2869
+ (0, D.restoreAllMocks)();
2870
+ }, "resetAllMocksLoader"), Rt = /* @__PURE__ */ n((e, t = 0, r) => {
2871
+ if (t > 5 || e == null)
2872
+ return e;
2873
+ if ((0, D.isMockFunction)(e))
2874
+ return r && e.mockName(r), e;
2875
+ if (typeof e == "function" && "isAction" in e && e.isAction && !("implicit" in e && e.implicit)) {
2876
+ let o = (0, D.fn)(e);
2877
+ return r && o.mockName(r), o;
2878
+ }
2879
+ if (Array.isArray(e)) {
2880
+ t++;
2881
+ for (let o = 0; o < e.length; o++)
2882
+ Object.getOwnPropertyDescriptor(e, o)?.writable && (e[o] = Rt(e[o], t));
2883
+ return e;
2884
+ }
2885
+ if (typeof e == "object" && e.constructor === Object) {
2886
+ t++;
2887
+ for (let [o, i] of Object.entries(e))
2888
+ Object.getOwnPropertyDescriptor(e, o)?.writable && (e[o] = Rt(i, t, o));
2889
+ return e;
2890
+ }
2891
+ return e;
2892
+ }, "traverseArgs"), _n = /* @__PURE__ */ n(({ initialArgs: e }) => {
2893
+ Rt(e);
2894
+ }, "nameSpiesAndWrapActionsInSpies"), fo = !1, Dn = /* @__PURE__ */ n(async (e) => {
2895
+ globalThis.HTMLElement && e.canvasElement instanceof globalThis.HTMLElement && (e.canvas = (0, D.within)(e.canvasElement));
2896
+ let t = globalThis.window?.navigator?.clipboard;
2897
+ if (t) {
2898
+ e.userEvent = (0, go.instrument)(
2899
+ { userEvent: D.uninstrumentedUserEvent.setup() },
2900
+ { intercept: !0 }
2901
+ ).userEvent, Object.defineProperty(globalThis.window.navigator, "clipboard", {
2902
+ get: /* @__PURE__ */ n(() => t, "get"),
2903
+ configurable: !0
2904
+ });
2905
+ let r = HTMLElement.prototype.focus;
2906
+ fo || Object.defineProperties(HTMLElement.prototype, {
2907
+ focus: {
2908
+ configurable: !0,
2909
+ set: /* @__PURE__ */ n((o) => {
2910
+ r = o, fo = !0;
2911
+ }, "set"),
2912
+ get: /* @__PURE__ */ n(() => r, "get")
2913
+ }
2914
+ });
2915
+ }
2916
+ }, "enhanceContext"), wt = /* @__PURE__ */ n(() => (0, yo.definePreviewAddon)({
2917
+ loaders: [Ln, _n, Dn]
2918
+ }), "default");
2919
+
2920
+ // src/viewport/preview.ts
2921
+ var bo = require("storybook/internal/csf");
2922
+
2923
+ // src/viewport/constants.ts
2924
+ var ho = "storybook/viewport", xo = "viewport", Gp = `${ho}/panel`, Wp = `${ho}/tool`;
2925
+
2926
+ // src/viewport/preview.ts
2927
+ var Hn = {
2928
+ [xo]: { value: void 0, isRotated: !1 }
2929
+ }, Et = /* @__PURE__ */ n(() => (0, bo.definePreviewAddon)({
2930
+ initialGlobals: Hn
2931
+ }), "default");
2932
+
2933
+ // src/csf/core-annotations.ts
2934
+ function Ct() {
2935
+ return [
2936
+ // @ts-expect-error CJS fallback
2937
+ (bt.default ?? bt)(),
2938
+ // @ts-expect-error CJS fallback
2939
+ (st.default ?? st)(),
2940
+ // @ts-expect-error CJS fallback
2941
+ (yt.default ?? yt)(),
2942
+ // @ts-expect-error CJS fallback
2943
+ (At.default ?? At)(),
2944
+ // @ts-expect-error CJS fallback
2945
+ (Et.default ?? Et)(),
2946
+ // @ts-expect-error CJS fallback
2947
+ (ot.default ?? ot)(),
2948
+ // @ts-expect-error CJS fallback
2949
+ (at.default ?? at)(),
2950
+ // @ts-expect-error CJS fallback
2951
+ (wt.default ?? wt)()
2952
+ ];
2953
+ }
2954
+ n(Ct, "getCoreAnnotations");
2955
+
2956
+ // src/csf/csf-factories.ts
2957
+ function Nn(e) {
2958
+ let t, r = {
2959
+ _tag: "Preview",
2960
+ input: e,
2961
+ get composed() {
2962
+ if (t)
2963
+ return t;
2964
+ let { addons: o, ...i } = e;
2965
+ return t = se(
2966
+ le([...Ct(), ...o ?? [], i])
2967
+ ), t;
2968
+ },
2969
+ meta(o) {
2970
+ return Un(o, this);
2971
+ }
2972
+ };
2973
+ return globalThis.globalProjectAnnotations = r.composed, r;
2974
+ }
2975
+ n(Nn, "definePreview");
2976
+ function jn(e) {
2977
+ return e;
2978
+ }
2979
+ n(jn, "definePreviewAddon");
2980
+ function Bn(e) {
138
2981
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Preview";
139
2982
  }
140
- a(U, "isPreview");
141
- function D(e) {
2983
+ n(Bn, "isPreview");
2984
+ function zn(e) {
142
2985
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Meta";
143
2986
  }
144
- a(D, "isMeta");
145
- function B(e) {
2987
+ n(zn, "isMeta");
2988
+ function Un(e, t) {
2989
+ return {
2990
+ _tag: "Meta",
2991
+ input: e,
2992
+ preview: t,
2993
+ get composed() {
2994
+ throw new Error("Not implemented");
2995
+ },
2996
+ // @ts-expect-error hard
2997
+ story(r = {}) {
2998
+ return So(typeof r == "function" ? { render: r } : r, this);
2999
+ }
3000
+ };
3001
+ }
3002
+ n(Un, "defineMeta");
3003
+ function Gn(e) {
146
3004
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Story";
147
3005
  }
148
- a(B, "isStory");
3006
+ n(Gn, "isStory");
3007
+ function So(e, t) {
3008
+ let r, o = /* @__PURE__ */ n(() => (r || (r = Ze(
3009
+ e,
3010
+ t.input,
3011
+ void 0,
3012
+ t.preview.composed
3013
+ )), r), "compose");
3014
+ return {
3015
+ _tag: "Story",
3016
+ input: e,
3017
+ meta: t,
3018
+ __compose: o,
3019
+ get composed() {
3020
+ let i = o(), { args: s, argTypes: a, parameters: p, id: c, tags: l, globals: y, storyName: u } = i;
3021
+ return { args: s, argTypes: a, parameters: p, id: c, tags: l, name: u, globals: y };
3022
+ },
3023
+ get play() {
3024
+ return e.play ?? t.input?.play ?? (async () => {
3025
+ });
3026
+ },
3027
+ get run() {
3028
+ return o().run ?? (async () => {
3029
+ });
3030
+ },
3031
+ extend(i) {
3032
+ return So(
3033
+ {
3034
+ ...this.input,
3035
+ ...i,
3036
+ args: { ...this.input.args, ...i.args },
3037
+ argTypes: _(this.input.argTypes, i.argTypes),
3038
+ afterEach: [
3039
+ ...b(this.input?.afterEach ?? []),
3040
+ ...b(i.afterEach ?? [])
3041
+ ],
3042
+ beforeEach: [
3043
+ ...b(this.input?.beforeEach ?? []),
3044
+ ...b(i.beforeEach ?? [])
3045
+ ],
3046
+ decorators: [
3047
+ ...b(this.input?.decorators ?? []),
3048
+ ...b(i.decorators ?? [])
3049
+ ],
3050
+ globals: { ...this.input.globals, ...i.globals },
3051
+ loaders: [
3052
+ ...b(this.input?.loaders ?? []),
3053
+ ...b(i.loaders ?? [])
3054
+ ],
3055
+ parameters: _(this.input.parameters, i.parameters),
3056
+ tags: (0, To.combineTags)(...this.input.tags ?? [], ...i.tags ?? [])
3057
+ },
3058
+ this.meta
3059
+ );
3060
+ }
3061
+ };
3062
+ }
3063
+ n(So, "defineStory");
149
3064
 
150
3065
  // src/csf/index.ts
151
- var O = /* @__PURE__ */ a((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
152
- "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), b = /* @__PURE__ */ a((e, r) => {
153
- let t = O(e);
154
- if (t === "")
155
- throw new Error(`Invalid ${r} '${e}', must include alphanumeric characters`);
156
- return t;
157
- }, "sanitizeSafe"), k = /* @__PURE__ */ a((e, r) => `${b(e, "kind")}${r ? `--${b(r, "name")}` : ""}`, "toId"), q = /* @__PURE__ */ a((e) => S(
3066
+ var wo = /* @__PURE__ */ n((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g,
3067
+ "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), Ao = /* @__PURE__ */ n((e, t) => {
3068
+ let r = wo(e);
3069
+ if (r === "")
3070
+ throw new Error(`Invalid ${t} '${e}', must include alphanumeric characters`);
3071
+ return r;
3072
+ }, "sanitizeSafe"), Wn = /* @__PURE__ */ n((e, t) => `${Ao(e, "kind")}${t ? `--${Ao(t, "name")}` : ""}`, "toId"), Yn = /* @__PURE__ */ n((e) => Mt(
158
3073
  e), "storyNameFromExport");
159
- function h(e, r) {
160
- return Array.isArray(r) ? r.includes(e) : e.match(r);
3074
+ function Ro(e, t) {
3075
+ return Array.isArray(t) ? t.includes(e) : e.match(t);
161
3076
  }
162
- a(h, "matches");
163
- function F(e, { includeStories: r, excludeStories: t }) {
3077
+ n(Ro, "matches");
3078
+ function Vn(e, { includeStories: t, excludeStories: r }) {
164
3079
  return (
165
3080
  // https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
166
- e !== "__esModule" && (!r || h(e, r)) && (!t || !h(e, t))
3081
+ e !== "__esModule" && (!t || Ro(e, t)) && (!r || !Ro(e, r))
167
3082
  );
168
3083
  }
169
- a(F, "isExportStory");
170
- var G = /* @__PURE__ */ a((e, { rootSeparator: r, groupSeparator: t }) => {
171
- let [n, s] = e.split(r, 2), l = (s || e).split(t).filter((o) => !!o);
3084
+ n(Vn, "isExportStory");
3085
+ var Kn = /* @__PURE__ */ n((e, { rootSeparator: t, groupSeparator: r }) => {
3086
+ let [o, i] = e.split(t, 2), s = (i || e).split(r).filter((a) => !!a);
172
3087
  return {
173
- root: s ? n : null,
174
- groups: l
3088
+ root: i ? o : null,
3089
+ groups: s
175
3090
  };
176
- }, "parseKind"), J = /* @__PURE__ */ a((...e) => {
177
- let r = e.reduce((t, n) => (n.startsWith("!") ? t.delete(n.slice(1)) : t.add(n), t), /* @__PURE__ */ new Set());
178
- return Array.from(r);
3091
+ }, "parseKind"), qn = /* @__PURE__ */ n((...e) => {
3092
+ let t = e.reduce((r, o) => (o.startsWith("!") ? r.delete(o.slice(1)) : r.add(o), r), /* @__PURE__ */ new Set());
3093
+ return Array.from(t);
179
3094
  }, "combineTags");