@elghandour/fetchify
Version:
Universal wrapper for Fetch API
1,440 lines • 50.3 kB
JavaScript
function br(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
function Ar(r) {
if (r.__esModule)
return r;
var e = r.default;
if (typeof e == "function") {
var t = function n() {
if (this instanceof n) {
var a = [null];
a.push.apply(a, arguments);
var o = Function.bind.apply(e, a);
return new o();
}
return e.apply(this, arguments);
};
t.prototype = e.prototype;
} else
t = {};
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(r).forEach(function(n) {
var a = Object.getOwnPropertyDescriptor(r, n);
Object.defineProperty(t, n, a.get ? a : {
enumerable: !0,
get: function() {
return r[n];
}
});
}), t;
}
var Or = function() {
if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
return !1;
if (typeof Symbol.iterator == "symbol")
return !0;
var e = {}, t = Symbol("test"), n = Object(t);
if (typeof t == "string" || Object.prototype.toString.call(t) !== "[object Symbol]" || Object.prototype.toString.call(n) !== "[object Symbol]")
return !1;
var a = 42;
e[t] = a;
for (t in e)
return !1;
if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
return !1;
var o = Object.getOwnPropertySymbols(e);
if (o.length !== 1 || o[0] !== t || !Object.prototype.propertyIsEnumerable.call(e, t))
return !1;
if (typeof Object.getOwnPropertyDescriptor == "function") {
var f = Object.getOwnPropertyDescriptor(e, t);
if (f.value !== a || f.enumerable !== !0)
return !1;
}
return !0;
}, Ge = typeof Symbol < "u" && Symbol, wr = Or, Pr = function() {
return typeof Ge != "function" || typeof Symbol != "function" || typeof Ge("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : wr();
}, Er = "Function.prototype.bind called on incompatible ", ge = Array.prototype.slice, $r = Object.prototype.toString, Fr = "[object Function]", Ir = function(e) {
var t = this;
if (typeof t != "function" || $r.call(t) !== Fr)
throw new TypeError(Er + t);
for (var n = ge.call(arguments, 1), a, o = function() {
if (this instanceof a) {
var p = t.apply(
this,
n.concat(ge.call(arguments))
);
return Object(p) === p ? p : this;
} else
return t.apply(
e,
n.concat(ge.call(arguments))
);
}, f = Math.max(0, t.length - n.length), i = [], c = 0; c < f; c++)
i.push("$" + c);
if (a = Function("binder", "return function (" + i.join(",") + "){ return binder.apply(this,arguments); }")(o), t.prototype) {
var l = function() {
};
l.prototype = t.prototype, a.prototype = new l(), l.prototype = null;
}
return a;
}, xr = Ir, Me = Function.prototype.bind || xr, Rr = Me, Tr = Rr.call(Function.call, Object.prototype.hasOwnProperty), m, Q = SyntaxError, or = Function, V = TypeError, he = function(r) {
try {
return or('"use strict"; return (' + r + ").constructor;")();
} catch {
}
}, B = Object.getOwnPropertyDescriptor;
if (B)
try {
B({}, "");
} catch {
B = null;
}
var Se = function() {
throw new V();
}, Nr = B ? function() {
try {
return arguments.callee, Se;
} catch {
try {
return B(arguments, "callee").get;
} catch {
return Se;
}
}
}() : Se, k = Pr(), R = Object.getPrototypeOf || function(r) {
return r.__proto__;
}, z = {}, Mr = typeof Uint8Array > "u" ? m : R(Uint8Array), q = {
"%AggregateError%": typeof AggregateError > "u" ? m : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer > "u" ? m : ArrayBuffer,
"%ArrayIteratorPrototype%": k ? R([][Symbol.iterator]()) : m,
"%AsyncFromSyncIteratorPrototype%": m,
"%AsyncFunction%": z,
"%AsyncGenerator%": z,
"%AsyncGeneratorFunction%": z,
"%AsyncIteratorPrototype%": z,
"%Atomics%": typeof Atomics > "u" ? m : Atomics,
"%BigInt%": typeof BigInt > "u" ? m : BigInt,
"%Boolean%": Boolean,
"%DataView%": typeof DataView > "u" ? m : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": Error,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": EvalError,
"%Float32Array%": typeof Float32Array > "u" ? m : Float32Array,
"%Float64Array%": typeof Float64Array > "u" ? m : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? m : FinalizationRegistry,
"%Function%": or,
"%GeneratorFunction%": z,
"%Int8Array%": typeof Int8Array > "u" ? m : Int8Array,
"%Int16Array%": typeof Int16Array > "u" ? m : Int16Array,
"%Int32Array%": typeof Int32Array > "u" ? m : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": k ? R(R([][Symbol.iterator]())) : m,
"%JSON%": typeof JSON == "object" ? JSON : m,
"%Map%": typeof Map > "u" ? m : Map,
"%MapIteratorPrototype%": typeof Map > "u" || !k ? m : R((/* @__PURE__ */ new Map())[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": Object,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise > "u" ? m : Promise,
"%Proxy%": typeof Proxy > "u" ? m : Proxy,
"%RangeError%": RangeError,
"%ReferenceError%": ReferenceError,
"%Reflect%": typeof Reflect > "u" ? m : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set > "u" ? m : Set,
"%SetIteratorPrototype%": typeof Set > "u" || !k ? m : R((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? m : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": k ? R(""[Symbol.iterator]()) : m,
"%Symbol%": k ? Symbol : m,
"%SyntaxError%": Q,
"%ThrowTypeError%": Nr,
"%TypedArray%": Mr,
"%TypeError%": V,
"%Uint8Array%": typeof Uint8Array > "u" ? m : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? m : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array > "u" ? m : Uint16Array,
"%Uint32Array%": typeof Uint32Array > "u" ? m : Uint32Array,
"%URIError%": URIError,
"%WeakMap%": typeof WeakMap > "u" ? m : WeakMap,
"%WeakRef%": typeof WeakRef > "u" ? m : WeakRef,
"%WeakSet%": typeof WeakSet > "u" ? m : WeakSet
}, Dr = function r(e) {
var t;
if (e === "%AsyncFunction%")
t = he("async function () {}");
else if (e === "%GeneratorFunction%")
t = he("function* () {}");
else if (e === "%AsyncGeneratorFunction%")
t = he("async function* () {}");
else if (e === "%AsyncGenerator%") {
var n = r("%AsyncGeneratorFunction%");
n && (t = n.prototype);
} else if (e === "%AsyncIteratorPrototype%") {
var a = r("%AsyncGenerator%");
a && (t = R(a.prototype));
}
return q[e] = t, t;
}, He = {
"%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"]
}, ie = Me, se = Tr, Cr = ie.call(Function.call, Array.prototype.concat), _r = ie.call(Function.apply, Array.prototype.splice), ke = ie.call(Function.call, String.prototype.replace), de = ie.call(Function.call, String.prototype.slice), Br = ie.call(Function.call, RegExp.prototype.exec), Ur = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, Wr = /\\(\\)?/g, Lr = function(e) {
var t = de(e, 0, 1), n = de(e, -1);
if (t === "%" && n !== "%")
throw new Q("invalid intrinsic syntax, expected closing `%`");
if (n === "%" && t !== "%")
throw new Q("invalid intrinsic syntax, expected opening `%`");
var a = [];
return ke(e, Ur, function(o, f, i, c) {
a[a.length] = i ? ke(c, Wr, "$1") : f || o;
}), a;
}, Gr = function(e, t) {
var n = e, a;
if (se(He, n) && (a = He[n], n = "%" + a[0] + "%"), se(q, n)) {
var o = q[n];
if (o === z && (o = Dr(n)), typeof o > "u" && !t)
throw new V("intrinsic " + e + " exists, but is not available. Please file an issue!");
return {
alias: a,
name: n,
value: o
};
}
throw new Q("intrinsic " + e + " does not exist!");
}, De = function(e, t) {
if (typeof e != "string" || e.length === 0)
throw new V("intrinsic name must be a non-empty string");
if (arguments.length > 1 && typeof t != "boolean")
throw new V('"allowMissing" argument must be a boolean');
if (Br(/^%?[^%]*%?$/, e) === null)
throw new Q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
var n = Lr(e), a = n.length > 0 ? n[0] : "", o = Gr("%" + a + "%", t), f = o.name, i = o.value, c = !1, l = o.alias;
l && (a = l[0], _r(n, Cr([0, 1], l)));
for (var p = 1, y = !0; p < n.length; p += 1) {
var s = n[p], d = de(s, 0, 1), u = de(s, -1);
if ((d === '"' || d === "'" || d === "`" || u === '"' || u === "'" || u === "`") && d !== u)
throw new Q("property names with quotes must have matching quotes");
if ((s === "constructor" || !y) && (c = !0), a += "." + s, f = "%" + a + "%", se(q, f))
i = q[f];
else if (i != null) {
if (!(s in i)) {
if (!t)
throw new V("base intrinsic for " + e + " exists, but the property is not available.");
return;
}
if (B && p + 1 >= n.length) {
var v = B(i, s);
y = !!v, y && "get" in v && !("originalValue" in v.get) ? i = v.get : i = i[s];
} else
y = se(i, s), i = i[s];
y && !c && (q[f] = i);
}
}
return i;
}, ar = { exports: {} };
(function(r) {
var e = Me, t = De, n = t("%Function.prototype.apply%"), a = t("%Function.prototype.call%"), o = t("%Reflect.apply%", !0) || e.call(a, n), f = t("%Object.getOwnPropertyDescriptor%", !0), i = t("%Object.defineProperty%", !0), c = t("%Math.max%");
if (i)
try {
i({}, "a", { value: 1 });
} catch {
i = null;
}
r.exports = function(y) {
var s = o(e, a, arguments);
if (f && i) {
var d = f(s, "length");
d.configurable && i(
s,
"length",
{ value: 1 + c(0, y.length - (arguments.length - 1)) }
);
}
return s;
};
var l = function() {
return o(e, n, arguments);
};
i ? i(r.exports, "apply", { value: l }) : r.exports.apply = l;
})(ar);
var Hr = ar.exports, ir = De, fr = Hr, kr = fr(ir("String.prototype.indexOf")), zr = function(e, t) {
var n = ir(e, !!t);
return typeof n == "function" && kr(e, ".prototype.") > -1 ? fr(n) : n;
};
const Vr = {}, qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Vr
}, Symbol.toStringTag, { value: "Module" })), Qr = /* @__PURE__ */ Ar(qr);
var Ce = typeof Map == "function" && Map.prototype, be = Object.getOwnPropertyDescriptor && Ce ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, ve = Ce && be && typeof be.get == "function" ? be.get : null, jr = Ce && Map.prototype.forEach, _e = typeof Set == "function" && Set.prototype, Ae = Object.getOwnPropertyDescriptor && _e ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, me = _e && Ae && typeof Ae.get == "function" ? Ae.get : null, Jr = _e && Set.prototype.forEach, Kr = typeof WeakMap == "function" && WeakMap.prototype, ne = Kr ? WeakMap.prototype.has : null, Yr = typeof WeakSet == "function" && WeakSet.prototype, oe = Yr ? WeakSet.prototype.has : null, Xr = typeof WeakRef == "function" && WeakRef.prototype, ze = Xr ? WeakRef.prototype.deref : null, Zr = Boolean.prototype.valueOf, et = Object.prototype.toString, rt = Function.prototype.toString, tt = String.prototype.match, Be = String.prototype.slice, M = String.prototype.replace, nt = String.prototype.toUpperCase, Ve = String.prototype.toLowerCase, lr = RegExp.prototype.test, qe = Array.prototype.concat, P = Array.prototype.join, ot = Array.prototype.slice, Qe = Math.floor, Fe = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, Oe = Object.getOwnPropertySymbols, Ie = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, j = typeof Symbol == "function" && typeof Symbol.iterator == "object", A = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === j || "symbol") ? Symbol.toStringTag : null, cr = Object.prototype.propertyIsEnumerable, je = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(r) {
return r.__proto__;
} : null);
function Je(r, e) {
if (r === 1 / 0 || r === -1 / 0 || r !== r || r && r > -1e3 && r < 1e3 || lr.call(/e/, e))
return e;
var t = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
if (typeof r == "number") {
var n = r < 0 ? -Qe(-r) : Qe(r);
if (n !== r) {
var a = String(n), o = Be.call(e, a.length + 1);
return M.call(a, t, "$&_") + "." + M.call(M.call(o, /([0-9]{3})/g, "$&_"), /_$/, "");
}
}
return M.call(e, t, "$&_");
}
var xe = Qr, Ke = xe.custom, Ye = pr(Ke) ? Ke : null, at = function r(e, t, n, a) {
var o = t || {};
if (T(o, "quoteStyle") && o.quoteStyle !== "single" && o.quoteStyle !== "double")
throw new TypeError('option "quoteStyle" must be "single" or "double"');
if (T(o, "maxStringLength") && (typeof o.maxStringLength == "number" ? o.maxStringLength < 0 && o.maxStringLength !== 1 / 0 : o.maxStringLength !== null))
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
var f = T(o, "customInspect") ? o.customInspect : !0;
if (typeof f != "boolean" && f !== "symbol")
throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
if (T(o, "indent") && o.indent !== null && o.indent !== " " && !(parseInt(o.indent, 10) === o.indent && o.indent > 0))
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
if (T(o, "numericSeparator") && typeof o.numericSeparator != "boolean")
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
var i = o.numericSeparator;
if (typeof e > "u")
return "undefined";
if (e === null)
return "null";
if (typeof e == "boolean")
return e ? "true" : "false";
if (typeof e == "string")
return sr(e, o);
if (typeof e == "number") {
if (e === 0)
return 1 / 0 / e > 0 ? "0" : "-0";
var c = String(e);
return i ? Je(e, c) : c;
}
if (typeof e == "bigint") {
var l = String(e) + "n";
return i ? Je(e, l) : l;
}
var p = typeof o.depth > "u" ? 5 : o.depth;
if (typeof n > "u" && (n = 0), n >= p && p > 0 && typeof e == "object")
return Re(e) ? "[Array]" : "[Object]";
var y = wt(o, n);
if (typeof a > "u")
a = [];
else if (yr(a, e) >= 0)
return "[Circular]";
function s($, G, le) {
if (G && (a = ot.call(a), a.push(G)), le) {
var H = {
depth: o.depth
};
return T(o, "quoteStyle") && (H.quoteStyle = o.quoteStyle), r($, H, n + 1, a);
}
return r($, o, n + 1, a);
}
if (typeof e == "function" && !Xe(e)) {
var d = dt(e), u = ce(e, s);
return "[Function" + (d ? ": " + d : " (anonymous)") + "]" + (u.length > 0 ? " { " + P.call(u, ", ") + " }" : "");
}
if (pr(e)) {
var v = j ? M.call(String(e), /^(Symbol\(.*\))_[^)]*$/, "$1") : Ie.call(e);
return typeof e == "object" && !j ? te(v) : v;
}
if (bt(e)) {
for (var h = "<" + Ve.call(String(e.nodeName)), g = e.attributes || [], E = 0; E < g.length; E++)
h += " " + g[E].name + "=" + ur(it(g[E].value), "double", o);
return h += ">", e.childNodes && e.childNodes.length && (h += "..."), h += "</" + Ve.call(String(e.nodeName)) + ">", h;
}
if (Re(e)) {
if (e.length === 0)
return "[]";
var I = ce(e, s);
return y && !Ot(I) ? "[" + Te(I, y) + "]" : "[ " + P.call(I, ", ") + " ]";
}
if (lt(e)) {
var U = ce(e, s);
return !("cause" in Error.prototype) && "cause" in e && !cr.call(e, "cause") ? "{ [" + String(e) + "] " + P.call(qe.call("[cause]: " + s(e.cause), U), ", ") + " }" : U.length === 0 ? "[" + String(e) + "]" : "{ [" + String(e) + "] " + P.call(U, ", ") + " }";
}
if (typeof e == "object" && f) {
if (Ye && typeof e[Ye] == "function" && xe)
return xe(e, { depth: p - n });
if (f !== "symbol" && typeof e.inspect == "function")
return e.inspect();
}
if (vt(e)) {
var ee = [];
return jr.call(e, function($, G) {
ee.push(s(G, e, !0) + " => " + s($, e));
}), Ze("Map", ve.call(e), ee, y);
}
if (ht(e)) {
var fe = [];
return Jr.call(e, function($) {
fe.push(s($, e));
}), Ze("Set", me.call(e), fe, y);
}
if (mt(e))
return we("WeakMap");
if (St(e))
return we("WeakSet");
if (gt(e))
return we("WeakRef");
if (ut(e))
return te(s(Number(e)));
if (yt(e))
return te(s(Fe.call(e)));
if (pt(e))
return te(Zr.call(e));
if (ct(e))
return te(s(String(e)));
if (!ft(e) && !Xe(e)) {
var C = ce(e, s), x = je ? je(e) === Object.prototype : e instanceof Object || e.constructor === Object, W = e instanceof Object ? "" : "null prototype", L = !x && A && Object(e) === e && A in e ? Be.call(D(e), 8, -1) : W ? "Object" : "", re = x || typeof e.constructor != "function" ? "" : e.constructor.name ? e.constructor.name + " " : "", O = re + (L || W ? "[" + P.call(qe.call([], L || [], W || []), ": ") + "] " : "");
return C.length === 0 ? O + "{}" : y ? O + "{" + Te(C, y) + "}" : O + "{ " + P.call(C, ", ") + " }";
}
return String(e);
};
function ur(r, e, t) {
var n = (t.quoteStyle || e) === "double" ? '"' : "'";
return n + r + n;
}
function it(r) {
return M.call(String(r), /"/g, """);
}
function Re(r) {
return D(r) === "[object Array]" && (!A || !(typeof r == "object" && A in r));
}
function ft(r) {
return D(r) === "[object Date]" && (!A || !(typeof r == "object" && A in r));
}
function Xe(r) {
return D(r) === "[object RegExp]" && (!A || !(typeof r == "object" && A in r));
}
function lt(r) {
return D(r) === "[object Error]" && (!A || !(typeof r == "object" && A in r));
}
function ct(r) {
return D(r) === "[object String]" && (!A || !(typeof r == "object" && A in r));
}
function ut(r) {
return D(r) === "[object Number]" && (!A || !(typeof r == "object" && A in r));
}
function pt(r) {
return D(r) === "[object Boolean]" && (!A || !(typeof r == "object" && A in r));
}
function pr(r) {
if (j)
return r && typeof r == "object" && r instanceof Symbol;
if (typeof r == "symbol")
return !0;
if (!r || typeof r != "object" || !Ie)
return !1;
try {
return Ie.call(r), !0;
} catch {
}
return !1;
}
function yt(r) {
if (!r || typeof r != "object" || !Fe)
return !1;
try {
return Fe.call(r), !0;
} catch {
}
return !1;
}
var st = Object.prototype.hasOwnProperty || function(r) {
return r in this;
};
function T(r, e) {
return st.call(r, e);
}
function D(r) {
return et.call(r);
}
function dt(r) {
if (r.name)
return r.name;
var e = tt.call(rt.call(r), /^function\s*([\w$]+)/);
return e ? e[1] : null;
}
function yr(r, e) {
if (r.indexOf)
return r.indexOf(e);
for (var t = 0, n = r.length; t < n; t++)
if (r[t] === e)
return t;
return -1;
}
function vt(r) {
if (!ve || !r || typeof r != "object")
return !1;
try {
ve.call(r);
try {
me.call(r);
} catch {
return !0;
}
return r instanceof Map;
} catch {
}
return !1;
}
function mt(r) {
if (!ne || !r || typeof r != "object")
return !1;
try {
ne.call(r, ne);
try {
oe.call(r, oe);
} catch {
return !0;
}
return r instanceof WeakMap;
} catch {
}
return !1;
}
function gt(r) {
if (!ze || !r || typeof r != "object")
return !1;
try {
return ze.call(r), !0;
} catch {
}
return !1;
}
function ht(r) {
if (!me || !r || typeof r != "object")
return !1;
try {
me.call(r);
try {
ve.call(r);
} catch {
return !0;
}
return r instanceof Set;
} catch {
}
return !1;
}
function St(r) {
if (!oe || !r || typeof r != "object")
return !1;
try {
oe.call(r, oe);
try {
ne.call(r, ne);
} catch {
return !0;
}
return r instanceof WeakSet;
} catch {
}
return !1;
}
function bt(r) {
return !r || typeof r != "object" ? !1 : typeof HTMLElement < "u" && r instanceof HTMLElement ? !0 : typeof r.nodeName == "string" && typeof r.getAttribute == "function";
}
function sr(r, e) {
if (r.length > e.maxStringLength) {
var t = r.length - e.maxStringLength, n = "... " + t + " more character" + (t > 1 ? "s" : "");
return sr(Be.call(r, 0, e.maxStringLength), e) + n;
}
var a = M.call(M.call(r, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, At);
return ur(a, "single", e);
}
function At(r) {
var e = r.charCodeAt(0), t = {
8: "b",
9: "t",
10: "n",
12: "f",
13: "r"
}[e];
return t ? "\\" + t : "\\x" + (e < 16 ? "0" : "") + nt.call(e.toString(16));
}
function te(r) {
return "Object(" + r + ")";
}
function we(r) {
return r + " { ? }";
}
function Ze(r, e, t, n) {
var a = n ? Te(t, n) : P.call(t, ", ");
return r + " (" + e + ") {" + a + "}";
}
function Ot(r) {
for (var e = 0; e < r.length; e++)
if (yr(r[e], `
`) >= 0)
return !1;
return !0;
}
function wt(r, e) {
var t;
if (r.indent === " ")
t = " ";
else if (typeof r.indent == "number" && r.indent > 0)
t = P.call(Array(r.indent + 1), " ");
else
return null;
return {
base: t,
prev: P.call(Array(e + 1), t)
};
}
function Te(r, e) {
if (r.length === 0)
return "";
var t = `
` + e.prev + e.base;
return t + P.call(r, "," + t) + `
` + e.prev;
}
function ce(r, e) {
var t = Re(r), n = [];
if (t) {
n.length = r.length;
for (var a = 0; a < r.length; a++)
n[a] = T(r, a) ? e(r[a], r) : "";
}
var o = typeof Oe == "function" ? Oe(r) : [], f;
if (j) {
f = {};
for (var i = 0; i < o.length; i++)
f["$" + o[i]] = o[i];
}
for (var c in r)
T(r, c) && (t && String(Number(c)) === c && c < r.length || j && f["$" + c] instanceof Symbol || (lr.call(/[^\w$]/, c) ? n.push(e(c, r) + ": " + e(r[c], r)) : n.push(c + ": " + e(r[c], r))));
if (typeof Oe == "function")
for (var l = 0; l < o.length; l++)
cr.call(r, o[l]) && n.push("[" + e(o[l]) + "]: " + e(r[o[l]], r));
return n;
}
var Ue = De, K = zr, Pt = at, Et = Ue("%TypeError%"), ue = Ue("%WeakMap%", !0), pe = Ue("%Map%", !0), $t = K("WeakMap.prototype.get", !0), Ft = K("WeakMap.prototype.set", !0), It = K("WeakMap.prototype.has", !0), xt = K("Map.prototype.get", !0), Rt = K("Map.prototype.set", !0), Tt = K("Map.prototype.has", !0), We = function(r, e) {
for (var t = r, n; (n = t.next) !== null; t = n)
if (n.key === e)
return t.next = n.next, n.next = r.next, r.next = n, n;
}, Nt = function(r, e) {
var t = We(r, e);
return t && t.value;
}, Mt = function(r, e, t) {
var n = We(r, e);
n ? n.value = t : r.next = {
// eslint-disable-line no-param-reassign
key: e,
next: r.next,
value: t
};
}, Dt = function(r, e) {
return !!We(r, e);
}, Ct = function() {
var e, t, n, a = {
assert: function(o) {
if (!a.has(o))
throw new Et("Side channel does not contain " + Pt(o));
},
get: function(o) {
if (ue && o && (typeof o == "object" || typeof o == "function")) {
if (e)
return $t(e, o);
} else if (pe) {
if (t)
return xt(t, o);
} else if (n)
return Nt(n, o);
},
has: function(o) {
if (ue && o && (typeof o == "object" || typeof o == "function")) {
if (e)
return It(e, o);
} else if (pe) {
if (t)
return Tt(t, o);
} else if (n)
return Dt(n, o);
return !1;
},
set: function(o, f) {
ue && o && (typeof o == "object" || typeof o == "function") ? (e || (e = new ue()), Ft(e, o, f)) : pe ? (t || (t = new pe()), Rt(t, o, f)) : (n || (n = { key: {}, next: null }), Mt(n, o, f));
}
};
return a;
}, _t = String.prototype.replace, Bt = /%20/g, Pe = {
RFC1738: "RFC1738",
RFC3986: "RFC3986"
}, Le = {
default: Pe.RFC3986,
formatters: {
RFC1738: function(r) {
return _t.call(r, Bt, "+");
},
RFC3986: function(r) {
return String(r);
}
},
RFC1738: Pe.RFC1738,
RFC3986: Pe.RFC3986
}, Ut = Le, Ee = Object.prototype.hasOwnProperty, _ = Array.isArray, w = function() {
for (var r = [], e = 0; e < 256; ++e)
r.push("%" + ((e < 16 ? "0" : "") + e.toString(16)).toUpperCase());
return r;
}(), Wt = function(e) {
for (; e.length > 1; ) {
var t = e.pop(), n = t.obj[t.prop];
if (_(n)) {
for (var a = [], o = 0; o < n.length; ++o)
typeof n[o] < "u" && a.push(n[o]);
t.obj[t.prop] = a;
}
}
}, dr = function(e, t) {
for (var n = t && t.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, a = 0; a < e.length; ++a)
typeof e[a] < "u" && (n[a] = e[a]);
return n;
}, Lt = function r(e, t, n) {
if (!t)
return e;
if (typeof t != "object") {
if (_(e))
e.push(t);
else if (e && typeof e == "object")
(n && (n.plainObjects || n.allowPrototypes) || !Ee.call(Object.prototype, t)) && (e[t] = !0);
else
return [e, t];
return e;
}
if (!e || typeof e != "object")
return [e].concat(t);
var a = e;
return _(e) && !_(t) && (a = dr(e, n)), _(e) && _(t) ? (t.forEach(function(o, f) {
if (Ee.call(e, f)) {
var i = e[f];
i && typeof i == "object" && o && typeof o == "object" ? e[f] = r(i, o, n) : e.push(o);
} else
e[f] = o;
}), e) : Object.keys(t).reduce(function(o, f) {
var i = t[f];
return Ee.call(o, f) ? o[f] = r(o[f], i, n) : o[f] = i, o;
}, a);
}, Gt = function(e, t) {
return Object.keys(t).reduce(function(n, a) {
return n[a] = t[a], n;
}, e);
}, Ht = function(r, e, t) {
var n = r.replace(/\+/g, " ");
if (t === "iso-8859-1")
return n.replace(/%[0-9a-f]{2}/gi, unescape);
try {
return decodeURIComponent(n);
} catch {
return n;
}
}, kt = function(e, t, n, a, o) {
if (e.length === 0)
return e;
var f = e;
if (typeof e == "symbol" ? f = Symbol.prototype.toString.call(e) : typeof e != "string" && (f = String(e)), n === "iso-8859-1")
return escape(f).replace(/%u[0-9a-f]{4}/gi, function(p) {
return "%26%23" + parseInt(p.slice(2), 16) + "%3B";
});
for (var i = "", c = 0; c < f.length; ++c) {
var l = f.charCodeAt(c);
if (l === 45 || l === 46 || l === 95 || l === 126 || l >= 48 && l <= 57 || l >= 65 && l <= 90 || l >= 97 && l <= 122 || o === Ut.RFC1738 && (l === 40 || l === 41)) {
i += f.charAt(c);
continue;
}
if (l < 128) {
i = i + w[l];
continue;
}
if (l < 2048) {
i = i + (w[192 | l >> 6] + w[128 | l & 63]);
continue;
}
if (l < 55296 || l >= 57344) {
i = i + (w[224 | l >> 12] + w[128 | l >> 6 & 63] + w[128 | l & 63]);
continue;
}
c += 1, l = 65536 + ((l & 1023) << 10 | f.charCodeAt(c) & 1023), i += w[240 | l >> 18] + w[128 | l >> 12 & 63] + w[128 | l >> 6 & 63] + w[128 | l & 63];
}
return i;
}, zt = function(e) {
for (var t = [{ obj: { o: e }, prop: "o" }], n = [], a = 0; a < t.length; ++a)
for (var o = t[a], f = o.obj[o.prop], i = Object.keys(f), c = 0; c < i.length; ++c) {
var l = i[c], p = f[l];
typeof p == "object" && p !== null && n.indexOf(p) === -1 && (t.push({ obj: f, prop: l }), n.push(p));
}
return Wt(t), e;
}, Vt = function(e) {
return Object.prototype.toString.call(e) === "[object RegExp]";
}, qt = function(e) {
return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
}, Qt = function(e, t) {
return [].concat(e, t);
}, jt = function(e, t) {
if (_(e)) {
for (var n = [], a = 0; a < e.length; a += 1)
n.push(t(e[a]));
return n;
}
return t(e);
}, vr = {
arrayToObject: dr,
assign: Gt,
combine: Qt,
compact: zt,
decode: Ht,
encode: kt,
isBuffer: qt,
isRegExp: Vt,
maybeMap: jt,
merge: Lt
}, mr = Ct, ye = vr, ae = Le, Jt = Object.prototype.hasOwnProperty, er = {
brackets: function(e) {
return e + "[]";
},
comma: "comma",
indices: function(e, t) {
return e + "[" + t + "]";
},
repeat: function(e) {
return e;
}
}, F = Array.isArray, Kt = Array.prototype.push, gr = function(r, e) {
Kt.apply(r, F(e) ? e : [e]);
}, Yt = Date.prototype.toISOString, rr = ae.default, b = {
addQueryPrefix: !1,
allowDots: !1,
charset: "utf-8",
charsetSentinel: !1,
delimiter: "&",
encode: !0,
encoder: ye.encode,
encodeValuesOnly: !1,
format: rr,
formatter: ae.formatters[rr],
// deprecated
indices: !1,
serializeDate: function(e) {
return Yt.call(e);
},
skipNulls: !1,
strictNullHandling: !1
}, Xt = function(e) {
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
}, $e = {}, Zt = function r(e, t, n, a, o, f, i, c, l, p, y, s, d, u, v, h) {
for (var g = e, E = h, I = 0, U = !1; (E = E.get($e)) !== void 0 && !U; ) {
var ee = E.get(e);
if (I += 1, typeof ee < "u") {
if (ee === I)
throw new RangeError("Cyclic object value");
U = !0;
}
typeof E.get($e) > "u" && (I = 0);
}
if (typeof c == "function" ? g = c(t, g) : g instanceof Date ? g = y(g) : n === "comma" && F(g) && (g = ye.maybeMap(g, function(H) {
return H instanceof Date ? y(H) : H;
})), g === null) {
if (o)
return i && !u ? i(t, b.encoder, v, "key", s) : t;
g = "";
}
if (Xt(g) || ye.isBuffer(g)) {
if (i) {
var fe = u ? t : i(t, b.encoder, v, "key", s);
return [d(fe) + "=" + d(i(g, b.encoder, v, "value", s))];
}
return [d(t) + "=" + d(String(g))];
}
var C = [];
if (typeof g > "u")
return C;
var x;
if (n === "comma" && F(g))
u && i && (g = ye.maybeMap(g, i)), x = [{ value: g.length > 0 ? g.join(",") || null : void 0 }];
else if (F(c))
x = c;
else {
var W = Object.keys(g);
x = l ? W.sort(l) : W;
}
for (var L = a && F(g) && g.length === 1 ? t + "[]" : t, re = 0; re < x.length; ++re) {
var O = x[re], $ = typeof O == "object" && typeof O.value < "u" ? O.value : g[O];
if (!(f && $ === null)) {
var G = F(g) ? typeof n == "function" ? n(L, O) : L : L + (p ? "." + O : "[" + O + "]");
h.set(e, I);
var le = mr();
le.set($e, h), gr(C, r(
$,
G,
n,
a,
o,
f,
n === "comma" && u && F(g) ? null : i,
c,
l,
p,
y,
s,
d,
u,
v,
le
));
}
}
return C;
}, en = function(e) {
if (!e)
return b;
if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
throw new TypeError("Encoder has to be a function.");
var t = e.charset || b.charset;
if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
var n = ae.default;
if (typeof e.format < "u") {
if (!Jt.call(ae.formatters, e.format))
throw new TypeError("Unknown format option provided.");
n = e.format;
}
var a = ae.formatters[n], o = b.filter;
return (typeof e.filter == "function" || F(e.filter)) && (o = e.filter), {
addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : b.addQueryPrefix,
allowDots: typeof e.allowDots > "u" ? b.allowDots : !!e.allowDots,
charset: t,
charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : b.charsetSentinel,
delimiter: typeof e.delimiter > "u" ? b.delimiter : e.delimiter,
encode: typeof e.encode == "boolean" ? e.encode : b.encode,
encoder: typeof e.encoder == "function" ? e.encoder : b.encoder,
encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : b.encodeValuesOnly,
filter: o,
format: n,
formatter: a,
serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : b.serializeDate,
skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : b.skipNulls,
sort: typeof e.sort == "function" ? e.sort : null,
strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : b.strictNullHandling
};
}, rn = function(r, e) {
var t = r, n = en(e), a, o;
typeof n.filter == "function" ? (o = n.filter, t = o("", t)) : F(n.filter) && (o = n.filter, a = o);
var f = [];
if (typeof t != "object" || t === null)
return "";
var i;
e && e.arrayFormat in er ? i = e.arrayFormat : e && "indices" in e ? i = e.indices ? "indices" : "repeat" : i = "indices";
var c = er[i];
if (e && "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
var l = c === "comma" && e && e.commaRoundTrip;
a || (a = Object.keys(t)), n.sort && a.sort(n.sort);
for (var p = mr(), y = 0; y < a.length; ++y) {
var s = a[y];
n.skipNulls && t[s] === null || gr(f, Zt(
t[s],
s,
c,
l,
n.strictNullHandling,
n.skipNulls,
n.encode ? n.encoder : null,
n.filter,
n.sort,
n.allowDots,
n.serializeDate,
n.format,
n.formatter,
n.encodeValuesOnly,
n.charset,
p
));
}
var d = f.join(n.delimiter), u = n.addQueryPrefix === !0 ? "?" : "";
return n.charsetSentinel && (n.charset === "iso-8859-1" ? u += "utf8=%26%2310003%3B&" : u += "utf8=%E2%9C%93&"), d.length > 0 ? u + d : "";
}, J = vr, Ne = Object.prototype.hasOwnProperty, tn = Array.isArray, S = {
allowDots: !1,
allowPrototypes: !1,
allowSparse: !1,
arrayLimit: 20,
charset: "utf-8",
charsetSentinel: !1,
comma: !1,
decoder: J.decode,
delimiter: "&",
depth: 5,
ignoreQueryPrefix: !1,
interpretNumericEntities: !1,
parameterLimit: 1e3,
parseArrays: !0,
plainObjects: !1,
strictNullHandling: !1
}, nn = function(r) {
return r.replace(/&#(\d+);/g, function(e, t) {
return String.fromCharCode(parseInt(t, 10));
});
}, hr = function(r, e) {
return r && typeof r == "string" && e.comma && r.indexOf(",") > -1 ? r.split(",") : r;
}, on = "utf8=%26%2310003%3B", an = "utf8=%E2%9C%93", fn = function(e, t) {
var n = { __proto__: null }, a = t.ignoreQueryPrefix ? e.replace(/^\?/, "") : e, o = t.parameterLimit === 1 / 0 ? void 0 : t.parameterLimit, f = a.split(t.delimiter, o), i = -1, c, l = t.charset;
if (t.charsetSentinel)
for (c = 0; c < f.length; ++c)
f[c].indexOf("utf8=") === 0 && (f[c] === an ? l = "utf-8" : f[c] === on && (l = "iso-8859-1"), i = c, c = f.length);
for (c = 0; c < f.length; ++c)
if (c !== i) {
var p = f[c], y = p.indexOf("]="), s = y === -1 ? p.indexOf("=") : y + 1, d, u;
s === -1 ? (d = t.decoder(p, S.decoder, l, "key"), u = t.strictNullHandling ? null : "") : (d = t.decoder(p.slice(0, s), S.decoder, l, "key"), u = J.maybeMap(
hr(p.slice(s + 1), t),
function(v) {
return t.decoder(v, S.decoder, l, "value");
}
)), u && t.interpretNumericEntities && l === "iso-8859-1" && (u = nn(u)), p.indexOf("[]=") > -1 && (u = tn(u) ? [u] : u), Ne.call(n, d) ? n[d] = J.combine(n[d], u) : n[d] = u;
}
return n;
}, ln = function(r, e, t, n) {
for (var a = n ? e : hr(e, t), o = r.length - 1; o >= 0; --o) {
var f, i = r[o];
if (i === "[]" && t.parseArrays)
f = [].concat(a);
else {
f = t.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
var c = i.charAt(0) === "[" && i.charAt(i.length - 1) === "]" ? i.slice(1, -1) : i, l = parseInt(c, 10);
!t.parseArrays && c === "" ? f = { 0: a } : !isNaN(l) && i !== c && String(l) === c && l >= 0 && t.parseArrays && l <= t.arrayLimit ? (f = [], f[l] = a) : c !== "__proto__" && (f[c] = a);
}
a = f;
}
return a;
}, cn = function(e, t, n, a) {
if (e) {
var o = n.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e, f = /(\[[^[\]]*])/, i = /(\[[^[\]]*])/g, c = n.depth > 0 && f.exec(o), l = c ? o.slice(0, c.index) : o, p = [];
if (l) {
if (!n.plainObjects && Ne.call(Object.prototype, l) && !n.allowPrototypes)
return;
p.push(l);
}
for (var y = 0; n.depth > 0 && (c = i.exec(o)) !== null && y < n.depth; ) {
if (y += 1, !n.plainObjects && Ne.call(Object.prototype, c[1].slice(1, -1)) && !n.allowPrototypes)
return;
p.push(c[1]);
}
return c && p.push("[" + o.slice(c.index) + "]"), ln(p, t, n, a);
}
}, un = function(e) {
if (!e)
return S;
if (e.decoder !== null && e.decoder !== void 0 && typeof e.decoder != "function")
throw new TypeError("Decoder has to be a function.");
if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
var t = typeof e.charset > "u" ? S.charset : e.charset;
return {
allowDots: typeof e.allowDots > "u" ? S.allowDots : !!e.allowDots,
allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : S.allowPrototypes,
allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : S.allowSparse,
arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : S.arrayLimit,
charset: t,
charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : S.charsetSentinel,
comma: typeof e.comma == "boolean" ? e.comma : S.comma,
decoder: typeof e.decoder == "function" ? e.decoder : S.decoder,
delimiter: typeof e.delimiter == "string" || J.isRegExp(e.delimiter) ? e.delimiter : S.delimiter,
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : S.depth,
ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : S.interpretNumericEntities,
parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : S.parameterLimit,
parseArrays: e.parseArrays !== !1,
plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : S.plainObjects,
strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : S.strictNullHandling
};
}, pn = function(r, e) {
var t = un(e);
if (r === "" || r === null || typeof r > "u")
return t.plainObjects ? /* @__PURE__ */ Object.create(null) : {};
for (var n = typeof r == "string" ? fn(r, t) : r, a = t.plainObjects ? /* @__PURE__ */ Object.create(null) : {}, o = Object.keys(n), f = 0; f < o.length; ++f) {
var i = o[f], c = cn(i, n[i], t, typeof r == "string");
a = J.merge(a, c, t);
}
return t.allowSparse === !0 ? a : J.compact(a);
}, yn = rn, sn = pn, dn = Le, vn = {
formats: dn,
parse: sn,
stringify: yn
};
const tr = /* @__PURE__ */ br(vn), Rn = () => typeof window == "object", Sr = (r) => r && typeof r == "object" && !Array.isArray(Array), mn = (r) => {
if (!Sr(r))
throw Error("type should be object!");
return !Object.keys(r).length;
};
function nr(r) {
return r == null ? !1 : !!(typeof r == "string" || typeof r == "bigint" || typeof r == "number" || typeof r == "boolean" || Array.isArray(r) && r.length);
}
function Tn(r) {
if (!Sr(r) || mn(r))
return "";
let e = "?";
return Object.keys(r).forEach((n, a) => {
if (!nr(r[n]))
return;
a !== 0 && (e += "&"), Array.isArray(r[n]) ? r[n].forEach((f, i) => {
nr(f) && (i !== 0 && (e += "&"), e += `${encodeURIComponent(n)}=${encodeURIComponent(f)}`);
}) : e += `${encodeURIComponent(n)}=${encodeURIComponent(r[n])}`;
}), e;
}
function gn(r) {
const e = [];
return r.replace(/(\{+)([^}]+)(}+)/g, (t, n, a, o) => (n.length === o.length && e.push(a), a)), e;
}
function Nn(r, e) {
let t = r;
return gn(r).forEach((a) => {
e[a] && (t = t.replace(`{${a}}`, e[a]));
}), t;
}
function Mn() {
}
const hn = ["json", "text", "blob", "arrayBuffer", "formData"];
function Sn(r = {}) {
let e = r;
return {
set: function(i) {
e = i;
},
getAll: function() {
return e;
},
update: function(i) {
e = { ...e, ...i };
},
remove: function(i) {
typeof i == "string" && delete e[i];
}
};
}
function bn(r = {}) {
let e = r;
return {
set: function(i) {
e = i;
},
getAll: function() {
return e;
},
update: function(i) {
e = { ...e, ...i };
},
remove: function(i) {
typeof i == "string" && delete e[i];
}
};
}
const An = Sn(), On = bn(), N = {
request: void 0,
response: void 0
};
function Dn({ request: r, response: e }) {
r && (N.request = r), e && (N.response = e);
}
function wn(r, e, t = {}) {
const n = tr.stringify(t, { skipNulls: !0 });
return e.startsWith("http") ? e : `${r}${e.startsWith("/") ? "" : "/"}${e}${n ? "?" + tr.stringify(t, { skipNulls: !0, arrayFormat: "repeat" }) : ""}`;
}
async function Y(r, e, {
params: t = {},
configs: n = {},
body: a,
headers: o = {},
responseType: f = "json",
meta: i = {},
requestInterceptor: c = void 0,
responseInterceptor: l = void 0
}) {
let p = {}, y, s, d, u = {
headers: { ...On.getAll(), ...o },
configs: { ...An.getAll(), ...n },
params: t,
body: a,
path: e,
responseType: f,
meta: i,
type: r
};
N.request && !c && (u = { ...u, ...await N.request(u) }), c && (u = { ...u, ...await c(u) }), p.method = u.type, u.body && u.type && u.type !== "GET" && (u.body instanceof FormData || typeof u.body == "string" || u.body instanceof ArrayBuffer || u.body instanceof Int8Array || u.body instanceof Uint8Array || u.body instanceof Uint8ClampedArray || u.body instanceof Int16Array || u.body instanceof Uint16Array || u.body instanceof Int32Array || u.body instanceof Uint32Array || u.body instanceof Float32Array || u.body instanceof Float64Array || u.body instanceof BigInt64Array || u.body instanceof BigUint64Array || u.body instanceof DataView || u.body instanceof Blob || u.body instanceof File || u.body instanceof Uint8Array || u.body instanceof URLSearchParams ? p.body = u.body : p.body = u.body && JSON.stringify(u.body)), Object.keys(u.headers).forEach((v) => {
const h = u.headers;
h[v] === void 0 && typeof h[v] > "u" && delete h[v];
}), s = wn(u.configs.baseURL, u.path, u.params), p = {
...p,
...u.configs,
headers: u.headers
};
try {
d = await fetch(s, p);
const v = u.type === "HEAD" || d.status === 204;
let h = {};
if (v || (h = await d[hn.includes(u.responseType) ? u.responseType : "json"]()), !d.ok)
throw y = {
meta: u.meta,
response: d,
error: {
...h
}
}, y;
return y = { data: h, response: d, meta: u.meta }, N.response && !l ? N.response(y, p, u) : l ? l(y, p, u) : y;
} catch (v) {
const g = v instanceof Error && !("response" in v) ? {
error: {
name: v.name,
message: v.message
},
meta: u.meta
} : v;
return N.response ? N.response(g, p, u) : g;
}
}
function X() {
return new AbortController();
}
function Z(r, e) {
return typeof r != "number" ? void 0 : setTimeout(() => {
e.abort();
}, r);
}
async function Pn(r, {
params: e,
configs: t = {},
headers: n,
responseType: a,
meta: o = {},
timeout: f,
requestInterceptor: i = void 0,
responseInterceptor: c = void 0
} = {}, l) {
const p = X();
p instanceof AbortController && (t.signal = p.signal), l && l(p);
const y = Z(f, p), { data: s, response: d, error: u } = await Y("GET", r, { params: e, configs: t, headers: n, responseType: a, meta: o, requestInterceptor: i, responseInterceptor: c });
return clearTimeout(y), {
data: s,
response: d,
error: u,
meta: o
};
}
async function En(r, {
params: e,
configs: t = {},
headers: n,
meta: a = {},
timeout: o,
requestInterceptor: f = void 0,
responseInterceptor: i = void 0
} = {}, c) {
const l = X();
l instanceof AbortController && (t.signal = l.signal), c && c(l);
const p = Z(o, l), { data: y, response: s, error: d } = await Y("HEAD", r, { params: e, configs: t, headers: n, meta: a, requestInterceptor: f, responseInterceptor: i });
return clearTimeout(p), {
data: y,
response: s,
error: d,
meta: a
};
}
async function $n(r, {
body: e = {},
params: t,
configs: n = {},
headers: a = {},
responseType: o,
meta: f = {},
timeout: i,
requestInterceptor: c = void 0,
responseInterceptor: l = void 0
} = {}, p) {
const y = X();
y instanceof AbortController && (n.signal = y.signal), p && p(y);
const s = Z(i, y), { data: d, response: u, error: v } = await Y(
"POST",
r,
{
params: t,
configs: n,
body: e,
headers: a,
responseType: o,
meta: f,
requestInterceptor: c,
responseInterceptor: l
}
);
return clearTimeout(s), {
data: d,
response: u,
error: v,
meta: f
};
}
async function Fn(r, {
body: e = {},
params: t,
configs: n = {},
headers: a = {},
responseType: o,
meta: f = {},
timeout: i,
requestInterceptor: c = void 0,
responseInterceptor: l = void 0
} = {}, p) {
const y = X();
y instanceof AbortController && (n.signal = y.signal), p && p(y);
const s = Z(i, y), { data: d, response: u, error: v } = await Y("PUT", r, {
params: t,
configs: n,
body: e,
headers: a,
responseType: o,
meta: f,
requestInterceptor: c,
responseInterceptor: l
});
return clearTimeout(s), {
data: d,
response: u,
error: v,
meta: f
};
}
async function In(r, {
body: e = {},
params: t,
configs: n = {},
headers: a = {},
responseType: o,
meta: f = {},
timeout: i,
requestInterceptor: c = void 0,
responseInterceptor: l = void 0
} = {}, p) {
const y = X();
y instanceof AbortController && (n.signal = y.signal), p && p(y);
const s = Z(i, y), { data: d, response: u, error: v } = await Y("DELETE", r, {
params: t,
configs: n,
body: e,
headers: a,
responseType: o,
meta: f,
requestInterceptor: c,
responseInterceptor: l
});
return clearTimeout(s), {
data: d,
response: u,
error: v,
meta: f
};
}
async function xn(r, {
body: e = {},
params: t,
configs: n = {},
headers: a = {},
responseType: o,
meta: f = {},
timeout: i,
requestInterceptor: c = void 0,
responseInterceptor: l = void 0
} = {}, p) {
const y = X();
y instanceof AbortController && (n.signal = y.signal), p && p(y);
const s = Z(i, y), { data: d, response: u, error: v } = await Y("PATCH", r, {
params: t,
configs: n,
body: e,
headers: a,
responseType: o,
meta: f,
requestInterceptor: c,
responseInterceptor: l
});
return clearTimeout(s), {
data: d,
response: u,
error: v,
meta: f
};
}
const Cn = {
POST: $n,
GET: Pn,
DELETE: In,
PUT: Fn,
PATCH: xn,
HEAD: En
};
export {
In as DELETE,
Pn as GET,
En as HEAD,
xn as PATCH,
$n as POST,
Fn a