@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 CHANGED
@@ -1,9 +1,9 @@
1
- function p(e) {
1
+ function d(e) {
2
2
  return e != null && typeof e == "object" && e["@@functional/placeholder"] === !0;
3
3
  }
4
- function B(e) {
4
+ function P(e) {
5
5
  return function t(r) {
6
- return arguments.length === 0 || p(r) ? t : e.apply(this, arguments);
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 p(r) ? t : B(function(s) {
15
+ return d(r) ? t : P(function(s) {
16
16
  return e(r, s);
17
17
  });
18
18
  default:
19
- return p(r) && p(n) ? t : p(r) ? B(function(s) {
19
+ return d(r) && d(n) ? t : d(r) ? P(function(s) {
20
20
  return e(s, n);
21
- }) : p(n) ? B(function(s) {
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 q(e) {
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 p(r) ? t : D(function(i, l) {
33
+ return d(r) ? t : D(function(i, l) {
34
34
  return e(r, i, l);
35
35
  });
36
36
  case 2:
37
- return p(r) && p(n) ? t : p(r) ? D(function(i, l) {
37
+ return d(r) && d(n) ? t : d(r) ? D(function(i, l) {
38
38
  return e(i, n, l);
39
- }) : p(n) ? D(function(i, l) {
39
+ }) : d(n) ? D(function(i, l) {
40
40
  return e(r, i, l);
41
- }) : B(function(i) {
41
+ }) : P(function(i) {
42
42
  return e(r, n, i);
43
43
  });
44
44
  default:
45
- return p(r) && p(n) && p(s) ? t : p(r) && p(n) ? D(function(i, l) {
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
- }) : p(r) && p(s) ? D(function(i, l) {
47
+ }) : d(r) && d(s) ? D(function(i, l) {
48
48
  return e(i, n, l);
49
- }) : p(n) && p(s) ? D(function(i, l) {
49
+ }) : d(n) && d(s) ? D(function(i, l) {
50
50
  return e(r, i, l);
51
- }) : p(r) ? B(function(i) {
51
+ }) : d(r) ? P(function(i) {
52
52
  return e(i, n, s);
53
- }) : p(n) ? B(function(i) {
53
+ }) : d(n) ? P(function(i) {
54
54
  return e(r, i, s);
55
- }) : p(s) ? B(function(i) {
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 W = Array.isArray || function(t) {
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 F(e, t) {
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 V = Number.isInteger || function(t) {
70
+ const W = Number.isInteger || function(t) {
71
71
  return t << 0 === t;
72
72
  };
73
73
  function Oe(e, t, r) {
74
- if (V(e) && W(r)) {
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__ */ B(function(t) {
83
+ var De = /* @__PURE__ */ P(function(t) {
84
84
  return t == null;
85
- }), N = /* @__PURE__ */ q(function e(t, r, n) {
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) && F(s, n) && typeof n[s] == "object" ? n[s] : V(t[1]) ? [] : {};
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
- }), Pe = /* @__PURE__ */ q(function(t, r, n) {
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 Ie(e, t) {
100
+ function Se(e, t) {
113
101
  if (t == null)
114
102
  return t;
115
- if (V(e) && W(t))
116
- return Ce(e, 1, t);
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 Ne(e, t) {
123
- if (V(e) && W(t))
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 Ue = /* @__PURE__ */ D(function e(t, r) {
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 Ie(t[0], r);
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 ? Ne(n, r) : Pe(n, e(s, r[n]), r);
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 Ue([t], r);
144
- }), Le = /* @__PURE__ */ q(function(t, r, n) {
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
- F(i, r) && (s[i] = F(i, n) ? t(i, r[i], n[i]) : r[i]);
136
+ k(i, r) && (s[i] = k(i, n) ? t(i, r[i], n[i]) : r[i]);
149
137
  for (i in n)
150
- F(i, n) && !F(i, s) && (s[i] = n[i]);
138
+ k(i, n) && !k(i, s) && (s[i] = n[i]);
151
139
  return s;
152
- }), qe = /* @__PURE__ */ q(function e(t, r, n) {
153
- return Le(function(s, i, l) {
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 qe(function(n, s, i) {
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 || {}), 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) => {
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
- }, je = (e, t) => {
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
- }, He = (e) => Object.prototype.hasOwnProperty.call(e, "__entity") ? e.__entity : e, X = (e) => {
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
- }, 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) => {
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 (X(n[r]) === U.EDITING)
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
- }, me = ({
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 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);
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
- }, ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
200
+ }, st = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
213
201
  __proto__: null,
214
202
  batchingUpdate: Ae,
215
- checkNetworkActivity: je,
216
- commitEntity: ke,
217
- defaultNormalize: me,
203
+ checkNetworkActivity: Le,
204
+ commitEntity: He,
205
+ defaultNormalize: Re,
218
206
  dropRequestFromArray: he,
219
207
  editEntity: ve,
220
- getEntityState: X,
221
- getSubEntity: He,
222
- insertEntity: xe,
208
+ getEntityState: V,
209
+ getSubEntity: qe,
210
+ insertEntity: je,
223
211
  requestCancel: _e,
224
212
  resetEntity: be
225
- }, Symbol.toStringTag, { value: "Module" })), ce = {}, ct = (e = ce, t) => {
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
- }, lt = (e = le, t) => {
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
- return { ...e, activeRequest: Se(1, 1 / 0, e.activeRequest) };
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 Fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, fe = {}, Ee;
299
- function Me() {
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 = R(a), H(o, g() ? Reflect.construct(a, [], R(o).constructor) : a.apply(o, u));
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, Z(c.key), c);
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, T = !0, b = !1;
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 T = f.done, f;
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
- T || u.return == null || u.return();
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 R(o) {
386
- return R = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(a) {
374
+ function m(o) {
375
+ return m = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(a) {
387
376
  return a.__proto__ || Object.getPrototypeOf(a);
388
- }, R(o);
377
+ }, m(o);
389
378
  }
390
- function d(o, a) {
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 g() {
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 (g = function() {
397
+ return (T = function() {
409
398
  return !!o;
410
399
  })();
411
400
  }
412
- function H(o, a) {
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 = R(o)) !== null; ) ;
412
+ for (; !{}.hasOwnProperty.call(o, a) && (o = m(o)) !== null; ) ;
424
413
  return o;
425
414
  }
426
- function J(o, a, u, c) {
427
- var E = v(R(o.prototype), a, u);
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 Z(o) {
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 ee(o) {
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 te(o) {
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, T = E.length; h < T; h++)
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(), T = function() {
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
- T();
512
+ g();
524
513
  return !u.defaultPrevented;
525
514
  }
526
515
  }
527
516
  }]);
528
- }(), x = /* @__PURE__ */ function(o) {
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 d(a, o), i(a, [{
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)), J(a, "dispatchEvent", 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), T();
582
+ E.abort(this.reason), g();
594
583
  }
595
- function T() {
584
+ function g() {
596
585
  var O = l(c), z;
597
586
  try {
598
587
  for (O.s(); !(z = O.n()).done; ) {
599
- var Te = z.value;
600
- Te.removeEventListener("abort", h);
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 x(),
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 = te(u), E = ee(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", x.prototype[Symbol.toStringTag] = "AbortSignal");
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 = x);
652
- })(typeof self < "u" ? self : Fe);
640
+ w(o) && (o.AbortController = C, o.AbortSignal = H);
641
+ })(typeof self < "u" ? self : xe);
653
642
  })), fe;
654
643
  }
655
- Me();
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 || {}, m = {
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 Ge(e) {
659
+ function Fe(e) {
671
660
  return e && DataView.prototype.isPrototypeOf(e);
672
661
  }
673
- if (m.arrayBuffer)
674
- var Ye = [
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
- ], Ke = ArrayBuffer.isView || function(e) {
685
- return e && Ye.indexOf(Object.prototype.toString.call(e)) > -1;
673
+ ], Ge = ArrayBuffer.isView || function(e) {
674
+ return e && Me.indexOf(Object.prototype.toString.call(e)) > -1;
686
675
  };
687
- function j(e) {
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 m.iterable && (t[Symbol.iterator] = function() {
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 = j(e), t = oe(t);
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[j(e)];
712
+ delete this.map[q(e)];
724
713
  };
725
714
  _.prototype.get = function(e) {
726
- return e = j(e), this.has(e) ? this.map[e] : null;
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(j(e));
718
+ return this.map.hasOwnProperty(q(e));
730
719
  };
731
720
  _.prototype.set = function(e, t) {
732
- this.map[j(e)] = oe(t);
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
- m.iterable && (_.prototype[Symbol.iterator] = _.prototype.entries);
757
- function re(e) {
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 Re(e) {
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 Qe(e) {
774
- var t = new FileReader(), r = Re(t);
762
+ function Ye(e) {
763
+ var t = new FileReader(), r = me(t);
775
764
  return t.readAsArrayBuffer(e), r;
776
765
  }
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";
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 $e(e) {
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 ge() {
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 : 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);
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 = re(this);
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 (m.blob)
817
- return this.blob().then(Qe);
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 = re(this);
810
+ var e = te(this);
822
811
  if (e)
823
812
  return e;
824
813
  if (this._bodyBlob)
825
- return ze(this._bodyBlob);
814
+ return Ke(this._bodyBlob);
826
815
  if (this._bodyArrayBuffer)
827
- return Promise.resolve($e(this._bodyArrayBuffer));
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
- }, m.formData && (this.formData = function() {
832
- return this.text().then(Xe);
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 We = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
838
- function Ve(e) {
826
+ var ze = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
827
+ function $e(e) {
839
828
  var t = e.toUpperCase();
840
- return We.indexOf(t) > -1 ? t : e;
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 = Ve(t.method || this.method || "GET"), this.mode = t.mode || this.mode || null, this.signal = t.signal || this.signal || function() {
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 Xe(e) {
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 Je(e) {
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
- ge.call(L.prototype);
900
- function P(e, t) {
901
- if (!(this instanceof P))
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
- ge.call(P.prototype);
908
- P.prototype.clone = function() {
909
- return new P(this._bodyInit, {
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
- P.error = function() {
917
- var e = new P(null, { status: 200, statusText: "" });
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 Ze = [301, 302, 303, 307, 308];
921
- P.redirect = function(e, t) {
922
- if (Ze.indexOf(t) === -1)
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 P(null, { status: t, headers: { location: e } });
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 d = {
935
+ var p = {
947
936
  statusText: i.statusText,
948
- headers: Je(i.getAllResponseHeaders() || "")
937
+ headers: Ve(i.getAllResponseHeaders() || "")
949
938
  };
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;
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 P(g, d));
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(d) {
957
+ function v(p) {
969
958
  try {
970
- return d === "" && A.location.href ? A.location.href : d;
959
+ return p === "" && A.location.href ? A.location.href : p;
971
960
  } catch {
972
- return d;
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 && (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);
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(d, g) {
984
- i.setRequestHeader(g, d);
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 = P);
993
- let k = {};
994
- const et = typeof window < "u" ? "signal" in new Request("") ? window.fetch : se : fetch;
995
- class ft {
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: R,
1003
- preError: d,
1004
- postError: g,
1005
- data: H,
991
+ postUpdate: m,
992
+ preError: p,
993
+ postError: T,
994
+ data: j,
1006
995
  files: S,
1007
996
  requestCancel: M = !0,
1008
- updateStore: J = !0,
997
+ updateStore: X = !0,
1009
998
  fileKey: G = this.options.fileKey,
1010
- primaryKey: Z = this.options.primaryKey,
999
+ primaryKey: J = this.options.primaryKey,
1011
1000
  bodyKey: Y = this.options.bodyKey,
1012
- method: ee = this.options.method,
1013
- normalize: te = this.options.normalize,
1001
+ method: Z = this.options.method,
1002
+ normalize: ee = this.options.normalize,
1014
1003
  mergeListStrategy: K = this.options.mergeListStrategy,
1015
- headers: x = this.options.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({ ...H, requestID: w });
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: H, requestCancel: M, requestStartTime: o, requestEndTime: void 0 }
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 T = await (await et(l, {
1031
- method: ee,
1019
+ const g = await (await Je(l, {
1020
+ method: Z,
1032
1021
  signal: h,
1033
- headers: { "ui-request-id": w, ...x },
1022
+ headers: { "ui-request-id": w, ...H },
1034
1023
  body: c
1035
1024
  })).json();
1036
- if (T)
1037
- for (k = Object.assign(
1025
+ if (g)
1026
+ for (x = Object.assign(
1038
1027
  {
1039
1028
  [w]: {
1040
1029
  requestID: w,
1041
- response: T,
1030
+ response: g,
1042
1031
  requestApi: l,
1043
1032
  requestStartTime: o,
1044
1033
  preUpdate: v,
1045
- postUpdate: R,
1046
- normalize: te,
1047
- preError: d,
1048
- postError: g,
1034
+ postUpdate: m,
1035
+ normalize: ee,
1036
+ preError: p,
1037
+ postError: T,
1049
1038
  mergeListStrategy: K,
1050
- updateStore: J,
1051
- data: H,
1039
+ updateStore: X,
1040
+ data: j,
1052
1041
  requestCancel: M,
1053
1042
  controller: E
1054
1043
  }
1055
1044
  },
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];
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: Z
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(T)), s({
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 k[b];
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: me,
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 tt(e, t, r) {
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 rt(e, t, r) {
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 nt(e, t, r) {
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 ot(e, t) {
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 it(e) {
1132
+ function nt(e) {
1147
1133
  return (t) => t({ type: y.CDEEBEEE_DROP_PATH, payload: { path: e } });
1148
1134
  }
1149
- function st(e) {
1135
+ function ot(e) {
1150
1136
  return (t) => t({ type: y.CDEEBEEE_DROP_REQUEST_BY_API_URL, payload: { api: e } });
1151
1137
  }
1152
- function at(e) {
1138
+ function it(e) {
1153
1139
  return (t) => t({ type: y.CDEEBEEE_DROP_ERROR_BY_API_URL, payload: { api: e } });
1154
1140
  }
1155
- const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1141
+ const lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1156
1142
  __proto__: null,
1157
- commitEntity: nt,
1158
- dropCdeebeePath: it,
1159
- dropErrorsByApiUrl: at,
1160
- dropRequestByApiUrl: st,
1161
- resetEntity: ot,
1162
- setKeyValue: rt,
1163
- unsafe_updateStore: tt
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
- ft as CdeebeeRequest,
1167
- ct as cdeebee,
1168
- Et as cdeebeeActions,
1152
+ ct as CdeebeeRequest,
1153
+ at as cdeebee,
1154
+ lt as cdeebeeActions,
1169
1155
  U as cdeebeeEntityState,
1170
- ut as cdeebeeHelpers,
1171
- pe as cdeebeeMergeStrategy,
1156
+ st as cdeebeeHelpers,
1157
+ de as cdeebeeMergeStrategy,
1172
1158
  y as cdeebeeTypes,
1173
- lt as requestManager
1159
+ ut as requestManager
1174
1160
  };
@@ -1,3 +1,3 @@
1
- (function(R,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(R=typeof globalThis<"u"?globalThis:R||self,d(R.cdeebee={}))})(this,function(R){"use strict";function d(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function B(e){return function t(r){return arguments.length===0||d(r)?t:e.apply(this,arguments)}}function P(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return d(r)?t:B(function(s){return e(r,s)});default:return d(r)&&d(n)?t:d(r)?B(function(s){return e(s,n)}):d(n)?B(function(s){return e(r,s)}):e(r,n)}}}function j(e){return function t(r,n,s){switch(arguments.length){case 0:return t;case 1:return d(r)?t:P(function(i,l){return e(r,i,l)});case 2:return d(r)&&d(n)?t:d(r)?P(function(i,l){return e(i,n,l)}):d(n)?P(function(i,l){return e(r,i,l)}):B(function(i){return e(r,n,i)});default:return d(r)&&d(n)&&d(s)?t:d(r)&&d(n)?P(function(i,l){return e(i,l,s)}):d(r)&&d(s)?P(function(i,l){return e(i,n,l)}):d(n)&&d(s)?P(function(i,l){return e(r,i,l)}):d(r)?B(function(i){return e(i,n,s)}):d(n)?B(function(i){return e(r,i,s)}):d(s)?B(function(i){return e(r,n,i)}):e(r,n,s)}}}const G=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 Y=Number.isInteger||function(t){return t<<0===t};function we(e,t,r){if(Y(e)&&G(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=B(function(t){return t==null}),I=j(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]:Y(t[1])?[]:{};r=e(Array.prototype.slice.call(t,1),r,i)}return we(s,r,n)}),De=j(function(t,r,n){return I([t],r,n)});function Pe(e,t){return function(){var r=arguments.length;if(r===0)return t();var n=arguments[r-1];return G(n)||typeof n[e]!="function"?t.apply(this,arguments):n[e].apply(n,Array.prototype.slice.call(arguments,0,r-1))}}var Se=j(Pe("slice",function(t,r,n){return Array.prototype.slice.call(n,t,r)})),Be=j(function(t,r,n){var s=Array.prototype.slice.call(n,0);return s.splice(t,r),s});function Ce(e,t){if(t==null)return t;if(Y(e)&&G(t))return Be(e,1,t);var r={};for(var n in t)r[n]=t[n];return delete r[e],r}function Ie(e,t){if(Y(e)&&G(t))return[].concat(t);var r={};for(var n in t)r[n]=t[n];return r}var Ne=P(function e(t,r){if(r==null)return r;switch(t.length){case 0:return r;case 1:return Ce(t[0],r);default:var n=t[0],s=Array.prototype.slice.call(t,1);return r[n]==null?Ie(n,r):De(n,e(s,r[n]),r)}}),le=P(function(t,r){return Ne([t],r)}),Ue=j(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}),Le=j(function e(t,r,n){return Ue(function(s,i,l){return ce(i)&&ce(l)?e(t,i,l):t(s,i,l)},r,n)}),K=P(function(t,r){return Le(function(n,s,i){return i},t,r)}),Z=P(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()},qe=(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},je=e=>Object.prototype.hasOwnProperty.call(e,"__entity")?e.__entity:e,Q=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},He=e=>(e.__state=C.NEW,e),ke=e=>Q(e)===C.NORMAL?(console.warn("commit works only in editing and new states"),e):fe(e),de=e=>Q(e)===C.NORMAL?(console.warn("reset works only in editing and new states"),e):fe(e),pe=(e,t,r)=>{const n=e[t];if(Q(n[r])===C.EDITING)return e;const i=I([t,r,"__entity"],n[r],e);return I([t,r,"__entity","__state"],C.EDITING,i)},he=(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 g of t[l].data)m[g[t[l][s]]]=g;n[l]===ee.replace?t[l]=m:t[l]=K(r[l],m)}else(t[l]===null||t[l]===void 0||typeof t[l]=="string")&&(t=Z([l],t))}return t},Fe=Object.freeze(Object.defineProperty({__proto__:null,batchingUpdate:he,checkNetworkActivity:qe,commitEntity:ke,defaultNormalize:_e,dropRequestFromArray:Ee,editEntity:pe,getEntityState:Q,getSubEntity:je,insertEntity:He,requestCancel:ye,resetEntity:de},Symbol.toStringTag,{value:"Module"})),be={},xe=(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=pe(e,n.entityList,n.entityID);return he(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:{}},Me=(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:return{...e,activeRequest:Se(1,1/0,e.activeRequest)};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 Ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},me={},Ae;function Ye(){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=g(a),x(o,T()?Reflect.construct(a,[],g(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=W(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=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}Te.call(N.prototype);function S(e,t){if(!(this instanceof S))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 h(t.headers),this.url=t.url||"",this._initBody(e)}Te.call(S.prototype),S.prototype.clone=function(){return new S(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},S.error=function(){var e=new S(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var tt=[301,302,303,307,308];S.redirect=function(e,t){if(tt.indexOf(t)===-1)throw new RangeError("Invalid status code");return new S(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 p={statusText:i.statusText,headers:et(i.getAllResponseHeaders()||"")};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");var T="response"in i?i.response:i.responseText;setTimeout(function(){r(new S(T,p))},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(p){try{return p===""&&v.location.href?v.location.href:p}catch{return p}}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 h||v.Headers&&t.headers instanceof v.Headers)){var g=[];Object.getOwnPropertyNames(t.headers).forEach(function(p){g.push(H(p)),i.setRequestHeader(p,te(t.headers[p]))}),s.headers.forEach(function(p,T){g.indexOf(T)===-1&&i.setRequestHeader(T,p)})}else s.headers.forEach(function(p,T){i.setRequestHeader(T,p)});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=h,v.Request=N,v.Response=S);let F={};const rt=typeof window<"u"?"signal"in new Request("")?window.fetch:oe:fetch;class nt{constructor(t,r){this.send=n=>async(s,i)=>{var a,u;const{api:l,preUpdate:m,postUpdate:g,preError:p,postError:T,data:x,files:L,requestCancel:z=!0,updateStore:ie=!0,fileKey:$=this.options.fileKey,primaryKey:se=this.options.primaryKey,bodyKey:W=this.options.bodyKey,method:ae=this.options.method,normalize:ue=this.options.normalize,mergeListStrategy:V=this.options.mergeListStrategy,headers:M=this.options.headers,responseKeyCode:q=this.options.responseKeyCode}=K(this.requestObject,n),O=Math.random().toString(36).substr(2),o=new Date;try{let c=JSON.stringify({...x,requestID:O});const E=new AbortController,{signal:_}=E;if(s({type:y.CDEEBEE_REQUESTMANAGER_SET,payload:{requestID:O,api:l,controller:E,data:x,requestCancel:z,requestStartTime:o,requestEndTime:void 0}}),L){const b=new FormData;for(let f=0;f<L.length;f+=1)$&&b.append($,L[f]);W&&b.append(W,c),c=b}const w=await(await rt(l,{method:ae,signal:_,headers:{"ui-request-id":O,...M},body:c})).json();if(w)for(F=Object.assign({[O]:{requestID:O,response:w,requestApi:l,requestStartTime:o,preUpdate:m,postUpdate:g,normalize:ue,preError:p,postError:T,mergeListStrategy:V,updateStore:ie,data:x,requestCancel:z,controller:E}},F);F[(u=(a=i().requestManager.activeRequest)==null?void 0:a[0])==null?void 0:u.requestID];){const b=i().requestManager.activeRequest[0].requestID,f=F[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 F[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",K(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,K(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 ot(e,t,r){return n=>{n({type:y.CDEEBEE_ENTITY_UNSAFE_UPDATE_STORE,payload:{entityList:e,entityID:t,value:r}})}}function it(e,t,r){return n=>{n({type:y.CDEEBEE_ENTITY_CHANGE_FIELD,payload:{entityList:e,entityID:t,valueList:r}})}}function st(e,t,r){return n=>{n({type:y.CDEEBEE_SET_ENTITY,payload:{entityList:e,entityID:t,entity:r}})}}function at(e,t){return r=>{r({type:y.CDEEBEE_RESET_ENTITY,payload:{entityList:e,entityID:t}})}}function ut(e){return t=>t({type:y.CDEEBEEE_DROP_PATH,payload:{path:e}})}function ct(e){return t=>t({type:y.CDEEBEEE_DROP_REQUEST_BY_API_URL,payload:{api:e}})}function lt(e){return t=>t({type:y.CDEEBEEE_DROP_ERROR_BY_API_URL,payload:{api:e}})}const ft=Object.freeze(Object.defineProperty({__proto__:null,commitEntity:st,dropCdeebeePath:ut,dropErrorsByApiUrl:lt,dropRequestByApiUrl:ct,resetEntity:at,setKeyValue:it,unsafe_updateStore:ot},Symbol.toStringTag,{value:"Module"}));R.CdeebeeRequest=nt,R.cdeebee=xe,R.cdeebeeActions=ft,R.cdeebeeEntityState=C,R.cdeebeeHelpers=Fe,R.cdeebeeMergeStrategy=ee,R.cdeebeeTypes=y,R.requestManager=Me,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
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"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recats/cdeebee",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "description": "React Redux data-logic library",
5
5
  "repository": "git@github.com:recats/cdeebee.git",
6
6
  "author": "recats",