import {
  a as C,
  c as ye,
  d as Se
} from "../_browser-chunks/chunk-HT4E25ZO.js";
import {
  d as de
} from "../_browser-chunks/chunk-7XLJCGX3.js";
import {
  p as pe
} from "../_browser-chunks/chunk-UXUHATZT.js";
import {
  a as ue
} from "../_browser-chunks/chunk-KCGBM3WI.js";
import {
  a as M
} from "../_browser-chunks/chunk-T7THUOJ6.js";
import {
  a as St,
  b as H,
  c as K
} from "../_browser-chunks/chunk-VRBWRKGV.js";
import {
  a as ie,
  c as le,
  e as Z,
  f as w
} from "../_browser-chunks/chunk-IU22WWJQ.js";
import {
  a as ce
} from "../_browser-chunks/chunk-VEVXVIEO.js";
import {
  a as F,
  b as ae
} from "../_browser-chunks/chunk-JCASV5LV.js";
import {
  a as n,
  c as se,
  d as R,
  e as J
} from "../_browser-chunks/chunk-IO47FP3U.js";

// ../node_modules/picocolors/picocolors.browser.js
var Fe = se((_s, Wt) => {
  var P = String, Be = /* @__PURE__ */ n(function() {
    return { isColorSupported: !1, reset: P, bold: P, dim: P, italic: P, underline: P, inverse: P, hidden: P, strikethrough: P, black: P, red: P, green: P, yellow: P, blue: P, magenta: P, cyan: P, white: P, gray: P, bgBlack: P, bgRed: P, bgGreen: P, bgYellow: P, bgBlue: P, bgMagenta: P, bgCyan: P, bgWhite: P, blackBright: P, redBright: P, greenBright: P, yellowBright: P, blueBright: P, magentaBright: P, cyanBright: P, whiteBright: P, bgBlackBright: P, bgRedBright: P, bgGreenBright: P, bgYellowBright: P, bgBlueBright: P, bgMagentaBright: P, bgCyanBright: P, bgWhiteBright: P };
  }, "create");
  Wt.exports = Be();
  Wt.exports.createColors = Be;
});

// ../node_modules/store2/dist/store2.js
var Ye = se((at, it) => {
  (function(t, e) {
    var r = {
      version: "2.14.4",
      areas: {},
      apis: {},
      nsdelim: ".",
      // utilities
      inherit: /* @__PURE__ */ n(function(l, o) {
        for (var c in l)
          o.hasOwnProperty(c) || Object.defineProperty(o, c, Object.getOwnPropertyDescriptor(l, c));
        return o;
      }, "inherit"),
      stringify: /* @__PURE__ */ n(function(l, o) {
        return l === void 0 || typeof l == "function" ? l + "" : JSON.stringify(l, o || r.replace);
      }, "stringify"),
      parse: /* @__PURE__ */ n(function(l, o) {
        try {
          return JSON.parse(l, o || r.revive);
        } catch {
          return l;
        }
      }, "parse"),
      // extension hooks
      fn: /* @__PURE__ */ n(function(l, o) {
        r.storeAPI[l] = o;
        for (var c in r.apis)
          r.apis[c][l] = o;
      }, "fn"),
      get: /* @__PURE__ */ n(function(l, o) {
        return l.getItem(o);
      }, "get"),
      set: /* @__PURE__ */ n(function(l, o, c) {
        l.setItem(o, c);
      }, "set"),
      remove: /* @__PURE__ */ n(function(l, o) {
        l.removeItem(o);
      }, "remove"),
      key: /* @__PURE__ */ n(function(l, o) {
        return l.key(o);
      }, "key"),
      length: /* @__PURE__ */ n(function(l) {
        return l.length;
      }, "length"),
      clear: /* @__PURE__ */ n(function(l) {
        l.clear();
      }, "clear"),
      // core functions
      Store: /* @__PURE__ */ n(function(l, o, c) {
        var s = r.inherit(r.storeAPI, function(i, u, p) {
          return arguments.length === 0 ? s.getAll() : typeof u == "function" ? s.transact(i, u, p) : u !== void 0 ? s.set(i, u, p) : typeof i == "string" || typeof i == "number" ? s.get(i) : typeof i == "function" ? s.each(i) : i ? s.setAll(i, u) : s.clear();
        });
        s._id = l;
        try {
          var d = "__store2_test";
          o.setItem(d, "ok"), s._area = o, o.removeItem(d);
        } catch {
          s._area = r.storage("fake");
        }
        return s._ns = c || "", r.areas[l] || (r.areas[l] = s._area), r.apis[s._ns + s._id] || (r.apis[s._ns + s._id] = s), s;
      }, "Store"),
      storeAPI: {
        // admin functions
        area: /* @__PURE__ */ n(function(l, o) {
          var c = this[l];
          return (!c || !c.area) && (c = r.Store(l, o, this._ns), this[l] || (this[l] = c)), c;
        }, "area"),
        namespace: /* @__PURE__ */ n(function(l, o, c) {
          if (c = c || this._delim || r.nsdelim, !l)
            return this._ns ? this._ns.substring(0, this._ns.length - c.length) : "";
          var s = l, d = this[s];
          if ((!d || !d.namespace) && (d = r.Store(this._id, this._area, this._ns + s + c), d._delim = c, this[s] || (this[s] = d), !o))
            for (var i in r.areas)
              d.area(i, r.areas[i]);
          return d;
        }, "namespace"),
        isFake: /* @__PURE__ */ n(function(l) {
          return l ? (this._real = this._area, this._area = r.storage("fake")) : l === !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(l) {
          return this._area.has ? this._area.has(this._in(l)) : this._in(l) in this._area;
        }, "has"),
        size: /* @__PURE__ */ n(function() {
          return this.keys().length;
        }, "size"),
        each: /* @__PURE__ */ n(function(l, o) {
          for (var c = 0, s = r.length(this._area); c < s; c++) {
            var d = this._out(r.key(this._area, c));
            if (d !== void 0 && l.call(this, d, this.get(d), o) === !1)
              break;
            s > r.length(this._area) && (s--, c--);
          }
          return o || this;
        }, "each"),
        keys: /* @__PURE__ */ n(function(l) {
          return this.each(function(o, c, s) {
            s.push(o);
          }, l || []);
        }, "keys"),
        get: /* @__PURE__ */ n(function(l, o) {
          var c = r.get(this._area, this._in(l)), s;
          return typeof o == "function" && (s = o, o = null), c !== null ? r.parse(c, s) : o ?? c;
        }, "get"),
        getAll: /* @__PURE__ */ n(function(l) {
          return this.each(function(o, c, s) {
            s[o] = c;
          }, l || {});
        }, "getAll"),
        transact: /* @__PURE__ */ n(function(l, o, c) {
          var s = this.get(l, c), d = o(s);
          return this.set(l, d === void 0 ? s : d), this;
        }, "transact"),
        set: /* @__PURE__ */ n(function(l, o, c) {
          var s = this.get(l), d;
          return s != null && c === !1 ? o : (typeof c == "function" && (d = c, c = void 0), r.set(this._area, this._in(l), r.stringify(o, d), c) || s);
        }, "set"),
        setAll: /* @__PURE__ */ n(function(l, o) {
          var c, s;
          for (var d in l)
            s = l[d], this.set(d, s, o) !== s && (c = !0);
          return c;
        }, "setAll"),
        add: /* @__PURE__ */ n(function(l, o, c) {
          var s = this.get(l);
          if (s instanceof Array)
            o = s.concat(o);
          else if (s !== null) {
            var d = typeof s;
            if (d === typeof o && d === "object") {
              for (var i in o)
                s[i] = o[i];
              o = s;
            } else
              o = s + o;
          }
          return r.set(this._area, this._in(l), r.stringify(o, c)), o;
        }, "add"),
        remove: /* @__PURE__ */ n(function(l, o) {
          var c = this.get(l, o);
          return r.remove(this._area, this._in(l)), c;
        }, "remove"),
        clear: /* @__PURE__ */ n(function() {
          return this._ns ? this.each(function(l) {
            r.remove(this._area, this._in(l));
          }, 1) : r.clear(this._area), this;
        }, "clear"),
        clearAll: /* @__PURE__ */ n(function() {
          var l = this._area;
          for (var o in r.areas)
            r.areas.hasOwnProperty(o) && (this._area = r.areas[o], this.clear());
          return this._area = l, this;
        }, "clearAll"),
        // internal use functions
        _in: /* @__PURE__ */ n(function(l) {
          return typeof l != "string" && (l = r.stringify(l)), this._ns ? this._ns + l : l;
        }, "_in"),
        _out: /* @__PURE__ */ n(function(l) {
          return this._ns ? l && l.indexOf(this._ns) === 0 ? l.substring(this._ns.length) : void 0 : (
            // so each() knows to skip it
            l
          );
        }, "_out")
      },
      // end _.storeAPI
      storage: /* @__PURE__ */ n(function(l) {
        return r.inherit(r.storageAPI, { items: {}, name: l });
      }, "storage"),
      storageAPI: {
        length: 0,
        has: /* @__PURE__ */ n(function(l) {
          return this.items.hasOwnProperty(l);
        }, "has"),
        key: /* @__PURE__ */ n(function(l) {
          var o = 0;
          for (var c in this.items)
            if (this.has(c) && l === o++)
              return c;
        }, "key"),
        setItem: /* @__PURE__ */ n(function(l, o) {
          this.has(l) || this.length++, this.items[l] = o;
        }, "setItem"),
        removeItem: /* @__PURE__ */ n(function(l) {
          this.has(l) && (delete this.items[l], this.length--);
        }, "removeItem"),
        getItem: /* @__PURE__ */ n(function(l) {
          return this.has(l) ? this.items[l] : null;
        }, "getItem"),
        clear: /* @__PURE__ */ n(function() {
          for (var l in this.items)
            this.removeItem(l);
        }, "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 e == "function" && e.amd !== void 0 ? e("store2", [], function() {
      return a;
    }) : typeof it < "u" && it.exports ? it.exports = a : (t.store && (r.conflict = t.store), t.store = a);
  })(at, at && at.define);
});

// src/manager-api/root.tsx
import $, {
  Component as jo,
  Fragment as Go,
  useCallback as X,
  useContext as oe,
  useEffect as tr,
  useMemo as re,
  useRef as Xe,
  useState as Vo
} from "react";
import {
  DOCS_PREPARED as $o,
  SET_STORIES as Ho,
  SHARED_STATE_CHANGED as Je,
  SHARED_STATE_SET as Q,
  STORY_CHANGED as zo,
  STORY_PREPARED as Yo
} from "storybook/internal/core-events";

// src/manager-api/context.ts
import { createContext as sr } from "react";
var fe = /* @__PURE__ */ n(({ api: t, state: e }) => sr({ api: t, state: e }), "createContext");

// src/manager-api/lib/merge.ts
import { logger as ge } from "storybook/internal/client-logger";
var k = /* @__PURE__ */ n((t, ...e) => {
  let r = {};
  r = H(
    {},
    t,
    (a, l) => {
      if (Array.isArray(l) && Array.isArray(a))
        return l.forEach((o) => {
          a.find((s) => s === o || w(s, o)) || a.push(o);
        }), a;
      if (Array.isArray(a))
        return ge.log(["the types mismatch, picking", a]), a;
    }
  );
  for (let a of e)
    r = H(r, a, (l, o) => {
      if (Array.isArray(o) && Array.isArray(l))
        return o.forEach((c) => {
          l.find((d) => d === c || w(d, c)) || l.push(c);
        }), l;
      if (Array.isArray(l))
        return ge.log(["the types mismatch, picking", l]), l;
    });
  return r;
}, "default"), he = /* @__PURE__ */ n((t, ...e) => {
  let r = {};
  r = H(
    {},
    t,
    (a, l) => {
      if (Array.isArray(l))
        return l;
    }
  );
  for (let a of e)
    r = H(r, a, (l, o) => {
      if (Array.isArray(o))
        return o;
    });
  return r;
}, "noArrayMerge");

// src/manager-api/initial-state.ts
var ar = /* @__PURE__ */ n((...t) => t.reduce((e, r) => k(e, r), {}), "main"), tt = ar;

// src/manager-api/lib/addons.ts
import { logger as lr } from "storybook/internal/client-logger";
import { SET_CONFIG as me } from "storybook/internal/core-events";
import { Addon_TypesEnum as Pe } from "storybook/internal/types";
import { global as gt } from "@storybook/global";

// src/manager-api/lib/storybook-channel-mock.ts
import { Channel as ir } from "storybook/internal/channels";
function ft() {
  let t = {
    setHandler: /* @__PURE__ */ n(() => {
    }, "setHandler"),
    send: /* @__PURE__ */ n(() => {
    }, "send")
  };
  return new ir({ transport: t });
}
n(ft, "mockChannel");

// src/manager-api/lib/addons.ts
var Pt = class Pt {
  constructor() {
    this.loaders = {};
    this.elements = {};
    this.config = {};
    this.getChannel = /* @__PURE__ */ n(() => (this.channel || this.setChannel(ft()), this.channel), "getChannel");
    this.ready = /* @__PURE__ */ n(() => this.promise, "ready");
    this.hasChannel = /* @__PURE__ */ n(() => !!this.channel, "hasChannel");
    this.setChannel = /* @__PURE__ */ n((e) => {
      this.channel = e, this.resolve();
    }, "setChannel");
    this.setConfig = /* @__PURE__ */ n((e) => {
      Object.assign(this.config, e), this.hasChannel() ? this.getChannel().emit(me, this.config) : this.ready().then((r) => {
        r.emit(me, 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((e, r) => {
      this.loaders[e] && lr.warn(`${e} was loaded twice, this could have bad side-effects`), this.loaders[e] = r;
    }, "register");
    this.loadAddons = /* @__PURE__ */ n((e) => {
      Object.values(this.loaders).forEach((r) => r(e));
    }, "loadAddons");
    this.promise = new Promise((e) => {
      this.resolve = () => e(this.getChannel());
    });
  }
  getElements(e) {
    return this.elements[e] || (this.elements[e] = {}), this.elements[e];
  }
  /**
   * 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(e, r) {
    let { type: a } = r, l = this.getElements(a);
    l[e] = { ...r, id: e };
  }
  experimental_getRegisteredAddons() {
    return Object.keys(this.loaders);
  }
};
n(Pt, "AddonStore");
var mt = Pt, ht = "__STORYBOOK_ADDONS_MANAGER";
function cr() {
  return gt[ht] || (gt[ht] = new mt()), gt[ht];
}
n(cr, "getAddonsStore");
var ur = cr();

// src/manager-api/modules/addons.ts
var It = {};
R(It, {
  ensurePanel: () => bt,
  init: () => dr
});
import { Addon_TypesEnum as be } from "storybook/internal/types";
function bt(t, e, r) {
  let a = Object.keys(t);
  return a.indexOf(e) >= 0 ? e : a.length ? a[0] : r;
}
n(bt, "ensurePanel");
var dr = /* @__PURE__ */ n(({ provider: t, store: e, fullAPI: r }) => {
  let a = {
    getElements: /* @__PURE__ */ n((l) => t.getElements(l), "getElements"),
    getSelectedPanel: /* @__PURE__ */ n(() => {
      let { selectedPanel: l } = e.getState();
      return bt(a.getElements(be.PANEL), l, l);
    }, "getSelectedPanel"),
    setSelectedPanel: /* @__PURE__ */ n((l) => {
      e.setState({ selectedPanel: l }, { persistence: "session" });
    }, "setSelectedPanel"),
    setAddonState(l, o, c) {
      let s = typeof o == "function" ? o : () => o;
      return e.setState(
        (d) => ({ ...d, addons: { ...d.addons, [l]: s(d.addons[l]) } }),
        c
      ).then(() => a.getAddonState(l));
    },
    getAddonState: /* @__PURE__ */ n((l) => e.getState().addons[l] || globalThis?.STORYBOOK_ADDON_STATE[l], "getAddonState")
  };
  return {
    api: a,
    state: {
      selectedPanel: bt(
        a.getElements(be.PANEL),
        e.getState().selectedPanel
      ),
      addons: {}
    }
  };
}, "init");

// src/manager-api/modules/channel.ts
var At = {};
R(At, {
  init: () => pr
});
var pr = /* @__PURE__ */ n(({ provider: t }) => ({ api: {
  getChannel: /* @__PURE__ */ n(() => t.channel, "getChannel"),
  on: /* @__PURE__ */ n((r, a) => (t.channel?.on(r, a), () => t.channel?.off(r, a)), "on"),
  off: /* @__PURE__ */ n((r, a) => t.channel?.off(r, a), "off"),
  once: /* @__PURE__ */ n((r, a) => t.channel?.once(r, a), "once"),
  emit: /* @__PURE__ */ n((r, a, ...l) => {
    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"), t.channel?.emit(r, a, ...l);
  }, "emit")
}, state: {} }), "init");

// src/manager-api/modules/globals.ts
var xt = {};
R(xt, {
  init: () => Er
});
import { logger as ke } from "storybook/internal/client-logger";
import { GLOBALS_UPDATED as vr, SET_GLOBALS as _r, UPDATE_GLOBALS as Tr } from "storybook/internal/core-events";

// src/manager-api/lib/events.ts
import { logger as Ar } from "storybook/internal/client-logger";

// src/manager-api/modules/refs.ts
var Et = {};
R(Et, {
  defaultStoryMapper: () => Ce,
  getSourceType: () => Tt,
  init: () => Ir
});
import { global as Oe } from "@storybook/global";

// src/manager-api/lib/stories.ts
import { sanitize as yr } from "storybook/internal/csf";
var vt = J(ce(), 1);

// src/manager-api/lib/intersect.ts
var Ie = /* @__PURE__ */ n((t, e) => !Array.isArray(t) || !Array.isArray(e) || !t.length || !e.length ? [] : t.reduce((r, a) => (e.includes(a) && r.push(a), r), []), "default");

// src/manager-api/lib/stories.ts
var Sr = /\s*\/\s*/, Ae = /* @__PURE__ */ n(({
  globalParameters: t,
  kindParameters: e,
  stories: r
}) => le(r, (a) => ({
  ...a,
  parameters: Ee(
    t,
    e[a.kind],
    a.parameters
  )
})), "denormalizeStoryParameters"), ve = /* @__PURE__ */ n((t) => ({ v: 5, entries: Object.entries(t).reduce(
  (r, [a, l]) => {
    if (!l)
      return r;
    let { docsOnly: o, fileName: c, ...s } = l.parameters, d = {
      title: l.kind,
      id: a,
      name: l.name,
      importPath: c
    };
    if (o)
      r[a] = {
        type: "docs",
        tags: ["stories-mdx"],
        storiesImports: [],
        ...d
      };
    else {
      let { argTypes: i, args: u, initialArgs: p } = l;
      r[a] = {
        type: "story",
        ...d,
        parameters: s,
        argTypes: i,
        args: u,
        initialArgs: p
      };
    }
    return r;
  },
  {}
) }), "transformSetStoriesStoryDataToPreparedStoryIndex"), fr = /* @__PURE__ */ n((t) => ({
  v: 3,
  stories: Object.values(t.stories).reduce(
    (e, r) => (e[r.id] = {
      ...r,
      title: r.kind,
      name: r.name || r.story,
      importPath: r.parameters.fileName || ""
    }, e),
    {}
  )
}), "transformStoryIndexV2toV3"), gr = /* @__PURE__ */ n((t) => {
  let e = ie(Object.values(t.stories), (r) => r.title);
  return {
    v: 4,
    entries: Object.values(t.stories).reduce(
      (r, a) => {
        let l = "story";
        return (a.parameters?.docsOnly || a.name === "Page" && e[a.title] === 1) && (l = "docs"), r[a.id] = {
          type: l,
          ...l === "docs" && { tags: ["stories-mdx"], storiesImports: [] },
          ...a
        }, delete r[a.id].story, delete r[a.id].kind, r;
      },
      {}
    )
  };
}, "transformStoryIndexV3toV4"), hr = /* @__PURE__ */ n((t) => ({
  v: 5,
  entries: Object.values(t.entries).reduce(
    (e, r) => (e[r.id] = {
      ...r,
      tags: r.tags ? ["dev", "test", ...r.tags] : ["dev"]
    }, e),
    {}
  )
}), "transformStoryIndexV4toV5"), W = /* @__PURE__ */ n((t, { provider: e, docsOptions: r, filters: a, allStatuses: l }) => {
  if (!t.v)
    throw new Error("Composition: Missing stories.json version");
  let o = t;
  o = o.v === 2 ? fr(o) : o, o = o.v === 3 ? gr(o) : o, o = o.v === 4 ? hr(o) : o, o = o;
  let c = Object.values(o.entries).filter((g) => {
    let h = !0, m = l[g.id] ?? {};
    return Object.values(m).some(({ value: b }) => b === "status-value:error") || Object.values(a).forEach((b) => {
      h !== !1 && (h = b({ ...g, statuses: m }));
    }), h;
  }), { sidebar: s = {} } = e.getConfig(), { showRoots: d, collapsedRoots: i = [], renderLabel: u } = s, p = typeof d < "u", y = c.reduce((g, h) => {
    if (r.docsMode && h.type !== "docs")
      return g;
    let { title: m } = h, b = m.trim().split(Sr), A = (!p || d) && b.length > 1 ? [b.shift()] : [], _ = [...A, ...b], x = _.reduce((I, v, N) => {
      let pt = N > 0 && I[N - 1], yt = yr(pt ? `${pt}-${v}` : v);
      if (v.trim() === "")
        throw new Error(F`Invalid title ${m} ending in slash.`);
      if (pt === yt)
        throw new Error(
          F`
          Invalid part '${v}', leading to id === parentId ('${yt}'), inside title '${m}'
          
          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(yt), I;
    }, []);
    return x.forEach((I, v) => {
      let N = x[v + 1] || h.id;
      A.length && v === 0 ? g[I] = k(g[I] || {}, {
        type: "root",
        id: I,
        name: _[v],
        tags: [],
        depth: v,
        renderLabel: u,
        startCollapsed: i.includes(I),
        // Note that this will later get appended to the previous list of children (see below)
        children: [N]
      }) : (!g[I] || g[I].type === "component") && v === x.length - 1 ? g[I] = k(g[I] || {}, {
        type: "component",
        id: I,
        name: _[v],
        tags: [],
        parent: x[v - 1],
        depth: v,
        renderLabel: u,
        ...N && {
          children: [N]
        }
      }) : g[I] = k(g[I] || {}, {
        type: "group",
        id: I,
        name: _[v],
        tags: [],
        parent: x[v - 1],
        depth: v,
        renderLabel: u,
        ...N && {
          children: [N]
        }
      });
    }), g[h.id] = {
      type: "story",
      tags: [],
      ...h,
      depth: x.length,
      parent: x[x.length - 1],
      renderLabel: u,
      prepared: !!h.parameters
    }, g;
  }, {});
  function S(g, h) {
    return g[h.id] || (g[h.id] = h, (h.type === "root" || h.type === "group" || h.type === "component") && (h.children.forEach((m) => S(g, y[m])), h.tags = h.children.reduce((m, b) => {
      let A = g[b];
      return m === null ? A.tags : Ie(m, A.tags);
    }, null))), g;
  }
  n(S, "addItem");
  let f = Object.values(y).filter((g) => g.type !== "root" && !g.parent).reduce(S, {});
  return Object.values(y).filter((g) => g.type === "root").reduce(S, f);
}, "transformStoryIndexToStoriesHash"), _t = /* @__PURE__ */ n((t, e) => e ? Object.fromEntries(
  Object.entries(t).map(([r, a]) => {
    let l = e[r];
    return a.type === "story" && l?.type === "story" && l.prepared ? [r, { ...l, ...a, prepared: !0 }] : [r, a];
  })
) : t, "addPreparedStories"), _e = (0, vt.default)(1)((t) => Object.entries(t).reduce((e, r) => {
  let a = r[1];
  return a.type === "component" && e.push([...a.children]), e;
}, [])), Te = (0, vt.default)(1)((t) => Object.keys(t).filter((e) => ["story", "docs"].includes(t[e].type)));

// src/manager-api/modules/refs.ts
var { location: mr, fetch: xe } = Oe, Tt = /* @__PURE__ */ n((t, e) => {
  let { origin: r, pathname: a } = mr, { origin: l, pathname: o } = new URL(t), c = `${r + a}`.replace("/iframe.html", "").replace(/\/$/, ""), s = `${l + o}`.replace("/iframe.html", "").replace(/\/$/, "");
  return c === s ? ["local", s] : e || t ? ["external", s] : [null, null];
}, "getSourceType"), Ce = /* @__PURE__ */ n((t, e) => ({ ...e, kind: e.kind.replace("|", "/") }), "defaultStoryMapper"), Re = /* @__PURE__ */ n((t, e) => Object.entries(t).reduce((r, [a, l]) => ({ ...r, [a]: { ...l, refId: e.id } }), {}), "addRefIds");
async function we(t) {
  if (!t)
    return {};
  try {
    let e = await t;
    if (e === !1 || e === !0)
      throw new Error("Unexpected boolean response");
    if (!e.ok)
      throw new Error(`Unexpected response not OK: ${e.statusText}`);
    let r = await e.json();
    return r.entries || r.stories ? { storyIndex: r } : r;
  } catch (e) {
    return { indexError: e };
  }
}
n(we, "handleRequest");
var Pr = /* @__PURE__ */ n((t) => {
  let e = /https?:\/\/(.+:.+)@/, r = t, a, [, l] = t.match(e) || [];
  return l && (r = t.replace(`${l}@`, ""), a = btoa(`${l}`)), {
    url: r,
    authorization: a
  };
}, "parseUrl"), br = /* @__PURE__ */ n((t, e, r) => {
  let { storyMapper: a } = r;
  return a ? Object.entries(t).reduce((l, [o, c]) => ({ ...l, [o]: a(e, c) }), {}) : t;
}, "map"), Ir = /* @__PURE__ */ n(({ store: t, provider: e, singleStory: r, docsOptions: a = {} }, { runCheck: l = !0 } = {}) => {
  let o = {
    findRef: /* @__PURE__ */ n((d) => {
      let i = o.getRefs();
      return Object.values(i).find(({ url: u }) => u.match(d));
    }, "findRef"),
    changeRefVersion: /* @__PURE__ */ n(async (d, i) => {
      let { versions: u, title: p } = o.getRefs()[d], y = {
        id: d,
        url: i,
        versions: u,
        title: p,
        index: {},
        filteredIndex: {},
        expanded: !0
      };
      await o.setRef(d, { ...y, type: "unknown" }, !1), await o.checkRef(y);
    }, "changeRefVersion"),
    changeRefState: /* @__PURE__ */ n((d, i) => {
      let { [d]: u, ...p } = o.getRefs();
      p[d] = { ...u, previewInitialized: i }, t.setState({
        refs: p
      });
    }, "changeRefState"),
    checkRef: /* @__PURE__ */ n(async (d) => {
      let { id: i, url: u, version: p, type: y } = d, S = y === "server-checked", f = {}, g = p ? `?version=${p}` : "", h = S ? "omit" : "include", m = Pr(u), b = {
        Accept: "application/json"
      };
      m.authorization && Object.assign(b, {
        Authorization: `Basic ${m.authorization}`
      });
      let [A, _] = await Promise.all(
        ["index.json", "stories.json"].map(
          async (I) => we(
            xe(`${m.url}/${I}${g}`, {
              headers: b,
              credentials: h
            })
          )
        )
      );
      if (!A.indexError || !_.indexError) {
        let I = await we(
          xe(`${m.url}/metadata.json${g}`, {
            headers: b,
            credentials: h,
            cache: "no-cache"
          }).catch(() => !1)
        );
        Object.assign(f, {
          ...A.indexError ? _ : A,
          ...!I.indexError && I
        });
      } else S || (f.indexError = {
        message: F`
            Error: Loading of ref failed
              at fetch (lib/api/src/modules/refs.ts)

            URL: ${m.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 = d.versions && Object.keys(d.versions).length ? d.versions : f.versions;
      await o.setRef(i, {
        id: i,
        url: m.url,
        ...f,
        ...x ? { versions: x } : {},
        type: f.storyIndex ? "lazy" : "auto-inject"
      });
    }, "checkRef"),
    getRefs: /* @__PURE__ */ n(() => {
      let { refs: d = {} } = t.getState();
      return d;
    }, "getRefs"),
    setRef: /* @__PURE__ */ n(async (d, { storyIndex: i, setStoriesData: u, ...p }, y = !1) => {
      if (r)
        return;
      let S, f, g, { filters: h } = t.getState(), { storyMapper: m = Ce } = e.getConfig(), b = o.getRefs()[d];
      (i || u) && (S = u ? ve(
        br(u, b, { storyMapper: m })
      ) : i, g = W(i, {
        provider: e,
        docsOptions: a,
        filters: h,
        allStatuses: {}
      }), f = W(i, {
        provider: e,
        docsOptions: a,
        filters: {},
        allStatuses: {}
      })), f && (f = Re(f, b)), g && (g = Re(g, b)), await o.updateRef(d, { ...b, ...p, index: f, filteredIndex: g, internal_index: S });
    }, "setRef"),
    updateRef: /* @__PURE__ */ n(async (d, i) => {
      let { [d]: u, ...p } = o.getRefs();
      p[d] = { ...u, ...i };
      let y = Object.keys(s).reduce((S, f) => (S[f] = p[f], S), {});
      await t.setState({
        refs: y
      });
    }, "updateRef")
  }, c = !r && Oe.REFS || {}, s = c;
  return l && new Promise(async (d) => {
    for (let i of Object.values(c))
      await o.checkRef({ ...i, stories: {} });
    d(void 0);
  }), {
    api: o,
    state: {
      refs: s
    }
  };
}, "init");

// src/manager-api/lib/events.ts
var T = /* @__PURE__ */ n((t, e) => {
  let { source: r, refId: a, type: l } = t, [o, c] = Tt(r, a), s;
  (a || o === "external") && (s = a && e.getRefs()[a] ? e.getRefs()[a] : e.findRef(c));
  let d = {
    source: r,
    sourceType: o,
    sourceLocation: c,
    refId: a,
    ref: s,
    type: l
  };
  switch (!0) {
    case typeof a == "string":
    case o === "local":
    case o === "external":
      return d;
    // if we couldn't find the source, something risky happened, we ignore the input, and log a warning
    default:
      return Ar.warn(`Received a ${l} frame that was not configured as a ref`), null;
  }
}, "getEventMetadata");

// src/manager-api/modules/globals.ts
var Er = /* @__PURE__ */ n(({ store: t, fullAPI: e, provider: r }) => {
  let a = {
    getGlobals() {
      return t.getState().globals;
    },
    getUserGlobals() {
      return t.getState().userGlobals;
    },
    getStoryGlobals() {
      return t.getState().storyGlobals;
    },
    getGlobalTypes() {
      return t.getState().globalTypes;
    },
    updateGlobals(c) {
      r.channel?.emit(Tr, {
        globals: c,
        options: {
          target: "storybook-preview-iframe"
        }
      });
    }
  }, l = {
    globals: {},
    userGlobals: {},
    storyGlobals: {},
    globalTypes: {}
  }, o = /* @__PURE__ */ n(({
    globals: c,
    storyGlobals: s,
    userGlobals: d
  }) => {
    let {
      globals: i,
      userGlobals: u,
      storyGlobals: p
    } = t.getState();
    M(c, i) || t.setState({ globals: c }), M(d, u) || t.setState({ userGlobals: d }), M(s, p) || t.setState({ storyGlobals: s });
  }, "updateGlobals");
  return r.channel?.on(
    vr,
    /* @__PURE__ */ n(function({ globals: s, storyGlobals: d, userGlobals: i }) {
      let { ref: u } = T(this, e);
      u ? ke.warn(
        "received a GLOBALS_UPDATED from a non-local ref. This is not currently supported."
      ) : o({ globals: s, storyGlobals: d, userGlobals: i });
    }, "handleGlobalsUpdated")
  ), r.channel?.on(
    _r,
    /* @__PURE__ */ n(function({ globals: s, globalTypes: d }) {
      let { ref: i } = T(this, e), u = t.getState()?.globals;
      i ? Object.keys(s).length > 0 && ke.warn("received globals from a non-local ref. This is not currently supported.") : t.setState({ globals: s, userGlobals: s, globalTypes: d }), u && Object.keys(u).length !== 0 && !M(s, u) && a.updateGlobals(u);
    }, "handleSetGlobals")
  ), {
    api: a,
    state: l
  };
}, "init");

// src/manager-api/modules/layout.ts
var rt = {};
R(rt, {
  ActiveTabs: () => Me,
  defaultLayoutState: () => E,
  focusableUIElements: () => z,
  init: () => Cr
});
import { SET_CONFIG as xr } from "storybook/internal/core-events";
import { global as Rr } from "@storybook/global";
import { create as wr } from "storybook/theming/create";
var { document: Or } = Rr, De = /* @__PURE__ */ n((t) => typeof t == "function", "isFunction"), Me = {
  SIDEBAR: "sidebar",
  CANVAS: "canvas",
  ADDONS: "addons"
}, E = {
  ui: {
    enableShortcuts: !0
  },
  layout: {
    initialActive: Me.CANVAS,
    showToolbar: !0,
    navSize: 300,
    bottomPanelHeight: 300,
    rightPanelWidth: 400,
    recentVisibleSizes: {
      navSize: 300,
      bottomPanelHeight: 300,
      rightPanelWidth: 400
    },
    panelPosition: "bottom",
    showTabs: !0
  },
  layoutCustomisations: {
    showSidebar: void 0,
    showToolbar: void 0
  },
  selectedPanel: void 0,
  theme: wr()
}, z = {
  storySearchField: "storybook-explorer-searchfield",
  storyListMenu: "storybook-explorer-menu",
  storyPanelRoot: "storybook-panel-root"
}, Rt = /* @__PURE__ */ n((t) => t.layout.navSize > 0, "getIsNavShown"), wt = /* @__PURE__ */ n((t) => {
  let { bottomPanelHeight: e, rightPanelWidth: r, panelPosition: a } = t.layout;
  return a === "bottom" && e > 0 || a === "right" && r > 0;
}, "getIsPanelShown"), Ne = /* @__PURE__ */ n((t) => !Rt(t) && !wt(t), "getIsFullscreen"), et = /* @__PURE__ */ n((t) => ({
  navSize: t.navSize > 0 ? t.navSize : t.recentVisibleSizes.navSize,
  bottomPanelHeight: t.bottomPanelHeight > 0 ? t.bottomPanelHeight : t.recentVisibleSizes.bottomPanelHeight,
  rightPanelWidth: t.rightPanelWidth > 0 ? t.rightPanelWidth : t.recentVisibleSizes.rightPanelWidth
}), "getRecentVisibleSizes"), Cr = /* @__PURE__ */ n(({ store: t, provider: e, singleStory: r }) => {
  let a = {
    toggleFullscreen(o) {
      return t.setState(
        (c) => {
          let s = Ne(c), d = typeof o == "boolean" ? o : !s;
          return d === s ? { layout: c.layout } : d ? {
            layout: {
              ...c.layout,
              navSize: 0,
              bottomPanelHeight: 0,
              rightPanelWidth: 0,
              recentVisibleSizes: et(c.layout)
            }
          } : {
            layout: {
              ...c.layout,
              navSize: c.singleStory ? 0 : c.layout.recentVisibleSizes.navSize,
              bottomPanelHeight: c.layout.recentVisibleSizes.bottomPanelHeight,
              rightPanelWidth: c.layout.recentVisibleSizes.rightPanelWidth
            }
          };
        },
        { persistence: "session" }
      );
    },
    togglePanel(o) {
      return t.setState(
        (c) => {
          let s = wt(c), d = typeof o == "boolean" ? o : !s;
          return d === s ? { layout: c.layout } : d ? {
            layout: {
              ...c.layout,
              bottomPanelHeight: c.layout.recentVisibleSizes.bottomPanelHeight,
              rightPanelWidth: c.layout.recentVisibleSizes.rightPanelWidth
            }
          } : {
            layout: {
              ...c.layout,
              bottomPanelHeight: 0,
              rightPanelWidth: 0,
              recentVisibleSizes: et(c.layout)
            }
          };
        },
        { persistence: "session" }
      );
    },
    togglePanelPosition(o) {
      return t.setState(
        (c) => {
          let s = o || (c.layout.panelPosition === "right" ? "bottom" : "right");
          return {
            layout: {
              ...c.layout,
              panelPosition: s,
              bottomPanelHeight: c.layout.recentVisibleSizes.bottomPanelHeight,
              rightPanelWidth: c.layout.recentVisibleSizes.rightPanelWidth
            }
          };
        },
        { persistence: "permanent" }
      );
    },
    toggleNav(o) {
      return t.setState(
        (c) => {
          if (c.singleStory)
            return { layout: c.layout };
          let s = Rt(c), d = typeof o == "boolean" ? o : !s;
          return d === s ? { layout: c.layout } : d ? {
            layout: {
              ...c.layout,
              navSize: c.layout.recentVisibleSizes.navSize
            }
          } : {
            layout: {
              ...c.layout,
              navSize: 0,
              recentVisibleSizes: et(c.layout)
            }
          };
        },
        { persistence: "session" }
      );
    },
    toggleToolbar(o) {
      return t.setState(
        (c) => {
          let s = typeof o < "u" ? o : !c.layout.showToolbar;
          return {
            layout: {
              ...c.layout,
              showToolbar: s
            }
          };
        },
        { persistence: "session" }
      );
    },
    setSizes({
      navSize: o,
      bottomPanelHeight: c,
      rightPanelWidth: s
    }) {
      return t.setState(
        (d) => {
          let i = {
            ...d.layout,
            navSize: o ?? d.layout.navSize,
            bottomPanelHeight: c ?? d.layout.bottomPanelHeight,
            rightPanelWidth: s ?? d.layout.rightPanelWidth
          };
          return {
            layout: {
              ...i,
              recentVisibleSizes: et(i)
            }
          };
        },
        { persistence: "session" }
      );
    },
    focusOnUIElement(o, c) {
      if (!o)
        return;
      let s = Or.getElementById(o);
      s && (s.focus(), c && s.select());
    },
    getInitialOptions() {
      let { theme: o, selectedPanel: c, layoutCustomisations: s, ...d } = e.getConfig();
      return {
        ...E,
        layout: {
          ...Z(
            E.layout,
            K(d, Object.keys(E.layout))
          ),
          ...r && { navSize: 0 }
        },
        layoutCustomisations: {
          ...E.layoutCustomisations,
          ...s ?? {}
        },
        ui: Z(E.ui, K(d, Object.keys(E.ui))),
        selectedPanel: c || E.selectedPanel,
        theme: o || E.theme
      };
    },
    getIsFullscreen() {
      return Ne(t.getState());
    },
    getIsPanelShown() {
      return wt(t.getState());
    },
    getIsNavShown() {
      return Rt(t.getState());
    },
    getShowToolbarWithCustomisations(o) {
      let c = t.getState();
      return De(c.layoutCustomisations.showToolbar) ? c.layoutCustomisations.showToolbar(c, o) ?? o : o;
    },
    getNavSizeWithCustomisations(o) {
      let c = t.getState();
      if (De(c.layoutCustomisations.showSidebar)) {
        let s = c.layoutCustomisations.showSidebar(c, o !== 0);
        if (o === 0 && s === !0)
          return c.layout.recentVisibleSizes.navSize;
        if (o !== 0 && s === !1)
          return 0;
      }
      return o;
    },
    setOptions: /* @__PURE__ */ n((o) => {
      let { layout: c, ui: s, selectedPanel: d, theme: i } = t.getState();
      if (!o)
        return;
      let u = {
        ...c,
        ...o.layout || {},
        ...K(o, Object.keys(c)),
        ...r && { navSize: 0 }
      }, p = {
        ...s,
        ...o.ui,
        ...Z(o.ui || {}, K(o, Object.keys(s)))
      }, y = {
        ...i,
        ...o.theme
      }, S = {};
      w(s, p) || (S.ui = p), w(c, u) || (S.layout = u), o.selectedPanel && !w(d, o.selectedPanel) && (S.selectedPanel = o.selectedPanel), Object.keys(S).length && t.setState(S, { persistence: "permanent" }), w(i, y) || t.setState({ theme: y });
    }, "setOptions")
  }, l = K(t.getState(), ["layout", "selectedPanel"]);
  return e.channel?.on(xr, () => {
    a.setOptions(k(a.getInitialOptions(), l));
  }), {
    api: a,
    state: k(a.getInitialOptions(), l)
  };
}, "init");

// src/manager-api/modules/notifications.ts
var Ot = {};
R(Ot, {
  init: () => kr
});
var kr = /* @__PURE__ */ n(({ store: t }) => ({ api: {
  addNotification: /* @__PURE__ */ n((a) => {
    t.setState(({ notifications: l }) => {
      let [o, c] = St(l, (s) => s.id === a.id);
      return o.forEach((s) => {
        s.onClear && s.onClear({ dismissed: !1, timeout: !1 });
      }), { notifications: [...c, a] };
    });
  }, "addNotification"),
  clearNotification: /* @__PURE__ */ n((a) => {
    t.setState(({ notifications: l }) => {
      let [o, c] = St(l, (s) => s.id === a);
      return o.forEach((s) => {
        s.onClear && s.onClear({ dismissed: !1, timeout: !1 });
      }), { notifications: c };
    });
  }, "clearNotification")
}, state: { notifications: [] } }), "init");

// src/manager-api/modules/provider.ts
var Ct = {};
R(Ct, {
  init: () => Dr
});
var Dr = /* @__PURE__ */ n(({ provider: t, fullAPI: e }) => ({
  api: t.renderPreview ? { renderPreview: t.renderPreview } : {},
  state: {},
  init: /* @__PURE__ */ n(() => {
    t.handleAPI(e);
  }, "init")
}), "init");

// src/manager-api/modules/settings.ts
var kt = {};
R(kt, {
  init: () => Nr
});
var Nr = /* @__PURE__ */ n(({ store: t, navigate: e, fullAPI: r }) => ({
  state: { settings: { lastTrackedStoryId: null } },
  api: {
    closeSettings: /* @__PURE__ */ n(() => {
      let {
        settings: { lastTrackedStoryId: o }
      } = t.getState();
      o ? r.selectStory(o) : r.selectFirstStory();
    }, "closeSettings"),
    changeSettingsTab: /* @__PURE__ */ n((o) => {
      e(`/settings/${o}`);
    }, "changeSettingsTab"),
    isSettingsScreenActive: /* @__PURE__ */ n(() => {
      let { path: o } = r.getUrlState();
      return !!(o || "").match(/^\/settings/);
    }, "isSettingsScreenActive"),
    retrieveSelection() {
      let { settings: o } = t.getState();
      return o.lastTrackedStoryId;
    },
    storeSelection: /* @__PURE__ */ n(async () => {
      let { storyId: o, settings: c } = t.getState();
      await t.setState({
        settings: { ...c, lastTrackedStoryId: o }
      });
    }, "storeSelection")
  }
}), "init");

// src/manager-api/modules/shortcuts.ts
var Kt = {};
R(Kt, {
  controlOrMetaKey: () => j,
  defaultShortcuts: () => G,
  init: () => Vr,
  isMacLike: () => Le,
  keys: () => Ft
});
import {
  FORCE_REMOUNT as Br,
  PREVIEW_KEYDOWN as Fr,
  STORIES_COLLAPSE_ALL as Kr,
  STORIES_EXPAND_ALL as Wr
} from "storybook/internal/core-events";
import { global as jr } from "@storybook/global";

// src/manager-api/lib/shortcut.ts
import { global as Mr } from "@storybook/global";
var { navigator: Dt } = Mr, Nt = /* @__PURE__ */ n(() => Dt && Dt.platform ? !!Dt.platform.match(/(Mac|iPhone|iPod|iPad)/i) : !1, "isMacLike"), ps = /* @__PURE__ */ n(() => Nt() ? "\u2318" : "ctrl", "controlOrMetaSymbol"), ys = /* @__PURE__ */ n(() => Nt() ? "meta" : "control", "controlOrMetaKey"), Ur = /* @__PURE__ */ n(() => Nt() ? "\u2325" : "alt", "optionOrAltSymbol"), Ss = /* @__PURE__ */ n((t, e) => JSON.stringify(t) === JSON.stringify(e), "isShortcutTaken"), Mt = /* @__PURE__ */ n((t) => {
  if (["Meta", "Alt", "Control", "Shift"].includes(t.key))
    return null;
  let e = [];
  if (t.altKey && e.push("alt"), t.ctrlKey && e.push("control"), t.metaKey && e.push("meta"), t.shiftKey && e.push("shift"), t.key && t.key.length === 1 && t.key !== " ") {
    let r = t.key.toUpperCase(), a = t.code?.toUpperCase().replace("KEY", "").replace("DIGIT", "");
    a && a.length === 1 && a !== r ? e.push([r, a]) : e.push(r);
  }
  return t.key === " " && e.push("space"), t.key === "Escape" && e.push("escape"), t.key === "ArrowRight" && e.push("ArrowRight"), t.key === "ArrowDown" && e.push("ArrowDown"), t.key === "ArrowUp" && e.push("ArrowUp"), t.key === "ArrowLeft" && e.push("ArrowLeft"), e.length > 0 ? e : null;
}, "eventToShortcut"), Ut = /* @__PURE__ */ n((t, e) => !t || !e || (t.join("").startsWith("shift/") && t.shift(), t.length !== e.length) ? !1 : !t.find(
  (r, a) => Array.isArray(r) ? !r.includes(e[a]) : r !== e[a]
), "shortcutMatchesShortcut"), fs = /* @__PURE__ */ n((t, e) => Ut(Mt(t), e), "eventMatchesShortcut"), Lr = /* @__PURE__ */ n((t) => t === "alt" ? Ur() : t === "control" ? "\u2303" : t === "meta" ? "\u2318" : t === "shift" ? "\u21E7\u200B" : t === "Enter" || t === "Backspace" || t === "Esc" || t === "escape" ? "" : t === " " ? "SPACE" : t === "ArrowUp" ? "\u2191" : t === "ArrowDown" ? "\u2193" : t === "ArrowLeft" ? "\u2190" : t === "ArrowRight" ? "\u2192" : t.toUpperCase(), "keyToSymbol"), gs = /* @__PURE__ */ n((t) => t.map(Lr).join(" "), "shortcutToHumanString");

// src/manager-api/modules/shortcuts.ts
var { navigator: Lt, document: Ue } = jr, Le = /* @__PURE__ */ n(() => Lt && Lt.platform ? !!Lt.platform.match(/(Mac|iPhone|iPod|iPad)/i) : !1, "isMacLike"), j = /* @__PURE__ */ n(() => Le() ? "meta" : "control", "controlOrMetaKey");
function Ft(t) {
  return Object.keys(t);
}
n(Ft, "keys");
var G = Object.freeze({
  fullScreen: ["alt", "F"],
  togglePanel: ["alt", "A"],
  panelPosition: ["alt", "D"],
  toggleNav: ["alt", "S"],
  toolbar: ["alt", "T"],
  search: [j(), "K"],
  focusNav: ["1"],
  focusIframe: ["2"],
  focusPanel: ["3"],
  prevComponent: ["alt", "ArrowUp"],
  nextComponent: ["alt", "ArrowDown"],
  prevStory: ["alt", "ArrowLeft"],
  nextStory: ["alt", "ArrowRight"],
  shortcutsPage: [j(), "shift", ","],
  aboutPage: [j(), ","],
  escape: ["escape"],
  // This one is not customizable
  collapseAll: [j(), "shift", "ArrowUp"],
  expandAll: [j(), "shift", "ArrowDown"],
  remount: ["alt", "R"]
}), Bt = {};
function Gr(t) {
  let e = t.target;
  return !!(/input|textarea/i.test(e.tagName) || e.getAttribute("contenteditable") !== null || e.closest("dialog[open]"));
}
n(Gr, "shouldSkipShortcut");
var Vr = /* @__PURE__ */ n(({ store: t, fullAPI: e, provider: r }) => {
  let a = {
    // Getting and setting shortcuts
    getShortcutKeys() {
      return t.getState().shortcuts;
    },
    getDefaultShortcuts() {
      return {
        ...G,
        ...a.getAddonsShortcutDefaults()
      };
    },
    getAddonsShortcuts() {
      return Bt;
    },
    getAddonsShortcutLabels() {
      let s = {};
      return Object.entries(a.getAddonsShortcuts()).forEach(([d, { label: i }]) => {
        s[d] = i;
      }), s;
    },
    getAddonsShortcutDefaults() {
      let s = {};
      return Object.entries(a.getAddonsShortcuts()).forEach(([d, { defaultShortcut: i }]) => {
        s[d] = i;
      }), s;
    },
    async setShortcuts(s) {
      return await t.setState({ shortcuts: s }, { persistence: "permanent" }), s;
    },
    async restoreAllDefaultShortcuts() {
      return a.setShortcuts(a.getDefaultShortcuts());
    },
    async setShortcut(s, d) {
      let i = a.getShortcutKeys();
      return await a.setShortcuts({ ...i, [s]: d }), d;
    },
    async setAddonShortcut(s, d) {
      let i = a.getShortcutKeys();
      return await a.setShortcuts({
        ...i,
        [`${s}-${d.actionName}`]: d.defaultShortcut
      }), Bt[`${s}-${d.actionName}`] = d, d;
    },
    async restoreDefaultShortcut(s) {
      let d = a.getDefaultShortcuts()[s];
      return a.setShortcut(s, d);
    },
    // Listening to shortcut events
    handleKeydownEvent(s) {
      let d = Mt(s), i = a.getShortcutKeys(), p = Ft(i).find(
        (y) => Ut(d, i[y])
      );
      p && a.handleShortcutFeature(p, s);
    },
    // warning: event might not have a full prototype chain because it may originate from the channel
    handleShortcutFeature(s, d) {
      let {
        ui: { enableShortcuts: i },
        storyId: u
      } = t.getState();
      if (i)
        switch (d?.preventDefault && d.preventDefault(), s) {
          case "escape": {
            e.getIsFullscreen() ? e.toggleFullscreen(!1) : e.getIsNavShown() && e.toggleNav(!0);
            break;
          }
          case "focusNav": {
            e.getIsFullscreen() && e.toggleFullscreen(!1), e.getIsNavShown() || e.toggleNav(!0), e.focusOnUIElement(z.storyListMenu);
            break;
          }
          case "search": {
            e.getIsFullscreen() && e.toggleFullscreen(!1), e.getIsNavShown() || e.toggleNav(!0), setTimeout(() => {
              e.focusOnUIElement(z.storySearchField, !0);
            }, 0);
            break;
          }
          case "focusIframe": {
            let p = Ue.getElementById("storybook-preview-iframe");
            if (p)
              try {
                p.contentWindow.focus();
              } catch {
              }
            break;
          }
          case "focusPanel": {
            e.getIsFullscreen() && e.toggleFullscreen(!1), e.getIsPanelShown() || e.togglePanel(!0), e.focusOnUIElement(z.storyPanelRoot);
            break;
          }
          case "nextStory": {
            e.jumpToStory(1);
            break;
          }
          case "prevStory": {
            e.jumpToStory(-1);
            break;
          }
          case "nextComponent": {
            e.jumpToComponent(1);
            break;
          }
          case "prevComponent": {
            e.jumpToComponent(-1);
            break;
          }
          case "fullScreen": {
            e.toggleFullscreen();
            break;
          }
          case "togglePanel": {
            e.togglePanel();
            break;
          }
          case "toggleNav": {
            e.toggleNav();
            break;
          }
          case "toolbar": {
            e.toggleToolbar();
            break;
          }
          case "panelPosition": {
            e.getIsFullscreen() && e.toggleFullscreen(!1), e.getIsPanelShown() || e.togglePanel(!0), e.togglePanelPosition();
            break;
          }
          case "aboutPage": {
            e.navigate("/settings/about");
            break;
          }
          case "shortcutsPage": {
            e.navigate("/settings/shortcuts");
            break;
          }
          case "collapseAll": {
            e.emit(Kr);
            break;
          }
          case "expandAll": {
            e.emit(Wr);
            break;
          }
          case "remount": {
            e.emit(Br, { storyId: u });
            break;
          }
          default:
            Bt[s].action();
            break;
        }
    }
  }, { shortcuts: l = G } = t.getState(), o = {
    // Any saved shortcuts that are still in our set of defaults
    shortcuts: Ft(G).reduce(
      (s, d) => ({ ...s, [d]: l[d] || G[d] }),
      G
    )
  };
  return { api: a, state: o, init: /* @__PURE__ */ n(() => {
    Ue.addEventListener("keydown", (s) => {
      Gr(s) || a.handleKeydownEvent(s);
    }), r.channel?.on(Fr, (s) => {
      a.handleKeydownEvent(s.event);
    });
  }, "initModule") };
}, "init");

// src/manager-api/modules/stories.ts
var $t = {};
R($t, {
  init: () => bo
});
import { logger as Qr } from "storybook/internal/client-logger";
import {
  CONFIG_ERROR as Xr,
  CURRENT_STORY_WAS_SET as Jr,
  DOCS_PREPARED as Zr,
  PRELOAD_ENTRIES as to,
  RESET_STORY_ARGS as eo,
  SELECT_STORY as ro,
  SET_CONFIG as oo,
  SET_CURRENT_STORY as no,
  SET_FILTER as so,
  SET_INDEX as ao,
  SET_STORIES as io,
  STORY_ARGS_UPDATED as lo,
  STORY_CHANGED as co,
  STORY_INDEX_INVALIDATED as uo,
  STORY_MISSING as po,
  STORY_PREPARED as yo,
  STORY_SPECIFIED as So,
  UPDATE_STORY_ARGS as fo
} from "storybook/internal/core-events";
import { sanitize as je, toId as st } from "storybook/internal/csf";
import { global as go } from "@storybook/global";

// src/server-errors.ts
var $r = J(Fe(), 1);
var jt = class jt extends ue {
  constructor(r) {
    super({
      category: "CORE-SERVER",
      code: 16,
      message: `Status has typeId "${r.status.typeId}" but was added to store with typeId "${r.typeId}". Full status: ${JSON.stringify(
        r.status,
        null,
        2
      )}`
    });
    this.data = r;
  }
};
n(jt, "StatusTypeIdMismatchError");
var ot = jt;

// src/shared/status-store/index.ts
var Ke = {
  id: "storybook/status",
  leader: !0,
  initialState: {}
}, Gt = {
  SELECT: "select"
};
function We({
  universalStatusStore: t,
  useUniversalStore: e,
  environment: r
}) {
  let a = {
    getAll() {
      return t.getState();
    },
    set(o) {
      t.setState((c) => {
        let s = { ...c };
        for (let d of o) {
          let { storyId: i, typeId: u } = d;
          s[i] = { ...s[i] ?? {}, [u]: d };
        }
        return s;
      });
    },
    onAllStatusChange(o) {
      return t.onStateChange((c, s) => {
        o(c, s);
      });
    },
    onSelect(o) {
      return t.subscribe(Gt.SELECT, (c) => {
        o(c.payload);
      });
    },
    selectStatuses: /* @__PURE__ */ n((o) => {
      t.send({ type: Gt.SELECT, payload: o });
    }, "selectStatuses"),
    unset(o) {
      if (!o) {
        t.setState({});
        return;
      }
      t.setState((c) => {
        let s = { ...c };
        for (let d of o)
          delete s[d];
        return s;
      });
    },
    typeId: void 0
  }, l = /* @__PURE__ */ n((o) => ({
    getAll: a.getAll,
    set(c) {
      t.setState((s) => {
        let d = { ...s };
        for (let i of c) {
          let { storyId: u } = i;
          if (i.typeId !== o)
            switch (r) {
              case "server":
                throw new ot({
                  status: i,
                  typeId: o
                });
              case "manager":
                throw new de({
                  status: i,
                  typeId: o
                });
              case "preview":
              default:
                throw new pe({
                  status: i,
                  typeId: o
                });
            }
          d[u] = { ...d[u] ?? {}, [o]: i };
        }
        return d;
      });
    },
    onAllStatusChange: a.onAllStatusChange,
    onSelect(c) {
      return t.subscribe(Gt.SELECT, (s) => {
        s.payload.some((d) => d.typeId === o) && c(s.payload);
      });
    },
    unset(c) {
      t.setState((s) => {
        let d = { ...s };
        for (let i in d)
          if (d[i]?.[o] && (!c || c?.includes(i))) {
            let { [o]: u, ...p } = d[i];
            d[i] = p;
          }
        return d;
      });
    },
    typeId: o
  }), "getStatusStoreByTypeId");
  return e ? {
    getStatusStoreByTypeId: l,
    fullStatusStore: a,
    universalStatusStore: t,
    useStatusStore: /* @__PURE__ */ n((o) => e(t, o)[0], "useStatusStore")
  } : { getStatusStoreByTypeId: l, fullStatusStore: a, universalStatusStore: t };
}
n(We, "createStatusStore");

// src/shared/universal-store/use-universal-store-manager.ts
import * as L from "react";
var Y = /* @__PURE__ */ n((t, e) => {
  let r = L.useRef(
    e ? e(t.getState()) : t.getState()
  ), a = L.useCallback(
    (c) => t.onStateChange((s, d) => {
      if (!e) {
        r.current = s, c();
        return;
      }
      let i = e(s), u = e(d);
      !w(i, u) && (r.current = i, c());
    }),
    [t, e]
  ), l = L.useCallback(() => {
    let c = t.getState(), s = e ? e(c) : c;
    return w(s, r.current) || (r.current = s), r.current;
  }, [t, e]);
  return [L.useSyncExternalStore(a, l), t.setState];
}, "useUniversalStore");

// src/manager-api/stores/status.ts
var Hr = We({
  universalStatusStore: C.create({
    ...Ke,
    leader: globalThis.CONFIG_TYPE === "PRODUCTION"
  }),
  useUniversalStore: Y,
  environment: "manager"
}), { fullStatusStore: nt, getStatusStoreByTypeId: zr, useStatusStore: Yr, universalStatusStore: qr } = Hr;

// src/manager-api/modules/stories.ts
var { fetch: ho } = go, mo = "./index.json", Po = ["enableShortcuts", "theme", "showRoots"];
function Vt(t) {
  if (!t || typeof t == "string")
    return t;
  let e = { ...t };
  return Po.forEach((r) => {
    r in e && delete e[r];
  }), e;
}
n(Vt, "removeRemovedOptions");
var bo = /* @__PURE__ */ n(({
  fullAPI: t,
  store: e,
  navigate: r,
  provider: a,
  storyId: l,
  viewMode: o,
  docsOptions: c = {}
}) => {
  let s = {
    storyId: st,
    getData: /* @__PURE__ */ n((i, u) => {
      let p = s.resolveStory(i, u);
      if (p?.type === "story" || p?.type === "docs")
        return p;
    }, "getData"),
    isPrepared: /* @__PURE__ */ n((i, u) => {
      let p = s.getData(i, u);
      return p ? p.type === "story" ? p.prepared : !0 : !1;
    }, "isPrepared"),
    resolveStory: /* @__PURE__ */ n((i, u) => {
      let { refs: p, index: y } = e.getState();
      if (!(u && !p[u]))
        return u ? p?.[u]?.index?.[i] ?? void 0 : y ? y[i] : void 0;
    }, "resolveStory"),
    getCurrentStoryData: /* @__PURE__ */ n(() => {
      let { storyId: i, refId: u } = e.getState();
      return s.getData(i, u);
    }, "getCurrentStoryData"),
    getParameters: /* @__PURE__ */ n((i, u) => {
      let { storyId: p, refId: y } = typeof i == "string" ? { storyId: i, refId: void 0 } : i, S = s.getData(p, y);
      if (["story", "docs"].includes(S?.type)) {
        let { parameters: f } = S;
        if (f)
          return u ? f[u] : f;
      }
      return null;
    }, "getParameters"),
    getCurrentParameter: /* @__PURE__ */ n((i) => {
      let { storyId: u, refId: p } = e.getState();
      return s.getParameters({ storyId: u, refId: p }, i) || void 0;
    }, "getCurrentParameter"),
    jumpToComponent: /* @__PURE__ */ n((i) => {
      let { index: u, storyId: p, refs: y, refId: S } = e.getState();
      if (!s.getData(p, S))
        return;
      let g = S ? y[S].index || {} : u;
      if (!g)
        return;
      let h = s.findSiblingStoryId(p, g, i, !0);
      h && s.selectStory(h, void 0, { ref: S });
    }, "jumpToComponent"),
    jumpToStory: /* @__PURE__ */ n((i) => {
      let { index: u, storyId: p, refs: y, refId: S } = e.getState(), f = s.getData(p, S);
      if (!f)
        return;
      let g = f.refId ? y[f.refId].index : u;
      if (!g)
        return;
      let h = s.findSiblingStoryId(p, g, i, !1);
      h && s.selectStory(h, void 0, { ref: S });
    }, "jumpToStory"),
    selectFirstStory: /* @__PURE__ */ n(() => {
      let { index: i } = e.getState();
      if (!i)
        return;
      let u = Object.keys(i).find((p) => i[p].type === "story");
      if (u) {
        s.selectStory(u);
        return;
      }
      r("/");
    }, "selectFirstStory"),
    selectStory: /* @__PURE__ */ n((i = void 0, u = void 0, p = {}) => {
      let { ref: y } = p, { storyId: S, index: f, refs: g } = e.getState(), h = y ? g[y].index : f, m = S?.split("--", 2)[0];
      if (h)
        if (u)
          if (i) {
            let b = y ? `${y}_${st(i, u)}` : st(i, u);
            if (h[b])
              s.selectStory(b, void 0, p);
            else {
              let A = h[je(i)];
              if (A?.type === "component") {
                let _ = A.children.find((x) => h[x].name === u);
                _ && s.selectStory(_, void 0, p);
              }
            }
          } else {
            let b = st(m, u);
            s.selectStory(b, void 0, p);
          }
        else {
          let b = i ? h[i] || h[je(i)] : h[m];
          if (!b)
            throw new Error(`Unknown id or title: '${i}'`);
          e.setState({
            settings: { ...e.getState().settings, lastTrackedStoryId: b.id }
          });
          let A = s.findLeafEntry(h, b.id), _ = A.refId ? `${A.refId}_${A.id}` : A.id;
          r(`/${A.type}/${_}`);
        }
    }, "selectStory"),
    findLeafEntry(i, u) {
      let p = i[u];
      if (p.type === "docs" || p.type === "story")
        return p;
      let y = p.children[0];
      return s.findLeafEntry(i, y);
    },
    findLeafStoryId(i, u) {
      return s.findLeafEntry(i, u)?.id;
    },
    findAllLeafStoryIds(i) {
      let { index: u } = e.getState();
      if (!u)
        return [];
      let p = /* @__PURE__ */ n((y, S = []) => {
        let f = u[y];
        return f && (f.type === "story" ? S.push(f.id) : "children" in f && f.children.forEach((g) => p(g, S))), S;
      }, "findChildEntriesRecursively");
      return p(i, []);
    },
    findSiblingStoryId(i, u, p, y) {
      if (y) {
        let g = _e(u), h = g.findIndex((m) => m.includes(i));
        return h === g.length - 1 && p > 0 || h === 0 && p < 0 ? void 0 : g[h + p] ? g[h + p][0] : void 0;
      }
      let S = Te(u), f = S.indexOf(i);
      if (!(f === S.length - 1 && p > 0) && !(f === 0 && p < 0))
        return S[f + p];
    },
    updateStoryArgs: /* @__PURE__ */ n((i, u) => {
      let { id: p, refId: y } = i;
      a.channel?.emit(fo, {
        storyId: p,
        updatedArgs: u,
        options: { target: y }
      });
    }, "updateStoryArgs"),
    resetStoryArgs: /* @__PURE__ */ n((i, u) => {
      let { id: p, refId: y } = i;
      a.channel?.emit(eo, {
        storyId: p,
        argNames: u,
        options: { target: y }
      });
    }, "resetStoryArgs"),
    fetchIndex: /* @__PURE__ */ n(async () => {
      try {
        let i = await ho(mo);
        if (i.status !== 200)
          throw new Error(await i.text());
        let u = await i.json();
        if (u.v < 3) {
          Qr.warn(`Skipping story index with version v${u.v}, awaiting SET_STORIES.`);
          return;
        }
        await s.setIndex(u);
      } catch (i) {
        await e.setState({ indexError: i });
      }
    }, "fetchIndex"),
    // The story index we receive on SET_INDEX is "prepared" in that it has parameters
    // The story index we receive on fetchStoryIndex is not, but all the prepared fields are optional
    // so we can cast one to the other easily enough
    setIndex: /* @__PURE__ */ n(async (i) => {
      let { filteredIndex: u, index: p, filters: y } = e.getState(), S = nt.getAll(), f = W(i, {
        provider: a,
        docsOptions: c,
        filters: y,
        allStatuses: S
      }), g = W(i, {
        provider: a,
        docsOptions: c,
        filters: {},
        allStatuses: S
      });
      await e.setState({
        internal_index: i,
        filteredIndex: _t(f, u),
        index: _t(g, p),
        indexError: void 0
      });
    }, "setIndex"),
    // FIXME: is there a bug where filtered stories get added back in on updateStory???
    updateStory: /* @__PURE__ */ n(async (i, u, p) => {
      if (p) {
        let { id: y, index: S, filteredIndex: f } = p;
        S[i] = {
          ...S[i],
          ...u
        }, f[i] = {
          ...f[i],
          ...u
        }, await t.updateRef(y, { index: S, filteredIndex: f });
      } else {
        let { index: y, filteredIndex: S } = e.getState();
        y && (y[i] = {
          ...y[i],
          ...u
        }), S && (S[i] = {
          ...S[i],
          ...u
        }), (y || S) && await e.setState({ index: y, filteredIndex: S });
      }
    }, "updateStory"),
    updateDocs: /* @__PURE__ */ n(async (i, u, p) => {
      if (p) {
        let { id: y, index: S, filteredIndex: f } = p;
        S[i] = {
          ...S[i],
          ...u
        }, f[i] = {
          ...f[i],
          ...u
        }, await t.updateRef(y, { index: S, filteredIndex: f });
      } else {
        let { index: y, filteredIndex: S } = e.getState();
        y && (y[i] = {
          ...y[i],
          ...u
        }), S && (S[i] = {
          ...S[i],
          ...u
        }), (y || S) && await e.setState({ index: y, filteredIndex: S });
      }
    }, "updateDocs"),
    setPreviewInitialized: /* @__PURE__ */ n(async (i) => {
      i ? t.updateRef(i.id, { previewInitialized: !0 }) : e.setState({ previewInitialized: !0 });
    }, "setPreviewInitialized"),
    experimental_setFilter: /* @__PURE__ */ n(async (i, u) => {
      await e.setState({ filters: { ...e.getState().filters, [i]: u } });
      let { internal_index: p } = e.getState();
      if (!p)
        return;
      await s.setIndex(p);
      let y = await t.getRefs();
      Object.entries(y).forEach(([S, { internal_index: f, ...g }]) => {
        t.setRef(S, { ...g, storyIndex: f }, !0);
      }), a.channel?.emit(so, { id: i });
    }, "experimental_setFilter")
  };
  a.channel?.on(
    So,
    /* @__PURE__ */ n(function({
      storyId: u,
      viewMode: p
    }) {
      let { sourceType: y } = T(this, t);
      if (y === "local") {
        let S = e.getState(), f = S.path === "/" || S.viewMode === "story" || S.viewMode === "docs", g = S.viewMode && S.storyId, h = S.viewMode !== p || S.storyId !== u, { type: m } = S.index?.[S.storyId] || {};
        f && (g && h && !(m === "root" || m === "component" || m === "group") ? a.channel?.emit(no, {
          storyId: S.storyId,
          viewMode: S.viewMode
        }) : h && r(`/${p}/${u}`));
      }
    }, "handler")
  ), a.channel?.on(Jr, /* @__PURE__ */ n(function() {
    let { ref: u } = T(this, t);
    s.setPreviewInitialized(u);
  }, "handler")), a.channel?.on(co, /* @__PURE__ */ n(function() {
    let { sourceType: u } = T(this, t);
    if (u === "local") {
      let p = s.getCurrentParameter("options");
      p && t.setOptions(Vt(p));
    }
  }, "handler")), a.channel?.on(
    yo,
    /* @__PURE__ */ n(function({ id: u, ...p }) {
      let { ref: y, sourceType: S } = T(this, t);
      if (s.updateStory(u, { ...p, prepared: !0 }, y), !y && !e.getState().hasCalledSetOptions) {
        let { options: f } = p.parameters;
        t.setOptions(Vt(f)), e.setState({ hasCalledSetOptions: !0 });
      }
      if (S === "local") {
        let { storyId: f, index: g, refId: h } = e.getState();
        if (!g)
          return;
        let m = Array.from(
          /* @__PURE__ */ new Set([
            s.findSiblingStoryId(f, g, 1, !0),
            s.findSiblingStoryId(f, g, -1, !0)
          ])
        ).filter(Boolean);
        a.channel?.emit(to, {
          ids: m,
          options: { target: h }
        });
      }
    }, "handler")
  ), a.channel?.on(
    Zr,
    /* @__PURE__ */ n(function({ id: u, ...p }) {
      let { ref: y } = T(this, t);
      s.updateStory(u, { ...p, prepared: !0 }, y);
    }, "handler")
  ), a.channel?.on(ao, /* @__PURE__ */ n(function(u) {
    let { ref: p } = T(this, t);
    if (p)
      t.setRef(p.id, { ...p, storyIndex: u }, !0);
    else {
      s.setIndex(u);
      let y = s.getCurrentParameter("options");
      t.setOptions(Vt(y));
    }
  }, "handler")), a.channel?.on(io, /* @__PURE__ */ n(function(u) {
    let { ref: p } = T(this, t), y = u.v ? Ae(u) : u.stories;
    if (p)
      t.setRef(p.id, { ...p, setStoriesData: y }, !0);
    else
      throw new Error("Cannot call SET_STORIES for local frame");
  }, "handler")), a.channel?.on(
    ro,
    /* @__PURE__ */ n(function({
      kind: u,
      title: p = u,
      story: y,
      name: S = y,
      storyId: f,
      ...g
    }) {
      let { ref: h } = T(this, t);
      h ? t.selectStory(f || p, S, { ...g, ref: h.id }) : t.selectStory(f || p, S, g);
    }, "handler")
  ), a.channel?.on(
    lo,
    /* @__PURE__ */ n(function({ storyId: u, args: p }) {
      let { ref: y } = T(this, t);
      s.updateStory(u, { args: p }, y);
    }, "handleStoryArgsUpdated")
  ), a.channel?.on(Xr, /* @__PURE__ */ n(function(u) {
    let { ref: p } = T(this, t);
    s.setPreviewInitialized(p);
  }, "handleConfigError")), a.channel?.on(po, /* @__PURE__ */ n(function(u) {
    let { ref: p } = T(this, t);
    s.setPreviewInitialized(p);
  }, "handleConfigError")), a.channel?.on(oo, () => {
    let i = a.getConfig();
    i?.sidebar?.filters && e.setState({
      filters: {
        ...e.getState().filters,
        ...i?.sidebar?.filters
      }
    });
  }), nt.onAllStatusChange(async () => {
    let { internal_index: i } = e.getState();
    if (!i)
      return;
    await s.setIndex(i);
    let u = await t.getRefs();
    Object.entries(u).forEach(([p, { internal_index: y, ...S }]) => {
      t.setRef(p, { ...S, storyIndex: y }, !0);
    });
  });
  let d = a.getConfig();
  return {
    api: s,
    state: {
      storyId: l,
      viewMode: o,
      hasCalledSetOptions: !1,
      previewInitialized: !1,
      filters: d?.sidebar?.filters || {}
    },
    init: /* @__PURE__ */ n(async () => {
      a.channel?.on(uo, () => s.fetchIndex()), await s.fetchIndex();
    }, "init")
  };
}, "init");

// src/manager-api/modules/url.ts
var Yt = {};
R(Yt, {
  init: () => wo
});
import {
  GLOBALS_UPDATED as Io,
  NAVIGATE_URL as Ao,
  SET_CURRENT_STORY as vo,
  STORY_ARGS_UPDATED as _o,
  UPDATE_QUERY_PARAMS as To
} from "storybook/internal/core-events";
import { buildArgsParam as Ge, queryFromLocation as Eo } from "storybook/internal/router";
import { global as xo } from "@storybook/global";
var { window: Ht } = xo, B = /* @__PURE__ */ n((t) => {
  if (t === "true" || t === "1")
    return !0;
  if (t === "false" || t === "0")
    return !1;
}, "parseBoolean"), zt, Ro = /* @__PURE__ */ n(({
  state: { location: t, path: e, viewMode: r, storyId: a },
  singleStory: l
}) => {
  let {
    full: o,
    panel: c,
    nav: s,
    shortcuts: d,
    addonPanel: i,
    tabs: u,
    path: p,
    ...y
    // the rest gets passed to the iframe
  } = Eo(t), S, f, g;
  B(o) === !0 ? (S = 0, f = 0, g = 0) : B(o) === !1 && (S = E.layout.navSize, f = E.layout.bottomPanelHeight, g = E.layout.rightPanelWidth), l || (B(s) === !0 && (S = E.layout.navSize), B(s) === !1 && (S = 0)), B(c) === !1 && (f = 0, g = 0);
  let h = {
    navSize: S,
    bottomPanelHeight: f,
    rightPanelWidth: g,
    panelPosition: ["right", "bottom"].includes(c) ? c : void 0,
    showTabs: B(u)
  }, m = {
    enableShortcuts: B(d)
  }, b = i || void 0, A = a, _ = M(zt, y) ? zt : y;
  return zt = _, { viewMode: r, layout: h, ui: m, selectedPanel: b, location: t, path: e, customQueryParams: _, storyId: A };
}, "initialUrlSupport"), wo = /* @__PURE__ */ n((t) => {
  let { store: e, navigate: r, provider: a, fullAPI: l } = t, o = /* @__PURE__ */ n((i, u = {}, p = {}) => {
    let y = Object.entries(u).filter(([, f]) => f).sort(([f], [g]) => f < g ? -1 : 1).map(([f, g]) => `${f}=${g}`), S = [i, ...y].join("&");
    return r(S, p);
  }, "navigateTo"), c = {
    getQueryParam(i) {
      let { customQueryParams: u } = e.getState();
      return u ? u[i] : void 0;
    },
    getUrlState() {
      let { location: i, path: u, customQueryParams: p, storyId: y, url: S, viewMode: f } = e.getState();
      return {
        path: u,
        hash: i.hash ?? "",
        queryParams: p,
        storyId: y,
        url: S,
        viewMode: f
      };
    },
    setQueryParams(i) {
      let { customQueryParams: u } = e.getState(), p = {}, y = {
        ...u,
        ...Object.entries(i).reduce((S, [f, g]) => (g !== null && (S[f] = g), S), p)
      };
      M(u, y) || (e.setState({ customQueryParams: y }), a.channel?.emit(To, y));
    },
    applyQueryParams(i, u) {
      let { path: p, hash: y = "", queryParams: S } = c.getUrlState();
      o(`${p}${y}`, { ...S, ...i }, u), c.setQueryParams(i);
    },
    navigateUrl(i, u) {
      r(i, { plain: !0, ...u });
    }
  }, s = /* @__PURE__ */ n(() => {
    let { path: i, hash: u = "", queryParams: p, viewMode: y } = c.getUrlState();
    if (y !== "story")
      return;
    let S = l.getCurrentStoryData();
    if (S?.type !== "story")
      return;
    let { args: f, initialArgs: g } = S, h = Ge(g, f);
    o(`${i}${u}`, { ...p, args: h }, { replace: !0 }), c.setQueryParams({ args: h });
  }, "updateArgsParam");
  a.channel?.on(vo, () => s());
  let d;
  return a.channel?.on(_o, () => {
    "requestIdleCallback" in Ht ? (d && Ht.cancelIdleCallback(d), d = Ht.requestIdleCallback(s, { timeout: 1e3 })) : (d && clearTimeout(d), setTimeout(s, 100));
  }), a.channel?.on(Io, ({ userGlobals: i, initialGlobals: u }) => {
    let { path: p, hash: y = "", queryParams: S } = c.getUrlState(), f = Ge(u, i);
    o(`${p}${y}`, { ...S, globals: f }, { replace: !0 }), c.setQueryParams({ globals: f });
  }), a.channel?.on(Ao, (i, u) => {
    c.navigateUrl(i, u);
  }), {
    api: c,
    state: Ro(t)
  };
}, "init");

// src/manager-api/modules/versions.ts
var Qt = {};
R(Qt, {
  init: () => ko
});
var He = J(ce(), 1);
import { global as qt } from "@storybook/global";
import O from "semver";

// src/manager-api/version.ts
var Ve = "0.0.0-pr-31819-sha-dcea463b";

// src/manager-api/modules/versions.ts
var { VERSIONCHECK: Oo } = qt, $e = (0, He.default)(1)(() => {
  try {
    return { ...JSON.parse(Oo).data || {} };
  } catch {
    return {};
  }
}), Co = /* @__PURE__ */ n((t) => t.includes("vue") ? "vue" : t, "normalizeRendererName"), ko = /* @__PURE__ */ n(({ store: t }) => {
  let { dismissedVersionNotification: e } = t.getState(), r = {
    versions: {
      current: {
        version: Ve
      },
      ...$e()
    },
    dismissedVersionNotification: e
  }, a = {
    getCurrentVersion: /* @__PURE__ */ n(() => {
      let {
        versions: { current: o }
      } = t.getState();
      return o;
    }, "getCurrentVersion"),
    getLatestVersion: /* @__PURE__ */ n(() => {
      let {
        versions: { latest: o, next: c, current: s }
      } = t.getState();
      return s && O.prerelease(s.version) && c ? o && O.gt(o.version, c.version) ? o : c : o;
    }, "getLatestVersion"),
    // TODO: Move this to it's own "info" module later
    getDocsUrl: /* @__PURE__ */ n(({ subpath: o, versioned: c, renderer: s }) => {
      let {
        versions: { latest: d, current: i }
      } = t.getState(), u = "https://storybook.js.org/docs/";
      if (c && i?.version && d?.version) {
        let S = O.diff(d.version, i.version);
        S === "patch" || S === null || // assume latest version when current version is a 0.0.0 canary
        O.satisfies(i.version, "0.0.0", { includePrerelease: !0 }) || (u += `${O.major(i.version)}.${O.minor(i.version)}/`);
      }
      let [p, y] = o?.split("#") || [];
      if (p && (u += `${p}/`), s && typeof qt.STORYBOOK_RENDERER < "u") {
        let S = qt.STORYBOOK_RENDERER;
        S && (u += `?renderer=${Co(S)}`);
      }
      return y && (u += `#${y}`), u;
    }, "getDocsUrl"),
    versionUpdateAvailable: /* @__PURE__ */ n(() => {
      let o = a.getLatestVersion(), c = a.getCurrentVersion();
      if (o) {
        if (!o.version || !c.version)
          return !0;
        let d = !!O.prerelease(c.version) ? `${O.major(c.version)}.${O.minor(c.version)}.${O.patch(
          c.version
        )}` : c.version, i = O.diff(d, o.version);
        return O.gt(o.version, d) && i !== "patch" && !i.includes("pre");
      }
      return !1;
    }, "versionUpdateAvailable")
  };
  return { init: /* @__PURE__ */ n(async () => {
    let { versions: o = {} } = t.getState(), { latest: c, next: s } = $e();
    await t.setState({
      versions: { ...o, latest: c, next: s }
    });
  }, "initModule"), state: r, api: a };
}, "init");

// src/manager-api/modules/whatsnew.tsx
var Jt = {};
R(Jt, {
  init: () => Fo
});
import Xt from "react";
import {
  REQUEST_WHATS_NEW_DATA as Do,
  RESULT_WHATS_NEW_DATA as No,
  SET_WHATS_NEW_CACHE as Mo,
  TOGGLE_WHATS_NEW_NOTIFICATIONS as Uo
} from "storybook/internal/core-events";
import { global as Lo } from "@storybook/global";
var ze = "whats-new", Bo = /* @__PURE__ */ n(({ color: t = "currentColor", size: e = 14 }) => Xt.createElement(
  "svg",
  {
    width: e,
    height: e,
    viewBox: "0 0 14 14",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg"
  },
  Xt.createElement(
    "path",
    {
      fillRule: "evenodd",
      clipRule: "evenodd",
      d: "M2.042.616a.704.704 0 00-.66.729L1.816 12.9c.014.367.306.66.672.677l9.395.422h.032a.704.704 0 00.704-.703V.704c0-.015 0-.03-.002-.044a.704.704 0 00-.746-.659l-.773.049.057 1.615a.105.105 0 01-.17.086l-.52-.41-.617.468a.105.105 0 01-.168-.088L9.746.134 2.042.616zm8.003 4.747c-.247.192-2.092.324-2.092.05.04-1.045-.429-1.091-.689-1.091-.247 0-.662.075-.662.634 0 .57.607.893 1.32 1.27 1.014.538 2.24 1.188 2.24 2.823 0 1.568-1.273 2.433-2.898 2.433-1.676 0-3.141-.678-2.976-3.03.065-.275 2.197-.21 2.197 0-.026.971.195 1.256.753 1.256.43 0 .624-.236.624-.634 0-.602-.633-.958-1.361-1.367-.987-.554-2.148-1.205-2.148-2.7 0-1.494 1.027-2.489 2.86-2.489 1.832 0 2.832.98 2.832 2.845z",
      fill: t
    }
  )
), "StorybookIcon"), Fo = /* @__PURE__ */ n(({ fullAPI: t, store: e, provider: r }) => {
  let a = {
    whatsNewData: void 0
  };
  function l(i) {
    e.setState({ whatsNewData: i }), a.whatsNewData = i;
  }
  n(l, "setWhatsNewState");
  let o = {
    isWhatsNewUnread() {
      return a.whatsNewData?.status === "SUCCESS" && !a.whatsNewData.postIsRead;
    },
    whatsNewHasBeenRead() {
      a.whatsNewData?.status === "SUCCESS" && (s({ lastReadPost: a.whatsNewData.url }), l({ ...a.whatsNewData, postIsRead: !0 }), t.clearNotification(ze));
    },
    toggleWhatsNewNotifications() {
      a.whatsNewData?.status === "SUCCESS" && (l({
        ...a.whatsNewData,
        disableWhatsNewNotifications: !a.whatsNewData.disableWhatsNewNotifications
      }), r.channel?.emit(Uo, {
        disableWhatsNewNotifications: a.whatsNewData.disableWhatsNewNotifications
      }));
    }
  };
  function c() {
    return r.channel?.emit(Do), new Promise(
      (i) => r.channel?.once(
        No,
        ({ data: u }) => i(u)
      )
    );
  }
  n(c, "getLatestWhatsNewPost");
  function s(i) {
    r.channel?.emit(Mo, i);
  }
  return n(s, "setWhatsNewCache"), { init: /* @__PURE__ */ n(async () => {
    if (Lo.CONFIG_TYPE !== "DEVELOPMENT")
      return;
    let i = await c();
    l(i);
    let u = t.getUrlState();
    !(u?.path === "/onboarding" || u.queryParams?.onboarding === "true") && i.status === "SUCCESS" && !i.disableWhatsNewNotifications && i.showNotification && t.addNotification({
      id: ze,
      link: "/settings/whats-new",
      content: {
        headline: i.title,
        subHeadline: "Learn what's new in Storybook"
      },
      icon: Xt.createElement(Bo, null),
      onClear({ dismissed: y }) {
        y && s({ lastDismissedPost: i.url });
      }
    });
  }, "initModule"), state: a, api: o };
}, "init");

// src/manager-api/store.ts
var V = J(Ye(), 1);

// src/manager-api/lib/store-setup.ts
var qe = /* @__PURE__ */ n((t) => {
  t.fn("set", function(e, r) {
    return t.set(
      // @ts-expect-error('this' implicitly has type 'any')
      this._area,
      // @ts-expect-error('this' implicitly has type 'any')
      this._in(e),
      ye(r, { maxDepth: 50 })
    );
  }), t.fn("get", function(e, r) {
    let a = t.get(this._area, this._in(e));
    return a !== null ? Se(a) : r || a;
  });
}, "default");

// src/manager-api/store.ts
qe(V.default._);
var Qe = "@storybook/manager/store";
function Zt(t) {
  return t.get(Qe) || {};
}
n(Zt, "get");
function Ko(t, e) {
  return t.set(Qe, e);
}
n(Ko, "set");
function Wo(t, e) {
  let r = Zt(t);
  return Ko(t, { ...r, ...e });
}
n(Wo, "update");
var te = class te {
  constructor({ setState: e, getState: r }) {
    this.upstreamSetState = e, this.upstreamGetState = r;
  }
  // The assumption is that this will be called once, to initialize the React state
  // when the module is instantiated
  getInitialState(e) {
    return { ...e, ...Zt(V.default.local), ...Zt(V.default.session) };
  }
  getState() {
    return this.upstreamGetState();
  }
  async setState(e, r, a) {
    let l, o;
    typeof r == "function" ? (l = r, o = a) : o = r;
    let { persistence: c = "none" } = o || {}, s = {}, d = {};
    typeof e == "function" ? s = /* @__PURE__ */ n((u) => (d = e(u), d), "patch") : (s = e, d = s);
    let i = await new Promise((u) => {
      this.upstreamSetState(s, () => {
        u(this.getState());
      });
    });
    if (c !== "none") {
      let u = c === "session" ? V.default.session : V.default.local;
      await Wo(u, d);
    }
    return l && l(i), i;
  }
};
n(te, "Store");
var q = te;

// src/manager-api/lib/request-response.ts
var ee = class ee extends Error {
  constructor(r, a) {
    super(r);
    this.payload = void 0;
    this.payload = a;
  }
};
n(ee, "RequestResponseError");
var lt = ee, Pa = /* @__PURE__ */ n((t, e, r, a, l = 5e3) => {
  let o;
  return new Promise((c, s) => {
    let d = {
      id: Math.random().toString(16).slice(2),
      payload: a
    }, i = /* @__PURE__ */ n((u) => {
      u.id === d.id && (clearTimeout(o), t.off(r, i), u.success ? c(u.payload) : s(new lt(u.error, u.payload)));
    }, "responseHandler");
    t.emit(e, d), t.on(r, i), o = setTimeout(() => {
      t.off(r, i), s(new lt("Timed out waiting for response"));
    }, l);
  });
}, "experimental_requestResponse");

// src/manager-api/root.tsx
var { ActiveTabs: Oa } = rt;
var ut = fe({ api: void 0, state: tt({}) }), Ee = /* @__PURE__ */ n((...t) => he({}, ...t), "combineParameters"), ct = class ct extends jo {
  constructor(r) {
    super(r);
    this.api = {};
    this.initModules = /* @__PURE__ */ n(() => {
      this.modules.forEach((r) => {
        "init" in r && r.init();
      });
    }, "initModules");
    let {
      location: a,
      path: l,
      refId: o,
      viewMode: c = r.docsOptions.docsMode ? "docs" : r.viewMode,
      singleStory: s,
      storyId: d,
      docsOptions: i,
      navigate: u
    } = r, p = new q({
      getState: /* @__PURE__ */ n(() => this.state, "getState"),
      setState: /* @__PURE__ */ n((m, b) => (this.setState(m, () => b(this.state)), this.state), "setState")
    }), y = { location: a, path: l, viewMode: c, singleStory: s, storyId: d, refId: o }, S = { docsOptions: i };
    this.state = p.getInitialState(tt({ ...y, ...S }));
    let f = {
      navigate: u,
      store: p,
      provider: r.provider
    };
    this.modules = [
      Ct,
      At,
      It,
      rt,
      Ot,
      kt,
      Kt,
      $t,
      Et,
      xt,
      Yt,
      Qt,
      Jt
    ].map(
      (m) => m.init({ ...y, ...S, ...f, state: this.state, fullAPI: this.api })
    );
    let g = tt(this.state, ...this.modules.map((m) => m.state)), h = Object.assign(this.api, { navigate: u }, ...this.modules.map((m) => m.api));
    this.state = g, this.api = h;
  }
  static getDerivedStateFromProps(r, a) {
    return a.path !== r.path ? {
      ...a,
      location: r.location,
      path: r.path,
      refId: r.refId,
      viewMode: r.viewMode,
      storyId: r.storyId
    } : null;
  }
  shouldComponentUpdate(r, a) {
    let l = this.props, o = this.state;
    return l.path !== r.path || !w(o, a);
  }
  render() {
    let { children: r } = this.props, a = {
      state: this.state,
      api: this.api
    };
    return $.createElement(qo, { effect: this.initModules }, $.createElement(ut.Provider, { value: a }, $.createElement(Xo, null, r)));
  }
};
n(ct, "ManagerProvider"), ct.displayName = "Manager";
var Ze = ct, qo = /* @__PURE__ */ n(({ children: t, effect: e }) => ($.useEffect(e, []), t), "EffectOnMount"), Qo = /* @__PURE__ */ n((t) => t, "defaultFilter");
function Xo({
  // @ts-expect-error (Converted from ts-ignore)
  filter: t = Qo,
  children: e
}) {
  let r = oe(ut), a = Xe(e), l = Xe(t);
  if (typeof a.current != "function")
    return $.createElement(Go, null, a.current);
  let o = l.current(r), c = re(() => [...Object.entries(o).reduce((s, d) => s.concat(d), [])], [r.state]);
  return re(() => {
    let s = a.current;
    return $.createElement(s, { ...o });
  }, c);
}
n(Xo, "ManagerConsumer");
function Ca() {
  let { state: t } = oe(ut);
  return t;
}
n(Ca, "useStorybookState");
function U() {
  let { api: t } = oe(ut);
  return t;
}
n(U, "useStorybookApi");
function er(t, e) {
  return typeof t > "u" ? e : t;
}
n(er, "orDefault");
var rr = /* @__PURE__ */ n((t, e = []) => {
  let r = U();
  return tr(() => (Object.entries(t).forEach(([a, l]) => r.on(a, l)), () => {
    Object.entries(t).forEach(([a, l]) => r.off(a, l));
  }), e), r.emit;
}, "useChannel");
function ka(t) {
  return U().isPrepared(t);
}
n(ka, "useStoryPrepared");
function Da(t, e) {
  let r = U(), [a, l] = Vo(r.getCurrentParameter(t)), o = X(() => {
    let c = r.getCurrentParameter(t);
    l(c);
  }, [r, t]);
  return rr(
    {
      [Yo]: o,
      [$o]: o
    },
    [o]
  ), er(a, e);
}
n(Da, "useParameter");
globalThis.STORYBOOK_ADDON_STATE = {};
var { STORYBOOK_ADDON_STATE: D } = globalThis;
function Jo(t, e) {
  let r = U(), a = r.getAddonState(t) || D[t], l = er(
    a,
    D[t] ? D[t] : e
  ), o = !1;
  l === e && e !== void 0 && (D[t] = e, o = !0), tr(() => {
    o && r.setAddonState(t, e);
  }, [o]);
  let c = X(
    async (u, p) => {
      await r.setAddonState(t, u, p);
      let y = r.getAddonState(t);
      return D[t] = y, y;
    },
    [r, t]
  ), s = re(() => {
    let u = {
      [`${Je}-client-${t}`]: c,
      [`${Q}-client-${t}`]: c
    }, p = {
      [Ho]: async () => {
        let y = r.getAddonState(t);
        y ? (D[t] = y, r.emit(`${Q}-manager-${t}`, y)) : D[t] ? (await c(D[t]), r.emit(`${Q}-manager-${t}`, D[t])) : e !== void 0 && (await c(e), D[t] = e, r.emit(`${Q}-manager-${t}`, e));
      },
      [zo]: () => {
        let y = r.getAddonState(t);
        y !== void 0 && r.emit(`${Q}-manager-${t}`, y);
      }
    };
    return {
      ...u,
      ...p
    };
  }, [t]), d = rr(s), i = X(
    async (u, p) => {
      await c(u, p);
      let y = r.getAddonState(t);
      d(`${Je}-manager-${t}`, y);
    },
    [r, d, c, t]
  );
  return [l, i];
}
n(Jo, "useSharedState");
function Na(t, e) {
  return Jo(t, e);
}
n(Na, "useAddonState");
function Ma() {
  let { getCurrentStoryData: t, updateStoryArgs: e, resetStoryArgs: r } = U(), a = t(), l = a?.type === "story" ? a.args : {}, o = a?.type === "story" ? a.initialArgs : {}, c = X(
    (d) => e(a, d),
    [a, e]
  ), s = X(
    (d) => r(a, d),
    [a, r]
  );
  return [l, c, s, o];
}
n(Ma, "useArgs");
function Ua() {
  let t = U();
  return [t.getGlobals(), t.updateGlobals, t.getStoryGlobals(), t.getUserGlobals()];
}
n(Ua, "useGlobals");
function La() {
  return U().getGlobalTypes();
}
n(La, "useGlobalTypes");
function Zo() {
  let { getCurrentStoryData: t } = U();
  return t();
}
n(Zo, "useCurrentStory");
function Ba() {
  let t = Zo();
  return t?.type === "story" && t.argTypes || {};
}
n(Ba, "useArgTypes");
var Fa = Pe;

// src/shared/universal-store/mock.ts
import { Channel as tn } from "storybook/internal/channels";
var dt = class dt extends C {
  constructor(e, r) {
    C.isInternalConstructing = !0, super(
      { ...e, leader: !0 },
      { channel: new tn({}), environment: C.Environment.MOCK }
    ), C.isInternalConstructing = !1, typeof r?.fn == "function" && (this.testUtils = r, this.getState = r.fn(this.getState), this.setState = r.fn(this.setState), this.subscribe = r.fn(this.subscribe), this.onStateChange = r.fn(this.onStateChange), this.send = r.fn(this.send));
  }
  /** Create a mock universal store. This is just an alias for the constructor */
  static create(e, r) {
    return new dt(e, r);
  }
  unsubscribeAll() {
    if (!this.testUtils)
      throw new Error(
        ae`Cannot call unsubscribeAll on a store that does not have testUtils.
        Please provide testUtils as the second argument when creating the store.`
      );
    let e = /* @__PURE__ */ n((r) => {
      try {
        r.value();
      } catch {
      }
    }, "callReturnedUnsubscribeFn");
    this.subscribe.mock?.results.forEach(e), this.onStateChange.mock?.results.forEach(e);
  }
};
n(dt, "MockUniversalStore");
var ne = dt;

// src/shared/test-provider-store/index.ts
var or = {
  id: "storybook/test-provider",
  leader: !0,
  initialState: {}
};
function nr({
  universalTestProviderStore: t,
  useUniversalStore: e
}) {
  let r = {
    settingsChanged: /* @__PURE__ */ n(() => {
      t.untilReady().then(() => {
        t.send({ type: "settings-changed" });
      });
    }, "settingsChanged"),
    onRunAll: /* @__PURE__ */ n((o) => t.subscribe("run-all", o), "onRunAll"),
    onClearAll: /* @__PURE__ */ n((o) => t.subscribe("clear-all", o), "onClearAll")
  }, a = {
    ...r,
    getFullState: t.getState,
    setFullState: t.setState,
    onSettingsChanged: /* @__PURE__ */ n((o) => t.subscribe("settings-changed", o), "onSettingsChanged"),
    runAll: /* @__PURE__ */ n(async () => {
      await t.untilReady(), t.send({ type: "run-all" });
    }, "runAll"),
    clearAll: /* @__PURE__ */ n(async () => {
      await t.untilReady(), t.send({ type: "clear-all" });
    }, "clearAll")
  }, l = /* @__PURE__ */ n((o) => {
    let c = /* @__PURE__ */ n(() => t.getState()[o] ?? "test-provider-state:pending", "getStateForTestProvider"), s = /* @__PURE__ */ n((d) => {
      t.untilReady().then(() => {
        t.setState((i) => ({
          ...i,
          [o]: d
        }));
      });
    }, "setStateForTestProvider");
    return {
      ...r,
      testProviderId: o,
      getState: c,
      setState: s,
      runWithState: /* @__PURE__ */ n(async (d) => {
        s("test-provider-state:running");
        try {
          await d(), s("test-provider-state:succeeded");
        } catch {
          s("test-provider-state:crashed");
        }
      }, "runWithState")
    };
  }, "getTestProviderStoreById");
  return e ? {
    getTestProviderStoreById: l,
    fullTestProviderStore: a,
    universalTestProviderStore: t,
    useTestProviderStore: /* @__PURE__ */ n((o) => e(t, o)[0], "useTestProviderStore")
  } : {
    getTestProviderStoreById: l,
    fullTestProviderStore: a,
    universalTestProviderStore: t
  };
}
n(nr, "createTestProviderStore");

// src/manager-api/stores/test-provider.ts
var en = nr({
  universalTestProviderStore: C.create({
    ...or,
    leader: globalThis.CONFIG_TYPE === "PRODUCTION"
  }),
  useUniversalStore: Y
}), {
  fullTestProviderStore: rn,
  getTestProviderStoreById: on,
  useTestProviderStore: nn,
  universalTestProviderStore: sn
} = en;
export {
  Oa as ActiveTabs,
  Xo as Consumer,
  ut as ManagerContext,
  Ze as Provider,
  lt as RequestResponseError,
  ur as addons,
  Ee as combineParameters,
  ys as controlOrMetaKey,
  ps as controlOrMetaSymbol,
  fs as eventMatchesShortcut,
  Mt as eventToShortcut,
  ne as experimental_MockUniversalStore,
  C as experimental_UniversalStore,
  zr as experimental_getStatusStore,
  on as experimental_getTestProviderStore,
  Pa as experimental_requestResponse,
  Yr as experimental_useStatusStore,
  nn as experimental_useTestProviderStore,
  Y as experimental_useUniversalStore,
  nt as internal_fullStatusStore,
  rn as internal_fullTestProviderStore,
  qr as internal_universalStatusStore,
  sn as internal_universalTestProviderStore,
  Nt as isMacLike,
  Ss as isShortcutTaken,
  Lr as keyToSymbol,
  k as merge,
  ft as mockChannel,
  Ur as optionOrAltSymbol,
  Ut as shortcutMatchesShortcut,
  gs as shortcutToHumanString,
  Fa as types,
  Na as useAddonState,
  Ba as useArgTypes,
  Ma as useArgs,
  rr as useChannel,
  La as useGlobalTypes,
  Ua as useGlobals,
  Da as useParameter,
  Jo as useSharedState,
  ka as useStoryPrepared,
  U as useStorybookApi,
  Ca as useStorybookState
};
