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