@hortiview/modulebase 0.0.20436 → 1.0.0

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.
Files changed (51) hide show
  1. package/README.md +3 -2
  2. package/dist/IsRestoringProvider-CBSZo7ur.js +312 -0
  3. package/dist/ModuleCore-DuJVrj6v.js +11828 -0
  4. package/dist/QueryClientProvider-DyiNrPkn.js +514 -0
  5. package/dist/_commonjsHelpers-ByX85dGu.js +33 -0
  6. package/dist/api-COabZnyn.js +147 -0
  7. package/dist/assets/ModuleCore.css +1 -1
  8. package/dist/chunk-LFPYN7LY-D1ls8FXf.js +8643 -0
  9. package/dist/components/ModuleBase.js +9 -9
  10. package/dist/components/ModuleCore.js +1 -1
  11. package/dist/constants.js +2 -3
  12. package/dist/hooks/useCustom.js +1 -1
  13. package/dist/hooks/useCustomMutation.js +5 -5
  14. package/dist/hooks/useEntity.js +30 -30
  15. package/dist/hooks/useOffline.js +1 -1
  16. package/dist/hooks/useOption.js +5 -5
  17. package/dist/hooks/useServiceBus.js +1 -1
  18. package/dist/hooks/useStores.js +1 -1
  19. package/dist/{_baseGet-C6jMXSsQ.js → isTypedArray-SkhznY1k.js} +494 -494
  20. package/dist/lib/constants.d.ts +0 -1
  21. package/dist/lib/hooks/useCustom.d.ts +4 -2
  22. package/dist/lib/hooks/useCustomMutation.d.ts +8 -3
  23. package/dist/lib/hooks/useEntity.d.ts +6 -0
  24. package/dist/lib/types/Requests.d.ts +0 -17
  25. package/dist/lib/utils/api.d.ts +6 -13
  26. package/dist/lib/utils/baseFetches.d.ts +3 -2
  27. package/dist/main.js +188 -173
  28. package/dist/module-router.js +2322 -121
  29. package/dist/{mutation-DSKlaYzY.js → mutation-CmhiEgfA.js} +101 -56
  30. package/dist/{omit-C9Qe80rl.js → omit-Do6MFRwA.js} +240 -223
  31. package/dist/provider/SignalR/SignalRProvider.js +2389 -2824
  32. package/dist/react-c9FSfB30.js +27 -0
  33. package/dist/stores/BasePropsStore.js +1 -1
  34. package/dist/stores/EnvironmentStore.js +1 -1
  35. package/dist/useMutation-Aoachkw_.js +139 -0
  36. package/dist/useQuery-DEU_AUtf.js +392 -0
  37. package/dist/utils/api.js +3 -4
  38. package/dist/utils/baseFetches.js +18 -14
  39. package/dist/utils/fetches.js +3 -4
  40. package/dist/utils/helper.js +13 -13
  41. package/package.json +17 -13
  42. package/dist/ModuleCore-DpwHP0IU.js +0 -14973
  43. package/dist/QueryClientProvider-Beog9TR7.js +0 -437
  44. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  45. package/dist/api-CogBuK0n.js +0 -473
  46. package/dist/chunk-IR6S3I6Y-BmDdD3SP.js +0 -8162
  47. package/dist/isRestoring-CLuxJVSA.js +0 -281
  48. package/dist/react-QiIgv49H.js +0 -27
  49. package/dist/useMutation-zu8uxBak.js +0 -97
  50. package/dist/useQuery-Bj9k9zik.js +0 -395
  51. package/dist/utils-DxRR_XLb.js +0 -9
@@ -0,0 +1,514 @@
1
+ import * as j from "react";
2
+ import { jsx as R } from "react/jsx-runtime";
3
+ var C = class {
4
+ constructor() {
5
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
6
+ }
7
+ subscribe(e) {
8
+ return this.listeners.add(e), this.onSubscribe(), () => {
9
+ this.listeners.delete(e), this.onUnsubscribe();
10
+ };
11
+ }
12
+ hasListeners() {
13
+ return this.listeners.size > 0;
14
+ }
15
+ onSubscribe() {
16
+ }
17
+ onUnsubscribe() {
18
+ }
19
+ }, D = {
20
+ // We need the wrapper function syntax below instead of direct references to
21
+ // global setTimeout etc.
22
+ //
23
+ // BAD: `setTimeout: setTimeout`
24
+ // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
25
+ //
26
+ // If we use direct references here, then anything that wants to spy on or
27
+ // replace the global setTimeout (like tests) won't work since we'll already
28
+ // have a hard reference to the original implementation at the time when this
29
+ // file was imported.
30
+ setTimeout: (e, t) => setTimeout(e, t),
31
+ clearTimeout: (e) => clearTimeout(e),
32
+ setInterval: (e, t) => setInterval(e, t),
33
+ clearInterval: (e) => clearInterval(e)
34
+ }, Q = class {
35
+ // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
36
+ // type at app boot; and if we leave that type, then any new timer provider
37
+ // would need to support ReturnType<typeof setTimeout>, which is infeasible.
38
+ //
39
+ // We settle for type safety for the TimeoutProvider type, and accept that
40
+ // this class is unsafe internally to allow for extension.
41
+ #e = D;
42
+ #t = !1;
43
+ setTimeoutProvider(e) {
44
+ process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
45
+ "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
46
+ { previous: this.#e, provider: e }
47
+ ), this.#e = e, process.env.NODE_ENV !== "production" && (this.#t = !1);
48
+ }
49
+ setTimeout(e, t) {
50
+ return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(e, t);
51
+ }
52
+ clearTimeout(e) {
53
+ this.#e.clearTimeout(e);
54
+ }
55
+ setInterval(e, t) {
56
+ return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(e, t);
57
+ }
58
+ clearInterval(e) {
59
+ this.#e.clearInterval(e);
60
+ }
61
+ }, E = new Q();
62
+ function K(e) {
63
+ setTimeout(e, 0);
64
+ }
65
+ var w = typeof window > "u" || "Deno" in globalThis;
66
+ function P() {
67
+ }
68
+ function ee(e, t) {
69
+ return typeof e == "function" ? e(t) : e;
70
+ }
71
+ function A(e) {
72
+ return typeof e == "number" && e >= 0 && e !== 1 / 0;
73
+ }
74
+ function te(e, t) {
75
+ return Math.max(e + (t || 0) - Date.now(), 0);
76
+ }
77
+ function re(e, t) {
78
+ return typeof e == "function" ? e(t) : e;
79
+ }
80
+ function ne(e, t) {
81
+ return typeof e == "function" ? e(t) : e;
82
+ }
83
+ function se(e, t) {
84
+ const {
85
+ type: r = "all",
86
+ exact: n,
87
+ fetchStatus: s,
88
+ predicate: o,
89
+ queryKey: c,
90
+ stale: i
91
+ } = e;
92
+ if (c) {
93
+ if (n) {
94
+ if (t.queryHash !== V(c, t.options))
95
+ return !1;
96
+ } else if (!F(t.queryKey, c))
97
+ return !1;
98
+ }
99
+ if (r !== "all") {
100
+ const u = t.isActive();
101
+ if (r === "active" && !u || r === "inactive" && u)
102
+ return !1;
103
+ }
104
+ return !(typeof i == "boolean" && t.isStale() !== i || s && s !== t.state.fetchStatus || o && !o(t));
105
+ }
106
+ function ie(e, t) {
107
+ const { exact: r, status: n, predicate: s, mutationKey: o } = e;
108
+ if (o) {
109
+ if (!t.options.mutationKey)
110
+ return !1;
111
+ if (r) {
112
+ if (O(t.options.mutationKey) !== O(o))
113
+ return !1;
114
+ } else if (!F(t.options.mutationKey, o))
115
+ return !1;
116
+ }
117
+ return !(n && t.state.status !== n || s && !s(t));
118
+ }
119
+ function V(e, t) {
120
+ return (t?.queryKeyHashFn || O)(e);
121
+ }
122
+ function O(e) {
123
+ return JSON.stringify(
124
+ e,
125
+ (t, r) => S(r) ? Object.keys(r).sort().reduce((n, s) => (n[s] = r[s], n), {}) : r
126
+ );
127
+ }
128
+ function F(e, t) {
129
+ return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((r) => F(e[r], t[r])) : !1;
130
+ }
131
+ var z = Object.prototype.hasOwnProperty;
132
+ function T(e, t, r = 0) {
133
+ if (e === t)
134
+ return e;
135
+ if (r > 500) return t;
136
+ const n = N(e) && N(t);
137
+ if (!n && !(S(e) && S(t))) return t;
138
+ const o = (n ? e : Object.keys(e)).length, c = n ? t : Object.keys(t), i = c.length, u = n ? new Array(i) : {};
139
+ let v = 0;
140
+ for (let f = 0; f < i; f++) {
141
+ const h = n ? f : c[f], l = e[h], y = t[h];
142
+ if (l === y) {
143
+ u[h] = l, (n ? f < o : z.call(e, h)) && v++;
144
+ continue;
145
+ }
146
+ if (l === null || y === null || typeof l != "object" || typeof y != "object") {
147
+ u[h] = y;
148
+ continue;
149
+ }
150
+ const m = T(l, y, r + 1);
151
+ u[h] = m, m === l && v++;
152
+ }
153
+ return o === i && v === o ? e : u;
154
+ }
155
+ function oe(e, t) {
156
+ if (!t || Object.keys(e).length !== Object.keys(t).length)
157
+ return !1;
158
+ for (const r in e)
159
+ if (e[r] !== t[r])
160
+ return !1;
161
+ return !0;
162
+ }
163
+ function N(e) {
164
+ return Array.isArray(e) && e.length === Object.keys(e).length;
165
+ }
166
+ function S(e) {
167
+ if (!I(e))
168
+ return !1;
169
+ const t = e.constructor;
170
+ if (t === void 0)
171
+ return !0;
172
+ const r = t.prototype;
173
+ return !(!I(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
174
+ }
175
+ function I(e) {
176
+ return Object.prototype.toString.call(e) === "[object Object]";
177
+ }
178
+ function _(e) {
179
+ return new Promise((t) => {
180
+ E.setTimeout(t, e);
181
+ });
182
+ }
183
+ function ue(e, t, r) {
184
+ if (typeof r.structuralSharing == "function")
185
+ return r.structuralSharing(e, t);
186
+ if (r.structuralSharing !== !1) {
187
+ if (process.env.NODE_ENV !== "production")
188
+ try {
189
+ return T(e, t);
190
+ } catch (n) {
191
+ throw console.error(
192
+ `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`
193
+ ), n;
194
+ }
195
+ return T(e, t);
196
+ }
197
+ return t;
198
+ }
199
+ function ae(e, t, r = 0) {
200
+ const n = [...e, t];
201
+ return r && n.length > r ? n.slice(1) : n;
202
+ }
203
+ function ce(e, t, r = 0) {
204
+ const n = [t, ...e];
205
+ return r && n.length > r ? n.slice(0, -1) : n;
206
+ }
207
+ var L = /* @__PURE__ */ Symbol();
208
+ function le(e, t) {
209
+ return process.env.NODE_ENV !== "production" && e.queryFn === L && console.error(
210
+ `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
211
+ ), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === L ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
212
+ }
213
+ function fe(e, t) {
214
+ return typeof e == "function" ? e(...t) : !!e;
215
+ }
216
+ function he(e, t, r) {
217
+ let n = !1, s;
218
+ return Object.defineProperty(e, "signal", {
219
+ enumerable: !0,
220
+ get: () => (s ??= t(), n || (n = !0, s.aborted ? r() : s.addEventListener("abort", r, { once: !0 })), s)
221
+ }), e;
222
+ }
223
+ var U = class extends C {
224
+ #e;
225
+ #t;
226
+ #r;
227
+ constructor() {
228
+ super(), this.#r = (e) => {
229
+ if (!w && window.addEventListener) {
230
+ const t = () => e();
231
+ return window.addEventListener("visibilitychange", t, !1), () => {
232
+ window.removeEventListener("visibilitychange", t);
233
+ };
234
+ }
235
+ };
236
+ }
237
+ onSubscribe() {
238
+ this.#t || this.setEventListener(this.#r);
239
+ }
240
+ onUnsubscribe() {
241
+ this.hasListeners() || (this.#t?.(), this.#t = void 0);
242
+ }
243
+ setEventListener(e) {
244
+ this.#r = e, this.#t?.(), this.#t = e((t) => {
245
+ typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
246
+ });
247
+ }
248
+ setFocused(e) {
249
+ this.#e !== e && (this.#e = e, this.onFocus());
250
+ }
251
+ onFocus() {
252
+ const e = this.isFocused();
253
+ this.listeners.forEach((t) => {
254
+ t(e);
255
+ });
256
+ }
257
+ isFocused() {
258
+ return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
259
+ }
260
+ }, G = new U();
261
+ function H() {
262
+ let e, t;
263
+ const r = new Promise((s, o) => {
264
+ e = s, t = o;
265
+ });
266
+ r.status = "pending", r.catch(() => {
267
+ });
268
+ function n(s) {
269
+ Object.assign(r, s), delete r.resolve, delete r.reject;
270
+ }
271
+ return r.resolve = (s) => {
272
+ n({
273
+ status: "fulfilled",
274
+ value: s
275
+ }), e(s);
276
+ }, r.reject = (s) => {
277
+ n({
278
+ status: "rejected",
279
+ reason: s
280
+ }), t(s);
281
+ }, r;
282
+ }
283
+ function ye(e) {
284
+ let t;
285
+ if (e.then((r) => (t = r, r), P)?.catch(P), t !== void 0)
286
+ return { data: t };
287
+ }
288
+ var $ = K;
289
+ function B() {
290
+ let e = [], t = 0, r = (i) => {
291
+ i();
292
+ }, n = (i) => {
293
+ i();
294
+ }, s = $;
295
+ const o = (i) => {
296
+ t ? e.push(i) : s(() => {
297
+ r(i);
298
+ });
299
+ }, c = () => {
300
+ const i = e;
301
+ e = [], i.length && s(() => {
302
+ n(() => {
303
+ i.forEach((u) => {
304
+ r(u);
305
+ });
306
+ });
307
+ });
308
+ };
309
+ return {
310
+ batch: (i) => {
311
+ let u;
312
+ t++;
313
+ try {
314
+ u = i();
315
+ } finally {
316
+ t--, t || c();
317
+ }
318
+ return u;
319
+ },
320
+ /**
321
+ * All calls to the wrapped function will be batched.
322
+ */
323
+ batchCalls: (i) => (...u) => {
324
+ o(() => {
325
+ i(...u);
326
+ });
327
+ },
328
+ schedule: o,
329
+ /**
330
+ * Use this method to set a custom notify function.
331
+ * This can be used to for example wrap notifications with `React.act` while running tests.
332
+ */
333
+ setNotifyFunction: (i) => {
334
+ r = i;
335
+ },
336
+ /**
337
+ * Use this method to set a custom function to batch notifications together into a single tick.
338
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
339
+ */
340
+ setBatchNotifyFunction: (i) => {
341
+ n = i;
342
+ },
343
+ setScheduler: (i) => {
344
+ s = i;
345
+ }
346
+ };
347
+ }
348
+ var de = B(), J = class extends C {
349
+ #e = !0;
350
+ #t;
351
+ #r;
352
+ constructor() {
353
+ super(), this.#r = (e) => {
354
+ if (!w && window.addEventListener) {
355
+ const t = () => e(!0), r = () => e(!1);
356
+ return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
357
+ window.removeEventListener("online", t), window.removeEventListener("offline", r);
358
+ };
359
+ }
360
+ };
361
+ }
362
+ onSubscribe() {
363
+ this.#t || this.setEventListener(this.#r);
364
+ }
365
+ onUnsubscribe() {
366
+ this.hasListeners() || (this.#t?.(), this.#t = void 0);
367
+ }
368
+ setEventListener(e) {
369
+ this.#r = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
370
+ }
371
+ setOnline(e) {
372
+ this.#e !== e && (this.#e = e, this.listeners.forEach((r) => {
373
+ r(e);
374
+ }));
375
+ }
376
+ isOnline() {
377
+ return this.#e;
378
+ }
379
+ }, M = new J();
380
+ function Z(e) {
381
+ return Math.min(1e3 * 2 ** e, 3e4);
382
+ }
383
+ function W(e) {
384
+ return (e ?? "online") === "online" ? M.isOnline() : !0;
385
+ }
386
+ var X = class extends Error {
387
+ constructor(e) {
388
+ super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
389
+ }
390
+ };
391
+ function ve(e) {
392
+ let t = !1, r = 0, n;
393
+ const s = H(), o = () => s.status !== "pending", c = (a) => {
394
+ if (!o()) {
395
+ const p = new X(a);
396
+ l(p), e.onCancel?.(p);
397
+ }
398
+ }, i = () => {
399
+ t = !0;
400
+ }, u = () => {
401
+ t = !1;
402
+ }, v = () => G.isFocused() && (e.networkMode === "always" || M.isOnline()) && e.canRun(), f = () => W(e.networkMode) && e.canRun(), h = (a) => {
403
+ o() || (n?.(), s.resolve(a));
404
+ }, l = (a) => {
405
+ o() || (n?.(), s.reject(a));
406
+ }, y = () => new Promise((a) => {
407
+ n = (p) => {
408
+ (o() || v()) && a(p);
409
+ }, e.onPause?.();
410
+ }).then(() => {
411
+ n = void 0, o() || e.onContinue?.();
412
+ }), m = () => {
413
+ if (o())
414
+ return;
415
+ let a;
416
+ const p = r === 0 ? e.initialPromise : void 0;
417
+ try {
418
+ a = p ?? e.fn();
419
+ } catch (d) {
420
+ a = Promise.reject(d);
421
+ }
422
+ Promise.resolve(a).then(h).catch((d) => {
423
+ if (o())
424
+ return;
425
+ const b = e.retry ?? (w ? 0 : 3), g = e.retryDelay ?? Z, q = typeof g == "function" ? g(r, d) : g, x = b === !0 || typeof b == "number" && r < b || typeof b == "function" && b(r, d);
426
+ if (t || !x) {
427
+ l(d);
428
+ return;
429
+ }
430
+ r++, e.onFail?.(r, d), _(q).then(() => v() ? void 0 : y()).then(() => {
431
+ t ? l(d) : m();
432
+ });
433
+ });
434
+ };
435
+ return {
436
+ promise: s,
437
+ status: () => s.status,
438
+ cancel: c,
439
+ continue: () => (n?.(), s),
440
+ cancelRetry: i,
441
+ continueRetry: u,
442
+ canStart: f,
443
+ start: () => (f() ? m() : y().then(m), s)
444
+ };
445
+ }
446
+ var me = class {
447
+ #e;
448
+ destroy() {
449
+ this.clearGcTimeout();
450
+ }
451
+ scheduleGc() {
452
+ this.clearGcTimeout(), A(this.gcTime) && (this.#e = E.setTimeout(() => {
453
+ this.optionalRemove();
454
+ }, this.gcTime));
455
+ }
456
+ updateGcTime(e) {
457
+ this.gcTime = Math.max(
458
+ this.gcTime || 0,
459
+ e ?? (w ? 1 / 0 : 300 * 1e3)
460
+ );
461
+ }
462
+ clearGcTimeout() {
463
+ this.#e && (E.clearTimeout(this.#e), this.#e = void 0);
464
+ }
465
+ }, k = j.createContext(
466
+ void 0
467
+ ), pe = (e) => {
468
+ const t = j.useContext(k);
469
+ if (e)
470
+ return e;
471
+ if (!t)
472
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
473
+ return t;
474
+ }, be = ({
475
+ client: e,
476
+ children: t
477
+ }) => (j.useEffect(() => (e.mount(), () => {
478
+ e.unmount();
479
+ }), [e]), /* @__PURE__ */ R(k.Provider, { value: e, children: t }));
480
+ export {
481
+ M as A,
482
+ ee as B,
483
+ X as C,
484
+ F as D,
485
+ be as Q,
486
+ me as R,
487
+ C as S,
488
+ P as a,
489
+ fe as b,
490
+ ve as c,
491
+ ne as d,
492
+ L as e,
493
+ re as f,
494
+ le as g,
495
+ O as h,
496
+ W as i,
497
+ w as j,
498
+ A as k,
499
+ E as l,
500
+ G as m,
501
+ de as n,
502
+ ye as o,
503
+ H as p,
504
+ ce as q,
505
+ ue as r,
506
+ oe as s,
507
+ te as t,
508
+ pe as u,
509
+ ae as v,
510
+ he as w,
511
+ ie as x,
512
+ V as y,
513
+ se as z
514
+ };
@@ -0,0 +1,33 @@
1
+ var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
+ function a(e) {
3
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
4
+ }
5
+ function f(e) {
6
+ if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
7
+ var n = e.default;
8
+ if (typeof n == "function") {
9
+ var t = function r() {
10
+ var o = !1;
11
+ try {
12
+ o = this instanceof r;
13
+ } catch {
14
+ }
15
+ return o ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
16
+ };
17
+ t.prototype = n.prototype;
18
+ } else t = {};
19
+ return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
20
+ var o = Object.getOwnPropertyDescriptor(e, r);
21
+ Object.defineProperty(t, r, o.get ? o : {
22
+ enumerable: !0,
23
+ get: function() {
24
+ return e[r];
25
+ }
26
+ });
27
+ }), t;
28
+ }
29
+ export {
30
+ f as a,
31
+ u as c,
32
+ a as g
33
+ };
@@ -0,0 +1,147 @@
1
+ import { g as w } from "./_commonjsHelpers-ByX85dGu.js";
2
+ import { r as b, a as j, b as v, c as I, d as M, e as R, f as _, g as B, h as C } from "./isTypedArray-SkhznY1k.js";
3
+ import { RETRY_HTTP_STATUS_CODES as z } from "./constants.js";
4
+ import { useBasePropsStore as c } from "./stores/BasePropsStore.js";
5
+ var h, g;
6
+ function O() {
7
+ if (g) return h;
8
+ g = 1;
9
+ var e = b();
10
+ function t(s, r, o) {
11
+ var n = s == null ? void 0 : e(s, r);
12
+ return n === void 0 ? o : n;
13
+ }
14
+ return h = t, h;
15
+ }
16
+ var U = O();
17
+ const $ = /* @__PURE__ */ w(U);
18
+ var d, y;
19
+ function G() {
20
+ if (y) return d;
21
+ y = 1;
22
+ var e = j(), t = v(), s = I(), r = M(), o = R(), n = _(), i = C(), f = B(), k = "[object Map]", q = "[object Set]", S = Object.prototype, x = S.hasOwnProperty;
23
+ function A(a) {
24
+ if (a == null)
25
+ return !0;
26
+ if (o(a) && (r(a) || typeof a == "string" || typeof a.splice == "function" || n(a) || f(a) || s(a)))
27
+ return !a.length;
28
+ var l = t(a);
29
+ if (l == k || l == q)
30
+ return !a.size;
31
+ if (i(a))
32
+ return !e(a).length;
33
+ for (var P in a)
34
+ if (x.call(a, P))
35
+ return !1;
36
+ return !0;
37
+ }
38
+ return d = A, d;
39
+ }
40
+ var H = G();
41
+ const D = /* @__PURE__ */ w(H), Y = (e, t, s, r = "GET", o) => {
42
+ const n = new Headers();
43
+ return n.append("Content-Type", "application/json"), t && n.append("orgId", t), s && n.append("languageId", s), e && n.append("Authorization", `Bearer ${e}`), o && o.forEach((i, f) => {
44
+ n.set(f, i);
45
+ }), {
46
+ redirect: "follow",
47
+ credentials: "omit",
48
+ method: r,
49
+ headers: n
50
+ };
51
+ };
52
+ let u = "moduleTokenIsFresh";
53
+ const p = async (e, t, s = !0) => {
54
+ for (; u === "isModuleTokenRefreshing"; )
55
+ await m(100);
56
+ const r = c.getState().throwError;
57
+ if (u === "unableToRefreshModuleToken") throw r?.("Unauthorized", 401);
58
+ let o = await Promise.resolve();
59
+ try {
60
+ const i = { ...t };
61
+ o = await fetch(e, i);
62
+ } catch {
63
+ s || r?.("Network error", 500);
64
+ }
65
+ if (K(o, e, t), o?.ok)
66
+ return T(o);
67
+ if (u === "isModuleTokenRefreshing")
68
+ return await p(e, t, s);
69
+ if (o?.status === 401)
70
+ return await F(e, t);
71
+ const n = Object.values(z);
72
+ return s && n.includes(o?.status) ? (await m(5e3), p(e, t, !1)) : T(o);
73
+ }, F = async (e, t) => {
74
+ const s = c.getState().throwError, r = c.getState().refreshModulePermissionToken;
75
+ if (r == null || typeof r != "function")
76
+ throw s?.("refreshModulePermissionToken is not a function or was not found", 401);
77
+ u = "isModuleTokenRefreshing";
78
+ const o = await r();
79
+ if (o === void 0)
80
+ throw u = "unableToRefreshModuleToken", s?.("Unauthorized", 401);
81
+ const n = {
82
+ ...t,
83
+ headers: {
84
+ ...t.headers,
85
+ Authorization: `Bearer ${o}`
86
+ }
87
+ };
88
+ return u = "moduleTokenIsFresh", p(e, n);
89
+ }, E = async (e) => {
90
+ const t = await e.text();
91
+ let s;
92
+ try {
93
+ s = JSON.parse(t);
94
+ } catch {
95
+ s = {
96
+ value: t
97
+ };
98
+ }
99
+ return s;
100
+ }, K = async (e, t, s) => {
101
+ const r = e.clone(), o = c.getState().logEvent, n = c.getState().logError;
102
+ try {
103
+ const i = {
104
+ requestUrl: t,
105
+ requestHeaders: { ...s.headers, Authorization: void 0 },
106
+ requestMethod: s.method,
107
+ requestBody: $(s, "body"),
108
+ responseStatus: r?.status.toString(),
109
+ responseStatusText: r?.statusText,
110
+ responseBody: await E(r)
111
+ };
112
+ e.ok && o ? o({
113
+ name: `request: ${r?.status.toString()} - ${t}`,
114
+ properties: i
115
+ }) : n?.({
116
+ exception: {
117
+ name: `request: ${r?.status.toString()} - ${t}`,
118
+ message: r?.statusText
119
+ },
120
+ properties: i
121
+ });
122
+ } catch {
123
+ console.error("Error while tracking event or exception in AppInsights");
124
+ }
125
+ }, T = async (e) => {
126
+ if (e.ok)
127
+ return E(e);
128
+ const t = {
129
+ detail: e.statusText,
130
+ status: e.status,
131
+ stack: void 0,
132
+ title: "BaseError"
133
+ }, s = c.getState().throwError;
134
+ try {
135
+ const r = await e.json();
136
+ D(r) || (t.title = r.title ?? "UnexpectedError", t.stack = r.message ?? r.title ?? e.statusText, t.detail = r.detail);
137
+ } catch {
138
+ t.detail = e.statusText;
139
+ }
140
+ throw s?.(t.detail, t.status);
141
+ }, m = (e) => new Promise((t) => setTimeout(t, e));
142
+ export {
143
+ Y as a,
144
+ p as f,
145
+ $ as g,
146
+ T as h
147
+ };
@@ -1 +1 @@
1
- ._image_178sv_1>svg{width:inherit;height:inherit;color:inherit}._loadingBigOverlay_7dxo1_1{z-index:500;position:fixed;top:0;left:0;width:100%;height:100%;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background-color:#0000001a}._bigLoadSpinnerCard_7dxo1_12{background-color:var(--lmnt-theme-background);text-align:center;inline-size:auto;padding:2rem 2rem 1.5rem;border-radius:1rem;box-shadow:0 .5rem .625rem -.3125rem #0003,0 .375rem 1.875rem .3125rem #0000001f,0 1rem 1.5rem .125rem #00000024;z-index:500;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}._bigLoadSpinnerCardText_7dxo1_27{padding:0;margin:1rem 0 0;text-align:center}._logo_7dxo1_33{width:4.75rem!important;height:4.75rem!important}@keyframes _rotate360deg_7dxo1_1{0%{transform:rotate(0)}to{transform:rotate(360deg)}}._logo_7dxo1_33 path[id=Subtract_2]{transform-origin:center;animation:_rotate360deg_7dxo1_1 1s linear infinite}._loadingSpinnerContainer_1f3ss_1{z-index:500;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--lmnt-theme-on-surface-high)}._database_11ki8_1{color:var(--lmnt-theme-secondary);animation:_spin_11ki8_1 4s linear infinite}@keyframes _spin_11ki8_1{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}._iot_11ki8_16,._platform_11ki8_17,._other_11ki8_18{color:var(--lmnt-theme-danger)}._crossedOut_11ki8_22{position:relative;display:inline-block}._crossedOut_11ki8_22:after{content:"";position:absolute;width:3rem;height:.25rem;left:50%;top:50%;background:var(--lmnt-theme-danger-on-surface);box-shadow:0 0 0 .125rem var(--lmnt-theme-background);transform:translate(-50%,calc(-50% - .25rem)) rotate(45deg);transform-origin:center;z-index:2}._disclaimer_1k38t_1{color:var(--lmnt-theme-danger);font-style:normal;line-height:20px}._iconArea_1k38t_7{display:flex;justify-content:center}
1
+ ._image_178sv_1>svg{width:inherit;height:inherit;color:inherit}._disclaimer_1k38t_1{color:var(--lmnt-theme-danger);font-style:normal;line-height:20px}._iconArea_1k38t_7{display:flex;justify-content:center}._loadingBigOverlay_7dxo1_1{z-index:500;position:fixed;top:0;left:0;width:100%;height:100%;backdrop-filter:blur(2px);background-color:#0000001a}._bigLoadSpinnerCard_7dxo1_12{background-color:var(--lmnt-theme-background);text-align:center;inline-size:auto;padding:2rem 2rem 1.5rem;border-radius:1rem;box-shadow:0 .5rem .625rem -.3125rem #0003,0 .375rem 1.875rem .3125rem #0000001f,0 1rem 1.5rem .125rem #00000024;z-index:500;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}._bigLoadSpinnerCardText_7dxo1_27{padding:0;margin:1rem 0 0;text-align:center}._logo_7dxo1_33{width:4.75rem!important;height:4.75rem!important}@keyframes _rotate360deg_7dxo1_1{0%{transform:rotate(0)}to{transform:rotate(360deg)}}._logo_7dxo1_33 path[id=Subtract_2]{transform-origin:center;animation:_rotate360deg_7dxo1_1 1s linear infinite}._loadingSpinnerContainer_1f3ss_1{z-index:500;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--lmnt-theme-on-surface-high)}._database_1vpro_1{color:var(--lmnt-theme-secondary);animation:_spin_1vpro_1 4s linear infinite}@keyframes _spin_1vpro_1{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}._done_1vpro_16{color:var(--lmnt-theme-success)}._iot_1vpro_20,._platform_1vpro_21,._other_1vpro_22{color:var(--lmnt-theme-danger)}._celebration_1vpro_26,._primary_1vpro_30{color:var(--lmnt-theme-primary)}._secondary_1vpro_34{color:var(--lmnt-theme-secondary)}._danger_1vpro_38{color:var(--lmnt-theme-danger)}._success_1vpro_42{color:var(--lmnt-theme-success)}._crossedOut_1vpro_46{position:relative;display:inline-block}._crossedOut_1vpro_46:after{content:"";position:absolute;width:3rem;height:.25rem;left:50%;top:50%;background:var(--lmnt-theme-danger-on-surface);box-shadow:0 0 0 .125rem var(--lmnt-theme-background);transform:translate(-50%,calc(-50% - .25rem)) rotate(45deg);transform-origin:center;z-index:2}._fullHeight_1vpro_65{height:100%}._centerText_1vpro_69{text-align:center}