var c = Object.defineProperty;
var o = (n, r) => c(n, "name", { value: r, configurable: !0 });

// src/test/preview.ts
import { instrument as f } from "storybook/internal/instrumenter";
import { definePreview as m } from "storybook/preview-api";
import {
  clearAllMocks as k,
  fn as p,
  isMockFunction as l,
  resetAllMocks as A,
  restoreAllMocks as a,
  uninstrumentedUserEvent as b,
  within as d
} from "storybook/test";
var g = /* @__PURE__ */ o(({ parameters: n }) => {
  n?.test?.mockReset === !0 ? A() : n?.test?.clearMocks === !0 ? k() : n?.test?.restoreMocks !== !1 && a();
}, "resetAllMocksLoader"), e = /* @__PURE__ */ o((n, r = 0, i) => {
  if (r > 5 || n == null)
    return n;
  if (l(n))
    return i && n.mockName(i), n;
  if (typeof n == "function" && "isAction" in n && n.isAction && !("implicit" in n && n.implicit)) {
    let t = p(n);
    return i && t.mockName(i), t;
  }
  if (Array.isArray(n)) {
    r++;
    for (let t = 0; t < n.length; t++)
      n[t] = e(n[t], r);
    return n;
  }
  if (typeof n == "object" && n.constructor === Object) {
    r++;
    for (let [t, s] of Object.entries(n))
      Object.getOwnPropertyDescriptor(n, t)?.writable && (n[t] = e(s, r, t));
    return n;
  }
  return n;
}, "traverseArgs"), w = /* @__PURE__ */ o(({ initialArgs: n }) => {
  e(n);
}, "nameSpiesAndWrapActionsInSpies"), M = /* @__PURE__ */ o(async (n) => {
  globalThis.HTMLElement && n.canvasElement instanceof globalThis.HTMLElement && (n.canvas = d(n.canvasElement)), globalThis.window?.navigator?.
  clipboard && (n.userEvent = f(
    { userEvent: b.setup() },
    { intercept: !0 }
  ).userEvent);
}, "enhanceContext"), F = /* @__PURE__ */ o(() => m({
  loaders: [g, w, M]
}), "default");
export {
  F as default,
  e as traverseArgs
};
