@deot/docs-client 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/chunks/browser-Cmwcvs-d.js +505 -0
- package/dist/chunks/cdn-DEvdGJu2-bmlgKy4E.js +38 -0
- package/dist/chunks/chunk-rhk8Qtmk-CUgXtmq_.js +14 -0
- package/dist/chunks/compile-Bw7v7QE--Dd1-R95H.js +79920 -0
- package/dist/chunks/compiler-sfc.esm-browser-B4_kBkG5.js +24975 -0
- package/dist/chunks/dayjs.min-B3g34Qcz.js +300 -0
- package/dist/chunks/dist-0ySyXNpo.js +415 -0
- package/dist/chunks/dist-BUw25nXJ.js +65 -0
- package/dist/chunks/dist-BeOE8qTX.js +345 -0
- package/dist/chunks/dist-Bm7SK-km.js +24517 -0
- package/dist/chunks/dist-C3V7reR4.js +197 -0
- package/dist/chunks/dist-C8z9l0mA.js +58 -0
- package/dist/chunks/dist-CI9Lp9Cj.js +247 -0
- package/dist/chunks/dist-COjpr4FU.js +426 -0
- package/dist/chunks/dist-CQir6D4y.js +244 -0
- package/dist/chunks/dist-CuJyl-ef.js +17 -0
- package/dist/chunks/dist-Cxf7_ocf.js +44 -0
- package/dist/chunks/dist-DF4kisl2.js +43 -0
- package/dist/chunks/dist-DLj8yJdm.js +38 -0
- package/dist/chunks/dist-DN0sqx7H.js +39 -0
- package/dist/chunks/dist-DWqBe2Ah.js +132 -0
- package/dist/chunks/dist-D_Uqh6m9.js +80 -0
- package/dist/chunks/dist-DcIU51zW.js +166 -0
- package/dist/chunks/dist-DlmO7OlF.js +22 -0
- package/dist/chunks/dist-kiZUqqzR.js +27 -0
- package/dist/chunks/dist-oZ12SGqg.js +6 -0
- package/dist/chunks/dist-uXnwGrO3.js +76 -0
- package/dist/chunks/dist-va7FmnW4.js +156 -0
- package/dist/chunks/{echarts-I1Rk_oCV.js → echarts-Dk-pu7GM.js} +450 -398
- package/dist/chunks/files-C5UMzYxA-q9oJ4PrI.js +110 -0
- package/dist/chunks/html2canvas-Deo0mM5K.js +4022 -0
- package/dist/chunks/index.es-UlJ0gfdF.js +5757 -0
- package/dist/chunks/jspdf.es.min-CJc40v7q.js +17873 -0
- package/dist/chunks/jsx-CwMPlI4_-CAiik-V7.js +128454 -0
- package/dist/chunks/jszip.min-BbVwZKYP.js +3044 -0
- package/dist/chunks/linker-JHdz37DK-CWgUtxZ5.js +118 -0
- package/dist/chunks/local-sandbox-B8IJ5jWb-BgfU3iQ4.js +300 -0
- package/dist/chunks/lodash-Cxf6dD_I.js +5161 -0
- package/dist/chunks/modules-DlLJF_vd-DcNdL6sc.js +153 -0
- package/dist/chunks/{photoswipe.esm-CT37djgx.js → photoswipe.esm-B0V-xGTB.js} +36 -31
- package/dist/chunks/pinia-pDJilYOg.js +326 -0
- package/dist/chunks/purify.es-BiqY1C6m.js +867 -0
- package/dist/chunks/remote-DfXAsO9n-C_MtPVYr.js +75 -0
- package/dist/chunks/script-xKUjE8pf-oF69rg-w.js +14941 -0
- package/dist/chunks/store-D8vwi-HV-RFStijWr.js +16936 -0
- package/dist/chunks/vue-router-C0mj8Ot5.js +1196 -0
- package/dist/chunks/vue.runtime.esm-bundler-XxHGOLq2.js +4879 -0
- package/dist/index.cjs +17 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41759 -103263
- package/dist/index.style.css +3 -4
- package/package.json +9 -9
- package/dist/chunks/_commonjsHelpers-BFTU3MAI-D_7z5o6A.js +0 -8
- package/dist/chunks/jsx-H2PmTOgp-C0GVSSMR.js +0 -128281
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
globalThis.process;
|
|
2
|
+
import { n as e } from "./rolldown-runtime-Ce3zPWPd.js";
|
|
3
|
+
import { o as t } from "./dist-C3V7reR4.js";
|
|
4
|
+
import { a as n, c as r, d as i, f as a, h as o, i as s, l as c, m as l, n as u, p as d, r as f, s as p, t as m, u as h } from "./dist-DLj8yJdm.js";
|
|
5
|
+
//#region node_modules/.pnpm/@deot+http-hooks@1.1.8/node_modules/@deot/http-hooks/dist/index.js
|
|
6
|
+
var g = /* @__PURE__ */ e({
|
|
7
|
+
onRequest: () => C,
|
|
8
|
+
onResponse: () => _
|
|
9
|
+
}), _ = (e) => {
|
|
10
|
+
let { body: t } = e.response;
|
|
11
|
+
if (o(t)) try {
|
|
12
|
+
t = JSON.parse(t.toString());
|
|
13
|
+
} catch {}
|
|
14
|
+
return e.response.body = t, e;
|
|
15
|
+
}, v = "application/json", y = "application/x-www-form-urlencoded", b = "multipart/form-data", x = (e) => e || e === !1 || e === 0 || e === "", S = (e) => {
|
|
16
|
+
let t = [];
|
|
17
|
+
for (let n in e) x(e[n]) && t.push(n + "=" + encodeURIComponent(d(e[n]) ? JSON.stringify(e[n]) : e[n]));
|
|
18
|
+
return t.join("&");
|
|
19
|
+
}, C = (e) => {
|
|
20
|
+
let { url: g, body: _, headers: C, method: w, dynamic: T } = e.request, E = w.toLowerCase(), D = g, O = _;
|
|
21
|
+
if (T && d(O)) {
|
|
22
|
+
let e = O, n = /(\/?{[^?\/\&]+|\/?:[^\d][^?\/\&]+)/g, r = "", i = D.replace(/[a-zA-z]+:\/\/[^\/{]*/, (e) => (r = e, ""));
|
|
23
|
+
if (n.test(i)) {
|
|
24
|
+
let a = [];
|
|
25
|
+
i = i.replace(n, (n) => {
|
|
26
|
+
let r = n.replace(/({|}|\s|:|\/)/g, ""), i = t(e, r);
|
|
27
|
+
return a.push(i), i.v ? `${n.indexOf("/") === 0 ? "/" : ""}${i.v}` : "";
|
|
28
|
+
}), a.forEach((e) => e.o[e.k] !== void 0 && delete e.o[e.k]), D = r + i;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (["get"].includes(E) && d(O)) {
|
|
32
|
+
let e = S(O);
|
|
33
|
+
e.length > 0 && (D += (D.includes("?") ? "&" : "?") + e), O = null;
|
|
34
|
+
} else {
|
|
35
|
+
let e = C.get("Content-Type") || "", t = e.includes(v);
|
|
36
|
+
if (i(O) && h(O) && (O = new FormData(O)), c(O) && t) throw Error("expected 'json', received 'FormData', need formDataToJSON");
|
|
37
|
+
if (!(u(O) || n(O) || l(O) || p(O) || s(O) || c(O) || o(O) || !O)) {
|
|
38
|
+
if (f(O)) O = O.buffer;
|
|
39
|
+
else if (a(O)) C.set("Content-Type", y, !1), O = O.toString();
|
|
40
|
+
else if (r(O)) {
|
|
41
|
+
let e = O;
|
|
42
|
+
O = new FormData(), Array.from(e).forEach((e) => {
|
|
43
|
+
O.append("files[]", e);
|
|
44
|
+
});
|
|
45
|
+
} else if (d(O) || m(O)) {
|
|
46
|
+
if (e.includes(y)) O = S(O);
|
|
47
|
+
else if (e.includes(b)) {
|
|
48
|
+
let e = O;
|
|
49
|
+
O = new FormData(), Object.keys(e).forEach((t) => {
|
|
50
|
+
let n = [t, e[t]];
|
|
51
|
+
p(n[1]) && n[1].name && n.push(n[1].name), d(n[1]) && (n[1] = JSON.stringify(n[1])), x(n[1]) && O.append.apply(O, n);
|
|
52
|
+
});
|
|
53
|
+
} else C.set("Content-Type", v, !1), O = JSON.stringify(O);
|
|
54
|
+
} else O = JSON.stringify(O);
|
|
55
|
+
}
|
|
56
|
+
!c(O) && [
|
|
57
|
+
"post",
|
|
58
|
+
"put",
|
|
59
|
+
"patch"
|
|
60
|
+
].includes(E) && C.set("Content-Type", y, !1);
|
|
61
|
+
}
|
|
62
|
+
return c(O) && C.set("Content-Type", null, !0), e.request.url = D, e.request.body = O, e.request.headers = C, e;
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { C as n, _ as r, g as t };
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
globalThis.process;
|
|
2
|
+
import { n as e } from "./rolldown-runtime-Ce3zPWPd.js";
|
|
3
|
+
//#region node_modules/.pnpm/@deot+http-core@1.1.7/node_modules/@deot/http-core/dist/index.js
|
|
4
|
+
var t = /* @__PURE__ */ e({
|
|
5
|
+
ERROR_CODE: () => f,
|
|
6
|
+
HTTPController: () => m,
|
|
7
|
+
HTTPHeaders: () => n,
|
|
8
|
+
HTTPRequest: () => a,
|
|
9
|
+
HTTPResponse: () => r,
|
|
10
|
+
HTTPShell: () => p,
|
|
11
|
+
HTTPShellLeaf: () => d
|
|
12
|
+
}), n = class e {
|
|
13
|
+
constructor(e) {
|
|
14
|
+
typeof e == "object" && this.set(e, !0);
|
|
15
|
+
}
|
|
16
|
+
set(t, n, r) {
|
|
17
|
+
if (typeof t == "string") {
|
|
18
|
+
let e = t, i = n;
|
|
19
|
+
this[e] = r ? i : this[e] || i;
|
|
20
|
+
} else {
|
|
21
|
+
let i = t;
|
|
22
|
+
r = n, i = i instanceof e ? i.toJSON() : { ...i }, Object.keys(i).forEach((e) => {
|
|
23
|
+
this.set(e, i[e], r);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
has(e) {
|
|
29
|
+
return !!this[e];
|
|
30
|
+
}
|
|
31
|
+
get(e) {
|
|
32
|
+
return this[e];
|
|
33
|
+
}
|
|
34
|
+
toJSON() {
|
|
35
|
+
let e = /* @__PURE__ */ Object.create(null);
|
|
36
|
+
for (let t in this) Object.hasOwnProperty.call(this, t) && this[t] && (e[t] = this[t]);
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
get [Symbol.toStringTag]() {
|
|
40
|
+
return "HTTPHeaders";
|
|
41
|
+
}
|
|
42
|
+
}, r = class e {
|
|
43
|
+
url;
|
|
44
|
+
body;
|
|
45
|
+
headers;
|
|
46
|
+
status;
|
|
47
|
+
statusText;
|
|
48
|
+
redirected;
|
|
49
|
+
type;
|
|
50
|
+
ok;
|
|
51
|
+
bodyUsed;
|
|
52
|
+
constructor(t, r) {
|
|
53
|
+
let i = {
|
|
54
|
+
body: null,
|
|
55
|
+
headers: {},
|
|
56
|
+
ok: !0,
|
|
57
|
+
redirected: !1,
|
|
58
|
+
status: 200,
|
|
59
|
+
statusText: "",
|
|
60
|
+
type: "default",
|
|
61
|
+
url: ""
|
|
62
|
+
}, a = t && (t.constructor === Object || t instanceof e) ? {
|
|
63
|
+
...i,
|
|
64
|
+
...t,
|
|
65
|
+
...r
|
|
66
|
+
} : {
|
|
67
|
+
...i,
|
|
68
|
+
body: t,
|
|
69
|
+
...r
|
|
70
|
+
};
|
|
71
|
+
Object.keys(a).forEach((e) => {
|
|
72
|
+
let t = a[e] === void 0 ? i[e] : a[e];
|
|
73
|
+
this[e] = e === "headers" ? new n(t) : t;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
static error(t, n) {
|
|
77
|
+
return new e(null, {
|
|
78
|
+
...n,
|
|
79
|
+
status: n?.status || 0,
|
|
80
|
+
type: "error",
|
|
81
|
+
ok: !1,
|
|
82
|
+
statusText: t
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, i = (e) => new r({ body: e.body }), a = class e {
|
|
86
|
+
url;
|
|
87
|
+
method;
|
|
88
|
+
headers;
|
|
89
|
+
body;
|
|
90
|
+
mode;
|
|
91
|
+
credentials;
|
|
92
|
+
cache;
|
|
93
|
+
redirect;
|
|
94
|
+
referrer;
|
|
95
|
+
integrity;
|
|
96
|
+
keepalive;
|
|
97
|
+
referrerPolicy;
|
|
98
|
+
bodyUsed;
|
|
99
|
+
localData = null;
|
|
100
|
+
onStart;
|
|
101
|
+
onFinish;
|
|
102
|
+
onRequest;
|
|
103
|
+
onResponse;
|
|
104
|
+
timeout;
|
|
105
|
+
maxTries;
|
|
106
|
+
interval;
|
|
107
|
+
shared = null;
|
|
108
|
+
provider;
|
|
109
|
+
constructor(t, r, a) {
|
|
110
|
+
let o = {
|
|
111
|
+
method: "GET",
|
|
112
|
+
headers: {},
|
|
113
|
+
body: null,
|
|
114
|
+
mode: "cors",
|
|
115
|
+
credentials: "same-origin",
|
|
116
|
+
cache: "default",
|
|
117
|
+
redirect: "follow",
|
|
118
|
+
integrity: "",
|
|
119
|
+
keepalive: !1,
|
|
120
|
+
referrer: "about:client",
|
|
121
|
+
referrerPolicy: "",
|
|
122
|
+
localData: null,
|
|
123
|
+
timeout: 6e4,
|
|
124
|
+
maxTries: 1,
|
|
125
|
+
interval: 0,
|
|
126
|
+
shared: null,
|
|
127
|
+
provider: i
|
|
128
|
+
}, s = t && (t.constructor === Object || t instanceof e) ? {
|
|
129
|
+
...o,
|
|
130
|
+
...a,
|
|
131
|
+
...t,
|
|
132
|
+
...r
|
|
133
|
+
} : {
|
|
134
|
+
...o,
|
|
135
|
+
...a,
|
|
136
|
+
url: t,
|
|
137
|
+
...r
|
|
138
|
+
};
|
|
139
|
+
Object.keys(s).forEach((e) => {
|
|
140
|
+
let t = s[e] === void 0 ? o[e] : s[e];
|
|
141
|
+
this[e] = e === "headers" ? new n(t) : t;
|
|
142
|
+
});
|
|
143
|
+
let c = (t && typeof t == "object" ? t : r) || {};
|
|
144
|
+
[
|
|
145
|
+
"onStart",
|
|
146
|
+
"onFinish",
|
|
147
|
+
"onRequest",
|
|
148
|
+
"onResponse"
|
|
149
|
+
].forEach((e) => {
|
|
150
|
+
let t = c[e], n = Array.isArray(t) ? t : t ? [t] : [];
|
|
151
|
+
this[e] = (a ? n.concat(a[e]) : n).filter((e, t, n) => n.indexOf(e) === t);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}, o = +/* @__PURE__ */ new Date(), s = 0, c = (e) => `${e}-${o}-${++s}`, l = (e) => {
|
|
155
|
+
let t = 0;
|
|
156
|
+
return typeof e == "object" && e.enforce && (t = e.enforce === "pre" ? -1 : 1), t;
|
|
157
|
+
}, u = (e) => [...e].sort((e, t) => l(e) - l(t)).map((e) => typeof e == "object" ? e.handler : e), d = class {
|
|
158
|
+
id = c("shell.leaf");
|
|
159
|
+
cancel;
|
|
160
|
+
timeout;
|
|
161
|
+
target;
|
|
162
|
+
originalRequest;
|
|
163
|
+
originalResponse;
|
|
164
|
+
request;
|
|
165
|
+
response;
|
|
166
|
+
constructor(e) {
|
|
167
|
+
this.originalRequest = e, this.request = new a(e);
|
|
168
|
+
}
|
|
169
|
+
then(e, t) {
|
|
170
|
+
return this.target.then(e, t);
|
|
171
|
+
}
|
|
172
|
+
catch(e) {
|
|
173
|
+
return this.target.catch(e);
|
|
174
|
+
}
|
|
175
|
+
finally(e) {
|
|
176
|
+
return this.target.finally(e);
|
|
177
|
+
}
|
|
178
|
+
}, f = {
|
|
179
|
+
HTTP_URL_EMPTY: "HTTP_URL_EMPTY",
|
|
180
|
+
HTTP_RESPONSE_REBUILD_FAILED: "HTTP_RESPONSE_REBUILD_FAILED",
|
|
181
|
+
HTTP_OPTIONS_REBUILD_FAILED: "HTTP_OPTIONS_REBUILD_FAILED",
|
|
182
|
+
HTTP_CANCEL: "HTTP_CANCEL",
|
|
183
|
+
HTTP_REQUEST_TIMEOUT: "HTTP_REQUEST_TIMEOUT",
|
|
184
|
+
HTTP_STATUS_ERROR: "HTTP_STATUS_ERROR",
|
|
185
|
+
HTTP_CODE_ILLEGAL: "HTTP_CODE_ILLEGAL",
|
|
186
|
+
HTTP_RESPONSE_PARSING_FAILED: "HTTP_RESPONSE_PARSING_FAILED"
|
|
187
|
+
}, p = class {
|
|
188
|
+
parent;
|
|
189
|
+
request;
|
|
190
|
+
leafs = {};
|
|
191
|
+
isPending = !1;
|
|
192
|
+
constructor(e, t, n) {
|
|
193
|
+
this.request = new a(e, t, n.request), this.parent = n;
|
|
194
|
+
}
|
|
195
|
+
send() {
|
|
196
|
+
let e = Object.keys(this.leafs);
|
|
197
|
+
if (this.request.shared && e.length) return this.leafs[e[0]];
|
|
198
|
+
this.parent._add(this);
|
|
199
|
+
let t = new d(this.request);
|
|
200
|
+
this.leafs[t.id] = t;
|
|
201
|
+
let n = new Promise((e, n) => {
|
|
202
|
+
t.cancel = async () => {
|
|
203
|
+
n(this.error(t, f.HTTP_CANCEL)), await new Promise((e) => {
|
|
204
|
+
t.target.catch(() => {}).finally(e);
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
}), r, i;
|
|
208
|
+
return t.target = new Promise((e, o) => {
|
|
209
|
+
Promise.resolve().then(() => this.loading(t)).then(() => this.before(t)).then(() => {
|
|
210
|
+
let e = this.after(t), { timeout: r } = t.originalRequest, i = [e, n];
|
|
211
|
+
return r && i.push(new Promise((e, n) => {
|
|
212
|
+
t.timeout = setTimeout(() => n(this.error(t, f.HTTP_REQUEST_TIMEOUT)), r);
|
|
213
|
+
})), Promise.race(i);
|
|
214
|
+
}).then(() => i = t.response).catch((e) => r = e).then(() => {
|
|
215
|
+
let n = (n) => {
|
|
216
|
+
this.clear(t).then(() => e(n));
|
|
217
|
+
}, s = async (e) => {
|
|
218
|
+
this.clear(t).then(() => o(e));
|
|
219
|
+
}, c = r || i.type === "error", l = new a(this.request);
|
|
220
|
+
return --l.maxTries, c && l.maxTries >= 1 ? (l.onStart = [], l.onFinish = [], Promise.resolve().then(() => l.interval && new Promise((e) => setTimeout(e, l.interval))).then(() => this.parent.http(l)).then(n).catch(s)) : c ? s(r || i) : n(i);
|
|
221
|
+
});
|
|
222
|
+
}), t;
|
|
223
|
+
}
|
|
224
|
+
async task(e, t, n) {
|
|
225
|
+
if (!t.length) return;
|
|
226
|
+
let r = !1;
|
|
227
|
+
return u(t).reduce((t, i) => (t = t.then(() => {
|
|
228
|
+
if (!r) {
|
|
229
|
+
let t = i(e);
|
|
230
|
+
return t === e || t;
|
|
231
|
+
}
|
|
232
|
+
return !1;
|
|
233
|
+
}).then((e) => {
|
|
234
|
+
!r && n && n(e), e === !1 && (r = !0);
|
|
235
|
+
}), t), Promise.resolve());
|
|
236
|
+
}
|
|
237
|
+
async clear(e) {
|
|
238
|
+
let { timeout: t, id: n, response: r } = e;
|
|
239
|
+
t && clearTimeout(t), await this.loaded(e), !(r?.type !== "error" && this.request.shared) && this.clearByLeafId(n);
|
|
240
|
+
}
|
|
241
|
+
clearByLeafId(e) {
|
|
242
|
+
let t = this.leafs[e];
|
|
243
|
+
t && (Object.keys(t).forEach((e) => delete t[e]), delete this.leafs[e], Object.keys(this.leafs).length || this.parent._remove(this));
|
|
244
|
+
}
|
|
245
|
+
async removeIfShared(e) {
|
|
246
|
+
let t;
|
|
247
|
+
this.request.shared && (!e || this.request.shared === e) && (t = Object.keys(this.leafs)[0]) && (await this.cancel(t), this.clearByLeafId(t));
|
|
248
|
+
}
|
|
249
|
+
async cancel(e) {
|
|
250
|
+
if (e) {
|
|
251
|
+
let t = typeof e == "string" ? this.leafs[e] : e;
|
|
252
|
+
t?.cancel && await t.cancel();
|
|
253
|
+
} else await Object.keys(this.leafs).reduce((e, t) => (e = e.then(() => this.cancel(t)), e), Promise.resolve());
|
|
254
|
+
}
|
|
255
|
+
async loading(e) {
|
|
256
|
+
let { localData: t, onStart: n } = e.originalRequest;
|
|
257
|
+
!t && !this.isPending && (this.isPending = !0, await this.task(e, n));
|
|
258
|
+
}
|
|
259
|
+
async loaded(e) {
|
|
260
|
+
let { localData: t, onFinish: n } = e.originalRequest, r = Object.keys(this.leafs).length === 1;
|
|
261
|
+
!t && r && this.isPending && (this.isPending = !1, await this.task(e, n));
|
|
262
|
+
}
|
|
263
|
+
async before(e) {
|
|
264
|
+
let { onRequest: t } = e.originalRequest;
|
|
265
|
+
try {
|
|
266
|
+
await this.task(e, t, (t) => {
|
|
267
|
+
let n;
|
|
268
|
+
n = t instanceof a ? new a(t) : t === !0 ? e.request : new a(e.request, t), e.request = n;
|
|
269
|
+
});
|
|
270
|
+
} catch (t) {
|
|
271
|
+
throw this.error(e, f.HTTP_OPTIONS_REBUILD_FAILED, t);
|
|
272
|
+
}
|
|
273
|
+
if (!e.request.url && !e.request.localData) throw this.error(e, f.HTTP_URL_EMPTY);
|
|
274
|
+
}
|
|
275
|
+
async after(e) {
|
|
276
|
+
let { localData: t, onResponse: n, provider: i } = e.request, a = t ? Promise.resolve(new r({ body: t })) : i(e.request, e), o;
|
|
277
|
+
try {
|
|
278
|
+
o = await a;
|
|
279
|
+
} catch (e) {
|
|
280
|
+
o = e;
|
|
281
|
+
}
|
|
282
|
+
e.originalResponse = o, e.response = new r(o);
|
|
283
|
+
try {
|
|
284
|
+
await this.task(e, n, (t) => {
|
|
285
|
+
let n;
|
|
286
|
+
n = t instanceof r ? new r(t) : t === !0 ? e.response : new r(e.response, t), e.response = n;
|
|
287
|
+
});
|
|
288
|
+
} catch (t) {
|
|
289
|
+
throw this.error(e, f.HTTP_RESPONSE_REBUILD_FAILED, t);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
error(e, t, n) {
|
|
293
|
+
return r.error(t, {
|
|
294
|
+
body: n,
|
|
295
|
+
"@@internal": {
|
|
296
|
+
request: {
|
|
297
|
+
input: this.request,
|
|
298
|
+
used: e?.request
|
|
299
|
+
},
|
|
300
|
+
response: {
|
|
301
|
+
input: e?.originalResponse,
|
|
302
|
+
used: e?.response
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}, m = class {
|
|
308
|
+
request;
|
|
309
|
+
shells;
|
|
310
|
+
constructor(e) {
|
|
311
|
+
this.request = new a(e || {}), this.shells = [];
|
|
312
|
+
}
|
|
313
|
+
http(e, t) {
|
|
314
|
+
return this._getShell(e, t).send();
|
|
315
|
+
}
|
|
316
|
+
custom(e, t) {
|
|
317
|
+
return this._getShell(e, t);
|
|
318
|
+
}
|
|
319
|
+
async cancel(e) {
|
|
320
|
+
await this.shells.reduce((t, n) => (t = t.then(() => n.cancel(e)), t), Promise.resolve()), e || (this.shells = this.shells.filter((e) => !!e.request.shared));
|
|
321
|
+
}
|
|
322
|
+
async removeShared(e) {
|
|
323
|
+
await this.shells.reduce((t, n) => (t = t.then(() => n.removeIfShared(e)), t), Promise.resolve());
|
|
324
|
+
}
|
|
325
|
+
async clear() {
|
|
326
|
+
await this.cancel(), await this.removeShared();
|
|
327
|
+
}
|
|
328
|
+
_getShell(e, t) {
|
|
329
|
+
let n = new p(e, t, this);
|
|
330
|
+
return n.request.shared && (n = this.shells.find((e) => {
|
|
331
|
+
if (e.request.shared !== n.request.shared) return !1;
|
|
332
|
+
try {
|
|
333
|
+
return JSON.stringify(e.request) === JSON.stringify(n.request);
|
|
334
|
+
} catch {}
|
|
335
|
+
}) || n), n;
|
|
336
|
+
}
|
|
337
|
+
_add(e) {
|
|
338
|
+
this.shells.includes(e) || this.shells.push(e);
|
|
339
|
+
}
|
|
340
|
+
_remove(e) {
|
|
341
|
+
this.shells = this.shells.filter((t) => t !== e);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
//#endregion
|
|
345
|
+
export { t as a, r as i, m as n, n as r, f as t };
|