"use strict";
var l = Object.defineProperty;
var F = Object.getOwnPropertyDescriptor;
var C = Object.getOwnPropertyNames;
var W = Object.prototype.hasOwnProperty;
var i = (e, t) => l(e, "name", { value: t, configurable: !0 });
var y = (e, t) => {
  for (var o in t)
    l(e, o, { get: t[o], enumerable: !0 });
}, M = (e, t, o, r) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (let n of C(t))
      !W.call(e, n) && n !== o && l(e, n, { get: () => t[n], enumerable: !(r = F(t, n)) || r.enumerable });
  return e;
};
var L = (e) => M(l({}, "__esModule", { value: !0 }), e);

// src/actions/preview.ts
var z = {};
y(z, {
  default: () => K
});
module.exports = L(z);
var j = require("storybook/preview-api");

// src/actions/addArgs.ts
var A = {};
y(A, {
  argsEnhancers: () => Y
});

// src/actions/runtime/action.ts
var O = require("storybook/internal/preview-errors"), u = require("@storybook/global"), w = require("storybook/preview-api");

// src/actions/constants.ts
var f = "storybook/actions", q = `${f}/panel`, E = `${f}/action-event`, G = `${f}/action-clear`;

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

// src/actions/runtime/action.ts
var v = /* @__PURE__ */ i((e, t) => {
  let o = Object.getPrototypeOf(e);
  return !o || t(o) ? o : v(o, t);
}, "findProto"), N = /* @__PURE__ */ i((e) => !!(typeof e == "object" && e && v(e, (t) => /^Synthetic(?:Base)?Event$/.test(t.constructor.name)) &&
typeof e.persist == "function"), "isReactSyntheticEvent"), V = /* @__PURE__ */ i((e) => {
  if (N(e)) {
    let t = Object.create(
      e.constructor.prototype,
      Object.getOwnPropertyDescriptors(e)
    );
    t.persist();
    let o = Object.getOwnPropertyDescriptor(t, "view"), r = o?.value;
    return typeof r == "object" && r?.constructor.name === "Window" && Object.defineProperty(t, "view", {
      ...o,
      value: Object.create(r.constructor.prototype)
    }), t;
  }
  return e;
}, "serializeArg");
function g(e, t = {}) {
  let o = {
    ...R,
    ...t
  }, r = /* @__PURE__ */ i(function(...s) {
    if (t.implicit) {
      let x = ("__STORYBOOK_PREVIEW__" in u.global ? u.global.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
        (d) => d.phase === "playing" || d.phase === "rendering"
      );
      if (x) {
        let d = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, b = new O.ImplicitActionsDuringRendering({
          phase: x.phase,
          name: e,
          deprecated: d
        });
        if (d)
          console.warn(b);
        else
          throw b;
      }
    }
    let a = w.addons.getChannel(), c = Date.now().toString(36) + Math.random().toString(36).substring(2), p = 5, m = s.map(V), P = s.length >
    1 ? m : m[0], S = {
      id: c,
      count: 0,
      data: { name: e, args: P },
      options: {
        ...o,
        maxDepth: p + (o.depth || 3)
      }
    };
    a.emit(E, S);
  }, "actionHandler");
  return r.isAction = !0, r.implicit = t.implicit, r;
}
i(g, "action");

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

// src/actions/addArgs.ts
var Y = [
  D,
  _
];

// src/actions/loaders.ts
var h = {};
y(h, {
  loaders: () => B
});
var I = require("storybook/test/spy");
var k = !1, $ = /* @__PURE__ */ i((e) => {
  let { parameters: t } = e;
  t?.actions?.disable || k || ((0, I.onMockCall)((o, r) => {
    let n = o.getMockName();
    n !== "spy" && (!/^next\/.*::/.test(n) || [
      "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) => n.startsWith(s))) && g(n)(r);
  }), k = !0);
}, "logActionsWhenMockCalled"), B = [$];

// src/actions/preview.ts
var K = /* @__PURE__ */ i(() => (0, j.definePreview)({
  ...A,
  ...h
}), "default");
