var Hr = Object.create;
var ce = Object.defineProperty;
var Nr = Object.getOwnPropertyDescriptor;
var jr = Object.getOwnPropertyNames;
var Br = Object.getPrototypeOf, zr = Object.prototype.hasOwnProperty;
var n = (e, t) => ce(e, "name", { value: t, configurable: !0 });
var Ur = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), yt = (e, t) => {
  for (var r in t)
    ce(e, r, { get: t[r], enumerable: !0 });
}, Gr = (e, t, r, o) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (let i of jr(t))
      !zr.call(e, i) && i !== r && ce(e, i, { get: () => t[i], enumerable: !(o = Nr(t, i)) || o.enumerable });
  return e;
};
var Wr = (e, t, r) => (r = e != null ? Hr(Br(e)) : {}, Gr(
  // 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/@ngard/tiny-isequal/index.js
var ht = Ur((Ee) => {
  Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.isEqual = /* @__PURE__ */ function() {
    var e = Object.prototype.toString, t = Object.getPrototypeOf, r = Object.getOwnPropertySymbols ? function(o) {
      return Object.keys(o).concat(Object.getOwnPropertySymbols(o));
    } : Object.keys;
    return function(o, i) {
      return (/* @__PURE__ */ n(function s(a, l, c) {
        var p, y, u, h = e.call(a), T = e.call(l);
        if (a === l) return !0;
        if (a == null || l == null) return !1;
        if (c.indexOf(a) > -1 && c.indexOf(l) > -1) return !0;
        if (c.push(a, l), h != T || (p = r(a), y = r(l), p.length != y.length || p.some(function(R) {
          return !s(a[R], l[R], c);
        }))) return !1;
        switch (h.slice(8, -1)) {
          case "Symbol":
            return a.valueOf() == l.valueOf();
          case "Date":
          case "Number":
            return +a == +l || +a != +a && +l != +l;
          case "RegExp":
          case "Function":
          case "String":
          case "Boolean":
            return "" + a == "" + l;
          case "Set":
          case "Map":
            p = a.entries(), y = l.entries();
            do
              if (!s((u = p.next()).value, y.next().value, c)) return !1;
            while (!u.done);
            return !0;
          case "ArrayBuffer":
            a = new Uint8Array(a), l = new Uint8Array(l);
          case "DataView":
            a = new Uint8Array(a.buffer), l = new Uint8Array(l.buffer);
          case "Float32Array":
          case "Float64Array":
          case "Int8Array":
          case "Int16Array":
          case "Int32Array":
          case "Uint8Array":
          case "Uint16Array":
          case "Uint32Array":
          case "Uint8ClampedArray":
          case "Arguments":
          case "Array":
            if (a.length != l.length) return !1;
            for (u = 0; u < a.length; u++) if ((u in a || u in l) && (u in a != u in l || !s(a[u], l[u], c))) return !1;
            return !0;
          case "Object":
            return s(t(a), t(l), c);
          default:
            return !1;
        }
      }, "n"))(o, i, []);
    };
  }();
});

// src/csf/toStartCaseStr.ts
function gt(e) {
  return e.replace(/_/g, " ").replace(/-/g, " ").replace(/\./g, " ").replace(/([^\n])([A-Z])([a-z])/g, (t, r, o, i) => `${r} ${o}${i}`).replace(/([a-z])([A-Z])/g, (t, r, o) => `${r} ${o}`).replace(/([a-z])([0-9])/gi, (t, r, o) => `${r} ${o}`).replace(/([0-9])([a-z])/gi, (t, r, o) => `${r} ${o}`).replace(/(\s|^)(\w)/g, (t, r, o) => `${r}${o.toUpperCase()}`).replace(/ +/g, " ").trim();
}
n(gt, "toStartCaseStr");

// src/csf/includeConditionalArg.ts
var Ce = Wr(ht(), 1);
var xt = /* @__PURE__ */ n((e) => e.map((t) => typeof t < "u").filter(Boolean).length, "count"), Yr = /* @__PURE__ */ n((e, t) => {
  let { exists: r, eq: o, neq: i, truthy: s } = e;
  if (xt([r, o, i, s]) > 1)
    throw new Error(`Invalid conditional test ${JSON.stringify({ exists: r, eq: o, neq: i })}`);
  if (typeof o < "u")
    return (0, Ce.isEqual)(t, o);
  if (typeof i < "u")
    return !(0, Ce.isEqual)(t, i);
  if (typeof r < "u") {
    let l = typeof t < "u";
    return r ? l : !l;
  }
  return (typeof s > "u" ? !0 : s) ? !!t : !t;
}, "testValue"), Vr = /* @__PURE__ */ n((e, t, r) => {
  if (!e.if)
    return !0;
  let { arg: o, global: i } = e.if;
  if (xt([o, i]) !== 1)
    throw new Error(`Invalid conditional value ${JSON.stringify({ arg: o, global: i })}`);
  let s = o ? t[o] : r[i];
  return Yr(e.if, s);
}, "includeConditionalArg");

// src/csf/csf-factories.ts
import { combineTags as Ln } from "storybook/internal/csf";

// src/preview-api/modules/addons/main.ts
import { global as ve } from "@storybook/global";

// src/preview-api/modules/addons/storybook-channel-mock.ts
import { Channel as Kr } from "storybook/internal/channels";
function bt() {
  let e = {
    setHandler: /* @__PURE__ */ n(() => {
    }, "setHandler"),
    send: /* @__PURE__ */ n(() => {
    }, "send")
  };
  return new Kr({ transport: e });
}
n(bt, "mockChannel");

// src/preview-api/modules/addons/main.ts
var Pe = class {
  constructor() {
    this.getChannel = /* @__PURE__ */ n(() => {
      if (!this.channel) {
        let t = bt();
        return this.setChannel(t), t;
      }
      return 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.promise = new Promise((t) => {
      this.resolve = () => t(this.getChannel());
    });
  }
  static {
    n(this, "AddonStore");
  }
}, ke = "__STORYBOOK_ADDONS_PREVIEW";
function qr() {
  return ve[ke] || (ve[ke] = new Pe()), ve[ke];
}
n(qr, "getAddonsStore");
var Oe = qr();

// src/preview-api/modules/addons/hooks.ts
import { logger as Qn } from "storybook/internal/client-logger";
import {
  FORCE_RE_RENDER as ti,
  RESET_STORY_ARGS as ri,
  STORY_RENDERED as Tt,
  UPDATE_GLOBALS as oi,
  UPDATE_STORY_ARGS as ni
} from "storybook/internal/core-events";
import { global as Me } from "@storybook/global";
var de = class {
  constructor() {
    this.hookListsMap = void 0;
    this.mountedDecorators = void 0;
    this.prevMountedDecorators = void 0;
    this.currentHooks = void 0;
    this.nextHookIndex = void 0;
    this.currentPhase = void 0;
    this.currentEffects = void 0;
    this.prevEffects = void 0;
    this.currentDecoratorName = void 0;
    this.hasUpdates = void 0;
    this.currentContext = void 0;
    this.renderListener = /* @__PURE__ */ n((t) => {
      t === this.currentContext?.id && (this.triggerEffects(), this.currentContext = null, this.removeRenderListeners());
    }, "renderListener");
    this.init();
  }
  static {
    n(this, "HooksContext");
  }
  init() {
    this.hookListsMap = /* @__PURE__ */ new WeakMap(), this.mountedDecorators = /* @__PURE__ */ new Set(), this.prevMountedDecorators = /* @__PURE__ */ new Set(), this.currentHooks = [], this.nextHookIndex = 0, this.currentPhase = "NONE", this.currentEffects = [], this.prevEffects = [], this.currentDecoratorName = null, this.hasUpdates = !1, this.currentContext = null;
  }
  clean() {
    this.prevEffects.forEach((t) => {
      t.destroy && t.destroy();
    }), this.init(), this.removeRenderListeners();
  }
  getNextHook() {
    let t = this.currentHooks[this.nextHookIndex];
    return this.nextHookIndex += 1, t;
  }
  triggerEffects() {
    this.prevEffects.forEach((t) => {
      !this.currentEffects.includes(t) && t.destroy && t.destroy();
    }), this.currentEffects.forEach((t) => {
      this.prevEffects.includes(t) || (t.destroy = t.create());
    }), this.prevEffects = this.currentEffects, this.currentEffects = [];
  }
  addRenderListeners() {
    this.removeRenderListeners(), Oe.getChannel().on(Tt, this.renderListener);
  }
  removeRenderListeners() {
    Oe.getChannel().removeListener(Tt, this.renderListener);
  }
};
function St(e) {
  let t = /* @__PURE__ */ n((...r) => {
    let { hooks: o } = typeof r[0] == "function" ? r[1] : r[0], i = o.currentPhase, s = o.currentHooks, a = o.nextHookIndex, l = o.currentDecoratorName;
    o.currentDecoratorName = e.name, o.prevMountedDecorators.has(e) ? (o.currentPhase = "UPDATE", o.currentHooks = o.hookListsMap.get(e) || []) : (o.currentPhase = "MOUNT", o.currentHooks = [], o.hookListsMap.set(e, o.currentHooks), o.prevMountedDecorators.add(e)), o.nextHookIndex = 0;
    let c = Me.STORYBOOK_HOOKS_CONTEXT;
    Me.STORYBOOK_HOOKS_CONTEXT = o;
    let p = e(...r);
    if (Me.STORYBOOK_HOOKS_CONTEXT = c, o.currentPhase === "UPDATE" && o.getNextHook() != null)
      throw new Error(
        "Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
      );
    return o.currentPhase = i, o.currentHooks = s, o.nextHookIndex = a, o.currentDecoratorName = l, p;
  }, "hookified");
  return t.originalFn = e, t;
}
n(St, "hookify");
var $e = 0, Xr = 25, At = /* @__PURE__ */ n((e) => (t, r) => {
  let o = e(
    St(t),
    r.map((i) => St(i))
  );
  return (i) => {
    let { hooks: s } = i;
    s.prevMountedDecorators ??= /* @__PURE__ */ new Set(), s.mountedDecorators = /* @__PURE__ */ new Set([t, ...r]), s.currentContext = i, s.hasUpdates = !1;
    let a = o(i);
    for ($e = 1; s.hasUpdates; )
      if (s.hasUpdates = !1, s.currentEffects = [], a = o(i), $e += 1, $e > Xr)
        throw new Error(
          "Too many re-renders. Storybook limits the number of renders to prevent an infinite loop."
        );
    return s.addRenderListeners(), a;
  };
}, "applyHooks");

// ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
function ee(e) {
  if (!e || typeof e != "object")
    return !1;
  let t = Object.getPrototypeOf(e);
  return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(e) === "[object Object]" : !1;
}
n(ee, "isPlainObject");

// ../node_modules/es-toolkit/dist/object/mapValues.mjs
function U(e, t) {
  let r = {}, o = Object.keys(e);
  for (let i = 0; i < o.length; i++) {
    let s = o[i], a = e[s];
    r[s] = t(a, s, e);
  }
  return r;
}
n(U, "mapValues");

// ../node_modules/es-toolkit/dist/object/pickBy.mjs
function Fe(e, t) {
  let r = {}, o = Object.keys(e);
  for (let i = 0; i < o.length; i++) {
    let s = o[i], a = e[s];
    t(a, s) && (r[s] = a);
  }
  return r;
}
n(Fe, "pickBy");

// src/preview-api/modules/store/args.ts
import { once as Ai } from "storybook/internal/client-logger";

// ../node_modules/ts-dedent/esm/index.js
function W(e) {
  for (var t = [], r = 1; r < arguments.length; r++)
    t[r - 1] = arguments[r];
  var o = Array.from(typeof e == "string" ? [e] : e);
  o[o.length - 1] = o[o.length - 1].replace(/\r?\n([\t ]*)$/, "");
  var i = o.reduce(function(l, c) {
    var p = c.match(/\n([\t ]+|(?!\s).)/g);
    return p ? l.concat(p.map(function(y) {
      var u, h;
      return (h = (u = y.match(/[\t ]/g)) === null || u === void 0 ? void 0 : u.length) !== null && h !== void 0 ? h : 0;
    })) : l;
  }, []);
  if (i.length) {
    var s = new RegExp(`
[	 ]{` + Math.min.apply(Math, i) + "}", "g");
    o = o.map(function(l) {
      return l.replace(s, `
`);
    });
  }
  o[0] = o[0].replace(/^\r?\n/, "");
  var a = o[0];
  return t.forEach(function(l, c) {
    var p = a.match(/(?:^|\n)( *)$/), y = p ? p[1] : "", u = l;
    typeof l == "string" && l.includes(`
`) && (u = String(l).split(`
`).map(function(h, T) {
      return T === 0 ? h : "" + y + h;
    }).join(`
`)), a += u + o[c + 1];
  }), a;
}
n(W, "dedent");

// src/preview-api/modules/store/args.ts
var wi = Symbol("incompatible");
var Ei = Symbol("Deeply equal");
var Ie = "UNTARGETED";
function Rt({
  args: e,
  argTypes: t
}) {
  let r = {};
  return Object.entries(e).forEach(([o, i]) => {
    let { target: s = Ie } = t[o] || {};
    r[s] = r[s] || {}, r[s][o] = i;
  }), r;
}
n(Rt, "groupArgsByTarget");

// src/preview-api/modules/store/csf/getValuesFromArgTypes.ts
var wt = /* @__PURE__ */ n((e = {}) => Object.entries(e).reduce((t, [r, { defaultValue: o }]) => (typeof o < "u" && (t[r] = o), t), {}), "getValuesFromArgTypes");

// src/preview-api/modules/store/csf/normalizeInputTypes.ts
var Zr = /* @__PURE__ */ n((e) => typeof e == "string" ? { name: e } : e, "normalizeType"), Jr = /* @__PURE__ */ n((e) => typeof e == "string" ? { type: e } : e, "normalizeControl"), Qr = /* @__PURE__ */ n((e, t) => {
  let { type: r, control: o, ...i } = e, s = {
    name: t,
    ...i
  };
  return r && (s.type = Zr(r)), o ? s.control = Jr(o) : o === !1 && (s.control = { disable: !0 }), s;
}, "normalizeInputType"), K = /* @__PURE__ */ n((e) => U(e, Qr), "normalizeInputTypes");

// src/preview-api/modules/store/csf/normalizeStory.ts
import { deprecate as eo, logger as to } from "storybook/internal/client-logger";
import { storyNameFromExport as ro, toId as oo } from "storybook/internal/csf";

// src/preview-api/modules/store/csf/normalizeArrays.ts
var b = /* @__PURE__ */ n((e) => Array.isArray(e) ? e : e ? [e] : [], "normalizeArrays");

// src/preview-api/modules/store/csf/normalizeStory.ts
var no = W`
CSF .story annotations deprecated; annotate story functions directly:
- StoryFn.story.name => StoryFn.storyName
- StoryFn.story.(parameters|decorators) => StoryFn.(parameters|decorators)
See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#hoisted-csf-annotations for details and codemod.
`;
function Le(e, t, r) {
  let o = t, i = typeof t == "function" ? t : null, { story: s } = o;
  s && (to.debug("deprecated story", s), eo(no));
  let a = ro(e), l = typeof o != "function" && o.name || o.storyName || s?.name || a, c = [
    ...b(o.decorators),
    ...b(s?.decorators)
  ], p = { ...s?.parameters, ...o.parameters }, y = { ...s?.args, ...o.args }, u = { ...s?.argTypes, ...o.argTypes }, h = [...b(o.loaders), ...b(s?.loaders)], T = [
    ...b(o.beforeEach),
    ...b(s?.beforeEach)
  ], R = [
    ...b(o.afterEach),
    ...b(s?.afterEach)
  ], { render: P, play: L, tags: O = [], globals: F = {} } = o, A = p.__id || oo(r.id, a);
  return {
    moduleExport: t,
    id: A,
    name: l,
    tags: O,
    decorators: c,
    parameters: p,
    args: y,
    argTypes: K(u),
    loaders: h,
    beforeEach: T,
    afterEach: R,
    globals: F,
    ...P && { render: P },
    ...i && { userStoryFn: i },
    ...L && { play: L }
  };
}
n(Le, "normalizeStory");

// src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
import { sanitize as io } from "storybook/internal/csf";
function Et(e, t = e.title, r) {
  let { id: o, argTypes: i } = e;
  return {
    id: io(o || t),
    ...e,
    title: t,
    ...i && { argTypes: K(i) },
    parameters: {
      fileName: r,
      ...e.parameters
    }
  };
}
n(Et, "normalizeComponentAnnotations");

// src/preview-api/modules/store/csf/prepareStory.ts
import { combineTags as ao, includeConditionalArg as lo } from "storybook/internal/csf";
import { NoRenderFunctionError as po } from "storybook/internal/preview-errors";
import { global as co } from "@storybook/global";
import { global as mo } from "@storybook/global";

// src/preview-api/modules/preview-web/render/mount-utils.ts
function vt(e) {
  return e != null && so(e).includes("mount");
}
n(vt, "mountDestructured");
function so(e) {
  let t = e.toString().match(/[^(]*\(([^)]*)/);
  if (!t)
    return [];
  let r = Ct(t[1]);
  if (!r.length)
    return [];
  let o = r[0];
  return o.startsWith("{") && o.endsWith("}") ? Ct(o.slice(1, -1).replace(/\s/g, "")).map((s) => s.replace(/:.*|=.*/g, "")) : [];
}
n(so, "getUsedProps");
function Ct(e) {
  let t = [], r = [], o = 0;
  for (let s = 0; s < e.length; s++)
    if (e[s] === "{" || e[s] === "[")
      r.push(e[s] === "{" ? "}" : "]");
    else if (e[s] === r[r.length - 1])
      r.pop();
    else if (!r.length && e[s] === ",") {
      let a = e.substring(o, s).trim();
      a && t.push(a), o = s + 1;
    }
  let i = e.substring(o).trim();
  return i && t.push(i), t;
}
n(Ct, "splitByComma");

// src/preview-api/modules/store/decorators.ts
function kt(e, t, r) {
  let o = r(e);
  return (i) => t(o, i);
}
n(kt, "decorateStory");
function Pt({
  componentId: e,
  title: t,
  kind: r,
  id: o,
  name: i,
  story: s,
  parameters: a,
  initialArgs: l,
  argTypes: c,
  ...p
} = {}) {
  return p;
}
n(Pt, "sanitizeStoryContextUpdate");
function De(e, t) {
  let r = {}, o = /* @__PURE__ */ n((s) => (a) => {
    if (!r.value)
      throw new Error("Decorated function called without init");
    return r.value = {
      ...r.value,
      ...Pt(a)
    }, s(r.value);
  }, "bindWithContext"), i = t.reduce(
    (s, a) => kt(s, a, o),
    e
  );
  return (s) => (r.value = s, i(s));
}
n(De, "defaultDecorateStory");

// src/preview-api/modules/store/parameters.ts
var D = /* @__PURE__ */ n((...e) => {
  let t = {}, r = e.filter(Boolean), o = r.reduce((i, s) => (Object.entries(s).forEach(([a, l]) => {
    let c = i[a];
    Array.isArray(l) || typeof c > "u" ? i[a] = l : ee(l) && ee(c) ? t[a] = !0 : typeof l < "u" && (i[a] = l);
  }), i), {});
  return Object.keys(t).forEach((i) => {
    let s = r.filter(Boolean).map((a) => a[i]).filter((a) => typeof a < "u");
    s.every((a) => ee(a)) ? o[i] = D(...s) : o[i] = s[s.length - 1];
  }), o;
}, "combineParameters");

// src/preview-api/modules/store/csf/prepareStory.ts
function _e(e, t, r) {
  let { moduleExport: o, id: i, name: s } = e || {}, a = uo(
    e,
    t,
    r
  ), l = /* @__PURE__ */ n(async (w) => {
    let d = {};
    for (let m of [
      b(r.loaders),
      b(t.loaders),
      b(e.loaders)
    ]) {
      if (w.abortSignal.aborted)
        return d;
      let f = await Promise.all(m.map((x) => x(w)));
      Object.assign(d, ...f);
    }
    return d;
  }, "applyLoaders"), c = /* @__PURE__ */ n(async (w) => {
    let d = new Array();
    for (let m of [
      ...b(r.beforeEach),
      ...b(t.beforeEach),
      ...b(e.beforeEach)
    ]) {
      if (w.abortSignal.aborted)
        return d;
      let f = await m(w);
      f && d.push(f);
    }
    return d;
  }, "applyBeforeEach"), p = /* @__PURE__ */ n(async (w) => {
    let d = [
      ...b(r.afterEach),
      ...b(t.afterEach),
      ...b(e.afterEach)
    ].reverse();
    for (let m of d) {
      if (w.abortSignal.aborted)
        return;
      await m(w);
    }
  }, "applyAfterEach"), y = /* @__PURE__ */ n((w) => w.originalStoryFn(w.args, w), "undecoratedStoryFn"), { applyDecorators: u = De, runStep: h } = r, T = [
    ...b(e?.decorators),
    ...b(t?.decorators),
    ...b(r?.decorators)
  ], R = e?.userStoryFn || e?.render || t.render || r.render, P = At(u)(y, T), L = /* @__PURE__ */ n((w) => P(w), "unboundStoryFn"), O = e?.play ?? t?.play, F = vt(O);
  if (!R && !F)
    throw new po({ id: i });
  let A = /* @__PURE__ */ n((w) => async () => (await w.renderToCanvas(), w.canvas), "defaultMount"), S = e.mount ?? t.mount ?? r.mount ?? A, v = r.testingLibraryRender;
  return {
    storyGlobals: {},
    ...a,
    moduleExport: o,
    id: i,
    name: s,
    story: s,
    originalStoryFn: R,
    undecoratedStoryFn: y,
    unboundStoryFn: L,
    applyLoaders: l,
    applyBeforeEach: c,
    applyAfterEach: p,
    playFunction: O,
    runStep: h,
    mount: S,
    testingLibraryRender: v,
    renderToCanvas: r.renderToCanvas,
    usesMount: F
  };
}
n(_e, "prepareStory");
function uo(e, t, r) {
  let o = ["dev", "test"], i = mo.DOCS_OPTIONS?.autodocs === !0 ? ["autodocs"] : [], s = ao(
    ...o,
    ...i,
    ...r.tags ?? [],
    ...t.tags ?? [],
    ...e?.tags ?? []
  ), a = D(
    r.parameters,
    t.parameters,
    e?.parameters
  ), { argTypesEnhancers: l = [], argsEnhancers: c = [] } = r, p = D(
    r.argTypes,
    t.argTypes,
    e?.argTypes
  );
  if (e) {
    let O = e?.userStoryFn || e?.render || t.render || r.render;
    a.__isArgsStory = O && O.length > 0;
  }
  let y = {
    ...r.args,
    ...t.args,
    ...e?.args
  }, u = {
    ...t.globals,
    ...e?.globals
  }, h = {
    componentId: t.id,
    title: t.title,
    kind: t.title,
    // Back compat
    id: e?.id || t.id,
    // if there's no story name, we create a fake one since enhancers expect a name
    name: e?.name || "__meta",
    story: e?.name || "__meta",
    // Back compat
    component: t.component,
    subcomponents: t.subcomponents,
    tags: s,
    parameters: a,
    initialArgs: y,
    argTypes: p,
    storyGlobals: u
  };
  h.argTypes = l.reduce(
    (O, F) => F({ ...h, argTypes: O }),
    h.argTypes
  );
  let T = { ...y };
  h.initialArgs = [...c].reduce(
    (O, F) => ({
      ...O,
      ...F({
        ...h,
        initialArgs: O
      })
    }),
    T
  );
  let { name: R, story: P, ...L } = h;
  return L;
}
n(uo, "preparePartialAnnotations");
function Ot(e) {
  let { args: t } = e, r = {
    ...e,
    allArgs: void 0,
    argsByTarget: void 0
  };
  if (co.FEATURES?.argTypeTargetsV7) {
    let s = Rt(e);
    r = {
      ...e,
      allArgs: e.args,
      argsByTarget: s,
      args: s[Ie] || {}
    };
  }
  let o = Object.entries(r.args).reduce((s, [a, l]) => {
    if (!r.argTypes[a]?.mapping)
      return s[a] = l, s;
    let c = /* @__PURE__ */ n((p) => {
      let y = r.argTypes[a].mapping;
      return y && p in y ? y[p] : p;
    }, "mappingFn");
    return s[a] = Array.isArray(l) ? l.map(c) : c(l), s;
  }, {}), i = Object.entries(o).reduce((s, [a, l]) => {
    let c = r.argTypes[a] || {};
    return lo(c, o, r.globals) && (s[a] = l), s;
  }, {});
  return { ...r, unmappedArgs: t, args: i };
}
n(Ot, "prepareContext");

// src/preview-api/modules/store/inferArgTypes.ts
import { logger as fo } from "storybook/internal/client-logger";
var He = /* @__PURE__ */ n((e, t, r) => {
  let o = typeof e;
  switch (o) {
    case "boolean":
    case "string":
    case "number":
    case "function":
    case "symbol":
      return { name: o };
    default:
      break;
  }
  return e ? r.has(e) ? (fo.warn(W`
        We've detected a cycle in arg '${t}'. Args should be JSON-serializable.

        Consider using the mapping feature or fully custom args:
        - Mapping: https://storybook.js.org/docs/writing-stories/args#mapping-to-complex-arg-values
        - Custom args: https://storybook.js.org/docs/essentials/controls#fully-custom-args
      `), { name: "other", value: "cyclic object" }) : (r.add(e), Array.isArray(e) ? { name: "array", value: e.length > 0 ? He(e[0], t, new Set(r)) : { name: "other", value: "unknown" } } : { name: "object", value: U(e, (s) => He(s, t, new Set(r))) }) : { name: "object", value: {} };
}, "inferType"), Ne = /* @__PURE__ */ n((e) => {
  let { id: t, argTypes: r = {}, initialArgs: o = {} } = e, i = U(o, (a, l) => ({
    name: l,
    type: He(a, `${t}.${l}`, /* @__PURE__ */ new Set())
  })), s = U(r, (a, l) => ({
    name: l
  }));
  return D(i, s, r);
}, "inferArgTypes");
Ne.secondPass = !0;

// src/preview-api/modules/store/inferControls.ts
import { logger as yo } from "storybook/internal/client-logger";

// src/preview-api/modules/store/filterArgTypes.ts
var Mt = /* @__PURE__ */ n((e, t) => Array.isArray(t) ? t.includes(e) : e.match(t), "matches"), je = /* @__PURE__ */ n((e, t, r) => !t && !r ? e : e && Fe(e, (o, i) => {
  let s = o.name || i.toString();
  return !!(!t || Mt(s, t)) && (!r || !Mt(s, r));
}), "filterArgTypes");

// src/preview-api/modules/store/inferControls.ts
var go = /* @__PURE__ */ n((e, t, r) => {
  let { type: o, options: i } = e;
  if (o) {
    if (r.color && r.color.test(t)) {
      let s = o.name;
      if (s === "string")
        return { control: { type: "color" } };
      s !== "enum" && yo.warn(
        `Addon controls: Control of type color only supports string, received "${s}" instead`
      );
    }
    if (r.date && r.date.test(t))
      return { control: { type: "date" } };
    switch (o.name) {
      case "array":
        return { control: { type: "object" } };
      case "boolean":
        return { control: { type: "boolean" } };
      case "string":
        return { control: { type: "text" } };
      case "number":
        return { control: { type: "number" } };
      case "enum": {
        let { value: s } = o;
        return { control: { type: s?.length <= 5 ? "radio" : "select" }, options: s };
      }
      case "function":
      case "symbol":
        return null;
      default:
        return { control: { type: i ? "select" : "object" } };
    }
  }
}, "inferControl"), me = /* @__PURE__ */ n((e) => {
  let {
    argTypes: t,
    parameters: { __isArgsStory: r, controls: { include: o = null, exclude: i = null, matchers: s = {} } = {} }
  } = e;
  if (!r)
    return t;
  let a = je(t, o, i), l = U(a, (c, p) => c?.type && go(c, p.toString(), s));
  return D(l, a);
}, "inferControls");
me.secondPass = !0;

// src/preview-api/modules/store/csf/normalizeProjectAnnotations.ts
function te({
  argTypes: e,
  globalTypes: t,
  argTypesEnhancers: r,
  decorators: o,
  loaders: i,
  beforeEach: s,
  afterEach: a,
  initialGlobals: l,
  ...c
}) {
  return {
    ...e && { argTypes: K(e) },
    ...t && { globalTypes: K(t) },
    decorators: b(o),
    loaders: b(i),
    beforeEach: b(s),
    afterEach: b(a),
    argTypesEnhancers: [
      ...r || [],
      Ne,
      // There's an architectural decision to be made regarding embedded addons in core:
      //
      // Option 1: Keep embedded addons but ensure consistency by moving addon-specific code
      // (like inferControls) to live alongside the addon code itself. This maintains the
      // concept of core addons while improving code organization.
      //
      // Option 2: Fully integrate these addons into core, potentially moving UI components
      // into the manager and treating them as core features rather than addons. This is a
      // bigger architectural change requiring careful consideration.
      //
      // For now, we're keeping inferControls here as we need time to properly evaluate
      // these options and their implications. Some features (like Angular's cleanArgsDecorator)
      // currently rely on this behavior.
      //
      // TODO: Make an architectural decision on the handling of core addons
      me
    ],
    initialGlobals: l,
    ...c
  };
}
n(te, "normalizeProjectAnnotations");

// src/preview-api/modules/store/csf/composeConfigs.ts
import { global as ho } from "@storybook/global";

// src/preview-api/modules/store/csf/beforeAll.ts
var $t = /* @__PURE__ */ n((e) => async () => {
  let t = [];
  for (let r of e) {
    let o = await r();
    o && t.unshift(o);
  }
  return async () => {
    for (let r of t)
      await r();
  };
}, "composeBeforeAllHooks");

// src/preview-api/modules/store/csf/stepRunners.ts
function Be(e) {
  return async (t, r, o) => {
    await e.reduceRight(
      (s, a) => async () => a(t, s, o),
      async () => r(o)
    )();
  };
}
n(Be, "composeStepRunners");

// src/preview-api/modules/store/csf/composeConfigs.ts
function oe(e, t) {
  return e.map((r) => r.default?.[t] ?? r[t]).filter(Boolean);
}
n(oe, "getField");
function Y(e, t, r = {}) {
  return oe(e, t).reduce((o, i) => {
    let s = b(i);
    return r.reverseFileOrder ? [...s, ...o] : [...o, ...s];
  }, []);
}
n(Y, "getArrayField");
function ue(e, t) {
  return Object.assign({}, ...oe(e, t));
}
n(ue, "getObjectField");
function re(e, t) {
  return oe(e, t).pop();
}
n(re, "getSingletonField");
function ne(e) {
  let t = Y(e, "argTypesEnhancers"), r = oe(e, "runStep"), o = Y(e, "beforeAll");
  return {
    parameters: D(...oe(e, "parameters")),
    decorators: Y(e, "decorators", {
      reverseFileOrder: !(ho.FEATURES?.legacyDecoratorFileOrder ?? !1)
    }),
    args: ue(e, "args"),
    argsEnhancers: Y(e, "argsEnhancers"),
    argTypes: ue(e, "argTypes"),
    argTypesEnhancers: [
      ...t.filter((i) => !i.secondPass),
      ...t.filter((i) => i.secondPass)
    ],
    initialGlobals: ue(e, "initialGlobals"),
    globalTypes: ue(e, "globalTypes"),
    loaders: Y(e, "loaders"),
    beforeAll: $t(o),
    beforeEach: Y(e, "beforeEach"),
    afterEach: Y(e, "afterEach"),
    render: re(e, "render"),
    renderToCanvas: re(e, "renderToCanvas"),
    applyDecorators: re(e, "applyDecorators"),
    runStep: Be(r),
    tags: Y(e, "tags"),
    mount: re(e, "mount"),
    testingLibraryRender: re(e, "testingLibraryRender")
  };
}
n(ne, "composeConfigs");

// src/preview-api/modules/store/csf/portable-stories.ts
import { isExportStory as Ks } from "storybook/internal/csf";
import { getCoreAnnotations as Xs } from "storybook/internal/csf";
import { MountMustBeDestructuredError as bo } from "storybook/internal/preview-errors";

// src/preview-api/modules/preview-web/render/animation-utils.ts
function Ft() {
  try {
    return (
      // @ts-expect-error this property exists in certain environments
      !!globalThis.__vitest_browser__ || // @ts-expect-error this property exists in certain environments
      !!globalThis.__playwright__binding__
    );
  } catch {
    return !1;
  }
}
n(Ft, "isTestEnvironment");
function It(e = !0) {
  if (!("document" in globalThis && "createElement" in globalThis.document))
    return () => {
    };
  let t = document.createElement("style");
  t.textContent = `*, *:before, *:after {
    animation: none !important;
  }`, document.head.appendChild(t);
  let r = document.createElement("style");
  return r.textContent = `*, *:before, *:after {
    animation-delay: 0s !important;
    animation-direction: ${e ? "reverse" : "normal"} !important;
    animation-play-state: paused !important;
    transition: none !important;
  }`, document.head.appendChild(r), document.body.clientHeight, document.head.removeChild(t), () => {
    r.parentNode?.removeChild(r);
  };
}
n(It, "pauseAnimations");
async function Lt(e) {
  if (!("document" in globalThis && "getAnimations" in globalThis.document && "querySelectorAll" in globalThis.document))
    return;
  let t = !1;
  await Promise.race([
    // After 50ms, retrieve any running animations and wait for them to finish
    // If new animations are created while waiting, we'll wait for them too
    new Promise((r) => {
      setTimeout(() => {
        let o = [globalThis.document, ...Dt(globalThis.document)], i = /* @__PURE__ */ n(async () => {
          if (t || e?.aborted)
            return;
          let s = o.flatMap((a) => a?.getAnimations?.() || []).filter((a) => a.playState === "running" && !xo(a));
          s.length > 0 && (await Promise.all(s.map((a) => a.finished)), await i());
        }, "checkAnimationsFinished");
        i().then(r);
      }, 100);
    }),
    // If animations don't finish within the timeout, continue without waiting
    new Promise(
      (r) => setTimeout(() => {
        t = !0, r(void 0);
      }, 5e3)
    )
  ]);
}
n(Lt, "waitForAnimations");
function Dt(e) {
  return [e, ...e.querySelectorAll("*")].reduce((t, r) => ("shadowRoot" in r && r.shadowRoot && t.push(r.shadowRoot, ...Dt(r.shadowRoot)), t), []);
}
n(Dt, "getShadowRoots");
function xo(e) {
  if (e instanceof CSSAnimation && e.effect instanceof KeyframeEffect && e.effect.target) {
    let t = getComputedStyle(e.effect.target, e.effect.pseudoElement), r = t.animationName?.split(", ").indexOf(e.animationName);
    return t.animationIterationCount.split(", ")[r] === "infinite";
  }
  return !1;
}
n(xo, "isInfiniteAnimation");

// src/preview-api/modules/store/reporter-api.ts
var fe = class {
  constructor() {
    this.reports = [];
  }
  static {
    n(this, "ReporterAPI");
  }
  async addReport(t) {
    this.reports.push(t);
  }
};

// src/preview-api/modules/store/csf/portable-stories.ts
var To = "ComposedStory", So = "Unnamed Story";
var V = [];
function ze(e, t, r, o, i) {
  if (e === void 0)
    throw new Error("Expected a story but received undefined.");
  t.title = t.title ?? To;
  let s = Et(t), a = i || e.storyName || e.story?.name || e.name || So, l = Le(
    a,
    e,
    s
  ), c = te(
    ne([
      o ?? globalThis.globalProjectAnnotations ?? {},
      r ?? {}
    ])
  ), p = _e(
    l,
    s,
    c
  ), u = {
    ...wt(c.globalTypes),
    ...c.initialGlobals,
    ...p.storyGlobals
  }, h = new fe(), T = /* @__PURE__ */ n(() => {
    let A = Ot({
      hooks: new de(),
      globals: u,
      args: { ...p.initialArgs },
      viewMode: "story",
      reporting: h,
      loaded: {},
      abortSignal: new AbortController().signal,
      step: /* @__PURE__ */ n((S, v) => p.runStep(S, v, A), "step"),
      canvasElement: null,
      canvas: {},
      userEvent: {},
      globalTypes: c.globalTypes,
      ...p,
      context: null,
      mount: null
    });
    return A.parameters.__isPortableStory = !0, A.context = A, p.renderToCanvas && (A.renderToCanvas = async () => {
      let S = await p.renderToCanvas?.(
        {
          componentId: p.componentId,
          title: p.title,
          id: p.id,
          name: p.name,
          tags: p.tags,
          showMain: /* @__PURE__ */ n(() => {
          }, "showMain"),
          showError: /* @__PURE__ */ n((v) => {
            throw new Error(`${v.title}
${v.description}`);
          }, "showError"),
          showException: /* @__PURE__ */ n((v) => {
            throw v;
          }, "showException"),
          forceRemount: !0,
          storyContext: A,
          storyFn: /* @__PURE__ */ n(() => p.unboundStoryFn(A), "storyFn"),
          unboundStoryFn: p.unboundStoryFn
        },
        A.canvasElement
      );
      S && V.push(S);
    }), A.mount = p.mount(A), A;
  }, "initializeContext"), R, P = /* @__PURE__ */ n(async (A) => {
    let S = T();
    return S.canvasElement ??= globalThis?.document?.body, R && (S.loaded = R.loaded), Object.assign(S, A), p.playFunction(S);
  }, "play"), L = /* @__PURE__ */ n((A) => {
    let S = T();
    return Object.assign(S, A), Ao(p, S);
  }, "run"), O = p.playFunction ? P : void 0;
  return Object.assign(
    /* @__PURE__ */ n(function(S) {
      let v = T();
      return R && (v.loaded = R.loaded), v.args = {
        ...v.initialArgs,
        ...S
      }, p.unboundStoryFn(v);
    }, "storyFn"),
    {
      id: p.id,
      storyName: a,
      load: /* @__PURE__ */ n(async () => {
        for (let S of [...V].reverse())
          await S();
        V.length = 0;
        let A = T();
        A.loaded = await p.applyLoaders(A), V.push(...(await p.applyBeforeEach(A)).filter(Boolean)), R = A;
      }, "load"),
      globals: u,
      args: p.initialArgs,
      parameters: p.parameters,
      argTypes: p.argTypes,
      play: O,
      run: L,
      reporting: h,
      tags: p.tags
    }
  );
}
n(ze, "composeStory");
async function Ao(e, t) {
  for (let s of [...V].reverse())
    await s();
  if (V.length = 0, !t.canvasElement) {
    let s = document.createElement("div");
    globalThis?.document?.body?.appendChild(s), t.canvasElement = s, V.push(() => {
      globalThis?.document?.body?.contains(s) && globalThis?.document?.body?.removeChild(s);
    });
  }
  if (t.loaded = await e.applyLoaders(t), t.abortSignal.aborted)
    return;
  V.push(...(await e.applyBeforeEach(t)).filter(Boolean));
  let r = e.playFunction, o = e.usesMount;
  if (o || await t.mount(), t.abortSignal.aborted)
    return;
  r && (o || (t.mount = async () => {
    throw new bo({ playFunction: r.toString() });
  }), await r(t));
  let i;
  Ft() ? i = It() : await Lt(t.abortSignal), await e.applyAfterEach(t), await i?.();
}
n(Ao, "runStory");

// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
var Ro = !1, Ue = "Invariant failed";
function ye(e, t) {
  if (!e) {
    if (Ro)
      throw new Error(Ue);
    var r = typeof t == "function" ? t() : t, o = r ? "".concat(Ue, ": ").concat(r) : Ue;
    throw new Error(o);
  }
}
n(ye, "invariant");

// src/actions/preview.ts
import { definePreviewAddon as $o } from "storybook/internal/csf";

// src/actions/addArgs.ts
var We = {};
yt(We, {
  argsEnhancers: () => ko
});

// src/actions/runtime/action.ts
import { ImplicitActionsDuringRendering as wo } from "storybook/internal/preview-errors";
import { global as Nt } from "@storybook/global";
import { addons as Eo } from "storybook/preview-api";

// src/actions/constants.ts
var Ge = "storybook/actions", Ma = `${Ge}/panel`, _t = `${Ge}/action-event`, $a = `${Ge}/action-clear`;

// src/actions/runtime/configureActions.ts
var Ht = {
  depth: 10,
  clearOnStoryChange: !0,
  limit: 50
};

// src/actions/runtime/action.ts
var jt = /* @__PURE__ */ n((e, t) => {
  let r = Object.getPrototypeOf(e);
  return !r || t(r) ? r : jt(r, t);
}, "findProto"), Co = /* @__PURE__ */ n((e) => !!(typeof e == "object" && e && jt(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) && typeof e.persist == "function"), "isReactSyntheticEvent"), vo = /* @__PURE__ */ n((e) => {
  if (Co(e)) {
    let t = Object.create(
      e.constructor.prototype,
      Object.getOwnPropertyDescriptors(e)
    );
    t.persist();
    let r = Object.getOwnPropertyDescriptor(t, "view"), o = r?.value;
    return typeof o == "object" && o?.constructor.name === "Window" && Object.defineProperty(t, "view", {
      ...r,
      value: Object.create(o.constructor.prototype)
    }), t;
  }
  return e;
}, "serializeArg");
function ie(e, t = {}) {
  let r = {
    ...Ht,
    ...t
  }, o = /* @__PURE__ */ n(function(...s) {
    if (t.implicit) {
      let T = ("__STORYBOOK_PREVIEW__" in Nt ? Nt.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
        (R) => R.phase === "playing" || R.phase === "rendering"
      );
      if (T) {
        let R = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, P = new wo({
          phase: T.phase,
          name: e,
          deprecated: R
        });
        if (R)
          console.warn(P);
        else
          throw P;
      }
    }
    let a = Eo.getChannel(), l = Date.now().toString(36) + Math.random().toString(36).substring(2), c = 5, p = s.map(vo), y = s.length > 1 ? p : p[0], u = {
      id: l,
      count: 0,
      data: { name: e, args: y },
      options: {
        ...r,
        maxDepth: c + (r.depth || 3)
      }
    };
    a.emit(_t, u);
  }, "actionHandler");
  return o.isAction = !0, o.implicit = t.implicit, o;
}
n(ie, "action");

// src/actions/addArgsHelpers.ts
var Bt = /* @__PURE__ */ n((e, t) => typeof t[e] > "u" && !(e in t), "isInInitialArgs"), zt = /* @__PURE__ */ n((e) => {
  let {
    initialArgs: t,
    argTypes: r,
    id: o,
    parameters: { actions: i }
  } = e;
  if (!i || i.disable || !i.argTypesRegex || !r)
    return {};
  let s = new RegExp(i.argTypesRegex);
  return Object.entries(r).filter(
    ([l]) => !!s.test(l)
  ).reduce((l, [c, p]) => (Bt(c, t) && (l[c] = ie(c, { implicit: !0, id: o })), l), {});
}, "inferActionsFromArgTypesRegex"), Ut = /* @__PURE__ */ n((e) => {
  let {
    initialArgs: t,
    argTypes: r,
    parameters: { actions: o }
  } = e;
  return o?.disable || !r ? {} : Object.entries(r).filter(([s, a]) => !!a.action).reduce((s, [a, l]) => (Bt(a, t) && (s[a] = ie(typeof l.action == "string" ? l.action : a)), s), {});
}, "addActionsFromArgTypes");

// src/actions/addArgs.ts
var ko = [
  Ut,
  zt
];

// src/actions/loaders.ts
var Ye = {};
yt(Ye, {
  loaders: () => Mo
});
import { onMockCall as Po } from "storybook/test";
var Gt = !1, Oo = /* @__PURE__ */ n((e) => {
  let { parameters: t } = e;
  t?.actions?.disable || Gt || (Po((r, o) => {
    let i = r.getMockName();
    i !== "spy" && (!/^next\/.*::/.test(i) || [
      "next/router::useRouter()",
      "next/navigation::useRouter()",
      "next/navigation::redirect",
      "next/cache::",
      "next/headers::cookies().set",
      "next/headers::cookies().delete",
      "next/headers::headers().set",
      "next/headers::headers().delete"
    ].some((s) => i.startsWith(s))) && ie(i)(o);
  }), Gt = !0);
}, "logActionsWhenMockCalled"), Mo = [Oo];

// src/actions/preview.ts
var Ve = /* @__PURE__ */ n(() => $o({
  ...We,
  ...Ye
}), "default");

// src/backgrounds/preview.ts
import { definePreviewAddon as _o } from "storybook/internal/csf";

// src/backgrounds/constants.ts
var Fo = "storybook/background", Z = "backgrounds";
var Qa = {
  UPDATE: `${Fo}/update`
};

// src/backgrounds/decorator.ts
import { useEffect as qt } from "storybook/preview-api";

// src/backgrounds/defaults.ts
var Wt = {
  light: { name: "light", value: "#F8F8F8" },
  dark: { name: "dark", value: "#333" }
};

// src/backgrounds/utils.ts
var { document: N } = globalThis, Yt = /* @__PURE__ */ n(() => globalThis?.matchMedia ? !!globalThis.matchMedia("(prefers-reduced-motion: reduce)")?.matches : !1, "isReduceMotionEnabled"), Ke = /* @__PURE__ */ n((e) => {
  (Array.isArray(e) ? e : [e]).forEach(Io);
}, "clearStyles"), Io = /* @__PURE__ */ n((e) => {
  if (!N)
    return;
  let t = N.getElementById(e);
  t && t.parentElement && t.parentElement.removeChild(t);
}, "clearStyle"), Vt = /* @__PURE__ */ n((e, t) => {
  if (!N)
    return;
  let r = N.getElementById(e);
  if (r)
    r.innerHTML !== t && (r.innerHTML = t);
  else {
    let o = N.createElement("style");
    o.setAttribute("id", e), o.innerHTML = t, N.head.appendChild(o);
  }
}, "addGridStyle"), Kt = /* @__PURE__ */ n((e, t, r) => {
  if (!N)
    return;
  let o = N.getElementById(e);
  if (o)
    o.innerHTML !== t && (o.innerHTML = t);
  else {
    let i = N.createElement("style");
    i.setAttribute("id", e), i.innerHTML = t;
    let s = `addon-backgrounds-grid${r ? `-docs-${r}` : ""}`, a = N.getElementById(s);
    a ? a.parentElement?.insertBefore(i, a) : N.head.appendChild(i);
  }
}, "addBackgroundStyle");

// src/backgrounds/decorator.ts
var Lo = {
  cellSize: 100,
  cellAmount: 10,
  opacity: 0.8
}, Xt = "addon-backgrounds", Zt = "addon-backgrounds-grid", Do = Yt() ? "" : "transition: background-color 0.3s;", Jt = /* @__PURE__ */ n((e, t) => {
  let { globals: r = {}, parameters: o = {}, viewMode: i, id: s } = t, {
    options: a = Wt,
    disable: l,
    grid: c = Lo
  } = o[Z] || {}, p = r[Z] || {}, y = typeof p == "string" ? p : p?.value, u = y ? a[y] : void 0, h = typeof u == "string" ? u : u?.value || "transparent", T = typeof p == "string" ? !1 : p.grid || !1, R = !!u && !l, P = i === "docs" ? `#anchor--${s} .docs-story` : ".sb-show-main", L = i === "docs" ? `#anchor--${s} .docs-story` : ".sb-show-main", O = o.layout === void 0 || o.layout === "padded", F = i === "docs" ? 20 : O ? 16 : 0, { cellAmount: A, cellSize: S, opacity: v, offsetX: w = F, offsetY: d = F } = c, m = i === "docs" ? `${Xt}-docs-${s}` : `${Xt}-color`, f = i === "docs" ? s : null;
  qt(() => {
    let g = `
    ${P} {
      background: ${h} !important;
      ${Do}
      }`;
    if (!R) {
      Ke(m);
      return;
    }
    Kt(m, g, f);
  }, [P, m, f, R, h]);
  let x = i === "docs" ? `${Zt}-docs-${s}` : `${Zt}`;
  return qt(() => {
    if (!T) {
      Ke(x);
      return;
    }
    let g = [
      `${S * A}px ${S * A}px`,
      `${S * A}px ${S * A}px`,
      `${S}px ${S}px`,
      `${S}px ${S}px`
    ].join(", "), E = `
        ${L} {
          background-size: ${g} !important;
          background-position: ${w}px ${d}px, ${w}px ${d}px, ${w}px ${d}px, ${w}px ${d}px !important;
          background-blend-mode: difference !important;
          background-image: linear-gradient(rgba(130, 130, 130, ${v}) 1px, transparent 1px),
           linear-gradient(90deg, rgba(130, 130, 130, ${v}) 1px, transparent 1px),
           linear-gradient(rgba(130, 130, 130, ${v / 2}) 1px, transparent 1px),
           linear-gradient(90deg, rgba(130, 130, 130, ${v / 2}) 1px, transparent 1px) !important;
        }
      `;
    Vt(x, E);
  }, [A, S, L, x, T, w, d, v]), e();
}, "withBackgroundAndGrid");

// src/backgrounds/preview.ts
var Ho = globalThis.FEATURES?.backgrounds ? [Jt] : [], No = {
  [Z]: {
    grid: {
      cellSize: 20,
      opacity: 0.5,
      cellAmount: 5
    },
    disable: !1
  }
}, jo = {
  [Z]: { value: void 0, grid: !1 }
}, qe = /* @__PURE__ */ n(() => _o({
  decorators: Ho,
  parameters: No,
  initialGlobals: jo
}), "default");

// src/component-testing/preview.ts
import { definePreviewAddon as Bo } from "storybook/internal/csf";
import { instrument as zo } from "storybook/internal/instrumenter";
var { step: Uo } = zo(
  {
    // It seems like the label is unused, but the instrumenter has access to it
    // The context will be bounded later in StoryRender, so that the user can write just:
    // await step("label", (context) => {
    //   // labeled step
    // });
    step: /* @__PURE__ */ n(async (e, t, r) => t(r), "step")
  },
  { intercept: !0 }
), Xe = /* @__PURE__ */ n(() => Bo({
  parameters: {
    throwPlayFunctionExceptions: !1
  },
  runStep: Uo
}), "default");

// src/highlight/preview.ts
import { definePreviewAddon as Ko } from "storybook/internal/csf";
import { addons as cr } from "storybook/preview-api";

// src/highlight/useHighlights.ts
import { STORY_RENDER_PHASE_CHANGED as Yo } from "storybook/internal/core-events";

// src/highlight/constants.ts
var ge = "storybook/highlight", Qt = `${ge}/add`, er = `${ge}/remove`, tr = `${ge}/reset`, rr = `${ge}/scroll-into-view`, Ze = 2147483647, B = 28;

// src/highlight/icons.ts
var Je = {
  chevronLeft: [
    "M9.10355 10.1464C9.29882 10.3417 9.29882 10.6583 9.10355 10.8536C8.90829 11.0488 8.59171 11.0488 8.39645 10.8536L4.89645 7.35355C4.70118 7.15829 4.70118 6.84171 4.89645 6.64645L8.39645 3.14645C8.59171 2.95118 8.90829 2.95118 9.10355 3.14645C9.29882 3.34171 9.29882 3.65829 9.10355 3.85355L5.95711 7L9.10355 10.1464Z"
  ],
  chevronRight: [
    "M4.89645 10.1464C4.70118 10.3417 4.70118 10.6583 4.89645 10.8536C5.09171 11.0488 5.40829 11.0488 5.60355 10.8536L9.10355 7.35355C9.29882 7.15829 9.29882 6.84171 9.10355 6.64645L5.60355 3.14645C5.40829 2.95118 5.09171 2.95118 4.89645 3.14645C4.70118 3.34171 4.70118 3.65829 4.89645 3.85355L8.04289 7L4.89645 10.1464Z"
  ],
  info: [
    "M7 5.5a.5.5 0 01.5.5v4a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zM7 4.5A.75.75 0 107 3a.75.75 0 000 1.5z",
    "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z"
  ],
  shareAlt: [
    "M2 1.004a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1v-4.5a.5.5 0 00-1 0v4.5H2v-10h4.5a.5.5 0 000-1H2z",
    "M7.354 7.357L12 2.711v1.793a.5.5 0 001 0v-3a.5.5 0 00-.5-.5h-3a.5.5 0 100 1h1.793L6.646 6.65a.5.5 0 10.708.707z"
  ]
};

// src/highlight/utils.ts
var Go = "svg,path,rect,circle,line,polyline,polygon,ellipse,text".split(","), M = /* @__PURE__ */ n((e, t = {}, r) => {
  let o = Go.includes(e) ? document.createElementNS("http://www.w3.org/2000/svg", e) : document.createElement(e);
  return Object.entries(t).forEach(([i, s]) => {
    /[A-Z]/.test(i) ? (i === "onClick" && (o.addEventListener("click", s), o.addEventListener("keydown", (a) => {
      (a.key === "Enter" || a.key === " ") && (a.preventDefault(), s());
    })), i === "onMouseEnter" && o.addEventListener("mouseenter", s), i === "onMouseLeave" && o.addEventListener("mouseleave", s)) : o.setAttribute(i, s);
  }), r?.forEach((i) => {
    if (!(i == null || i === !1))
      try {
        o.appendChild(i);
      } catch {
        o.appendChild(document.createTextNode(String(i)));
      }
  }), o;
}, "createElement"), ae = /* @__PURE__ */ n((e) => Je[e] && M(
  "svg",
  { width: "14", height: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg" },
  Je[e].map(
    (t) => M("path", {
      fill: "currentColor",
      "fill-rule": "evenodd",
      "clip-rule": "evenodd",
      d: t
    })
  )
), "createIcon"), or = /* @__PURE__ */ n((e) => {
  if ("elements" in e) {
    let { elements: o, color: i, style: s } = e;
    return {
      id: void 0,
      priority: 0,
      selectors: o,
      styles: {
        outline: `2px ${s} ${i}`,
        outlineOffset: "2px",
        boxShadow: "0 0 0 6px rgba(255,255,255,0.6)"
      },
      menu: void 0
    };
  }
  let { menu: t, ...r } = e;
  return {
    id: void 0,
    priority: 0,
    styles: {
      outline: "2px dashed #029cfd"
    },
    ...r,
    menu: Array.isArray(t) ? t.every(Array.isArray) ? t : [t] : void 0
  };
}, "normalizeOptions"), Wo = /* @__PURE__ */ n((e) => e instanceof Function, "isFunction"), se = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ n((e) => {
  let t = Symbol();
  return q.set(t, []), se.set(t, e), { get: /* @__PURE__ */ n(() => se.get(t), "get"), set: /* @__PURE__ */ n((a) => {
    let l = se.get(t), c = Wo(a) ? a(l) : a;
    c !== l && (se.set(t, c), q.get(t)?.forEach((p) => {
      he.get(p)?.(), he.set(p, p(c));
    }));
  }, "set"), subscribe: /* @__PURE__ */ n((a) => (q.get(t)?.push(a), () => {
    let l = q.get(t);
    l && q.set(
      t,
      l.filter((c) => c !== a)
    );
  }), "subscribe"), teardown: /* @__PURE__ */ n(() => {
    q.get(t)?.forEach((a) => {
      he.get(a)?.(), he.delete(a);
    }), q.delete(t), se.delete(t);
  }, "teardown") };
}, "useStore"), Qe = /* @__PURE__ */ n((e) => {
  let t = document.getElementById("storybook-root"), r = /* @__PURE__ */ new Map();
  for (let o of e) {
    let { priority: i = 0 } = o;
    for (let s of o.selectors) {
      let a = [
        ...document.querySelectorAll(
          // Elements matching the selector, excluding storybook elements and their descendants.
          // Necessary to find portaled elements (e.g. children of `body`).
          `:is(${s}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`
        ),
        // Elements matching the selector inside the storybook root, as these were excluded above.
        ...t?.querySelectorAll(s) || []
      ];
      for (let l of a) {
        let c = r.get(l);
        (!c || c.priority <= i) && r.set(l, {
          ...o,
          priority: i,
          selectors: Array.from(new Set((c?.selectors || []).concat(s)))
        });
      }
    }
  }
  return r;
}, "mapElements"), nr = /* @__PURE__ */ n((e) => Array.from(e.entries()).map(([t, { selectors: r, styles: o, hoverStyles: i, focusStyles: s, menu: a }]) => {
  let { top: l, left: c, width: p, height: y } = t.getBoundingClientRect(), { position: u } = getComputedStyle(t);
  return {
    element: t,
    selectors: r,
    styles: o,
    hoverStyles: i,
    focusStyles: s,
    menu: a,
    top: u === "fixed" ? l : l + window.scrollY,
    left: u === "fixed" ? c : c + window.scrollX,
    width: p,
    height: y
  };
}).sort((t, r) => r.width * r.height - t.width * t.height), "mapBoxes"), et = /* @__PURE__ */ n((e, t) => {
  let r = e.getBoundingClientRect(), { x: o, y: i } = t;
  return r?.top && r?.left && o >= r.left && o <= r.left + r.width && i >= r.top && i <= r.top + r.height;
}, "isOverMenu"), tt = /* @__PURE__ */ n((e, t, r) => {
  if (!t || !r)
    return !1;
  let { left: o, top: i, width: s, height: a } = e;
  a < B && (i = i - Math.round((B - a) / 2), a = B), s < B && (o = o - Math.round((B - s) / 2), s = B), t.style.position === "fixed" && (o += window.scrollX, i += window.scrollY);
  let { x: l, y: c } = r;
  return l >= o && l <= o + s && c >= i && c <= i + a;
}, "isTargeted"), ir = /* @__PURE__ */ n((e, t, r = {}) => {
  let { x: o, y: i } = t, { margin: s = 5, topOffset: a = 0, centered: l = !1 } = r, { scrollX: c, scrollY: p, innerHeight: y, innerWidth: u } = window, h = Math.min(
    e.style.position === "fixed" ? i - p : i,
    y - e.clientHeight - s - a + p
  ), T = l ? e.clientWidth / 2 : 0, R = e.style.position === "fixed" ? Math.max(Math.min(o - c, u - T - s), T + s) : Math.max(
    Math.min(o, u - T - s + c),
    T + s + c
  );
  Object.assign(e.style, {
    ...R !== o && { left: `${R}px` },
    ...h !== i && { top: `${h}px` }
  });
}, "keepInViewport"), rt = /* @__PURE__ */ n((e) => {
  window.HTMLElement.prototype.hasOwnProperty("showPopover") && e.showPopover();
}, "showPopover"), sr = /* @__PURE__ */ n((e) => {
  window.HTMLElement.prototype.hasOwnProperty("showPopover") && e.hidePopover();
}, "hidePopover"), ar = /* @__PURE__ */ n((e) => ({
  top: e.top,
  left: e.left,
  width: e.width,
  height: e.height,
  selectors: e.selectors,
  element: {
    attributes: Object.fromEntries(
      Array.from(e.element.attributes).map((t) => [t.name, t.value])
    ),
    localName: e.element.localName,
    tagName: e.element.tagName,
    outerHTML: e.element.outerHTML
  }
}), "getEventDetails");

// src/highlight/useHighlights.ts
var C = "storybook-highlights-menu", lr = "storybook-highlights-root", Vo = "storybook-root", pr = /* @__PURE__ */ n((e) => {
  if (globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED)
    return;
  globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED = !0;
  let { document: t } = globalThis, r = z([]), o = z(/* @__PURE__ */ new Map()), i = z([]), s = z(), a = z(), l = z([]), c = z([]), p = z(), y = z(), u = t.getElementById(lr);
  r.subscribe(() => {
    u || (u = M("div", { id: lr }), t.body.appendChild(u));
  }), r.subscribe((d) => {
    let m = t.getElementById(Vo);
    if (!m)
      return;
    o.set(Qe(d));
    let f = new MutationObserver(() => o.set(Qe(d)));
    return f.observe(m, { subtree: !0, childList: !0 }), () => {
      f.disconnect();
    };
  }), o.subscribe((d) => {
    let m = /* @__PURE__ */ n(() => requestAnimationFrame(() => i.set(nr(d))), "updateBoxes"), f = new ResizeObserver(m);
    f.observe(t.body), Array.from(d.keys()).forEach((g) => f.observe(g));
    let x = Array.from(t.body.querySelectorAll("*")).filter((g) => {
      let { overflow: E, overflowX: I, overflowY: k } = window.getComputedStyle(g);
      return ["auto", "scroll"].some((H) => [E, I, k].includes(H));
    });
    return x.forEach((g) => g.addEventListener("scroll", m)), () => {
      f.disconnect(), x.forEach((g) => g.removeEventListener("scroll", m));
    };
  }), o.subscribe((d) => {
    let m = Array.from(d.keys()).filter(({ style: x }) => x.position === "sticky"), f = /* @__PURE__ */ n(() => requestAnimationFrame(() => {
      i.set(
        (x) => x.map((g) => {
          if (m.includes(g.element)) {
            let { top: E, left: I } = g.element.getBoundingClientRect();
            return { ...g, top: E + window.scrollY, left: I + window.scrollX };
          }
          return g;
        })
      );
    }), "updateBoxes");
    return t.addEventListener("scroll", f), () => t.removeEventListener("scroll", f);
  }), o.subscribe((d) => {
    l.set((m) => m.filter(({ element: f }) => d.has(f)));
  }), l.subscribe((d) => {
    d.length ? (y.set((m) => d.some((f) => f.element === m?.element) ? m : void 0), p.set((m) => d.some((f) => f.element === m?.element) ? m : void 0)) : (y.set(void 0), p.set(void 0), s.set(void 0));
  });
  let h = new Map(/* @__PURE__ */ new Map());
  r.subscribe((d) => {
    d.forEach(({ keyframes: m }) => {
      if (m) {
        let f = h.get(m);
        f || (f = t.createElement("style"), f.setAttribute("data-highlight", "keyframes"), h.set(m, f), t.head.appendChild(f)), f.innerHTML = m;
      }
    }), h.forEach((m, f) => {
      d.some((x) => x.keyframes === f) || (m.remove(), h.delete(f));
    });
  });
  let T = new Map(/* @__PURE__ */ new Map());
  i.subscribe((d) => {
    d.forEach((m) => {
      let f = T.get(m.element);
      if (u && !f) {
        let x = {
          popover: "manual",
          "data-highlight-dimensions": `w${m.width.toFixed(0)}h${m.height.toFixed(0)}`,
          "data-highlight-coordinates": `x${m.left.toFixed(0)}y${m.top.toFixed(0)}`
        };
        f = u.appendChild(
          M("div", x, [M("div")])
        ), T.set(m.element, f);
      }
    }), T.forEach((m, f) => {
      d.some(({ element: x }) => x === f) || (m.remove(), T.delete(f));
    });
  }), i.subscribe((d) => {
    let m = d.filter((x) => x.menu);
    if (!m.length)
      return;
    let f = /* @__PURE__ */ n((x) => {
      requestAnimationFrame(() => {
        let g = t.getElementById(C), E = { x: x.pageX, y: x.pageY };
        if (g && !et(g, E)) {
          let I = m.filter((k) => {
            let H = T.get(k.element);
            return tt(k, H, E);
          });
          s.set(I.length ? E : void 0), l.set(I);
        }
      });
    }, "onClick");
    return t.addEventListener("click", f), () => t.removeEventListener("click", f);
  });
  let R = /* @__PURE__ */ n(() => {
    let d = t.getElementById(C), m = a.get();
    !m || d && et(d, m) || c.set((f) => {
      let x = i.get().filter((k) => {
        let H = T.get(k.element);
        return tt(k, H, m);
      }), g = f.filter((k) => x.includes(k)), E = x.filter((k) => !f.includes(k)), I = f.length - g.length;
      return E.length || I ? [...g, ...E] : f;
    });
  }, "updateHovered");
  a.subscribe(R), i.subscribe(R);
  let P = /* @__PURE__ */ n(() => {
    let d = y.get(), m = d ? [d] : l.get(), f = m.length === 1 ? m[0] : p.get(), x = s.get() !== void 0;
    i.get().forEach((g) => {
      let E = T.get(g.element);
      if (E) {
        let I = f === g, k = x ? f ? I : m.includes(g) : c.get()?.includes(g);
        Object.assign(E.style, {
          animation: "none",
          background: "transparent",
          border: "none",
          boxSizing: "border-box",
          outline: "none",
          outlineOffset: "0px",
          ...g.styles,
          ...k ? g.hoverStyles : {},
          ...I ? g.focusStyles : {},
          position: getComputedStyle(g.element).position === "fixed" ? "fixed" : "absolute",
          zIndex: Ze - 10,
          top: `${g.top}px`,
          left: `${g.left}px`,
          width: `${g.width}px`,
          height: `${g.height}px`,
          margin: 0,
          padding: 0,
          cursor: g.menu && k ? "pointer" : "default",
          pointerEvents: g.menu ? "auto" : "none",
          display: "flex",
          alignItems: "center",
          justifyContent: "center",
          overflow: "visible"
        }), Object.assign(E.children[0].style, {
          width: "100%",
          height: "100%",
          minHeight: `${B}px`,
          minWidth: `${B}px`,
          boxSizing: "content-box",
          padding: E.style.outlineWidth || "0px"
        }), rt(E);
      }
    });
  }, "updateBoxStyles");
  i.subscribe(P), l.subscribe(P), c.subscribe(P), p.subscribe(P), y.subscribe(P);
  let L = /* @__PURE__ */ n(() => {
    if (!u)
      return;
    let d = t.getElementById(C);
    if (d)
      d.innerHTML = "";
    else {
      let g = { id: C, popover: "manual" };
      d = u.appendChild(M("div", g)), u.appendChild(
        M("style", {}, [
          `
            #${C} {
              position: absolute;
              z-index: ${Ze};
              width: 300px;
              padding: 0px;
              margin: 15px 0 0 0;
              transform: translateX(-50%);
              font-family: "Nunito Sans", -apple-system, ".SFNSText-Regular", "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
              font-size: 12px;
              background: white;
              border: none;
              border-radius: 6px;
              box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.05), 0 5px 15px 0 rgba(0, 0, 0, 0.1);
              color: #2E3438;
            }
            #${C} ul {
              list-style: none;
              margin: 0;
              padding: 0;
            }
            #${C} > ul {
              max-height: 300px;
              overflow-y: auto;
              padding: 4px 0;
            }
            #${C} li {
              padding: 0 4px;
              margin: 0;
            }
            #${C} li > :not(ul) {
              display: flex;
              padding: 8px;
              margin: 0;
              align-items: center;
              gap: 8px;
              border-radius: 4px;
            }
            #${C} button {
              width: 100%;
              border: 0;
              background: transparent;
              color: inherit;
              text-align: left;
              font-family: inherit;
              font-size: inherit;
            }
            #${C} button:focus-visible {
              outline-color: #029CFD;
            }
            #${C} button:hover {
              background: rgba(2, 156, 253, 0.07);
              color: #029CFD;
              cursor: pointer;
            }
            #${C} li code {
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
              line-height: 16px;
              font-size: 11px;
            }
            #${C} li svg {
              flex-shrink: 0;
              margin: 1px;
              color: #73828C;
            }
            #${C} li > button:hover svg, #${C} li > button:focus-visible svg {
              color: #029CFD;
            }
            #${C} .element-list li svg {
              display: none;
            }
            #${C} li.selectable svg, #${C} li.selected svg {
              display: block;
            }
            #${C} .menu-list {
              border-top: 1px solid rgba(38, 85, 115, 0.15);
            }
            #${C} .menu-list > li:not(:last-child) {
              padding-bottom: 4px;
              margin-bottom: 4px;
              border-bottom: 1px solid rgba(38, 85, 115, 0.15);
            }
            #${C} .menu-items, #${C} .menu-items li {
              padding: 0;
            }
            #${C} .menu-item {
              display: flex;
            }
            #${C} .menu-item-content {
              display: flex;
              flex-direction: column;
              flex-grow: 1;
            }
          `
        ])
      );
    }
    let m = y.get(), f = m ? [m] : l.get();
    if (f.length && (d.style.position = getComputedStyle(f[0].element).position === "fixed" ? "fixed" : "absolute", d.appendChild(
      M(
        "ul",
        { class: "element-list" },
        f.map((g) => {
          let E = f.length > 1 && !!g.menu?.some(
            (H) => H.some(
              (X) => !X.selectors || X.selectors.some((pe) => g.selectors.includes(pe))
            )
          ), I = E ? {
            class: "selectable",
            onClick: /* @__PURE__ */ n(() => y.set(g), "onClick"),
            onMouseEnter: /* @__PURE__ */ n(() => p.set(g), "onMouseEnter"),
            onMouseLeave: /* @__PURE__ */ n(() => p.set(void 0), "onMouseLeave")
          } : m ? { class: "selected", onClick: /* @__PURE__ */ n(() => y.set(void 0), "onClick") } : {}, k = E || m;
          return M("li", I, [
            M(k ? "button" : "div", k ? { type: "button" } : {}, [
              m ? ae("chevronLeft") : null,
              M("code", {}, [g.element.outerHTML]),
              E ? ae("chevronRight") : null
            ])
          ]);
        })
      )
    )), y.get() || l.get().length === 1) {
      let g = y.get() || l.get()[0], E = g.menu?.filter(
        (I) => I.some(
          (k) => !k.selectors || k.selectors.some((H) => g.selectors.includes(H))
        )
      );
      E?.length && d.appendChild(
        M(
          "ul",
          { class: "menu-list" },
          E.map(
            (I) => M("li", {}, [
              M(
                "ul",
                { class: "menu-items" },
                I.map(
                  ({ id: k, title: H, description: X, iconLeft: pe, iconRight: ut, clickEvent: ft }) => {
                    let we = ft && (() => e.emit(ft, k, ar(g)));
                    return M("li", {}, [
                      M(
                        we ? "button" : "div",
                        we ? { class: "menu-item", type: "button", onClick: we } : { class: "menu-item" },
                        [
                          pe ? ae(pe) : null,
                          M("div", { class: "menu-item-content" }, [
                            M(X ? "strong" : "span", {}, [H]),
                            X && M("span", {}, [X])
                          ]),
                          ut ? ae(ut) : null
                        ]
                      )
                    ]);
                  }
                )
              )
            ])
          )
        )
      );
    }
    let x = s.get();
    x ? (Object.assign(d.style, {
      display: "block",
      left: `${d.style.position === "fixed" ? x.x - window.scrollX : x.x}px`,
      top: `${d.style.position === "fixed" ? x.y - window.scrollY : x.y}px`
    }), rt(d), requestAnimationFrame(() => ir(d, x, { topOffset: 15, centered: !0 }))) : (sr(d), Object.assign(d.style, { display: "none" }));
  }, "renderMenu");
  l.subscribe(L), y.subscribe(L);
  let O = /* @__PURE__ */ n((d) => {
    let m = or(d);
    r.set((f) => {
      let x = m.id ? f.filter((g) => g.id !== m.id) : f;
      return m.selectors?.length ? [...x, m] : x;
    });
  }, "addHighlight"), F = /* @__PURE__ */ n((d) => {
    d && r.set((m) => m.filter((f) => f.id !== d));
  }, "removeHighlight"), A = /* @__PURE__ */ n(() => {
    r.set([]), o.set(/* @__PURE__ */ new Map()), i.set([]), s.set(void 0), a.set(void 0), l.set([]), c.set([]), p.set(void 0), y.set(void 0);
  }, "resetState"), S, v = /* @__PURE__ */ n((d, m) => {
    let f = "scrollIntoView-highlight";
    clearTimeout(S), F(f);
    let x = t.querySelector(d);
    if (!x) {
      console.warn(`Cannot scroll into view: ${d} not found`);
      return;
    }
    x.scrollIntoView({ behavior: "smooth", block: "center", ...m });
    let g = `kf-${Math.random().toString(36).substring(2, 15)}`;
    r.set((E) => [
      ...E,
      {
        id: f,
        priority: 1e3,
        selectors: [d],
        styles: {
          outline: "2px solid #1EA7FD",
          outlineOffset: "-1px",
          animation: `${g} 3s linear forwards`
        },
        keyframes: `@keyframes ${g} {
          0% { outline: 2px solid #1EA7FD; }
          20% { outline: 2px solid #1EA7FD00; }
          40% { outline: 2px solid #1EA7FD; }
          60% { outline: 2px solid #1EA7FD00; }
          80% { outline: 2px solid #1EA7FD; }
          100% { outline: 2px solid #1EA7FD00; }
        }`
      }
    ]), S = setTimeout(() => F(f), 3500);
  }, "scrollIntoView"), w = /* @__PURE__ */ n((d) => {
    requestAnimationFrame(() => a.set({ x: d.pageX, y: d.pageY }));
  }, "onMouseMove");
  t.body.addEventListener("mousemove", w), e.on(Qt, O), e.on(er, F), e.on(tr, A), e.on(rr, v), e.on(Yo, ({ newPhase: d }) => {
    d === "loading" && A();
  });
}, "useHighlights");

// src/highlight/preview.ts
globalThis?.FEATURES?.highlight && cr?.ready && cr.ready().then(pr);
var ot = /* @__PURE__ */ n(() => Ko({}), "default");

// src/measure/preview.ts
import { definePreviewAddon as mn } from "storybook/internal/csf";

// src/measure/constants.ts
var xe = "storybook/measure-addon", Ll = `${xe}/tool`, dr = "measureEnabled", Dl = {
  RESULT: `${xe}/result`,
  REQUEST: `${xe}/request`,
  CLEAR: `${xe}/clear`
};

// src/measure/withMeasure.ts
import { useEffect as Er } from "storybook/preview-api";

// src/measure/box-model/canvas.ts
import { global as be } from "@storybook/global";
function mr() {
  let e = be.document.documentElement, t = Math.max(e.scrollHeight, e.offsetHeight);
  return { width: Math.max(e.scrollWidth, e.offsetWidth), height: t };
}
n(mr, "getDocumentWidthAndHeight");
function qo() {
  let e = be.document.createElement("canvas");
  e.id = "storybook-addon-measure";
  let t = e.getContext("2d");
  ye(t != null);
  let { width: r, height: o } = mr();
  return nt(e, t, { width: r, height: o }), e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none", be.document.body.appendChild(e), { canvas: e, context: t, width: r, height: o };
}
n(qo, "createCanvas");
function nt(e, t, { width: r, height: o }) {
  e.style.width = `${r}px`, e.style.height = `${o}px`;
  let i = be.window.devicePixelRatio;
  e.width = Math.floor(r * i), e.height = Math.floor(o * i), t.scale(i, i);
}
n(nt, "setCanvasWidthAndHeight");
var $ = {};
function ur() {
  $.canvas || ($ = qo());
}
n(ur, "init");
function fr() {
  $.context && $.context.clearRect(0, 0, $.width ?? 0, $.height ?? 0);
}
n(fr, "clear");
function yr(e) {
  fr(), e($.context);
}
n(yr, "draw");
function gr() {
  ye($.canvas, "Canvas should exist in the state."), ye($.context, "Context should exist in the state."), nt($.canvas, $.context, { width: 0, height: 0 });
  let { width: e, height: t } = mr();
  nt($.canvas, $.context, { width: e, height: t }), $.width = e, $.height = t;
}
n(gr, "rescale");
function hr() {
  $.canvas && (fr(), $.canvas.parentNode?.removeChild($.canvas), $ = {});
}
n(hr, "destroy");

// src/measure/box-model/visualizer.ts
import { global as j } from "@storybook/global";

// src/measure/box-model/labels.ts
var J = {
  margin: "#f6b26b",
  border: "#ffe599",
  padding: "#93c47d",
  content: "#6fa8dc",
  text: "#232020"
}, G = 6;
function xr(e, { x: t, y: r, w: o, h: i, r: s }) {
  t = t - o / 2, r = r - i / 2, o < 2 * s && (s = o / 2), i < 2 * s && (s = i / 2), e.beginPath(), e.moveTo(t + s, r), e.arcTo(t + o, r, t + o, r + i, s), e.arcTo(t + o, r + i, t, r + i, s), e.arcTo(t, r + i, t, r, s), e.arcTo(t, r, t + o, r, s), e.closePath();
}
n(xr, "roundedRect");
function Xo(e, { padding: t, border: r, width: o, height: i, top: s, left: a }) {
  let l = o - r.left - r.right - t.left - t.right, c = i - t.top - t.bottom - r.top - r.bottom, p = a + r.left + t.left, y = s + r.top + t.top;
  return e === "top" ? p += l / 2 : e === "right" ? (p += l, y += c / 2) : e === "bottom" ? (p += l / 2, y += c) : e === "left" ? y += c / 2 : e === "center" && (p += l / 2, y += c / 2), { x: p, y };
}
n(Xo, "positionCoordinate");
function Zo(e, t, { margin: r, border: o, padding: i }, s, a) {
  let l = /* @__PURE__ */ n((h) => 0, "shift"), c = 0, p = 0, y = a ? 1 : 0.5, u = a ? s * 2 : 0;
  return e === "padding" ? l = /* @__PURE__ */ n((h) => i[h] * y + u, "shift") : e === "border" ? l = /* @__PURE__ */ n((h) => i[h] + o[h] * y + u, "shift") : e === "margin" && (l = /* @__PURE__ */ n((h) => i[h] + o[h] + r[h] * y + u, "shift")), t === "top" ? p = -l("top") : t === "right" ? c = l("right") : t === "bottom" ? p = l("bottom") : t === "left" && (c = -l("left")), { offsetX: c, offsetY: p };
}
n(Zo, "offset");
function Jo(e, t) {
  return Math.abs(e.x - t.x) < Math.abs(e.w + t.w) / 2 && Math.abs(e.y - t.y) < Math.abs(e.h + t.h) / 2;
}
n(Jo, "collide");
function Qo(e, t, r) {
  return e === "top" ? t.y = r.y - r.h - G : e === "right" ? t.x = r.x + r.w / 2 + G + t.w / 2 : e === "bottom" ? t.y = r.y + r.h + G : e === "left" && (t.x = r.x - r.w / 2 - G - t.w / 2), { x: t.x, y: t.y };
}
n(Qo, "overlapAdjustment");
function br(e, t, { x: r, y: o, w: i, h: s }, a) {
  return xr(e, { x: r, y: o, w: i, h: s, r: 3 }), e.fillStyle = `${J[t]}dd`, e.fill(), e.strokeStyle = J[t], e.stroke(), e.fillStyle = J.text, e.fillText(a, r, o), xr(e, { x: r, y: o, w: i, h: s, r: 3 }), e.fillStyle = `${J[t]}dd`, e.fill(), e.strokeStyle = J[t], e.stroke(), e.fillStyle = J.text, e.fillText(a, r, o), { x: r, y: o, w: i, h: s };
}
n(br, "textWithRect");
function Tr(e, t) {
  e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
  let r = e.measureText(t), o = r.actualBoundingBoxAscent + r.actualBoundingBoxDescent, i = r.width + G * 2, s = o + G * 2;
  return { w: i, h: s };
}
n(Tr, "configureText");
function en(e, t, { type: r, position: o = "center", text: i }, s, a = !1) {
  let { x: l, y: c } = Xo(o, t), { offsetX: p, offsetY: y } = Zo(r, o, t, G + 1, a);
  l += p, c += y;
  let { w: u, h } = Tr(e, i);
  if (s && Jo({ x: l, y: c, w: u, h }, s)) {
    let T = Qo(o, { x: l, y: c, w: u, h }, s);
    l = T.x, c = T.y;
  }
  return br(e, r, { x: l, y: c, w: u, h }, i);
}
n(en, "drawLabel");
function tn(e, { w: t, h: r }) {
  let o = t * 0.5 + G, i = r * 0.5 + G;
  return {
    offsetX: (e.x === "left" ? -1 : 1) * o,
    offsetY: (e.y === "top" ? -1 : 1) * i
  };
}
n(tn, "floatingOffset");
function rn(e, t, { type: r, text: o }) {
  let { floatingAlignment: i, extremities: s } = t, a = s[i.x], l = s[i.y], { w: c, h: p } = Tr(e, o), { offsetX: y, offsetY: u } = tn(i, {
    w: c,
    h: p
  });
  return a += y, l += u, br(e, r, { x: a, y: l, w: c, h: p }, o);
}
n(rn, "drawFloatingLabel");
function le(e, t, r, o) {
  let i = [];
  r.forEach((s, a) => {
    let l = o && s.position === "center" ? rn(e, t, s) : en(e, t, s, i[a - 1], o);
    i[a] = l;
  });
}
n(le, "drawStack");
function Sr(e, t, r, o) {
  let i = r.reduce((s, a) => (Object.prototype.hasOwnProperty.call(s, a.position) || (s[a.position] = []), s[a.position]?.push(a), s), {});
  i.top && le(e, t, i.top, o), i.right && le(e, t, i.right, o), i.bottom && le(e, t, i.bottom, o), i.left && le(e, t, i.left, o), i.center && le(e, t, i.center, o);
}
n(Sr, "labelStacks");

// src/measure/box-model/visualizer.ts
var Te = {
  margin: "#f6b26ba8",
  border: "#ffe599a8",
  padding: "#93c47d8c",
  content: "#6fa8dca8"
}, Ar = 30;
function _(e) {
  return parseInt(e.replace("px", ""), 10);
}
n(_, "pxToNumber");
function Q(e) {
  return Number.isInteger(e) ? e : e.toFixed(2);
}
n(Q, "round");
function it(e) {
  return e.filter((t) => t.text !== 0 && t.text !== "0");
}
n(it, "filterZeroValues");
function on(e) {
  let t = {
    top: j.window.scrollY,
    bottom: j.window.scrollY + j.window.innerHeight,
    left: j.window.scrollX,
    right: j.window.scrollX + j.window.innerWidth
  }, r = {
    top: Math.abs(t.top - e.top),
    bottom: Math.abs(t.bottom - e.bottom),
    left: Math.abs(t.left - e.left),
    right: Math.abs(t.right - e.right)
  };
  return {
    x: r.left > r.right ? "left" : "right",
    y: r.top > r.bottom ? "top" : "bottom"
  };
}
n(on, "floatingAlignment");
function nn(e) {
  let t = j.getComputedStyle(e), { top: r, left: o, right: i, bottom: s, width: a, height: l } = e.getBoundingClientRect(), {
    marginTop: c,
    marginBottom: p,
    marginLeft: y,
    marginRight: u,
    paddingTop: h,
    paddingBottom: T,
    paddingLeft: R,
    paddingRight: P,
    borderBottomWidth: L,
    borderTopWidth: O,
    borderLeftWidth: F,
    borderRightWidth: A
  } = t;
  r = r + j.window.scrollY, o = o + j.window.scrollX, s = s + j.window.scrollY, i = i + j.window.scrollX;
  let S = {
    top: _(c),
    bottom: _(p),
    left: _(y),
    right: _(u)
  }, v = {
    top: _(h),
    bottom: _(T),
    left: _(R),
    right: _(P)
  }, w = {
    top: _(O),
    bottom: _(L),
    left: _(F),
    right: _(A)
  }, d = {
    top: r - S.top,
    bottom: s + S.bottom,
    left: o - S.left,
    right: i + S.right
  };
  return {
    margin: S,
    padding: v,
    border: w,
    top: r,
    left: o,
    bottom: s,
    right: i,
    width: a,
    height: l,
    extremities: d,
    floatingAlignment: on(d)
  };
}
n(nn, "measureElement");
function sn(e, { margin: t, width: r, height: o, top: i, left: s, bottom: a, right: l }) {
  let c = o + t.bottom + t.top;
  e.fillStyle = Te.margin, e.fillRect(s, i - t.top, r, t.top), e.fillRect(l, i - t.top, t.right, c), e.fillRect(s, a, r, t.bottom), e.fillRect(s - t.left, i - t.top, t.left, c);
  let p = [
    {
      type: "margin",
      text: Q(t.top),
      position: "top"
    },
    {
      type: "margin",
      text: Q(t.right),
      position: "right"
    },
    {
      type: "margin",
      text: Q(t.bottom),
      position: "bottom"
    },
    {
      type: "margin",
      text: Q(t.left),
      position: "left"
    }
  ];
  return it(p);
}
n(sn, "drawMargin");
function an(e, { padding: t, border: r, width: o, height: i, top: s, left: a, bottom: l, right: c }) {
  let p = o - r.left - r.right, y = i - t.top - t.bottom - r.top - r.bottom;
  e.fillStyle = Te.padding, e.fillRect(a + r.left, s + r.top, p, t.top), e.fillRect(
    c - t.right - r.right,
    s + t.top + r.top,
    t.right,
    y
  ), e.fillRect(
    a + r.left,
    l - t.bottom - r.bottom,
    p,
    t.bottom
  ), e.fillRect(a + r.left, s + t.top + r.top, t.left, y);
  let u = [
    {
      type: "padding",
      text: t.top,
      position: "top"
    },
    {
      type: "padding",
      text: t.right,
      position: "right"
    },
    {
      type: "padding",
      text: t.bottom,
      position: "bottom"
    },
    {
      type: "padding",
      text: t.left,
      position: "left"
    }
  ];
  return it(u);
}
n(an, "drawPadding");
function ln(e, { border: t, width: r, height: o, top: i, left: s, bottom: a, right: l }) {
  let c = o - t.top - t.bottom;
  e.fillStyle = Te.border, e.fillRect(s, i, r, t.top), e.fillRect(s, a - t.bottom, r, t.bottom), e.fillRect(s, i + t.top, t.left, c), e.fillRect(l - t.right, i + t.top, t.right, c);
  let p = [
    {
      type: "border",
      text: t.top,
      position: "top"
    },
    {
      type: "border",
      text: t.right,
      position: "right"
    },
    {
      type: "border",
      text: t.bottom,
      position: "bottom"
    },
    {
      type: "border",
      text: t.left,
      position: "left"
    }
  ];
  return it(p);
}
n(ln, "drawBorder");
function pn(e, { padding: t, border: r, width: o, height: i, top: s, left: a }) {
  let l = o - r.left - r.right - t.left - t.right, c = i - t.top - t.bottom - r.top - r.bottom;
  return e.fillStyle = Te.content, e.fillRect(
    a + r.left + t.left,
    s + r.top + t.top,
    l,
    c
  ), [
    {
      type: "content",
      position: "center",
      text: `${Q(l)} x ${Q(c)}`
    }
  ];
}
n(pn, "drawContent");
function cn(e) {
  return (t) => {
    if (e && t) {
      let r = nn(e), o = sn(t, r), i = an(t, r), s = ln(t, r), a = pn(t, r), l = r.width <= Ar * 3 || r.height <= Ar;
      Sr(
        t,
        r,
        [...a, ...i, ...s, ...o],
        l
      );
    }
  };
}
n(cn, "drawBoxModel");
function Rr(e) {
  yr(cn(e));
}
n(Rr, "drawSelectedElement");

// src/measure/util.ts
import { global as dn } from "@storybook/global";
var wr = /* @__PURE__ */ n((e, t) => {
  let r = dn.document.elementFromPoint(e, t), o = /* @__PURE__ */ n((s) => {
    if (s && s.shadowRoot) {
      let a = s.shadowRoot.elementFromPoint(e, t);
      return s.isEqualNode(a) ? s : a.shadowRoot ? o(a) : a;
    }
    return s;
  }, "crawlShadows");
  return o(r) || r;
}, "deepElementFromPoint");

// src/measure/withMeasure.ts
var Cr, Se = { x: 0, y: 0 };
function vr(e, t) {
  Cr = wr(e, t), Rr(Cr);
}
n(vr, "findAndDrawElement");
var kr = /* @__PURE__ */ n((e, t) => {
  let { measureEnabled: r } = t.globals || {};
  return Er(() => {
    if (typeof globalThis.document > "u")
      return;
    let o = /* @__PURE__ */ n((i) => {
      window.requestAnimationFrame(() => {
        i.stopPropagation(), Se.x = i.clientX, Se.y = i.clientY;
      });
    }, "onPointerMove");
    return globalThis.document.addEventListener("pointermove", o), () => {
      globalThis.document.removeEventListener("pointermove", o);
    };
  }, []), Er(() => {
    let o = /* @__PURE__ */ n((s) => {
      window.requestAnimationFrame(() => {
        s.stopPropagation(), vr(s.clientX, s.clientY);
      });
    }, "onPointerOver"), i = /* @__PURE__ */ n(() => {
      window.requestAnimationFrame(() => {
        gr();
      });
    }, "onResize");
    return t.viewMode === "story" && r && (globalThis.document.addEventListener("pointerover", o), ur(), globalThis.window.addEventListener("resize", i), vr(Se.x, Se.y)), () => {
      globalThis.window.removeEventListener("resize", i), hr();
    };
  }, [r, t.viewMode]), e();
}, "withMeasure");

// src/measure/preview.ts
var un = globalThis.FEATURES?.measure ? [kr] : [], fn = {
  [dr]: !1
}, st = /* @__PURE__ */ n(() => mn({
  decorators: un,
  initialGlobals: fn
}), "default");

// src/outline/preview.ts
import { definePreviewAddon as xn } from "storybook/internal/csf";

// src/outline/constants.ts
var Ae = "outline";

// src/outline/withOutline.ts
import { useEffect as gn, useMemo as hn } from "storybook/preview-api";

// src/outline/helpers.ts
import { global as Re } from "@storybook/global";
var at = /* @__PURE__ */ n((e) => {
  (Array.isArray(e) ? e : [e]).forEach(yn);
}, "clearStyles"), yn = /* @__PURE__ */ n((e) => {
  let t = typeof e == "string" ? e : e.join(""), r = Re.document.getElementById(t);
  r && r.parentElement && r.parentElement.removeChild(r);
}, "clearStyle"), Pr = /* @__PURE__ */ n((e, t) => {
  let r = Re.document.getElementById(e);
  if (r)
    r.innerHTML !== t && (r.innerHTML = t);
  else {
    let o = Re.document.createElement("style");
    o.setAttribute("id", e), o.innerHTML = t, Re.document.head.appendChild(o);
  }
}, "addOutlineStyles");

// src/outline/outlineCSS.ts
function lt(e) {
  return W`
    ${e} body {
      outline: 1px solid #2980b9 !important;
    }

    ${e} article {
      outline: 1px solid #3498db !important;
    }

    ${e} nav {
      outline: 1px solid #0088c3 !important;
    }

    ${e} aside {
      outline: 1px solid #33a0ce !important;
    }

    ${e} section {
      outline: 1px solid #66b8da !important;
    }

    ${e} header {
      outline: 1px solid #99cfe7 !important;
    }

    ${e} footer {
      outline: 1px solid #cce7f3 !important;
    }

    ${e} h1 {
      outline: 1px solid #162544 !important;
    }

    ${e} h2 {
      outline: 1px solid #314e6e !important;
    }

    ${e} h3 {
      outline: 1px solid #3e5e85 !important;
    }

    ${e} h4 {
      outline: 1px solid #449baf !important;
    }

    ${e} h5 {
      outline: 1px solid #c7d1cb !important;
    }

    ${e} h6 {
      outline: 1px solid #4371d0 !important;
    }

    ${e} main {
      outline: 1px solid #2f4f90 !important;
    }

    ${e} address {
      outline: 1px solid #1a2c51 !important;
    }

    ${e} div {
      outline: 1px solid #036cdb !important;
    }

    ${e} p {
      outline: 1px solid #ac050b !important;
    }

    ${e} hr {
      outline: 1px solid #ff063f !important;
    }

    ${e} pre {
      outline: 1px solid #850440 !important;
    }

    ${e} blockquote {
      outline: 1px solid #f1b8e7 !important;
    }

    ${e} ol {
      outline: 1px solid #ff050c !important;
    }

    ${e} ul {
      outline: 1px solid #d90416 !important;
    }

    ${e} li {
      outline: 1px solid #d90416 !important;
    }

    ${e} dl {
      outline: 1px solid #fd3427 !important;
    }

    ${e} dt {
      outline: 1px solid #ff0043 !important;
    }

    ${e} dd {
      outline: 1px solid #e80174 !important;
    }

    ${e} figure {
      outline: 1px solid #ff00bb !important;
    }

    ${e} figcaption {
      outline: 1px solid #bf0032 !important;
    }

    ${e} table {
      outline: 1px solid #00cc99 !important;
    }

    ${e} caption {
      outline: 1px solid #37ffc4 !important;
    }

    ${e} thead {
      outline: 1px solid #98daca !important;
    }

    ${e} tbody {
      outline: 1px solid #64a7a0 !important;
    }

    ${e} tfoot {
      outline: 1px solid #22746b !important;
    }

    ${e} tr {
      outline: 1px solid #86c0b2 !important;
    }

    ${e} th {
      outline: 1px solid #a1e7d6 !important;
    }

    ${e} td {
      outline: 1px solid #3f5a54 !important;
    }

    ${e} col {
      outline: 1px solid #6c9a8f !important;
    }

    ${e} colgroup {
      outline: 1px solid #6c9a9d !important;
    }

    ${e} button {
      outline: 1px solid #da8301 !important;
    }

    ${e} datalist {
      outline: 1px solid #c06000 !important;
    }

    ${e} fieldset {
      outline: 1px solid #d95100 !important;
    }

    ${e} form {
      outline: 1px solid #d23600 !important;
    }

    ${e} input {
      outline: 1px solid #fca600 !important;
    }

    ${e} keygen {
      outline: 1px solid #b31e00 !important;
    }

    ${e} label {
      outline: 1px solid #ee8900 !important;
    }

    ${e} legend {
      outline: 1px solid #de6d00 !important;
    }

    ${e} meter {
      outline: 1px solid #e8630c !important;
    }

    ${e} optgroup {
      outline: 1px solid #b33600 !important;
    }

    ${e} option {
      outline: 1px solid #ff8a00 !important;
    }

    ${e} output {
      outline: 1px solid #ff9619 !important;
    }

    ${e} progress {
      outline: 1px solid #e57c00 !important;
    }

    ${e} select {
      outline: 1px solid #e26e0f !important;
    }

    ${e} textarea {
      outline: 1px solid #cc5400 !important;
    }

    ${e} details {
      outline: 1px solid #33848f !important;
    }

    ${e} summary {
      outline: 1px solid #60a1a6 !important;
    }

    ${e} command {
      outline: 1px solid #438da1 !important;
    }

    ${e} menu {
      outline: 1px solid #449da6 !important;
    }

    ${e} del {
      outline: 1px solid #bf0000 !important;
    }

    ${e} ins {
      outline: 1px solid #400000 !important;
    }

    ${e} img {
      outline: 1px solid #22746b !important;
    }

    ${e} iframe {
      outline: 1px solid #64a7a0 !important;
    }

    ${e} embed {
      outline: 1px solid #98daca !important;
    }

    ${e} object {
      outline: 1px solid #00cc99 !important;
    }

    ${e} param {
      outline: 1px solid #37ffc4 !important;
    }

    ${e} video {
      outline: 1px solid #6ee866 !important;
    }

    ${e} audio {
      outline: 1px solid #027353 !important;
    }

    ${e} source {
      outline: 1px solid #012426 !important;
    }

    ${e} canvas {
      outline: 1px solid #a2f570 !important;
    }

    ${e} track {
      outline: 1px solid #59a600 !important;
    }

    ${e} map {
      outline: 1px solid #7be500 !important;
    }

    ${e} area {
      outline: 1px solid #305900 !important;
    }

    ${e} a {
      outline: 1px solid #ff62ab !important;
    }

    ${e} em {
      outline: 1px solid #800b41 !important;
    }

    ${e} strong {
      outline: 1px solid #ff1583 !important;
    }

    ${e} i {
      outline: 1px solid #803156 !important;
    }

    ${e} b {
      outline: 1px solid #cc1169 !important;
    }

    ${e} u {
      outline: 1px solid #ff0430 !important;
    }

    ${e} s {
      outline: 1px solid #f805e3 !important;
    }

    ${e} small {
      outline: 1px solid #d107b2 !important;
    }

    ${e} abbr {
      outline: 1px solid #4a0263 !important;
    }

    ${e} q {
      outline: 1px solid #240018 !important;
    }

    ${e} cite {
      outline: 1px solid #64003c !important;
    }

    ${e} dfn {
      outline: 1px solid #b4005a !important;
    }

    ${e} sub {
      outline: 1px solid #dba0c8 !important;
    }

    ${e} sup {
      outline: 1px solid #cc0256 !important;
    }

    ${e} time {
      outline: 1px solid #d6606d !important;
    }

    ${e} code {
      outline: 1px solid #e04251 !important;
    }

    ${e} kbd {
      outline: 1px solid #5e001f !important;
    }

    ${e} samp {
      outline: 1px solid #9c0033 !important;
    }

    ${e} var {
      outline: 1px solid #d90047 !important;
    }

    ${e} mark {
      outline: 1px solid #ff0053 !important;
    }

    ${e} bdi {
      outline: 1px solid #bf3668 !important;
    }

    ${e} bdo {
      outline: 1px solid #6f1400 !important;
    }

    ${e} ruby {
      outline: 1px solid #ff7b93 !important;
    }

    ${e} rt {
      outline: 1px solid #ff2f54 !important;
    }

    ${e} rp {
      outline: 1px solid #803e49 !important;
    }

    ${e} span {
      outline: 1px solid #cc2643 !important;
    }

    ${e} br {
      outline: 1px solid #db687d !important;
    }

    ${e} wbr {
      outline: 1px solid #db175b !important;
    }`;
}
n(lt, "outlineCSS");

// src/outline/withOutline.ts
var Or = /* @__PURE__ */ n((e, t) => {
  let r = t.globals || {}, o = [!0, "true"].includes(r[Ae]), i = t.viewMode === "docs", s = hn(() => lt(i ? '[data-story-block="true"]' : ".sb-show-main"), [t]);
  return gn(() => {
    let a = i ? `addon-outline-docs-${t.id}` : "addon-outline";
    return o ? Pr(a, s) : at(a), () => {
      at(a);
    };
  }, [o, s, t]), e();
}, "withOutline");

// src/outline/preview.ts
var bn = globalThis.FEATURES?.outline ? [Or] : [], Tn = {
  [Ae]: !1
}, pt = /* @__PURE__ */ n(() => xn({ decorators: bn, initialGlobals: Tn }), "default");

// src/test/preview.ts
import { definePreviewAddon as Sn } from "storybook/internal/csf";
import { instrument as An } from "storybook/internal/instrumenter";
import {
  clearAllMocks as Rn,
  fn as wn,
  isMockFunction as En,
  resetAllMocks as Cn,
  restoreAllMocks as vn,
  uninstrumentedUserEvent as kn,
  within as Pn
} from "storybook/test";
var On = /* @__PURE__ */ n(({ parameters: e }) => {
  e?.test?.mockReset === !0 ? Cn() : e?.test?.clearMocks === !0 ? Rn() : e?.test?.restoreMocks !== !1 && vn();
}, "resetAllMocksLoader"), ct = /* @__PURE__ */ n((e, t = 0, r) => {
  if (t > 5 || e == null)
    return e;
  if (En(e))
    return r && e.mockName(r), e;
  if (typeof e == "function" && "isAction" in e && e.isAction && !("implicit" in e && e.implicit)) {
    let o = wn(e);
    return r && o.mockName(r), o;
  }
  if (Array.isArray(e)) {
    t++;
    for (let o = 0; o < e.length; o++)
      Object.getOwnPropertyDescriptor(e, o)?.writable && (e[o] = ct(e[o], t));
    return e;
  }
  if (typeof e == "object" && e.constructor === Object) {
    t++;
    for (let [o, i] of Object.entries(e))
      Object.getOwnPropertyDescriptor(e, o)?.writable && (e[o] = ct(i, t, o));
    return e;
  }
  return e;
}, "traverseArgs"), Mn = /* @__PURE__ */ n(({ initialArgs: e }) => {
  ct(e);
}, "nameSpiesAndWrapActionsInSpies"), Mr = !1, $n = /* @__PURE__ */ n(async (e) => {
  globalThis.HTMLElement && e.canvasElement instanceof globalThis.HTMLElement && (e.canvas = Pn(e.canvasElement));
  let t = globalThis.window?.navigator?.clipboard;
  if (t) {
    e.userEvent = An(
      { userEvent: kn.setup() },
      { intercept: !0 }
    ).userEvent, Object.defineProperty(globalThis.window.navigator, "clipboard", {
      get: /* @__PURE__ */ n(() => t, "get"),
      configurable: !0
    });
    let r = HTMLElement.prototype.focus;
    Mr || Object.defineProperties(HTMLElement.prototype, {
      focus: {
        configurable: !0,
        set: /* @__PURE__ */ n((o) => {
          r = o, Mr = !0;
        }, "set"),
        get: /* @__PURE__ */ n(() => r, "get")
      }
    });
  }
}, "enhanceContext"), dt = /* @__PURE__ */ n(() => Sn({
  loaders: [On, Mn, $n]
}), "default");

// src/viewport/preview.ts
import { definePreviewAddon as Fn } from "storybook/internal/csf";

// src/viewport/constants.ts
var $r = "storybook/viewport", Fr = "viewport", $p = `${$r}/panel`, Fp = `${$r}/tool`;

// src/viewport/preview.ts
var In = {
  [Fr]: { value: void 0, isRotated: !1 }
}, mt = /* @__PURE__ */ n(() => Fn({
  initialGlobals: In
}), "default");

// src/csf/core-annotations.ts
function Ir() {
  return [
    // @ts-expect-error CJS fallback
    (st.default ?? st)(),
    // @ts-expect-error CJS fallback
    (qe.default ?? qe)(),
    // @ts-expect-error CJS fallback
    (ot.default ?? ot)(),
    // @ts-expect-error CJS fallback
    (pt.default ?? pt)(),
    // @ts-expect-error CJS fallback
    (mt.default ?? mt)(),
    // @ts-expect-error CJS fallback
    (Ve.default ?? Ve)(),
    // @ts-expect-error CJS fallback
    (Xe.default ?? Xe)(),
    // @ts-expect-error CJS fallback
    (dt.default ?? dt)()
  ];
}
n(Ir, "getCoreAnnotations");

// src/csf/csf-factories.ts
function Jp(e) {
  let t, r = {
    _tag: "Preview",
    input: e,
    get composed() {
      if (t)
        return t;
      let { addons: o, ...i } = e;
      return t = te(
        ne([...Ir(), ...o ?? [], i])
      ), t;
    },
    meta(o) {
      return Dn(o, this);
    }
  };
  return globalThis.globalProjectAnnotations = r.composed, r;
}
n(Jp, "definePreview");
function Qp(e) {
  return e;
}
n(Qp, "definePreviewAddon");
function ec(e) {
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Preview";
}
n(ec, "isPreview");
function tc(e) {
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Meta";
}
n(tc, "isMeta");
function Dn(e, t) {
  return {
    _tag: "Meta",
    input: e,
    preview: t,
    get composed() {
      throw new Error("Not implemented");
    },
    // @ts-expect-error hard
    story(r = {}) {
      return Lr(typeof r == "function" ? { render: r } : r, this);
    }
  };
}
n(Dn, "defineMeta");
function rc(e) {
  return e != null && typeof e == "object" && "_tag" in e && e?._tag === "Story";
}
n(rc, "isStory");
function Lr(e, t) {
  let r, o = /* @__PURE__ */ n(() => (r || (r = ze(
    e,
    t.input,
    void 0,
    t.preview.composed
  )), r), "compose");
  return {
    _tag: "Story",
    input: e,
    meta: t,
    __compose: o,
    get composed() {
      let i = o(), { args: s, argTypes: a, parameters: l, id: c, tags: p, globals: y, storyName: u } = i;
      return { args: s, argTypes: a, parameters: l, id: c, tags: p, name: u, globals: y };
    },
    get play() {
      return e.play ?? t.input?.play ?? (async () => {
      });
    },
    get run() {
      return o().run ?? (async () => {
      });
    },
    extend(i) {
      return Lr(
        {
          ...this.input,
          ...i,
          args: { ...this.input.args, ...i.args },
          argTypes: D(this.input.argTypes, i.argTypes),
          afterEach: [
            ...b(this.input?.afterEach ?? []),
            ...b(i.afterEach ?? [])
          ],
          beforeEach: [
            ...b(this.input?.beforeEach ?? []),
            ...b(i.beforeEach ?? [])
          ],
          decorators: [
            ...b(this.input?.decorators ?? []),
            ...b(i.decorators ?? [])
          ],
          globals: { ...this.input.globals, ...i.globals },
          loaders: [
            ...b(this.input?.loaders ?? []),
            ...b(i.loaders ?? [])
          ],
          parameters: D(this.input.parameters, i.parameters),
          tags: Ln(...this.input.tags ?? [], ...i.tags ?? [])
        },
        this.meta
      );
    }
  };
}
n(Lr, "defineStory");

// src/csf/index.ts
var _n = /* @__PURE__ */ n((e) => e.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "-").replace(/-+/g, "-").replace(/^-+/, "").replace(/-+$/, ""), "sanitize"), Dr = /* @__PURE__ */ n((e, t) => {
  let r = _n(e);
  if (r === "")
    throw new Error(`Invalid ${t} '${e}', must include alphanumeric characters`);
  return r;
}, "sanitizeSafe"), sc = /* @__PURE__ */ n((e, t) => `${Dr(e, "kind")}${t ? `--${Dr(t, "name")}` : ""}`, "toId"), ac = /* @__PURE__ */ n((e) => gt(e), "storyNameFromExport");
function _r(e, t) {
  return Array.isArray(t) ? t.includes(e) : e.match(t);
}
n(_r, "matches");
function lc(e, { includeStories: t, excludeStories: r }) {
  return (
    // https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
    e !== "__esModule" && (!t || _r(e, t)) && (!r || !_r(e, r))
  );
}
n(lc, "isExportStory");
var pc = /* @__PURE__ */ n((e, { rootSeparator: t, groupSeparator: r }) => {
  let [o, i] = e.split(t, 2), s = (i || e).split(r).filter((a) => !!a);
  return {
    root: i ? o : null,
    groups: s
  };
}, "parseKind"), cc = /* @__PURE__ */ n((...e) => {
  let t = e.reduce((r, o) => (o.startsWith("!") ? r.delete(o.slice(1)) : r.add(o), r), /* @__PURE__ */ new Set());
  return Array.from(t);
}, "combineTags");
export {
  cc as combineTags,
  Jp as definePreview,
  Qp as definePreviewAddon,
  Ir as getCoreAnnotations,
  Vr as includeConditionalArg,
  lc as isExportStory,
  tc as isMeta,
  ec as isPreview,
  rc as isStory,
  pc as parseKind,
  _n as sanitize,
  ac as storyNameFromExport,
  sc as toId
};
