import CJS_COMPAT_NODE_URL from 'node:url';
import CJS_COMPAT_NODE_PATH from 'node:path';
import CJS_COMPAT_NODE_MODULE from "node:module";

const __filename = CJS_COMPAT_NODE_URL.fileURLToPath(import.meta.url);
const __dirname = CJS_COMPAT_NODE_PATH.dirname(__filename);
const require = CJS_COMPAT_NODE_MODULE.createRequire(import.meta.url);
// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------
import {
  a as q,
  b as Ot,
  c as pe
} from "./chunk-LGXXNKGQ.js";
import {
  a as Rt
} from "./chunk-QRMCI4IG.js";
import {
  a as fe
} from "./chunk-MES5DXOO.js";
import {
  a as A,
  c as ue,
  e as k
} from "./chunk-JNV2AX5Q.js";
import {
  a as j
} from "./chunk-WBEMC3FF.js";
import {
  a as i,
  b as N,
  c as gt,
  d as B,
  e as It,
  f as Y,
  g as Tt
} from "./chunk-HRN2KQZP.js";

// ../node_modules/tslib/tslib.es6.mjs
var Ge = {};
It(Ge, {
  __addDisposableResource: () => Me,
  __assign: () => M,
  __asyncDelegator: () => Ce,
  __asyncGenerator: () => xe,
  __asyncValues: () => Ne,
  __await: () => P,
  __awaiter: () => Oe,
  __classPrivateFieldGet: () => Be,
  __classPrivateFieldIn: () => je,
  __classPrivateFieldSet: () => ke,
  __createBinding: () => U,
  __decorate: () => Ee,
  __disposeResources: () => He,
  __esDecorate: () => Se,
  __exportStar: () => ve,
  __extends: () => _e,
  __generator: () => be,
  __importDefault: () => Fe,
  __importStar: () => Le,
  __makeTemplateObject: () => De,
  __metadata: () => Re,
  __param: () => he,
  __propKey: () => Ie,
  __read: () => z,
  __rest: () => ye,
  __rewriteRelativeImportExtension: () => Ue,
  __runInitializers: () => ge,
  __setFunctionName: () => Te,
  __spread: () => Ae,
  __spreadArray: () => Pe,
  __spreadArrays: () => we,
  __values: () => H,
  default: () => Pt
});
function _e(e, r) {
  if (typeof r != "function" && r !== null)
    throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
  J(e, r);
  function t() {
    this.constructor = e;
  }
  i(t, "__"), e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
}
function ye(e, r) {
  var t = {};
  for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && r.indexOf(o) < 0 && (t[o] = e[o]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
      r.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (t[o[n]] = e[o[n]]);
  return t;
}
function Ee(e, r, t, o) {
  var n = arguments.length, a = n < 3 ? r : o === null ? o = Object.getOwnPropertyDescriptor(r, t) : o, s;
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, r, t, o);
  else for (var l = e.length - 1; l >= 0; l--) (s = e[l]) && (a = (n < 3 ? s(a) : n > 3 ? s(r, t, a) : s(r, t)) || a);
  return n > 3 && a && Object.defineProperty(r, t, a), a;
}
function he(e, r) {
  return function(t, o) {
    r(t, o, e);
  };
}
function Se(e, r, t, o, n, a) {
  function s(I) {
    if (I !== void 0 && typeof I != "function") throw new TypeError("Function expected");
    return I;
  }
  i(s, "accept");
  for (var l = o.kind, u = l === "getter" ? "get" : l === "setter" ? "set" : "value", c = !r && e ? o.static ? e : e.prototype : null, f = r || (c ? Object.getOwnPropertyDescriptor(c, o.name) : {}), _, E = !1, d = t.length - 1; d >= 0; d--) {
    var p = {};
    for (var m in o) p[m] = m === "access" ? {} : o[m];
    for (var m in o.access) p.access[m] = o.access[m];
    p.addInitializer = function(I) {
      if (E) throw new TypeError("Cannot add initializers after decoration has completed");
      a.push(s(I || null));
    };
    var h = (0, t[d])(l === "accessor" ? { get: f.get, set: f.set } : f[u], p);
    if (l === "accessor") {
      if (h === void 0) continue;
      if (h === null || typeof h != "object") throw new TypeError("Object expected");
      (_ = s(h.get)) && (f.get = _), (_ = s(h.set)) && (f.set = _), (_ = s(h.init)) && n.unshift(_);
    } else (_ = s(h)) && (l === "field" ? n.unshift(_) : f[u] = _);
  }
  c && Object.defineProperty(c, o.name, f), E = !0;
}
function ge(e, r, t) {
  for (var o = arguments.length > 2, n = 0; n < r.length; n++)
    t = o ? r[n].call(e, t) : r[n].call(e);
  return o ? t : void 0;
}
function Ie(e) {
  return typeof e == "symbol" ? e : "".concat(e);
}
function Te(e, r, t) {
  return typeof r == "symbol" && (r = r.description ? "[".concat(r.description, "]") : ""), Object.defineProperty(e, "name", { configurable: !0, value: t ? "".concat(t, " ", r) : r });
}
function Re(e, r) {
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, r);
}
function Oe(e, r, t, o) {
  function n(a) {
    return a instanceof t ? a : new t(function(s) {
      s(a);
    });
  }
  return i(n, "adopt"), new (t || (t = Promise))(function(a, s) {
    function l(f) {
      try {
        c(o.next(f));
      } catch (_) {
        s(_);
      }
    }
    i(l, "fulfilled");
    function u(f) {
      try {
        c(o.throw(f));
      } catch (_) {
        s(_);
      }
    }
    i(u, "rejected");
    function c(f) {
      f.done ? a(f.value) : n(f.value).then(l, u);
    }
    i(c, "step"), c((o = o.apply(e, r || [])).next());
  });
}
function be(e, r) {
  var t = { label: 0, sent: /* @__PURE__ */ i(function() {
    if (a[0] & 1) throw a[1];
    return a[1];
  }, "sent"), trys: [], ops: [] }, o, n, a, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
  return s.next = l(0), s.throw = l(1), s.return = l(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
    return this;
  }), s;
  function l(c) {
    return function(f) {
      return u([c, f]);
    };
  }
  function u(c) {
    if (o) throw new TypeError("Generator is already executing.");
    for (; s && (s = 0, c[0] && (t = 0)), t; ) try {
      if (o = 1, n && (a = c[0] & 2 ? n.return : c[0] ? n.throw || ((a = n.return) && a.call(n), 0) : n.next) && !(a = a.call(n, c[1])).done) return a;
      switch (n = 0, a && (c = [c[0] & 2, a.value]), c[0]) {
        case 0:
        case 1:
          a = c;
          break;
        case 4:
          return t.label++, { value: c[1], done: !1 };
        case 5:
          t.label++, n = c[1], c = [0];
          continue;
        case 7:
          c = t.ops.pop(), t.trys.pop();
          continue;
        default:
          if (a = t.trys, !(a = a.length > 0 && a[a.length - 1]) && (c[0] === 6 || c[0] === 2)) {
            t = 0;
            continue;
          }
          if (c[0] === 3 && (!a || c[1] > a[0] && c[1] < a[3])) {
            t.label = c[1];
            break;
          }
          if (c[0] === 6 && t.label < a[1]) {
            t.label = a[1], a = c;
            break;
          }
          if (a && t.label < a[2]) {
            t.label = a[2], t.ops.push(c);
            break;
          }
          a[2] && t.ops.pop(), t.trys.pop();
          continue;
      }
      c = r.call(e, t);
    } catch (f) {
      c = [6, f], n = 0;
    } finally {
      o = a = 0;
    }
    if (c[0] & 5) throw c[1];
    return { value: c[0] ? c[1] : void 0, done: !0 };
  }
}
function ve(e, r) {
  for (var t in e) t !== "default" && !Object.prototype.hasOwnProperty.call(r, t) && U(r, e, t);
}
function H(e) {
  var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], o = 0;
  if (t) return t.call(e);
  if (e && typeof e.length == "number") return {
    next: /* @__PURE__ */ i(function() {
      return e && o >= e.length && (e = void 0), { value: e && e[o++], done: !e };
    }, "next")
  };
  throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function z(e, r) {
  var t = typeof Symbol == "function" && e[Symbol.iterator];
  if (!t) return e;
  var o = t.call(e), n, a = [], s;
  try {
    for (; (r === void 0 || r-- > 0) && !(n = o.next()).done; ) a.push(n.value);
  } catch (l) {
    s = { error: l };
  } finally {
    try {
      n && !n.done && (t = o.return) && t.call(o);
    } finally {
      if (s) throw s.error;
    }
  }
  return a;
}
function Ae() {
  for (var e = [], r = 0; r < arguments.length; r++)
    e = e.concat(z(arguments[r]));
  return e;
}
function we() {
  for (var e = 0, r = 0, t = arguments.length; r < t; r++) e += arguments[r].length;
  for (var o = Array(e), n = 0, r = 0; r < t; r++)
    for (var a = arguments[r], s = 0, l = a.length; s < l; s++, n++)
      o[n] = a[s];
  return o;
}
function Pe(e, r, t) {
  if (t || arguments.length === 2) for (var o = 0, n = r.length, a; o < n; o++)
    (a || !(o in r)) && (a || (a = Array.prototype.slice.call(r, 0, o)), a[o] = r[o]);
  return e.concat(a || Array.prototype.slice.call(r));
}
function P(e) {
  return this instanceof P ? (this.v = e, this) : new P(e);
}
function xe(e, r, t) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var o = t.apply(e, r || []), n, a = [];
  return n = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), l("next"), l("throw"), l("return", s), n[Symbol.asyncIterator] = function() {
    return this;
  }, n;
  function s(d) {
    return function(p) {
      return Promise.resolve(p).then(d, _);
    };
  }
  function l(d, p) {
    o[d] && (n[d] = function(m) {
      return new Promise(function(h, I) {
        a.push([d, m, h, I]) > 1 || u(d, m);
      });
    }, p && (n[d] = p(n[d])));
  }
  function u(d, p) {
    try {
      c(o[d](p));
    } catch (m) {
      E(a[0][3], m);
    }
  }
  function c(d) {
    d.value instanceof P ? Promise.resolve(d.value.v).then(f, _) : E(a[0][2], d);
  }
  function f(d) {
    u("next", d);
  }
  function _(d) {
    u("throw", d);
  }
  function E(d, p) {
    d(p), a.shift(), a.length && u(a[0][0], a[0][1]);
  }
}
function Ce(e) {
  var r, t;
  return r = {}, o("next"), o("throw", function(n) {
    throw n;
  }), o("return"), r[Symbol.iterator] = function() {
    return this;
  }, r;
  function o(n, a) {
    r[n] = e[n] ? function(s) {
      return (t = !t) ? { value: P(e[n](s)), done: !1 } : a ? a(s) : s;
    } : a;
  }
}
function Ne(e) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var r = e[Symbol.asyncIterator], t;
  return r ? r.call(e) : (e = typeof H == "function" ? H(e) : e[Symbol.iterator](), t = {}, o("next"), o("throw"), o("return"), t[Symbol.asyncIterator] = function() {
    return this;
  }, t);
  function o(a) {
    t[a] = e[a] && function(s) {
      return new Promise(function(l, u) {
        s = e[a](s), n(l, u, s.done, s.value);
      });
    };
  }
  function n(a, s, l, u) {
    Promise.resolve(u).then(function(c) {
      a({ value: c, done: l });
    }, s);
  }
}
function De(e, r) {
  return Object.defineProperty ? Object.defineProperty(e, "raw", { value: r }) : e.raw = r, e;
}
function Le(e) {
  if (e && e.__esModule) return e;
  var r = {};
  if (e != null) for (var t = X(e), o = 0; o < t.length; o++) t[o] !== "default" && U(r, e, t[o]);
  return At(r, e), r;
}
function Fe(e) {
  return e && e.__esModule ? e : { default: e };
}
function Be(e, r, t, o) {
  if (t === "a" && !o) throw new TypeError("Private accessor was defined without a getter");
  if (typeof r == "function" ? e !== r || !o : !r.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return t === "m" ? o : t === "a" ? o.call(e) : o ? o.value : r.get(e);
}
function ke(e, r, t, o, n) {
  if (o === "m") throw new TypeError("Private method is not writable");
  if (o === "a" && !n) throw new TypeError("Private accessor was defined without a setter");
  if (typeof r == "function" ? e !== r || !n : !r.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return o === "a" ? n.call(e, t) : n ? n.value = t : r.set(e, t), t;
}
function je(e, r) {
  if (r === null || typeof r != "object" && typeof r != "function") throw new TypeError("Cannot use 'in' operator on non-object");
  return typeof e == "function" ? r === e : e.has(r);
}
function Me(e, r, t) {
  if (r != null) {
    if (typeof r != "object" && typeof r != "function") throw new TypeError("Object expected.");
    var o, n;
    if (t) {
      if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
      o = r[Symbol.asyncDispose];
    }
    if (o === void 0) {
      if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
      o = r[Symbol.dispose], t && (n = o);
    }
    if (typeof o != "function") throw new TypeError("Object not disposable.");
    n && (o = /* @__PURE__ */ i(function() {
      try {
        n.call(this);
      } catch (a) {
        return Promise.reject(a);
      }
    }, "dispose")), e.stack.push({ value: r, dispose: o, async: t });
  } else t && e.stack.push({ async: !0 });
  return r;
}
function He(e) {
  function r(a) {
    e.error = e.hasError ? new wt(a, e.error, "An error was suppressed during disposal.") : a, e.hasError = !0;
  }
  i(r, "fail");
  var t, o = 0;
  function n() {
    for (; t = e.stack.pop(); )
      try {
        if (!t.async && o === 1) return o = 0, e.stack.push(t), Promise.resolve().then(n);
        if (t.dispose) {
          var a = t.dispose.call(t.value);
          if (t.async) return o |= 2, Promise.resolve(a).then(n, function(s) {
            return r(s), n();
          });
        } else o |= 1;
      } catch (s) {
        r(s);
      }
    if (o === 1) return e.hasError ? Promise.reject(e.error) : Promise.resolve();
    if (e.hasError) throw e.error;
  }
  return i(n, "next"), n();
}
function Ue(e, r) {
  return typeof e == "string" && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(t, o, n, a, s) {
    return o ? r ? ".jsx" : ".js" : n && (!a || !s) ? t : n + a + "." + s.toLowerCase() + "js";
  }) : e;
}
var J, M, U, At, X, wt, Pt, We = gt(() => {
  J = /* @__PURE__ */ i(function(e, r) {
    return J = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, o) {
      t.__proto__ = o;
    } || function(t, o) {
      for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && (t[n] = o[n]);
    }, J(e, r);
  }, "extendStatics");
  i(_e, "__extends");
  M = /* @__PURE__ */ i(function() {
    return M = Object.assign || /* @__PURE__ */ i(function(r) {
      for (var t, o = 1, n = arguments.length; o < n; o++) {
        t = arguments[o];
        for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (r[a] = t[a]);
      }
      return r;
    }, "__assign"), M.apply(this, arguments);
  }, "__assign");
  i(ye, "__rest");
  i(Ee, "__decorate");
  i(he, "__param");
  i(Se, "__esDecorate");
  i(ge, "__runInitializers");
  i(Ie, "__propKey");
  i(Te, "__setFunctionName");
  i(Re, "__metadata");
  i(Oe, "__awaiter");
  i(be, "__generator");
  U = Object.create ? function(e, r, t, o) {
    o === void 0 && (o = t);
    var n = Object.getOwnPropertyDescriptor(r, t);
    (!n || ("get" in n ? !r.__esModule : n.writable || n.configurable)) && (n = { enumerable: !0, get: /* @__PURE__ */ i(function() {
      return r[t];
    }, "get") }), Object.defineProperty(e, o, n);
  } : function(e, r, t, o) {
    o === void 0 && (o = t), e[o] = r[t];
  };
  i(ve, "__exportStar");
  i(H, "__values");
  i(z, "__read");
  i(Ae, "__spread");
  i(we, "__spreadArrays");
  i(Pe, "__spreadArray");
  i(P, "__await");
  i(xe, "__asyncGenerator");
  i(Ce, "__asyncDelegator");
  i(Ne, "__asyncValues");
  i(De, "__makeTemplateObject");
  At = Object.create ? function(e, r) {
    Object.defineProperty(e, "default", { enumerable: !0, value: r });
  } : function(e, r) {
    e.default = r;
  }, X = /* @__PURE__ */ i(function(e) {
    return X = Object.getOwnPropertyNames || function(r) {
      var t = [];
      for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (t[t.length] = o);
      return t;
    }, X(e);
  }, "ownKeys");
  i(Le, "__importStar");
  i(Fe, "__importDefault");
  i(Be, "__classPrivateFieldGet");
  i(ke, "__classPrivateFieldSet");
  i(je, "__classPrivateFieldIn");
  i(Me, "__addDisposableResource");
  wt = typeof SuppressedError == "function" ? SuppressedError : function(e, r, t) {
    var o = new Error(t);
    return o.name = "SuppressedError", o.error = e, o.suppressed = r, o;
  };
  i(He, "__disposeResources");
  i(Ue, "__rewriteRelativeImportExtension");
  Pt = {
    __extends: _e,
    __assign: M,
    __rest: ye,
    __decorate: Ee,
    __param: he,
    __esDecorate: Se,
    __runInitializers: ge,
    __propKey: Ie,
    __setFunctionName: Te,
    __metadata: Re,
    __awaiter: Oe,
    __generator: be,
    __createBinding: U,
    __exportStar: ve,
    __values: H,
    __read: z,
    __spread: Ae,
    __spreadArrays: we,
    __spreadArray: Pe,
    __await: P,
    __asyncGenerator: xe,
    __asyncDelegator: Ce,
    __asyncValues: Ne,
    __makeTemplateObject: De,
    __importStar: Le,
    __importDefault: Fe,
    __classPrivateFieldGet: Be,
    __classPrivateFieldSet: ke,
    __classPrivateFieldIn: je,
    __addDisposableResource: Me,
    __disposeResources: He,
    __rewriteRelativeImportExtension: Ue
  };
});

// ../node_modules/@yarnpkg/esbuild-plugin-pnp/lib/index.js
var qe = B((G) => {
  "use strict";
  Object.defineProperty(G, "__esModule", { value: !0 });
  G.pnpPlugin = void 0;
  var Ye = (We(), Tt(Ge)), xt = Ye.__importStar(N("fs")), Ct = Ye.__importDefault(N("path")), Nt = /()/, Dt = [".tsx", ".ts", ".jsx", ".mjs", ".cjs", ".js", ".css", ".json"];
  function Lt(e) {
    return e.map((r) => {
      let t = r.indexOf("*");
      return t !== -1 ? { prefix: r.slice(0, t), suffix: r.slice(t + 1) } : r;
    });
  }
  i(Lt, "parseExternals");
  function Ft(e, r) {
    for (let t of r)
      if (typeof t == "object") {
        if (e.length >= t.prefix.length + t.suffix.length && e.startsWith(t.prefix) && e.endsWith(t.suffix))
          return !0;
      } else if (e === t || !t.startsWith("/") && !t.startsWith("./") && !t.startsWith("../") && t !== "." && t !== ".." && e.startsWith(`${t}/`))
        return !0;
    return !1;
  }
  i(Ft, "isExternal");
  async function Bt(e) {
    return {
      contents: await xt.promises.readFile(e.path),
      loader: "default",
      // For regular imports in the `file` namespace, resolveDir is the directory the
      // file being resolved lives in. For all other virtual modules, this defaults to
      // empty string: ""
      // A sensible value for pnp imports is the same as the `file` namespace, as pnp
      // still resolves to files on disk (in the cache).
      resolveDir: Ct.default.dirname(e.path)
    };
  }
  i(Bt, "defaultOnLoad");
  async function kt(e, { resolvedPath: r, error: t, watchFiles: o }) {
    let n = t ? [{ text: t.message }] : [], a;
    switch (e.kind) {
      case "require-call":
      case "require-resolve":
      case "dynamic-import":
        a = { warnings: n };
        break;
      default:
        a = { errors: n };
        break;
    }
    return r !== null ? { namespace: "pnp", path: r, watchFiles: o } : { external: !0, ...a, watchFiles: o };
  }
  i(kt, "defaultOnResolve");
  function jt({ baseDir: e = process.cwd(), extensions: r = Dt, filter: t = Nt, onResolve: o = kt, onLoad: n = Bt } = {}) {
    return {
      name: "@yarnpkg/esbuild-plugin-pnp",
      setup(a) {
        var s, l;
        let { findPnpApi: u } = N("module");
        if (typeof u > "u")
          return;
        let c = Lt((s = a.initialOptions.external) !== null && s !== void 0 ? s : []), f = (l = a.initialOptions.platform) !== null && l !== void 0 ? l : "browser", _ = f === "node", E = new Set(a.initialOptions.conditions);
        E.add("default"), (f === "browser" || f === "node") && E.add(f);
        let d = new Set(E);
        d.add("import");
        let p = new Set(E);
        p.add("require"), a.onResolve({ filter: t }, (m) => {
          var h, I;
          if (Ft(m.path, c))
            return { external: !0 };
          let b = E;
          m.kind === "dynamic-import" || m.kind === "import-statement" ? b = d : (m.kind === "require-call" || m.kind === "require-resolve") && (b = p);
          let O = m.resolveDir ? `${m.resolveDir}/` : m.importer ? m.importer : `${e}/`, R = u(O);
          if (!R)
            return;
          let g = null, w;
          try {
            g = R.resolveRequest(m.path, O, {
              conditions: b,
              considerBuiltins: _,
              extensions: r
            });
          } catch (F) {
            w = F;
          }
          let le = [R.resolveRequest("pnpapi", null)];
          if (g) {
            let F = R.findPackageLocator(g);
            if (F) {
              let W = R.getPackageInformation(F);
              W?.linkType === "SOFT" && le.push((I = (h = R.resolveVirtual) === null || h === void 0 ? void 0 : h.call(R, g)) !== null && I !== void 0 ? I : g);
            }
          }
          return o(m, { resolvedPath: g, error: w, watchFiles: le });
        }), a.onLoad !== null && a.onLoad({ filter: t }, n);
      }
    };
  }
  i(jt, "pnpPlugin");
  G.pnpPlugin = jt;
});

// ../node_modules/ejs/lib/utils.js
var Xe = B((v) => {
  "use strict";
  var Mt = /[|\\{}()[\]^$+*?.]/g, Ht = Object.prototype.hasOwnProperty, Z = /* @__PURE__ */ i(function(e, r) {
    return Ht.apply(e, [r]);
  }, "hasOwn");
  v.escapeRegExpChars = function(e) {
    return e ? String(e).replace(Mt, "\\$&") : "";
  };
  var Ut = {
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    '"': "&#34;",
    "'": "&#39;"
  }, Gt = /[&<>'"]/g;
  function Wt(e) {
    return Ut[e] || e;
  }
  i(Wt, "encode_char");
  var Yt = `var _ENCODE_HTML_RULES = {
      "&": "&amp;"
    , "<": "&lt;"
    , ">": "&gt;"
    , '"': "&#34;"
    , "'": "&#39;"
    }
  , _MATCH_HTML = /[&<>'"]/g;
function encode_char(c) {
  return _ENCODE_HTML_RULES[c] || c;
};
`;
  v.escapeXML = function(e) {
    return e == null ? "" : String(e).replace(Gt, Wt);
  };
  function Je() {
    return Function.prototype.toString.call(this) + `;
` + Yt;
  }
  i(Je, "escapeXMLToString");
  try {
    typeof Object.defineProperty == "function" ? Object.defineProperty(v.escapeXML, "toString", { value: Je }) : v.escapeXML.toString = Je;
  } catch {
    console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)");
  }
  v.shallowCopy = function(e, r) {
    if (r = r || {}, e != null)
      for (var t in r)
        Z(r, t) && (t === "__proto__" || t === "constructor" || (e[t] = r[t]));
    return e;
  };
  v.shallowCopyFromList = function(e, r, t) {
    if (t = t || [], r = r || {}, e != null)
      for (var o = 0; o < t.length; o++) {
        var n = t[o];
        if (typeof r[n] < "u") {
          if (!Z(r, n) || n === "__proto__" || n === "constructor")
            continue;
          e[n] = r[n];
        }
      }
    return e;
  };
  v.cache = {
    _data: {},
    set: /* @__PURE__ */ i(function(e, r) {
      this._data[e] = r;
    }, "set"),
    get: /* @__PURE__ */ i(function(e) {
      return this._data[e];
    }, "get"),
    remove: /* @__PURE__ */ i(function(e) {
      delete this._data[e];
    }, "remove"),
    reset: /* @__PURE__ */ i(function() {
      this._data = {};
    }, "reset")
  };
  v.hyphenToCamel = function(e) {
    return e.replace(/-[a-z]/g, function(r) {
      return r[1].toUpperCase();
    });
  };
  v.createNullProtoObjWherePossible = function() {
    return typeof Object.create == "function" ? function() {
      return /* @__PURE__ */ Object.create(null);
    } : { __proto__: null } instanceof Object ? function() {
      return {};
    } : function() {
      return { __proto__: null };
    };
  }();
  v.hasOwnOnlyObject = function(e) {
    var r = v.createNullProtoObjWherePossible();
    for (var t in e)
      Z(e, t) && (r[t] = e[t]);
    return r;
  };
});

// ../node_modules/ejs/package.json
var ze = B((ro, qt) => {
  qt.exports = {
    name: "ejs",
    description: "Embedded JavaScript templates",
    keywords: [
      "template",
      "engine",
      "ejs"
    ],
    version: "3.1.10",
    author: "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
    license: "Apache-2.0",
    bin: {
      ejs: "./bin/cli.js"
    },
    main: "./lib/ejs.js",
    jsdelivr: "ejs.min.js",
    unpkg: "ejs.min.js",
    repository: {
      type: "git",
      url: "git://github.com/mde/ejs.git"
    },
    bugs: "https://github.com/mde/ejs/issues",
    homepage: "https://github.com/mde/ejs",
    dependencies: {
      jake: "^10.8.5"
    },
    devDependencies: {
      browserify: "^16.5.1",
      eslint: "^6.8.0",
      "git-directory-deploy": "^1.5.1",
      jsdoc: "^4.0.2",
      "lru-cache": "^4.0.1",
      mocha: "^10.2.0",
      "uglify-js": "^3.3.16"
    },
    engines: {
      node: ">=0.10.0"
    },
    scripts: {
      test: "npx jake test"
    }
  };
});

// ../node_modules/ejs/lib/ejs.js
var it = B((y) => {
  "use strict";
  var te = N("fs"), D = N("path"), S = Xe(), Qe = !1, Vt = ze().version, Kt = "<", $t = ">", Jt = "%", nt = "locals", Xt = "ejs", zt = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)", at = [
    "delimiter",
    "scope",
    "context",
    "debug",
    "compileDebug",
    "client",
    "_with",
    "rmWhitespace",
    "strict",
    "filename",
    "async"
  ], Qt = at.concat("cache"), Ze = /^\uFEFF/, ee = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
  y.cache = S.cache;
  y.fileLoader = te.readFileSync;
  y.localsName = nt;
  y.promiseImpl = new Function("return this;")().Promise;
  y.resolveInclude = function(e, r, t) {
    var o = D.dirname, n = D.extname, a = D.resolve, s = a(t ? r : o(r), e), l = n(e);
    return l || (s += ".ejs"), s;
  };
  function et(e, r) {
    var t;
    if (r.some(function(o) {
      return t = y.resolveInclude(e, o, !0), te.existsSync(t);
    }))
      return t;
  }
  i(et, "resolvePaths");
  function Zt(e, r) {
    var t, o, n = r.views, a = /^[A-Za-z]+:\\|^\//.exec(e);
    if (a && a.length)
      e = e.replace(/^\/*/, ""), Array.isArray(r.root) ? t = et(e, r.root) : t = y.resolveInclude(e, r.root || "/", !0);
    else if (r.filename && (o = y.resolveInclude(e, r.filename), te.existsSync(o) && (t = o)), !t && Array.isArray(n) && (t = et(e, n)), !t && typeof r.includer != "function")
      throw new Error('Could not find the include file "' + r.escapeFunction(e) + '"');
    return t;
  }
  i(Zt, "getIncludePath");
  function L(e, r) {
    var t, o = e.filename, n = arguments.length > 1;
    if (e.cache) {
      if (!o)
        throw new Error("cache option requires a filename");
      if (t = y.cache.get(o), t)
        return t;
      n || (r = tt(o).toString().replace(Ze, ""));
    } else if (!n) {
      if (!o)
        throw new Error("Internal EJS error: no file name or template provided");
      r = tt(o).toString().replace(Ze, "");
    }
    return t = y.compile(r, e), e.cache && y.cache.set(o, t), t;
  }
  i(L, "handleCache");
  function er(e, r, t) {
    var o;
    if (t) {
      try {
        o = L(e)(r);
      } catch (n) {
        return t(n);
      }
      t(null, o);
    } else {
      if (typeof y.promiseImpl == "function")
        return new y.promiseImpl(function(n, a) {
          try {
            o = L(e)(r), n(o);
          } catch (s) {
            a(s);
          }
        });
      throw new Error("Please provide a callback function");
    }
  }
  i(er, "tryHandleCache");
  function tt(e) {
    return y.fileLoader(e);
  }
  i(tt, "fileLoader");
  function tr(e, r) {
    var t = S.shallowCopy(S.createNullProtoObjWherePossible(), r);
    if (t.filename = Zt(e, t), typeof r.includer == "function") {
      var o = r.includer(e, t.filename);
      if (o && (o.filename && (t.filename = o.filename), o.template))
        return L(t, o.template);
    }
    return L(t);
  }
  i(tr, "includeFile");
  function rt(e, r, t, o, n) {
    var a = r.split(`
`), s = Math.max(o - 3, 0), l = Math.min(a.length, o + 3), u = n(t), c = a.slice(s, l).map(function(f, _) {
      var E = _ + s + 1;
      return (E == o ? " >> " : "    ") + E + "| " + f;
    }).join(`
`);
    throw e.path = u, e.message = (u || "ejs") + ":" + o + `
` + c + `

` + e.message, e;
  }
  i(rt, "rethrow");
  function ot(e) {
    return e.replace(/;(\s*$)/, "$1");
  }
  i(ot, "stripSemi");
  y.compile = /* @__PURE__ */ i(function(r, t) {
    var o;
    return t && t.scope && (Qe || (console.warn("`scope` option is deprecated and will be removed in EJS 3"), Qe = !0), t.context || (t.context = t.scope), delete t.scope), o = new T(r, t), o.compile();
  }, "compile");
  y.render = function(e, r, t) {
    var o = r || S.createNullProtoObjWherePossible(), n = t || S.createNullProtoObjWherePossible();
    return arguments.length == 2 && S.shallowCopyFromList(n, o, at), L(n, e)(o);
  };
  y.renderFile = function() {
    var e = Array.prototype.slice.call(arguments), r = e.shift(), t, o = { filename: r }, n, a;
    return typeof arguments[arguments.length - 1] == "function" && (t = e.pop()), e.length ? (n = e.shift(), e.length ? S.shallowCopy(o, e.pop()) : (n.settings && (n.settings.views && (o.views = n.settings.views), n.settings["view cache"] && (o.cache = !0), a = n.settings["view options"], a && S.shallowCopy(o, a)), S.shallowCopyFromList(o, n, Qt)), o.filename = r) : n = S.createNullProtoObjWherePossible(), er(o, n, t);
  };
  y.Template = T;
  y.clearCache = function() {
    y.cache.reset();
  };
  function T(e, r) {
    var t = S.hasOwnOnlyObject(r), o = S.createNullProtoObjWherePossible();
    this.templateText = e, this.mode = null, this.truncate = !1, this.currentLine = 1, this.source = "", o.client = t.client || !1, o.escapeFunction = t.escape || t.escapeFunction || S.escapeXML, o.compileDebug = t.compileDebug !== !1, o.debug = !!t.debug, o.filename = t.filename, o.openDelimiter = t.openDelimiter || y.openDelimiter || Kt, o.closeDelimiter = t.closeDelimiter || y.closeDelimiter || $t, o.delimiter = t.delimiter || y.delimiter || Jt, o.strict = t.strict || !1, o.context = t.context, o.cache = t.cache || !1, o.rmWhitespace = t.rmWhitespace, o.root = t.root, o.includer = t.includer, o.outputFunctionName = t.outputFunctionName, o.localsName = t.localsName || y.localsName || nt, o.views = t.views, o.async = t.async, o.destructuredLocals = t.destructuredLocals, o.legacyInclude = typeof t.legacyInclude < "u" ? !!t.legacyInclude : !0, o.strict ? o._with = !1 : o._with = typeof t._with < "u" ? t._with : !0, this.opts = o, this.regex = this.createRegex();
  }
  i(T, "Template");
  T.modes = {
    EVAL: "eval",
    ESCAPED: "escaped",
    RAW: "raw",
    COMMENT: "comment",
    LITERAL: "literal"
  };
  T.prototype = {
    createRegex: /* @__PURE__ */ i(function() {
      var e = zt, r = S.escapeRegExpChars(this.opts.delimiter), t = S.escapeRegExpChars(this.opts.openDelimiter), o = S.escapeRegExpChars(this.opts.closeDelimiter);
      return e = e.replace(/%/g, r).replace(/</g, t).replace(/>/g, o), new RegExp(e);
    }, "createRegex"),
    compile: /* @__PURE__ */ i(function() {
      var e, r, t = this.opts, o = "", n = "", a = t.escapeFunction, s, l = t.filename ? JSON.stringify(t.filename) : "undefined";
      if (!this.source) {
        if (this.generateSource(), o += `  var __output = "";
  function __append(s) { if (s !== undefined && s !== null) __output += s }
`, t.outputFunctionName) {
          if (!ee.test(t.outputFunctionName))
            throw new Error("outputFunctionName is not a valid JS identifier.");
          o += "  var " + t.outputFunctionName + ` = __append;
`;
        }
        if (t.localsName && !ee.test(t.localsName))
          throw new Error("localsName is not a valid JS identifier.");
        if (t.destructuredLocals && t.destructuredLocals.length) {
          for (var u = "  var __locals = (" + t.localsName + ` || {}),
`, c = 0; c < t.destructuredLocals.length; c++) {
            var f = t.destructuredLocals[c];
            if (!ee.test(f))
              throw new Error("destructuredLocals[" + c + "] is not a valid JS identifier.");
            c > 0 && (u += `,
  `), u += f + " = __locals." + f;
          }
          o += u + `;
`;
        }
        t._with !== !1 && (o += "  with (" + t.localsName + ` || {}) {
`, n += `  }
`), n += `  return __output;
`, this.source = o + this.source + n;
      }
      t.compileDebug ? e = `var __line = 1
  , __lines = ` + JSON.stringify(this.templateText) + `
  , __filename = ` + l + `;
try {
` + this.source + `} catch (e) {
  rethrow(e, __lines, __filename, __line, escapeFn);
}
` : e = this.source, t.client && (e = "escapeFn = escapeFn || " + a.toString() + `;
` + e, t.compileDebug && (e = "rethrow = rethrow || " + rt.toString() + `;
` + e)), t.strict && (e = `"use strict";
` + e), t.debug && console.log(e), t.compileDebug && t.filename && (e = e + `
//# sourceURL=` + l + `
`);
      try {
        if (t.async)
          try {
            s = new Function("return (async function(){}).constructor;")();
          } catch (p) {
            throw p instanceof SyntaxError ? new Error("This environment does not support async/await") : p;
          }
        else
          s = Function;
        r = new s(t.localsName + ", escapeFn, include, rethrow", e);
      } catch (p) {
        throw p instanceof SyntaxError && (t.filename && (p.message += " in " + t.filename), p.message += ` while compiling ejs

`, p.message += `If the above error is not helpful, you may want to try EJS-Lint:
`, p.message += "https://github.com/RyanZim/EJS-Lint", t.async || (p.message += `
`, p.message += "Or, if you meant to create an async function, pass `async: true` as an option.")), p;
      }
      var _ = t.client ? r : /* @__PURE__ */ i(function(m) {
        var h = /* @__PURE__ */ i(function(I, b) {
          var O = S.shallowCopy(S.createNullProtoObjWherePossible(), m);
          return b && (O = S.shallowCopy(O, b)), tr(I, t)(O);
        }, "include");
        return r.apply(
          t.context,
          [m || S.createNullProtoObjWherePossible(), a, h, rt]
        );
      }, "anonymous");
      if (t.filename && typeof Object.defineProperty == "function") {
        var E = t.filename, d = D.basename(E, D.extname(E));
        try {
          Object.defineProperty(_, "name", {
            value: d,
            writable: !1,
            enumerable: !1,
            configurable: !0
          });
        } catch {
        }
      }
      return _;
    }, "compile"),
    generateSource: /* @__PURE__ */ i(function() {
      var e = this.opts;
      e.rmWhitespace && (this.templateText = this.templateText.replace(/[\r\n]+/g, `
`).replace(/^\s+|\s+$/gm, "")), this.templateText = this.templateText.replace(/[ \t]*<%_/gm, "<%_").replace(/_%>[ \t]*/gm, "_%>");
      var r = this, t = this.parseTemplateText(), o = this.opts.delimiter, n = this.opts.openDelimiter, a = this.opts.closeDelimiter;
      t && t.length && t.forEach(function(s, l) {
        var u;
        if (s.indexOf(n + o) === 0 && s.indexOf(n + o + o) !== 0 && (u = t[l + 2], !(u == o + a || u == "-" + o + a || u == "_" + o + a)))
          throw new Error('Could not find matching close tag for "' + s + '".');
        r.scanLine(s);
      });
    }, "generateSource"),
    parseTemplateText: /* @__PURE__ */ i(function() {
      for (var e = this.templateText, r = this.regex, t = r.exec(e), o = [], n; t; )
        n = t.index, n !== 0 && (o.push(e.substring(0, n)), e = e.slice(n)), o.push(t[0]), e = e.slice(t[0].length), t = r.exec(e);
      return e && o.push(e), o;
    }, "parseTemplateText"),
    _addOutput: /* @__PURE__ */ i(function(e) {
      if (this.truncate && (e = e.replace(/^(?:\r\n|\r|\n)/, ""), this.truncate = !1), !e)
        return e;
      e = e.replace(/\\/g, "\\\\"), e = e.replace(/\n/g, "\\n"), e = e.replace(/\r/g, "\\r"), e = e.replace(/"/g, '\\"'), this.source += '    ; __append("' + e + `")
`;
    }, "_addOutput"),
    scanLine: /* @__PURE__ */ i(function(e) {
      var r = this, t = this.opts.delimiter, o = this.opts.openDelimiter, n = this.opts.closeDelimiter, a = 0;
      switch (a = e.split(`
`).length - 1, e) {
        case o + t:
        case o + t + "_":
          this.mode = T.modes.EVAL;
          break;
        case o + t + "=":
          this.mode = T.modes.ESCAPED;
          break;
        case o + t + "-":
          this.mode = T.modes.RAW;
          break;
        case o + t + "#":
          this.mode = T.modes.COMMENT;
          break;
        case o + t + t:
          this.mode = T.modes.LITERAL, this.source += '    ; __append("' + e.replace(o + t + t, o + t) + `")
`;
          break;
        case t + t + n:
          this.mode = T.modes.LITERAL, this.source += '    ; __append("' + e.replace(t + t + n, t + n) + `")
`;
          break;
        case t + n:
        case "-" + t + n:
        case "_" + t + n:
          this.mode == T.modes.LITERAL && this._addOutput(e), this.mode = null, this.truncate = e.indexOf("-") === 0 || e.indexOf("_") === 0;
          break;
        default:
          if (this.mode) {
            switch (this.mode) {
              case T.modes.EVAL:
              case T.modes.ESCAPED:
              case T.modes.RAW:
                e.lastIndexOf("//") > e.lastIndexOf(`
`) && (e += `
`);
            }
            switch (this.mode) {
              // Just executing code
              case T.modes.EVAL:
                this.source += "    ; " + e + `
`;
                break;
              // Exec, esc, and output
              case T.modes.ESCAPED:
                this.source += "    ; __append(escapeFn(" + ot(e) + `))
`;
                break;
              // Exec and output
              case T.modes.RAW:
                this.source += "    ; __append(" + ot(e) + `)
`;
                break;
              case T.modes.COMMENT:
                break;
              // Literal <%% mode, append as raw output
              case T.modes.LITERAL:
                this._addOutput(e);
                break;
            }
          } else
            this._addOutput(e);
      }
      r.opts.compileDebug && a && (this.currentLine += a, this.source += "    ; __line = " + this.currentLine + `
`);
    }, "scanLine")
  };
  y.escapeXML = S.escapeXML;
  y.__express = y.renderFile;
  y.VERSION = Vt;
  y.name = Xt;
  typeof window < "u" && (window.ejs = y);
});

// src/builder-manager/index.ts
import { cp as br, rm as vr, writeFile as Et } from "node:fs/promises";
import { stringifyProcessEnvs as Ar } from "storybook/internal/common";
import { logger as se } from "storybook/internal/node-logger";

// ../node_modules/@fal-works/esbuild-plugin-global-externals/lib/module-info.js
var de = /* @__PURE__ */ i((e) => {
  let {
    type: r = "esm",
    varName: t,
    namedExports: o = null,
    defaultExport: n = !0
  } = typeof e == "string" ? { varName: e } : e;
  return { type: r, varName: t, namedExports: o, defaultExport: n };
}, "normalizeModuleInfo");

// ../node_modules/@fal-works/esbuild-plugin-global-externals/lib/on-load.js
var bt = /* @__PURE__ */ i((e) => `module.exports = ${e};`, "createCjsContents");
var vt = /* @__PURE__ */ i((e, r, t) => {
  let o = t ? [`export default ${e};`] : [];
  if (r && r.length) {
    let n = [...new Set(r)].join(", ");
    o.push(`const { ${n} } = ${e};`), o.push(`export { ${n} };`);
  }
  return o.join(`
`);
}, "createEsmContents"), me = /* @__PURE__ */ i((e) => {
  let { type: r, varName: t, namedExports: o, defaultExport: n } = e;
  switch (r) {
    case "esm":
      return vt(t, o, n);
    case "cjs":
      return bt(t);
  }
}, "createContents");

// ../node_modules/@fal-works/esbuild-plugin-global-externals/lib/with-reg-exp.js
var V = "global-externals", K = /* @__PURE__ */ i((e) => {
  let { modulePathFilter: r, getModuleInfo: t } = e;
  return {
    name: V,
    setup(o) {
      o.onResolve({ filter: r }, (n) => ({
        path: n.path,
        namespace: V
      })), o.onLoad({ filter: /.*/, namespace: V }, (n) => {
        let a = n.path, s = de(t(a));
        return { contents: me(s) };
      });
    }
  };
}, "globalExternalsWithRegExp");

// ../node_modules/@fal-works/esbuild-plugin-global-externals/lib/with-object.js
var $ = /* @__PURE__ */ i((e) => {
  let r = {
    modulePathFilter: new RegExp(`^(?:${Object.keys(e).join("|")})$`),
    getModuleInfo: /* @__PURE__ */ i((t) => e[t], "getModuleInfo")
  };
  return K(r);
}, "globalExternals");

// src/builder-manager/index.ts
var ht = Y(qe(), 1);
var ce = Y(Rt(), 1);

// src/manager/globals/exports.ts
var Ve = {
  react: [
    "Children",
    "Component",
    "Fragment",
    "Profiler",
    "PureComponent",
    "StrictMode",
    "Suspense",
    "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
    "act",
    "cloneElement",
    "createContext",
    "createElement",
    "createFactory",
    "createRef",
    "forwardRef",
    "isValidElement",
    "lazy",
    "memo",
    "startTransition",
    "unstable_act",
    "useCallback",
    "useContext",
    "useDebugValue",
    "useDeferredValue",
    "useEffect",
    "useId",
    "useImperativeHandle",
    "useInsertionEffect",
    "useLayoutEffect",
    "useMemo",
    "useReducer",
    "useRef",
    "useState",
    "useSyncExternalStore",
    "useTransition",
    "version"
  ],
  "react-dom": [
    "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
    "createPortal",
    "createRoot",
    "findDOMNode",
    "flushSync",
    "hydrate",
    "hydrateRoot",
    "render",
    "unmountComponentAtNode",
    "unstable_batchedUpdates",
    "unstable_renderSubtreeIntoContainer",
    "version"
  ],
  "react-dom/client": ["createRoot", "hydrateRoot"],
  "@storybook/icons": [
    "AccessibilityAltIcon",
    "AccessibilityIcon",
    "AccessibilityIgnoredIcon",
    "AddIcon",
    "AdminIcon",
    "AlertAltIcon",
    "AlertIcon",
    "AlignLeftIcon",
    "AlignRightIcon",
    "AppleIcon",
    "ArrowBottomLeftIcon",
    "ArrowBottomRightIcon",
    "ArrowDownIcon",
    "ArrowLeftIcon",
    "ArrowRightIcon",
    "ArrowSolidDownIcon",
    "ArrowSolidLeftIcon",
    "ArrowSolidRightIcon",
    "ArrowSolidUpIcon",
    "ArrowTopLeftIcon",
    "ArrowTopRightIcon",
    "ArrowUpIcon",
    "AzureDevOpsIcon",
    "BackIcon",
    "BasketIcon",
    "BatchAcceptIcon",
    "BatchDenyIcon",
    "BeakerIcon",
    "BellIcon",
    "BitbucketIcon",
    "BoldIcon",
    "BookIcon",
    "BookmarkHollowIcon",
    "BookmarkIcon",
    "BottomBarIcon",
    "BottomBarToggleIcon",
    "BoxIcon",
    "BranchIcon",
    "BrowserIcon",
    "ButtonIcon",
    "CPUIcon",
    "CalendarIcon",
    "CameraIcon",
    "CameraStabilizeIcon",
    "CategoryIcon",
    "CertificateIcon",
    "ChangedIcon",
    "ChatIcon",
    "CheckIcon",
    "ChevronDownIcon",
    "ChevronLeftIcon",
    "ChevronRightIcon",
    "ChevronSmallDownIcon",
    "ChevronSmallLeftIcon",
    "ChevronSmallRightIcon",
    "ChevronSmallUpIcon",
    "ChevronUpIcon",
    "ChromaticIcon",
    "ChromeIcon",
    "CircleHollowIcon",
    "CircleIcon",
    "ClearIcon",
    "CloseAltIcon",
    "CloseIcon",
    "CloudHollowIcon",
    "CloudIcon",
    "CogIcon",
    "CollapseIcon",
    "CommandIcon",
    "CommentAddIcon",
    "CommentIcon",
    "CommentsIcon",
    "CommitIcon",
    "CompassIcon",
    "ComponentDrivenIcon",
    "ComponentIcon",
    "ContrastIcon",
    "ContrastIgnoredIcon",
    "ControlsIcon",
    "CopyIcon",
    "CreditIcon",
    "CrossIcon",
    "DashboardIcon",
    "DatabaseIcon",
    "DeleteIcon",
    "DiamondIcon",
    "DirectionIcon",
    "DiscordIcon",
    "DocChartIcon",
    "DocListIcon",
    "DocumentIcon",
    "DownloadIcon",
    "DragIcon",
    "EditIcon",
    "EllipsisIcon",
    "EmailIcon",
    "ExpandAltIcon",
    "ExpandIcon",
    "EyeCloseIcon",
    "EyeIcon",
    "FaceHappyIcon",
    "FaceNeutralIcon",
    "FaceSadIcon",
    "FacebookIcon",
    "FailedIcon",
    "FastForwardIcon",
    "FigmaIcon",
    "FilterIcon",
    "FlagIcon",
    "FolderIcon",
    "FormIcon",
    "GDriveIcon",
    "GithubIcon",
    "GitlabIcon",
    "GlobeIcon",
    "GoogleIcon",
    "GraphBarIcon",
    "GraphLineIcon",
    "GraphqlIcon",
    "GridAltIcon",
    "GridIcon",
    "GrowIcon",
    "HeartHollowIcon",
    "HeartIcon",
    "HomeIcon",
    "HourglassIcon",
    "InfoIcon",
    "ItalicIcon",
    "JumpToIcon",
    "KeyIcon",
    "LightningIcon",
    "LightningOffIcon",
    "LinkBrokenIcon",
    "LinkIcon",
    "LinkedinIcon",
    "LinuxIcon",
    "ListOrderedIcon",
    "ListUnorderedIcon",
    "LocationIcon",
    "LockIcon",
    "MarkdownIcon",
    "MarkupIcon",
    "MediumIcon",
    "MemoryIcon",
    "MenuIcon",
    "MergeIcon",
    "MirrorIcon",
    "MobileIcon",
    "MoonIcon",
    "NutIcon",
    "OutboxIcon",
    "OutlineIcon",
    "PaintBrushIcon",
    "PaperClipIcon",
    "ParagraphIcon",
    "PassedIcon",
    "PhoneIcon",
    "PhotoDragIcon",
    "PhotoIcon",
    "PhotoStabilizeIcon",
    "PinAltIcon",
    "PinIcon",
    "PlayAllHollowIcon",
    "PlayBackIcon",
    "PlayHollowIcon",
    "PlayIcon",
    "PlayNextIcon",
    "PlusIcon",
    "PointerDefaultIcon",
    "PointerHandIcon",
    "PowerIcon",
    "PrintIcon",
    "ProceedIcon",
    "ProfileIcon",
    "PullRequestIcon",
    "QuestionIcon",
    "RSSIcon",
    "RedirectIcon",
    "ReduxIcon",
    "RefreshIcon",
    "ReplyIcon",
    "RepoIcon",
    "RequestChangeIcon",
    "RewindIcon",
    "RulerIcon",
    "SaveIcon",
    "SearchIcon",
    "ShareAltIcon",
    "ShareIcon",
    "ShieldIcon",
    "SideBySideIcon",
    "SidebarAltIcon",
    "SidebarAltToggleIcon",
    "SidebarIcon",
    "SidebarToggleIcon",
    "SpeakerIcon",
    "StackedIcon",
    "StarHollowIcon",
    "StarIcon",
    "StatusFailIcon",
    "StatusIcon",
    "StatusPassIcon",
    "StatusWarnIcon",
    "StickerIcon",
    "StopAltHollowIcon",
    "StopAltIcon",
    "StopIcon",
    "StorybookIcon",
    "StructureIcon",
    "SubtractIcon",
    "SunIcon",
    "SupportIcon",
    "SweepIcon",
    "SwitchAltIcon",
    "SyncIcon",
    "TabletIcon",
    "ThumbsUpIcon",
    "TimeIcon",
    "TimerIcon",
    "TransferIcon",
    "TrashIcon",
    "TwitterIcon",
    "TypeIcon",
    "UbuntuIcon",
    "UndoIcon",
    "UnfoldIcon",
    "UnlockIcon",
    "UnpinIcon",
    "UploadIcon",
    "UserAddIcon",
    "UserAltIcon",
    "UserIcon",
    "UsersIcon",
    "VSCodeIcon",
    "VerifiedIcon",
    "VideoIcon",
    "WandIcon",
    "WatchIcon",
    "WindowsIcon",
    "WrenchIcon",
    "XIcon",
    "YoutubeIcon",
    "ZoomIcon",
    "ZoomOutIcon",
    "ZoomResetIcon",
    "iconList"
  ],
  "storybook/manager-api": [
    "ActiveTabs",
    "Consumer",
    "ManagerContext",
    "Provider",
    "RequestResponseError",
    "addons",
    "combineParameters",
    "controlOrMetaKey",
    "controlOrMetaSymbol",
    "eventMatchesShortcut",
    "eventToShortcut",
    "experimental_MockUniversalStore",
    "experimental_UniversalStore",
    "experimental_getStatusStore",
    "experimental_getTestProviderStore",
    "experimental_requestResponse",
    "experimental_useStatusStore",
    "experimental_useTestProviderStore",
    "experimental_useUniversalStore",
    "internal_fullStatusStore",
    "internal_fullTestProviderStore",
    "internal_universalStatusStore",
    "internal_universalTestProviderStore",
    "isMacLike",
    "isShortcutTaken",
    "keyToSymbol",
    "merge",
    "mockChannel",
    "optionOrAltSymbol",
    "shortcutMatchesShortcut",
    "shortcutToHumanString",
    "types",
    "useAddonState",
    "useArgTypes",
    "useArgs",
    "useChannel",
    "useGlobalTypes",
    "useGlobals",
    "useParameter",
    "useSharedState",
    "useStoryPrepared",
    "useStorybookApi",
    "useStorybookState"
  ],
  "storybook/theming": [
    "CacheProvider",
    "ClassNames",
    "Global",
    "ThemeProvider",
    "background",
    "color",
    "convert",
    "create",
    "createCache",
    "createGlobal",
    "createReset",
    "css",
    "darken",
    "ensure",
    "ignoreSsrWarning",
    "isPropValid",
    "jsx",
    "keyframes",
    "lighten",
    "styled",
    "themes",
    "typography",
    "useTheme",
    "withTheme"
  ],
  "storybook/theming/create": ["create", "themes"],
  "storybook/test": [
    "buildQueries",
    "clearAllMocks",
    "configure",
    "createEvent",
    "expect",
    "findAllByAltText",
    "findAllByDisplayValue",
    "findAllByLabelText",
    "findAllByPlaceholderText",
    "findAllByRole",
    "findAllByTestId",
    "findAllByText",
    "findAllByTitle",
    "findByAltText",
    "findByDisplayValue",
    "findByLabelText",
    "findByPlaceholderText",
    "findByRole",
    "findByTestId",
    "findByText",
    "findByTitle",
    "fireEvent",
    "fn",
    "getAllByAltText",
    "getAllByDisplayValue",
    "getAllByLabelText",
    "getAllByPlaceholderText",
    "getAllByRole",
    "getAllByTestId",
    "getAllByText",
    "getAllByTitle",
    "getByAltText",
    "getByDisplayValue",
    "getByLabelText",
    "getByPlaceholderText",
    "getByRole",
    "getByTestId",
    "getByText",
    "getByTitle",
    "getConfig",
    "getDefaultNormalizer",
    "getElementError",
    "getNodeText",
    "getQueriesForElement",
    "getRoles",
    "getSuggestedQuery",
    "isInaccessible",
    "isMockFunction",
    "logDOM",
    "logRoles",
    "mocked",
    "mocks",
    "onMockCall",
    "prettyDOM",
    "prettyFormat",
    "queries",
    "queryAllByAltText",
    "queryAllByAttribute",
    "queryAllByDisplayValue",
    "queryAllByLabelText",
    "queryAllByPlaceholderText",
    "queryAllByRole",
    "queryAllByTestId",
    "queryAllByText",
    "queryAllByTitle",
    "queryByAltText",
    "queryByAttribute",
    "queryByDisplayValue",
    "queryByLabelText",
    "queryByPlaceholderText",
    "queryByRole",
    "queryByTestId",
    "queryByText",
    "queryByTitle",
    "queryHelpers",
    "resetAllMocks",
    "restoreAllMocks",
    "screen",
    "spyOn",
    "uninstrumentedUserEvent",
    "userEvent",
    "waitFor",
    "waitForElementToBeRemoved",
    "within"
  ],
  "storybook/internal/channels": [
    "Channel",
    "HEARTBEAT_INTERVAL",
    "HEARTBEAT_MAX_LATENCY",
    "PostMessageTransport",
    "WebsocketTransport",
    "createBrowserChannel"
  ],
  "storybook/internal/client-logger": ["deprecate", "logger", "once", "pretty"],
  "storybook/internal/components": [
    "A",
    "ActionBar",
    "AddonPanel",
    "Badge",
    "Bar",
    "Blockquote",
    "Button",
    "ClipboardCode",
    "Code",
    "DL",
    "Div",
    "DocumentWrapper",
    "EmptyTabContent",
    "ErrorFormatter",
    "FlexBar",
    "Form",
    "H1",
    "H2",
    "H3",
    "H4",
    "H5",
    "H6",
    "HR",
    "IconButton",
    "Img",
    "LI",
    "Link",
    "ListItem",
    "Loader",
    "Modal",
    "OL",
    "P",
    "Placeholder",
    "Pre",
    "ProgressSpinner",
    "ResetWrapper",
    "ScrollArea",
    "Separator",
    "Spaced",
    "Span",
    "StorybookIcon",
    "StorybookLogo",
    "SyntaxHighlighter",
    "TT",
    "TabBar",
    "TabButton",
    "TabWrapper",
    "Table",
    "Tabs",
    "TabsState",
    "TooltipLinkList",
    "TooltipMessage",
    "TooltipNote",
    "UL",
    "WithTooltip",
    "WithTooltipPure",
    "Zoom",
    "codeCommon",
    "components",
    "createCopyToClipboardFunction",
    "getStoryHref",
    "interleaveSeparators",
    "nameSpaceClassNames",
    "resetComponents",
    "withReset"
  ],
  "storybook/internal/core-errors": [
    "ARGTYPES_INFO_REQUEST",
    "ARGTYPES_INFO_RESPONSE",
    "CHANNEL_CREATED",
    "CHANNEL_WS_DISCONNECT",
    "CONFIG_ERROR",
    "CREATE_NEW_STORYFILE_REQUEST",
    "CREATE_NEW_STORYFILE_RESPONSE",
    "CURRENT_STORY_WAS_SET",
    "DOCS_PREPARED",
    "DOCS_RENDERED",
    "FILE_COMPONENT_SEARCH_REQUEST",
    "FILE_COMPONENT_SEARCH_RESPONSE",
    "FORCE_REMOUNT",
    "FORCE_RE_RENDER",
    "GLOBALS_UPDATED",
    "NAVIGATE_URL",
    "PLAY_FUNCTION_THREW_EXCEPTION",
    "PRELOAD_ENTRIES",
    "PREVIEW_BUILDER_PROGRESS",
    "PREVIEW_KEYDOWN",
    "REGISTER_SUBSCRIPTION",
    "REQUEST_WHATS_NEW_DATA",
    "RESET_STORY_ARGS",
    "RESULT_WHATS_NEW_DATA",
    "SAVE_STORY_REQUEST",
    "SAVE_STORY_RESPONSE",
    "SELECT_STORY",
    "SET_CONFIG",
    "SET_CURRENT_STORY",
    "SET_FILTER",
    "SET_GLOBALS",
    "SET_INDEX",
    "SET_STORIES",
    "SET_WHATS_NEW_CACHE",
    "SHARED_STATE_CHANGED",
    "SHARED_STATE_SET",
    "STORIES_COLLAPSE_ALL",
    "STORIES_EXPAND_ALL",
    "STORY_ARGS_UPDATED",
    "STORY_CHANGED",
    "STORY_ERRORED",
    "STORY_FINISHED",
    "STORY_HOT_UPDATED",
    "STORY_INDEX_INVALIDATED",
    "STORY_MISSING",
    "STORY_PREPARED",
    "STORY_RENDERED",
    "STORY_RENDER_PHASE_CHANGED",
    "STORY_SPECIFIED",
    "STORY_THREW_EXCEPTION",
    "STORY_UNCHANGED",
    "TELEMETRY_ERROR",
    "TOGGLE_WHATS_NEW_NOTIFICATIONS",
    "UNHANDLED_ERRORS_WHILE_PLAYING",
    "UPDATE_GLOBALS",
    "UPDATE_QUERY_PARAMS",
    "UPDATE_STORY_ARGS"
  ],
  "storybook/internal/core-events": [
    "ARGTYPES_INFO_REQUEST",
    "ARGTYPES_INFO_RESPONSE",
    "CHANNEL_CREATED",
    "CHANNEL_WS_DISCONNECT",
    "CONFIG_ERROR",
    "CREATE_NEW_STORYFILE_REQUEST",
    "CREATE_NEW_STORYFILE_RESPONSE",
    "CURRENT_STORY_WAS_SET",
    "DOCS_PREPARED",
    "DOCS_RENDERED",
    "FILE_COMPONENT_SEARCH_REQUEST",
    "FILE_COMPONENT_SEARCH_RESPONSE",
    "FORCE_REMOUNT",
    "FORCE_RE_RENDER",
    "GLOBALS_UPDATED",
    "NAVIGATE_URL",
    "PLAY_FUNCTION_THREW_EXCEPTION",
    "PRELOAD_ENTRIES",
    "PREVIEW_BUILDER_PROGRESS",
    "PREVIEW_KEYDOWN",
    "REGISTER_SUBSCRIPTION",
    "REQUEST_WHATS_NEW_DATA",
    "RESET_STORY_ARGS",
    "RESULT_WHATS_NEW_DATA",
    "SAVE_STORY_REQUEST",
    "SAVE_STORY_RESPONSE",
    "SELECT_STORY",
    "SET_CONFIG",
    "SET_CURRENT_STORY",
    "SET_FILTER",
    "SET_GLOBALS",
    "SET_INDEX",
    "SET_STORIES",
    "SET_WHATS_NEW_CACHE",
    "SHARED_STATE_CHANGED",
    "SHARED_STATE_SET",
    "STORIES_COLLAPSE_ALL",
    "STORIES_EXPAND_ALL",
    "STORY_ARGS_UPDATED",
    "STORY_CHANGED",
    "STORY_ERRORED",
    "STORY_FINISHED",
    "STORY_HOT_UPDATED",
    "STORY_INDEX_INVALIDATED",
    "STORY_MISSING",
    "STORY_PREPARED",
    "STORY_RENDERED",
    "STORY_RENDER_PHASE_CHANGED",
    "STORY_SPECIFIED",
    "STORY_THREW_EXCEPTION",
    "STORY_UNCHANGED",
    "TELEMETRY_ERROR",
    "TOGGLE_WHATS_NEW_NOTIFICATIONS",
    "UNHANDLED_ERRORS_WHILE_PLAYING",
    "UPDATE_GLOBALS",
    "UPDATE_QUERY_PARAMS",
    "UPDATE_STORY_ARGS"
  ],
  "storybook/internal/manager-errors": [
    "Category",
    "ProviderDoesNotExtendBaseProviderError",
    "StatusTypeIdMismatchError",
    "UncaughtManagerError"
  ],
  "storybook/internal/router": [
    "BaseLocationProvider",
    "DEEPLY_EQUAL",
    "Link",
    "Location",
    "LocationProvider",
    "Match",
    "Route",
    "buildArgsParam",
    "deepDiff",
    "getMatch",
    "parsePath",
    "queryFromLocation",
    "stringifyQuery",
    "useNavigate"
  ],
  "storybook/internal/types": ["Addon_TypesEnum"],
  "storybook/internal/manager-api": [
    "ActiveTabs",
    "Consumer",
    "ManagerContext",
    "Provider",
    "RequestResponseError",
    "addons",
    "combineParameters",
    "controlOrMetaKey",
    "controlOrMetaSymbol",
    "eventMatchesShortcut",
    "eventToShortcut",
    "experimental_MockUniversalStore",
    "experimental_UniversalStore",
    "experimental_getStatusStore",
    "experimental_getTestProviderStore",
    "experimental_requestResponse",
    "experimental_useStatusStore",
    "experimental_useTestProviderStore",
    "experimental_useUniversalStore",
    "internal_fullStatusStore",
    "internal_fullTestProviderStore",
    "internal_universalStatusStore",
    "internal_universalTestProviderStore",
    "isMacLike",
    "isShortcutTaken",
    "keyToSymbol",
    "merge",
    "mockChannel",
    "optionOrAltSymbol",
    "shortcutMatchesShortcut",
    "shortcutToHumanString",
    "types",
    "useAddonState",
    "useArgTypes",
    "useArgs",
    "useChannel",
    "useGlobalTypes",
    "useGlobals",
    "useParameter",
    "useSharedState",
    "useStoryPrepared",
    "useStorybookApi",
    "useStorybookState"
  ],
  "storybook/internal/theming": [
    "CacheProvider",
    "ClassNames",
    "Global",
    "ThemeProvider",
    "background",
    "color",
    "convert",
    "create",
    "createCache",
    "createGlobal",
    "createReset",
    "css",
    "darken",
    "ensure",
    "ignoreSsrWarning",
    "isPropValid",
    "jsx",
    "keyframes",
    "lighten",
    "styled",
    "themes",
    "typography",
    "useTheme",
    "withTheme"
  ],
  "storybook/internal/theming/create": ["create", "themes"]
};

// src/manager/globals/globals.ts
var Q = {
  react: "__REACT__",
  "react-dom": "__REACT_DOM__",
  "react-dom/client": "__REACT_DOM_CLIENT__",
  "@storybook/icons": "__STORYBOOK_ICONS__",
  "storybook/manager-api": "__STORYBOOK_API__",
  "storybook/test": "__STORYBOOK_TEST__",
  "storybook/theming": "__STORYBOOK_THEMING__",
  "storybook/theming/create": "__STORYBOOK_THEMING_CREATE__",
  "storybook/internal/channels": "__STORYBOOK_CHANNELS__",
  "storybook/internal/client-logger": "__STORYBOOK_CLIENT_LOGGER__",
  "storybook/internal/components": "__STORYBOOK_COMPONENTS__",
  "storybook/internal/core-errors": "__STORYBOOK_CORE_EVENTS__",
  "storybook/internal/core-events": "__STORYBOOK_CORE_EVENTS__",
  "storybook/internal/manager-errors": "__STORYBOOK_CORE_EVENTS_MANAGER_ERRORS__",
  "storybook/internal/router": "__STORYBOOK_ROUTER__",
  "storybook/internal/types": "__STORYBOOK_TYPES__",
  // @deprecated TODO: delete in 9.1
  "storybook/internal/manager-api": "__STORYBOOK_API__",
  "storybook/internal/theming": "__STORYBOOK_THEMING__",
  "storybook/internal/theming/create": "__STORYBOOK_THEMING_CREATE__"
}, Ke = Object.keys(Q);

// src/manager/globals/globals-module-info.ts
var $e = Ke.reduce(
  (e, r) => (e[r] = {
    type: "esm",
    varName: Q[r],
    namedExports: Ve[r],
    defaultExport: !0
  }, e),
  {}
);

// src/builder-manager/utils/data.ts
import { basename as or } from "node:path";
import { getRefs as nr } from "storybook/internal/common";

// src/builder-manager/utils/template.ts
var st = Y(it(), 1);
import { readFile as rr } from "node:fs/promises";
var re = /* @__PURE__ */ i((e) => A(k("storybook"), "assets/server", e), "getTemplatePath"), ct = /* @__PURE__ */ i(async (e) => {
  let r = re(e);
  return rr(r, { encoding: "utf8" });
}, "readTemplate");
var oe = /* @__PURE__ */ i(async (e, r, t, o, n, a, s, l, u, c, f, { versionCheck: _, previewUrl: E, configType: d, ignorePreview: p }, m) => {
  let h = await r, I = await e, b = Object.entries(m).reduce(
    (O, [R, g]) => ({ ...O, [R]: JSON.stringify(g) }),
    {}
  );
  return (0, st.render)(I, {
    title: h ? `${h} - Storybook` : "Storybook",
    files: { js: a, css: n },
    favicon: await t,
    globals: {
      FEATURES: JSON.stringify(await s, null, 2),
      REFS: JSON.stringify(await l, null, 2),
      LOGLEVEL: JSON.stringify(await u, null, 2),
      DOCS_OPTIONS: JSON.stringify(await c, null, 2),
      CONFIG_TYPE: JSON.stringify(await d, null, 2),
      // These two need to be double stringified because the UI expects a string
      VERSIONCHECK: JSON.stringify(JSON.stringify(_), null, 2),
      PREVIEW_URL: JSON.stringify(E, null, 2),
      // global preview URL
      TAGS_OPTIONS: JSON.stringify(await f, null, 2),
      ...b
    },
    head: await o || "",
    ignorePreview: p
  });
}, "renderHTML");

// src/builder-manager/utils/data.ts
var ne = /* @__PURE__ */ i(async (e) => {
  let r = nr(e), t = e.presets.apply("favicon").then((E) => or(E)), o = e.presets.apply("features"), n = e.presets.apply("logLevel"), a = e.presets.apply("title"), s = e.presets.apply("docs", {}), l = e.presets.apply("tags", {}), u = ct("template.ejs"), c = e.presets.apply("managerHead"), [f, _] = await Promise.all([
    //
    ut.get(),
    lt(e)
  ]);
  return {
    refs: r,
    features: o,
    title: a,
    docsOptions: s,
    template: u,
    customHead: c,
    instance: f,
    config: _,
    logLevel: n,
    favicon: t,
    tagsOptions: l
  };
}, "getData");

// src/builder-manager/utils/files.ts
import { existsSync as ar } from "node:fs";
import { mkdir as ir, writeFile as sr } from "node:fs/promises";
import { dirname as cr, join as lr, normalize as ur } from "node:path";
async function ae(e, r) {
  let t = await Promise.all(
    r?.map(async (a) => {
      let { location: s, url: l } = fr(a, e);
      if (!ar(s)) {
        let u = cr(s);
        await ir(u, { recursive: !0 });
      }
      return await sr(s, a.contents), l;
    }) || []
  ), o = t.filter((a) => a.endsWith(".js"));
  return { cssFiles: t.filter((a) => a.endsWith(".css")), jsFiles: o };
}
i(ae, "readOrderedFiles");
function fr(e, r) {
  let t = e.path.replace(r, ""), o = ur(lr(r, t)), n = `./sb-addons${j(t).split("/").map(encodeURIComponent).join("/")}`;
  return { location: o, url: n };
}
i(fr, "sanitizePath");

// src/builder-manager/utils/framework.ts
import { sep as pr } from "node:path";
import {
  extractProperRendererNameFromFramework as ft,
  getFrameworkName as dr
} from "storybook/internal/common";
var pt = /* @__PURE__ */ i((e) => {
  if (e)
    return typeof e == "string" ? e : e.name;
}, "pluckNameFromConfigProperty"), dt = /* @__PURE__ */ i((e) => e.replaceAll(pr, "/"), "normalizePath"), mr = /* @__PURE__ */ i((e) => dt(e).match(/(@storybook\/.*)$/)?.[1], "pluckStorybookPackageFromPath"), _r = /* @__PURE__ */ i((e) => dt(e).split("node_modules/")[1] ?? e, "pluckThirdPartyPackageFromPath"), ie = /* @__PURE__ */ i(async (e) => {
  let r = {}, { builder: t } = await e.presets.apply("core"), o = await dr(e);
  await ft(o) && (r.STORYBOOK_RENDERER = await ft(o) ?? void 0);
  let a = pt(t);
  a && (r.STORYBOOK_BUILDER = mr(a) ?? _r(a));
  let s = pt(await e.presets.apply("framework"));
  return s && (r.STORYBOOK_FRAMEWORK = s), r;
}, "buildFrameworkGlobalsFromOptions");

// src/builder-manager/utils/managerEntries.ts
import { existsSync as yr } from "node:fs";
import { mkdir as Er, writeFile as hr } from "node:fs/promises";
import { dirname as Sr, join as mt, parse as gr, relative as Ir, sep as Tr } from "node:path";
import { resolvePathInStorybookCache as Rr } from "storybook/internal/common";
var _t = /* @__PURE__ */ i((e) => e.replaceAll(".", "").replaceAll("@", "").replaceAll(Tr, "-").replaceAll("/", "-").replaceAll(new RegExp(/^(-)+/g), ""), "sanitizeBase"), Or = /* @__PURE__ */ i((e) => {
  let r = e.split(/-?node_modules-?/);
  return r[r.length - 1].replaceAll("storybook-addon-", "").replaceAll("dist-", "");
}, "sanitizeFinal");
async function yt(e, r) {
  return Promise.all(
    e.map(async (t, o) => {
      let { name: n, dir: a } = gr(t), s = Rr("sb-manager", r);
      if (!s)
        throw new Error("Could not create/find cache directory");
      let l = Ir(process.cwd(), a), u = mt(
        s,
        Or(mt(`${_t(l)}-${o}`, `${_t(n)}-bundle.js`))
      );
      if (!yr(u)) {
        let c = Sr(u);
        await Er(c, { recursive: !0 });
      }
      return await hr(u, `import '${j(t).replaceAll(/'/g, "\\'")}';`), u;
    })
  );
}
i(yt, "wrapManagerEntries");

// src/builder-manager/index.ts
var St = A(k("storybook"), "dist/manager"), wr = /^\/($|\?)/, x, C, lt = /* @__PURE__ */ i(async (e) => {
  let [r, t] = await Promise.all([
    e.presets.apply("managerEntries", []),
    e.presets.apply("env")
  ]), o = re("addon.tsconfig.json"), n;
  try {
    n = fe("./manager", {
      url: e.configDir,
      extensions: [".js", ".mjs", ".jsx", ".ts", ".mts", ".tsx"]
    });
  } catch {
  }
  let a = n ? [...r, n] : r;
  return {
    entryPoints: await yt(a, e.cacheKey),
    outdir: A(e.outputDir || "./", "sb-addons"),
    format: "iife",
    write: !1,
    ignoreAnnotations: !0,
    resolveExtensions: [".ts", ".tsx", ".mjs", ".js", ".jsx"],
    outExtension: { ".js": ".js" },
    loader: {
      ".js": "jsx",
      // media
      ".png": "dataurl",
      ".gif": "dataurl",
      ".jpg": "dataurl",
      ".jpeg": "dataurl",
      ".svg": "dataurl",
      ".webp": "dataurl",
      ".webm": "dataurl",
      ".mp3": "dataurl",
      // modern fonts
      ".woff2": "dataurl",
      // legacy font formats
      ".woff": "dataurl",
      ".eot": "dataurl",
      ".ttf": "dataurl"
    },
    target: q,
    supported: pe,
    platform: "browser",
    bundle: !0,
    minify: !1,
    minifyWhitespace: !1,
    minifyIdentifiers: !1,
    minifySyntax: !0,
    metafile: !1,
    // turn this on to assist with debugging the bundling of managerEntries
    // treeShaking: true,
    sourcemap: !1,
    conditions: ["browser", "module", "default"],
    jsxFactory: "React.createElement",
    jsxFragment: "React.Fragment",
    jsx: "transform",
    jsxImportSource: "react",
    tsconfig: o,
    legalComments: "external",
    plugins: [$($e), (0, ht.pnpPlugin)()],
    banner: {
      js: "try{"
    },
    footer: {
      js: '}catch(e){ console.error("[Storybook] One of your manager-entries failed: " + import.meta.url, e); }'
    },
    define: {
      "process.env": JSON.stringify(t),
      ...Ar(t),
      global: "window",
      module: "{}"
    }
  };
}, "getConfig"), ut = {
  get: /* @__PURE__ */ i(async () => {
    let { build: e } = await import("esbuild");
    return e;
  }, "get")
}, Pr = /* @__PURE__ */ i(async function* ({
  startTime: r,
  options: t,
  router: o
}) {
  t.quiet || se.info("=> Starting manager..");
  let {
    config: n,
    favicon: a,
    customHead: s,
    features: l,
    instance: u,
    refs: c,
    template: f,
    title: _,
    logLevel: E,
    docsOptions: d,
    tagsOptions: p
  } = await ne(t);
  yield;
  let m = n.outdir;
  await vr(m, { recursive: !0, force: !0 }), yield, x = await u({
    ...n
  }), yield, o.use(
    "/sb-addons",
    (0, ce.default)(m, {
      maxAge: 3e5,
      dev: !0,
      immutable: !0
    })
  ), o.use(
    "/sb-manager",
    (0, ce.default)(St, {
      maxAge: 3e5,
      dev: !0,
      immutable: !0
    })
  );
  let { cssFiles: h, jsFiles: I } = await ae(m, x?.outputFiles);
  x.metafile && t.outputDir && await Et(
    A(t.outputDir, "metafile.json"),
    JSON.stringify(x.metafile, null, 2)
  );
  let b = await ie(t);
  yield;
  let O = await oe(
    f,
    _,
    a,
    s,
    h,
    I,
    l,
    c,
    E,
    d,
    p,
    t,
    b
  );
  return yield, o.use("/", ({ url: R }, g, w) => {
    R && wr.test(R) ? (g.statusCode = 200, g.setHeader("Content-Type", "text/html"), g.write(O), g.end()) : w();
  }), o.use("/index.html", (R, g) => {
    g.statusCode = 200, g.setHeader("Content-Type", "text/html"), g.write(O), g.end();
  }), {
    bail: Cr,
    stats: {
      toJson: /* @__PURE__ */ i(() => ({}), "toJson")
    },
    totalTime: process.hrtime(r)
  };
}, "starterGeneratorFn"), xr = /* @__PURE__ */ i(async function* ({ startTime: r, options: t }) {
  if (!t.outputDir)
    throw new Error("outputDir is required");
  se.info("=> Building manager..");
  let {
    config: o,
    customHead: n,
    favicon: a,
    features: s,
    instance: l,
    refs: u,
    template: c,
    title: f,
    logLevel: _,
    docsOptions: E,
    tagsOptions: d
  } = await ne(t);
  yield;
  let p = o.outdir, m = A(t.outputDir, "sb-manager");
  x = await l({
    ...o,
    minify: !0
  }), yield;
  let h = br(St, m, {
    filter: /* @__PURE__ */ i((g) => {
      let { ext: w } = ue(g);
      return w ? w === ".js" : !0;
    }, "filter"),
    recursive: !0
  }), { cssFiles: I, jsFiles: b } = await ae(p, x?.outputFiles), O = await ie(t);
  yield;
  let R = await oe(
    c,
    f,
    a,
    n,
    I,
    b,
    s,
    u,
    _,
    E,
    d,
    t,
    O
  );
  return await Promise.all([Et(A(t.outputDir, "index.html"), R), h]), se.trace({ message: "=> Manager built", time: process.hrtime(r) }), {
    toJson: /* @__PURE__ */ i(() => ({}), "toJson")
  };
}, "builderGeneratorFn"), Cr = /* @__PURE__ */ i(async () => {
  if (C)
    try {
      await C.throw(new Error());
    } catch {
    }
}, "bail"), $o = /* @__PURE__ */ i(async (e) => {
  C = Pr(e);
  let r;
  do
    r = await C.next();
  while (!r.done);
  return r.value;
}, "start"), Jo = /* @__PURE__ */ i(async (e) => {
  C = xr(e);
  let r;
  do
    r = await C.next();
  while (!r.done);
  return r.value;
}, "build"), Xo = [], zo = [];
export {
  q as BROWSER_TARGETS,
  Ot as NODE_TARGET,
  Cr as bail,
  Jo as build,
  Xo as corePresets,
  ut as executor,
  lt as getConfig,
  zo as overridePresets,
  $o as start
};
