"use strict";
var xe = Object.create;
var A = Object.defineProperty;
var _e = Object.getOwnPropertyDescriptor;
var Me = Object.getOwnPropertyNames;
var Ie = Object.getPrototypeOf, Se = Object.prototype.hasOwnProperty;
var n = (o, t) => A(o, "name", { value: t, configurable: !0 });
var we = (o, t) => () => (t || o((t = { exports: {} }).exports, t), t.exports), ve = (o, t) => {
  for (var e in t)
    A(o, e, { get: t[e], enumerable: !0 });
}, ce = (o, t, e, r) => {
  if (t && typeof t == "object" || typeof t == "function")
    for (let s of Me(t))
      !Se.call(o, s) && s !== e && A(o, s, { get: () => t[s], enumerable: !(r = _e(t, s)) || r.enumerable });
  return o;
};
var x = (o, t, e) => (e = o != null ? xe(Ie(o)) : {}, ce(
  // 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 || !o || !o.__esModule ? A(e, "default", { value: o, enumerable: !0 }) : e,
  o
)), Ne = (o) => ce(A({}, "__esModule", { value: !0 }), o);

// ../node_modules/ts-dedent/dist/index.js
var Oe = we((T) => {
  "use strict";
  Object.defineProperty(T, "__esModule", { value: !0 });
  T.dedent = void 0;
  function Re(o) {
    for (var t = [], e = 1; e < arguments.length; e++)
      t[e - 1] = arguments[e];
    var r = Array.from(typeof o == "string" ? [o] : o);
    r[r.length - 1] = r[r.length - 1].replace(/\r?\n([\t ]*)$/, "");
    var s = r.reduce(function(g, S) {
      var O = S.match(/\n([\t ]+|(?!\s).)/g);
      return O ? g.concat(O.map(function(w) {
        var y, b;
        return (b = (y = w.match(/[\t ]/g)) === null || y === void 0 ? void 0 : y.length) !== null && b !== void 0 ? b : 0;
      })) : g;
    }, []);
    if (s.length) {
      var c = new RegExp(`
[	 ]{` + Math.min.apply(Math, s) + "}", "g");
      r = r.map(function(g) {
        return g.replace(c, `
`);
      });
    }
    r[0] = r[0].replace(/^\r?\n/, "");
    var l = r[0];
    return t.forEach(function(g, S) {
      var O = l.match(/(?:^|\n)( *)$/), w = O ? O[1] : "", y = g;
      typeof g == "string" && g.includes(`
`) && (y = String(g).split(`
`).map(function(b, Te) {
        return Te === 0 ? b : "" + w + b;
      }).join(`
`)), l += y + r[S + 1];
    }), l;
  }
  n(Re, "dedent");
  T.dedent = Re;
  T.default = Re;
});

// src/server-errors.ts
var Xe = {};
ve(Xe, {
  AngularLegacyBuildOptionsError: () => Y,
  Category: () => Ce,
  ConflictingStaticDirConfigError: () => j,
  CouldNotEvaluateFrameworkError: () => P,
  CriticalPresetLoadError: () => H,
  FindPackageVersionsError: () => ae,
  GenerateNewProjectOnInitError: () => oe,
  GoogleFontsDownloadError: () => z,
  GoogleFontsLoadingError: () => J,
  InvalidFrameworkNameError: () => K,
  InvalidStoriesEntryError: () => V,
  MainFileESMOnlyImportError: () => Q,
  MainFileEvaluationError: () => ee,
  MainFileMissingError: () => Z,
  MissingAngularJsonError: () => U,
  MissingBuilderError: () => X,
  MissingFrameworkFieldError: () => F,
  NoMatchingExportError: () => q,
  NoStatsForViteDevError: () => ie,
  NxProjectDetectedError: () => W,
  UpgradeStorybookInWrongWorkingDirectory: () => se,
  UpgradeStorybookToLowerVersionError: () => te,
  UpgradeStorybookToSameVersionError: () => re,
  UpgradeStorybookUnknownCurrentVersionError: () => ne,
  WebpackCompilationError: () => G,
  WebpackInvocationError: () => D,
  WebpackMissingStatsError: () => $
});
module.exports = Ne(Xe);

// node_modules/chalk/source/vendor/ansi-styles/index.js
var le = /* @__PURE__ */ n((o = 0) => (t) => `\x1B[${t + o}m`, "wrapAnsi16"), ue = /* @__PURE__ */ n((o = 0) => (t) => `\x1B[${38 + o};5;${t}\
m`, "wrapAnsi256"), de = /* @__PURE__ */ n((o = 0) => (t, e, r) => `\x1B[${38 + o};2;${t};${e};${r}m`, "wrapAnsi16m"), d = {
  modifier: {
    reset: [0, 0],
    // 21 isn't widely supported and 22 does the same thing
    bold: [1, 22],
    dim: [2, 22],
    italic: [3, 23],
    underline: [4, 24],
    overline: [53, 55],
    inverse: [7, 27],
    hidden: [8, 28],
    strikethrough: [9, 29]
  },
  color: {
    black: [30, 39],
    red: [31, 39],
    green: [32, 39],
    yellow: [33, 39],
    blue: [34, 39],
    magenta: [35, 39],
    cyan: [36, 39],
    white: [37, 39],
    // Bright color
    blackBright: [90, 39],
    gray: [90, 39],
    // Alias of `blackBright`
    grey: [90, 39],
    // Alias of `blackBright`
    redBright: [91, 39],
    greenBright: [92, 39],
    yellowBright: [93, 39],
    blueBright: [94, 39],
    magentaBright: [95, 39],
    cyanBright: [96, 39],
    whiteBright: [97, 39]
  },
  bgColor: {
    bgBlack: [40, 49],
    bgRed: [41, 49],
    bgGreen: [42, 49],
    bgYellow: [43, 49],
    bgBlue: [44, 49],
    bgMagenta: [45, 49],
    bgCyan: [46, 49],
    bgWhite: [47, 49],
    // Bright color
    bgBlackBright: [100, 49],
    bgGray: [100, 49],
    // Alias of `bgBlackBright`
    bgGrey: [100, 49],
    // Alias of `bgBlackBright`
    bgRedBright: [101, 49],
    bgGreenBright: [102, 49],
    bgYellowBright: [103, 49],
    bgBlueBright: [104, 49],
    bgMagentaBright: [105, 49],
    bgCyanBright: [106, 49],
    bgWhiteBright: [107, 49]
  }
}, Je = Object.keys(d.modifier), Le = Object.keys(d.color), Be = Object.keys(d.bgColor), qe = [...Le, ...Be];
function We() {
  let o = /* @__PURE__ */ new Map();
  for (let [t, e] of Object.entries(d)) {
    for (let [r, s] of Object.entries(e))
      d[r] = {
        open: `\x1B[${s[0]}m`,
        close: `\x1B[${s[1]}m`
      }, e[r] = d[r], o.set(s[0], s[1]);
    Object.defineProperty(d, t, {
      value: e,
      enumerable: !1
    });
  }
  return Object.defineProperty(d, "codes", {
    value: o,
    enumerable: !1
  }), d.color.close = "\x1B[39m", d.bgColor.close = "\x1B[49m", d.color.ansi = le(), d.color.ansi256 = ue(), d.color.ansi16m = de(), d.bgColor.
  ansi = le(10), d.bgColor.ansi256 = ue(10), d.bgColor.ansi16m = de(10), Object.defineProperties(d, {
    rgbToAnsi256: {
      value(t, e, r) {
        return t === e && e === r ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 *
        Math.round(e / 255 * 5) + Math.round(r / 255 * 5);
      },
      enumerable: !1
    },
    hexToRgb: {
      value(t) {
        let e = /[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));
        if (!e)
          return [0, 0, 0];
        let [r] = e;
        r.length === 3 && (r = [...r].map((c) => c + c).join(""));
        let s = Number.parseInt(r, 16);
        return [
          /* eslint-disable no-bitwise */
          s >> 16 & 255,
          s >> 8 & 255,
          s & 255
          /* eslint-enable no-bitwise */
        ];
      },
      enumerable: !1
    },
    hexToAnsi256: {
      value: /* @__PURE__ */ n((t) => d.rgbToAnsi256(...d.hexToRgb(t)), "value"),
      enumerable: !1
    },
    ansi256ToAnsi: {
      value(t) {
        if (t < 8)
          return 30 + t;
        if (t < 16)
          return 90 + (t - 8);
        let e, r, s;
        if (t >= 232)
          e = ((t - 232) * 10 + 8) / 255, r = e, s = e;
        else {
          t -= 16;
          let g = t % 36;
          e = Math.floor(t / 36) / 5, r = Math.floor(g / 6) / 5, s = g % 6 / 5;
        }
        let c = Math.max(e, r, s) * 2;
        if (c === 0)
          return 30;
        let l = 30 + (Math.round(s) << 2 | Math.round(r) << 1 | Math.round(e));
        return c === 2 && (l += 60), l;
      },
      enumerable: !1
    },
    rgbToAnsi: {
      value: /* @__PURE__ */ n((t, e, r) => d.ansi256ToAnsi(d.rgbToAnsi256(t, e, r)), "value"),
      enumerable: !1
    },
    hexToAnsi: {
      value: /* @__PURE__ */ n((t) => d.ansi256ToAnsi(d.hexToAnsi256(t)), "value"),
      enumerable: !1
    }
  }), d;
}
n(We, "assembleStyles");
var Fe = We(), h = Fe;

// node_modules/chalk/source/vendor/supports-color/index.js
var M = x(require("node:process"), 1), ge = x(require("node:os"), 1), v = x(require("node:tty"), 1);
function f(o, t = globalThis.Deno ? globalThis.Deno.args : M.default.argv) {
  let e = o.startsWith("-") ? "" : o.length === 1 ? "-" : "--", r = t.indexOf(e + o), s = t.indexOf("--");
  return r !== -1 && (s === -1 || r < s);
}
n(f, "hasFlag");
var { env: p } = M.default, _;
f("no-color") || f("no-colors") || f("color=false") || f("color=never") ? _ = 0 : (f("color") || f("colors") || f("color=true") || f("color=\
always")) && (_ = 1);
function Ke() {
  if ("FORCE_COLOR" in p)
    return p.FORCE_COLOR === "true" ? 1 : p.FORCE_COLOR === "false" ? 0 : p.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(p.FORCE_COLOR,
    10), 3);
}
n(Ke, "envForceColor");
function Pe(o) {
  return o === 0 ? !1 : {
    level: o,
    hasBasic: !0,
    has256: o >= 2,
    has16m: o >= 3
  };
}
n(Pe, "translateLevel");
function je(o, { streamIsTTY: t, sniffFlags: e = !0 } = {}) {
  let r = Ke();
  r !== void 0 && (_ = r);
  let s = e ? _ : r;
  if (s === 0)
    return 0;
  if (e) {
    if (f("color=16m") || f("color=full") || f("color=truecolor"))
      return 3;
    if (f("color=256"))
      return 2;
  }
  if ("TF_BUILD" in p && "AGENT_NAME" in p)
    return 1;
  if (o && !t && s === void 0)
    return 0;
  let c = s || 0;
  if (p.TERM === "dumb")
    return c;
  if (M.default.platform === "win32") {
    let l = ge.default.release().split(".");
    return Number(l[0]) >= 10 && Number(l[2]) >= 10586 ? Number(l[2]) >= 14931 ? 3 : 2 : 1;
  }
  if ("CI" in p)
    return "GITHUB_ACTIONS" in p || "GITEA_ACTIONS" in p ? 3 : ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((l) => l in
    p) || p.CI_NAME === "codeship" ? 1 : c;
  if ("TEAMCITY_VERSION" in p)
    return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(p.TEAMCITY_VERSION) ? 1 : 0;
  if (p.COLORTERM === "truecolor" || p.TERM === "xterm-kitty")
    return 3;
  if ("TERM_PROGRAM" in p) {
    let l = Number.parseInt((p.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
    switch (p.TERM_PROGRAM) {
      case "iTerm.app":
        return l >= 3 ? 3 : 2;
      case "Apple_Terminal":
        return 2;
    }
  }
  return /-256(color)?$/i.test(p.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(p.TERM) || "COLORTERM" in p ?
  1 : c;
}
n(je, "_supportsColor");
function pe(o, t = {}) {
  let e = je(o, {
    streamIsTTY: o && o.isTTY,
    ...t
  });
  return Pe(e);
}
n(pe, "createSupportsColor");
var Ve = {
  stdout: pe({ isTTY: v.default.isatty(1) }),
  stderr: pe({ isTTY: v.default.isatty(2) })
}, fe = Ve;

// node_modules/chalk/source/utilities.js
function me(o, t, e) {
  let r = o.indexOf(t);
  if (r === -1)
    return o;
  let s = t.length, c = 0, l = "";
  do
    l += o.slice(c, r) + t + e, c = r + s, r = o.indexOf(t, c);
  while (r !== -1);
  return l += o.slice(c), l;
}
n(me, "stringReplaceAll");
function he(o, t, e, r) {
  let s = 0, c = "";
  do {
    let l = o[r - 1] === "\r";
    c += o.slice(s, l ? r - 1 : r) + t + (l ? `\r
` : `
`) + e, s = r + 1, r = o.indexOf(`
`, s);
  } while (r !== -1);
  return c += o.slice(s), c;
}
n(he, "stringEncaseCRLFWithFirstIndex");

// node_modules/chalk/source/index.js
var { stdout: ye, stderr: be } = fe, N = Symbol("GENERATOR"), E = Symbol("STYLER"), k = Symbol("IS_EMPTY"), Ee = [
  "ansi",
  "ansi",
  "ansi256",
  "ansi16m"
], R = /* @__PURE__ */ Object.create(null), $e = /* @__PURE__ */ n((o, t = {}) => {
  if (t.level && !(Number.isInteger(t.level) && t.level >= 0 && t.level <= 3))
    throw new Error("The `level` option should be an integer from 0 to 3");
  let e = ye ? ye.level : 0;
  o.level = t.level === void 0 ? e : t.level;
}, "applyOptions");
var De = /* @__PURE__ */ n((o) => {
  let t = /* @__PURE__ */ n((...e) => e.join(" "), "chalk");
  return $e(t, o), Object.setPrototypeOf(t, C.prototype), t;
}, "chalkFactory");
function C(o) {
  return De(o);
}
n(C, "createChalk");
Object.setPrototypeOf(C.prototype, Function.prototype);
for (let [o, t] of Object.entries(h))
  R[o] = {
    get() {
      let e = I(this, B(t.open, t.close, this[E]), this[k]);
      return Object.defineProperty(this, o, { value: e }), e;
    }
  };
R.visible = {
  get() {
    let o = I(this, this[E], !0);
    return Object.defineProperty(this, "visible", { value: o }), o;
  }
};
var L = /* @__PURE__ */ n((o, t, e, ...r) => o === "rgb" ? t === "ansi16m" ? h[e].ansi16m(...r) : t === "ansi256" ? h[e].ansi256(h.rgbToAnsi256(
...r)) : h[e].ansi(h.rgbToAnsi(...r)) : o === "hex" ? L("rgb", t, e, ...h.hexToRgb(...r)) : h[e][o](...r), "getModelAnsi"), Ge = ["rgb", "he\
x", "ansi256"];
for (let o of Ge) {
  R[o] = {
    get() {
      let { level: e } = this;
      return function(...r) {
        let s = B(L(o, Ee[e], "color", ...r), h.color.close, this[E]);
        return I(this, s, this[k]);
      };
    }
  };
  let t = "bg" + o[0].toUpperCase() + o.slice(1);
  R[t] = {
    get() {
      let { level: e } = this;
      return function(...r) {
        let s = B(L(o, Ee[e], "bgColor", ...r), h.bgColor.close, this[E]);
        return I(this, s, this[k]);
      };
    }
  };
}
var Ue = Object.defineProperties(() => {
}, {
  ...R,
  level: {
    enumerable: !0,
    get() {
      return this[N].level;
    },
    set(o) {
      this[N].level = o;
    }
  }
}), B = /* @__PURE__ */ n((o, t, e) => {
  let r, s;
  return e === void 0 ? (r = o, s = t) : (r = e.openAll + o, s = t + e.closeAll), {
    open: o,
    close: t,
    openAll: r,
    closeAll: s,
    parent: e
  };
}, "createStyler"), I = /* @__PURE__ */ n((o, t, e) => {
  let r = /* @__PURE__ */ n((...s) => Ye(r, s.length === 1 ? "" + s[0] : s.join(" ")), "builder");
  return Object.setPrototypeOf(r, Ue), r[N] = o, r[E] = t, r[k] = e, r;
}, "createBuilder"), Ye = /* @__PURE__ */ n((o, t) => {
  if (o.level <= 0 || !t)
    return o[k] ? "" : t;
  let e = o[E];
  if (e === void 0)
    return t;
  let { openAll: r, closeAll: s } = e;
  if (t.includes("\x1B"))
    for (; e !== void 0; )
      t = me(t, e.close, e.open), e = e.parent;
  let c = t.indexOf(`
`);
  return c !== -1 && (t = he(t, s, r, c)), r + t + s;
}, "applyStyle");
Object.defineProperties(C.prototype, R);
var He = C(), ao = C({ level: be ? be.level : 0 });
var m = He;

// src/server-errors.ts
var u = x(Oe(), 1);

// src/storybook-error.ts
function Ae({
  code: o,
  category: t
}) {
  let e = String(o).padStart(4, "0");
  return `SB_${t}_${e}`;
}
n(Ae, "parseErrorCode");
var a = class o extends Error {
  constructor(e) {
    super(o.getFullMessage(e));
    /**
     * Data associated with the error. Used to provide additional information in the error message or to be passed to telemetry.
     */
    this.data = {};
    /**
     * Flag used to easily determine if the error originates from Storybook.
     */
    this.fromStorybook = !0;
    this.category = e.category, this.documentation = e.documentation ?? !1, this.code = e.code;
  }
  static {
    n(this, "StorybookError");
  }
  get fullErrorCode() {
    return Ae({ code: this.code, category: this.category });
  }
  /**
   * Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>.
   */
  get name() {
    let e = this.constructor.name;
    return `${this.fullErrorCode} (${e})`;
  }
  /**
   * Generates the error message along with additional documentation link (if applicable).
   */
  static getFullMessage({
    documentation: e,
    code: r,
    category: s,
    message: c
  }) {
    let l;
    return e === !0 ? l = `https://storybook.js.org/error/${Ae({ code: r, category: s })}` : typeof e == "string" ? l = e : Array.isArray(e) &&
    (l = `
${e.map((g) => `	- ${g}`).join(`
`)}`), `${c}${l != null ? `

More info: ${l}
` : ""}`;
  }
};

// src/server-errors.ts
var Ce = /* @__PURE__ */ ((i) => (i.CLI = "CLI", i.CLI_INIT = "CLI_INIT", i.CLI_AUTOMIGRATE = "CLI_AUTOMIGRATE", i.CLI_UPGRADE = "CLI_UPGRAD\
E", i.CLI_ADD = "CLI_ADD", i.CODEMOD = "CODEMOD", i.CORE_SERVER = "CORE-SERVER", i.CSF_PLUGIN = "CSF-PLUGIN", i.CSF_TOOLS = "CSF-TOOLS", i.CORE_COMMON =
"CORE-COMMON", i.NODE_LOGGER = "NODE-LOGGER", i.TELEMETRY = "TELEMETRY", i.BUILDER_MANAGER = "BUILDER-MANAGER", i.BUILDER_VITE = "BUILDER-VI\
TE", i.BUILDER_WEBPACK5 = "BUILDER-WEBPACK5", i.SOURCE_LOADER = "SOURCE-LOADER", i.POSTINSTALL = "POSTINSTALL", i.DOCS_TOOLS = "DOCS-TOOLS",
i.CORE_WEBPACK = "CORE-WEBPACK", i.FRAMEWORK_ANGULAR = "FRAMEWORK_ANGULAR", i.FRAMEWORK_EMBER = "FRAMEWORK_EMBER", i.FRAMEWORK_HTML_VITE = "\
FRAMEWORK_HTML-VITE", i.FRAMEWORK_HTML_WEBPACK5 = "FRAMEWORK_HTML-WEBPACK5", i.FRAMEWORK_NEXTJS = "FRAMEWORK_NEXTJS", i.FRAMEWORK_PREACT_VITE =
"FRAMEWORK_PREACT-VITE", i.FRAMEWORK_PREACT_WEBPACK5 = "FRAMEWORK_PREACT-WEBPACK5", i.FRAMEWORK_REACT_VITE = "FRAMEWORK_REACT-VITE", i.FRAMEWORK_REACT_WEBPACK5 =
"FRAMEWORK_REACT-WEBPACK5", i.FRAMEWORK_SERVER_WEBPACK5 = "FRAMEWORK_SERVER-WEBPACK5", i.FRAMEWORK_SVELTE_VITE = "FRAMEWORK_SVELTE-VITE", i.
FRAMEWORK_SVELTE_WEBPACK5 = "FRAMEWORK_SVELTE-WEBPACK5", i.FRAMEWORK_SVELTEKIT = "FRAMEWORK_SVELTEKIT", i.FRAMEWORK_VUE_VITE = "FRAMEWORK_VU\
E-VITE", i.FRAMEWORK_VUE_WEBPACK5 = "FRAMEWORK_VUE-WEBPACK5", i.FRAMEWORK_VUE3_VITE = "FRAMEWORK_VUE3-VITE", i.FRAMEWORK_VUE3_WEBPACK5 = "FR\
AMEWORK_VUE3-WEBPACK5", i.FRAMEWORK_WEB_COMPONENTS_VITE = "FRAMEWORK_WEB-COMPONENTS-VITE", i.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_\
WEB-COMPONENTS-WEBPACK5", i))(Ce || {}), W = class extends a {
  static {
    n(this, "NxProjectDetectedError");
  }
  constructor() {
    super({
      category: "CLI_INIT",
      code: 1,
      documentation: "https://nx.dev/packages/storybook",
      message: u.dedent`
        We have detected Nx in your project. Nx has its own Storybook initializer, so please use it instead.
        Run "nx g @nx/storybook:configuration" to add Storybook to your project.`
    });
  }
}, F = class extends a {
  static {
    n(this, "MissingFrameworkFieldError");
  }
  constructor() {
    super({
      category: "CORE-COMMON",
      code: 1,
      documentation: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-framework-api",
      message: u.dedent`
        Could not find a 'framework' field in Storybook config.
        
        Please run 'npx storybook automigrate' to automatically fix your config.`
    });
  }
}, K = class extends a {
  constructor(e) {
    super({
      category: "CORE-COMMON",
      code: 2,
      documentation: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-framework-api",
      message: u.dedent`
        Invalid value of '${e.frameworkName}' in the 'framework' field of Storybook config.
        
        Please run 'npx storybook automigrate' to automatically fix your config.
      `
    });
    this.data = e;
  }
  static {
    n(this, "InvalidFrameworkNameError");
  }
}, P = class extends a {
  constructor(e) {
    super({
      category: "CORE-COMMON",
      code: 3,
      documentation: "",
      message: u.dedent`
        Could not evaluate the '${e.frameworkName}' package from the 'framework' field of Storybook config.
        
        Are you sure it's a valid package and is installed?`
    });
    this.data = e;
  }
  static {
    n(this, "CouldNotEvaluateFrameworkError");
  }
}, j = class extends a {
  static {
    n(this, "ConflictingStaticDirConfigError");
  }
  constructor() {
    super({
      category: "CORE-SERVER",
      code: 1,
      documentation: "https://storybook.js.org/docs/react/configure/images-and-assets#serving-static-files-via-storybook-configuration",
      message: u.dedent`
        Storybook encountered a conflict when trying to serve statics. You have configured both:
        * Storybook's option in the config file: 'staticDirs'
        * Storybook's (deprecated) CLI flag: '--staticDir' or '-s'
        
        Please remove the CLI flag from your storybook script and use only the 'staticDirs' option instead.`
    });
  }
}, V = class extends a {
  static {
    n(this, "InvalidStoriesEntryError");
  }
  constructor() {
    super({
      category: "CORE-COMMON",
      code: 4,
      documentation: "https://storybook.js.org/docs/react/faq#can-i-have-a-storybook-with-no-local-stories",
      message: u.dedent`
        Storybook could not index your stories.
        Your main configuration somehow does not contain a 'stories' field, or it resolved to an empty array.
        
        Please check your main configuration file and make sure it exports a 'stories' field that is not an empty array.`
    });
  }
}, $ = class extends a {
  static {
    n(this, "WebpackMissingStatsError");
  }
  constructor() {
    super({
      category: "BUILDER-WEBPACK5",
      code: 1,
      documentation: [
        "https://webpack.js.org/configuration/stats/",
        "https://storybook.js.org/docs/react/builders/webpack#configure"
      ],
      message: u.dedent`
        No Webpack stats found. Did you turn off stats reporting in your Webpack config?
        Storybook needs Webpack stats (including errors) in order to build correctly.`
    });
  }
}, D = class extends a {
  constructor(e) {
    super({
      category: "BUILDER-WEBPACK5",
      code: 2,
      message: e.error.message.trim()
    });
    this.data = e;
  }
  static {
    n(this, "WebpackInvocationError");
  }
};
function ke(o = "") {
  return o.replace(/\u001B\[[0-9;]*m/g, "");
}
n(ke, "removeAnsiEscapeCodes");
var G = class extends a {
  constructor(e) {
    e.errors = e.errors.map((r) => ({
      ...r,
      message: ke(r.message),
      stack: ke(r.stack),
      name: r.name
    }));
    super({
      category: "BUILDER-WEBPACK5",
      code: 3,
      // This error message is a followup of errors logged by Webpack to the user
      message: u.dedent`
        There were problems when compiling your code with Webpack.
        Run Storybook with --debug-webpack for more information.
      `
    });
    this.data = e;
  }
  static {
    n(this, "WebpackCompilationError");
  }
}, U = class extends a {
  constructor(e) {
    super({
      category: "CLI_INIT",
      code: 2,
      documentation: "https://storybook.js.org/docs/angular/faq#error-no-angularjson-file-found",
      message: u.dedent`
        An angular.json file was not found in the current working directory: ${e.path}
        Storybook needs it to work properly, so please rerun the command at the root of your project, where the angular.json file is located.`
    });
    this.data = e;
  }
  static {
    n(this, "MissingAngularJsonError");
  }
}, Y = class extends a {
  static {
    n(this, "AngularLegacyBuildOptionsError");
  }
  constructor() {
    super({
      category: "FRAMEWORK_ANGULAR",
      code: 1,
      documentation: [
        "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular-drop-support-for-calling-storybook-directly",
        "https://github.com/storybookjs/storybook/tree/next/code/frameworks/angular#how-do-i-migrate-to-an-angular-storybook-builder"
      ],
      message: u.dedent`
        Your Storybook startup script uses a solution that is not supported anymore.
        You must use Angular builder to have an explicit configuration on the project used in angular.json.
        
        Please run 'npx storybook automigrate' to automatically fix your config.`
    });
  }
}, H = class extends a {
  constructor(e) {
    super({
      category: "CORE-SERVER",
      code: 2,
      documentation: "",
      message: u.dedent`
        Storybook failed to load the following preset: ${e.presetName}.
        
        Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.
        
        If you believe this is a bug, please open an issue on Github.
        
        ${e.error.stack || e.error.message}`
    });
    this.data = e;
  }
  static {
    n(this, "CriticalPresetLoadError");
  }
}, X = class extends a {
  static {
    n(this, "MissingBuilderError");
  }
  constructor() {
    super({
      category: "CORE-SERVER",
      code: 3,
      documentation: "https://github.com/storybookjs/storybook/issues/24071",
      message: u.dedent`
        Storybook could not find a builder configuration for your project. 
        Builders normally come from a framework package e.g. '@storybook/react-vite', or from builder packages e.g. '@storybook/builder-vite'.
        
        - Does your main config file contain a 'framework' field configured correctly?
        - Is the Storybook framework package installed correctly?
        - If you don't use a framework, does your main config contain a 'core.builder' configured correctly?
        - Are you in a monorepo and perhaps the framework package is hoisted incorrectly?
        
        If you believe this is a bug, please describe your issue in detail on Github.`
    });
  }
}, z = class extends a {
  constructor(e) {
    super({
      category: "FRAMEWORK_NEXTJS",
      code: 1,
      documentation: "https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#nextjs-font-optimization",
      message: u.dedent`
        Failed to fetch \`${e.fontFamily}\` from Google Fonts with URL: \`${e.url}\``
    });
    this.data = e;
  }
  static {
    n(this, "GoogleFontsDownloadError");
  }
}, J = class extends a {
  constructor(e) {
    super({
      category: "FRAMEWORK_NEXTJS",
      code: 2,
      documentation: "https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#nextjs-font-optimization",
      message: u.dedent`
        An error occurred when trying to load Google Fonts with URL \`${e.url}\`.
        
        ${e.error instanceof Error ? e.error.message : ""}`
    });
    this.data = e;
  }
  static {
    n(this, "GoogleFontsLoadingError");
  }
}, q = class extends a {
  constructor(e) {
    super({
      category: "CORE-SERVER",
      code: 4,
      documentation: "",
      message: u.dedent`
        There was an exports mismatch error when trying to build Storybook.
        Please check whether the versions of your Storybook packages match whenever possible, as this might be the cause.
        
        Problematic example:
        { "@storybook/react": "7.5.3", "@storybook/react-vite": "7.4.5", "storybook": "7.3.0" }
        
        Correct example:
        { "@storybook/react": "7.5.3", "@storybook/react-vite": "7.5.3", "storybook": "7.5.3" }
        
        Please run \`npx storybook doctor\` for guidance on how to fix this issue.`
    });
    this.data = e;
  }
  static {
    n(this, "NoMatchingExportError");
  }
}, Q = class extends a {
  constructor(e) {
    let r = [
      `Storybook failed to load ${e.location}`,
      "",
      "It looks like the file tried to load/import an ESM only module.",
      `Support for this is currently limited in ${e.location}`,
      "You can import ESM modules in your main file, but only as dynamic import.",
      ""
    ];
    e.line && r.push(
      m.white(
        `In your ${m.yellow(e.location)} file, line ${m.bold.cyan(
          e.num
        )} threw an error:`
      ),
      m.grey(e.line)
    ), r.push(
      "",
      m.white(
        `Convert the static import to a dynamic import ${m.underline("where they are used")}.`
      ),
      m.white("Example:") + " " + m.gray("await import(<your ESM only module>);"),
      ""
    );
    super({
      category: "CORE-SERVER",
      code: 5,
      documentation: "https://github.com/storybookjs/storybook/issues/23972#issuecomment-1948534058",
      message: r.join(`
`)
    });
    this.data = e;
  }
  static {
    n(this, "MainFileESMOnlyImportError");
  }
}, Z = class extends a {
  constructor(e) {
    let r = {
      storybook: {
        helperMessage: "You can pass a --config-dir flag to tell Storybook, where your main.js file is located at.",
        documentation: "https://storybook.js.org/docs/configure"
      },
      vitest: {
        helperMessage: "You can pass a configDir plugin option to tell where your main.js file is located at.",
        // TODO: add proper docs once available
        documentation: "https://storybook.js.org/docs/configure"
      }
    }, { documentation: s, helperMessage: c } = r[e.source || "storybook"];
    super({
      category: "CORE-SERVER",
      code: 6,
      documentation: s,
      message: u.dedent`
        No configuration files have been found in your configDir: ${m.yellow(e.location)}.
        Storybook needs a "main.js" file, please add it.
        
        ${c}`
    });
    this.data = e;
  }
  static {
    n(this, "MainFileMissingError");
  }
}, ee = class extends a {
  constructor(e) {
    let r = m.white(
      (e.error.stack || e.error.message).replaceAll(process.cwd(), "")
    );
    super({
      category: "CORE-SERVER",
      code: 7,
      message: u.dedent`
        Storybook couldn't evaluate your ${m.yellow(e.location)} file.
        
        Original error:
        ${r}`
    });
    this.data = e;
  }
  static {
    n(this, "MainFileEvaluationError");
  }
}, oe = class extends a {
  constructor(e) {
    super({
      category: "CLI_INIT",
      code: 3,
      documentation: "",
      message: u.dedent`
        There was an error while using ${e.packageManager} to create a new ${e.projectType} project.
        
        ${e.error instanceof Error ? e.error.message : ""}`
    });
    this.data = e;
  }
  static {
    n(this, "GenerateNewProjectOnInitError");
  }
}, te = class extends a {
  constructor(e) {
    super({
      category: "CLI_UPGRADE",
      code: 3,
      message: u.dedent`
        You are trying to upgrade Storybook to a lower version than the version currently installed. This is not supported.
        
        Storybook version ${e.beforeVersion} was detected in your project, but you are trying to "upgrade" to version ${e.currentVersion}.
        
        This usually happens when running the upgrade command without a version specifier, e.g. "npx storybook upgrade".
        This will cause npm to run the globally cached storybook binary, which might be an older version.
        
        Instead you should always run the Storybook CLI with a version specifier to force npm to download the latest version:
        
        "npx storybook@latest upgrade"`
    });
    this.data = e;
  }
  static {
    n(this, "UpgradeStorybookToLowerVersionError");
  }
}, re = class extends a {
  constructor(e) {
    super({
      category: "CLI_UPGRADE",
      code: 4,
      message: u.dedent`
        You are upgrading Storybook to the same version that is currently installed in the project, version ${e.beforeVersion}.
        
        This usually happens when running the upgrade command without a version specifier, e.g. "npx storybook upgrade".
        This will cause npm to run the globally cached storybook binary, which might be the same version that you already have.
        This also happens if you're running the Storybook CLI that is locally installed in your project.
        
        If you intended to upgrade to the latest version, you should always run the Storybook CLI with a version specifier to force npm to download the latest version:
        
        "npx storybook@latest upgrade"
        
        If you intended to re-run automigrations, you should run the "automigrate" command directly instead:
        
        "npx storybook automigrate"`
    });
    this.data = e;
  }
  static {
    n(this, "UpgradeStorybookToSameVersionError");
  }
}, ne = class extends a {
  static {
    n(this, "UpgradeStorybookUnknownCurrentVersionError");
  }
  constructor() {
    super({
      category: "CLI_UPGRADE",
      code: 5,
      message: u.dedent`
        We couldn't determine the current version of Storybook in your project.
        
        Are you running the Storybook CLI in a project without Storybook?
        It might help if you specify your Storybook config directory with the --config-dir flag.`
    });
  }
}, se = class extends a {
  static {
    n(this, "UpgradeStorybookInWrongWorkingDirectory");
  }
  constructor() {
    super({
      category: "CLI_UPGRADE",
      code: 6,
      message: u.dedent`
        You are running the upgrade command in a CWD that does not contain Storybook dependencies.
        
        Did you mean to run it in a different directory? Make sure the directory you run this command in contains a package.json with your Storybook dependencies.`
    });
  }
}, ie = class extends a {
  static {
    n(this, "NoStatsForViteDevError");
  }
  constructor() {
    super({
      category: "BUILDER-VITE",
      code: 1,
      message: u.dedent`
        Unable to write preview stats as the Vite builder does not support stats in dev mode.
        
        Please remove the \`--stats-json\` flag when running in dev mode.`
    });
  }
}, ae = class extends a {
  constructor(e) {
    super({
      category: "CLI",
      code: 1,
      message: u.dedent`
        Unable to find versions of "${e.packageName}" using ${e.packageManager}
        ${e.error && `Reason: ${e.error}`}`
    });
    this.data = e;
  }
  static {
    n(this, "FindPackageVersionsError");
  }
};
