import { __exports as c } from "../../../../../../../../_virtual/code.js";
var g;
function S() {
  return g ? c : (g = 1, function(n) {
    Object.defineProperty(n, "__esModule", { value: !0 }), n.regexpCode = n.getEsmExportName = n.getProperty = n.safeStringify = n.stringify = n.strConcat = n.addCodeArg = n.str = n._ = n.nil = n._Code = n.Name = n.IDENTIFIER = n._CodeOrName = void 0;
    class o {
    }
    n._CodeOrName = o, n.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
    class s extends o {
      constructor(t) {
        if (super(), !n.IDENTIFIER.test(t))
          throw new Error("CodeGen: name must be a valid identifier");
        this.str = t;
      }
      toString() {
        return this.str;
      }
      emptyStr() {
        return !1;
      }
      get names() {
        return { [this.str]: 1 };
      }
    }
    n.Name = s;
    class u extends o {
      constructor(t) {
        super(), this._items = typeof t == "string" ? [t] : t;
      }
      toString() {
        return this.str;
      }
      emptyStr() {
        if (this._items.length > 1)
          return !1;
        const t = this._items[0];
        return t === "" || t === '""';
      }
      get str() {
        var t;
        return (t = this._str) !== null && t !== void 0 ? t : this._str = this._items.reduce((i, r) => `${i}${r}`, "");
      }
      get names() {
        var t;
        return (t = this._names) !== null && t !== void 0 ? t : this._names = this._items.reduce((i, r) => (r instanceof s && (i[r.str] = (i[r.str] || 0) + 1), i), {});
      }
    }
    n._Code = u, n.nil = new u("");
    function d(e, ...t) {
      const i = [e[0]];
      let r = 0;
      for (; r < t.length; )
        a(i, t[r]), i.push(e[++r]);
      return new u(i);
    }
    n._ = d;
    const l = new u("+");
    function m(e, ...t) {
      const i = [f(e[0])];
      let r = 0;
      for (; r < t.length; )
        i.push(l), a(i, t[r]), i.push(l, f(e[++r]));
      return h(i), new u(i);
    }
    n.str = m;
    function a(e, t) {
      t instanceof u ? e.push(...t._items) : t instanceof s ? e.push(t) : e.push(C(t));
    }
    n.addCodeArg = a;
    function h(e) {
      let t = 1;
      for (; t < e.length - 1; ) {
        if (e[t] === l) {
          const i = _(e[t - 1], e[t + 1]);
          if (i !== void 0) {
            e.splice(t - 1, 3, i);
            continue;
          }
          e[t++] = "+";
        }
        t++;
      }
    }
    function _(e, t) {
      if (t === '""')
        return e;
      if (e === '""')
        return t;
      if (typeof e == "string")
        return t instanceof s || e[e.length - 1] !== '"' ? void 0 : typeof t != "string" ? `${e.slice(0, -1)}${t}"` : t[0] === '"' ? e.slice(0, -1) + t.slice(1) : void 0;
      if (typeof t == "string" && t[0] === '"' && !(e instanceof s))
        return `"${e}${t.slice(1)}`;
    }
    function y(e, t) {
      return t.emptyStr() ? e : e.emptyStr() ? t : m`${e}${t}`;
    }
    n.strConcat = y;
    function C(e) {
      return typeof e == "number" || typeof e == "boolean" || e === null ? e : f(Array.isArray(e) ? e.join(",") : e);
    }
    function E(e) {
      return new u(f(e));
    }
    n.stringify = E;
    function f(e) {
      return JSON.stringify(e).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
    }
    n.safeStringify = f;
    function I(e) {
      return typeof e == "string" && n.IDENTIFIER.test(e) ? new u(`.${e}`) : d`[${e}]`;
    }
    n.getProperty = I;
    function $(e) {
      if (typeof e == "string" && n.IDENTIFIER.test(e))
        return new u(`${e}`);
      throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`);
    }
    n.getEsmExportName = $;
    function w(e) {
      return new u(e.toString());
    }
    n.regexpCode = w;
  }(c), c);
}
export {
  S as __require
};
//# sourceMappingURL=code.js.map
