UNPKG

@botpress/adk-cli

Version:

Command-line interface for the Botpress Agent Development Kit (ADK)

12,993 lines 503 kB
// @bun
import {
  require_semver
} from "./chunk-2a5b6azq.js";
import {
  $a,
  Jt,
  RP,
  Uk,
  ps,
  require_lib
} from "./chunk-3xrpxgq4.js";
import {
  __export,
  __toESM
} from "./chunk-dhs2bg35.js";

// ../../node_modules/.bun/@botpress+sdk@6.11.1+5e7ec880c4edb477/node_modules/@botpress/sdk/dist/index.mjs
var exports_dist = {};
__export(exports_dist, {
  z: () => ne,
  version: () => zT,
  serve: () => wo,
  parseBody: () => Nt,
  messages: () => Wm,
  isApiError: () => RP,
  errors: () => Lh,
  WELL_KNOWN_ATTRIBUTES: () => mC,
  RuntimeError: () => ps,
  PluginDefinition: () => Ml,
  Plugin: () => $l,
  OAUTH_IDENTIFIER_HEADER: () => yC,
  InterfaceDefinition: () => Rl,
  IntegrationSpecificClient: () => oi,
  IntegrationLogger: () => ui,
  IntegrationDefinition: () => Ka,
  Integration: () => Sl,
  BotSpecificClient: () => dn,
  BotLogger: () => ci,
  BotDefinition: () => kl,
  Bot: () => Ol
});
var import_browser_or_node = __toESM(require_lib(), 1);
var di = __toESM(require_semver(), 1);
var Oo = Object.defineProperty;
var qT = Object.getOwnPropertyDescriptor;
var GT = Object.getOwnPropertyNames;
var VT = Object.prototype.hasOwnProperty;
var ot = (t, e) => () => (t && (e = t(t = 0)), e);
var pn = (t, e) => {
  for (var n in e)
    Oo(t, n, { get: e[n], enumerable: true });
};
var JT = (t, e, n, r) => {
  if (e && typeof e == "object" || typeof e == "function")
    for (let o of GT(e))
      !VT.call(t, o) && o !== n && Oo(t, o, { get: () => e[o], enumerable: !(r = qT(e, o)) || r.enumerable });
  return t;
};
var YT = (t) => JT(Oo({}, "__esModule", { value: true }), t);
var S = ot(() => {});
var G = {};
pn(G, { _debugEnd: () => ku, _debugProcess: () => Su, _events: () => Fu, _eventsCount: () => zu, _exiting: () => uu, _fatalExceptions: () => Pu, _getActiveHandles: () => pu, _getActiveRequests: () => fu, _kill: () => mu, _linkedBinding: () => au, _maxListeners: () => Ku, _preload_modules: () => Zu, _rawDebug: () => ou, _startProfilerIdleNotifier: () => Au, _stopProfilerIdleNotifier: () => Cu, _tickCallback: () => Eu, abort: () => Nu, addListener: () => qu, allowedNodeEnvironmentFlags: () => bu, arch: () => Fl, argv: () => Gl, argv0: () => $u, assert: () => wu, binding: () => Ql, browser: () => iu, chdir: () => nu, config: () => cu, cpuUsage: () => mi, cwd: () => tu, debugPort: () => ju, default: () => nc, dlopen: () => du, domain: () => lu, emit: () => Xu, emitWarning: () => Xl, env: () => ql, execArgv: () => Vl, execPath: () => Uu, exit: () => vu, features: () => xu, hasUncaughtExceptionCaptureCallback: () => Iu, hrtime: () => gi, kill: () => Tu, listeners: () => tc, memoryUsage: () => hu, moduleLoadList: () => su, nextTick: () => Ll, off: () => Vu, on: () => Vt, once: () => Gu, openStdin: () => _u, pid: () => Du, platform: () => zl, ppid: () => Hu, prependListener: () => Qu, prependOnceListener: () => ec, reallyExit: () => gu, release: () => ru, removeAllListeners: () => Yu, removeListener: () => Ju, resourceUsage: () => yu, setSourceMapsEnabled: () => Lu, setUncaughtExceptionCaptureCallback: () => Bu, stderr: () => Ru, stdin: () => Mu, stdout: () => Ou, title: () => Kl, umask: () => eu, uptime: () => Wu, version: () => Jl, versions: () => Yl });
function No(t) {
  throw new Error("Node.js process " + t + " is not supported by JSPM core outside of Node.js");
}
function XT() {
  !er || !wn || (er = false, wn.length ? Gt = wn.concat(Gt) : pi = -1, Gt.length && Zl());
}
function Zl() {
  if (!er) {
    var t = setTimeout(XT, 0);
    er = true;
    for (var e = Gt.length;e; ) {
      for (wn = Gt, Gt = [];++pi < e; )
        wn && wn[pi].run();
      pi = -1, e = Gt.length;
    }
    wn = null, er = false, clearTimeout(t);
  }
}
function Ll(t) {
  var e = new Array(arguments.length - 1);
  if (arguments.length > 1)
    for (var n = 1;n < arguments.length; n++)
      e[n - 1] = arguments[n];
  Gt.push(new Wl(t, e)), Gt.length === 1 && !er && setTimeout(Zl, 0);
}
function Wl(t, e) {
  this.fun = t, this.array = e;
}
function st() {}
function au(t) {
  No("_linkedBinding");
}
function du(t) {
  No("dlopen");
}
function fu() {
  return [];
}
function pu() {
  return [];
}
function wu(t, e) {
  if (!t)
    throw new Error(e || "assertion error");
}
function Iu() {
  return false;
}
function Wu() {
  return gn.now() / 1000;
}
function gi(t) {
  var e = Math.floor((Date.now() - gn.now()) * 0.001), n = gn.now() * 0.001, r = Math.floor(n) + e, o = Math.floor(n % 1 * 1e9);
  return t && (r = r - t[0], o = o - t[1], o < 0 && (r--, o += Mo)), [r, o];
}
function Vt() {
  return nc;
}
function tc(t) {
  return [];
}
var Gt;
var er;
var wn;
var pi;
var Kl;
var Fl;
var zl;
var ql;
var Gl;
var Vl;
var Jl;
var Yl;
var Xl;
var Ql;
var eu;
var tu;
var nu;
var ru;
var iu;
var ou;
var su;
var lu;
var uu;
var cu;
var gu;
var mu;
var mi;
var yu;
var hu;
var Tu;
var vu;
var _u;
var bu;
var xu;
var Pu;
var Bu;
var Eu;
var Su;
var ku;
var Au;
var Cu;
var Ou;
var Ru;
var Mu;
var Nu;
var Du;
var Hu;
var Uu;
var ju;
var $u;
var Zu;
var Lu;
var gn;
var Ro;
var Mo;
var Ku;
var Fu;
var zu;
var qu;
var Gu;
var Vu;
var Ju;
var Yu;
var Xu;
var Qu;
var ec;
var nc;
var rc = ot(() => {
  S();
  A();
  k();
  Gt = [], er = false, pi = -1;
  Wl.prototype.run = function() {
    this.fun.apply(null, this.array);
  };
  Kl = "browser", Fl = "x64", zl = "browser", ql = { PATH: "/usr/bin", LANG: typeof navigator < "u" ? navigator.language + ".UTF-8" : undefined, PWD: "/", HOME: "/home", TMP: "/tmp" }, Gl = ["/usr/bin/node"], Vl = [], Jl = "v16.8.0", Yl = {}, Xl = function(t, e) {
    console.warn((e ? e + ": " : "") + t);
  }, Ql = function(t) {
    No("binding");
  }, eu = function(t) {
    return 0;
  }, tu = function() {
    return "/";
  }, nu = function(t) {}, ru = { name: "node", sourceUrl: "", headersUrl: "", libUrl: "" };
  iu = true, ou = st, su = [];
  lu = {}, uu = false, cu = {};
  gu = st, mu = st, mi = function() {
    return {};
  }, yu = mi, hu = mi, Tu = st, vu = st, _u = st, bu = {};
  xu = { inspector: false, debug: false, uv: false, ipv6: false, tls_alpn: false, tls_sni: false, tls_ocsp: false, tls: false, cached_builtins: true }, Pu = st, Bu = st;
  Eu = st, Su = st, ku = st, Au = st, Cu = st, Ou = undefined, Ru = undefined, Mu = undefined, Nu = st, Du = 2, Hu = 1, Uu = "/bin/usr/node", ju = 9229, $u = "node", Zu = [], Lu = st, gn = { now: typeof performance < "u" ? performance.now.bind(performance) : undefined, timing: typeof performance < "u" ? performance.timing : undefined };
  gn.now === undefined && (Ro = Date.now(), gn.timing && gn.timing.navigationStart && (Ro = gn.timing.navigationStart), gn.now = () => Date.now() - Ro);
  Mo = 1e9;
  gi.bigint = function(t) {
    var e = gi(t);
    return typeof BigInt > "u" ? e[0] * Mo + e[1] : BigInt(e[0] * Mo) + BigInt(e[1]);
  };
  Ku = 10, Fu = {}, zu = 0;
  qu = Vt, Gu = Vt, Vu = Vt, Ju = Vt, Yu = Vt, Xu = st, Qu = Vt, ec = Vt;
  nc = { version: Jl, versions: Yl, arch: Fl, platform: zl, browser: iu, release: ru, _rawDebug: ou, moduleLoadList: su, binding: Ql, _linkedBinding: au, _events: Fu, _eventsCount: zu, _maxListeners: Ku, on: Vt, addListener: qu, once: Gu, off: Vu, removeListener: Ju, removeAllListeners: Yu, emit: Xu, prependListener: Qu, prependOnceListener: ec, listeners: tc, domain: lu, _exiting: uu, config: cu, dlopen: du, uptime: Wu, _getActiveRequests: fu, _getActiveHandles: pu, reallyExit: gu, _kill: mu, cpuUsage: mi, resourceUsage: yu, memoryUsage: hu, kill: Tu, exit: vu, openStdin: _u, allowedNodeEnvironmentFlags: bu, assert: wu, features: xu, _fatalExceptions: Pu, setUncaughtExceptionCaptureCallback: Bu, hasUncaughtExceptionCaptureCallback: Iu, emitWarning: Xl, nextTick: Ll, _tickCallback: Eu, _debugProcess: Su, _debugEnd: ku, _startProfilerIdleNotifier: Au, _stopProfilerIdleNotifier: Cu, stdout: Ou, stdin: Mu, stderr: Ru, abort: Nu, umask: eu, chdir: nu, cwd: tu, env: ql, title: Kl, argv: Gl, execArgv: Vl, pid: Du, ppid: Hu, execPath: Uu, debugPort: ju, hrtime: gi, argv0: $u, _preload_modules: Zu, setSourceMapsEnabled: Lu };
});
var k = ot(() => {
  rc();
});
function QT() {
  if (ic)
    return br;
  ic = true, br.byteLength = a, br.toByteArray = c, br.fromByteArray = p;
  for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = 0, s = r.length;o < s; ++o)
    t[o] = r[o], e[r.charCodeAt(o)] = o;
  e[45] = 62, e[95] = 63;
  function i(y) {
    var T = y.length;
    if (T % 4 > 0)
      throw new Error("Invalid string. Length must be a multiple of 4");
    var P = y.indexOf("=");
    P === -1 && (P = T);
    var B = P === T ? 0 : 4 - P % 4;
    return [P, B];
  }
  function a(y) {
    var T = i(y), P = T[0], B = T[1];
    return (P + B) * 3 / 4 - B;
  }
  function l(y, T, P) {
    return (T + P) * 3 / 4 - P;
  }
  function c(y) {
    var T, P = i(y), B = P[0], v = P[1], E = new n(l(y, B, v)), I = 0, D = v > 0 ? B - 4 : B, $;
    for ($ = 0;$ < D; $ += 4)
      T = e[y.charCodeAt($)] << 18 | e[y.charCodeAt($ + 1)] << 12 | e[y.charCodeAt($ + 2)] << 6 | e[y.charCodeAt($ + 3)], E[I++] = T >> 16 & 255, E[I++] = T >> 8 & 255, E[I++] = T & 255;
    return v === 2 && (T = e[y.charCodeAt($)] << 2 | e[y.charCodeAt($ + 1)] >> 4, E[I++] = T & 255), v === 1 && (T = e[y.charCodeAt($)] << 10 | e[y.charCodeAt($ + 1)] << 4 | e[y.charCodeAt($ + 2)] >> 2, E[I++] = T >> 8 & 255, E[I++] = T & 255), E;
  }
  function f(y) {
    return t[y >> 18 & 63] + t[y >> 12 & 63] + t[y >> 6 & 63] + t[y & 63];
  }
  function g(y, T, P) {
    for (var B, v = [], E = T;E < P; E += 3)
      B = (y[E] << 16 & 16711680) + (y[E + 1] << 8 & 65280) + (y[E + 2] & 255), v.push(f(B));
    return v.join("");
  }
  function p(y) {
    for (var T, P = y.length, B = P % 3, v = [], E = 16383, I = 0, D = P - B;I < D; I += E)
      v.push(g(y, I, I + E > D ? D : I + E));
    return B === 1 ? (T = y[P - 1], v.push(t[T >> 2] + t[T << 4 & 63] + "==")) : B === 2 && (T = (y[P - 2] << 8) + y[P - 1], v.push(t[T >> 10] + t[T >> 4 & 63] + t[T << 2 & 63] + "=")), v.join("");
  }
  return br;
}
function ev() {
  if (oc)
    return yi;
  oc = true;
  return yi.read = function(t, e, n, r, o) {
    var s, i, a = o * 8 - r - 1, l = (1 << a) - 1, c = l >> 1, f = -7, g = n ? o - 1 : 0, p = n ? -1 : 1, y = t[e + g];
    for (g += p, s = y & (1 << -f) - 1, y >>= -f, f += a;f > 0; s = s * 256 + t[e + g], g += p, f -= 8)
      ;
    for (i = s & (1 << -f) - 1, s >>= -f, f += r;f > 0; i = i * 256 + t[e + g], g += p, f -= 8)
      ;
    if (s === 0)
      s = 1 - c;
    else {
      if (s === l)
        return i ? NaN : (y ? -1 : 1) * (1 / 0);
      i = i + Math.pow(2, r), s = s - c;
    }
    return (y ? -1 : 1) * i * Math.pow(2, s - r);
  }, yi.write = function(t, e, n, r, o, s) {
    var i, a, l, c = s * 8 - o - 1, f = (1 << c) - 1, g = f >> 1, p = o === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = r ? 0 : s - 1, T = r ? 1 : -1, P = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
    for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (a = isNaN(e) ? 1 : 0, i = f) : (i = Math.floor(Math.log(e) / Math.LN2), e * (l = Math.pow(2, -i)) < 1 && (i--, l *= 2), i + g >= 1 ? e += p / l : e += p * Math.pow(2, 1 - g), e * l >= 2 && (i++, l /= 2), i + g >= f ? (a = 0, i = f) : i + g >= 1 ? (a = (e * l - 1) * Math.pow(2, o), i = i + g) : (a = e * Math.pow(2, g - 1) * Math.pow(2, o), i = 0));o >= 8; t[n + y] = a & 255, y += T, a /= 256, o -= 8)
      ;
    for (i = i << o | a, c += o;c > 0; t[n + y] = i & 255, y += T, i /= 256, c -= 8)
      ;
    t[n + y - T] |= P * 128;
  }, yi;
}
function $t() {
  if (sc)
    return xn;
  sc = true;
  let t = QT(), e = ev(), n = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
  xn.Buffer = i, xn.SlowBuffer = v, xn.INSPECT_MAX_BYTES = 50;
  let r = 2147483647;
  xn.kMaxLength = r, i.TYPED_ARRAY_SUPPORT = o(), !i.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
  function o() {
    try {
      let h = new Uint8Array(1), u = { foo: function() {
        return 42;
      } };
      return Object.setPrototypeOf(u, Uint8Array.prototype), Object.setPrototypeOf(h, u), h.foo() === 42;
    } catch {
      return false;
    }
  }
  Object.defineProperty(i.prototype, "parent", { enumerable: true, get: function() {
    if (i.isBuffer(this))
      return this.buffer;
  } }), Object.defineProperty(i.prototype, "offset", { enumerable: true, get: function() {
    if (i.isBuffer(this))
      return this.byteOffset;
  } });
  function s(h) {
    if (h > r)
      throw new RangeError('The value "' + h + '" is invalid for option "size"');
    let u = new Uint8Array(h);
    return Object.setPrototypeOf(u, i.prototype), u;
  }
  function i(h, u, d) {
    if (typeof h == "number") {
      if (typeof u == "string")
        throw new TypeError('The "string" argument must be of type string. Received type number');
      return f(h);
    }
    return a(h, u, d);
  }
  i.poolSize = 8192;
  function a(h, u, d) {
    if (typeof h == "string")
      return g(h, u);
    if (ArrayBuffer.isView(h))
      return y(h);
    if (h == null)
      throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof h);
    if (_t(h, ArrayBuffer) || h && _t(h.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (_t(h, SharedArrayBuffer) || h && _t(h.buffer, SharedArrayBuffer)))
      return T(h, u, d);
    if (typeof h == "number")
      throw new TypeError('The "value" argument must not be of type number. Received type number');
    let _ = h.valueOf && h.valueOf();
    if (_ != null && _ !== h)
      return i.from(_, u, d);
    let O = P(h);
    if (O)
      return O;
    if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof h[Symbol.toPrimitive] == "function")
      return i.from(h[Symbol.toPrimitive]("string"), u, d);
    throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof h);
  }
  i.from = function(h, u, d) {
    return a(h, u, d);
  }, Object.setPrototypeOf(i.prototype, Uint8Array.prototype), Object.setPrototypeOf(i, Uint8Array);
  function l(h) {
    if (typeof h != "number")
      throw new TypeError('"size" argument must be of type number');
    if (h < 0)
      throw new RangeError('The value "' + h + '" is invalid for option "size"');
  }
  function c(h, u, d) {
    return l(h), h <= 0 ? s(h) : u !== undefined ? typeof d == "string" ? s(h).fill(u, d) : s(h).fill(u) : s(h);
  }
  i.alloc = function(h, u, d) {
    return c(h, u, d);
  };
  function f(h) {
    return l(h), s(h < 0 ? 0 : B(h) | 0);
  }
  i.allocUnsafe = function(h) {
    return f(h);
  }, i.allocUnsafeSlow = function(h) {
    return f(h);
  };
  function g(h, u) {
    if ((typeof u != "string" || u === "") && (u = "utf8"), !i.isEncoding(u))
      throw new TypeError("Unknown encoding: " + u);
    let d = E(h, u) | 0, _ = s(d), O = _.write(h, u);
    return O !== d && (_ = _.slice(0, O)), _;
  }
  function p(h) {
    let u = h.length < 0 ? 0 : B(h.length) | 0, d = s(u);
    for (let _ = 0;_ < u; _ += 1)
      d[_] = h[_] & 255;
    return d;
  }
  function y(h) {
    if (_t(h, Uint8Array)) {
      let u = new Uint8Array(h);
      return T(u.buffer, u.byteOffset, u.byteLength);
    }
    return p(h);
  }
  function T(h, u, d) {
    if (u < 0 || h.byteLength < u)
      throw new RangeError('"offset" is outside of buffer bounds');
    if (h.byteLength < u + (d || 0))
      throw new RangeError('"length" is outside of buffer bounds');
    let _;
    return u === undefined && d === undefined ? _ = new Uint8Array(h) : d === undefined ? _ = new Uint8Array(h, u) : _ = new Uint8Array(h, u, d), Object.setPrototypeOf(_, i.prototype), _;
  }
  function P(h) {
    if (i.isBuffer(h)) {
      let u = B(h.length) | 0, d = s(u);
      return d.length === 0 || h.copy(d, 0, 0, u), d;
    }
    if (h.length !== undefined)
      return typeof h.length != "number" || vr(h.length) ? s(0) : p(h);
    if (h.type === "Buffer" && Array.isArray(h.data))
      return p(h.data);
  }
  function B(h) {
    if (h >= r)
      throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + r.toString(16) + " bytes");
    return h | 0;
  }
  function v(h) {
    return +h != h && (h = 0), i.alloc(+h);
  }
  i.isBuffer = function(u) {
    return u != null && u._isBuffer === true && u !== i.prototype;
  }, i.compare = function(u, d) {
    if (_t(u, Uint8Array) && (u = i.from(u, u.offset, u.byteLength)), _t(d, Uint8Array) && (d = i.from(d, d.offset, d.byteLength)), !i.isBuffer(u) || !i.isBuffer(d))
      throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
    if (u === d)
      return 0;
    let _ = u.length, O = d.length;
    for (let H = 0, K = Math.min(_, O);H < K; ++H)
      if (u[H] !== d[H]) {
        _ = u[H], O = d[H];
        break;
      }
    return _ < O ? -1 : O < _ ? 1 : 0;
  }, i.isEncoding = function(u) {
    switch (String(u).toLowerCase()) {
      case "hex":
      case "utf8":
      case "utf-8":
      case "ascii":
      case "latin1":
      case "binary":
      case "base64":
      case "ucs2":
      case "ucs-2":
      case "utf16le":
      case "utf-16le":
        return true;
      default:
        return false;
    }
  }, i.concat = function(u, d) {
    if (!Array.isArray(u))
      throw new TypeError('"list" argument must be an Array of Buffers');
    if (u.length === 0)
      return i.alloc(0);
    let _;
    if (d === undefined)
      for (d = 0, _ = 0;_ < u.length; ++_)
        d += u[_].length;
    let O = i.allocUnsafe(d), H = 0;
    for (_ = 0;_ < u.length; ++_) {
      let K = u[_];
      if (_t(K, Uint8Array))
        H + K.length > O.length ? (i.isBuffer(K) || (K = i.from(K)), K.copy(O, H)) : Uint8Array.prototype.set.call(O, K, H);
      else if (i.isBuffer(K))
        K.copy(O, H);
      else
        throw new TypeError('"list" argument must be an Array of Buffers');
      H += K.length;
    }
    return O;
  };
  function E(h, u) {
    if (i.isBuffer(h))
      return h.length;
    if (ArrayBuffer.isView(h) || _t(h, ArrayBuffer))
      return h.byteLength;
    if (typeof h != "string")
      throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof h);
    let d = h.length, _ = arguments.length > 2 && arguments[2] === true;
    if (!_ && d === 0)
      return 0;
    let O = false;
    for (;; )
      switch (u) {
        case "ascii":
        case "latin1":
        case "binary":
          return d;
        case "utf8":
        case "utf-8":
          return Se(h).length;
        case "ucs2":
        case "ucs-2":
        case "utf16le":
        case "utf-16le":
          return d * 2;
        case "hex":
          return d >>> 1;
        case "base64":
          return At(h).length;
        default:
          if (O)
            return _ ? -1 : Se(h).length;
          u = ("" + u).toLowerCase(), O = true;
      }
  }
  i.byteLength = E;
  function I(h, u, d) {
    let _ = false;
    if ((u === undefined || u < 0) && (u = 0), u > this.length || ((d === undefined || d > this.length) && (d = this.length), d <= 0) || (d >>>= 0, u >>>= 0, d <= u))
      return "";
    for (h || (h = "utf8");; )
      switch (h) {
        case "hex":
          return ve(this, u, d);
        case "utf8":
        case "utf-8":
          return Xe(this, u, d);
        case "ascii":
          return pt(this, u, d);
        case "latin1":
        case "binary":
          return Re(this, u, d);
        case "base64":
          return We(this, u, d);
        case "ucs2":
        case "ucs-2":
        case "utf16le":
        case "utf-16le":
          return we(this, u, d);
        default:
          if (_)
            throw new TypeError("Unknown encoding: " + h);
          h = (h + "").toLowerCase(), _ = true;
      }
  }
  i.prototype._isBuffer = true;
  function D(h, u, d) {
    let _ = h[u];
    h[u] = h[d], h[d] = _;
  }
  i.prototype.swap16 = function() {
    let u = this.length;
    if (u % 2 !== 0)
      throw new RangeError("Buffer size must be a multiple of 16-bits");
    for (let d = 0;d < u; d += 2)
      D(this, d, d + 1);
    return this;
  }, i.prototype.swap32 = function() {
    let u = this.length;
    if (u % 4 !== 0)
      throw new RangeError("Buffer size must be a multiple of 32-bits");
    for (let d = 0;d < u; d += 4)
      D(this, d, d + 3), D(this, d + 1, d + 2);
    return this;
  }, i.prototype.swap64 = function() {
    let u = this.length;
    if (u % 8 !== 0)
      throw new RangeError("Buffer size must be a multiple of 64-bits");
    for (let d = 0;d < u; d += 8)
      D(this, d, d + 7), D(this, d + 1, d + 6), D(this, d + 2, d + 5), D(this, d + 3, d + 4);
    return this;
  }, i.prototype.toString = function() {
    let u = this.length;
    return u === 0 ? "" : arguments.length === 0 ? Xe(this, 0, u) : I.apply(this, arguments);
  }, i.prototype.toLocaleString = i.prototype.toString, i.prototype.equals = function(u) {
    if (!i.isBuffer(u))
      throw new TypeError("Argument must be a Buffer");
    return this === u ? true : i.compare(this, u) === 0;
  }, i.prototype.inspect = function() {
    let u = "", d = xn.INSPECT_MAX_BYTES;
    return u = this.toString("hex", 0, d).replace(/(.{2})/g, "$1 ").trim(), this.length > d && (u += " ... "), "<Buffer " + u + ">";
  }, n && (i.prototype[n] = i.prototype.inspect), i.prototype.compare = function(u, d, _, O, H) {
    if (_t(u, Uint8Array) && (u = i.from(u, u.offset, u.byteLength)), !i.isBuffer(u))
      throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof u);
    if (d === undefined && (d = 0), _ === undefined && (_ = u ? u.length : 0), O === undefined && (O = 0), H === undefined && (H = this.length), d < 0 || _ > u.length || O < 0 || H > this.length)
      throw new RangeError("out of range index");
    if (O >= H && d >= _)
      return 0;
    if (O >= H)
      return -1;
    if (d >= _)
      return 1;
    if (d >>>= 0, _ >>>= 0, O >>>= 0, H >>>= 0, this === u)
      return 0;
    let K = H - O, _e = _ - d, Ke = Math.min(K, _e), De = this.slice(O, H), Fe = u.slice(d, _);
    for (let Oe = 0;Oe < Ke; ++Oe)
      if (De[Oe] !== Fe[Oe]) {
        K = De[Oe], _e = Fe[Oe];
        break;
      }
    return K < _e ? -1 : _e < K ? 1 : 0;
  };
  function $(h, u, d, _, O) {
    if (h.length === 0)
      return -1;
    if (typeof d == "string" ? (_ = d, d = 0) : d > 2147483647 ? d = 2147483647 : d < -2147483648 && (d = -2147483648), d = +d, vr(d) && (d = O ? 0 : h.length - 1), d < 0 && (d = h.length + d), d >= h.length) {
      if (O)
        return -1;
      d = h.length - 1;
    } else if (d < 0)
      if (O)
        d = 0;
      else
        return -1;
    if (typeof u == "string" && (u = i.from(u, _)), i.isBuffer(u))
      return u.length === 0 ? -1 : Q(h, u, d, _, O);
    if (typeof u == "number")
      return u = u & 255, typeof Uint8Array.prototype.indexOf == "function" ? O ? Uint8Array.prototype.indexOf.call(h, u, d) : Uint8Array.prototype.lastIndexOf.call(h, u, d) : Q(h, [u], d, _, O);
    throw new TypeError("val must be string, number or Buffer");
  }
  function Q(h, u, d, _, O) {
    let H = 1, K = h.length, _e = u.length;
    if (_ !== undefined && (_ = String(_).toLowerCase(), _ === "ucs2" || _ === "ucs-2" || _ === "utf16le" || _ === "utf-16le")) {
      if (h.length < 2 || u.length < 2)
        return -1;
      H = 2, K /= 2, _e /= 2, d /= 2;
    }
    function Ke(Fe, Oe) {
      return H === 1 ? Fe[Oe] : Fe.readUInt16BE(Oe * H);
    }
    let De;
    if (O) {
      let Fe = -1;
      for (De = d;De < K; De++)
        if (Ke(h, De) === Ke(u, Fe === -1 ? 0 : De - Fe)) {
          if (Fe === -1 && (Fe = De), De - Fe + 1 === _e)
            return Fe * H;
        } else
          Fe !== -1 && (De -= De - Fe), Fe = -1;
    } else
      for (d + _e > K && (d = K - _e), De = d;De >= 0; De--) {
        let Fe = true;
        for (let Oe = 0;Oe < _e; Oe++)
          if (Ke(h, De + Oe) !== Ke(u, Oe)) {
            Fe = false;
            break;
          }
        if (Fe)
          return De;
      }
    return -1;
  }
  i.prototype.includes = function(u, d, _) {
    return this.indexOf(u, d, _) !== -1;
  }, i.prototype.indexOf = function(u, d, _) {
    return $(this, u, d, _, true);
  }, i.prototype.lastIndexOf = function(u, d, _) {
    return $(this, u, d, _, false);
  };
  function Y(h, u, d, _) {
    d = Number(d) || 0;
    let O = h.length - d;
    _ ? (_ = Number(_), _ > O && (_ = O)) : _ = O;
    let H = u.length;
    _ > H / 2 && (_ = H / 2);
    let K;
    for (K = 0;K < _; ++K) {
      let _e = parseInt(u.substr(K * 2, 2), 16);
      if (vr(_e))
        return K;
      h[d + K] = _e;
    }
    return K;
  }
  function ce(h, u, d, _) {
    return jt(Se(u, h.length - d), h, d, _);
  }
  function re(h, u, d, _) {
    return jt(me(u), h, d, _);
  }
  function ee(h, u, d, _) {
    return jt(At(u), h, d, _);
  }
  function Ie(h, u, d, _) {
    return jt(U(u, h.length - d), h, d, _);
  }
  i.prototype.write = function(u, d, _, O) {
    if (d === undefined)
      O = "utf8", _ = this.length, d = 0;
    else if (_ === undefined && typeof d == "string")
      O = d, _ = this.length, d = 0;
    else if (isFinite(d))
      d = d >>> 0, isFinite(_) ? (_ = _ >>> 0, O === undefined && (O = "utf8")) : (O = _, _ = undefined);
    else
      throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
    let H = this.length - d;
    if ((_ === undefined || _ > H) && (_ = H), u.length > 0 && (_ < 0 || d < 0) || d > this.length)
      throw new RangeError("Attempt to write outside buffer bounds");
    O || (O = "utf8");
    let K = false;
    for (;; )
      switch (O) {
        case "hex":
          return Y(this, u, d, _);
        case "utf8":
        case "utf-8":
          return ce(this, u, d, _);
        case "ascii":
        case "latin1":
        case "binary":
          return re(this, u, d, _);
        case "base64":
          return ee(this, u, d, _);
        case "ucs2":
        case "ucs-2":
        case "utf16le":
        case "utf-16le":
          return Ie(this, u, d, _);
        default:
          if (K)
            throw new TypeError("Unknown encoding: " + O);
          O = ("" + O).toLowerCase(), K = true;
      }
  }, i.prototype.toJSON = function() {
    return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) };
  };
  function We(h, u, d) {
    return u === 0 && d === h.length ? t.fromByteArray(h) : t.fromByteArray(h.slice(u, d));
  }
  function Xe(h, u, d) {
    d = Math.min(h.length, d);
    let _ = [], O = u;
    for (;O < d; ) {
      let H = h[O], K = null, _e = H > 239 ? 4 : H > 223 ? 3 : H > 191 ? 2 : 1;
      if (O + _e <= d) {
        let Ke, De, Fe, Oe;
        switch (_e) {
          case 1:
            H < 128 && (K = H);
            break;
          case 2:
            Ke = h[O + 1], (Ke & 192) === 128 && (Oe = (H & 31) << 6 | Ke & 63, Oe > 127 && (K = Oe));
            break;
          case 3:
            Ke = h[O + 1], De = h[O + 2], (Ke & 192) === 128 && (De & 192) === 128 && (Oe = (H & 15) << 12 | (Ke & 63) << 6 | De & 63, Oe > 2047 && (Oe < 55296 || Oe > 57343) && (K = Oe));
            break;
          case 4:
            Ke = h[O + 1], De = h[O + 2], Fe = h[O + 3], (Ke & 192) === 128 && (De & 192) === 128 && (Fe & 192) === 128 && (Oe = (H & 15) << 18 | (Ke & 63) << 12 | (De & 63) << 6 | Fe & 63, Oe > 65535 && Oe < 1114112 && (K = Oe));
        }
      }
      K === null ? (K = 65533, _e = 1) : K > 65535 && (K -= 65536, _.push(K >>> 10 & 1023 | 55296), K = 56320 | K & 1023), _.push(K), O += _e;
    }
    return qe(_);
  }
  let ze = 4096;
  function qe(h) {
    let u = h.length;
    if (u <= ze)
      return String.fromCharCode.apply(String, h);
    let d = "", _ = 0;
    for (;_ < u; )
      d += String.fromCharCode.apply(String, h.slice(_, _ += ze));
    return d;
  }
  function pt(h, u, d) {
    let _ = "";
    d = Math.min(h.length, d);
    for (let O = u;O < d; ++O)
      _ += String.fromCharCode(h[O] & 127);
    return _;
  }
  function Re(h, u, d) {
    let _ = "";
    d = Math.min(h.length, d);
    for (let O = u;O < d; ++O)
      _ += String.fromCharCode(h[O]);
    return _;
  }
  function ve(h, u, d) {
    let _ = h.length;
    (!u || u < 0) && (u = 0), (!d || d < 0 || d > _) && (d = _);
    let O = "";
    for (let H = u;H < d; ++H)
      O += fi[h[H]];
    return O;
  }
  function we(h, u, d) {
    let _ = h.slice(u, d), O = "";
    for (let H = 0;H < _.length - 1; H += 2)
      O += String.fromCharCode(_[H] + _[H + 1] * 256);
    return O;
  }
  i.prototype.slice = function(u, d) {
    let _ = this.length;
    u = ~~u, d = d === undefined ? _ : ~~d, u < 0 ? (u += _, u < 0 && (u = 0)) : u > _ && (u = _), d < 0 ? (d += _, d < 0 && (d = 0)) : d > _ && (d = _), d < u && (d = u);
    let O = this.subarray(u, d);
    return Object.setPrototypeOf(O, i.prototype), O;
  };
  function se(h, u, d) {
    if (h % 1 !== 0 || h < 0)
      throw new RangeError("offset is not uint");
    if (h + u > d)
      throw new RangeError("Trying to access beyond buffer length");
  }
  i.prototype.readUintLE = i.prototype.readUIntLE = function(u, d, _) {
    u = u >>> 0, d = d >>> 0, _ || se(u, d, this.length);
    let O = this[u], H = 1, K = 0;
    for (;++K < d && (H *= 256); )
      O += this[u + K] * H;
    return O;
  }, i.prototype.readUintBE = i.prototype.readUIntBE = function(u, d, _) {
    u = u >>> 0, d = d >>> 0, _ || se(u, d, this.length);
    let O = this[u + --d], H = 1;
    for (;d > 0 && (H *= 256); )
      O += this[u + --d] * H;
    return O;
  }, i.prototype.readUint8 = i.prototype.readUInt8 = function(u, d) {
    return u = u >>> 0, d || se(u, 1, this.length), this[u];
  }, i.prototype.readUint16LE = i.prototype.readUInt16LE = function(u, d) {
    return u = u >>> 0, d || se(u, 2, this.length), this[u] | this[u + 1] << 8;
  }, i.prototype.readUint16BE = i.prototype.readUInt16BE = function(u, d) {
    return u = u >>> 0, d || se(u, 2, this.length), this[u] << 8 | this[u + 1];
  }, i.prototype.readUint32LE = i.prototype.readUInt32LE = function(u, d) {
    return u = u >>> 0, d || se(u, 4, this.length), (this[u] | this[u + 1] << 8 | this[u + 2] << 16) + this[u + 3] * 16777216;
  }, i.prototype.readUint32BE = i.prototype.readUInt32BE = function(u, d) {
    return u = u >>> 0, d || se(u, 4, this.length), this[u] * 16777216 + (this[u + 1] << 16 | this[u + 2] << 8 | this[u + 3]);
  }, i.prototype.readBigUInt64LE = Pt(function(u) {
    u = u >>> 0, b(u, "offset");
    let d = this[u], _ = this[u + 7];
    (d === undefined || _ === undefined) && x(u, this.length - 8);
    let O = d + this[++u] * 2 ** 8 + this[++u] * 2 ** 16 + this[++u] * 2 ** 24, H = this[++u] + this[++u] * 2 ** 8 + this[++u] * 2 ** 16 + _ * 2 ** 24;
    return BigInt(O) + (BigInt(H) << BigInt(32));
  }), i.prototype.readBigUInt64BE = Pt(function(u) {
    u = u >>> 0, b(u, "offset");
    let d = this[u], _ = this[u + 7];
    (d === undefined || _ === undefined) && x(u, this.length - 8);
    let O = d * 2 ** 24 + this[++u] * 2 ** 16 + this[++u] * 2 ** 8 + this[++u], H = this[++u] * 2 ** 24 + this[++u] * 2 ** 16 + this[++u] * 2 ** 8 + _;
    return (BigInt(O) << BigInt(32)) + BigInt(H);
  }), i.prototype.readIntLE = function(u, d, _) {
    u = u >>> 0, d = d >>> 0, _ || se(u, d, this.length);
    let O = this[u], H = 1, K = 0;
    for (;++K < d && (H *= 256); )
      O += this[u + K] * H;
    return H *= 128, O >= H && (O -= Math.pow(2, 8 * d)), O;
  }, i.prototype.readIntBE = function(u, d, _) {
    u = u >>> 0, d = d >>> 0, _ || se(u, d, this.length);
    let O = d, H = 1, K = this[u + --O];
    for (;O > 0 && (H *= 256); )
      K += this[u + --O] * H;
    return H *= 128, K >= H && (K -= Math.pow(2, 8 * d)), K;
  }, i.prototype.readInt8 = function(u, d) {
    return u = u >>> 0, d || se(u, 1, this.length), this[u] & 128 ? (255 - this[u] + 1) * -1 : this[u];
  }, i.prototype.readInt16LE = function(u, d) {
    u = u >>> 0, d || se(u, 2, this.length);
    let _ = this[u] | this[u + 1] << 8;
    return _ & 32768 ? _ | 4294901760 : _;
  }, i.prototype.readInt16BE = function(u, d) {
    u = u >>> 0, d || se(u, 2, this.length);
    let _ = this[u + 1] | this[u] << 8;
    return _ & 32768 ? _ | 4294901760 : _;
  }, i.prototype.readInt32LE = function(u, d) {
    return u = u >>> 0, d || se(u, 4, this.length), this[u] | this[u + 1] << 8 | this[u + 2] << 16 | this[u + 3] << 24;
  }, i.prototype.readInt32BE = function(u, d) {
    return u = u >>> 0, d || se(u, 4, this.length), this[u] << 24 | this[u + 1] << 16 | this[u + 2] << 8 | this[u + 3];
  }, i.prototype.readBigInt64LE = Pt(function(u) {
    u = u >>> 0, b(u, "offset");
    let d = this[u], _ = this[u + 7];
    (d === undefined || _ === undefined) && x(u, this.length - 8);
    let O = this[u + 4] + this[u + 5] * 2 ** 8 + this[u + 6] * 2 ** 16 + (_ << 24);
    return (BigInt(O) << BigInt(32)) + BigInt(d + this[++u] * 2 ** 8 + this[++u] * 2 ** 16 + this[++u] * 2 ** 24);
  }), i.prototype.readBigInt64BE = Pt(function(u) {
    u = u >>> 0, b(u, "offset");
    let d = this[u], _ = this[u + 7];
    (d === undefined || _ === undefined) && x(u, this.length - 8);
    let O = (d << 24) + this[++u] * 2 ** 16 + this[++u] * 2 ** 8 + this[++u];
    return (BigInt(O) << BigInt(32)) + BigInt(this[++u] * 2 ** 24 + this[++u] * 2 ** 16 + this[++u] * 2 ** 8 + _);
  }), i.prototype.readFloatLE = function(u, d) {
    return u = u >>> 0, d || se(u, 4, this.length), e.read(this, u, true, 23, 4);
  }, i.prototype.readFloatBE = function(u, d) {
    return u = u >>> 0, d || se(u, 4, this.length), e.read(this, u, false, 23, 4);
  }, i.prototype.readDoubleLE = function(u, d) {
    return u = u >>> 0, d || se(u, 8, this.length), e.read(this, u, true, 52, 8);
  }, i.prototype.readDoubleBE = function(u, d) {
    return u = u >>> 0, d || se(u, 8, this.length), e.read(this, u, false, 52, 8);
  };
  function de(h, u, d, _, O, H) {
    if (!i.isBuffer(h))
      throw new TypeError('"buffer" argument must be a Buffer instance');
    if (u > O || u < H)
      throw new RangeError('"value" argument is out of bounds');
    if (d + _ > h.length)
      throw new RangeError("Index out of range");
  }
  i.prototype.writeUintLE = i.prototype.writeUIntLE = function(u, d, _, O) {
    if (u = +u, d = d >>> 0, _ = _ >>> 0, !O) {
      let _e = Math.pow(2, 8 * _) - 1;
      de(this, u, d, _, _e, 0);
    }
    let H = 1, K = 0;
    for (this[d] = u & 255;++K < _ && (H *= 256); )
      this[d + K] = u / H & 255;
    return d + _;
  }, i.prototype.writeUintBE = i.prototype.writeUIntBE = function(u, d, _, O) {
    if (u = +u, d = d >>> 0, _ = _ >>> 0, !O) {
      let _e = Math.pow(2, 8 * _) - 1;
      de(this, u, d, _, _e, 0);
    }
    let H = _ - 1, K = 1;
    for (this[d + H] = u & 255;--H >= 0 && (K *= 256); )
      this[d + H] = u / K & 255;
    return d + _;
  }, i.prototype.writeUint8 = i.prototype.writeUInt8 = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 1, 255, 0), this[d] = u & 255, d + 1;
  }, i.prototype.writeUint16LE = i.prototype.writeUInt16LE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 2, 65535, 0), this[d] = u & 255, this[d + 1] = u >>> 8, d + 2;
  }, i.prototype.writeUint16BE = i.prototype.writeUInt16BE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 2, 65535, 0), this[d] = u >>> 8, this[d + 1] = u & 255, d + 2;
  }, i.prototype.writeUint32LE = i.prototype.writeUInt32LE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 4, 4294967295, 0), this[d + 3] = u >>> 24, this[d + 2] = u >>> 16, this[d + 1] = u >>> 8, this[d] = u & 255, d + 4;
  }, i.prototype.writeUint32BE = i.prototype.writeUInt32BE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 4, 4294967295, 0), this[d] = u >>> 24, this[d + 1] = u >>> 16, this[d + 2] = u >>> 8, this[d + 3] = u & 255, d + 4;
  };
  function N(h, u, d, _, O) {
    te(u, _, O, h, d, 7);
    let H = Number(u & BigInt(4294967295));
    h[d++] = H, H = H >> 8, h[d++] = H, H = H >> 8, h[d++] = H, H = H >> 8, h[d++] = H;
    let K = Number(u >> BigInt(32) & BigInt(4294967295));
    return h[d++] = K, K = K >> 8, h[d++] = K, K = K >> 8, h[d++] = K, K = K >> 8, h[d++] = K, d;
  }
  function Z(h, u, d, _, O) {
    te(u, _, O, h, d, 7);
    let H = Number(u & BigInt(4294967295));
    h[d + 7] = H, H = H >> 8, h[d + 6] = H, H = H >> 8, h[d + 5] = H, H = H >> 8, h[d + 4] = H;
    let K = Number(u >> BigInt(32) & BigInt(4294967295));
    return h[d + 3] = K, K = K >> 8, h[d + 2] = K, K = K >> 8, h[d + 1] = K, K = K >> 8, h[d] = K, d + 8;
  }
  i.prototype.writeBigUInt64LE = Pt(function(u, d = 0) {
    return N(this, u, d, BigInt(0), BigInt("0xffffffffffffffff"));
  }), i.prototype.writeBigUInt64BE = Pt(function(u, d = 0) {
    return Z(this, u, d, BigInt(0), BigInt("0xffffffffffffffff"));
  }), i.prototype.writeIntLE = function(u, d, _, O) {
    if (u = +u, d = d >>> 0, !O) {
      let Ke = Math.pow(2, 8 * _ - 1);
      de(this, u, d, _, Ke - 1, -Ke);
    }
    let H = 0, K = 1, _e = 0;
    for (this[d] = u & 255;++H < _ && (K *= 256); )
      u < 0 && _e === 0 && this[d + H - 1] !== 0 && (_e = 1), this[d + H] = (u / K >> 0) - _e & 255;
    return d + _;
  }, i.prototype.writeIntBE = function(u, d, _, O) {
    if (u = +u, d = d >>> 0, !O) {
      let Ke = Math.pow(2, 8 * _ - 1);
      de(this, u, d, _, Ke - 1, -Ke);
    }
    let H = _ - 1, K = 1, _e = 0;
    for (this[d + H] = u & 255;--H >= 0 && (K *= 256); )
      u < 0 && _e === 0 && this[d + H + 1] !== 0 && (_e = 1), this[d + H] = (u / K >> 0) - _e & 255;
    return d + _;
  }, i.prototype.writeInt8 = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 1, 127, -128), u < 0 && (u = 255 + u + 1), this[d] = u & 255, d + 1;
  }, i.prototype.writeInt16LE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 2, 32767, -32768), this[d] = u & 255, this[d + 1] = u >>> 8, d + 2;
  }, i.prototype.writeInt16BE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 2, 32767, -32768), this[d] = u >>> 8, this[d + 1] = u & 255, d + 2;
  }, i.prototype.writeInt32LE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 4, 2147483647, -2147483648), this[d] = u & 255, this[d + 1] = u >>> 8, this[d + 2] = u >>> 16, this[d + 3] = u >>> 24, d + 4;
  }, i.prototype.writeInt32BE = function(u, d, _) {
    return u = +u, d = d >>> 0, _ || de(this, u, d, 4, 2147483647, -2147483648), u < 0 && (u = 4294967295 + u + 1), this[d] = u >>> 24, this[d + 1] = u >>> 16, this[d + 2] = u >>> 8, this[d + 3] = u & 255, d + 4;
  }, i.prototype.writeBigInt64LE = Pt(function(u, d = 0) {
    return N(this, u, d, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
  }), i.prototype.writeBigInt64BE = Pt(function(u, d = 0) {
    return Z(this, u, d, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
  });
  function W(h, u, d, _, O, H) {
    if (d + _ > h.length)
      throw new RangeError("Index out of range");
    if (d < 0)
      throw new RangeError("Index out of range");
  }
  function le(h, u, d, _, O) {
    return u = +u, d = d >>> 0, O || W(h, u, d, 4), e.write(h, u, d, _, 23, 4), d + 4;
  }
  i.prototype.writeFloatLE = function(u, d, _) {
    return le(this, u, d, true, _);
  }, i.prototype.writeFloatBE = function(u, d, _) {
    return le(this, u, d, false, _);
  };
  function ge(h, u, d, _, O) {
    return u = +u, d = d >>> 0, O || W(h, u, d, 8), e.write(h, u, d, _, 52, 8), d + 8;
  }
  i.prototype.writeDoubleLE = function(u, d, _) {
    return ge(this, u, d, true, _);
  }, i.prototype.writeDoubleBE = function(u, d, _) {
    return ge(this, u, d, false, _);
  }, i.prototype.copy = function(u, d, _, O) {
    if (!i.isBuffer(u))
      throw new TypeError("argument should be a Buffer");
    if (_ || (_ = 0), !O && O !== 0 && (O = this.length), d >= u.length && (d = u.length), d || (d = 0), O > 0 && O < _ && (O = _), O === _ || u.length === 0 || this.length === 0)
      return 0;
    if (d < 0)
      throw new RangeError("targetStart out of bounds");
    if (_ < 0 || _ >= this.length)
      throw new RangeError("Index out of range");
    if (O < 0)
      throw new RangeError("sourceEnd out of bounds");
    O > this.length && (O = this.length), u.length - d < O - _ && (O = u.length - d + _);
    let H = O - _;
    return this === u && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(d, _, O) : Uint8Array.prototype.set.call(u, this.subarray(_, O), d), H;
  }, i.prototype.fill = function(u, d, _, O) {
    if (typeof u == "string") {
      if (typeof d == "string" ? (O = d, d = 0, _ = this.length) : typeof _ == "string" && (O = _, _ = this.length), O !== undefined && typeof O != "string")
        throw new TypeError("encoding must be a string");
      if (typeof O == "string" && !i.isEncoding(O))
        throw new TypeError("Unknown encoding: " + O);
      if (u.length === 1) {
        let K = u.charCodeAt(0);
        (O === "utf8" && K < 128 || O === "latin1") && (u = K);
      }
    } else
      typeof u == "number" ? u = u & 255 : typeof u == "boolean" && (u = Number(u));
    if (d < 0 || this.length < d || this.length < _)
      throw new RangeError("Out of range index");
    if (_ <= d)
      return this;
    d = d >>> 0, _ = _ === undefined ? this.length : _ >>> 0, u || (u = 0);
    let H;
    if (typeof u == "number")
      for (H = d;H < _; ++H)
        this[H] = u;
    else {
      let K = i.isBuffer(u) ? u : i.from(u, O), _e = K.length;
      if (_e === 0)
        throw new TypeError('The value "' + u + '" is invalid for argument "value"');
      for (H = 0;H < _ - d; ++H)
        this[H + d] = K[H % _e];
    }
    return this;
  };
  let R = {};
  function C(h, u, d) {
    R[h] = class extends d {
      constructor() {
        super(), Object.defineProperty(this, "message", { value: u.apply(this, arguments), writable: true, configurable: true }), this.name = `${this.name} [${h}]`, this.stack, delete this.name;
      }
      get code() {
        return h;
      }
      set code(O) {
        Object.defineProperty(this, "code", { configurable: true, enumerable: true, value: O, writable: true });
      }
      toString() {
        return `${this.name} [${h}]: ${this.message}`;
      }
    };
  }
  C("ERR_BUFFER_OUT_OF_BOUNDS", function(h) {
    return h ? `${h} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
  }, RangeError), C("ERR_INVALID_ARG_TYPE", function(h, u) {
    return `The "${h}" argument must be of type number. Received type ${typeof u}`;
  }, TypeError), C("ERR_OUT_OF_RANGE", function(h, u, d) {
    let _ = `The value of "${h}" is out of range.`, O = d;
    return Number.isInteger(d) && Math.abs(d) > 2 ** 32 ? O = j(String(d)) : typeof d == "bigint" && (O = String(d), (d > BigInt(2) ** BigInt(32) || d < -(BigInt(2) ** BigInt(32))) && (O = j(O)), O += "n"), _ += ` It must be ${u}. Received ${O}`, _;
  }, RangeError);
  function j(h) {
    let u = "", d = h.length, _ = h[0] === "-" ? 1 : 0;
    for (;d >= _ + 4; d -= 3)
      u = `_${h.slice(d - 3, d)}${u}`;
    return `${h.slice(0, d)}${u}`;
  }
  function V(h, u, d) {
    b(u, "offset"), (h[u] === undefined || h[u + d] === undefined) && x(u, h.length - (d + 1));
  }
  function te(h, u, d, _, O, H) {
    if (h > d || h < u) {
      let K = typeof u == "bigint" ? "n" : "", _e;
      throw u === 0 || u === BigInt(0) ? _e = `>= 0${K} and < 2${K} ** ${(H + 1) * 8}${K}` : _e = `>= -(2${K} ** ${(H + 1) * 8 - 1}${K}) and < 2 ** ${(H + 1) * 8 - 1}${K}`, new R.ERR_OUT_OF_RANGE("value", _e, h);
    }
    V(_, O, H);
  }
  function b(h, u) {
    if (typeof h != "number")
      throw new R.ERR_INVALID_ARG_TYPE(u, "number", h);
  }
  function x(h, u, d) {
    throw Math.floor(h) !== h ? (b(h, d), new R.ERR_OUT_OF_RANGE("offset", "an integer", h)) : u < 0 ? new R.ERR_BUFFER_OUT_OF_BOUNDS : new R.ERR_OUT_OF_RANGE("offset", `>= 0 and <= ${u}`, h);
  }
  let F = /[^+/0-9A-Za-z-_]/g;
  function J(h) {
    if (h = h.split("=")[0], h = h.trim().replace(F, ""), h.length < 2)
      return "";
    for (;h.length % 4 !== 0; )
      h = h + "=";
    return h;
  }
  function Se(h, u) {
    u = u || 1 / 0;
    let d, _ = h.length, O = null, H = [];
    for (let K = 0;K < _; ++K) {
      if (d = h.charCodeAt(K), d > 55295 && d < 57344) {
        if (!O) {
          if (d > 56319) {
            (u -= 3) > -1 && H.push(239, 191, 189);
            continue;
          } else if (K + 1 === _) {
            (u -= 3) > -1 && H.push(239, 191, 189);
            continue;
          }
          O = d;
          continue;
        }
        if (d < 56320) {
          (u -= 3) > -1 && H.push(239, 191, 189), O = d;
          continue;
        }
        d = (O - 55296 << 10 | d - 56320) + 65536;
      } else
        O && (u -= 3) > -1 && H.push(239, 191, 189);
      if (O = null, d < 128) {
        if ((u -= 1) < 0)
          break;
        H.push(d);
      } else if (d < 2048) {
        if ((u -= 2) < 0)
          break;
        H.push(d >> 6 | 192, d & 63 | 128);
      } else if (d < 65536) {
        if ((u -= 3) < 0)
          break;
        H.push(d >> 12 | 224, d >> 6 & 63 | 128, d & 63 | 128);
      } else if (d < 1114112) {
        if ((u -= 4) < 0)
          break;
        H.push(d >> 18 | 240, d >> 12 & 63 | 128, d >> 6 & 63 | 128, d & 63 | 128);
      } else
        throw new Error("Invalid code point");
    }
    return H;
  }
  function me(h) {
    let u = [];
    for (let d = 0;d < h.length; ++d)
      u.push(h.charCodeAt(d) & 255);
    return u;
  }
  function U(h, u) {
    let d, _, O, H = [];
    for (let K = 0;K < h.length && !((u -= 2) < 0); ++K)
      d = h.charCodeAt(K), _ = d >> 8, O = d % 256, H.push(O), H.push(_);
    return H;
  }
  function At(h) {
    return t.toByteArray(J(h));
  }
  function jt(h, u, d, _) {
    let O;
    for (O = 0;O < _ && !(O + d >= u.length || O >= h.length); ++O)
      u[O + d] = h[O];
    return O;
  }
  function _t(h, u) {
    return h instanceof u || h != null && h.constructor != null && h.constructor.name != null && h.constructor.name === u.name;
  }
  function vr(h) {
    return h !== h;
  }
  let fi = function() {
    let h = "0123456789abcdef", u = new Array(256);
    for (let d = 0;d < 16; ++d) {
      let _ = d * 16;
      for (let O = 0;O < 16; ++O)
        u[_ + O] = h[d] + h[O];
    }
    return u;
  }();
  function Pt(h) {
    return typeof BigInt > "u" ? _r : h;
  }
  function _r() {
    throw new Error("BigInt not supported");
  }
  return xn;
}
var br;
var ic;
var yi;
var oc;
var xn;
var sc;
var hi = ot(() => {
  S();
  A();
  k();
  br = {}, ic = false;
  yi = {}, oc = false;
  xn = {}, sc = false;
});
var Pn;
var z;
var BA;
var IA;
var ac = ot(() => {
  S();
  A();
  k();
  hi();
  Pn = $t();
  Pn.Buffer;
  Pn.SlowBuffer;
  Pn.INSPECT_MAX_BYTES;
  Pn.kMaxLength;
  z = Pn.Buffer, BA = Pn.INSPECT_MAX_BYTES, IA = Pn.kMaxLength;
});
var A = ot(() => {
  ac();
});
function Wt() {
  return Km || (Km = true, typeof Object.create == "function" ? eo = function(e, n) {
    n && (e.super_ = n, e.prototype = Object.create(n.prototype, { constructor: { value: e, enumerable: false, writable: true, configurable: true } }));
  } : eo = function(e, n) {
    if (n) {
      e.super_ = n;
      var r = function() {};
      r.prototype = n.prototype, e.prototype = new r, e.prototype.constructor = e;
    }
  }), eo;
}
var eo;
var Km;
var Gs = ot(() => {
  S();
  A();
  k();
  eo = {}, Km = false;
});
function Ae() {
  Ae.init.call(this);
}
function to(t) {
  if (typeof t != "function")
    throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t);
}
function ey(t) {
  return t._maxListeners === undefined ? Ae.defaultMaxListeners : t._maxListeners;
}
function Gm(t, e, n, r) {
  var o, s, i, a;
  if (to(n), (s = t._events) === undefined ? (s = t._events = Object.create(null), t._eventsCount = 0) : (s.newListener !== undefined && (t.emit("newListener", e, n.listener ? n.listener : n), s = t._events), i = s[e]), i === undefined)
    i = s[e] = n, ++t._eventsCount;
  else if (typeof i == "function" ? i = s[e] = r ? [n, i] : [i, n] : r ? i.unshift(n) : i.push(n), (o = ey(t)) > 0 && i.length > o && !i.warned) {
    i.warned = true;
    var l = new Error("Possible EventEmitter memory leak detected. " + i.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
    l.name = "MaxListenersExceededWarning", l.emitter = t, l.type = e, l.count = i.length, a = l, console && console.warn && console.warn(a);
  }
  return t;
}
function qB() {
  if (!this.fired)
    return this.target.removeListener(this.type, this.wrapFn), this.fired = true, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
}
function Vm(t, e, n) {
  var r = { fired: false, wrapFn: undefined, target: t, type: e, listener: n }, o = qB.bind(r);
  return o.listener = n, r.wrapFn = o, o;
}
function Jm(t, e, n) {
  var r = t._events;
  if (r === undefined)
    return [];
  var o = r[e];
  return o === undefined ? [] : typeof o == "function" ? n ? [o.listener || o] : [o] : n ? function(s) {
    for (var i = new Array(s.length), a = 0;a < i.length; ++a)
      i[a] = s[a].listener || s[a];
    return i;
  }(o) : ty(o, o.length);
}
function Ym(t) {
  var e = this._events;
  if (e !== undefined) {
    var n = e[t];
    if (typeof n == "function")
      return 1;
    if (n !== undefined)
      return n.length;
  }
  return 0;
}
function ty(t, e) {
  for (var n = new Array(e), r = 0;r < e; ++r)
    n[r] = t[r];
  return n;
}
var Xm;
var Qm;
var lr;
var Fm;
var zm;
var qm;
var yt;
var Vs = ot(() => {
  S();
  A();
  k();
  lr = typeof Reflect == "object" ? Reflect : null, Fm = lr && typeof lr.apply == "function" ? lr.apply : function(t, e, n) {
    return Function.prototype.apply.call(t, e, n);
  };
  Qm = lr && typeof lr.ownKeys == "function" ? lr.ownKeys : Object.getOwnPropertySymbols ? function(t) {
    return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));
  } : function(t) {
    return Object.getOwnPropertyNames(t);
  };
  zm = Number.isNaN || function(t) {
    return t != t;
  };
  Xm = Ae, Ae.EventEmitter = Ae, Ae.prototype._events = undefined, Ae.prototype._eventsCount = 0, Ae.prototype._maxListeners = undefined;
  qm = 10;
  Object.defineProperty(Ae, "defaultMaxListeners", { enumerable: true, get: function() {
    return qm;
  }, set: function(t) {
    if (typeof t != "number" || t < 0 || zm(t))
      throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + ".");
    qm = t;
  } }), Ae.init = function() {
    this._events !== undefined && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || undefined;
  }, Ae.prototype.setMaxListeners = function(t) {
    if (typeof t != "number" || t < 0 || zm(t))
      throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + t + ".");
    return this._maxListeners = t, this;
  }, Ae.prototype.getMaxListeners = function() {
    return ey(this);
  }, Ae.prototype.emit = function(t) {
    for (var e = [], n = 1;n < arguments.length; n++)
      e.push(arguments[n]);
    var r = t === "error", o = this._events;
    if (o !== undefined)
      r = r && o.error === undefined;
    else if (!r)
      return false;
    if (r) {
      var s;
      if (e.length > 0 && (s = e[0]), s instanceof Error)
        throw s;
      var i = new Error("Unhandled error." + (s ? " (" + s.message + ")" : ""));
      throw i.context = s, i;
    }
    var a = o[t];
    if (a === undefined)
      return false;
    if (typeof a == "function")
      Fm(a, this, e);
    else {
      var l = a.length, c = ty(a, l);
      for (n = 0;n < l; ++n)
        Fm(c[n], this, e);
    }
    return true;
  }, Ae.prototype.addListener = function(t, e) {
    return Gm(this, t, e, false);
  }, Ae.prototype.on = Ae.prototype.addListener, Ae.prototype.prependListener = function(t, e) {
    return Gm(this, t, e, true);
  }, Ae.prototype.once = function(t, e) {
    return to(e), this.on(t, Vm(this, t, e)), this;
  }, Ae.prototype.prependOnceListener = function(t, e) {
    return to(e), this.prependListener(t, Vm(this, t, e)), this;
  }, Ae.prototype.removeListener = function(t, e) {
    var n, r, o, s, i;
    if (to(e), (r = this._events) === undefined)
      return this;
    if ((n = r[t]) === undefined)
      return this;
    if (n === e || n.listener === e)
      --this._eventsCount == 0 ? this._events = Object.create(null) : (delete r[t], r.removeListener && this.emit("removeListener", t, n.listener || e));
    else if (typeof n != "function") {
      for (o = -1, s = n.length - 1;s >= 0; s--)
        if (n[s] === e || n[s].listener === e) {
          i = n[s].listener, o = s;
          break;
        }
      if (o < 0)
        return this;
      o === 0 ? n.shift() : function(a, l) {
        for (;l + 1 < a.length; l++)
          a[l] = a[l + 1];
        a.pop();
      }(n, o), n.length === 1 && (r[t] = n[0]), r.removeListener !== undefined && this.emit("removeListener", t, i || e);
    }
    return this;
  }, Ae.prototype.off = Ae.prototype.removeListener, Ae.prototype.removeAllListeners = function(t) {
    var e, n, r;
    if ((n = this._events) === undefined)
      return this;
    if (n.removeListener === undefined)
      return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[t] !== undefined && (--this._eventsCount == 0 ? this._events = Object.create(null) : delete n[t]), this;
    if (arguments.length === 0) {
      var o, s = Object.keys(n);
      for (r = 0;r < s.length; ++r)
        (o = s[r]) !== "removeListener" && this.removeAllListeners(o);
      return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
    }
    if (typeof (e = n[t]) == "function")
      this.removeListener(t, e);
    else if (e !== undefined)
      for (r = e.length - 1;r >= 0; r--)
        this.removeListener(t, e[r]);
    return this;
  }, Ae.prototype.listeners = function(t) {
    return Jm(this, t, true);
  }, Ae.prototype.rawListeners = function(t) {
    return Jm(this, t, false);
  }, Ae.listenerCount = function(t, e) {
    return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ym.call(t, e);
  }, Ae.prototype.listenerCount = Ym, Ae.prototype.eventNames = function() {
    return this._eventsCount > 0 ? Qm(this._events) : [];
  };
  yt = Xm;
  yt.EventEmitter;
  yt.defaultMaxListeners;
  yt.init;
  yt.listenerCount;
  yt.EventEmitter;
  yt.defaultMaxListeners;
  yt.init;
  yt.listenerCount;
});
var ny = ot(() => {
  S();
  A();
  k();
  Vs();
  yt.once = function(t, e) {
    return new Promise((n, r) => {
      function o(...i) {
        s !== undefined && t.removeListener("error", s), n(i);
      }
      let s;
      e !== "error" && (s = (i) => {
        t.removeListener(name, o), r(i);
      }, t.once("error", s)), t.once(e, o);
    });
  };
  yt.on = function(t, e) {
    let n = [], r = [], o = null, s = false, i = { async next() {
      let c = n.shift();
      if (c)
        return createIterResult(c, false);
      if (o) {
        let f = Promise.reject(o);
        return o = null, f;
      }
      return s ? createIterResult(undefined, true) : new Promise((f, g) => r.push({ resolve: f, reject: g }));
    }, async return() {
      t.removeListener(e, a), t.removeListener("error", l), s = true;
      for (let c of r)
        c.resolve(createIterResult(undefined, true));
      return createIterResult(undefined, true);
    }, throw(c) {
      o = c, t.removeListener(e, a), t.removeListener("error", l);
    }, [Symbol.asyncIterator]() {
      return this;
    } };
    return t.on(e, a), t.on("error", l), i;
    function a(...c) {
      let f = r.shift();
      f ? f.resolve(createIterResult(c, false)) : n.push(c);
    }
    function l(c) {
      s = true;
      let f = r.shift();
      f ? f.reject(c) : o = c, i.return();
    }
  };
});
function ea() {
  throw new Error("setTimeout has not been defined");
}
function ta() {
  throw new Error("clearTimeout has not been defined");
}
function yy(t) {
  if (on === setTimeout)
    return setTimeout(t, 0);
  if ((on === ea || !on) && setTimeout)
    return on = setTimeout, setTimeout(t, 0);
  try {
    return on(t, 0);
  } catch {
    try {
      return on.call(null, t, 0);
    } catch {
      return on.call(this || cr, t, 0);
    }
  }
}
function GB() {
  ur && zn && (ur = false, zn.length ? an = zn.concat(an) : ao = -1, an.length && hy());
}
function hy() {
  if (!ur) {
    var t = yy(GB);
    ur = true;
    for (var e = an.length;e; ) {
      for (zn = an, an = [];++ao < e; )
        zn && zn[ao].run();
      ao = -1, e = an.length;
    }
    zn = null, ur = false, function(n) {
      if (sn === clearTimeout)
        return clearTimeout(n);
      if ((sn === ta || !sn) && clearTimeout)
        return sn = clearTimeout, clearTimeout(n);
      try {
        sn(n);
      } catch {
        try {
          return sn.call(null, n);
        } catch {
          return sn.call(this || cr, n);
        }
      }
    }(t);
  }
}
function ry(t, e) {
  (this || cr).fun = t, (this || cr).array = e;
}
function rn() {}
function Gn(t) {
  return t.call.bind(t);
}
function ei(t, e) {
  if (typeof t != "object")
    return false;
  try {
    return e(t), true;
  } catch {
    return false;
  }
}
function oy(t) {
  return ht && wt ? Bt(t) !== undefined : xy(t) || Py(t) || By(t) || Iy(t) || Ey(t) || Sy(t) || ky(t) || Ay(t) || Cy(t) || Oy(t) || Ry(t);
}
function xy(t) {
  return ht && wt ? Bt(t) === "Uint8Array" : Le(t) === "[object Uint8Array]" || iI(t) && t.buffer !== undefined;
}
function Py(t) {
  return ht && wt ? Bt(t) === "Uint8ClampedArray" : Le(t) === "[object Uint8ClampedArray]";
}
function By(t) {
  return ht && wt ? Bt(t) === "Uint16Array" : Le(t) === "[object Uint16Array]";
}
function Iy(t) {
  return ht && wt ? Bt(t) === "Uint32Array" : Le(t) === "[object Uint32Array]";
}
function Ey(t) {
  return ht && wt ? Bt(t) === "Int8Array" : Le(t) === "[object Int8Array]";
}
function Sy(t) {
  return ht && wt ? Bt(t) === "Int16Array" : Le(t) === "[object Int16Array]";
}
function ky(t) {
  return ht && wt ? Bt(t) === "Int32Array" : Le(t) === "[object Int32Array]";
}
function Ay(t) {
  return ht && wt ? Bt(t) === "Float32Array" : Le(t) === "[object Float32Array]";
}
function Cy(t) {
  return ht && wt ? Bt(t) === "Float64Array" : Le(t) === "[object Float64Array]";
}
function Oy(t) {
  return ht && wt ? Bt(t) === "BigInt64Array" : Le(t) === "[object BigInt64Array]";
}
function Ry(t) {
  return ht && wt ? Bt(t) === "BigUint64Array" : Le(t) === "[object BigUint64Array]";
}
function no(t) {
  return Le(t) === "[object Map]";
}
function ro(t) {
  return Le(t) === "[object Set]";
}
function io(t) {
  return Le(t) === "[object WeakMap]";
}
function Js(t) {
  return Le(t) === "[object WeakSet]";
}
function uo(t) {
  return Le(t) === "[object ArrayBuffer]";
}
function sy(t) {
  return typeof ArrayBuffer < "u" && (uo.working ? uo(t) : t instanceof ArrayBuffer);
}
function co(t) {
  return Le(t) === "[object DataView]";
}
function ay(t) {
  return typeof DataView < "u" && (co.working ? co(t) : t instanceof DataView);
}
function fo(t) {
  return Le(t) === "[object SharedArrayBuffer]";
}
function ly(t) {
  return typeof SharedArrayBuffer < "u" && (fo.working ? fo(t) : t instanceof SharedArrayBuffer);
}
function uy(t) {
  return ei(t, uI);
}
function cy(t) {
  return ei(t, cI);
}
function dy(t) {
  return ei(t, dI);
}
function fy(t) {
  return wy && ei(t, fI);
}
function py(t) {
  return ra && ei(t, pI);
}
function Tn(t, e) {
  var n = { seen: [], stylize: yI };
  return arguments.length >= 3 && (n.depth = arguments[2]), arguments.length >= 4 && (n.colors = arguments[3]), ia(e) ? n.showHidden = e : e && L._extend(n, e), qn(n.showHidden) && (n.showHidden = false), qn(n.depth) && (n.depth = 2), qn(n.colors) && (n.colors = false), qn(n.customInspect) && (n.customInspect = true), n.colors && (n.stylize = mI), po(n, t, n.depth);
}
function mI(t, e) {
  var n = Tn.styles[e];
  return n ? "\x1B[" + Tn.colors[n][0] + "m" + t + "\x1B[" + Tn.colors[n][1] + "m" : t;
}
function yI(t, e) {
  return t;
}
function po(t, e, n) {
  if (t.customInspect && e && lo(e.inspect) && e.inspect !== L.inspect && (!e.constructor || e.constructor.prototype !== e)) {
    var r = e.inspect(n, t);
    return go(r) || (r = po(t, r, n)), r;
  }
  var o = function(p, y) {
    if (qn(y))
      return p.stylize("undefined", "undefined");
    if (go(y)) {
      var T = "'" + JSON.stringify(y).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
      return p.stylize(T, "string");
    }
    if (Dy(y))
      return p.stylize("" + y, "number");
    if (ia(y))
      return p.stylize("" + y, "boolean");
    if (ho(y))
      return p.stylize("null", "null");
  }(t, e);
  if (o)
    return o;
  var s = Object.keys(e), i = function(p) {
    var y = {};
    return p.forEach(function(T, P) {
      y[T] = true;
    }), y;
  }(s);
  if (t.showHidden && (s = Object.getOwnPropertyNames(e)), Qr(e) && (s.indexOf("message") >= 0 || s.indexOf("description") >= 0))
    return Ys(e);
  if (s.length === 0) {
    if (lo(e)) {
      var a = e.name ? ": " + e.name : "";
      return t.stylize("[Function" + a + "]", "special");
    }
    if (Xr(e))
      return t.stylize(RegExp.prototype.toString.call(e), "regexp");
    if (mo(e))
      return t.stylize(Date.prototype.toString.call(e), "date");
    if (Qr(e))
      return Ys(e);
  }
  var l, c = "", f = false, g = ["{", "}"];
  return Ny(e) && (f = true, g = ["[", "]"]), lo(e) && (c = " [Function" + (e.name ? ": " + e.name : "") + "]"), Xr(e) && (c = " " + RegExp.prototype.toString.call(e)), mo(e) && (c = " " + Date.prototype.toUTCString.call(e)), Qr(e) && (c = " " + Ys(e)), s.length !== 0 || f && e.length != 0 ? n < 0 ? Xr(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special") : (t.seen.push(e), l = f ? function(p, y, T, P, B) {
    for (var v = [], E = 0, I = y.length;E < I; ++E)
      Hy(y, String(E)) ? v.push(Xs(p, y, T, P, String(E), true)) : v.push("");
    return B.forEach(function(D) {
      D.match(/^\d+$/) || v.push(Xs(p, y, T, P, D, true));
    }), v;
  }(t, e, n, i, s) : s.map(function(p) {
    return Xs(t, e, n, i, p, f);
  }), t.seen.pop(), function(p, y, T) {
    var P = 0;
    return p.reduce(function(B, v) {
      return P++, v.indexOf(`
`) >= 0 && P++, B + v.replace(/\u001b\[\d\d?m/g, "").length + 1;
    }, 0) > 60 ? T[0] + (y === "" ? "" : y + `
 `) + " " + p.join(`,
  `) + " " + T[1] : T[0] + y + " " + p.join(", ") + " " + T[1];
  }(l, c, g)) : g[0] + c + g[1];
}
function Ys(t) {
  return "[" + Error.prototype.toString.call(t) + "]";
}
function Xs(t, e, n, r, o, s) {
  var i, a, l;
  if ((l = Object.getOwnPropertyDescriptor(e, o) || { value: e[o] }).get ? a = l.set ? t.stylize("[Getter/Setter]", "special") : t.stylize("[Getter]", "special") : l.set && (a = t.stylize("[Setter]", "special")), Hy(r, o) || (i = "[" + o + "]"), a || (t.seen.indexOf(l.value) < 0 ? (a = ho(n) ? po(t, l.value, null) : po(t, l.value, n - 1)).indexOf(`
`) > -1 && (a = s ? a.split(`
`).map(function(c) {
    return "  " + c;
  }).join(`
`).substr(2) : `
` + a.split(`
`).map(function(c) {
    return "   " + c;
  }).join(`
`)) : a = t.stylize("[Circular]", "special")), qn(i)) {
    if (s && o.match(/^\d+$/))
      return a;
    (i = JSON.stringify("" + o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (i = i.substr(1, i.length - 2), i = t.stylize(i, "name")) : (i = i.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), i = t.stylize(i, "string"));
  }
  return i + ": " + a;
}
function Ny(t) {
  return Array.isArray(t);
}
function ia(t) {
  return typeof t == "boolean";
}
function ho(t) {
  return t === null;
}
function Dy(t) {
  return typeof t == "number";
}
function go(t) {
  return typeof t == "string";
}
function qn(t) {
  return t === undefined;
}
function Xr(t) {
  return dr(t) && oa(t) === "[object RegExp]";
}
function dr(t) {
  return typeof t == "object" && t !== null;
}
function mo(t) {
  return dr(t) && oa(t) === "[object Date]";
}
function Qr(t) {
  return dr(t) && (oa(t) === "[object Error]" || t instanceof Error);
}
function lo(t) {
  return typeof t == "function";
}
function oa(t) {
  return Object.prototype.toString.call(t);
}
function Qs(t) {
  return t < 10 ? "0" + t.toString(10) : t.toString(10);
}
function TI() {
  var t = new Date, e = [Qs(t.getHours()), Qs(t.getMinutes()), Qs(t.getSeconds())].join(":");
  return [t.getDate(), hI[t.getMonth()], e].join(" ");
}
function Hy(t, e) {
  return Object.prototype.hasOwnProperty.call(t, e);
}
function vI(t, e) {
  if (!t) {
    var n = new Error("Promise was rejected with a falsy value");
    n.reason = t, t = n;
  }
  return e(t);
}
var my;
var on;
var sn;
var cr;
var Ye;
var zn;
var an;
var ur;
var ao;
var He;
var VB;
var na;
var yo;
var Ty;
var JB;
var YB;
var XB;
var QB;
var eI;
var vy;
var _y;
var iy;
var tI;
var nI;
var rI;
var by;
var be;
var iI;
var oI;
var sI;
var wy;
var ra;
var wt;
var ht;
var aI;
var Le;
var uI;
var cI;
var dI;
var Yr;
var L;
var Kt;
var gy;
var gI;
var oo;
var My;
var so;
var hI;
var Fn;
var HC;
var To = ot(() => {
  S();
  A();
  k();
  cr = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global, Ye = my = {};
  (function() {
    try {
      on = typeof setTimeout == "function" ? setTimeout : ea;
    } catch {
      on = ea;
    }
    try {
      sn = typeof clearTimeout == "function" ? clearTimeout : ta;
    } catch {
      sn = ta;
    }
  })();
  an = [], ur = false, ao = -1;
  Ye.nextTick = function(t) {
    var e = new Array(arguments.length - 1);
    if (arguments.length > 1)
      for (var n = 1;n < arguments.length; n++)
        e[n - 1] = arguments[n];
    an.push(new ry(t, e)), an.length !== 1 || ur || yy(hy);
  }, ry.prototype.run = function() {
    (this || cr).fun.apply(null, (this || cr).array);
  }, Ye.title = "browser", Ye.browser = true, Ye.env = {}, Ye.argv = [], Ye.version = "", Ye.versions = {}, Ye.on = rn, Ye.addListener = rn, Ye.once = rn, Ye.off = rn, Ye.removeListener = rn, Ye.removeAllListeners = rn, Ye.emit = rn, Ye.prependListener = rn, Ye.prependOnceListener = rn, Ye.listeners = function(t) {
    return [];
  }, Ye.binding = function(t) {
    throw new Error("process.binding is not supported");
  }, Ye.cwd = function() {
    return "/";
  }, Ye.chdir = function(t) {
    throw new Error("process.chdir is not supported");
  }, Ye.umask = function() {
    return 0;
  };
  He = my;
  He.addListener;
  He.argv;
  He.binding;
  He.browser;
  He.chdir;
  He.cwd;
  He.emit;
  He.env;
  He.listeners;
  He.nextTick;
  He.off;
  He.on;
  He.once;
  He.prependListener;
  He.prependOnceListener;
  He.removeAllListeners;
  He.removeListener;
  He.title;
  He.umask;
  He.version;
  He.versions;
  VB = typeof Symbol == "function" && typeof Symbol.toStringTag == "symbol", na = Object.prototype.toString, yo = function(t) {
    return !(VB && t && typeof t == "object" && (Symbol.toStringTag in t)) && na.call(t) === "[object Arguments]";
  }, Ty = function(t) {
    return !!yo(t) || t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && na.call(t) !== "[object Array]" && na.call(t.callee) === "[object Function]";
  }, JB = function() {
    return yo(arguments);
  }();
  yo.isLegacyArguments = Ty;
  YB = JB ? yo : Ty, XB = Object.prototype.toString, QB = Function.prototype.toString, eI = /^\s*(?:function)?\*/, vy = typeof Symbol == "function" && typeof Symbol.toStringTag == "symbol", _y = Object.getPrototypeOf, iy = function() {
    if (!vy)
      return false;
    try {
      return Function("return function*() {}")();
    } catch {}
  }(), tI = iy ? _y(iy) : {}, nI = function(t) {
    return typeof t == "function" && (!!eI.test(QB.call(t)) || (vy ? _y(t) === tI : XB.call(t) === "[object GeneratorFunction]"));
  }, rI = typeof Object.create == "function" ? function(t, e) {
    e && (t.super_ = e, t.prototype = Object.create(e.prototype, { constructor: { value: t, enumerable: false, writable: true, configurable: true } }));
  } : function(t, e) {
    if (e) {
      t.super_ = e;
      var n = function() {};
      n.prototype = e.prototype, t.prototype = new n, t.prototype.constructor = t;
    }
  }, by = function(t) {
    return t && typeof t == "object" && typeof t.copy == "function" && typeof t.fill == "function" && typeof t.readUInt8 == "function";
  }, be = {}, iI = by, oI = YB, sI = nI;
  wy = typeof BigInt < "u", ra = typeof Symbol < "u", wt = ra && Symbol.toStringTag !== undefined, ht = typeof Uint8Array < "u", aI = typeof ArrayBuffer < "u";
  if (ht && wt)
    var lI = Object.getPrototypeOf(Uint8Array.prototype), Bt2 = Gn(Object.getOwnPropertyDescriptor(lI, Symbol.toStringTag).get);
  Le = Gn(Object.prototype.toString), uI = Gn(Number.prototype.valueOf), cI = Gn(String.prototype.valueOf), dI = Gn(Boolean.prototype.valueOf);
  if (wy)
    var fI2 = Gn(BigInt.prototype.valueOf);
  if (ra)
    var pI2 = Gn(Symbol.prototype.valueOf);
  be.isArgumentsObject = oI, be.isGeneratorFunction = sI, be.isPromise = function(t) {
    return typeof Promise < "u" && t instanceof Promise || t !== null && typeof t == "object" && typeof t.then == "function" && typeof t.catch == "function";
  }, be.isArrayBufferView = function(t) {
    return aI && ArrayBuffer.isView ? ArrayBuffer.isView(t) : oy(t) || ay(t);
  }, be.isTypedArray = oy, be.isUint8Array = xy, be.isUint8ClampedArray = Py, be.isUint16Array = By, be.isUint32Array = Iy, be.isInt8Array = Ey, be.isInt16Array = Sy, be.isInt32Array = ky, be.isFloat32Array = Ay, be.isFloat64Array = Cy, be.isBigInt64Array = Oy, be.isBigUint64Array = Ry, no.working = typeof Map < "u" && no(new Map), be.isMap = function(t) {
    return typeof Map < "u" && (no.working ? no(t) : t instanceof Map);
  }, ro.working = typeof Set < "u" && ro(new Set), be.isSet = function(t) {
    return typeof Set < "u" && (ro.working ? ro(t) : t instanceof Set);
  }, io.working = typeof WeakMap < "u" && io(new WeakMap), be.isWeakMap = function(t) {
    return typeof WeakMap < "u" && (io.working ? io(t) : t instanceof WeakMap);
  }, Js.working = typeof WeakSet < "u" && Js(new WeakSet), be.isWeakSet = function(t) {
    return Js(t);
  }, uo.working = typeof ArrayBuffer < "u" && uo(new ArrayBuffer), be.isArrayBuffer = sy, co.working = typeof ArrayBuffer < "u" && typeof DataView < "u" && co(new DataView(new ArrayBuffer(1), 0, 1)), be.isDataView = ay, fo.working = typeof SharedArrayBuffer < "u" && fo(new SharedArrayBuffer), be.isSharedArrayBuffer = ly, be.isAsyncFunction = function(t) {
    return Le(t) === "[object AsyncFunction]";
  }, be.isMapIterator = function(t) {
    return Le(t) === "[object Map Iterator]";
  }, be.isSetIterator = function(t) {
    return Le(t) === "[object Set Iterator]";
  }, be.isGeneratorObject = function(t) {
    return Le(t) === "[object Generator]";
  }, be.isWebAssemblyCompiledModule = function(t) {
    return Le(t) === "[object WebAssembly.Module]";
  }, be.isNumberObject = uy, be.isStringObject = cy, be.isBooleanObject = dy, be.isBigIntObject = fy, be.isSymbolObject = py, be.isBoxedPrimitive = function(t) {
    return uy(t) || cy(t) || dy(t) || fy(t) || py(t);
  }, be.isAnyArrayBuffer = function(t) {
    return ht && (sy(t) || ly(t));
  }, ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(t) {
    Object.defineProperty(be, t, { enumerable: false, value: function() {
      throw new Error(t + " is not supported in userland");
    } });
  });
  Yr = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global, L = {}, Kt = He, gy = Object.getOwnPropertyDescriptors || function(t) {
    for (var e = Object.keys(t), n = {}, r = 0;r < e.length; r++)
      n[e[r]] = Object.getOwnPropertyDescriptor(t, e[r]);
    return n;
  }, gI = /%[sdj%]/g;
  L.format = function(t) {
    if (!go(t)) {
      for (var e = [], n = 0;n < arguments.length; n++)
        e.push(Tn(arguments[n]));
      return e.join(" ");
    }
    n = 1;
    for (var r = arguments, o = r.length, s = String(t).replace(gI, function(a) {
      if (a === "%%")
        return "%";
      if (n >= o)
        return a;
      switch (a) {
        case "%s":
          return String(r[n++]);
        case "%d":
          return Number(r[n++]);
        case "%j":
          try {
            return JSON.stringify(r[n++]);
          } catch {
            return "[Circular]";
          }
        default:
          return a;
      }
    }), i = r[n];n < o; i = r[++n])
      ho(i) || !dr(i) ? s += " " + i : s += " " + Tn(i);
    return s;
  }, L.deprecate = function(t, e) {
    if (Kt !== undefined && Kt.noDeprecation === true)
      return t;
    if (Kt === undefined)
      return function() {
        return L.deprecate(t, e).apply(this || Yr, arguments);
      };
    var n = false;
    return function() {
      if (!n) {
        if (Kt.throwDeprecation)
          throw new Error(e);
        Kt.traceDeprecation ? console.trace(e) : console.error(e), n = true;
      }
      return t.apply(this || Yr, arguments);
    };
  };
  oo = {}, My = /^$/;
  Kt.env.NODE_DEBUG && (so = Kt.env.NODE_DEBUG, so = so.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(), My = new RegExp("^" + so + "$", "i"));
  L.debuglog = function(t) {
    if (t = t.toUpperCase(), !oo[t])
      if (My.test(t)) {
        var e = Kt.pid;
        oo[t] = function() {
          var n = L.format.apply(L, arguments);
          console.error("%s %d: %s", t, e, n);
        };
      } else
        oo[t] = function() {};
    return oo[t];
  }, L.inspect = Tn, Tn.colors = { bold: [1, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], white: [37, 39], grey: [90, 39], black: [30, 39], blue: [34, 39], cyan: [36, 39], green: [32, 39], magenta: [35, 39], red: [31, 39], yellow: [33, 39] }, Tn.styles = { special: "cyan", number: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", date: "magenta", regexp: "red" }, L.types = be, L.isArray = Ny, L.isBoolean = ia, L.isNull = ho, L.isNullOrUndefined = function(t) {
    return t == null;
  }, L.isNumber = Dy, L.isString = go, L.isSymbol = function(t) {
    return typeof t == "symbol";
  }, L.isUndefined = qn, L.isRegExp = Xr, L.types.isRegExp = Xr, L.isObject = dr, L.isDate = mo, L.types.isDate = mo, L.isError = Qr, L.types.isNativeError = Qr, L.isFunction = lo, L.isPrimitive = function(t) {
    return t === null || typeof t == "boolean" || typeof t == "number" || typeof t == "string" || typeof t == "symbol" || t === undefined;
  }, L.isBuffer = by;
  hI = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  L.log = function() {
    console.log("%s - %s", TI(), L.format.apply(L, arguments));
  }, L.inherits = rI, L._extend = function(t, e) {
    if (!e || !dr(e))
      return t;
    for (var n = Object.keys(e), r = n.length;r--; )
      t[n[r]] = e[n[r]];
    return t;
  };
  Fn = typeof Symbol < "u" ? Symbol("util.promisify.custom") : undefined;
  L.promisify = function(t) {
    if (typeof t != "function")
      throw new TypeError('The "original" argument must be of type Function');
    if (Fn && t[Fn]) {
      var e;
      if (typeof (e = t[Fn]) != "function")
        throw new TypeError('The "util.promisify.custom" argument must be of type Function');
      return Object.defineProperty(e, Fn, { value: e, enumerable: false, writable: false, configurable: true }), e;
    }
    function e() {
      for (var n, r, o = new Promise(function(a, l) {
        n = a, r = l;
      }), s = [], i = 0;i < arguments.length; i++)
        s.push(arguments[i]);
      s.push(function(a, l) {
        a ? r(a) : n(l);
      });
      try {
        t.apply(this || Yr, s);
      } catch (a) {
        r(a);
      }
      return o;
    }
    return Object.setPrototypeOf(e, Object.getPrototypeOf(t)), Fn && Object.defineProperty(e, Fn, { value: e, enumerable: false, writable: false, configurable: true }), Object.defineProperties(e, gy(t));
  }, L.promisify.custom = Fn, L.callbackify = function(t) {
    if (typeof t != "function")
      throw new TypeError('The "original" argument must be of type Function');
    function e() {
      for (var n = [], r = 0;r < arguments.length; r++)
        n.push(arguments[r]);
      var o = n.pop();
      if (typeof o != "function")
        throw new TypeError("The last argument must be of type Function");
      var s = this || Yr, i = function() {
        return o.apply(s, arguments);
      };
      t.apply(this || Yr, n).then(function(a) {
        Kt.nextTick(i.bind(null, null, a));
      }, function(a) {
        Kt.nextTick(vI.bind(null, a, i));
      });
    }
    return Object.setPrototypeOf(e, Object.getPrototypeOf(t)), Object.defineProperties(e, gy(t)), e;
  };
  L._extend;
  L.callbackify;
  L.debuglog;
  L.deprecate;
  L.format;
  L.inherits;
  L.inspect;
  L.isArray;
  L.isBoolean;
  L.isBuffer;
  L.isDate;
  L.isError;
  L.isFunction;
  L.isNull;
  L.isNullOrUndefined;
  L.isNumber;
  L.isObject;
  L.isPrimitive;
  L.isRegExp;
  L.isString;
  L.isSymbol;
  L.isUndefined;
  L.log;
  L.promisify;
  L._extend;
  L.callbackify;
  L.debuglog;
  L.deprecate;
  L.format;
  L.inherits;
  L.inspect;
  L.isArray;
  L.isBoolean;
  L.isBuffer;
  L.isDate;
  L.isError;
  L.isFunction;
  L.isNull;
  L.isNullOrUndefined;
  L.isNumber;
  L.isObject;
  L.isPrimitive;
  L.isRegExp;
  L.isString;
  L.isSymbol;
  L.isUndefined;
  L.log;
  HC = L.promisify;
  L.types;
});
var WC;
var Uy = ot(() => {
  S();
  A();
  k();
  To();
  L._extend;
  L.callbackify;
  L.debuglog;
  L.deprecate;
  L.format;
  L.inherits;
  L.inspect;
  L.isArray;
  L.isBoolean;
  L.isBuffer;
  L.isDate;
  L.isError;
  L.isFunction;
  L.isNull;
  L.isNullOrUndefined;
  L.isNumber;
  L.isObject;
  L.isPrimitive;
  L.isRegExp;
  L.isString;
  L.isSymbol;
  L.isUndefined;
  L.log;
  WC = L.promisify;
  L.types;
  L.TextEncoder = globalThis.TextEncoder;
  L.TextDecoder = globalThis.TextDecoder;
});
function ua(t) {
  throw new Error("Node.js process " + t + " is not supported by JSPM core outside of Node.js");
}
function _I() {
  !fr || !Vn || (fr = false, Vn.length ? ln = Vn.concat(ln) : vo = -1, ln.length && jy());
}
function jy() {
  if (!fr) {
    var t = setTimeout(_I, 0);
    fr = true;
    for (var e = ln.length;e; ) {
      for (Vn = ln, ln = [];++vo < e; )
        Vn && Vn[vo].run();
      vo = -1, e = ln.length;
    }
    Vn = null, fr = false, clearTimeout(t);
  }
}
function bI(t) {
  var e = new Array(arguments.length - 1);
  if (arguments.length > 1)
    for (var n = 1;n < arguments.length; n++)
      e[n - 1] = arguments[n];
  ln.push(new $y(t, e)), ln.length === 1 && !fr && setTimeout(jy, 0);
}
function $y(t, e) {
  this.fun = t, this.array = e;
}
function lt() {}
function UI(t) {
  ua("_linkedBinding");
}
function LI(t) {
  ua("dlopen");
}
function WI() {
  return [];
}
function KI() {
  return [];
}
function QI(t, e) {
  if (!t)
    throw new Error(e || "assertion error");
}
function rE() {
  return false;
}
function _E() {
  return vn.now() / 1000;
}
function la(t) {
  var e = Math.floor((Date.now() - vn.now()) * 0.001), n = vn.now() * 0.001, r = Math.floor(n) + e, o = Math.floor(n % 1 * 1e9);
  return t && (r = r - t[0], o = o - t[1], o < 0 && (r--, o += aa)), [r, o];
}
function _n() {
  return Mt;
}
function OE(t) {
  return [];
}
var ln;
var fr;
var Vn;
var vo;
var wI;
var xI;
var PI;
var BI;
var II;
var EI;
var SI;
var kI;
var AI;
var CI;
var OI;
var RI;
var MI;
var NI;
var DI;
var HI;
var jI;
var $I;
var ZI;
var FI;
var zI;
var ca;
var qI;
var GI;
var VI;
var JI;
var YI;
var XI;
var eE;
var tE;
var nE;
var iE;
var oE;
var sE;
var aE;
var lE;
var uE;
var cE;
var dE;
var fE;
var pE;
var gE;
var mE;
var yE;
var hE;
var TE;
var vE;
var vn;
var sa;
var aa;
var bE;
var wE;
var xE;
var PE;
var BE;
var IE;
var EE;
var SE;
var kE;
var AE;
var CE;
var Mt;
var da = ot(() => {
  S();
  A();
  k();
  ln = [], fr = false, vo = -1;
  $y.prototype.run = function() {
    this.fun.apply(null, this.array);
  };
  wI = "browser", xI = "x64", PI = "browser", BI = { PATH: "/usr/bin", LANG: navigator.language + ".UTF-8", PWD: "/", HOME: "/home", TMP: "/tmp" }, II = ["/usr/bin/node"], EI = [], SI = "v16.8.0", kI = {}, AI = function(t, e) {
    console.warn((e ? e + ": " : "") + t);
  }, CI = function(t) {
    ua("binding");
  }, OI = function(t) {
    return 0;
  }, RI = function() {
    return "/";
  }, MI = function(t) {}, NI = { name: "node", sourceUrl: "", headersUrl: "", libUrl: "" };
  DI = lt, HI = [];
  jI = {}, $I = false, ZI = {};
  FI = lt, zI = lt, ca = function() {
    return {};
  }, qI = ca, GI = ca, VI = lt, JI = lt, YI = lt, XI = {};
  eE = { inspector: false, debug: false, uv: false, ipv6: false, tls_alpn: false, tls_sni: false, tls_ocsp: false, tls: false, cached_builtins: true }, tE = lt, nE = lt;
  iE = lt, oE = lt, sE = lt, aE = lt, lE = lt, uE = undefined, cE = undefined, dE = undefined, fE = lt, pE = 2, gE = 1, mE = "/bin/usr/node", yE = 9229, hE = "node", TE = [], vE = lt, vn = { now: typeof performance < "u" ? performance.now.bind(performance) : undefined, timing: typeof performance < "u" ? performance.timing : undefined };
  vn.now === undefined && (sa = Date.now(), vn.timing && vn.timing.navigationStart && (sa = vn.timing.navigationStart), vn.now = () => Date.now() - sa);
  aa = 1e9;
  la.bigint = function(t) {
    var e = la(t);
    return typeof BigInt > "u" ? e[0] * aa + e[1] : BigInt(e[0] * aa) + BigInt(e[1]);
  };
  bE = 10, wE = {}, xE = 0;
  PE = _n, BE = _n, IE = _n, EE = _n, SE = _n, kE = lt, AE = _n, CE = _n;
  Mt = { version: SI, versions: kI, arch: xI, platform: PI, release: NI, _rawDebug: DI, moduleLoadList: HI, binding: CI, _linkedBinding: UI, _events: wE, _eventsCount: xE, _maxListeners: bE, on: _n, addListener: PE, once: BE, off: IE, removeListener: EE, removeAllListeners: SE, emit: kE, prependListener: AE, prependOnceListener: CE, listeners: OE, domain: jI, _exiting: $I, config: ZI, dlopen: LI, uptime: _E, _getActiveRequests: WI, _getActiveHandles: KI, reallyExit: FI, _kill: zI, cpuUsage: ca, resourceUsage: qI, memoryUsage: GI, kill: VI, exit: JI, openStdin: YI, allowedNodeEnvironmentFlags: XI, assert: QI, features: eE, _fatalExceptions: tE, setUncaughtExceptionCaptureCallback: nE, hasUncaughtExceptionCaptureCallback: rE, emitWarning: AI, nextTick: bI, _tickCallback: iE, _debugProcess: oE, _debugEnd: sE, _startProfilerIdleNotifier: aE, _stopProfilerIdleNotifier: lE, stdout: uE, stdin: dE, stderr: cE, abort: fE, umask: OI, chdir: MI, cwd: RI, env: BI, title: wI, argv: II, execArgv: EI, pid: pE, ppid: gE, execPath: mE, debugPort: yE, hrtime: la, argv0: hE, _preload_modules: TE, setSourceMapsEnabled: vE };
});
function Ly() {
  if (Zy)
    return fa;
  Zy = true, fa = t;
  function t(n, r) {
    if (e("noDeprecation"))
      return n;
    var o = false;
    function s() {
      if (!o) {
        if (e("throwDeprecation"))
          throw new Error(r);
        e("traceDeprecation") ? console.trace(r) : console.warn(r), o = true;
      }
      return n.apply(this || pa, arguments);
    }
    return s;
  }
  function e(n) {
    try {
      if (!pa.localStorage)
        return false;
    } catch {
      return false;
    }
    var r = pa.localStorage[n];
    return r == null ? false : String(r).toLowerCase() === "true";
  }
  return fa;
}
var fa;
var Zy;
var pa;
var Wy = ot(() => {
  S();
  A();
  k();
  fa = {}, Zy = false, pa = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
});
function RE() {
  if (Ky)
    return ti;
  Ky = true;
  var t = $t(), e = t.Buffer;
  function n(o, s) {
    for (var i in o)
      s[i] = o[i];
  }
  e.from && e.alloc && e.allocUnsafe && e.allocUnsafeSlow ? ti = t : (n(t, ti), ti.Buffer = r);
  function r(o, s, i) {
    return e(o, s, i);
  }
  return r.prototype = Object.create(e.prototype), n(e, r), r.from = function(o, s, i) {
    if (typeof o == "number")
      throw new TypeError("Argument must not be a number");
    return e(o, s, i);
  }, r.alloc = function(o, s, i) {
    if (typeof o != "number")
      throw new TypeError("Argument must be a number");
    var a = e(o);
    return s !== undefined ? typeof i == "string" ? a.fill(s, i) : a.fill(s) : a.fill(0), a;
  }, r.allocUnsafe = function(o) {
    if (typeof o != "number")
      throw new TypeError("Argument must be a number");
    return e(o);
  }, r.allocUnsafeSlow = function(o) {
    if (typeof o != "number")
      throw new TypeError("Argument must be a number");
    return t.SlowBuffer(o);
  }, ti;
}
function ME() {
  if (Fy)
    return ga;
  Fy = true;
  var t = RE().Buffer, e = t.isEncoding || function(v) {
    switch (v = "" + v, v && v.toLowerCase()) {
      case "hex":
      case "utf8":
      case "utf-8":
      case "ascii":
      case "binary":
      case "base64":
      case "ucs2":
      case "ucs-2":
      case "utf16le":
      case "utf-16le":
      case "raw":
        return true;
      default:
        return false;
    }
  };
  function n(v) {
    if (!v)
      return "utf8";
    for (var E;; )
      switch (v) {
        case "utf8":
        case "utf-8":
          return "utf8";
        case "ucs2":
        case "ucs-2":
        case "utf16le":
        case "utf-16le":
          return "utf16le";
        case "latin1":
        case "binary":
          return "latin1";
        case "base64":
        case "ascii":
        case "hex":
          return v;
        default:
          if (E)
            return;
          v = ("" + v).toLowerCase(), E = true;
      }
  }
  function r(v) {
    var E = n(v);
    if (typeof E != "string" && (t.isEncoding === e || !e(v)))
      throw new Error("Unknown encoding: " + v);
    return E || v;
  }
  ga.StringDecoder = o;
  function o(v) {
    this.encoding = r(v);
    var E;
    switch (this.encoding) {
      case "utf16le":
        this.text = g, this.end = p, E = 4;
        break;
      case "utf8":
        this.fillLast = l, E = 4;
        break;
      case "base64":
        this.text = y, this.end = T, E = 3;
        break;
      default:
        this.write = P, this.end = B;
        return;
    }
    this.lastNeed = 0, this.lastTotal = 0, this.lastChar = t.allocUnsafe(E);
  }
  o.prototype.write = function(v) {
    if (v.length === 0)
      return "";
    var E, I;
    if (this.lastNeed) {
      if (E = this.fillLast(v), E === undefined)
        return "";
      I = this.lastNeed, this.lastNeed = 0;
    } else
      I = 0;
    return I < v.length ? E ? E + this.text(v, I) : this.text(v, I) : E || "";
  }, o.prototype.end = f, o.prototype.text = c, o.prototype.fillLast = function(v) {
    if (this.lastNeed <= v.length)
      return v.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
    v.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, v.length), this.lastNeed -= v.length;
  };
  function s(v) {
    return v <= 127 ? 0 : v >> 5 === 6 ? 2 : v >> 4 === 14 ? 3 : v >> 3 === 30 ? 4 : v >> 6 === 2 ? -1 : -2;
  }
  function i(v, E, I) {
    var D = E.length - 1;
    if (D < I)
      return 0;
    var $ = s(E[D]);
    return $ >= 0 ? ($ > 0 && (v.lastNeed = $ - 1), $) : --D < I || $ === -2 ? 0 : ($ = s(E[D]), $ >= 0 ? ($ > 0 && (v.lastNeed = $ - 2), $) : --D < I || $ === -2 ? 0 : ($ = s(E[D]), $ >= 0 ? ($ > 0 && ($ === 2 ? $ = 0 : v.lastNeed = $ - 3), $) : 0));
  }
  function a(v, E, I) {
    if ((E[0] & 192) !== 128)
      return v.lastNeed = 0, "\uFFFD";
    if (v.lastNeed > 1 && E.length > 1) {
      if ((E[1] & 192) !== 128)
        return v.lastNeed = 1, "\uFFFD";
      if (v.lastNeed > 2 && E.length > 2 && (E[2] & 192) !== 128)
        return v.lastNeed = 2, "\uFFFD";
    }
  }
  function l(v) {
    var E = this.lastTotal - this.lastNeed, I = a(this, v);
    if (I !== undefined)
      return I;
    if (this.lastNeed <= v.length)
      return v.copy(this.lastChar, E, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
    v.copy(this.lastChar, E, 0, v.length), this.lastNeed -= v.length;
  }
  function c(v, E) {
    var I = i(this, v, E);
    if (!this.lastNeed)
      return v.toString("utf8", E);
    this.lastTotal = I;
    var D = v.length - (I - this.lastNeed);
    return v.copy(this.lastChar, 0, D), v.toString("utf8", E, D);
  }
  function f(v) {
    var E = v && v.length ? this.write(v) : "";
    return this.lastNeed ? E + "\uFFFD" : E;
  }
  function g(v, E) {
    if ((v.length - E) % 2 === 0) {
      var I = v.toString("utf16le", E);
      if (I) {
        var D = I.charCodeAt(I.length - 1);
        if (D >= 55296 && D <= 56319)
          return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = v[v.length - 2], this.lastChar[1] = v[v.length - 1], I.slice(0, -1);
      }
      return I;
    }
    return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = v[v.length - 1], v.toString("utf16le", E, v.length - 1);
  }
  function p(v) {
    var E = v && v.length ? this.write(v) : "";
    if (this.lastNeed) {
      var I = this.lastTotal - this.lastNeed;
      return E + this.lastChar.toString("utf16le", 0, I);
    }
    return E;
  }
  function y(v, E) {
    var I = (v.length - E) % 3;
    return I === 0 ? v.toString("base64", E) : (this.lastNeed = 3 - I, this.lastTotal = 3, I === 1 ? this.lastChar[0] = v[v.length - 1] : (this.lastChar[0] = v[v.length - 2], this.lastChar[1] = v[v.length - 1]), v.toString("base64", E, v.length - I));
  }
  function T(v) {
    var E = v && v.length ? this.write(v) : "";
    return this.lastNeed ? E + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : E;
  }
  function P(v) {
    return v.toString(this.encoding);
  }
  function B(v) {
    return v && v.length ? this.write(v) : "";
  }
  return ga;
}
var ti;
var Ky;
var ga;
var Fy;
var ni;
var rO;
var zy = ot(() => {
  S();
  A();
  k();
  hi();
  ti = {}, Ky = false;
  ga = {}, Fy = false;
  ni = ME();
  ni.StringDecoder;
  rO = ni.StringDecoder;
});
function NE() {
  if (qy)
    return ma;
  qy = true;
  var t = ma = {}, e, n;
  function r() {
    throw new Error("setTimeout has not been defined");
  }
  function o() {
    throw new Error("clearTimeout has not been defined");
  }
  (function() {
    try {
      typeof setTimeout == "function" ? e = setTimeout : e = r;
    } catch {
      e = r;
    }
    try {
      typeof clearTimeout == "function" ? n = clearTimeout : n = o;
    } catch {
      n = o;
    }
  })();
  function s(P) {
    if (e === setTimeout)
      return setTimeout(P, 0);
    if ((e === r || !e) && setTimeout)
      return e = setTimeout, setTimeout(P, 0);
    try {
      return e(P, 0);
    } catch {
      try {
        return e.call(null, P, 0);
      } catch {
        return e.call(this || pr, P, 0);
      }
    }
  }
  function i(P) {
    if (n === clearTimeout)
      return clearTimeout(P);
    if ((n === o || !n) && clearTimeout)
      return n = clearTimeout, clearTimeout(P);
    try {
      return n(P);
    } catch {
      try {
        return n.call(null, P);
      } catch {
        return n.call(this || pr, P);
      }
    }
  }
  var a = [], l = false, c, f = -1;
  function g() {
    !l || !c || (l = false, c.length ? a = c.concat(a) : f = -1, a.length && p());
  }
  function p() {
    if (!l) {
      var P = s(g);
      l = true;
      for (var B = a.length;B; ) {
        for (c = a, a = [];++f < B; )
          c && c[f].run();
        f = -1, B = a.length;
      }
      c = null, l = false, i(P);
    }
  }
  t.nextTick = function(P) {
    var B = new Array(arguments.length - 1);
    if (arguments.length > 1)
      for (var v = 1;v < arguments.length; v++)
        B[v - 1] = arguments[v];
    a.push(new y(P, B)), a.length === 1 && !l && s(p);
  };
  function y(P, B) {
    (this || pr).fun = P, (this || pr).array = B;
  }
  y.prototype.run = function() {
    (this || pr).fun.apply(null, (this || pr).array);
  }, t.title = "browser", t.browser = true, t.env = {}, t.argv = [], t.version = "", t.versions = {};
  function T() {}
  return t.on = T, t.addListener = T, t.once = T, t.off = T, t.removeListener = T, t.removeAllListeners = T, t.emit = T, t.prependListener = T, t.prependOnceListener = T, t.listeners = function(P) {
    return [];
  }, t.binding = function(P) {
    throw new Error("process.binding is not supported");
  }, t.cwd = function() {
    return "/";
  }, t.chdir = function(P) {
    throw new Error("process.chdir is not supported");
  }, t.umask = function() {
    return 0;
  }, ma;
}
var ma;
var qy;
var pr;
var Ue;
var ya = ot(() => {
  S();
  A();
  k();
  ma = {}, qy = false, pr = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  Ue = NE();
  Ue.platform = "browser";
  Ue.addListener;
  Ue.argv;
  Ue.binding;
  Ue.browser;
  Ue.chdir;
  Ue.cwd;
  Ue.emit;
  Ue.env;
  Ue.listeners;
  Ue.nextTick;
  Ue.off;
  Ue.on;
  Ue.once;
  Ue.prependListener;
  Ue.prependOnceListener;
  Ue.removeAllListeners;
  Ue.removeListener;
  Ue.title;
  Ue.umask;
  Ue.version;
  Ue.versions;
});
function DE() {
  if (Gy)
    return ha;
  Gy = true;
  var t = Ue;
  function e(s) {
    if (typeof s != "string")
      throw new TypeError("Path must be a string. Received " + JSON.stringify(s));
  }
  function n(s, i) {
    for (var a = "", l = 0, c = -1, f = 0, g, p = 0;p <= s.length; ++p) {
      if (p < s.length)
        g = s.charCodeAt(p);
      else {
        if (g === 47)
          break;
        g = 47;
      }
      if (g === 47) {
        if (!(c === p - 1 || f === 1))
          if (c !== p - 1 && f === 2) {
            if (a.length < 2 || l !== 2 || a.charCodeAt(a.length - 1) !== 46 || a.charCodeAt(a.length - 2) !== 46) {
              if (a.length > 2) {
                var y = a.lastIndexOf("/");
                if (y !== a.length - 1) {
                  y === -1 ? (a = "", l = 0) : (a = a.slice(0, y), l = a.length - 1 - a.lastIndexOf("/")), c = p, f = 0;
                  continue;
                }
              } else if (a.length === 2 || a.length === 1) {
                a = "", l = 0, c = p, f = 0;
                continue;
              }
            }
            i && (a.length > 0 ? a += "/.." : a = "..", l = 2);
          } else
            a.length > 0 ? a += "/" + s.slice(c + 1, p) : a = s.slice(c + 1, p), l = p - c - 1;
        c = p, f = 0;
      } else
        g === 46 && f !== -1 ? ++f : f = -1;
    }
    return a;
  }
  function r(s, i) {
    var a = i.dir || i.root, l = i.base || (i.name || "") + (i.ext || "");
    return a ? a === i.root ? a + l : a + s + l : l;
  }
  var o = { resolve: function() {
    for (var i = "", a = false, l, c = arguments.length - 1;c >= -1 && !a; c--) {
      var f;
      c >= 0 ? f = arguments[c] : (l === undefined && (l = t.cwd()), f = l), e(f), f.length !== 0 && (i = f + "/" + i, a = f.charCodeAt(0) === 47);
    }
    return i = n(i, !a), a ? i.length > 0 ? "/" + i : "/" : i.length > 0 ? i : ".";
  }, normalize: function(i) {
    if (e(i), i.length === 0)
      return ".";
    var a = i.charCodeAt(0) === 47, l = i.charCodeAt(i.length - 1) === 47;
    return i = n(i, !a), i.length === 0 && !a && (i = "."), i.length > 0 && l && (i += "/"), a ? "/" + i : i;
  }, isAbsolute: function(i) {
    return e(i), i.length > 0 && i.charCodeAt(0) === 47;
  }, join: function() {
    if (arguments.length === 0)
      return ".";
    for (var i, a = 0;a < arguments.length; ++a) {
      var l = arguments[a];
      e(l), l.length > 0 && (i === undefined ? i = l : i += "/" + l);
    }
    return i === undefined ? "." : o.normalize(i);
  }, relative: function(i, a) {
    if (e(i), e(a), i === a || (i = o.resolve(i), a = o.resolve(a), i === a))
      return "";
    for (var l = 1;l < i.length && i.charCodeAt(l) === 47; ++l)
      ;
    for (var c = i.length, f = c - l, g = 1;g < a.length && a.charCodeAt(g) === 47; ++g)
      ;
    for (var p = a.length, y = p - g, T = f < y ? f : y, P = -1, B = 0;B <= T; ++B) {
      if (B === T) {
        if (y > T) {
          if (a.charCodeAt(g + B) === 47)
            return a.slice(g + B + 1);
          if (B === 0)
            return a.slice(g + B);
        } else
          f > T && (i.charCodeAt(l + B) === 47 ? P = B : B === 0 && (P = 0));
        break;
      }
      var v = i.charCodeAt(l + B), E = a.charCodeAt(g + B);
      if (v !== E)
        break;
      v === 47 && (P = B);
    }
    var I = "";
    for (B = l + P + 1;B <= c; ++B)
      (B === c || i.charCodeAt(B) === 47) && (I.length === 0 ? I += ".." : I += "/..");
    return I.length > 0 ? I + a.slice(g + P) : (g += P, a.charCodeAt(g) === 47 && ++g, a.slice(g));
  }, _makeLong: function(i) {
    return i;
  }, dirname: function(i) {
    if (e(i), i.length === 0)
      return ".";
    for (var a = i.charCodeAt(0), l = a === 47, c = -1, f = true, g = i.length - 1;g >= 1; --g)
      if (a = i.charCodeAt(g), a === 47) {
        if (!f) {
          c = g;
          break;
        }
      } else
        f = false;
    return c === -1 ? l ? "/" : "." : l && c === 1 ? "//" : i.slice(0, c);
  }, basename: function(i, a) {
    if (a !== undefined && typeof a != "string")
      throw new TypeError('"ext" argument must be a string');
    e(i);
    var l = 0, c = -1, f = true, g;
    if (a !== undefined && a.length > 0 && a.length <= i.length) {
      if (a.length === i.length && a === i)
        return "";
      var p = a.length - 1, y = -1;
      for (g = i.length - 1;g >= 0; --g) {
        var T = i.charCodeAt(g);
        if (T === 47) {
          if (!f) {
            l = g + 1;
            break;
          }
        } else
          y === -1 && (f = false, y = g + 1), p >= 0 && (T === a.charCodeAt(p) ? --p === -1 && (c = g) : (p = -1, c = y));
      }
      return l === c ? c = y : c === -1 && (c = i.length), i.slice(l, c);
    } else {
      for (g = i.length - 1;g >= 0; --g)
        if (i.charCodeAt(g) === 47) {
          if (!f) {
            l = g + 1;
            break;
          }
        } else
          c === -1 && (f = false, c = g + 1);
      return c === -1 ? "" : i.slice(l, c);
    }
  }, extname: function(i) {
    e(i);
    for (var a = -1, l = 0, c = -1, f = true, g = 0, p = i.length - 1;p >= 0; --p) {
      var y = i.charCodeAt(p);
      if (y === 47) {
        if (!f) {
          l = p + 1;
          break;
        }
        continue;
      }
      c === -1 && (f = false, c = p + 1), y === 46 ? a === -1 ? a = p : g !== 1 && (g = 1) : a !== -1 && (g = -1);
    }
    return a === -1 || c === -1 || g === 0 || g === 1 && a === c - 1 && a === l + 1 ? "" : i.slice(a, c);
  }, format: function(i) {
    if (i === null || typeof i != "object")
      throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof i);
    return r("/", i);
  }, parse: function(i) {
    e(i);
    var a = { root: "", dir: "", base: "", ext: "", name: "" };
    if (i.length === 0)
      return a;
    var l = i.charCodeAt(0), c = l === 47, f;
    c ? (a.root = "/", f = 1) : f = 0;
    for (var g = -1, p = 0, y = -1, T = true, P = i.length - 1, B = 0;P >= f; --P) {
      if (l = i.charCodeAt(P), l === 47) {
        if (!T) {
          p = P + 1;
          break;
        }
        continue;
      }
      y === -1 && (T = false, y = P + 1), l === 46 ? g === -1 ? g = P : B !== 1 && (B = 1) : g !== -1 && (B = -1);
    }
    return g === -1 || y === -1 || B === 0 || B === 1 && g === y - 1 && g === p + 1 ? y !== -1 && (p === 0 && c ? a.base = a.name = i.slice(1, y) : a.base = a.name = i.slice(p, y)) : (p === 0 && c ? (a.name = i.slice(1, g), a.base = i.slice(1, y)) : (a.name = i.slice(p, g), a.base = i.slice(p, y)), a.ext = i.slice(g, y)), p > 0 ? a.dir = i.slice(0, p - 1) : c && (a.dir = "/"), a;
  }, sep: "/", delimiter: ":", win32: null, posix: null };
  return o.posix = o, ha = o, ha;
}
function Jn(t) {
  throw new RangeError($E[t]);
}
function Jy(t, e) {
  let n = t.split("@"), r = "";
  n.length > 1 && (r = n[0] + "@", t = n[1]);
  let o = function(s, i) {
    let a = [], l = s.length;
    for (;l--; )
      a[l] = i(s[l]);
    return a;
  }((t = t.replace(jE, ".")).split("."), e).join(".");
  return r + o;
}
function oh(t) {
  let e = [], n = 0, r = t.length;
  for (;n < r; ) {
    let o = t.charCodeAt(n++);
    if (o >= 55296 && o <= 56319 && n < r) {
      let s = t.charCodeAt(n++);
      (64512 & s) == 56320 ? e.push(((1023 & o) << 10) + (1023 & s) + 65536) : (e.push(o), n--);
    } else
      e.push(o);
  }
  return e;
}
function LE(t, e) {
  return Object.prototype.hasOwnProperty.call(t, e);
}
function It() {
  this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;
}
function ii(t, e, n) {
  if (t && Ft.isObject(t) && t instanceof It)
    return t;
  var r = new It;
  return r.parse(t, e, n), r;
}
function XE() {
  if (rh)
    return ba;
  rh = true;
  var t = He;
  function e(s) {
    if (typeof s != "string")
      throw new TypeError("Path must be a string. Received " + JSON.stringify(s));
  }
  function n(s, i) {
    for (var a = "", l = 0, c = -1, f = 0, g, p = 0;p <= s.length; ++p) {
      if (p < s.length)
        g = s.charCodeAt(p);
      else {
        if (g === 47)
          break;
        g = 47;
      }
      if (g === 47) {
        if (!(c === p - 1 || f === 1))
          if (c !== p - 1 && f === 2) {
            if (a.length < 2 || l !== 2 || a.charCodeAt(a.length - 1) !== 46 || a.charCodeAt(a.length - 2) !== 46) {
              if (a.length > 2) {
                var y = a.lastIndexOf("/");
                if (y !== a.length - 1) {
                  y === -1 ? (a = "", l = 0) : (a = a.slice(0, y), l = a.length - 1 - a.lastIndexOf("/")), c = p, f = 0;
                  continue;
                }
              } else if (a.length === 2 || a.length === 1) {
                a = "", l = 0, c = p, f = 0;
                continue;
              }
            }
            i && (a.length > 0 ? a += "/.." : a = "..", l = 2);
          } else
            a.length > 0 ? a += "/" + s.slice(c + 1, p) : a = s.slice(c + 1, p), l = p - c - 1;
        c = p, f = 0;
      } else
        g === 46 && f !== -1 ? ++f : f = -1;
    }
    return a;
  }
  function r(s, i) {
    var a = i.dir || i.root, l = i.base || (i.name || "") + (i.ext || "");
    return a ? a === i.root ? a + l : a + s + l : l;
  }
  var o = { resolve: function() {
    for (var i = "", a = false, l, c = arguments.length - 1;c >= -1 && !a; c--) {
      var f;
      c >= 0 ? f = arguments[c] : (l === undefined && (l = t.cwd()), f = l), e(f), f.length !== 0 && (i = f + "/" + i, a = f.charCodeAt(0) === 47);
    }
    return i = n(i, !a), a ? i.length > 0 ? "/" + i : "/" : i.length > 0 ? i : ".";
  }, normalize: function(i) {
    if (e(i), i.length === 0)
      return ".";
    var a = i.charCodeAt(0) === 47, l = i.charCodeAt(i.length - 1) === 47;
    return i = n(i, !a), i.length === 0 && !a && (i = "."), i.length > 0 && l && (i += "/"), a ? "/" + i : i;
  }, isAbsolute: function(i) {
    return e(i), i.length > 0 && i.charCodeAt(0) === 47;
  }, join: function() {
    if (arguments.length === 0)
      return ".";
    for (var i, a = 0;a < arguments.length; ++a) {
      var l = arguments[a];
      e(l), l.length > 0 && (i === undefined ? i = l : i += "/" + l);
    }
    return i === undefined ? "." : o.normalize(i);
  }, relative: function(i, a) {
    if (e(i), e(a), i === a || (i = o.resolve(i), a = o.resolve(a), i === a))
      return "";
    for (var l = 1;l < i.length && i.charCodeAt(l) === 47; ++l)
      ;
    for (var c = i.length, f = c - l, g = 1;g < a.length && a.charCodeAt(g) === 47; ++g)
      ;
    for (var p = a.length, y = p - g, T = f < y ? f : y, P = -1, B = 0;B <= T; ++B) {
      if (B === T) {
        if (y > T) {
          if (a.charCodeAt(g + B) === 47)
            return a.slice(g + B + 1);
          if (B === 0)
            return a.slice(g + B);
        } else
          f > T && (i.charCodeAt(l + B) === 47 ? P = B : B === 0 && (P = 0));
        break;
      }
      var v = i.charCodeAt(l + B), E = a.charCodeAt(g + B);
      if (v !== E)
        break;
      v === 47 && (P = B);
    }
    var I = "";
    for (B = l + P + 1;B <= c; ++B)
      (B === c || i.charCodeAt(B) === 47) && (I.length === 0 ? I += ".." : I += "/..");
    return I.length > 0 ? I + a.slice(g + P) : (g += P, a.charCodeAt(g) === 47 && ++g, a.slice(g));
  }, _makeLong: function(i) {
    return i;
  }, dirname: function(i) {
    if (e(i), i.length === 0)
      return ".";
    for (var a = i.charCodeAt(0), l = a === 47, c = -1, f = true, g = i.length - 1;g >= 1; --g)
      if (a = i.charCodeAt(g), a === 47) {
        if (!f) {
          c = g;
          break;
        }
      } else
        f = false;
    return c === -1 ? l ? "/" : "." : l && c === 1 ? "//" : i.slice(0, c);
  }, basename: function(i, a) {
    if (a !== undefined && typeof a != "string")
      throw new TypeError('"ext" argument must be a string');
    e(i);
    var l = 0, c = -1, f = true, g;
    if (a !== undefined && a.length > 0 && a.length <= i.length) {
      if (a.length === i.length && a === i)
        return "";
      var p = a.length - 1, y = -1;
      for (g = i.length - 1;g >= 0; --g) {
        var T = i.charCodeAt(g);
        if (T === 47) {
          if (!f) {
            l = g + 1;
            break;
          }
        } else
          y === -1 && (f = false, y = g + 1), p >= 0 && (T === a.charCodeAt(p) ? --p === -1 && (c = g) : (p = -1, c = y));
      }
      return l === c ? c = y : c === -1 && (c = i.length), i.slice(l, c);
    } else {
      for (g = i.length - 1;g >= 0; --g)
        if (i.charCodeAt(g) === 47) {
          if (!f) {
            l = g + 1;
            break;
          }
        } else
          c === -1 && (f = false, c = g + 1);
      return c === -1 ? "" : i.slice(l, c);
    }
  }, extname: function(i) {
    e(i);
    for (var a = -1, l = 0, c = -1, f = true, g = 0, p = i.length - 1;p >= 0; --p) {
      var y = i.charCodeAt(p);
      if (y === 47) {
        if (!f) {
          l = p + 1;
          break;
        }
        continue;
      }
      c === -1 && (f = false, c = p + 1), y === 46 ? a === -1 ? a = p : g !== 1 && (g = 1) : a !== -1 && (g = -1);
    }
    return a === -1 || c === -1 || g === 0 || g === 1 && a === c - 1 && a === l + 1 ? "" : i.slice(a, c);
  }, format: function(i) {
    if (i === null || typeof i != "object")
      throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof i);
    return r("/", i);
  }, parse: function(i) {
    e(i);
    var a = { root: "", dir: "", base: "", ext: "", name: "" };
    if (i.length === 0)
      return a;
    var l = i.charCodeAt(0), c = l === 47, f;
    c ? (a.root = "/", f = 1) : f = 0;
    for (var g = -1, p = 0, y = -1, T = true, P = i.length - 1, B = 0;P >= f; --P) {
      if (l = i.charCodeAt(P), l === 47) {
        if (!T) {
          p = P + 1;
          break;
        }
        continue;
      }
      y === -1 && (T = false, y = P + 1), l === 46 ? g === -1 ? g = P : B !== 1 && (B = 1) : g !== -1 && (B = -1);
    }
    return g === -1 || y === -1 || B === 0 || B === 1 && g === y - 1 && g === p + 1 ? y !== -1 && (p === 0 && c ? a.base = a.name = i.slice(1, y) : a.base = a.name = i.slice(p, y)) : (p === 0 && c ? (a.name = i.slice(1, g), a.base = i.slice(1, y)) : (a.name = i.slice(p, g), a.base = i.slice(p, y)), a.ext = i.slice(g, y)), p > 0 ? a.dir = i.slice(0, p - 1) : c && (a.dir = "/"), a;
  }, sep: "/", delimiter: ":", win32: null, posix: null };
  return o.posix = o, ba = o, ba;
}
function cS(t) {
  if (typeof t == "string")
    t = new URL(t);
  else if (!(t instanceof URL))
    throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");
  if (t.protocol !== "file:")
    throw new Deno.errors.InvalidData("invalid url scheme");
  return xa ? dS(t) : fS(t);
}
function dS(t) {
  let { hostname: e, pathname: n } = t;
  for (let r = 0;r < n.length; r++)
    if (n[r] === "%") {
      let o = n.codePointAt(r + 2) || 32;
      if (n[r + 1] === "2" && o === 102 || n[r + 1] === "5" && o === 99)
        throw new Deno.errors.InvalidData("must not include encoded \\ or / characters");
    }
  if (n = n.replace(iS, "\\"), n = decodeURIComponent(n), e !== "")
    return `\\\\${e}${n}`;
  {
    let r = n.codePointAt(1) | 32, o = n[2];
    if (r < nS || r > rS || o !== ":")
      throw new Deno.errors.InvalidData("file url path must be absolute");
    return n.slice(1);
  }
}
function fS(t) {
  if (t.hostname !== "")
    throw new Deno.errors.InvalidData("invalid file url hostname");
  let e = t.pathname;
  for (let n = 0;n < e.length; n++)
    if (e[n] === "%") {
      let r = e.codePointAt(n + 2) || 32;
      if (e[n + 1] === "2" && r === 102)
        throw new Deno.errors.InvalidData("must not include encoded / characters");
    }
  return decodeURIComponent(e);
}
function pS(t) {
  let e = ih.resolve(t), n = t.charCodeAt(t.length - 1);
  (n === tS || xa && n === eS) && e[e.length - 1] !== ih.sep && (e += "/");
  let r = new URL("file://");
  return e.includes("%") && (e = e.replace(oS, "%25")), !xa && e.includes("\\") && (e = e.replace(sS, "%5C")), e.includes(`
`) && (e = e.replace(aS, "%0A")), e.includes("\r") && (e = e.replace(lS, "%0D")), e.includes("\t") && (e = e.replace(uS, "%09")), r.pathname = e, r;
}
function BS(t) {
  if (typeof t == "string")
    t = new URL(t);
  else if (!(t instanceof URL))
    throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");
  if (t.protocol !== "file:")
    throw new Deno.errors.InvalidData("invalid url scheme");
  return Pa ? IS(t) : ES(t);
}
function IS(t) {
  let { hostname: e, pathname: n } = t;
  for (let r = 0;r < n.length; r++)
    if (n[r] === "%") {
      let o = n.codePointAt(r + 2) || 32;
      if (n[r + 1] === "2" && o === 102 || n[r + 1] === "5" && o === 99)
        throw new Deno.errors.InvalidData("must not include encoded \\ or / characters");
    }
  if (n = n.replace(vS, "\\"), n = decodeURIComponent(n), e !== "")
    return `\\\\${e}${n}`;
  {
    let r = n.codePointAt(1) | 32, o = n[2];
    if (r < hS || r > TS || o !== ":")
      throw new Deno.errors.InvalidData("file url path must be absolute");
    return n.slice(1);
  }
}
function ES(t) {
  if (t.hostname !== "")
    throw new Deno.errors.InvalidData("invalid file url hostname");
  let e = t.pathname;
  for (let n = 0;n < e.length; n++)
    if (e[n] === "%") {
      let r = e.codePointAt(n + 2) || 32;
      if (e[n + 1] === "2" && r === 102)
        throw new Deno.errors.InvalidData("must not include encoded / characters");
    }
  return decodeURIComponent(e);
}
function SS(t) {
  let e = Vy.resolve(t), n = t.charCodeAt(t.length - 1);
  (n === yS || Pa && n === mS) && e[e.length - 1] !== Vy.sep && (e += "/");
  let r = new URL("file://");
  return e.includes("%") && (e = e.replace(_S, "%25")), !Pa && e.includes("\\") && (e = e.replace(bS, "%5C")), e.includes(`
`) && (e = e.replace(wS, "%0A")), e.includes("\r") && (e = e.replace(xS, "%0D")), e.includes("\t") && (e = e.replace(PS, "%09")), r.pathname = e, r;
}
var ha;
var Gy;
var Vy;
var mr;
var HE;
var UE;
var jE;
var $E;
var zt;
var Ta;
var Yy;
var sh;
var Xy;
var Qy;
var ZE;
var WE;
var ri;
var KE;
var un;
var Ce;
var FE;
var Ft;
var zE;
var qE;
var GE;
var VE;
var wa;
var eh;
var th;
var nh;
var JE;
var YE;
var va;
var gr;
var _a;
var ba;
var rh;
var ih;
var QE;
var eS;
var tS;
var nS;
var rS;
var xa;
var iS;
var oS;
var sS;
var aS;
var lS;
var uS;
var gS;
var mS;
var yS;
var hS;
var TS;
var Pa;
var vS;
var _S;
var bS;
var wS;
var xS;
var PS;
var ah = ot(() => {
  S();
  A();
  k();
  To();
  ya();
  ha = {}, Gy = false;
  Vy = DE(), mr = 2147483647, HE = /^xn--/, UE = /[^\0-\x7E]/, jE = /[\x2E\u3002\uFF0E\uFF61]/g, $E = { overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, zt = Math.floor, Ta = String.fromCharCode;
  Yy = function(t, e) {
    return t + 22 + 75 * (t < 26) - ((e != 0) << 5);
  }, sh = function(t, e, n) {
    let r = 0;
    for (t = n ? zt(t / 700) : t >> 1, t += zt(t / e);t > 455; r += 36)
      t = zt(t / 35);
    return zt(r + 36 * t / (t + 38));
  }, Xy = function(t) {
    let e = [], n = t.length, r = 0, o = 128, s = 72, i = t.lastIndexOf("-");
    i < 0 && (i = 0);
    for (let l = 0;l < i; ++l)
      t.charCodeAt(l) >= 128 && Jn("not-basic"), e.push(t.charCodeAt(l));
    for (let l = i > 0 ? i + 1 : 0;l < n; ) {
      let c = r;
      for (let g = 1, p = 36;; p += 36) {
        l >= n && Jn("invalid-input");
        let y = (a = t.charCodeAt(l++)) - 48 < 10 ? a - 22 : a - 65 < 26 ? a - 65 : a - 97 < 26 ? a - 97 : 36;
        (y >= 36 || y > zt((mr - r) / g)) && Jn("overflow"), r += y * g;
        let T = p <= s ? 1 : p >= s + 26 ? 26 : p - s;
        if (y < T)
          break;
        let P = 36 - T;
        g > zt(mr / P) && Jn("overflow"), g *= P;
      }
      let f = e.length + 1;
      s = sh(r - c, f, c == 0), zt(r / f) > mr - o && Jn("overflow"), o += zt(r / f), r %= f, e.splice(r++, 0, o);
    }
    var a;
    return String.fromCodePoint(...e);
  }, Qy = function(t) {
    let e = [], n = (t = oh(t)).length, r = 128, o = 0, s = 72;
    for (let l of t)
      l < 128 && e.push(Ta(l));
    let i = e.length, a = i;
    for (i && e.push("-");a < n; ) {
      let l = mr;
      for (let f of t)
        f >= r && f < l && (l = f);
      let c = a + 1;
      l - r > zt((mr - o) / c) && Jn("overflow"), o += (l - r) * c, r = l;
      for (let f of t)
        if (f < r && ++o > mr && Jn("overflow"), f == r) {
          let g = o;
          for (let p = 36;; p += 36) {
            let y = p <= s ? 1 : p >= s + 26 ? 26 : p - s;
            if (g < y)
              break;
            let T = g - y, P = 36 - y;
            e.push(Ta(Yy(y + T % P, 0))), g = zt(T / P);
          }
          e.push(Ta(Yy(g, 0))), s = sh(o, c, a == i), o = 0, ++a;
        }
      ++o, ++r;
    }
    return e.join("");
  }, ZE = { version: "2.1.0", ucs2: { decode: oh, encode: (t) => String.fromCodePoint(...t) }, decode: Xy, encode: Qy, toASCII: function(t) {
    return Jy(t, function(e) {
      return UE.test(e) ? "xn--" + Qy(e) : e;
    });
  }, toUnicode: function(t) {
    return Jy(t, function(e) {
      return HE.test(e) ? Xy(e.slice(4).toLowerCase()) : e;
    });
  } };
  WE = function(t, e, n, r) {
    e = e || "&", n = n || "=";
    var o = {};
    if (typeof t != "string" || t.length === 0)
      return o;
    var s = /\+/g;
    t = t.split(e);
    var i = 1000;
    r && typeof r.maxKeys == "number" && (i = r.maxKeys);
    var a = t.length;
    i > 0 && a > i && (a = i);
    for (var l = 0;l < a; ++l) {
      var c, f, g, p, y = t[l].replace(s, "%20"), T = y.indexOf(n);
      T >= 0 ? (c = y.substr(0, T), f = y.substr(T + 1)) : (c = y, f = ""), g = decodeURIComponent(c), p = decodeURIComponent(f), LE(o, g) ? Array.isArray(o[g]) ? o[g].push(p) : o[g] = [o[g], p] : o[g] = p;
    }
    return o;
  }, ri = function(t) {
    switch (typeof t) {
      case "string":
        return t;
      case "boolean":
        return t ? "true" : "false";
      case "number":
        return isFinite(t) ? t : "";
      default:
        return "";
    }
  }, KE = function(t, e, n, r) {
    return e = e || "&", n = n || "=", t === null && (t = undefined), typeof t == "object" ? Object.keys(t).map(function(o) {
      var s = encodeURIComponent(ri(o)) + n;
      return Array.isArray(t[o]) ? t[o].map(function(i) {
        return s + encodeURIComponent(ri(i));
      }).join(e) : s + encodeURIComponent(ri(t[o]));
    }).join(e) : r ? encodeURIComponent(ri(r)) + n + encodeURIComponent(ri(t)) : "";
  }, un = {};
  un.decode = un.parse = WE, un.encode = un.stringify = KE;
  un.decode;
  un.encode;
  un.parse;
  un.stringify;
  Ce = {}, FE = ZE, Ft = { isString: function(t) {
    return typeof t == "string";
  }, isObject: function(t) {
    return typeof t == "object" && t !== null;
  }, isNull: function(t) {
    return t === null;
  }, isNullOrUndefined: function(t) {
    return t == null;
  } };
  Ce.parse = ii, Ce.resolve = function(t, e) {
    return ii(t, false, true).resolve(e);
  }, Ce.resolveObject = function(t, e) {
    return t ? ii(t, false, true).resolveObject(e) : e;
  }, Ce.format = function(t) {
    return Ft.isString(t) && (t = ii(t)), t instanceof It ? t.format() : It.prototype.format.call(t);
  }, Ce.Url = It;
  zE = /^([a-z0-9.+-]+:)/i, qE = /:[0-9]*$/, GE = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, VE = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", `
`, "\t"]), wa = ["'"].concat(VE), eh = ["%", "/", "?", ";", "#"].concat(wa), th = ["/", "?", "#"], nh = /^[+a-z0-9A-Z_-]{0,63}$/, JE = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, YE = { javascript: true, "javascript:": true }, va = { javascript: true, "javascript:": true }, gr = { http: true, https: true, ftp: true, gopher: true, file: true, "http:": true, "https:": true, "ftp:": true, "gopher:": true, "file:": true }, _a = un;
  It.prototype.parse = function(t, e, n) {
    if (!Ft.isString(t))
      throw new TypeError("Parameter 'url' must be a string, not " + typeof t);
    var r = t.indexOf("?"), o = r !== -1 && r < t.indexOf("#") ? "?" : "#", s = t.split(o);
    s[0] = s[0].replace(/\\/g, "/");
    var i = t = s.join(o);
    if (i = i.trim(), !n && t.split("#").length === 1) {
      var a = GE.exec(i);
      if (a)
        return this.path = i, this.href = i, this.pathname = a[1], a[2] ? (this.search = a[2], this.query = e ? _a.parse(this.search.substr(1)) : this.search.substr(1)) : e && (this.search = "", this.query = {}), this;
    }
    var l = zE.exec(i);
    if (l) {
      var c = (l = l[0]).toLowerCase();
      this.protocol = c, i = i.substr(l.length);
    }
    if (n || l || i.match(/^\/\/[^@\/]+@[^@\/]+/)) {
      var f = i.substr(0, 2) === "//";
      !f || l && va[l] || (i = i.substr(2), this.slashes = true);
    }
    if (!va[l] && (f || l && !gr[l])) {
      for (var g, p, y = -1, T = 0;T < th.length; T++)
        (P = i.indexOf(th[T])) !== -1 && (y === -1 || P < y) && (y = P);
      for ((p = y === -1 ? i.lastIndexOf("@") : i.lastIndexOf("@", y)) !== -1 && (g = i.slice(0, p), i = i.slice(p + 1), this.auth = decodeURIComponent(g)), y = -1, T = 0;T < eh.length; T++) {
        var P;
        (P = i.indexOf(eh[T])) !== -1 && (y === -1 || P < y) && (y = P);
      }
      y === -1 && (y = i.length), this.host = i.slice(0, y), i = i.slice(y), this.parseHost(), this.hostname = this.hostname || "";
      var B = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
      if (!B)
        for (var v = this.hostname.split(/\./), E = (T = 0, v.length);T < E; T++) {
          var I = v[T];
          if (I && !I.match(nh)) {
            for (var D = "", $ = 0, Q = I.length;$ < Q; $++)
              I.charCodeAt($) > 127 ? D += "x" : D += I[$];
            if (!D.match(nh)) {
              var Y = v.slice(0, T), ce = v.slice(T + 1), re = I.match(JE);
              re && (Y.push(re[1]), ce.unshift(re[2])), ce.length && (i = "/" + ce.join(".") + i), this.hostname = Y.join(".");
              break;
            }
          }
        }
      this.hostname.length > 255 ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), B || (this.hostname = FE.toASCII(this.hostname));
      var ee = this.port ? ":" + this.port : "", Ie = this.hostname || "";
      this.host = Ie + ee, this.href += this.host, B && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), i[0] !== "/" && (i = "/" + i));
    }
    if (!YE[c])
      for (T = 0, E = wa.length;T < E; T++) {
        var We = wa[T];
        if (i.indexOf(We) !== -1) {
          var Xe = encodeURIComponent(We);
          Xe === We && (Xe = escape(We)), i = i.split(We).join(Xe);
        }
      }
    var ze = i.indexOf("#");
    ze !== -1 && (this.hash = i.substr(ze), i = i.slice(0, ze));
    var qe = i.indexOf("?");
    if (qe !== -1 ? (this.search = i.substr(qe), this.query = i.substr(qe + 1), e && (this.query = _a.parse(this.query)), i = i.slice(0, qe)) : e && (this.search = "", this.query = {}), i && (this.pathname = i), gr[c] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
      ee = this.pathname || "";
      var pt = this.search || "";
      this.path = ee + pt;
    }
    return this.href = this.format(), this;
  }, It.prototype.format = function() {
    var t = this.auth || "";
    t && (t = (t = encodeURIComponent(t)).replace(/%3A/i, ":"), t += "@");
    var e = this.protocol || "", n = this.pathname || "", r = this.hash || "", o = false, s = "";
    this.host ? o = t + this.host : this.hostname && (o = t + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (o += ":" + this.port)), this.query && Ft.isObject(this.query) && Object.keys(this.query).length && (s = _a.stringify(this.query));
    var i = this.search || s && "?" + s || "";
    return e && e.substr(-1) !== ":" && (e += ":"), this.slashes || (!e || gr[e]) && o !== false ? (o = "//" + (o || ""), n && n.charAt(0) !== "/" && (n = "/" + n)) : o || (o = ""), r && r.charAt(0) !== "#" && (r = "#" + r), i && i.charAt(0) !== "?" && (i = "?" + i), e + o + (n = n.replace(/[?#]/g, function(a) {
      return encodeURIComponent(a);
    })) + (i = i.replace("#", "%23")) + r;
  }, It.prototype.resolve = function(t) {
    return this.resolveObject(ii(t, false, true)).format();
  }, It.prototype.resolveObject = function(t) {
    if (Ft.isString(t)) {
      var e = new It;
      e.parse(t, false, true), t = e;
    }
    for (var n = new It, r = Object.keys(this), o = 0;o < r.length; o++) {
      var s = r[o];
      n[s] = this[s];
    }
    if (n.hash = t.hash, t.href === "")
      return n.href = n.format(), n;
    if (t.slashes && !t.protocol) {
      for (var i = Object.keys(t), a = 0;a < i.length; a++) {
        var l = i[a];
        l !== "protocol" && (n[l] = t[l]);
      }
      return gr[n.protocol] && n.hostname && !n.pathname && (n.path = n.pathname = "/"), n.href = n.format(), n;
    }
    if (t.protocol && t.protocol !== n.protocol) {
      if (!gr[t.protocol]) {
        for (var c = Object.keys(t), f = 0;f < c.length; f++) {
          var g = c[f];
          n[g] = t[g];
        }
        return n.href = n.format(), n;
      }
      if (n.protocol = t.protocol, t.host || va[t.protocol])
        n.pathname = t.pathname;
      else {
        for (var p = (t.pathname || "").split("/");p.length && !(t.host = p.shift()); )
          ;
        t.host || (t.host = ""), t.hostname || (t.hostname = ""), p[0] !== "" && p.unshift(""), p.length < 2 && p.unshift(""), n.pathname = p.join("/");
      }
      if (n.search = t.search, n.query = t.query, n.host = t.host || "", n.auth = t.auth, n.hostname = t.hostname || t.host, n.port = t.port, n.pathname || n.search) {
        var y = n.pathname || "", T = n.search || "";
        n.path = y + T;
      }
      return n.slashes = n.slashes || t.slashes, n.href = n.format(), n;
    }
    var P = n.pathname && n.pathname.charAt(0) === "/", B = t.host || t.pathname && t.pathname.charAt(0) === "/", v = B || P || n.host && t.pathname, E = v, I = n.pathname && n.pathname.split("/") || [], D = (p = t.pathname && t.pathname.split("/") || [], n.protocol && !gr[n.protocol]);
    if (D && (n.hostname = "", n.port = null, n.host && (I[0] === "" ? I[0] = n.host : I.unshift(n.host)), n.host = "", t.protocol && (t.hostname = null, t.port = null, t.host && (p[0] === "" ? p[0] = t.host : p.unshift(t.host)), t.host = null), v = v && (p[0] === "" || I[0] === "")), B)
      n.host = t.host || t.host === "" ? t.host : n.host, n.hostname = t.hostname || t.hostname === "" ? t.hostname : n.hostname, n.search = t.search, n.query = t.query, I = p;
    else if (p.length)
      I || (I = []), I.pop(), I = I.concat(p), n.search = t.search, n.query = t.query;
    else if (!Ft.isNullOrUndefined(t.search))
      return D && (n.hostname = n.host = I.shift(), (re = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@")) && (n.auth = re.shift(), n.host = n.hostname = re.shift())), n.search = t.search, n.query = t.query, Ft.isNull(n.pathname) && Ft.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")), n.href = n.format(), n;
    if (!I.length)
      return n.pathname = null, n.search ? n.path = "/" + n.search : n.path = null, n.href = n.format(), n;
    for (var $ = I.slice(-1)[0], Q = (n.host || t.host || I.length > 1) && ($ === "." || $ === "..") || $ === "", Y = 0, ce = I.length;ce >= 0; ce--)
      ($ = I[ce]) === "." ? I.splice(ce, 1) : $ === ".." ? (I.splice(ce, 1), Y++) : Y && (I.splice(ce, 1), Y--);
    if (!v && !E)
      for (;Y--; Y)
        I.unshift("..");
    !v || I[0] === "" || I[0] && I[0].charAt(0) === "/" || I.unshift(""), Q && I.join("/").substr(-1) !== "/" && I.push("");
    var re, ee = I[0] === "" || I[0] && I[0].charAt(0) === "/";
    return D && (n.hostname = n.host = ee ? "" : I.length ? I.shift() : "", (re = !!(n.host && n.host.indexOf("@") > 0) && n.host.split("@")) && (n.auth = re.shift(), n.host = n.hostname = re.shift())), (v = v || n.host && I.length) && !ee && I.unshift(""), I.length ? n.pathname = I.join("/") : (n.pathname = null, n.path = null), Ft.isNull(n.pathname) && Ft.isNull(n.search) || (n.path = (n.pathname ? n.pathname : "") + (n.search ? n.search : "")), n.auth = t.auth || n.auth, n.slashes = n.slashes || t.slashes, n.href = n.format(), n;
  }, It.prototype.parseHost = function() {
    var t = this.host, e = qE.exec(t);
    e && ((e = e[0]) !== ":" && (this.port = e.substr(1)), t = t.substr(0, t.length - e.length)), t && (this.hostname = t);
  };
  Ce.Url;
  Ce.format;
  Ce.resolve;
  Ce.resolveObject;
  ba = {}, rh = false;
  ih = XE(), QE = typeof Deno < "u" ? Deno.build.os === "windows" ? "win32" : Deno.build.os : undefined;
  Ce.URL = typeof URL < "u" ? URL : null;
  Ce.pathToFileURL = pS;
  Ce.fileURLToPath = cS;
  Ce.Url;
  Ce.format;
  Ce.resolve;
  Ce.resolveObject;
  Ce.URL;
  eS = 92, tS = 47, nS = 97, rS = 122, xa = QE === "win32", iS = /\//g, oS = /%/g, sS = /\\/g, aS = /\n/g, lS = /\r/g, uS = /\t/g;
  gS = typeof Deno < "u" ? Deno.build.os === "windows" ? "win32" : Deno.build.os : undefined;
  Ce.URL = typeof URL < "u" ? URL : null;
  Ce.pathToFileURL = SS;
  Ce.fileURLToPath = BS;
  Ce.Url;
  Ce.format;
  Ce.resolve;
  Ce.resolveObject;
  Ce.parse;
  Ce.URL;
  mS = 92, yS = 47, hS = 97, TS = 122, Pa = gS === "win32", vS = /\//g, _S = /%/g, bS = /\\/g, wS = /\n/g, xS = /\r/g, PS = /\t/g;
});
var $h = {};
pn($h, { Agent: () => jS, ClientRequest: () => $S, IncomingMessage: () => ZS, METHODS: () => LS, STATUS_CODES: () => WS, default: () => cn, get: () => KS, globalAgent: () => FS, request: () => zS });
function Ch() {
  if (lh)
    return xt;
  lh = true, xt.fetch = r(Yn.fetch) && r(Yn.ReadableStream), xt.writableStream = r(Yn.WritableStream), xt.abortController = r(Yn.AbortController);
  var t;
  function e() {
    if (t !== undefined)
      return t;
    if (Yn.XMLHttpRequest) {
      t = new Yn.XMLHttpRequest;
      try {
        t.open("GET", Yn.XDomainRequest ? "/" : "https://example.com");
      } catch {
        t = null;
      }
    } else
      t = null;
    return t;
  }
  function n(o) {
    var s = e();
    if (!s)
      return false;
    try {
      return s.responseType = o, s.responseType === o;
    } catch {}
    return false;
  }
  xt.arraybuffer = xt.fetch || n("arraybuffer"), xt.msstream = !xt.fetch && n("ms-stream"), xt.mozchunkedarraybuffer = !xt.fetch && n("moz-chunked-arraybuffer"), xt.overrideMimeType = xt.fetch || (e() ? r(e().overrideMimeType) : false);
  function r(o) {
    return typeof o == "function";
  }
  return t = null, xt;
}
function Oh() {
  return uh || (uh = true, Ba = yt.EventEmitter), Ba;
}
function kS() {
  if (ch)
    return Ia;
  ch = true;
  function t(T, P) {
    var B = Object.keys(T);
    if (Object.getOwnPropertySymbols) {
      var v = Object.getOwnPropertySymbols(T);
      P && (v = v.filter(function(E) {
        return Object.getOwnPropertyDescriptor(T, E).enumerable;
      })), B.push.apply(B, v);
    }
    return B;
  }
  function e(T) {
    for (var P = 1;P < arguments.length; P++) {
      var B = arguments[P] != null ? arguments[P] : {};
      P % 2 ? t(Object(B), true).forEach(function(v) {
        n(T, v, B[v]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(T, Object.getOwnPropertyDescriptors(B)) : t(Object(B)).forEach(function(v) {
        Object.defineProperty(T, v, Object.getOwnPropertyDescriptor(B, v));
      });
    }
    return T;
  }
  function n(T, P, B) {
    return P = i(P), P in T ? Object.defineProperty(T, P, { value: B, enumerable: true, configurable: true, writable: true }) : T[P] = B, T;
  }
  function r(T, P) {
    if (!(T instanceof P))
      throw new TypeError("Cannot call a class as a function");
  }
  function o(T, P) {
    for (var B = 0;B < P.length; B++) {
      var v = P[B];
      v.enumerable = v.enumerable || false, v.configurable = true, "value" in v && (v.writable = true), Object.defineProperty(T, i(v.key), v);
    }
  }
  function s(T, P, B) {
    return P && o(T.prototype, P), Object.defineProperty(T, "prototype", { writable: false }), T;
  }
  function i(T) {
    var P = a(T, "string");
    return typeof P == "symbol" ? P : String(P);
  }
  function a(T, P) {
    if (typeof T != "object" || T === null)
      return T;
    var B = T[Symbol.toPrimitive];
    if (B !== undefined) {
      var v = B.call(T, P || "default");
      if (typeof v != "object")
        return v;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return (P === "string" ? String : Number)(T);
  }
  var l = $t(), c = l.Buffer, f = L, g = f.inspect, p = g && g.custom || "inspect";
  function y(T, P, B) {
    c.prototype.copy.call(T, P, B);
  }
  return Ia = function() {
    function T() {
      r(this, T), this.head = null, this.tail = null, this.length = 0;
    }
    return s(T, [{ key: "push", value: function(B) {
      var v = { data: B, next: null };
      this.length > 0 ? this.tail.next = v : this.head = v, this.tail = v, ++this.length;
    } }, { key: "unshift", value: function(B) {
      var v = { data: B, next: this.head };
      this.length === 0 && (this.tail = v), this.head = v, ++this.length;
    } }, { key: "shift", value: function() {
      if (this.length !== 0) {
        var B = this.head.data;
        return this.length === 1 ? this.head = this.tail = null : this.head = this.head.next, --this.length, B;
      }
    } }, { key: "clear", value: function() {
      this.head = this.tail = null, this.length = 0;
    } }, { key: "join", value: function(B) {
      if (this.length === 0)
        return "";
      for (var v = this.head, E = "" + v.data;v = v.next; )
        E += B + v.data;
      return E;
    } }, { key: "concat", value: function(B) {
      if (this.length === 0)
        return c.alloc(0);
      for (var v = c.allocUnsafe(B >>> 0), E = this.head, I = 0;E; )
        y(E.data, v, I), I += E.data.length, E = E.next;
      return v;
    } }, { key: "consume", value: function(B, v) {
      var E;
      return B < this.head.data.length ? (E = this.head.data.slice(0, B), this.head.data = this.head.data.slice(B)) : B === this.head.data.length ? E = this.shift() : E = v ? this._getString(B) : this._getBuffer(B), E;
    } }, { key: "first", value: function() {
      return this.head.data;
    } }, { key: "_getString", value: function(B) {
      var v = this.head, E = 1, I = v.data;
      for (B -= I.length;v = v.next; ) {
        var D = v.data, $ = B > D.length ? D.length : B;
        if ($ === D.length ? I += D : I += D.slice(0, B), B -= $, B === 0) {
          $ === D.length ? (++E, v.next ? this.head = v.next : this.head = this.tail = null) : (this.head = v, v.data = D.slice($));
          break;
        }
        ++E;
      }
      return this.length -= E, I;
    } }, { key: "_getBuffer", value: function(B) {
      var v = c.allocUnsafe(B), E = this.head, I = 1;
      for (E.data.copy(v), B -= E.data.length;E = E.next; ) {
        var D = E.data, $ = B > D.length ? D.length : B;
        if (D.copy(v, v.length - B, 0, $), B -= $, B === 0) {
          $ === D.length ? (++I, E.next ? this.head = E.next : this.head = this.tail = null) : (this.head = E, E.data = D.slice($));
          break;
        }
        ++I;
      }
      return this.length -= I, v;
    } }, { key: p, value: function(B, v) {
      return g(this, e(e({}, v), {}, { depth: 0, customInspect: false }));
    } }]), T;
  }(), Ia;
}
function Rh() {
  if (dh)
    return Ea;
  dh = true;
  var t = Mt;
  function e(a, l) {
    var c = this, f = this._readableState && this._readableState.destroyed, g = this._writableState && this._writableState.destroyed;
    return f || g ? (l ? l(a) : a && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = true, t.nextTick(s, this, a)) : t.nextTick(s, this, a)), this) : (this._readableState && (this._readableState.destroyed = true), this._writableState && (this._writableState.destroyed = true), this._destroy(a || null, function(p) {
      !l && p ? c._writableState ? c._writableState.errorEmitted ? t.nextTick(r, c) : (c._writableState.errorEmitted = true, t.nextTick(n, c, p)) : t.nextTick(n, c, p) : l ? (t.nextTick(r, c), l(p)) : t.nextTick(r, c);
    }), this);
  }
  function n(a, l) {
    s(a, l), r(a);
  }
  function r(a) {
    a._writableState && !a._writableState.emitClose || a._readableState && !a._readableState.emitClose || a.emit("close");
  }
  function o() {
    this._readableState && (this._readableState.destroyed = false, this._readableState.reading = false, this._readableState.ended = false, this._readableState.endEmitted = false), this._writableState && (this._writableState.destroyed = false, this._writableState.ended = false, this._writableState.ending = false, this._writableState.finalCalled = false, this._writableState.prefinished = false, this._writableState.finished = false, this._writableState.errorEmitted = false);
  }
  function s(a, l) {
    a.emit("error", l);
  }
  function i(a, l) {
    var { _readableState: c, _writableState: f } = a;
    c && c.autoDestroy || f && f.autoDestroy ? a.destroy(l) : a.emit("error", l);
  }
  return Ea = { destroy: e, undestroy: o, errorOrDestroy: i }, Ea;
}
function hr() {
  if (fh)
    return Sa;
  fh = true;
  let t = {};
  function e(i, a, l) {
    l || (l = Error);
    function c(g, p, y) {
      return typeof a == "string" ? a : a(g, p, y);
    }

    class f extends l {
      constructor(p, y, T) {
        super(c(p, y, T));
      }
    }
    f.prototype.name = l.name, f.prototype.code = i, t[i] = f;
  }
  function n(i, a) {
    if (Array.isArray(i)) {
      let l = i.length;
      return i = i.map((c) => String(c)), l > 2 ? `one of ${a} ${i.slice(0, l - 1).join(", ")}, or ` + i[l - 1] : l === 2 ? `one of ${a} ${i[0]} or ${i[1]}` : `of ${a} ${i[0]}`;
    } else
      return `of ${a} ${String(i)}`;
  }
  function r(i, a, l) {
    return i.substr(0, a.length) === a;
  }
  function o(i, a, l) {
    return (l === undefined || l > i.length) && (l = i.length), i.substring(l - a.length, l) === a;
  }
  function s(i, a, l) {
    return typeof l != "number" && (l = 0), l + a.length > i.length ? false : i.indexOf(a, l) !== -1;
  }
  return e("ERR_INVALID_OPT_VALUE", function(i, a) {
    return 'The value "' + a + '" is invalid for option "' + i + '"';
  }, TypeError), e("ERR_INVALID_ARG_TYPE", function(i, a, l) {
    let c;
    typeof a == "string" && r(a, "not ") ? (c = "must not be", a = a.replace(/^not /, "")) : c = "must be";
    let f;
    if (o(i, " argument"))
      f = `The ${i} ${c} ${n(a, "type")}`;
    else {
      let g = s(i, ".") ? "property" : "argument";
      f = `The "${i}" ${g} ${c} ${n(a, "type")}`;
    }
    return f += `. Received type ${typeof l}`, f;
  }, TypeError), e("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), e("ERR_METHOD_NOT_IMPLEMENTED", function(i) {
    return "The " + i + " method is not implemented";
  }), e("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), e("ERR_STREAM_DESTROYED", function(i) {
    return "Cannot call " + i + " after a stream was destroyed";
  }), e("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), e("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), e("ERR_STREAM_WRITE_AFTER_END", "write after end"), e("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), e("ERR_UNKNOWN_ENCODING", function(i) {
    return "Unknown encoding: " + i;
  }, TypeError), e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), Sa.codes = t, Sa;
}
function Mh() {
  if (ph)
    return ka;
  ph = true;
  var t = hr().codes.ERR_INVALID_OPT_VALUE;
  function e(r, o, s) {
    return r.highWaterMark != null ? r.highWaterMark : o ? r[s] : null;
  }
  function n(r, o, s, i) {
    var a = e(o, i, s);
    if (a != null) {
      if (!(isFinite(a) && Math.floor(a) === a) || a < 0) {
        var l = i ? s : "highWaterMark";
        throw new t(l, a);
      }
      return Math.floor(a);
    }
    return r.objectMode ? 16 : 16 * 1024;
  }
  return ka = { getHighWaterMark: n }, ka;
}
function Nh() {
  if (gh)
    return Aa;
  gh = true;
  var t = Mt;
  Aa = re;
  function e(R) {
    var C = this;
    this.next = null, this.entry = null, this.finish = function() {
      ge(C, R);
    };
  }
  var n;
  re.WritableState = Y;
  var r = { deprecate: Ly() }, o = Oh(), s = $t().Buffer, i = (typeof mh < "u" ? mh : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {};
  function a(R) {
    return s.from(R);
  }
  function l(R) {
    return s.isBuffer(R) || R instanceof i;
  }
  var c = Rh(), f = Mh(), g = f.getHighWaterMark, p = hr().codes, y = p.ERR_INVALID_ARG_TYPE, T = p.ERR_METHOD_NOT_IMPLEMENTED, P = p.ERR_MULTIPLE_CALLBACK, B = p.ERR_STREAM_CANNOT_PIPE, v = p.ERR_STREAM_DESTROYED, E = p.ERR_STREAM_NULL_VALUES, I = p.ERR_STREAM_WRITE_AFTER_END, D = p.ERR_UNKNOWN_ENCODING, $ = c.errorOrDestroy;
  Wt()(re, o);
  function Q() {}
  function Y(R, C, j) {
    n = n || yr(), R = R || {}, typeof j != "boolean" && (j = C instanceof n), this.objectMode = !!R.objectMode, j && (this.objectMode = this.objectMode || !!R.writableObjectMode), this.highWaterMark = g(this, R, "writableHighWaterMark", j), this.finalCalled = false, this.needDrain = false, this.ending = false, this.ended = false, this.finished = false, this.destroyed = false;
    var V = R.decodeStrings === false;
    this.decodeStrings = !V, this.defaultEncoding = R.defaultEncoding || "utf8", this.length = 0, this.writing = false, this.corked = 0, this.sync = true, this.bufferProcessing = false, this.onwrite = function(te) {
      Re(C, te);
    }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = false, this.errorEmitted = false, this.emitClose = R.emitClose !== false, this.autoDestroy = !!R.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new e(this);
  }
  Y.prototype.getBuffer = function() {
    for (var C = this.bufferedRequest, j = [];C; )
      j.push(C), C = C.next;
    return j;
  }, function() {
    try {
      Object.defineProperty(Y.prototype, "buffer", { get: r.deprecate(function() {
        return this.getBuffer();
      }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") });
    } catch {}
  }();
  var ce;
  typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (ce = Function.prototype[Symbol.hasInstance], Object.defineProperty(re, Symbol.hasInstance, { value: function(C) {
    return ce.call(this, C) ? true : this !== re ? false : C && C._writableState instanceof Y;
  } })) : ce = function(C) {
    return C instanceof this;
  };
  function re(R) {
    n = n || yr();
    var C = this instanceof n;
    if (!C && !ce.call(re, this))
      return new re(R);
    this._writableState = new Y(R, this, C), this.writable = true, R && (typeof R.write == "function" && (this._write = R.write), typeof R.writev == "function" && (this._writev = R.writev), typeof R.destroy == "function" && (this._destroy = R.destroy), typeof R.final == "function" && (this._final = R.final)), o.call(this);
  }
  re.prototype.pipe = function() {
    $(this, new B);
  };
  function ee(R, C) {
    var j = new I;
    $(R, j), t.nextTick(C, j);
  }
  function Ie(R, C, j, V) {
    var te;
    return j === null ? te = new E : typeof j != "string" && !C.objectMode && (te = new y("chunk", ["string", "Buffer"], j)), te ? ($(R, te), t.nextTick(V, te), false) : true;
  }
  re.prototype.write = function(R, C, j) {
    var V = this._writableState, te = false, b = !V.objectMode && l(R);
    return b && !s.isBuffer(R) && (R = a(R)), typeof C == "function" && (j = C, C = null), b ? C = "buffer" : C || (C = V.defaultEncoding), typeof j != "function" && (j = Q), V.ending ? ee(this, j) : (b || Ie(this, V, R, j)) && (V.pendingcb++, te = Xe(this, V, b, R, C, j)), te;
  }, re.prototype.cork = function() {
    this._writableState.corked++;
  }, re.prototype.uncork = function() {
    var R = this._writableState;
    R.corked && (R.corked--, !R.writing && !R.corked && !R.bufferProcessing && R.bufferedRequest && se(this, R));
  }, re.prototype.setDefaultEncoding = function(C) {
    if (typeof C == "string" && (C = C.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((C + "").toLowerCase()) > -1))
      throw new D(C);
    return this._writableState.defaultEncoding = C, this;
  }, Object.defineProperty(re.prototype, "writableBuffer", { enumerable: false, get: function() {
    return this._writableState && this._writableState.getBuffer();
  } });
  function We(R, C, j) {
    return !R.objectMode && R.decodeStrings !== false && typeof C == "string" && (C = s.from(C, j)), C;
  }
  Object.defineProperty(re.prototype, "writableHighWaterMark", { enumerable: false, get: function() {
    return this._writableState.highWaterMark;
  } });
  function Xe(R, C, j, V, te, b) {
    if (!j) {
      var x = We(C, V, te);
      V !== x && (j = true, te = "buffer", V = x);
    }
    var F = C.objectMode ? 1 : V.length;
    C.length += F;
    var J = C.length < C.highWaterMark;
    if (J || (C.needDrain = true), C.writing || C.corked) {
      var Se = C.lastBufferedRequest;
      C.lastBufferedRequest = { chunk: V, encoding: te, isBuf: j, callback: b, next: null }, Se ? Se.next = C.lastBufferedRequest : C.bufferedRequest = C.lastBufferedRequest, C.bufferedRequestCount += 1;
    } else
      ze(R, C, false, F, V, te, b);
    return J;
  }
  function ze(R, C, j, V, te, b, x) {
    C.writelen = V, C.writecb = x, C.writing = true, C.sync = true, C.destroyed ? C.onwrite(new v("write")) : j ? R._writev(te, C.onwrite) : R._write(te, b, C.onwrite), C.sync = false;
  }
  function qe(R, C, j, V, te) {
    --C.pendingcb, j ? (t.nextTick(te, V), t.nextTick(W, R, C), R._writableState.errorEmitted = true, $(R, V)) : (te(V), R._writableState.errorEmitted = true, $(R, V), W(R, C));
  }
  function pt(R) {
    R.writing = false, R.writecb = null, R.length -= R.writelen, R.writelen = 0;
  }
  function Re(R, C) {
    var j = R._writableState, V = j.sync, te = j.writecb;
    if (typeof te != "function")
      throw new P;
    if (pt(j), C)
      qe(R, j, V, C, te);
    else {
      var b = de(j) || R.destroyed;
      !b && !j.corked && !j.bufferProcessing && j.bufferedRequest && se(R, j), V ? t.nextTick(ve, R, j, b, te) : ve(R, j, b, te);
    }
  }
  function ve(R, C, j, V) {
    j || we(R, C), C.pendingcb--, V(), W(R, C);
  }
  function we(R, C) {
    C.length === 0 && C.needDrain && (C.needDrain = false, R.emit("drain"));
  }
  function se(R, C) {
    C.bufferProcessing = true;
    var j = C.bufferedRequest;
    if (R._writev && j && j.next) {
      var V = C.bufferedRequestCount, te = new Array(V), b = C.corkedRequestsFree;
      b.entry = j;
      for (var x = 0, F = true;j; )
        te[x] = j, j.isBuf || (F = false), j = j.next, x += 1;
      te.allBuffers = F, ze(R, C, true, C.length, te, "", b.finish), C.pendingcb++, C.lastBufferedRequest = null, b.next ? (C.corkedRequestsFree = b.next, b.next = null) : C.corkedRequestsFree = new e(C), C.bufferedRequestCount = 0;
    } else {
      for (;j; ) {
        var { chunk: J, encoding: Se, callback: me } = j, U = C.objectMode ? 1 : J.length;
        if (ze(R, C, false, U, J, Se, me), j = j.next, C.bufferedRequestCount--, C.writing)
          break;
      }
      j === null && (C.lastBufferedRequest = null);
    }
    C.bufferedRequest = j, C.bufferProcessing = false;
  }
  re.prototype._write = function(R, C, j) {
    j(new T("_write()"));
  }, re.prototype._writev = null, re.prototype.end = function(R, C, j) {
    var V = this._writableState;
    return typeof R == "function" ? (j = R, R = null, C = null) : typeof C == "function" && (j = C, C = null), R != null && this.write(R, C), V.corked && (V.corked = 1, this.uncork()), V.ending || le(this, V, j), this;
  }, Object.defineProperty(re.prototype, "writableLength", { enumerable: false, get: function() {
    return this._writableState.length;
  } });
  function de(R) {
    return R.ending && R.length === 0 && R.bufferedRequest === null && !R.finished && !R.writing;
  }
  function N(R, C) {
    R._final(function(j) {
      C.pendingcb--, j && $(R, j), C.prefinished = true, R.emit("prefinish"), W(R, C);
    });
  }
  function Z(R, C) {
    !C.prefinished && !C.finalCalled && (typeof R._final == "function" && !C.destroyed ? (C.pendingcb++, C.finalCalled = true, t.nextTick(N, R, C)) : (C.prefinished = true, R.emit("prefinish")));
  }
  function W(R, C) {
    var j = de(C);
    if (j && (Z(R, C), C.pendingcb === 0 && (C.finished = true, R.emit("finish"), C.autoDestroy))) {
      var V = R._readableState;
      (!V || V.autoDestroy && V.endEmitted) && R.destroy();
    }
    return j;
  }
  function le(R, C, j) {
    C.ending = true, W(R, C), j && (C.finished ? t.nextTick(j) : R.once("finish", j)), C.ended = true, R.writable = false;
  }
  function ge(R, C, j) {
    var V = R.entry;
    for (R.entry = null;V; ) {
      var te = V.callback;
      C.pendingcb--, te(j), V = V.next;
    }
    C.corkedRequestsFree.next = R;
  }
  return Object.defineProperty(re.prototype, "destroyed", { enumerable: false, get: function() {
    return this._writableState === undefined ? false : this._writableState.destroyed;
  }, set: function(C) {
    this._writableState && (this._writableState.destroyed = C);
  } }), re.prototype.destroy = c.destroy, re.prototype._undestroy = c.undestroy, re.prototype._destroy = function(R, C) {
    C(R);
  }, Aa;
}
function yr() {
  if (yh)
    return Ca;
  yh = true;
  var t = Mt, e = Object.keys || function(f) {
    var g = [];
    for (var p in f)
      g.push(p);
    return g;
  };
  Ca = a;
  var n = Dh(), r = Nh();
  Wt()(a, n);
  for (var o = e(r.prototype), s = 0;s < o.length; s++) {
    var i = o[s];
    a.prototype[i] || (a.prototype[i] = r.prototype[i]);
  }
  function a(f) {
    if (!(this instanceof a))
      return new a(f);
    n.call(this, f), r.call(this, f), this.allowHalfOpen = true, f && (f.readable === false && (this.readable = false), f.writable === false && (this.writable = false), f.allowHalfOpen === false && (this.allowHalfOpen = false, this.once("end", l)));
  }
  Object.defineProperty(a.prototype, "writableHighWaterMark", { enumerable: false, get: function() {
    return this._writableState.highWaterMark;
  } }), Object.defineProperty(a.prototype, "writableBuffer", { enumerable: false, get: function() {
    return this._writableState && this._writableState.getBuffer();
  } }), Object.defineProperty(a.prototype, "writableLength", { enumerable: false, get: function() {
    return this._writableState.length;
  } });
  function l() {
    this._writableState.ended || t.nextTick(c, this);
  }
  function c(f) {
    f.end();
  }
  return Object.defineProperty(a.prototype, "destroyed", { enumerable: false, get: function() {
    return this._readableState === undefined || this._writableState === undefined ? false : this._readableState.destroyed && this._writableState.destroyed;
  }, set: function(g) {
    this._readableState === undefined || this._writableState === undefined || (this._readableState.destroyed = g, this._writableState.destroyed = g);
  } }), Ca;
}
function Wa() {
  if (hh)
    return Oa;
  hh = true;
  var t = hr().codes.ERR_STREAM_PREMATURE_CLOSE;
  function e(s) {
    var i = false;
    return function() {
      if (!i) {
        i = true;
        for (var a = arguments.length, l = new Array(a), c = 0;c < a; c++)
          l[c] = arguments[c];
        s.apply(this, l);
      }
    };
  }
  function n() {}
  function r(s) {
    return s.setHeader && typeof s.abort == "function";
  }
  function o(s, i, a) {
    if (typeof i == "function")
      return o(s, null, i);
    i || (i = {}), a = e(a || n);
    var l = i.readable || i.readable !== false && s.readable, c = i.writable || i.writable !== false && s.writable, f = function() {
      s.writable || p();
    }, g = s._writableState && s._writableState.finished, p = function() {
      c = false, g = true, l || a.call(s);
    }, y = s._readableState && s._readableState.endEmitted, T = function() {
      l = false, y = true, c || a.call(s);
    }, P = function(I) {
      a.call(s, I);
    }, B = function() {
      var I;
      if (l && !y)
        return (!s._readableState || !s._readableState.ended) && (I = new t), a.call(s, I);
      if (c && !g)
        return (!s._writableState || !s._writableState.ended) && (I = new t), a.call(s, I);
    }, v = function() {
      s.req.on("finish", p);
    };
    return r(s) ? (s.on("complete", p), s.on("abort", B), s.req ? v() : s.on("request", v)) : c && !s._writableState && (s.on("end", f), s.on("close", f)), s.on("end", T), s.on("finish", p), i.error !== false && s.on("error", P), s.on("close", B), function() {
      s.removeListener("complete", p), s.removeListener("abort", B), s.removeListener("request", v), s.req && s.req.removeListener("finish", p), s.removeListener("end", f), s.removeListener("close", f), s.removeListener("finish", p), s.removeListener("end", T), s.removeListener("error", P), s.removeListener("close", B);
    };
  }
  return Oa = o, Oa;
}
function AS() {
  if (Th)
    return Ra;
  Th = true;
  var t = Mt, e;
  function n(D, $, Q) {
    return $ = r($), $ in D ? Object.defineProperty(D, $, { value: Q, enumerable: true, configurable: true, writable: true }) : D[$] = Q, D;
  }
  function r(D) {
    var $ = o(D, "string");
    return typeof $ == "symbol" ? $ : String($);
  }
  function o(D, $) {
    if (typeof D != "object" || D === null)
      return D;
    var Q = D[Symbol.toPrimitive];
    if (Q !== undefined) {
      var Y = Q.call(D, $ || "default");
      if (typeof Y != "object")
        return Y;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return ($ === "string" ? String : Number)(D);
  }
  var s = Wa(), i = Symbol("lastResolve"), a = Symbol("lastReject"), l = Symbol("error"), c = Symbol("ended"), f = Symbol("lastPromise"), g = Symbol("handlePromise"), p = Symbol("stream");
  function y(D, $) {
    return { value: D, done: $ };
  }
  function T(D) {
    var $ = D[i];
    if ($ !== null) {
      var Q = D[p].read();
      Q !== null && (D[f] = null, D[i] = null, D[a] = null, $(y(Q, false)));
    }
  }
  function P(D) {
    t.nextTick(T, D);
  }
  function B(D, $) {
    return function(Q, Y) {
      D.then(function() {
        if ($[c]) {
          Q(y(undefined, true));
          return;
        }
        $[g](Q, Y);
      }, Y);
    };
  }
  var v = Object.getPrototypeOf(function() {}), E = Object.setPrototypeOf((e = { get stream() {
    return this[p];
  }, next: function() {
    var $ = this, Q = this[l];
    if (Q !== null)
      return Promise.reject(Q);
    if (this[c])
      return Promise.resolve(y(undefined, true));
    if (this[p].destroyed)
      return new Promise(function(ee, Ie) {
        t.nextTick(function() {
          $[l] ? Ie($[l]) : ee(y(undefined, true));
        });
      });
    var Y = this[f], ce;
    if (Y)
      ce = new Promise(B(Y, this));
    else {
      var re = this[p].read();
      if (re !== null)
        return Promise.resolve(y(re, false));
      ce = new Promise(this[g]);
    }
    return this[f] = ce, ce;
  } }, n(e, Symbol.asyncIterator, function() {
    return this;
  }), n(e, "return", function() {
    var $ = this;
    return new Promise(function(Q, Y) {
      $[p].destroy(null, function(ce) {
        if (ce) {
          Y(ce);
          return;
        }
        Q(y(undefined, true));
      });
    });
  }), e), v), I = function($) {
    var Q, Y = Object.create(E, (Q = {}, n(Q, p, { value: $, writable: true }), n(Q, i, { value: null, writable: true }), n(Q, a, { value: null, writable: true }), n(Q, l, { value: null, writable: true }), n(Q, c, { value: $._readableState.endEmitted, writable: true }), n(Q, g, { value: function(re, ee) {
      var Ie = Y[p].read();
      Ie ? (Y[f] = null, Y[i] = null, Y[a] = null, re(y(Ie, false))) : (Y[i] = re, Y[a] = ee);
    }, writable: true }), Q));
    return Y[f] = null, s($, function(ce) {
      if (ce && ce.code !== "ERR_STREAM_PREMATURE_CLOSE") {
        var re = Y[a];
        re !== null && (Y[f] = null, Y[i] = null, Y[a] = null, re(ce)), Y[l] = ce;
        return;
      }
      var ee = Y[i];
      ee !== null && (Y[f] = null, Y[i] = null, Y[a] = null, ee(y(undefined, true))), Y[c] = true;
    }), $.on("readable", P.bind(null, Y)), Y;
  };
  return Ra = I, Ra;
}
function CS() {
  return vh || (vh = true, Ma = function() {
    throw new Error("Readable.from is not available in the browser");
  }), Ma;
}
function Dh() {
  if (_h)
    return Na;
  _h = true;
  var t = Mt;
  Na = ee;
  var e;
  ee.ReadableState = re, yt.EventEmitter;
  var n = function(x, F) {
    return x.listeners(F).length;
  }, r = Oh(), o = $t().Buffer, s = (typeof bh < "u" ? bh : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {};
  function i(b) {
    return o.from(b);
  }
  function a(b) {
    return o.isBuffer(b) || b instanceof s;
  }
  var l = L, c;
  l && l.debuglog ? c = l.debuglog("stream") : c = function() {};
  var f = kS(), g = Rh(), p = Mh(), y = p.getHighWaterMark, T = hr().codes, P = T.ERR_INVALID_ARG_TYPE, B = T.ERR_STREAM_PUSH_AFTER_EOF, v = T.ERR_METHOD_NOT_IMPLEMENTED, E = T.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, I, D, $;
  Wt()(ee, r);
  var Q = g.errorOrDestroy, Y = ["error", "close", "destroy", "pause", "resume"];
  function ce(b, x, F) {
    if (typeof b.prependListener == "function")
      return b.prependListener(x, F);
    !b._events || !b._events[x] ? b.on(x, F) : Array.isArray(b._events[x]) ? b._events[x].unshift(F) : b._events[x] = [F, b._events[x]];
  }
  function re(b, x, F) {
    e = e || yr(), b = b || {}, typeof F != "boolean" && (F = x instanceof e), this.objectMode = !!b.objectMode, F && (this.objectMode = this.objectMode || !!b.readableObjectMode), this.highWaterMark = y(this, b, "readableHighWaterMark", F), this.buffer = new f, this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = false, this.endEmitted = false, this.reading = false, this.sync = true, this.needReadable = false, this.emittedReadable = false, this.readableListening = false, this.resumeScheduled = false, this.paused = true, this.emitClose = b.emitClose !== false, this.autoDestroy = !!b.autoDestroy, this.destroyed = false, this.defaultEncoding = b.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = false, this.decoder = null, this.encoding = null, b.encoding && (I || (I = ni.StringDecoder), this.decoder = new I(b.encoding), this.encoding = b.encoding);
  }
  function ee(b) {
    if (e = e || yr(), !(this instanceof ee))
      return new ee(b);
    var x = this instanceof e;
    this._readableState = new re(b, this, x), this.readable = true, b && (typeof b.read == "function" && (this._read = b.read), typeof b.destroy == "function" && (this._destroy = b.destroy)), r.call(this);
  }
  Object.defineProperty(ee.prototype, "destroyed", { enumerable: false, get: function() {
    return this._readableState === undefined ? false : this._readableState.destroyed;
  }, set: function(x) {
    this._readableState && (this._readableState.destroyed = x);
  } }), ee.prototype.destroy = g.destroy, ee.prototype._undestroy = g.undestroy, ee.prototype._destroy = function(b, x) {
    x(b);
  }, ee.prototype.push = function(b, x) {
    var F = this._readableState, J;
    return F.objectMode ? J = true : typeof b == "string" && (x = x || F.defaultEncoding, x !== F.encoding && (b = o.from(b, x), x = ""), J = true), Ie(this, b, x, false, J);
  }, ee.prototype.unshift = function(b) {
    return Ie(this, b, null, true, false);
  };
  function Ie(b, x, F, J, Se) {
    c("readableAddChunk", x);
    var me = b._readableState;
    if (x === null)
      me.reading = false, Re(b, me);
    else {
      var U;
      if (Se || (U = Xe(me, x)), U)
        Q(b, U);
      else if (me.objectMode || x && x.length > 0)
        if (typeof x != "string" && !me.objectMode && Object.getPrototypeOf(x) !== o.prototype && (x = i(x)), J)
          me.endEmitted ? Q(b, new E) : We(b, me, x, true);
        else if (me.ended)
          Q(b, new B);
        else {
          if (me.destroyed)
            return false;
          me.reading = false, me.decoder && !F ? (x = me.decoder.write(x), me.objectMode || x.length !== 0 ? We(b, me, x, false) : se(b, me)) : We(b, me, x, false);
        }
      else
        J || (me.reading = false, se(b, me));
    }
    return !me.ended && (me.length < me.highWaterMark || me.length === 0);
  }
  function We(b, x, F, J) {
    x.flowing && x.length === 0 && !x.sync ? (x.awaitDrain = 0, b.emit("data", F)) : (x.length += x.objectMode ? 1 : F.length, J ? x.buffer.unshift(F) : x.buffer.push(F), x.needReadable && ve(b)), se(b, x);
  }
  function Xe(b, x) {
    var F;
    return !a(x) && typeof x != "string" && x !== undefined && !b.objectMode && (F = new P("chunk", ["string", "Buffer", "Uint8Array"], x)), F;
  }
  ee.prototype.isPaused = function() {
    return this._readableState.flowing === false;
  }, ee.prototype.setEncoding = function(b) {
    I || (I = ni.StringDecoder);
    var x = new I(b);
    this._readableState.decoder = x, this._readableState.encoding = this._readableState.decoder.encoding;
    for (var F = this._readableState.buffer.head, J = "";F !== null; )
      J += x.write(F.data), F = F.next;
    return this._readableState.buffer.clear(), J !== "" && this._readableState.buffer.push(J), this._readableState.length = J.length, this;
  };
  var ze = 1073741824;
  function qe(b) {
    return b >= ze ? b = ze : (b--, b |= b >>> 1, b |= b >>> 2, b |= b >>> 4, b |= b >>> 8, b |= b >>> 16, b++), b;
  }
  function pt(b, x) {
    return b <= 0 || x.length === 0 && x.ended ? 0 : x.objectMode ? 1 : b !== b ? x.flowing && x.length ? x.buffer.head.data.length : x.length : (b > x.highWaterMark && (x.highWaterMark = qe(b)), b <= x.length ? b : x.ended ? x.length : (x.needReadable = true, 0));
  }
  ee.prototype.read = function(b) {
    c("read", b), b = parseInt(b, 10);
    var x = this._readableState, F = b;
    if (b !== 0 && (x.emittedReadable = false), b === 0 && x.needReadable && ((x.highWaterMark !== 0 ? x.length >= x.highWaterMark : x.length > 0) || x.ended))
      return c("read: emitReadable", x.length, x.ended), x.length === 0 && x.ended ? j(this) : ve(this), null;
    if (b = pt(b, x), b === 0 && x.ended)
      return x.length === 0 && j(this), null;
    var J = x.needReadable;
    c("need readable", J), (x.length === 0 || x.length - b < x.highWaterMark) && (J = true, c("length less than watermark", J)), x.ended || x.reading ? (J = false, c("reading or ended", J)) : J && (c("do read"), x.reading = true, x.sync = true, x.length === 0 && (x.needReadable = true), this._read(x.highWaterMark), x.sync = false, x.reading || (b = pt(F, x)));
    var Se;
    return b > 0 ? Se = C(b, x) : Se = null, Se === null ? (x.needReadable = x.length <= x.highWaterMark, b = 0) : (x.length -= b, x.awaitDrain = 0), x.length === 0 && (x.ended || (x.needReadable = true), F !== b && x.ended && j(this)), Se !== null && this.emit("data", Se), Se;
  };
  function Re(b, x) {
    if (c("onEofChunk"), !x.ended) {
      if (x.decoder) {
        var F = x.decoder.end();
        F && F.length && (x.buffer.push(F), x.length += x.objectMode ? 1 : F.length);
      }
      x.ended = true, x.sync ? ve(b) : (x.needReadable = false, x.emittedReadable || (x.emittedReadable = true, we(b)));
    }
  }
  function ve(b) {
    var x = b._readableState;
    c("emitReadable", x.needReadable, x.emittedReadable), x.needReadable = false, x.emittedReadable || (c("emitReadable", x.flowing), x.emittedReadable = true, t.nextTick(we, b));
  }
  function we(b) {
    var x = b._readableState;
    c("emitReadable_", x.destroyed, x.length, x.ended), !x.destroyed && (x.length || x.ended) && (b.emit("readable"), x.emittedReadable = false), x.needReadable = !x.flowing && !x.ended && x.length <= x.highWaterMark, R(b);
  }
  function se(b, x) {
    x.readingMore || (x.readingMore = true, t.nextTick(de, b, x));
  }
  function de(b, x) {
    for (;!x.reading && !x.ended && (x.length < x.highWaterMark || x.flowing && x.length === 0); ) {
      var F = x.length;
      if (c("maybeReadMore read 0"), b.read(0), F === x.length)
        break;
    }
    x.readingMore = false;
  }
  ee.prototype._read = function(b) {
    Q(this, new v("_read()"));
  }, ee.prototype.pipe = function(b, x) {
    var F = this, J = this._readableState;
    switch (J.pipesCount) {
      case 0:
        J.pipes = b;
        break;
      case 1:
        J.pipes = [J.pipes, b];
        break;
      default:
        J.pipes.push(b);
        break;
    }
    J.pipesCount += 1, c("pipe count=%d opts=%j", J.pipesCount, x);
    var Se = (!x || x.end !== false) && b !== t.stdout && b !== t.stderr, me = Se ? At : u;
    J.endEmitted ? t.nextTick(me) : F.once("end", me), b.on("unpipe", U);
    function U(d, _) {
      c("onunpipe"), d === F && _ && _.hasUnpiped === false && (_.hasUnpiped = true, vr());
    }
    function At() {
      c("onend"), b.end();
    }
    var jt = N(F);
    b.on("drain", jt);
    var _t = false;
    function vr() {
      c("cleanup"), b.removeListener("close", _r), b.removeListener("finish", h), b.removeListener("drain", jt), b.removeListener("error", Pt), b.removeListener("unpipe", U), F.removeListener("end", At), F.removeListener("end", u), F.removeListener("data", fi), _t = true, J.awaitDrain && (!b._writableState || b._writableState.needDrain) && jt();
    }
    F.on("data", fi);
    function fi(d) {
      c("ondata");
      var _ = b.write(d);
      c("dest.write", _), _ === false && ((J.pipesCount === 1 && J.pipes === b || J.pipesCount > 1 && te(J.pipes, b) !== -1) && !_t && (c("false write response, pause", J.awaitDrain), J.awaitDrain++), F.pause());
    }
    function Pt(d) {
      c("onerror", d), u(), b.removeListener("error", Pt), n(b, "error") === 0 && Q(b, d);
    }
    ce(b, "error", Pt);
    function _r() {
      b.removeListener("finish", h), u();
    }
    b.once("close", _r);
    function h() {
      c("onfinish"), b.removeListener("close", _r), u();
    }
    b.once("finish", h);
    function u() {
      c("unpipe"), F.unpipe(b);
    }
    return b.emit("pipe", F), J.flowing || (c("pipe resume"), F.resume()), b;
  };
  function N(b) {
    return function() {
      var F = b._readableState;
      c("pipeOnDrain", F.awaitDrain), F.awaitDrain && F.awaitDrain--, F.awaitDrain === 0 && n(b, "data") && (F.flowing = true, R(b));
    };
  }
  ee.prototype.unpipe = function(b) {
    var x = this._readableState, F = { hasUnpiped: false };
    if (x.pipesCount === 0)
      return this;
    if (x.pipesCount === 1)
      return b && b !== x.pipes ? this : (b || (b = x.pipes), x.pipes = null, x.pipesCount = 0, x.flowing = false, b && b.emit("unpipe", this, F), this);
    if (!b) {
      var { pipes: J, pipesCount: Se } = x;
      x.pipes = null, x.pipesCount = 0, x.flowing = false;
      for (var me = 0;me < Se; me++)
        J[me].emit("unpipe", this, { hasUnpiped: false });
      return this;
    }
    var U = te(x.pipes, b);
    return U === -1 ? this : (x.pipes.splice(U, 1), x.pipesCount -= 1, x.pipesCount === 1 && (x.pipes = x.pipes[0]), b.emit("unpipe", this, F), this);
  }, ee.prototype.on = function(b, x) {
    var F = r.prototype.on.call(this, b, x), J = this._readableState;
    return b === "data" ? (J.readableListening = this.listenerCount("readable") > 0, J.flowing !== false && this.resume()) : b === "readable" && !J.endEmitted && !J.readableListening && (J.readableListening = J.needReadable = true, J.flowing = false, J.emittedReadable = false, c("on readable", J.length, J.reading), J.length ? ve(this) : J.reading || t.nextTick(W, this)), F;
  }, ee.prototype.addListener = ee.prototype.on, ee.prototype.removeListener = function(b, x) {
    var F = r.prototype.removeListener.call(this, b, x);
    return b === "readable" && t.nextTick(Z, this), F;
  }, ee.prototype.removeAllListeners = function(b) {
    var x = r.prototype.removeAllListeners.apply(this, arguments);
    return (b === "readable" || b === undefined) && t.nextTick(Z, this), x;
  };
  function Z(b) {
    var x = b._readableState;
    x.readableListening = b.listenerCount("readable") > 0, x.resumeScheduled && !x.paused ? x.flowing = true : b.listenerCount("data") > 0 && b.resume();
  }
  function W(b) {
    c("readable nexttick read 0"), b.read(0);
  }
  ee.prototype.resume = function() {
    var b = this._readableState;
    return b.flowing || (c("resume"), b.flowing = !b.readableListening, le(this, b)), b.paused = false, this;
  };
  function le(b, x) {
    x.resumeScheduled || (x.resumeScheduled = true, t.nextTick(ge, b, x));
  }
  function ge(b, x) {
    c("resume", x.reading), x.reading || b.read(0), x.resumeScheduled = false, b.emit("resume"), R(b), x.flowing && !x.reading && b.read(0);
  }
  ee.prototype.pause = function() {
    return c("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== false && (c("pause"), this._readableState.flowing = false, this.emit("pause")), this._readableState.paused = true, this;
  };
  function R(b) {
    var x = b._readableState;
    for (c("flow", x.flowing);x.flowing && b.read() !== null; )
      ;
  }
  ee.prototype.wrap = function(b) {
    var x = this, F = this._readableState, J = false;
    b.on("end", function() {
      if (c("wrapped end"), F.decoder && !F.ended) {
        var U = F.decoder.end();
        U && U.length && x.push(U);
      }
      x.push(null);
    }), b.on("data", function(U) {
      if (c("wrapped data"), F.decoder && (U = F.decoder.write(U)), !(F.objectMode && U == null) && !(!F.objectMode && (!U || !U.length))) {
        var At = x.push(U);
        At || (J = true, b.pause());
      }
    });
    for (var Se in b)
      this[Se] === undefined && typeof b[Se] == "function" && (this[Se] = function(At) {
        return function() {
          return b[At].apply(b, arguments);
        };
      }(Se));
    for (var me = 0;me < Y.length; me++)
      b.on(Y[me], this.emit.bind(this, Y[me]));
    return this._read = function(U) {
      c("wrapped _read", U), J && (J = false, b.resume());
    }, this;
  }, typeof Symbol == "function" && (ee.prototype[Symbol.asyncIterator] = function() {
    return D === undefined && (D = AS()), D(this);
  }), Object.defineProperty(ee.prototype, "readableHighWaterMark", { enumerable: false, get: function() {
    return this._readableState.highWaterMark;
  } }), Object.defineProperty(ee.prototype, "readableBuffer", { enumerable: false, get: function() {
    return this._readableState && this._readableState.buffer;
  } }), Object.defineProperty(ee.prototype, "readableFlowing", { enumerable: false, get: function() {
    return this._readableState.flowing;
  }, set: function(x) {
    this._readableState && (this._readableState.flowing = x);
  } }), ee._fromList = C, Object.defineProperty(ee.prototype, "readableLength", { enumerable: false, get: function() {
    return this._readableState.length;
  } });
  function C(b, x) {
    if (x.length === 0)
      return null;
    var F;
    return x.objectMode ? F = x.buffer.shift() : !b || b >= x.length ? (x.decoder ? F = x.buffer.join("") : x.buffer.length === 1 ? F = x.buffer.first() : F = x.buffer.concat(x.length), x.buffer.clear()) : F = x.buffer.consume(b, x.decoder), F;
  }
  function j(b) {
    var x = b._readableState;
    c("endReadable", x.endEmitted), x.endEmitted || (x.ended = true, t.nextTick(V, x, b));
  }
  function V(b, x) {
    if (c("endReadableNT", b.endEmitted, b.length), !b.endEmitted && b.length === 0 && (b.endEmitted = true, x.readable = false, x.emit("end"), b.autoDestroy)) {
      var F = x._writableState;
      (!F || F.autoDestroy && F.finished) && x.destroy();
    }
  }
  typeof Symbol == "function" && (ee.from = function(b, x) {
    return $ === undefined && ($ = CS()), $(ee, b, x);
  });
  function te(b, x) {
    for (var F = 0, J = b.length;F < J; F++)
      if (b[F] === x)
        return F;
    return -1;
  }
  return Na;
}
function Hh() {
  if (wh)
    return Da;
  wh = true, Da = a;
  var t = hr().codes, e = t.ERR_METHOD_NOT_IMPLEMENTED, n = t.ERR_MULTIPLE_CALLBACK, r = t.ERR_TRANSFORM_ALREADY_TRANSFORMING, o = t.ERR_TRANSFORM_WITH_LENGTH_0, s = yr();
  Wt()(a, s);
  function i(f, g) {
    var p = this._transformState;
    p.transforming = false;
    var y = p.writecb;
    if (y === null)
      return this.emit("error", new n);
    p.writechunk = null, p.writecb = null, g != null && this.push(g), y(f);
    var T = this._readableState;
    T.reading = false, (T.needReadable || T.length < T.highWaterMark) && this._read(T.highWaterMark);
  }
  function a(f) {
    if (!(this instanceof a))
      return new a(f);
    s.call(this, f), this._transformState = { afterTransform: i.bind(this), needTransform: false, transforming: false, writecb: null, writechunk: null, writeencoding: null }, this._readableState.needReadable = true, this._readableState.sync = false, f && (typeof f.transform == "function" && (this._transform = f.transform), typeof f.flush == "function" && (this._flush = f.flush)), this.on("prefinish", l);
  }
  function l() {
    var f = this;
    typeof this._flush == "function" && !this._readableState.destroyed ? this._flush(function(g, p) {
      c(f, g, p);
    }) : c(this, null, null);
  }
  a.prototype.push = function(f, g) {
    return this._transformState.needTransform = false, s.prototype.push.call(this, f, g);
  }, a.prototype._transform = function(f, g, p) {
    p(new e("_transform()"));
  }, a.prototype._write = function(f, g, p) {
    var y = this._transformState;
    if (y.writecb = p, y.writechunk = f, y.writeencoding = g, !y.transforming) {
      var T = this._readableState;
      (y.needTransform || T.needReadable || T.length < T.highWaterMark) && this._read(T.highWaterMark);
    }
  }, a.prototype._read = function(f) {
    var g = this._transformState;
    g.writechunk !== null && !g.transforming ? (g.transforming = true, this._transform(g.writechunk, g.writeencoding, g.afterTransform)) : g.needTransform = true;
  }, a.prototype._destroy = function(f, g) {
    s.prototype._destroy.call(this, f, function(p) {
      g(p);
    });
  };
  function c(f, g, p) {
    if (g)
      return f.emit("error", g);
    if (p != null && f.push(p), f._writableState.length)
      throw new o;
    if (f._transformState.transforming)
      throw new r;
    return f.push(null);
  }
  return Da;
}
function OS() {
  if (xh)
    return Ha;
  xh = true, Ha = e;
  var t = Hh();
  Wt()(e, t);
  function e(n) {
    if (!(this instanceof e))
      return new e(n);
    t.call(this, n);
  }
  return e.prototype._transform = function(n, r, o) {
    o(null, n);
  }, Ha;
}
function RS() {
  if (Ph)
    return Ua;
  Ph = true;
  var t;
  function e(p) {
    var y = false;
    return function() {
      y || (y = true, p.apply(undefined, arguments));
    };
  }
  var n = hr().codes, r = n.ERR_MISSING_ARGS, o = n.ERR_STREAM_DESTROYED;
  function s(p) {
    if (p)
      throw p;
  }
  function i(p) {
    return p.setHeader && typeof p.abort == "function";
  }
  function a(p, y, T, P) {
    P = e(P);
    var B = false;
    p.on("close", function() {
      B = true;
    }), t === undefined && (t = Wa()), t(p, { readable: y, writable: T }, function(E) {
      if (E)
        return P(E);
      B = true, P();
    });
    var v = false;
    return function(E) {
      if (!B && !v) {
        if (v = true, i(p))
          return p.abort();
        if (typeof p.destroy == "function")
          return p.destroy();
        P(E || new o("pipe"));
      }
    };
  }
  function l(p) {
    p();
  }
  function c(p, y) {
    return p.pipe(y);
  }
  function f(p) {
    return !p.length || typeof p[p.length - 1] != "function" ? s : p.pop();
  }
  function g() {
    for (var p = arguments.length, y = new Array(p), T = 0;T < p; T++)
      y[T] = arguments[T];
    var P = f(y);
    if (Array.isArray(y[0]) && (y = y[0]), y.length < 2)
      throw new r("streams");
    var B, v = y.map(function(E, I) {
      var D = I < y.length - 1, $ = I > 0;
      return a(E, D, $, function(Q) {
        B || (B = Q), Q && v.forEach(l), !D && (v.forEach(l), P(B));
      });
    });
    return y.reduce(c);
  }
  return Ua = g, Ua;
}
function Uh() {
  return Bh || (Bh = true, Tt = Tt = Dh(), Tt.Stream = Tt, Tt.Readable = Tt, Tt.Writable = Nh(), Tt.Duplex = yr(), Tt.Transform = Hh(), Tt.PassThrough = OS(), Tt.finished = Wa(), Tt.pipeline = RS()), Tt;
}
function jh() {
  if (Ih)
    return _o;
  Ih = true;
  var t = $t().Buffer, e = Mt, n = Ch(), r = Wt(), o = Uh(), s = _o.readyStates = { UNSENT: 0, OPENED: 1, HEADERS_RECEIVED: 2, LOADING: 3, DONE: 4 }, i = _o.IncomingMessage = function(a, l, c, f) {
    var g = this || bo;
    if (o.Readable.call(g), g._mode = c, g.headers = {}, g.rawHeaders = [], g.trailers = {}, g.rawTrailers = [], g.on("end", function() {
      e.nextTick(function() {
        g.emit("close");
      });
    }), c === "fetch") {
      let v = function() {
        y.read().then(function(E) {
          if (!g._destroyed) {
            if (f(E.done), E.done) {
              g.push(null);
              return;
            }
            g.push(t.from(E.value)), v();
          }
        }).catch(function(E) {
          f(true), g._destroyed || g.emit("error", E);
        });
      };
      if (g._fetchResponse = l, g.url = l.url, g.statusCode = l.status, g.statusMessage = l.statusText, l.headers.forEach(function(E, I) {
        g.headers[I.toLowerCase()] = E, g.rawHeaders.push(I, E);
      }), n.writableStream) {
        var p = new WritableStream({ write: function(E) {
          return f(false), new Promise(function(I, D) {
            g._destroyed ? D() : g.push(t.from(E)) ? I() : g._resumeFetch = I;
          });
        }, close: function() {
          f(true), g._destroyed || g.push(null);
        }, abort: function(E) {
          f(true), g._destroyed || g.emit("error", E);
        } });
        try {
          l.body.pipeTo(p).catch(function(E) {
            f(true), g._destroyed || g.emit("error", E);
          });
          return;
        } catch {}
      }
      var y = l.body.getReader();
      v();
    } else {
      g._xhr = a, g._pos = 0, g.url = a.responseURL, g.statusCode = a.status, g.statusMessage = a.statusText;
      var T = a.getAllResponseHeaders().split(/\r?\n/);
      if (T.forEach(function(v) {
        var E = v.match(/^([^:]+):\s*(.*)/);
        if (E) {
          var I = E[1].toLowerCase();
          I === "set-cookie" ? (g.headers[I] === undefined && (g.headers[I] = []), g.headers[I].push(E[2])) : g.headers[I] !== undefined ? g.headers[I] += ", " + E[2] : g.headers[I] = E[2], g.rawHeaders.push(E[1], E[2]);
        }
      }), g._charset = "x-user-defined", !n.overrideMimeType) {
        var P = g.rawHeaders["mime-type"];
        if (P) {
          var B = P.match(/;\s*charset=([^;])(;|$)/);
          B && (g._charset = B[1].toLowerCase());
        }
        g._charset || (g._charset = "utf-8");
      }
    }
  };
  return r(i, o.Readable), i.prototype._read = function() {
    var a = this || bo, l = a._resumeFetch;
    l && (a._resumeFetch = null, l());
  }, i.prototype._onXHRProgress = function(a) {
    var l = this || bo, c = l._xhr, f = null;
    switch (l._mode) {
      case "text":
        if (f = c.responseText, f.length > l._pos) {
          var g = f.substr(l._pos);
          if (l._charset === "x-user-defined") {
            for (var p = t.alloc(g.length), y = 0;y < g.length; y++)
              p[y] = g.charCodeAt(y) & 255;
            l.push(p);
          } else
            l.push(g, l._charset);
          l._pos = f.length;
        }
        break;
      case "arraybuffer":
        if (c.readyState !== s.DONE || !c.response)
          break;
        f = c.response, l.push(t.from(new Uint8Array(f)));
        break;
      case "moz-chunked-arraybuffer":
        if (f = c.response, c.readyState !== s.LOADING || !f)
          break;
        l.push(t.from(new Uint8Array(f)));
        break;
      case "ms-stream":
        if (f = c.response, c.readyState !== s.LOADING)
          break;
        var T = new bo.MSStreamReader;
        T.onprogress = function() {
          T.result.byteLength > l._pos && (l.push(t.from(new Uint8Array(T.result.slice(l._pos)))), l._pos = T.result.byteLength);
        }, T.onload = function() {
          a(true), l.push(null);
        }, T.readAsArrayBuffer(f);
        break;
    }
    l._xhr.readyState === s.DONE && l._mode !== "ms-stream" && (a(true), l.push(null));
  }, _o;
}
function MS() {
  if (Eh)
    return ja;
  Eh = true;
  var t = $t().Buffer, e = Mt, n = Ch(), r = Wt(), o = jh(), s = Uh(), i = o.IncomingMessage, a = o.readyStates;
  function l(p, y) {
    return n.fetch && y ? "fetch" : n.mozchunkedarraybuffer ? "moz-chunked-arraybuffer" : n.msstream ? "ms-stream" : n.arraybuffer && p ? "arraybuffer" : "text";
  }
  var c = ja = function(p) {
    var y = this || it;
    s.Writable.call(y), y._opts = p, y._body = [], y._headers = {}, p.auth && y.setHeader("Authorization", "Basic " + t.from(p.auth).toString("base64")), Object.keys(p.headers).forEach(function(B) {
      y.setHeader(B, p.headers[B]);
    });
    var T, P = true;
    if (p.mode === "disable-fetch" || "requestTimeout" in p && !n.abortController)
      P = false, T = true;
    else if (p.mode === "prefer-streaming")
      T = false;
    else if (p.mode === "allow-wrong-content-type")
      T = !n.overrideMimeType;
    else if (!p.mode || p.mode === "default" || p.mode === "prefer-fast")
      T = true;
    else
      throw new Error("Invalid value for opts.mode");
    y._mode = l(T, P), y._fetchTimer = null, y._socketTimeout = null, y._socketTimer = null, y.on("finish", function() {
      y._onFinish();
    });
  };
  r(c, s.Writable), c.prototype.setHeader = function(p, y) {
    var T = this || it, P = p.toLowerCase();
    g.indexOf(P) === -1 && (T._headers[P] = { name: p, value: y });
  }, c.prototype.getHeader = function(p) {
    var y = (this || it)._headers[p.toLowerCase()];
    return y ? y.value : null;
  }, c.prototype.removeHeader = function(p) {
    var y = this || it;
    delete y._headers[p.toLowerCase()];
  }, c.prototype._onFinish = function() {
    var p = this || it;
    if (!p._destroyed) {
      var y = p._opts;
      "timeout" in y && y.timeout !== 0 && p.setTimeout(y.timeout);
      var T = p._headers, P = null;
      y.method !== "GET" && y.method !== "HEAD" && (P = new Blob(p._body, { type: (T["content-type"] || {}).value || "" }));
      var B = [];
      if (Object.keys(T).forEach(function(D) {
        var $ = T[D].name, Q = T[D].value;
        Array.isArray(Q) ? Q.forEach(function(Y) {
          B.push([$, Y]);
        }) : B.push([$, Q]);
      }), p._mode === "fetch") {
        var v = null;
        if (n.abortController) {
          var E = new AbortController;
          v = E.signal, p._fetchAbortController = E, "requestTimeout" in y && y.requestTimeout !== 0 && (p._fetchTimer = it.setTimeout(function() {
            p.emit("requestTimeout"), p._fetchAbortController && p._fetchAbortController.abort();
          }, y.requestTimeout));
        }
        it.fetch(p._opts.url, { method: p._opts.method, headers: B, body: P || undefined, mode: "cors", credentials: y.withCredentials ? "include" : "same-origin", signal: v }).then(function(D) {
          p._fetchResponse = D, p._resetTimers(false), p._connect();
        }, function(D) {
          p._resetTimers(true), p._destroyed || p.emit("error", D);
        });
      } else {
        var I = p._xhr = new it.XMLHttpRequest;
        try {
          I.open(p._opts.method, p._opts.url, true);
        } catch (D) {
          e.nextTick(function() {
            p.emit("error", D);
          });
          return;
        }
        "responseType" in I && (I.responseType = p._mode), "withCredentials" in I && (I.withCredentials = !!y.withCredentials), p._mode === "text" && "overrideMimeType" in I && I.overrideMimeType("text/plain; charset=x-user-defined"), "requestTimeout" in y && (I.timeout = y.requestTimeout, I.ontimeout = function() {
          p.emit("requestTimeout");
        }), B.forEach(function(D) {
          I.setRequestHeader(D[0], D[1]);
        }), p._response = null, I.onreadystatechange = function() {
          switch (I.readyState) {
            case a.LOADING:
            case a.DONE:
              p._onXHRProgress();
              break;
          }
        }, p._mode === "moz-chunked-arraybuffer" && (I.onprogress = function() {
          p._onXHRProgress();
        }), I.onerror = function() {
          p._destroyed || (p._resetTimers(true), p.emit("error", new Error("XHR error")));
        };
        try {
          I.send(P);
        } catch (D) {
          e.nextTick(function() {
            p.emit("error", D);
          });
          return;
        }
      }
    }
  };
  function f(p) {
    try {
      var y = p.status;
      return y !== null && y !== 0;
    } catch {
      return false;
    }
  }
  c.prototype._onXHRProgress = function() {
    var p = this || it;
    p._resetTimers(false), !(!f(p._xhr) || p._destroyed) && (p._response || p._connect(), p._response._onXHRProgress(p._resetTimers.bind(p)));
  }, c.prototype._connect = function() {
    var p = this || it;
    p._destroyed || (p._response = new i(p._xhr, p._fetchResponse, p._mode, p._resetTimers.bind(p)), p._response.on("error", function(y) {
      p.emit("error", y);
    }), p.emit("response", p._response));
  }, c.prototype._write = function(p, y, T) {
    var P = this || it;
    P._body.push(p), T();
  }, c.prototype._resetTimers = function(p) {
    var y = this || it;
    it.clearTimeout(y._socketTimer), y._socketTimer = null, p ? (it.clearTimeout(y._fetchTimer), y._fetchTimer = null) : y._socketTimeout && (y._socketTimer = it.setTimeout(function() {
      y.emit("timeout");
    }, y._socketTimeout));
  }, c.prototype.abort = c.prototype.destroy = function(p) {
    var y = this || it;
    y._destroyed = true, y._resetTimers(true), y._response && (y._response._destroyed = true), y._xhr ? y._xhr.abort() : y._fetchAbortController && y._fetchAbortController.abort(), p && y.emit("error", p);
  }, c.prototype.end = function(p, y, T) {
    var P = this || it;
    typeof p == "function" && (T = p, p = undefined), s.Writable.prototype.end.call(P, p, y, T);
  }, c.prototype.setTimeout = function(p, y) {
    var T = this || it;
    y && T.once("timeout", y), T._socketTimeout = p, T._resetTimers(false);
  }, c.prototype.flushHeaders = function() {}, c.prototype.setNoDelay = function() {}, c.prototype.setSocketKeepAlive = function() {};
  var g = ["accept-charset", "accept-encoding", "access-control-request-headers", "access-control-request-method", "connection", "content-length", "cookie", "cookie2", "date", "dnt", "expect", "host", "keep-alive", "origin", "referer", "te", "trailer", "transfer-encoding", "upgrade", "via"];
  return ja;
}
function NS() {
  if (Sh)
    return $a2;
  Sh = true, $a2 = e;
  var t = Object.prototype.hasOwnProperty;
  function e() {
    for (var n = {}, r = 0;r < arguments.length; r++) {
      var o = arguments[r];
      for (var s in o)
        t.call(o, s) && (n[s] = o[s]);
    }
    return n;
  }
  return $a2;
}
function DS() {
  return kh || (kh = true, Za = { 100: "Continue", 101: "Switching Protocols", 102: "Processing", 200: "OK", 201: "Created", 202: "Accepted", 203: "Non-Authoritative Information", 204: "No Content", 205: "Reset Content", 206: "Partial Content", 207: "Multi-Status", 208: "Already Reported", 226: "IM Used", 300: "Multiple Choices", 301: "Moved Permanently", 302: "Found", 303: "See Other", 304: "Not Modified", 305: "Use Proxy", 307: "Temporary Redirect", 308: "Permanent Redirect", 400: "Bad Request", 401: "Unauthorized", 402: "Payment Required", 403: "Forbidden", 404: "Not Found", 405: "Method Not Allowed", 406: "Not Acceptable", 407: "Proxy Authentication Required", 408: "Request Timeout", 409: "Conflict", 410: "Gone", 411: "Length Required", 412: "Precondition Failed", 413: "Payload Too Large", 414: "URI Too Long", 415: "Unsupported Media Type", 416: "Range Not Satisfiable", 417: "Expectation Failed", 418: "I'm a teapot", 421: "Misdirected Request", 422: "Unprocessable Entity", 423: "Locked", 424: "Failed Dependency", 425: "Unordered Collection", 426: "Upgrade Required", 428: "Precondition Required", 429: "Too Many Requests", 431: "Request Header Fields Too Large", 451: "Unavailable For Legal Reasons", 500: "Internal Server Error", 501: "Not Implemented", 502: "Bad Gateway", 503: "Service Unavailable", 504: "Gateway Timeout", 505: "HTTP Version Not Supported", 506: "Variant Also Negotiates", 507: "Insufficient Storage", 508: "Loop Detected", 509: "Bandwidth Limit Exceeded", 510: "Not Extended", 511: "Network Authentication Required" }), Za;
}
function US() {
  if (Ah)
    return La;
  Ah = true;
  var t = MS(), e = jh(), n = NS(), r = DS(), o = Ce, s = La;
  return s.request = function(i, a) {
    typeof i == "string" ? i = o.parse(i) : i = n(i);
    var l = HS.location.protocol.search(/^https?:$/) === -1 ? "http:" : "", c = i.protocol || l, f = i.hostname || i.host, g = i.port, p = i.path || "/";
    f && f.indexOf(":") !== -1 && (f = "[" + f + "]"), i.url = (f ? c + "//" + f : "") + (g ? ":" + g : "") + p, i.method = (i.method || "GET").toUpperCase(), i.headers = i.headers || {};
    var y = new t(i);
    return a && y.on("response", a), y;
  }, s.get = function(a, l) {
    var c = s.request(a, l);
    return c.end(), c;
  }, s.ClientRequest = t, s.IncomingMessage = e.IncomingMessage, s.Agent = function() {}, s.Agent.defaultMaxSockets = 4, s.globalAgent = new s.Agent, s.STATUS_CODES = r, s.METHODS = ["CHECKOUT", "CONNECT", "COPY", "DELETE", "GET", "HEAD", "LOCK", "M-SEARCH", "MERGE", "MKACTIVITY", "MKCOL", "MOVE", "NOTIFY", "OPTIONS", "PATCH", "POST", "PROPFIND", "PROPPATCH", "PURGE", "PUT", "REPORT", "SEARCH", "SUBSCRIBE", "TRACE", "UNLOCK", "UNSUBSCRIBE"], La;
}
var xt;
var lh;
var Yn;
var Ba;
var uh;
var Ia;
var ch;
var Ea;
var dh;
var Sa;
var fh;
var ka;
var ph;
var Aa;
var gh;
var mh;
var Ca;
var yh;
var Oa;
var hh;
var Ra;
var Th;
var Ma;
var vh;
var Na;
var _h;
var bh;
var Da;
var wh;
var Ha;
var xh;
var Ua;
var Ph;
var Tt;
var Bh;
var _o;
var Ih;
var bo;
var ja;
var Eh;
var it;
var $a2;
var Sh;
var Za;
var kh;
var La;
var Ah;
var HS;
var cn;
var jS;
var $S;
var ZS;
var LS;
var WS;
var KS;
var FS;
var zS;
var Zh = ot(() => {
  S();
  A();
  k();
  Gs();
  ny();
  Vs();
  hi();
  Uy();
  To();
  da();
  Wy();
  zy();
  ah();
  ya();
  xt = {}, lh = false, Yn = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  Ba = {}, uh = false;
  Ia = {}, ch = false;
  Ea = {}, dh = false;
  Sa = {}, fh = false;
  ka = {}, ph = false;
  Aa = {}, gh = false, mh = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  Ca = {}, yh = false;
  Oa = {}, hh = false;
  Ra = {}, Th = false;
  Ma = {}, vh = false;
  Na = {}, _h = false, bh = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  Da = {}, wh = false;
  Ha = {}, xh = false;
  Ua = {}, Ph = false;
  Tt = {}, Bh = false;
  _o = {}, Ih = false, bo = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  ja = {}, Eh = false, it = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  $a2 = {}, Sh = false;
  Za = {}, kh = false;
  La = {}, Ah = false, HS = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
  cn = US(), jS = cn.Agent, $S = cn.ClientRequest, ZS = cn.IncomingMessage, LS = cn.METHODS, WS = cn.STATUS_CODES, KS = cn.get, FS = cn.globalAgent, zS = cn.request;
});
S();
A();
k();
var Wm = {};
pn(Wm, { defaults: () => zB, markdown: () => KB, markdownBloc: () => FB });
S();
A();
k();
S();
A();
k();
S();
A();
k();
var as = Object.defineProperty;
var tv = Object.defineProperties;
var nv = Object.getOwnPropertyDescriptors;
var ki = Object.getOwnPropertySymbols;
var Kc = Object.prototype.hasOwnProperty;
var Fc = Object.prototype.propertyIsEnumerable;
var lc = (t, e, n) => (e in t) ? as(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
var w = (t, e) => {
  for (var n in e || (e = {}))
    Kc.call(e, n) && lc(t, n, e[n]);
  if (ki)
    for (var n of ki(e))
      Fc.call(e, n) && lc(t, n, e[n]);
  return t;
};
var M = (t, e) => tv(t, nv(e));
var m = (t, e) => as(t, "name", { value: e, configurable: true });
var zc = (t, e) => {
  var n = {};
  for (var r in t)
    Kc.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
  if (t != null && ki)
    for (var r of ki(t))
      e.indexOf(r) < 0 && Fc.call(t, r) && (n[r] = t[r]);
  return n;
};
var Rt = (t, e) => {
  for (var n in e)
    as(t, n, { get: e[n], enumerable: true });
};
var ne = {};
Rt(ne, { DIRTY: () => $s, ERR: () => js, OK: () => Mi, any: () => Nn, array: () => On, bigint: () => Fi, boolean: () => Kn, branded: () => Us, catch: () => Ds, coerce: () => Ag, custom: () => Wi, date: () => zi, default: () => Ns, discriminatedUnion: () => Fr, downstream: () => Cs, enum: () => Gi, function: () => Ss, instanceof: () => vs, intersection: () => Vi, is: () => tt, lazy: () => Is, literal: () => Kr, map: () => Bs, nan: () => ws, nativeEnum: () => xs, never: () => Wr, null: () => Vr, nullable: () => Rs, number: () => Wn, object: () => sr, optional: () => Os, pipeline: () => Hs, preprocess: () => ks, promise: () => Es, readonly: () => Ms, record: () => zr, ref: () => qi, set: () => Ji, strictObject: () => Ps, string: () => en, symbol: () => bs, transforms: () => qc, tuple: () => Jr, undefined: () => Ki, union: () => Rn, unknown: () => hn, upstream: () => As, void: () => _s, zuiKey: () => ke });
var qc = {};
Rt(qc, { errors: () => Cg, fromJSONSchema: () => Xg, fromJSONSchemaLegacy: () => CP, fromObject: () => is, json: () => ZB, toJSONSchema: () => et, toJSONSchemaLegacy: () => aB, toTypescriptSchema: () => zs, toTypescriptType: () => Fs });
var tn = {};
Rt(tn, { DIRTY: () => $s, ERR: () => js, OK: () => Mi, any: () => Nn, array: () => On, bigint: () => Fi, boolean: () => Kn, branded: () => Us, catch: () => Ds, coerce: () => Ag, custom: () => Wi, date: () => zi, default: () => Ns, discriminatedUnion: () => Fr, downstream: () => Cs, enum: () => Gi, function: () => Ss, instanceof: () => vs, intersection: () => Vi, is: () => tt, lazy: () => Is, literal: () => Kr, map: () => Bs, nan: () => ws, nativeEnum: () => xs, never: () => Wr, null: () => Vr, nullable: () => Rs, number: () => Wn, object: () => sr, optional: () => Os, pipeline: () => Hs, preprocess: () => ks, promise: () => Es, readonly: () => Ms, record: () => zr, ref: () => qi, set: () => Ji, strictObject: () => Ps, string: () => en, symbol: () => bs, tuple: () => Jr, undefined: () => Ki, union: () => Rn, unknown: () => hn, upstream: () => As, void: () => _s, zuiKey: () => ke });
var ke = "x-zui";
var Je = {};
Rt(Je, { CustomSet: () => ux });
var Lt = {};
Rt(Lt, { isEqual: () => gp, unique: () => ax });
var rv = typeof global == "object" && global && global.Object === Object && global;
var Gc = rv;
var iv = typeof self == "object" && self && self.Object === Object && self;
var ov = Gc || iv || Function("return this")();
var nn = ov;
var sv = nn.Symbol;
var yn = sv;
var Vc = Object.prototype;
var av = Vc.hasOwnProperty;
var lv = Vc.toString;
var wr = yn ? yn.toStringTag : undefined;
function Jc(t) {
  var e = av.call(t, wr), n = t[wr];
  try {
    t[wr] = undefined;
    var r = true;
  } catch {}
  var o = lv.call(t);
  return r && (e ? t[wr] = n : delete t[wr]), o;
}
m(Jc, "getRawTag");
var uv = Jc;
var cv = Object.prototype;
var dv = cv.toString;
function Yc(t) {
  return dv.call(t);
}
m(Yc, "objectToString");
var fv = Yc;
var pv = "[object Null]";
var gv = "[object Undefined]";
var uc = yn ? yn.toStringTag : undefined;
function Xc(t) {
  return t == null ? t === undefined ? gv : pv : uc && (uc in Object(t)) ? uv(t) : fv(t);
}
m(Xc, "baseGetTag");
var Dn = Xc;
function Qc(t) {
  return t != null && typeof t == "object";
}
m(Qc, "isObjectLike");
var Mn = Qc;
var mv = "[object Symbol]";
function ed(t) {
  return typeof t == "symbol" || Mn(t) && Dn(t) == mv;
}
m(ed, "isSymbol");
var ls = ed;
function td(t, e) {
  for (var n = -1, r = t == null ? 0 : t.length, o = Array(r);++n < r; )
    o[n] = e(t[n], n, t);
  return o;
}
m(td, "arrayMap");
var nd = td;
var yv = Array.isArray;
var Qt = yv;
var hv = 1 / 0;
var cc = yn ? yn.prototype : undefined;
var dc = cc ? cc.toString : undefined;
function us(t) {
  if (typeof t == "string")
    return t;
  if (Qt(t))
    return nd(t, us) + "";
  if (ls(t))
    return dc ? dc.call(t) : "";
  var e = t + "";
  return e == "0" && 1 / t == -hv ? "-0" : e;
}
m(us, "baseToString");
var Tv = us;
function rd(t) {
  var e = typeof t;
  return t != null && (e == "object" || e == "function");
}
m(rd, "isObject");
var or = rd;
function id(t) {
  return t;
}
m(id, "identity");
var vv = id;
var _v = "[object AsyncFunction]";
var bv = "[object Function]";
var wv = "[object GeneratorFunction]";
var xv = "[object Proxy]";
function od(t) {
  if (!or(t))
    return false;
  var e = Dn(t);
  return e == bv || e == wv || e == _v || e == xv;
}
m(od, "isFunction");
var sd = od;
var Pv = nn["__core-js_shared__"];
var Do = Pv;
var fc = function() {
  var t = /[^.]+$/.exec(Do && Do.keys && Do.keys.IE_PROTO || "");
  return t ? "Symbol(src)_1." + t : "";
}();
function ad(t) {
  return !!fc && fc in t;
}
m(ad, "isMasked");
var Bv = ad;
var Iv = Function.prototype;
var Ev = Iv.toString;
function ld(t) {
  if (t != null) {
    try {
      return Ev.call(t);
    } catch {}
    try {
      return t + "";
    } catch {}
  }
  return "";
}
m(ld, "toSource");
var Hn = ld;
var Sv = /[\\^$.*+?()[\]{}|]/g;
var kv = /^\[object .+?Constructor\]$/;
var Av = Function.prototype;
var Cv = Object.prototype;
var Ov = Av.toString;
var Rv = Cv.hasOwnProperty;
var Mv = RegExp("^" + Ov.call(Rv).replace(Sv, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
function ud(t) {
  if (!or(t) || Bv(t))
    return false;
  var e = sd(t) ? Mv : kv;
  return e.test(Hn(t));
}
m(ud, "baseIsNative");
var Nv = ud;
function cd(t, e) {
  return t?.[e];
}
m(cd, "getValue");
var Dv = cd;
function dd(t, e) {
  var n = Dv(t, e);
  return Nv(n) ? n : undefined;
}
m(dd, "getNative");
var Un = dd;
var Hv = Un(nn, "WeakMap");
var Go = Hv;
var Uv = function() {
  try {
    var t = Un(Object, "defineProperty");
    return t({}, "", {}), t;
  } catch {}
}();
var pc = Uv;
var jv = 9007199254740991;
var $v = /^(?:0|[1-9]\d*)$/;
function fd(t, e) {
  var n = typeof t;
  return e = e ?? jv, !!e && (n == "number" || n != "symbol" && $v.test(t)) && t > -1 && t % 1 == 0 && t < e;
}
m(fd, "isIndex");
var cs = fd;
function pd(t, e, n) {
  e == "__proto__" && pc ? pc(t, e, { configurable: true, enumerable: true, value: n, writable: true }) : t[e] = n;
}
m(pd, "baseAssignValue");
var gd = pd;
function md(t, e) {
  return t === e || t !== t && e !== e;
}
m(md, "eq");
var ds = md;
var Zv = Object.prototype;
var Lv = Zv.hasOwnProperty;
function yd(t, e, n) {
  var r = t[e];
  (!(Lv.call(t, e) && ds(r, n)) || n === undefined && !(e in t)) && gd(t, e, n);
}
m(yd, "assignValue");
var Wv = yd;
var Kv = 9007199254740991;
function hd(t) {
  return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Kv;
}
m(hd, "isLength");
var fs = hd;
function Td(t) {
  return t != null && fs(t.length) && !sd(t);
}
m(Td, "isArrayLike");
var vd = Td;
var Fv = Object.prototype;
function _d(t) {
  var e = t && t.constructor, n = typeof e == "function" && e.prototype || Fv;
  return t === n;
}
m(_d, "isPrototype");
var bd = _d;
function wd(t, e) {
  for (var n = -1, r = Array(t);++n < t; )
    r[n] = e(n);
  return r;
}
m(wd, "baseTimes");
var zv = wd;
var qv = "[object Arguments]";
function xd(t) {
  return Mn(t) && Dn(t) == qv;
}
m(xd, "baseIsArguments");
var gc = xd;
var Pd = Object.prototype;
var Gv = Pd.hasOwnProperty;
var Vv = Pd.propertyIsEnumerable;
var Jv = gc(function() {
  return arguments;
}()) ? gc : function(t) {
  return Mn(t) && Gv.call(t, "callee") && !Vv.call(t, "callee");
};
var Bd = Jv;
function Id() {
  return false;
}
m(Id, "stubFalse");
var Yv = Id;
var Ed = typeof exports_dist == "object" && exports_dist && !exports_dist.nodeType && exports_dist;
var mc = Ed && typeof module_dist == "object" && module_dist && !module_dist.nodeType && module_dist;
var Xv = mc && mc.exports === Ed;
var yc = Xv ? nn.Buffer : undefined;
var Qv = yc ? yc.isBuffer : undefined;
var e_ = Qv || Yv;
var Vo = e_;
var t_ = "[object Arguments]";
var n_ = "[object Array]";
var r_ = "[object Boolean]";
var i_ = "[object Date]";
var o_ = "[object Error]";
var s_ = "[object Function]";
var a_ = "[object Map]";
var l_ = "[object Number]";
var u_ = "[object Object]";
var c_ = "[object RegExp]";
var d_ = "[object Set]";
var f_ = "[object String]";
var p_ = "[object WeakMap]";
var g_ = "[object ArrayBuffer]";
var m_ = "[object DataView]";
var y_ = "[object Float32Array]";
var h_ = "[object Float64Array]";
var T_ = "[object Int8Array]";
var v_ = "[object Int16Array]";
var __ = "[object Int32Array]";
var b_ = "[object Uint8Array]";
var w_ = "[object Uint8ClampedArray]";
var x_ = "[object Uint16Array]";
var P_ = "[object Uint32Array]";
var Me = {};
Me[y_] = Me[h_] = Me[T_] = Me[v_] = Me[__] = Me[b_] = Me[w_] = Me[x_] = Me[P_] = true;
Me[t_] = Me[n_] = Me[g_] = Me[r_] = Me[m_] = Me[i_] = Me[o_] = Me[s_] = Me[a_] = Me[l_] = Me[u_] = Me[c_] = Me[d_] = Me[f_] = Me[p_] = false;
function Sd(t) {
  return Mn(t) && fs(t.length) && !!Me[Dn(t)];
}
m(Sd, "baseIsTypedArray");
var B_ = Sd;
function kd(t) {
  return function(e) {
    return t(e);
  };
}
m(kd, "baseUnary");
var I_ = kd;
var Ad = typeof exports_dist == "object" && exports_dist && !exports_dist.nodeType && exports_dist;
var Hr = Ad && typeof module_dist == "object" && module_dist && !module_dist.nodeType && module_dist;
var E_ = Hr && Hr.exports === Ad;
var Ho = E_ && Gc.process;
var S_ = function() {
  try {
    var t = Hr && Hr.require && Hr.require("util").types;
    return t || Ho && Ho.binding && Ho.binding("util");
  } catch {}
}();
var hc = S_;
var Tc = hc && hc.isTypedArray;
var k_ = Tc ? I_(Tc) : B_;
var Cd = k_;
var A_ = Object.prototype;
var C_ = A_.hasOwnProperty;
function Od(t, e) {
  var n = Qt(t), r = !n && Bd(t), o = !n && !r && Vo(t), s = !n && !r && !o && Cd(t), i = n || r || o || s, a = i ? zv(t.length, String) : [], l = a.length;
  for (var c in t)
    (e || C_.call(t, c)) && !(i && (c == "length" || o && (c == "offset" || c == "parent") || s && (c == "buffer" || c == "byteLength" || c == "byteOffset") || cs(c, l))) && a.push(c);
  return a;
}
m(Od, "arrayLikeKeys");
var Rd = Od;
function Md(t, e) {
  return function(n) {
    return t(e(n));
  };
}
m(Md, "overArg");
var Nd = Md;
var O_ = Nd(Object.keys, Object);
var R_ = O_;
var M_ = Object.prototype;
var N_ = M_.hasOwnProperty;
function Dd(t) {
  if (!bd(t))
    return R_(t);
  var e = [];
  for (var n in Object(t))
    N_.call(t, n) && n != "constructor" && e.push(n);
  return e;
}
m(Dd, "baseKeys");
var D_ = Dd;
function Hd(t) {
  return vd(t) ? Rd(t) : D_(t);
}
m(Hd, "keys");
var ps2 = Hd;
function Ud(t) {
  var e = [];
  if (t != null)
    for (var n in Object(t))
      e.push(n);
  return e;
}
m(Ud, "nativeKeysIn");
var H_ = Ud;
var U_ = Object.prototype;
var j_ = U_.hasOwnProperty;
function jd(t) {
  if (!or(t))
    return H_(t);
  var e = bd(t), n = [];
  for (var r in t)
    r == "constructor" && (e || !j_.call(t, r)) || n.push(r);
  return n;
}
m(jd, "baseKeysIn");
var $_ = jd;
function $d(t) {
  return vd(t) ? Rd(t, true) : $_(t);
}
m($d, "keysIn");
var Z_ = $d;
var L_ = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var W_ = /^\w*$/;
function Zd(t, e) {
  if (Qt(t))
    return false;
  var n = typeof t;
  return n == "number" || n == "symbol" || n == "boolean" || t == null || ls(t) ? true : W_.test(t) || !L_.test(t) || e != null && (t in Object(e));
}
m(Zd, "isKey");
var gs = Zd;
var K_ = Un(Object, "create");
var $r = K_;
function Ld() {
  this.__data__ = $r ? $r(null) : {}, this.size = 0;
}
m(Ld, "hashClear");
var F_ = Ld;
function Wd(t) {
  var e = this.has(t) && delete this.__data__[t];
  return this.size -= e ? 1 : 0, e;
}
m(Wd, "hashDelete");
var z_ = Wd;
var q_ = "__lodash_hash_undefined__";
var G_ = Object.prototype;
var V_ = G_.hasOwnProperty;
function Kd(t) {
  var e = this.__data__;
  if ($r) {
    var n = e[t];
    return n === q_ ? undefined : n;
  }
  return V_.call(e, t) ? e[t] : undefined;
}
m(Kd, "hashGet");
var J_ = Kd;
var Y_ = Object.prototype;
var X_ = Y_.hasOwnProperty;
function Fd(t) {
  var e = this.__data__;
  return $r ? e[t] !== undefined : X_.call(e, t);
}
m(Fd, "hashHas");
var Q_ = Fd;
var eb = "__lodash_hash_undefined__";
function zd(t, e) {
  var n = this.__data__;
  return this.size += this.has(t) ? 0 : 1, n[t] = $r && e === undefined ? eb : e, this;
}
m(zd, "hashSet");
var tb = zd;
function jn(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.clear();++e < n; ) {
    var r = t[e];
    this.set(r[0], r[1]);
  }
}
m(jn, "Hash");
jn.prototype.clear = F_;
jn.prototype.delete = z_;
jn.prototype.get = J_;
jn.prototype.has = Q_;
jn.prototype.set = tb;
var vc = jn;
function qd() {
  this.__data__ = [], this.size = 0;
}
m(qd, "listCacheClear");
var nb = qd;
function Gd(t, e) {
  for (var n = t.length;n--; )
    if (ds(t[n][0], e))
      return n;
  return -1;
}
m(Gd, "assocIndexOf");
var Di = Gd;
var rb = Array.prototype;
var ib = rb.splice;
function Vd(t) {
  var e = this.__data__, n = Di(e, t);
  if (n < 0)
    return false;
  var r = e.length - 1;
  return n == r ? e.pop() : ib.call(e, n, 1), --this.size, true;
}
m(Vd, "listCacheDelete");
var ob = Vd;
function Jd(t) {
  var e = this.__data__, n = Di(e, t);
  return n < 0 ? undefined : e[n][1];
}
m(Jd, "listCacheGet");
var sb = Jd;
function Yd(t) {
  return Di(this.__data__, t) > -1;
}
m(Yd, "listCacheHas");
var ab = Yd;
function Xd(t, e) {
  var n = this.__data__, r = Di(n, t);
  return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
}
m(Xd, "listCacheSet");
var lb = Xd;
function $n(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.clear();++e < n; ) {
    var r = t[e];
    this.set(r[0], r[1]);
  }
}
m($n, "ListCache");
$n.prototype.clear = nb;
$n.prototype.delete = ob;
$n.prototype.get = sb;
$n.prototype.has = ab;
$n.prototype.set = lb;
var Hi = $n;
var ub = Un(nn, "Map");
var Zr = ub;
function Qd() {
  this.size = 0, this.__data__ = { hash: new vc, map: new (Zr || Hi), string: new vc };
}
m(Qd, "mapCacheClear");
var cb = Qd;
function ef(t) {
  var e = typeof t;
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
}
m(ef, "isKeyable");
var db = ef;
function tf(t, e) {
  var n = t.__data__;
  return db(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
}
m(tf, "getMapData");
var Ui = tf;
function nf(t) {
  var e = Ui(this, t).delete(t);
  return this.size -= e ? 1 : 0, e;
}
m(nf, "mapCacheDelete");
var fb = nf;
function rf(t) {
  return Ui(this, t).get(t);
}
m(rf, "mapCacheGet");
var pb = rf;
function of(t) {
  return Ui(this, t).has(t);
}
m(of, "mapCacheHas");
var gb = of;
function sf(t, e) {
  var n = Ui(this, t), r = n.size;
  return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
}
m(sf, "mapCacheSet");
var mb = sf;
function Zn(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.clear();++e < n; ) {
    var r = t[e];
    this.set(r[0], r[1]);
  }
}
m(Zn, "MapCache");
Zn.prototype.clear = cb;
Zn.prototype.delete = fb;
Zn.prototype.get = pb;
Zn.prototype.has = gb;
Zn.prototype.set = mb;
var ji = Zn;
var yb = "Expected a function";
function $i(t, e) {
  if (typeof t != "function" || e != null && typeof e != "function")
    throw new TypeError(yb);
  var n = m(function() {
    var r = arguments, o = e ? e.apply(this, r) : r[0], s = n.cache;
    if (s.has(o))
      return s.get(o);
    var i = t.apply(this, r);
    return n.cache = s.set(o, i) || s, i;
  }, "memoized");
  return n.cache = new ($i.Cache || ji), n;
}
m($i, "memoize");
$i.Cache = ji;
var hb = $i;
var Tb = 500;
function af(t) {
  var e = hb(t, function(r) {
    return n.size === Tb && n.clear(), r;
  }), n = e.cache;
  return e;
}
m(af, "memoizeCapped");
var vb = af;
var _b = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var bb = /\\(\\)?/g;
var wb = vb(function(t) {
  var e = [];
  return t.charCodeAt(0) === 46 && e.push(""), t.replace(_b, function(n, r, o, s) {
    e.push(o ? s.replace(bb, "$1") : r || n);
  }), e;
});
var xb = wb;
function lf(t) {
  return t == null ? "" : Tv(t);
}
m(lf, "toString");
var Pb = lf;
function uf(t, e) {
  return Qt(t) ? t : gs(t, e) ? [t] : xb(Pb(t));
}
m(uf, "castPath");
var Zi = uf;
var Bb = 1 / 0;
function cf(t) {
  if (typeof t == "string" || ls(t))
    return t;
  var e = t + "";
  return e == "0" && 1 / t == -Bb ? "-0" : e;
}
m(cf, "toKey");
var Gr = cf;
function df(t, e) {
  e = Zi(e, t);
  for (var n = 0, r = e.length;t != null && n < r; )
    t = t[Gr(e[n++])];
  return n && n == r ? t : undefined;
}
m(df, "baseGet");
var ms = df;
function ff(t, e, n) {
  var r = t == null ? undefined : ms(t, e);
  return r === undefined ? n : r;
}
m(ff, "get");
var Ib = ff;
function pf(t, e) {
  for (var n = -1, r = e.length, o = t.length;++n < r; )
    t[o + n] = e[n];
  return t;
}
m(pf, "arrayPush");
var gf = pf;
var Eb = Nd(Object.getPrototypeOf, Object);
var mf = Eb;
var Sb = "[object Object]";
var kb = Function.prototype;
var Ab = Object.prototype;
var yf = kb.toString;
var Cb = Ab.hasOwnProperty;
var Ob = yf.call(Object);
function hf(t) {
  if (!Mn(t) || Dn(t) != Sb)
    return false;
  var e = mf(t);
  if (e === null)
    return true;
  var n = Cb.call(e, "constructor") && e.constructor;
  return typeof n == "function" && n instanceof n && yf.call(n) == Ob;
}
m(hf, "isPlainObject");
var Rb = hf;
function Tf() {
  this.__data__ = new Hi, this.size = 0;
}
m(Tf, "stackClear");
var Mb = Tf;
function vf(t) {
  var e = this.__data__, n = e.delete(t);
  return this.size = e.size, n;
}
m(vf, "stackDelete");
var Nb = vf;
function _f(t) {
  return this.__data__.get(t);
}
m(_f, "stackGet");
var Db = _f;
function bf(t) {
  return this.__data__.has(t);
}
m(bf, "stackHas");
var Hb = bf;
var Ub = 200;
function wf(t, e) {
  var n = this.__data__;
  if (n instanceof Hi) {
    var r = n.__data__;
    if (!Zr || r.length < Ub - 1)
      return r.push([t, e]), this.size = ++n.size, this;
    n = this.__data__ = new ji(r);
  }
  return n.set(t, e), this.size = n.size, this;
}
m(wf, "stackSet");
var jb = wf;
function Ln(t) {
  var e = this.__data__ = new Hi(t);
  this.size = e.size;
}
m(Ln, "Stack");
Ln.prototype.clear = Mb;
Ln.prototype.delete = Nb;
Ln.prototype.get = Db;
Ln.prototype.has = Hb;
Ln.prototype.set = jb;
var _i = Ln;
function xf(t, e) {
  for (var n = -1, r = t == null ? 0 : t.length, o = 0, s = [];++n < r; ) {
    var i = t[n];
    e(i, n, t) && (s[o++] = i);
  }
  return s;
}
m(xf, "arrayFilter");
var $b = xf;
function Pf() {
  return [];
}
m(Pf, "stubArray");
var Bf = Pf;
var Zb = Object.prototype;
var Lb = Zb.propertyIsEnumerable;
var _c = Object.getOwnPropertySymbols;
var Wb = _c ? function(t) {
  return t == null ? [] : (t = Object(t), $b(_c(t), function(e) {
    return Lb.call(t, e);
  }));
} : Bf;
var If = Wb;
var Kb = Object.getOwnPropertySymbols;
var Fb = Kb ? function(t) {
  for (var e = [];t; )
    gf(e, If(t)), t = mf(t);
  return e;
} : Bf;
var zb = Fb;
function Ef(t, e, n) {
  var r = e(t);
  return Qt(t) ? r : gf(r, n(t));
}
m(Ef, "baseGetAllKeys");
var Sf = Ef;
function kf(t) {
  return Sf(t, ps2, If);
}
m(kf, "getAllKeys");
var bc = kf;
function Af(t) {
  return Sf(t, Z_, zb);
}
m(Af, "getAllKeysIn");
var qb = Af;
var Gb = Un(nn, "DataView");
var Jo = Gb;
var Vb = Un(nn, "Promise");
var Yo = Vb;
var Jb = Un(nn, "Set");
var Xo = Jb;
var wc = "[object Map]";
var Yb = "[object Object]";
var xc = "[object Promise]";
var Pc = "[object Set]";
var Bc = "[object WeakMap]";
var Ic = "[object DataView]";
var Xb = Hn(Jo);
var Qb = Hn(Zr);
var ew = Hn(Yo);
var tw = Hn(Xo);
var nw = Hn(Go);
var En = Dn;
(Jo && En(new Jo(new ArrayBuffer(1))) != Ic || Zr && En(new Zr) != wc || Yo && En(Yo.resolve()) != xc || Xo && En(new Xo) != Pc || Go && En(new Go) != Bc) && (En = m(function(t) {
  var e = Dn(t), n = e == Yb ? t.constructor : undefined, r = n ? Hn(n) : "";
  if (r)
    switch (r) {
      case Xb:
        return Ic;
      case Qb:
        return wc;
      case ew:
        return xc;
      case tw:
        return Pc;
      case nw:
        return Bc;
    }
  return e;
}, "getTag"));
var Ec = En;
var rw = nn.Uint8Array;
var Sc = rw;
var iw = "__lodash_hash_undefined__";
function Cf(t) {
  return this.__data__.set(t, iw), this;
}
m(Cf, "setCacheAdd");
var ow = Cf;
function Of(t) {
  return this.__data__.has(t);
}
m(Of, "setCacheHas");
var sw = Of;
function Lr(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.__data__ = new ji;++e < n; )
    this.add(t[e]);
}
m(Lr, "SetCache");
Lr.prototype.add = Lr.prototype.push = ow;
Lr.prototype.has = sw;
var aw = Lr;
function Rf(t, e) {
  for (var n = -1, r = t == null ? 0 : t.length;++n < r; )
    if (e(t[n], n, t))
      return true;
  return false;
}
m(Rf, "arraySome");
var lw = Rf;
function Mf(t, e) {
  return t.has(e);
}
m(Mf, "cacheHas");
var uw = Mf;
var cw = 1;
var dw = 2;
function Nf(t, e, n, r, o, s) {
  var i = n & cw, a = t.length, l = e.length;
  if (a != l && !(i && l > a))
    return false;
  var c = s.get(t), f = s.get(e);
  if (c && f)
    return c == e && f == t;
  var g = -1, p = true, y = n & dw ? new aw : undefined;
  for (s.set(t, e), s.set(e, t);++g < a; ) {
    var T = t[g], P = e[g];
    if (r)
      var B = i ? r(P, T, g, e, t, s) : r(T, P, g, t, e, s);
    if (B !== undefined) {
      if (B)
        continue;
      p = false;
      break;
    }
    if (y) {
      if (!lw(e, function(v, E) {
        if (!uw(y, E) && (T === v || o(T, v, n, r, s)))
          return y.push(E);
      })) {
        p = false;
        break;
      }
    } else if (!(T === P || o(T, P, n, r, s))) {
      p = false;
      break;
    }
  }
  return s.delete(t), s.delete(e), p;
}
m(Nf, "equalArrays");
var Df = Nf;
function Hf(t) {
  var e = -1, n = Array(t.size);
  return t.forEach(function(r, o) {
    n[++e] = [o, r];
  }), n;
}
m(Hf, "mapToArray");
var fw = Hf;
function Uf(t) {
  var e = -1, n = Array(t.size);
  return t.forEach(function(r) {
    n[++e] = r;
  }), n;
}
m(Uf, "setToArray");
var pw = Uf;
var gw = 1;
var mw = 2;
var yw = "[object Boolean]";
var hw = "[object Date]";
var Tw = "[object Error]";
var vw = "[object Map]";
var _w = "[object Number]";
var bw = "[object RegExp]";
var ww = "[object Set]";
var xw = "[object String]";
var Pw = "[object Symbol]";
var Bw = "[object ArrayBuffer]";
var Iw = "[object DataView]";
var kc = yn ? yn.prototype : undefined;
var Uo = kc ? kc.valueOf : undefined;
function jf(t, e, n, r, o, s, i) {
  switch (n) {
    case Iw:
      if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
        return false;
      t = t.buffer, e = e.buffer;
    case Bw:
      return !(t.byteLength != e.byteLength || !s(new Sc(t), new Sc(e)));
    case yw:
    case hw:
    case _w:
      return ds(+t, +e);
    case Tw:
      return t.name == e.name && t.message == e.message;
    case bw:
    case xw:
      return t == e + "";
    case vw:
      var a = fw;
    case ww:
      var l = r & gw;
      if (a || (a = pw), t.size != e.size && !l)
        return false;
      var c = i.get(t);
      if (c)
        return c == e;
      r |= mw, i.set(t, e);
      var f = Df(a(t), a(e), r, o, s, i);
      return i.delete(t), f;
    case Pw:
      if (Uo)
        return Uo.call(t) == Uo.call(e);
  }
  return false;
}
m(jf, "equalByTag");
var Ew = jf;
var Sw = 1;
var kw = Object.prototype;
var Aw = kw.hasOwnProperty;
function $f(t, e, n, r, o, s) {
  var i = n & Sw, a = bc(t), l = a.length, c = bc(e), f = c.length;
  if (l != f && !i)
    return false;
  for (var g = l;g--; ) {
    var p = a[g];
    if (!(i ? p in e : Aw.call(e, p)))
      return false;
  }
  var y = s.get(t), T = s.get(e);
  if (y && T)
    return y == e && T == t;
  var P = true;
  s.set(t, e), s.set(e, t);
  for (var B = i;++g < l; ) {
    p = a[g];
    var v = t[p], E = e[p];
    if (r)
      var I = i ? r(E, v, p, e, t, s) : r(v, E, p, t, e, s);
    if (!(I === undefined ? v === E || o(v, E, n, r, s) : I)) {
      P = false;
      break;
    }
    B || (B = p == "constructor");
  }
  if (P && !B) {
    var D = t.constructor, $ = e.constructor;
    D != $ && "constructor" in t && "constructor" in e && !(typeof D == "function" && D instanceof D && typeof $ == "function" && $ instanceof $) && (P = false);
  }
  return s.delete(t), s.delete(e), P;
}
m($f, "equalObjects");
var Cw = $f;
var Ow = 1;
var Ac = "[object Arguments]";
var Cc = "[object Array]";
var Ti = "[object Object]";
var Rw = Object.prototype;
var Oc = Rw.hasOwnProperty;
function Zf(t, e, n, r, o, s) {
  var i = Qt(t), a = Qt(e), l = i ? Cc : Ec(t), c = a ? Cc : Ec(e);
  l = l == Ac ? Ti : l, c = c == Ac ? Ti : c;
  var f = l == Ti, g = c == Ti, p = l == c;
  if (p && Vo(t)) {
    if (!Vo(e))
      return false;
    i = true, f = false;
  }
  if (p && !f)
    return s || (s = new _i), i || Cd(t) ? Df(t, e, n, r, o, s) : Ew(t, e, l, n, r, o, s);
  if (!(n & Ow)) {
    var y = f && Oc.call(t, "__wrapped__"), T = g && Oc.call(e, "__wrapped__");
    if (y || T) {
      var P = y ? t.value() : t, B = T ? e.value() : e;
      return s || (s = new _i), o(P, B, n, r, s);
    }
  }
  return p ? (s || (s = new _i), Cw(t, e, n, r, o, s)) : false;
}
m(Zf, "baseIsEqualDeep");
var Mw = Zf;
function ys(t, e, n, r, o) {
  return t === e ? true : t == null || e == null || !Mn(t) && !Mn(e) ? t !== t && e !== e : Mw(t, e, n, r, ys, o);
}
m(ys, "baseIsEqual");
var Li = ys;
var Nw = 1;
var Dw = 2;
function Lf(t, e, n, r) {
  var o = n.length, s = o, i = !r;
  if (t == null)
    return !s;
  for (t = Object(t);o--; ) {
    var a = n[o];
    if (i && a[2] ? a[1] !== t[a[0]] : !(a[0] in t))
      return false;
  }
  for (;++o < s; ) {
    a = n[o];
    var l = a[0], c = t[l], f = a[1];
    if (i && a[2]) {
      if (c === undefined && !(l in t))
        return false;
    } else {
      var g = new _i;
      if (r)
        var p = r(c, f, l, t, e, g);
      if (!(p === undefined ? Li(f, c, Nw | Dw, r, g) : p))
        return false;
    }
  }
  return true;
}
m(Lf, "baseIsMatch");
var Hw = Lf;
function Wf(t) {
  return t === t && !or(t);
}
m(Wf, "isStrictComparable");
var Kf = Wf;
function Ff(t) {
  for (var e = ps2(t), n = e.length;n--; ) {
    var r = e[n], o = t[r];
    e[n] = [r, o, Kf(o)];
  }
  return e;
}
m(Ff, "getMatchData");
var Uw = Ff;
function zf(t, e) {
  return function(n) {
    return n == null ? false : n[t] === e && (e !== undefined || (t in Object(n)));
  };
}
m(zf, "matchesStrictComparable");
var qf = zf;
function Gf(t) {
  var e = Uw(t);
  return e.length == 1 && e[0][2] ? qf(e[0][0], e[0][1]) : function(n) {
    return n === t || Hw(n, t, e);
  };
}
m(Gf, "baseMatches");
var jw = Gf;
function Vf(t, e) {
  return t != null && e in Object(t);
}
m(Vf, "baseHasIn");
var $w = Vf;
function Jf(t, e, n) {
  e = Zi(e, t);
  for (var r = -1, o = e.length, s = false;++r < o; ) {
    var i = Gr(e[r]);
    if (!(s = t != null && n(t, i)))
      break;
    t = t[i];
  }
  return s || ++r != o ? s : (o = t == null ? 0 : t.length, !!o && fs(o) && cs(i, o) && (Qt(t) || Bd(t)));
}
m(Jf, "hasPath");
var Zw = Jf;
function Yf(t, e) {
  return t != null && Zw(t, e, $w);
}
m(Yf, "hasIn");
var Lw = Yf;
var Ww = 1;
var Kw = 2;
function Xf(t, e) {
  return gs(t) && Kf(e) ? qf(Gr(t), e) : function(n) {
    var r = Ib(n, t);
    return r === undefined && r === e ? Lw(n, t) : Li(e, r, Ww | Kw);
  };
}
m(Xf, "baseMatchesProperty");
var Fw = Xf;
function Qf(t) {
  return function(e) {
    return e?.[t];
  };
}
m(Qf, "baseProperty");
var zw = Qf;
function ep(t) {
  return function(e) {
    return ms(e, t);
  };
}
m(ep, "basePropertyDeep");
var qw = ep;
function tp(t) {
  return gs(t) ? zw(Gr(t)) : qw(t);
}
m(tp, "property");
var Gw = tp;
function np(t) {
  return typeof t == "function" ? t : t == null ? vv : typeof t == "object" ? Qt(t) ? Fw(t[0], t[1]) : jw(t) : Gw(t);
}
m(np, "baseIteratee");
var hs = np;
function rp(t) {
  return function(e, n, r) {
    for (var o = -1, s = Object(e), i = r(e), a = i.length;a--; ) {
      var l = i[t ? a : ++o];
      if (n(s[l], l, s) === false)
        break;
    }
    return e;
  };
}
m(rp, "createBaseFor");
var Vw = rp;
var Jw = Vw();
var Yw = Jw;
function ip(t, e) {
  return t && Yw(t, e, ps2);
}
m(ip, "baseForOwn");
var Xw = ip;
function op(t, e) {
  return Li(t, e);
}
m(op, "isEqual");
var mn = op;
function sp(t, e, n) {
  n = typeof n == "function" ? n : undefined;
  var r = n ? n(t, e) : undefined;
  return r === undefined ? Li(t, e, undefined, n) : !!r;
}
m(sp, "isEqualWith");
var Qw = sp;
function ap(t) {
  return t === undefined;
}
m(ap, "isUndefined");
var Rc = ap;
function lp(t, e) {
  var n = {};
  return e = hs(e, 3), Xw(t, function(r, o, s) {
    gd(n, o, e(r, o, s));
  }), n;
}
m(lp, "mapValues");
var ex = lp;
var tx = "Expected a function";
function up(t) {
  if (typeof t != "function")
    throw new TypeError(tx);
  return function() {
    var e = arguments;
    switch (e.length) {
      case 0:
        return !t.call(this);
      case 1:
        return !t.call(this, e[0]);
      case 2:
        return !t.call(this, e[0], e[1]);
      case 3:
        return !t.call(this, e[0], e[1], e[2]);
    }
    return !t.apply(this, e);
  };
}
m(up, "negate");
var nx = up;
function cp(t, e, n, r) {
  if (!or(t))
    return t;
  e = Zi(e, t);
  for (var o = -1, s = e.length, i = s - 1, a = t;a != null && ++o < s; ) {
    var l = Gr(e[o]), c = n;
    if (l === "__proto__" || l === "constructor" || l === "prototype")
      return t;
    if (o != i) {
      var f = a[l];
      c = r ? r(f, l, a) : undefined, c === undefined && (c = or(f) ? f : cs(e[o + 1]) ? [] : {});
    }
    Wv(a, l, c), a = a[l];
  }
  return t;
}
m(cp, "baseSet");
var rx = cp;
function dp(t, e, n) {
  for (var r = -1, o = e.length, s = {};++r < o; ) {
    var i = e[r], a = ms(t, i);
    n(a, i) && rx(s, Zi(i, t), a);
  }
  return s;
}
m(dp, "basePickBy");
var ix = dp;
function fp(t, e) {
  if (t == null)
    return {};
  var n = nd(qb(t), function(r) {
    return [r];
  });
  return e = hs(e), ix(t, n, function(r, o) {
    return e(r, o[0]);
  });
}
m(fp, "pickBy");
var ox = fp;
function pp(t, e) {
  return ox(t, nx(hs(e)));
}
m(pp, "omitBy");
var Mc = pp;
var gp = m((t, e) => mp(t, e, new WeakSet), "isEqual");
var Nc = m((t) => Rb(t), "_isPlainObject");
var mp = m((t, e, n) => Qw(t, e, sx(n)), "_isEqualWithVisitedTracking");
var sx = m((t) => (e, n) => {
  if (Nc(e) && !t.has(e) && Nc(n) && !t.has(n)) {
    let r = Mc(e, Rc), o = Mc(n, Rc);
    return t.add(r).add(o).add(e).add(n), mp(r, o, t);
  }
}, "_customizerWithVisitedTracking");
var ax = m((t) => Array.from(new Set(t)), "unique");
var lx = { compare: gp };
var yp = class {
  constructor(e = [], n = {}) {
    this._options = w(w({}, lx), n), this._items = [];
    for (let r of e)
      this.add(r);
  }
  get items() {
    return [...this._items];
  }
  get size() {
    return this._items.length;
  }
  has(e) {
    return this._items.some((n) => this._options.compare(n, e));
  }
  add(e) {
    this.has(e) || this._items.push(e);
  }
  isEqual(e) {
    return this.size !== e.size ? false : this.isSubsetOf(e) && e.isSubsetOf(this);
  }
  isSubsetOf(e) {
    return this.size > e.size ? false : this._items.every((n) => e.has(n));
  }
};
m(yp, "CustomSet");
var ux = yp;
var ae = {};
Rt(ae, { errToObj: () => cx, toString: () => dx });
var cx = m((t) => typeof t == "string" ? { message: t } : t || {}, "errToObj");
var dx = m((t) => typeof t == "string" ? t : t?.message, "toString");
var Ot = {};
Rt(Ot, { assertNever: () => hp });
function hp(t) {
  throw new Error("assertNever called");
}
m(hp, "assertNever");
var Ct = {};
Rt(Ct, { compareFunctions: () => px, joinValues: () => Tp, jsonStringifyReplacer: () => fx });
function Tp(t, e = " | ") {
  return t.map((n) => typeof n == "string" ? `'${n}'` : n).join(e);
}
m(Tp, "joinValues");
var fx = m((t, e) => typeof e == "bigint" ? e.toString() : e, "jsonStringifyReplacer");
var px = m((t, e) => t.toString() === e.toString(), "compareFunctions");
var vp = {};
Rt(vp, { extractPrecisionAndOffset: () => bp, generateDatetimeRegex: () => _p });
var _p = m((t) => {
  let e = t.precision ? Qo + t.precision + mx : t.precision === 0 ? "" : Pp, n = t.offset ? xp : gx;
  return new RegExp(`^${wp}${e}${n}$`);
}, "generateDatetimeRegex");
var bp = m((t) => ({ precision: yx(t), offset: t.endsWith(`${xp}$`) }), "extractPrecisionAndOffset");
var wp = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}";
var xp = "(([+-]\\d{2}(:?\\d{2})?)|Z)";
var gx = "Z";
var Pp = "(\\.\\d+)?";
var Qo = "\\.\\d{";
var mx = "}";
var yx = m((t) => {
  let e = t.slice(1 + wp.length);
  return e.startsWith(Pp) ? null : e.startsWith(Qo) ? parseInt(e.slice(Qo.length)) : 0;
}, "_extractPrecision");
var Ai = m((t, e) => {
  let n;
  switch (t.code) {
    case "invalid_type":
      t.received === "undefined" ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
      break;
    case "invalid_literal":
      n = `Invalid literal value, expected ${JSON.stringify(t.expected, Ct.jsonStringifyReplacer)}`;
      break;
    case "unrecognized_keys":
      n = `Unrecognized key(s) in object: ${Ct.joinValues(t.keys, ", ")}`;
      break;
    case "invalid_union":
      n = "Invalid input";
      break;
    case "invalid_union_discriminator":
      n = `Invalid discriminator value. Expected ${Ct.joinValues(t.options)}`;
      break;
    case "invalid_enum_value":
      n = `Invalid enum value. Expected ${Ct.joinValues(t.options)}, received '${t.received}'`;
      break;
    case "invalid_arguments":
      n = "Invalid function arguments";
      break;
    case "invalid_return_type":
      n = "Invalid function return type";
      break;
    case "invalid_date":
      n = "Invalid date";
      break;
    case "invalid_string":
      typeof t.validation == "object" ? "includes" in t.validation ? (n = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${t.validation.position}`)) : ("startsWith" in t.validation) ? n = `Invalid input: must start with "${t.validation.startsWith}"` : ("endsWith" in t.validation) ? n = `Invalid input: must end with "${t.validation.endsWith}"` : Ot.assertNever(t.validation) : t.validation !== "regex" ? n = `Invalid ${t.validation}` : n = "Invalid";
      break;
    case "too_small":
      t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : n = "Invalid input";
      break;
    case "too_big":
      t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? n = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : n = "Invalid input";
      break;
    case "custom":
      n = "Invalid input";
      break;
    case "invalid_intersection_types":
      n = "Intersection results could not be merged";
      break;
    case "not_multiple_of":
      n = `Number must be a multiple of ${t.multipleOf}`;
      break;
    case "not_finite":
      n = "Number must be finite";
      break;
    case "unresolved_reference":
      n = "Unresolved reference";
      break;
    default:
      n = e.defaultError, Ot.assertNever(t);
  }
  return { message: n };
}, "errorMap");
var Ci = class Bp extends Error {
  constructor(e) {
    super(), this.__type__ = "ZuiError", this.issues = [], this.addIssue = m((r) => {
      this.issues = [...this.issues, r];
    }, "addIssue"), this.addIssues = m((r = []) => {
      this.issues = [...this.issues, ...r];
    }, "addIssues");
    let n = new.target.prototype;
    Object.setPrototypeOf ? Object.setPrototypeOf(this, n) : this.__proto__ = n, this.name = "ZodError", this.issues = e;
  }
  get errors() {
    return this.issues;
  }
  format(e) {
    let n = e || function(s) {
      return s.message;
    }, r = { _errors: [] }, o = m((s) => {
      for (let i of s.issues)
        if (i.code === "invalid_union")
          i.unionErrors.map(o);
        else if (i.code === "invalid_return_type")
          o(i.returnTypeError);
        else if (i.code === "invalid_arguments")
          o(i.argumentsError);
        else if (i.path.length === 0)
          r._errors.push(n(i));
        else {
          let a = r, l = 0;
          for (;l < i.path.length; ) {
            let c = i.path[l];
            l === i.path.length - 1 ? (a[c] = a[c] || { _errors: [] }, a[c]._errors.push(n(i))) : a[c] = a[c] || { _errors: [] }, a = a[c], l++;
          }
        }
    }, "processError");
    return o(this), r;
  }
  static assert(e) {
    if (!(e instanceof Bp))
      throw new Error(`Not a ZodError: ${e}`);
  }
  toString() {
    return this.message;
  }
  get message() {
    return JSON.stringify(this.issues, Ct.jsonStringifyReplacer, 2);
  }
  get isEmpty() {
    return this.issues.length === 0;
  }
};
m(Ci, "ZodError");
Ci.create = m((t) => new Ci(t), "create");
var Xt = Ci;
var hx = Ai;
function Oi() {
  return hx;
}
m(Oi, "getErrorMap");
var Ne = {};
function Ip(t) {
  Object.assign(Ne, t);
}
m(Ip, "setBuilders");
var es = m((t) => {
  var e;
  let { data: n, path: r, errorMaps: o, issueData: s } = t, i = [...r, ...s.path || []], a = M(w({}, s), { path: i }), l = "", c = o.filter((f) => !!f).slice().reverse();
  for (let f of c)
    l = f(a, { data: n, defaultError: l }).message;
  return M(w({}, s), { path: i, message: (e = s.message) != null ? e : l });
}, "makeIssue");
function X(t, e) {
  let n = es({ issueData: e, data: t.data, path: t.path, errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Oi(), Ai].filter((r) => !!r) });
  t.common.issues.push(n);
}
m(X, "addIssueToContext");
var Ep = class Sp {
  constructor() {
    this.value = "valid";
  }
  dirty() {
    this.value === "valid" && (this.value = "dirty");
  }
  abort() {
    this.value !== "aborted" && (this.value = "aborted");
  }
  static mergeArray(e, n) {
    let r = [];
    for (let o of n) {
      if (o.status === "aborted")
        return { status: "aborted" };
      o.status === "dirty" && e.dirty(), r.push(o.value);
    }
    return { status: e.value, value: r };
  }
  static async mergeObjectAsync(e, n) {
    let r = [];
    for (let o of n)
      r.push({ key: await o.key, value: await o.value });
    return Sp.mergeObjectSync(e, r);
  }
  static mergeObjectSync(e, n) {
    let r = {};
    for (let o of n) {
      let { key: s, value: i } = o;
      if (s.status === "aborted")
        return { status: "aborted" };
      if (i.status === "aborted")
        return { status: "aborted" };
      s.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), s.value !== "__proto__" && (typeof i.value < "u" || o.alwaysSet) && (r[s.value] = i.value);
    }
    return { status: e.value, value: r };
  }
};
m(Ep, "ParseStatus");
var bt = Ep;
var Ri = m((t) => typeof Promise < "u" && t instanceof Promise, "isAsync");
var Cn = m((t) => {
  switch (typeof t) {
    case "undefined":
      return "undefined";
    case "string":
      return "string";
    case "number":
      return isNaN(t) ? "nan" : "number";
    case "boolean":
      return "boolean";
    case "function":
      return "function";
    case "bigint":
      return "bigint";
    case "symbol":
      return "symbol";
    case "object":
      return Array.isArray(t) ? "array" : t === null ? "null" : typeof Promise < "u" && t instanceof Promise || t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? "promise" : typeof Map < "u" && t instanceof Map ? "map" : typeof Set < "u" && t instanceof Set ? "set" : typeof Date < "u" && t instanceof Date ? "date" : "object";
    default:
      return "unknown";
  }
}, "getParsedType");
var kp = class {
  constructor(e, n, r, o) {
    this._cachedPath = [], this.parent = e, this.data = n, this._path = r, this._key = o;
  }
  get path() {
    return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
  }
};
m(kp, "ParseInputLazyPath");
var Zt = kp;
var Ap = class extends Error {
  constructor(e) {
    super(`Cannot access property ${e} before initialization. You're probably importing ZUI incorrectly. If not, reach out to the maintainers.`);
  }
};
m(Ap, "_CircularDependencyError");
var jo = Ap;
var Cp = class {
  constructor(e) {
    this.__type__ = "ZuiType", this.spa = this.safeParseAsync, this._handleResult = m((n, r) => {
      if (r.status === "valid")
        return { success: true, data: r.value };
      if (!n.common.issues.length)
        throw new Error("Validation failed but no issues detected.");
      return { success: false, get error() {
        if (this._error)
          return this._error;
        let o = new Xt(n.common.issues);
        return this._error = o, this._error;
      } };
    }, "_handleResult"), this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this.downstream = this.downstream.bind(this);
  }
  get description() {
    return this._metadataRoot._def.description;
  }
  get typeName() {
    return this._def.typeName;
  }
  dereference(e) {
    return this;
  }
  getReferences() {
    return [];
  }
  clone() {
    let e = this.constructor;
    return new e(w({}, this._def));
  }
  _getType(e) {
    return Cn(e.data);
  }
  _getOrReturnCtx(e, n) {
    return n || { common: e.parent.common, data: e.data, parsedType: Cn(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent };
  }
  _processInputParams(e) {
    return { status: new bt, ctx: { common: e.parent.common, data: e.data, parsedType: Cn(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent } };
  }
  _parseSync(e) {
    let n = this._parse(e);
    if (Ri(n))
      throw new Error("Synchronous parse encountered promise.");
    return n;
  }
  _parseAsync(e) {
    let n = this._parse(e);
    return Promise.resolve(n);
  }
  parse(e, n) {
    let r = this.safeParse(e, n);
    if (r.success)
      return r.data;
    throw r.error;
  }
  safeParse(e, n) {
    var r;
    let o = { common: { issues: [], async: (r = n?.async) != null ? r : false, contextualErrorMap: n?.errorMap }, path: n?.path || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Cn(e) }, s = this._parseSync({ data: e, path: o.path, parent: o });
    return this._handleResult(o, s);
  }
  async parseAsync(e, n) {
    let r = await this.safeParseAsync(e, n);
    if (r.success)
      return r.data;
    throw r.error;
  }
  async safeParseAsync(e, n) {
    let r = { common: { issues: [], contextualErrorMap: n?.errorMap, async: true }, path: n?.path || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: Cn(e) }, o = this._parse({ data: e, path: r.path, parent: r }), s = await (Ri(o) ? o : Promise.resolve(o));
    return this._handleResult(r, s);
  }
  refine(e, n) {
    let r = m((o) => typeof n == "string" || typeof n > "u" ? { message: n } : typeof n == "function" ? n(o) : n, "getIssueProperties");
    return Ne.downstream(this, (o) => {
      let s = e(o), i = [], a = m(() => i.push(w({ code: "custom" }, r(o))), "setError");
      return typeof Promise < "u" && s instanceof Promise ? s.then((l) => l ? { status: "valid", value: o } : (a(), { status: "dirty", value: o, issues: i })) : s ? { status: "valid", value: o } : (a(), { status: "dirty", value: o, issues: i });
    });
  }
  superRefine(e) {
    return Ne.downstream(this, (n, r) => {
      let o = [], s = e(n, { addIssue: (i) => o.push(i), path: r.path });
      return typeof Promise < "u" && s instanceof Promise ? s.then(() => o.some((i) => i.fatal) ? { status: "aborted", issues: o } : o.length ? { status: "dirty", value: n, issues: o } : { status: "valid", value: n }) : o.some((i) => i.fatal) ? { status: "aborted", issues: o } : o.length ? { status: "dirty", value: n, issues: o } : { status: "valid", value: n };
    });
  }
  downstream(e, n) {
    return Ne.downstream(this, e, n);
  }
  optional() {
    return Ne.optional(this, this._def);
  }
  nullable() {
    return Ne.nullable(this, this._def);
  }
  nullish() {
    return this.nullable().optional();
  }
  array() {
    return Ne.array(this, this._def);
  }
  promise() {
    return Ne.promise(this, this._def);
  }
  mandatory() {
    return this;
  }
  or(e) {
    return Ne.union([this, e]);
  }
  and(e) {
    return Ne.intersection(this, e);
  }
  transform(e) {
    return Ne.downstream(this, (n, r) => {
      let o = [], s = e(n, { addIssue: (i) => o.push(i), path: r.path });
      return s instanceof Promise ? s.then((i) => o.some((a) => a.fatal) ? { status: "aborted", issues: o } : o.length ? { status: "dirty", value: i, issues: o } : { status: "valid", value: i }) : o.some((i) => i.fatal) ? { status: "aborted", issues: o } : o.length ? { status: "dirty", value: s, issues: o } : { status: "valid", value: s };
    }, { failFast: true });
  }
  default(e) {
    let n = typeof e == "function" ? e : () => e;
    return Ne.default(this, n);
  }
  brand() {
    return Ne.branded(this);
  }
  catch(e) {
    return Ne.catch(this, e);
  }
  describe(e) {
    let n = this.clone();
    return n._metadataRoot._def.description = e, n;
  }
  pipe(e) {
    return Ne.pipeline(this, e);
  }
  readonly() {
    return Ne.readonly(this);
  }
  isOptional() {
    return this.safeParse(undefined).success;
  }
  isNullable() {
    return this.safeParse(null).success;
  }
  metadata(e) {
    var n, r, o;
    let s = this.clone(), i = s._metadataRoot;
    (o = (n = i._def)[r = ke]) != null || (n[r] = {});
    for (let [a, l] of Object.entries(e))
      i._def[ke] = M(w({}, i._def[ke]), { [a]: l });
    return s;
  }
  getMetadata() {
    return w({}, this._metadataRoot._def[ke]);
  }
  setMetadata(e) {
    this._metadataRoot._def[ke] = w({}, e);
  }
  get ui() {
    return w({}, this._metadataRoot._def[ke]);
  }
  get _metadataRoot() {
    return this.naked();
  }
  displayAs(e) {
    return this.metadata({ displayAs: [e.id, e.params] });
  }
  title(e) {
    return this.metadata({ title: e });
  }
  hidden(e) {
    let n;
    return e === undefined ? n = true : typeof e == "function" ? n = e.toString() : n = e, this.metadata({ hidden: n });
  }
  disabled(e) {
    let n;
    return e === undefined ? n = true : typeof e == "function" ? n = e.toString() : n = e, this.metadata({ disabled: n });
  }
  placeholder(e) {
    return this.metadata({ placeholder: e });
  }
  toJSONSchema(e) {
    throw new jo("toJSONSchema");
  }
  toTypescriptType(e) {
    throw new jo("toTypescriptType");
  }
  toTypescriptSchema() {
    throw new jo("toTypescriptSchema");
  }
  naked() {
    return this;
  }
};
m(Cp, "ZodBaseTypeImpl");
var pe = Cp;
var Op = class Rp extends pe {
  constructor() {
    super(...arguments), this._any = true;
  }
  _parse(e) {
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof Rp;
  }
};
m(Op, "ZodAnyImpl");
var Tx = Op;
var Mp = class Sn extends pe {
  dereference(e) {
    return new Sn(M(w({}, this._def), { type: this._def.type.dereference(e) }));
  }
  getReferences() {
    return this._def.type.getReferences();
  }
  clone() {
    return new Sn(M(w({}, this._def), { type: this._def.type.clone() }));
  }
  isEqual(e) {
    var n, r, o, s, i, a;
    return e instanceof Sn ? mn((n = this._def.exactLength) == null ? undefined : n.value, (r = e._def.exactLength) == null ? undefined : r.value) && mn((o = this._def.maxLength) == null ? undefined : o.value, (s = e._def.maxLength) == null ? undefined : s.value) && mn((i = this._def.minLength) == null ? undefined : i.value, (a = e._def.minLength) == null ? undefined : a.value) && this._def.type.isEqual(e._def.type) : false;
  }
  _parse(e) {
    let { ctx: n, status: r } = this._processInputParams(e), o = this._def;
    if (n.parsedType !== "array")
      return X(n, { code: "invalid_type", expected: "array", received: n.parsedType }), { status: "aborted" };
    if (o.exactLength !== null) {
      let i = n.data.length > o.exactLength.value, a = n.data.length < o.exactLength.value;
      (i || a) && (X(n, { code: i ? "too_big" : "too_small", minimum: a ? o.exactLength.value : undefined, maximum: i ? o.exactLength.value : undefined, type: "array", inclusive: true, exact: true, message: o.exactLength.message }), r.dirty());
    }
    if (o.minLength !== null && n.data.length < o.minLength.value && (X(n, { code: "too_small", minimum: o.minLength.value, type: "array", inclusive: true, exact: false, message: o.minLength.message }), r.dirty()), o.maxLength !== null && n.data.length > o.maxLength.value && (X(n, { code: "too_big", maximum: o.maxLength.value, type: "array", inclusive: true, exact: false, message: o.maxLength.message }), r.dirty()), n.common.async)
      return Promise.all([...n.data].map((i, a) => o.type._parseAsync(new Zt(n, i, n.path, a)))).then((i) => bt.mergeArray(r, i));
    let s = [...n.data].map((i, a) => o.type._parseSync(new Zt(n, i, n.path, a)));
    return bt.mergeArray(r, s);
  }
  get element() {
    return this._def.type;
  }
  min(e, n) {
    return new Sn(M(w({}, this._def), { minLength: { value: e, message: ae.toString(n) } }));
  }
  max(e, n) {
    return new Sn(M(w({}, this._def), { maxLength: { value: e, message: ae.toString(n) } }));
  }
  length(e, n) {
    return new Sn(M(w({}, this._def), { exactLength: { value: e, message: ae.toString(n) } }));
  }
  nonempty(e) {
    return this.min(1, e);
  }
};
m(Mp, "ZodArrayImpl");
var vx = Mp;
var Np = class bi extends pe {
  constructor() {
    super(...arguments), this.min = this.gte, this.max = this.lte;
  }
  _parse(e) {
    if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== "bigint") {
      let s = this._getOrReturnCtx(e);
      return X(s, { code: "invalid_type", expected: "bigint", received: s.parsedType }), { status: "aborted" };
    }
    let r, o = new bt;
    for (let s of this._def.checks)
      s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (r = this._getOrReturnCtx(e, r), X(r, { code: "too_small", type: "bigint", minimum: s.value, inclusive: s.inclusive, message: s.message }), o.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (r = this._getOrReturnCtx(e, r), X(r, { code: "too_big", type: "bigint", maximum: s.value, inclusive: s.inclusive, message: s.message }), o.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), X(r, { code: "not_multiple_of", multipleOf: s.value, message: s.message }), o.dirty()) : Ot.assertNever(s);
    return { status: o.value, value: e.data };
  }
  isEqual(e) {
    if (!(e instanceof bi) || this._def.coerce !== e._def.coerce)
      return false;
    let n = new Je.CustomSet(this._def.checks), r = new Je.CustomSet(e._def.checks);
    return n.isEqual(r);
  }
  gte(e, n) {
    return this.setLimit("min", e, true, ae.toString(n));
  }
  gt(e, n) {
    return this.setLimit("min", e, false, ae.toString(n));
  }
  lte(e, n) {
    return this.setLimit("max", e, true, ae.toString(n));
  }
  lt(e, n) {
    return this.setLimit("max", e, false, ae.toString(n));
  }
  setLimit(e, n, r, o) {
    return new bi(M(w({}, this._def), { checks: [...this._def.checks, { kind: e, value: n, inclusive: r, message: ae.toString(o) }] }));
  }
  _addCheck(e) {
    return new bi(M(w({}, this._def), { checks: [...this._def.checks, e] }));
  }
  positive(e) {
    return this._addCheck({ kind: "min", value: BigInt(0), inclusive: false, message: ae.toString(e) });
  }
  negative(e) {
    return this._addCheck({ kind: "max", value: BigInt(0), inclusive: false, message: ae.toString(e) });
  }
  nonpositive(e) {
    return this._addCheck({ kind: "max", value: BigInt(0), inclusive: true, message: ae.toString(e) });
  }
  nonnegative(e) {
    return this._addCheck({ kind: "min", value: BigInt(0), inclusive: true, message: ae.toString(e) });
  }
  multipleOf(e, n) {
    return this._addCheck({ kind: "multipleOf", value: e, message: ae.toString(n) });
  }
  get minValue() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "min" && (e === null || n.value > e) && (e = n.value);
    return e;
  }
  get maxValue() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "max" && (e === null || n.value < e) && (e = n.value);
    return e;
  }
};
m(Np, "ZodBigIntImpl");
var _x = Np;
var Dp = class Hp extends pe {
  _parse(e) {
    if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== "boolean") {
      let r = this._getOrReturnCtx(e);
      return X(r, { code: "invalid_type", expected: "boolean", received: r.parsedType }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof Hp ? this._def.coerce === e._def.coerce : false;
  }
};
m(Dp, "ZodBooleanImpl");
var bx = Dp;
var Up = class Br extends pe {
  dereference(e) {
    return new Br(M(w({}, this._def), { type: this._def.type.dereference(e) }));
  }
  getReferences() {
    return this._def.type.getReferences();
  }
  clone() {
    return new Br(M(w({}, this._def), { type: this._def.type.clone() }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e), r = n.data;
    return this._def.type._parse({ data: r, path: n.path, parent: n });
  }
  unwrap() {
    return this._def.type;
  }
  isEqual(e) {
    return e instanceof Br ? this._def.type.isEqual(e._def.type) : false;
  }
  naked() {
    return this._def.type.naked();
  }
  mandatory() {
    return new Br(M(w({}, this._def), { type: this._def.type.mandatory() }));
  }
};
m(Up, "ZodBrandedImpl");
var wx = Up;
var jp = class Ir extends pe {
  _parse(e) {
    let { ctx: n } = this._processInputParams(e), r = M(w({}, n), { common: M(w({}, n.common), { issues: [] }) }), o = this._def.innerType._parse({ data: r.data, path: r.path, parent: w({}, r) });
    return Ri(o) ? o.then((s) => ({ status: "valid", value: s.status === "valid" ? s.value : this._def.catchValue({ get error() {
      return new Xt(r.common.issues);
    }, input: r.data }) })) : { status: "valid", value: o.status === "valid" ? o.value : this._def.catchValue({ get error() {
      return new Xt(r.common.issues);
    }, input: r.data }) };
  }
  removeCatch() {
    return this._def.innerType;
  }
  isEqual(e) {
    return e instanceof Ir ? this._def.innerType.isEqual(e._def.innerType) && Ct.compareFunctions(this._def.catchValue, e._def.catchValue) : false;
  }
  dereference(e) {
    return new Ir(M(w({}, this._def), { innerType: this._def.innerType.dereference(e) }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new Ir(M(w({}, this._def), { innerType: this._def.innerType.clone() }));
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new Ir(M(w({}, this._def), { innerType: this._def.innerType.mandatory() }));
  }
};
m(jp, "ZodCatchImpl");
var xx = jp;
var $p = class ts extends pe {
  _parse(e) {
    if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== "date") {
      let s = this._getOrReturnCtx(e);
      return X(s, { code: "invalid_type", expected: "date", received: s.parsedType }), { status: "aborted" };
    }
    if (isNaN(e.data.getTime())) {
      let s = this._getOrReturnCtx(e);
      return X(s, { code: "invalid_date" }), { status: "aborted" };
    }
    let r = new bt, o;
    for (let s of this._def.checks)
      s.kind === "min" ? e.data.getTime() < s.value && (o = this._getOrReturnCtx(e, o), X(o, { code: "too_small", message: s.message, inclusive: true, exact: false, minimum: s.value, type: "date" }), r.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (o = this._getOrReturnCtx(e, o), X(o, { code: "too_big", message: s.message, inclusive: true, exact: false, maximum: s.value, type: "date" }), r.dirty()) : Ot.assertNever(s);
    return { status: r.value, value: new Date(e.data.getTime()) };
  }
  _addCheck(e) {
    return new ts(M(w({}, this._def), { checks: [...this._def.checks, e] }));
  }
  min(e, n) {
    return this._addCheck({ kind: "min", value: e.getTime(), message: ae.toString(n) });
  }
  max(e, n) {
    return this._addCheck({ kind: "max", value: e.getTime(), message: ae.toString(n) });
  }
  get minDate() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "min" && (e === null || n.value > e) && (e = n.value);
    return e != null ? new Date(e) : null;
  }
  get maxDate() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "max" && (e === null || n.value < e) && (e = n.value);
    return e != null ? new Date(e) : null;
  }
  isEqual(e) {
    if (!(e instanceof ts))
      return false;
    let n = new Je.CustomSet(this._def.checks), r = new Je.CustomSet(e._def.checks);
    return n.isEqual(r) && this._def.coerce === e._def.coerce;
  }
};
m($p, "ZodDateImpl");
var Px = $p;
var Zp = class Er extends pe {
  _parse(e) {
    let { ctx: n } = this._processInputParams(e), r = n.data;
    return n.parsedType === "undefined" && (r = this._def.defaultValue()), this._def.innerType._parse({ data: r, path: n.path, parent: n });
  }
  removeDefault() {
    return this._def.innerType;
  }
  dereference(e) {
    return new Er(M(w({}, this._def), { innerType: this._def.innerType.dereference(e) }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new Er(M(w({}, this._def), { innerType: this._def.innerType.clone() }));
  }
  isEqual(e) {
    return e instanceof Er ? this._def.innerType.isEqual(e._def.innerType) && mn(this._def.defaultValue(), e._def.defaultValue()) : false;
  }
  unwrap() {
    return this._def.innerType;
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new Er(M(w({}, this._def), { innerType: this._def.innerType.mandatory() }));
  }
};
m(Zp, "ZodDefaultImpl");
var Bx = Zp;
var Yt = m((t) => {
  let e = t;
  return e ? e.typeName === "ZodLazy" ? Yt(e.schema) : e.typeName === "ZodEffects" ? Yt(e.innerType()) : e.typeName === "ZodLiteral" ? [e.value] : e.typeName === "ZodEnum" ? e.options : e.typeName === "ZodNativeEnum" ? Object.values(e.enum) : e.typeName === "ZodDefault" ? Yt(e._def.innerType) : e.typeName === "ZodUndefined" ? [undefined] : e.typeName === "ZodNull" ? [null] : e.typeName === "ZodOptional" ? [undefined, ...Yt(e.unwrap())] : e.typeName === "ZodNullable" ? [null, ...Yt(e.unwrap())] : e.typeName === "ZodBranded" || e.typeName === "ZodReadonly" ? Yt(e.unwrap()) : e.typeName === "ZodCatch" ? Yt(e._def.innerType) : [] : [];
}, "getDiscriminator");
var Lp = class Sr extends pe {
  constructor(e) {
    let n = Sr._getOptionsMap(e.discriminator, e.options);
    super(M(w({}, e), { optionsMap: n }));
  }
  dereference(e) {
    let n = this.options.map((r) => r.dereference(e));
    return new Sr(M(w({}, this._def), { options: n }));
  }
  getReferences() {
    return Lt.unique(this.options.flatMap((e) => e.getReferences()));
  }
  clone() {
    let e = this.options.map((n) => n.clone());
    return new Sr(M(w({}, this._def), { options: e }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e);
    if (n.parsedType !== "object")
      return X(n, { code: "invalid_type", expected: "object", received: n.parsedType }), { status: "aborted" };
    let r = this.discriminator, o = n.data[r], s = this.optionsMap.get(o);
    return s ? n.common.async ? s._parseAsync({ data: n.data, path: n.path, parent: n }) : s._parseSync({ data: n.data, path: n.path, parent: n }) : (X(n, { code: "invalid_union_discriminator", options: Array.from(this.optionsMap.keys()), path: [r] }), { status: "aborted" });
  }
  get discriminator() {
    return this._def.discriminator;
  }
  get options() {
    return this._def.options;
  }
  get optionsMap() {
    return this._def.optionsMap;
  }
  static _getOptionsMap(e, n) {
    let r = new Map;
    for (let o of n) {
      let s = Yt(o.shape[e]);
      if (!s.length)
        throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
      for (let i of s) {
        if (r.has(i))
          throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);
        r.set(i, o);
      }
    }
    return r;
  }
  isEqual(e) {
    if (!(e instanceof Sr) || this._def.discriminator !== e._def.discriminator)
      return false;
    let n = m((s, i) => s.isEqual(i), "compare"), r = new Je.CustomSet(this._def.options, { compare: n }), o = new Je.CustomSet(e._def.options, { compare: n });
    return r.isEqual(o);
  }
};
m(Lp, "ZodDiscriminatedUnionImpl");
var Ix = Lp;
var Wp = class Kp extends pe {
  _parse(e) {
    if (typeof e.data != "string") {
      let n = this._getOrReturnCtx(e), r = this._def.values;
      return X(n, { expected: Ct.joinValues(r), received: n.parsedType, code: "invalid_type" }), { status: "aborted" };
    }
    if (this._def.values.indexOf(e.data) === -1) {
      let n = this._getOrReturnCtx(e), r = this._def.values;
      return X(n, { received: n.data, code: "invalid_enum_value", options: r }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  get options() {
    return this._def.values;
  }
  get enum() {
    let e = {};
    for (let n of this._def.values)
      e[n] = n;
    return e;
  }
  get Values() {
    return this.enum;
  }
  get Enum() {
    return this.enum;
  }
  extract(e, n = this._def) {
    return Ne.enum(e, w(w({}, this._def), n));
  }
  exclude(e, n = this._def) {
    return Ne.enum(this.options.filter((r) => !e.includes(r)), w(w({}, this._def), n));
  }
  isEqual(e) {
    if (!(e instanceof Kp))
      return false;
    let n = new Je.CustomSet(this._def.values), r = new Je.CustomSet(e._def.values);
    return n.isEqual(r);
  }
};
m(Wp, "ZodEnumImpl");
var Ex = Wp;
var Fp = class tr extends pe {
  constructor() {
    super(...arguments), this.validate = this.implement;
  }
  dereference(e) {
    let n = this._def.args.dereference(e), r = this._def.returns.dereference(e);
    return new tr(M(w({}, this._def), { args: n, returns: r }));
  }
  getReferences() {
    return Lt.unique([...this._def.args.getReferences(), ...this._def.returns.getReferences()]);
  }
  clone() {
    return new tr(M(w({}, this._def), { args: this._def.args.clone(), returns: this._def.returns.clone() }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e);
    if (n.parsedType !== "function")
      return X(n, { code: "invalid_type", expected: "function", received: n.parsedType }), { status: "aborted" };
    function r(c, f) {
      return es({ data: c, path: n.path, errorMaps: [n.common.contextualErrorMap, n.schemaErrorMap, Oi(), Ai].filter((g) => !!g), issueData: { code: "invalid_arguments", argumentsError: f } });
    }
    m(r, "makeArgsIssue");
    function o(c, f) {
      return es({ data: c, path: n.path, errorMaps: [n.common.contextualErrorMap, n.schemaErrorMap, Oi(), Ai].filter((g) => !!g), issueData: { code: "invalid_return_type", returnTypeError: f } });
    }
    m(o, "makeReturnsIssue");
    let s = { errorMap: n.common.contextualErrorMap }, i = n.data, a = this, l = this._def.returns;
    return tt.zuiPromise(l) ? { status: "valid", async value(...c) {
      let f = new Xt([]), g = await a._def.args.parseAsync(c, s).catch((T) => {
        throw f.addIssue(r(c, T)), f;
      }), p = await Reflect.apply(i, this, g);
      return await l._def.type.parseAsync(p, s).catch((T) => {
        throw tt.zuiError(T) ? (f.addIssue(o(p, T)), f) : T;
      });
    } } : { status: "valid", value(...c) {
      let f = a._def.args.safeParse(c, s);
      if (!f.success)
        throw new Xt([r(c, f.error)]);
      let g = Reflect.apply(i, this, f.data), p = a._def.returns.safeParse(g, s);
      if (!p.success)
        throw new Xt([o(g, p.error)]);
      return p.data;
    } };
  }
  parameters() {
    return this._def.args;
  }
  returnType() {
    return this._def.returns;
  }
  args(...e) {
    return new tr(M(w({}, this._def), { args: Ne.tuple(e).rest(Ne.unknown()) }));
  }
  returns(e) {
    return new tr(M(w({}, this._def), { returns: e }));
  }
  implement(e) {
    return this.parse(e);
  }
  strictImplement(e) {
    return this.parse(e);
  }
  isEqual(e) {
    return e instanceof tr && this._def.args.isEqual(e._def.args) && this._def.returns.isEqual(e._def.returns);
  }
};
m(Fp, "ZodFunctionImpl");
var Sx = Fp;
var zp = class wi extends pe {
  dereference(e) {
    return new wi(M(w({}, this._def), { left: this._def.left.dereference(e), right: this._def.right.dereference(e) }));
  }
  getReferences() {
    return Lt.unique([...this._def.left.getReferences(), ...this._def.right.getReferences()]);
  }
  clone() {
    return new wi(M(w({}, this._def), { left: this._def.left.clone(), right: this._def.right.clone() }));
  }
  _parse(e) {
    let { status: n, ctx: r } = this._processInputParams(e), o = m((s, i) => {
      if (s.status === "aborted" || i.status === "aborted")
        return { status: "aborted" };
      let a = this._mergeValues(s.value, i.value);
      return a.valid ? ((s.status === "dirty" || i.status === "dirty") && n.dirty(), { status: n.value, value: a.data }) : (X(r, { code: "invalid_intersection_types" }), { status: "aborted" });
    }, "handleParsed");
    return r.common.async ? Promise.all([this._def.left._parseAsync({ data: r.data, path: r.path, parent: r }), this._def.right._parseAsync({ data: r.data, path: r.path, parent: r })]).then(([s, i]) => o(s, i)) : o(this._def.left._parseSync({ data: r.data, path: r.path, parent: r }), this._def.right._parseSync({ data: r.data, path: r.path, parent: r }));
  }
  isEqual(e) {
    if (!(e instanceof wi))
      return false;
    let n = m((s, i) => s.isEqual(i), "compare"), r = new Je.CustomSet([this._def.left, this._def.right], { compare: n }), o = new Je.CustomSet([e._def.left, e._def.right], { compare: n });
    return r.isEqual(o);
  }
  _mergeValues(e, n) {
    let r = Cn(e), o = Cn(n);
    if (e === n)
      return { valid: true, data: e };
    if (r === "object" && o === "object") {
      let s = Object.keys(n), i = Object.keys(e).filter((l) => s.indexOf(l) !== -1), a = w(w({}, e), n);
      for (let l of i) {
        let c = this._mergeValues(e[l], n[l]);
        if (!c.valid)
          return { valid: false };
        a[l] = c.data;
      }
      return { valid: true, data: a };
    } else if (r === "array" && o === "array") {
      if (e.length !== n.length)
        return { valid: false };
      let s = [];
      for (let i = 0;i < e.length; i++) {
        let a = e[i], l = n[i], c = this._mergeValues(a, l);
        if (!c.valid)
          return { valid: false };
        s.push(c.data);
      }
      return { valid: true, data: s };
    } else
      return r === "date" && o === "date" && +e == +n ? { valid: true, data: e } : { valid: false };
  }
};
m(zp, "ZodIntersectionImpl");
var kx = zp;
var qp = class kr extends pe {
  get schema() {
    return this._def.getter();
  }
  dereference(e) {
    return new kr(M(w({}, this._def), { getter: () => this._def.getter().dereference(e) }));
  }
  getReferences() {
    return this._def.getter().getReferences();
  }
  clone() {
    return new kr(M(w({}, this._def), { getter: () => this._def.getter().clone() }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e);
    return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
  }
  isEqual(e) {
    return e instanceof kr ? this._def.getter().isEqual(e._def.getter()) : false;
  }
  naked() {
    return this._def.getter().naked();
  }
  mandatory() {
    return new kr(M(w({}, this._def), { getter: () => this._def.getter().mandatory() }));
  }
};
m(qp, "ZodLazyImpl");
var Ax = qp;
var Gp = class Vp extends pe {
  _parse(e) {
    if (e.data !== this._def.value) {
      let n = this._getOrReturnCtx(e);
      return X(n, { received: n.data, code: "invalid_literal", expected: this._def.value }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  get value() {
    return this._def.value;
  }
  isEqual(e) {
    return e instanceof Vp ? mn(this._def.value, e._def.value) : false;
  }
};
m(Gp, "ZodLiteralImpl");
var Cx = Gp;
var Jp = class xi extends pe {
  get keySchema() {
    return this._def.keyType;
  }
  get valueSchema() {
    return this._def.valueType;
  }
  dereference(e) {
    let n = this._def.keyType.dereference(e), r = this._def.valueType.dereference(e);
    return new xi(M(w({}, this._def), { keyType: n, valueType: r }));
  }
  getReferences() {
    return Lt.unique([...this._def.keyType.getReferences(), ...this._def.valueType.getReferences()]);
  }
  clone() {
    return new xi(M(w({}, this._def), { keyType: this._def.keyType.clone(), valueType: this._def.valueType.clone() }));
  }
  _parse(e) {
    let { status: n, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== "map")
      return X(r, { code: "invalid_type", expected: "map", received: r.parsedType }), { status: "aborted" };
    let o = this._def.keyType, s = this._def.valueType, i = [...r.data.entries()].map(([a, l], c) => ({ key: o._parse(new Zt(r, a, r.path, [c, "key"])), value: s._parse(new Zt(r, l, r.path, [c, "value"])) }));
    if (r.common.async) {
      let a = new Map;
      return Promise.resolve().then(async () => {
        for (let l of i) {
          let c = await l.key, f = await l.value;
          if (c.status === "aborted" || f.status === "aborted")
            return { status: "aborted" };
          (c.status === "dirty" || f.status === "dirty") && n.dirty(), a.set(c.value, f.value);
        }
        return { status: n.value, value: a };
      });
    } else {
      let a = new Map;
      for (let l of i) {
        let { key: c, value: f } = l;
        if (c.status === "aborted" || f.status === "aborted")
          return { status: "aborted" };
        (c.status === "dirty" || f.status === "dirty") && n.dirty(), a.set(c.value, f.value);
      }
      return { status: n.value, value: a };
    }
  }
  isEqual(e) {
    return !(!(e instanceof xi) || !this._def.keyType.isEqual(e._def.keyType) || !this._def.valueType.isEqual(e._def.valueType));
  }
};
m(Jp, "ZodMapImpl");
var Ox = Jp;
var Yp = class Xp extends pe {
  _parse(e) {
    if (this._getType(e) !== "nan") {
      let r = this._getOrReturnCtx(e);
      return X(r, { code: "invalid_type", expected: "nan", received: r.parsedType }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof Xp;
  }
};
m(Yp, "ZodNaNImpl");
var Rx = Yp;
var Qp = class eg extends pe {
  constructor() {
    super(...arguments), this._getValidEnumValues = m((e) => {
      let n = Object.keys(e).filter((o) => typeof e[e[o]] != "number"), r = {};
      for (let o of n)
        r[o] = e[o];
      return Object.values(r);
    }, "_getValidEnumValues");
  }
  _parse(e) {
    let n = this._getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
    if (r.parsedType !== "string" && r.parsedType !== "number") {
      let o = Object.values(n);
      return X(r, { expected: Ct.joinValues(o), received: r.parsedType, code: "invalid_type" }), { status: "aborted" };
    }
    if (n.indexOf(e.data) === -1) {
      let o = Object.values(n);
      return X(r, { received: r.data, code: "invalid_enum_value", options: o }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  get enum() {
    return this._def.values;
  }
  isEqual(e) {
    return e instanceof eg ? mn(this._def.values, e._def.values) : false;
  }
};
m(Qp, "ZodNativeEnumImpl");
var Mx = Qp;
var tg = class ng extends pe {
  _parse(e) {
    let n = this._getOrReturnCtx(e);
    return X(n, { code: "invalid_type", expected: "never", received: n.parsedType }), { status: "aborted" };
  }
  isEqual(e) {
    return e instanceof ng;
  }
};
m(tg, "ZodNeverImpl");
var Nx = tg;
var rg = class ig extends pe {
  _parse(e) {
    if (this._getType(e) !== "null") {
      let r = this._getOrReturnCtx(e);
      return X(r, { code: "invalid_type", expected: "null", received: r.parsedType }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof ig;
  }
};
m(rg, "ZodNullImpl");
var Dx = rg;
var og = class Ar extends pe {
  dereference(e) {
    return new Ar(M(w({}, this._def), { innerType: this._def.innerType.dereference(e) }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new Ar(M(w({}, this._def), { innerType: this._def.innerType.clone() }));
  }
  _parse(e) {
    return this._getType(e) === "null" ? { status: "valid", value: null } : this._def.innerType._parse(e);
  }
  unwrap() {
    return this._def.innerType;
  }
  isEqual(e) {
    return e instanceof Ar ? this._def.innerType.isEqual(e._def.innerType) : false;
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new Ar(M(w({}, this._def), { innerType: this._def.innerType.mandatory() }));
  }
};
m(og, "ZodNullableImpl");
var Hx = og;
var sg = class Pi extends pe {
  constructor() {
    super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
  }
  _parse(e) {
    if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== "number") {
      let s = this._getOrReturnCtx(e);
      return X(s, { code: "invalid_type", expected: "number", received: s.parsedType }), { status: "aborted" };
    }
    let r, o = new bt;
    for (let s of this._def.checks)
      s.kind === "int" ? Number.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), X(r, { code: "invalid_type", expected: "integer", received: "float", message: s.message }), o.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (r = this._getOrReturnCtx(e, r), X(r, { code: "too_small", minimum: s.value, type: "number", inclusive: s.inclusive, exact: false, message: s.message }), o.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (r = this._getOrReturnCtx(e, r), X(r, { code: "too_big", maximum: s.value, type: "number", inclusive: s.inclusive, exact: false, message: s.message }), o.dirty()) : s.kind === "multipleOf" ? this._floatSafeRemainder(e.data, s.value) !== 0 && (r = this._getOrReturnCtx(e, r), X(r, { code: "not_multiple_of", multipleOf: s.value, message: s.message }), o.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), X(r, { code: "not_finite", message: s.message }), o.dirty()) : Ot.assertNever(s);
    return { status: o.value, value: e.data };
  }
  gte(e, n) {
    return this.setLimit("min", e, true, ae.toString(n));
  }
  gt(e, n) {
    return this.setLimit("min", e, false, ae.toString(n));
  }
  lte(e, n) {
    return this.setLimit("max", e, true, ae.toString(n));
  }
  lt(e, n) {
    return this.setLimit("max", e, false, ae.toString(n));
  }
  setLimit(e, n, r, o) {
    return new Pi(M(w({}, this._def), { checks: [...this._def.checks, { kind: e, value: n, inclusive: r, message: ae.toString(o) }] }));
  }
  _addCheck(e) {
    return new Pi(M(w({}, this._def), { checks: [...this._def.checks, e] }));
  }
  int(e) {
    return this._addCheck({ kind: "int", message: ae.toString(e) });
  }
  positive(e) {
    return this._addCheck({ kind: "min", value: 0, inclusive: false, message: ae.toString(e) });
  }
  negative(e) {
    return this._addCheck({ kind: "max", value: 0, inclusive: false, message: ae.toString(e) });
  }
  nonpositive(e) {
    return this._addCheck({ kind: "max", value: 0, inclusive: true, message: ae.toString(e) });
  }
  nonnegative(e) {
    return this._addCheck({ kind: "min", value: 0, inclusive: true, message: ae.toString(e) });
  }
  multipleOf(e, n) {
    return this._addCheck({ kind: "multipleOf", value: e, message: ae.toString(n) });
  }
  finite(e) {
    return this._addCheck({ kind: "finite", message: ae.toString(e) });
  }
  safe(e) {
    return this._addCheck({ kind: "min", inclusive: true, value: Number.MIN_SAFE_INTEGER, message: ae.toString(e) })._addCheck({ kind: "max", inclusive: true, value: Number.MAX_SAFE_INTEGER, message: ae.toString(e) });
  }
  get minValue() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "min" && (e === null || n.value > e) && (e = n.value);
    return e;
  }
  get maxValue() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "max" && (e === null || n.value < e) && (e = n.value);
    return e;
  }
  get isInt() {
    return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && Number.isInteger(e.value));
  }
  get isFinite() {
    let e = null, n = null;
    for (let r of this._def.checks) {
      if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
        return true;
      r.kind === "min" ? (n === null || r.value > n) && (n = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
    }
    return Number.isFinite(n) && Number.isFinite(e);
  }
  isEqual(e) {
    if (!(e instanceof Pi))
      return false;
    let n = new Je.CustomSet(this._def.checks), r = new Je.CustomSet(e._def.checks);
    return n.isEqual(r);
  }
  _floatSafeRemainder(e, n) {
    let r = (e.toString().split(".")[1] || "").length, o = (n.toString().split(".")[1] || "").length, s = r > o ? r : o, i = parseInt(e.toFixed(s).replace(".", "")), a = parseInt(n.toFixed(s).replace(".", ""));
    return i % a / Math.pow(10, s);
  }
};
m(sg, "ZodNumberImpl");
var Ux = sg;
var ag = class gt extends pe {
  constructor() {
    super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
  }
  _getCached() {
    if (this._cached !== null)
      return this._cached;
    let e = this._def.shape(), n = Object.keys(e);
    return this._cached = { shape: e, keys: n };
  }
  dereference(e) {
    let n = this._def.shape(), r = {};
    for (let o in n)
      r[o] = n[o].dereference(e);
    return new gt(M(w({}, this._def), { shape: () => r }));
  }
  getReferences() {
    let e = this._def.shape(), n = [];
    for (let r in e)
      n.push(...e[r].getReferences());
    return Lt.unique(n);
  }
  clone() {
    let e = {}, n = this._def.shape();
    for (let [o, s] of Object.entries(n))
      e[o] = s.clone();
    return new gt(M(w({}, this._def), { shape: () => e }));
  }
  _parse(e) {
    if (this._getType(e) !== "object") {
      let f = this._getOrReturnCtx(e);
      return X(f, { code: "invalid_type", expected: "object", received: f.parsedType }), { status: "aborted" };
    }
    let { status: r, ctx: o } = this._processInputParams(e), { shape: s, keys: i } = this._getCached(), a = [];
    if (this._def.unknownKeys !== "strip")
      for (let f in o.data)
        i.includes(f) || a.push(f);
    let l = [];
    for (let f of i) {
      let g = s[f], p = o.data[f];
      l.push({ key: { status: "valid", value: f }, value: g._parse(new Zt(o, p, o.path, f)), alwaysSet: f in o.data });
    }
    let c = this._def.unknownKeys;
    if (c === "passthrough")
      for (let f of a)
        l.push({ key: { status: "valid", value: f }, value: { status: "valid", value: o.data[f] } });
    else if (c === "strict")
      a.length > 0 && (X(o, { code: "unrecognized_keys", keys: a }), r.dirty());
    else if (c !== "strip")
      for (let f of a) {
        let g = o.data[f];
        l.push({ key: { status: "valid", value: f }, value: c._parse(new Zt(o, g, o.path, f)), alwaysSet: f in o.data });
      }
    return o.common.async ? Promise.resolve().then(async () => {
      let f = [];
      for (let g of l) {
        let p = await g.key;
        f.push({ key: p, value: await g.value, alwaysSet: g.alwaysSet });
      }
      return f;
    }).then((f) => bt.mergeObjectSync(r, f)) : bt.mergeObjectSync(r, l);
  }
  get shape() {
    return this._def.shape();
  }
  strict(e) {
    return ae.errToObj, new gt(w(M(w({}, this._def), { unknownKeys: "strict" }), e !== undefined ? { errorMap: (n, r) => {
      var o, s, i, a;
      let l = (i = (s = (o = this._def).errorMap) == null ? undefined : s.call(o, n, r).message) != null ? i : r.defaultError;
      return n.code === "unrecognized_keys" ? { message: (a = ae.errToObj(e).message) != null ? a : l } : { message: l };
    } } : {}));
  }
  strip() {
    return new gt(M(w({}, this._def), { unknownKeys: "strip" }));
  }
  passthrough() {
    return new gt(M(w({}, this._def), { unknownKeys: "passthrough" }));
  }
  additionalProperties() {
    if (typeof this._def.unknownKeys == "object")
      return this._def.unknownKeys;
    if (this._def.unknownKeys === "passthrough")
      return Ne.any();
    if (this._def.unknownKeys === "strict")
      return Ne.never();
  }
  extend(e) {
    return new gt(M(w({}, this._def), { shape: () => w(w({}, this._def.shape()), e) }));
  }
  merge(e) {
    return new gt({ unknownKeys: e._def.unknownKeys, shape: () => w(w({}, this._def.shape()), e._def.shape()), typeName: "ZodObject" });
  }
  setKey(e, n) {
    return this.augment({ [e]: n });
  }
  catchall(e) {
    return new gt(M(w({}, this._def), { unknownKeys: e }));
  }
  pick(e) {
    let n = {};
    return Object.keys(e).forEach((o) => {
      e[o] && this.shape[o] && (n[o] = this.shape[o]);
    }), new gt(M(w({}, this._def), { shape: () => n }));
  }
  omit(e) {
    let n = {};
    return Object.entries(this.shape).forEach(([o, s]) => {
      e[o] || (n[o] = s);
    }), new gt(M(w({}, this._def), { shape: () => n }));
  }
  partial(e) {
    let n = {};
    return Object.keys(this.shape).forEach((o) => {
      let s = this.shape[o];
      e && !e[o] ? n[o] = s : n[o] = s?.optional();
    }), new gt(M(w({}, this._def), { shape: () => n }));
  }
  required(e) {
    let n = {};
    return Object.entries(this.shape).forEach(([r, o]) => {
      if (e && !e[r])
        n[r] = o;
      else {
        let i = o;
        for (;tt.zuiOptional(i); )
          i = i._def.innerType;
        n[r] = i;
      }
    }), new gt(M(w({}, this._def), { shape: () => n }));
  }
  keyof() {
    let e = Object.keys(this.shape);
    return Ne.enum(e);
  }
  isEqual(e) {
    if (!(e instanceof gt) || !this._unknownKeysEqual(e))
      return false;
    let n = this._def.shape(), r = e._def.shape(), o = m((a, l) => a[0] === l[0] && a[1].isEqual(l[1]), "compare"), s = new Je.CustomSet(Object.entries(n), { compare: o }), i = new Je.CustomSet(Object.entries(r), { compare: o });
    return s.isEqual(i);
  }
  _unknownKeysEqual(e) {
    let n = this.additionalProperties(), r = e.additionalProperties();
    return n === undefined || r === undefined ? n === r : n.isEqual(r);
  }
};
m(ag, "ZodObjectImpl");
var lg = ag;
var ug = class Bi extends pe {
  dereference(e) {
    return new Bi(M(w({}, this._def), { innerType: this._def.innerType.dereference(e) }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new Bi(M(w({}, this._def), { innerType: this._def.innerType.clone() }));
  }
  _parse(e) {
    return this._getType(e) === "undefined" ? { status: "valid", value: undefined } : this._def.innerType._parse(e);
  }
  unwrap() {
    return this._def.innerType;
  }
  isEqual(e) {
    return e instanceof Bi ? this._def.innerType.isEqual(e._def.innerType) : false;
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return this._def.innerType.mandatory();
  }
};
m(ug, "ZodOptionalImpl");
var jx = ug;
var cg = class Ii extends pe {
  dereference(e) {
    return new Ii(M(w({}, this._def), { in: this._def.in.dereference(e), out: this._def.out.dereference(e) }));
  }
  getReferences() {
    return Lt.unique([...this._def.in.getReferences(), ...this._def.out.getReferences()]);
  }
  clone() {
    return new Ii(M(w({}, this._def), { in: this._def.in.clone(), out: this._def.out.clone() }));
  }
  _parse(e) {
    let { status: n, ctx: r } = this._processInputParams(e);
    if (r.common.async)
      return m(async () => {
        let s = await this._def.in._parseAsync({ data: r.data, path: r.path, parent: r });
        return s.status === "aborted" ? { status: "aborted" } : s.status === "dirty" ? (n.dirty(), { status: "dirty", value: s.value }) : this._def.out._parseAsync({ data: s.value, path: r.path, parent: r });
      }, "handleAsync")();
    {
      let o = this._def.in._parseSync({ data: r.data, path: r.path, parent: r });
      return o.status === "aborted" ? { status: "aborted" } : o.status === "dirty" ? (n.dirty(), { status: "dirty", value: o.value }) : this._def.out._parseSync({ data: o.value, path: r.path, parent: r });
    }
  }
  isEqual(e) {
    return !(!(e instanceof Ii) || !this._def.in.isEqual(e._def.in) || !this._def.out.isEqual(e._def.out));
  }
};
m(cg, "ZodPipelineImpl");
var $x = cg;
var dg = class Ei extends pe {
  unwrap() {
    return this._def.type;
  }
  dereference(e) {
    return new Ei(M(w({}, this._def), { type: this._def.type.dereference(e) }));
  }
  getReferences() {
    return this._def.type.getReferences();
  }
  clone() {
    return new Ei(M(w({}, this._def), { type: this._def.type.clone() }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e);
    return n.parsedType !== "promise" && n.common.async === false ? (X(n, { code: "invalid_type", expected: "promise", received: n.parsedType }), { status: "aborted" }) : { status: "valid", value: (n.parsedType === "promise" ? n.data : Promise.resolve(n.data)).then((o) => this._def.type.parseAsync(o, { path: n.path, errorMap: n.common.contextualErrorMap })) };
  }
  isEqual(e) {
    return e instanceof Ei ? this._def.type.isEqual(e._def.type) : false;
  }
  naked() {
    return this._def.type.naked();
  }
};
m(dg, "ZodPromiseImpl");
var Zx = dg;
var fg = class Cr extends pe {
  constructor() {
    super(...arguments), this._freeze = m((e) => e.status !== "valid" ? e : M(w({}, e), { value: Object.freeze(e.value) }), "_freeze");
  }
  dereference(e) {
    return new Cr(M(w({}, this._def), { innerType: this._def.innerType.dereference(e) }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new Cr(M(w({}, this._def), { innerType: this._def.innerType.clone() }));
  }
  _parse(e) {
    let n = this._def.innerType._parse(e);
    return Ri(n) ? n.then(this._freeze) : this._freeze(n);
  }
  unwrap() {
    return this._def.innerType;
  }
  isEqual(e) {
    return e instanceof Cr ? this._def.innerType.isEqual(e._def.innerType) : false;
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new Cr(M(w({}, this._def), { innerType: this._def.innerType.mandatory() }));
  }
};
m(fg, "ZodReadonlyImpl");
var Lx = fg;
var pg = class Si extends pe {
  get keySchema() {
    return this._def.keyType;
  }
  get valueSchema() {
    return this._def.valueType;
  }
  dereference(e) {
    let n = this._def.keyType.dereference(e), r = this._def.valueType.dereference(e);
    return new Si(M(w({}, this._def), { keyType: n, valueType: r }));
  }
  getReferences() {
    return Lt.unique([...this._def.keyType.getReferences(), ...this._def.valueType.getReferences()]);
  }
  clone() {
    return new Si(M(w({}, this._def), { keyType: this._def.keyType.clone(), valueType: this._def.valueType.clone() }));
  }
  _parse(e) {
    let { status: n, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== "object")
      return X(r, { code: "invalid_type", expected: "object", received: r.parsedType }), { status: "aborted" };
    let o = [], s = this._def.keyType, i = this._def.valueType;
    for (let a in r.data)
      o.push({ key: s._parse(new Zt(r, a, r.path, a)), value: i._parse(new Zt(r, r.data[a], r.path, a)) });
    return r.common.async ? bt.mergeObjectAsync(n, o) : bt.mergeObjectSync(n, o);
  }
  get element() {
    return this._def.valueType;
  }
  isEqual(e) {
    return !(!(e instanceof Si) || !this._def.keyType.isEqual(e._def.keyType) || !this._def.valueType.isEqual(e._def.valueType));
  }
};
m(pg, "ZodRecordImpl");
var Dc = pg;
var gg = class mg extends pe {
  dereference(e) {
    let n = e[this._def.uri];
    return n || this;
  }
  getReferences() {
    return [this._def.uri];
  }
  _parse(e) {
    let n = this._getOrReturnCtx(e);
    return X(n, { code: "unresolved_reference" }), { status: "aborted" };
  }
  isOptional() {
    return false;
  }
  isNullable() {
    return false;
  }
  isEqual(e) {
    return e instanceof mg ? this._def.uri === e._def.uri : false;
  }
};
m(gg, "ZodRefImpl");
var Wx = gg;
var yg = class nr extends pe {
  dereference(e) {
    return new nr(M(w({}, this._def), { valueType: this._def.valueType.dereference(e) }));
  }
  getReferences() {
    return this._def.valueType.getReferences();
  }
  clone() {
    return new nr(M(w({}, this._def), { valueType: this._def.valueType.clone() }));
  }
  _parse(e) {
    let { status: n, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== "set")
      return X(r, { code: "invalid_type", expected: "set", received: r.parsedType }), { status: "aborted" };
    let o = this._def;
    o.minSize !== null && r.data.size < o.minSize.value && (X(r, { code: "too_small", minimum: o.minSize.value, type: "set", inclusive: true, exact: false, message: o.minSize.message }), n.dirty()), o.maxSize !== null && r.data.size > o.maxSize.value && (X(r, { code: "too_big", maximum: o.maxSize.value, type: "set", inclusive: true, exact: false, message: o.maxSize.message }), n.dirty());
    let s = this._def.valueType;
    function i(l) {
      let c = new Set;
      for (let f of l) {
        if (f.status === "aborted")
          return { status: "aborted" };
        f.status === "dirty" && n.dirty(), c.add(f.value);
      }
      return { status: n.value, value: c };
    }
    m(i, "finalizeSet");
    let a = [...r.data.values()].map((l, c) => s._parse(new Zt(r, l, r.path, c)));
    return r.common.async ? Promise.all(a).then((l) => i(l)) : i(a);
  }
  min(e, n) {
    return new nr(M(w({}, this._def), { minSize: { value: e, message: ae.toString(n) } }));
  }
  max(e, n) {
    return new nr(M(w({}, this._def), { maxSize: { value: e, message: ae.toString(n) } }));
  }
  size(e, n) {
    return this.min(e, n).max(e, n);
  }
  nonempty(e) {
    return this.min(1, e);
  }
  isEqual(e) {
    var n, r, o, s;
    if (!(e instanceof nr))
      return false;
    let i = (n = this._def.minSize) == null ? undefined : n.value, a = (r = e._def.minSize) == null ? undefined : r.value;
    if (i !== a)
      return false;
    let l = (o = this._def.maxSize) == null ? undefined : o.value, c = (s = e._def.maxSize) == null ? undefined : s.value;
    return l !== c ? false : this._def.valueType.isEqual(e._def.valueType);
  }
};
m(yg, "ZodSetImpl");
var Kx = yg;
var Fx = /^c[^\s-]{8,}$/i;
var zx = /^[a-z][a-z0-9]*$/;
var qx = /^[0-9A-HJKMNP-TV-Z]{26}$/;
var Gx = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
var Vx = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
var Jx = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
var $o;
var Yx = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
var Xx = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
function hg(t, e) {
  return !!((e === "v4" || !e) && Yx.test(t) || (e === "v6" || !e) && Xx.test(t));
}
m(hg, "isValidIP");
var Tg = class rr extends pe {
  _parse(e) {
    if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== "string") {
      let s = this._getOrReturnCtx(e);
      return X(s, { code: "invalid_type", expected: "string", received: s.parsedType }), { status: "aborted" };
    }
    let r = new bt, o;
    for (let s of this._def.checks)
      if (s.kind === "min")
        e.data.length < s.value && (o = this._getOrReturnCtx(e, o), X(o, { code: "too_small", minimum: s.value, type: "string", inclusive: true, exact: false, message: s.message }), r.dirty());
      else if (s.kind === "max")
        e.data.length > s.value && (o = this._getOrReturnCtx(e, o), X(o, { code: "too_big", maximum: s.value, type: "string", inclusive: true, exact: false, message: s.message }), r.dirty());
      else if (s.kind === "length") {
        let i = e.data.length > s.value, a = e.data.length < s.value;
        (i || a) && (o = this._getOrReturnCtx(e, o), i ? X(o, { code: "too_big", maximum: s.value, type: "string", inclusive: true, exact: true, message: s.message }) : a && X(o, { code: "too_small", minimum: s.value, type: "string", inclusive: true, exact: true, message: s.message }), r.dirty());
      } else if (s.kind === "email")
        Vx.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "email", code: "invalid_string", message: s.message }), r.dirty());
      else if (s.kind === "emoji")
        $o || ($o = new RegExp(Jx, "u")), $o.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "emoji", code: "invalid_string", message: s.message }), r.dirty());
      else if (s.kind === "uuid")
        Gx.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "uuid", code: "invalid_string", message: s.message }), r.dirty());
      else if (s.kind === "cuid")
        Fx.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "cuid", code: "invalid_string", message: s.message }), r.dirty());
      else if (s.kind === "cuid2")
        zx.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "cuid2", code: "invalid_string", message: s.message }), r.dirty());
      else if (s.kind === "ulid")
        qx.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "ulid", code: "invalid_string", message: s.message }), r.dirty());
      else if (s.kind === "url")
        try {
          new URL(e.data);
        } catch {
          o = this._getOrReturnCtx(e, o), X(o, { validation: "url", code: "invalid_string", message: s.message }), r.dirty();
        }
      else
        s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "regex", code: "invalid_string", message: s.message }), r.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (o = this._getOrReturnCtx(e, o), X(o, { code: "invalid_string", validation: { includes: s.value, position: s.position }, message: s.message }), r.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (o = this._getOrReturnCtx(e, o), X(o, { code: "invalid_string", validation: { startsWith: s.value }, message: s.message }), r.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (o = this._getOrReturnCtx(e, o), X(o, { code: "invalid_string", validation: { endsWith: s.value }, message: s.message }), r.dirty()) : s.kind === "datetime" ? vp.generateDatetimeRegex(s).test(e.data) || (o = this._getOrReturnCtx(e, o), X(o, { code: "invalid_string", validation: "datetime", message: s.message }), r.dirty()) : s.kind === "ip" ? hg(e.data, s.version) || (o = this._getOrReturnCtx(e, o), X(o, { validation: "ip", code: "invalid_string", message: s.message }), r.dirty()) : Ot.assertNever(s);
    return { status: r.value, value: e.data };
  }
  _addCheck(e) {
    return new rr(M(w({}, this._def), { checks: [...this._def.checks, e] }));
  }
  email(e) {
    return this._addCheck(w({ kind: "email" }, ae.errToObj(e)));
  }
  url(e) {
    return this._addCheck(w({ kind: "url" }, ae.errToObj(e)));
  }
  emoji(e) {
    return this._addCheck(w({ kind: "emoji" }, ae.errToObj(e)));
  }
  uuid(e) {
    return this._addCheck(w({ kind: "uuid" }, ae.errToObj(e)));
  }
  cuid(e) {
    return this._addCheck(w({ kind: "cuid" }, ae.errToObj(e)));
  }
  cuid2(e) {
    return this._addCheck(w({ kind: "cuid2" }, ae.errToObj(e)));
  }
  ulid(e) {
    return this._addCheck(w({ kind: "ulid" }, ae.errToObj(e)));
  }
  ip(e) {
    return this._addCheck(w({ kind: "ip" }, ae.errToObj(e)));
  }
  datetime(e) {
    var n;
    return typeof e == "string" ? this._addCheck({ kind: "datetime", precision: null, offset: false, message: e }) : this._addCheck(w({ kind: "datetime", precision: typeof e?.precision > "u" ? null : e?.precision, offset: (n = e?.offset) != null ? n : false }, ae.errToObj(e?.message)));
  }
  regex(e, n) {
    return this._addCheck(w({ kind: "regex", regex: e }, ae.errToObj(n)));
  }
  includes(e, n) {
    return this._addCheck(w({ kind: "includes", value: e, position: n?.position }, ae.errToObj(n?.message)));
  }
  startsWith(e, n) {
    return this._addCheck(w({ kind: "startsWith", value: e }, ae.errToObj(n)));
  }
  endsWith(e, n) {
    return this._addCheck(w({ kind: "endsWith", value: e }, ae.errToObj(n)));
  }
  min(e, n) {
    return this._addCheck(w({ kind: "min", value: e }, ae.errToObj(n)));
  }
  max(e, n) {
    return this._addCheck(w({ kind: "max", value: e }, ae.errToObj(n)));
  }
  length(e, n) {
    return this._addCheck(w({ kind: "length", value: e }, ae.errToObj(n)));
  }
  nonempty(e) {
    return this.min(1, ae.errToObj(e));
  }
  trim() {
    return new rr(M(w({}, this._def), { checks: [...this._def.checks, { kind: "trim" }] }));
  }
  secret() {
    return this._def[ke] = M(w({}, this._def[ke]), { secret: true }), this;
  }
  toLowerCase() {
    return new rr(M(w({}, this._def), { checks: [...this._def.checks, { kind: "toLowerCase" }] }));
  }
  toUpperCase() {
    return new rr(M(w({}, this._def), { checks: [...this._def.checks, { kind: "toUpperCase" }] }));
  }
  get isDatetime() {
    return !!this._def.checks.find((e) => e.kind === "datetime");
  }
  get isEmail() {
    return !!this._def.checks.find((e) => e.kind === "email");
  }
  get isURL() {
    return !!this._def.checks.find((e) => e.kind === "url");
  }
  get isEmoji() {
    return !!this._def.checks.find((e) => e.kind === "emoji");
  }
  get isUUID() {
    return !!this._def.checks.find((e) => e.kind === "uuid");
  }
  get isCUID() {
    return !!this._def.checks.find((e) => e.kind === "cuid");
  }
  get isCUID2() {
    return !!this._def.checks.find((e) => e.kind === "cuid2");
  }
  get isULID() {
    return !!this._def.checks.find((e) => e.kind === "ulid");
  }
  get isIP() {
    return !!this._def.checks.find((e) => e.kind === "ip");
  }
  get minLength() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "min" && (e === null || n.value > e) && (e = n.value);
    return e;
  }
  get maxLength() {
    let e = null;
    for (let n of this._def.checks)
      n.kind === "max" && (e === null || n.value < e) && (e = n.value);
    return e;
  }
  isEqual(e) {
    if (!(e instanceof rr))
      return false;
    let n = new Je.CustomSet(this._def.checks), r = new Je.CustomSet(e._def.checks);
    return n.isEqual(r);
  }
};
m(Tg, "ZodStringImpl");
var Qx = Tg;
var vg = class _g extends pe {
  _parse(e) {
    if (this._getType(e) !== "symbol") {
      let r = this._getOrReturnCtx(e);
      return X(r, { code: "invalid_type", expected: "symbol", received: r.parsedType }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof _g;
  }
};
m(vg, "ZodSymbolImpl");
var eP = vg;
var bg = class Or extends pe {
  innerType() {
    return this._def.schema;
  }
  sourceType() {
    return tt.zuiEffects(this._def.schema) ? this._def.schema.sourceType() : this._def.schema;
  }
  dereference(e) {
    return new Or(M(w({}, this._def), { schema: this._def.schema.dereference(e) }));
  }
  getReferences() {
    return this._def.schema.getReferences();
  }
  clone() {
    return new Or(M(w({}, this._def), { schema: this._def.schema.clone() }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e), r = this._def.effect;
    if (r.type === "upstream") {
      let o = r.effect(n.data, { path: n.path });
      if (n.common.async)
        return Promise.resolve(o).then(async (s) => {
          if (s ?? (s = { status: "valid", value: n.data }), this._processResult(n, s), s.status === "aborted")
            return { status: "aborted" };
          let i = await this._def.schema._parseAsync({ data: s.value, path: n.path, parent: n });
          return i.status === "aborted" ? { status: "aborted" } : i.status === "dirty" ? { status: "dirty", value: i.value } : s.status === "dirty" ? { status: "dirty", value: i.value } : i;
        });
      {
        if (o instanceof Promise)
          throw new Error("Asynchronous upstream transform encountered during synchronous parse operation. Use .parseAsync instead.");
        if (o ?? (o = { status: "valid", value: n.data }), this._processResult(n, o), o.status === "aborted")
          return { status: "aborted" };
        let s = this._def.schema._parseSync({ data: o.value, path: n.path, parent: n });
        return s.status === "aborted" ? { status: "aborted" } : s.status === "dirty" ? { status: "dirty", value: s.value } : o.status === "dirty" ? { status: "dirty", value: s.value } : s;
      }
    }
    if (r.type === "downstream")
      if (n.common.async === false) {
        let o = this._def.schema._parseSync({ data: n.data, path: n.path, parent: n });
        if (o.status === "aborted" || o.status === "dirty" && r.failFast)
          return o;
        let s = r.effect(o.value, { path: n.path });
        if (s instanceof Promise)
          throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
        return s ?? (s = { status: "valid", value: o.value }), this._processResult(n, s), s.status === "aborted" ? { status: "aborted" } : s.status === "dirty" ? { status: "dirty", value: s.value } : o.status === "dirty" ? { status: "dirty", value: s.value } : s;
      } else
        return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" || o.status === "dirty" && r.failFast ? o : Promise.resolve(r.effect(o.value, { path: n.path })).then((s) => (s ?? (s = { status: "valid", value: o.value }), this._processResult(n, s), s.status === "aborted" ? { status: "aborted" } : s.status === "dirty" ? { status: "dirty", value: s.value } : o.status === "dirty" ? { status: "dirty", value: s.value } : s)));
    Ot.assertNever(r);
  }
  _processResult(e, n) {
    if (n.status !== "valid")
      for (let r of n.issues)
        X(e, r);
  }
  isEqual(e) {
    return !(e instanceof Or) || !this._def.schema.isEqual(e._def.schema) ? false : this._def.effect.type === "upstream" ? e._def.effect.type !== "upstream" ? false : Ct.compareFunctions(this._def.effect.effect, e._def.effect.effect) : this._def.effect.type === "downstream" ? e._def.effect.type !== "downstream" || this._def.effect.failFast !== e._def.effect.failFast ? false : Ct.compareFunctions(this._def.effect.effect, e._def.effect.effect) : (this._def.effect, false);
  }
  naked() {
    return this._def.schema.naked();
  }
  mandatory() {
    return new Or(M(w({}, this._def), { schema: this._def.schema.mandatory() }));
  }
};
m(bg, "ZodEffectsImpl");
var Ts = bg;
var wg = class Rr extends pe {
  dereference(e) {
    let n = this._def.items.map((o) => o.dereference(e)), r = this._def.rest ? this._def.rest.dereference(e) : null;
    return new Rr(M(w({}, this._def), { items: n, rest: r }));
  }
  getReferences() {
    return Lt.unique([...this._def.items.flatMap((e) => e.getReferences()), ...this._def.rest ? this._def.rest.getReferences() : []]);
  }
  clone() {
    let e = this._def.items.map((r) => r.clone()), n = this._def.rest ? this._def.rest.clone() : null;
    return new Rr(M(w({}, this._def), { items: e, rest: n }));
  }
  _parse(e) {
    let { status: n, ctx: r } = this._processInputParams(e);
    if (r.parsedType !== "array")
      return X(r, { code: "invalid_type", expected: "array", received: r.parsedType }), { status: "aborted" };
    if (r.data.length < this._def.items.length)
      return X(r, { code: "too_small", minimum: this._def.items.length, inclusive: true, exact: false, type: "array" }), { status: "aborted" };
    !this._def.rest && r.data.length > this._def.items.length && (X(r, { code: "too_big", maximum: this._def.items.length, inclusive: true, exact: false, type: "array" }), n.dirty());
    let s = [...r.data].map((i, a) => {
      let l = this._def.items[a] || this._def.rest;
      return l ? l._parse(new Zt(r, i, r.path, a)) : null;
    }).filter((i) => !!i);
    return r.common.async ? Promise.all(s).then((i) => bt.mergeArray(n, i)) : bt.mergeArray(n, s);
  }
  get items() {
    return this._def.items;
  }
  rest(e) {
    return new Rr(M(w({}, this._def), { rest: e }));
  }
  isEqual(e) {
    if (!(e instanceof Rr) || !this._restEquals(e))
      return false;
    let n = m((s, i) => s.isEqual(i), "compare"), r = new Je.CustomSet(this._def.items, { compare: n }), o = new Je.CustomSet(e._def.items, { compare: n });
    return r.isEqual(o);
  }
  _restEquals(e) {
    return this._def.rest === null ? e._def.rest === null : e._def.rest !== null && this._def.rest.isEqual(e._def.rest);
  }
};
m(wg, "ZodTupleImpl");
var tP = wg;
var xg = class Pg extends pe {
  _parse(e) {
    if (this._getType(e) !== "undefined") {
      let r = this._getOrReturnCtx(e);
      return X(r, { code: "invalid_type", expected: "undefined", received: r.parsedType }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof Pg;
  }
  mandatory() {
    return Ne.never(w({}, this._def));
  }
};
m(xg, "ZodUndefinedImpl");
var nP = xg;
var Bg = class Mr extends pe {
  dereference(e) {
    let n = this._def.options.map((r) => r.dereference(e));
    return new Mr(M(w({}, this._def), { options: n }));
  }
  getReferences() {
    return Lt.unique(this._def.options.reduce((e, n) => [...e, ...n.getReferences()], []));
  }
  clone() {
    let e = this._def.options.map((n) => n.clone());
    return new Mr(M(w({}, this._def), { options: e }));
  }
  _parse(e) {
    let { ctx: n } = this._processInputParams(e), r = this._def.options;
    function o(s) {
      for (let a of s)
        if (a.result.status === "valid")
          return a.result;
      for (let a of s)
        if (a.result.status === "dirty")
          return n.common.issues.push(...a.ctx.common.issues), a.result;
      let i = s.map((a) => new Xt(a.ctx.common.issues));
      return X(n, { code: "invalid_union", unionErrors: i }), { status: "aborted" };
    }
    if (m(o, "handleResults"), n.common.async)
      return Promise.all(r.map(async (s) => {
        let i = M(w({}, n), { common: M(w({}, n.common), { issues: [] }), parent: null });
        return { result: await s._parseAsync({ data: n.data, path: n.path, parent: i }), ctx: i };
      })).then(o);
    {
      let s, i = [];
      for (let l of r) {
        let c = M(w({}, n), { common: M(w({}, n.common), { issues: [] }), parent: null }), f = l._parseSync({ data: n.data, path: n.path, parent: c });
        if (f.status === "valid")
          return f;
        f.status === "dirty" && !s && (s = { result: f, ctx: c }), c.common.issues.length && i.push(c.common.issues);
      }
      if (s)
        return n.common.issues.push(...s.ctx.common.issues), s.result;
      let a = i.map((l) => new Xt(l));
      return X(n, { code: "invalid_union", unionErrors: a }), { status: "aborted" };
    }
  }
  get options() {
    return this._def.options;
  }
  isEqual(e) {
    if (!(e instanceof Mr))
      return false;
    let n = m((s, i) => s.isEqual(i), "compare"), r = new Je.CustomSet([...this._def.options], { compare: n }), o = new Je.CustomSet([...e._def.options], { compare: n });
    return r.isEqual(o);
  }
  mandatory() {
    let e = this._def.options.filter((s) => !tt.zuiUndefined(s)).map((s) => s.mandatory()), [n, r, ...o] = e;
    return n ? r ? new Mr(M(w({}, this._def), { options: [n, r, ...o] })) : n : Ne.never(w({}, this._def));
  }
};
m(Bg, "ZodUnionImpl");
var rP = Bg;
var Ig = class Eg extends pe {
  constructor() {
    super(...arguments), this._unknown = true;
  }
  _parse(e) {
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof Eg;
  }
};
m(Ig, "ZodUnknownImpl");
var iP = Ig;
var Sg = class kg extends pe {
  _parse(e) {
    if (this._getType(e) !== "undefined") {
      let r = this._getOrReturnCtx(e);
      return X(r, { code: "invalid_type", expected: "void", received: r.parsedType }), { status: "aborted" };
    }
    return { status: "valid", value: e.data };
  }
  isEqual(e) {
    return e instanceof kg;
  }
};
m(Sg, "ZodVoidImpl");
var oP = Sg;
var sP = m((t) => t instanceof Error, "_isError");
var aP = m((t) => typeof t == "object" && t !== null, "_isObject");
var tt = { zuiError: (t) => t instanceof Xt || sP(t) && ("__type__" in t) && t.__type__ === "ZuiError", zuiType: (t) => t instanceof pe || aP(t) && ("__type__" in t) && t.__type__ === "ZuiType", zuiAny: (t) => t.typeName === "ZodAny", zuiArray: (t) => t.typeName === "ZodArray", zuiBigInt: (t) => t.typeName === "ZodBigInt", zuiBoolean: (t) => t.typeName === "ZodBoolean", zuiBranded: (t) => t.typeName === "ZodBranded", zuiCatch: (t) => t.typeName === "ZodCatch", zuiDate: (t) => t.typeName === "ZodDate", zuiDefault: (t) => t.typeName === "ZodDefault", zuiDiscriminatedUnion: (t) => t.typeName === "ZodDiscriminatedUnion", zuiEnum: (t) => t.typeName === "ZodEnum", zuiFunction: (t) => t.typeName === "ZodFunction", zuiIntersection: (t) => t.typeName === "ZodIntersection", zuiLazy: (t) => t.typeName === "ZodLazy", zuiLiteral: (t) => t.typeName === "ZodLiteral", zuiMap: (t) => t.typeName === "ZodMap", zuiNaN: (t) => t.typeName === "ZodNaN", zuiNativeEnum: (t) => t.typeName === "ZodNativeEnum", zuiNever: (t) => t.typeName === "ZodNever", zuiNull: (t) => t.typeName === "ZodNull", zuiNullable: (t) => t.typeName === "ZodNullable", zuiNumber: (t) => t.typeName === "ZodNumber", zuiObject: (t) => t.typeName === "ZodObject", zuiOptional: (t) => t.typeName === "ZodOptional", zuiPipeline: (t) => t.typeName === "ZodPipeline", zuiPromise: (t) => t.typeName === "ZodPromise", zuiReadonly: (t) => t.typeName === "ZodReadonly", zuiRecord: (t) => t.typeName === "ZodRecord", zuiRef: (t) => t.typeName === "ZodRef", zuiSet: (t) => t.typeName === "ZodSet", zuiString: (t) => t.typeName === "ZodString", zuiSymbol: (t) => t.typeName === "ZodSymbol", zuiEffects: (t) => t.typeName === "ZodEffects", zuiTuple: (t) => t.typeName === "ZodTuple", zuiUndefined: (t) => t.typeName === "ZodUndefined", zuiUnion: (t) => t.typeName === "ZodUnion", zuiUnknown: (t) => t.typeName === "ZodUnknown", zuiVoid: (t) => t.typeName === "ZodVoid" };
var ye = m((t) => {
  if (!t)
    return {};
  let { errorMap: e, invalid_type_error: n, required_error: r, description: o, supportsExtensions: s, [ke]: i } = t;
  if (e && (n || r))
    throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
  let a = i ? Object.fromEntries(Object.entries(i).filter(([c]) => c !== "secret" || s?.includes("secret"))) : undefined;
  return e ? { errorMap: e, description: o, [ke]: a } : { errorMap: m((c, f) => c.code !== "invalid_type" ? { message: f.defaultError } : typeof f.data > "u" ? { message: r ?? f.defaultError } : { message: n ?? f.defaultError }, "customMap"), description: o, [ke]: a };
}, "_processCreateParams");
var Wi = m((t, e = {}, n) => t ? Nn().downstream((r) => {
  var o, s;
  if (!t(r)) {
    let i = typeof e == "function" ? e(r) : typeof e == "string" ? { message: e } : e;
    return ((s = (o = i.fatal) != null ? o : n) != null ? s : true) ? js(w({ code: "custom" }, i)) : $s(r, w({ code: "custom" }, i));
  }
}) : Nn(), "customType");
var vs = m((t, e = { message: `Input not instance of ${t.name}` }) => Wi((n) => n instanceof t, e), "instanceOfType");
var Nn = m((t) => new Tx(w({ typeName: "ZodAny" }, ye(t))), "anyType");
var hn = m((t) => new iP(w({ typeName: "ZodUnknown" }, ye(t))), "unknownType");
var Wr = m((t) => new Nx(w({ typeName: "ZodNever" }, ye(t))), "neverType");
var _s = m((t) => new oP(w({ typeName: "ZodVoid" }, ye(t))), "voidType");
var Vr = m((t) => new Dx(w({ typeName: "ZodNull" }, ye(t))), "nullType");
var Ki = m((t) => new nP(w({ typeName: "ZodUndefined" }, ye(t))), "undefinedType");
var bs = m((t) => new eP(w({ typeName: "ZodSymbol" }, ye(t))), "symbolType");
var ws = m((t) => new Rx(w({ typeName: "ZodNaN" }, ye(t))), "nanType");
var en = m((t) => {
  var e;
  return new Qx(w({ checks: [], typeName: "ZodString", coerce: (e = t?.coerce) != null ? e : false }, ye(M(w({}, t), { supportsExtensions: ["secret"] }))));
}, "stringType");
var Wn = m((t) => new Ux(w({ checks: [], typeName: "ZodNumber", coerce: t?.coerce || false }, ye(t))), "numberType");
var Kn = m((t) => new bx(w({ typeName: "ZodBoolean", coerce: t?.coerce || false }, ye(t))), "booleanType");
var Fi = m((t) => {
  var e;
  return new _x(w({ checks: [], typeName: "ZodBigInt", coerce: (e = t?.coerce) != null ? e : false }, ye(t)));
}, "bigIntType");
var zi = m((t) => new Px(w({ checks: [], coerce: t?.coerce || false, typeName: "ZodDate" }, ye(t))), "dateType");
var qi = m((t) => new Wx({ typeName: "ZodRef", uri: t }), "refType");
var Kr = m((t, e) => new Cx(w({ value: t, typeName: "ZodLiteral" }, ye(e))), "literalType");
var Gi = m((t, e) => new Ex(w({ values: t, typeName: "ZodEnum" }, ye(e))), "enumType");
var xs = m((t, e) => new Mx(w({ values: t, typeName: "ZodNativeEnum" }, ye(e))), "nativeEnumType");
var On = m((t, e) => new vx(w({ type: t, minLength: null, maxLength: null, exactLength: null, typeName: "ZodArray" }, ye(e))), "arrayType");
var sr = m((t, e) => new lg(w({ shape: () => t, unknownKeys: "strip", typeName: "ZodObject" }, ye(e))), "objectType");
var Ps = m((t, e) => new lg(w({ shape: () => t, unknownKeys: "strict", typeName: "ZodObject" }, ye(e))), "strictObjectType");
var Rn = m((t, e) => new rP(w({ options: t, typeName: "ZodUnion" }, ye(e))), "unionType");
var Fr = m((t, e, n) => new Ix(w({ typeName: "ZodDiscriminatedUnion", discriminator: t, options: e }, ye(n))), "discriminatedUnionType");
var Vi = m((t, e, n) => new kx(w({ left: t, right: e, typeName: "ZodIntersection" }, ye(n))), "intersectionType");
var Jr = m((t, e) => {
  if (!Array.isArray(t))
    throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
  return new tP(w({ items: t, typeName: "ZodTuple", rest: null }, ye(e)));
}, "tupleType");
var zr = m((t, e, n) => e instanceof pe ? new Dc(w({ keyType: t, valueType: e, typeName: "ZodRecord" }, ye(n))) : new Dc(w({ keyType: en(), valueType: t, typeName: "ZodRecord" }, ye(e))), "recordType");
var Bs = m((t, e, n) => new Ox(w({ valueType: e, keyType: t, typeName: "ZodMap" }, ye(n))), "mapType");
var Ji = m((t, e) => new Kx(w({ valueType: t, minSize: null, maxSize: null, typeName: "ZodSet" }, ye(e))), "setType");
var Is = m((t, e) => new Ax(w({ getter: t, typeName: "ZodLazy" }, ye(e))), "lazyType");
var Es = m((t, e) => new Zx(w({ type: t, typeName: "ZodPromise" }, ye(e))), "promiseType");
var Ss = m((t, e, n) => new Sx(w({ args: t || Jr([]).rest(hn()), returns: e || hn(), typeName: "ZodFunction" }, ye(n))), "functionType");
var ks = m((t, e, n) => new Ts(w({ schema: e, effect: { type: "upstream", effect: (r, o) => {
  let s = t(r, o);
  return s instanceof Promise ? s.then((i) => Mi(i)) : Mi(s);
} }, typeName: "ZodEffects" }, ye(n))), "preprocessType");
var As = m((t, e, n) => new Ts(w({ schema: e, effect: { type: "upstream", effect: t }, typeName: "ZodEffects" }, ye(n))), "upstreamType");
var Cs = m((t, e, n) => new Ts(w({ schema: t, effect: { type: "downstream", effect: e, failFast: n?.failFast }, typeName: "ZodEffects" }, ye(n))), "downstreamType");
var Os = m((t, e) => new jx(w({ innerType: t, typeName: "ZodOptional" }, ye(e))), "optionalType");
var Rs = m((t, e) => new Hx(w({ innerType: t, typeName: "ZodNullable" }, ye(e))), "nullableType");
var Ms = m((t, e) => new Lx(w({ innerType: t, typeName: "ZodReadonly" }, ye(e))), "readonlyType");
var Ns = m((t, e, n) => new Bx(w({ innerType: t, typeName: "ZodDefault", defaultValue: typeof e == "function" ? e : () => e }, ye(n))), "defaultType");
var Ds = m((t, e, n) => new xx(w({ innerType: t, typeName: "ZodCatch", catchValue: typeof e == "function" ? e : () => e }, ye(n))), "catchType");
var Hs = m((t, e) => new $x({ in: t, out: e, typeName: "ZodPipeline" }), "pipelineType");
var Us = m((t) => new wx(w({ typeName: "ZodBranded", type: t }, ye({ supportsExtensions: ["secret"] }))), "brandedType");
Ip({ any: Nn, array: On, bigint: Fi, boolean: Kn, branded: Us, catch: Ds, custom: Wi, date: zi, default: Ns, discriminatedUnion: Fr, enum: Gi, function: Ss, instanceof: vs, intersection: Vi, lazy: Is, literal: Kr, map: Bs, nan: ws, nativeEnum: xs, never: Wr, null: Vr, nullable: Rs, number: Wn, object: sr, optional: Os, pipeline: Hs, preprocess: ks, upstream: As, downstream: Cs, promise: Es, record: zr, ref: qi, readonly: Ms, set: Ji, strictObject: Ps, string: en, symbol: bs, tuple: Jr, undefined: Ki, union: Rn, unknown: hn, void: _s });
var Ag = { string(t) {
  return en(M(w({}, t), { coerce: true }));
}, number(t) {
  return Wn(M(w({}, t), { coerce: true }));
}, boolean(t) {
  return Kn(M(w({}, t), { coerce: true }));
}, bigint(t) {
  return Fi(M(w({}, t), { coerce: true }));
}, date(t) {
  return zi(M(w({}, t), { coerce: true }));
} };
var Mi = m((t) => ({ status: "valid", value: t }), "OK");
var js = m((t, ...e) => ({ status: "aborted", issues: [t, ...e] }), "ERR");
var $s = m((t, e, ...n) => ({ status: "dirty", value: t, issues: [e, ...n] }), "DIRTY");
var Cg = {};
Rt(Cg, { JSONSchemaToZuiError: () => Yi, ObjectToZuiError: () => ns, UnrepresentableGenericError: () => rs, UnsupportedJSONSchemaToZuiError: () => kn, UnsupportedZuiCheckToJSONSchemaError: () => Ug, UnsupportedZuiToJSONSchemaError: () => dt, UnsupportedZuiToTypescriptSchemaError: () => An, UnsupportedZuiToTypescriptTypeError: () => Fg, UntitledDeclarationError: () => qg, ZuiToJSONSchemaError: () => Xi, ZuiToTypescriptSchemaError: () => Zg, ZuiToTypescriptTypeError: () => Qi, ZuiTransformError: () => ar });
var Og = class extends Error {
  constructor(e, n) {
    super(n), this.transform = e;
  }
};
m(Og, "ZuiTransformError");
var ar = Og;
var Rg = class extends ar {
  constructor(e) {
    super("json-schema-to-zui", e);
  }
};
m(Rg, "JSONSchemaToZuiError");
var Yi = Rg;
var Mg = class extends ar {
  constructor(e) {
    super("object-to-zui", e);
  }
};
m(Mg, "ObjectToZuiError");
var ns = Mg;
var Ng = class extends ar {
  constructor(e) {
    super("zui-to-json-schema", e);
  }
};
m(Ng, "ZuiToJSONSchemaError");
var Xi = Ng;
var Dg = class extends Xi {
  constructor(e, { suggestedAlternative: n } = {}) {
    super(`Zod type ${e} cannot be transformed to JSON Schema.` + (n ? ` Suggested alternative: ${n}` : ""));
  }
};
m(Dg, "UnsupportedZuiToJSONSchemaError");
var dt = Dg;
var Hg = class extends Xi {
  constructor({ zodType: e, checkKind: n }) {
    super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`);
  }
};
m(Hg, "UnsupportedZuiCheckToJSONSchemaError");
var Ug = Hg;
var jg = class extends Yi {
  constructor(e) {
    super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`);
  }
};
m(jg, "UnsupportedJSONSchemaToZuiError");
var kn = jg;
var $g = class extends ar {
  constructor(e) {
    super("zui-to-typescript-schema", e);
  }
};
m($g, "ZuiToTypescriptSchemaError");
var Zg = $g;
var Lg = class extends Zg {
  constructor(e) {
    super(`Zod type ${e} cannot be transformed to TypeScript schema.`);
  }
};
m(Lg, "UnsupportedZuiToTypescriptSchemaError");
var An = Lg;
var Wg = class extends ar {
  constructor(e) {
    super("zui-to-typescript-type", e);
  }
};
m(Wg, "ZuiToTypescriptTypeError");
var Qi = Wg;
var Kg = class extends Qi {
  constructor(e) {
    super(`Zod type ${e} cannot be transformed to TypeScript type.`);
  }
};
m(Kg, "UnsupportedZuiToTypescriptTypeError");
var Fg = Kg;
var zg = class extends Qi {
  constructor() {
    super("Schema must have a title to be transformed to a TypeScript type with a declaration.");
  }
};
m(zg, "UntitledDeclarationError");
var qg = zg;
var Gg = class extends Qi {
  constructor() {
    super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.');
  }
};
m(Gg, "UnrepresentableGenericError");
var rs = Gg;
var lP = m((t) => {
  let e;
  try {
    e = new Function("z", `return ${t}`)(tn);
  } catch (n) {
    return { sucess: false, error: `Failed to evaluate schema: ${(n instanceof Error ? n : new Error(String(n))).message}` };
  }
  return tt.zuiType(e) ? { sucess: true, value: e } : { sucess: false, error: `String "${t}" does not evaluate to a Zod schema` };
}, "evalZuiString");
var fe = { ZodString: "ZodString", ZodNumber: "ZodNumber", ZodNaN: "ZodNaN", ZodBigInt: "ZodBigInt", ZodBoolean: "ZodBoolean", ZodDate: "ZodDate", ZodSymbol: "ZodSymbol", ZodUndefined: "ZodUndefined", ZodNull: "ZodNull", ZodAny: "ZodAny", ZodUnknown: "ZodUnknown", ZodNever: "ZodNever", ZodVoid: "ZodVoid", ZodArray: "ZodArray", ZodObject: "ZodObject", ZodUnion: "ZodUnion", ZodDiscriminatedUnion: "ZodDiscriminatedUnion", ZodIntersection: "ZodIntersection", ZodTuple: "ZodTuple", ZodRecord: "ZodRecord", ZodRef: "ZodRef", ZodMap: "ZodMap", ZodSet: "ZodSet", ZodFunction: "ZodFunction", ZodLazy: "ZodLazy", ZodLiteral: "ZodLiteral", ZodEnum: "ZodEnum", ZodEffects: "ZodEffects", ZodNativeEnum: "ZodNativeEnum", ZodOptional: "ZodOptional", ZodNullable: "ZodNullable", ZodDefault: "ZodDefault", ZodCatch: "ZodCatch", ZodPromise: "ZodPromise", ZodBranded: "ZodBranded", ZodPipeline: "ZodPipeline", ZodReadonly: "ZodReadonly" };
var uP = m((t) => [t.slice(0, t.length / 2), t.slice(t.length / 2)], "half");
var cP = m((t, ...e) => Object.keys(t).reduce((n, r) => (e.includes(r) || (n[r] = t[r]), n), {}), "omit");
function at(t, e, n) {
  var r;
  let o = t[e], s = "";
  if (o !== undefined) {
    let i = n({ value: o, json: JSON.stringify(o) });
    if (i) {
      let a = i[0], l = i.length === 3 ? i[1] : "", c = i.length === 3 ? i[2] : i[1];
      s += a, ((r = t.errorMessage) == null ? undefined : r[e]) !== undefined && (s += l + JSON.stringify(t.errorMessage[e])), s += c;
    }
  }
  return s;
}
m(at, "withMessage");
var Nr = Symbol("Original index");
var dP = m((t) => {
  let e = [];
  for (let n = 0;n < t.length; n++) {
    let r = t[n];
    if (typeof r == "boolean")
      e.push(r ? { [Nr]: n } : { [Nr]: n, not: {} });
    else {
      if (Nr in r)
        return t;
      e.push(M(w({}, r), { [Nr]: n }));
    }
  }
  return e;
}, "ensureOriginalIndex");
function qr(t, e) {
  if (t.allOf.length === 0)
    return "z.never()";
  if (t.allOf.length === 1) {
    let n = t.allOf[0];
    return nt(n, M(w({}, e), { path: [...e.path, "allOf", n[Nr]] }));
  } else {
    let [n, r] = uP(dP(t.allOf));
    return `z.intersection(${qr({ allOf: n }, e)}, ${qr({ allOf: r }, e)})`;
  }
}
m(qr, "parseAllOf");
var Vg = m((t, e) => t.anyOf.length ? t.anyOf.length === 1 ? nt(t.anyOf[0], M(w({}, e), { path: [...e.path, "anyOf", 0] })) : `z.union([${t.anyOf.map((n, r) => nt(n, M(w({}, e), { path: [...e.path, "anyOf", r] }))).join(", ")}])` : "z.any()", "parseAnyOf");
var fP = m((t, e) => {
  if (Array.isArray(t.items))
    return `z.tuple([${t.items.map((r, o) => nt(r, M(w({}, e), { path: [...e.path, "items", o] })))}])`;
  let n = t.items ? `z.array(${nt(t.items, M(w({}, e), { path: [...e.path, "items"] }))})` : "z.array(z.any())";
  return n += at(t, "minItems", ({ json: r }) => [`.min(${r}`, ", ", ")"]), n += at(t, "maxItems", ({ json: r }) => [`.max(${r}`, ", ", ")"]), n;
}, "parseArray");
var pP = m((t) => {
  var e;
  return (e = t[ke]) != null && e.coerce ? "z.coerce.boolean()" : "z.boolean()";
}, "parseBoolean");
var gP = m((t) => `z.literal(${JSON.stringify(t.const)})`, "parseConst");
var mP = m((t) => "z.any()", "parseDefault");
var Zs = m((t, e) => t.oneOf.length ? t.oneOf.length === 1 ? nt(t.oneOf[0], M(w({}, e), { path: [...e.path, "oneOf", 0] })) : `z.any().superRefine((x, ctx) => {
    const schemas = [${t.oneOf.map((n, r) => nt(n, M(w({}, e), { path: [...e.path, "oneOf", r] }))).join(", ")}];
    const errors = schemas.reduce(
      (errors: z.ZodError[], schema) =>
        ((result) => ("error" in result ? [...errors, result.error] : errors))(
          schema.safeParse(x)
        ),
      []
    );
    if (schemas.length - errors.length !== 1) {
      ctx.addIssue({
        path: ctx.path,
        code: "invalid_union",
        unionErrors: errors,
        message: "Invalid input: Should pass single schema",
      });
    }
  })` : "z.any()", "parseOneOf");
var yP = m((t, e) => {
  var n, r;
  if (t.oneOf.length <= 1 || !((n = t.discriminator) != null && n.propertyName))
    return Zs(t, e);
  let o = t.oneOf.map((s, i) => nt(s, M(w({}, e), { path: [...e.path, "oneOf", i] })));
  return `z.discriminatedUnion("${(r = t.discriminator) == null ? undefined : r.propertyName}", [${o.join(", ")}])`;
}, "parseDiscriminator");
var hP = m((t) => t.enum.length === 0 ? "z.never()" : t.enum.length === 1 ? `z.literal(${JSON.stringify(t.enum[0])})` : t.enum.every((e) => typeof e == "string") ? `z.enum([${t.enum.map((e) => JSON.stringify(e))}])` : `z.union([${t.enum.map((e) => `z.literal(${JSON.stringify(e)})`).join(", ")}])`, "parseEnum");
var TP = m((t, e) => {
  let n = nt(t.if, M(w({}, e), { path: [...e.path, "if"] })), r = nt(t.then, M(w({}, e), { path: [...e.path, "then"] })), o = nt(t.else, M(w({}, e), { path: [...e.path, "else"] }));
  return `z.union([${r}, ${o}]).superRefine((value,ctx) => {
  const result = ${n}.safeParse(value).success
    ? ${r}.safeParse(value)
    : ${o}.safeParse(value);
  if (!result.success) {
    result.error.errors.forEach((error) => ctx.addIssue(error))
  }
})`;
}, "parseIfThenElse");
var vP = m((t, e) => `z.union([${t.type.map((n) => nt(M(w({}, t), { type: n }), e)).join(", ")}])`, "parseMultipleType");
var _P = m((t, e) => `z.any().refine((value) => !${nt(t.not, M(w({}, e), { path: [...e.path, "not"] }))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`, "parseNot");
var bP = m((t) => "z.null()", "parseNull");
var wP = m((t, e) => `${nt(cP(t, "nullable"), e, true)}.nullable()`, "parseNullable");
var xP = m((t) => {
  var e;
  let n = "z.number()";
  return (e = t[ke]) != null && e.coerce && (n = "z.coerce.number()"), t.type === "integer" ? n += at(t, "type", () => [".int(", ")"]) : n += at(t, "format", ({ value: r }) => {
    if (r === "int64")
      return [".int(", ")"];
  }), n += at(t, "multipleOf", ({ value: r, json: o }) => r === 1 ? n.startsWith("z.number().int(") ? undefined : [".int(", ")"] : [`.multipleOf(${o}`, ", ", ")"]), typeof t.minimum == "number" ? t.exclusiveMinimum === true ? n += at(t, "minimum", ({ json: r }) => [`.gt(${r}`, ", ", ")"]) : n += at(t, "minimum", ({ json: r }) => [`.gte(${r}`, ", ", ")"]) : typeof t.exclusiveMinimum == "number" && (n += at(t, "exclusiveMinimum", ({ json: r }) => [`.gt(${r}`, ", ", ")"])), typeof t.maximum == "number" ? t.exclusiveMaximum === true ? n += at(t, "maximum", ({ json: r }) => [`.lt(${r}`, ", ", ")"]) : n += at(t, "maximum", ({ json: r }) => [`.lte(${r}`, ", ", ")"]) : typeof t.exclusiveMaximum == "number" && (n += at(t, "exclusiveMaximum", ({ json: r }) => [`.lt(${r}`, ", ", ")"])), n;
}, "parseNumber");
function Jg(t, e) {
  let n;
  t.properties && (Object.keys(t.properties).length ? (n = "z.object({ ", n += Object.keys(t.properties).map((i) => {
    let a = t.properties[i], l = `${JSON.stringify(i)}: ${nt(a, M(w({}, e), { path: [...e.path, "properties", i] }))}`, c = typeof a == "object" && a.default !== undefined || typeof t.default == "object" && t.default !== null && i in t.default, f = Array.isArray(t.required) ? t.required.includes(i) : typeof a == "object" && a.required === true;
    return !c && !f ? `${l}.optional()` : l;
  }).join(", "), n += " })") : n = "z.object({})");
  let r = t.additionalProperties !== undefined ? nt(t.additionalProperties, M(w({}, e), { path: [...e.path, "additionalProperties"] })) : undefined, o;
  if (t.patternProperties) {
    let i = Object.fromEntries(Object.entries(t.patternProperties).map(([a, l]) => [a, nt(l, M(w({}, e), { path: [...e.path, "patternProperties", a] }))], {}));
    o = "", n ? r ? o += `.catchall(z.union([${[...Object.values(i), r].join(", ")}]))` : Object.keys(i).length > 1 ? o += `.catchall(z.union([${Object.values(i).join(", ")}]))` : o += `.catchall(${Object.values(i)})` : r ? o += `z.record(z.union([${[...Object.values(i), r].join(", ")}]))` : Object.keys(i).length > 1 ? o += `z.record(z.union([${Object.values(i).join(", ")}]))` : o += `z.record(${Object.values(i)})`, o += `.superRefine((value, ctx) => {
`, o += `for (const key in value) {
`, r && (t.properties ? o += `let evaluated = [${Object.keys(t.properties).map((a) => JSON.stringify(a)).join(", ")}].includes(key)
` : o += `let evaluated = false
`);
    for (let a in t.patternProperties)
      o += "if (key.match(new RegExp(" + JSON.stringify(a) + `))) {
`, r && (o += `evaluated = true
`), o += "const result = " + i[a] + `.safeParse(value[key])
`, o += `if (!result.success) {
`, o += `ctx.addIssue({
          path: [...ctx.path, key],
          code: 'custom',
          message: \`Invalid input: Key matching regex /\${key}/ must match schema\`,
          params: {
            issues: result.error.issues
          }
        })
`, o += `}
`, o += `}
`;
    r && (o += `if (!evaluated) {
`, o += "const result = " + r + `.safeParse(value[key])
`, o += `if (!result.success) {
`, o += `ctx.addIssue({
          path: [...ctx.path, key],
          code: 'custom',
          message: \`Invalid input: must match catchall schema\`,
          params: {
            issues: result.error.issues
          }
        })
`, o += `}
`, o += `}
`), o += `}
`, o += "})";
  }
  let s = n ? o ? n + o : r ? r === "z.never()" ? n + ".strict()" : n + `.catchall(${r})` : n : o || (r ? `z.record(${r})` : "z.record(z.any())");
  return Ge.an.anyOf(t) && (s += `.and(${Vg(M(w({}, t), { anyOf: t.anyOf.map((i) => typeof i == "object" && !i.type && (i.properties || i.additionalProperties || i.patternProperties) ? M(w({}, i), { type: "object" }) : i) }), e)})`), Ge.a.oneOf(t) && (s += `.and(${Zs(M(w({}, t), { oneOf: t.oneOf.map((i) => typeof i == "object" && !i.type && (i.properties || i.additionalProperties || i.patternProperties) ? M(w({}, i), { type: "object" }) : i) }), e)})`), Ge.an.allOf(t) && (s += `.and(${qr(M(w({}, t), { allOf: t.allOf.map((i) => typeof i == "object" && !i.type && (i.properties || i.additionalProperties || i.patternProperties) ? M(w({}, i), { type: "object" }) : i) }), e)})`), s;
}
m(Jg, "parseObject");
var PP = m((t) => `z.ref('${t.$ref}')`, "parseRef");
var BP = m((t) => {
  var e;
  let n = "z.string()";
  if ((e = t[ke]) != null && e.coerce) {
    if (t.format === "date-time")
      return "z.coerce.date()";
    n = "z.coerce.string()";
  }
  return n += at(t, "format", ({ value: r }) => {
    switch (r) {
      case "email":
        return [".email(", ")"];
      case "ip":
        return [".ip(", ")"];
      case "ipv4":
        return ['.ip({ version: "v4"', ", message: ", " })"];
      case "ipv6":
        return ['.ip({ version: "v6"', ", message: ", " })"];
      case "uri":
        return [".url(", ")"];
      case "uuid":
        return [".uuid(", ")"];
      case "date-time":
        return [".datetime(", ")"];
    }
  }), n += at(t, "pattern", ({ json: r }) => [`.regex(new RegExp(${r})`, ", ", ")"]), n += at(t, "minLength", ({ json: r }) => [`.min(${r}`, ", ", ")"]), n += at(t, "maxLength", ({ json: r }) => [`.max(${r}`, ", ", ")"]), n;
}, "parseString");
var nt = m((t, e = { seen: new Map, path: [] }, n) => {
  if (typeof t != "object")
    return t ? "z.any()" : "z.never()";
  if (e.parserOverride) {
    let s = e.parserOverride(t, e);
    if (typeof s == "string")
      return s;
  }
  let r = e.seen.get(t);
  if (r) {
    if (r.r !== undefined)
      return r.r;
    if (e.depth === undefined || r.n >= e.depth)
      return "z.any()";
    r.n += 1;
  } else
    r = { r: undefined, n: 0 }, e.seen.set(t, r);
  let o = SP(t, e);
  return n || (o = IP(t, o), e.withoutDefaults || (o = EP(t, o))), r.r = o, o;
}, "parseSchema");
var IP = m((t, e) => (t.description && (e += `.describe(${JSON.stringify(t.description)})`), e), "addMeta");
var EP = m((t, e) => (t.default !== undefined && (e += `.default(${JSON.stringify(t.default)})`), e), "addDefaults");
var SP = m((t, e) => Ge.a.nullable(t) ? wP(t, e) : Ge.an.object(t) ? Jg(t, e) : Ge.an.array(t) ? fP(t, e) : Ge.an.anyOf(t) ? Vg(t, e) : Ge.an.allOf(t) ? qr(t, e) : Ge.a.discriminator(t) ? yP(t, e) : Ge.a.oneOf(t) ? Zs(t, e) : Ge.a.not(t) ? _P(t, e) : Ge.an.enum(t) ? hP(t) : Ge.a.const(t) ? gP(t) : Ge.a.multipleType(t) ? vP(t, e) : Ge.a.primitive(t, "string") ? BP(t) : Ge.a.primitive(t, "number") || Ge.a.primitive(t, "integer") ? xP(t) : Ge.a.primitive(t, "boolean") ? pP(t) : Ge.a.primitive(t, "null") ? bP(t) : Ge.a.conditional(t) ? TP(t, e) : Ge.a.ref(t) ? PP(t) : mP(t), "selectParser");
var Ge = { an: { object: (t) => t.type === "object", array: (t) => t.type === "array", anyOf: (t) => t.anyOf !== undefined, allOf: (t) => t.allOf !== undefined, enum: (t) => t.enum !== undefined }, a: { nullable: (t) => t.nullable === true, multipleType: (t) => Array.isArray(t.type), not: (t) => t.not !== undefined, const: (t) => t.const !== undefined, primitive: (t, e) => t.type === e, conditional: (t) => !!(("if" in t) && t.if && ("then" in t) && ("else" in t) && t.then && t.else), discriminator: (t) => {
  var e;
  return t.oneOf !== undefined && ((e = t.discriminator) == null ? undefined : e.propertyName) !== undefined;
}, oneOf: (t) => t.oneOf !== undefined, ref: (t) => t.$ref !== undefined } };
var kP = m((t) => nt(t, { seen: new Map, path: [] }), "jsonSchemaToZodStr");
var AP = m((t) => {
  let e = kP(t);
  e = e.replaceAll("errors: z.ZodError[]", "errors");
  let n = lP(e);
  if (!n.sucess)
    throw new Yi(n.error);
  return n.value;
}, "jsonSchemaToZod");
var Dr = m((t, e) => {
  var n, r;
  if (e[ke] && t._def && (t.naked()._def[ke] = e[ke]), ((n = t._def) == null ? undefined : n.typeName) === "ZodObject" && e.type === "object" && e.properties && Object.entries(e.properties).forEach(([o, s]) => {
    let i = typeof t._def.shape == "function" ? t._def.shape() : t._def.shape;
    i[o] && Dr(i[o], s);
  }), ((r = t._def) == null ? undefined : r.typeName) === "ZodRecord" && e.type === "object" && e.additionalProperties && Dr(t._def.valueType, e.additionalProperties), e.type === "array" && e.items) {
    let o = e.items;
    if (typeof o == "object" && !Array.isArray(o)) {
      let s = t._def.type;
      s && Dr(s, o);
    } else
      Array.isArray(o) && o.forEach((s, i) => {
        let a = t._def;
        a.typeName === fe.ZodTuple && Dr(a.items[i], s);
      });
  }
}, "applyZuiPropsRecursively");
var CP = m((t) => {
  let e = AP(t);
  return Dr(e, t), e;
}, "fromJSONSchemaLegacy");
var OP = m((t) => {
  var e, n;
  return t.anyOf !== undefined && t.anyOf.length === 2 && t.anyOf.some((r) => typeof r != "boolean" && Yg(r)) && ((n = (e = t["x-zui"]) == null ? undefined : e.def) == null ? undefined : n.typeName) === "ZodOptional";
}, "isOptionalSchema");
var RP2 = m((t) => {
  var e, n;
  return t.anyOf !== undefined && t.anyOf.length === 2 && t.anyOf.some((r) => typeof r != "boolean" && r.type === "null") && ((n = (e = t["x-zui"]) == null ? undefined : e.def) == null ? undefined : n.typeName) === "ZodNullable";
}, "isNullableSchema");
var Yg = m((t) => {
  var e, n;
  return t.not === true && ((n = (e = t["x-zui"]) == null ? undefined : e.def) == null ? undefined : n.typeName) === "ZodUndefined";
}, "isUndefinedSchema");
var MP = m((t) => {
  var e, n;
  return !t.not && ((n = (e = t["x-zui"]) == null ? undefined : e.def) == null ? undefined : n.typeName) === "ZodUnknown";
}, "isUnknownSchema");
var NP = m((t) => {
  var e, n;
  return t.anyOf !== undefined && ((n = (e = t["x-zui"]) == null ? undefined : e.def) == null ? undefined : n.typeName) === "ZodDiscriminatedUnion";
}, "isDiscriminatedUnionSchema");
var DP = m((t) => {
  var e, n;
  return t.oneOf !== undefined && ((n = (e = t["x-zui"]) == null ? undefined : e.def) == null ? undefined : n.typeName) === "ZodDiscriminatedUnion";
}, "isExclusiveDiscriminatedUnionSchema");
var HP = m((t, e) => UP(t) ? $P(t, e) : jP(t) ? ZP(t, e) : LP(t, e), "arrayJSONSchemaToZuiArray");
var UP = m((t) => Array.isArray(t.items), "_isTuple");
var jP = m((t) => t.items !== undefined && t.uniqueItems, "_isSet");
var $P = m(({ items: t, additionalItems: e }, n) => {
  let r = t.map(n), o = Jr(r);
  return e !== undefined && (o = o.rest(n(e))), o;
}, "_handleTuple");
var ZP = m(({ items: t, minItems: e, maxItems: n }, r) => {
  let o = Ji(r(t));
  return e && (o = o.min(e)), n && (o = o.max(n)), o;
}, "_handleSet");
var LP = m(({ minItems: t, maxItems: e, items: n }, r) => {
  let o = On(r(n));
  return t && t === e ? o.length(t) : (t && (o = o.min(t)), e && (o = o.max(e)), o);
}, "_handleArray");
var WP = m(({ type: t, minimum: e, exclusiveMinimum: n, maximum: r, exclusiveMaximum: o, multipleOf: s, format: i }) => {
  let a = Wn();
  return t === "integer" && (a = a.int()), i === "finite" && (a = a.finite()), n !== undefined ? a = a.gt(n) : e !== undefined && (a = a.gte(e)), o !== undefined ? a = a.lt(o) : r !== undefined && (a = a.lte(r)), s !== undefined && (a = a.multipleOf(s)), a;
}, "numberJSONSchemaToZuiNumber");
var Ur = {};
Rt(Ur, { escapeSpecialChars: () => KP });
var KP = m((t) => t.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escapeSpecialChars");
function Ls(t, e, n, r) {
  r?.errorMessages && n && (t.errorMessage = M(w({}, t.errorMessage), { [e]: n }));
}
m(Ls, "addErrorMessage");
function Ee(t, e, n, r, o) {
  t[e] = n, Ls(t, e, r, o);
}
m(Ee, "setResponseValueAndErrors");
var Ve = { cuid: "^[cC][^\\s-]{8,}$", cuid2: "^[a-z][a-z0-9]*$", ulid: "^[0-9A-HJKMNP-TV-Z]{26}$", email: "^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$", emoji: "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", uuid: "^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$", ipv4: "^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$", ipv6: "^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$" };
function Ws(t, e) {
  let n = w({ type: "string" }, t.coerce ? { [ke]: { coerce: t.coerce || undefined } } : {});
  function r(o) {
    return e.patternStrategy === "escape" ? Ur.escapeSpecialChars(o) : o;
  }
  if (m(r, "processPattern"), t.checks)
    for (let o of t.checks)
      switch (o.kind) {
        case "min":
          Ee(n, "minLength", typeof n.minLength == "number" ? Math.max(n.minLength, o.value) : o.value, o.message, e);
          break;
        case "max":
          Ee(n, "maxLength", typeof n.maxLength == "number" ? Math.min(n.maxLength, o.value) : o.value, o.message, e);
          break;
        case "email":
          switch (e.emailStrategy) {
            case "format:email":
              Bn(n, "email", o.message, e);
              break;
            case "format:idn-email":
              Bn(n, "idn-email", o.message, e);
              break;
            case "pattern:zod":
              Jt2(n, Ve.email, o.message, e);
              break;
          }
          break;
        case "url":
          Bn(n, "uri", o.message, e);
          break;
        case "uuid":
          Bn(n, "uuid", o.message, e);
          break;
        case "regex":
          Jt2(n, o.regex.source, o.message, e);
          break;
        case "cuid":
          Jt2(n, Ve.cuid, o.message, e);
          break;
        case "cuid2":
          Jt2(n, Ve.cuid2, o.message, e);
          break;
        case "startsWith":
          Jt2(n, "^" + r(o.value), o.message, e);
          break;
        case "endsWith":
          Jt2(n, r(o.value) + "$", o.message, e);
          break;
        case "datetime":
          Bn(n, "date-time", o.message, e);
          break;
        case "length":
          Ee(n, "minLength", typeof n.minLength == "number" ? Math.max(n.minLength, o.value) : o.value, o.message, e), Ee(n, "maxLength", typeof n.maxLength == "number" ? Math.min(n.maxLength, o.value) : o.value, o.message, e);
          break;
        case "includes": {
          Jt2(n, r(o.value), o.message, e);
          break;
        }
        case "ip": {
          o.version !== "v6" && Bn(n, "ipv4", o.message, e), o.version !== "v4" && Bn(n, "ipv6", o.message, e);
          break;
        }
        case "emoji":
          Jt2(n, Ve.emoji, o.message, e);
          break;
        case "ulid": {
          Jt2(n, Ve.ulid, o.message, e);
          break;
        }
        case "toLowerCase":
        case "toUpperCase":
        case "trim":
          break;
        default:
      }
  return n;
}
m(Ws, "parseStringDef");
var Bn = m((t, e, n, r) => {
  var o;
  t.format || (o = t.anyOf) != null && o.some((s) => s.format) ? (t.anyOf || (t.anyOf = []), t.format && (t.anyOf.push(w({ format: t.format }, t.errorMessage && r.errorMessages && { errorMessage: { format: t.errorMessage.format } })), delete t.format, t.errorMessage && (delete t.errorMessage.format, Object.keys(t.errorMessage).length === 0 && delete t.errorMessage)), t.anyOf.push(w({ format: e }, n && r.errorMessages && { errorMessage: { format: n } }))) : Ee(t, "format", e, n, r);
}, "addFormat");
var Jt2 = m((t, e, n, r) => {
  var o;
  t.pattern || (o = t.allOf) != null && o.some((s) => s.pattern) ? (t.allOf || (t.allOf = []), t.pattern && (t.allOf.push(w({ pattern: t.pattern }, t.errorMessage && r.errorMessages && { errorMessage: { pattern: t.errorMessage.pattern } })), delete t.pattern, t.errorMessage && (delete t.errorMessage.pattern, Object.keys(t.errorMessage).length === 0 && delete t.errorMessage)), t.allOf.push(w({ pattern: e }, n && r.errorMessages && { errorMessage: { pattern: n } }))) : Ee(t, "pattern", e, n, r);
}, "addPattern");
var FP = m(({ format: t, pattern: e, minLength: n, maxLength: r }) => {
  let o = en();
  if (n && r && n === r ? o = o.length(n) : (n && (o = o.min(n)), r && (o = o.max(r))), t === "cuid" || e === Ve.cuid)
    o = o.cuid();
  else if (t === "cuid2" || e === Ve.cuid2)
    o = o.cuid2();
  else if (t === "emoji" || e === Ve.emoji)
    o = o.emoji();
  else if (t === "ulid" || e === Ve.ulid)
    o = o.ulid();
  else if (t === "date-time") {
    let { precision: s, offset: i } = e ? bp(e) : {};
    o = o.datetime({ precision: s, offset: i });
  } else
    t === "email" || e === Ve.email ? o = o.email() : t === "ipv4" || e === Ve.ipv4 ? o = o.ip() : t === "ipv6" || e === Ve.ipv6 ? o = o.ip("v6") : t === "uri" ? o = o.url() : t === "uuid" || e === Ve.uuid ? o = o.uuid() : e && (o = o.regex(new RegExp(e)));
  return o;
}, "stringJSONSchemaToZuiString");
var xr = m((t, e) => {
  let n = [];
  e.enum !== undefined && n.push(...e.enum), e.const !== undefined && n.push(e.const);
  let r, o = n.filter((i) => typeof i === t), [s] = o;
  if (s)
    if (o.length === 1)
      r = Kr(s);
    else {
      let i = o.map((a) => Kr(a));
      r = Rn(i);
    }
  else if (t === "string" && e.type === "string" && (r = FP(e)), t === "number" && (e.type === "number" || e.type === "integer") && (r = WP(e)), t === "boolean" && (r = Kn()), t === "null" && (r = Vr()), !r)
    throw new Yi(`Unknown primitive type: "${t}"`);
  return e.description && (r = r.describe(e.description)), r;
}, "toZuiPrimitive");
var In = Nn();
function Xg(t) {
  return $e(t);
}
m(Xg, "fromJSONSchema");
function $e(t) {
  var e, n, r, o, s, i;
  if (t === undefined)
    return In;
  if (t === true)
    return Nn();
  if (t === false)
    return Wr();
  if (t.default !== undefined)
    return $e(M(w({}, t), { default: undefined })).default(t.default);
  if (t.readOnly)
    return $e(M(w({}, t), { readOnly: undefined })).readonly();
  if (t.description !== undefined)
    return $e(M(w({}, t), { description: undefined })).describe(t.description);
  if (t.patternProperties !== undefined)
    throw new kn({ patternProperties: t.patternProperties });
  if (t.propertyNames !== undefined)
    throw new kn({ propertyNames: t.propertyNames });
  if (t.if !== undefined)
    throw new kn({ if: t.if });
  if (t.then !== undefined)
    throw new kn({ then: t.then });
  if (t.else !== undefined)
    throw new kn({ else: t.else });
  if (t.$ref !== undefined)
    return qi(t.$ref);
  if (t.not !== undefined) {
    if (Yg(t))
      return Ki();
    if (t.not === true)
      return Wr();
    throw new kn({ not: t.not });
  }
  if (Array.isArray(t.type)) {
    if (t.type.length === 0)
      return In;
    if (t.type.length === 1)
      return $e(M(w({}, t), { type: t.type[0] }));
    let a = t, { type: l } = a, c = zc(a, ["type"]), f = t.type.map((g) => $e(M(w({}, c), { type: g })));
    return Rn(f);
  }
  if (t.type === "string")
    return t.enum && t.enum.length > 0 ? Gi(t.enum) : xr("string", t);
  if (t.type === "integer") {
    let a = xr("number", t);
    return a.typeName === "ZodNumber" ? a.int() : a;
  }
  if (t.type === "number")
    return xr("number", t);
  if (t.type === "boolean")
    return xr("boolean", t);
  if (t.type === "null")
    return xr("null", t);
  if (t.type === "array")
    return HP(t, $e);
  if (t.type === "object") {
    if (t.additionalProperties !== undefined && t.properties !== undefined) {
      let a = $e(t.additionalProperties);
      return $e(M(w({}, t), { additionalProperties: undefined })).catchall(a);
    }
    if (t.properties !== undefined) {
      let a = {};
      for (let [l, c] of Object.entries(t.properties)) {
        let f = $e(c), g = (e = t.required) != null ? e : [];
        a[l] = g.includes(l) || f.isOptional() ? f : f.optional();
      }
      return sr(a);
    }
    if (t.additionalProperties !== undefined) {
      let a = $e(t.additionalProperties);
      return zr(a);
    }
    return zr(In);
  }
  if (t.anyOf !== undefined) {
    if (t.anyOf.length === 0)
      return In;
    if (t.anyOf.length === 1)
      return $e(t.anyOf[0]);
    if (OP(t))
      return $e(t.anyOf[0]).optional();
    if (RP2(t))
      return $e(t.anyOf[0]).nullable();
    if (NP(t) && ((r = (n = t["x-zui"]) == null ? undefined : n.def) != null && r.discriminator)) {
      let { discriminator: l } = t["x-zui"].def, c = t.anyOf.map($e);
      return Fr(l, c);
    }
    let a = t.anyOf.map($e);
    return Rn(a);
  }
  if (t.oneOf !== undefined) {
    if (t.oneOf.length === 0)
      return In;
    if (t.oneOf.length === 1)
      return $e(t.oneOf[0]);
    if (DP(t)) {
      let l = ((o = t.discriminator) == null ? undefined : o.propertyName) || ((i = (s = t["x-zui"]) == null ? undefined : s.def) == null ? undefined : i.discriminator);
      if (l) {
        let c = t.oneOf.map($e);
        return Fr(l, c);
      }
    }
    let a = t.oneOf.map($e);
    return Rn(a);
  }
  if (t.allOf !== undefined) {
    if (t.allOf.length === 0)
      return In;
    if (t.allOf.length === 1)
      return $e(t.allOf[0]);
    let [a, ...l] = t.allOf, c = $e(a), f = $e({ allOf: l });
    return Vi(c, f);
  }
  return t.type, MP(t) ? hn() : In;
}
m($e, "_fromJSONSchema");
var zP = /^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/;
var is = m((t, e, n = true) => {
  if (typeof t != "object")
    throw new ns("Input must be an object");
  let r = m((i) => {
    let a = i;
    return e?.nullable && (a = a.nullable()), e?.optional && (a = a.optional()), e?.passtrough && tt.zuiObject(a) && (a = a.passthrough()), a;
  }, "applyOptions"), o = Object.entries(t).reduce((i, [a, l]) => {
    if (l === null)
      i[a] = r(Vr());
    else
      switch (typeof l) {
        case "string":
          i[a] = zP.test(l) ? r(en().datetime()) : r(en());
          break;
        case "number":
          i[a] = r(Wn());
          break;
        case "boolean":
          i[a] = r(Kn());
          break;
        case "object":
          if (Array.isArray(l)) {
            let [c] = l;
            if (c == null)
              i[a] = r(On(hn()));
            else if (typeof c == "object")
              i[a] = r(On(is(c, e, false)));
            else if (typeof c == "string" || typeof c == "number" || typeof c == "boolean") {
              let f = qP(c);
              i[a] = r(On(f));
            }
          } else
            i[a] = r(is(l, e, false));
          break;
        default:
          throw new ns(`Unsupported type for key ${a}`);
      }
    return i;
  }, {}), s = Object.keys(o).length > 0;
  return e?.passtrough || !n && !s ? sr(o).passthrough() : sr(o);
}, "fromObject");
var qP = m((t) => typeof t == "string" ? en() : typeof t == "number" ? Wn() : typeof t == "boolean" ? Kn() : hn(), "_getInnerType");
function Qg() {
  return {};
}
m(Qg, "parseAnyDef");
function em(t, e) {
  var n, r;
  let o = { type: "array" };
  return ((r = (n = t.type) == null ? undefined : n._def) == null ? undefined : r.typeName) !== fe.ZodAny && (o.items = Pe(t.type._def, M(w({}, e), { currentPath: [...e.currentPath, "items"] }))), t.minLength && Ee(o, "minItems", t.minLength.value, t.minLength.message, e), t.maxLength && Ee(o, "maxItems", t.maxLength.value, t.maxLength.message, e), t.exactLength && (Ee(o, "minItems", t.exactLength.value, t.exactLength.message, e), Ee(o, "maxItems", t.exactLength.value, t.exactLength.message, e)), o;
}
m(em, "parseArrayDef");
function tm(t, e) {
  let n = w({ type: "integer", format: "int64" }, t.coerce ? { [ke]: { coerce: t.coerce || undefined } } : {});
  if (!t.checks)
    return n;
  for (let r of t.checks)
    switch (r.kind) {
      case "min":
        e.target === "jsonSchema7" ? r.inclusive ? Ee(n, "minimum", r.value, r.message, e) : Ee(n, "exclusiveMinimum", r.value, r.message, e) : (r.inclusive || (n.exclusiveMinimum = true), Ee(n, "minimum", r.value, r.message, e));
        break;
      case "max":
        e.target === "jsonSchema7" ? r.inclusive ? Ee(n, "maximum", r.value, r.message, e) : Ee(n, "exclusiveMaximum", r.value, r.message, e) : (r.inclusive || (n.exclusiveMaximum = true), Ee(n, "maximum", r.value, r.message, e));
        break;
      case "multipleOf":
        Ee(n, "multipleOf", r.value, r.message, e);
        break;
    }
  return n;
}
m(tm, "parseBigintDef");
function nm(t) {
  return w({ type: "boolean" }, t.coerce ? { [ke]: { coerce: t.coerce || undefined } } : {});
}
m(nm, "parseBooleanDef");
function rm(t, e) {
  return Pe(t.type._def, e);
}
m(rm, "parseBrandedDef");
var GP = m((t, e) => Pe(t.innerType._def, e), "parseCatchDef");
function im(t, e) {
  return e.dateStrategy === "integer" ? VP(t, e) : w({ type: "string", format: "date-time" }, t.coerce ? { [ke]: { coerce: t.coerce || undefined } } : {});
}
m(im, "parseDateDef");
var VP = m((t, e) => {
  let n = w({ type: "integer", format: "unix-time" }, t.coerce ? { [ke]: { coerce: t.coerce || undefined } } : {});
  for (let r of t.checks)
    switch (r.kind) {
      case "min":
        e.target === "jsonSchema7" && Ee(n, "minimum", r.value, r.message, e);
        break;
      case "max":
        e.target === "jsonSchema7" && Ee(n, "maximum", r.value, r.message, e);
        break;
    }
  return n;
}, "integerDateParser");
function om(t, e) {
  return M(w({}, Pe(t.innerType._def, e)), { default: t.defaultValue() });
}
m(om, "parseDefaultDef");
function sm(t, e) {
  return e.effectStrategy === "input" ? Pe(t.schema._def, e) : {};
}
m(sm, "parseEffectsDef");
function am(t) {
  return { type: "string", enum: t.values };
}
m(am, "parseEnumDef");
var JP = m((t) => ("type" in t) && t.type === "string" ? false : ("allOf" in t), "isJsonSchema7AllOfType");
function lm(t, e) {
  let n = [Pe(t.left._def, M(w({}, e), { currentPath: [...e.currentPath, "allOf", "0"] })), Pe(t.right._def, M(w({}, e), { currentPath: [...e.currentPath, "allOf", "1"] }))].filter((s) => !!s), r = e.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : undefined, o = [];
  return n.forEach((s) => {
    if (JP(s))
      o.push(...s.allOf), s.unevaluatedProperties === undefined && (r = undefined);
    else {
      let i = s;
      if ("additionalProperties" in s && s.additionalProperties === false) {
        let a = s, { additionalProperties: l } = a;
        i = zc(a, ["additionalProperties"]);
      } else
        r = undefined;
      o.push(i);
    }
  }), o.length ? w({ allOf: o }, r) : undefined;
}
m(lm, "parseIntersectionDef");
function um(t, e) {
  let n = typeof t.value;
  return n !== "bigint" && n !== "number" && n !== "boolean" && n !== "string" ? { type: Array.isArray(t.value) ? "array" : "object" } : e.target === "openApi3" ? { type: n === "bigint" ? "integer" : n, enum: [t.value] } : { type: n === "bigint" ? "integer" : n, const: t.value };
}
m(um, "parseLiteralDef");
function Ks(t, e) {
  var n, r, o, s, i;
  if (e.target === "openApi3" && ((n = t.keyType) == null ? undefined : n._def.typeName) === fe.ZodEnum)
    return { type: "object", required: t.keyType._def.values, properties: t.keyType._def.values.reduce((l, c) => {
      var f;
      return M(w({}, l), { [c]: (f = Pe(t.valueType._def, M(w({}, e), { currentPath: [...e.currentPath, "properties", c] }))) != null ? f : {} });
    }, {}), additionalProperties: false };
  let a = { type: "object", additionalProperties: (r = Pe(t.valueType._def, M(w({}, e), { currentPath: [...e.currentPath, "additionalProperties"] }))) != null ? r : {} };
  if (e.target === "openApi3")
    return a;
  if (((o = t.keyType) == null ? undefined : o._def.typeName) === fe.ZodString && ((s = t.keyType._def.checks) != null && s.length)) {
    let l = Object.entries(Ws(t.keyType._def, e)).reduce((c, [f, g]) => f === "type" ? c : M(w({}, c), { [f]: g }), {});
    return M(w({}, a), { propertyNames: l });
  } else if (((i = t.keyType) == null ? undefined : i._def.typeName) === fe.ZodEnum)
    return M(w({}, a), { propertyNames: { enum: t.keyType._def.values } });
  return a;
}
m(Ks, "parseRecordDef");
function cm(t, e) {
  if (e.mapStrategy === "record")
    return Ks(t, e);
  let n = Pe(t.keyType._def, M(w({}, e), { currentPath: [...e.currentPath, "items", "items", "0"] })) || {}, r = Pe(t.valueType._def, M(w({}, e), { currentPath: [...e.currentPath, "items", "items", "1"] })) || {};
  return { type: "array", maxItems: 125, items: { type: "array", items: [n, r], minItems: 2, maxItems: 2 } };
}
m(cm, "parseMapDef");
function dm(t) {
  let e = t.values, r = Object.keys(t.values).filter((s) => typeof e[e[s]] != "number").map((s) => e[s]), o = Array.from(new Set(r.map((s) => typeof s)));
  return { type: o.length === 1 ? o[0] === "string" ? "string" : "number" : ["string", "number"], enum: r.filter((s) => typeof s == "string" || typeof s == "number") };
}
m(dm, "parseNativeEnumDef");
function fm() {
  return { not: {} };
}
m(fm, "parseNeverDef");
function pm(t) {
  return t.target === "openApi3" ? { enum: ["null"], nullable: true } : { type: "null" };
}
m(pm, "parseNullDef");
var Ni = { ZodString: "string", ZodNumber: "number", ZodBigInt: "integer", ZodBoolean: "boolean", ZodNull: "null" };
function gm(t, e) {
  if (e.target === "openApi3")
    return Hc(t, e);
  let n = t.options instanceof Map ? Array.from(t.options.values()) : t.options;
  if (n.every((r) => (r._def.typeName in Ni) && (!r._def.checks || !r._def.checks.length))) {
    let r = n.reduce((o, s) => {
      let i = Ni[s._def.typeName];
      return i && !o.includes(i) ? [...o, i] : o;
    }, []);
    return { type: r.length > 1 ? r : r[0] };
  } else if (n.every((r) => r._def.typeName === "ZodLiteral" && !r.description)) {
    let r = n.reduce((o, s) => {
      let i = typeof s._def.value;
      switch (i) {
        case "string":
        case "number":
        case "boolean":
          return [...o, i];
        case "bigint":
          return [...o, "integer"];
        case "object":
          if (s._def.value === null)
            return [...o, "null"];
        case "symbol":
        case "undefined":
        case "function":
        default:
          return o;
      }
    }, []);
    if (r.length === n.length) {
      let o = r.filter((s, i, a) => a.indexOf(s) === i);
      return { type: o.length > 1 ? o : o[0], enum: n.reduce((s, i) => s.includes(i._def.value) ? s : [...s, i._def.value], []) };
    }
  } else if (n.every((r) => r._def.typeName === "ZodEnum"))
    return { type: "string", enum: n.reduce((r, o) => [...r, ...o._def.values.filter((s) => !r.includes(s))], []) };
  return Hc(t, e);
}
m(gm, "parseUnionDef");
var Hc = m((t, e) => {
  let n = (t.options instanceof Map ? Array.from(t.options.values()) : t.options).map((o, s) => Pe(o._def, M(w({}, e), { currentPath: [...e.currentPath, e.unionStrategy, `${s}`] }))).filter((o) => !!o && (!e.strictUnions || typeof o == "object" && Object.keys(o).length > 0)), r = e.discriminator && t.typeName === "ZodDiscriminatedUnion" && typeof t.discriminator == "string" ? { discriminator: { propertyName: t.discriminator } } : {};
  if (n.length)
    return e.unionStrategy === "anyOf" ? w({ anyOf: n }, r) : w({ oneOf: n }, r);
}, "asUnionOf");
function mm(t, e) {
  let n = t.innerType;
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(n._def.typeName) && (!n._def.checks || !n._def.checks.length)) {
    if (e.target === "openApi3") {
      let s = { type: Ni[n._def.typeName], nullable: true };
      return os(n._def, e, s);
    }
    let o = { type: [Ni[n._def.typeName], "null"] };
    return os(n._def, e, o);
  }
  if (e.target === "openApi3") {
    let o = Pe(n._def, M(w({}, e), { currentPath: [...e.currentPath] }));
    return o && M(w({}, o), { nullable: true });
  }
  let r = Pe(n._def, M(w({}, e), { currentPath: [...e.currentPath, "anyOf", "0"] }));
  return r && { anyOf: [r, { type: "null" }] };
}
m(mm, "parseNullableDef");
function ym(t, e) {
  let n = w({ type: "number" }, t.coerce ? { [ke]: { coerce: t.coerce || undefined } } : {});
  if (!t.checks)
    return n;
  for (let r of t.checks)
    switch (r.kind) {
      case "int":
        n.type = "integer", Ls(n, "type", r.message, e);
        break;
      case "min":
        e.target === "jsonSchema7" ? r.inclusive ? Ee(n, "minimum", r.value, r.message, e) : Ee(n, "exclusiveMinimum", r.value, r.message, e) : (r.inclusive || (n.exclusiveMinimum = true), Ee(n, "minimum", r.value, r.message, e));
        break;
      case "max":
        e.target === "jsonSchema7" ? r.inclusive ? Ee(n, "maximum", r.value, r.message, e) : Ee(n, "exclusiveMaximum", r.value, r.message, e) : (r.inclusive || (n.exclusiveMaximum = true), Ee(n, "maximum", r.value, r.message, e));
        break;
      case "multipleOf":
        Ee(n, "multipleOf", r.value, r.message, e);
        break;
    }
  return n;
}
m(ym, "parseNumberDef");
var YP = m((t, e) => {
  var n;
  return tt.zuiType(t.unknownKeys) ? t.unknownKeys.typeName === "ZodNever" ? false : (n = Pe(t.unknownKeys._def, M(w({}, e), { currentPath: [...e.currentPath, "additionalProperties"] }))) != null ? n : true : t.unknownKeys === "passthrough";
}, "getAdditionalProperties");
function hm(t, e) {
  let n = M(w({ type: "object" }, Object.entries(t.shape()).reduce((r, [o, s]) => {
    if (s === undefined || s._def === undefined)
      return r;
    let i = Pe(s._def, M(w({}, e), { currentPath: [...e.currentPath, "properties", o], propertyPath: [...e.currentPath, "properties", o] }));
    return i === undefined ? r : { properties: M(w({}, r.properties), { [o]: i }), required: s.isOptional() ? r.required : [...r.required, o] };
  }, { properties: {}, required: [] })), { additionalProperties: YP(t, e) });
  return n.required.length || delete n.required, n;
}
m(hm, "parseObjectDef");
var XP = m((t, e) => {
  var n;
  if (e.currentPath.toString() === ((n = e.propertyPath) == null ? undefined : n.toString()))
    return Pe(t.innerType._def, e);
  let r = Pe(t.innerType._def, M(w({}, e), { currentPath: [...e.currentPath, "anyOf", "1"] }));
  return r ? { anyOf: [{ not: {} }, r] } : {};
}, "parseOptionalDef");
var QP = m((t, e) => {
  if (e.pipeStrategy === "input")
    return Pe(t.in._def, e);
  if (e.pipeStrategy === "output")
    return Pe(t.out._def, e);
  let n = Pe(t.in._def, M(w({}, e), { currentPath: [...e.currentPath, "allOf", "0"] })), r = Pe(t.out._def, M(w({}, e), { currentPath: [...e.currentPath, "allOf", n ? "1" : "0"] }));
  return { allOf: [n, r].filter((o) => o !== undefined) };
}, "parsePipelineDef");
function Tm(t, e) {
  return Pe(t.type._def, e);
}
m(Tm, "parsePromiseDef");
var eB = m((t, e) => Pe(t.innerType._def, e), "parseReadonlyDef");
function vm(t) {
  return { $ref: t.uri };
}
m(vm, "parseRefDef");
function _m(t, e) {
  let r = { type: "array", uniqueItems: true, items: Pe(t.valueType._def, M(w({}, e), { currentPath: [...e.currentPath, "items"] })) };
  return t.minSize && Ee(r, "minItems", t.minSize.value, t.minSize.message, e), t.maxSize && Ee(r, "maxItems", t.maxSize.value, t.maxSize.message, e), r;
}
m(_m, "parseSetDef");
function bm(t, e) {
  return t.rest ? { type: "array", minItems: t.items.length, items: t.items.map((n, r) => Pe(n._def, M(w({}, e), { currentPath: [...e.currentPath, "items", `${r}`] }))).reduce((n, r) => r === undefined ? n : [...n, r], []), additionalItems: Pe(t.rest._def, M(w({}, e), { currentPath: [...e.currentPath, "additionalItems"] })) } : { type: "array", minItems: t.items.length, maxItems: t.items.length, items: t.items.map((n, r) => Pe(n._def, M(w({}, e), { currentPath: [...e.currentPath, "items", `${r}`] }))).reduce((n, r) => r === undefined ? n : [...n, r], []) };
}
m(bm, "parseTupleDef");
function wm() {
  return { not: {} };
}
m(wm, "parseUndefinedDef");
function xm() {
  return {};
}
m(xm, "parseUnknownDef");
function Pe(t, e, n = false) {
  let r = e.seen.get(t);
  if (r && !n) {
    let i = tB(r, e);
    if (i !== undefined)
      return i;
  }
  let o = { def: t, path: e.currentPath, jsonSchema: undefined };
  e.seen.set(t, o);
  let s = rB(t, t.typeName, e);
  return s && os(t, e, s), o.jsonSchema = s, s;
}
m(Pe, "parseDef");
var tB = m((t, e) => {
  switch (e.$refStrategy) {
    case "root":
      return { $ref: t.path.join("/") };
    case "relative":
      return { $ref: nB(e.currentPath, t.path) };
    case "none":
    case "seen":
      return t.path.length < e.currentPath.length && t.path.every((n, r) => e.currentPath[r] === n) ? (console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`), {}) : e.$refStrategy === "seen" ? {} : undefined;
  }
}, "get$ref");
var nB = m((t, e) => {
  let n = 0;
  for (;n < t.length && n < e.length && t[n] === e[n]; n++)
    ;
  return [(t.length - n).toString(), ...e.slice(n)].join("/");
}, "getRelativePath");
var rB = m((t, e, n) => {
  switch (e) {
    case fe.ZodString:
      return Ws(t, n);
    case fe.ZodNumber:
      return ym(t, n);
    case fe.ZodObject:
      return hm(t, n);
    case fe.ZodBigInt:
      return tm(t, n);
    case fe.ZodBoolean:
      return nm(t);
    case fe.ZodDate:
      return im(t, n);
    case fe.ZodUndefined:
      return wm();
    case fe.ZodNull:
      return pm(n);
    case fe.ZodArray:
      return em(t, n);
    case fe.ZodUnion:
    case fe.ZodDiscriminatedUnion:
      return gm(t, n);
    case fe.ZodIntersection:
      return lm(t, n);
    case fe.ZodTuple:
      return bm(t, n);
    case fe.ZodRecord:
      return Ks(t, n);
    case fe.ZodRef:
      return vm(t);
    case fe.ZodLiteral:
      return um(t, n);
    case fe.ZodEnum:
      return am(t);
    case fe.ZodNativeEnum:
      return dm(t);
    case fe.ZodNullable:
      return mm(t, n);
    case fe.ZodOptional:
      return XP(t, n);
    case fe.ZodMap:
      return cm(t, n);
    case fe.ZodSet:
      return _m(t, n);
    case fe.ZodLazy:
      return Pe(t.getter()._def, n);
    case fe.ZodPromise:
      return Tm(t, n);
    case fe.ZodNaN:
    case fe.ZodNever:
      return fm();
    case fe.ZodEffects:
      return sm(t, n);
    case fe.ZodAny:
      return Qg();
    case fe.ZodUnknown:
      return xm();
    case fe.ZodDefault:
      return om(t, n);
    case fe.ZodBranded:
      return rm(t, n);
    case fe.ZodReadonly:
      return eB(t, n);
    case fe.ZodCatch:
      return GP(t, n);
    case fe.ZodPipeline:
      return QP(t, n);
    case fe.ZodFunction:
    case fe.ZodVoid:
    case fe.ZodSymbol:
      return;
    default:
      return ((r) => {})(e);
  }
}, "selectParser");
var os = m((t, e, n) => (t.description && (n.description = t.description, e.markdownDescription && (n.markdownDescription = t.description)), Object.assign(n, { [ke]: w(w({}, t[ke]), n[ke]) }), n), "addMeta");
var Uc = { name: undefined, $refStrategy: "root", basePath: ["#"], effectStrategy: "input", pipeStrategy: "all", dateStrategy: "string", mapStrategy: "entries", definitionPath: "definitions", target: "jsonSchema7", strictUnions: false, definitions: {}, errorMessages: false, markdownDescription: false, patternStrategy: "escape", emailStrategy: "format:email", discriminator: false, unionStrategy: "anyOf" };
var iB = m((t) => typeof t == "string" ? M(w({}, Uc), { name: t }) : w(w({}, Uc), t), "getDefaultOptions");
var oB = m((t) => {
  let e = iB(t), n = e.name !== undefined ? [...e.basePath, e.definitionPath, e.name] : e.basePath;
  return M(w({}, e), { currentPath: n, propertyPath: undefined, seen: new Map(Object.entries(e.definitions).map(([r, o]) => [o._def, { def: o._def, path: [...e.basePath, e.definitionPath, r], jsonSchema: undefined }])) });
}, "getRefs");
var sB = m((t, e) => {
  var n;
  let r = oB(e), o = typeof e == "object" && e.definitions ? Object.entries(e.definitions).reduce((l, [c, f]) => {
    var g;
    return M(w({}, l), { [c]: (g = Pe(f._def, M(w({}, r), { currentPath: [...r.basePath, r.definitionPath, c] }), true)) != null ? g : {} });
  }, {}) : undefined, s = typeof e == "string" ? e : e?.name, i = (n = Pe(t._def, s === undefined ? r : M(w({}, r), { currentPath: [...r.basePath, r.definitionPath, s] }), false)) != null ? n : {}, a = s === undefined ? o ? M(w({}, i), { [r.definitionPath]: o }) : i : { $ref: [...r.$refStrategy === "relative" ? [] : r.basePath, r.definitionPath, s].join("/"), [r.definitionPath]: M(w({}, o), { [s]: i }) };
  return r.target === "jsonSchema7" ? a.$schema = "http://json-schema.org/draft-07/schema#" : r.target === "jsonSchema2019-09" && (a.$schema = "https://json-schema.org/draft/2019-09/schema#"), a;
}, "zodToJsonSchema");
var aB = m((t, e = { target: "openApi3" }) => {
  let n = sB(t, e);
  return e.$schemaUrl === false ? delete n.$schema : typeof e.$schemaUrl == "string" && (n.$schema = e.$schemaUrl), n;
}, "toJSONSchemaLegacy");
var { zuiKey: Zo } = tn;
var lB = m((t, e) => {
  let n = { type: "array", description: t.description, items: e(t._def.type), "x-zui": t._def["x-zui"] };
  return t._def[Zo] && (n[Zo] = t._def[Zo]), t._def.minLength && (n.minItems = t._def.minLength.value), t._def.maxLength && (n.maxItems = t._def.maxLength.value), t._def.exactLength && (n.minItems = t._def.exactLength.value, n.maxItems = t._def.exactLength.value), n;
}, "zodArrayToJsonArray");
var { zuiKey: Lo } = tn;
var uB = m((t) => {
  let e = { type: "number", description: t.description, "x-zui": t._def["x-zui"] };
  t._def[Lo] && (e[Lo] = t._def[Lo]);
  for (let n of t._def.checks)
    switch (n.kind) {
      case "min": {
        let r = n.inclusive ? "minimum" : "exclusiveMinimum", o = n.inclusive ? "exclusiveMinimum" : "minimum";
        e[r] = n.value, delete e[o];
        break;
      }
      case "max": {
        let r = n.inclusive ? "maximum" : "exclusiveMaximum", o = n.inclusive ? "exclusiveMaximum" : "maximum";
        e[r] = n.value, delete e[o];
        break;
      }
      case "int":
        e.type = "integer";
        break;
      case "finite": {
        e.format = "finite";
        break;
      }
      case "multipleOf":
        e.multipleOf = n.value;
        break;
      default:
    }
  return e;
}, "zodNumberToJsonNumber");
var { zuiKey: Wo } = tn;
var cB = m((t, e) => {
  let n = { type: "array", description: t.description, uniqueItems: true, items: e(t._def.valueType), "x-zui": t._def["x-zui"] };
  return t._def[Wo] && (n[Wo] = t._def[Wo]), t._def.minSize && (n.minItems = t._def.minSize.value), t._def.maxSize && (n.maxItems = t._def.maxSize.value), n;
}, "zodSetToJsonSet");
var { zuiKey: Pr } = tn;
var dB = m((t) => {
  let e = { type: "string", description: t.description, "x-zui": t._def["x-zui"] };
  t._def[Pr] && (e[Pr] = t._def[Pr]);
  for (let n of t._def.checks)
    switch (n.kind) {
      case "cuid":
        e.format = "cuid", e.pattern = Ve.cuid;
        break;
      case "cuid2":
        e.format = "cuid2", e.pattern = Ve.cuid2;
        break;
      case "ulid":
        e.format = "ulid", e.pattern = Ve.ulid;
        break;
      case "uuid":
        e.format = "uuid", e.pattern = Ve.uuid;
        break;
      case "emoji":
        e.format = "emoji", e.pattern = Ve.emoji;
        break;
      case "email":
        e.format = "email", e.pattern = Ve.email;
        break;
      case "ip":
        e.format = n.version === "v6" ? "ipv6" : "ipv4", e.pattern = n.version === "v6" ? Ve.ipv6 : Ve.ipv4;
        break;
      case "datetime":
        e.format = "date-time", (n.precision !== null || n.offset) && (e.pattern = _p(n).source, e[Pr] = M(w({}, e[Pr]), { precision: n.precision, offset: n.offset }));
        break;
      case "url":
        e.format = "uri";
        break;
      case "endsWith":
        e.pattern = `${Ur.escapeSpecialChars(n.value)}$`;
        break;
      case "startsWith":
        e.pattern = `^${Ur.escapeSpecialChars(n.value)}`;
        break;
      case "includes":
        let r = n.position && n.position >= 1 ? `^(?:.{${n.position}}).*` : "";
        e.pattern = `${r}${Ur.escapeSpecialChars(n.value)}`;
        break;
      case "regex":
        e.pattern = n.regex.source;
        break;
      case "length":
        e.minLength = e.maxLength = Math.max(0, n.value);
        break;
      case "min":
        e.minLength = Math.max(0, n.value);
        break;
      case "max":
        e.maxLength = Math.max(0, n.value);
        break;
      default:
        throw new Ug({ zodType: "ZodString", checkKind: n.kind });
    }
  return e;
}, "zodStringToJsonString");
var { zuiKey: Ko } = tn;
var fB = m((t, e) => {
  let n = { type: "array", description: t.description, items: t._def.items.map((r) => e(r)) };
  return t._def[Ko] && (n[Ko] = t._def[Ko]), t._def.rest && (n.additionalItems = e(t._def.rest)), n;
}, "zodTupleToJsonTuple");
var pB = { unionStrategy: "anyOf", discriminatedUnionStrategy: "oneOf", discriminator: true };
function et(t, e = {}) {
  let n = w(w({}, pB), e), r = t;
  switch (r.typeName) {
    case "ZodString":
      return dB(r);
    case "ZodNumber":
      return uB(r);
    case "ZodNaN":
      throw new dt("ZodNaN");
    case "ZodBigInt":
      throw new dt("ZodBigInt", { suggestedAlternative: "serialize bigint to string" });
    case "ZodBoolean":
      return { type: "boolean", description: r.description, "x-zui": r._def["x-zui"] };
    case "ZodDate":
      throw new dt("ZodDate", { suggestedAlternative: "use z.string().datetime() instead" });
    case "ZodUndefined":
      return Fo(r);
    case "ZodNull":
      return zo(r);
    case "ZodAny":
      return { description: r.description, "x-zui": r._def["x-zui"] };
    case "ZodUnknown":
      return { description: r.description, "x-zui": M(w({}, r._def["x-zui"]), { def: { typeName: "ZodUnknown" } }) };
    case "ZodNever":
      return { not: true, description: r.description, "x-zui": r._def["x-zui"] };
    case "ZodVoid":
      throw new dt("ZodVoid");
    case "ZodArray":
      return lB(r, (f) => et(f, n));
    case "ZodObject":
      let o = Object.entries(r.shape), s = o.filter(([f, g]) => !g.isOptional()), i = s.length ? s.map(([f]) => f) : undefined, a = o.map(([f, g]) => [f, g.mandatory()]).map(([f, g]) => [f, et(g, n)]);
      return { type: "object", description: r.description, properties: Object.fromEntries(a), required: i, additionalProperties: gB(r._def, n), "x-zui": r._def["x-zui"] };
    case "ZodUnion":
      return n.unionStrategy === "oneOf" ? { description: r.description, oneOf: r.options.map((f) => et(f, n)), "x-zui": r._def["x-zui"] } : { description: r.description, anyOf: r.options.map((f) => et(f, n)), "x-zui": r._def["x-zui"] };
    case "ZodDiscriminatedUnion":
      if (n.discriminatedUnionStrategy === "oneOf") {
        let f = n.discriminator ? { propertyName: r.discriminator } : undefined;
        return { description: r.description, oneOf: r.options.map((g) => et(g, n)), discriminator: f, "x-zui": M(w({}, r._def["x-zui"]), { def: { typeName: "ZodDiscriminatedUnion", discriminator: r.discriminator } }) };
      }
      return { description: r.description, anyOf: r.options.map((f) => et(f, n)), "x-zui": M(w({}, r._def["x-zui"]), { def: { typeName: "ZodDiscriminatedUnion", discriminator: r.discriminator } }) };
    case "ZodIntersection":
      let l = et(r._def.left, n), c = et(r._def.right, n);
      return "additionalProperties" in l && delete l.additionalProperties, "additionalProperties" in c && delete c.additionalProperties, { description: r.description, allOf: [l, c], "x-zui": r._def["x-zui"] };
    case "ZodTuple":
      return fB(r, (f) => et(f, n));
    case "ZodRecord":
      return { type: "object", description: r.description, additionalProperties: et(r._def.valueType, n), "x-zui": r._def["x-zui"] };
    case "ZodMap":
      throw new dt("ZodMap");
    case "ZodSet":
      return cB(r, (f) => et(f, n));
    case "ZodFunction":
      throw new dt("ZodFunction");
    case "ZodLazy":
      throw new dt("ZodLazy");
    case "ZodLiteral":
      if (typeof r.value == "string")
        return { type: "string", description: r.description, const: r.value, "x-zui": r._def["x-zui"] };
      if (typeof r.value == "number")
        return { type: "number", description: r.description, const: r.value, "x-zui": r._def["x-zui"] };
      if (typeof r.value == "boolean")
        return { type: "boolean", description: r.description, const: r.value, "x-zui": r._def["x-zui"] };
      if (r.value === null)
        return zo(r._def);
      if (r.value === undefined)
        return Fo(r._def);
      {
        r.value;
        let f = typeof r.value;
        throw new Xi(`Unsupported literal type: "${f}"`);
      }
    case "ZodEnum":
      return { type: "string", description: r.description, enum: r._def.values, "x-zui": r._def["x-zui"] };
    case "ZodEffects":
      throw new dt("ZodEffects");
    case "ZodNativeEnum":
      throw new dt("ZodNativeEnum");
    case "ZodOptional":
      return { description: r.description, anyOf: [et(r._def.innerType, n), Fo()], "x-zui": M(w({}, r._def["x-zui"]), { def: { typeName: "ZodOptional" } }) };
    case "ZodNullable":
      return { anyOf: [et(r._def.innerType, n), zo()], "x-zui": M(w({}, r._def["x-zui"]), { def: { typeName: "ZodNullable" } }) };
    case "ZodDefault":
      return M(w({}, et(r._def.innerType, n)), { default: r._def.defaultValue() });
    case "ZodCatch":
      throw new dt("ZodCatch");
    case "ZodPromise":
      throw new dt("ZodPromise");
    case "ZodBranded":
      throw new dt("ZodBranded");
    case "ZodPipeline":
      throw new dt("ZodPipeline");
    case "ZodSymbol":
      throw new dt("ZodPipeline");
    case "ZodReadonly":
      return M(w({}, et(r._def.innerType, n)), { readOnly: true });
    case "ZodRef":
      return { $ref: r._def.uri, description: r.description, "x-zui": r._def["x-zui"] };
    default:
      Ot.assertNever(r);
  }
}
m(et, "toJSONSchema");
var Fo = m((t) => ({ not: true, description: t?.description, "x-zui": M(w({}, t?.["x-zui"]), { def: { typeName: "ZodUndefined" } }) }), "undefinedSchema");
var zo = m((t) => ({ type: "null", description: t?.description, "x-zui": t?.["x-zui"] }), "nullSchema");
var gB = m((t, e) => t.unknownKeys === "passthrough" ? true : t.unknownKeys === "strict" || !tt.zuiType(t.unknownKeys) || t.unknownKeys.typeName === "ZodNever" ? false : et(t.unknownKeys, e), "additionalPropertiesSchema");
function Pm(t) {
  return typeof t == "symbol" ? "symbol" : typeof t == "bigint" ? `${t.toString()}n` : ie(t);
}
m(Pm, "primitiveToTypscriptLiteralType");
function ie(t) {
  return typeof t > "u" ? "undefined" : typeof t == "symbol" ? t.description ? `Symbol(${ie(t.description)})` : "Symbol()" : typeof t == "bigint" ? `BigInt(${t.toString()})` : typeof t == "string" ? Em(t) : JSON.stringify(t);
}
m(ie, "primitiveToTypescriptValue");
function ir(t) {
  return typeof t > "u" ? "undefined" : JSON.stringify(t);
}
m(ir, "unknownToTypescriptValue");
var Bm = m((t, e) => {
  let n = Object.entries(t), r = e ? " as const" : "";
  return `{ ${n.map(([o, s]) => `${ss(o)}: ${ir(s)}`).join(", ")} }${r}`;
}, "recordOfUnknownToTypescriptRecord");
var ss = m((t) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : ie(t), "toPropertyKey");
var mB = m((t) => t.charAt(0).toUpperCase() + t.slice(1), "capitalize");
var Im = m((t) => {
  let e = /[^a-zA-Z0-9_]/g;
  return t.split(e).map(mB).filter((r) => !!r).join("");
}, "toTypeArgumentName");
var jc = m((t) => {
  for (var e;t.length && !((e = t[0]) != null && e.trim()); )
    t.shift();
  for (;t.length && !t[t.length - 1].trim(); )
    t.pop();
}, "trimEmptyLinesInPlace");
var Qe = m((t) => {
  t = t?.replace(/(\n(\s*)?){3,}/g, `

`);
  let e = m((o) => o.startsWith("* ") ? ` ${o}` : ` * ${o}`, "ensureLineStartsWithAsterisk"), n = m((o) => o.replace(/\*\//g, "*\\/"), "escapeCommentEnd"), r = (t ?? "").split(`
`).map((o) => o.trim());
  return jc(r), r.length && (r[0] = r[0].replace(/^\/\*\*?/, ""), r[r.length - 1] = r[r.length - 1].replace(/\*\/$/, "")), jc(r), r.length === 0 ? "" : r.length === 1 ? `/** ${n(r[0])} */` : `/**
${r.map(e).map(n).join(`
`)}
 */`;
}, "getMultilineComment");
function Em(t) {
  if (typeof t != "string")
    return "";
  let n = String.raw`${t}`.replace(/\\/g, "\\\\").replace(/\n/g, "\\n").replace(/"/g, "\\\"").replace(/'/g, "\\'");
  return n.includes("`") ? `"${n}"` : n.includes("'") ? `"${n}"` : `'${n}'`;
}
m(Em, "escapeString");
var Sm = ["string", "number", "boolean", "unknown", "void", "any", "null", "undefined", "never", "bigint", "symbol", "object"];
var yB = 5;
var hB = m((t) => Sm.includes(t), "isPrimitive");
var TB = m((t) => Sm.map((e) => `${e}[]`).includes(t), "isArrayOfPrimitives");
var qo = m((t) => t.replace(/ +/g, " ").trim(), "stripSpaces");
var km = class {
  constructor(e, n) {
    this.key = e, this.value = n;
  }
};
m(km, "KeyValue");
var vi = km;
var Am = class {
  constructor(e) {
    this.schema = e;
  }
};
m(Am, "FnParameters");
var $c = Am;
var Cm = class {
  constructor(e) {
    this.schema = e;
  }
};
m(Cm, "FnReturn");
var Zc = Cm;
var Om = class {
  constructor(e) {
    this.props = e;
  }
};
m(Om, "Declaration");
var jr = Om;
function Fs(t, e = {}) {
  let n = bB(t, e), r = xe(n, e);
  return e.formatter && (r = e.formatter(r)), r;
}
m(Fs, "toTypescriptType");
var Lc = m((t) => t.endsWith("?") ? t : `${t}?`, "_optionalKey");
function xe(t, e) {
  var n, r, o;
  let s = M(w({}, e), { declaration: false, parent: t });
  if (t === null)
    return "";
  if (t instanceof jr)
    return vB(t, s);
  if (t instanceof vi) {
    let a;
    if (tt.zuiOptional(t.value) ? a = t.value : tt.zuiDefault(t.value) && e.treatDefaultAsOptional && (a = t.value._def.innerType.optional()), a) {
      let y = a._def.innerType;
      return tt.zuiType(y) && !y.description && a.description && (y = y?.describe(a.description)), xe(new vi(Lc(t.key), y), s);
    }
    let l = Qe(t.value._def.description || t.value.description), c = l?.trim().length > 0 ? `
` : "", f = t.value.describe(""), p = tt.zuiAny(t.value) ? Lc(t.key) : t.key;
    return `${c}${l}${c}${p}: ${xe(f, s)}${c}`;
  }
  if (t instanceof $c) {
    if (tt.zuiTuple(t.schema)) {
      let f = "";
      for (let g = 0;g < t.schema.items.length; g++) {
        let p = (o = (r = (n = t.schema.items[g]) == null ? undefined : n.ui) == null ? undefined : r.title) != null ? o : `arg${g}`, y = t.schema.items[g];
        f += `${xe(new vi(ss(p), y), s)}${g < t.schema.items.length - 1 ? ", " : ""} `;
      }
      return f;
    }
    let a = tt.zuiLiteral(t.schema.naked()), l = xe(t.schema, s).trim();
    return l.startsWith("{") && l.endsWith("}") || l.startsWith("[") && l.endsWith("]") || l.startsWith("(") && l.endsWith(")") || l.startsWith("Array<") && l.endsWith(">") || l.startsWith("Record<") && l.endsWith(">") || TB(l) || a ? `args: ${l}` : l;
  }
  if (t instanceof Zc)
    return tt.zuiOptional(t.schema) ? `${xe(t.schema.unwrap(), s)} | undefined` : xe(t.schema, s);
  let i = t;
  switch (i.typeName) {
    case "ZodString":
      return `${Qe(i.description)} string`.trim();
    case "ZodNumber":
    case "ZodNaN":
    case "ZodBigInt":
      return `${Qe(i.description)} number`.trim();
    case "ZodBoolean":
      return `${Qe(i.description)} boolean`.trim();
    case "ZodDate":
      return `${Qe(i.description)} Date`.trim();
    case "ZodUndefined":
      return `${Qe(i.description)} undefined`.trim();
    case "ZodNull":
      return `${Qe(i.description)} null`.trim();
    case "ZodAny":
      return `${Qe(i.description)} any`.trim();
    case "ZodUnknown":
      return `${Qe(i.description)} unknown`.trim();
    case "ZodNever":
      return `${Qe(i.description)} never`.trim();
    case "ZodVoid":
      return `${Qe(i.description)} void`.trim();
    case "ZodArray":
      let a = xe(i._def.type, s);
      return hB(a) ? `${a}[]` : `Array<${a}>`;
    case "ZodObject":
      return `{ ${Object.entries(i._def.shape()).map(([D, $]) => tt.zuiType($) ? xe(new vi(ss(D), $), s) : `${D}: unknown`).join("; ")} }`;
    case "ZodUnion":
      let c = i._def.options.map((D) => xe(D, s));
      return `${Qe(i.description)}
${c.join(" | ")}`;
    case "ZodDiscriminatedUnion":
      let f = i._def.options.map((D) => xe(D, s));
      return `${Qe(i.description)}
${f.join(" | ")}`;
    case "ZodIntersection":
      return `${xe(i._def.left, s)} & ${xe(i._def.right, s)}`;
    case "ZodTuple":
      return i._def.items.length === 0 ? "[]" : `[${i._def.items.map((D) => xe(D, s)).join(", ")}]`;
    case "ZodRecord":
      let p = xe(i._def.keyType, s), y = xe(i._def.valueType, s);
      return `${Qe(i.description)} { [key: ${p}]: ${y} }`;
    case "ZodMap":
      return `Map<${xe(i._def.keyType, s)}, ${xe(i._def.valueType, s)}>`;
    case "ZodSet":
      return `Set<${xe(i._def.valueType, s)}>`;
    case "ZodFunction":
      let T = xe(new $c(i._def.args), s), P = xe(new Zc(i._def.returns), s), B = e?.parent instanceof jr && e?.parent.props.type === "type";
      return e?.declaration && !B ? `${Qe(i.description)}
(${T}): ${P}` : `${Qe(i.description)}
(${T}) => ${P}`;
    case "ZodLazy":
      return xe(i._def.getter(), s);
    case "ZodLiteral":
      let v = Pm(i._def.value);
      return `${Qe(i.description)}
${v}`.trim();
    case "ZodEnum":
      return i._def.values.map(ie).join(" | ");
    case "ZodEffects":
      return xe(i._def.schema, s);
    case "ZodNativeEnum":
      throw new Fg("ZodNativeEnum");
    case "ZodOptional":
      return `${xe(i._def.innerType, s)} | undefined`;
    case "ZodNullable":
      return `${xe(i._def.innerType, s)} | null`;
    case "ZodDefault":
      let I = e.treatDefaultAsOptional ? i._def.innerType.optional() : i._def.innerType;
      return xe(I, s);
    case "ZodCatch":
      return xe(i._def.innerType, s);
    case "ZodPromise":
      return `Promise<${xe(i._def.type, s)}>`;
    case "ZodBranded":
      return xe(i._def.type, s);
    case "ZodPipeline":
      return xe(i._def.in, s);
    case "ZodSymbol":
      return `${Qe(i.description)} symbol`.trim();
    case "ZodReadonly":
      return `Readonly<${xe(i._def.innerType, s)}>`;
    case "ZodRef":
      return Im(i._def.uri);
    default:
      Ot.assertNever(i);
  }
}
m(xe, "sUnwrapZod");
var vB = m((t, e) => {
  if (t.props.type === "none")
    return xe(t.props.schema, e);
  let { schema: n, identifier: r } = t.props, o = Qe(n.description), s = n.describe(""), i = xe(s, M(w({}, e), { declaration: true })), l = i.split(`
`).length >= yB && e.includeClosingTags ? `// end of ${r}` : "";
  if (t.props.type !== "type" && n.typeName === "ZodFunction")
    return qo(`${o}
declare function ${r}${i};${l}`);
  if (t.props.type === "variable")
    return qo(`${o}declare const ${r}: ${i};${l}`);
  let c = t.props.args.length > 0 ? `<${t.props.args.map(Im).join(", ")}>` : "";
  return qo(`${o}type ${t.props.identifier}${c} = ${i};${l}`);
}, "unwrapDeclaration");
var _B = m((t) => t.declaration ? t.declaration === true ? "variable" : t.declaration : "none", "getDeclarationType");
var bB = m((t, e) => {
  let n = _B(e), r = t.getReferences();
  if (n === "none") {
    if (r.length > 0)
      throw new rs;
    return new jr({ type: "none", schema: t });
  }
  let o = "title" in t.ui ? t.ui.title : null;
  if (!o)
    throw new qg;
  if (n === "variable") {
    if (r.length > 0)
      throw new rs;
    return new jr({ type: "variable", identifier: o, schema: t });
  }
  return new jr({ type: "type", identifier: o, schema: t, args: r });
}, "getDeclarationProps");
var wB = m((t) => {
  let e = [];
  if (t.exactLength) {
    let { value: n, message: r } = t.exactLength;
    e.push(`.length(${ie(n)}, ${ie(r)})`);
  }
  if (t.minLength) {
    let { value: n, message: r } = t.minLength;
    e.push(`.min(${ie(n)}, ${ie(r)})`);
  }
  if (t.maxLength) {
    let { value: n, message: r } = t.maxLength;
    e.push(`.max(${ie(n)}, ${ie(r)})`);
  }
  return e.join("");
}, "generateArrayChecks");
var xB = m((t) => {
  let e = t.checks;
  return e.length === 0 ? "" : e.map(PB).join("");
}, "generateBigIntChecks");
var PB = m((t) => {
  switch (t.kind) {
    case "min":
      return `.min(${ie(t.value)}, ${ie(t.message)})`;
    case "max":
      return `.max(${ie(t.value)}, ${ie(t.message)})`;
    case "multipleOf":
      return `.multipleOf(${ie(t.value)}, ${ie(t.message)})`;
    default:
      return "";
  }
}, "_generateBigIntCheck");
var BB = m((t) => {
  let e = t.checks;
  return e.length === 0 ? "" : e.map(IB).join("");
}, "generateDateChecks");
var IB = m((t) => {
  switch (t.kind) {
    case "min":
      return `.min(${Wc(t.value)}, ${ie(t.message)})`;
    case "max":
      return `.max(${Wc(t.value)}, ${ie(t.message)})`;
    default:
      return "";
  }
}, "_generateDateCheck");
var Wc = m((t) => `new Date(${t})`, "dateTs");
var EB = m((t) => {
  let e = t.checks;
  return e.length === 0 ? "" : e.map(SB).join("");
}, "generateNumberChecks");
var SB = m((t) => {
  switch (t.kind) {
    case "min":
      return `.min(${ie(t.value)}, ${ie(t.message)})`;
    case "max":
      return `.max(${ie(t.value)}, ${ie(t.message)})`;
    case "int":
      return `.int(${ie(t.message)})`;
    case "multipleOf":
      return `.multipleOf(${ie(t.value)}, ${ie(t.message)})`;
    case "finite":
      return `.finite(${ie(t.message)})`;
    default:
      return "";
  }
}, "_generateNumberCheck");
var kB = m((t) => {
  let e = [];
  if (t.minSize) {
    let { value: n, message: r } = t.minSize;
    e.push(`.min(${ie(n)}, ${ie(r)})`);
  }
  if (t.maxSize) {
    let { value: n, message: r } = t.maxSize;
    e.push(`.max(${ie(n)}, ${ie(r)})`);
  }
  return e.join("");
}, "generateSetChecks");
var AB = m((t) => {
  let e = t.checks;
  return e.length === 0 ? "" : e.map(CB).join("");
}, "generateStringChecks");
var CB = m((t) => {
  switch (t.kind) {
    case "min":
      return `.min(${ie(t.value)}, ${ie(t.message)})`;
    case "max":
      return `.max(${ie(t.value)}, ${ie(t.message)})`;
    case "length":
      return `.length(${ie(t.value)}, ${ie(t.message)})`;
    case "email":
      return `.email(${ie(t.message)})`;
    case "url":
      return `.url(${ie(t.message)})`;
    case "emoji":
      return `.emoji(${ie(t.message)})`;
    case "uuid":
      return `.uuid(${ie(t.message)})`;
    case "cuid":
      return `.cuid(${ie(t.message)})`;
    case "cuid2":
      return `.cuid2(${ie(t.message)})`;
    case "ulid":
      return `.ulid(${ie(t.message)})`;
    case "includes":
      let e = ir({ message: t.message, position: t.position });
      return `.includes(${ie(t.value)}, ${e})`;
    case "startsWith":
      return `.startsWith(${ie(t.value)}, ${ie(t.message)})`;
    case "endsWith":
      return `.endsWith(${ie(t.value)}, ${ie(t.message)})`;
    case "regex":
      return `.regex(${String(t.regex)}, ${ie(t.message)})`;
    case "trim":
      return ".trim()";
    case "toLowerCase":
      return ".toLowerCase()";
    case "toUpperCase":
      return ".toUpperCase()";
    case "datetime":
      let r = t.precision === null ? undefined : t.precision;
      return `.datetime(${ir({ message: t.message, precision: r, offset: t.offset })})`;
    case "ip":
      return `.ip(${ir({ message: t.message, version: t.version })})`;
    default:
      return "";
  }
}, "_generateStringCheck");
var { zuiKey: mt } = tn;
function zs(t) {
  return Ze(t);
}
m(zs, "toTypescriptSchema");
function Ze(t) {
  let e = t;
  switch (e.typeName) {
    case "ZodString":
      return `z.string()${AB(e._def)}${Be(e._def)}`.trim();
    case "ZodNumber":
      return `z.number()${EB(e._def)}${Be(e._def)}`.trim();
    case "ZodNaN":
      return `z.nan()${Be(e._def)}`.trim();
    case "ZodBigInt":
      return `z.bigint()${xB(e._def)}${Be(e._def)}`.trim();
    case "ZodBoolean":
      return `z.boolean()${Be(e._def)}`.trim();
    case "ZodDate":
      return `z.date()${BB(e._def)}${Be(e._def)}`.trim();
    case "ZodUndefined":
      return `z.undefined()${Be(e._def)}`.trim();
    case "ZodNull":
      return `z.null()${Be(e._def)}`.trim();
    case "ZodAny":
      return `z.any()${Be(e._def)}`.trim();
    case "ZodUnknown":
      return `z.unknown()${Be(e._def)}`.trim();
    case "ZodNever":
      return `z.never()${Be(e._def)}`.trim();
    case "ZodVoid":
      return `z.void()${Be(e._def)}`.trim();
    case "ZodArray":
      return `z.array(${Ze(e._def.type)})${wB(e._def)}${Be(e._def, e._def.type)}`;
    case "ZodObject":
      let n = ex(e.shape, Ze), r = e.additionalProperties(), o = r ? `.catchall(${Ze(r)})` : "";
      return ["z.object({", ...Object.entries(n).map(([Q, Y]) => `  ${Q}: ${Y},`), `})${o}${Be(e._def)}`].join(`
`).trim();
    case "ZodUnion":
      return `z.union([${e._def.options.map(Ze).join(", ")}])${Be(e._def)}`.trim();
    case "ZodDiscriminatedUnion":
      let i = e._def.options.map(Ze);
      return `z.discriminatedUnion(${ie(e._def.discriminator)}, [${i.join(", ")}])${Be(e._def)}`.trim();
    case "ZodIntersection":
      let l = Ze(e._def.left), c = Ze(e._def.right);
      return `z.intersection(${l}, ${c})${Be(e._def)}`.trim();
    case "ZodTuple":
      return `z.tuple([${e._def.items.map(Ze).join(", ")}])${Be(e._def)}`.trim();
    case "ZodRecord":
      let g = Ze(e._def.keyType), p = Ze(e._def.valueType);
      return `z.record(${g}, ${p})${Be(e._def)}`.trim();
    case "ZodMap":
      let y = Ze(e._def.keyType), T = Ze(e._def.valueType);
      return `z.map(${y}, ${T})${Be(e._def)}`.trim();
    case "ZodSet":
      return `z.set(${Ze(e._def.valueType)})${kB(e._def)}${Be(e._def)}`.trim();
    case "ZodFunction":
      let P = e._def.args.items.map(Ze), B = P.length ? `.args(${P.join(", ")})` : "", v = Ze(e._def.returns);
      return `z.function()${B}.returns(${v})${Be(e._def)}`.trim();
    case "ZodLazy":
      return `z.lazy(() => ${Ze(e._def.getter())})${Be(e._def)}`.trim();
    case "ZodLiteral":
      return `z.literal(${ie(e._def.value)})${Be(e._def)}`.trim();
    case "ZodEnum":
      return `z.enum([${e._def.values.map(ie).join(", ")}])${Be(e._def)}`.trim();
    case "ZodEffects":
      throw new An("ZodEffects");
    case "ZodNativeEnum":
      throw new An("ZodNativeEnum");
    case "ZodOptional":
      return `z.optional(${Ze(e._def.innerType)})${Be(e._def, e._def.innerType)}`.trim();
    case "ZodNullable":
      return `z.nullable(${Ze(e._def.innerType)})${Be(e._def, e._def.innerType)}`.trim();
    case "ZodDefault":
      let D = ir(e._def.defaultValue());
      return `z.default(${Ze(e._def.innerType)}, ${D})${Be(e._def, e._def.innerType)}`.trim();
    case "ZodCatch":
      throw new An("ZodCatch");
    case "ZodPromise":
      return `z.promise(${Ze(e._def.type)})${Be(e._def, e._def.type)}`.trim();
    case "ZodBranded":
      throw new An("ZodBranded");
    case "ZodPipeline":
      throw new An("ZodPipeline");
    case "ZodSymbol":
      throw new An("ZodSymbol");
    case "ZodReadonly":
      return `z.readonly(${Ze(e._def.innerType)})${Be(e._def, e._def.innerType)}`.trim();
    case "ZodRef":
      return `z.ref(${ie(e._def.uri)})${Be(e._def)}`.trim();
    default:
      Ot.assertNever(e);
  }
}
m(Ze, "sUnwrapZod");
var Be = m((t, e) => {
  let n = e?._def;
  return `${RB(t, n)}${OB(t, n)}`;
}, "_addMetadata");
var OB = m((t, e) => !t.description || e && e.description === t.description ? "" : `.describe(${ie(t.description)})`, "_maybeDescribe");
var RB = m((t, e) => `${MB(t, e)}${NB(t, e)}${DB(t, e)}${HB(t, e)}${UB(t, e)}${jB(t, e)}${$B(t, e)}`, "_addZuiExtensions");
var MB = m((t, e) => {
  var n, r;
  let o = (n = t[mt]) == null ? undefined : n.title;
  return !o || e && ((r = e[mt]) == null ? undefined : r.title) === o ? "" : `.title(${ie(o)})`;
}, "_maybeTitle");
var NB = m((t, e) => {
  var n, r;
  let o = (n = t[mt]) == null ? undefined : n.displayAs;
  return !o || e && mn((r = e[mt]) == null ? undefined : r.displayAs, o) ? "" : `.displayAs(${Bm({ id: o[0], params: o[1] })})`;
}, "_maybeDisplayAs");
var DB = m((t, e) => {
  var n, r;
  let o = (n = t[mt]) == null ? undefined : n.disabled;
  return !o || e && ((r = e[mt]) == null ? undefined : r.disabled) === o ? "" : `.disabled(${o})`;
}, "_maybeDisabled");
var HB = m((t, e) => {
  var n, r;
  let o = (n = t[mt]) == null ? undefined : n.hidden;
  return !o || e && ((r = e[mt]) == null ? undefined : r.hidden) === o ? "" : `.hidden(${o})`;
}, "_maybeHidden");
var UB = m((t, e) => {
  var n, r;
  let o = (n = t[mt]) == null ? undefined : n.placeholder;
  return !o || e && ((r = e[mt]) == null ? undefined : r.placeholder) === o ? "" : `.placeholder(${ie(o)})`;
}, "_maybePlaceholder");
var jB = m((t, e) => {
  var n, r;
  let o = (n = t[mt]) == null ? undefined : n.secret;
  return !o || e && ((r = e[mt]) == null ? undefined : r.secret) === o ? "" : ".secret()";
}, "_maybeSecret");
var $B = m((t, e) => {
  var n, r;
  let o = ["title", "tooltip", "displayAs", "disabled", "hidden", "placeholder", "secret", "coerce"], s = Object.entries((n = t[mt]) != null ? n : {}).filter(([i]) => !o.includes(i));
  if (s.length === 0)
    return "";
  if (e) {
    let i = Object.entries((r = e[mt]) != null ? r : {}).filter(([a]) => !o.includes(a));
    if (mn(Object.fromEntries(s), Object.fromEntries(i)))
      return "";
  }
  return `.metadata(${Bm(Object.fromEntries(s))})`;
}, "_maybeSetMetadata");
var ZB = {};
pe.prototype.toJSONSchema = function(t = {}) {
  return et(this, t);
};
pe.prototype.toTypescriptType = function(t = {}) {
  return Fs(this, t);
};
pe.prototype.toTypescriptSchema = function() {
  return zs(this);
};
var rt = ne.string().min(1);
var Mm = ne.object({ text: rt });
var Nm = ne.object({ markdown: rt });
var Dm = ne.object({ imageUrl: rt, title: rt.optional() });
var Hm = ne.object({ audioUrl: rt, title: rt.optional() });
var Um = ne.object({ videoUrl: rt, title: rt.optional() });
var jm = ne.object({ fileUrl: rt, title: rt.optional() });
var $m = ne.object({ latitude: ne.number(), longitude: ne.number(), address: ne.string().optional(), title: ne.string().optional() });
var Zm = ne.object({ title: rt, subtitle: rt.optional(), imageUrl: rt.optional(), actions: ne.array(ne.object({ action: ne.enum(["postback", "url", "say"]), label: rt, value: rt })) });
var Rm = ne.object({ text: rt, options: ne.array(ne.object({ label: rt, value: rt })) });
var LB = ne.object({ items: ne.array(Zm) });
var Lm = ne.union([ne.object({ type: ne.literal("text"), payload: Mm }), ne.object({ type: ne.literal("image"), payload: Dm }), ne.object({ type: ne.literal("audio"), payload: Hm }), ne.object({ type: ne.literal("video"), payload: Um }), ne.object({ type: ne.literal("file"), payload: jm }), ne.object({ type: ne.literal("location"), payload: $m })]);
var WB = ne.object({ items: ne.array(Lm) });
var KB = { schema: Nm };
var FB = { schema: ne.object({ items: ne.array(ne.union([...Lm.options, ne.object({ type: ne.literal("markdown"), payload: Nm })])) }) };
var zB = { text: { schema: Mm }, image: { schema: Dm }, audio: { schema: Hm }, video: { schema: Um }, file: { schema: jm }, location: { schema: $m }, carousel: { schema: LB }, card: { schema: Zm }, dropdown: { schema: Rm }, choice: { schema: Rm }, bloc: { schema: WB } };
S();
A();
k();
var mC = { HIDDEN_IN_STUDIO: { bpActionHiddenInStudio: "true" }, AWAIT_RETURN: { bpActionAwaitReturn: "true" } };
var yC = "x-bp-integration-identifier";
S();
A();
k();
S();
A();
k();
var qs = console;
function Nt(t) {
  if (!t.body)
    throw new Error("Missing body");
  return JSON.parse(t.body);
}
async function wo(t, e = 8072, n = YS) {
  if (!import_browser_or_node.isNode)
    throw new Error("This function can only be called in Node.js");
  let o = (Zh(), YT($h)).createServer(async (s, i) => {
    try {
      let a = await GS(s);
      if (a.path === "/health") {
        i.writeHead(200).end("ok");
        return;
      }
      let l = await t(a);
      i.writeHead(l?.status ?? 200, l?.headers ?? {}).end(l?.body ?? "{}");
    } catch (a) {
      let l = a instanceof Error ? a.message : String(a);
      qs.error("Error while handling request", { error: l ?? "Internal error occured" }), i.writeHead(500).end(JSON.stringify({ error: l ?? "Internal error occured" }));
    }
  });
  return o.listen(e, () => n(e)), o;
}
async function GS(t) {
  let e = await JS(t), n = {};
  for (let o = 0;o < t.rawHeaders.length; o += 2) {
    let s = t.rawHeaders[o].toLowerCase(), i = t.rawHeaders[o + 1];
    n[s] = i;
  }
  let r = new URL(t.url ?? "", t.headers.host ? `http://${t.headers.host}` : "http://botpress.cloud");
  return { body: e, path: r.pathname, query: VS(r.search, "?"), headers: n, method: t.method?.toUpperCase() ?? "GET" };
}
function VS(t, e) {
  return t.indexOf(e) === 0 ? t.slice(e.length) : t;
}
async function JS(t) {
  return new Promise((e, n) => {
    if (t.method !== "POST" && t.method !== "PUT" && t.method !== "PATCH")
      return e(undefined);
    let r = "";
    t.on("data", (o) => r += o.toString()), t.on("error", (o) => n(o)), t.on("end", () => e(r));
  });
}
function YS(t) {
  qs.info(`Listening on port ${t}`);
}
S();
A();
k();
S();
A();
k();
var Lh = {};
pn(Lh, { DefinitionError: () => vt, isDefinitionError: () => XS });
S();
A();
k();
var vt = class extends Error {
  __IS_SDK_ERROR__ = true;
  type = "definition_error";
};
var XS = (t) => t instanceof vt || typeof t == "object" && t !== null && ("__IS_SDK_ERROR__" in t) && t.__IS_SDK_ERROR__ === true && ("type" in t) && t.type === "definition_error";
S();
A();
k();
S();
A();
k();
var je = {};
pn(je, { mapKeys: () => tk, mapValues: () => ek, mergeRecords: () => rk, pairs: () => xo, stripUndefinedProps: () => nk, values: () => QS });
S();
A();
k();
var xo = (t) => Object.entries(t);
var QS = (t) => Object.values(t);
var ek = (t, e) => Object.fromEntries(xo(t).map(([n, r]) => [n, e(r, n)]));
var tk = (t, e) => Object.fromEntries(xo(t).map(([n, r]) => [e(n), r]));
var nk = (t) => Object.fromEntries(xo(t).filter(([, e]) => e !== undefined));
var rk = (t, e, n) => {
  let r = [...Object.keys(t), ...Object.keys(e)], o = [...new Set(r)], s = {};
  for (let i of o) {
    let a = t[i], l = e[i];
    a && l ? s[i] = n(a, l) : a ? s[i] = a : l && (s[i] = l);
  }
  return s;
};
var ue = {};
pn(ue, { safePush: () => ik, unique: () => ok });
S();
A();
k();
var ik = (t, ...e) => t ? [...t, ...e] : [...e];
var ok = (t) => Array.from(new Set(t));
S();
A();
k();
var ut = {};
pn(ut, { setName: () => sk });
S();
A();
k();
var sk = (t, e) => (Object.defineProperty(t, "name", { value: e }), t);
var Wh = (t) => {
  let { name: e, version: n } = t, r = { actions: {}, events: {}, channels: {} }, o = { name: e, version: n, entities: je.mapValues(t.entities, (i) => ({ name: i.name })), actions: {}, events: {}, channels: {} }, s = je.mapValues(t.entities, (i) => i.schema);
  for (let [i, a] of Object.entries(t.definition.actions ?? {})) {
    let l = a.input.schema.dereference(s), c = a.output.schema.dereference(s), f = t.actions?.[i]?.name ?? i;
    r.actions[f] = { ...a, ...t.actions?.[i] ?? {}, input: { schema: l }, output: { schema: c } }, o.actions[i] = { name: f };
  }
  for (let [i, a] of Object.entries(t.definition.events ?? {})) {
    let l = a.schema.dereference(s), c = t.events?.[i]?.name ?? i;
    r.events[c] = { ...a, ...t.events?.[i] ?? {}, schema: l }, o.events[i] = { name: c };
  }
  for (let [i, a] of Object.entries(t.definition.channels ?? {})) {
    let l = {};
    for (let [f, g] of Object.entries(a.messages)) {
      let p = g.schema.dereference(s);
      l[f] = { ...g, schema: p };
    }
    let c = t.channels?.[i]?.name ?? i;
    r.channels[c] = { ...a, ...t.channels?.[i] ?? {}, message: { ...a.message ?? {}, tags: { ...a.message?.tags ?? {}, ...t.channels?.[i]?.message?.tags ?? {} } }, conversation: { ...a.conversation ?? {}, tags: { ...a.conversation?.tags ?? {}, ...t.channels?.[i]?.conversation?.tags ?? {} } }, messages: l }, o.channels[i] = { name: c };
  }
  return { resolved: r, statement: o };
};
S();
A();
k();
var Kh = "6.11.1";
var bn = Kh;
S();
A();
k();
var Po = Symbol("schemaName");
var Fh = (t) => t ? je.mapValues(t, (n, r) => ({ ...n, [Po]: r })) : {};
var zh = (t) => (Po in t) && t[Po] !== undefined;
var qh = (t) => t[Po];
S();
A();
k();
var Ka = class {
  constructor(e) {
    this.props = e;
    this.name = e.name, this.version = e.version, this.icon = e.icon, this.readme = e.readme, this.title = e.title, this.identifier = e.identifier, this.description = e.description, this.configuration = e.configuration, this.configurations = e.configurations, this.events = e.events, this.actions = e.actions, this.channels = e.channels, this.states = e.states, this.user = e.user, this.secrets = e.secrets, this.entities = e.entities, this.interfaces = e.interfaces, this.__advanced = e.__advanced, this.attributes = e.attributes;
  }
  name;
  version;
  title;
  description;
  icon;
  readme;
  configuration;
  configurations;
  events;
  actions;
  channels;
  states;
  user;
  secrets;
  identifier;
  entities;
  interfaces;
  __advanced;
  attributes;
  get metadata() {
    return { sdkVersion: bn };
  }
  extend(e, n) {
    let { entities: r, actions: o, events: s, channels: i } = this._callBuilder(e, n), a = this;
    a.interfaces ??= {};
    let l = Object.values(r).map((p) => p.name), c = l.length === 0 ? e.name : `${e.name}<${l.join(",")}>`, { resolved: f, statement: g } = Wh({ ...e, entities: r, actions: je.stripUndefinedProps(o), events: je.stripUndefinedProps(s), channels: je.stripUndefinedProps(i) });
    return a.actions = je.mergeRecords(a.actions ?? {}, f.actions, this._mergeActions), a.channels = je.mergeRecords(a.channels ?? {}, f.channels, this._mergeChannels), a.events = je.mergeRecords(a.events ?? {}, f.events, this._mergeEvents), a.interfaces[c] = { id: e.id, ...g }, this;
  }
  _callBuilder(e, n) {
    let o = { entities: Fh(this.entities) }, s = n(o), i = je.pairs(s.entities).find(([l, c]) => !zh(c));
    if (i)
      throw new vt(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);
    return { entities: je.mapValues(s.entities, (l) => ({ name: qh(l), schema: l.schema })), actions: s.actions ?? {}, events: s.events ?? {}, channels: s.channels ?? {} };
  }
  _mergeActions = (e, n) => ({ ...e, ...n, input: { schema: this._mergeObjectSchemas(e.input.schema, n.input.schema) }, output: { schema: this._mergeObjectSchemas(e.output.schema, n.output.schema) } });
  _mergeEvents = (e, n) => ({ ...e, ...n, schema: this._mergeObjectSchemas(e.schema, n.schema) });
  _mergeChannels = (e, n) => {
    let r = je.mergeRecords(e.messages, n.messages, this._mergeMessage), o;
    (e.conversation || n.conversation) && (o = { tags: { ...e.conversation?.tags, ...n.conversation?.tags } });
    let s;
    return (e.message || n.message) && (s = { tags: { ...e.message?.tags, ...n.message?.tags } }), { ...e, ...n, messages: r, conversation: o, message: s };
  };
  _mergeMessage = (e, n) => ({ schema: this._mergeObjectSchemas(e.schema, n.schema) });
  _mergeObjectSchemas = (e, n) => {
    let r = e._def, o = n._def;
    if (r.typeName === "ZodObject" && o.typeName === "ZodObject") {
      let s = r.shape(), i = o.shape();
      return ne.object({ ...s, ...i });
    }
    if (r.typeName === "ZodRecord" && o.typeName === "ZodRecord")
      return ne.record(ne.intersection(r.valueType, o.valueType));
    throw new Error("Cannot merge object schemas with record schemas");
  };
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
var Bo = { retries: 3, retryCondition: (t) => $a.isNetworkOrIdempotentRequestError(t) || [429, 502].includes(t.response?.status ?? 0), retryDelay: (t, e) => (lk(e.response?.headers ?? {}) ?? t) * 1000 };
var lk = (t) => {
  let e = ["RateLimit-Reset", "X-RateLimit-Reset", "Retry-After", "ratelimit-reset", "x-ratelimit-reset", "retry-after"];
  for (let n of e) {
    let r = t[n];
    if (r !== undefined)
      return uk(String(r));
  }
};
var uk = (t) => {
  let e = ck(t) ? dk(t) : t.length > 0 ? parseInt(t, 10) : undefined;
  return e === undefined || isNaN(e) ? undefined : e;
};
var ck = (t) => t.includes(" ");
var dk = (t) => {
  let e = fk(t);
  if (!e)
    return;
  let n = new Date;
  return Math.max(0, Math.floor((e.getTime() - n.getTime()) / 1000));
};
var fk = (t) => {
  let e = new Date(t);
  return isNaN(e.getTime()) ? undefined : e;
};
S();
A();
k();
S();
A();
k();
var oi = class {
  constructor(e) {
    this._client = e;
  }
  get _inner() {
    return this._client;
  }
  createConversation = (e) => this._client.createConversation(e);
  getConversation = (e) => this._client.getConversation(e);
  listConversations = (e) => this._client.listConversations(e);
  getOrCreateConversation = (e) => this._client.getOrCreateConversation(e);
  updateConversation = (e) => this._client.updateConversation(e);
  deleteConversation = (e) => this._client.deleteConversation(e);
  listParticipants = (e) => this._client.listParticipants(e);
  addParticipant = (e) => this._client.addParticipant(e);
  getParticipant = (e) => this._client.getParticipant(e);
  removeParticipant = (e) => this._client.removeParticipant(e);
  createEvent = (e) => this._client.createEvent(e);
  getEvent = (e) => this._client.getEvent(e);
  listEvents = (e) => this._client.listEvents(e);
  createMessage = (e) => this._client.createMessage(e);
  getOrCreateMessage = (e) => this._client.getOrCreateMessage(e);
  getMessage = (e) => this._client.getMessage(e).then((n) => n);
  updateMessage = (e) => this._client.updateMessage(e).then((n) => n);
  listMessages = (e) => this._client.listMessages(e);
  deleteMessage = (e) => this._client.deleteMessage(e);
  initializeIncomingMessage = (e) => this._client.initializeIncomingMessage(e);
  createUser = (e) => this._client.createUser(e);
  getUser = (e) => this._client.getUser(e);
  listUsers = (e) => this._client.listUsers(e);
  getOrCreateUser = (e) => this._client.getOrCreateUser(e);
  updateUser = (e) => this._client.updateUser(e);
  deleteUser = (e) => this._client.deleteUser(e);
  getState = (e) => this._client.getState(e);
  setState = (e) => this._client.setState(e);
  getOrSetState = (e) => this._client.getOrSetState(e);
  patchState = (e) => this._client.patchState(e);
  configureIntegration = (e) => this._client.configureIntegration(e);
  uploadFile = (e) => this._client.uploadFile(e);
  upsertFile = (e) => this._client.upsertFile(e);
  deleteFile = (e) => this._client.deleteFile(e);
  listFiles = (e) => this._client.listFiles(e);
  getFile = (e) => this._client.getFile(e);
  updateFileMetadata = (e) => this._client.updateFileMetadata(e);
  trackAnalytics = (e) => this._client.trackAnalytics(e);
};
S();
A();
k();
var Io = class {
  _cost = 0;
  get cost() {
    return this._cost;
  }
  setCost(e) {
    this._cost = e;
  }
  toJSON() {
    return { cost: this.cost };
  }
};
S();
A();
k();
S();
A();
k();
var Dt = "#";
var Eo = "x-bot-id";
var Vh = "x-bot-user-id";
var Jh = "x-integration-id";
var Yh = "x-integration-alias";
var Xh = "x-webhook-id";
var Qh = "x-bp-configuration-type";
var So = "x-bp-configuration";
var ko = "x-bp-operation";
var eT = "x-bp-type";
S();
A();
k();
var Et = (t) => {
  throw t instanceof Error ? t : new Error(t);
};
var o0 = ne.enum(["webhook_received", "message_created", "action_triggered", "register", "unregister", "ping", "create_user", "create_conversation"]);
var tT = (t) => ({ botId: t[Eo] || Et("Missing bot header"), botUserId: t[Vh] || Et("Missing bot user header"), integrationId: t[Jh] || Et("Missing integration header"), integrationAlias: t[Yh] || Et("Missing integration alias header"), webhookId: t[Xh] || Et("Missing webhook header"), operation: t[ko] || Et("Missing operation header"), configurationType: t[Qh] ?? null, configuration: JSON.parse(z.from(t[So] || Et("Missing configuration header"), "base64").toString("utf-8")) });
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var za = {};
var nT = false;
function fl() {
  return nT || (nT = true, za = function() {
    if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
      return false;
    if (typeof Symbol.iterator == "symbol")
      return true;
    var e = {}, n = Symbol("test"), r = Object(n);
    if (typeof n == "string" || Object.prototype.toString.call(n) !== "[object Symbol]" || Object.prototype.toString.call(r) !== "[object Symbol]")
      return false;
    var o = 42;
    e[n] = o;
    for (n in e)
      return false;
    if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
      return false;
    var s = Object.getOwnPropertySymbols(e);
    if (s.length !== 1 || s[0] !== n || !Object.prototype.propertyIsEnumerable.call(e, n))
      return false;
    if (typeof Object.getOwnPropertyDescriptor == "function") {
      var i = Object.getOwnPropertyDescriptor(e, n);
      if (i.value !== o || i.enumerable !== true)
        return false;
    }
    return true;
  }), za;
}
var qa = {};
var rT = false;
function pk() {
  return rT || (rT = true, qa = Error), qa;
}
var Ga = {};
var iT = false;
function gk() {
  return iT || (iT = true, Ga = EvalError), Ga;
}
var Va = {};
var oT = false;
function mk() {
  return oT || (oT = true, Va = RangeError), Va;
}
var Ja = {};
var sT = false;
function yk() {
  return sT || (sT = true, Ja = ReferenceError), Ja;
}
var Ya = {};
var aT = false;
function xT() {
  return aT || (aT = true, Ya = SyntaxError), Ya;
}
var Xa = {};
var lT = false;
function Ao() {
  return lT || (lT = true, Xa = TypeError), Xa;
}
var Qa = {};
var uT = false;
function hk() {
  return uT || (uT = true, Qa = URIError), Qa;
}
var el = {};
var cT = false;
function Tk() {
  if (cT)
    return el;
  cT = true;
  var t = typeof Symbol < "u" && Symbol, e = fl();
  return el = function() {
    return typeof t != "function" || typeof Symbol != "function" || typeof t("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? false : e();
  }, el;
}
var tl = {};
var dT = false;
function vk() {
  if (dT)
    return tl;
  dT = true;
  var t = { __proto__: null, foo: {} }, e = Object;
  return tl = function() {
    return { __proto__: t }.foo === t.foo && !(t instanceof e);
  }, tl;
}
var nl = {};
var fT = false;
function _k() {
  if (fT)
    return nl;
  fT = true;
  var t = "Function.prototype.bind called on incompatible ", e = Object.prototype.toString, n = Math.max, r = "[object Function]", o = function(l, c) {
    for (var f = [], g = 0;g < l.length; g += 1)
      f[g] = l[g];
    for (var p = 0;p < c.length; p += 1)
      f[p + l.length] = c[p];
    return f;
  }, s = function(l, c) {
    for (var f = [], g = c, p = 0;g < l.length; g += 1, p += 1)
      f[p] = l[g];
    return f;
  }, i = function(a, l) {
    for (var c = "", f = 0;f < a.length; f += 1)
      c += a[f], f + 1 < a.length && (c += l);
    return c;
  };
  return nl = function(l) {
    var c = this;
    if (typeof c != "function" || e.apply(c) !== r)
      throw new TypeError(t + c);
    for (var f = s(arguments, 1), g, p = function() {
      if (this instanceof g) {
        var v = c.apply(this, o(f, arguments));
        return Object(v) === v ? v : this;
      }
      return c.apply(l, o(f, arguments));
    }, y = n(0, c.length - f.length), T = [], P = 0;P < y; P++)
      T[P] = "$" + P;
    if (g = Function("binder", "return function (" + i(T, ",") + "){ return binder.apply(this,arguments); }")(p), c.prototype) {
      var B = function() {};
      B.prototype = c.prototype, g.prototype = new B, B.prototype = null;
    }
    return g;
  }, nl;
}
var rl = {};
var pT = false;
function pl() {
  if (pT)
    return rl;
  pT = true;
  var t = _k();
  return rl = Function.prototype.bind || t, rl;
}
var il = {};
var gT = false;
function bk() {
  if (gT)
    return il;
  gT = true;
  var t = Function.prototype.call, e = Object.prototype.hasOwnProperty, n = pl();
  return il = n.call(t, e), il;
}
var ol = {};
var mT = false;
function ai() {
  if (mT)
    return ol;
  mT = true;
  var t, e = pk(), n = gk(), r = mk(), o = yk(), s = xT(), i = Ao(), a = hk(), l = Function, c = function(Re) {
    try {
      return l('"use strict"; return (' + Re + ").constructor;")();
    } catch {}
  }, f = Object.getOwnPropertyDescriptor;
  if (f)
    try {
      f({}, "");
    } catch {
      f = null;
    }
  var g = function() {
    throw new i;
  }, p = f ? function() {
    try {
      return arguments.callee, g;
    } catch {
      try {
        return f(arguments, "callee").get;
      } catch {
        return g;
      }
    }
  }() : g, y = Tk()(), T = vk()(), P = Object.getPrototypeOf || (T ? function(Re) {
    return Re.__proto__;
  } : null), B = {}, v = typeof Uint8Array > "u" || !P ? t : P(Uint8Array), E = { __proto__: null, "%AggregateError%": typeof AggregateError > "u" ? t : AggregateError, "%Array%": Array, "%ArrayBuffer%": typeof ArrayBuffer > "u" ? t : ArrayBuffer, "%ArrayIteratorPrototype%": y && P ? P([][Symbol.iterator]()) : t, "%AsyncFromSyncIteratorPrototype%": t, "%AsyncFunction%": B, "%AsyncGenerator%": B, "%AsyncGeneratorFunction%": B, "%AsyncIteratorPrototype%": B, "%Atomics%": typeof Atomics > "u" ? t : Atomics, "%BigInt%": typeof BigInt > "u" ? t : BigInt, "%BigInt64Array%": typeof BigInt64Array > "u" ? t : BigInt64Array, "%BigUint64Array%": typeof BigUint64Array > "u" ? t : BigUint64Array, "%Boolean%": Boolean, "%DataView%": typeof DataView > "u" ? t : DataView, "%Date%": Date, "%decodeURI%": decodeURI, "%decodeURIComponent%": decodeURIComponent, "%encodeURI%": encodeURI, "%encodeURIComponent%": encodeURIComponent, "%Error%": e, "%eval%": eval, "%EvalError%": n, "%Float32Array%": typeof Float32Array > "u" ? t : Float32Array, "%Float64Array%": typeof Float64Array > "u" ? t : Float64Array, "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? t : FinalizationRegistry, "%Function%": l, "%GeneratorFunction%": B, "%Int8Array%": typeof Int8Array > "u" ? t : Int8Array, "%Int16Array%": typeof Int16Array > "u" ? t : Int16Array, "%Int32Array%": typeof Int32Array > "u" ? t : Int32Array, "%isFinite%": isFinite, "%isNaN%": isNaN, "%IteratorPrototype%": y && P ? P(P([][Symbol.iterator]())) : t, "%JSON%": typeof JSON == "object" ? JSON : t, "%Map%": typeof Map > "u" ? t : Map, "%MapIteratorPrototype%": typeof Map > "u" || !y || !P ? t : P(new Map()[Symbol.iterator]()), "%Math%": Math, "%Number%": Number, "%Object%": Object, "%parseFloat%": parseFloat, "%parseInt%": parseInt, "%Promise%": typeof Promise > "u" ? t : Promise, "%Proxy%": typeof Proxy > "u" ? t : Proxy, "%RangeError%": r, "%ReferenceError%": o, "%Reflect%": typeof Reflect > "u" ? t : Reflect, "%RegExp%": RegExp, "%Set%": typeof Set > "u" ? t : Set, "%SetIteratorPrototype%": typeof Set > "u" || !y || !P ? t : P(new Set()[Symbol.iterator]()), "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? t : SharedArrayBuffer, "%String%": String, "%StringIteratorPrototype%": y && P ? P(""[Symbol.iterator]()) : t, "%Symbol%": y ? Symbol : t, "%SyntaxError%": s, "%ThrowTypeError%": p, "%TypedArray%": v, "%TypeError%": i, "%Uint8Array%": typeof Uint8Array > "u" ? t : Uint8Array, "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? t : Uint8ClampedArray, "%Uint16Array%": typeof Uint16Array > "u" ? t : Uint16Array, "%Uint32Array%": typeof Uint32Array > "u" ? t : Uint32Array, "%URIError%": a, "%WeakMap%": typeof WeakMap > "u" ? t : WeakMap, "%WeakRef%": typeof WeakRef > "u" ? t : WeakRef, "%WeakSet%": typeof WeakSet > "u" ? t : WeakSet };
  if (P)
    try {
      null.error;
    } catch (Re) {
      var I = P(P(Re));
      E["%Error.prototype%"] = I;
    }
  var D = function Re(ve) {
    var we;
    if (ve === "%AsyncFunction%")
      we = c("async function () {}");
    else if (ve === "%GeneratorFunction%")
      we = c("function* () {}");
    else if (ve === "%AsyncGeneratorFunction%")
      we = c("async function* () {}");
    else if (ve === "%AsyncGenerator%") {
      var se = Re("%AsyncGeneratorFunction%");
      se && (we = se.prototype);
    } else if (ve === "%AsyncIteratorPrototype%") {
      var de = Re("%AsyncGenerator%");
      de && P && (we = P(de.prototype));
    }
    return E[ve] = we, we;
  }, $ = { __proto__: null, "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }, Q = pl(), Y = bk(), ce = Q.call(Function.call, Array.prototype.concat), re = Q.call(Function.apply, Array.prototype.splice), ee = Q.call(Function.call, String.prototype.replace), Ie = Q.call(Function.call, String.prototype.slice), We = Q.call(Function.call, RegExp.prototype.exec), Xe = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, ze = /\\(\\)?/g, qe = function(ve) {
    var we = Ie(ve, 0, 1), se = Ie(ve, -1);
    if (we === "%" && se !== "%")
      throw new s("invalid intrinsic syntax, expected closing `%`");
    if (se === "%" && we !== "%")
      throw new s("invalid intrinsic syntax, expected opening `%`");
    var de = [];
    return ee(ve, Xe, function(N, Z, W, le) {
      de[de.length] = W ? ee(le, ze, "$1") : Z || N;
    }), de;
  }, pt = function(ve, we) {
    var se = ve, de;
    if (Y($, se) && (de = $[se], se = "%" + de[0] + "%"), Y(E, se)) {
      var N = E[se];
      if (N === B && (N = D(se)), typeof N > "u" && !we)
        throw new i("intrinsic " + ve + " exists, but is not available. Please file an issue!");
      return { alias: de, name: se, value: N };
    }
    throw new s("intrinsic " + ve + " does not exist!");
  };
  return ol = function(ve, we) {
    if (typeof ve != "string" || ve.length === 0)
      throw new i("intrinsic name must be a non-empty string");
    if (arguments.length > 1 && typeof we != "boolean")
      throw new i('"allowMissing" argument must be a boolean');
    if (We(/^%?[^%]*%?$/, ve) === null)
      throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
    var se = qe(ve), de = se.length > 0 ? se[0] : "", N = pt("%" + de + "%", we), Z = N.name, W = N.value, le = false, ge = N.alias;
    ge && (de = ge[0], re(se, ce([0, 1], ge)));
    for (var R = 1, C = true;R < se.length; R += 1) {
      var j = se[R], V = Ie(j, 0, 1), te = Ie(j, -1);
      if ((V === '"' || V === "'" || V === "`" || te === '"' || te === "'" || te === "`") && V !== te)
        throw new s("property names with quotes must have matching quotes");
      if ((j === "constructor" || !C) && (le = true), de += "." + j, Z = "%" + de + "%", Y(E, Z))
        W = E[Z];
      else if (W != null) {
        if (!(j in W)) {
          if (!we)
            throw new i("base intrinsic for " + ve + " exists, but the property is not available.");
          return;
        }
        if (f && R + 1 >= se.length) {
          var b = f(W, j);
          C = !!b, C && "get" in b && !("originalValue" in b.get) ? W = b.get : W = W[j];
        } else
          C = Y(W, j), W = W[j];
        C && !le && (E[Z] = W);
      }
    }
    return W;
  }, ol;
}
var sl = {};
var yT = false;
function gl() {
  if (yT)
    return sl;
  yT = true;
  var t = ai(), e = t("%Object.defineProperty%", true) || false;
  if (e)
    try {
      e({}, "a", { value: 1 });
    } catch {
      e = false;
    }
  return sl = e, sl;
}
var al = {};
var hT = false;
function Co() {
  if (hT)
    return al;
  hT = true;
  var t = ai(), e = t("%Object.getOwnPropertyDescriptor%", true);
  if (e)
    try {
      e([], "length");
    } catch {
      e = null;
    }
  return al = e, al;
}
var ll = {};
var TT = false;
function wk() {
  if (TT)
    return ll;
  TT = true;
  var t = gl(), e = xT(), n = Ao(), r = Co();
  return ll = function(s, i, a) {
    if (!s || typeof s != "object" && typeof s != "function")
      throw new n("`obj` must be an object or a function`");
    if (typeof i != "string" && typeof i != "symbol")
      throw new n("`property` must be a string or a symbol`");
    if (arguments.length > 3 && typeof arguments[3] != "boolean" && arguments[3] !== null)
      throw new n("`nonEnumerable`, if provided, must be a boolean or null");
    if (arguments.length > 4 && typeof arguments[4] != "boolean" && arguments[4] !== null)
      throw new n("`nonWritable`, if provided, must be a boolean or null");
    if (arguments.length > 5 && typeof arguments[5] != "boolean" && arguments[5] !== null)
      throw new n("`nonConfigurable`, if provided, must be a boolean or null");
    if (arguments.length > 6 && typeof arguments[6] != "boolean")
      throw new n("`loose`, if provided, must be a boolean");
    var l = arguments.length > 3 ? arguments[3] : null, c = arguments.length > 4 ? arguments[4] : null, f = arguments.length > 5 ? arguments[5] : null, g = arguments.length > 6 ? arguments[6] : false, p = !!r && r(s, i);
    if (t)
      t(s, i, { configurable: f === null && p ? p.configurable : !f, enumerable: l === null && p ? p.enumerable : !l, value: a, writable: c === null && p ? p.writable : !c });
    else if (g || !l && !c && !f)
      s[i] = a;
    else
      throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
  }, ll;
}
var ul = {};
var vT = false;
function xk() {
  if (vT)
    return ul;
  vT = true;
  var t = gl(), e = function() {
    return !!t;
  };
  return e.hasArrayLengthDefineBug = function() {
    if (!t)
      return null;
    try {
      return t([], "length", { value: 1 }).length !== 1;
    } catch {
      return true;
    }
  }, ul = e, ul;
}
var cl = {};
var _T = false;
function Pk() {
  if (_T)
    return cl;
  _T = true;
  var t = ai(), e = wk(), n = xk()(), r = Co(), o = Ao(), s = t("%Math.floor%");
  return cl = function(a, l) {
    if (typeof a != "function")
      throw new o("`fn` is not a function");
    if (typeof l != "number" || l < 0 || l > 4294967295 || s(l) !== l)
      throw new o("`length` must be a positive 32-bit integer");
    var c = arguments.length > 2 && !!arguments[2], f = true, g = true;
    if ("length" in a && r) {
      var p = r(a, "length");
      p && !p.configurable && (f = false), p && !p.writable && (g = false);
    }
    return (f || g || !c) && (n ? e(a, "length", l, true, true) : e(a, "length", l)), a;
  }, cl;
}
var si = {};
var bT = false;
function ml() {
  if (bT)
    return si;
  bT = true;
  var t = pl(), e = ai(), n = Pk(), r = Ao(), o = e("%Function.prototype.apply%"), s = e("%Function.prototype.call%"), i = e("%Reflect.apply%", true) || t.call(s, o), a = gl(), l = e("%Math.max%");
  si = function(g) {
    if (typeof g != "function")
      throw new r("a function is required");
    var p = i(t, s, arguments);
    return n(p, 1 + l(0, g.length - (arguments.length - 1)), true);
  };
  var c = function() {
    return i(t, o, arguments);
  };
  return a ? a(si, "apply", { value: c }) : si.apply = c, si;
}
var dl = {};
var wT = false;
function yl() {
  if (wT)
    return dl;
  wT = true;
  var t = ai(), e = ml(), n = e(t("String.prototype.indexOf"));
  return dl = function(o, s) {
    var i = t(o, !!s);
    return typeof i == "function" && n(o, ".prototype.") > -1 ? e(i) : i;
  }, dl;
}
Gs();
da();
var hl = {};
var PT = false;
function El() {
  if (PT)
    return hl;
  PT = true;
  var t = fl();
  return hl = function() {
    return t() && !!Symbol.toStringTag;
  }, hl;
}
var Tl = {};
var BT = false;
function Bk() {
  if (BT)
    return Tl;
  BT = true;
  var t = El()(), e = yl(), n = e("Object.prototype.toString"), r = function(a) {
    return t && a && typeof a == "object" && Symbol.toStringTag in a ? false : n(a) === "[object Arguments]";
  }, o = function(a) {
    return r(a) ? true : a !== null && typeof a == "object" && typeof a.length == "number" && a.length >= 0 && n(a) !== "[object Array]" && n(a.callee) === "[object Function]";
  }, s = function() {
    return r(arguments);
  }();
  return r.isLegacyArguments = o, Tl = s ? r : o, Tl;
}
var vl = {};
var IT = false;
function Ik() {
  if (IT)
    return vl;
  IT = true;
  var t = Object.prototype.toString, e = Function.prototype.toString, n = /^\s*(?:function)?\*/, r = El()(), o = Object.getPrototypeOf, s = function() {
    if (!r)
      return false;
    try {
      return Function("return function*() {}")();
    } catch {}
  }, i;
  return vl = function(l) {
    if (typeof l != "function")
      return false;
    if (n.test(e.call(l)))
      return true;
    if (!r) {
      var c = t.call(l);
      return c === "[object GeneratorFunction]";
    }
    if (!o)
      return false;
    if (typeof i > "u") {
      var f = s();
      i = f ? o(f) : false;
    }
    return o(l) === i;
  }, vl;
}
var _l = {};
var ET = false;
function Ek() {
  if (ET)
    return _l;
  ET = true;
  var t = Function.prototype.toString, e = typeof Reflect == "object" && Reflect !== null && Reflect.apply, n, r;
  if (typeof e == "function" && typeof Object.defineProperty == "function")
    try {
      n = Object.defineProperty({}, "length", { get: function() {
        throw r;
      } }), r = {}, e(function() {
        throw 42;
      }, null, n);
    } catch (E) {
      E !== r && (e = null);
    }
  else
    e = null;
  var o = /^\s*class\b/, s = function(I) {
    try {
      var D = t.call(I);
      return o.test(D);
    } catch {
      return false;
    }
  }, i = function(I) {
    try {
      return s(I) ? false : (t.call(I), true);
    } catch {
      return false;
    }
  }, a = Object.prototype.toString, l = "[object Object]", c = "[object Function]", f = "[object GeneratorFunction]", g = "[object HTMLAllCollection]", p = "[object HTML document.all class]", y = "[object HTMLCollection]", T = typeof Symbol == "function" && !!Symbol.toStringTag, P = !(0 in [,]), B = function() {
    return false;
  };
  if (typeof document == "object") {
    var v = document.all;
    a.call(v) === a.call(document.all) && (B = function(I) {
      if ((P || !I) && (typeof I > "u" || typeof I == "object"))
        try {
          var D = a.call(I);
          return (D === g || D === p || D === y || D === l) && I("") == null;
        } catch {}
      return false;
    });
  }
  return _l = e ? function(I) {
    if (B(I))
      return true;
    if (!I || typeof I != "function" && typeof I != "object")
      return false;
    try {
      e(I, null, n);
    } catch (D) {
      if (D !== r)
        return false;
    }
    return !s(I) && i(I);
  } : function(I) {
    if (B(I))
      return true;
    if (!I || typeof I != "function" && typeof I != "object")
      return false;
    if (T)
      return i(I);
    if (s(I))
      return false;
    var D = a.call(I);
    return D !== c && D !== f && !/^\[object HTML/.test(D) ? false : i(I);
  }, _l;
}
var bl = {};
var ST = false;
function Sk() {
  if (ST)
    return bl;
  ST = true;
  var t = Ek(), e = Object.prototype.toString, n = Object.prototype.hasOwnProperty, r = function(l, c, f) {
    for (var g = 0, p = l.length;g < p; g++)
      n.call(l, g) && (f == null ? c(l[g], g, l) : c.call(f, l[g], g, l));
  }, o = function(l, c, f) {
    for (var g = 0, p = l.length;g < p; g++)
      f == null ? c(l.charAt(g), g, l) : c.call(f, l.charAt(g), g, l);
  }, s = function(l, c, f) {
    for (var g in l)
      n.call(l, g) && (f == null ? c(l[g], g, l) : c.call(f, l[g], g, l));
  }, i = function(l, c, f) {
    if (!t(c))
      throw new TypeError("iterator must be a function");
    var g;
    arguments.length >= 3 && (g = f), e.call(l) === "[object Array]" ? r(l, c, g) : typeof l == "string" ? o(l, c, g) : s(l, c, g);
  };
  return bl = i, bl;
}
var wl = {};
var kT = false;
function kk() {
  return kT || (kT = true, wl = ["Float32Array", "Float64Array", "Int8Array", "Int16Array", "Int32Array", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "BigInt64Array", "BigUint64Array"]), wl;
}
var xl = {};
var AT = false;
var Ak = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
function Ck() {
  if (AT)
    return xl;
  AT = true;
  var t = kk(), e = typeof globalThis > "u" ? Ak : globalThis;
  return xl = function() {
    for (var r = [], o = 0;o < t.length; o++)
      typeof e[t[o]] == "function" && (r[r.length] = t[o]);
    return r;
  }, xl;
}
var Pl = {};
var CT = false;
var Ok = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
function DT() {
  if (CT)
    return Pl;
  CT = true;
  var t = Sk(), e = Ck(), n = ml(), r = yl(), o = Co(), s = r("Object.prototype.toString"), i = El()(), a = typeof globalThis > "u" ? Ok : globalThis, l = e(), c = r("String.prototype.slice"), f = Object.getPrototypeOf, g = r("Array.prototype.indexOf", true) || function(B, v) {
    for (var E = 0;E < B.length; E += 1)
      if (B[E] === v)
        return E;
    return -1;
  }, p = { __proto__: null };
  i && o && f ? t(l, function(P) {
    var B = new a[P];
    if (Symbol.toStringTag in B) {
      var v = f(B), E = o(v, Symbol.toStringTag);
      if (!E) {
        var I = f(v);
        E = o(I, Symbol.toStringTag);
      }
      p["$" + P] = n(E.get);
    }
  }) : t(l, function(P) {
    var B = new a[P], v = B.slice || B.set;
    v && (p["$" + P] = n(v));
  });
  var y = function(B) {
    var v = false;
    return t(p, function(E, I) {
      if (!v)
        try {
          "$" + E(B) === I && (v = c(I, 1));
        } catch {}
    }), v;
  }, T = function(B) {
    var v = false;
    return t(p, function(E, I) {
      if (!v)
        try {
          E(B), v = c(I, 1);
        } catch {}
    }), v;
  };
  return Pl = function(B) {
    if (!B || typeof B != "object")
      return false;
    if (!i) {
      var v = c(s(B), 8, -1);
      return g(l, v) > -1 ? v : v !== "Object" ? false : T(B);
    }
    return o ? y(B) : null;
  }, Pl;
}
var Bl = {};
var OT = false;
function Rk() {
  if (OT)
    return Bl;
  OT = true;
  var t = DT();
  return Bl = function(n) {
    return !!t(n);
  }, Bl;
}
var he = {};
var RT = false;
function Mk() {
  if (RT)
    return he;
  RT = true;
  var t = Bk(), e = Ik(), n = DT(), r = Rk();
  function o(U) {
    return U.call.bind(U);
  }
  var s = typeof BigInt < "u", i = typeof Symbol < "u", a = o(Object.prototype.toString), l = o(Number.prototype.valueOf), c = o(String.prototype.valueOf), f = o(Boolean.prototype.valueOf);
  if (s)
    var g = o(BigInt.prototype.valueOf);
  if (i)
    var p = o(Symbol.prototype.valueOf);
  function y(U, At) {
    if (typeof U != "object")
      return false;
    try {
      return At(U), true;
    } catch {
      return false;
    }
  }
  he.isArgumentsObject = t, he.isGeneratorFunction = e, he.isTypedArray = r;
  function T(U) {
    return typeof Promise < "u" && U instanceof Promise || U !== null && typeof U == "object" && typeof U.then == "function" && typeof U.catch == "function";
  }
  he.isPromise = T;
  function P(U) {
    return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? ArrayBuffer.isView(U) : r(U) || N(U);
  }
  he.isArrayBufferView = P;
  function B(U) {
    return n(U) === "Uint8Array";
  }
  he.isUint8Array = B;
  function v(U) {
    return n(U) === "Uint8ClampedArray";
  }
  he.isUint8ClampedArray = v;
  function E(U) {
    return n(U) === "Uint16Array";
  }
  he.isUint16Array = E;
  function I(U) {
    return n(U) === "Uint32Array";
  }
  he.isUint32Array = I;
  function D(U) {
    return n(U) === "Int8Array";
  }
  he.isInt8Array = D;
  function $(U) {
    return n(U) === "Int16Array";
  }
  he.isInt16Array = $;
  function Q(U) {
    return n(U) === "Int32Array";
  }
  he.isInt32Array = Q;
  function Y(U) {
    return n(U) === "Float32Array";
  }
  he.isFloat32Array = Y;
  function ce(U) {
    return n(U) === "Float64Array";
  }
  he.isFloat64Array = ce;
  function re(U) {
    return n(U) === "BigInt64Array";
  }
  he.isBigInt64Array = re;
  function ee(U) {
    return n(U) === "BigUint64Array";
  }
  he.isBigUint64Array = ee;
  function Ie(U) {
    return a(U) === "[object Map]";
  }
  Ie.working = typeof Map < "u" && Ie(new Map);
  function We(U) {
    return typeof Map > "u" ? false : Ie.working ? Ie(U) : U instanceof Map;
  }
  he.isMap = We;
  function Xe(U) {
    return a(U) === "[object Set]";
  }
  Xe.working = typeof Set < "u" && Xe(new Set);
  function ze(U) {
    return typeof Set > "u" ? false : Xe.working ? Xe(U) : U instanceof Set;
  }
  he.isSet = ze;
  function qe(U) {
    return a(U) === "[object WeakMap]";
  }
  qe.working = typeof WeakMap < "u" && qe(new WeakMap);
  function pt(U) {
    return typeof WeakMap > "u" ? false : qe.working ? qe(U) : U instanceof WeakMap;
  }
  he.isWeakMap = pt;
  function Re(U) {
    return a(U) === "[object WeakSet]";
  }
  Re.working = typeof WeakSet < "u" && Re(new WeakSet);
  function ve(U) {
    return Re(U);
  }
  he.isWeakSet = ve;
  function we(U) {
    return a(U) === "[object ArrayBuffer]";
  }
  we.working = typeof ArrayBuffer < "u" && we(new ArrayBuffer);
  function se(U) {
    return typeof ArrayBuffer > "u" ? false : we.working ? we(U) : U instanceof ArrayBuffer;
  }
  he.isArrayBuffer = se;
  function de(U) {
    return a(U) === "[object DataView]";
  }
  de.working = typeof ArrayBuffer < "u" && typeof DataView < "u" && de(new DataView(new ArrayBuffer(1), 0, 1));
  function N(U) {
    return typeof DataView > "u" ? false : de.working ? de(U) : U instanceof DataView;
  }
  he.isDataView = N;
  var Z = typeof SharedArrayBuffer < "u" ? SharedArrayBuffer : undefined;
  function W(U) {
    return a(U) === "[object SharedArrayBuffer]";
  }
  function le(U) {
    return typeof Z > "u" ? false : (typeof W.working > "u" && (W.working = W(new Z)), W.working ? W(U) : U instanceof Z);
  }
  he.isSharedArrayBuffer = le;
  function ge(U) {
    return a(U) === "[object AsyncFunction]";
  }
  he.isAsyncFunction = ge;
  function R(U) {
    return a(U) === "[object Map Iterator]";
  }
  he.isMapIterator = R;
  function C(U) {
    return a(U) === "[object Set Iterator]";
  }
  he.isSetIterator = C;
  function j(U) {
    return a(U) === "[object Generator]";
  }
  he.isGeneratorObject = j;
  function V(U) {
    return a(U) === "[object WebAssembly.Module]";
  }
  he.isWebAssemblyCompiledModule = V;
  function te(U) {
    return y(U, l);
  }
  he.isNumberObject = te;
  function b(U) {
    return y(U, c);
  }
  he.isStringObject = b;
  function x(U) {
    return y(U, f);
  }
  he.isBooleanObject = x;
  function F(U) {
    return s && y(U, g);
  }
  he.isBigIntObject = F;
  function J(U) {
    return i && y(U, p);
  }
  he.isSymbolObject = J;
  function Se(U) {
    return te(U) || b(U) || x(U) || F(U) || J(U);
  }
  he.isBoxedPrimitive = Se;
  function me(U) {
    return typeof Uint8Array < "u" && (se(U) || le(U));
  }
  return he.isAnyArrayBuffer = me, ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(U) {
    Object.defineProperty(he, U, { enumerable: false, value: function() {
      throw new Error(U + " is not supported in userland");
    } });
  }), he;
}
var Il = {};
var MT = false;
function Nk() {
  return MT || (MT = true, Il = function(e) {
    return e && typeof e == "object" && typeof e.copy == "function" && typeof e.fill == "function" && typeof e.readUInt8 == "function";
  }), Il;
}
var Te = {};
var NT = false;
var li = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : global;
function Dk() {
  if (NT)
    return Te;
  NT = true;
  var t = Mt, e = Object.getOwnPropertyDescriptors || function(Z) {
    for (var W = Object.keys(Z), le = {}, ge = 0;ge < W.length; ge++)
      le[W[ge]] = Object.getOwnPropertyDescriptor(Z, W[ge]);
    return le;
  }, n = /%[sdj%]/g;
  Te.format = function(N) {
    if (!$(N)) {
      for (var Z = [], W = 0;W < arguments.length; W++)
        Z.push(i(arguments[W]));
      return Z.join(" ");
    }
    for (var W = 1, le = arguments, ge = le.length, R = String(N).replace(n, function(j) {
      if (j === "%%")
        return "%";
      if (W >= ge)
        return j;
      switch (j) {
        case "%s":
          return String(le[W++]);
        case "%d":
          return Number(le[W++]);
        case "%j":
          try {
            return JSON.stringify(le[W++]);
          } catch {
            return "[Circular]";
          }
        default:
          return j;
      }
    }), C = le[W];W < ge; C = le[++W])
      E(C) || !re(C) ? R += " " + C : R += " " + i(C);
    return R;
  }, Te.deprecate = function(N, Z) {
    if (typeof t < "u" && t.noDeprecation === true)
      return N;
    if (typeof t > "u")
      return function() {
        return Te.deprecate(N, Z).apply(this || li, arguments);
      };
    var W = false;
    function le() {
      if (!W) {
        if (t.throwDeprecation)
          throw new Error(Z);
        t.traceDeprecation ? console.trace(Z) : console.error(Z), W = true;
      }
      return N.apply(this || li, arguments);
    }
    return le;
  };
  var r = {}, o = /^$/;
  if (t.env.NODE_DEBUG) {
    var s = t.env.NODE_DEBUG;
    s = s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase(), o = new RegExp("^" + s + "$", "i");
  }
  Te.debuglog = function(N) {
    if (N = N.toUpperCase(), !r[N])
      if (o.test(N)) {
        var Z = t.pid;
        r[N] = function() {
          var W = Te.format.apply(Te, arguments);
          console.error("%s %d: %s", N, Z, W);
        };
      } else
        r[N] = function() {};
    return r[N];
  };
  function i(N, Z) {
    var W = { seen: [], stylize: l };
    return arguments.length >= 3 && (W.depth = arguments[2]), arguments.length >= 4 && (W.colors = arguments[3]), v(Z) ? W.showHidden = Z : Z && Te._extend(W, Z), Y(W.showHidden) && (W.showHidden = false), Y(W.depth) && (W.depth = 2), Y(W.colors) && (W.colors = false), Y(W.customInspect) && (W.customInspect = true), W.colors && (W.stylize = a), f(W, N, W.depth);
  }
  Te.inspect = i, i.colors = { bold: [1, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], white: [37, 39], grey: [90, 39], black: [30, 39], blue: [34, 39], cyan: [36, 39], green: [32, 39], magenta: [35, 39], red: [31, 39], yellow: [33, 39] }, i.styles = { special: "cyan", number: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", date: "magenta", regexp: "red" };
  function a(N, Z) {
    var W = i.styles[Z];
    return W ? "\x1B[" + i.colors[W][0] + "m" + N + "\x1B[" + i.colors[W][1] + "m" : N;
  }
  function l(N, Z) {
    return N;
  }
  function c(N) {
    var Z = {};
    return N.forEach(function(W, le) {
      Z[W] = true;
    }), Z;
  }
  function f(N, Z, W) {
    if (N.customInspect && Z && We(Z.inspect) && Z.inspect !== Te.inspect && !(Z.constructor && Z.constructor.prototype === Z)) {
      var le = Z.inspect(W, N);
      return $(le) || (le = f(N, le, W)), le;
    }
    var ge = g(N, Z);
    if (ge)
      return ge;
    var R = Object.keys(Z), C = c(R);
    if (N.showHidden && (R = Object.getOwnPropertyNames(Z)), Ie(Z) && (R.indexOf("message") >= 0 || R.indexOf("description") >= 0))
      return p(Z);
    if (R.length === 0) {
      if (We(Z)) {
        var j = Z.name ? ": " + Z.name : "";
        return N.stylize("[Function" + j + "]", "special");
      }
      if (ce(Z))
        return N.stylize(RegExp.prototype.toString.call(Z), "regexp");
      if (ee(Z))
        return N.stylize(Date.prototype.toString.call(Z), "date");
      if (Ie(Z))
        return p(Z);
    }
    var V = "", te = false, b = ["{", "}"];
    if (B(Z) && (te = true, b = ["[", "]"]), We(Z)) {
      var x = Z.name ? ": " + Z.name : "";
      V = " [Function" + x + "]";
    }
    if (ce(Z) && (V = " " + RegExp.prototype.toString.call(Z)), ee(Z) && (V = " " + Date.prototype.toUTCString.call(Z)), Ie(Z) && (V = " " + p(Z)), R.length === 0 && (!te || Z.length == 0))
      return b[0] + V + b[1];
    if (W < 0)
      return ce(Z) ? N.stylize(RegExp.prototype.toString.call(Z), "regexp") : N.stylize("[Object]", "special");
    N.seen.push(Z);
    var F;
    return te ? F = y(N, Z, W, C, R) : F = R.map(function(J) {
      return T(N, Z, W, C, J, te);
    }), N.seen.pop(), P(F, V, b);
  }
  function g(N, Z) {
    if (Y(Z))
      return N.stylize("undefined", "undefined");
    if ($(Z)) {
      var W = "'" + JSON.stringify(Z).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
      return N.stylize(W, "string");
    }
    if (D(Z))
      return N.stylize("" + Z, "number");
    if (v(Z))
      return N.stylize("" + Z, "boolean");
    if (E(Z))
      return N.stylize("null", "null");
  }
  function p(N) {
    return "[" + Error.prototype.toString.call(N) + "]";
  }
  function y(N, Z, W, le, ge) {
    for (var R = [], C = 0, j = Z.length;C < j; ++C)
      ve(Z, String(C)) ? R.push(T(N, Z, W, le, String(C), true)) : R.push("");
    return ge.forEach(function(V) {
      V.match(/^\d+$/) || R.push(T(N, Z, W, le, V, true));
    }), R;
  }
  function T(N, Z, W, le, ge, R) {
    var C, j, V;
    if (V = Object.getOwnPropertyDescriptor(Z, ge) || { value: Z[ge] }, V.get ? V.set ? j = N.stylize("[Getter/Setter]", "special") : j = N.stylize("[Getter]", "special") : V.set && (j = N.stylize("[Setter]", "special")), ve(le, ge) || (C = "[" + ge + "]"), j || (N.seen.indexOf(V.value) < 0 ? (E(W) ? j = f(N, V.value, null) : j = f(N, V.value, W - 1), j.indexOf(`
`) > -1 && (R ? j = j.split(`
`).map(function(te) {
      return "  " + te;
    }).join(`
`).slice(2) : j = `
` + j.split(`
`).map(function(te) {
      return "   " + te;
    }).join(`
`))) : j = N.stylize("[Circular]", "special")), Y(C)) {
      if (R && ge.match(/^\d+$/))
        return j;
      C = JSON.stringify("" + ge), C.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (C = C.slice(1, -1), C = N.stylize(C, "name")) : (C = C.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), C = N.stylize(C, "string"));
    }
    return C + ": " + j;
  }
  function P(N, Z, W) {
    var le = N.reduce(function(ge, R) {
      return R.indexOf(`
`) >= 0, ge + R.replace(/\u001b\[\d\d?m/g, "").length + 1;
    }, 0);
    return le > 60 ? W[0] + (Z === "" ? "" : Z + `
 `) + " " + N.join(`,
  `) + " " + W[1] : W[0] + Z + " " + N.join(", ") + " " + W[1];
  }
  Te.types = Mk();
  function B(N) {
    return Array.isArray(N);
  }
  Te.isArray = B;
  function v(N) {
    return typeof N == "boolean";
  }
  Te.isBoolean = v;
  function E(N) {
    return N === null;
  }
  Te.isNull = E;
  function I(N) {
    return N == null;
  }
  Te.isNullOrUndefined = I;
  function D(N) {
    return typeof N == "number";
  }
  Te.isNumber = D;
  function $(N) {
    return typeof N == "string";
  }
  Te.isString = $;
  function Q(N) {
    return typeof N == "symbol";
  }
  Te.isSymbol = Q;
  function Y(N) {
    return N === undefined;
  }
  Te.isUndefined = Y;
  function ce(N) {
    return re(N) && ze(N) === "[object RegExp]";
  }
  Te.isRegExp = ce, Te.types.isRegExp = ce;
  function re(N) {
    return typeof N == "object" && N !== null;
  }
  Te.isObject = re;
  function ee(N) {
    return re(N) && ze(N) === "[object Date]";
  }
  Te.isDate = ee, Te.types.isDate = ee;
  function Ie(N) {
    return re(N) && (ze(N) === "[object Error]" || N instanceof Error);
  }
  Te.isError = Ie, Te.types.isNativeError = Ie;
  function We(N) {
    return typeof N == "function";
  }
  Te.isFunction = We;
  function Xe(N) {
    return N === null || typeof N == "boolean" || typeof N == "number" || typeof N == "string" || typeof N == "symbol" || typeof N > "u";
  }
  Te.isPrimitive = Xe, Te.isBuffer = Nk();
  function ze(N) {
    return Object.prototype.toString.call(N);
  }
  function qe(N) {
    return N < 10 ? "0" + N.toString(10) : N.toString(10);
  }
  var pt = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  function Re() {
    var N = new Date, Z = [qe(N.getHours()), qe(N.getMinutes()), qe(N.getSeconds())].join(":");
    return [N.getDate(), pt[N.getMonth()], Z].join(" ");
  }
  Te.log = function() {
    console.log("%s - %s", Re(), Te.format.apply(Te, arguments));
  }, Te.inherits = Wt(), Te._extend = function(N, Z) {
    if (!Z || !re(Z))
      return N;
    for (var W = Object.keys(Z), le = W.length;le--; )
      N[W[le]] = Z[W[le]];
    return N;
  };
  function ve(N, Z) {
    return Object.prototype.hasOwnProperty.call(N, Z);
  }
  var we = typeof Symbol < "u" ? Symbol("util.promisify.custom") : undefined;
  Te.promisify = function(Z) {
    if (typeof Z != "function")
      throw new TypeError('The "original" argument must be of type Function');
    if (we && Z[we]) {
      if (W = Z[we], typeof W != "function")
        throw new TypeError('The "util.promisify.custom" argument must be of type Function');
      return Object.defineProperty(W, we, { value: W, enumerable: false, writable: false, configurable: true }), W;
    }
    function W() {
      for (var le, ge, R = new Promise(function(V, te) {
        le = V, ge = te;
      }), C = [], j = 0;j < arguments.length; j++)
        C.push(arguments[j]);
      C.push(function(V, te) {
        V ? ge(V) : le(te);
      });
      try {
        Z.apply(this || li, C);
      } catch (V) {
        ge(V);
      }
      return R;
    }
    return Object.setPrototypeOf(W, Object.getPrototypeOf(Z)), we && Object.defineProperty(W, we, { value: W, enumerable: false, writable: false, configurable: true }), Object.defineProperties(W, e(Z));
  }, Te.promisify.custom = we;
  function se(N, Z) {
    if (!N) {
      var W = new Error("Promise was rejected with a falsy value");
      W.reason = N, N = W;
    }
    return Z(N);
  }
  function de(N) {
    if (typeof N != "function")
      throw new TypeError('The "original" argument must be of type Function');
    function Z() {
      for (var W = [], le = 0;le < arguments.length; le++)
        W.push(arguments[le]);
      var ge = W.pop();
      if (typeof ge != "function")
        throw new TypeError("The last argument must be of type Function");
      var R = this || li, C = function() {
        return ge.apply(R, arguments);
      };
      N.apply(this || li, W).then(function(j) {
        t.nextTick(C.bind(null, null, j));
      }, function(j) {
        t.nextTick(se.bind(null, j, C));
      });
    }
    return Object.setPrototypeOf(Z, Object.getPrototypeOf(N)), Object.defineProperties(Z, e(N)), Z;
  }
  return Te.callbackify = de, Te;
}
var oe = Dk();
oe.format;
oe.deprecate;
oe.debuglog;
oe.inspect;
oe.types;
oe.isArray;
oe.isBoolean;
oe.isNull;
oe.isNullOrUndefined;
oe.isNumber;
oe.isString;
oe.isSymbol;
oe.isUndefined;
oe.isRegExp;
oe.isObject;
oe.isDate;
oe.isError;
oe.isFunction;
oe.isPrimitive;
oe.isBuffer;
oe.log;
oe.inherits;
oe._extend;
oe.promisify;
oe.callbackify;
var h0 = oe._extend;
var T0 = oe.callbackify;
var v0 = oe.debuglog;
var _0 = oe.deprecate;
var b0 = oe.format;
var w0 = oe.inherits;
var x0 = oe.inspect;
var P0 = oe.isArray;
var B0 = oe.isBoolean;
var I0 = oe.isBuffer;
var E0 = oe.isDate;
var S0 = oe.isError;
var k0 = oe.isFunction;
var A0 = oe.isNull;
var C0 = oe.isNullOrUndefined;
var O0 = oe.isNumber;
var R0 = oe.isObject;
var M0 = oe.isPrimitive;
var N0 = oe.isRegExp;
var D0 = oe.isString;
var H0 = oe.isSymbol;
var U0 = oe.isUndefined;
var j0 = oe.log;
var $0 = oe.promisify;
var Z0 = oe.types;
var L0 = oe.TextEncoder = globalThis.TextEncoder;
var W0 = oe.TextDecoder = globalThis.TextDecoder;
var Tr = class {
  defaultOptions;
  constructor(e) {
    this.defaultOptions = e;
  }
  info(...e) {
    this._log("info", e);
  }
  debug(...e) {
    this._log("debug", e);
  }
  warn(...e) {
    this._log("warn", e);
  }
  error(...e) {
    this._log("error", e);
  }
  issue(e) {
    console.info(JSON.stringify(e));
  }
  _log(e, n) {
    this._getConsoleMethod(e)(this._serializeMessage(e, n));
  }
  _serializeMessage(e, n) {
    let r = oe.format(...n);
    return G.env.BP_LOG_FORMAT === "json" ? this.getJsonMessage(e, r) : r;
  }
  getJsonMessage(e, n) {
    return JSON.stringify({ msg: n, level: e, options: this.defaultOptions });
  }
  _getConsoleMethod(e) {
    switch (e) {
      case "debug":
        return console.debug;
      case "warn":
        return console.warn;
      case "error":
        return console.error;
      default:
        return console.info;
    }
  }
};
var ui = class t extends Tr {
  constructor(e) {
    super({ visibleToBotOwners: false, hiddenToIntegrationOwners: false, ...e });
  }
  with(e) {
    return new t({ ...this.defaultOptions, ...e });
  }
  withUserId(e) {
    return this.with({ userId: e });
  }
  withConversationId(e) {
    return this.with({ conversationId: e });
  }
  withVisibleToBotOwners(e) {
    return this.with({ visibleToBotOwners: e });
  }
  withHiddenToIntegrationOwners(e) {
    return this.with({ hiddenToIntegrationOwners: e });
  }
  forBot() {
    return this.with({ hiddenToIntegrationOwners: false, visibleToBotOwners: true });
  }
  forBotOnly() {
    return this.with({ hiddenToIntegrationOwners: true, visibleToBotOwners: true });
  }
  getJsonMessage(e, n) {
    return JSON.stringify({ msg: n, level: e, botId: this.defaultOptions.botId, integrationId: this.defaultOptions.integrationId, integrationAlias: this.defaultOptions.integrationAlias, visible_to_bot_owner: this.defaultOptions.visibleToBotOwners, hidden_to_integration_owner: this.defaultOptions.hiddenToIntegrationOwners, options: this.defaultOptions });
  }
};
S();
A();
k();
var $k = (t2) => ["traceparent", "tracestate", "sentry-trace"].reduce((e, n) => (t2[n] && (e[n] = t2[n]), e), {});
var Zk = (t2, e, n) => {
  let [, r] = (e.headers.traceparent || "").split("-"), o = new Uk({ botId: t2.botId, integrationId: t2.integrationId, integrationAlias: t2.integrationAlias, retry: Bo, headers: n.managesOwnTracePropagation ? {} : $k(e.headers) }), s = new oi(o), i = new ui({ traceId: r, botId: t2.botId, integrationId: t2.integrationId, integrationAlias: t2.integrationAlias });
  return { ctx: t2, req: e, client: s, logger: i, instance: n };
};
var Lk = async (t2) => {
  let { ctx: e } = t2;
  switch (e.operation) {
    case "webhook_received":
      return await Kk(t2);
    case "register":
      return await Fk(t2);
    case "unregister":
      return await zk(t2);
    case "message_created":
      return await Vk(t2);
    case "action_triggered":
      return await Jk(t2);
    case "ping":
      return await Wk(t2);
    case "create_user":
      return await qk(t2);
    case "create_conversation":
      return await Gk(t2);
    default:
      throw new Jt(`Unknown operation ${e.operation}`);
  }
};
var UT = (t2) => async (e) => {
  let n = tT(e.headers), r = Zk(n, e, t2), { logger: o } = r;
  try {
    let s;
    return s = await Yk(r), s ? { ...s, status: s.status ?? 200 } : (s = await Lk(r), s ? { ...s, status: s.status ?? 200 } : { status: 200 });
  } catch (s) {
    if (RP(s)) {
      let a = s.type === "Runtime" ? s : new ps(s.message, s);
      return o.forBot().error(a.message), { status: a.code, body: JSON.stringify(a.toJSON()) };
    }
    console.error(s);
    let i = new ps("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");
    return o.forBot().error(i.message), { status: i.code, body: JSON.stringify(i.toJSON()) };
  }
};
var Wk = async (t2) => {};
var Kk = async ({ client: t2, ctx: e, req: n, logger: r, instance: o }) => {
  let { req: s } = Nt(n);
  return o.webhook({ client: t2, ctx: e, req: s, logger: r });
};
var Fk = async ({ client: t2, ctx: e, req: n, logger: r, instance: o }) => {
  if (!o.register)
    return;
  let { webhookUrl: s } = Nt(n);
  await o.register({ client: t2, ctx: e, webhookUrl: s, logger: r });
};
var zk = async ({ client: t2, ctx: e, req: n, logger: r, instance: o }) => {
  if (!o.unregister)
    return;
  let { webhookUrl: s } = Nt(n);
  await o.unregister({ ctx: e, webhookUrl: s, client: t2, logger: r });
};
var qk = async ({ client: t2, ctx: e, req: n, logger: r, instance: o }) => {
  if (!o.createUser)
    return;
  let { tags: s } = Nt(n);
  return await o.createUser({ ctx: e, client: t2, tags: s, logger: r });
};
var Gk = async ({ client: t2, ctx: e, req: n, logger: r, instance: o }) => {
  if (!o.createConversation)
    return;
  let { channel: s, tags: i } = Nt(n);
  return await o.createConversation({ ctx: e, client: t2, channel: s, tags: i, logger: r });
};
var Vk = async ({ ctx: t2, req: e, client: n, logger: r, instance: o }) => {
  let { conversation: s, user: i, type: a, payload: l, message: c } = Nt(e), f = o.channels[s.channel];
  if (!f)
    throw new Error(`Channel ${s.channel} not found`);
  let g = f.messages[a];
  if (!g)
    throw new Error(`Message of type ${a} not found in channel ${s.channel}`);
  await g({ ctx: t2, conversation: s, message: c, user: i, type: a, client: n, payload: l, ack: async ({ tags: y }) => {
    await n.updateMessage({ id: c.id, tags: y });
  }, logger: r });
};
var Jk = async ({ req: t2, ctx: e, client: n, logger: r, instance: o }) => {
  let { input: s, type: i } = Nt(t2);
  if (!i)
    throw new Error("Missing action type");
  let a = o.actions[i];
  if (!a)
    throw new Error(`Action ${i} not found`);
  let l = new Io, f = { output: await a({ ctx: e, input: s, client: n, type: i, logger: r, metadata: l }), meta: l.toJSON() };
  return { body: JSON.stringify(f) };
};
var Yk = async ({ instance: t2, client: e, ctx: n, logger: r, req: o }) => {
  let s = t2.unknownOperationHandler;
  if (s)
    return await s({ client: e, ctx: n, logger: r, req: o });
};
var Sl = class {
  constructor(e) {
    this.props = e;
    this.actions = e.actions, this.channels = e.channels, this.register = e.register, this.unregister = e.unregister, this.createUser = e.createUser, this.createConversation = e.createConversation, this.webhook = e.handler, this.unknownOperationHandler = e.__advanced?.unknownOperationHandler, this.managesOwnTracePropagation = e.__advanced?.managesOwnTracePropagation;
  }
  actions;
  channels;
  register;
  unregister;
  createUser;
  createConversation;
  webhook;
  unknownOperationHandler;
  managesOwnTracePropagation;
  handler = UT(this);
  start = (e) => wo(this.handler, e);
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var kl = class {
  constructor(e) {
    this.props = e;
    this.integrations = e.integrations, this.plugins = e.plugins, this.user = e.user, this.conversation = e.conversation, this.message = e.message, this.states = e.states, this.configuration = e.configuration, this.events = e.events, this.recurringEvents = e.recurringEvents, this.actions = e.actions, this.tables = e.tables, this.secrets = e.secrets, this.workflows = e.workflows, this.attributes = e.attributes, this.__advanced = e.__advanced, this.withPlugins = { user: e.user, conversation: e.conversation, message: e.message, states: e.states, events: e.events, recurringEvents: e.recurringEvents, actions: e.actions, tables: e.tables, workflows: e.workflows };
  }
  integrations;
  plugins;
  user;
  conversation;
  message;
  states;
  configuration;
  events;
  recurringEvents;
  actions;
  tables;
  secrets;
  workflows;
  attributes;
  __advanced;
  withPlugins;
  get metadata() {
    return { sdkVersion: bn };
  }
  addIntegration(e, n) {
    let r = this;
    r.integrations || (r.integrations = {});
    let o = n?.alias ?? e.name;
    if (r.integrations[o])
      throw new vt(`Another integration with alias "${o}" is already installed in the bot`);
    let s = n && "configurationType" in n ? n.configurationType : undefined, i = n && "configuration" in n ? n.configuration ?? {} : {}, a = s ? e.definition.configurations?.[s]?.schema : e.definition.configuration?.schema, l = a ? a.safeParse(i) : null, c = l?.success ? { ...i, ...l.data } : i;
    return r.integrations[o] = { ...e, alias: o, enabled: n?.enabled, configurationType: s, configuration: c, disabledChannels: n?.disabledChannels }, this;
  }
  addPlugin(e, n) {
    let r = this;
    r.plugins || (r.plugins = {});
    let o = n.alias ?? e.name;
    if (r.plugins[o])
      throw new vt(`Another plugin with alias "${o}" is already installed in the bot`);
    let s = Object.fromEntries(Object.entries(n.dependencies ?? {}).filter(([g, p]) => ("integrationInterfaceAlias" in p)).map(([g, p]) => {
      let y = this.integrations?.[p.integrationAlias];
      if (!y) {
        let P = Object.keys(this.integrations ?? {}).join(", ") || "(none)";
        throw new vt(`Interface with alias "${g}" of plugin with alias "${o}" references integration with alias "${p.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
Available integration aliases: ${P}`);
      }
      let T = y.definition.interfaces?.[p.integrationInterfaceAlias];
      if (!T) {
        let P = Object.keys(y.definition.interfaces ?? {}).join(", ") || "(none)";
        throw new vt(`Interface with alias "${p.integrationInterfaceAlias}" does not exist in integration "${y.name}" referenced by interface with alias "${g}" of plugin with alias "${o}".
Available interface aliases: ${P}`);
      }
      return [g, { ...T, id: y.id, name: y.name, version: y.version, ...p }];
    })), i = Object.fromEntries(Object.entries(n.dependencies ?? {}).filter(([g, p]) => !("integrationInterfaceAlias" in p)).map(([g, p]) => {
      let y = this.integrations?.[p.integrationAlias];
      if (!y) {
        let T = Object.keys(this.integrations ?? {}).join(", ") || "(none)";
        throw new Error(`Integration with alias "${g}" of plugin with alias "${o}" references integration with alias "${p.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
Available integration aliases: ${T}`);
      }
      return [g, { ...y, ...p }];
    })), a = n.configuration ?? {}, l = e.definition.configuration?.schema, c = l ? l.safeParse(a) : null, f = c?.success ? { ...a, ...c.data } : a;
    return r.plugins[o] = { ...e, alias: o, configuration: f, interfaces: s, integrations: i }, r.withPlugins.user = this._mergeUser(r.withPlugins.user, e.definition.user), r.withPlugins.conversation = this._mergeConversation(r.withPlugins.conversation, e.definition.conversation), r.withPlugins.message = this._mergeMessage(r.withPlugins.message, e.definition.message), r.withPlugins.recurringEvents = this._mergeRecurringEvents(r.withPlugins.recurringEvents, e.definition.recurringEvents), r.withPlugins.tables = this._mergeTables(r.withPlugins.tables, e.definition.tables), r.withPlugins.workflows = this._mergeWorkflows(r.withPlugins.workflows, e.definition.workflows), r.withPlugins.states = this._mergeStates(r.withPlugins.states, this._prefixKeysWithPluginAlias(e.definition.states, o)), r.withPlugins.events = this._mergeEvents(r.withPlugins.events, this._prefixKeysWithPluginAlias(e.definition.events, o)), r.withPlugins.actions = this._mergeActions(r.withPlugins.actions, this._prefixKeysWithPluginAlias(e.definition.actions, o)), this;
  }
  _mergeUser = (e, n) => ({ tags: { ...e?.tags, ...n?.tags } });
  _mergeConversation = (e, n) => ({ tags: { ...e?.tags, ...n?.tags } });
  _mergeMessage = (e, n) => ({ tags: { ...e?.tags, ...n?.tags } });
  _mergeStates = (e, n) => ({ ...e, ...n });
  _mergeEvents = (e, n) => ({ ...e, ...n });
  _mergeRecurringEvents = (e, n) => ({ ...e, ...n });
  _mergeActions = (e, n) => ({ ...e, ...n });
  _mergeTables = (e, n) => ({ ...e, ...n });
  _mergeWorkflows = (e, n) => ({ ...e, ...n });
  _prefixKeysWithPluginAlias = (e, n) => je.mapKeys(e ?? {}, (r) => `${n}${Dt}${r}`);
  dereferencePluginEntities() {
    let e = this._buildZuiReferenceMap();
    return { ...this, withPlugins: { ...this.withPlugins, events: this._dereferenceDefinitionSchemas(this.withPlugins.events, e), states: this._dereferenceDefinitionSchemas(this.withPlugins.states, e), tables: this._dereferenceDefinitionSchemas(this.withPlugins.tables, e), actions: this._dereferenceActionDefinitionSchemas(this.withPlugins.actions, e) }, plugins: Object.fromEntries(Object.entries(this.plugins ?? {}).map(([n, r]) => [n, { ...r, definition: { ...r.definition, configuration: this._dereferenceDefinitionSchema(r.definition.configuration, e), events: this._dereferenceDefinitionSchemas(r.definition.events, e), states: this._dereferenceDefinitionSchemas(r.definition.states, e), tables: this._dereferenceDefinitionSchemas(r.definition.tables, e), actions: this._dereferenceActionDefinitionSchemas(r.definition.actions, e) } }])) };
  }
  _buildZuiReferenceMap() {
    let e = {}, n = Object.entries(this.plugins ?? {});
    for (let [r, o] of n) {
      let s = Object.entries(o.interfaces ?? {});
      for (let [i, a] of s) {
        let l = this.integrations?.[a.integrationAlias];
        if (!l)
          throw new vt(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${a.name}" which is not installed`);
        let c = Object.entries(a.entities ?? {});
        for (let [f, { name: g }] of c) {
          let p = l.definition.entities?.[g]?.schema;
          if (!p)
            throw new Error(`Interface entity "${g}" does not exist in integration "${l.name}"`);
          e[`interface:${i}/entities/${f}`] = p;
        }
      }
    }
    return e;
  }
  _dereferenceZuiSchema(e, n) {
    return e.dereference(n);
  }
  _dereferenceDefinitionSchemas(e, n) {
    return Object.fromEntries(Object.entries(e ?? {}).map(([r, o]) => [r, this._dereferenceDefinitionSchema(o, n)]));
  }
  _dereferenceDefinitionSchema(e, n) {
    return e && { ...e, schema: this._dereferenceZuiSchema(e.schema, n) };
  }
  _dereferenceActionDefinitionSchemas(e, n) {
    return Object.fromEntries(Object.entries(e ?? {}).map(([r, o]) => [r, { ...o, input: { schema: this._dereferenceZuiSchema(o.input.schema, n) }, output: { schema: this._dereferenceZuiSchema(o.output.schema, n) } }]));
  }
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
var ci = class t2 extends Tr {
  constructor(e) {
    super({ ...e });
  }
  with(e) {
    return new t2({ ...this.defaultOptions, ...e });
  }
  withUserId(e) {
    return this.with({ userId: e });
  }
  withConversationId(e) {
    return this.with({ conversationId: e });
  }
  withWorkflowId(e) {
    return this.with({ workflowId: e });
  }
  withEventId(e) {
    return this.with({ eventId: e });
  }
  withMessageId(e) {
    return this.with({ messageId: e });
  }
};
S();
A();
k();
S();
A();
k();
var dn = class {
  constructor(e, n = { before: {}, after: {} }) {
    this._client = e;
    this._hooks = n;
  }
  get _inner() {
    return this._client;
  }
  getConversation = (e) => this._run("getConversation", e);
  listConversations = (e) => this._run("listConversations", e);
  updateConversation = (e) => this._run("updateConversation", e);
  deleteConversation = (e) => this._run("deleteConversation", e);
  listParticipants = (e) => this._run("listParticipants", e);
  addParticipant = (e) => this._run("addParticipant", e);
  getParticipant = (e) => this._run("getParticipant", e);
  removeParticipant = (e) => this._run("removeParticipant", e);
  createEvent = (e) => this._run("createEvent", e);
  getEvent = (e) => this._run("getEvent", e);
  listEvents = (e) => this._run("listEvents", e);
  createMessage = (e) => this._run("createMessage", e);
  getMessage = (e) => this._run("getMessage", e);
  updateMessage = (e) => this._run("updateMessage", e);
  listMessages = (e) => this._run("listMessages", e);
  deleteMessage = (e) => this._run("deleteMessage", e);
  getUser = (e) => this._run("getUser", e);
  listUsers = (e) => this._run("listUsers", e);
  updateUser = (e) => this._run("updateUser", e);
  deleteUser = (e) => this._run("deleteUser", e);
  getState = (e) => this._run("getState", e);
  setState = (e) => this._run("setState", e);
  getOrSetState = (e) => this._run("getOrSetState", e);
  patchState = (e) => this._run("patchState", e);
  callAction = (e) => this._run("callAction", e);
  uploadFile = (e) => this._run("uploadFile", e);
  upsertFile = (e) => this._run("upsertFile", e);
  deleteFile = (e) => this._run("deleteFile", e);
  listFiles = (e) => this._run("listFiles", e);
  getFile = (e) => this._run("getFile", e);
  updateFileMetadata = (e) => this._run("updateFileMetadata", e);
  searchFiles = (e) => this._run("searchFiles", e);
  trackAnalytics = (e) => this._run("trackAnalytics", e);
  getTableRow = (e) => this._run("getTableRow", e);
  createTableRows = (e) => this._run("createTableRows", e);
  findTableRows = (e) => this._run("findTableRows", e);
  deleteTableRows = (e) => this._run("deleteTableRows", e);
  updateTableRows = (e) => this._run("updateTableRows", e);
  upsertTableRows = (e) => this._run("upsertTableRows", e);
  createWorkflow = (e) => this._run("createWorkflow", e);
  getOrCreateWorkflow = (e) => this._run("getOrCreateWorkflow", e);
  getWorkflow = (e) => this._run("getWorkflow", e);
  updateWorkflow = (e) => this._run("updateWorkflow", e);
  deleteWorkflow = (e) => this._run("deleteWorkflow", e);
  listWorkflows = (e) => this._run("listWorkflows", e);
  createConversation = (e) => this._client.createConversation(e);
  getOrCreateConversation = (e) => this._client.getOrCreateConversation(e);
  createUser = (e) => this._client.createUser(e);
  getOrCreateUser = (e) => this._client.getOrCreateUser(e);
  _run = async (e, n) => {
    let r = this._hooks.before[e];
    r && (n = await r(n));
    let o = await this._client[e](n), s = this._hooks.after[e];
    return s && (o = await s(o, n)), o;
  };
};
S();
A();
k();
var Xk = ne.enum(["event_received", "register", "unregister", "ping", "action_triggered"]);
var jT = (t3) => ({ botId: t3[Eo] || Et("Missing bot id header"), operation: Xk.parse(t3[ko]), type: t3[eT] || Et("Missing type header"), configuration: JSON.parse(z.from(t3[So] || Et("Missing configuration header"), "base64").toString("utf-8")) });
S();
A();
k();
var ct = { status: 200 };
S();
A();
k();
S();
A();
k();
var Al = (t3) => {
  switch (t3) {
    case "workflow_continued":
      return "continued";
    case "workflow_started":
      return "started";
    case "workflow_timedout":
      return "timed_out";
    default:
      throw new Error(`Unsupported workflow update type: ${t3}`);
  }
};
var Qk = ["child_workflow_deleted", "child_workflow_finished", "workflow_timedout", "workflow_started", "workflow_continued"];
var $T = async (t3, e) => {
  if (t3.ctx.type !== "workflow_update" || !Qk.includes(e.payload.type))
    throw new Error("Unexpected event type");
  let n = { ...t3, logger: eA(t3, e) };
  if (!e.payload.workflow.name)
    return n.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.", e.payload.workflow), ct;
  switch (e.payload.type) {
    case "child_workflow_deleted":
    case "child_workflow_finished":
      n.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);
      break;
    case "workflow_timedout":
    case "workflow_started":
    case "workflow_continued":
      return await tA(n, e);
    default:
      e.payload.type;
  }
  return ct;
};
var eA = (t3, e) => t3.logger.with({ eventId: e.id, workflowId: e.payload.workflow.id, conversationId: e.payload.conversation?.id, userId: e.payload.user?.id });
var tA = async (t3, e) => {
  let n = Al(e.payload.type), r = t3.self.workflowHandlers[n]?.[e.payload.workflow.name];
  if (!r || r.length === 0)
    return t3.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`), ct;
  let { updatedWorkflow: o } = await nA(t3, e);
  return o.status === "pending" && t3.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `), ct;
};
var nA = async (t3, e) => {
  let n = Al(e.payload.type), r = t3.self.workflowHandlers[n]?.[e.payload.workflow.name], o = structuredClone(e.payload.workflow);
  for (let s of r ?? [])
    o = await s({ ...t3, event: e, conversation: e.payload.conversation, user: e.payload.user, workflow: o });
  return { updatedWorkflow: o };
};
S();
A();
k();
var LT = (t3) => async (e) => {
  let n = jT(e.headers), r = new ci, o = new Uk({ botId: n.botId, retry: Bo }), s = new dn(o, { before: { createMessage: async (a) => {
    let l = t3.hookHandlers.before_outgoing_message[a.type] ?? [];
    for (let c of l) {
      let f = new dn(o);
      a = (await c({ client: f, ctx: n, logger: r.with({ conversationId: a.conversationId, userId: a.userId }), data: a }))?.data ?? a;
    }
    return a;
  }, callAction: async (a) => {
    let l = t3.hookHandlers.before_outgoing_call_action[a.type] ?? [];
    for (let c of l) {
      let f = new dn(o);
      a = (await c({ client: f, ctx: n, logger: r, data: a }))?.data ?? a;
    }
    return a;
  } }, after: { createMessage: async (a) => {
    let l = t3.hookHandlers.after_outgoing_message[a.message.type] ?? [];
    for (let c of l) {
      let f = new dn(o);
      a = (await c({ client: f, ctx: n, logger: r.with({ messageId: a.message.id, conversationId: a.message.conversationId, userId: a.message.userId }), data: a }))?.data ?? a;
    }
    return a;
  }, callAction: async (a, l) => {
    let { type: c } = l, f = t3.hookHandlers.after_outgoing_call_action[c] ?? [];
    for (let g of f) {
      let p = new dn(o);
      a = (await g({ client: p, ctx: n, logger: r, data: { type: c, ...a } }))?.data ?? a;
    }
    return a;
  } } }), i = { req: e, ctx: n, logger: r, client: s, self: t3 };
  try {
    switch (n.operation) {
      case "action_triggered":
        return await uA(i);
      case "event_received":
        return await lA(i);
      case "register":
        return await sA(i);
      case "unregister":
        return await aA(i);
      case "ping":
        return await oA(i);
      default:
        throw new Error(`Unknown operation ${n.operation}`);
    }
  } catch (a) {
    let l = a instanceof Error ? a : new Error(String(a));
    if (RP(l)) {
      let f = l.type === "Runtime" ? l : new ps(l.message, l);
      return r.error(f.message), { status: f.code, body: JSON.stringify(f.toJSON()) };
    }
    let c = new ps("An unexpected error occurred in the bot.", l);
    return r.error(c.message, l), { status: c.code, body: JSON.stringify(c.toJSON()) };
  }
};
var oA = async (t3) => ct;
var sA = async (t3) => (await t3.self.registerHandler?.({ client: t3.client, ctx: t3.ctx, logger: t3.logger }), ct);
var aA = async (t3) => ct;
var lA = async (t3) => {
  let { ctx: e, logger: n, req: r, client: o, self: s } = t3, i = { client: o, ctx: e, logger: n }, a = Nt(r);
  if (i.logger = i.logger.with({ eventId: a.event.id, messageId: a.event.messageId, conversationId: a.event.conversationId, userId: a.event.userId }), e.type === "workflow_update")
    return await $T(t3, a.event);
  if (e.type === "message_created") {
    let y = a.event, T = y.payload.message, P = y.payload.user, B = y.payload.conversation;
    i.logger = i.logger.with({ messageId: T.id, conversationId: T.conversationId, userId: T.userId });
    let v = s.hookHandlers.before_incoming_message[T.type] ?? [];
    for (let $ of v) {
      let Q = await $({ ...i, user: P, conversation: B, data: T });
      if (T = Q?.data ?? T, Q?.stop)
        return ct;
    }
    let E = { ...i, user: P, conversation: B, message: T, event: y }, I = s.messageHandlers[T.type] ?? [];
    for (let $ of I)
      await $(E);
    let D = s.hookHandlers.after_incoming_message[T.type] ?? [];
    for (let $ of D) {
      let Q = await $({ ...i, user: P, conversation: B, data: T });
      if (T = Q?.data ?? T, Q?.stop)
        return ct;
    }
    return ct;
  }
  if (e.type === "state_expired") {
    let T = a.event.payload.state, P = { ...i, state: T }, B = s.stateExpiredHandlers[T.name] ?? [];
    for (let v of B)
      await v(P);
    return ct;
  }
  let l = a.event, c = s.hookHandlers.before_incoming_event[l.type] ?? [];
  for (let y of c) {
    let T = await y({ ...i, data: l });
    if (l = T?.data ?? l, T?.stop)
      return ct;
  }
  let f = { ...i, event: l }, g = s.eventHandlers[l.type] ?? [];
  for (let y of g)
    await y(f);
  let p = s.hookHandlers.after_incoming_event[l.type] ?? [];
  for (let y of p) {
    let T = await y({ ...i, data: l });
    if (l = T?.data ?? l, T?.stop)
      return ct;
  }
  return ct;
};
var uA = async ({ ctx: t3, logger: e, req: n, client: r, self: o }) => {
  let { input: s, type: i } = Nt(n);
  if (!i)
    throw new Error("Missing action type");
  let a = o.hookHandlers.before_incoming_call_action[i] ?? [];
  for (let p of a) {
    let y = await p({ ctx: t3, logger: e, client: r, data: { type: i, input: s } });
    s = y?.data?.input ?? s, i = y?.data?.type ?? i;
  }
  let l = o.actionHandlers[i];
  if (!l)
    throw new Error(`Action ${i} not found`);
  let c = await l({ ctx: t3, logger: e, input: s, client: r, type: i }), f = o.hookHandlers.after_incoming_call_action[i] ?? [];
  for (let p of f) {
    let y = await p({ ctx: t3, logger: e, client: r, data: { type: i, output: c } });
    i = y?.data?.type ?? i, c = y?.data?.output ?? c;
  }
  return { status: 200, body: JSON.stringify({ output: c }) };
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
var qt = (t3, { alias: e }) => {
  if (!("tags" in t3) || !e)
    return t3;
  let n = `${e}${Dt}`, r = Object.fromEntries(Object.entries(t3.tags ?? {}).flatMap(([o, s]) => o.startsWith(n) ? [[o.slice(n.length), s]] : []));
  return { ...t3, tags: r };
};
var ft = (t3, { alias: e }) => {
  if (!("tags" in t3) || !e)
    return t3;
  let n = `${e}${Dt}`, r = Object.fromEntries(Object.entries(t3.tags ?? {}).map(([o, s]) => [o.startsWith(n) ? o : `${n}${o}`, s]));
  return { ...t3, tags: r };
};
S();
A();
k();
var Cl = class {
  constructor(e) {
    this._list = e;
  }
  _nextToken;
  _elementsBuffer = [];
  _isExhausted = false;
  [Symbol.asyncIterator]() {
    return this;
  }
  async next() {
    return this._bufferIsEmpty && !this._isExhausted && await this._fetchNextPageIntoBuffer(), this._bufferIsEmpty ? { done: true, value: undefined } : { done: false, value: this._elementsBuffer.shift() };
  }
  async take(e) {
    let n = [];
    for (let r = 0;r < e; ++r) {
      let o = await this.next();
      if (o.done)
        break;
      n.push(o.value);
    }
    return n;
  }
  async takePage(e) {
    for (let r = 0;r < e; ++r)
      this._isExhausted || await this._fetchNextPageIntoBuffer();
    let n = [...this._elementsBuffer];
    return this._elementsBuffer.length = 0, n;
  }
  async takeAll() {
    return this.take(Number.POSITIVE_INFINITY);
  }
  get isExhausted() {
    return this._isExhausted;
  }
  async _fetchNextPageIntoBuffer() {
    let { items: e, meta: n } = await this._list({ nextToken: this._nextToken });
    this._elementsBuffer.push(...e), this._nextToken = n.nextToken, n.nextToken || (this._isExhausted = true);
  }
  get _bufferIsEmpty() {
    return this._elementsBuffer.length === 0;
  }
};
var St = (t3) => new Cl(t3);
var fn = (t3) => new Proxy({}, { get: (e, n) => ({ listInstances: (r) => St(({ nextToken: o }) => t3.client.listWorkflows({ ...r, name: n, nextToken: o }).then(({ meta: s, workflows: i }) => ({ meta: s, items: i.map((a) => kt({ ...t3, workflow: a })) }))), startNewInstance: async (r) => {
  let { workflow: o } = await t3.client.createWorkflow({ name: n, status: "pending", ...ft(r, { alias: undefined }) });
  return { workflow: kt({ ...t3, workflow: o }) };
} }) });
var kt = (t3) => {
  let e = false;
  return { ...qt(t3.workflow, { alias: undefined }), async update(n) {
    let { workflow: r } = await t3.client.updateWorkflow({ id: t3.workflow.id, ...ft(n, { alias: undefined }) });
    return await t3.onWorkflowUpdate?.(r), { workflow: kt({ ...t3, workflow: r }) };
  }, async acknowledgeStartOfProcessing() {
    if (!t3.event || t3.workflow.status !== "pending" || e)
      return { workflow: kt(t3) };
    let { workflow: n } = await t3.client.updateWorkflow({ id: t3.workflow.id, status: "in_progress", eventId: t3.event.id });
    return e = true, await t3.onWorkflowUpdate?.(n), { workflow: kt({ ...t3, workflow: n }) };
  }, async setFailed({ failureReason: n }) {
    let { workflow: r } = await t3.client.updateWorkflow({ id: t3.workflow.id, status: "failed", failureReason: n });
    return await t3.onWorkflowUpdate?.(r), { workflow: kt({ ...t3, workflow: r }) };
  }, async setCompleted({ output: n } = {}) {
    let { workflow: r } = await t3.client.updateWorkflow({ id: t3.workflow.id, status: "completed", output: n });
    return await t3.onWorkflowUpdate?.(r), { workflow: kt({ ...t3, workflow: r }) };
  }, async cancel() {
    let { workflow: n } = await t3.client.updateWorkflow({ id: t3.workflow.id, status: "cancelled" });
    return await t3.onWorkflowUpdate?.(n), { workflow: kt({ ...t3, workflow: n }) };
  } };
};
S();
A();
k();
var Ol = class {
  constructor(e) {
    this.props = e;
    this._registerHandler = e.register, this._actionHandlers = e.actions, this._plugins = e.plugins;
  }
  _registerHandler;
  _actionHandlers;
  _messageHandlers = {};
  _eventHandlers = {};
  _stateExpiredHandlers = {};
  _hookHandlers = { before_incoming_event: {}, before_incoming_message: {}, before_outgoing_message: {}, before_outgoing_call_action: {}, before_incoming_call_action: {}, after_incoming_event: {}, after_incoming_message: {}, after_outgoing_message: {}, after_outgoing_call_action: {}, after_incoming_call_action: {} };
  _workflowHandlers = { started: {}, continued: {}, timed_out: {} };
  _plugins = {};
  _registerOrder = 0;
  get registerHandler() {
    return this._registerHandler;
  }
  get actionHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = this._actionHandlers[n];
      if (r)
        return ut.setName((o) => r({ ...o, workflows: fn(o) }), r.name);
      for (let [o, s] of Object.entries(this._plugins)) {
        let [i, a] = n.split(Dt);
        if (!(i !== o || !a))
          return s.actionHandlers[a];
      }
    } });
  }
  get messageHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = Object.values(this._plugins).flatMap((a) => a.messageHandlers[n] ?? []), o = n === "*" ? [] : this._messageHandlers[n] ?? [], s = this._messageHandlers["*"] ?? [], i = [...o, ...s].sort((a, l) => a.order - l.order).map(({ handler: a }) => ut.setName((l) => a({ ...l, workflows: fn(l) }), a.name));
      return ue.unique([...r, ...i]);
    } });
  }
  get eventHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = Object.values(this._plugins).flatMap((a) => a.eventHandlers[n] ?? []), o = n === "*" ? [] : this._eventHandlers[n] ?? [], s = this._eventHandlers["*"] ?? [], i = [...o, ...s].sort((a, l) => a.order - l.order).map(({ handler: a }) => ut.setName((l) => a({ ...l, workflows: fn(l) }), a.name));
      return ue.unique([...r, ...i]);
    } });
  }
  get stateExpiredHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = Object.values(this._plugins).flatMap((a) => a.stateExpiredHandlers[n] ?? []), o = n === "*" ? [] : this._stateExpiredHandlers[n] ?? [], s = this._stateExpiredHandlers["*"] ?? [], i = [...o, ...s].sort((a, l) => a.order - l.order).map(({ handler: a }) => ut.setName((l) => a({ ...l, workflows: fn(l) }), a.name));
      return ue.unique([...r, ...i]);
    } });
  }
  get hookHandlers() {
    return new Proxy({}, { get: (e, n) => {
      if (this._hookHandlers[n])
        return new Proxy({}, { get: (o, s) => {
          let i = Object.values(this._plugins).flatMap((g) => g.hookHandlers[n]?.[s] ?? []), a = this._hookHandlers[n] ?? {}, l = s === "*" ? [] : a[s] ?? [], c = a["*"] ?? [], f = [...l, ...c].sort((g, p) => g.order - p.order).map(({ handler: g }) => ut.setName((p) => g({ ...p, workflows: fn(p) }), g.name));
          return ue.unique([...i, ...f]);
        } });
    } });
  }
  get workflowHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = this._workflowHandlers[n];
      if (r)
        return new Proxy({}, { get: (o, s) => {
          let i = r[s]?.sort((l, c) => l.order - c.order).map(({ handler: l }) => ut.setName(async (c) => {
            let f = c.workflow;
            return await l({ ...c, workflow: kt({ ...c, onWorkflowUpdate(g) {
              f = g;
            } }), workflows: fn(c) }), f;
          }, l.name)) ?? [], a = Object.values(this._plugins).flatMap((l) => l.workflowHandlers[n]?.[s] ?? []);
          return ue.unique([...i, ...a]);
        } });
    } });
  }
  on = { message: (e, n) => {
    this._messageHandlers[e] = ue.safePush(this._messageHandlers[e], { handler: n, order: this._registerOrder++ });
  }, event: (e, n) => {
    this._eventHandlers[e] = ue.safePush(this._eventHandlers[e], { handler: n, order: this._registerOrder++ });
  }, stateExpired: (e, n) => {
    this._stateExpiredHandlers[e] = ue.safePush(this._stateExpiredHandlers[e], { handler: n, order: this._registerOrder++ });
  }, beforeIncomingEvent: (e, n) => {
    this._hookHandlers.before_incoming_event[e] = ue.safePush(this._hookHandlers.before_incoming_event[e], { handler: n, order: this._registerOrder++ });
  }, beforeIncomingMessage: (e, n) => {
    this._hookHandlers.before_incoming_message[e] = ue.safePush(this._hookHandlers.before_incoming_message[e], { handler: n, order: this._registerOrder++ });
  }, beforeOutgoingMessage: (e, n) => {
    this._hookHandlers.before_outgoing_message[e] = ue.safePush(this._hookHandlers.before_outgoing_message[e], { handler: n, order: this._registerOrder++ });
  }, beforeOutgoingCallAction: (e, n) => {
    this._hookHandlers.before_outgoing_call_action[e] = ue.safePush(this._hookHandlers.before_outgoing_call_action[e], { handler: n, order: this._registerOrder++ });
  }, beforeIncomingCallAction: (e, n) => {
    this._hookHandlers.before_incoming_call_action[e] = ue.safePush(this._hookHandlers.before_incoming_call_action[e], { handler: n, order: this._registerOrder++ });
  }, afterIncomingEvent: (e, n) => {
    this._hookHandlers.after_incoming_event[e] = ue.safePush(this._hookHandlers.after_incoming_event[e], { handler: n, order: this._registerOrder++ });
  }, afterIncomingMessage: (e, n) => {
    this._hookHandlers.after_incoming_message[e] = ue.safePush(this._hookHandlers.after_incoming_message[e], { handler: n, order: this._registerOrder++ });
  }, afterOutgoingMessage: (e, n) => {
    this._hookHandlers.after_outgoing_message[e] = ue.safePush(this._hookHandlers.after_outgoing_message[e], { handler: n, order: this._registerOrder++ });
  }, afterOutgoingCallAction: (e, n) => {
    this._hookHandlers.after_outgoing_call_action[e] = ue.safePush(this._hookHandlers.after_outgoing_call_action[e], { handler: n, order: this._registerOrder++ });
  }, afterIncomingCallAction: (e, n) => {
    this._hookHandlers.after_incoming_call_action[e] = ue.safePush(this._hookHandlers.after_incoming_call_action[e], { handler: n, order: this._registerOrder++ });
  }, workflowStart: (e, n) => {
    this._workflowHandlers.started[e] = ue.safePush(this._workflowHandlers.started[e], { handler: n, order: this._registerOrder++ });
  }, workflowContinue: (e, n) => {
    this._workflowHandlers.continued[e] = ue.safePush(this._workflowHandlers.continued[e], { handler: n, order: this._registerOrder++ });
  }, workflowTimeout: (e, n) => {
    this._workflowHandlers.timed_out[e] = ue.safePush(this._workflowHandlers.timed_out[e], { handler: n, order: this._registerOrder++ });
  } };
  handler = LT(this);
  start = (e) => wo(this.handler, e);
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var Rl = class {
  constructor(e) {
    this.props = e;
    this.name = e.name, this.version = e.version, this.icon = e.icon, this.title = e.title, this.description = e.description, this.readme = e.readme, this.entities = e.entities ?? {}, this.attributes = e.attributes, this.__advanced = e.__advanced;
    let n = this._getEntityReference(this.entities), r = e.events === undefined ? {} : je.mapValues(e.events, (i) => ({ ...i, schema: i.schema(n) })), o = e.actions === undefined ? {} : je.mapValues(e.actions, (i) => ({ ...i, input: { ...i.input, schema: i.input.schema(n) }, output: { ...i.output, schema: i.output.schema(n) } })), s = e.channels === undefined ? {} : je.mapValues(e.channels, (i) => ({ ...i, messages: je.mapValues(i.messages, (a) => ({ ...a, schema: a.schema(n) })) }));
    this.events = r, this.actions = o, this.channels = s;
  }
  name;
  version;
  title;
  description;
  icon;
  readme;
  attributes;
  entities;
  events;
  actions;
  channels;
  __advanced;
  get metadata() {
    return { sdkVersion: bn };
  }
  _getEntityReference = (e) => {
    let n = {};
    for (let [r, o] of Object.entries(e)) {
      let s = o.schema._def["x-zui"]?.title, i = o.schema._def.description, a = ne.ref(r);
      s && a.title(s), i && a.describe(i), n[r] = a;
    }
    return n;
  };
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var Ml = class {
  constructor(e) {
    this.props = e;
    let n = Object.fromEntries(Object.entries(e.interfaces ?? {}).map(([o, s]) => [o, Object.fromEntries(Object.entries(s.definition.entities ?? {}).map(([i]) => [i, ne.ref(`interface:${o}/entities/${i}`)]))]));
    this.name = e.name, this.version = e.version, this.icon = e.icon, this.readme = e.readme, this.title = e.title, this.description = e.description, this.integrations = e.integrations, this.interfaces = e.interfaces, this.user = e.user, this.conversation = e.conversation, this.message = e.message, this.recurringEvents = e.recurringEvents, this.workflows = e.workflows, this.attributes = e.attributes, this.__advanced = e.__advanced;
    let r = new Set;
    for (let o of [...Object.keys(e.integrations ?? {}), ...Object.keys(e.interfaces ?? {})]) {
      if (r.has(o))
        throw new vt(`Duplicate interface or integration alias detected in plugin definition: '${o}'. Please use unique aliases for each interface and integration.`);
      r.add(o);
    }
    this.configuration = e.configuration ? { ...e.configuration, schema: typeof e.configuration.schema == "object" ? e.configuration.schema : e.configuration.schema({ entities: n }) } : undefined, this.states = Object.fromEntries(Object.entries(e.states ?? {}).map(([o, s]) => [o, { ...s, schema: typeof s.schema == "object" ? s.schema : s.schema({ entities: n }) }])), this.events = Object.fromEntries(Object.entries(e.events ?? {}).map(([o, s]) => [o, { ...s, schema: typeof s.schema == "object" ? s.schema : s.schema({ entities: n }) }])), this.actions = Object.fromEntries(Object.entries(e.actions ?? {}).map(([o, s]) => [o, { ...s, input: { ...s.input, schema: typeof s.input.schema == "object" ? s.input.schema : s.input.schema({ entities: n }) }, output: { ...s.output, schema: typeof s.output.schema == "object" ? s.output.schema : s.output.schema({ entities: n }) } }])), this.tables = Object.fromEntries(Object.entries(e.tables ?? {}).map(([o, s]) => [o, { ...s, schema: typeof s.schema == "object" ? s.schema : s.schema({ entities: n }) }]));
  }
  name;
  version;
  title;
  description;
  icon;
  readme;
  attributes;
  integrations;
  interfaces;
  user;
  conversation;
  message;
  states;
  configuration;
  events;
  recurringEvents;
  actions;
  tables;
  workflows;
  __advanced;
  get metadata() {
    return { sdkVersion: bn };
  }
  dereferenceEntities({ intersectWithUnknownRecord: e } = { intersectWithUnknownRecord: true }) {
    let n = this._buildZuiReferenceMap(e);
    return { ...this, configuration: this.configuration ? { ...this.configuration, schema: this._dereferenceZuiSchema(this.configuration.schema, n) } : undefined, events: this._dereferenceDefinitionSchemas(this.events, n), states: this._dereferenceDefinitionSchemas(this.states, n), tables: this._dereferenceDefinitionSchemas(this.tables, n), actions: this._dereferenceActionDefinitionSchemas(this.actions, n) };
  }
  _buildZuiReferenceMap(e) {
    return Object.fromEntries(Object.entries(this.interfaces ?? {}).flatMap(([n, r]) => Object.entries(r.definition.entities ?? {}).map(([o, s]) => [`interface:${n}/entities/${o}`, e ? s.schema.and(ne.record(ne.string(), ne.unknown())) : s.schema])));
  }
  _dereferenceZuiSchema(e, n) {
    return e.dereference(n);
  }
  _dereferenceDefinitionSchemas(e, n) {
    return Object.fromEntries(Object.entries(e ?? {}).map(([r, o]) => [r, { ...o, schema: this._dereferenceZuiSchema(o.schema, n) }]));
  }
  _dereferenceActionDefinitionSchemas(e, n) {
    return Object.fromEntries(Object.entries(e ?? {}).map(([r, o]) => [r, { ...o, input: { schema: this._dereferenceZuiSchema(o.input.schema, n) }, output: { schema: this._dereferenceZuiSchema(o.output.schema, n) } }]));
  }
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
var WT = (t3, e) => new Proxy({}, { get: (n, r) => new Proxy({}, { get: (o, s) => (i) => {
  let a = (e.integrations[r] ?? e.interfaces[r])?.integrationAlias, l = e.interfaces[r]?.actions?.[s]?.name ?? s;
  return t3.callAction({ type: `${a}:${l}`, input: i }).then((c) => c.output);
} }) });
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var Nl = (t3) => ({ async getById({ id: e }) {
  let n = await t3.client.getMessage({ id: e });
  return Ht({ ...t3, message: n.message });
}, list(e) {
  return St(({ nextToken: n }) => t3.client.listMessages({ ...ft(e ?? {}, { alias: t3.plugin?.alias }), nextToken: n }).then(({ meta: r, messages: o }) => ({ meta: r, items: o.map((s) => Ht({ ...t3, message: s })) })));
} });
var Ht = (t3) => ({ ...qt(t3.message, { alias: t3.plugin?.alias }), async delete() {
  await t3.client.deleteMessage({ id: t3.message.id });
}, async update(e) {
  let { message: n } = await t3.client.updateMessage({ ...ft(e, { alias: t3.plugin?.alias }), id: t3.message.id });
  return Ht({ ...t3, message: n });
} });
S();
A();
k();
S();
A();
k();
var Dl = (t3) => ({ list(e) {
  return St(({ nextToken: n }) => t3.client.listUsers({ ...ft(e ?? {}, { alias: t3.pluginAlias }), nextToken: n }).then(({ meta: r, users: o }) => ({ meta: r, items: o.map((s) => Ut({ ...t3, conversationId: e?.conversationId, user: s })) })));
}, async getById({ id: e }) {
  let n = await t3.client.getUser({ id: e });
  return Ut({ ...t3, user: n.user, conversationId: undefined });
} });
var Ut = (t3) => {
  let e = { ...qt(t3.user, { alias: t3.pluginAlias }), async update(n) {
    let { user: r } = await t3.client.updateUser({ ...ft(n, { alias: t3.pluginAlias }), id: t3.user.id });
    return Ut({ ...t3, user: r });
  } };
  return t3.conversationId ? { ...e, async removeFromConversation() {
    return await t3.client.removeParticipant({ id: t3.conversationId, userId: t3.user.id }), Ut({ ...t3, conversationId: undefined });
  } } : { ...e, async addToConversation({ conversationId: n }) {
    let { participant: r } = await t3.client.addParticipant({ id: n, userId: t3.user.id });
    return Ut({ ...t3, user: r, conversationId: n });
  } };
};
S();
A();
k();
var Hl = (t3) => new Proxy({}, { get: (e, n) => new Proxy({}, { get: (r, o) => ({ list(s) {
  let i = t3.plugin?.interfaces[n]?.integrationAlias ?? t3.plugin?.integrations[n]?.integrationAlias, a = t3.plugin?.interfaces[n]?.channels?.[o]?.name ?? o;
  return St(({ nextToken: l }) => t3.client.listConversations({ ...ft(s ?? {}, { alias: t3.plugin?.alias }), channel: a === "*" ? undefined : a, integrationName: i === "*" ? undefined : i, nextToken: l }).then(({ meta: c, conversations: f }) => ({ meta: c, items: f.map((g) => Qn({ ...t3, conversation: g })) })));
}, async getById({ id: s }) {
  let i = await t3.client.getConversation({ id: s });
  return Qn({ ...t3, conversation: i.conversation });
} }) }) });
var Qn = (t3) => {
  let e = t3.client;
  return { ...qt(t3.conversation, { alias: t3.plugin?.alias }), async delete() {
    await e.deleteConversation({ id: t3.conversation.id });
  }, async update(n) {
    let { conversation: r } = await e.updateConversation({ ...ft(n, { alias: t3.plugin?.alias }), id: t3.conversation.id });
    return Qn({ ...t3, conversation: r });
  }, async getMessage({ id: n }) {
    let r = await e.getMessage({ id: n });
    return Ht({ ...t3, message: r.message });
  }, async getOrCreateMessage(n) {
    let { message: r } = await e.getOrCreateMessage({ ...ft(n, { alias: t3.plugin?.alias }), conversationId: t3.conversation.id });
    return Ht({ ...t3, message: r });
  }, async createMessage(n) {
    let { message: r } = await e.createMessage({ ...ft(n, { alias: t3.plugin?.alias }), conversationId: t3.conversation.id });
    return Ht({ ...t3, message: r });
  }, listMessages(n) {
    return St(({ nextToken: r }) => e.listMessages({ ...ft(n ?? {}, { alias: t3.plugin?.alias }), conversationId: t3.conversation.id, nextToken: r }).then(({ meta: o, messages: s }) => ({ meta: o, items: s.map((i) => Ht({ ...t3, message: i })) })));
  }, listParticipants() {
    return St(({ nextToken: n }) => e.listParticipants({ id: t3.conversation.id, nextToken: n }).then(({ meta: r, participants: o }) => ({ meta: r, items: o.map((s) => Ut({ ...t3, user: s, conversationId: t3.conversation.id })) })));
  } };
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
var Ul = class t3 {
  constructor(e) {
    this._props = e;
  }
  async emit(e) {
    let { conversationId: n, userId: r, messageId: o } = this._props, { event: s } = await this._props.client.createEvent({ type: this._props.eventName, payload: e, conversationId: n, userId: r, messageId: o });
    return s;
  }
  async schedule(e, n) {
    let { conversationId: r, userId: o, messageId: s } = this._props, { event: i } = await this._props.client.createEvent({ type: this._props.eventName, payload: e, conversationId: r, userId: o, messageId: s, schedule: n });
    return i;
  }
  withConversationId(e) {
    return new t3({ ...this._props, conversationId: e });
  }
  withUserId(e) {
    return new t3({ ...this._props, userId: e });
  }
  withMessageId(e) {
    return new t3({ ...this._props, messageId: e });
  }
  async getById(e) {
    return (await this._props.client.getEvent({ id: e.id })).event;
  }
  list(e) {
    return St(({ nextToken: n }) => this._props.client.listEvents({ ...e, type: this._props.eventName, conversationId: this._props.conversationId, userId: this._props.userId, messageId: this._props.messageId, nextToken: n }).then(({ meta: r, events: o }) => ({ meta: r, items: o })));
  }
};
var KT = (t4, e) => new Proxy({}, { get: (n, r) => {
  let o = e.alias !== undefined ? `${e.alias}${Dt}${r}` : r;
  return new Ul({ client: t4, eventName: o });
} });
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var jl = class {
  constructor(e, n, r) {
    this._client = e;
    this._stateType = n;
    this._stateName = r;
  }
  async get(e) {
    return await this._client.getState({ type: this._stateType, name: this._stateName, id: e }).then((n) => n.state.payload);
  }
  async set(e, n, r) {
    await this._client.setState({ type: this._stateType, name: this._stateName, id: e, payload: n, expiry: r?.expiryMs });
  }
  async getOrSet(e, n, r) {
    return await this._client.getOrSetState({ type: this._stateType, name: this._stateName, id: e, payload: n, expiry: r?.expiryMs }).then((o) => o.state.payload);
  }
  async delete(e) {
    await this._client.setState({ type: this._stateType, name: this._stateName, id: e, payload: null });
  }
  async patch(e, n) {
    await this._client.patchState({ type: this._stateType, name: this._stateName, id: e, payload: n });
  }
};
var FT = (t4, e) => new Proxy({}, { get: (n, r) => new Proxy({}, { get: (o, s) => {
  let i = e.alias !== undefined ? `${e.alias}${Dt}${s}` : s;
  return new jl(t4, r, i);
} }) });
S();
A();
k();
var cA = (t4) => ("user" in t4) && ("conversation" in t4);
var $l = class {
  constructor(e) {
    this.props = e;
    this._actionHandlers = e.actions;
  }
  _runtimeProps;
  _actionHandlers;
  _messageHandlers = {};
  _eventHandlers = {};
  _stateExpiredHandlers = {};
  _hookHandlers = { before_incoming_event: {}, before_incoming_message: {}, before_outgoing_message: {}, before_outgoing_call_action: {}, before_incoming_call_action: {}, after_incoming_event: {}, after_incoming_message: {}, after_outgoing_message: {}, after_outgoing_call_action: {}, after_incoming_call_action: {} };
  _workflowHandlers = { started: {}, continued: {}, timed_out: {} };
  _registerOrder = 0;
  initialize(e) {
    return this._runtimeProps = e, this;
  }
  get _runtime() {
    if (!this._runtimeProps)
      throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");
    return this._runtimeProps;
  }
  _getTools(e) {
    let { configuration: n, interfaces: r, integrations: o, alias: s } = this._runtime, i = WT(e, this._runtime), a = FT(e, this._runtime), l = fn({ client: e, pluginAlias: this._runtime.alias }), c = KT(e, this._runtime), f = Dl({ client: e, pluginAlias: this._runtime.alias }), g = Hl({ client: e, plugin: this._runtime }), p = Nl({ client: e, plugin: this._runtime });
    return { configuration: n, interfaces: r, integrations: o, actions: i, states: a, alias: s, workflows: l, events: c, users: f, conversations: g, messages: p };
  }
  get actionHandlers() {
    return new Proxy({}, { get: (e, n) => {
      n = this._stripAliasPrefix(n);
      let r = this._actionHandlers[n];
      if (r)
        return ut.setName((o) => r({ ...o, ...this._getTools(o.client) }), r.name);
    } });
  }
  get messageHandlers() {
    return new Proxy({}, { get: (e, n) => {
      n = this._stripAliasPrefix(n);
      let r = n === "*" ? [] : this._messageHandlers[n] ?? [], o = this._messageHandlers["*"] ?? [];
      return ue.unique([...r, ...o]).sort((i, a) => i.order - a.order).map(({ handler: i }) => ut.setName((a) => i({ ...a, user: Ut({ ...a, conversationId: a.conversation.id, pluginAlias: this._runtime.alias }), message: Ht({ ...a, plugin: this._runtime, message: a.message }), conversation: Qn({ ...a, plugin: this._runtime, conversation: a.conversation }), ...this._getTools(a.client) }), i.name));
    } });
  }
  get eventHandlers() {
    return new Proxy({}, { get: (e, n) => {
      n = this._stripAliasPrefix(n);
      let r = n === "*" ? [] : this._eventHandlers[n] ?? [], o = Object.entries(this._eventHandlers).filter(([a]) => this._eventResolvesTo(a, n)).flatMap(([, a]) => a ?? []), s = this._eventHandlers["*"] ?? [];
      return ue.unique([...r, ...o, ...s]).sort((a, l) => a.order - l.order).map(({ handler: a }) => ut.setName((l) => a({ ...l, ...this._getTools(l.client) }), a.name));
    } });
  }
  get stateExpiredHandlers() {
    return new Proxy({}, { get: (e, n) => {
      n = this._stripAliasPrefix(n);
      let r = n === "*" ? [] : this._stateExpiredHandlers[n] ?? [], o = this._stateExpiredHandlers["*"] ?? [];
      return ue.unique([...r, ...o]).sort((i, a) => i.order - a.order).map(({ handler: i }) => ut.setName((a) => i({ ...a, ...this._getTools(a.client) }), i.name));
    } });
  }
  get hookHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = this._hookHandlers[n];
      if (r)
        return new Proxy({}, { get: (o, s) => {
          s = this._stripAliasPrefix(s);
          let i = s === "*" ? [] : r[s] ?? [], a = Object.entries(r).filter(([f]) => this._eventResolvesTo(f, s)).flatMap(([, f]) => f ?? []), l = r["*"] ?? [];
          return ue.unique([...i, ...a, ...l]).sort((f, g) => f.order - g.order).map(({ handler: f }) => ut.setName((g) => {
            let p = qt(g.data, { alias: this._runtime.alias }), y = this._getTools(g.client), T = {};
            if (cA(g)) {
              let P = Ut({ client: g.client, user: g.user, conversationId: g.conversation.id, pluginAlias: this._runtime.alias }), B = Qn({ client: g.client, plugin: this._runtime, conversation: g.conversation });
              T = { user: P, conversation: B };
            }
            return f({ ...g, data: p, ...T, ...y });
          }, f.name));
        } });
    } });
  }
  get workflowHandlers() {
    return new Proxy({}, { get: (e, n) => {
      let r = this._workflowHandlers[n];
      if (r)
        return new Proxy({}, { get: (o, s) => (r[s]?.sort((a, l) => a.order - l.order) ?? []).map(({ handler: a }) => ut.setName(async (l) => {
          let c = l.workflow;
          return await a({ ...l, workflow: kt({ ...l, workflow: c, onWorkflowUpdate(f) {
            c = f;
          }, pluginAlias: this._runtime.alias }), ...this._getTools(l.client) }), c;
        }, a.name)) });
    } });
  }
  on = { message: (e, n) => {
    this._messageHandlers[e] = ue.safePush(this._messageHandlers[e], { handler: n, order: this._registerOrder++ });
  }, event: (e, n) => {
    this._eventHandlers[e] = ue.safePush(this._eventHandlers[e], { handler: n, order: this._registerOrder++ });
  }, stateExpired: (e, n) => {
    this._stateExpiredHandlers[e] = ue.safePush(this._stateExpiredHandlers[e], { handler: n, order: this._registerOrder++ });
  }, beforeIncomingEvent: (e, n) => {
    this._hookHandlers.before_incoming_event[e] = ue.safePush(this._hookHandlers.before_incoming_event[e], { handler: n, order: this._registerOrder++ });
  }, beforeIncomingMessage: (e, n) => {
    this._hookHandlers.before_incoming_message[e] = ue.safePush(this._hookHandlers.before_incoming_message[e], { handler: n, order: this._registerOrder++ });
  }, beforeOutgoingMessage: (e, n) => {
    this._hookHandlers.before_outgoing_message[e] = ue.safePush(this._hookHandlers.before_outgoing_message[e], { handler: n, order: this._registerOrder++ });
  }, beforeOutgoingCallAction: (e, n) => {
    this._hookHandlers.before_outgoing_call_action[e] = ue.safePush(this._hookHandlers.before_outgoing_call_action[e], { handler: n, order: this._registerOrder++ });
  }, beforeIncomingCallAction: (e, n) => {
    this._hookHandlers.before_incoming_call_action[e] = ue.safePush(this._hookHandlers.before_incoming_call_action[e], { handler: n, order: this._registerOrder++ });
  }, afterIncomingEvent: (e, n) => {
    this._hookHandlers.after_incoming_event[e] = ue.safePush(this._hookHandlers.after_incoming_event[e], { handler: n, order: this._registerOrder++ });
  }, afterIncomingMessage: (e, n) => {
    this._hookHandlers.after_incoming_message[e] = ue.safePush(this._hookHandlers.after_incoming_message[e], { handler: n, order: this._registerOrder++ });
  }, afterOutgoingMessage: (e, n) => {
    this._hookHandlers.after_outgoing_message[e] = ue.safePush(this._hookHandlers.after_outgoing_message[e], { handler: n, order: this._registerOrder++ });
  }, afterOutgoingCallAction: (e, n) => {
    this._hookHandlers.after_outgoing_call_action[e] = ue.safePush(this._hookHandlers.after_outgoing_call_action[e], { handler: n, order: this._registerOrder++ });
  }, afterIncomingCallAction: (e, n) => {
    this._hookHandlers.after_incoming_call_action[e] = ue.safePush(this._hookHandlers.after_incoming_call_action[e], { handler: n, order: this._registerOrder++ });
  }, workflowStart: (e, n) => {
    this._workflowHandlers.started[e] = ue.safePush(this._workflowHandlers.started[e], { handler: n, order: this._registerOrder++ });
  }, workflowContinue: (e, n) => {
    this._workflowHandlers.continued[e] = ue.safePush(this._workflowHandlers.continued[e], { handler: n, order: this._registerOrder++ });
  }, workflowTimeout: (e, n) => {
    this._workflowHandlers.timed_out[e] = ue.safePush(this._workflowHandlers.timed_out[e], { handler: n, order: this._registerOrder++ });
  } };
  _eventResolvesTo = (e, n) => {
    let [o, s] = e.split(":");
    if (!o || !s)
      return false;
    let i = this._runtime.interfaces[o];
    if (i && n === `${i.integrationAlias}:${i?.events?.[s]?.name}`)
      return true;
    let a = this._runtime.integrations[o];
    return !!(a && n === `${a.integrationAlias}:${s}`);
  };
  _stripAliasPrefix = (e) => {
    let { alias: n } = this._runtime;
    if (!n)
      return e;
    let r = `${n}#`;
    return e.startsWith(r) ? e.slice(r.length) : e;
  };
};
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
S();
A();
k();
var zT = {};
pn(zT, { allWithinMajorOf: () => dA, allWithinMinorOf: () => fA });
S();
A();
k();
function dA(t4) {
  let e = di.major(t4.version);
  return { ...t4, version: `>=${e}.0.0 <${e + 1}.0.0` };
}
function fA(t4) {
  let e = di.major(t4.version), n = di.minor(t4.version);
  return { ...t4, version: `>=${e}.${n}.0 <${e}.${n + 1}.0` };
}
S();
A();
k();
/*! Bundled license information:

lodash-es/lodash.js:
  (**
   * @license
   * Lodash (Custom Build) <https://lodash.com/>
   * Build: `lodash modularize exports="es" -o ./`
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)
*/
/*! Bundled license information:

@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
  (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)

@jspm/core/nodelibs/browser/chunk-CcCWfKp1.js:
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
*/

export { Wm, ne, mC, yC, Nt, wo, Lh, Ka, oi, ui, Sl, kl, ci, dn, Ol, Rl, Ml, $l, zT };