@hortiview/modulebase 0.0.1

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 (56) hide show
  1. package/README.md +8 -0
  2. package/dist/QueryClientProvider-DQv4Y3Qu.js +707 -0
  3. package/dist/_baseGet-Bh5zJ_C8.js +805 -0
  4. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  5. package/dist/chunk-IR6S3I6Y-BvQXS3A3.js +3908 -0
  6. package/dist/components/ModuleBase.d.ts +11 -0
  7. package/dist/components/ModuleBase.js +691 -0
  8. package/dist/constants.d.ts +25 -0
  9. package/dist/constants.js +34 -0
  10. package/dist/fetches-DUCQo_6B.js +477 -0
  11. package/dist/hooks/useBreadcrumbTranslation.d.ts +1 -0
  12. package/dist/hooks/useBreadcrumbTranslation.js +20 -0
  13. package/dist/hooks/useCustom.d.ts +6 -0
  14. package/dist/hooks/useCustom.js +19 -0
  15. package/dist/hooks/useEntity.d.ts +186 -0
  16. package/dist/hooks/useEntity.js +58 -0
  17. package/dist/hooks/useNavigate.d.ts +5 -0
  18. package/dist/hooks/useNavigate.js +27 -0
  19. package/dist/hooks/useOption.d.ts +17 -0
  20. package/dist/hooks/useOption.js +23 -0
  21. package/dist/hooks/useSignalRMessages.d.ts +6 -0
  22. package/dist/hooks/useSignalRMessages.js +13 -0
  23. package/dist/hooks/useStores.d.ts +29 -0
  24. package/dist/hooks/useStores.js +844 -0
  25. package/dist/main.d.ts +9 -0
  26. package/dist/main.js +19 -0
  27. package/dist/provider/SignalR/SignalRProvider.d.ts +13 -0
  28. package/dist/provider/SignalR/SignalRProvider.js +6408 -0
  29. package/dist/provider/SignalR/signalR.d.ts +53 -0
  30. package/dist/provider/SignalR/signalR.js +11 -0
  31. package/dist/react-QiIgv49H.js +27 -0
  32. package/dist/stores/BasePropsStore.d.ts +6 -0
  33. package/dist/stores/BasePropsStore.js +7 -0
  34. package/dist/stores/EnvironmentStore.d.ts +8 -0
  35. package/dist/stores/EnvironmentStore.js +9 -0
  36. package/dist/types/AppInsights.d.ts +12 -0
  37. package/dist/types/AppInsights.js +1 -0
  38. package/dist/types/BaseProps.d.ts +38 -0
  39. package/dist/types/BaseProps.js +1 -0
  40. package/dist/types/CommonOptions.d.ts +61 -0
  41. package/dist/types/CommonOptions.js +4 -0
  42. package/dist/types/Deprecated.d.ts +93 -0
  43. package/dist/types/Deprecated.js +1 -0
  44. package/dist/types/Environment.d.ts +17 -0
  45. package/dist/types/Environment.js +1 -0
  46. package/dist/types/ModuleApi.d.ts +80 -0
  47. package/dist/types/ModuleApi.js +1 -0
  48. package/dist/types/Requests.d.ts +49 -0
  49. package/dist/types/Requests.js +4 -0
  50. package/dist/types/SystemMessage.d.ts +14 -0
  51. package/dist/types/SystemMessage.js +1 -0
  52. package/dist/useQuery-znAyMQW1.js +397 -0
  53. package/dist/utils/fetches.d.ts +26 -0
  54. package/dist/utils/fetches.js +16 -0
  55. package/dist/vite-env.d.js +1 -0
  56. package/package.json +55 -0
@@ -0,0 +1,11 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { RouteObject } from 'react-router';
3
+ import { BaseProps } from '../types/BaseProps';
4
+ import { EnvConfig } from '../types/Environment';
5
+ export declare const ModuleBase: ({ props, routes, env, useSignalR, queryClient, }: {
6
+ props: BaseProps;
7
+ routes: RouteObject[];
8
+ env?: EnvConfig;
9
+ useSignalR?: boolean;
10
+ queryClient?: QueryClient;
11
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,691 @@
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { S as k, h as N, Q as x, n as u, m as M, R as H, c as K, a as E, b as h, e as B, d as j, f as L, g as U, o as S, r as D, i as G, j as A, p as C, s as V, k as W } from "../QueryClientProvider-DQv4Y3Qu.js";
3
+ import { useState as $, useEffect as q } from "react";
4
+ import { c as z, R as X } from "../chunk-IR6S3I6Y-BvQXS3A3.js";
5
+ import { REQUIRED_PROPS as Y } from "../constants.js";
6
+ import { SignalRProvider as J } from "../provider/SignalR/SignalRProvider.js";
7
+ import { useBasePropsStore as R } from "../stores/BasePropsStore.js";
8
+ import { useEnvironmentStore as F } from "../stores/EnvironmentStore.js";
9
+ var Z = class extends k {
10
+ constructor(e = {}) {
11
+ super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
12
+ }
13
+ #e;
14
+ build(e, t, s) {
15
+ const i = t.queryKey, r = t.queryHash ?? N(i, t);
16
+ let n = this.get(r);
17
+ return n || (n = new x({
18
+ client: e,
19
+ queryKey: i,
20
+ queryHash: r,
21
+ options: e.defaultQueryOptions(t),
22
+ state: s,
23
+ defaultOptions: e.getQueryDefaults(i)
24
+ }), this.add(n)), n;
25
+ }
26
+ add(e) {
27
+ this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
28
+ type: "added",
29
+ query: e
30
+ }));
31
+ }
32
+ remove(e) {
33
+ const t = this.#e.get(e.queryHash);
34
+ t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({ type: "removed", query: e }));
35
+ }
36
+ clear() {
37
+ u.batch(() => {
38
+ this.getAll().forEach((e) => {
39
+ this.remove(e);
40
+ });
41
+ });
42
+ }
43
+ get(e) {
44
+ return this.#e.get(e);
45
+ }
46
+ getAll() {
47
+ return [...this.#e.values()];
48
+ }
49
+ find(e) {
50
+ const t = { exact: !0, ...e };
51
+ return this.getAll().find(
52
+ (s) => M(t, s)
53
+ );
54
+ }
55
+ findAll(e = {}) {
56
+ const t = this.getAll();
57
+ return Object.keys(e).length > 0 ? t.filter((s) => M(e, s)) : t;
58
+ }
59
+ notify(e) {
60
+ u.batch(() => {
61
+ this.listeners.forEach((t) => {
62
+ t(e);
63
+ });
64
+ });
65
+ }
66
+ onFocus() {
67
+ u.batch(() => {
68
+ this.getAll().forEach((e) => {
69
+ e.onFocus();
70
+ });
71
+ });
72
+ }
73
+ onOnline() {
74
+ u.batch(() => {
75
+ this.getAll().forEach((e) => {
76
+ e.onOnline();
77
+ });
78
+ });
79
+ }
80
+ }, ee = class extends H {
81
+ #e;
82
+ #t;
83
+ #s;
84
+ constructor(e) {
85
+ super(), this.mutationId = e.mutationId, this.#t = e.mutationCache, this.#e = [], this.state = e.state || te(), this.setOptions(e.options), this.scheduleGc();
86
+ }
87
+ setOptions(e) {
88
+ this.options = e, this.updateGcTime(this.options.gcTime);
89
+ }
90
+ get meta() {
91
+ return this.options.meta;
92
+ }
93
+ addObserver(e) {
94
+ this.#e.includes(e) || (this.#e.push(e), this.clearGcTimeout(), this.#t.notify({
95
+ type: "observerAdded",
96
+ mutation: this,
97
+ observer: e
98
+ }));
99
+ }
100
+ removeObserver(e) {
101
+ this.#e = this.#e.filter((t) => t !== e), this.scheduleGc(), this.#t.notify({
102
+ type: "observerRemoved",
103
+ mutation: this,
104
+ observer: e
105
+ });
106
+ }
107
+ optionalRemove() {
108
+ this.#e.length || (this.state.status === "pending" ? this.scheduleGc() : this.#t.remove(this));
109
+ }
110
+ continue() {
111
+ return this.#s?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
112
+ this.execute(this.state.variables);
113
+ }
114
+ async execute(e) {
115
+ this.#s = K({
116
+ fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
117
+ onFail: (i, r) => {
118
+ this.#i({ type: "failed", failureCount: i, error: r });
119
+ },
120
+ onPause: () => {
121
+ this.#i({ type: "pause" });
122
+ },
123
+ onContinue: () => {
124
+ this.#i({ type: "continue" });
125
+ },
126
+ retry: this.options.retry ?? 0,
127
+ retryDelay: this.options.retryDelay,
128
+ networkMode: this.options.networkMode,
129
+ canRun: () => this.#t.canRun(this)
130
+ });
131
+ const t = this.state.status === "pending", s = !this.#s.canStart();
132
+ try {
133
+ if (!t) {
134
+ this.#i({ type: "pending", variables: e, isPaused: s }), await this.#t.config.onMutate?.(
135
+ e,
136
+ this
137
+ );
138
+ const r = await this.options.onMutate?.(e);
139
+ r !== this.state.context && this.#i({
140
+ type: "pending",
141
+ context: r,
142
+ variables: e,
143
+ isPaused: s
144
+ });
145
+ }
146
+ const i = await this.#s.start();
147
+ return await this.#t.config.onSuccess?.(
148
+ i,
149
+ e,
150
+ this.state.context,
151
+ this
152
+ ), await this.options.onSuccess?.(i, e, this.state.context), await this.#t.config.onSettled?.(
153
+ i,
154
+ null,
155
+ this.state.variables,
156
+ this.state.context,
157
+ this
158
+ ), await this.options.onSettled?.(i, null, e, this.state.context), this.#i({ type: "success", data: i }), i;
159
+ } catch (i) {
160
+ try {
161
+ throw await this.#t.config.onError?.(
162
+ i,
163
+ e,
164
+ this.state.context,
165
+ this
166
+ ), await this.options.onError?.(
167
+ i,
168
+ e,
169
+ this.state.context
170
+ ), await this.#t.config.onSettled?.(
171
+ void 0,
172
+ i,
173
+ this.state.variables,
174
+ this.state.context,
175
+ this
176
+ ), await this.options.onSettled?.(
177
+ void 0,
178
+ i,
179
+ e,
180
+ this.state.context
181
+ ), i;
182
+ } finally {
183
+ this.#i({ type: "error", error: i });
184
+ }
185
+ } finally {
186
+ this.#t.runNext(this);
187
+ }
188
+ }
189
+ #i(e) {
190
+ const t = (s) => {
191
+ switch (e.type) {
192
+ case "failed":
193
+ return {
194
+ ...s,
195
+ failureCount: e.failureCount,
196
+ failureReason: e.error
197
+ };
198
+ case "pause":
199
+ return {
200
+ ...s,
201
+ isPaused: !0
202
+ };
203
+ case "continue":
204
+ return {
205
+ ...s,
206
+ isPaused: !1
207
+ };
208
+ case "pending":
209
+ return {
210
+ ...s,
211
+ context: e.context,
212
+ data: void 0,
213
+ failureCount: 0,
214
+ failureReason: null,
215
+ error: null,
216
+ isPaused: e.isPaused,
217
+ status: "pending",
218
+ variables: e.variables,
219
+ submittedAt: Date.now()
220
+ };
221
+ case "success":
222
+ return {
223
+ ...s,
224
+ data: e.data,
225
+ failureCount: 0,
226
+ failureReason: null,
227
+ error: null,
228
+ status: "success",
229
+ isPaused: !1
230
+ };
231
+ case "error":
232
+ return {
233
+ ...s,
234
+ data: void 0,
235
+ error: e.error,
236
+ failureCount: s.failureCount + 1,
237
+ failureReason: e.error,
238
+ isPaused: !1,
239
+ status: "error"
240
+ };
241
+ }
242
+ };
243
+ this.state = t(this.state), u.batch(() => {
244
+ this.#e.forEach((s) => {
245
+ s.onMutationUpdate(e);
246
+ }), this.#t.notify({
247
+ mutation: this,
248
+ type: "updated",
249
+ action: e
250
+ });
251
+ });
252
+ }
253
+ };
254
+ function te() {
255
+ return {
256
+ context: void 0,
257
+ data: void 0,
258
+ error: null,
259
+ failureCount: 0,
260
+ failureReason: null,
261
+ isPaused: !1,
262
+ status: "idle",
263
+ variables: void 0,
264
+ submittedAt: 0
265
+ };
266
+ }
267
+ var se = class extends k {
268
+ constructor(e = {}) {
269
+ super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
270
+ }
271
+ #e;
272
+ #t;
273
+ #s;
274
+ build(e, t, s) {
275
+ const i = new ee({
276
+ mutationCache: this,
277
+ mutationId: ++this.#s,
278
+ options: e.defaultMutationOptions(t),
279
+ state: s
280
+ });
281
+ return this.add(i), i;
282
+ }
283
+ add(e) {
284
+ this.#e.add(e);
285
+ const t = O(e);
286
+ if (typeof t == "string") {
287
+ const s = this.#t.get(t);
288
+ s ? s.push(e) : this.#t.set(t, [e]);
289
+ }
290
+ this.notify({ type: "added", mutation: e });
291
+ }
292
+ remove(e) {
293
+ if (this.#e.delete(e)) {
294
+ const t = O(e);
295
+ if (typeof t == "string") {
296
+ const s = this.#t.get(t);
297
+ if (s)
298
+ if (s.length > 1) {
299
+ const i = s.indexOf(e);
300
+ i !== -1 && s.splice(i, 1);
301
+ } else s[0] === e && this.#t.delete(t);
302
+ }
303
+ }
304
+ this.notify({ type: "removed", mutation: e });
305
+ }
306
+ canRun(e) {
307
+ const t = O(e);
308
+ if (typeof t == "string") {
309
+ const i = this.#t.get(t)?.find(
310
+ (r) => r.state.status === "pending"
311
+ );
312
+ return !i || i === e;
313
+ } else
314
+ return !0;
315
+ }
316
+ runNext(e) {
317
+ const t = O(e);
318
+ return typeof t == "string" ? this.#t.get(t)?.find((i) => i !== e && i.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
319
+ }
320
+ clear() {
321
+ u.batch(() => {
322
+ this.#e.forEach((e) => {
323
+ this.notify({ type: "removed", mutation: e });
324
+ }), this.#e.clear(), this.#t.clear();
325
+ });
326
+ }
327
+ getAll() {
328
+ return Array.from(this.#e);
329
+ }
330
+ find(e) {
331
+ const t = { exact: !0, ...e };
332
+ return this.getAll().find(
333
+ (s) => E(t, s)
334
+ );
335
+ }
336
+ findAll(e = {}) {
337
+ return this.getAll().filter((t) => E(e, t));
338
+ }
339
+ notify(e) {
340
+ u.batch(() => {
341
+ this.listeners.forEach((t) => {
342
+ t(e);
343
+ });
344
+ });
345
+ }
346
+ resumePausedMutations() {
347
+ const e = this.getAll().filter((t) => t.state.isPaused);
348
+ return u.batch(
349
+ () => Promise.all(
350
+ e.map((t) => t.continue().catch(h))
351
+ )
352
+ );
353
+ }
354
+ };
355
+ function O(e) {
356
+ return e.options.scope?.id;
357
+ }
358
+ function T(e) {
359
+ return {
360
+ onFetch: (t, s) => {
361
+ const i = t.options, r = t.fetchOptions?.meta?.fetchMore?.direction, n = t.state.data?.pages || [], d = t.state.data?.pageParams || [];
362
+ let c = { pages: [], pageParams: [] }, f = 0;
363
+ const P = async () => {
364
+ let y = !1;
365
+ const w = (o) => {
366
+ Object.defineProperty(o, "signal", {
367
+ enumerable: !0,
368
+ get: () => (t.signal.aborted ? y = !0 : t.signal.addEventListener("abort", () => {
369
+ y = !0;
370
+ }), t.signal)
371
+ });
372
+ }, a = B(t.options, t.fetchOptions), p = async (o, l, m) => {
373
+ if (y)
374
+ return Promise.reject();
375
+ if (l == null && o.pages.length)
376
+ return Promise.resolve(o);
377
+ const v = {
378
+ client: t.client,
379
+ queryKey: t.queryKey,
380
+ pageParam: l,
381
+ direction: m ? "backward" : "forward",
382
+ meta: t.options.meta
383
+ };
384
+ w(v);
385
+ const _ = await a(
386
+ v
387
+ ), { maxPages: b } = t.options, Q = m ? j : L;
388
+ return {
389
+ pages: Q(o.pages, _, b),
390
+ pageParams: Q(o.pageParams, l, b)
391
+ };
392
+ };
393
+ if (r && n.length) {
394
+ const o = r === "backward", l = o ? ie : I, m = {
395
+ pages: n,
396
+ pageParams: d
397
+ }, v = l(i, m);
398
+ c = await p(m, v, o);
399
+ } else {
400
+ const o = e ?? n.length;
401
+ do {
402
+ const l = f === 0 ? d[0] ?? i.initialPageParam : I(i, c);
403
+ if (f > 0 && l == null)
404
+ break;
405
+ c = await p(c, l), f++;
406
+ } while (f < o);
407
+ }
408
+ return c;
409
+ };
410
+ t.options.persister ? t.fetchFn = () => t.options.persister?.(
411
+ P,
412
+ {
413
+ client: t.client,
414
+ queryKey: t.queryKey,
415
+ meta: t.options.meta,
416
+ signal: t.signal
417
+ },
418
+ s
419
+ ) : t.fetchFn = P;
420
+ }
421
+ };
422
+ }
423
+ function I(e, { pages: t, pageParams: s }) {
424
+ const i = t.length - 1;
425
+ return t.length > 0 ? e.getNextPageParam(
426
+ t[i],
427
+ t,
428
+ s[i],
429
+ s
430
+ ) : void 0;
431
+ }
432
+ function ie(e, { pages: t, pageParams: s }) {
433
+ return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
434
+ }
435
+ var re = class {
436
+ #e;
437
+ #t;
438
+ #s;
439
+ #i;
440
+ #n;
441
+ #r;
442
+ #a;
443
+ #u;
444
+ constructor(e = {}) {
445
+ this.#e = e.queryCache || new Z(), this.#t = e.mutationCache || new se(), this.#s = e.defaultOptions || {}, this.#i = /* @__PURE__ */ new Map(), this.#n = /* @__PURE__ */ new Map(), this.#r = 0;
446
+ }
447
+ mount() {
448
+ this.#r++, this.#r === 1 && (this.#a = U.subscribe(async (e) => {
449
+ e && (await this.resumePausedMutations(), this.#e.onFocus());
450
+ }), this.#u = S.subscribe(async (e) => {
451
+ e && (await this.resumePausedMutations(), this.#e.onOnline());
452
+ }));
453
+ }
454
+ unmount() {
455
+ this.#r--, this.#r === 0 && (this.#a?.(), this.#a = void 0, this.#u?.(), this.#u = void 0);
456
+ }
457
+ isFetching(e) {
458
+ return this.#e.findAll({ ...e, fetchStatus: "fetching" }).length;
459
+ }
460
+ isMutating(e) {
461
+ return this.#t.findAll({ ...e, status: "pending" }).length;
462
+ }
463
+ getQueryData(e) {
464
+ const t = this.defaultQueryOptions({ queryKey: e });
465
+ return this.#e.get(t.queryHash)?.state.data;
466
+ }
467
+ ensureQueryData(e) {
468
+ const t = this.defaultQueryOptions(e), s = this.#e.build(this, t), i = s.state.data;
469
+ return i === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && s.isStaleByTime(D(t.staleTime, s)) && this.prefetchQuery(t), Promise.resolve(i));
470
+ }
471
+ getQueriesData(e) {
472
+ return this.#e.findAll(e).map(({ queryKey: t, state: s }) => {
473
+ const i = s.data;
474
+ return [t, i];
475
+ });
476
+ }
477
+ setQueryData(e, t, s) {
478
+ const i = this.defaultQueryOptions({ queryKey: e }), n = this.#e.get(
479
+ i.queryHash
480
+ )?.state.data, d = G(t, n);
481
+ if (d !== void 0)
482
+ return this.#e.build(this, i).setData(d, { ...s, manual: !0 });
483
+ }
484
+ setQueriesData(e, t, s) {
485
+ return u.batch(
486
+ () => this.#e.findAll(e).map(({ queryKey: i }) => [
487
+ i,
488
+ this.setQueryData(i, t, s)
489
+ ])
490
+ );
491
+ }
492
+ getQueryState(e) {
493
+ const t = this.defaultQueryOptions({ queryKey: e });
494
+ return this.#e.get(
495
+ t.queryHash
496
+ )?.state;
497
+ }
498
+ removeQueries(e) {
499
+ const t = this.#e;
500
+ u.batch(() => {
501
+ t.findAll(e).forEach((s) => {
502
+ t.remove(s);
503
+ });
504
+ });
505
+ }
506
+ resetQueries(e, t) {
507
+ const s = this.#e, i = {
508
+ type: "active",
509
+ ...e
510
+ };
511
+ return u.batch(() => (s.findAll(e).forEach((r) => {
512
+ r.reset();
513
+ }), this.refetchQueries(i, t)));
514
+ }
515
+ cancelQueries(e, t = {}) {
516
+ const s = { revert: !0, ...t }, i = u.batch(
517
+ () => this.#e.findAll(e).map((r) => r.cancel(s))
518
+ );
519
+ return Promise.all(i).then(h).catch(h);
520
+ }
521
+ invalidateQueries(e, t = {}) {
522
+ return u.batch(() => {
523
+ if (this.#e.findAll(e).forEach((i) => {
524
+ i.invalidate();
525
+ }), e?.refetchType === "none")
526
+ return Promise.resolve();
527
+ const s = {
528
+ ...e,
529
+ type: e?.refetchType ?? e?.type ?? "active"
530
+ };
531
+ return this.refetchQueries(s, t);
532
+ });
533
+ }
534
+ refetchQueries(e, t = {}) {
535
+ const s = {
536
+ ...t,
537
+ cancelRefetch: t.cancelRefetch ?? !0
538
+ }, i = u.batch(
539
+ () => this.#e.findAll(e).filter((r) => !r.isDisabled()).map((r) => {
540
+ let n = r.fetch(void 0, s);
541
+ return s.throwOnError || (n = n.catch(h)), r.state.fetchStatus === "paused" ? Promise.resolve() : n;
542
+ })
543
+ );
544
+ return Promise.all(i).then(h);
545
+ }
546
+ fetchQuery(e) {
547
+ const t = this.defaultQueryOptions(e);
548
+ t.retry === void 0 && (t.retry = !1);
549
+ const s = this.#e.build(this, t);
550
+ return s.isStaleByTime(
551
+ D(t.staleTime, s)
552
+ ) ? s.fetch(t) : Promise.resolve(s.state.data);
553
+ }
554
+ prefetchQuery(e) {
555
+ return this.fetchQuery(e).then(h).catch(h);
556
+ }
557
+ fetchInfiniteQuery(e) {
558
+ return e.behavior = T(e.pages), this.fetchQuery(e);
559
+ }
560
+ prefetchInfiniteQuery(e) {
561
+ return this.fetchInfiniteQuery(e).then(h).catch(h);
562
+ }
563
+ ensureInfiniteQueryData(e) {
564
+ return e.behavior = T(e.pages), this.ensureQueryData(e);
565
+ }
566
+ resumePausedMutations() {
567
+ return S.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
568
+ }
569
+ getQueryCache() {
570
+ return this.#e;
571
+ }
572
+ getMutationCache() {
573
+ return this.#t;
574
+ }
575
+ getDefaultOptions() {
576
+ return this.#s;
577
+ }
578
+ setDefaultOptions(e) {
579
+ this.#s = e;
580
+ }
581
+ setQueryDefaults(e, t) {
582
+ this.#i.set(A(e), {
583
+ queryKey: e,
584
+ defaultOptions: t
585
+ });
586
+ }
587
+ getQueryDefaults(e) {
588
+ const t = [...this.#i.values()], s = {};
589
+ return t.forEach((i) => {
590
+ C(e, i.queryKey) && Object.assign(s, i.defaultOptions);
591
+ }), s;
592
+ }
593
+ setMutationDefaults(e, t) {
594
+ this.#n.set(A(e), {
595
+ mutationKey: e,
596
+ defaultOptions: t
597
+ });
598
+ }
599
+ getMutationDefaults(e) {
600
+ const t = [...this.#n.values()];
601
+ let s = {};
602
+ return t.forEach((i) => {
603
+ C(e, i.mutationKey) && (s = { ...s, ...i.defaultOptions });
604
+ }), s;
605
+ }
606
+ defaultQueryOptions(e) {
607
+ if (e._defaulted)
608
+ return e;
609
+ const t = {
610
+ ...this.#s.queries,
611
+ ...this.getQueryDefaults(e.queryKey),
612
+ ...e,
613
+ _defaulted: !0
614
+ };
615
+ return t.queryHash || (t.queryHash = N(
616
+ t.queryKey,
617
+ t
618
+ )), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === V && (t.enabled = !1), t;
619
+ }
620
+ defaultMutationOptions(e) {
621
+ return e?._defaulted ? e : {
622
+ ...this.#s.mutations,
623
+ ...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
624
+ ...e,
625
+ _defaulted: !0
626
+ };
627
+ }
628
+ clear() {
629
+ this.#e.clear(), this.#t.clear();
630
+ }
631
+ };
632
+ const ne = new re({
633
+ defaultOptions: {
634
+ mutations: {
635
+ retry: !1
636
+ },
637
+ queries: {
638
+ refetchOnWindowFocus: !1,
639
+ gcTime: 1e3 * 60 * 60 * 24,
640
+ // 24 hours
641
+ staleTime: 60 * 1e3,
642
+ // 60 seconds
643
+ retry: !1
644
+ }
645
+ }
646
+ }), ge = ({
647
+ props: e,
648
+ routes: t,
649
+ env: s = void 0,
650
+ useSignalR: i = !1,
651
+ queryClient: r = ne
652
+ }) => {
653
+ const n = R((a) => a.setBaseProps), d = R((a) => a.modulePermissionToken), c = F((a) => a.setEnvironment), f = F((a) => a.addEnvironment), [P, y] = $(!1);
654
+ q(() => {
655
+ const a = oe();
656
+ if (y(!a), a && c(a), !s) return;
657
+ console.log(s);
658
+ const p = s[a?.ENVIRONMENT];
659
+ p && f(p);
660
+ }, [f, s, c]), q(() => {
661
+ y(!ae(e)), n(e);
662
+ }, [
663
+ e.currentLanguage,
664
+ e.currentLanguageId,
665
+ e.modulePermissionToken,
666
+ e.organizationId,
667
+ e.currentNavigationPath,
668
+ e.sourcePath
669
+ ]);
670
+ const w = z([
671
+ {
672
+ path: e.basePath,
673
+ children: t
674
+ }
675
+ ]);
676
+ return P ? /* @__PURE__ */ g("div", { children: "TODO: Show fancy error" }) : d ? /* @__PURE__ */ g(W, { client: r, children: /* @__PURE__ */ g(J, { enabled: i, children: /* @__PURE__ */ g(X, { router: w }) }) }) : /* @__PURE__ */ g("div", { children: "TODO: Show fancy Loadingspinner" });
677
+ }, ae = (e) => Y.every((t) => ue(t, e)), ue = (e, t) => {
678
+ if (!t[e]) {
679
+ if (t.throwError)
680
+ return t.throwError(`Missing required prop: ${e}`, 404), !1;
681
+ throw new Error(`Missing required prop: ${e}`);
682
+ }
683
+ return !0;
684
+ }, oe = () => {
685
+ const e = window.__env__;
686
+ if (e && e.COMMON_API && e.MODULE_AUTH_API && e.API_PREFIX && e.ENVIRONMENT)
687
+ return e;
688
+ };
689
+ export {
690
+ ge as ModuleBase
691
+ };