This commit is contained in:
2026-10-14 10:46:32 +08:00
parent d8cc3ec655
commit 40fe1509a0
4 changed files with 107 additions and 104 deletions
+101 -99
View File
@@ -4,7 +4,7 @@ var oe = (r) => {
}; };
var ge = (r, e, t) => e in r ? de(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t; var ge = (r, e, t) => e in r ? de(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
var l = (r, e, t) => ge(r, typeof e != "symbol" ? e + "" : e, t), ae = (r, e, t) => e.has(r) || oe("Cannot " + t); var l = (r, e, t) => ge(r, typeof e != "symbol" ? e + "" : e, t), ae = (r, e, t) => e.has(r) || oe("Cannot " + t);
var s = (r, e, t) => (ae(r, e, "read from private field"), t ? t.call(r) : e.get(r)), w = (r, e, t) => e.has(r) ? oe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), C = (r, e, t, n) => (ae(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t); var s = (r, e, t) => (ae(r, e, "read from private field"), t ? t.call(r) : e.get(r)), w = (r, e, t) => e.has(r) ? oe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), A = (r, e, t, n) => (ae(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t);
function pe(r) { function pe(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
} }
@@ -12,7 +12,7 @@ var ue = {};
(function(r) { (function(r) {
(function(e) { (function(e) {
e([], function() { e([], function() {
var t = -1, n = -2, i = -3, c = -4, f = -5, U = function(h, d) { var t = -1, n = -2, i = -3, o = -4, f = -5, U = function(h, d) {
d = d || {}; d = d || {};
var u = d.verbose || !1; var u = d.verbose || !1;
u && console.log("Normalize the JSON Object"), h = typeof h == "string" ? this.JSON.parse(h) : h, u && console.log("Creating a empty dictionary"); u && console.log("Normalize the JSON Object"), h = typeof h == "string" ? this.JSON.parse(h) : h, u && console.log("Creating a empty dictionary");
@@ -22,53 +22,53 @@ var ue = {};
floats: [] floats: []
}; };
u && console.log("Creating the AST"); u && console.log("Creating the AST");
var p = function S(o) { var p = function S(a) {
u && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(o)); u && console.log("Calling recursiveAstBuilder with " + this.JSON.stringify(a));
var y = typeof o; var y = typeof a;
if (o === null) if (a === null)
return { return {
type: "null", type: "null",
index: i index: i
}; };
if (typeof o > "u") if (typeof a > "u")
return { return {
type: "undefined", type: "undefined",
index: f index: f
}; };
if (o instanceof Array) { if (a instanceof Array) {
var O = ["@"]; var O = ["@"];
for (var b in o) for (var b in a)
o.hasOwnProperty(b) && O.push(S(o[b])); a.hasOwnProperty(b) && O.push(S(a[b]));
return O; return O;
} }
if (y === "object") { if (y === "object") {
var O = ["$"]; var O = ["$"];
for (var N in o) for (var N in a)
o.hasOwnProperty(N) && (O.push(S(N)), O.push(S(o[N]))); a.hasOwnProperty(N) && (O.push(S(N)), O.push(S(a[N])));
return O; return O;
} }
if (o === "") if (a === "")
return { return {
type: "empty", type: "empty",
index: c index: o
}; };
if (y === "string") { if (y === "string") {
var P = q.call(g.strings, o); var P = q.call(g.strings, a);
return P == -1 && (g.strings.push(T(o)), P = g.strings.length - 1), { return P == -1 && (g.strings.push(T(a)), P = g.strings.length - 1), {
type: "strings", type: "strings",
index: P index: P
}; };
} }
if (y === "number" && o % 1 === 0) { if (y === "number" && a % 1 === 0) {
var P = q.call(g.integers, o); var P = q.call(g.integers, a);
return P == -1 && (g.integers.push(m(o)), P = g.integers.length - 1), { return P == -1 && (g.integers.push(m(a)), P = g.integers.length - 1), {
type: "integers", type: "integers",
index: P index: P
}; };
} }
if (y === "number") { if (y === "number") {
var P = q.call(g.floats, o); var P = q.call(g.floats, a);
return P == -1 && (g.floats.push(o), P = g.floats.length - 1), { return P == -1 && (g.floats.push(a), P = g.floats.length - 1), {
type: "floats", type: "floats",
index: P index: P
}; };
@@ -76,20 +76,20 @@ var ue = {};
if (y === "boolean") if (y === "boolean")
return { return {
type: "boolean", type: "boolean",
index: o ? t : n index: a ? t : n
}; };
throw new Error("Unexpected argument of type " + typeof o); throw new Error("Unexpected argument of type " + typeof a);
}(h), E = g.strings.length, J = g.integers.length; }(h), E = g.strings.length, J = g.integers.length;
g.floats.length, u && console.log("Parsing the dictionary"); g.floats.length, u && console.log("Parsing the dictionary");
var M = g.strings.join("|"); var _ = g.strings.join("|");
return M += "^" + g.integers.join("|"), M += "^" + g.floats.join("|"), u && console.log("Parsing the structure"), M += "^" + function S(o) { return _ += "^" + g.integers.join("|"), _ += "^" + g.floats.join("|"), u && console.log("Parsing the structure"), _ += "^" + function S(a) {
if (u && console.log("Calling a recursiveParser with " + this.JSON.stringify(o)), o instanceof Array) { if (u && console.log("Calling a recursiveParser with " + this.JSON.stringify(a)), a instanceof Array) {
var y = o.shift(); var y = a.shift();
for (var O in o) for (var O in a)
o.hasOwnProperty(O) && (y += S(o[O]) + "|"); a.hasOwnProperty(O) && (y += S(a[O]) + "|");
return (y[y.length - 1] === "|" ? y.slice(0, -1) : y) + "]"; return (y[y.length - 1] === "|" ? y.slice(0, -1) : y) + "]";
} }
var b = o.type, N = o.index; var b = a.type, N = a.index;
if (b === "strings") if (b === "strings")
return m(N); return m(N);
if (b === "integers") if (b === "integers")
@@ -97,20 +97,20 @@ var ue = {};
if (b === "floats") if (b === "floats")
return m(E + J + N); return m(E + J + N);
if (b === "boolean") if (b === "boolean")
return o.index; return a.index;
if (b === "null") if (b === "null")
return i; return i;
if (b === "undefined") if (b === "undefined")
return f; return f;
if (b === "empty") if (b === "empty")
return c; return o;
throw new TypeError("The item is alien!"); throw new TypeError("The item is alien!");
}(p), u && console.log("Ending parser"), d.debug ? { }(p), u && console.log("Ending parser"), d.debug ? {
dictionary: g, dictionary: g,
ast: p, ast: p,
packed: M packed: _
} : M; } : _;
}, a = function(h, d) { }, c = function(h, d) {
d = d || {}; d = d || {};
var u = h.split("^"); var u = h.split("^");
d.verbose && console.log("Building dictionary"); d.verbose && console.log("Building dictionary");
@@ -118,7 +118,7 @@ var ue = {};
if (p !== "") { if (p !== "") {
p = p.split("|"), d.verbose && console.log("Parse the strings dictionary"); p = p.split("|"), d.verbose && console.log("Parse the strings dictionary");
for (var E = 0, J = p.length; E < J; E++) for (var E = 0, J = p.length; E < J; E++)
g.push(_(p[E])); g.push(C(p[E]));
} }
if (p = u[1], p !== "") { if (p = u[1], p !== "") {
p = p.split("|"), d.verbose && console.log("Parse the integers dictionary"); p = p.split("|"), d.verbose && console.log("Parse the integers dictionary");
@@ -131,22 +131,22 @@ var ue = {};
g.push(parseFloat(p[E])); g.push(parseFloat(p[E]));
} }
p = null, d.verbose && console.log("Tokenizing the structure"); p = null, d.verbose && console.log("Tokenizing the structure");
for (var M = "", S = [], o = u[3].length, E = 0; E < o; E++) { for (var _ = "", S = [], a = u[3].length, E = 0; E < a; E++) {
var y = u[3].charAt(E); var y = u[3].charAt(E);
y === "|" || y === "$" || y === "@" || y === "]" ? (M && (S.push(I(M)), M = ""), y !== "|" && S.push(y)) : M += y; y === "|" || y === "$" || y === "@" || y === "]" ? (_ && (S.push(I(_)), _ = ""), y !== "|" && S.push(y)) : _ += y;
} }
var O = S.length, b = 0; var O = S.length, b = 0;
return d.verbose && console.log("Starting recursive parser"), function N() { return d.verbose && console.log("Starting recursive parser"), function N() {
var P = S[b++]; var P = S[b++];
if (d.verbose && console.log("Reading collection type " + (P === "$" ? "object" : "Array")), P === "@") { if (d.verbose && console.log("Reading collection type " + (P === "$" ? "object" : "Array")), P === "@") {
for (var v = []; b < O; b++) { for (var v = []; b < O; b++) {
var A = S[b]; var M = S[b];
if (d.verbose && console.log("Read " + A + " symbol"), A === "]") if (d.verbose && console.log("Read " + M + " symbol"), M === "]")
return v; return v;
if (A === "@" || A === "$") if (M === "@" || M === "$")
v.push(N()); v.push(N());
else else
switch (A) { switch (M) {
case t: case t:
v.push(!0); v.push(!0);
break; break;
@@ -159,11 +159,11 @@ var ue = {};
case f: case f:
v.push(void 0); v.push(void 0);
break; break;
case c: case o:
v.push(""); v.push("");
break; break;
default: default:
v.push(g[A]); v.push(g[M]);
} }
} }
return d.verbose && console.log("Parsed " + this.JSON.stringify(v)), v; return d.verbose && console.log("Parsed " + this.JSON.stringify(v)), v;
@@ -173,12 +173,12 @@ var ue = {};
var x = S[b]; var x = S[b];
if (x === "]") if (x === "]")
return v; return v;
x === c ? x = "" : x = g[x]; x === o ? x = "" : x = g[x];
var A = S[++b]; var M = S[++b];
if (A === "@" || A === "$") if (M === "@" || M === "$")
v[x] = N(); v[x] = N();
else else
switch (A) { switch (M) {
case t: case t:
v[x] = !0; v[x] = !0;
break; break;
@@ -191,11 +191,11 @@ var ue = {};
case f: case f:
v[x] = void 0; v[x] = void 0;
break; break;
case c: case o:
v[x] = ""; v[x] = "";
break; break;
default: default:
v[x] = g[A]; v[x] = g[M];
} }
} }
return d.verbose && console.log("Parsed " + this.JSON.stringify(v)), v; return d.verbose && console.log("Parsed " + this.JSON.stringify(v)), v;
@@ -212,7 +212,7 @@ var ue = {};
"%": "%25" "%": "%25"
}[d]; }[d];
}); });
}, _ = function(h) { }, C = function(h) {
return typeof h != "string" ? h : h.replace(/\+|%2B|%7C|%5E|%25/g, function(d) { return typeof h != "string" ? h : h.replace(/\+|%2B|%7C|%5E|%25/g, function(d) {
return { return {
"+": " ", "+": " ",
@@ -235,7 +235,7 @@ var ue = {};
return { return {
JSON, JSON,
pack: U, pack: U,
unpack: a unpack: c
}; };
}); });
})(function(e, t) { })(function(e, t) {
@@ -254,7 +254,7 @@ const ie = class ie {
* @param {string} url * @param {string} url
* @param {string} res * @param {string} res
*/ */
constructor(e, t, n, i, c) { constructor(e, t, n, i, o) {
/** @type {number} */ /** @type {number} */
l(this, "code", 0); l(this, "code", 0);
/** @type {string} */ /** @type {string} */
@@ -330,7 +330,7 @@ const ie = class ie {
* @param {string | symbol} key * @param {string | symbol} key
* @returns {unknown} * @returns {unknown}
*/ */
w(this, W, (e) => e === "$echoMsg" ? s(this, k) : e === "then" ? (C(this, j, !0), s(this, X)) : e === "catch" ? s(this, Z) : e === "finally" ? s(this, ee) : e === "IS_ECHO_MSG" ? s(this, j) : Reflect.get(this, e)); w(this, W, (e) => e === "$echoMsg" ? s(this, k) : e === "then" ? (A(this, j, !0), s(this, X)) : e === "catch" ? s(this, Z) : e === "finally" ? s(this, ee) : e === "IS_ECHO_MSG" ? s(this, j) : Reflect.get(this, e));
/** /**
* message 消息弹窗后回调 * message 消息弹窗后回调
* *
@@ -354,7 +354,7 @@ const ie = class ie {
* fn 内部抛出的异常会变成 reject,而不是同步抛出。 * fn 内部抛出的异常会变成 reject,而不是同步抛出。
*/ */
l(this, "msg", (e = (n) => n, t = !1) => { l(this, "msg", (e = (n) => n, t = !1) => {
s(this, k).call(this), C(this, H, t); s(this, k).call(this), A(this, H, t);
try { try {
return Promise.resolve( return Promise.resolve(
e == null ? void 0 : e(s(this, B).getPrototypeOf()) e == null ? void 0 : e(s(this, B).getPrototypeOf())
@@ -390,7 +390,7 @@ const ie = class ie {
* @param {(reason: HttpResponse) => unknown} [onrejected] * @param {(reason: HttpResponse) => unknown} [onrejected]
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
l(this, "resp", (e, t) => (C(this, j, !0), [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(this)) : t ? Promise.resolve(t(s(this, $))) : Promise.reject(s(this, $)))); l(this, "resp", (e, t) => (A(this, j, !0), [0, 1].includes(this.code) ? Promise.resolve(e == null ? void 0 : e(this)) : t ? Promise.resolve(t(s(this, $))) : Promise.reject(s(this, $))));
/** /**
* 转换成 JSON * 转换成 JSON
* *
@@ -415,7 +415,7 @@ const ie = class ie {
* @returns {void} * @returns {void}
*/ */
w(this, k, () => { w(this, k, () => {
s(this, j) && (C(this, j, !1), se.onMsg(this.code, this.message)); s(this, j) && (A(this, j, !1), se.onMsg(this.code, this.message));
}); });
/** /**
* Promise then * Promise then
@@ -431,7 +431,7 @@ const ie = class ie {
* @param {HttpResponseRejectCallback} fn * @param {HttpResponseRejectCallback} fn
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
w(this, Z, (e) => Promise.resolve(e(s(this, $)))); w(this, Z, (e) => [0, 1].includes(this.code) ? Promise.resolve(this.data) : Promise.resolve(e(s(this, $))));
/** /**
* Promise finally * Promise finally
* *
@@ -439,7 +439,7 @@ const ie = class ie {
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
w(this, ee, (e) => (e == null || e(), [0, 1].includes(this.code) ? Promise.resolve(s(this, B).getPrototypeOf()) : Promise.reject(s(this, $)))); w(this, ee, (e) => (e == null || e(), [0, 1].includes(this.code) ? Promise.resolve(s(this, B).getPrototypeOf()) : Promise.reject(s(this, $))));
return this.code = e, this.message = t, this.data = n, this.url = i, this.res = c, C(this, $, new Proxy(this, s(this, B))); return this.code = e, this.message = t, this.data = n, this.url = i, this.res = o, A(this, $, new Proxy(this, s(this, B)));
} }
static [Symbol.hasInstance](e) { static [Symbol.hasInstance](e) {
return (e == null ? void 0 : e.constructor) === ie || (e == null ? void 0 : e[Symbol.for("HttpResponse")]) === !0; return (e == null ? void 0 : e.constructor) === ie || (e == null ? void 0 : e[Symbol.for("HttpResponse")]) === !0;
@@ -464,8 +464,8 @@ function ve(r) {
throw new TypeError("passed argument must be of tye string"); throw new TypeError("passed argument must be of tye string");
var t = unescape(encodeURIComponent(e)), n = new Uint8Array(t.length); var t = unescape(encodeURIComponent(e)), n = new Uint8Array(t.length);
const i = t.split(""); const i = t.split("");
for (let c = 0; c < i.length; c++) for (let o = 0; o < i.length; o++)
n[c] = i[c].charCodeAt(0); n[o] = i[o].charCodeAt(0);
return n; return n;
}; };
} }
@@ -479,10 +479,10 @@ function we(r) {
if (typeof n != "boolean") if (typeof n != "boolean")
throw new TypeError("stream option must be boolean"); throw new TypeError("stream option must be boolean");
if (ArrayBuffer.isView(e)) { if (ArrayBuffer.isView(e)) {
var i = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), c = new Array(i.length); var i = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), o = new Array(i.length);
for (let f = 0; f < i.length; f++) for (let f = 0; f < i.length; f++)
c[f] = String.fromCharCode(i[f]); o[f] = String.fromCharCode(i[f]);
return decodeURIComponent(escape(c.join(""))); return decodeURIComponent(escape(o.join("")));
} else } else
throw new TypeError("passed argument must be an array buffer view"); throw new TypeError("passed argument must be an array buffer view");
}; };
@@ -492,11 +492,13 @@ var fe = {
TextDecoder: we TextDecoder: we
}; };
const ye = new fe.TextEncoder("utf8"), be = new fe.TextDecoder("utf8"); const ye = new fe.TextEncoder("utf8"), be = new fe.TextDecoder("utf8");
function Ee(r) { function Ee(r, e = 0) {
let e = 5381; let t = 3735928559 ^ e, n = 1103547991 ^ e;
for (let t = 0; t < r.length; t++) for (let i = 0; i < r.length; i++) {
e = e * 33 ^ r.charCodeAt(t); const o = r.charCodeAt(i);
return (e >>> 0).toString(16); t = Math.imul(t ^ o, 2654435761), n = Math.imul(n ^ o, 1597334677);
}
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(n ^ n >>> 13, 3266489909), n = Math.imul(n ^ n >>> 16, 2246822507), n ^= Math.imul(t ^ t >>> 13, 3266489909), (4294967296 * (2097151 & n) + (t >>> 0)).toString(16);
} }
function Pe(r, e) { function Pe(r, e) {
return r.replace(new RegExp(`^${e}+|${e}+$`, "g"), ""); return r.replace(new RegExp(`^${e}+|${e}+$`, "g"), "");
@@ -504,7 +506,7 @@ function Pe(r, e) {
function Te(r) { function Te(r) {
return ye.encode(r || ""); return ye.encode(r || "");
} }
function _e(r) { function Ce(r) {
return be.decode(new DataView(r), {}); return be.decode(new DataView(r), {});
} }
const Se = 62, Q = 30, he = 31, Oe = 63; const Se = 62, Q = 30, he = 31, Oe = 63;
@@ -543,7 +545,7 @@ class xe {
*/ */
decode(e) { decode(e) {
if (!e || e.length === 0) return ""; if (!e || e.length === 0) return "";
const t = new Ae(this).decode(e); const t = new Me(this).decode(e);
return new TextDecoder().decode(t); return new TextDecoder().decode(t);
} }
} }
@@ -559,7 +561,7 @@ class me {
l(this, "src", new Uint8Array()); l(this, "src", new Uint8Array());
/** @type {number} */ /** @type {number} */
l(this, "pos", 0); l(this, "pos", 0);
C(this, z, e); A(this, z, e);
} }
/** @returns {number} */ /** @returns {number} */
get6bits() { get6bits() {
@@ -584,14 +586,14 @@ class me {
} }
z = new WeakMap(); z = new WeakMap();
var V; var V;
class Ae { class Me {
/** /**
* @param {Base62} b62 * @param {Base62} b62
*/ */
constructor(e) { constructor(e) {
/** @type {Base62} */ /** @type {Base62} */
w(this, V); w(this, V);
C(this, V, e); A(this, V, e);
} }
/** /**
* @param {string} src * @param {string} src
@@ -599,14 +601,14 @@ class Ae {
*/ */
decode(e) { decode(e) {
const t = new Uint8Array(Math.ceil(e.length * 6 / 8) + 1); const t = new Uint8Array(Math.ceil(e.length * 6 / 8) + 1);
let n = t.length, i = 0, c = 0; let n = t.length, i = 0, o = 0;
for (let f = 0; f < e.length; f++) { for (let f = 0; f < e.length; f++) {
const U = e[f].charCodeAt(0), a = s(this, V).decodeMap[U]; const U = e[f].charCodeAt(0), c = s(this, V).decodeMap[U];
if (a === 255) if (c === 255)
throw new Error(`CorruptInputError at index ${f}`); throw new Error(`CorruptInputError at index ${f}`);
f === e.length - 1 ? (c |= a << i, i += Math.ceil(Math.log2(a + 1))) : (a & Q) === Q ? (c |= a << i, i += 5) : (c |= a << i, i += 6), i >= 8 && (n--, t[n] = c & 255, i %= 8, c >>= 8); f === e.length - 1 ? (o |= c << i, i += Math.ceil(Math.log2(c + 1))) : (c & Q) === Q ? (o |= c << i, i += 5) : (o |= c << i, i += 6), i >= 8 && (n--, t[n] = o & 255, i %= 8, o >>= 8);
} }
return i > 0 && (n--, t[n] = c & 255), t.slice(n); return i > 0 && (n--, t[n] = o & 255), t.slice(n);
} }
} }
V = new WeakMap(); V = new WeakMap();
@@ -647,7 +649,7 @@ class se {
* @param {RequestFn} [reqFn] * @param {RequestFn} [reqFn]
*/ */
l(this, "init", (e, t, n) => { l(this, "init", (e, t, n) => {
e && C(this, te, e), n && C(this, G, n), t && C(this, D, new xe(t)), s(this, re).call(this); e && A(this, te, e), n && A(this, G, n), t && A(this, D, new xe(t)), s(this, re).call(this);
}); });
w(this, re, () => { w(this, re, () => {
!s(this, K).size || !s(this, G) || (s(this, K).forEach((e) => s(this, Y).call(this, ...e)), s(this, K).clear()); !s(this, K).size || !s(this, G) || (s(this, K).forEach((e) => s(this, Y).call(this, ...e)), s(this, K).clear());
@@ -662,28 +664,28 @@ class se {
if (!s(this, G)) if (!s(this, G))
s(this, K).add([e, t, n, i]); s(this, K).add([e, t, n, i]);
else { else {
const { url: c, method: f, ...U } = n || {}; const { url: o, method: f, ...U } = n || {};
s(this, G).call(this, { url: c, method: f, ...U }).then((a) => { s(this, G).call(this, { url: o, method: f, ...U }).then((c) => {
if (![0, 1].includes(a.code)) if (![0, 1].includes(c.code))
throw ne(a.code ?? -1, a.msg ?? "响应格式错误", a.data, c, a == null ? void 0 : a.res); throw ne(c.code ?? -1, c.msg ?? "响应格式错误", c.data, o, c == null ? void 0 : c.res);
return [a.code, a.msg, a.data, c, (a == null ? void 0 : a.res) ?? ""]; return [c.code, c.msg, c.data, o, (c == null ? void 0 : c.res) ?? ""];
}).then((a) => { }).then((c) => {
const T = ( const T = (
/** @type {CacheEntry} */ /** @type {CacheEntry} */
a c
); );
return (t == "#" || f == "GET") && s(this, R)[t].set(e, T), t != "#" && f == "GET" && !i && setTimeout(() => { return (t == "#" || f == "GET") && s(this, R)[t].set(e, T), t != "#" && f == "GET" && !i && setTimeout(() => {
s(this, R)[t].delete(e); s(this, R)[t].delete(e);
}, 300), T; }, 300), T;
}).then((a) => { }).then((c) => {
var T; var T;
return (T = s(this, F).get(e)) == null ? void 0 : T.forEach((_, m, I) => { return (T = s(this, F).get(e)) == null ? void 0 : T.forEach((C, m, I) => {
_ && _[0](a), delete I[m]; C && C[0](c), delete I[m];
}); });
}).catch((a) => { }).catch((c) => {
var T; var T;
s(this, R)[t].delete(e), (T = s(this, F).get(e)) == null || T.forEach((_, m, I) => { s(this, R)[t].delete(e), (T = s(this, F).get(e)) == null || T.forEach((C, m, I) => {
_ && _[1](a instanceof L ? a : ne(-1, a, null, c)), delete I[m]; C && C[1](c instanceof L ? c : ne(-1, c, null, o)), delete I[m];
}); });
}).finally(() => s(this, F).delete(e)); }).finally(() => s(this, F).delete(e));
} }
@@ -697,16 +699,16 @@ class se {
l(this, "request", ({ url: e = "/", method: t = "GET", ...n }, i = !1) => { l(this, "request", ({ url: e = "/", method: t = "GET", ...n }, i = !1) => {
var m, I; var m, I;
e = Pe(e, "/"); e = Pe(e, "/");
const c = ( const o = (
/** @type {HttpMethod} */ /** @type {HttpMethod} */
t.toUpperCase() t.toUpperCase()
), f = Ee(JSON.stringify([e, c, n])), U = ( ), f = Ee(JSON.stringify([e, o, n])), U = (
/** @type {'#' | '$'} */ /** @type {'#' | '$'} */
(m = e == null ? void 0 : e.includes) != null && m.call(e, "/_/") ? "#" : "$" (m = e == null ? void 0 : e.includes) != null && m.call(e, "/_/") ? "#" : "$"
), { promise: a, resolve: T, reject: _ } = Promise.withResolvers(); ), { promise: c, resolve: T, reject: C } = Promise.withResolvers();
return s(this, R)[U].has(f) ? (console.log("cache", e), T(s(this, R)[U].get(f))) : s(this, F).has(f) ? (I = s(this, F).get(f)) == null || I.push([T, _]) : (s(this, F).set(f, [[T, _]]), s(this, Y).call(this, f, U, { url: e, method: c, ...n }, i)), /** @type {HttpResponseChainable} */ return s(this, R)[U].has(f) ? (console.log("cache", e), T(s(this, R)[U].get(f))) : s(this, F).has(f) ? (I = s(this, F).get(f)) == null || I.push([T, C]) : (s(this, F).set(f, [[T, C]]), s(this, Y).call(this, f, U, { url: e, method: o, ...n }, i)), /** @type {HttpResponseChainable} */
/** @type {unknown} */ /** @type {unknown} */
new Proxy(a, { new Proxy(c, {
// Symbol.for('HttpResponse') 是标记,用于外部 instanceof 识别此 Proxy 为 HttpResponse 类型 // Symbol.for('HttpResponse') 是标记,用于外部 instanceof 识别此 Proxy 为 HttpResponse 类型
get: (q, h) => h === Symbol.for("HttpResponse") ? !0 : (...d) => q.then((u) => ( get: (q, h) => h === Symbol.for("HttpResponse") ? !0 : (...d) => q.then((u) => (
/** @type {any} */ /** @type {any} */
@@ -835,5 +837,5 @@ export {
Ee as signature, Ee as signature,
Te as str2uint8array, Te as str2uint8array,
Pe as trim, Pe as trim,
_e as uint8array2str Ce as uint8array2str
}; };
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "ff-request", "name": "ff-request",
"version": "0.12.2", "version": "0.12.3",
"type": "module", "type": "module",
"main": "./ff-request.umd.cjs", "main": "./ff-request.umd.cjs",
"module": "./ff-request.js", "module": "./ff-request.js",
+3 -2
View File
@@ -1,9 +1,10 @@
/** /**
* DJB2 算法 —— 将字符串散列为十六进制字符串 * cyrb53 算法 —— 将字符串散列为十六进制字符串
* @param {string} input * @param {string} input
* @param {number} [seed=0]
* @returns {string} * @returns {string}
*/ */
export function signature(input: string): string; export function signature(input: string, seed?: number): string;
/** /**
* 去除字符串首尾指定字符 * 去除字符串首尾指定字符
* @param {string} str * @param {string} str