storybook 9.0.0-alpha.0 → 9.0.0-alpha.2

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 (211) hide show
  1. package/README.md +31 -29
  2. package/assets/browser/favicon.svg +1 -0
  3. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  4. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  5. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  6. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  7. package/assets/docs/message-reference.png +0 -0
  8. package/assets/server/addon.tsconfig.json +6 -0
  9. package/assets/server/base-preview-body.html +119 -0
  10. package/assets/server/base-preview-head.html +451 -0
  11. package/assets/server/template.ejs +87 -0
  12. package/bin/index.cjs +1 -1
  13. package/dist/babel/index.cjs +54034 -0
  14. package/dist/babel/index.d.ts +7488 -0
  15. package/dist/babel/index.js +54044 -0
  16. package/dist/bin/index.cjs +124 -0
  17. package/dist/bin/index.js +118 -0
  18. package/dist/builder-manager/index.cjs +2167 -0
  19. package/dist/builder-manager/index.d.ts +19 -0
  20. package/dist/builder-manager/index.js +2189 -0
  21. package/dist/channels/index.cjs +1938 -0
  22. package/dist/channels/index.d.ts +108 -0
  23. package/dist/channels/index.js +1885 -0
  24. package/dist/cli/bin/index.cjs +2687 -0
  25. package/dist/cli/bin/index.d.ts +2 -0
  26. package/dist/cli/bin/index.js +2707 -0
  27. package/dist/cli/index.cjs +17327 -0
  28. package/dist/cli/index.d.ts +209 -0
  29. package/dist/cli/index.js +17349 -0
  30. package/dist/client-logger/index.cjs +112 -0
  31. package/dist/client-logger/index.d.ts +29 -0
  32. package/dist/client-logger/index.js +70 -0
  33. package/dist/common/index.cjs +20558 -0
  34. package/dist/common/index.d.ts +955 -0
  35. package/dist/common/index.js +20643 -0
  36. package/dist/components/index.cjs +30056 -0
  37. package/dist/components/index.d.ts +1423 -0
  38. package/dist/components/index.js +25416 -0
  39. package/dist/core-events/index.cjs +167 -0
  40. package/dist/core-events/index.d.ts +313 -0
  41. package/dist/core-events/index.js +149 -0
  42. package/dist/core-server/index.cjs +37872 -0
  43. package/dist/core-server/index.d.ts +462 -0
  44. package/dist/core-server/index.js +37966 -0
  45. package/dist/core-server/presets/common-manager.js +28 -0
  46. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  47. package/dist/core-server/presets/common-override-preset.js +4829 -0
  48. package/dist/core-server/presets/common-preset.cjs +10228 -0
  49. package/dist/core-server/presets/common-preset.js +10306 -0
  50. package/dist/csf/index.cjs +223 -0
  51. package/dist/csf/index.d.ts +752 -0
  52. package/dist/csf/index.js +216 -0
  53. package/dist/csf-tools/index.cjs +1422 -0
  54. package/dist/csf-tools/index.d.ts +250 -0
  55. package/dist/csf-tools/index.js +1439 -0
  56. package/dist/docs-tools/index.cjs +923 -0
  57. package/dist/docs-tools/index.d.ts +162 -0
  58. package/dist/docs-tools/index.js +909 -0
  59. package/dist/index.cjs +17 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +2 -7
  62. package/dist/instrumenter/index.cjs +3273 -0
  63. package/dist/instrumenter/index.d.ts +104 -0
  64. package/dist/instrumenter/index.js +4800 -0
  65. package/dist/manager/globals-module-info.cjs +666 -0
  66. package/dist/manager/globals-module-info.d.ts +36 -0
  67. package/dist/manager/globals-module-info.js +653 -0
  68. package/dist/manager/globals-runtime.js +41567 -0
  69. package/dist/manager/globals.cjs +43 -0
  70. package/dist/manager/globals.d.ts +21 -0
  71. package/dist/manager/globals.js +30 -0
  72. package/dist/manager/runtime.js +12043 -0
  73. package/dist/manager-api/index.cjs +10772 -0
  74. package/dist/manager-api/index.d.ts +1211 -0
  75. package/dist/manager-api/index.js +4547 -0
  76. package/dist/manager-errors.d.ts +65 -0
  77. package/dist/manager-errors.js +83 -0
  78. package/dist/node-logger/index.cjs +1642 -0
  79. package/dist/node-logger/index.d.ts +117 -0
  80. package/dist/node-logger/index.js +1652 -0
  81. package/dist/preview/globals.cjs +34 -0
  82. package/dist/preview/globals.d.ts +12 -0
  83. package/dist/preview/globals.js +21 -0
  84. package/dist/preview/runtime.js +7723 -0
  85. package/dist/preview-api/index.cjs +5658 -0
  86. package/dist/preview-api/index.d.ts +1356 -0
  87. package/dist/preview-api/index.js +5665 -0
  88. package/dist/preview-errors.cjs +486 -0
  89. package/dist/preview-errors.d.ts +188 -0
  90. package/dist/preview-errors.js +433 -0
  91. package/dist/router/index.cjs +3320 -0
  92. package/dist/router/index.d.ts +385 -0
  93. package/dist/router/index.js +1849 -0
  94. package/dist/server-errors.cjs +710 -0
  95. package/dist/server-errors.d.ts +272 -0
  96. package/dist/server-errors.js +711 -0
  97. package/dist/telemetry/index.cjs +3683 -0
  98. package/dist/telemetry/index.d.ts +112 -0
  99. package/dist/telemetry/index.js +3720 -0
  100. package/dist/theming/create.cjs +2422 -0
  101. package/dist/theming/create.d.ts +50 -0
  102. package/dist/theming/create.js +990 -0
  103. package/dist/theming/index.cjs +4832 -0
  104. package/dist/theming/index.d.ts +11939 -0
  105. package/dist/theming/index.js +3253 -0
  106. package/dist/types/index.cjs +27 -0
  107. package/dist/types/index.d.ts +2541 -0
  108. package/dist/types/index.js +7 -0
  109. package/package.json +308 -212
  110. package/.eslintrc.cjs +0 -31
  111. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  112. package/core/babel/index.cjs +0 -1
  113. package/core/babel/index.d.ts +0 -2
  114. package/core/babel/index.js +0 -1
  115. package/core/builder-manager/index.cjs +0 -1
  116. package/core/builder-manager/index.d.ts +0 -2
  117. package/core/builder-manager/index.js +0 -1
  118. package/core/channels/index.cjs +0 -1
  119. package/core/channels/index.d.ts +0 -2
  120. package/core/channels/index.js +0 -1
  121. package/core/cli/bin/index.cjs +0 -1
  122. package/core/cli/bin/index.d.ts +0 -2
  123. package/core/cli/bin/index.js +0 -1
  124. package/core/cli/index.cjs +0 -1
  125. package/core/cli/index.d.ts +0 -2
  126. package/core/cli/index.js +0 -1
  127. package/core/client-logger/index.cjs +0 -1
  128. package/core/client-logger/index.d.ts +0 -2
  129. package/core/client-logger/index.js +0 -1
  130. package/core/common/index.cjs +0 -1
  131. package/core/common/index.d.ts +0 -2
  132. package/core/common/index.js +0 -1
  133. package/core/components/index.cjs +0 -1
  134. package/core/components/index.d.ts +0 -2
  135. package/core/components/index.js +0 -1
  136. package/core/core-events/index.cjs +0 -1
  137. package/core/core-events/index.d.ts +0 -2
  138. package/core/core-events/index.js +0 -1
  139. package/core/core-server/index.cjs +0 -1
  140. package/core/core-server/index.d.ts +0 -2
  141. package/core/core-server/index.js +0 -1
  142. package/core/core-server/presets/common-manager.js +0 -1
  143. package/core/core-server/presets/common-override-preset.cjs +0 -1
  144. package/core/core-server/presets/common-override-preset.js +0 -1
  145. package/core/core-server/presets/common-preset.cjs +0 -1
  146. package/core/core-server/presets/common-preset.js +0 -1
  147. package/core/csf/index.cjs +0 -1
  148. package/core/csf/index.d.ts +0 -2
  149. package/core/csf/index.js +0 -1
  150. package/core/csf-tools/index.cjs +0 -1
  151. package/core/csf-tools/index.d.ts +0 -2
  152. package/core/csf-tools/index.js +0 -1
  153. package/core/docs-tools/index.cjs +0 -1
  154. package/core/docs-tools/index.d.ts +0 -2
  155. package/core/docs-tools/index.js +0 -1
  156. package/core/index.cjs +0 -1
  157. package/core/index.d.ts +0 -2
  158. package/core/index.js +0 -1
  159. package/core/manager/globals-module-info.cjs +0 -1
  160. package/core/manager/globals-module-info.d.ts +0 -2
  161. package/core/manager/globals-module-info.js +0 -1
  162. package/core/manager/globals-runtime.js +0 -1
  163. package/core/manager/globals.cjs +0 -1
  164. package/core/manager/globals.d.ts +0 -2
  165. package/core/manager/globals.js +0 -1
  166. package/core/manager-api/index.cjs +0 -1
  167. package/core/manager-api/index.d.ts +0 -2
  168. package/core/manager-api/index.js +0 -1
  169. package/core/manager-errors.d.ts +0 -2
  170. package/core/manager-errors.js +0 -1
  171. package/core/node-logger/index.cjs +0 -1
  172. package/core/node-logger/index.d.ts +0 -2
  173. package/core/node-logger/index.js +0 -1
  174. package/core/preview/globals.cjs +0 -1
  175. package/core/preview/globals.d.ts +0 -2
  176. package/core/preview/globals.js +0 -1
  177. package/core/preview/runtime.js +0 -1
  178. package/core/preview-api/index.cjs +0 -1
  179. package/core/preview-api/index.d.ts +0 -2
  180. package/core/preview-api/index.js +0 -1
  181. package/core/preview-errors.cjs +0 -1
  182. package/core/preview-errors.d.ts +0 -2
  183. package/core/preview-errors.js +0 -1
  184. package/core/router/index.cjs +0 -1
  185. package/core/router/index.d.ts +0 -2
  186. package/core/router/index.js +0 -1
  187. package/core/server-errors.cjs +0 -1
  188. package/core/server-errors.d.ts +0 -2
  189. package/core/server-errors.js +0 -1
  190. package/core/telemetry/index.cjs +0 -1
  191. package/core/telemetry/index.d.ts +0 -2
  192. package/core/telemetry/index.js +0 -1
  193. package/core/theming/create.cjs +0 -1
  194. package/core/theming/create.d.ts +0 -2
  195. package/core/theming/create.js +0 -1
  196. package/core/theming/index.cjs +0 -1
  197. package/core/theming/index.d.ts +0 -2
  198. package/core/theming/index.js +0 -1
  199. package/core/types/index.cjs +0 -1
  200. package/core/types/index.d.ts +0 -2
  201. package/core/types/index.js +0 -1
  202. package/core.cjs +0 -0
  203. package/core.d.ts +0 -0
  204. package/core.js +0 -1
  205. package/dist/chunk-OWLSIX54.js +0 -8
  206. package/dist/core-path.cjs +0 -1
  207. package/dist/core-path.d.ts +0 -3
  208. package/dist/core-path.js +0 -9
  209. package/dist/proxy.cjs +0 -1
  210. package/dist/proxy.d.ts +0 -2
  211. package/dist/proxy.js +0 -9
@@ -0,0 +1,1938 @@
1
+ "use strict";
2
+ var Le = Object.create;
3
+ var z = Object.defineProperty;
4
+ var Me = Object.getOwnPropertyDescriptor;
5
+ var Fe = Object.getOwnPropertyNames;
6
+ var Ue = Object.getPrototypeOf, $e = Object.prototype.hasOwnProperty;
7
+ var o = (t, e) => z(t, "name", { value: e, configurable: !0 });
8
+ var F = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports), ke = (t, e) => {
9
+ for (var r in e)
10
+ z(t, r, { get: e[r], enumerable: !0 });
11
+ }, he = (t, e, r, n) => {
12
+ if (e && typeof e == "object" || typeof e == "function")
13
+ for (let a of Fe(e))
14
+ !$e.call(t, a) && a !== r && z(t, a, { get: () => e[a], enumerable: !(n = Me(e, a)) || n.enumerable });
15
+ return t;
16
+ };
17
+ var I = (t, e, r) => (r = t != null ? Le(Ue(t)) : {}, he(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ e || !t || !t.__esModule ? z(r, "default", { value: t, enumerable: !0 }) : r,
23
+ t
24
+ )), Ge = (t) => he(z({}, "__esModule", { value: !0 }), t);
25
+
26
+ // ../node_modules/@storybook/global/dist/index.js
27
+ var te = F((pt, de) => {
28
+ "use strict";
29
+ var ne = Object.defineProperty, He = Object.getOwnPropertyDescriptor, We = Object.getOwnPropertyNames, qe = Object.prototype.hasOwnProperty,
30
+ Je = /* @__PURE__ */ o((t, e) => {
31
+ for (var r in e)
32
+ ne(t, r, { get: e[r], enumerable: !0 });
33
+ }, "__export"), ze = /* @__PURE__ */ o((t, e, r, n) => {
34
+ if (e && typeof e == "object" || typeof e == "function")
35
+ for (let a of We(e))
36
+ !qe.call(t, a) && a !== r && ne(t, a, { get: /* @__PURE__ */ o(() => e[a], "get"), enumerable: !(n = He(e, a)) || n.enumerable });
37
+ return t;
38
+ }, "__copyProps"), Be = /* @__PURE__ */ o((t) => ze(ne({}, "__esModule", { value: !0 }), t), "__toCommonJS"), ye = {};
39
+ Je(ye, {
40
+ global: /* @__PURE__ */ o(() => Ve, "global")
41
+ });
42
+ de.exports = Be(ye);
43
+ var Ve = (() => {
44
+ let t;
45
+ return typeof window < "u" ? t = window : typeof globalThis < "u" ? t = globalThis : typeof global < "u" ? t = global : typeof self < "u" ?
46
+ t = self : t = {}, t;
47
+ })();
48
+ });
49
+
50
+ // ../node_modules/ts-dedent/dist/index.js
51
+ var me = F((B) => {
52
+ "use strict";
53
+ Object.defineProperty(B, "__esModule", { value: !0 });
54
+ B.dedent = void 0;
55
+ function ge(t) {
56
+ for (var e = [], r = 1; r < arguments.length; r++)
57
+ e[r - 1] = arguments[r];
58
+ var n = Array.from(typeof t == "string" ? [t] : t);
59
+ n[n.length - 1] = n[n.length - 1].replace(/\r?\n([\t ]*)$/, "");
60
+ var a = n.reduce(function(c, i) {
61
+ var h = i.match(/\n([\t ]+|(?!\s).)/g);
62
+ return h ? c.concat(h.map(function(u) {
63
+ var p, y;
64
+ return (y = (p = u.match(/[\t ]/g)) === null || p === void 0 ? void 0 : p.length) !== null && y !== void 0 ? y : 0;
65
+ })) : c;
66
+ }, []);
67
+ if (a.length) {
68
+ var s = new RegExp(`
69
+ [ ]{` + Math.min.apply(Math, a) + "}", "g");
70
+ n = n.map(function(c) {
71
+ return c.replace(s, `
72
+ `);
73
+ });
74
+ }
75
+ n[0] = n[0].replace(/^\r?\n/, "");
76
+ var l = n[0];
77
+ return e.forEach(function(c, i) {
78
+ var h = l.match(/(?:^|\n)( *)$/), u = h ? h[1] : "", p = c;
79
+ typeof c == "string" && c.includes(`
80
+ `) && (p = String(c).split(`
81
+ `).map(function(y, d) {
82
+ return d === 0 ? y : "" + u + y;
83
+ }).join(`
84
+ `)), l += p + n[i + 1];
85
+ }), l;
86
+ }
87
+ o(ge, "dedent");
88
+ B.dedent = ge;
89
+ B.default = ge;
90
+ });
91
+
92
+ // ../node_modules/map-or-similar/src/similar.js
93
+ var _e = F((bt, ve) => {
94
+ function x() {
95
+ return this.list = [], this.lastItem = void 0, this.size = 0, this;
96
+ }
97
+ o(x, "Similar");
98
+ x.prototype.get = function(t) {
99
+ var e;
100
+ if (this.lastItem && this.isEqual(this.lastItem.key, t))
101
+ return this.lastItem.val;
102
+ if (e = this.indexOf(t), e >= 0)
103
+ return this.lastItem = this.list[e], this.list[e].val;
104
+ };
105
+ x.prototype.set = function(t, e) {
106
+ var r;
107
+ return this.lastItem && this.isEqual(this.lastItem.key, t) ? (this.lastItem.val = e, this) : (r = this.indexOf(t), r >= 0 ? (this.lastItem =
108
+ this.list[r], this.list[r].val = e, this) : (this.lastItem = { key: t, val: e }, this.list.push(this.lastItem), this.size++, this));
109
+ };
110
+ x.prototype.delete = function(t) {
111
+ var e;
112
+ if (this.lastItem && this.isEqual(this.lastItem.key, t) && (this.lastItem = void 0), e = this.indexOf(t), e >= 0)
113
+ return this.size--, this.list.splice(e, 1)[0];
114
+ };
115
+ x.prototype.has = function(t) {
116
+ var e;
117
+ return this.lastItem && this.isEqual(this.lastItem.key, t) ? !0 : (e = this.indexOf(t), e >= 0 ? (this.lastItem = this.list[e], !0) : !1);
118
+ };
119
+ x.prototype.forEach = function(t, e) {
120
+ var r;
121
+ for (r = 0; r < this.size; r++)
122
+ t.call(e || this, this.list[r].val, this.list[r].key, this);
123
+ };
124
+ x.prototype.indexOf = function(t) {
125
+ var e;
126
+ for (e = 0; e < this.size; e++)
127
+ if (this.isEqual(this.list[e].key, t))
128
+ return e;
129
+ return -1;
130
+ };
131
+ x.prototype.isEqual = function(t, e) {
132
+ return t === e || t !== t && e !== e;
133
+ };
134
+ ve.exports = x;
135
+ });
136
+
137
+ // ../node_modules/map-or-similar/src/map-or-similar.js
138
+ var Ee = F((St, be) => {
139
+ be.exports = function(t) {
140
+ if (typeof Map != "function" || t) {
141
+ var e = _e();
142
+ return new e();
143
+ } else
144
+ return /* @__PURE__ */ new Map();
145
+ };
146
+ });
147
+
148
+ // ../node_modules/memoizerific/src/memoizerific.js
149
+ var Ce = F((Tt, Te) => {
150
+ var Se = Ee();
151
+ Te.exports = function(t) {
152
+ var e = new Se(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), r = [];
153
+ return function(n) {
154
+ var a = /* @__PURE__ */ o(function() {
155
+ var s = e, l, c, i = arguments.length - 1, h = Array(i + 1), u = !0, p;
156
+ if ((a.numArgs || a.numArgs === 0) && a.numArgs !== i + 1)
157
+ throw new Error("Memoizerific functions should always be called with the same number of arguments");
158
+ for (p = 0; p < i; p++) {
159
+ if (h[p] = {
160
+ cacheItem: s,
161
+ arg: arguments[p]
162
+ }, s.has(arguments[p])) {
163
+ s = s.get(arguments[p]);
164
+ continue;
165
+ }
166
+ u = !1, l = new Se(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), s.set(arguments[p], l), s = l;
167
+ }
168
+ return u && (s.has(arguments[i]) ? c = s.get(arguments[i]) : u = !1), u || (c = n.apply(null, arguments), s.set(arguments[i], c)), t >
169
+ 0 && (h[i] = {
170
+ cacheItem: s,
171
+ arg: arguments[i]
172
+ }, u ? Ze(r, h) : r.push(h), r.length > t && Qe(r.shift())), a.wasMemoized = u, a.numArgs = i + 1, c;
173
+ }, "memoizerific");
174
+ return a.limit = t, a.wasMemoized = !1, a.cache = e, a.lru = r, a;
175
+ };
176
+ };
177
+ function Ze(t, e) {
178
+ var r = t.length, n = e.length, a, s, l;
179
+ for (s = 0; s < r; s++) {
180
+ for (a = !0, l = 0; l < n; l++)
181
+ if (!et(t[s][l].arg, e[l].arg)) {
182
+ a = !1;
183
+ break;
184
+ }
185
+ if (a)
186
+ break;
187
+ }
188
+ t.push(t.splice(s, 1)[0]);
189
+ }
190
+ o(Ze, "moveToMostRecentLru");
191
+ function Qe(t) {
192
+ var e = t.length, r = t[e - 1], n, a;
193
+ for (r.cacheItem.delete(r.arg), a = e - 2; a >= 0 && (r = t[a], n = r.cacheItem.get(r.arg), !n || !n.size); a--)
194
+ r.cacheItem.delete(r.arg);
195
+ }
196
+ o(Qe, "removeCachedResult");
197
+ function et(t, e) {
198
+ return t === e || t !== t && e !== e;
199
+ }
200
+ o(et, "isEqual");
201
+ });
202
+
203
+ // ../node_modules/telejson/dist/index.js
204
+ var oe = F((exports, module) => {
205
+ "use strict";
206
+ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.
207
+ getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJS = /* @__PURE__ */ o(
208
+ (t, e) => /* @__PURE__ */ o(function() {
209
+ return e || (0, t[__getOwnPropNames(t)[0]])((e = { exports: {} }).exports, e), e.exports;
210
+ }, "__require"), "__commonJS"), __export = /* @__PURE__ */ o((t, e) => {
211
+ for (var r in e)
212
+ __defProp(t, r, { get: e[r], enumerable: !0 });
213
+ }, "__export"), __copyProps = /* @__PURE__ */ o((t, e, r, n) => {
214
+ if (e && typeof e == "object" || typeof e == "function")
215
+ for (let a of __getOwnPropNames(e))
216
+ !__hasOwnProp.call(t, a) && a !== r && __defProp(t, a, { get: /* @__PURE__ */ o(() => e[a], "get"), enumerable: !(n = __getOwnPropDesc(
217
+ e, a)) || n.enumerable });
218
+ return t;
219
+ }, "__copyProps"), __toESM = /* @__PURE__ */ o((t, e, r) => (r = t != null ? __create(__getProtoOf(t)) : {}, __copyProps(
220
+ e || !t || !t.__esModule ? __defProp(r, "default", { value: t, enumerable: !0 }) : r,
221
+ t
222
+ )), "__toESM"), __toCommonJS = /* @__PURE__ */ o((t) => __copyProps(__defProp({}, "__esModule", { value: !0 }), t), "__toCommonJS"), require_shams = __commonJS(
223
+ {
224
+ "node_modules/has-symbols/shams.js"(t, e) {
225
+ "use strict";
226
+ e.exports = /* @__PURE__ */ o(function() {
227
+ if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
228
+ return !1;
229
+ if (typeof Symbol.iterator == "symbol")
230
+ return !0;
231
+ var n = {}, a = Symbol("test"), s = Object(a);
232
+ if (typeof a == "string" || Object.prototype.toString.call(a) !== "[object Symbol]" || Object.prototype.toString.call(s) !== "[objec\
233
+ t Symbol]")
234
+ return !1;
235
+ var l = 42;
236
+ n[a] = l;
237
+ for (a in n)
238
+ return !1;
239
+ if (typeof Object.keys == "function" && Object.keys(n).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(
240
+ n).length !== 0)
241
+ return !1;
242
+ var c = Object.getOwnPropertySymbols(n);
243
+ if (c.length !== 1 || c[0] !== a || !Object.prototype.propertyIsEnumerable.call(n, a))
244
+ return !1;
245
+ if (typeof Object.getOwnPropertyDescriptor == "function") {
246
+ var i = Object.getOwnPropertyDescriptor(n, a);
247
+ if (i.value !== l || i.enumerable !== !0)
248
+ return !1;
249
+ }
250
+ return !0;
251
+ }, "hasSymbols");
252
+ }
253
+ }), require_has_symbols = __commonJS({
254
+ "node_modules/has-symbols/index.js"(t, e) {
255
+ "use strict";
256
+ var r = typeof Symbol < "u" && Symbol, n = require_shams();
257
+ e.exports = /* @__PURE__ */ o(function() {
258
+ return typeof r != "function" || typeof Symbol != "function" || typeof r("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 :
259
+ n();
260
+ }, "hasNativeSymbols");
261
+ }
262
+ }), require_implementation = __commonJS({
263
+ "node_modules/function-bind/implementation.js"(t, e) {
264
+ "use strict";
265
+ var r = "Function.prototype.bind called on incompatible ", n = Array.prototype.slice, a = Object.prototype.toString, s = "[object Func\
266
+ tion]";
267
+ e.exports = /* @__PURE__ */ o(function(c) {
268
+ var i = this;
269
+ if (typeof i != "function" || a.call(i) !== s)
270
+ throw new TypeError(r + i);
271
+ for (var h = n.call(arguments, 1), u, p = /* @__PURE__ */ o(function() {
272
+ if (this instanceof u) {
273
+ var T = i.apply(
274
+ this,
275
+ h.concat(n.call(arguments))
276
+ );
277
+ return Object(T) === T ? T : this;
278
+ } else
279
+ return i.apply(
280
+ c,
281
+ h.concat(n.call(arguments))
282
+ );
283
+ }, "binder"), y = Math.max(0, i.length - h.length), d = [], v = 0; v < y; v++)
284
+ d.push("$" + v);
285
+ if (u = Function("binder", "return function (" + d.join(",") + "){ return binder.apply(this,arguments); }")(p), i.prototype) {
286
+ var w = /* @__PURE__ */ o(function() {
287
+ }, "Empty2");
288
+ w.prototype = i.prototype, u.prototype = new w(), w.prototype = null;
289
+ }
290
+ return u;
291
+ }, "bind");
292
+ }
293
+ }), require_function_bind = __commonJS({
294
+ "node_modules/function-bind/index.js"(t, e) {
295
+ "use strict";
296
+ var r = require_implementation();
297
+ e.exports = Function.prototype.bind || r;
298
+ }
299
+ }), require_src = __commonJS({
300
+ "node_modules/has/src/index.js"(t, e) {
301
+ "use strict";
302
+ var r = require_function_bind();
303
+ e.exports = r.call(Function.call, Object.prototype.hasOwnProperty);
304
+ }
305
+ }), require_get_intrinsic = __commonJS({
306
+ "node_modules/get-intrinsic/index.js"(t, e) {
307
+ "use strict";
308
+ var r, n = SyntaxError, a = Function, s = TypeError, l = /* @__PURE__ */ o(function(A) {
309
+ try {
310
+ return a('"use strict"; return (' + A + ").constructor;")();
311
+ } catch {
312
+ }
313
+ }, "getEvalledConstructor"), c = Object.getOwnPropertyDescriptor;
314
+ if (c)
315
+ try {
316
+ c({}, "");
317
+ } catch {
318
+ c = null;
319
+ }
320
+ var i = /* @__PURE__ */ o(function() {
321
+ throw new s();
322
+ }, "throwTypeError"), h = c ? function() {
323
+ try {
324
+ return arguments.callee, i;
325
+ } catch {
326
+ try {
327
+ return c(arguments, "callee").get;
328
+ } catch {
329
+ return i;
330
+ }
331
+ }
332
+ }() : i, u = require_has_symbols()(), p = Object.getPrototypeOf || function(A) {
333
+ return A.__proto__;
334
+ }, y = {}, d = typeof Uint8Array > "u" ? r : p(Uint8Array), v = {
335
+ "%AggregateError%": typeof AggregateError > "u" ? r : AggregateError,
336
+ "%Array%": Array,
337
+ "%ArrayBuffer%": typeof ArrayBuffer > "u" ? r : ArrayBuffer,
338
+ "%ArrayIteratorPrototype%": u ? p([][Symbol.iterator]()) : r,
339
+ "%AsyncFromSyncIteratorPrototype%": r,
340
+ "%AsyncFunction%": y,
341
+ "%AsyncGenerator%": y,
342
+ "%AsyncGeneratorFunction%": y,
343
+ "%AsyncIteratorPrototype%": y,
344
+ "%Atomics%": typeof Atomics > "u" ? r : Atomics,
345
+ "%BigInt%": typeof BigInt > "u" ? r : BigInt,
346
+ "%Boolean%": Boolean,
347
+ "%DataView%": typeof DataView > "u" ? r : DataView,
348
+ "%Date%": Date,
349
+ "%decodeURI%": decodeURI,
350
+ "%decodeURIComponent%": decodeURIComponent,
351
+ "%encodeURI%": encodeURI,
352
+ "%encodeURIComponent%": encodeURIComponent,
353
+ "%Error%": Error,
354
+ "%eval%": eval,
355
+ "%EvalError%": EvalError,
356
+ "%Float32Array%": typeof Float32Array > "u" ? r : Float32Array,
357
+ "%Float64Array%": typeof Float64Array > "u" ? r : Float64Array,
358
+ "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? r : FinalizationRegistry,
359
+ "%Function%": a,
360
+ "%GeneratorFunction%": y,
361
+ "%Int8Array%": typeof Int8Array > "u" ? r : Int8Array,
362
+ "%Int16Array%": typeof Int16Array > "u" ? r : Int16Array,
363
+ "%Int32Array%": typeof Int32Array > "u" ? r : Int32Array,
364
+ "%isFinite%": isFinite,
365
+ "%isNaN%": isNaN,
366
+ "%IteratorPrototype%": u ? p(p([][Symbol.iterator]())) : r,
367
+ "%JSON%": typeof JSON == "object" ? JSON : r,
368
+ "%Map%": typeof Map > "u" ? r : Map,
369
+ "%MapIteratorPrototype%": typeof Map > "u" || !u ? r : p((/* @__PURE__ */ new Map())[Symbol.iterator]()),
370
+ "%Math%": Math,
371
+ "%Number%": Number,
372
+ "%Object%": Object,
373
+ "%parseFloat%": parseFloat,
374
+ "%parseInt%": parseInt,
375
+ "%Promise%": typeof Promise > "u" ? r : Promise,
376
+ "%Proxy%": typeof Proxy > "u" ? r : Proxy,
377
+ "%RangeError%": RangeError,
378
+ "%ReferenceError%": ReferenceError,
379
+ "%Reflect%": typeof Reflect > "u" ? r : Reflect,
380
+ "%RegExp%": RegExp,
381
+ "%Set%": typeof Set > "u" ? r : Set,
382
+ "%SetIteratorPrototype%": typeof Set > "u" || !u ? r : p((/* @__PURE__ */ new Set())[Symbol.iterator]()),
383
+ "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? r : SharedArrayBuffer,
384
+ "%String%": String,
385
+ "%StringIteratorPrototype%": u ? p(""[Symbol.iterator]()) : r,
386
+ "%Symbol%": u ? Symbol : r,
387
+ "%SyntaxError%": n,
388
+ "%ThrowTypeError%": h,
389
+ "%TypedArray%": d,
390
+ "%TypeError%": s,
391
+ "%Uint8Array%": typeof Uint8Array > "u" ? r : Uint8Array,
392
+ "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? r : Uint8ClampedArray,
393
+ "%Uint16Array%": typeof Uint16Array > "u" ? r : Uint16Array,
394
+ "%Uint32Array%": typeof Uint32Array > "u" ? r : Uint32Array,
395
+ "%URIError%": URIError,
396
+ "%WeakMap%": typeof WeakMap > "u" ? r : WeakMap,
397
+ "%WeakRef%": typeof WeakRef > "u" ? r : WeakRef,
398
+ "%WeakSet%": typeof WeakSet > "u" ? r : WeakSet
399
+ }, w = /* @__PURE__ */ o(function A(g) {
400
+ var b;
401
+ if (g === "%AsyncFunction%")
402
+ b = l("async function () {}");
403
+ else if (g === "%GeneratorFunction%")
404
+ b = l("function* () {}");
405
+ else if (g === "%AsyncGeneratorFunction%")
406
+ b = l("async function* () {}");
407
+ else if (g === "%AsyncGenerator%") {
408
+ var m = A("%AsyncGeneratorFunction%");
409
+ m && (b = m.prototype);
410
+ } else if (g === "%AsyncIteratorPrototype%") {
411
+ var E = A("%AsyncGenerator%");
412
+ E && (b = p(E.prototype));
413
+ }
414
+ return v[g] = b, b;
415
+ }, "doEval2"), T = {
416
+ "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
417
+ "%ArrayPrototype%": ["Array", "prototype"],
418
+ "%ArrayProto_entries%": ["Array", "prototype", "entries"],
419
+ "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
420
+ "%ArrayProto_keys%": ["Array", "prototype", "keys"],
421
+ "%ArrayProto_values%": ["Array", "prototype", "values"],
422
+ "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
423
+ "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
424
+ "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
425
+ "%BooleanPrototype%": ["Boolean", "prototype"],
426
+ "%DataViewPrototype%": ["DataView", "prototype"],
427
+ "%DatePrototype%": ["Date", "prototype"],
428
+ "%ErrorPrototype%": ["Error", "prototype"],
429
+ "%EvalErrorPrototype%": ["EvalError", "prototype"],
430
+ "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
431
+ "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
432
+ "%FunctionPrototype%": ["Function", "prototype"],
433
+ "%Generator%": ["GeneratorFunction", "prototype"],
434
+ "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
435
+ "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
436
+ "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
437
+ "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
438
+ "%JSONParse%": ["JSON", "parse"],
439
+ "%JSONStringify%": ["JSON", "stringify"],
440
+ "%MapPrototype%": ["Map", "prototype"],
441
+ "%NumberPrototype%": ["Number", "prototype"],
442
+ "%ObjectPrototype%": ["Object", "prototype"],
443
+ "%ObjProto_toString%": ["Object", "prototype", "toString"],
444
+ "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
445
+ "%PromisePrototype%": ["Promise", "prototype"],
446
+ "%PromiseProto_then%": ["Promise", "prototype", "then"],
447
+ "%Promise_all%": ["Promise", "all"],
448
+ "%Promise_reject%": ["Promise", "reject"],
449
+ "%Promise_resolve%": ["Promise", "resolve"],
450
+ "%RangeErrorPrototype%": ["RangeError", "prototype"],
451
+ "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
452
+ "%RegExpPrototype%": ["RegExp", "prototype"],
453
+ "%SetPrototype%": ["Set", "prototype"],
454
+ "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
455
+ "%StringPrototype%": ["String", "prototype"],
456
+ "%SymbolPrototype%": ["Symbol", "prototype"],
457
+ "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
458
+ "%TypedArrayPrototype%": ["TypedArray", "prototype"],
459
+ "%TypeErrorPrototype%": ["TypeError", "prototype"],
460
+ "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
461
+ "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
462
+ "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
463
+ "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
464
+ "%URIErrorPrototype%": ["URIError", "prototype"],
465
+ "%WeakMapPrototype%": ["WeakMap", "prototype"],
466
+ "%WeakSetPrototype%": ["WeakSet", "prototype"]
467
+ }, N = require_function_bind(), j = require_src(), D = N.call(Function.call, Array.prototype.concat), L = N.call(Function.apply, Array.
468
+ prototype.splice), fe = N.call(Function.call, String.prototype.replace), K = N.call(Function.call, String.prototype.slice), xe = N.call(
469
+ Function.call, RegExp.prototype.exec), Ne = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,
470
+ Re = /\\(\\)?/g, je = /* @__PURE__ */ o(function(g) {
471
+ var b = K(g, 0, 1), m = K(g, -1);
472
+ if (b === "%" && m !== "%")
473
+ throw new n("invalid intrinsic syntax, expected closing `%`");
474
+ if (m === "%" && b !== "%")
475
+ throw new n("invalid intrinsic syntax, expected opening `%`");
476
+ var E = [];
477
+ return fe(g, Ne, function(O, M, S, Y) {
478
+ E[E.length] = S ? fe(Y, Re, "$1") : M || O;
479
+ }), E;
480
+ }, "stringToPath3"), De = /* @__PURE__ */ o(function(g, b) {
481
+ var m = g, E;
482
+ if (j(T, m) && (E = T[m], m = "%" + E[0] + "%"), j(v, m)) {
483
+ var O = v[m];
484
+ if (O === y && (O = w(m)), typeof O > "u" && !b)
485
+ throw new s("intrinsic " + g + " exists, but is not available. Please file an issue!");
486
+ return {
487
+ alias: E,
488
+ name: m,
489
+ value: O
490
+ };
491
+ }
492
+ throw new n("intrinsic " + g + " does not exist!");
493
+ }, "getBaseIntrinsic2");
494
+ e.exports = /* @__PURE__ */ o(function(g, b) {
495
+ if (typeof g != "string" || g.length === 0)
496
+ throw new s("intrinsic name must be a non-empty string");
497
+ if (arguments.length > 1 && typeof b != "boolean")
498
+ throw new s('"allowMissing" argument must be a boolean');
499
+ if (xe(/^%?[^%]*%?$/, g) === null)
500
+ throw new n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
501
+ var m = je(g), E = m.length > 0 ? m[0] : "", O = De("%" + E + "%", b), M = O.name, S = O.value, Y = !1, re = O.alias;
502
+ re && (E = re[0], L(m, D([0, 1], re)));
503
+ for (var X = 1, J = !0; X < m.length; X += 1) {
504
+ var P = m[X], Z = K(P, 0, 1), Q = K(P, -1);
505
+ if ((Z === '"' || Z === "'" || Z === "`" || Q === '"' || Q === "'" || Q === "`") && Z !== Q)
506
+ throw new n("property names with quotes must have matching quotes");
507
+ if ((P === "constructor" || !J) && (Y = !0), E += "." + P, M = "%" + E + "%", j(v, M))
508
+ S = v[M];
509
+ else if (S != null) {
510
+ if (!(P in S)) {
511
+ if (!b)
512
+ throw new s("base intrinsic for " + g + " exists, but the property is not available.");
513
+ return;
514
+ }
515
+ if (c && X + 1 >= m.length) {
516
+ var ee = c(S, P);
517
+ J = !!ee, J && "get" in ee && !("originalValue" in ee.get) ? S = ee.get : S = S[P];
518
+ } else
519
+ J = j(S, P), S = S[P];
520
+ J && !Y && (v[M] = S);
521
+ }
522
+ }
523
+ return S;
524
+ }, "GetIntrinsic");
525
+ }
526
+ }), require_call_bind = __commonJS({
527
+ "node_modules/call-bind/index.js"(t, e) {
528
+ "use strict";
529
+ var r = require_function_bind(), n = require_get_intrinsic(), a = n("%Function.prototype.apply%"), s = n("%Function.prototype.call%"),
530
+ l = n("%Reflect.apply%", !0) || r.call(s, a), c = n("%Object.getOwnPropertyDescriptor%", !0), i = n("%Object.defineProperty%", !0), h = n(
531
+ "%Math.max%");
532
+ if (i)
533
+ try {
534
+ i({}, "a", { value: 1 });
535
+ } catch {
536
+ i = null;
537
+ }
538
+ e.exports = /* @__PURE__ */ o(function(y) {
539
+ var d = l(r, s, arguments);
540
+ if (c && i) {
541
+ var v = c(d, "length");
542
+ v.configurable && i(
543
+ d,
544
+ "length",
545
+ { value: 1 + h(0, y.length - (arguments.length - 1)) }
546
+ );
547
+ }
548
+ return d;
549
+ }, "callBind");
550
+ var u = /* @__PURE__ */ o(function() {
551
+ return l(r, a, arguments);
552
+ }, "applyBind2");
553
+ i ? i(e.exports, "apply", { value: u }) : e.exports.apply = u;
554
+ }
555
+ }), require_callBound = __commonJS({
556
+ "node_modules/call-bind/callBound.js"(t, e) {
557
+ "use strict";
558
+ var r = require_get_intrinsic(), n = require_call_bind(), a = n(r("String.prototype.indexOf"));
559
+ e.exports = /* @__PURE__ */ o(function(l, c) {
560
+ var i = r(l, !!c);
561
+ return typeof i == "function" && a(l, ".prototype.") > -1 ? n(i) : i;
562
+ }, "callBoundIntrinsic");
563
+ }
564
+ }), require_shams2 = __commonJS({
565
+ "node_modules/has-tostringtag/shams.js"(t, e) {
566
+ "use strict";
567
+ var r = require_shams();
568
+ e.exports = /* @__PURE__ */ o(function() {
569
+ return r() && !!Symbol.toStringTag;
570
+ }, "hasToStringTagShams");
571
+ }
572
+ }), require_is_regex = __commonJS({
573
+ "node_modules/is-regex/index.js"(t, e) {
574
+ "use strict";
575
+ var r = require_callBound(), n = require_shams2()(), a, s, l, c;
576
+ n && (a = r("Object.prototype.hasOwnProperty"), s = r("RegExp.prototype.exec"), l = {}, i = /* @__PURE__ */ o(function() {
577
+ throw l;
578
+ }, "throwRegexMarker"), c = {
579
+ toString: i,
580
+ valueOf: i
581
+ }, typeof Symbol.toPrimitive == "symbol" && (c[Symbol.toPrimitive] = i));
582
+ var i, h = r("Object.prototype.toString"), u = Object.getOwnPropertyDescriptor, p = "[object RegExp]";
583
+ e.exports = /* @__PURE__ */ o(n ? function(d) {
584
+ if (!d || typeof d != "object")
585
+ return !1;
586
+ var v = u(d, "lastIndex"), w = v && a(v, "value");
587
+ if (!w)
588
+ return !1;
589
+ try {
590
+ s(d, c);
591
+ } catch (T) {
592
+ return T === l;
593
+ }
594
+ } : function(d) {
595
+ return !d || typeof d != "object" && typeof d != "function" ? !1 : h(d) === p;
596
+ }, "isRegex");
597
+ }
598
+ }), require_is_function = __commonJS({
599
+ "node_modules/is-function/index.js"(t, e) {
600
+ e.exports = n;
601
+ var r = Object.prototype.toString;
602
+ function n(a) {
603
+ if (!a)
604
+ return !1;
605
+ var s = r.call(a);
606
+ return s === "[object Function]" || typeof a == "function" && s !== "[object RegExp]" || typeof window < "u" && (a === window.setTimeout ||
607
+ a === window.alert || a === window.confirm || a === window.prompt);
608
+ }
609
+ o(n, "isFunction3");
610
+ }
611
+ }), require_is_symbol = __commonJS({
612
+ "node_modules/is-symbol/index.js"(t, e) {
613
+ "use strict";
614
+ var r = Object.prototype.toString, n = require_has_symbols()();
615
+ n ? (a = Symbol.prototype.toString, s = /^Symbol\(.*\)$/, l = /* @__PURE__ */ o(function(i) {
616
+ return typeof i.valueOf() != "symbol" ? !1 : s.test(a.call(i));
617
+ }, "isRealSymbolObject"), e.exports = /* @__PURE__ */ o(function(i) {
618
+ if (typeof i == "symbol")
619
+ return !0;
620
+ if (r.call(i) !== "[object Symbol]")
621
+ return !1;
622
+ try {
623
+ return l(i);
624
+ } catch {
625
+ return !1;
626
+ }
627
+ }, "isSymbol3")) : e.exports = /* @__PURE__ */ o(function(i) {
628
+ return !1;
629
+ }, "isSymbol3");
630
+ var a, s, l;
631
+ }
632
+ }), src_exports = {};
633
+ __export(src_exports, {
634
+ isJSON: /* @__PURE__ */ o(() => isJSON, "isJSON"),
635
+ parse: /* @__PURE__ */ o(() => parse, "parse"),
636
+ replacer: /* @__PURE__ */ o(() => replacer, "replacer"),
637
+ reviver: /* @__PURE__ */ o(() => reviver2, "reviver"),
638
+ stringify: /* @__PURE__ */ o(() => stringify, "stringify")
639
+ });
640
+ module.exports = __toCommonJS(src_exports);
641
+ var import_is_regex = __toESM(require_is_regex()), import_is_function = __toESM(require_is_function()), import_is_symbol = __toESM(require_is_symbol());
642
+ function isObject(t) {
643
+ return t != null && typeof t == "object" && Array.isArray(t) === !1;
644
+ }
645
+ o(isObject, "isObject");
646
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global, freeGlobal_default = freeGlobal, freeSelf = typeof self ==
647
+ "object" && self && self.Object === Object && self, root2 = freeGlobal_default || freeSelf || Function("return this")(), root_default = root2,
648
+ Symbol2 = root_default.Symbol, Symbol_default = Symbol2, objectProto = Object.prototype, hasOwnProperty = objectProto.hasOwnProperty, nativeObjectToString = objectProto.
649
+ toString, symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
650
+ function getRawTag(t) {
651
+ var e = hasOwnProperty.call(t, symToStringTag), r = t[symToStringTag];
652
+ try {
653
+ t[symToStringTag] = void 0;
654
+ var n = !0;
655
+ } catch {
656
+ }
657
+ var a = nativeObjectToString.call(t);
658
+ return n && (e ? t[symToStringTag] = r : delete t[symToStringTag]), a;
659
+ }
660
+ o(getRawTag, "getRawTag");
661
+ var getRawTag_default = getRawTag, objectProto2 = Object.prototype, nativeObjectToString2 = objectProto2.toString;
662
+ function objectToString(t) {
663
+ return nativeObjectToString2.call(t);
664
+ }
665
+ o(objectToString, "objectToString");
666
+ var objectToString_default = objectToString, nullTag = "[object Null]", undefinedTag = "[object Undefined]", symToStringTag2 = Symbol_default ?
667
+ Symbol_default.toStringTag : void 0;
668
+ function baseGetTag(t) {
669
+ return t == null ? t === void 0 ? undefinedTag : nullTag : symToStringTag2 && symToStringTag2 in Object(t) ? getRawTag_default(t) : objectToString_default(
670
+ t);
671
+ }
672
+ o(baseGetTag, "baseGetTag");
673
+ var baseGetTag_default = baseGetTag;
674
+ function isObjectLike(t) {
675
+ return t != null && typeof t == "object";
676
+ }
677
+ o(isObjectLike, "isObjectLike");
678
+ var isObjectLike_default = isObjectLike, symbolTag = "[object Symbol]";
679
+ function isSymbol(t) {
680
+ return typeof t == "symbol" || isObjectLike_default(t) && baseGetTag_default(t) == symbolTag;
681
+ }
682
+ o(isSymbol, "isSymbol");
683
+ var isSymbol_default = isSymbol;
684
+ function arrayMap(t, e) {
685
+ for (var r = -1, n = t == null ? 0 : t.length, a = Array(n); ++r < n; )
686
+ a[r] = e(t[r], r, t);
687
+ return a;
688
+ }
689
+ o(arrayMap, "arrayMap");
690
+ var arrayMap_default = arrayMap, isArray = Array.isArray, isArray_default = isArray, INFINITY = 1 / 0, symbolProto = Symbol_default ? Symbol_default.
691
+ prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
692
+ function baseToString(t) {
693
+ if (typeof t == "string")
694
+ return t;
695
+ if (isArray_default(t))
696
+ return arrayMap_default(t, baseToString) + "";
697
+ if (isSymbol_default(t))
698
+ return symbolToString ? symbolToString.call(t) : "";
699
+ var e = t + "";
700
+ return e == "0" && 1 / t == -INFINITY ? "-0" : e;
701
+ }
702
+ o(baseToString, "baseToString");
703
+ var baseToString_default = baseToString;
704
+ function isObject2(t) {
705
+ var e = typeof t;
706
+ return t != null && (e == "object" || e == "function");
707
+ }
708
+ o(isObject2, "isObject2");
709
+ var isObject_default = isObject2, asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]",
710
+ proxyTag = "[object Proxy]";
711
+ function isFunction(t) {
712
+ if (!isObject_default(t))
713
+ return !1;
714
+ var e = baseGetTag_default(t);
715
+ return e == funcTag || e == genTag || e == asyncTag || e == proxyTag;
716
+ }
717
+ o(isFunction, "isFunction");
718
+ var isFunction_default = isFunction, coreJsData = root_default["__core-js_shared__"], coreJsData_default = coreJsData, maskSrcKey = function() {
719
+ var t = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
720
+ return t ? "Symbol(src)_1." + t : "";
721
+ }();
722
+ function isMasked(t) {
723
+ return !!maskSrcKey && maskSrcKey in t;
724
+ }
725
+ o(isMasked, "isMasked");
726
+ var isMasked_default = isMasked, funcProto = Function.prototype, funcToString = funcProto.toString;
727
+ function toSource(t) {
728
+ if (t != null) {
729
+ try {
730
+ return funcToString.call(t);
731
+ } catch {
732
+ }
733
+ try {
734
+ return t + "";
735
+ } catch {
736
+ }
737
+ }
738
+ return "";
739
+ }
740
+ o(toSource, "toSource");
741
+ var toSource_default = toSource, reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reIsHostCtor = /^\[object .+?Constructor\]$/, funcProto2 = Function.
742
+ prototype, objectProto3 = Object.prototype, funcToString2 = funcProto2.toString, hasOwnProperty2 = objectProto3.hasOwnProperty, reIsNative = RegExp(
743
+ "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
744
+ "$1.*?") + "$"
745
+ );
746
+ function baseIsNative(t) {
747
+ if (!isObject_default(t) || isMasked_default(t))
748
+ return !1;
749
+ var e = isFunction_default(t) ? reIsNative : reIsHostCtor;
750
+ return e.test(toSource_default(t));
751
+ }
752
+ o(baseIsNative, "baseIsNative");
753
+ var baseIsNative_default = baseIsNative;
754
+ function getValue(t, e) {
755
+ return t?.[e];
756
+ }
757
+ o(getValue, "getValue");
758
+ var getValue_default = getValue;
759
+ function getNative(t, e) {
760
+ var r = getValue_default(t, e);
761
+ return baseIsNative_default(r) ? r : void 0;
762
+ }
763
+ o(getNative, "getNative");
764
+ var getNative_default = getNative;
765
+ function eq(t, e) {
766
+ return t === e || t !== t && e !== e;
767
+ }
768
+ o(eq, "eq");
769
+ var eq_default = eq, reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
770
+ function isKey(t, e) {
771
+ if (isArray_default(t))
772
+ return !1;
773
+ var r = typeof t;
774
+ return r == "number" || r == "symbol" || r == "boolean" || t == null || isSymbol_default(t) ? !0 : reIsPlainProp.test(t) || !reIsDeepProp.
775
+ test(t) || e != null && t in Object(e);
776
+ }
777
+ o(isKey, "isKey");
778
+ var isKey_default = isKey, nativeCreate = getNative_default(Object, "create"), nativeCreate_default = nativeCreate;
779
+ function hashClear() {
780
+ this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {}, this.size = 0;
781
+ }
782
+ o(hashClear, "hashClear");
783
+ var hashClear_default = hashClear;
784
+ function hashDelete(t) {
785
+ var e = this.has(t) && delete this.__data__[t];
786
+ return this.size -= e ? 1 : 0, e;
787
+ }
788
+ o(hashDelete, "hashDelete");
789
+ var hashDelete_default = hashDelete, HASH_UNDEFINED = "__lodash_hash_undefined__", objectProto4 = Object.prototype, hasOwnProperty3 = objectProto4.
790
+ hasOwnProperty;
791
+ function hashGet(t) {
792
+ var e = this.__data__;
793
+ if (nativeCreate_default) {
794
+ var r = e[t];
795
+ return r === HASH_UNDEFINED ? void 0 : r;
796
+ }
797
+ return hasOwnProperty3.call(e, t) ? e[t] : void 0;
798
+ }
799
+ o(hashGet, "hashGet");
800
+ var hashGet_default = hashGet, objectProto5 = Object.prototype, hasOwnProperty4 = objectProto5.hasOwnProperty;
801
+ function hashHas(t) {
802
+ var e = this.__data__;
803
+ return nativeCreate_default ? e[t] !== void 0 : hasOwnProperty4.call(e, t);
804
+ }
805
+ o(hashHas, "hashHas");
806
+ var hashHas_default = hashHas, HASH_UNDEFINED2 = "__lodash_hash_undefined__";
807
+ function hashSet(t, e) {
808
+ var r = this.__data__;
809
+ return this.size += this.has(t) ? 0 : 1, r[t] = nativeCreate_default && e === void 0 ? HASH_UNDEFINED2 : e, this;
810
+ }
811
+ o(hashSet, "hashSet");
812
+ var hashSet_default = hashSet;
813
+ function Hash(t) {
814
+ var e = -1, r = t == null ? 0 : t.length;
815
+ for (this.clear(); ++e < r; ) {
816
+ var n = t[e];
817
+ this.set(n[0], n[1]);
818
+ }
819
+ }
820
+ o(Hash, "Hash");
821
+ Hash.prototype.clear = hashClear_default;
822
+ Hash.prototype.delete = hashDelete_default;
823
+ Hash.prototype.get = hashGet_default;
824
+ Hash.prototype.has = hashHas_default;
825
+ Hash.prototype.set = hashSet_default;
826
+ var Hash_default = Hash;
827
+ function listCacheClear() {
828
+ this.__data__ = [], this.size = 0;
829
+ }
830
+ o(listCacheClear, "listCacheClear");
831
+ var listCacheClear_default = listCacheClear;
832
+ function assocIndexOf(t, e) {
833
+ for (var r = t.length; r--; )
834
+ if (eq_default(t[r][0], e))
835
+ return r;
836
+ return -1;
837
+ }
838
+ o(assocIndexOf, "assocIndexOf");
839
+ var assocIndexOf_default = assocIndexOf, arrayProto = Array.prototype, splice = arrayProto.splice;
840
+ function listCacheDelete(t) {
841
+ var e = this.__data__, r = assocIndexOf_default(e, t);
842
+ if (r < 0)
843
+ return !1;
844
+ var n = e.length - 1;
845
+ return r == n ? e.pop() : splice.call(e, r, 1), --this.size, !0;
846
+ }
847
+ o(listCacheDelete, "listCacheDelete");
848
+ var listCacheDelete_default = listCacheDelete;
849
+ function listCacheGet(t) {
850
+ var e = this.__data__, r = assocIndexOf_default(e, t);
851
+ return r < 0 ? void 0 : e[r][1];
852
+ }
853
+ o(listCacheGet, "listCacheGet");
854
+ var listCacheGet_default = listCacheGet;
855
+ function listCacheHas(t) {
856
+ return assocIndexOf_default(this.__data__, t) > -1;
857
+ }
858
+ o(listCacheHas, "listCacheHas");
859
+ var listCacheHas_default = listCacheHas;
860
+ function listCacheSet(t, e) {
861
+ var r = this.__data__, n = assocIndexOf_default(r, t);
862
+ return n < 0 ? (++this.size, r.push([t, e])) : r[n][1] = e, this;
863
+ }
864
+ o(listCacheSet, "listCacheSet");
865
+ var listCacheSet_default = listCacheSet;
866
+ function ListCache(t) {
867
+ var e = -1, r = t == null ? 0 : t.length;
868
+ for (this.clear(); ++e < r; ) {
869
+ var n = t[e];
870
+ this.set(n[0], n[1]);
871
+ }
872
+ }
873
+ o(ListCache, "ListCache");
874
+ ListCache.prototype.clear = listCacheClear_default;
875
+ ListCache.prototype.delete = listCacheDelete_default;
876
+ ListCache.prototype.get = listCacheGet_default;
877
+ ListCache.prototype.has = listCacheHas_default;
878
+ ListCache.prototype.set = listCacheSet_default;
879
+ var ListCache_default = ListCache, Map2 = getNative_default(root_default, "Map"), Map_default = Map2;
880
+ function mapCacheClear() {
881
+ this.size = 0, this.__data__ = {
882
+ hash: new Hash_default(),
883
+ map: new (Map_default || ListCache_default)(),
884
+ string: new Hash_default()
885
+ };
886
+ }
887
+ o(mapCacheClear, "mapCacheClear");
888
+ var mapCacheClear_default = mapCacheClear;
889
+ function isKeyable(t) {
890
+ var e = typeof t;
891
+ return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
892
+ }
893
+ o(isKeyable, "isKeyable");
894
+ var isKeyable_default = isKeyable;
895
+ function getMapData(t, e) {
896
+ var r = t.__data__;
897
+ return isKeyable_default(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
898
+ }
899
+ o(getMapData, "getMapData");
900
+ var getMapData_default = getMapData;
901
+ function mapCacheDelete(t) {
902
+ var e = getMapData_default(this, t).delete(t);
903
+ return this.size -= e ? 1 : 0, e;
904
+ }
905
+ o(mapCacheDelete, "mapCacheDelete");
906
+ var mapCacheDelete_default = mapCacheDelete;
907
+ function mapCacheGet(t) {
908
+ return getMapData_default(this, t).get(t);
909
+ }
910
+ o(mapCacheGet, "mapCacheGet");
911
+ var mapCacheGet_default = mapCacheGet;
912
+ function mapCacheHas(t) {
913
+ return getMapData_default(this, t).has(t);
914
+ }
915
+ o(mapCacheHas, "mapCacheHas");
916
+ var mapCacheHas_default = mapCacheHas;
917
+ function mapCacheSet(t, e) {
918
+ var r = getMapData_default(this, t), n = r.size;
919
+ return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
920
+ }
921
+ o(mapCacheSet, "mapCacheSet");
922
+ var mapCacheSet_default = mapCacheSet;
923
+ function MapCache(t) {
924
+ var e = -1, r = t == null ? 0 : t.length;
925
+ for (this.clear(); ++e < r; ) {
926
+ var n = t[e];
927
+ this.set(n[0], n[1]);
928
+ }
929
+ }
930
+ o(MapCache, "MapCache");
931
+ MapCache.prototype.clear = mapCacheClear_default;
932
+ MapCache.prototype.delete = mapCacheDelete_default;
933
+ MapCache.prototype.get = mapCacheGet_default;
934
+ MapCache.prototype.has = mapCacheHas_default;
935
+ MapCache.prototype.set = mapCacheSet_default;
936
+ var MapCache_default = MapCache, FUNC_ERROR_TEXT = "Expected a function";
937
+ function memoize(t, e) {
938
+ if (typeof t != "function" || e != null && typeof e != "function")
939
+ throw new TypeError(FUNC_ERROR_TEXT);
940
+ var r = /* @__PURE__ */ o(function() {
941
+ var n = arguments, a = e ? e.apply(this, n) : n[0], s = r.cache;
942
+ if (s.has(a))
943
+ return s.get(a);
944
+ var l = t.apply(this, n);
945
+ return r.cache = s.set(a, l) || s, l;
946
+ }, "memoized");
947
+ return r.cache = new (memoize.Cache || MapCache_default)(), r;
948
+ }
949
+ o(memoize, "memoize");
950
+ memoize.Cache = MapCache_default;
951
+ var memoize_default = memoize, MAX_MEMOIZE_SIZE = 500;
952
+ function memoizeCapped(t) {
953
+ var e = memoize_default(t, function(n) {
954
+ return r.size === MAX_MEMOIZE_SIZE && r.clear(), n;
955
+ }), r = e.cache;
956
+ return e;
957
+ }
958
+ o(memoizeCapped, "memoizeCapped");
959
+ var memoizeCapped_default = memoizeCapped, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,
960
+ reEscapeChar = /\\(\\)?/g, stringToPath = memoizeCapped_default(function(t) {
961
+ var e = [];
962
+ return t.charCodeAt(0) === 46 && e.push(""), t.replace(rePropName, function(r, n, a, s) {
963
+ e.push(a ? s.replace(reEscapeChar, "$1") : n || r);
964
+ }), e;
965
+ }), stringToPath_default = stringToPath;
966
+ function toString(t) {
967
+ return t == null ? "" : baseToString_default(t);
968
+ }
969
+ o(toString, "toString");
970
+ var toString_default = toString;
971
+ function castPath(t, e) {
972
+ return isArray_default(t) ? t : isKey_default(t, e) ? [t] : stringToPath_default(toString_default(t));
973
+ }
974
+ o(castPath, "castPath");
975
+ var castPath_default = castPath, INFINITY2 = 1 / 0;
976
+ function toKey(t) {
977
+ if (typeof t == "string" || isSymbol_default(t))
978
+ return t;
979
+ var e = t + "";
980
+ return e == "0" && 1 / t == -INFINITY2 ? "-0" : e;
981
+ }
982
+ o(toKey, "toKey");
983
+ var toKey_default = toKey;
984
+ function baseGet(t, e) {
985
+ e = castPath_default(e, t);
986
+ for (var r = 0, n = e.length; t != null && r < n; )
987
+ t = t[toKey_default(e[r++])];
988
+ return r && r == n ? t : void 0;
989
+ }
990
+ o(baseGet, "baseGet");
991
+ var baseGet_default = baseGet;
992
+ function get(t, e, r) {
993
+ var n = t == null ? void 0 : baseGet_default(t, e);
994
+ return n === void 0 ? r : n;
995
+ }
996
+ o(get, "get");
997
+ var get_default = get, import_memoizerific = __toESM(Ce()), eventProperties = [
998
+ "bubbles",
999
+ "cancelBubble",
1000
+ "cancelable",
1001
+ "composed",
1002
+ "currentTarget",
1003
+ "defaultPrevented",
1004
+ "eventPhase",
1005
+ "isTrusted",
1006
+ "returnValue",
1007
+ "srcElement",
1008
+ "target",
1009
+ "timeStamp",
1010
+ "type"
1011
+ ], customEventSpecificProperties = ["detail"];
1012
+ function extractEventHiddenProperties(t) {
1013
+ let e = eventProperties.filter((r) => t[r] !== void 0).reduce((r, n) => ({ ...r, [n]: t[n] }), {});
1014
+ return t instanceof CustomEvent && customEventSpecificProperties.filter((r) => t[r] !== void 0).forEach((r) => {
1015
+ e[r] = t[r];
1016
+ }), e;
1017
+ }
1018
+ o(extractEventHiddenProperties, "extractEventHiddenProperties");
1019
+ var isObject3 = isObject, removeCodeComments = /* @__PURE__ */ o((t) => {
1020
+ let e = null, r = !1, n = !1, a = !1, s = "";
1021
+ if (t.indexOf("//") >= 0 || t.indexOf("/*") >= 0)
1022
+ for (let l = 0; l < t.length; l += 1)
1023
+ !e && !r && !n && !a ? t[l] === '"' || t[l] === "'" || t[l] === "`" ? e = t[l] : t[l] === "/" && t[l + 1] === "*" ? r = !0 : t[l] ===
1024
+ "/" && t[l + 1] === "/" ? n = !0 : t[l] === "/" && t[l + 1] !== "/" && (a = !0) : (e && (t[l] === e && t[l - 1] !== "\\" || t[l] ===
1025
+ `
1026
+ ` && e !== "`") && (e = null), a && (t[l] === "/" && t[l - 1] !== "\\" || t[l] === `
1027
+ `) && (a = !1), r && t[l - 1] === "/" && t[l - 2] === "*" && (r = !1), n && t[l] === `
1028
+ ` && (n = !1)), !r && !n && (s += t[l]);
1029
+ else
1030
+ s = t;
1031
+ return s;
1032
+ }, "removeCodeComments"), cleanCode = (0, import_memoizerific.default)(1e4)(
1033
+ (t) => removeCodeComments(t).replace(/\n\s*/g, "").trim()
1034
+ ), convertShorthandMethods = /* @__PURE__ */ o(function(e, r) {
1035
+ let n = r.slice(0, r.indexOf("{")), a = r.slice(r.indexOf("{"));
1036
+ if (n.includes("=>") || n.includes("function"))
1037
+ return r;
1038
+ let s = n;
1039
+ return s = s.replace(e, "function"), s + a;
1040
+ }, "convertShorthandMethods2"), dateFormat = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/, isJSON = /* @__PURE__ */ o((t) => t.match(
1041
+ /^[\[\{\"\}].*[\]\}\"]$/), "isJSON");
1042
+ function convertUnconventionalData(t) {
1043
+ if (!isObject3(t))
1044
+ return t;
1045
+ let e = t, r = !1;
1046
+ return typeof Event < "u" && t instanceof Event && (e = extractEventHiddenProperties(e), r = !0), e = Object.keys(e).reduce((n, a) => {
1047
+ try {
1048
+ e[a] && e[a].toJSON, n[a] = e[a];
1049
+ } catch {
1050
+ r = !0;
1051
+ }
1052
+ return n;
1053
+ }, {}), r ? e : t;
1054
+ }
1055
+ o(convertUnconventionalData, "convertUnconventionalData");
1056
+ var replacer = /* @__PURE__ */ o(function(e) {
1057
+ let r, n, a, s;
1058
+ return /* @__PURE__ */ o(function(c, i) {
1059
+ try {
1060
+ if (c === "")
1061
+ return s = [], r = /* @__PURE__ */ new Map([[i, "[]"]]), n = /* @__PURE__ */ new Map(), a = [], i;
1062
+ let h = n.get(this) || this;
1063
+ for (; a.length && h !== a[0]; )
1064
+ a.shift(), s.pop();
1065
+ if (typeof i == "boolean")
1066
+ return i;
1067
+ if (i === void 0)
1068
+ return e.allowUndefined ? "_undefined_" : void 0;
1069
+ if (i === null)
1070
+ return null;
1071
+ if (typeof i == "number")
1072
+ return i === -1 / 0 ? "_-Infinity_" : i === 1 / 0 ? "_Infinity_" : Number.isNaN(i) ? "_NaN_" : i;
1073
+ if (typeof i == "bigint")
1074
+ return `_bigint_${i.toString()}`;
1075
+ if (typeof i == "string")
1076
+ return dateFormat.test(i) ? e.allowDate ? `_date_${i}` : void 0 : i;
1077
+ if ((0, import_is_regex.default)(i))
1078
+ return e.allowRegExp ? `_regexp_${i.flags}|${i.source}` : void 0;
1079
+ if ((0, import_is_function.default)(i)) {
1080
+ if (!e.allowFunction)
1081
+ return;
1082
+ let { name: p } = i, y = i.toString();
1083
+ return y.match(
1084
+ /(\[native code\]|WEBPACK_IMPORTED_MODULE|__webpack_exports__|__webpack_require__)/
1085
+ ) ? `_function_${p}|${(() => {
1086
+ }).toString()}` : `_function_${p}|${cleanCode(convertShorthandMethods(c, y))}`;
1087
+ }
1088
+ if ((0, import_is_symbol.default)(i)) {
1089
+ if (!e.allowSymbol)
1090
+ return;
1091
+ let p = Symbol.keyFor(i);
1092
+ return p !== void 0 ? `_gsymbol_${p}` : `_symbol_${i.toString().slice(7, -1)}`;
1093
+ }
1094
+ if (a.length >= e.maxDepth)
1095
+ return Array.isArray(i) ? `[Array(${i.length})]` : "[Object]";
1096
+ if (i === this)
1097
+ return `_duplicate_${JSON.stringify(s)}`;
1098
+ if (i instanceof Error && e.allowError)
1099
+ return {
1100
+ __isConvertedError__: !0,
1101
+ errorProperties: {
1102
+ ...i.cause ? { cause: i.cause } : {},
1103
+ ...i,
1104
+ name: i.name,
1105
+ message: i.message,
1106
+ stack: i.stack,
1107
+ "_constructor-name_": i.constructor.name
1108
+ }
1109
+ };
1110
+ if (i.constructor && i.constructor.name && i.constructor.name !== "Object" && !Array.isArray(i) && !e.allowClass)
1111
+ return;
1112
+ let u = r.get(i);
1113
+ if (!u) {
1114
+ let p = Array.isArray(i) ? i : convertUnconventionalData(i);
1115
+ if (i.constructor && i.constructor.name && i.constructor.name !== "Object" && !Array.isArray(i) && e.allowClass)
1116
+ try {
1117
+ Object.assign(p, { "_constructor-name_": i.constructor.name });
1118
+ } catch {
1119
+ }
1120
+ return s.push(c), a.unshift(p), r.set(i, JSON.stringify(s)), i !== p && n.set(i, p), p;
1121
+ }
1122
+ return `_duplicate_${u}`;
1123
+ } catch {
1124
+ return;
1125
+ }
1126
+ }, "replace");
1127
+ }, "replacer2"), reviver2 = /* @__PURE__ */ o(function reviver(options) {
1128
+ let refs = [], root;
1129
+ return /* @__PURE__ */ o(function revive(key, value) {
1130
+ if (key === "" && (root = value, refs.forEach(({ target: t, container: e, replacement: r }) => {
1131
+ let n = isJSON(r) ? JSON.parse(r) : r.split(".");
1132
+ n.length === 0 ? e[t] = root : e[t] = get_default(root, n);
1133
+ })), key === "_constructor-name_")
1134
+ return value;
1135
+ if (isObject3(value) && value.__isConvertedError__) {
1136
+ let { message: t, ...e } = value.errorProperties, r = new Error(t);
1137
+ return Object.assign(r, e), r;
1138
+ }
1139
+ if (isObject3(value) && value["_constructor-name_"] && options.allowFunction) {
1140
+ let t = value["_constructor-name_"];
1141
+ if (t !== "Object") {
1142
+ let e = new Function(`return function ${t.replace(/[^a-zA-Z0-9$_]+/g, "")}(){}`)();
1143
+ Object.setPrototypeOf(value, new e());
1144
+ }
1145
+ return delete value["_constructor-name_"], value;
1146
+ }
1147
+ if (typeof value == "string" && value.startsWith("_function_") && options.allowFunction) {
1148
+ let [, name, source] = value.match(/_function_([^|]*)\|(.*)/) || [], sourceSanitized = source.replace(/[(\(\))|\\| |\]|`]*$/, "");
1149
+ if (!options.lazyEval)
1150
+ return eval(`(${sourceSanitized})`);
1151
+ let result = /* @__PURE__ */ o((...args) => {
1152
+ let f = eval(`(${sourceSanitized})`);
1153
+ return f(...args);
1154
+ }, "result");
1155
+ return Object.defineProperty(result, "toString", {
1156
+ value: /* @__PURE__ */ o(() => sourceSanitized, "value")
1157
+ }), Object.defineProperty(result, "name", {
1158
+ value: name
1159
+ }), result;
1160
+ }
1161
+ if (typeof value == "string" && value.startsWith("_regexp_") && options.allowRegExp) {
1162
+ let [, t, e] = value.match(/_regexp_([^|]*)\|(.*)/) || [];
1163
+ return new RegExp(e, t);
1164
+ }
1165
+ return typeof value == "string" && value.startsWith("_date_") && options.allowDate ? new Date(value.replace("_date_", "")) : typeof value ==
1166
+ "string" && value.startsWith("_duplicate_") ? (refs.push({ target: key, container: this, replacement: value.replace(/^_duplicate_/, "") }),
1167
+ null) : typeof value == "string" && value.startsWith("_symbol_") && options.allowSymbol ? Symbol(value.replace("_symbol_", "")) : typeof value ==
1168
+ "string" && value.startsWith("_gsymbol_") && options.allowSymbol ? Symbol.for(value.replace("_gsymbol_", "")) : typeof value == "strin\
1169
+ g" && value === "_-Infinity_" ? -1 / 0 : typeof value == "string" && value === "_Infinity_" ? 1 / 0 : typeof value == "string" && value === "\
1170
+ _NaN_" ? NaN : typeof value == "string" && value.startsWith("_bigint_") && typeof BigInt == "function" ? BigInt(value.replace("_bigint_", "")) :
1171
+ value;
1172
+ }, "revive");
1173
+ }, "reviver"), defaultOptions = {
1174
+ maxDepth: 10,
1175
+ space: void 0,
1176
+ allowFunction: !0,
1177
+ allowRegExp: !0,
1178
+ allowDate: !0,
1179
+ allowClass: !0,
1180
+ allowError: !0,
1181
+ allowUndefined: !0,
1182
+ allowSymbol: !0,
1183
+ lazyEval: !0
1184
+ }, stringify = /* @__PURE__ */ o((t, e = {}) => {
1185
+ let r = { ...defaultOptions, ...e };
1186
+ return JSON.stringify(convertUnconventionalData(t), replacer(r), e.space);
1187
+ }, "stringify"), mutator = /* @__PURE__ */ o(() => {
1188
+ let t = /* @__PURE__ */ new Map();
1189
+ return /* @__PURE__ */ o(function e(r) {
1190
+ isObject3(r) && Object.entries(r).forEach(([n, a]) => {
1191
+ a === "_undefined_" ? r[n] = void 0 : t.get(a) || (t.set(a, !0), e(a));
1192
+ }), Array.isArray(r) && r.forEach((n, a) => {
1193
+ n === "_undefined_" ? (t.set(n, !0), r[a] = void 0) : t.get(n) || (t.set(n, !0), e(n));
1194
+ });
1195
+ }, "mutateUndefined");
1196
+ }, "mutator"), parse = /* @__PURE__ */ o((t, e = {}) => {
1197
+ let r = { ...defaultOptions, ...e }, n = JSON.parse(t, reviver2(r));
1198
+ return mutator()(n), n;
1199
+ }, "parse");
1200
+ });
1201
+
1202
+ // src/channels/index.ts
1203
+ var lt = {};
1204
+ ke(lt, {
1205
+ Channel: () => $,
1206
+ HEARTBEAT_INTERVAL: () => pe,
1207
+ HEARTBEAT_MAX_LATENCY: () => ue,
1208
+ PostMessageTransport: () => G,
1209
+ WebsocketTransport: () => W,
1210
+ createBrowserChannel: () => st,
1211
+ default: () => it
1212
+ });
1213
+ module.exports = Ge(lt);
1214
+ var Ie = I(te(), 1);
1215
+
1216
+ // src/shared/universal-store/index.ts
1217
+ var R = I(me(), 1);
1218
+
1219
+ // src/shared/universal-store/instances.ts
1220
+ var ae = /* @__PURE__ */ new Map();
1221
+
1222
+ // src/shared/universal-store/index.ts
1223
+ var Ke = "UNIVERSAL_STORE:", C = {
1224
+ PENDING: "PENDING",
1225
+ RESOLVED: "RESOLVED",
1226
+ REJECTED: "REJECTED"
1227
+ }, U = class t {
1228
+ constructor(e, r) {
1229
+ /** Enable debug logs for this store */
1230
+ this.debugging = !1;
1231
+ // TODO: narrow type of listeners based on event type
1232
+ this.listeners = /* @__PURE__ */ new Map([["*", /* @__PURE__ */ new Set()]]);
1233
+ /** Gets the current state */
1234
+ this.getState = /* @__PURE__ */ o(() => (this.debug("getState", { state: this.state }), this.state), "getState");
1235
+ /**
1236
+ * Subscribes to store events
1237
+ *
1238
+ * @returns A function to unsubscribe
1239
+ */
1240
+ this.subscribe = /* @__PURE__ */ o((e, r) => {
1241
+ let n = typeof e == "function", a = n ? "*" : e, s = n ? e : r;
1242
+ if (this.debug("subscribe", { eventType: a, listener: s }), !s)
1243
+ throw new TypeError(
1244
+ `Missing first subscribe argument, or second if first is the event type, when subscribing to a UniversalStore with id '${this.id}'`
1245
+ );
1246
+ return this.listeners.has(a) || this.listeners.set(a, /* @__PURE__ */ new Set()), this.listeners.get(a).add(s), () => {
1247
+ this.debug("unsubscribe", { eventType: a, listener: s }), this.listeners.has(a) && (this.listeners.get(a).delete(s), this.listeners.
1248
+ get(a)?.size === 0 && this.listeners.delete(a));
1249
+ };
1250
+ }, "subscribe");
1251
+ /** Sends a custom event to the other stores */
1252
+ this.send = /* @__PURE__ */ o((e) => {
1253
+ if (this.debug("send", { event: e }), this.status !== t.Status.READY)
1254
+ throw new TypeError(
1255
+ R.dedent`Cannot send event before store is ready. You can get the current status with store.status,
1256
+ or await store.readyPromise to wait for the store to be ready before sending events.
1257
+ ${JSON.stringify(
1258
+ {
1259
+ event: e,
1260
+ id: this.id,
1261
+ actor: this.actor,
1262
+ environment: this.environment
1263
+ },
1264
+ null,
1265
+ 2
1266
+ )}`
1267
+ );
1268
+ this.emitToListeners(e, { actor: this.actor }), this.emitToChannel(e, { actor: this.actor });
1269
+ }, "send");
1270
+ if (this.debugging = e.debug ?? !1, !t.isInternalConstructing)
1271
+ throw new TypeError(
1272
+ "UniversalStore is not constructable - use UniversalStore.create() instead"
1273
+ );
1274
+ if (t.isInternalConstructing = !1, this.id = e.id, this.actorId = globalThis.crypto ? globalThis.crypto.randomUUID() : (
1275
+ // TODO: remove this fallback in SB 9.0 when we no longer support Node 18
1276
+ Date.now().toString(36) + Math.random().toString(36).substring(2)
1277
+ ), this.actorType = e.leader ? t.ActorType.LEADER : t.ActorType.FOLLOWER, this.state = e.initialState, this.channelEventName = `${Ke}${this.
1278
+ id}`, this.debug("constructor", {
1279
+ options: e,
1280
+ environmentOverrides: r,
1281
+ channelEventName: this.channelEventName
1282
+ }), this.actor.type === t.ActorType.LEADER)
1283
+ this.syncing = {
1284
+ state: C.RESOLVED,
1285
+ promise: Promise.resolve()
1286
+ };
1287
+ else {
1288
+ let n, a, s = new Promise((l, c) => {
1289
+ n = /* @__PURE__ */ o(() => {
1290
+ this.syncing.state === C.PENDING && (this.syncing.state = C.RESOLVED, l());
1291
+ }, "syncingResolve"), a = /* @__PURE__ */ o((i) => {
1292
+ this.syncing.state === C.PENDING && (this.syncing.state = C.REJECTED, c(i));
1293
+ }, "syncingReject");
1294
+ });
1295
+ this.syncing = {
1296
+ state: C.PENDING,
1297
+ promise: s,
1298
+ resolve: n,
1299
+ reject: a
1300
+ };
1301
+ }
1302
+ this.getState = this.getState.bind(this), this.setState = this.setState.bind(this), this.subscribe = this.subscribe.bind(this), this.onStateChange =
1303
+ this.onStateChange.bind(this), this.send = this.send.bind(this), this.emitToChannel = this.emitToChannel.bind(this), this.prepareThis = this.
1304
+ prepareThis.bind(this), this.emitToListeners = this.emitToListeners.bind(this), this.handleChannelEvents = this.handleChannelEvents.bind(
1305
+ this), this.debug = this.debug.bind(this), this.channel = r?.channel ?? t.preparation.channel, this.environment = r?.environment ?? t.preparation.
1306
+ environment, this.channel && this.environment ? this.prepareThis({ channel: this.channel, environment: this.environment }) : t.preparation.
1307
+ promise.then(this.prepareThis);
1308
+ }
1309
+ static {
1310
+ o(this, "UniversalStore");
1311
+ }
1312
+ static {
1313
+ /**
1314
+ * Defines the possible actor types in the store system
1315
+ *
1316
+ * @readonly
1317
+ */
1318
+ this.ActorType = {
1319
+ LEADER: "LEADER",
1320
+ FOLLOWER: "FOLLOWER"
1321
+ };
1322
+ }
1323
+ static {
1324
+ /**
1325
+ * Defines the possible environments the store can run in
1326
+ *
1327
+ * @readonly
1328
+ */
1329
+ this.Environment = {
1330
+ SERVER: "SERVER",
1331
+ MANAGER: "MANAGER",
1332
+ PREVIEW: "PREVIEW",
1333
+ UNKNOWN: "UNKNOWN",
1334
+ MOCK: "MOCK"
1335
+ };
1336
+ }
1337
+ static {
1338
+ /**
1339
+ * Internal event types used for store synchronization
1340
+ *
1341
+ * @readonly
1342
+ */
1343
+ this.InternalEventType = {
1344
+ EXISTING_STATE_REQUEST: "__EXISTING_STATE_REQUEST",
1345
+ EXISTING_STATE_RESPONSE: "__EXISTING_STATE_RESPONSE",
1346
+ SET_STATE: "__SET_STATE",
1347
+ LEADER_CREATED: "__LEADER_CREATED",
1348
+ FOLLOWER_CREATED: "__FOLLOWER_CREATED"
1349
+ };
1350
+ }
1351
+ static {
1352
+ this.Status = {
1353
+ UNPREPARED: "UNPREPARED",
1354
+ SYNCING: "SYNCING",
1355
+ READY: "READY",
1356
+ ERROR: "ERROR"
1357
+ };
1358
+ }
1359
+ static {
1360
+ // This is used to check if constructor was called from the static factory create()
1361
+ this.isInternalConstructing = !1;
1362
+ }
1363
+ static {
1364
+ t.setupPreparationPromise();
1365
+ }
1366
+ static setupPreparationPromise() {
1367
+ let e, r, n = new Promise(
1368
+ (a, s) => {
1369
+ e = /* @__PURE__ */ o((l) => {
1370
+ a(l);
1371
+ }, "resolveRef"), r = /* @__PURE__ */ o((...l) => {
1372
+ s(l);
1373
+ }, "rejectRef");
1374
+ }
1375
+ );
1376
+ t.preparation = {
1377
+ resolve: e,
1378
+ reject: r,
1379
+ promise: n
1380
+ };
1381
+ }
1382
+ /** The actor object representing the store instance with a unique ID and a type */
1383
+ get actor() {
1384
+ return Object.freeze({
1385
+ id: this.actorId,
1386
+ type: this.actorType,
1387
+ environment: this.environment ?? t.Environment.UNKNOWN
1388
+ });
1389
+ }
1390
+ /**
1391
+ * The current state of the store, that signals both if the store is prepared by Storybook and
1392
+ * also - in the case of a follower - if the state has been synced with the leader's state.
1393
+ */
1394
+ get status() {
1395
+ if (!this.channel || !this.environment)
1396
+ return t.Status.UNPREPARED;
1397
+ switch (this.syncing?.state) {
1398
+ case C.PENDING:
1399
+ case void 0:
1400
+ return t.Status.SYNCING;
1401
+ case C.REJECTED:
1402
+ return t.Status.ERROR;
1403
+ case C.RESOLVED:
1404
+ default:
1405
+ return t.Status.READY;
1406
+ }
1407
+ }
1408
+ /**
1409
+ * A promise that resolves when the store is fully ready. A leader will be ready when the store
1410
+ * has been prepared by Storybook, which is almost instantly.
1411
+ *
1412
+ * A follower will be ready when the state has been synced with the leader's state, within a few
1413
+ * hundred milliseconds.
1414
+ */
1415
+ untilReady() {
1416
+ return Promise.all([t.preparation.promise, this.syncing?.promise]);
1417
+ }
1418
+ /** Creates a new instance of UniversalStore */
1419
+ static create(e) {
1420
+ if (!e || typeof e?.id != "string")
1421
+ throw new TypeError("id is required and must be a string, when creating a UniversalStore");
1422
+ e.debug && console.debug(
1423
+ R.dedent`[UniversalStore]
1424
+ create`,
1425
+ { options: e }
1426
+ );
1427
+ let r = ae.get(e.id);
1428
+ if (r)
1429
+ return console.warn(R.dedent`UniversalStore with id "${e.id}" already exists in this environment, re-using existing.
1430
+ You should reuse the existing instance instead of trying to create a new one.`), r;
1431
+ t.isInternalConstructing = !0;
1432
+ let n = new t(e);
1433
+ return ae.set(e.id, n), n;
1434
+ }
1435
+ /**
1436
+ * Used by Storybook to set the channel for all instances of UniversalStore in the given
1437
+ * environment.
1438
+ *
1439
+ * @internal
1440
+ */
1441
+ static __prepare(e, r) {
1442
+ t.preparation.channel = e, t.preparation.environment = r, t.preparation.resolve({ channel: e, environment: r });
1443
+ }
1444
+ /**
1445
+ * Updates the store's state
1446
+ *
1447
+ * Either a new state or a state updater function can be passed to the method.
1448
+ */
1449
+ setState(e) {
1450
+ let r = this.state, n = typeof e == "function" ? e(r) : e;
1451
+ if (this.debug("setState", { newState: n, previousState: r, updater: e }), this.status !== t.Status.READY)
1452
+ throw new TypeError(
1453
+ R.dedent`Cannot set state before store is ready. You can get the current status with store.status,
1454
+ or await store.readyPromise to wait for the store to be ready before sending events.
1455
+ ${JSON.stringify(
1456
+ {
1457
+ newState: n,
1458
+ id: this.id,
1459
+ actor: this.actor,
1460
+ environment: this.environment
1461
+ },
1462
+ null,
1463
+ 2
1464
+ )}`
1465
+ );
1466
+ this.state = n;
1467
+ let a = {
1468
+ type: t.InternalEventType.SET_STATE,
1469
+ payload: {
1470
+ state: n,
1471
+ previousState: r
1472
+ }
1473
+ };
1474
+ this.emitToChannel(a, { actor: this.actor }), this.emitToListeners(a, { actor: this.actor });
1475
+ }
1476
+ /**
1477
+ * Subscribes to state changes
1478
+ *
1479
+ * @returns Unsubscribe function
1480
+ */
1481
+ onStateChange(e) {
1482
+ return this.debug("onStateChange", { listener: e }), this.subscribe(
1483
+ t.InternalEventType.SET_STATE,
1484
+ ({ payload: r }, n) => {
1485
+ e(r.state, r.previousState, n);
1486
+ }
1487
+ );
1488
+ }
1489
+ emitToChannel(e, r) {
1490
+ this.debug("emitToChannel", { event: e, eventInfo: r, channel: !!this.channel }), this.channel?.emit(this.channelEventName, {
1491
+ event: e,
1492
+ eventInfo: r
1493
+ });
1494
+ }
1495
+ prepareThis({
1496
+ channel: e,
1497
+ environment: r
1498
+ }) {
1499
+ this.channel = e, this.environment = r, this.debug("prepared", { channel: !!e, environment: r }), this.channel.on(this.channelEventName,
1500
+ this.handleChannelEvents), this.actor.type === t.ActorType.LEADER ? this.emitToChannel(
1501
+ { type: t.InternalEventType.LEADER_CREATED },
1502
+ { actor: this.actor }
1503
+ ) : (this.emitToChannel(
1504
+ { type: t.InternalEventType.FOLLOWER_CREATED },
1505
+ { actor: this.actor }
1506
+ ), this.emitToChannel(
1507
+ { type: t.InternalEventType.EXISTING_STATE_REQUEST },
1508
+ { actor: this.actor }
1509
+ ), setTimeout(() => {
1510
+ this.syncing.reject(
1511
+ new TypeError(
1512
+ `No existing state found for follower with id: '${this.id}'. Make sure a leader with the same id exists before creating a follower\
1513
+ .`
1514
+ )
1515
+ );
1516
+ }, 1e3));
1517
+ }
1518
+ emitToListeners(e, r) {
1519
+ let n = this.listeners.get(e.type), a = this.listeners.get("*");
1520
+ this.debug("emitToListeners", {
1521
+ event: e,
1522
+ eventInfo: r,
1523
+ eventTypeListeners: n,
1524
+ everythingListeners: a
1525
+ }), [...n ?? [], ...a ?? []].forEach(
1526
+ (s) => s(e, r)
1527
+ );
1528
+ }
1529
+ handleChannelEvents(e) {
1530
+ let { event: r, eventInfo: n } = e;
1531
+ if ([n.actor.id, n.forwardingActor?.id].includes(this.actor.id)) {
1532
+ this.debug("handleChannelEvents: Ignoring event from self", { channelEvent: e });
1533
+ return;
1534
+ } else if (this.syncing?.state === C.PENDING && r.type !== t.InternalEventType.EXISTING_STATE_RESPONSE) {
1535
+ this.debug("handleChannelEvents: Ignoring event while syncing", { channelEvent: e });
1536
+ return;
1537
+ }
1538
+ if (this.debug("handleChannelEvents", { channelEvent: e }), this.actor.type === t.ActorType.LEADER) {
1539
+ let a = !0;
1540
+ switch (r.type) {
1541
+ case t.InternalEventType.EXISTING_STATE_REQUEST:
1542
+ a = !1;
1543
+ let s = {
1544
+ type: t.InternalEventType.EXISTING_STATE_RESPONSE,
1545
+ payload: this.state
1546
+ };
1547
+ this.debug("handleChannelEvents: responding to existing state request", {
1548
+ responseEvent: s
1549
+ }), this.emitToChannel(s, { actor: this.actor });
1550
+ break;
1551
+ case t.InternalEventType.LEADER_CREATED:
1552
+ a = !1, this.syncing.state = C.REJECTED, this.debug("handleChannelEvents: erroring due to second leader being created", {
1553
+ event: r
1554
+ }), console.error(
1555
+ R.dedent`Detected multiple UniversalStore leaders created with the same id "${this.id}".
1556
+ Only one leader can exists at a time, your stores are now in an invalid state.
1557
+ Leaders detected:
1558
+ this: ${JSON.stringify(this.actor, null, 2)}
1559
+ other: ${JSON.stringify(n.actor, null, 2)}`
1560
+ );
1561
+ break;
1562
+ }
1563
+ a && (this.debug("handleChannelEvents: forwarding event", { channelEvent: e }), this.emitToChannel(r, { actor: n.actor, forwardingActor: this.
1564
+ actor }));
1565
+ }
1566
+ if (this.actor.type === t.ActorType.FOLLOWER)
1567
+ switch (r.type) {
1568
+ case t.InternalEventType.EXISTING_STATE_RESPONSE:
1569
+ if (this.debug("handleChannelEvents: Setting state from leader's existing state response", {
1570
+ event: r
1571
+ }), this.syncing?.state !== C.PENDING)
1572
+ break;
1573
+ this.syncing.resolve?.();
1574
+ let a = {
1575
+ type: t.InternalEventType.SET_STATE,
1576
+ payload: {
1577
+ state: r.payload,
1578
+ previousState: this.state
1579
+ }
1580
+ };
1581
+ this.state = r.payload, this.emitToListeners(a, n);
1582
+ break;
1583
+ }
1584
+ switch (r.type) {
1585
+ case t.InternalEventType.SET_STATE:
1586
+ this.debug("handleChannelEvents: Setting state", { event: r }), this.state = r.payload.state;
1587
+ break;
1588
+ }
1589
+ this.emitToListeners(r, { actor: n.actor });
1590
+ }
1591
+ debug(e, r) {
1592
+ this.debugging && console.debug(
1593
+ R.dedent`[UniversalStore::${this.id}::${this.environment ?? t.Environment.UNKNOWN}]
1594
+ ${e}`,
1595
+ JSON.stringify(
1596
+ {
1597
+ data: r,
1598
+ actor: this.actor,
1599
+ state: this.state,
1600
+ status: this.status
1601
+ },
1602
+ null,
1603
+ 2
1604
+ )
1605
+ );
1606
+ }
1607
+ /**
1608
+ * Used to reset the static fields of the UniversalStore class when cleaning up tests
1609
+ *
1610
+ * @internal
1611
+ */
1612
+ static __reset() {
1613
+ t.preparation.reject(new Error("reset")), t.setupPreparationPromise(), t.isInternalConstructing = !1;
1614
+ }
1615
+ };
1616
+
1617
+ // src/channels/main.ts
1618
+ var Ye = /* @__PURE__ */ o((t) => t.transports !== void 0, "isMulti"), Xe = /* @__PURE__ */ o(() => Math.random().toString(16).slice(2), "ge\
1619
+ nerateRandomId"), $ = class {
1620
+ constructor(e = {}) {
1621
+ this.sender = Xe();
1622
+ this.events = {};
1623
+ this.data = {};
1624
+ this.transports = [];
1625
+ this.isAsync = e.async || !1, Ye(e) ? (this.transports = e.transports || [], this.transports.forEach((r) => {
1626
+ r.setHandler((n) => this.handleEvent(n));
1627
+ })) : this.transports = e.transport ? [e.transport] : [], this.transports.forEach((r) => {
1628
+ r.setHandler((n) => this.handleEvent(n));
1629
+ });
1630
+ }
1631
+ static {
1632
+ o(this, "Channel");
1633
+ }
1634
+ get hasTransport() {
1635
+ return this.transports.length > 0;
1636
+ }
1637
+ addListener(e, r) {
1638
+ this.events[e] = this.events[e] || [], this.events[e].push(r);
1639
+ }
1640
+ emit(e, ...r) {
1641
+ let n = { type: e, args: r, from: this.sender }, a = {};
1642
+ r.length >= 1 && r[0] && r[0].options && (a = r[0].options);
1643
+ let s = /* @__PURE__ */ o(() => {
1644
+ this.transports.forEach((l) => {
1645
+ l.send(n, a);
1646
+ }), this.handleEvent(n);
1647
+ }, "handler");
1648
+ this.isAsync ? setImmediate(s) : s();
1649
+ }
1650
+ last(e) {
1651
+ return this.data[e];
1652
+ }
1653
+ eventNames() {
1654
+ return Object.keys(this.events);
1655
+ }
1656
+ listenerCount(e) {
1657
+ let r = this.listeners(e);
1658
+ return r ? r.length : 0;
1659
+ }
1660
+ listeners(e) {
1661
+ return this.events[e] || void 0;
1662
+ }
1663
+ once(e, r) {
1664
+ let n = this.onceListener(e, r);
1665
+ this.addListener(e, n);
1666
+ }
1667
+ removeAllListeners(e) {
1668
+ e ? this.events[e] && delete this.events[e] : this.events = {};
1669
+ }
1670
+ removeListener(e, r) {
1671
+ let n = this.listeners(e);
1672
+ n && (this.events[e] = n.filter((a) => a !== r));
1673
+ }
1674
+ on(e, r) {
1675
+ this.addListener(e, r);
1676
+ }
1677
+ off(e, r) {
1678
+ this.removeListener(e, r);
1679
+ }
1680
+ handleEvent(e) {
1681
+ let r = this.listeners(e.type);
1682
+ r && r.length && r.forEach((n) => {
1683
+ n.apply(e, e.args);
1684
+ }), this.data[e.type] = e.args;
1685
+ }
1686
+ onceListener(e, r) {
1687
+ let n = /* @__PURE__ */ o((...a) => (this.removeListener(e, n), r(...a)), "onceListener");
1688
+ return n;
1689
+ }
1690
+ };
1691
+
1692
+ // src/channels/postmessage/index.ts
1693
+ var k = require("storybook/internal/client-logger"), rt = I(require("storybook/internal/core-events"), 1), _ = I(te(), 1), H = I(oe(), 1);
1694
+
1695
+ // ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1696
+ var tt = process.env.NODE_ENV === "production", ie = "Invariant failed";
1697
+ function V(t, e) {
1698
+ if (!t) {
1699
+ if (tt)
1700
+ throw new Error(ie);
1701
+ var r = typeof e == "function" ? e() : e, n = r ? "".concat(ie, ": ").concat(r) : ie;
1702
+ throw new Error(n);
1703
+ }
1704
+ }
1705
+ o(V, "invariant");
1706
+
1707
+ // src/channels/postmessage/getEventSourceUrl.ts
1708
+ var Ae = require("storybook/internal/client-logger");
1709
+ var Oe = /* @__PURE__ */ o((t) => {
1710
+ let e = Array.from(
1711
+ document.querySelectorAll("iframe[data-is-storybook]")
1712
+ ), [r, ...n] = e.filter((s) => {
1713
+ try {
1714
+ return s.contentWindow?.location.origin === t.source.location.origin && s.contentWindow?.location.pathname === t.source.location.pathname;
1715
+ } catch {
1716
+ }
1717
+ try {
1718
+ return s.contentWindow === t.source;
1719
+ } catch {
1720
+ }
1721
+ let l = s.getAttribute("src"), c;
1722
+ try {
1723
+ if (!l)
1724
+ return !1;
1725
+ ({ origin: c } = new URL(l, document.location.toString()));
1726
+ } catch {
1727
+ return !1;
1728
+ }
1729
+ return c === t.origin;
1730
+ }), a = r?.getAttribute("src");
1731
+ if (a && n.length === 0) {
1732
+ let { protocol: s, host: l, pathname: c } = new URL(a, document.location.toString());
1733
+ return `${s}//${l}${c}`;
1734
+ }
1735
+ return n.length > 0 && Ae.logger.error("found multiple candidates for event source"), null;
1736
+ }, "getEventSourceUrl");
1737
+
1738
+ // src/channels/postmessage/index.ts
1739
+ var { document: se, location: le } = _.global, we = "storybook-channel", nt = { allowFunction: !1, maxDepth: 25 }, G = class {
1740
+ constructor(e) {
1741
+ this.config = e;
1742
+ this.connected = !1;
1743
+ if (this.buffer = [], typeof _.global?.addEventListener == "function" && _.global.addEventListener("message", this.handleEvent.bind(this),
1744
+ !1), e.page !== "manager" && e.page !== "preview")
1745
+ throw new Error(`postmsg-channel: "config.page" cannot be "${e.page}"`);
1746
+ }
1747
+ static {
1748
+ o(this, "PostMessageTransport");
1749
+ }
1750
+ setHandler(e) {
1751
+ this.handler = (...r) => {
1752
+ e.apply(this, r), !this.connected && this.getLocalFrame().length && (this.flush(), this.connected = !0);
1753
+ };
1754
+ }
1755
+ /**
1756
+ * Sends `event` to the associated window. If the window does not yet exist the event will be
1757
+ * stored in a buffer and sent when the window exists.
1758
+ *
1759
+ * @param event
1760
+ */
1761
+ send(e, r) {
1762
+ let {
1763
+ target: n,
1764
+ // telejson options
1765
+ allowRegExp: a,
1766
+ allowFunction: s,
1767
+ allowSymbol: l,
1768
+ allowDate: c,
1769
+ allowError: i,
1770
+ allowUndefined: h,
1771
+ allowClass: u,
1772
+ maxDepth: p,
1773
+ space: y,
1774
+ lazyEval: d
1775
+ } = r || {}, v = Object.fromEntries(
1776
+ Object.entries({
1777
+ allowRegExp: a,
1778
+ allowFunction: s,
1779
+ allowSymbol: l,
1780
+ allowDate: c,
1781
+ allowError: i,
1782
+ allowUndefined: h,
1783
+ allowClass: u,
1784
+ maxDepth: p,
1785
+ space: y,
1786
+ lazyEval: d
1787
+ }).filter(([D, L]) => typeof L < "u")
1788
+ ), w = {
1789
+ ...nt,
1790
+ ..._.global.CHANNEL_OPTIONS || {},
1791
+ ...v
1792
+ }, T = this.getFrames(n), N = new URLSearchParams(le?.search || ""), j = (0, H.stringify)(
1793
+ {
1794
+ key: we,
1795
+ event: e,
1796
+ refId: N.get("refId")
1797
+ },
1798
+ w
1799
+ );
1800
+ return T.length ? (this.buffer.length && this.flush(), T.forEach((D) => {
1801
+ try {
1802
+ D.postMessage(j, "*");
1803
+ } catch {
1804
+ k.logger.error("sending over postmessage fail");
1805
+ }
1806
+ }), Promise.resolve(null)) : new Promise((D, L) => {
1807
+ this.buffer.push({ event: e, resolve: D, reject: L });
1808
+ });
1809
+ }
1810
+ flush() {
1811
+ let { buffer: e } = this;
1812
+ this.buffer = [], e.forEach((r) => {
1813
+ this.send(r.event).then(r.resolve).catch(r.reject);
1814
+ });
1815
+ }
1816
+ getFrames(e) {
1817
+ if (this.config.page === "manager") {
1818
+ let n = Array.from(
1819
+ se.querySelectorAll("iframe[data-is-storybook][data-is-loaded]")
1820
+ ).flatMap((a) => {
1821
+ try {
1822
+ return a.contentWindow && a.dataset.isStorybook !== void 0 && a.id === e ? [a.contentWindow] : [];
1823
+ } catch {
1824
+ return [];
1825
+ }
1826
+ });
1827
+ return n?.length ? n : this.getCurrentFrames();
1828
+ }
1829
+ return _.global && _.global.parent && _.global.parent !== _.global.self ? [_.global.parent] : [];
1830
+ }
1831
+ getCurrentFrames() {
1832
+ return this.config.page === "manager" ? Array.from(
1833
+ se.querySelectorAll('[data-is-storybook="true"]')
1834
+ ).flatMap((r) => r.contentWindow ? [r.contentWindow] : []) : _.global && _.global.parent ? [_.global.parent] : [];
1835
+ }
1836
+ getLocalFrame() {
1837
+ return this.config.page === "manager" ? Array.from(
1838
+ se.querySelectorAll("#storybook-preview-iframe")
1839
+ ).flatMap((r) => r.contentWindow ? [r.contentWindow] : []) : _.global && _.global.parent ? [_.global.parent] : [];
1840
+ }
1841
+ handleEvent(e) {
1842
+ try {
1843
+ let { data: r } = e, { key: n, event: a, refId: s } = typeof r == "string" && (0, H.isJSON)(r) ? (0, H.parse)(r, _.global.CHANNEL_OPTIONS ||
1844
+ {}) : r;
1845
+ if (n === we) {
1846
+ let l = this.config.page === "manager" ? '<span style="color: #37D5D3; background: black"> manager </span>' : '<span style="color: #\
1847
+ 1EA7FD; background: black"> preview </span>', c = Object.values(rt).includes(a.type) ? `<span style="color: #FF4785">${a.type}</span>` : `<s\
1848
+ pan style="color: #FFAE00">${a.type}</span>`;
1849
+ if (s && (a.refId = s), a.source = this.config.page === "preview" ? e.origin : Oe(e), !a.source) {
1850
+ k.pretty.error(
1851
+ `${l} received ${c} but was unable to determine the source of the event`
1852
+ );
1853
+ return;
1854
+ }
1855
+ let i = `${l} received ${c} (${r.length})`;
1856
+ k.pretty.debug(
1857
+ le.origin !== a.source ? i : `${i} <span style="color: gray">(on ${le.origin} from ${a.source})</span>`,
1858
+ ...a.args
1859
+ ), V(this.handler, "ChannelHandler should be set"), this.handler(a);
1860
+ }
1861
+ } catch (r) {
1862
+ k.logger.error(r);
1863
+ }
1864
+ }
1865
+ };
1866
+
1867
+ // src/channels/websocket/index.ts
1868
+ var Pe = I(require("storybook/internal/core-events"), 1), ce = I(te(), 1), q = I(oe(), 1);
1869
+ var { WebSocket: at } = ce.global, pe = 15e3, ue = 5e3, W = class {
1870
+ constructor({ url: e, onError: r, page: n }) {
1871
+ this.buffer = [];
1872
+ this.isReady = !1;
1873
+ this.isClosed = !1;
1874
+ this.pingTimeout = 0;
1875
+ this.socket = new at(e), this.socket.onopen = () => {
1876
+ this.isReady = !0, this.heartbeat(), this.flush();
1877
+ }, this.socket.onmessage = ({ data: a }) => {
1878
+ let s = typeof a == "string" && (0, q.isJSON)(a) ? (0, q.parse)(a) : a;
1879
+ V(this.handler, "WebsocketTransport handler should be set"), this.handler(s), s.type === "ping" && (this.heartbeat(), this.send({ type: "\
1880
+ pong" }));
1881
+ }, this.socket.onerror = (a) => {
1882
+ r && r(a);
1883
+ }, this.socket.onclose = (a) => {
1884
+ V(this.handler, "WebsocketTransport handler should be set"), this.handler({
1885
+ type: Pe.CHANNEL_WS_DISCONNECT,
1886
+ args: [{ reason: a.reason, code: a.code }],
1887
+ from: n || "preview"
1888
+ }), this.isClosed = !0, clearTimeout(this.pingTimeout);
1889
+ };
1890
+ }
1891
+ static {
1892
+ o(this, "WebsocketTransport");
1893
+ }
1894
+ heartbeat() {
1895
+ clearTimeout(this.pingTimeout), this.pingTimeout = setTimeout(() => {
1896
+ this.socket.close(3008, "timeout");
1897
+ }, pe + ue);
1898
+ }
1899
+ setHandler(e) {
1900
+ this.handler = e;
1901
+ }
1902
+ send(e) {
1903
+ this.isClosed || (this.isReady ? this.sendNow(e) : this.sendLater(e));
1904
+ }
1905
+ sendLater(e) {
1906
+ this.buffer.push(e);
1907
+ }
1908
+ sendNow(e) {
1909
+ let r = (0, q.stringify)(e, {
1910
+ maxDepth: 15,
1911
+ allowFunction: !1,
1912
+ ...ce.global.CHANNEL_OPTIONS
1913
+ });
1914
+ this.socket.send(r);
1915
+ }
1916
+ flush() {
1917
+ let { buffer: e } = this;
1918
+ this.buffer = [], e.forEach((r) => this.send(r));
1919
+ }
1920
+ };
1921
+
1922
+ // src/channels/index.ts
1923
+ var { CONFIG_TYPE: ot } = Ie.global, it = $;
1924
+ function st({ page: t, extraTransports: e = [] }) {
1925
+ let r = [new G({ page: t }), ...e];
1926
+ if (ot === "DEVELOPMENT") {
1927
+ let a = window.location.protocol === "http:" ? "ws" : "wss", { hostname: s, port: l } = window.location, c = `${a}://${s}:${l}/storybook\
1928
+ -server-channel`;
1929
+ r.push(new W({ url: c, onError: /* @__PURE__ */ o(() => {
1930
+ }, "onError"), page: t }));
1931
+ }
1932
+ let n = new $({ transports: r });
1933
+ return U.__prepare(
1934
+ n,
1935
+ t === "manager" ? U.Environment.MANAGER : U.Environment.PREVIEW
1936
+ ), n;
1937
+ }
1938
+ o(st, "createBrowserChannel");