@recats/cdeebee 2.3.6 → 3.0.0-beta.3
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/LICENSE +1 -1
- package/README.md +309 -150
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +93 -6
- package/dist/index.js +220 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -24
- package/dist/actions.d.ts +0 -24
- package/dist/cdeebee.js +0 -1174
- package/dist/cdeebee.umd.cjs +0 -3
- package/dist/definition.d.ts +0 -210
- package/dist/helpers.d.ts +0 -22
- package/dist/reducer.d.ts +0 -8
- package/dist/request.d.ts +0 -8
package/dist/cdeebee.js
DELETED
|
@@ -1,1174 +0,0 @@
|
|
|
1
|
-
function p(e) {
|
|
2
|
-
return e != null && typeof e == "object" && e["@@functional/placeholder"] === !0;
|
|
3
|
-
}
|
|
4
|
-
function B(e) {
|
|
5
|
-
return function t(r) {
|
|
6
|
-
return arguments.length === 0 || p(r) ? t : e.apply(this, arguments);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function D(e) {
|
|
10
|
-
return function t(r, n) {
|
|
11
|
-
switch (arguments.length) {
|
|
12
|
-
case 0:
|
|
13
|
-
return t;
|
|
14
|
-
case 1:
|
|
15
|
-
return p(r) ? t : B(function(s) {
|
|
16
|
-
return e(r, s);
|
|
17
|
-
});
|
|
18
|
-
default:
|
|
19
|
-
return p(r) && p(n) ? t : p(r) ? B(function(s) {
|
|
20
|
-
return e(s, n);
|
|
21
|
-
}) : p(n) ? B(function(s) {
|
|
22
|
-
return e(r, s);
|
|
23
|
-
}) : e(r, n);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function q(e) {
|
|
28
|
-
return function t(r, n, s) {
|
|
29
|
-
switch (arguments.length) {
|
|
30
|
-
case 0:
|
|
31
|
-
return t;
|
|
32
|
-
case 1:
|
|
33
|
-
return p(r) ? t : D(function(i, l) {
|
|
34
|
-
return e(r, i, l);
|
|
35
|
-
});
|
|
36
|
-
case 2:
|
|
37
|
-
return p(r) && p(n) ? t : p(r) ? D(function(i, l) {
|
|
38
|
-
return e(i, n, l);
|
|
39
|
-
}) : p(n) ? D(function(i, l) {
|
|
40
|
-
return e(r, i, l);
|
|
41
|
-
}) : B(function(i) {
|
|
42
|
-
return e(r, n, i);
|
|
43
|
-
});
|
|
44
|
-
default:
|
|
45
|
-
return p(r) && p(n) && p(s) ? t : p(r) && p(n) ? D(function(i, l) {
|
|
46
|
-
return e(i, l, s);
|
|
47
|
-
}) : p(r) && p(s) ? D(function(i, l) {
|
|
48
|
-
return e(i, n, l);
|
|
49
|
-
}) : p(n) && p(s) ? D(function(i, l) {
|
|
50
|
-
return e(r, i, l);
|
|
51
|
-
}) : p(r) ? B(function(i) {
|
|
52
|
-
return e(i, n, s);
|
|
53
|
-
}) : p(n) ? B(function(i) {
|
|
54
|
-
return e(r, i, s);
|
|
55
|
-
}) : p(s) ? B(function(i) {
|
|
56
|
-
return e(r, n, i);
|
|
57
|
-
}) : e(r, n, s);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const W = Array.isArray || function(t) {
|
|
62
|
-
return t != null && t.length >= 0 && Object.prototype.toString.call(t) === "[object Array]";
|
|
63
|
-
};
|
|
64
|
-
function F(e, t) {
|
|
65
|
-
return Object.prototype.hasOwnProperty.call(t, e);
|
|
66
|
-
}
|
|
67
|
-
function ae(e) {
|
|
68
|
-
return Object.prototype.toString.call(e) === "[object Object]";
|
|
69
|
-
}
|
|
70
|
-
const V = Number.isInteger || function(t) {
|
|
71
|
-
return t << 0 === t;
|
|
72
|
-
};
|
|
73
|
-
function Oe(e, t, r) {
|
|
74
|
-
if (V(e) && W(r)) {
|
|
75
|
-
var n = [].concat(r);
|
|
76
|
-
return n[e] = t, n;
|
|
77
|
-
}
|
|
78
|
-
var s = {};
|
|
79
|
-
for (var i in r)
|
|
80
|
-
s[i] = r[i];
|
|
81
|
-
return s[e] = t, s;
|
|
82
|
-
}
|
|
83
|
-
var De = /* @__PURE__ */ B(function(t) {
|
|
84
|
-
return t == null;
|
|
85
|
-
}), N = /* @__PURE__ */ q(function e(t, r, n) {
|
|
86
|
-
if (t.length === 0)
|
|
87
|
-
return r;
|
|
88
|
-
var s = t[0];
|
|
89
|
-
if (t.length > 1) {
|
|
90
|
-
var i = !De(n) && F(s, n) && typeof n[s] == "object" ? n[s] : V(t[1]) ? [] : {};
|
|
91
|
-
r = e(Array.prototype.slice.call(t, 1), r, i);
|
|
92
|
-
}
|
|
93
|
-
return Oe(s, r, n);
|
|
94
|
-
}), Pe = /* @__PURE__ */ q(function(t, r, n) {
|
|
95
|
-
return N([t], r, n);
|
|
96
|
-
});
|
|
97
|
-
function Be(e, t) {
|
|
98
|
-
return function() {
|
|
99
|
-
var r = arguments.length;
|
|
100
|
-
if (r === 0)
|
|
101
|
-
return t();
|
|
102
|
-
var n = arguments[r - 1];
|
|
103
|
-
return W(n) || typeof n[e] != "function" ? t.apply(this, arguments) : n[e].apply(n, Array.prototype.slice.call(arguments, 0, r - 1));
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
var Se = /* @__PURE__ */ q(/* @__PURE__ */ Be("slice", function(t, r, n) {
|
|
107
|
-
return Array.prototype.slice.call(n, t, r);
|
|
108
|
-
})), Ce = /* @__PURE__ */ q(function(t, r, n) {
|
|
109
|
-
var s = Array.prototype.slice.call(n, 0);
|
|
110
|
-
return s.splice(t, r), s;
|
|
111
|
-
});
|
|
112
|
-
function Ie(e, t) {
|
|
113
|
-
if (t == null)
|
|
114
|
-
return t;
|
|
115
|
-
if (V(e) && W(t))
|
|
116
|
-
return Ce(e, 1, t);
|
|
117
|
-
var r = {};
|
|
118
|
-
for (var n in t)
|
|
119
|
-
r[n] = t[n];
|
|
120
|
-
return delete r[e], r;
|
|
121
|
-
}
|
|
122
|
-
function Ne(e, t) {
|
|
123
|
-
if (V(e) && W(t))
|
|
124
|
-
return [].concat(t);
|
|
125
|
-
var r = {};
|
|
126
|
-
for (var n in t)
|
|
127
|
-
r[n] = t[n];
|
|
128
|
-
return r;
|
|
129
|
-
}
|
|
130
|
-
var Ue = /* @__PURE__ */ D(function e(t, r) {
|
|
131
|
-
if (r == null)
|
|
132
|
-
return r;
|
|
133
|
-
switch (t.length) {
|
|
134
|
-
case 0:
|
|
135
|
-
return r;
|
|
136
|
-
case 1:
|
|
137
|
-
return Ie(t[0], r);
|
|
138
|
-
default:
|
|
139
|
-
var n = t[0], s = Array.prototype.slice.call(t, 1);
|
|
140
|
-
return r[n] == null ? Ne(n, r) : Pe(n, e(s, r[n]), r);
|
|
141
|
-
}
|
|
142
|
-
}), ue = /* @__PURE__ */ D(function(t, r) {
|
|
143
|
-
return Ue([t], r);
|
|
144
|
-
}), Le = /* @__PURE__ */ q(function(t, r, n) {
|
|
145
|
-
var s = {}, i;
|
|
146
|
-
r = r || {}, n = n || {};
|
|
147
|
-
for (i in r)
|
|
148
|
-
F(i, r) && (s[i] = F(i, n) ? t(i, r[i], n[i]) : r[i]);
|
|
149
|
-
for (i in n)
|
|
150
|
-
F(i, n) && !F(i, s) && (s[i] = n[i]);
|
|
151
|
-
return s;
|
|
152
|
-
}), qe = /* @__PURE__ */ q(function e(t, r, n) {
|
|
153
|
-
return Le(function(s, i, l) {
|
|
154
|
-
return ae(i) && ae(l) ? e(t, i, l) : t(s, i, l);
|
|
155
|
-
}, r, n);
|
|
156
|
-
}), $ = /* @__PURE__ */ D(function(t, r) {
|
|
157
|
-
return qe(function(n, s, i) {
|
|
158
|
-
return i;
|
|
159
|
-
}, t, r);
|
|
160
|
-
}), ne = /* @__PURE__ */ D(function(t, r) {
|
|
161
|
-
for (var n = {}, s = {}, i = 0, l = t.length; i < l; )
|
|
162
|
-
s[t[i]] = 1, i += 1;
|
|
163
|
-
for (var v in r)
|
|
164
|
-
s.hasOwnProperty(v) || (n[v] = r[v]);
|
|
165
|
-
return n;
|
|
166
|
-
}), y = /* @__PURE__ */ ((e) => (e.CDEEBEE_REQUESTMANAGER_SHIFT = "@@cdeebee/REQUESTMANAGER_SHIFT", e.CDEEBEE_REQUESTMANAGER_SET = "@@cdeebee/REQUESTMANAGER_SET", e.CDEEBEE_ERRORHANDLER_SET = "@@cdeebee/ERRORHANDLER_SET", e.CDEEBEE_ENTITY_CHANGE_FIELD = "@@cdeebee/ENTITY_CHANGE_FIELD", e.CDEEBEE_ENTITY_UNSAFE_UPDATE_STORE = "@@cdeebee/ENTITY_UNSAFE_UPDATE_STORE", e.CDEEBEE_RESET_ENTITY = "@@cdeebee/RESET_ENTITY", e.CDEEBEE_SET_ENTITY = "@@cdeebee/SET_ENTITY", e.CDEEBEEE_UPDATE = "@@cdeebee/UPDATE", e.CDEEBEEE_DROP = "@@cdeebee/DROP", e.CDEEBEEE_DROP_PATH = "@@cdeebee/DROP_PATH", e.CDEEBEE_INTERNAL_ERROR = "@@cdeebee/INTERNAL_ERROR", e.CDEEBEE_REQUEST_ABORTED = "@@cdeebee/REQUEST_ABORTED", e.CDEEBEEE_DROP_REQUEST_BY_API_URL = "@@cdeebee/DROP_REQUEST_BY_API_URL", e.CDEEBEEE_DROP_ERROR_BY_API_URL = "@@cdeebee/DROP_ERROR_BY_API_URL", e.CHANGE_ROUTE = "@@router/LOCATION_CHANGE", e))(y || {}), U = /* @__PURE__ */ ((e) => (e.NEW = "NEW", e.EDITING = "EDITING", e.NORMAL = "NORMAL", e))(U || {}), pe = /* @__PURE__ */ ((e) => (e.merge = "merge", e.replace = "replace", e))(pe || {});
|
|
167
|
-
const de = (e) => ne(["__entity", "__state"], e), he = (e) => e.filter((t) => t.requestCancel ? (_e(t), !1) : !0), _e = (e) => {
|
|
168
|
-
e.controller && e.controller.abort instanceof Function && e.controller.abort();
|
|
169
|
-
}, je = (e, t) => {
|
|
170
|
-
if (!t || e.length === 0)
|
|
171
|
-
return !1;
|
|
172
|
-
const r = t instanceof Array ? t : [t], n = e.map((s) => s.api);
|
|
173
|
-
for (let s = 0; s < r.length; s += 1)
|
|
174
|
-
if (n.includes(r[s]))
|
|
175
|
-
return !0;
|
|
176
|
-
return !1;
|
|
177
|
-
}, He = (e) => Object.prototype.hasOwnProperty.call(e, "__entity") ? e.__entity : e, X = (e) => {
|
|
178
|
-
var r;
|
|
179
|
-
const t = ((r = e == null ? void 0 : e.__entity) == null ? void 0 : r.__state) || (e == null ? void 0 : e.__state);
|
|
180
|
-
return t || U.NORMAL;
|
|
181
|
-
}, xe = (e) => (e.__state = U.NEW, e), ke = (e) => X(e) === U.NORMAL ? (console.warn("commit works only in editing and new states"), e) : de(e), be = (e) => X(e) === U.NORMAL ? (console.warn("reset works only in editing and new states"), e) : de(e), ve = (e, t, r) => {
|
|
182
|
-
const n = e[t];
|
|
183
|
-
if (X(n[r]) === U.EDITING)
|
|
184
|
-
return e;
|
|
185
|
-
const i = N([t, r, "__entity"], n[r], e);
|
|
186
|
-
return N([t, r, "__entity", "__state"], U.EDITING, i);
|
|
187
|
-
}, Ae = (e, t, r) => {
|
|
188
|
-
const n = r || [];
|
|
189
|
-
let s = e;
|
|
190
|
-
for (let i = 0; i < t.length; i++) {
|
|
191
|
-
const l = t[i];
|
|
192
|
-
s = N([...n, ...l.key], l.value, s);
|
|
193
|
-
}
|
|
194
|
-
return s;
|
|
195
|
-
}, me = ({
|
|
196
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
197
|
-
response: { responseStatus: e, ...t },
|
|
198
|
-
cdeebee: r,
|
|
199
|
-
mergeListStrategy: n,
|
|
200
|
-
primaryKey: s
|
|
201
|
-
}) => {
|
|
202
|
-
const i = Object.keys(t);
|
|
203
|
-
for (const l of i) {
|
|
204
|
-
const v = {};
|
|
205
|
-
if (t[l] instanceof Object && Object.prototype.hasOwnProperty.call(t[l], s)) {
|
|
206
|
-
for (const R of t[l].data)
|
|
207
|
-
v[R[t[l][s]]] = R;
|
|
208
|
-
n[l] === pe.replace ? t[l] = v : t[l] = $(r[l], v);
|
|
209
|
-
} else (t[l] === null || t[l] === void 0 || typeof t[l] == "string") && (t = ne([l], t));
|
|
210
|
-
}
|
|
211
|
-
return t;
|
|
212
|
-
}, ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
213
|
-
__proto__: null,
|
|
214
|
-
batchingUpdate: Ae,
|
|
215
|
-
checkNetworkActivity: je,
|
|
216
|
-
commitEntity: ke,
|
|
217
|
-
defaultNormalize: me,
|
|
218
|
-
dropRequestFromArray: he,
|
|
219
|
-
editEntity: ve,
|
|
220
|
-
getEntityState: X,
|
|
221
|
-
getSubEntity: He,
|
|
222
|
-
insertEntity: xe,
|
|
223
|
-
requestCancel: _e,
|
|
224
|
-
resetEntity: be
|
|
225
|
-
}, Symbol.toStringTag, { value: "Module" })), ce = {}, ct = (e = ce, t) => {
|
|
226
|
-
const { type: r, payload: n } = t;
|
|
227
|
-
switch (r) {
|
|
228
|
-
case y.CDEEBEEE_UPDATE:
|
|
229
|
-
return { ...e, ...n.response };
|
|
230
|
-
case y.CDEEBEE_ENTITY_CHANGE_FIELD: {
|
|
231
|
-
const s = ve(e, n.entityList, n.entityID);
|
|
232
|
-
return Ae(s, n.valueList, [n.entityList, n.entityID, "__entity"]);
|
|
233
|
-
}
|
|
234
|
-
case y.CDEEBEE_ENTITY_UNSAFE_UPDATE_STORE:
|
|
235
|
-
return N([n.entityList, n.entityID], n.value, e);
|
|
236
|
-
case y.CDEEBEE_SET_ENTITY:
|
|
237
|
-
return N([n.entityList, n.entityID], n.entity, e);
|
|
238
|
-
case y.CDEEBEE_RESET_ENTITY: {
|
|
239
|
-
const s = e[n.entityList];
|
|
240
|
-
return N(
|
|
241
|
-
[n.entityList, n.entityID],
|
|
242
|
-
be(s[n.entityID]),
|
|
243
|
-
e
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
case y.CDEEBEEE_DROP:
|
|
247
|
-
return ce;
|
|
248
|
-
case y.CDEEBEEE_DROP_PATH:
|
|
249
|
-
return ne(n.path, e);
|
|
250
|
-
default:
|
|
251
|
-
return e;
|
|
252
|
-
}
|
|
253
|
-
}, le = {
|
|
254
|
-
activeRequest: [],
|
|
255
|
-
requestByApiUrl: {},
|
|
256
|
-
errorHandler: {}
|
|
257
|
-
}, lt = (e = le, t) => {
|
|
258
|
-
const { type: r, payload: n } = t;
|
|
259
|
-
switch (r) {
|
|
260
|
-
case y.CDEEBEE_REQUESTMANAGER_SET:
|
|
261
|
-
return { ...e, activeRequest: [...e.activeRequest, n] };
|
|
262
|
-
case y.CDEEBEE_REQUESTMANAGER_SHIFT:
|
|
263
|
-
return { ...e, activeRequest: Se(1, 1 / 0, e.activeRequest) };
|
|
264
|
-
case y.CDEEBEEE_UPDATE:
|
|
265
|
-
return {
|
|
266
|
-
...e,
|
|
267
|
-
requestByApiUrl: {
|
|
268
|
-
...e.requestByApiUrl,
|
|
269
|
-
[n.api]: n.cleanResponse
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
case y.CDEEBEEE_DROP_REQUEST_BY_API_URL:
|
|
273
|
-
return {
|
|
274
|
-
...e,
|
|
275
|
-
requestByApiUrl: ue(n.api, e.requestByApiUrl)
|
|
276
|
-
};
|
|
277
|
-
case y.CDEEBEEE_DROP_ERROR_BY_API_URL:
|
|
278
|
-
return {
|
|
279
|
-
...e,
|
|
280
|
-
errorHandler: ue(n.api, e.errorHandler)
|
|
281
|
-
};
|
|
282
|
-
case y.CDEEBEE_ERRORHANDLER_SET:
|
|
283
|
-
return {
|
|
284
|
-
...e,
|
|
285
|
-
errorHandler: {
|
|
286
|
-
...e.errorHandler,
|
|
287
|
-
[n.api]: n.cleanResponse
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
case y.CDEEBEE_INTERNAL_ERROR:
|
|
291
|
-
return { ...e, activeRequest: [], requestByApiUrl: {} };
|
|
292
|
-
case y.CHANGE_ROUTE:
|
|
293
|
-
return { ...le, activeRequest: he(e.activeRequest) };
|
|
294
|
-
default:
|
|
295
|
-
return e;
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
var Fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, fe = {}, Ee;
|
|
299
|
-
function Me() {
|
|
300
|
-
return Ee || (Ee = 1, function(e) {
|
|
301
|
-
e();
|
|
302
|
-
}(function() {
|
|
303
|
-
function e(o, a) {
|
|
304
|
-
(a == null || a > o.length) && (a = o.length);
|
|
305
|
-
for (var u = 0, c = Array(a); u < a; u++) c[u] = o[u];
|
|
306
|
-
return c;
|
|
307
|
-
}
|
|
308
|
-
function t(o) {
|
|
309
|
-
if (o === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
310
|
-
return o;
|
|
311
|
-
}
|
|
312
|
-
function r(o, a, u) {
|
|
313
|
-
return a = R(a), H(o, g() ? Reflect.construct(a, [], R(o).constructor) : a.apply(o, u));
|
|
314
|
-
}
|
|
315
|
-
function n(o, a) {
|
|
316
|
-
if (!(o instanceof a)) throw new TypeError("Cannot call a class as a function");
|
|
317
|
-
}
|
|
318
|
-
function s(o, a) {
|
|
319
|
-
for (var u = 0; u < a.length; u++) {
|
|
320
|
-
var c = a[u];
|
|
321
|
-
c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(o, Z(c.key), c);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function i(o, a, u) {
|
|
325
|
-
return a && s(o.prototype, a), u && s(o, u), Object.defineProperty(o, "prototype", {
|
|
326
|
-
writable: !1
|
|
327
|
-
}), o;
|
|
328
|
-
}
|
|
329
|
-
function l(o, a) {
|
|
330
|
-
var u = typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
|
|
331
|
-
if (!u) {
|
|
332
|
-
if (Array.isArray(o) || (u = Y(o)) || a) {
|
|
333
|
-
u && (o = u);
|
|
334
|
-
var c = 0, E = function() {
|
|
335
|
-
};
|
|
336
|
-
return {
|
|
337
|
-
s: E,
|
|
338
|
-
n: function() {
|
|
339
|
-
return c >= o.length ? {
|
|
340
|
-
done: !0
|
|
341
|
-
} : {
|
|
342
|
-
done: !1,
|
|
343
|
-
value: o[c++]
|
|
344
|
-
};
|
|
345
|
-
},
|
|
346
|
-
e: function(f) {
|
|
347
|
-
throw f;
|
|
348
|
-
},
|
|
349
|
-
f: E
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
353
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
354
|
-
}
|
|
355
|
-
var h, T = !0, b = !1;
|
|
356
|
-
return {
|
|
357
|
-
s: function() {
|
|
358
|
-
u = u.call(o);
|
|
359
|
-
},
|
|
360
|
-
n: function() {
|
|
361
|
-
var f = u.next();
|
|
362
|
-
return T = f.done, f;
|
|
363
|
-
},
|
|
364
|
-
e: function(f) {
|
|
365
|
-
b = !0, h = f;
|
|
366
|
-
},
|
|
367
|
-
f: function() {
|
|
368
|
-
try {
|
|
369
|
-
T || u.return == null || u.return();
|
|
370
|
-
} finally {
|
|
371
|
-
if (b) throw h;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function v() {
|
|
377
|
-
return v = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(o, a, u) {
|
|
378
|
-
var c = M(o, a);
|
|
379
|
-
if (c) {
|
|
380
|
-
var E = Object.getOwnPropertyDescriptor(c, a);
|
|
381
|
-
return E.get ? E.get.call(arguments.length < 3 ? o : u) : E.value;
|
|
382
|
-
}
|
|
383
|
-
}, v.apply(null, arguments);
|
|
384
|
-
}
|
|
385
|
-
function R(o) {
|
|
386
|
-
return R = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(a) {
|
|
387
|
-
return a.__proto__ || Object.getPrototypeOf(a);
|
|
388
|
-
}, R(o);
|
|
389
|
-
}
|
|
390
|
-
function d(o, a) {
|
|
391
|
-
if (typeof a != "function" && a !== null) throw new TypeError("Super expression must either be null or a function");
|
|
392
|
-
o.prototype = Object.create(a && a.prototype, {
|
|
393
|
-
constructor: {
|
|
394
|
-
value: o,
|
|
395
|
-
writable: !0,
|
|
396
|
-
configurable: !0
|
|
397
|
-
}
|
|
398
|
-
}), Object.defineProperty(o, "prototype", {
|
|
399
|
-
writable: !1
|
|
400
|
-
}), a && S(o, a);
|
|
401
|
-
}
|
|
402
|
-
function g() {
|
|
403
|
-
try {
|
|
404
|
-
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
405
|
-
}));
|
|
406
|
-
} catch {
|
|
407
|
-
}
|
|
408
|
-
return (g = function() {
|
|
409
|
-
return !!o;
|
|
410
|
-
})();
|
|
411
|
-
}
|
|
412
|
-
function H(o, a) {
|
|
413
|
-
if (a && (typeof a == "object" || typeof a == "function")) return a;
|
|
414
|
-
if (a !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
415
|
-
return t(o);
|
|
416
|
-
}
|
|
417
|
-
function S(o, a) {
|
|
418
|
-
return S = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(u, c) {
|
|
419
|
-
return u.__proto__ = c, u;
|
|
420
|
-
}, S(o, a);
|
|
421
|
-
}
|
|
422
|
-
function M(o, a) {
|
|
423
|
-
for (; !{}.hasOwnProperty.call(o, a) && (o = R(o)) !== null; ) ;
|
|
424
|
-
return o;
|
|
425
|
-
}
|
|
426
|
-
function J(o, a, u, c) {
|
|
427
|
-
var E = v(R(o.prototype), a, u);
|
|
428
|
-
return typeof E == "function" ? function(h) {
|
|
429
|
-
return E.apply(u, h);
|
|
430
|
-
} : E;
|
|
431
|
-
}
|
|
432
|
-
function G(o, a) {
|
|
433
|
-
if (typeof o != "object" || !o) return o;
|
|
434
|
-
var u = o[Symbol.toPrimitive];
|
|
435
|
-
if (u !== void 0) {
|
|
436
|
-
var c = u.call(o, a);
|
|
437
|
-
if (typeof c != "object") return c;
|
|
438
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
439
|
-
}
|
|
440
|
-
return String(o);
|
|
441
|
-
}
|
|
442
|
-
function Z(o) {
|
|
443
|
-
var a = G(o, "string");
|
|
444
|
-
return typeof a == "symbol" ? a : a + "";
|
|
445
|
-
}
|
|
446
|
-
function Y(o, a) {
|
|
447
|
-
if (o) {
|
|
448
|
-
if (typeof o == "string") return e(o, a);
|
|
449
|
-
var u = {}.toString.call(o).slice(8, -1);
|
|
450
|
-
return u === "Object" && o.constructor && (u = o.constructor.name), u === "Map" || u === "Set" ? Array.from(o) : u === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u) ? e(o, a) : void 0;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
function ee(o) {
|
|
454
|
-
var a;
|
|
455
|
-
try {
|
|
456
|
-
a = new Event("abort");
|
|
457
|
-
} catch {
|
|
458
|
-
typeof document < "u" ? document.createEvent ? (a = document.createEvent("Event"), a.initEvent("abort", !1, !1)) : (a = document.createEventObject(), a.type = "abort") : a = {
|
|
459
|
-
type: "abort",
|
|
460
|
-
bubbles: !1,
|
|
461
|
-
cancelable: !1
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
return a.reason = o, a;
|
|
465
|
-
}
|
|
466
|
-
function te(o) {
|
|
467
|
-
if (o === void 0)
|
|
468
|
-
if (typeof document > "u")
|
|
469
|
-
o = new Error("This operation was aborted"), o.name = "AbortError";
|
|
470
|
-
else
|
|
471
|
-
try {
|
|
472
|
-
o = new DOMException("signal is aborted without reason"), Object.defineProperty(o, "name", {
|
|
473
|
-
value: "AbortError"
|
|
474
|
-
});
|
|
475
|
-
} catch {
|
|
476
|
-
o = new Error("This operation was aborted"), o.name = "AbortError";
|
|
477
|
-
}
|
|
478
|
-
return o;
|
|
479
|
-
}
|
|
480
|
-
var K = /* @__PURE__ */ function() {
|
|
481
|
-
function o() {
|
|
482
|
-
n(this, o), Object.defineProperty(this, "listeners", {
|
|
483
|
-
value: {},
|
|
484
|
-
writable: !0,
|
|
485
|
-
configurable: !0
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
return i(o, [{
|
|
489
|
-
key: "addEventListener",
|
|
490
|
-
value: function(u, c, E) {
|
|
491
|
-
u in this.listeners || (this.listeners[u] = []), this.listeners[u].push({
|
|
492
|
-
callback: c,
|
|
493
|
-
options: E
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
}, {
|
|
497
|
-
key: "removeEventListener",
|
|
498
|
-
value: function(u, c) {
|
|
499
|
-
if (u in this.listeners) {
|
|
500
|
-
for (var E = this.listeners[u], h = 0, T = E.length; h < T; h++)
|
|
501
|
-
if (E[h].callback === c) {
|
|
502
|
-
E.splice(h, 1);
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}, {
|
|
508
|
-
key: "dispatchEvent",
|
|
509
|
-
value: function(u) {
|
|
510
|
-
var c = this;
|
|
511
|
-
if (u.type in this.listeners) {
|
|
512
|
-
for (var E = this.listeners[u.type], h = E.slice(), T = function() {
|
|
513
|
-
var O = h[b];
|
|
514
|
-
try {
|
|
515
|
-
O.callback.call(c, u);
|
|
516
|
-
} catch (z) {
|
|
517
|
-
Promise.resolve().then(function() {
|
|
518
|
-
throw z;
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
O.options && O.options.once && c.removeEventListener(u.type, O.callback);
|
|
522
|
-
}, b = 0, f = h.length; b < f; b++)
|
|
523
|
-
T();
|
|
524
|
-
return !u.defaultPrevented;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}]);
|
|
528
|
-
}(), x = /* @__PURE__ */ function(o) {
|
|
529
|
-
function a() {
|
|
530
|
-
var u;
|
|
531
|
-
return n(this, a), u = r(this, a), u.listeners || K.call(u), Object.defineProperty(u, "aborted", {
|
|
532
|
-
value: !1,
|
|
533
|
-
writable: !0,
|
|
534
|
-
configurable: !0
|
|
535
|
-
}), Object.defineProperty(u, "onabort", {
|
|
536
|
-
value: null,
|
|
537
|
-
writable: !0,
|
|
538
|
-
configurable: !0
|
|
539
|
-
}), Object.defineProperty(u, "reason", {
|
|
540
|
-
value: void 0,
|
|
541
|
-
writable: !0,
|
|
542
|
-
configurable: !0
|
|
543
|
-
}), u;
|
|
544
|
-
}
|
|
545
|
-
return d(a, o), i(a, [{
|
|
546
|
-
key: "toString",
|
|
547
|
-
value: function() {
|
|
548
|
-
return "[object AbortSignal]";
|
|
549
|
-
}
|
|
550
|
-
}, {
|
|
551
|
-
key: "dispatchEvent",
|
|
552
|
-
value: function(c) {
|
|
553
|
-
c.type === "abort" && (this.aborted = !0, typeof this.onabort == "function" && this.onabort.call(this, c)), J(a, "dispatchEvent", this)([c]);
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal/throwIfAborted}
|
|
557
|
-
*/
|
|
558
|
-
}, {
|
|
559
|
-
key: "throwIfAborted",
|
|
560
|
-
value: function() {
|
|
561
|
-
var c = this.aborted, E = this.reason, h = E === void 0 ? "Aborted" : E;
|
|
562
|
-
if (c)
|
|
563
|
-
throw h;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal/timeout_static}
|
|
567
|
-
* @param {number} time The "active" time in milliseconds before the returned {@link AbortSignal} will abort.
|
|
568
|
-
* The value must be within range of 0 and {@link Number.MAX_SAFE_INTEGER}.
|
|
569
|
-
* @returns {AbortSignal} The signal will abort with its {@link AbortSignal.reason} property set to a `TimeoutError` {@link DOMException} on timeout,
|
|
570
|
-
* or an `AbortError` {@link DOMException} if the operation was user-triggered.
|
|
571
|
-
*/
|
|
572
|
-
}], [{
|
|
573
|
-
key: "timeout",
|
|
574
|
-
value: function(c) {
|
|
575
|
-
var E = new C();
|
|
576
|
-
return setTimeout(function() {
|
|
577
|
-
return E.abort(new DOMException("This signal is timeout in ".concat(c, "ms"), "TimeoutError"));
|
|
578
|
-
}, c), E.signal;
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static}
|
|
582
|
-
* @param {Iterable<AbortSignal>} iterable An {@link Iterable} (such as an {@link Array}) of abort signals.
|
|
583
|
-
* @returns {AbortSignal} - **Already aborted**, if any of the abort signals given is already aborted.
|
|
584
|
-
* The returned {@link AbortSignal}'s reason will be already set to the `reason` of the first abort signal that was already aborted.
|
|
585
|
-
* - **Asynchronously aborted**, when any abort signal in `iterable` aborts.
|
|
586
|
-
* The `reason` will be set to the reason of the first abort signal that is aborted.
|
|
587
|
-
*/
|
|
588
|
-
}, {
|
|
589
|
-
key: "any",
|
|
590
|
-
value: function(c) {
|
|
591
|
-
var E = new C();
|
|
592
|
-
function h() {
|
|
593
|
-
E.abort(this.reason), T();
|
|
594
|
-
}
|
|
595
|
-
function T() {
|
|
596
|
-
var O = l(c), z;
|
|
597
|
-
try {
|
|
598
|
-
for (O.s(); !(z = O.n()).done; ) {
|
|
599
|
-
var Te = z.value;
|
|
600
|
-
Te.removeEventListener("abort", h);
|
|
601
|
-
}
|
|
602
|
-
} catch (we) {
|
|
603
|
-
O.e(we);
|
|
604
|
-
} finally {
|
|
605
|
-
O.f();
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
var b = l(c), f;
|
|
609
|
-
try {
|
|
610
|
-
for (b.s(); !(f = b.n()).done; ) {
|
|
611
|
-
var Q = f.value;
|
|
612
|
-
if (Q.aborted) {
|
|
613
|
-
E.abort(Q.reason);
|
|
614
|
-
break;
|
|
615
|
-
} else Q.addEventListener("abort", h);
|
|
616
|
-
}
|
|
617
|
-
} catch (O) {
|
|
618
|
-
b.e(O);
|
|
619
|
-
} finally {
|
|
620
|
-
b.f();
|
|
621
|
-
}
|
|
622
|
-
return E.signal;
|
|
623
|
-
}
|
|
624
|
-
}]);
|
|
625
|
-
}(K), C = /* @__PURE__ */ function() {
|
|
626
|
-
function o() {
|
|
627
|
-
n(this, o), Object.defineProperty(this, "signal", {
|
|
628
|
-
value: new x(),
|
|
629
|
-
writable: !0,
|
|
630
|
-
configurable: !0
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
return i(o, [{
|
|
634
|
-
key: "abort",
|
|
635
|
-
value: function(u) {
|
|
636
|
-
var c = te(u), E = ee(c);
|
|
637
|
-
this.signal.reason = c, this.signal.dispatchEvent(E);
|
|
638
|
-
}
|
|
639
|
-
}, {
|
|
640
|
-
key: "toString",
|
|
641
|
-
value: function() {
|
|
642
|
-
return "[object AbortController]";
|
|
643
|
-
}
|
|
644
|
-
}]);
|
|
645
|
-
}();
|
|
646
|
-
typeof Symbol < "u" && Symbol.toStringTag && (C.prototype[Symbol.toStringTag] = "AbortController", x.prototype[Symbol.toStringTag] = "AbortSignal");
|
|
647
|
-
function w(o) {
|
|
648
|
-
return o.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL ? (console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"), !0) : typeof o.Request == "function" && !o.Request.prototype.hasOwnProperty("signal") || !o.AbortController;
|
|
649
|
-
}
|
|
650
|
-
(function(o) {
|
|
651
|
-
w(o) && (o.AbortController = C, o.AbortSignal = x);
|
|
652
|
-
})(typeof self < "u" ? self : Fe);
|
|
653
|
-
})), fe;
|
|
654
|
-
}
|
|
655
|
-
Me();
|
|
656
|
-
var A = typeof globalThis < "u" && globalThis || typeof self < "u" && self || // eslint-disable-next-line no-undef
|
|
657
|
-
typeof global < "u" && global || {}, m = {
|
|
658
|
-
searchParams: "URLSearchParams" in A,
|
|
659
|
-
iterable: "Symbol" in A && "iterator" in Symbol,
|
|
660
|
-
blob: "FileReader" in A && "Blob" in A && function() {
|
|
661
|
-
try {
|
|
662
|
-
return new Blob(), !0;
|
|
663
|
-
} catch {
|
|
664
|
-
return !1;
|
|
665
|
-
}
|
|
666
|
-
}(),
|
|
667
|
-
formData: "FormData" in A,
|
|
668
|
-
arrayBuffer: "ArrayBuffer" in A
|
|
669
|
-
};
|
|
670
|
-
function Ge(e) {
|
|
671
|
-
return e && DataView.prototype.isPrototypeOf(e);
|
|
672
|
-
}
|
|
673
|
-
if (m.arrayBuffer)
|
|
674
|
-
var Ye = [
|
|
675
|
-
"[object Int8Array]",
|
|
676
|
-
"[object Uint8Array]",
|
|
677
|
-
"[object Uint8ClampedArray]",
|
|
678
|
-
"[object Int16Array]",
|
|
679
|
-
"[object Uint16Array]",
|
|
680
|
-
"[object Int32Array]",
|
|
681
|
-
"[object Uint32Array]",
|
|
682
|
-
"[object Float32Array]",
|
|
683
|
-
"[object Float64Array]"
|
|
684
|
-
], Ke = ArrayBuffer.isView || function(e) {
|
|
685
|
-
return e && Ye.indexOf(Object.prototype.toString.call(e)) > -1;
|
|
686
|
-
};
|
|
687
|
-
function j(e) {
|
|
688
|
-
if (typeof e != "string" && (e = String(e)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e) || e === "")
|
|
689
|
-
throw new TypeError('Invalid character in header field name: "' + e + '"');
|
|
690
|
-
return e.toLowerCase();
|
|
691
|
-
}
|
|
692
|
-
function oe(e) {
|
|
693
|
-
return typeof e != "string" && (e = String(e)), e;
|
|
694
|
-
}
|
|
695
|
-
function ie(e) {
|
|
696
|
-
var t = {
|
|
697
|
-
next: function() {
|
|
698
|
-
var r = e.shift();
|
|
699
|
-
return { done: r === void 0, value: r };
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
return m.iterable && (t[Symbol.iterator] = function() {
|
|
703
|
-
return t;
|
|
704
|
-
}), t;
|
|
705
|
-
}
|
|
706
|
-
function _(e) {
|
|
707
|
-
this.map = {}, e instanceof _ ? e.forEach(function(t, r) {
|
|
708
|
-
this.append(r, t);
|
|
709
|
-
}, this) : Array.isArray(e) ? e.forEach(function(t) {
|
|
710
|
-
if (t.length != 2)
|
|
711
|
-
throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + t.length);
|
|
712
|
-
this.append(t[0], t[1]);
|
|
713
|
-
}, this) : e && Object.getOwnPropertyNames(e).forEach(function(t) {
|
|
714
|
-
this.append(t, e[t]);
|
|
715
|
-
}, this);
|
|
716
|
-
}
|
|
717
|
-
_.prototype.append = function(e, t) {
|
|
718
|
-
e = j(e), t = oe(t);
|
|
719
|
-
var r = this.map[e];
|
|
720
|
-
this.map[e] = r ? r + ", " + t : t;
|
|
721
|
-
};
|
|
722
|
-
_.prototype.delete = function(e) {
|
|
723
|
-
delete this.map[j(e)];
|
|
724
|
-
};
|
|
725
|
-
_.prototype.get = function(e) {
|
|
726
|
-
return e = j(e), this.has(e) ? this.map[e] : null;
|
|
727
|
-
};
|
|
728
|
-
_.prototype.has = function(e) {
|
|
729
|
-
return this.map.hasOwnProperty(j(e));
|
|
730
|
-
};
|
|
731
|
-
_.prototype.set = function(e, t) {
|
|
732
|
-
this.map[j(e)] = oe(t);
|
|
733
|
-
};
|
|
734
|
-
_.prototype.forEach = function(e, t) {
|
|
735
|
-
for (var r in this.map)
|
|
736
|
-
this.map.hasOwnProperty(r) && e.call(t, this.map[r], r, this);
|
|
737
|
-
};
|
|
738
|
-
_.prototype.keys = function() {
|
|
739
|
-
var e = [];
|
|
740
|
-
return this.forEach(function(t, r) {
|
|
741
|
-
e.push(r);
|
|
742
|
-
}), ie(e);
|
|
743
|
-
};
|
|
744
|
-
_.prototype.values = function() {
|
|
745
|
-
var e = [];
|
|
746
|
-
return this.forEach(function(t) {
|
|
747
|
-
e.push(t);
|
|
748
|
-
}), ie(e);
|
|
749
|
-
};
|
|
750
|
-
_.prototype.entries = function() {
|
|
751
|
-
var e = [];
|
|
752
|
-
return this.forEach(function(t, r) {
|
|
753
|
-
e.push([r, t]);
|
|
754
|
-
}), ie(e);
|
|
755
|
-
};
|
|
756
|
-
m.iterable && (_.prototype[Symbol.iterator] = _.prototype.entries);
|
|
757
|
-
function re(e) {
|
|
758
|
-
if (!e._noBody) {
|
|
759
|
-
if (e.bodyUsed)
|
|
760
|
-
return Promise.reject(new TypeError("Already read"));
|
|
761
|
-
e.bodyUsed = !0;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
function Re(e) {
|
|
765
|
-
return new Promise(function(t, r) {
|
|
766
|
-
e.onload = function() {
|
|
767
|
-
t(e.result);
|
|
768
|
-
}, e.onerror = function() {
|
|
769
|
-
r(e.error);
|
|
770
|
-
};
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
function Qe(e) {
|
|
774
|
-
var t = new FileReader(), r = Re(t);
|
|
775
|
-
return t.readAsArrayBuffer(e), r;
|
|
776
|
-
}
|
|
777
|
-
function ze(e) {
|
|
778
|
-
var t = new FileReader(), r = Re(t), n = /charset=([A-Za-z0-9_-]+)/.exec(e.type), s = n ? n[1] : "utf-8";
|
|
779
|
-
return t.readAsText(e, s), r;
|
|
780
|
-
}
|
|
781
|
-
function $e(e) {
|
|
782
|
-
for (var t = new Uint8Array(e), r = new Array(t.length), n = 0; n < t.length; n++)
|
|
783
|
-
r[n] = String.fromCharCode(t[n]);
|
|
784
|
-
return r.join("");
|
|
785
|
-
}
|
|
786
|
-
function ye(e) {
|
|
787
|
-
if (e.slice)
|
|
788
|
-
return e.slice(0);
|
|
789
|
-
var t = new Uint8Array(e.byteLength);
|
|
790
|
-
return t.set(new Uint8Array(e)), t.buffer;
|
|
791
|
-
}
|
|
792
|
-
function ge() {
|
|
793
|
-
return this.bodyUsed = !1, this._initBody = function(e) {
|
|
794
|
-
this.bodyUsed = this.bodyUsed, this._bodyInit = e, e ? typeof e == "string" ? this._bodyText = e : m.blob && Blob.prototype.isPrototypeOf(e) ? this._bodyBlob = e : m.formData && FormData.prototype.isPrototypeOf(e) ? this._bodyFormData = e : m.searchParams && URLSearchParams.prototype.isPrototypeOf(e) ? this._bodyText = e.toString() : m.arrayBuffer && m.blob && Ge(e) ? (this._bodyArrayBuffer = ye(e.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : m.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(e) || Ke(e)) ? this._bodyArrayBuffer = ye(e) : this._bodyText = e = Object.prototype.toString.call(e) : (this._noBody = !0, this._bodyText = ""), this.headers.get("content-type") || (typeof e == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : m.searchParams && URLSearchParams.prototype.isPrototypeOf(e) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
795
|
-
}, m.blob && (this.blob = function() {
|
|
796
|
-
var e = re(this);
|
|
797
|
-
if (e)
|
|
798
|
-
return e;
|
|
799
|
-
if (this._bodyBlob)
|
|
800
|
-
return Promise.resolve(this._bodyBlob);
|
|
801
|
-
if (this._bodyArrayBuffer)
|
|
802
|
-
return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
|
803
|
-
if (this._bodyFormData)
|
|
804
|
-
throw new Error("could not read FormData body as blob");
|
|
805
|
-
return Promise.resolve(new Blob([this._bodyText]));
|
|
806
|
-
}), this.arrayBuffer = function() {
|
|
807
|
-
if (this._bodyArrayBuffer) {
|
|
808
|
-
var e = re(this);
|
|
809
|
-
return e || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
|
|
810
|
-
this._bodyArrayBuffer.buffer.slice(
|
|
811
|
-
this._bodyArrayBuffer.byteOffset,
|
|
812
|
-
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
|
813
|
-
)
|
|
814
|
-
) : Promise.resolve(this._bodyArrayBuffer));
|
|
815
|
-
} else {
|
|
816
|
-
if (m.blob)
|
|
817
|
-
return this.blob().then(Qe);
|
|
818
|
-
throw new Error("could not read as ArrayBuffer");
|
|
819
|
-
}
|
|
820
|
-
}, this.text = function() {
|
|
821
|
-
var e = re(this);
|
|
822
|
-
if (e)
|
|
823
|
-
return e;
|
|
824
|
-
if (this._bodyBlob)
|
|
825
|
-
return ze(this._bodyBlob);
|
|
826
|
-
if (this._bodyArrayBuffer)
|
|
827
|
-
return Promise.resolve($e(this._bodyArrayBuffer));
|
|
828
|
-
if (this._bodyFormData)
|
|
829
|
-
throw new Error("could not read FormData body as text");
|
|
830
|
-
return Promise.resolve(this._bodyText);
|
|
831
|
-
}, m.formData && (this.formData = function() {
|
|
832
|
-
return this.text().then(Xe);
|
|
833
|
-
}), this.json = function() {
|
|
834
|
-
return this.text().then(JSON.parse);
|
|
835
|
-
}, this;
|
|
836
|
-
}
|
|
837
|
-
var We = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
838
|
-
function Ve(e) {
|
|
839
|
-
var t = e.toUpperCase();
|
|
840
|
-
return We.indexOf(t) > -1 ? t : e;
|
|
841
|
-
}
|
|
842
|
-
function L(e, t) {
|
|
843
|
-
if (!(this instanceof L))
|
|
844
|
-
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
845
|
-
t = t || {};
|
|
846
|
-
var r = t.body;
|
|
847
|
-
if (e instanceof L) {
|
|
848
|
-
if (e.bodyUsed)
|
|
849
|
-
throw new TypeError("Already read");
|
|
850
|
-
this.url = e.url, this.credentials = e.credentials, t.headers || (this.headers = new _(e.headers)), this.method = e.method, this.mode = e.mode, this.signal = e.signal, !r && e._bodyInit != null && (r = e._bodyInit, e.bodyUsed = !0);
|
|
851
|
-
} else
|
|
852
|
-
this.url = String(e);
|
|
853
|
-
if (this.credentials = t.credentials || this.credentials || "same-origin", (t.headers || !this.headers) && (this.headers = new _(t.headers)), this.method = Ve(t.method || this.method || "GET"), this.mode = t.mode || this.mode || null, this.signal = t.signal || this.signal || function() {
|
|
854
|
-
if ("AbortController" in A) {
|
|
855
|
-
var i = new AbortController();
|
|
856
|
-
return i.signal;
|
|
857
|
-
}
|
|
858
|
-
}(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && r)
|
|
859
|
-
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
860
|
-
if (this._initBody(r), (this.method === "GET" || this.method === "HEAD") && (t.cache === "no-store" || t.cache === "no-cache")) {
|
|
861
|
-
var n = /([?&])_=[^&]*/;
|
|
862
|
-
if (n.test(this.url))
|
|
863
|
-
this.url = this.url.replace(n, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
|
|
864
|
-
else {
|
|
865
|
-
var s = /\?/;
|
|
866
|
-
this.url += (s.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
L.prototype.clone = function() {
|
|
871
|
-
return new L(this, { body: this._bodyInit });
|
|
872
|
-
};
|
|
873
|
-
function Xe(e) {
|
|
874
|
-
var t = new FormData();
|
|
875
|
-
return e.trim().split("&").forEach(function(r) {
|
|
876
|
-
if (r) {
|
|
877
|
-
var n = r.split("="), s = n.shift().replace(/\+/g, " "), i = n.join("=").replace(/\+/g, " ");
|
|
878
|
-
t.append(decodeURIComponent(s), decodeURIComponent(i));
|
|
879
|
-
}
|
|
880
|
-
}), t;
|
|
881
|
-
}
|
|
882
|
-
function Je(e) {
|
|
883
|
-
var t = new _(), r = e.replace(/\r?\n[\t ]+/g, " ");
|
|
884
|
-
return r.split("\r").map(function(n) {
|
|
885
|
-
return n.indexOf(`
|
|
886
|
-
`) === 0 ? n.substr(1, n.length) : n;
|
|
887
|
-
}).forEach(function(n) {
|
|
888
|
-
var s = n.split(":"), i = s.shift().trim();
|
|
889
|
-
if (i) {
|
|
890
|
-
var l = s.join(":").trim();
|
|
891
|
-
try {
|
|
892
|
-
t.append(i, l);
|
|
893
|
-
} catch (v) {
|
|
894
|
-
console.warn("Response " + v.message);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
}), t;
|
|
898
|
-
}
|
|
899
|
-
ge.call(L.prototype);
|
|
900
|
-
function P(e, t) {
|
|
901
|
-
if (!(this instanceof P))
|
|
902
|
-
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
903
|
-
if (t || (t = {}), this.type = "default", this.status = t.status === void 0 ? 200 : t.status, this.status < 200 || this.status > 599)
|
|
904
|
-
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
|
|
905
|
-
this.ok = this.status >= 200 && this.status < 300, this.statusText = t.statusText === void 0 ? "" : "" + t.statusText, this.headers = new _(t.headers), this.url = t.url || "", this._initBody(e);
|
|
906
|
-
}
|
|
907
|
-
ge.call(P.prototype);
|
|
908
|
-
P.prototype.clone = function() {
|
|
909
|
-
return new P(this._bodyInit, {
|
|
910
|
-
status: this.status,
|
|
911
|
-
statusText: this.statusText,
|
|
912
|
-
headers: new _(this.headers),
|
|
913
|
-
url: this.url
|
|
914
|
-
});
|
|
915
|
-
};
|
|
916
|
-
P.error = function() {
|
|
917
|
-
var e = new P(null, { status: 200, statusText: "" });
|
|
918
|
-
return e.ok = !1, e.status = 0, e.type = "error", e;
|
|
919
|
-
};
|
|
920
|
-
var Ze = [301, 302, 303, 307, 308];
|
|
921
|
-
P.redirect = function(e, t) {
|
|
922
|
-
if (Ze.indexOf(t) === -1)
|
|
923
|
-
throw new RangeError("Invalid status code");
|
|
924
|
-
return new P(null, { status: t, headers: { location: e } });
|
|
925
|
-
};
|
|
926
|
-
var I = A.DOMException;
|
|
927
|
-
try {
|
|
928
|
-
new I();
|
|
929
|
-
} catch {
|
|
930
|
-
I = function(t, r) {
|
|
931
|
-
this.message = t, this.name = r;
|
|
932
|
-
var n = Error(t);
|
|
933
|
-
this.stack = n.stack;
|
|
934
|
-
}, I.prototype = Object.create(Error.prototype), I.prototype.constructor = I;
|
|
935
|
-
}
|
|
936
|
-
function se(e, t) {
|
|
937
|
-
return new Promise(function(r, n) {
|
|
938
|
-
var s = new L(e, t);
|
|
939
|
-
if (s.signal && s.signal.aborted)
|
|
940
|
-
return n(new I("Aborted", "AbortError"));
|
|
941
|
-
var i = new XMLHttpRequest();
|
|
942
|
-
function l() {
|
|
943
|
-
i.abort();
|
|
944
|
-
}
|
|
945
|
-
i.onload = function() {
|
|
946
|
-
var d = {
|
|
947
|
-
statusText: i.statusText,
|
|
948
|
-
headers: Je(i.getAllResponseHeaders() || "")
|
|
949
|
-
};
|
|
950
|
-
s.url.indexOf("file://") === 0 && (i.status < 200 || i.status > 599) ? d.status = 200 : d.status = i.status, d.url = "responseURL" in i ? i.responseURL : d.headers.get("X-Request-URL");
|
|
951
|
-
var g = "response" in i ? i.response : i.responseText;
|
|
952
|
-
setTimeout(function() {
|
|
953
|
-
r(new P(g, d));
|
|
954
|
-
}, 0);
|
|
955
|
-
}, i.onerror = function() {
|
|
956
|
-
setTimeout(function() {
|
|
957
|
-
n(new TypeError("Network request failed"));
|
|
958
|
-
}, 0);
|
|
959
|
-
}, i.ontimeout = function() {
|
|
960
|
-
setTimeout(function() {
|
|
961
|
-
n(new TypeError("Network request timed out"));
|
|
962
|
-
}, 0);
|
|
963
|
-
}, i.onabort = function() {
|
|
964
|
-
setTimeout(function() {
|
|
965
|
-
n(new I("Aborted", "AbortError"));
|
|
966
|
-
}, 0);
|
|
967
|
-
};
|
|
968
|
-
function v(d) {
|
|
969
|
-
try {
|
|
970
|
-
return d === "" && A.location.href ? A.location.href : d;
|
|
971
|
-
} catch {
|
|
972
|
-
return d;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
if (i.open(s.method, v(s.url), !0), s.credentials === "include" ? i.withCredentials = !0 : s.credentials === "omit" && (i.withCredentials = !1), "responseType" in i && (m.blob ? i.responseType = "blob" : m.arrayBuffer && (i.responseType = "arraybuffer")), t && typeof t.headers == "object" && !(t.headers instanceof _ || A.Headers && t.headers instanceof A.Headers)) {
|
|
976
|
-
var R = [];
|
|
977
|
-
Object.getOwnPropertyNames(t.headers).forEach(function(d) {
|
|
978
|
-
R.push(j(d)), i.setRequestHeader(d, oe(t.headers[d]));
|
|
979
|
-
}), s.headers.forEach(function(d, g) {
|
|
980
|
-
R.indexOf(g) === -1 && i.setRequestHeader(g, d);
|
|
981
|
-
});
|
|
982
|
-
} else
|
|
983
|
-
s.headers.forEach(function(d, g) {
|
|
984
|
-
i.setRequestHeader(g, d);
|
|
985
|
-
});
|
|
986
|
-
s.signal && (s.signal.addEventListener("abort", l), i.onreadystatechange = function() {
|
|
987
|
-
i.readyState === 4 && s.signal.removeEventListener("abort", l);
|
|
988
|
-
}), i.send(typeof s._bodyInit > "u" ? null : s._bodyInit);
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
se.polyfill = !0;
|
|
992
|
-
A.fetch || (A.fetch = se, A.Headers = _, A.Request = L, A.Response = P);
|
|
993
|
-
let k = {};
|
|
994
|
-
const et = typeof window < "u" ? "signal" in new Request("") ? window.fetch : se : fetch;
|
|
995
|
-
class ft {
|
|
996
|
-
constructor(t, r) {
|
|
997
|
-
this.send = (n) => async (s, i) => {
|
|
998
|
-
var a, u;
|
|
999
|
-
const {
|
|
1000
|
-
api: l,
|
|
1001
|
-
preUpdate: v,
|
|
1002
|
-
postUpdate: R,
|
|
1003
|
-
preError: d,
|
|
1004
|
-
postError: g,
|
|
1005
|
-
data: H,
|
|
1006
|
-
files: S,
|
|
1007
|
-
requestCancel: M = !0,
|
|
1008
|
-
updateStore: J = !0,
|
|
1009
|
-
fileKey: G = this.options.fileKey,
|
|
1010
|
-
primaryKey: Z = this.options.primaryKey,
|
|
1011
|
-
bodyKey: Y = this.options.bodyKey,
|
|
1012
|
-
method: ee = this.options.method,
|
|
1013
|
-
normalize: te = this.options.normalize,
|
|
1014
|
-
mergeListStrategy: K = this.options.mergeListStrategy,
|
|
1015
|
-
headers: x = this.options.headers,
|
|
1016
|
-
responseKeyCode: C = this.options.responseKeyCode
|
|
1017
|
-
} = $(this.requestObject, n), w = Math.random().toString(36).substr(2), o = /* @__PURE__ */ new Date();
|
|
1018
|
-
try {
|
|
1019
|
-
let c = JSON.stringify({ ...H, requestID: w });
|
|
1020
|
-
const E = new AbortController(), { signal: h } = E;
|
|
1021
|
-
if (s({
|
|
1022
|
-
type: y.CDEEBEE_REQUESTMANAGER_SET,
|
|
1023
|
-
payload: { requestID: w, api: l, controller: E, data: H, requestCancel: M, requestStartTime: o, requestEndTime: void 0 }
|
|
1024
|
-
}), S) {
|
|
1025
|
-
const b = new FormData();
|
|
1026
|
-
for (let f = 0; f < S.length; f += 1)
|
|
1027
|
-
G && b.append(G, S[f]);
|
|
1028
|
-
Y && b.append(Y, c), c = b;
|
|
1029
|
-
}
|
|
1030
|
-
const T = await (await et(l, {
|
|
1031
|
-
method: ee,
|
|
1032
|
-
signal: h,
|
|
1033
|
-
headers: { "ui-request-id": w, ...x },
|
|
1034
|
-
body: c
|
|
1035
|
-
})).json();
|
|
1036
|
-
if (T)
|
|
1037
|
-
for (k = Object.assign(
|
|
1038
|
-
{
|
|
1039
|
-
[w]: {
|
|
1040
|
-
requestID: w,
|
|
1041
|
-
response: T,
|
|
1042
|
-
requestApi: l,
|
|
1043
|
-
requestStartTime: o,
|
|
1044
|
-
preUpdate: v,
|
|
1045
|
-
postUpdate: R,
|
|
1046
|
-
normalize: te,
|
|
1047
|
-
preError: d,
|
|
1048
|
-
postError: g,
|
|
1049
|
-
mergeListStrategy: K,
|
|
1050
|
-
updateStore: J,
|
|
1051
|
-
data: H,
|
|
1052
|
-
requestCancel: M,
|
|
1053
|
-
controller: E
|
|
1054
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
k
|
|
1057
|
-
); k[(u = (a = i().requestManager.activeRequest) == null ? void 0 : a[0]) == null ? void 0 : u.requestID]; ) {
|
|
1058
|
-
const b = i().requestManager.activeRequest[0].requestID, f = k[b];
|
|
1059
|
-
C && f.response[C] === 0 ? (f.preUpdate && f.preUpdate(f.response), f.updateStore && s({
|
|
1060
|
-
type: y.CDEEBEEE_UPDATE,
|
|
1061
|
-
payload: {
|
|
1062
|
-
response: f.normalize instanceof Function && f.normalize({
|
|
1063
|
-
response: f.response,
|
|
1064
|
-
cdeebee: i().cdeebee,
|
|
1065
|
-
mergeListStrategy: f.mergeListStrategy,
|
|
1066
|
-
primaryKey: Z
|
|
1067
|
-
}),
|
|
1068
|
-
cleanResponse: f.response,
|
|
1069
|
-
api: f.requestApi,
|
|
1070
|
-
mergeListStrategy: f.mergeListStrategy
|
|
1071
|
-
}
|
|
1072
|
-
}), f.postUpdate && f.postUpdate(f.response)) : (f.preError && f.preError(f.response), s({
|
|
1073
|
-
type: y.CDEEBEE_ERRORHANDLER_SET,
|
|
1074
|
-
payload: { api: f.requestApi, cleanResponse: f.response }
|
|
1075
|
-
}), f.postError && f.postError(T)), s({
|
|
1076
|
-
type: y.CDEEBEE_REQUESTMANAGER_SHIFT,
|
|
1077
|
-
payload: {
|
|
1078
|
-
requestID: f.requestID,
|
|
1079
|
-
api: f.requestApi,
|
|
1080
|
-
controller: f.controller,
|
|
1081
|
-
data: f.data,
|
|
1082
|
-
requestCancel: f.requestCancel,
|
|
1083
|
-
requestStartTime: f.requestStartTime,
|
|
1084
|
-
requestEndTime: /* @__PURE__ */ new Date()
|
|
1085
|
-
}
|
|
1086
|
-
}), delete k[b];
|
|
1087
|
-
}
|
|
1088
|
-
} catch (c) {
|
|
1089
|
-
if (c.name === "AbortError")
|
|
1090
|
-
s({ type: y.CDEEBEE_REQUEST_ABORTED, payload: { requestID: w, api: l } });
|
|
1091
|
-
else {
|
|
1092
|
-
const E = /* @__PURE__ */ new Date();
|
|
1093
|
-
s({
|
|
1094
|
-
type: y.CDEEBEE_INTERNAL_ERROR,
|
|
1095
|
-
payload: { requestStartTime: o, requestEndTime: E, requestID: w, api: l }
|
|
1096
|
-
}), console.warn("@@makeRequest-error", c), console.warn("@@makeRequest-object", $(this.requestObject, n)), console.warn("@@makeRequest-info", { requestStartTime: o, requestEndTime: E, requestID: w }), Object.prototype.hasOwnProperty.call(this.options, "globalErrorHandler") && this.options.globalErrorHandler instanceof Function && this.options.globalErrorHandler(
|
|
1097
|
-
c,
|
|
1098
|
-
$(this.requestObject, n),
|
|
1099
|
-
{ requestStartTime: o, requestEndTime: E, requestID: w }
|
|
1100
|
-
)(s, i);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
}, this.requestObject = t, this.options = {
|
|
1104
|
-
fileKey: "files",
|
|
1105
|
-
bodyKey: "body",
|
|
1106
|
-
method: "POST",
|
|
1107
|
-
normalize: me,
|
|
1108
|
-
responseKeyCode: "responseStatus",
|
|
1109
|
-
headers: { "content-type": "application/json" },
|
|
1110
|
-
...r
|
|
1111
|
-
};
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
function tt(e, t, r) {
|
|
1115
|
-
return (n) => {
|
|
1116
|
-
n({
|
|
1117
|
-
type: y.CDEEBEE_ENTITY_UNSAFE_UPDATE_STORE,
|
|
1118
|
-
payload: { entityList: e, entityID: t, value: r }
|
|
1119
|
-
});
|
|
1120
|
-
};
|
|
1121
|
-
}
|
|
1122
|
-
function rt(e, t, r) {
|
|
1123
|
-
return (n) => {
|
|
1124
|
-
n({
|
|
1125
|
-
type: y.CDEEBEE_ENTITY_CHANGE_FIELD,
|
|
1126
|
-
payload: { entityList: e, entityID: t, valueList: r }
|
|
1127
|
-
});
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
function nt(e, t, r) {
|
|
1131
|
-
return (n) => {
|
|
1132
|
-
n({
|
|
1133
|
-
type: y.CDEEBEE_SET_ENTITY,
|
|
1134
|
-
payload: { entityList: e, entityID: t, entity: r }
|
|
1135
|
-
});
|
|
1136
|
-
};
|
|
1137
|
-
}
|
|
1138
|
-
function ot(e, t) {
|
|
1139
|
-
return (r) => {
|
|
1140
|
-
r({
|
|
1141
|
-
type: y.CDEEBEE_RESET_ENTITY,
|
|
1142
|
-
payload: { entityList: e, entityID: t }
|
|
1143
|
-
});
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
function it(e) {
|
|
1147
|
-
return (t) => t({ type: y.CDEEBEEE_DROP_PATH, payload: { path: e } });
|
|
1148
|
-
}
|
|
1149
|
-
function st(e) {
|
|
1150
|
-
return (t) => t({ type: y.CDEEBEEE_DROP_REQUEST_BY_API_URL, payload: { api: e } });
|
|
1151
|
-
}
|
|
1152
|
-
function at(e) {
|
|
1153
|
-
return (t) => t({ type: y.CDEEBEEE_DROP_ERROR_BY_API_URL, payload: { api: e } });
|
|
1154
|
-
}
|
|
1155
|
-
const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1156
|
-
__proto__: null,
|
|
1157
|
-
commitEntity: nt,
|
|
1158
|
-
dropCdeebeePath: it,
|
|
1159
|
-
dropErrorsByApiUrl: at,
|
|
1160
|
-
dropRequestByApiUrl: st,
|
|
1161
|
-
resetEntity: ot,
|
|
1162
|
-
setKeyValue: rt,
|
|
1163
|
-
unsafe_updateStore: tt
|
|
1164
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1165
|
-
export {
|
|
1166
|
-
ft as CdeebeeRequest,
|
|
1167
|
-
ct as cdeebee,
|
|
1168
|
-
Et as cdeebeeActions,
|
|
1169
|
-
U as cdeebeeEntityState,
|
|
1170
|
-
ut as cdeebeeHelpers,
|
|
1171
|
-
pe as cdeebeeMergeStrategy,
|
|
1172
|
-
y as cdeebeeTypes,
|
|
1173
|
-
lt as requestManager
|
|
1174
|
-
};
|