UNPKG

@storybook/core

Version:

Storybook framework-agnostic API

1,518 lines (1,470 loc) • 152 kB
var Dr = Object.create; var Ce = Object.defineProperty; var Nr = Object.getOwnPropertyDescriptor; var kr = Object.getOwnPropertyNames; var Ur = Object.getPrototypeOf, jr = Object.prototype.hasOwnProperty; var n = (e, t) => Ce(e, "name", { value: t, configurable: !0 }), ve = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (t, r) => (typeof require < "u" ? require : t)[r] }) : e)(function(e) { if (typeof require < "u") return require.apply(this, arguments); throw Error('Dynamic require of "' + e + '" is not supported'); }); var e0 = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), L = (e, t) => { for (var r in t) Ce(e, r, { get: t[r], enumerable: !0 }); }, Fr = (e, t, r, a) => { if (t && typeof t == "object" || typeof t == "function") for (let o of kr(t)) !jr.call(e, o) && o !== r && Ce(e, o, { get: () => t[o], enumerable: !(a = Nr(t, o)) || a.enumerable }); return e; }; var ze = (e, t, r) => (r = e != null ? Dr(Ur(e)) : {}, Fr( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. t || !e || !e.__esModule ? Ce(r, "default", { value: e, enumerable: !0 }) : r, e )); // ../node_modules/memoizerific/memoizerific.js var Be = e0((D0, pt) => { (function(e) { if (typeof D0 == "object" && typeof pt < "u") pt.exports = e(); else if (typeof define == "function" && define.amd) define([], e); else { var t; typeof window < "u" ? t = window : typeof global < "u" ? t = global : typeof self < "u" ? t = self : t = this, t.memoizerific = e(); } })(function() { var e, t, r; return (/* @__PURE__ */ n(function a(o, l, c) { function i(h, u) { if (!l[h]) { if (!o[h]) { var p = typeof ve == "function" && ve; if (!u && p) return p(h, !0); if (s) return s(h, !0); var v = new Error("Cannot find module '" + h + "'"); throw v.code = "MODULE_NOT_FOUND", v; } var m = l[h] = { exports: {} }; o[h][0].call(m.exports, function(g) { var w = o[h][1][g]; return i(w || g); }, m, m.exports, a, o, l, c); } return l[h].exports; } n(i, "s"); for (var s = typeof ve == "function" && ve, d = 0; d < c.length; d++) i(c[d]); return i; }, "e"))({ 1: [function(a, o, l) { o.exports = function(c) { if (typeof Map != "function" || c) { var i = a("./similar"); return new i(); } else return /* @__PURE__ */ new Map(); }; }, { "./similar": 2 }], 2: [function(a, o, l) { function c() { return this.list = [], this.lastItem = void 0, this.size = 0, this; } n(c, "Similar"), c.prototype.get = function(i) { var s; if (this.lastItem && this.isEqual(this.lastItem.key, i)) return this.lastItem.val; if (s = this.indexOf(i), s >= 0) return this.lastItem = this.list[s], this.list[s].val; }, c.prototype.set = function(i, s) { var d; return this.lastItem && this.isEqual(this.lastItem.key, i) ? (this.lastItem.val = s, this) : (d = this.indexOf(i), d >= 0 ? (this.lastItem = this.list[d], this.list[d].val = s, this) : (this.lastItem = { key: i, val: s }, this.list.push(this.lastItem), this.size++, this)); }, c.prototype.delete = function(i) { var s; if (this.lastItem && this.isEqual(this.lastItem.key, i) && (this.lastItem = void 0), s = this.indexOf(i), s >= 0) return this.size--, this.list.splice(s, 1)[0]; }, c.prototype.has = function(i) { var s; return this.lastItem && this.isEqual(this.lastItem.key, i) ? !0 : (s = this.indexOf(i), s >= 0 ? (this.lastItem = this.list[s], !0) : !1); }, c.prototype.forEach = function(i, s) { var d; for (d = 0; d < this.size; d++) i.call(s || this, this.list[d].val, this.list[d].key, this); }, c.prototype.indexOf = function(i) { var s; for (s = 0; s < this.size; s++) if (this.isEqual(this.list[s].key, i)) return s; return -1; }, c.prototype.isEqual = function(i, s) { return i === s || i !== i && s !== s; }, o.exports = c; }, {}], 3: [function(a, o, l) { var c = a("map-or-similar"); o.exports = function(h) { var u = new c(!1), p = []; return function(v) { var m = /* @__PURE__ */ n(function() { var g = u, w, y, S = arguments.length - 1, E = Array(S + 1), A = !0, x; if ((m.numArgs || m.numArgs === 0) && m.numArgs !== S + 1) throw new Error("Memoizerific functions should always be called with the same number of arguments"); for (x = 0; x < S; x++) { if (E[x] = { cacheItem: g, arg: arguments[x] }, g.has(arguments[x])) { g = g.get(arguments[x]); continue; } A = !1, w = new c(!1), g.set(arguments[x], w), g = w; } return A && (g.has(arguments[S]) ? y = g.get(arguments[S]) : A = !1), A || (y = v.apply(null, arguments), g.set(arguments[S], y)), h > 0 && (E[S] = { cacheItem: g, arg: arguments[S] }, A ? i(p, E) : p.push(E), p.length > h && s(p.shift())), m.wasMemoized = A, m.numArgs = S + 1, y; }, "memoizerific"); return m.limit = h, m.wasMemoized = !1, m.cache = u, m.lru = p, m; }; }; function i(h, u) { var p = h.length, v = u.length, m, g, w; for (g = 0; g < p; g++) { for (m = !0, w = 0; w < v; w++) if (!d(h[g][w].arg, u[w].arg)) { m = !1; break; } if (m) break; } h.push(h.splice(g, 1)[0]); } n(i, "moveToMostRecentLru"); function s(h) { var u = h.length, p = h[u - 1], v, m; for (p.cacheItem.delete(p.arg), m = u - 2; m >= 0 && (p = h[m], v = p.cacheItem.get(p.arg), !v || !v.size); m--) p.cacheItem.delete(p.arg); } n(s, "removeCachedResult"); function d(h, u) { return h === u || h !== h && u !== u; } n(d, "isEqual"); }, { "map-or-similar": 1 }] }, {}, [3])(3); }); }); // ../node_modules/store2/dist/store2.js var ir = e0((ke, Ue) => { (function(e, t) { var r = { version: "2.14.2", areas: {}, apis: {}, nsdelim: ".", // utilities inherit: /* @__PURE__ */ n(function(o, l) { for (var c in o) l.hasOwnProperty(c) || Object.defineProperty(l, c, Object.getOwnPropertyDescriptor(o, c)); return l; }, "inherit"), stringify: /* @__PURE__ */ n(function(o, l) { return o === void 0 || typeof o == "function" ? o + "" : JSON.stringify(o, l || r.replace); }, "stringify"), parse: /* @__PURE__ */ n(function(o, l) { try { return JSON.parse(o, l || r.revive); } catch { return o; } }, "parse"), // extension hooks fn: /* @__PURE__ */ n(function(o, l) { r.storeAPI[o] = l; for (var c in r.apis) r.apis[c][o] = l; }, "fn"), get: /* @__PURE__ */ n(function(o, l) { return o.getItem(l); }, "get"), set: /* @__PURE__ */ n(function(o, l, c) { o.setItem(l, c); }, "set"), remove: /* @__PURE__ */ n(function(o, l) { o.removeItem(l); }, "remove"), key: /* @__PURE__ */ n(function(o, l) { return o.key(l); }, "key"), length: /* @__PURE__ */ n(function(o) { return o.length; }, "length"), clear: /* @__PURE__ */ n(function(o) { o.clear(); }, "clear"), // core functions Store: /* @__PURE__ */ n(function(o, l, c) { var i = r.inherit(r.storeAPI, function(d, h, u) { return arguments.length === 0 ? i.getAll() : typeof h == "function" ? i.transact(d, h, u) : h !== void 0 ? i.set(d, h, u) : typeof d == "string" || typeof d == "number" ? i.get(d) : typeof d == "function" ? i.each(d) : d ? i.setAll(d, h) : i.clear(); }); i._id = o; try { var s = "__store2_test"; l.setItem(s, "ok"), i._area = l, l.removeItem(s); } catch { i._area = r.storage("fake"); } return i._ns = c || "", r.areas[o] || (r.areas[o] = i._area), r.apis[i._ns + i._id] || (r.apis[i._ns + i._id] = i), i; }, "Store"), storeAPI: { // admin functions area: /* @__PURE__ */ n(function(o, l) { var c = this[o]; return (!c || !c.area) && (c = r.Store(o, l, this._ns), this[o] || (this[o] = c)), c; }, "area"), namespace: /* @__PURE__ */ n(function(o, l, c) { if (c = c || this._delim || r.nsdelim, !o) return this._ns ? this._ns.substring(0, this._ns.length - c.length) : ""; var i = o, s = this[i]; if ((!s || !s.namespace) && (s = r.Store(this._id, this._area, this._ns + i + c), s._delim = c, this[i] || (this[i] = s), !l)) for (var d in r.areas) s.area(d, r.areas[d]); return s; }, "namespace"), isFake: /* @__PURE__ */ n(function(o) { return o ? (this._real = this._area, this._area = r.storage("fake")) : o === !1 && (this._area = this._real || this._area), this._area. name === "fake"; }, "isFake"), toString: /* @__PURE__ */ n(function() { return "store" + (this._ns ? "." + this.namespace() : "") + "[" + this._id + "]"; }, "toString"), // storage functions has: /* @__PURE__ */ n(function(o) { return this._area.has ? this._area.has(this._in(o)) : this._in(o) in this._area; }, "has"), size: /* @__PURE__ */ n(function() { return this.keys().length; }, "size"), each: /* @__PURE__ */ n(function(o, l) { for (var c = 0, i = r.length(this._area); c < i; c++) { var s = this._out(r.key(this._area, c)); if (s !== void 0 && o.call(this, s, this.get(s), l) === !1) break; i > r.length(this._area) && (i--, c--); } return l || this; }, "each"), keys: /* @__PURE__ */ n(function(o) { return this.each(function(l, c, i) { i.push(l); }, o || []); }, "keys"), get: /* @__PURE__ */ n(function(o, l) { var c = r.get(this._area, this._in(o)), i; return typeof l == "function" && (i = l, l = null), c !== null ? r.parse(c, i) : l ?? c; }, "get"), getAll: /* @__PURE__ */ n(function(o) { return this.each(function(l, c, i) { i[l] = c; }, o || {}); }, "getAll"), transact: /* @__PURE__ */ n(function(o, l, c) { var i = this.get(o, c), s = l(i); return this.set(o, s === void 0 ? i : s), this; }, "transact"), set: /* @__PURE__ */ n(function(o, l, c) { var i = this.get(o), s; return i != null && c === !1 ? l : (typeof c == "function" && (s = c, c = void 0), r.set(this._area, this._in(o), r.stringify(l, s), c) || i); }, "set"), setAll: /* @__PURE__ */ n(function(o, l) { var c, i; for (var s in o) i = o[s], this.set(s, i, l) !== i && (c = !0); return c; }, "setAll"), add: /* @__PURE__ */ n(function(o, l, c) { var i = this.get(o); if (i instanceof Array) l = i.concat(l); else if (i !== null) { var s = typeof i; if (s === typeof l && s === "object") { for (var d in l) i[d] = l[d]; l = i; } else l = i + l; } return r.set(this._area, this._in(o), r.stringify(l, c)), l; }, "add"), remove: /* @__PURE__ */ n(function(o, l) { var c = this.get(o, l); return r.remove(this._area, this._in(o)), c; }, "remove"), clear: /* @__PURE__ */ n(function() { return this._ns ? this.each(function(o) { r.remove(this._area, this._in(o)); }, 1) : r.clear(this._area), this; }, "clear"), clearAll: /* @__PURE__ */ n(function() { var o = this._area; for (var l in r.areas) r.areas.hasOwnProperty(l) && (this._area = r.areas[l], this.clear()); return this._area = o, this; }, "clearAll"), // internal use functions _in: /* @__PURE__ */ n(function(o) { return typeof o != "string" && (o = r.stringify(o)), this._ns ? this._ns + o : o; }, "_in"), _out: /* @__PURE__ */ n(function(o) { return this._ns ? o && o.indexOf(this._ns) === 0 ? o.substring(this._ns.length) : void 0 : ( // so each() knows to skip it o ); }, "_out") }, // end _.storeAPI storage: /* @__PURE__ */ n(function(o) { return r.inherit(r.storageAPI, { items: {}, name: o }); }, "storage"), storageAPI: { length: 0, has: /* @__PURE__ */ n(function(o) { return this.items.hasOwnProperty(o); }, "has"), key: /* @__PURE__ */ n(function(o) { var l = 0; for (var c in this.items) if (this.has(c) && o === l++) return c; }, "key"), setItem: /* @__PURE__ */ n(function(o, l) { this.has(o) || this.length++, this.items[o] = l; }, "setItem"), removeItem: /* @__PURE__ */ n(function(o) { this.has(o) && (delete this.items[o], this.length--); }, "removeItem"), getItem: /* @__PURE__ */ n(function(o) { return this.has(o) ? this.items[o] : null; }, "getItem"), clear: /* @__PURE__ */ n(function() { for (var o in this.items) this.removeItem(o); }, "clear") } // end _.storageAPI }, a = ( // safely set this up (throws error in IE10/32bit mode for local files) r.Store("local", function() { try { return localStorage; } catch { } }()) ); a.local = a, a._ = r, a.area("session", function() { try { return sessionStorage; } catch { } }()), a.area("page", r.storage("page")), typeof t == "function" && t.amd !== void 0 ? t("store2", [], function() { return a; }) : typeof Ue < "u" && Ue.exports ? Ue.exports = a : (e.store && (r.conflict = e.store), e.store = a); })(ke, ke && ke.define); }); // src/manager-api/root.tsx import de, { Component as po, Fragment as vo, useCallback as qe, useContext as Zt, useEffect as Or, useMemo as Xt, useRef as Tr } from "react"; import { deprecate as Qt } from "@storybook/core/client-logger"; import { SET_STORIES as mo, SHARED_STATE_CHANGED as Hr, SHARED_STATE_SET as xe, STORY_CHANGED as go } from "@storybook/core/core-events"; // ../node_modules/es-toolkit/dist/array/countBy.mjs function Xe(e, t) { let r = {}; for (let a = 0; a < e.length; a++) { let o = e[a], l = t(o); r[l] = (r[l] ?? 0) + 1; } return r; } n(Xe, "countBy"); // ../node_modules/es-toolkit/dist/array/partition.mjs function Te(e, t) { let r = [], a = []; for (let o = 0; o < e.length; o++) { let l = e[o]; t(l) ? r.push(l) : a.push(l); } return [r, a]; } n(Te, "partition"); // ../node_modules/es-toolkit/dist/object/pick.mjs function X(e, t) { let r = {}; for (let a = 0; a < t.length; a++) { let o = t[a]; Object.prototype.hasOwnProperty.call(e, o) && (r[o] = e[o]); } return r; } n(X, "pick"); // ../node_modules/es-toolkit/dist/predicate/isTypedArray.mjs function t0(e) { return ArrayBuffer.isView(e) && !(e instanceof DataView); } n(t0, "isTypedArray"); // ../node_modules/es-toolkit/dist/predicate/isPrimitive.mjs function r0(e) { return e == null || typeof e != "object" && typeof e != "function"; } n(r0, "isPrimitive"); // ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs function Ze(e) { if (typeof e != "object" || e == null) return !1; if (Object.getPrototypeOf(e) === null) return !0; if (e.toString() !== "[object Object]") return !1; let t = e; for (; Object.getPrototypeOf(t) !== null; ) t = Object.getPrototypeOf(t); return Object.getPrototypeOf(e) === t; } n(Ze, "isPlainObject"); // ../node_modules/es-toolkit/dist/object/mapValues.mjs function et(e, t) { let r = {}, a = Object.keys(e); for (let o = 0; o < a.length; o++) { let l = a[o], c = e[l]; r[l] = t(c, l, e); } return r; } n(et, "mapValues"); // ../node_modules/es-toolkit/dist/object/cloneDeep.mjs function a0(e) { return te(e); } n(a0, "cloneDeep"); function te(e, t = /* @__PURE__ */ new Map()) { if (r0(e)) return e; if (t.has(e)) return t.get(e); if (Array.isArray(e)) { let r = new Array(e.length); t.set(e, r); for (let a = 0; a < e.length; a++) r[a] = te(e[a], t); return Object.prototype.hasOwnProperty.call(e, "index") && (r.index = e.index), Object.prototype.hasOwnProperty.call(e, "input") && (r.input = e.input), r; } if (e instanceof Date) return new Date(e.getTime()); if (e instanceof RegExp) { let r = new RegExp(e.source, e.flags); return r.lastIndex = e.lastIndex, r; } if (e instanceof Map) { let r = /* @__PURE__ */ new Map(); t.set(e, r); for (let [a, o] of e.entries()) r.set(a, te(o, t)); return r; } if (e instanceof Set) { let r = /* @__PURE__ */ new Set(); t.set(e, r); for (let a of e.values()) r.add(te(a, t)); return r; } if (typeof Buffer < "u" && Buffer.isBuffer(e)) return e.subarray(); if (t0(e)) { let r = new (Object.getPrototypeOf(e)).constructor(e.length); t.set(e, r); for (let a = 0; a < e.length; a++) r[a] = te(e[a], t); return r; } if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return e.slice(0); if (e instanceof DataView) { let r = new DataView(e.buffer.slice(0), e.byteOffset, e.byteLength); return t.set(e, r), me(r, e, t), r; } if (typeof File < "u" && e instanceof File) { let r = new File([e], e.name, { type: e.type }); return t.set(e, r), me(r, e, t), r; } if (e instanceof Blob) { let r = new Blob([e], { type: e.type }); return t.set(e, r), me(r, e, t), r; } if (e instanceof Error) { let r = new e.constructor(); return t.set(e, r), r.message = e.message, r.name = e.name, r.stack = e.stack, r.cause = e.cause, me(r, e, t), r; } if (typeof e == "object" && e !== null) { let r = {}; return t.set(e, r), me(r, e, t), r; } return e; } n(te, "cloneDeepImpl"); function me(e, t, r) { let a = Object.keys(t); for (let o = 0; o < a.length; o++) { let l = a[o], c = Object.getOwnPropertyDescriptor(t, l); (c?.writable || c?.set) && (e[l] = te(t[l], r)); } } n(me, "copyProperties"); // ../node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs function re(e) { return typeof e == "object" && e !== null; } n(re, "isObjectLike"); // ../node_modules/es-toolkit/dist/object/merge.mjs function He(e, t) { let r = Object.keys(t); for (let a = 0; a < r.length; a++) { let o = r[a], l = t[o], c = e[o]; Array.isArray(l) ? e[o] = He(c ?? [], l) : re(c) && re(l) ? e[o] = He(c ?? {}, l) : (c === void 0 || l !== void 0) && (e[o] = l); } return e; } n(He, "merge"); // ../node_modules/es-toolkit/dist/object/toMerged.mjs function ge(e, t) { return He(a0(e), t); } n(ge, "toMerged"); // ../node_modules/es-toolkit/dist/object/mergeWith.mjs function Y(e, t, r) { let a = Object.keys(t); for (let o = 0; o < a.length; o++) { let l = a[o], c = t[l], i = e[l], s = r(i, c, l, e, t); s != null ? e[l] = s : Array.isArray(c) ? e[l] = Y(i ?? [], c, r) : re(i) && re(c) ? e[l] = Y(i ?? {}, c, r) : (i === void 0 || c !== void 0) && (e[l] = c); } return e; } n(Y, "mergeWith"); // ../node_modules/es-toolkit/dist/compat/_internal/tags.mjs var n0 = "[object RegExp]", o0 = "[object String]", l0 = "[object Number]", i0 = "[object Boolean]", tt = "[object Arguments]", s0 = "[objec\ t Symbol]", c0 = "[object Date]", f0 = "[object Map]", d0 = "[object Set]", h0 = "[object Array]", u0 = "[object Function]", p0 = "[object A\ rrayBuffer]", Le = "[object Object]", v0 = "[object Error]", m0 = "[object DataView]", g0 = "[object Uint8Array]", w0 = "[object Uint8Clampe\ dArray]", y0 = "[object Uint16Array]", R0 = "[object Uint32Array]", S0 = "[object BigUint64Array]", E0 = "[object Int8Array]", I0 = "[object\ Int16Array]", x0 = "[object Int32Array]", A0 = "[object BigInt64Array]", P0 = "[object Float32Array]", b0 = "[object Float64Array]"; // ../node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs function rt(e) { return Object.getOwnPropertySymbols(e).filter((t) => Object.prototype.propertyIsEnumerable.call(e, t)); } n(rt, "getSymbols"); // ../node_modules/es-toolkit/dist/compat/_internal/getTag.mjs function at(e) { return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e); } n(at, "getTag"); // ../node_modules/es-toolkit/dist/predicate/isEqual.mjs function O(e, t) { if (typeof e == typeof t) switch (typeof e) { case "bigint": case "string": case "boolean": case "symbol": case "undefined": return e === t; case "number": return e === t || Object.is(e, t); case "function": return e === t; case "object": return q(e, t); } return q(e, t); } n(O, "isEqual"); function q(e, t, r) { if (Object.is(e, t)) return !0; let a = at(e), o = at(t); if (a === tt && (a = Le), o === tt && (o = Le), a !== o) return !1; switch (a) { case o0: return e.toString() === t.toString(); case l0: { let i = e.valueOf(), s = t.valueOf(); return i === s || Number.isNaN(i) && Number.isNaN(s); } case i0: case c0: case s0: return Object.is(e.valueOf(), t.valueOf()); case n0: return e.source === t.source && e.flags === t.flags; case u0: return e === t; } r = r ?? /* @__PURE__ */ new Map(); let l = r.get(e), c = r.get(t); if (l != null && c != null) return l === t; r.set(e, t), r.set(t, e); try { switch (a) { case f0: { if (e.size !== t.size) return !1; for (let [i, s] of e.entries()) if (!t.has(i) || !q(s, t.get(i), r)) return !1; return !0; } case d0: { if (e.size !== t.size) return !1; let i = Array.from(e.values()), s = Array.from(t.values()); for (let d = 0; d < i.length; d++) { let h = i[d], u = s.findIndex((p) => q(h, p, r)); if (u === -1) return !1; s.splice(u, 1); } return !0; } case h0: case g0: case w0: case y0: case R0: case S0: case E0: case I0: case x0: case A0: case P0: case b0: { if (typeof Buffer < "u" && Buffer.isBuffer(e) !== Buffer.isBuffer(t) || e.length !== t.length) return !1; for (let i = 0; i < e.length; i++) if (!q(e[i], t[i], r)) return !1; return !0; } case p0: return e.byteLength !== t.byteLength ? !1 : q(new Uint8Array(e), new Uint8Array(t), r); case m0: return e.byteLength !== t.byteLength || e.byteOffset !== t.byteOffset ? !1 : q(e.buffer, t.buffer, r); case v0: return e.name === t.name && e.message === t.message; case Le: { if (!(q(e.constructor, t.constructor, r) || Ze(e) && Ze(t))) return !1; let s = [...Object.keys(e), ...rt(e)], d = [...Object.keys(t), ...rt(t)]; if (s.length !== d.length) return !1; for (let h = 0; h < s.length; h++) { let u = s[h], p = e[u]; if (!Object.prototype.hasOwnProperty.call(t, u)) return !1; let v = t[u]; if (!q(p, v, r)) return !1; } return !0; } default: return !1; } } finally { r.delete(e), r.delete(t); } } n(q, "areObjectsEqual"); // src/manager-api/context.ts import { createContext as Gr } from "react"; var _0 = /* @__PURE__ */ n(({ api: e, state: t }) => Gr({ api: e, state: t }), "createContext"); // src/manager-api/lib/merge.ts import { logger as M0 } from "@storybook/core/client-logger"; var $ = /* @__PURE__ */ n((e, ...t) => { let r = {}; r = Y({}, e, (a, o) => { if (Array.isArray(o) && Array.isArray(a)) return o.forEach((l) => { a.find((i) => i === l || O(i, l)) || a.push(l); }), a; if (Array.isArray(a)) return M0.log(["the types mismatch, picking", a]), a; }); for (let a of t) r = Y(r, a, (o, l) => { if (Array.isArray(l) && Array.isArray(o)) return l.forEach((c) => { o.find((s) => s === c || O(s, c)) || o.push(c); }), o; if (Array.isArray(o)) return M0.log(["the types mismatch, picking", o]), o; }); return r; }, "default"), C0 = /* @__PURE__ */ n((e, ...t) => { let r = {}; r = Y({}, e, (a, o) => { if (Array.isArray(o)) return o; }); for (let a of t) r = Y(r, a, (o, l) => { if (Array.isArray(l)) return l; }); return r; }, "noArrayMerge"); // src/manager-api/initial-state.ts var $r = /* @__PURE__ */ n((...e) => e.reduce((t, r) => $(t, r), {}), "main"), Oe = $r; // src/manager-api/lib/addons.ts import { Addon_TypesEnum as T0 } from "@storybook/core/types"; // ../node_modules/@storybook/global/dist/index.mjs var P = (() => { let e; return typeof window < "u" ? e = window : typeof globalThis < "u" ? e = globalThis : typeof global < "u" ? e = global : typeof self < "u" ? e = self : e = {}, e; })(); // src/manager-api/lib/addons.ts import { logger as Kr } from "@storybook/core/client-logger"; import { SET_CONFIG as z0 } from "@storybook/core/core-events"; // src/manager-api/lib/storybook-channel-mock.ts import { Channel as Wr } from "@storybook/core/channels"; function nt() { let e = { setHandler: /* @__PURE__ */ n(() => { }, "setHandler"), send: /* @__PURE__ */ n(() => { }, "send") }; return new Wr({ transport: e }); } n(nt, "mockChannel"); // src/manager-api/lib/addons.ts var it = class it { constructor() { this.loaders = {}; this.elements = {}; this.config = {}; this.getChannel = /* @__PURE__ */ n(() => (this.channel || this.setChannel(nt()), this.channel), "getChannel"); this.ready = /* @__PURE__ */ n(() => this.promise, "ready"); this.hasChannel = /* @__PURE__ */ n(() => !!this.channel, "hasChannel"); this.setChannel = /* @__PURE__ */ n((t) => { this.channel = t, this.resolve(); }, "setChannel"); this.setConfig = /* @__PURE__ */ n((t) => { Object.assign(this.config, t), this.hasChannel() ? this.getChannel().emit(z0, this.config) : this.ready().then((r) => { r.emit(z0, this.config); }); }, "setConfig"); this.getConfig = /* @__PURE__ */ n(() => this.config, "getConfig"); /** * Registers an addon loader function. * * @param {string} id - The id of the addon loader. * @param {(api: API) => void} callback - The function that will be called to register the addon. * @returns {void} */ this.register = /* @__PURE__ */ n((t, r) => { this.loaders[t] && Kr.warn(`${t} was loaded twice, this could have bad side-effects`), this.loaders[t] = r; }, "register"); this.loadAddons = /* @__PURE__ */ n((t) => { Object.values(this.loaders).forEach((r) => r(t)); }, "loadAddons"); this.promise = new Promise((t) => { this.resolve = () => t(this.getChannel()); }); } getElements(t) { return this.elements[t] || (this.elements[t] = {}), this.elements[t]; } /** * Adds an addon to the addon store. * * @param {string} id - The id of the addon. * @param {Addon_Type} addon - The addon to add. * @returns {void} */ add(t, r) { let { type: a } = r, o = this.getElements(a); o[t] = { ...r, id: t }; } experimental_getRegisteredAddons() { return Object.keys(this.loaders); } }; n(it, "AddonStore"); var lt = it, ot = "__STORYBOOK_ADDONS_MANAGER"; function qr() { return P[ot] || (P[ot] = new lt()), P[ot]; } n(qr, "getAddonsStore"); var Yr = qr(); // src/manager-api/modules/addons.ts var ct = {}; L(ct, { ensurePanel: () => st, init: () => Jr }); import { Addon_TypesEnum as H0 } from "@storybook/core/types"; function st(e, t, r) { let a = Object.keys(e); return a.indexOf(t) >= 0 ? t : a.length ? a[0] : r; } n(st, "ensurePanel"); var Jr = /* @__PURE__ */ n(({ provider: e, store: t, fullAPI: r }) => { let a = { getElements: /* @__PURE__ */ n((o) => e.getElements(o), "getElements"), getSelectedPanel: /* @__PURE__ */ n(() => { let { selectedPanel: o } = t.getState(); return st(a.getElements(H0.PANEL), o, o); }, "getSelectedPanel"), setSelectedPanel: /* @__PURE__ */ n((o) => { t.setState({ selectedPanel: o }, { persistence: "session" }); }, "setSelectedPanel"), setAddonState(o, l, c) { let i = typeof l == "function" ? l : () => l; return t.setState( (s) => ({ ...s, addons: { ...s.addons, [o]: i(s.addons[o]) } }), c ).then(() => a.getAddonState(o)); }, getAddonState: /* @__PURE__ */ n((o) => t.getState().addons[o] || globalThis?.STORYBOOK_ADDON_STATE[o], "getAddonState") }; return { api: a, state: { selectedPanel: st( a.getElements(H0.PANEL), t.getState().selectedPanel ), addons: {} } }; }, "init"); // src/manager-api/modules/channel.ts var ft = {}; L(ft, { init: () => Qr }); var Qr = /* @__PURE__ */ n(({ provider: e }) => ({ api: { getChannel: /* @__PURE__ */ n(() => e.channel, "getChannel"), on: /* @__PURE__ */ n((r, a) => (e.channel?.on(r, a), () => e.channel?.off(r, a)), "on"), off: /* @__PURE__ */ n((r, a) => e.channel?.off(r, a), "off"), once: /* @__PURE__ */ n((r, a) => e.channel?.once(r, a), "once"), emit: /* @__PURE__ */ n((r, a, ...o) => { a?.options?.target && a.options.target !== "storybook-preview-iframe" && !a.options.target.startsWith("storybook-ref-") && (a.options.target = a.options.target !== "storybook_internal" ? `storybook-ref-${a.options.target}` : "storybook-preview-iframe"), e.channel?.emit(r, a, ...o); }, "emit") }, state: {} }), "init"); // src/manager-api/modules/experimental_testmodule.ts var ut = {}; L(ut, { init: () => aa }); import { Addon_TypesEnum as Zr } from "@storybook/core/types"; import { TESTING_MODULE_CANCEL_TEST_RUN_REQUEST as ea, TESTING_MODULE_RUN_ALL_REQUEST as ta, TESTING_MODULE_RUN_REQUEST as L0 } from "@storybook/core/core-events"; // ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js var Xr = !1, dt = "Invariant failed"; function ht(e, t) { if (!e) { if (Xr) throw new Error(dt); var r = typeof t == "function" ? t() : t, a = r ? "".concat(dt, ": ").concat(r) : dt; throw new Error(a); } } n(ht, "invariant"); // src/manager-api/modules/experimental_testmodule.ts var ra = { details: {}, cancellable: !1, cancelling: !1, running: !1, failed: !1, crashed: !1 }, aa = /* @__PURE__ */ n(({ store: e, fullAPI: t }) => { let r = { testProviders: e.getState().testProviders || {} }, a = { getTestProviderState(l) { let { testProviders: c } = e.getState(); return c?.[l]; }, updateTestProviderState(l, c) { return e.setState( ({ testProviders: i }) => { let s = i[l], d = s.stateUpdater?.(s, c) ?? { ...s, ...c, details: { ...s.details, ...c.details } }; return { testProviders: { ...i, [l]: d } }; }, { persistence: "session" } ); }, clearTestProviderState(l) { let c = { cancelling: !1, running: !1, failed: !1, crashed: !1, progress: void 0 }; return e.setState( ({ testProviders: i }) => ({ testProviders: { ...i, [l]: { ...i[l], ...c } } }), { persistence: "session" } ); }, runTestProvider(l, c) { let i = e.getState().index; ht(i, "The index is currently unavailable"), a.updateTestProviderState(l, { running: !0, failed: !1, crashed: !1, progress: void 0 }); let s = new URL("index.json", window.location.href).toString(); if (!c?.entryId) { let p = { providerId: l, indexUrl: s }; return t.emit(L0, p), t.emit(ta, { providerId: l }), () => a.cancelTestProvider(l); } let d = i[c.entryId]; ht(d, `No entry found in the index for id '${c.entryId}'`); let h = /* @__PURE__ */ n((p, v = []) => { let m = i[p]; return m.type === "story" ? v.push(m.id) : "children" in m && m.children.forEach((g) => h(g, v)), v; }, "findStories"), u = { providerId: l, indexUrl: s, storyIds: h(c.entryId) }; return t.emit(L0, u), () => a.cancelTestProvider(l); }, cancelTestProvider(l) { a.updateTestProviderState(l, { cancelling: !0 }), t.emit(ea, { providerId: l }); } }; return { init: /* @__PURE__ */ n(async () => { let l = Object.fromEntries( Object.entries(t.getElements(Zr.experimental_TEST_PROVIDER)).map( ([c, i]) => [ c, { ...i, ...ra, ...r?.testProviders?.[c] || {}, running: !1 } ] ) ); e.setState({ testProviders: l }, { persistence: "session" }); }, "initModule"), state: r, api: a }; }, "init"); // src/manager-api/modules/globals.ts var yt = {}; L(yt, { init: () => ga }); import { logger as Y0 } from "@storybook/core/client-logger"; import { GLOBALS_UPDATED as pa, SET_GLOBALS as va, UPDATE_GLOBALS as ma } from "@storybook/core/core-events"; // ../node_modules/dequal/dist/index.mjs var O0 = Object.prototype.hasOwnProperty; function B0(e, t, r) { for (r of e.keys()) if (N(r, t)) return r; } n(B0, "find"); function N(e, t) { var r, a, o; if (e === t) return !0; if (e && t && (r = e.constructor) === t.constructor) { if (r === Date) return e.getTime() === t.getTime(); if (r === RegExp) return e.toString() === t.toString(); if (r === Array) { if ((a = e.length) === t.length) for (; a-- && N(e[a], t[a]); ) ; return a === -1; } if (r === Set) { if (e.size !== t.size) return !1; for (a of e) if (o = a, o && typeof o == "object" && (o = B0(t, o), !o) || !t.has(o)) return !1; return !0; } if (r === Map) { if (e.size !== t.size) return !1; for (a of e) if (o = a[0], o && typeof o == "object" && (o = B0(t, o), !o) || !N(a[1], t.get(o))) return !1; return !0; } if (r === ArrayBuffer) e = new Uint8Array(e), t = new Uint8Array(t); else if (r === DataView) { if ((a = e.byteLength) === t.byteLength) for (; a-- && e.getInt8(a) === t.getInt8(a); ) ; return a === -1; } if (ArrayBuffer.isView(e)) { if ((a = e.byteLength) === t.byteLength) for (; a-- && e[a] === t[a]; ) ; return a === -1; } if (!r || typeof e == "object") { a = 0; for (r in e) if (O0.call(e, r) && ++a && !O0.call(t, r) || !(r in t) || !N(e[r], t[r])) return !1; return Object.keys(t).length === a; } } return e !== e && t !== t; } n(N, "dequal"); // src/manager-api/lib/events.ts import { logger as ua } from "@storybook/core/client-logger"; // src/manager-api/modules/refs.ts var wt = {}; L(wt, { defaultStoryMapper: () => q0, getSourceType: () => gt, init: () => ha }); // ../node_modules/ts-dedent/esm/index.js function B(e) { for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r]; var a = Array.from(typeof e == "string" ? [e] : e); a[a.length - 1] = a[a.length - 1].replace(/\r?\n([\t ]*)$/, ""); var o = a.reduce(function(i, s) { var d = s.match(/\n([\t ]+|(?!\s).)/g); return d ? i.concat(d.map(function(h) { var u, p; return (p = (u = h.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && p !== void 0 ? p : 0; })) : i; }, []); if (o.length) { var l = new RegExp(` [ ]{` + Math.min.apply(Math, o) + "}", "g"); a = a.map(function(i) { return i.replace(l, ` `); }); } a[0] = a[0].replace(/^\r?\n/, ""); var c = a[0]; return t.forEach(function(i, s) { var d = c.match(/(?:^|\n)( *)$/), h = d ? d[1] : "", u = i; typeof i == "string" && i.includes(` `) && (u = String(i).split(` `).map(function(p, v) { return v === 0 ? p : "" + h + p; }).join(` `)), c += u + a[s + 1]; }), c; } n(B, "dedent"); var V0 = B; // src/manager-api/lib/stories.ts import { sanitize as na } from "@storybook/core/csf"; var vt = ze(Be(), 1); // src/manager-api/lib/intersect.ts var N0 = /* @__PURE__ */ n((e, t) => !Array.isArray(e) || !Array.isArray(t) || !e.length || !t.length ? [] : e.reduce((r, a) => (t.includes( a) && r.push(a), r), []), "default"); // src/manager-api/lib/stories.ts var oa = /\s*\/\s*/, k0 = /* @__PURE__ */ n(({ globalParameters: e, kindParameters: t, stories: r }) => et(r, (a) => ({ ...a, parameters: G0( e, t[a.kind], a.parameters ) })), "denormalizeStoryParameters"); var U0 = /* @__PURE__ */ n((e) => ({ v: 5, entries: Object.entries(e).reduce( (r, [a, o]) => { if (!o) return r; let { docsOnly: l, fileName: c, ...i } = o.parameters, s = { title: o.kind, id: a, name: o.name, importPath: c }; if (l) r[a] = { type: "docs", tags: ["stories-mdx"], storiesImports: [], ...s }; else { let { argTypes: d, args: h, initialArgs: u } = o; r[a] = { type: "story", ...s, parameters: i, argTypes: d, args: h, initialArgs: u }; } return r; }, {} ) }), "transformSetStoriesStoryDataToPreparedStoryIndex"), la = /* @__PURE__ */ n((e) => ({ v: 3, stories: Object.values(e.stories).reduce( (t, r) => (t[r.id] = { ...r, title: r.kind, name: r.name || r.story, importPath: r.parameters.fileName || "" }, t), {} ) }), "transformStoryIndexV2toV3"), ia = /* @__PURE__ */ n((e) => { let t = Xe(Object.values(e.stories), (r) => r.title); return { v: 4, entries: Object.values(e.stories).reduce( (r, a) => { let o = "story"; return (a.parameters?.docsOnly || a.name === "Page" && t[a.title] === 1) && (o = "docs"), r[a.id] = { type: o, ...o === "docs" && { tags: ["stories-mdx"], storiesImports: [] }, ...a }, delete r[a.id].story, delete r[a.id].kind, r; }, {} ) }; }, "transformStoryIndexV3toV4"), sa = /* @__PURE__ */ n((e) => ({ v: 5, entries: Object.values(e.entries).reduce( (t, r) => (t[r.id] = { ...r, tags: r.tags ? ["dev", "test", ...r.tags] : ["dev"] }, t), {} ) }), "transformStoryIndexV4toV5"), ae = /* @__PURE__ */ n((e, { provider: t, docsOptions: r, filters: a, status: o }) => { if (!e.v) throw new Error("Composition: Missing stories.json version"); let l = e; l = l.v === 2 ? la(l) : l, l = l.v === 3 ? ia(l) : l, l = l.v === 4 ? sa(l) : l, l = l; let c = Object.values(l.entries).filter((g) => { let w = !0, y = o[g.id]; return Object.values(y ?? {}).some(({ status: S }) => S === "error") || Object.values(a).forEach((S) => { w !== !1 && (w = S({ ...g, status: y })); }), w; }), { sidebar: i = {} } = t.getConfig(), { showRoots: s, collapsedRoots: d = [], renderLabel: h } = i, u = typeof s < "u", p = c.reduce((g, w) => { if (r.docsMode && w.type !== "docs") return g; let { title: y } = w, S = y.trim().split(oa), E = (!u || s) && S.length > 1 ? [S.shift()] : [], A = [...E, ...S], x = A.reduce((I, M, F) => { let he = F > 0 && I[F - 1], ue = na(he ? `${he}-${M}` : M); if (M.trim() === "") throw new Error(B`Invalid title ${y} ending in slash.`); if (he === ue) throw new Error( B` Invalid part '${M}', leading to id === parentId ('${ue}'), inside title '${y}' Did you create a path that uses the separator char accidentally, such as 'Vue <docs/>' where '/' is a separator char? See https://github.com/storybookjs/storybook/issues/6128 ` ); return I.push(ue), I; }, []); return x.forEach((I, M) => { let F = x[M + 1] || w.id; E.length && M === 0 ? g[I] = $(g[I] || {}, { type: "root", id: I, name: A[M], tags: [], depth: M, renderLabel: h, startCollapsed: d.includes(I), // Note that this will later get appended to the previous list of children (see below) children: [F] }) : (!g[I] || g[I].type === "component") && M === x.length - 1 ? g[I] = $(g[I] || {}, { type: "component", id: I, name: A[M], tags: [], parent: x[M - 1], depth: M, renderLabel: h, ...F && { children: [F] } }) : g[I] = $(g[I] || {}, { type: "group", id: I, name: A[M], tags: [], parent: x[M - 1], depth: M, renderLabel: h, ...F && { children: [F] } }); }), g[w.id] = { type: "story", tags: [], ...w, depth: x.length, parent: x[x.length - 1], renderLabel: h, prepared: !!w.parameters }, g; }, {}); function v(g, w) { return g[w.id] || (g[w.id] = w, (w.type === "root" || w.type === "group" || w.type === "component") && (w.children.forEach((y) => v(g, p[y])), w.tags = w.children.reduce((y, S) => { let E = g[S]; return y === null ? E.tags : N0(y, E.tags); }, null))), g; } n(v, "addItem"); let m = Object.values(p).filter((g) => g.type !== "root" && !g.parent).reduce(v, {}); return Object.values(p).filter((g) => g.type === "root").reduce(v, m); }, "transformStoryIndexToStoriesHash"), mt = /* @__PURE__ */ n((e, t) => t ? Object.fromEntries( Object.entries(e).map(([r, a]) => { let o = t[r]; return a.type === "story" && o?.type === "story" && o.prepared ? [r, { ...o, ...a, prepared: !0 }] : [r, a]; }) ) : e, "addPreparedStories"), j0 = (0, vt.default)(1)((e) => Object.entries(e).reduce((t, r) => { let a = r[1]; return a.type === "component" && t.push([...a.children]), t; }, [])), F0 = (0, vt.default)(1)((e) => Object.keys(e).filter((t) => ["story", "docs"].includes(e[t].type))); // src/manager-api/modules/refs.ts var { location: ca, fetch: $0 } = P, gt = /* @__PURE__ */ n((e, t) => { let { origin: r, pathname: a } = ca, { origin: o, pathname: l } = new URL(e), c = `${r + a}`.replace("/iframe.html", "").replace(/\/$/, ""), i = `${o + l}`.replace("/iframe.html", "").replace(/\/$/, ""); return c === i ? ["local", i] : t || e ? ["external", i] : [null, null]; }, "getSourceType"), q0 = /* @__PURE__ */ n((e, t) => ({ ...t, kind: t.kind.replace("|", "/") }), "defaultStoryMapper"), W0 = /* @__PURE__ */ n( (e, t) => Object.entries(e).reduce((r, [a, o]) => ({ ...r, [a]: { ...o, refId: t.id } }), {}), "addRefIds"); async function K0(e) { if (!e) return {}; try { let t = await e; if (t === !1 || t === !0) throw new Error("Unexpected boolean response"); if (!t.ok) throw new Error(`Unexpected response not OK: ${t.statusText}`); let r = await t.json(); return r.entries || r.stories ? { storyIndex: r } : r; } catch (t) { return { indexError: t }; } } n(K0, "handleRequest"); var fa = /* @__PURE__ */ n((e) => { let t = /https?:\/\/(.+:.+)@/, r = e, a, [, o] = e.match(t) || []; return o && (r = e.replace(`${o}@`, ""), a = btoa(`${o}`)), { url: r, authorization: a }; }, "parseUrl"), da = /* @__PURE__ */ n((e, t, r) => { let { storyMapper: a } = r; return a ? Object.entries(e).reduce((o, [l, c]) => ({ ...o, [l]: a(t, c) }), {}) : e; }, "map"), ha = /* @__PURE__ */ n(({ store: e, provider: t, singleStory: r, docsOptions: a = {} }, { runCheck: o = !0 } = {}) => { let l = { findRef: /* @__PURE__ */ n((s) => { let d = l.getRefs(); return Object.values(d).find(({ url: h }) => h.match(s)); }, "findRef"), changeRefVersion: /* @__PURE__ */ n(async (s, d) => { let { versions: h, title: u } = l.getRefs()[s], p = { id: s, url: d, versions: h, title: u, index: {}, filteredIndex: {}, expanded: !0 }; await l.setRef(s, { ...p, type: "unknown" }, !1), await l.checkRef(p); }, "changeRefVersion"), changeRefState: /* @__PURE__ */ n((s, d) => { let { [s]: h, ...u } = l.getRefs(); u[s] = { ...h, previewInitialized: d }, e.setState({ refs: u }); }, "changeRefState"), checkRef: /* @__PURE__ */ n(async (s) => { let { id: d, url: h, version: u, type: p } = s, v = p === "server-checked", m = {}, g = u ? `?version=${u}` : "", w = v ? "omit" : "in\ clude", y = fa(h), S = { Accept: "application/json" }; y.authorization && Object.assign(S, { Authorization: `Basic ${y.authorization}` }); let [E, A] = await Promise.all( ["index.json", "stories.json"].map( async (I) => K0( $0(`${y.url}/${I}${g}`, { headers: S, credentials: w }) ) ) ); if (!E.indexError || !A.indexError) { let I = await K0( $0(`${y.url}/metadata.json${g}`, { headers: S, credentials: w, cache: "no-cache" }).catch(() => !1) ); Object.assign(m, { ...E.indexError ? A : E, ...!I.indexError && I }); } else v || (m.indexError = { message: B` Error: Loading of ref failed at fetch (lib/api/src/modules/refs.ts) URL: ${y.url} We weren't able to load the above URL, it's possible a CORS error happened. Please check your dev-tools network tab. ` }); let x = s.versions && Object.keys(s.versions).length ? s.versions : m.versions; await l.setRef(d, { id: d, url: y.url, ...m, ...x ? { versions: x } : {}, type: m.storyIndex ? "lazy" : "auto-inject" }); }, "checkRef"), getRefs: /* @__PURE__ */ n(() => { let { refs: s = {} } = e.getState(); return s; }, "getRefs"), setRef: /* @__PURE__ */ n(async (s, { storyIndex: d, setStoriesData: h, ...u }, p = !1) => { if (r) return; let v, m, g, { filters: w } = e.getState(), { storyMapper: y = q0 } = t.getConfig(), S = l.getRefs()[s]; (d || h) && (v = h ? U0( da(h, S, { storyMapper: y }) ) : d, g = ae(d, { provider: t, docsOptions: a, filters: w, status: {} }), m = ae(d, { provider: t, docsOptions: a, filters: {}, status: {} })), m && (m = W0(m, S)), g && (g = W0(g, S)), await l.updateRef(s, { ...S, ...u, index: m, filteredIndex: g, internal_index: v }); }, "setRef"), updateRef: /* @__PURE__ */ n(async (s, d) => { let { [s]: h, ...u } = l.getRefs(); u[s] = { ...h, ...d }; let p = Object.keys(i).reduce((v, m) => (v[m] = u[m], v), {}); await e.setState({ refs: p }); }, "updateRef") }, c = !r && P.REFS || {}, i = c; return o && new Promise(async (s) => { for (let d of Object.values(c)) await l.checkRef({ ...d, stories: {} }); s(void 0); }), { api: l, state: { refs: i } }; }, "init"); // src/manager-api/lib/events.ts var T = /* @__PURE__ */ n((e, t) => { let { source: r, refId: a, type: o } = e, [l, c] = gt(r, a), i; (a || l === "external") && (i = a && t.getRefs()[a] ? t.getRefs()[a] : t.findRef(c)); let s = { source: r, sourceType: l, sourceLocation: c, refId: a, ref: i, type: o }; switch (!0) { case typeof a == "string": case l === "local": case l === "external": return s; // if we couldn't find the source, something risky happened, we ignore the input, and log a warning default: return ua.warn(`Received a ${o} frame that was not configured as a ref`), null; } }, "getEventMetadata"); // src/manager-api/modules/globals.ts var ga = /* @__PURE__ */ n(({ store: e, fullAPI: t, provider: r }) => { let a = { getGlobals() { return e.getState().globals; }, getUserGlobals() { return e.getState().userGlobals; }, getStoryGlobals() { return e.getState().storyGlobals; }, getGlobalTypes() { return e.getState().globalTypes; }, updateGlobals(c) { r.channel?.emit(ma, { globals: c, options: {