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