var y = Object.defineProperty;
var s = (t, o) => y(t, "name", { value: o, configurable: !0 });

// src/storybook-error.ts
function c({
  code: t,
  category: o
}) {
  let e = String(t).padStart(4, "0");
  return `SB_${o}_${e}`;
}
s(c, "parseErrorCode");
var n = class t extends Error {
  constructor(e) {
    super(t.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 {
    s(this, "StorybookError");
  }
  get fullErrorCode() {
    return c({ 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: d,
    category: E,
    message: l
  }) {
    let a;
    return e === !0 ? a = `https://storybook.js.org/error/${c({ code: d, category: E })}` : typeof e == "string" ? a = e : Array.isArray(e) &&
    (a = `
${e.map((N) => `	- ${N}`).join(`
`)}`), `${l}${a != null ? `

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

// src/manager-errors.ts
var g = /* @__PURE__ */ ((r) => (r.MANAGER_UNCAUGHT = "MANAGER_UNCAUGHT", r.MANAGER_UI = "MANAGER_UI", r.MANAGER_API = "MANAGER_API", r.MANAGER_CLIENT_LOGGER =
"MANAGER_CLIENT-LOGGER", r.MANAGER_CHANNELS = "MANAGER_CHANNELS", r.MANAGER_CORE_EVENTS = "MANAGER_CORE-EVENTS", r.MANAGER_ROUTER = "MANAGER\
_ROUTER", r.MANAGER_THEMING = "MANAGER_THEMING", r))(g || {}), A = class extends n {
  static {
    s(this, "ProviderDoesNotExtendBaseProviderError");
  }
  constructor() {
    super({
      category: "MANAGER_UI",
      code: 1,
      message: "The Provider passed into Storybook's UI is not extended from the base Provider. Please check your Provider implementation."
    });
  }
}, u = class extends n {
  constructor(e) {
    super({
      category: "MANAGER_UNCAUGHT",
      code: 1,
      message: e.error.message
    });
    this.data = e;
    this.stack = e.error.stack;
  }
  static {
    s(this, "UncaughtManagerError");
  }
}, i = class extends n {
  constructor(e) {
    super({
      category: "MANAGER_API",
      code: 1,
      message: `Status has typeId "${e.status.typeId}" but was added to store with typeId "${e.typeId}". Full status: ${JSON.stringify(
        e.status,
        null,
        2
      )}`
    });
    this.data = e;
  }
  static {
    s(this, "StatusTypeIdMismatchError");
  }
};
export {
  g as Category,
  A as ProviderDoesNotExtendBaseProviderError,
  i as StatusTypeIdMismatchError,
  u as UncaughtManagerError
};
