chizu 0.2.2 → 0.2.4

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/chizu.js CHANGED
@@ -1,1483 +1,207 @@
1
- var Yn = Object.defineProperty;
2
- var ur = (e) => {
3
- throw TypeError(e);
1
+ var I = Object.defineProperty;
2
+ var D = (t) => {
3
+ throw TypeError(t);
4
4
  };
5
- var Xn = (e, t, r) => t in e ? Yn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
6
- var Ee = (e, t, r) => Xn(e, typeof t != "symbol" ? t + "" : t, r), sr = (e, t, r) => t.has(e) || ur("Cannot " + r);
7
- var Pe = (e, t, r) => (sr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), xe = (e, t, r) => t.has(e) ? ur("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), Oe = (e, t, r, n) => (sr(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
8
- import { jsx as fe, jsxs as Zn, Fragment as Qn } from "react/jsx-runtime";
9
- import Ut from "eventemitter3";
10
- import * as f from "react";
11
- const _n = f.createContext({
12
- appEmitter: new Ut()
5
+ var N = (t, e, n) => e in t ? I(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
+ var y = (t, e, n) => N(t, typeof e != "symbol" ? e + "" : e, n), P = (t, e, n) => e.has(t) || D("Cannot " + n);
7
+ var w = (t, e, n) => (P(t, e, "read from private field"), n ? n.call(t) : e.get(t)), b = (t, e, n) => e.has(t) ? D("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), E = (t, e, n, r) => (P(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
8
+ import { jsx as m, Fragment as B } from "react/jsx-runtime";
9
+ import k from "eventemitter3";
10
+ import * as i from "react";
11
+ import { Immer as q } from "immer";
12
+ import p from "lodash/get";
13
+ import M from "traverse";
14
+ import * as d from "react-router-dom";
15
+ const O = i.createContext({
16
+ appEmitter: new k()
13
17
  });
14
- function bn() {
15
- return f.useContext(_n);
18
+ function A() {
19
+ return i.useContext(O);
16
20
  }
17
- function ea(e) {
21
+ function z(t) {
18
22
  return () => {
19
- const t = f.useMemo(
23
+ const e = i.useMemo(
20
24
  () => ({
21
- appEmitter: new Ut()
25
+ appEmitter: new k()
22
26
  }),
23
27
  []
24
28
  );
25
- return /* @__PURE__ */ fe(_n.Provider, { value: t, children: /* @__PURE__ */ fe(e, {}) });
29
+ return /* @__PURE__ */ m(O.Provider, { value: e, children: /* @__PURE__ */ m(t, {}) });
26
30
  };
27
31
  }
28
- function ta(e) {
29
- return e;
30
- }
31
- function ra(e) {
32
- return e;
33
- }
34
- class wn {
35
- constructor(t) {
36
- this.value = t;
32
+ class U {
33
+ constructor(e) {
34
+ this.value = e;
37
35
  }
38
36
  }
39
- class na {
40
- static Draft(t) {
41
- return new wn(t);
37
+ class F {
38
+ static Draft(e) {
39
+ return new U(e);
42
40
  }
43
41
  }
44
- Ee(na, "Op", {
42
+ y(F, "Op", {
45
43
  Add: 1,
46
44
  Remove: 2,
47
45
  Update: 4,
48
46
  Move: 8,
49
47
  Replace: 16
50
48
  });
51
- var X = /* @__PURE__ */ ((e) => (e.Mount = "lifecycle/mount", e.Tree = "lifecycle/tree", e.Derive = "lifecycle/derive", e.Error = "distributed/lifecycle/error", e.Unmount = "lifecycle/unmount", e))(X || {}), Cn = Symbol.for("immer-nothing"), lr = Symbol.for("immer-draftable"), k = Symbol.for("immer-state"), aa = process.env.NODE_ENV !== "production" ? [
52
- // All error codes, starting by 0:
53
- function(e) {
54
- return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
55
- },
56
- function(e) {
57
- return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
58
- },
59
- "This object has been frozen and should not be mutated",
60
- function(e) {
61
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
62
- },
63
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
64
- "Immer forbids circular references",
65
- "The first or second argument to `produce` must be a function",
66
- "The third argument to `produce` must be a function or undefined",
67
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
68
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
69
- function(e) {
70
- return `'current' expects a draft, got: ${e}`;
71
- },
72
- "Object.defineProperty() cannot be used on an Immer draft",
73
- "Object.setPrototypeOf() cannot be used on an Immer draft",
74
- "Immer only supports deleting array indices",
75
- "Immer only supports setting array indices and the 'length' property",
76
- function(e) {
77
- return `'original' expects a draft, got: ${e}`;
78
- }
79
- // Note: if more errors are added, the errorOffset in Patches.ts should be increased
80
- // See Patches.ts for additional errors
81
- ] : [];
82
- function D(e, ...t) {
83
- if (process.env.NODE_ENV !== "production") {
84
- const r = aa[e], n = typeof r == "function" ? r.apply(null, t) : r;
85
- throw new Error(`[Immer] ${n}`);
86
- }
87
- throw new Error(
88
- `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
89
- );
90
- }
91
- var B = Object.getPrototypeOf;
92
- function W(e) {
93
- return !!e && !!e[k];
94
- }
95
- function U(e) {
96
- var t;
97
- return e ? Sn(e) || Array.isArray(e) || !!e[lr] || !!((t = e.constructor) != null && t[lr]) || ve(e) || ge(e) : !1;
98
- }
99
- var ia = Object.prototype.constructor.toString();
100
- function Sn(e) {
101
- if (!e || typeof e != "object")
102
- return !1;
103
- const t = B(e);
104
- if (t === null)
105
- return !0;
106
- const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
107
- return r === Object ? !0 : typeof r == "function" && Function.toString.call(r) === ia;
108
- }
109
- function de(e, t) {
110
- ye(e) === 0 ? Reflect.ownKeys(e).forEach((r) => {
111
- t(r, e[r], e);
112
- }) : e.forEach((r, n) => t(n, r, e));
113
- }
114
- function ye(e) {
115
- const t = e[k];
116
- return t ? t.type_ : Array.isArray(e) ? 1 : ve(e) ? 2 : ge(e) ? 3 : 0;
117
- }
118
- function It(e, t) {
119
- return ye(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
120
- }
121
- function Rn(e, t, r) {
122
- const n = ye(e);
123
- n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
124
- }
125
- function oa(e, t) {
126
- return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
127
- }
128
- function ve(e) {
129
- return e instanceof Map;
130
- }
131
- function ge(e) {
132
- return e instanceof Set;
133
- }
134
- function H(e) {
135
- return e.copy_ || e.base_;
136
- }
137
- function Mt(e, t) {
138
- if (ve(e))
139
- return new Map(e);
140
- if (ge(e))
141
- return new Set(e);
142
- if (Array.isArray(e))
143
- return Array.prototype.slice.call(e);
144
- const r = Sn(e);
145
- if (t === !0 || t === "class_only" && !r) {
146
- const n = Object.getOwnPropertyDescriptors(e);
147
- delete n[k];
148
- let a = Reflect.ownKeys(n);
149
- for (let i = 0; i < a.length; i++) {
150
- const o = a[i], u = n[o];
151
- u.writable === !1 && (u.writable = !0, u.configurable = !0), (u.get || u.set) && (n[o] = {
152
- configurable: !0,
153
- writable: !0,
154
- // could live with !!desc.set as well here...
155
- enumerable: u.enumerable,
156
- value: e[o]
157
- });
158
- }
159
- return Object.create(B(e), n);
160
- } else {
161
- const n = B(e);
162
- if (n !== null && r)
163
- return { ...e };
164
- const a = Object.create(n);
165
- return Object.assign(a, e);
166
- }
167
- }
168
- function Gt(e, t = !1) {
169
- return _e(e) || W(e) || !U(e) || (ye(e) > 1 && (e.set = e.add = e.clear = e.delete = ua), Object.freeze(e), t && Object.entries(e).forEach(([r, n]) => Gt(n, !0))), e;
170
- }
171
- function ua() {
172
- D(2);
173
- }
174
- function _e(e) {
175
- return Object.isFrozen(e);
176
- }
177
- var sa = {};
178
- function G(e) {
179
- const t = sa[e];
180
- return t || D(0, e), t;
181
- }
182
- var Z;
183
- function En() {
184
- return Z;
185
- }
186
- function la(e, t) {
187
- return {
188
- drafts_: [],
189
- parent_: e,
190
- immer_: t,
191
- // Whenever the modified draft contains a draft from another scope, we
192
- // need to prevent auto-freezing so the unowned draft can be finalized.
193
- canAutoFreeze_: !0,
194
- unfinalizedDrafts_: 0
195
- };
196
- }
197
- function cr(e, t) {
198
- t && (G("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
199
- }
200
- function jt(e) {
201
- At(e), e.drafts_.forEach(ca), e.drafts_ = null;
202
- }
203
- function At(e) {
204
- e === Z && (Z = e.parent_);
205
- }
206
- function fr(e) {
207
- return Z = la(Z, e);
208
- }
209
- function ca(e) {
210
- const t = e[k];
211
- t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
212
- }
213
- function dr(e, t) {
214
- t.unfinalizedDrafts_ = t.drafts_.length;
215
- const r = t.drafts_[0];
216
- return e !== void 0 && e !== r ? (r[k].modified_ && (jt(t), D(4)), U(e) && (e = he(t, e), t.parent_ || pe(t, e)), t.patches_ && G("Patches").generateReplacementPatches_(
217
- r[k].base_,
218
- e,
219
- t.patches_,
220
- t.inversePatches_
221
- )) : e = he(t, r, []), jt(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Cn ? e : void 0;
222
- }
223
- function he(e, t, r) {
224
- if (_e(t))
225
- return t;
226
- const n = t[k];
227
- if (!n)
228
- return de(
229
- t,
230
- (a, i) => hr(e, n, t, a, i, r)
231
- ), t;
232
- if (n.scope_ !== e)
233
- return t;
234
- if (!n.modified_)
235
- return pe(e, n.base_, !0), n.base_;
236
- if (!n.finalized_) {
237
- n.finalized_ = !0, n.scope_.unfinalizedDrafts_--;
238
- const a = n.copy_;
239
- let i = a, o = !1;
240
- n.type_ === 3 && (i = new Set(a), a.clear(), o = !0), de(
241
- i,
242
- (u, s) => hr(e, n, a, u, s, r, o)
243
- ), pe(e, a, !1), r && e.patches_ && G("Patches").generatePatches_(
244
- n,
245
- r,
246
- e.patches_,
247
- e.inversePatches_
248
- );
249
- }
250
- return n.copy_;
251
- }
252
- function hr(e, t, r, n, a, i, o) {
253
- if (process.env.NODE_ENV !== "production" && a === r && D(5), W(a)) {
254
- const u = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
255
- !It(t.assigned_, n) ? i.concat(n) : void 0, s = he(e, a, u);
256
- if (Rn(r, n, s), W(s))
257
- e.canAutoFreeze_ = !1;
258
- else
259
- return;
260
- } else o && r.add(a);
261
- if (U(a) && !_e(a)) {
262
- if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
263
- return;
264
- he(e, a), (!t || !t.scope_.parent_) && typeof n != "symbol" && Object.prototype.propertyIsEnumerable.call(r, n) && pe(e, a);
265
- }
266
- }
267
- function pe(e, t, r = !1) {
268
- !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Gt(t, r);
269
- }
270
- function fa(e, t) {
271
- const r = Array.isArray(e), n = {
272
- type_: r ? 1 : 0,
273
- // Track which produce call this is associated with.
274
- scope_: t ? t.scope_ : En(),
275
- // True for both shallow and deep changes.
276
- modified_: !1,
277
- // Used during finalization.
278
- finalized_: !1,
279
- // Track which properties have been assigned (true) or deleted (false).
280
- assigned_: {},
281
- // The parent draft state.
282
- parent_: t,
283
- // The base state.
284
- base_: e,
285
- // The base proxy.
286
- draft_: null,
287
- // set below
288
- // The base copy with any updated values.
289
- copy_: null,
290
- // Called by the `produce` function.
291
- revoke_: null,
292
- isManual_: !1
293
- };
294
- let a = n, i = Bt;
295
- r && (a = [n], i = Q);
296
- const { revoke: o, proxy: u } = Proxy.revocable(a, i);
297
- return n.draft_ = u, n.revoke_ = o, u;
298
- }
299
- var Bt = {
300
- get(e, t) {
301
- if (t === k)
302
- return e;
303
- const r = H(e);
304
- if (!It(r, t))
305
- return da(e, r, t);
306
- const n = r[t];
307
- return e.finalized_ || !U(n) ? n : n === Te(e.base_, t) ? (De(e), e.copy_[t] = Nt(n, e)) : n;
308
- },
309
- has(e, t) {
310
- return t in H(e);
311
- },
312
- ownKeys(e) {
313
- return Reflect.ownKeys(H(e));
314
- },
315
- set(e, t, r) {
316
- const n = Pn(H(e), t);
317
- if (n != null && n.set)
318
- return n.set.call(e.draft_, r), !0;
319
- if (!e.modified_) {
320
- const a = Te(H(e), t), i = a == null ? void 0 : a[k];
321
- if (i && i.base_ === r)
322
- return e.copy_[t] = r, e.assigned_[t] = !1, !0;
323
- if (oa(r, a) && (r !== void 0 || It(e.base_, t)))
324
- return !0;
325
- De(e), Lt(e);
326
- }
327
- return e.copy_[t] === r && // special case: handle new props with value 'undefined'
328
- (r !== void 0 || t in e.copy_) || // special case: NaN
329
- Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
330
- },
331
- deleteProperty(e, t) {
332
- return Te(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, De(e), Lt(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
333
- },
334
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
335
- // the same guarantee in ES5 mode.
336
- getOwnPropertyDescriptor(e, t) {
337
- const r = H(e), n = Reflect.getOwnPropertyDescriptor(r, t);
338
- return n && {
339
- writable: !0,
340
- configurable: e.type_ !== 1 || t !== "length",
341
- enumerable: n.enumerable,
342
- value: r[t]
343
- };
344
- },
345
- defineProperty() {
346
- D(11);
347
- },
348
- getPrototypeOf(e) {
349
- return B(e.base_);
350
- },
351
- setPrototypeOf() {
352
- D(12);
353
- }
354
- }, Q = {};
355
- de(Bt, (e, t) => {
356
- Q[e] = function() {
357
- return arguments[0] = arguments[0][0], t.apply(this, arguments);
358
- };
359
- });
360
- Q.deleteProperty = function(e, t) {
361
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && D(13), Q.set.call(this, e, t, void 0);
362
- };
363
- Q.set = function(e, t, r) {
364
- return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && D(14), Bt.set.call(this, e[0], t, r, e[0]);
365
- };
366
- function Te(e, t) {
367
- const r = e[k];
368
- return (r ? H(r) : e)[t];
369
- }
370
- function da(e, t, r) {
371
- var a;
372
- const n = Pn(t, r);
373
- return n ? "value" in n ? n.value : (
374
- // This is a very special case, if the prop is a getter defined by the
375
- // prototype, we should invoke it with the draft as context!
376
- (a = n.get) == null ? void 0 : a.call(e.draft_)
377
- ) : void 0;
378
- }
379
- function Pn(e, t) {
380
- if (!(t in e))
381
- return;
382
- let r = B(e);
383
- for (; r; ) {
384
- const n = Object.getOwnPropertyDescriptor(r, t);
385
- if (n)
386
- return n;
387
- r = B(r);
388
- }
389
- }
390
- function Lt(e) {
391
- e.modified_ || (e.modified_ = !0, e.parent_ && Lt(e.parent_));
392
- }
393
- function De(e) {
394
- e.copy_ || (e.copy_ = Mt(
395
- e.base_,
396
- e.scope_.immer_.useStrictShallowCopy_
397
- ));
398
- }
399
- var xn = class {
400
- constructor(e) {
401
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, r, n) => {
402
- if (typeof t == "function" && typeof r != "function") {
403
- const i = r;
404
- r = t;
405
- const o = this;
406
- return function(s = i, ...l) {
407
- return o.produce(s, (m) => r.call(this, m, ...l));
408
- };
409
- }
410
- typeof r != "function" && D(6), n !== void 0 && typeof n != "function" && D(7);
411
- let a;
412
- if (U(t)) {
413
- const i = fr(this), o = Nt(t, void 0);
414
- let u = !0;
415
- try {
416
- a = r(o), u = !1;
417
- } finally {
418
- u ? jt(i) : At(i);
419
- }
420
- return cr(i, n), dr(a, i);
421
- } else if (!t || typeof t != "object") {
422
- if (a = r(t), a === void 0 && (a = t), a === Cn && (a = void 0), this.autoFreeze_ && Gt(a, !0), n) {
423
- const i = [], o = [];
424
- G("Patches").generateReplacementPatches_(t, a, i, o), n(i, o);
425
- }
426
- return a;
427
- } else
428
- D(1, t);
429
- }, this.produceWithPatches = (t, r) => {
430
- if (typeof t == "function")
431
- return (o, ...u) => this.produceWithPatches(o, (s) => t(s, ...u));
432
- let n, a;
433
- return [this.produce(t, r, (o, u) => {
434
- n = o, a = u;
435
- }), n, a];
436
- }, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
437
- }
438
- createDraft(e) {
439
- U(e) || D(8), W(e) && (e = ha(e));
440
- const t = fr(this), r = Nt(e, void 0);
441
- return r[k].isManual_ = !0, At(t), r;
442
- }
443
- finishDraft(e, t) {
444
- const r = e && e[k];
445
- (!r || !r.isManual_) && D(9);
446
- const { scope_: n } = r;
447
- return cr(n, t), dr(void 0, n);
448
- }
449
- /**
450
- * Pass true to automatically freeze all copies created by Immer.
451
- *
452
- * By default, auto-freezing is enabled.
453
- */
454
- setAutoFreeze(e) {
455
- this.autoFreeze_ = e;
456
- }
457
- /**
458
- * Pass true to enable strict shallow copy.
459
- *
460
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
461
- */
462
- setUseStrictShallowCopy(e) {
463
- this.useStrictShallowCopy_ = e;
464
- }
465
- applyPatches(e, t) {
466
- let r;
467
- for (r = t.length - 1; r >= 0; r--) {
468
- const a = t[r];
469
- if (a.path.length === 0 && a.op === "replace") {
470
- e = a.value;
471
- break;
472
- }
473
- }
474
- r > -1 && (t = t.slice(r + 1));
475
- const n = G("Patches").applyPatches_;
476
- return W(e) ? n(e, t) : this.produce(
477
- e,
478
- (a) => n(a, t)
479
- );
480
- }
481
- };
482
- function Nt(e, t) {
483
- const r = ve(e) ? G("MapSet").proxyMap_(e, t) : ge(e) ? G("MapSet").proxySet_(e, t) : fa(e, t);
484
- return (t ? t.scope_ : En()).drafts_.push(r), r;
485
- }
486
- function ha(e) {
487
- return W(e) || D(10, e), On(e);
488
- }
489
- function On(e) {
490
- if (!U(e) || _e(e))
491
- return e;
492
- const t = e[k];
493
- let r;
494
- if (t) {
495
- if (!t.modified_)
496
- return t.base_;
497
- t.finalized_ = !0, r = Mt(e, t.scope_.immer_.useStrictShallowCopy_);
498
- } else
499
- r = Mt(e, !0);
500
- return de(r, (n, a) => {
501
- Rn(r, n, On(a));
502
- }), t && (t.finalized_ = !1), r;
503
- }
504
- var I = new xn();
505
- I.produce;
506
- I.produceWithPatches.bind(
507
- I
508
- );
509
- I.setAutoFreeze.bind(I);
510
- I.setUseStrictShallowCopy.bind(I);
511
- I.applyPatches.bind(I);
512
- I.createDraft.bind(I);
513
- I.finishDraft.bind(I);
514
- const q = {
515
- immer: new xn(),
49
+ var h = /* @__PURE__ */ ((t) => (t.Mount = "lifecycle/mount", t.Node = "lifecycle/node", t.Derive = "lifecycle/derive", t.Error = "distributed/lifecycle/error", t.Unmount = "lifecycle/unmount", t))(h || {});
50
+ const l = {
51
+ immer: new q(),
516
52
  annotations: Symbol("annotations")
517
53
  };
518
- q.immer.setAutoFreeze(!1);
519
- class Ft {
520
- constructor(t, r, n = null) {
521
- Ee(this, "process");
522
- this.value = t, this.operations = r, this.field = n, this.process = null;
523
- }
524
- attach(t) {
525
- return this.process = t, this;
526
- }
527
- }
528
- function pa(e, t = []) {
529
- return new Ft(e, t);
530
- }
531
- var ue = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
532
- function Tn(e) {
533
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
534
- }
535
- var qe, pr;
536
- function Wt() {
537
- if (pr) return qe;
538
- pr = 1;
539
- var e = Array.isArray;
540
- return qe = e, qe;
541
- }
542
- var ke, mr;
543
- function ma() {
544
- if (mr) return ke;
545
- mr = 1;
546
- var e = typeof ue == "object" && ue && ue.Object === Object && ue;
547
- return ke = e, ke;
548
- }
549
- var Ie, yr;
550
- function Kt() {
551
- if (yr) return Ie;
552
- yr = 1;
553
- var e = ma(), t = typeof self == "object" && self && self.Object === Object && self, r = e || t || Function("return this")();
554
- return Ie = r, Ie;
555
- }
556
- var Me, vr;
557
- function Vt() {
558
- if (vr) return Me;
559
- vr = 1;
560
- var e = Kt(), t = e.Symbol;
561
- return Me = t, Me;
562
- }
563
- var je, gr;
564
- function ya() {
565
- if (gr) return je;
566
- gr = 1;
567
- var e = Vt(), t = Object.prototype, r = t.hasOwnProperty, n = t.toString, a = e ? e.toStringTag : void 0;
568
- function i(o) {
569
- var u = r.call(o, a), s = o[a];
570
- try {
571
- o[a] = void 0;
572
- var l = !0;
573
- } catch {
574
- }
575
- var m = n.call(o);
576
- return l && (u ? o[a] = s : delete o[a]), m;
577
- }
578
- return je = i, je;
579
- }
580
- var Ae, _r;
581
- function va() {
582
- if (_r) return Ae;
583
- _r = 1;
584
- var e = Object.prototype, t = e.toString;
585
- function r(n) {
586
- return t.call(n);
587
- }
588
- return Ae = r, Ae;
589
- }
590
- var Le, br;
591
- function Dn() {
592
- if (br) return Le;
593
- br = 1;
594
- var e = Vt(), t = ya(), r = va(), n = "[object Null]", a = "[object Undefined]", i = e ? e.toStringTag : void 0;
595
- function o(u) {
596
- return u == null ? u === void 0 ? a : n : i && i in Object(u) ? t(u) : r(u);
597
- }
598
- return Le = o, Le;
599
- }
600
- var Ne, wr;
601
- function ga() {
602
- if (wr) return Ne;
603
- wr = 1;
604
- function e(t) {
605
- return t != null && typeof t == "object";
606
- }
607
- return Ne = e, Ne;
608
- }
609
- var Fe, Cr;
610
- function Jt() {
611
- if (Cr) return Fe;
612
- Cr = 1;
613
- var e = Dn(), t = ga(), r = "[object Symbol]";
614
- function n(a) {
615
- return typeof a == "symbol" || t(a) && e(a) == r;
616
- }
617
- return Fe = n, Fe;
618
- }
619
- var $e, Sr;
620
- function _a() {
621
- if (Sr) return $e;
622
- Sr = 1;
623
- var e = Wt(), t = Jt(), r = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, n = /^\w*$/;
624
- function a(i, o) {
625
- if (e(i))
626
- return !1;
627
- var u = typeof i;
628
- return u == "number" || u == "symbol" || u == "boolean" || i == null || t(i) ? !0 : n.test(i) || !r.test(i) || o != null && i in Object(o);
629
- }
630
- return $e = a, $e;
631
- }
632
- var ze, Rr;
633
- function qn() {
634
- if (Rr) return ze;
635
- Rr = 1;
636
- function e(t) {
637
- var r = typeof t;
638
- return t != null && (r == "object" || r == "function");
639
- }
640
- return ze = e, ze;
641
- }
642
- var He, Er;
643
- function ba() {
644
- if (Er) return He;
645
- Er = 1;
646
- var e = Dn(), t = qn(), r = "[object AsyncFunction]", n = "[object Function]", a = "[object GeneratorFunction]", i = "[object Proxy]";
647
- function o(u) {
648
- if (!t(u))
649
- return !1;
650
- var s = e(u);
651
- return s == n || s == a || s == r || s == i;
652
- }
653
- return He = o, He;
654
- }
655
- var Ue, Pr;
656
- function wa() {
657
- if (Pr) return Ue;
658
- Pr = 1;
659
- var e = Kt(), t = e["__core-js_shared__"];
660
- return Ue = t, Ue;
661
- }
662
- var Ge, xr;
663
- function Ca() {
664
- if (xr) return Ge;
665
- xr = 1;
666
- var e = wa(), t = function() {
667
- var n = /[^.]+$/.exec(e && e.keys && e.keys.IE_PROTO || "");
668
- return n ? "Symbol(src)_1." + n : "";
669
- }();
670
- function r(n) {
671
- return !!t && t in n;
672
- }
673
- return Ge = r, Ge;
674
- }
675
- var Be, Or;
676
- function Sa() {
677
- if (Or) return Be;
678
- Or = 1;
679
- var e = Function.prototype, t = e.toString;
680
- function r(n) {
681
- if (n != null) {
682
- try {
683
- return t.call(n);
684
- } catch {
685
- }
686
- try {
687
- return n + "";
688
- } catch {
689
- }
690
- }
691
- return "";
692
- }
693
- return Be = r, Be;
694
- }
695
- var We, Tr;
696
- function Ra() {
697
- if (Tr) return We;
698
- Tr = 1;
699
- var e = ba(), t = Ca(), r = qn(), n = Sa(), a = /[\\^$.*+?()[\]{}|]/g, i = /^\[object .+?Constructor\]$/, o = Function.prototype, u = Object.prototype, s = o.toString, l = u.hasOwnProperty, m = RegExp(
700
- "^" + s.call(l).replace(a, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
701
- );
702
- function v(h) {
703
- if (!r(h) || t(h))
704
- return !1;
705
- var _ = e(h) ? m : i;
706
- return _.test(n(h));
707
- }
708
- return We = v, We;
709
- }
710
- var Ke, Dr;
711
- function Ea() {
712
- if (Dr) return Ke;
713
- Dr = 1;
714
- function e(t, r) {
715
- return t == null ? void 0 : t[r];
716
- }
717
- return Ke = e, Ke;
718
- }
719
- var Ve, qr;
720
- function kn() {
721
- if (qr) return Ve;
722
- qr = 1;
723
- var e = Ra(), t = Ea();
724
- function r(n, a) {
725
- var i = t(n, a);
726
- return e(i) ? i : void 0;
727
- }
728
- return Ve = r, Ve;
729
- }
730
- var Je, kr;
731
- function be() {
732
- if (kr) return Je;
733
- kr = 1;
734
- var e = kn(), t = e(Object, "create");
735
- return Je = t, Je;
736
- }
737
- var Ye, Ir;
738
- function Pa() {
739
- if (Ir) return Ye;
740
- Ir = 1;
741
- var e = be();
742
- function t() {
743
- this.__data__ = e ? e(null) : {}, this.size = 0;
744
- }
745
- return Ye = t, Ye;
746
- }
747
- var Xe, Mr;
748
- function xa() {
749
- if (Mr) return Xe;
750
- Mr = 1;
751
- function e(t) {
752
- var r = this.has(t) && delete this.__data__[t];
753
- return this.size -= r ? 1 : 0, r;
754
- }
755
- return Xe = e, Xe;
756
- }
757
- var Ze, jr;
758
- function Oa() {
759
- if (jr) return Ze;
760
- jr = 1;
761
- var e = be(), t = "__lodash_hash_undefined__", r = Object.prototype, n = r.hasOwnProperty;
762
- function a(i) {
763
- var o = this.__data__;
764
- if (e) {
765
- var u = o[i];
766
- return u === t ? void 0 : u;
767
- }
768
- return n.call(o, i) ? o[i] : void 0;
769
- }
770
- return Ze = a, Ze;
771
- }
772
- var Qe, Ar;
773
- function Ta() {
774
- if (Ar) return Qe;
775
- Ar = 1;
776
- var e = be(), t = Object.prototype, r = t.hasOwnProperty;
777
- function n(a) {
778
- var i = this.__data__;
779
- return e ? i[a] !== void 0 : r.call(i, a);
780
- }
781
- return Qe = n, Qe;
782
- }
783
- var et, Lr;
784
- function Da() {
785
- if (Lr) return et;
786
- Lr = 1;
787
- var e = be(), t = "__lodash_hash_undefined__";
788
- function r(n, a) {
789
- var i = this.__data__;
790
- return this.size += this.has(n) ? 0 : 1, i[n] = e && a === void 0 ? t : a, this;
791
- }
792
- return et = r, et;
793
- }
794
- var tt, Nr;
795
- function qa() {
796
- if (Nr) return tt;
797
- Nr = 1;
798
- var e = Pa(), t = xa(), r = Oa(), n = Ta(), a = Da();
799
- function i(o) {
800
- var u = -1, s = o == null ? 0 : o.length;
801
- for (this.clear(); ++u < s; ) {
802
- var l = o[u];
803
- this.set(l[0], l[1]);
804
- }
805
- }
806
- return i.prototype.clear = e, i.prototype.delete = t, i.prototype.get = r, i.prototype.has = n, i.prototype.set = a, tt = i, tt;
807
- }
808
- var rt, Fr;
809
- function ka() {
810
- if (Fr) return rt;
811
- Fr = 1;
812
- function e() {
813
- this.__data__ = [], this.size = 0;
814
- }
815
- return rt = e, rt;
816
- }
817
- var nt, $r;
818
- function Ia() {
819
- if ($r) return nt;
820
- $r = 1;
821
- function e(t, r) {
822
- return t === r || t !== t && r !== r;
823
- }
824
- return nt = e, nt;
825
- }
826
- var at, zr;
827
- function we() {
828
- if (zr) return at;
829
- zr = 1;
830
- var e = Ia();
831
- function t(r, n) {
832
- for (var a = r.length; a--; )
833
- if (e(r[a][0], n))
834
- return a;
835
- return -1;
836
- }
837
- return at = t, at;
838
- }
839
- var it, Hr;
840
- function Ma() {
841
- if (Hr) return it;
842
- Hr = 1;
843
- var e = we(), t = Array.prototype, r = t.splice;
844
- function n(a) {
845
- var i = this.__data__, o = e(i, a);
846
- if (o < 0)
847
- return !1;
848
- var u = i.length - 1;
849
- return o == u ? i.pop() : r.call(i, o, 1), --this.size, !0;
850
- }
851
- return it = n, it;
852
- }
853
- var ot, Ur;
854
- function ja() {
855
- if (Ur) return ot;
856
- Ur = 1;
857
- var e = we();
858
- function t(r) {
859
- var n = this.__data__, a = e(n, r);
860
- return a < 0 ? void 0 : n[a][1];
861
- }
862
- return ot = t, ot;
863
- }
864
- var ut, Gr;
865
- function Aa() {
866
- if (Gr) return ut;
867
- Gr = 1;
868
- var e = we();
869
- function t(r) {
870
- return e(this.__data__, r) > -1;
871
- }
872
- return ut = t, ut;
873
- }
874
- var st, Br;
875
- function La() {
876
- if (Br) return st;
877
- Br = 1;
878
- var e = we();
879
- function t(r, n) {
880
- var a = this.__data__, i = e(a, r);
881
- return i < 0 ? (++this.size, a.push([r, n])) : a[i][1] = n, this;
882
- }
883
- return st = t, st;
884
- }
885
- var lt, Wr;
886
- function Na() {
887
- if (Wr) return lt;
888
- Wr = 1;
889
- var e = ka(), t = Ma(), r = ja(), n = Aa(), a = La();
890
- function i(o) {
891
- var u = -1, s = o == null ? 0 : o.length;
892
- for (this.clear(); ++u < s; ) {
893
- var l = o[u];
894
- this.set(l[0], l[1]);
895
- }
896
- }
897
- return i.prototype.clear = e, i.prototype.delete = t, i.prototype.get = r, i.prototype.has = n, i.prototype.set = a, lt = i, lt;
898
- }
899
- var ct, Kr;
900
- function Fa() {
901
- if (Kr) return ct;
902
- Kr = 1;
903
- var e = kn(), t = Kt(), r = e(t, "Map");
904
- return ct = r, ct;
905
- }
906
- var ft, Vr;
907
- function $a() {
908
- if (Vr) return ft;
909
- Vr = 1;
910
- var e = qa(), t = Na(), r = Fa();
911
- function n() {
912
- this.size = 0, this.__data__ = {
913
- hash: new e(),
914
- map: new (r || t)(),
915
- string: new e()
916
- };
54
+ l.immer.setAutoFreeze(!1);
55
+ class S {
56
+ constructor(e, n, r = null) {
57
+ y(this, "process");
58
+ this.value = e, this.operations = n, this.field = r, this.process = null;
917
59
  }
918
- return ft = n, ft;
919
- }
920
- var dt, Jr;
921
- function za() {
922
- if (Jr) return dt;
923
- Jr = 1;
924
- function e(t) {
925
- var r = typeof t;
926
- return r == "string" || r == "number" || r == "symbol" || r == "boolean" ? t !== "__proto__" : t === null;
60
+ attach(e) {
61
+ return this.process = e, this;
927
62
  }
928
- return dt = e, dt;
929
63
  }
930
- var ht, Yr;
931
- function Ce() {
932
- if (Yr) return ht;
933
- Yr = 1;
934
- var e = za();
935
- function t(r, n) {
936
- var a = r.__data__;
937
- return e(n) ? a[typeof n == "string" ? "string" : "hash"] : a.map;
938
- }
939
- return ht = t, ht;
64
+ function J(t, e = []) {
65
+ return new S(t, e);
940
66
  }
941
- var pt, Xr;
942
- function Ha() {
943
- if (Xr) return pt;
944
- Xr = 1;
945
- var e = Ce();
946
- function t(r) {
947
- var n = e(this, r).delete(r);
948
- return this.size -= n ? 1 : 0, n;
949
- }
950
- return pt = t, pt;
951
- }
952
- var mt, Zr;
953
- function Ua() {
954
- if (Zr) return mt;
955
- Zr = 1;
956
- var e = Ce();
957
- function t(r) {
958
- return e(this, r).get(r);
959
- }
960
- return mt = t, mt;
961
- }
962
- var yt, Qr;
963
- function Ga() {
964
- if (Qr) return yt;
965
- Qr = 1;
966
- var e = Ce();
967
- function t(r) {
968
- return e(this, r).has(r);
969
- }
970
- return yt = t, yt;
971
- }
972
- var vt, en;
973
- function Ba() {
974
- if (en) return vt;
975
- en = 1;
976
- var e = Ce();
977
- function t(r, n) {
978
- var a = e(this, r), i = a.size;
979
- return a.set(r, n), this.size += a.size == i ? 0 : 1, this;
980
- }
981
- return vt = t, vt;
982
- }
983
- var gt, tn;
984
- function Wa() {
985
- if (tn) return gt;
986
- tn = 1;
987
- var e = $a(), t = Ha(), r = Ua(), n = Ga(), a = Ba();
988
- function i(o) {
989
- var u = -1, s = o == null ? 0 : o.length;
990
- for (this.clear(); ++u < s; ) {
991
- var l = o[u];
992
- this.set(l[0], l[1]);
993
- }
994
- }
995
- return i.prototype.clear = e, i.prototype.delete = t, i.prototype.get = r, i.prototype.has = n, i.prototype.set = a, gt = i, gt;
996
- }
997
- var _t, rn;
998
- function Ka() {
999
- if (rn) return _t;
1000
- rn = 1;
1001
- var e = Wa(), t = "Expected a function";
1002
- function r(n, a) {
1003
- if (typeof n != "function" || a != null && typeof a != "function")
1004
- throw new TypeError(t);
1005
- var i = function() {
1006
- var o = arguments, u = a ? a.apply(this, o) : o[0], s = i.cache;
1007
- if (s.has(u))
1008
- return s.get(u);
1009
- var l = n.apply(this, o);
1010
- return i.cache = s.set(u, l) || s, l;
1011
- };
1012
- return i.cache = new (r.Cache || e)(), i;
1013
- }
1014
- return r.Cache = e, _t = r, _t;
1015
- }
1016
- var bt, nn;
1017
- function Va() {
1018
- if (nn) return bt;
1019
- nn = 1;
1020
- var e = Ka(), t = 500;
1021
- function r(n) {
1022
- var a = e(n, function(o) {
1023
- return i.size === t && i.clear(), o;
1024
- }), i = a.cache;
1025
- return a;
1026
- }
1027
- return bt = r, bt;
1028
- }
1029
- var wt, an;
1030
- function Ja() {
1031
- if (an) return wt;
1032
- an = 1;
1033
- var e = Va(), t = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, r = /\\(\\)?/g, n = e(function(a) {
1034
- var i = [];
1035
- return a.charCodeAt(0) === 46 && i.push(""), a.replace(t, function(o, u, s, l) {
1036
- i.push(s ? l.replace(r, "$1") : u || o);
1037
- }), i;
1038
- });
1039
- return wt = n, wt;
1040
- }
1041
- var Ct, on;
1042
- function Ya() {
1043
- if (on) return Ct;
1044
- on = 1;
1045
- function e(t, r) {
1046
- for (var n = -1, a = t == null ? 0 : t.length, i = Array(a); ++n < a; )
1047
- i[n] = r(t[n], n, t);
1048
- return i;
1049
- }
1050
- return Ct = e, Ct;
1051
- }
1052
- var St, un;
1053
- function Xa() {
1054
- if (un) return St;
1055
- un = 1;
1056
- var e = Vt(), t = Ya(), r = Wt(), n = Jt(), a = e ? e.prototype : void 0, i = a ? a.toString : void 0;
1057
- function o(u) {
1058
- if (typeof u == "string")
1059
- return u;
1060
- if (r(u))
1061
- return t(u, o) + "";
1062
- if (n(u))
1063
- return i ? i.call(u) : "";
1064
- var s = u + "";
1065
- return s == "0" && 1 / u == -1 / 0 ? "-0" : s;
1066
- }
1067
- return St = o, St;
1068
- }
1069
- var Rt, sn;
1070
- function Za() {
1071
- if (sn) return Rt;
1072
- sn = 1;
1073
- var e = Xa();
1074
- function t(r) {
1075
- return r == null ? "" : e(r);
1076
- }
1077
- return Rt = t, Rt;
1078
- }
1079
- var Et, ln;
1080
- function Qa() {
1081
- if (ln) return Et;
1082
- ln = 1;
1083
- var e = Wt(), t = _a(), r = Ja(), n = Za();
1084
- function a(i, o) {
1085
- return e(i) ? i : t(i, o) ? [i] : r(n(i));
1086
- }
1087
- return Et = a, Et;
1088
- }
1089
- var Pt, cn;
1090
- function ei() {
1091
- if (cn) return Pt;
1092
- cn = 1;
1093
- var e = Jt();
1094
- function t(r) {
1095
- if (typeof r == "string" || e(r))
1096
- return r;
1097
- var n = r + "";
1098
- return n == "0" && 1 / r == -1 / 0 ? "-0" : n;
1099
- }
1100
- return Pt = t, Pt;
1101
- }
1102
- var xt, fn;
1103
- function ti() {
1104
- if (fn) return xt;
1105
- fn = 1;
1106
- var e = Qa(), t = ei();
1107
- function r(n, a) {
1108
- a = e(a, n);
1109
- for (var i = 0, o = a.length; n != null && i < o; )
1110
- n = n[t(a[i++])];
1111
- return i && i == o ? n : void 0;
1112
- }
1113
- return xt = r, xt;
1114
- }
1115
- var Ot, dn;
1116
- function ri() {
1117
- if (dn) return Ot;
1118
- dn = 1;
1119
- var e = ti();
1120
- function t(r, n, a) {
1121
- var i = r == null ? void 0 : e(r, n);
1122
- return i === void 0 ? a : i;
1123
- }
1124
- return Ot = t, Ot;
1125
- }
1126
- var ni = ri();
1127
- const ee = /* @__PURE__ */ Tn(ni);
1128
- class Yt {
1129
- constructor(t, r = t) {
1130
- this.stateless = t, this.stateful = r;
67
+ class x {
68
+ constructor(e, n = e) {
69
+ this.stateless = e, this.stateful = n;
1131
70
  }
1132
71
  get validatable() {
1133
- return In(this.stateful);
72
+ return _(this.stateful);
1134
73
  }
1135
74
  }
1136
- function In(e, t = []) {
1137
- return new Proxy(e, {
1138
- get(r, n) {
1139
- switch (n) {
75
+ function _(t, e = []) {
76
+ return new Proxy(t, {
77
+ get(n, r) {
78
+ switch (r) {
1140
79
  case "is":
1141
- return (a) => {
1142
- const i = Tt(e, t);
1143
- if (!i) return !1;
1144
- const o = new Set(
1145
- i.flatMap((s) => s.operations)
80
+ return (s) => {
81
+ const o = R(t, e);
82
+ if (!o) return !1;
83
+ const u = new Set(
84
+ o.flatMap((c) => c.operations)
1146
85
  );
1147
- return !!(Array.from(o).reduce(
1148
- (s, l) => s | (l ?? 0),
86
+ return !!(Array.from(u).reduce(
87
+ (c, f) => c | (f ?? 0),
1149
88
  0
1150
- ) & a);
89
+ ) & s);
1151
90
  };
1152
91
  case "pending":
1153
- return () => !!Tt(e, t);
92
+ return () => !!R(t, e);
1154
93
  case "draft":
1155
94
  return () => {
1156
- const a = Tt(e, t);
1157
- if (!a) return ee(e, t);
1158
- const i = a.flatMap((o) => o.operations).find((o) => o instanceof wn);
1159
- return i ? i.value : ee(e, t);
95
+ const s = R(t, e);
96
+ if (!s) return p(t, e);
97
+ const o = s.flatMap((u) => u.operations).find((u) => u instanceof U);
98
+ return o ? o.value : p(t, e);
1160
99
  };
1161
100
  }
1162
- return In(e, [...t, String(n)]);
101
+ return _(t, [...e, String(r)]);
1163
102
  }
1164
103
  });
1165
104
  }
1166
- function Tt(e, t) {
1167
- const n = typeof ee(e, t) == "object" ? t : t.slice(0, -1), a = n.length === 0 ? e : ee(e, n), i = (a == null ? void 0 : a[q.annotations]) ?? [];
1168
- return i.length > 0 ? i : null;
105
+ function R(t, e) {
106
+ const r = typeof p(t, e) == "object" ? e : e.slice(0, -1), s = r.length === 0 ? t : p(t, r), o = (s == null ? void 0 : s[l.annotations]) ?? [];
107
+ return o.length > 0 ? o : null;
1169
108
  }
1170
- var Dt, hn;
1171
- function ai() {
1172
- if (hn) return Dt;
1173
- hn = 1;
1174
- function e(c) {
1175
- return Object.prototype.toString.call(c);
1176
- }
1177
- function t(c) {
1178
- return e(c) === "[object Date]";
1179
- }
1180
- function r(c) {
1181
- return e(c) === "[object RegExp]";
1182
- }
1183
- function n(c) {
1184
- return e(c) === "[object Error]";
1185
- }
1186
- function a(c) {
1187
- return e(c) === "[object Boolean]";
1188
- }
1189
- function i(c) {
1190
- return e(c) === "[object Number]";
1191
- }
1192
- function o(c) {
1193
- return e(c) === "[object String]";
1194
- }
1195
- var u = Array.isArray || function(p) {
1196
- return Object.prototype.toString.call(p) === "[object Array]";
1197
- };
1198
- function s(c, p) {
1199
- if (c.forEach)
1200
- return c.forEach(p);
1201
- for (var b = 0; b < c.length; b++)
1202
- p(c[b], b, c);
1203
- }
1204
- var l = Object.keys || function(p) {
1205
- var b = [];
1206
- for (var g in p)
1207
- b.push(g);
1208
- return b;
1209
- }, m = Object.prototype.propertyIsEnumerable, v = Object.getOwnPropertySymbols;
1210
- function h(c) {
1211
- var p = l(c);
1212
- if (v)
1213
- for (var b = v(c), g = 0; g < b.length; g++)
1214
- m.call(c, b[g]) && p.push(b[g]);
1215
- return p;
1216
- }
1217
- var _ = Object.prototype.hasOwnProperty || function(c, p) {
1218
- return p in c;
1219
- };
1220
- function d(c) {
1221
- if (typeof c == "object" && c !== null) {
1222
- var p;
1223
- if (u(c))
1224
- p = [];
1225
- else if (t(c))
1226
- p = new Date(c.getTime ? c.getTime() : c);
1227
- else if (r(c))
1228
- p = new RegExp(c);
1229
- else if (n(c))
1230
- p = { message: c.message };
1231
- else if (a(c) || i(c) || o(c))
1232
- p = Object(c);
1233
- else if (Object.create && Object.getPrototypeOf)
1234
- p = Object.create(Object.getPrototypeOf(c));
1235
- else if (c.constructor === Object)
1236
- p = {};
1237
- else {
1238
- var b = c.constructor && c.constructor.prototype || c.__proto__ || {}, g = function() {
1239
- };
1240
- g.prototype = b, p = new g();
1241
- }
1242
- return s(h(c), function(R) {
1243
- p[R] = c[R];
1244
- }), p;
1245
- }
1246
- return c;
1247
- }
1248
- function S(c, p, b) {
1249
- var g = [], R = [], O = !0;
1250
- return function M(P) {
1251
- var j = b ? d(P) : P, T = {}, V = !0, w = {
1252
- node: j,
1253
- node_: P,
1254
- path: [].concat(g),
1255
- parent: R[R.length - 1],
1256
- parents: R,
1257
- key: g[g.length - 1],
1258
- isRoot: g.length === 0,
1259
- level: g.length,
1260
- circular: null,
1261
- update: function(E, ie) {
1262
- w.isRoot || (w.parent.node[w.key] = E), w.node = E, ie && (V = !1);
1263
- },
1264
- delete: function(E) {
1265
- delete w.parent.node[w.key], E && (V = !1);
1266
- },
1267
- remove: function(E) {
1268
- u(w.parent.node) ? w.parent.node.splice(w.key, 1) : delete w.parent.node[w.key], E && (V = !1);
1269
- },
1270
- keys: null,
1271
- before: function(E) {
1272
- T.before = E;
1273
- },
1274
- after: function(E) {
1275
- T.after = E;
1276
- },
1277
- pre: function(E) {
1278
- T.pre = E;
1279
- },
1280
- post: function(E) {
1281
- T.post = E;
1282
- },
1283
- stop: function() {
1284
- O = !1;
1285
- },
1286
- block: function() {
1287
- V = !1;
1288
- }
1289
- };
1290
- if (!O)
1291
- return w;
1292
- function ir() {
1293
- if (typeof w.node == "object" && w.node !== null) {
1294
- (!w.keys || w.node_ !== w.node) && (w.keys = h(w.node)), w.isLeaf = w.keys.length === 0;
1295
- for (var E = 0; E < R.length; E++)
1296
- if (R[E].node_ === P) {
1297
- w.circular = R[E];
1298
- break;
1299
- }
1300
- } else
1301
- w.isLeaf = !0, w.keys = null;
1302
- w.notLeaf = !w.isLeaf, w.notRoot = !w.isRoot;
1303
- }
1304
- ir();
1305
- var or = p.call(w, w.node);
1306
- return or !== void 0 && w.update && w.update(or), T.before && T.before.call(w, w.node), V && (typeof w.node == "object" && w.node !== null && !w.circular && (R.push(w), ir(), s(w.keys, function(E, ie) {
1307
- g.push(E), T.pre && T.pre.call(w, w.node[E], E);
1308
- var oe = M(w.node[E]);
1309
- b && _.call(w.node, E) && (w.node[E] = oe.node), oe.isLast = ie === w.keys.length - 1, oe.isFirst = ie === 0, T.post && T.post.call(w, oe), g.pop();
1310
- }), R.pop()), T.after && T.after.call(w, w.node)), w;
1311
- }(c).node;
1312
- }
1313
- function C(c) {
1314
- this.value = c;
1315
- }
1316
- C.prototype.get = function(c) {
1317
- for (var p = this.value, b = 0; b < c.length; b++) {
1318
- var g = c[b];
1319
- if (!p || !_.call(p, g))
1320
- return;
1321
- p = p[g];
1322
- }
1323
- return p;
1324
- }, C.prototype.has = function(c) {
1325
- for (var p = this.value, b = 0; b < c.length; b++) {
1326
- var g = c[b];
1327
- if (!p || !_.call(p, g))
1328
- return !1;
1329
- p = p[g];
1330
- }
1331
- return !0;
1332
- }, C.prototype.set = function(c, p) {
1333
- for (var b = this.value, g = 0; g < c.length - 1; g++) {
1334
- var R = c[g];
1335
- _.call(b, R) || (b[R] = {}), b = b[R];
1336
- }
1337
- return b[c[g]] = p, p;
1338
- }, C.prototype.map = function(c) {
1339
- return S(this.value, c, !0);
1340
- }, C.prototype.forEach = function(c) {
1341
- return this.value = S(this.value, c, !1), this.value;
1342
- }, C.prototype.reduce = function(c, p) {
1343
- var b = arguments.length === 1, g = b ? this.value : p;
1344
- return this.forEach(function(R) {
1345
- (!this.isRoot || !b) && (g = c.call(this, g, R));
1346
- }), g;
1347
- }, C.prototype.paths = function() {
1348
- var c = [];
1349
- return this.forEach(function() {
1350
- c.push(this.path);
1351
- }), c;
1352
- }, C.prototype.nodes = function() {
1353
- var c = [];
1354
- return this.forEach(function() {
1355
- c.push(this.node);
1356
- }), c;
1357
- }, C.prototype.clone = function() {
1358
- var c = [], p = [];
1359
- return function b(g) {
1360
- for (var R = 0; R < c.length; R++)
1361
- if (c[R] === g)
1362
- return p[R];
1363
- if (typeof g == "object" && g !== null) {
1364
- var O = d(g);
1365
- return c.push(g), p.push(O), s(h(g), function(M) {
1366
- O[M] = b(g[M]);
1367
- }), c.pop(), p.pop(), O;
1368
- }
1369
- return g;
1370
- }(this.value);
1371
- };
1372
- function y(c) {
1373
- return new C(c);
1374
- }
1375
- return s(h(C.prototype), function(c) {
1376
- y[c] = function(p) {
1377
- var b = [].slice.call(arguments, 1), g = new C(p);
1378
- return g[c].apply(g, b);
1379
- };
1380
- }), Dt = y, Dt;
1381
- }
1382
- var ii = ai();
1383
- const $t = /* @__PURE__ */ Tn(ii);
1384
- function oi(e, t, r) {
1385
- function n(i) {
1386
- return $t(i).forEach(function() {
1387
- if (this.key === q.annotations) {
109
+ function T(t, e, n) {
110
+ function r(o) {
111
+ return M(o).forEach(function() {
112
+ if (this.key === l.annotations) {
1388
113
  this.block();
1389
114
  return;
1390
115
  }
1391
- this.node instanceof Ft && this.update(this.node.value);
116
+ this.node instanceof S && this.update(this.node.value);
1392
117
  });
1393
118
  }
1394
- function a(i) {
1395
- return $t(i).forEach(function() {
1396
- if (this.key === q.annotations) {
119
+ function s(o) {
120
+ return M(o).forEach(function() {
121
+ if (this.key === l.annotations) {
1397
122
  this.block();
1398
123
  return;
1399
124
  }
1400
- if (this.node instanceof Ft) {
1401
- const o = typeof this.node.value == "object", u = [
1402
- ...o ? this.path : this.path.slice(0, -1),
1403
- q.annotations
1404
- ], s = ee(e.stateful, u) ?? [], l = this.node.attach(t);
1405
- o ? this.update(
125
+ if (this.node instanceof S) {
126
+ const u = typeof this.node.value == "object", a = [
127
+ ...u ? this.path : this.path.slice(0, -1),
128
+ l.annotations
129
+ ], c = p(t.stateful, a) ?? [], f = this.node.attach(e);
130
+ u ? this.update(
1406
131
  {
1407
132
  ...this.node.value,
1408
- [q.annotations]: [l, ...s]
133
+ [l.annotations]: [f, ...c]
1409
134
  },
1410
135
  !0
1411
- ) : (this.parent && (this.parent.node[q.annotations] = [l, ...s]), this.update(this.node.value, !0));
136
+ ) : (this.parent && (this.parent.node[l.annotations] = [f, ...c]), this.update(this.node.value, !0));
1412
137
  }
1413
138
  });
1414
139
  }
1415
- return new Yt(
1416
- n(q.immer.produce(e.stateless, r)),
1417
- a(q.immer.produce(e.stateful, r))
140
+ return new x(
141
+ r(l.immer.produce(t.stateless, n)),
142
+ s(l.immer.produce(t.stateful, n))
1418
143
  );
1419
144
  }
1420
- function ui(e, t) {
1421
- const r = $t(e.stateful).forEach(function() {
1422
- if (this.key === q.annotations) {
145
+ function $(t, e) {
146
+ const n = M(t.stateful).forEach(function() {
147
+ if (this.key === l.annotations) {
1423
148
  this.block();
1424
149
  return;
1425
150
  }
1426
- if (this.node && this.node[q.annotations]) {
1427
- const n = this.node[q.annotations];
151
+ if (this.node && this.node[l.annotations]) {
152
+ const r = this.node[l.annotations];
1428
153
  this.update(
1429
154
  {
1430
155
  ...this.node,
1431
- [q.annotations]: n.filter(
1432
- (a) => a.process !== t
156
+ [l.annotations]: r.filter(
157
+ (s) => s.process !== e
1433
158
  )
1434
159
  },
1435
160
  !0
1436
161
  );
1437
162
  }
1438
163
  });
1439
- return new Yt(e.stateless, r);
164
+ return new x(t.stateless, n);
1440
165
  }
1441
- function si(e) {
1442
- return f.useMemo(
166
+ function Q(t) {
167
+ return i.useMemo(
1443
168
  () => ({
1444
169
  controller: {
1445
170
  get model() {
1446
- return e.model.current.stateful;
171
+ return t.model.current.stateful;
1447
172
  },
1448
173
  get router() {
1449
- return e.router.current;
174
+ return t.router.current;
1450
175
  },
1451
176
  queue: [],
1452
- events: e.options.props,
177
+ handlers: t.options.props,
178
+ attributes: t.options.props,
1453
179
  actions: {
1454
- annotate(t, r) {
1455
- return pa(t, r);
180
+ annotate(e, n) {
181
+ return J(e, n);
1456
182
  },
1457
- produce(t) {
1458
- return (r, n) => oi(r, n, t);
183
+ produce(e) {
184
+ return (n, r) => T(n, r, e);
1459
185
  },
1460
- dispatch([t, ...r]) {
1461
- const n = Promise.withResolvers();
1462
- return e.dispatchers.dispatch(t, r, n), n.promise;
186
+ dispatch([e, ...n]) {
187
+ const r = Promise.withResolvers();
188
+ return e && t.dispatchers.dispatch(e, n, r), r.promise;
1463
189
  }
1464
190
  }
1465
191
  },
1466
192
  view: {
1467
193
  get model() {
1468
- return e.model.current.stateless;
194
+ return t.model.current.stateless;
1469
195
  },
1470
196
  get validate() {
1471
- return e.model.current.validatable;
197
+ return t.model.current.validatable;
1472
198
  },
1473
- get router() {
1474
- return e.router.current;
1475
- },
1476
- events: e.options.props,
199
+ handlers: t.options.props,
200
+ attributes: t.options.props,
1477
201
  actions: {
1478
- dispatch([t, ...r]) {
1479
- const n = Promise.withResolvers();
1480
- return e.dispatchers.dispatch(t, r, n), n.promise;
202
+ dispatch([e, ...n]) {
203
+ const r = Promise.withResolvers();
204
+ return e && t.dispatchers.dispatch(e, n, r), r.promise;
1481
205
  }
1482
206
  }
1483
207
  }
@@ -1485,1617 +209,154 @@ function si(e) {
1485
209
  []
1486
210
  );
1487
211
  }
1488
- function li(e) {
1489
- return f.useMemo(() => {
1490
- const t = e.options.controller(e.actions.controller);
1491
- return Object.entries(t).forEach(([n, a]) => e.dispatchers.attach(n, a)), t;
212
+ function W(t) {
213
+ return i.useMemo(() => {
214
+ var r, s;
215
+ const e = (s = (r = t.options).controller) == null ? void 0 : s.call(r, t.actions.controller);
216
+ return e ? (Object.entries(e).forEach(([o, u]) => t.dispatchers.attach(o, u)), e) : void 0;
1492
217
  }, []);
1493
218
  }
1494
- function ci(e) {
1495
- return (t, r) => async (n = Promise.withResolvers(), a) => {
1496
- if (typeof r != "function") return;
1497
- const i = Symbol("process"), o = r(...a);
219
+ function G(t) {
220
+ return (e, n) => async (r = Promise.withResolvers(), s) => {
221
+ if (typeof n != "function") return;
222
+ const o = Symbol("process"), u = n(...s);
1498
223
  for (; ; ) {
1499
- const { value: u, done: s } = await o.next();
1500
- if (s) {
1501
- const m = u(e.model.current, i);
1502
- e.model.current = ui(m, i), e.update.rerender();
224
+ const { value: a, done: c } = await u.next();
225
+ if (c) {
226
+ const C = a(t.model.current, o);
227
+ t.model.current = $(C, o), t.update.rerender();
1503
228
  break;
1504
229
  }
1505
- const l = u;
1506
- e.model.current = l(e.model.current, i), e.update.rerender();
230
+ const f = a;
231
+ t.model.current = f(t.model.current, o), t.update.rerender();
1507
232
  }
1508
- n.resolve();
233
+ r.resolve();
1509
234
  };
1510
235
  }
1511
- function pn(e) {
1512
- return e.startsWith("distributed");
236
+ function j(t) {
237
+ return t.startsWith("distributed");
1513
238
  }
1514
- var te, re;
1515
- class fi extends Error {
1516
- constructor(r, n = null) {
1517
- super(String(n));
1518
- xe(this, te);
1519
- xe(this, re);
1520
- Oe(this, te, r), Oe(this, re, n);
239
+ var v, g;
240
+ class H extends Error {
241
+ constructor(n, r = null) {
242
+ super(String(r));
243
+ b(this, v);
244
+ b(this, g);
245
+ E(this, v, n), E(this, g, r);
1521
246
  }
1522
247
  get type() {
1523
- return Pe(this, te);
248
+ return w(this, v);
1524
249
  }
1525
250
  get message() {
1526
- return Pe(this, re) || "";
251
+ return w(this, g) || "";
1527
252
  }
1528
253
  }
1529
- te = new WeakMap(), re = new WeakMap();
1530
- function di(e) {
1531
- const t = bn(), r = ci(e);
1532
- return f.useMemo(() => {
1533
- const n = new Ut(), a = t.appEmitter;
254
+ v = new WeakMap(), g = new WeakMap();
255
+ function K(t) {
256
+ const e = A(), n = G(t);
257
+ return i.useMemo(() => {
258
+ const r = new k(), s = e.appEmitter;
1534
259
  return {
1535
- attach(i, o) {
1536
- const u = String(i);
1537
- pn(u) ? a.on(u, r(i, o)) : n.on(u, r(i, o));
260
+ attach(o, u) {
261
+ const a = String(o);
262
+ j(a) ? s.on(a, n(o, u)) : r.on(a, n(o, u));
1538
263
  },
1539
- dispatch(i, o, u) {
1540
- const s = String(i);
1541
- pn(s) ? a.emit(s, u, o) : n.emit(s, u, o);
264
+ dispatch(o, u, a) {
265
+ const c = String(o);
266
+ j(c) ? s.emit(c, a, u) : r.emit(c, a, u);
1542
267
  }
1543
268
  };
1544
269
  }, []);
1545
270
  }
1546
- function hi() {
1547
- const e = f.useRef(null);
1548
- return f.useMemo(() => ({ customElement: e }), []);
1549
- }
1550
- function pi(e) {
1551
- const t = f.useRef(!1);
1552
- f.useLayoutEffect(() => {
1553
- e.dispatchers.dispatch(X.Derive, [e.options.props]);
1554
- }, [e.options.props]), f.useLayoutEffect(() => {
1555
- if (!t.current)
1556
- return t.current = !0, e.dispatchers.dispatch(X.Mount, []), e.dispatchers.dispatch(X.Tree, [
1557
- e.elements.customElement.current
1558
- ]), () => e.dispatchers.dispatch(X.Unmount, []);
1559
- }, []);
1560
- }
1561
- function mi(e) {
1562
- return f.useMemo(
1563
- () => ({
1564
- output(t) {
1565
- const r = e.elements.customElement.current;
1566
- console.groupCollapsed(
1567
- "%cRendered",
1568
- "background: rgb(217, 235, 240); color: rgb(0, 51, 102); border-radius: 2px; padding: 0 5px",
1569
- r
1570
- ), console.groupEnd();
1571
- }
1572
- }),
1573
- []
1574
- );
1575
- }
1576
- function yi(e) {
1577
- return f.useRef(
1578
- new Yt(e.options.model, e.options.model)
1579
- );
1580
- }
1581
- function vi() {
1582
- return f.useRef(/* @__PURE__ */ new Set());
1583
- }
1584
- var J = {}, mn;
1585
- function gi() {
1586
- if (mn) return J;
1587
- mn = 1, Object.defineProperty(J, "__esModule", { value: !0 }), J.parse = o, J.serialize = l;
1588
- const e = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, t = /^[\u0021-\u003A\u003C-\u007E]*$/, r = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, n = /^[\u0020-\u003A\u003D-\u007E]*$/, a = Object.prototype.toString, i = /* @__PURE__ */ (() => {
1589
- const h = function() {
1590
- };
1591
- return h.prototype = /* @__PURE__ */ Object.create(null), h;
1592
- })();
1593
- function o(h, _) {
1594
- const d = new i(), S = h.length;
1595
- if (S < 2)
1596
- return d;
1597
- const C = (_ == null ? void 0 : _.decode) || m;
1598
- let y = 0;
1599
- do {
1600
- const c = h.indexOf("=", y);
1601
- if (c === -1)
1602
- break;
1603
- const p = h.indexOf(";", y), b = p === -1 ? S : p;
1604
- if (c > b) {
1605
- y = h.lastIndexOf(";", c - 1) + 1;
1606
- continue;
1607
- }
1608
- const g = u(h, y, c), R = s(h, c, g), O = h.slice(g, R);
1609
- if (d[O] === void 0) {
1610
- let M = u(h, c + 1, b), P = s(h, b, M);
1611
- const j = C(h.slice(M, P));
1612
- d[O] = j;
1613
- }
1614
- y = b + 1;
1615
- } while (y < S);
1616
- return d;
1617
- }
1618
- function u(h, _, d) {
1619
- do {
1620
- const S = h.charCodeAt(_);
1621
- if (S !== 32 && S !== 9)
1622
- return _;
1623
- } while (++_ < d);
1624
- return d;
1625
- }
1626
- function s(h, _, d) {
1627
- for (; _ > d; ) {
1628
- const S = h.charCodeAt(--_);
1629
- if (S !== 32 && S !== 9)
1630
- return _ + 1;
1631
- }
1632
- return d;
1633
- }
1634
- function l(h, _, d) {
1635
- const S = (d == null ? void 0 : d.encode) || encodeURIComponent;
1636
- if (!e.test(h))
1637
- throw new TypeError(`argument name is invalid: ${h}`);
1638
- const C = S(_);
1639
- if (!t.test(C))
1640
- throw new TypeError(`argument val is invalid: ${_}`);
1641
- let y = h + "=" + C;
1642
- if (!d)
1643
- return y;
1644
- if (d.maxAge !== void 0) {
1645
- if (!Number.isInteger(d.maxAge))
1646
- throw new TypeError(`option maxAge is invalid: ${d.maxAge}`);
1647
- y += "; Max-Age=" + d.maxAge;
1648
- }
1649
- if (d.domain) {
1650
- if (!r.test(d.domain))
1651
- throw new TypeError(`option domain is invalid: ${d.domain}`);
1652
- y += "; Domain=" + d.domain;
1653
- }
1654
- if (d.path) {
1655
- if (!n.test(d.path))
1656
- throw new TypeError(`option path is invalid: ${d.path}`);
1657
- y += "; Path=" + d.path;
1658
- }
1659
- if (d.expires) {
1660
- if (!v(d.expires) || !Number.isFinite(d.expires.valueOf()))
1661
- throw new TypeError(`option expires is invalid: ${d.expires}`);
1662
- y += "; Expires=" + d.expires.toUTCString();
1663
- }
1664
- if (d.httpOnly && (y += "; HttpOnly"), d.secure && (y += "; Secure"), d.partitioned && (y += "; Partitioned"), d.priority)
1665
- switch (typeof d.priority == "string" ? d.priority.toLowerCase() : void 0) {
1666
- case "low":
1667
- y += "; Priority=Low";
1668
- break;
1669
- case "medium":
1670
- y += "; Priority=Medium";
1671
- break;
1672
- case "high":
1673
- y += "; Priority=High";
1674
- break;
1675
- default:
1676
- throw new TypeError(`option priority is invalid: ${d.priority}`);
1677
- }
1678
- if (d.sameSite)
1679
- switch (typeof d.sameSite == "string" ? d.sameSite.toLowerCase() : d.sameSite) {
1680
- case !0:
1681
- case "strict":
1682
- y += "; SameSite=Strict";
1683
- break;
1684
- case "lax":
1685
- y += "; SameSite=Lax";
1686
- break;
1687
- case "none":
1688
- y += "; SameSite=None";
1689
- break;
1690
- default:
1691
- throw new TypeError(`option sameSite is invalid: ${d.sameSite}`);
1692
- }
1693
- return y;
1694
- }
1695
- function m(h) {
1696
- if (h.indexOf("%") === -1)
1697
- return h;
1698
- try {
1699
- return decodeURIComponent(h);
1700
- } catch {
1701
- return h;
1702
- }
1703
- }
1704
- function v(h) {
1705
- return a.call(h) === "[object Date]";
1706
- }
1707
- return J;
1708
- }
1709
- gi();
1710
- /**
1711
- * react-router v7.6.0
1712
- *
1713
- * Copyright (c) Remix Software Inc.
1714
- *
1715
- * This source code is licensed under the MIT license found in the
1716
- * LICENSE.md file in the root directory of this source tree.
1717
- *
1718
- * @license MIT
1719
- */
1720
- function x(e, t) {
1721
- if (e === !1 || e === null || typeof e > "u")
1722
- throw new Error(t);
1723
- }
1724
- function A(e, t) {
1725
- if (!e) {
1726
- typeof console < "u" && console.warn(t);
1727
- try {
1728
- throw new Error(t);
1729
- } catch {
1730
- }
1731
- }
1732
- }
1733
- function zt({
1734
- pathname: e = "/",
1735
- search: t = "",
1736
- hash: r = ""
1737
- }) {
1738
- return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), r && r !== "#" && (e += r.charAt(0) === "#" ? r : "#" + r), e;
1739
- }
1740
- function Xt(e) {
1741
- let t = {};
1742
- if (e) {
1743
- let r = e.indexOf("#");
1744
- r >= 0 && (t.hash = e.substring(r), e = e.substring(0, r));
1745
- let n = e.indexOf("?");
1746
- n >= 0 && (t.search = e.substring(n), e = e.substring(0, n)), e && (t.pathname = e);
1747
- }
1748
- return t;
1749
- }
1750
- function Mn(e, t, r = "/") {
1751
- return _i(e, t, r, !1);
1752
- }
1753
- function _i(e, t, r, n) {
1754
- let a = typeof t == "string" ? Xt(t) : t, i = z(a.pathname || "/", r);
1755
- if (i == null)
1756
- return null;
1757
- let o = jn(e);
1758
- bi(o);
1759
- let u = null;
1760
- for (let s = 0; u == null && s < o.length; ++s) {
1761
- let l = qi(i);
1762
- u = Ti(
1763
- o[s],
1764
- l,
1765
- n
1766
- );
1767
- }
1768
- return u;
1769
- }
1770
- function jn(e, t = [], r = [], n = "") {
1771
- let a = (i, o, u) => {
1772
- let s = {
1773
- relativePath: u === void 0 ? i.path || "" : u,
1774
- caseSensitive: i.caseSensitive === !0,
1775
- childrenIndex: o,
1776
- route: i
1777
- };
1778
- s.relativePath.startsWith("/") && (x(
1779
- s.relativePath.startsWith(n),
1780
- `Absolute route path "${s.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
1781
- ), s.relativePath = s.relativePath.slice(n.length));
1782
- let l = N([n, s.relativePath]), m = r.concat(s);
1783
- i.children && i.children.length > 0 && (x(
1784
- // Our types know better, but runtime JS may not!
1785
- // @ts-expect-error
1786
- i.index !== !0,
1787
- `Index routes must not have child routes. Please remove all child routes from route path "${l}".`
1788
- ), jn(i.children, t, m, l)), !(i.path == null && !i.index) && t.push({
1789
- path: l,
1790
- score: xi(l, i.index),
1791
- routesMeta: m
1792
- });
1793
- };
1794
- return e.forEach((i, o) => {
1795
- var u;
1796
- if (i.path === "" || !((u = i.path) != null && u.includes("?")))
1797
- a(i, o);
1798
- else
1799
- for (let s of An(i.path))
1800
- a(i, o, s);
1801
- }), t;
1802
- }
1803
- function An(e) {
1804
- let t = e.split("/");
1805
- if (t.length === 0) return [];
1806
- let [r, ...n] = t, a = r.endsWith("?"), i = r.replace(/\?$/, "");
1807
- if (n.length === 0)
1808
- return a ? [i, ""] : [i];
1809
- let o = An(n.join("/")), u = [];
1810
- return u.push(
1811
- ...o.map(
1812
- (s) => s === "" ? i : [i, s].join("/")
1813
- )
1814
- ), a && u.push(...o), u.map(
1815
- (s) => e.startsWith("/") && s === "" ? "/" : s
1816
- );
1817
- }
1818
- function bi(e) {
1819
- e.sort(
1820
- (t, r) => t.score !== r.score ? r.score - t.score : Oi(
1821
- t.routesMeta.map((n) => n.childrenIndex),
1822
- r.routesMeta.map((n) => n.childrenIndex)
1823
- )
1824
- );
1825
- }
1826
- var wi = /^:[\w-]+$/, Ci = 3, Si = 2, Ri = 1, Ei = 10, Pi = -2, yn = (e) => e === "*";
1827
- function xi(e, t) {
1828
- let r = e.split("/"), n = r.length;
1829
- return r.some(yn) && (n += Pi), t && (n += Si), r.filter((a) => !yn(a)).reduce(
1830
- (a, i) => a + (wi.test(i) ? Ci : i === "" ? Ri : Ei),
1831
- n
1832
- );
1833
- }
1834
- function Oi(e, t) {
1835
- return e.length === t.length && e.slice(0, -1).every((n, a) => n === t[a]) ? (
1836
- // If two routes are siblings, we should try to match the earlier sibling
1837
- // first. This allows people to have fine-grained control over the matching
1838
- // behavior by simply putting routes with identical paths in the order they
1839
- // want them tried.
1840
- e[e.length - 1] - t[t.length - 1]
1841
- ) : (
1842
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
1843
- // so they sort equally.
1844
- 0
1845
- );
1846
- }
1847
- function Ti(e, t, r = !1) {
1848
- let { routesMeta: n } = e, a = {}, i = "/", o = [];
1849
- for (let u = 0; u < n.length; ++u) {
1850
- let s = n[u], l = u === n.length - 1, m = i === "/" ? t : t.slice(i.length) || "/", v = me(
1851
- { path: s.relativePath, caseSensitive: s.caseSensitive, end: l },
1852
- m
1853
- ), h = s.route;
1854
- if (!v && l && r && !n[n.length - 1].route.index && (v = me(
1855
- {
1856
- path: s.relativePath,
1857
- caseSensitive: s.caseSensitive,
1858
- end: !1
1859
- },
1860
- m
1861
- )), !v)
1862
- return null;
1863
- Object.assign(a, v.params), o.push({
1864
- // TODO: Can this as be avoided?
1865
- params: a,
1866
- pathname: N([i, v.pathname]),
1867
- pathnameBase: ji(
1868
- N([i, v.pathnameBase])
1869
- ),
1870
- route: h
1871
- }), v.pathnameBase !== "/" && (i = N([i, v.pathnameBase]));
1872
- }
1873
- return o;
1874
- }
1875
- function me(e, t) {
1876
- typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
1877
- let [r, n] = Di(
1878
- e.path,
1879
- e.caseSensitive,
1880
- e.end
1881
- ), a = t.match(r);
1882
- if (!a) return null;
1883
- let i = a[0], o = i.replace(/(.)\/+$/, "$1"), u = a.slice(1);
1884
- return {
1885
- params: n.reduce(
1886
- (l, { paramName: m, isOptional: v }, h) => {
1887
- if (m === "*") {
1888
- let d = u[h] || "";
1889
- o = i.slice(0, i.length - d.length).replace(/(.)\/+$/, "$1");
1890
- }
1891
- const _ = u[h];
1892
- return v && !_ ? l[m] = void 0 : l[m] = (_ || "").replace(/%2F/g, "/"), l;
1893
- },
1894
- {}
1895
- ),
1896
- pathname: i,
1897
- pathnameBase: o,
1898
- pattern: e
1899
- };
1900
- }
1901
- function Di(e, t = !1, r = !0) {
1902
- A(
1903
- e === "*" || !e.endsWith("*") || e.endsWith("/*"),
1904
- `Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`
1905
- );
1906
- let n = [], a = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
1907
- /\/:([\w-]+)(\?)?/g,
1908
- (o, u, s) => (n.push({ paramName: u, isOptional: s != null }), s ? "/?([^\\/]+)?" : "/([^\\/]+)")
1909
- );
1910
- return e.endsWith("*") ? (n.push({ paramName: "*" }), a += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? a += "\\/*$" : e !== "" && e !== "/" && (a += "(?:(?=\\/|$))"), [new RegExp(a, t ? void 0 : "i"), n];
1911
- }
1912
- function qi(e) {
1913
- try {
1914
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
1915
- } catch (t) {
1916
- return A(
1917
- !1,
1918
- `The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
1919
- ), e;
1920
- }
1921
- }
1922
- function z(e, t) {
1923
- if (t === "/") return e;
1924
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
1925
- return null;
1926
- let r = t.endsWith("/") ? t.length - 1 : t.length, n = e.charAt(r);
1927
- return n && n !== "/" ? null : e.slice(r) || "/";
1928
- }
1929
- function ki(e, t = "/") {
1930
- let {
1931
- pathname: r,
1932
- search: n = "",
1933
- hash: a = ""
1934
- } = typeof e == "string" ? Xt(e) : e;
1935
- return {
1936
- pathname: r ? r.startsWith("/") ? r : Ii(r, t) : t,
1937
- search: Ai(n),
1938
- hash: Li(a)
1939
- };
1940
- }
1941
- function Ii(e, t) {
1942
- let r = t.replace(/\/+$/, "").split("/");
1943
- return e.split("/").forEach((a) => {
1944
- a === ".." ? r.length > 1 && r.pop() : a !== "." && r.push(a);
1945
- }), r.length > 1 ? r.join("/") : "/";
1946
- }
1947
- function qt(e, t, r, n) {
1948
- return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
1949
- n
1950
- )}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
1951
- }
1952
- function Mi(e) {
1953
- return e.filter(
1954
- (t, r) => r === 0 || t.route.path && t.route.path.length > 0
1955
- );
1956
- }
1957
- function Ln(e) {
1958
- let t = Mi(e);
1959
- return t.map(
1960
- (r, n) => n === t.length - 1 ? r.pathname : r.pathnameBase
1961
- );
1962
- }
1963
- function Nn(e, t, r, n = !1) {
1964
- let a;
1965
- typeof e == "string" ? a = Xt(e) : (a = { ...e }, x(
1966
- !a.pathname || !a.pathname.includes("?"),
1967
- qt("?", "pathname", "search", a)
1968
- ), x(
1969
- !a.pathname || !a.pathname.includes("#"),
1970
- qt("#", "pathname", "hash", a)
1971
- ), x(
1972
- !a.search || !a.search.includes("#"),
1973
- qt("#", "search", "hash", a)
1974
- ));
1975
- let i = e === "" || a.pathname === "", o = i ? "/" : a.pathname, u;
1976
- if (o == null)
1977
- u = r;
1978
- else {
1979
- let v = t.length - 1;
1980
- if (!n && o.startsWith("..")) {
1981
- let h = o.split("/");
1982
- for (; h[0] === ".."; )
1983
- h.shift(), v -= 1;
1984
- a.pathname = h.join("/");
1985
- }
1986
- u = v >= 0 ? t[v] : "/";
1987
- }
1988
- let s = ki(a, u), l = o && o !== "/" && o.endsWith("/"), m = (i || o === ".") && r.endsWith("/");
1989
- return !s.pathname.endsWith("/") && (l || m) && (s.pathname += "/"), s;
1990
- }
1991
- var N = (e) => e.join("/").replace(/\/\/+/g, "/"), ji = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Ai = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, Li = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
1992
- function Ni(e) {
1993
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
1994
- }
1995
- var Fn = [
1996
- "POST",
1997
- "PUT",
1998
- "PATCH",
1999
- "DELETE"
2000
- ];
2001
- new Set(
2002
- Fn
2003
- );
2004
- var Fi = [
2005
- "GET",
2006
- ...Fn
2007
- ];
2008
- new Set(Fi);
2009
- var K = f.createContext(null);
2010
- K.displayName = "DataRouter";
2011
- var Se = f.createContext(null);
2012
- Se.displayName = "DataRouterState";
2013
- var $n = f.createContext({
2014
- isTransitioning: !1
2015
- });
2016
- $n.displayName = "ViewTransition";
2017
- var $i = f.createContext(
2018
- /* @__PURE__ */ new Map()
2019
- );
2020
- $i.displayName = "Fetchers";
2021
- var zi = f.createContext(null);
2022
- zi.displayName = "Await";
2023
- var F = f.createContext(
2024
- null
2025
- );
2026
- F.displayName = "Navigation";
2027
- var Zt = f.createContext(
2028
- null
2029
- );
2030
- Zt.displayName = "Location";
2031
- var L = f.createContext({
2032
- outlet: null,
2033
- matches: [],
2034
- isDataRoute: !1
2035
- });
2036
- L.displayName = "Route";
2037
- var Qt = f.createContext(null);
2038
- Qt.displayName = "RouteError";
2039
- function Hi(e, { relative: t } = {}) {
2040
- x(
2041
- ne(),
2042
- // TODO: This error is probably because they somehow have 2 versions of the
2043
- // router loaded. We can help them understand how to avoid that.
2044
- "useHref() may be used only in the context of a <Router> component."
2045
- );
2046
- let { basename: r, navigator: n } = f.useContext(F), { hash: a, pathname: i, search: o } = ae(e, { relative: t }), u = i;
2047
- return r !== "/" && (u = i === "/" ? r : N([r, i])), n.createHref({ pathname: u, search: o, hash: a });
2048
- }
2049
- function ne() {
2050
- return f.useContext(Zt) != null;
2051
- }
2052
- function $() {
2053
- return x(
2054
- ne(),
2055
- // TODO: This error is probably because they somehow have 2 versions of the
2056
- // router loaded. We can help them understand how to avoid that.
2057
- "useLocation() may be used only in the context of a <Router> component."
2058
- ), f.useContext(Zt).location;
2059
- }
2060
- var zn = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
2061
- function Hn(e) {
2062
- f.useContext(F).static || f.useLayoutEffect(e);
2063
- }
2064
- function er() {
2065
- let { isDataRoute: e } = f.useContext(L);
2066
- return e ? ro() : Ui();
2067
- }
2068
- function Ui() {
2069
- x(
2070
- ne(),
2071
- // TODO: This error is probably because they somehow have 2 versions of the
2072
- // router loaded. We can help them understand how to avoid that.
2073
- "useNavigate() may be used only in the context of a <Router> component."
2074
- );
2075
- let e = f.useContext(K), { basename: t, navigator: r } = f.useContext(F), { matches: n } = f.useContext(L), { pathname: a } = $(), i = JSON.stringify(Ln(n)), o = f.useRef(!1);
2076
- return Hn(() => {
2077
- o.current = !0;
2078
- }), f.useCallback(
2079
- (s, l = {}) => {
2080
- if (A(o.current, zn), !o.current) return;
2081
- if (typeof s == "number") {
2082
- r.go(s);
2083
- return;
2084
- }
2085
- let m = Nn(
2086
- s,
2087
- JSON.parse(i),
2088
- a,
2089
- l.relative === "path"
2090
- );
2091
- e == null && t !== "/" && (m.pathname = m.pathname === "/" ? t : N([t, m.pathname])), (l.replace ? r.replace : r.push)(
2092
- m,
2093
- l.state,
2094
- l
2095
- );
2096
- },
2097
- [
2098
- t,
2099
- r,
2100
- i,
2101
- a,
2102
- e
2103
- ]
2104
- );
2105
- }
2106
- f.createContext(null);
2107
- function Gi() {
2108
- let { matches: e } = f.useContext(L), t = e[e.length - 1];
2109
- return t ? t.params : {};
2110
- }
2111
- function ae(e, { relative: t } = {}) {
2112
- let { matches: r } = f.useContext(L), { pathname: n } = $(), a = JSON.stringify(Ln(r));
2113
- return f.useMemo(
2114
- () => Nn(
2115
- e,
2116
- JSON.parse(a),
2117
- n,
2118
- t === "path"
2119
- ),
2120
- [e, a, n, t]
2121
- );
2122
- }
2123
- function Bi(e, t, r, n) {
2124
- x(
2125
- ne(),
2126
- // TODO: This error is probably because they somehow have 2 versions of the
2127
- // router loaded. We can help them understand how to avoid that.
2128
- "useRoutes() may be used only in the context of a <Router> component."
2129
- );
2130
- let { navigator: a, static: i } = f.useContext(F), { matches: o } = f.useContext(L), u = o[o.length - 1], s = u ? u.params : {}, l = u ? u.pathname : "/", m = u ? u.pathnameBase : "/", v = u && u.route;
2131
- {
2132
- let c = v && v.path || "";
2133
- Un(
2134
- l,
2135
- !v || c.endsWith("*") || c.endsWith("*?"),
2136
- `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${c}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2137
-
2138
- Please change the parent <Route path="${c}"> to <Route path="${c === "/" ? "*" : `${c}/*`}">.`
2139
- );
2140
- }
2141
- let h = $(), _;
2142
- _ = h;
2143
- let d = _.pathname || "/", S = d;
2144
- if (m !== "/") {
2145
- let c = m.replace(/^\//, "").split("/");
2146
- S = "/" + d.replace(/^\//, "").split("/").slice(c.length).join("/");
2147
- }
2148
- let C = !i && r && r.matches && r.matches.length > 0 ? r.matches : Mn(e, { pathname: S });
2149
- return A(
2150
- v || C != null,
2151
- `No routes matched location "${_.pathname}${_.search}${_.hash}" `
2152
- ), A(
2153
- C == null || C[C.length - 1].route.element !== void 0 || C[C.length - 1].route.Component !== void 0 || C[C.length - 1].route.lazy !== void 0,
2154
- `Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
2155
- ), Yi(
2156
- C && C.map(
2157
- (c) => Object.assign({}, c, {
2158
- params: Object.assign({}, s, c.params),
2159
- pathname: N([
2160
- m,
2161
- // Re-encode pathnames that were decoded inside matchRoutes
2162
- a.encodeLocation ? a.encodeLocation(c.pathname).pathname : c.pathname
2163
- ]),
2164
- pathnameBase: c.pathnameBase === "/" ? m : N([
2165
- m,
2166
- // Re-encode pathnames that were decoded inside matchRoutes
2167
- a.encodeLocation ? a.encodeLocation(c.pathnameBase).pathname : c.pathnameBase
2168
- ])
2169
- })
2170
- ),
2171
- o,
2172
- r,
2173
- n
2174
- );
2175
- }
2176
- function Wi() {
2177
- let e = to(), t = Ni(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, n = "rgba(200,200,200, 0.5)", a = { padding: "0.5rem", backgroundColor: n }, i = { padding: "2px 4px", backgroundColor: n }, o = null;
2178
- return console.error(
2179
- "Error handled by React Router default ErrorBoundary:",
2180
- e
2181
- ), o = /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ f.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ f.createElement("code", { style: i }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ f.createElement("code", { style: i }, "errorElement"), " prop on your route.")), /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ f.createElement("h3", { style: { fontStyle: "italic" } }, t), r ? /* @__PURE__ */ f.createElement("pre", { style: a }, r) : null, o);
2182
- }
2183
- var Ki = /* @__PURE__ */ f.createElement(Wi, null), Vi = class extends f.Component {
2184
- constructor(e) {
2185
- super(e), this.state = {
2186
- location: e.location,
2187
- revalidation: e.revalidation,
2188
- error: e.error
2189
- };
2190
- }
2191
- static getDerivedStateFromError(e) {
2192
- return { error: e };
2193
- }
2194
- static getDerivedStateFromProps(e, t) {
2195
- return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
2196
- error: e.error,
2197
- location: e.location,
2198
- revalidation: e.revalidation
2199
- } : {
2200
- error: e.error !== void 0 ? e.error : t.error,
2201
- location: t.location,
2202
- revalidation: e.revalidation || t.revalidation
2203
- };
2204
- }
2205
- componentDidCatch(e, t) {
2206
- console.error(
2207
- "React Router caught the following error during render",
2208
- e,
2209
- t
2210
- );
2211
- }
2212
- render() {
2213
- return this.state.error !== void 0 ? /* @__PURE__ */ f.createElement(L.Provider, { value: this.props.routeContext }, /* @__PURE__ */ f.createElement(
2214
- Qt.Provider,
2215
- {
2216
- value: this.state.error,
2217
- children: this.props.component
2218
- }
2219
- )) : this.props.children;
2220
- }
2221
- };
2222
- function Ji({ routeContext: e, match: t, children: r }) {
2223
- let n = f.useContext(K);
2224
- return n && n.static && n.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (n.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ f.createElement(L.Provider, { value: e }, r);
2225
- }
2226
- function Yi(e, t = [], r = null, n = null) {
2227
- if (e == null) {
2228
- if (!r)
2229
- return null;
2230
- if (r.errors)
2231
- e = r.matches;
2232
- else if (t.length === 0 && !r.initialized && r.matches.length > 0)
2233
- e = r.matches;
2234
- else
2235
- return null;
2236
- }
2237
- let a = e, i = r == null ? void 0 : r.errors;
2238
- if (i != null) {
2239
- let s = a.findIndex(
2240
- (l) => l.route.id && (i == null ? void 0 : i[l.route.id]) !== void 0
2241
- );
2242
- x(
2243
- s >= 0,
2244
- `Could not find a matching route for errors on route IDs: ${Object.keys(
2245
- i
2246
- ).join(",")}`
2247
- ), a = a.slice(
2248
- 0,
2249
- Math.min(a.length, s + 1)
2250
- );
2251
- }
2252
- let o = !1, u = -1;
2253
- if (r)
2254
- for (let s = 0; s < a.length; s++) {
2255
- let l = a[s];
2256
- if ((l.route.HydrateFallback || l.route.hydrateFallbackElement) && (u = s), l.route.id) {
2257
- let { loaderData: m, errors: v } = r, h = l.route.loader && !m.hasOwnProperty(l.route.id) && (!v || v[l.route.id] === void 0);
2258
- if (l.route.lazy || h) {
2259
- o = !0, u >= 0 ? a = a.slice(0, u + 1) : a = [a[0]];
2260
- break;
2261
- }
2262
- }
2263
- }
2264
- return a.reduceRight((s, l, m) => {
2265
- let v, h = !1, _ = null, d = null;
2266
- r && (v = i && l.route.id ? i[l.route.id] : void 0, _ = l.route.errorElement || Ki, o && (u < 0 && m === 0 ? (Un(
2267
- "route-fallback",
2268
- !1,
2269
- "No `HydrateFallback` element provided to render during initial hydration"
2270
- ), h = !0, d = null) : u === m && (h = !0, d = l.route.hydrateFallbackElement || null)));
2271
- let S = t.concat(a.slice(0, m + 1)), C = () => {
2272
- let y;
2273
- return v ? y = _ : h ? y = d : l.route.Component ? y = /* @__PURE__ */ f.createElement(l.route.Component, null) : l.route.element ? y = l.route.element : y = s, /* @__PURE__ */ f.createElement(
2274
- Ji,
2275
- {
2276
- match: l,
2277
- routeContext: {
2278
- outlet: s,
2279
- matches: S,
2280
- isDataRoute: r != null
2281
- },
2282
- children: y
2283
- }
2284
- );
2285
- };
2286
- return r && (l.route.ErrorBoundary || l.route.errorElement || m === 0) ? /* @__PURE__ */ f.createElement(
2287
- Vi,
2288
- {
2289
- location: r.location,
2290
- revalidation: r.revalidation,
2291
- component: _,
2292
- error: v,
2293
- children: C(),
2294
- routeContext: { outlet: null, matches: S, isDataRoute: !0 }
2295
- }
2296
- ) : C();
2297
- }, null);
2298
- }
2299
- function tr(e) {
2300
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2301
- }
2302
- function Xi(e) {
2303
- let t = f.useContext(K);
2304
- return x(t, tr(e)), t;
2305
- }
2306
- function Zi(e) {
2307
- let t = f.useContext(Se);
2308
- return x(t, tr(e)), t;
2309
- }
2310
- function Qi(e) {
2311
- let t = f.useContext(L);
2312
- return x(t, tr(e)), t;
2313
- }
2314
- function rr(e) {
2315
- let t = Qi(e), r = t.matches[t.matches.length - 1];
2316
- return x(
2317
- r.route.id,
2318
- `${e} can only be used on routes that contain a unique "id"`
2319
- ), r.route.id;
2320
- }
2321
- function eo() {
2322
- return rr(
2323
- "useRouteId"
2324
- /* UseRouteId */
2325
- );
2326
- }
2327
- function to() {
2328
- var n;
2329
- let e = f.useContext(Qt), t = Zi(
2330
- "useRouteError"
2331
- /* UseRouteError */
2332
- ), r = rr(
2333
- "useRouteError"
2334
- /* UseRouteError */
2335
- );
2336
- return e !== void 0 ? e : (n = t.errors) == null ? void 0 : n[r];
2337
- }
2338
- function ro() {
2339
- let { router: e } = Xi(
2340
- "useNavigate"
2341
- /* UseNavigateStable */
2342
- ), t = rr(
2343
- "useNavigate"
2344
- /* UseNavigateStable */
2345
- ), r = f.useRef(!1);
2346
- return Hn(() => {
2347
- r.current = !0;
2348
- }), f.useCallback(
2349
- async (a, i = {}) => {
2350
- A(r.current, zn), r.current && (typeof a == "number" ? e.navigate(a) : await e.navigate(a, { fromRouteId: t, ...i }));
2351
- },
2352
- [e, t]
2353
- );
2354
- }
2355
- var vn = {};
2356
- function Un(e, t, r) {
2357
- !t && !vn[e] && (vn[e] = !0, A(!1, r));
2358
- }
2359
- f.memo(no);
2360
- function no({
2361
- routes: e,
2362
- future: t,
2363
- state: r
2364
- }) {
2365
- return Bi(e, void 0, r, t);
2366
- }
2367
- var le = "get", ce = "application/x-www-form-urlencoded";
2368
- function Re(e) {
2369
- return e != null && typeof e.tagName == "string";
2370
- }
2371
- function ao(e) {
2372
- return Re(e) && e.tagName.toLowerCase() === "button";
2373
- }
2374
- function io(e) {
2375
- return Re(e) && e.tagName.toLowerCase() === "form";
2376
- }
2377
- function oo(e) {
2378
- return Re(e) && e.tagName.toLowerCase() === "input";
2379
- }
2380
- function uo(e) {
2381
- return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
2382
- }
2383
- function so(e, t) {
2384
- return e.button === 0 && // Ignore everything but left clicks
2385
- (!t || t === "_self") && // Let browser handle "target=_blank" etc.
2386
- !uo(e);
2387
- }
2388
- function Ht(e = "") {
2389
- return new URLSearchParams(
2390
- typeof e == "string" || Array.isArray(e) || e instanceof URLSearchParams ? e : Object.keys(e).reduce((t, r) => {
2391
- let n = e[r];
2392
- return t.concat(
2393
- Array.isArray(n) ? n.map((a) => [r, a]) : [[r, n]]
2394
- );
2395
- }, [])
2396
- );
2397
- }
2398
- function lo(e, t) {
2399
- let r = Ht(e);
2400
- return t && t.forEach((n, a) => {
2401
- r.has(a) || t.getAll(a).forEach((i) => {
2402
- r.append(a, i);
2403
- });
2404
- }), r;
2405
- }
2406
- var se = null;
2407
- function co() {
2408
- if (se === null)
2409
- try {
2410
- new FormData(
2411
- document.createElement("form"),
2412
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
2413
- 0
2414
- ), se = !1;
2415
- } catch {
2416
- se = !0;
2417
- }
2418
- return se;
2419
- }
2420
- var fo = /* @__PURE__ */ new Set([
2421
- "application/x-www-form-urlencoded",
2422
- "multipart/form-data",
2423
- "text/plain"
2424
- ]);
2425
- function kt(e) {
2426
- return e != null && !fo.has(e) ? (A(
2427
- !1,
2428
- `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ce}"`
2429
- ), null) : e;
2430
- }
2431
- function ho(e, t) {
2432
- let r, n, a, i, o;
2433
- if (io(e)) {
2434
- let u = e.getAttribute("action");
2435
- n = u ? z(u, t) : null, r = e.getAttribute("method") || le, a = kt(e.getAttribute("enctype")) || ce, i = new FormData(e);
2436
- } else if (ao(e) || oo(e) && (e.type === "submit" || e.type === "image")) {
2437
- let u = e.form;
2438
- if (u == null)
2439
- throw new Error(
2440
- 'Cannot submit a <button> or <input type="submit"> without a <form>'
2441
- );
2442
- let s = e.getAttribute("formaction") || u.getAttribute("action");
2443
- if (n = s ? z(s, t) : null, r = e.getAttribute("formmethod") || u.getAttribute("method") || le, a = kt(e.getAttribute("formenctype")) || kt(u.getAttribute("enctype")) || ce, i = new FormData(u, e), !co()) {
2444
- let { name: l, type: m, value: v } = e;
2445
- if (m === "image") {
2446
- let h = l ? `${l}.` : "";
2447
- i.append(`${h}x`, "0"), i.append(`${h}y`, "0");
2448
- } else l && i.append(l, v);
2449
- }
2450
- } else {
2451
- if (Re(e))
2452
- throw new Error(
2453
- 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
2454
- );
2455
- r = le, n = null, a = ce, o = e;
2456
- }
2457
- return i && a === "text/plain" && (o = i, i = void 0), { action: n, method: r.toLowerCase(), encType: a, formData: i, body: o };
2458
- }
2459
- function nr(e, t) {
2460
- if (e === !1 || e === null || typeof e > "u")
2461
- throw new Error(t);
2462
- }
2463
- async function po(e, t) {
2464
- if (e.id in t)
2465
- return t[e.id];
2466
- try {
2467
- let r = await import(
2468
- /* @vite-ignore */
2469
- /* webpackIgnore: true */
2470
- e.module
2471
- );
2472
- return t[e.id] = r, r;
2473
- } catch (r) {
2474
- return console.error(
2475
- `Error loading route module \`${e.module}\`, reloading page...`
2476
- ), console.error(r), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
2477
- });
2478
- }
2479
- }
2480
- function mo(e) {
2481
- return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
2482
- }
2483
- async function yo(e, t, r) {
2484
- let n = await Promise.all(
2485
- e.map(async (a) => {
2486
- let i = t.routes[a.route.id];
2487
- if (i) {
2488
- let o = await po(i, r);
2489
- return o.links ? o.links() : [];
2490
- }
2491
- return [];
2492
- })
2493
- );
2494
- return bo(
2495
- n.flat(1).filter(mo).filter((a) => a.rel === "stylesheet" || a.rel === "preload").map(
2496
- (a) => a.rel === "stylesheet" ? { ...a, rel: "prefetch", as: "style" } : { ...a, rel: "prefetch" }
2497
- )
2498
- );
2499
- }
2500
- function gn(e, t, r, n, a, i) {
2501
- let o = (s, l) => r[l] ? s.route.id !== r[l].route.id : !0, u = (s, l) => {
2502
- var m;
2503
- return (
2504
- // param change, /users/123 -> /users/456
2505
- r[l].pathname !== s.pathname || // splat param changed, which is not present in match.path
2506
- // e.g. /files/images/avatar.jpg -> files/finances.xls
2507
- ((m = r[l].route.path) == null ? void 0 : m.endsWith("*")) && r[l].params["*"] !== s.params["*"]
2508
- );
2509
- };
2510
- return i === "assets" ? t.filter(
2511
- (s, l) => o(s, l) || u(s, l)
2512
- ) : i === "data" ? t.filter((s, l) => {
2513
- var v;
2514
- let m = n.routes[s.route.id];
2515
- if (!m || !m.hasLoader)
2516
- return !1;
2517
- if (o(s, l) || u(s, l))
2518
- return !0;
2519
- if (s.route.shouldRevalidate) {
2520
- let h = s.route.shouldRevalidate({
2521
- currentUrl: new URL(
2522
- a.pathname + a.search + a.hash,
2523
- window.origin
2524
- ),
2525
- currentParams: ((v = r[0]) == null ? void 0 : v.params) || {},
2526
- nextUrl: new URL(e, window.origin),
2527
- nextParams: s.params,
2528
- defaultShouldRevalidate: !0
2529
- });
2530
- if (typeof h == "boolean")
2531
- return h;
2532
- }
2533
- return !0;
2534
- }) : [];
2535
- }
2536
- function vo(e, t, { includeHydrateFallback: r } = {}) {
2537
- return go(
2538
- e.map((n) => {
2539
- let a = t.routes[n.route.id];
2540
- if (!a) return [];
2541
- let i = [a.module];
2542
- return a.clientActionModule && (i = i.concat(a.clientActionModule)), a.clientLoaderModule && (i = i.concat(a.clientLoaderModule)), r && a.hydrateFallbackModule && (i = i.concat(a.hydrateFallbackModule)), a.imports && (i = i.concat(a.imports)), i;
2543
- }).flat(1)
2544
- );
2545
- }
2546
- function go(e) {
2547
- return [...new Set(e)];
2548
- }
2549
- function _o(e) {
2550
- let t = {}, r = Object.keys(e).sort();
2551
- for (let n of r)
2552
- t[n] = e[n];
2553
- return t;
2554
- }
2555
- function bo(e, t) {
2556
- let r = /* @__PURE__ */ new Set();
2557
- return new Set(t), e.reduce((n, a) => {
2558
- let i = JSON.stringify(_o(a));
2559
- return r.has(i) || (r.add(i), n.push({ key: i, link: a })), n;
2560
- }, []);
2561
- }
2562
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
2563
- var wo = /* @__PURE__ */ new Set([100, 101, 204, 205]);
2564
- function Co(e, t) {
2565
- let r = typeof e == "string" ? new URL(
2566
- e,
2567
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
2568
- // don't assume window is available
2569
- typeof window > "u" ? "server://singlefetch/" : window.location.origin
2570
- ) : e;
2571
- return r.pathname === "/" ? r.pathname = "_root.data" : t && z(r.pathname, t) === "/" ? r.pathname = `${t.replace(/\/$/, "")}/_root.data` : r.pathname = `${r.pathname.replace(/\/$/, "")}.data`, r;
2572
- }
2573
- function Gn() {
2574
- let e = f.useContext(K);
2575
- return nr(
2576
- e,
2577
- "You must render this element inside a <DataRouterContext.Provider> element"
2578
- ), e;
2579
- }
2580
- function So() {
2581
- let e = f.useContext(Se);
2582
- return nr(
2583
- e,
2584
- "You must render this element inside a <DataRouterStateContext.Provider> element"
2585
- ), e;
2586
- }
2587
- var ar = f.createContext(void 0);
2588
- ar.displayName = "FrameworkContext";
2589
- function Bn() {
2590
- let e = f.useContext(ar);
2591
- return nr(
2592
- e,
2593
- "You must render this element inside a <HydratedRouter> element"
2594
- ), e;
2595
- }
2596
- function Ro(e, t) {
2597
- let r = f.useContext(ar), [n, a] = f.useState(!1), [i, o] = f.useState(!1), { onFocus: u, onBlur: s, onMouseEnter: l, onMouseLeave: m, onTouchStart: v } = t, h = f.useRef(null);
2598
- f.useEffect(() => {
2599
- if (e === "render" && o(!0), e === "viewport") {
2600
- let S = (y) => {
2601
- y.forEach((c) => {
2602
- o(c.isIntersecting);
2603
- });
2604
- }, C = new IntersectionObserver(S, { threshold: 0.5 });
2605
- return h.current && C.observe(h.current), () => {
2606
- C.disconnect();
2607
- };
2608
- }
2609
- }, [e]), f.useEffect(() => {
2610
- if (n) {
2611
- let S = setTimeout(() => {
2612
- o(!0);
2613
- }, 100);
2614
- return () => {
2615
- clearTimeout(S);
2616
- };
2617
- }
2618
- }, [n]);
2619
- let _ = () => {
2620
- a(!0);
2621
- }, d = () => {
2622
- a(!1), o(!1);
2623
- };
2624
- return r ? e !== "intent" ? [i, h, {}] : [
2625
- i,
2626
- h,
2627
- {
2628
- onFocus: Y(u, _),
2629
- onBlur: Y(s, d),
2630
- onMouseEnter: Y(l, _),
2631
- onMouseLeave: Y(m, d),
2632
- onTouchStart: Y(v, _)
2633
- }
2634
- ] : [!1, h, {}];
2635
- }
2636
- function Y(e, t) {
2637
- return (r) => {
2638
- e && e(r), r.defaultPrevented || t(r);
2639
- };
2640
- }
2641
- function Eo({
2642
- page: e,
2643
- ...t
2644
- }) {
2645
- let { router: r } = Gn(), n = f.useMemo(
2646
- () => Mn(r.routes, e, r.basename),
2647
- [r.routes, e, r.basename]
2648
- );
2649
- return n ? /* @__PURE__ */ f.createElement(xo, { page: e, matches: n, ...t }) : null;
2650
- }
2651
- function Po(e) {
2652
- let { manifest: t, routeModules: r } = Bn(), [n, a] = f.useState([]);
2653
- return f.useEffect(() => {
2654
- let i = !1;
2655
- return yo(e, t, r).then(
2656
- (o) => {
2657
- i || a(o);
2658
- }
2659
- ), () => {
2660
- i = !0;
2661
- };
2662
- }, [e, t, r]), n;
2663
- }
2664
- function xo({
2665
- page: e,
2666
- matches: t,
2667
- ...r
2668
- }) {
2669
- let n = $(), { manifest: a, routeModules: i } = Bn(), { basename: o } = Gn(), { loaderData: u, matches: s } = So(), l = f.useMemo(
2670
- () => gn(
2671
- e,
2672
- t,
2673
- s,
2674
- a,
2675
- n,
2676
- "data"
2677
- ),
2678
- [e, t, s, a, n]
2679
- ), m = f.useMemo(
2680
- () => gn(
2681
- e,
2682
- t,
2683
- s,
2684
- a,
2685
- n,
2686
- "assets"
2687
- ),
2688
- [e, t, s, a, n]
2689
- ), v = f.useMemo(() => {
2690
- if (e === n.pathname + n.search + n.hash)
2691
- return [];
2692
- let d = /* @__PURE__ */ new Set(), S = !1;
2693
- if (t.forEach((y) => {
2694
- var p;
2695
- let c = a.routes[y.route.id];
2696
- !c || !c.hasLoader || (!l.some((b) => b.route.id === y.route.id) && y.route.id in u && ((p = i[y.route.id]) != null && p.shouldRevalidate) || c.hasClientLoader ? S = !0 : d.add(y.route.id));
2697
- }), d.size === 0)
2698
- return [];
2699
- let C = Co(e, o);
2700
- return S && d.size > 0 && C.searchParams.set(
2701
- "_routes",
2702
- t.filter((y) => d.has(y.route.id)).map((y) => y.route.id).join(",")
2703
- ), [C.pathname + C.search];
271
+ function L() {
272
+ const t = i.useRef(null);
273
+ return i.useMemo(() => ({ customElement: t }), []);
274
+ }
275
+ function V(t) {
276
+ var n, r, s, o;
277
+ const e = i.useRef(!1);
278
+ i.useLayoutEffect(() => {
279
+ t.dispatchers.dispatch(h.Derive, [
280
+ t.options.props,
281
+ t.router.current
282
+ ]);
2704
283
  }, [
2705
- o,
2706
- u,
2707
- n,
2708
- a,
2709
- l,
2710
- t,
2711
- e,
2712
- i
2713
- ]), h = f.useMemo(
2714
- () => vo(m, a),
2715
- [m, a]
2716
- ), _ = Po(m);
2717
- return /* @__PURE__ */ f.createElement(f.Fragment, null, v.map((d) => /* @__PURE__ */ f.createElement("link", { key: d, rel: "prefetch", as: "fetch", href: d, ...r })), h.map((d) => /* @__PURE__ */ f.createElement("link", { key: d, rel: "modulepreload", href: d, ...r })), _.map(({ key: d, link: S }) => (
2718
- // these don't spread `linkProps` because they are full link descriptors
2719
- // already with their own props
2720
- /* @__PURE__ */ f.createElement("link", { key: d, ...S })
2721
- )));
2722
- }
2723
- function Oo(...e) {
2724
- return (t) => {
2725
- e.forEach((r) => {
2726
- typeof r == "function" ? r(t) : r != null && (r.current = t);
2727
- });
2728
- };
2729
- }
2730
- var Wn = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
2731
- try {
2732
- Wn && (window.__reactRouterVersion = "7.6.0");
2733
- } catch {
2734
- }
2735
- var Kn = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, Vn = f.forwardRef(
2736
- function({
2737
- onClick: t,
2738
- discover: r = "render",
2739
- prefetch: n = "none",
2740
- relative: a,
2741
- reloadDocument: i,
2742
- replace: o,
2743
- state: u,
2744
- target: s,
2745
- to: l,
2746
- preventScrollReset: m,
2747
- viewTransition: v,
2748
- ...h
2749
- }, _) {
2750
- let { basename: d } = f.useContext(F), S = typeof l == "string" && Kn.test(l), C, y = !1;
2751
- if (typeof l == "string" && S && (C = l, Wn))
2752
- try {
2753
- let P = new URL(window.location.href), j = l.startsWith("//") ? new URL(P.protocol + l) : new URL(l), T = z(j.pathname, d);
2754
- j.origin === P.origin && T != null ? l = T + j.search + j.hash : y = !0;
2755
- } catch {
2756
- A(
2757
- !1,
2758
- `<Link to="${l}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
2759
- );
2760
- }
2761
- let c = Hi(l, { relative: a }), [p, b, g] = Ro(
2762
- n,
2763
- h
2764
- ), R = ko(l, {
2765
- replace: o,
2766
- state: u,
2767
- target: s,
2768
- preventScrollReset: m,
2769
- relative: a,
2770
- viewTransition: v
2771
- });
2772
- function O(P) {
2773
- t && t(P), P.defaultPrevented || R(P);
2774
- }
2775
- let M = (
2776
- // eslint-disable-next-line jsx-a11y/anchor-has-content
2777
- /* @__PURE__ */ f.createElement(
2778
- "a",
2779
- {
2780
- ...h,
2781
- ...g,
2782
- href: C || c,
2783
- onClick: y || i ? t : O,
2784
- ref: Oo(_, b),
2785
- target: s,
2786
- "data-discover": !S && r === "render" ? "true" : void 0
2787
- }
2788
- )
2789
- );
2790
- return p && !S ? /* @__PURE__ */ f.createElement(f.Fragment, null, M, /* @__PURE__ */ f.createElement(Eo, { page: c })) : M;
2791
- }
2792
- );
2793
- Vn.displayName = "Link";
2794
- var To = f.forwardRef(
2795
- function({
2796
- "aria-current": t = "page",
2797
- caseSensitive: r = !1,
2798
- className: n = "",
2799
- end: a = !1,
2800
- style: i,
2801
- to: o,
2802
- viewTransition: u,
2803
- children: s,
2804
- ...l
2805
- }, m) {
2806
- let v = ae(o, { relative: l.relative }), h = $(), _ = f.useContext(Se), { navigator: d, basename: S } = f.useContext(F), C = _ != null && // Conditional usage is OK here because the usage of a data router is static
2807
- // eslint-disable-next-line react-hooks/rules-of-hooks
2808
- No(v) && u === !0, y = d.encodeLocation ? d.encodeLocation(v).pathname : v.pathname, c = h.pathname, p = _ && _.navigation && _.navigation.location ? _.navigation.location.pathname : null;
2809
- r || (c = c.toLowerCase(), p = p ? p.toLowerCase() : null, y = y.toLowerCase()), p && S && (p = z(p, S) || p);
2810
- const b = y !== "/" && y.endsWith("/") ? y.length - 1 : y.length;
2811
- let g = c === y || !a && c.startsWith(y) && c.charAt(b) === "/", R = p != null && (p === y || !a && p.startsWith(y) && p.charAt(y.length) === "/"), O = {
2812
- isActive: g,
2813
- isPending: R,
2814
- isTransitioning: C
2815
- }, M = g ? t : void 0, P;
2816
- typeof n == "function" ? P = n(O) : P = [
2817
- n,
2818
- g ? "active" : null,
2819
- R ? "pending" : null,
2820
- C ? "transitioning" : null
2821
- ].filter(Boolean).join(" ");
2822
- let j = typeof i == "function" ? i(O) : i;
2823
- return /* @__PURE__ */ f.createElement(
2824
- Vn,
2825
- {
2826
- ...l,
2827
- "aria-current": M,
2828
- className: P,
2829
- ref: m,
2830
- style: j,
2831
- to: o,
2832
- viewTransition: u
2833
- },
2834
- typeof s == "function" ? s(O) : s
2835
- );
2836
- }
2837
- );
2838
- To.displayName = "NavLink";
2839
- var Do = f.forwardRef(
2840
- ({
2841
- discover: e = "render",
2842
- fetcherKey: t,
2843
- navigate: r,
2844
- reloadDocument: n,
2845
- replace: a,
2846
- state: i,
2847
- method: o = le,
2848
- action: u,
2849
- onSubmit: s,
2850
- relative: l,
2851
- preventScrollReset: m,
2852
- viewTransition: v,
2853
- ...h
2854
- }, _) => {
2855
- let d = Ao(), S = Lo(u, { relative: l }), C = o.toLowerCase() === "get" ? "get" : "post", y = typeof u == "string" && Kn.test(u), c = (p) => {
2856
- if (s && s(p), p.defaultPrevented) return;
2857
- p.preventDefault();
2858
- let b = p.nativeEvent.submitter, g = (b == null ? void 0 : b.getAttribute("formmethod")) || o;
2859
- d(b || p.currentTarget, {
2860
- fetcherKey: t,
2861
- method: g,
2862
- navigate: r,
2863
- replace: a,
2864
- state: i,
2865
- relative: l,
2866
- preventScrollReset: m,
2867
- viewTransition: v
2868
- });
2869
- };
2870
- return /* @__PURE__ */ f.createElement(
2871
- "form",
2872
- {
2873
- ref: _,
2874
- method: C,
2875
- action: S,
2876
- onSubmit: n ? s : c,
2877
- ...h,
2878
- "data-discover": !y && e === "render" ? "true" : void 0
2879
- }
2880
- );
2881
- }
2882
- );
2883
- Do.displayName = "Form";
2884
- function qo(e) {
2885
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
2886
- }
2887
- function Jn(e) {
2888
- let t = f.useContext(K);
2889
- return x(t, qo(e)), t;
2890
- }
2891
- function ko(e, {
2892
- target: t,
2893
- replace: r,
2894
- state: n,
2895
- preventScrollReset: a,
2896
- relative: i,
2897
- viewTransition: o
2898
- } = {}) {
2899
- let u = er(), s = $(), l = ae(e, { relative: i });
2900
- return f.useCallback(
2901
- (m) => {
2902
- if (so(m, t)) {
2903
- m.preventDefault();
2904
- let v = r !== void 0 ? r : zt(s) === zt(l);
2905
- u(e, {
2906
- replace: v,
2907
- state: n,
2908
- preventScrollReset: a,
2909
- relative: i,
2910
- viewTransition: o
2911
- });
2912
- }
2913
- },
2914
- [
2915
- s,
2916
- u,
2917
- l,
2918
- r,
2919
- n,
2920
- t,
2921
- e,
2922
- a,
2923
- i,
2924
- o
2925
- ]
2926
- );
2927
- }
2928
- function Io(e) {
2929
- A(
2930
- typeof URLSearchParams < "u",
2931
- "You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params."
2932
- );
2933
- let t = f.useRef(Ht(e)), r = f.useRef(!1), n = $(), a = f.useMemo(
2934
- () => (
2935
- // Only merge in the defaults if we haven't yet called setSearchParams.
2936
- // Once we call that we want those to take precedence, otherwise you can't
2937
- // remove a param with setSearchParams({}) if it has an initial value
2938
- lo(
2939
- n.search,
2940
- r.current ? null : t.current
2941
- )
2942
- ),
2943
- [n.search]
2944
- ), i = er(), o = f.useCallback(
2945
- (u, s) => {
2946
- const l = Ht(
2947
- typeof u == "function" ? u(a) : u
2948
- );
2949
- r.current = !0, i("?" + l, s);
2950
- },
2951
- [i, a]
2952
- );
2953
- return [a, o];
2954
- }
2955
- var Mo = 0, jo = () => `__${String(++Mo)}__`;
2956
- function Ao() {
2957
- let { router: e } = Jn(
2958
- "useSubmit"
2959
- /* UseSubmit */
2960
- ), { basename: t } = f.useContext(F), r = eo();
2961
- return f.useCallback(
2962
- async (n, a = {}) => {
2963
- let { action: i, method: o, encType: u, formData: s, body: l } = ho(
2964
- n,
2965
- t
2966
- );
2967
- if (a.navigate === !1) {
2968
- let m = a.fetcherKey || jo();
2969
- await e.fetch(m, r, a.action || i, {
2970
- preventScrollReset: a.preventScrollReset,
2971
- formData: s,
2972
- body: l,
2973
- formMethod: a.method || o,
2974
- formEncType: a.encType || u,
2975
- flushSync: a.flushSync
2976
- });
2977
- } else
2978
- await e.navigate(a.action || i, {
2979
- preventScrollReset: a.preventScrollReset,
2980
- formData: s,
2981
- body: l,
2982
- formMethod: a.method || o,
2983
- formEncType: a.encType || u,
2984
- replace: a.replace,
2985
- state: a.state,
2986
- fromRouteId: r,
2987
- flushSync: a.flushSync,
2988
- viewTransition: a.viewTransition
2989
- });
2990
- },
2991
- [e, t, r]
2992
- );
284
+ t.options.props,
285
+ (n = t.router.current) == null ? void 0 : n.location,
286
+ (r = t.router.current) == null ? void 0 : r.params,
287
+ (o = (s = t.router.current) == null ? void 0 : s.search) == null ? void 0 : o[0]
288
+ ]), i.useLayoutEffect(() => {
289
+ if (!e.current)
290
+ return e.current = !0, t.dispatchers.dispatch(h.Mount, []), t.dispatchers.dispatch(h.Node, [
291
+ t.elements.customElement.current
292
+ ]), () => t.dispatchers.dispatch(h.Unmount, []);
293
+ }, []);
2993
294
  }
2994
- function Lo(e, { relative: t } = {}) {
2995
- let { basename: r } = f.useContext(F), n = f.useContext(L);
2996
- x(n, "useFormAction must be used inside a RouteContext");
2997
- let [a] = n.matches.slice(-1), i = { ...ae(e || ".", { relative: t }) }, o = $();
2998
- if (e == null) {
2999
- i.search = o.search;
3000
- let u = new URLSearchParams(i.search), s = u.getAll("index");
3001
- if (s.some((m) => m === "")) {
3002
- u.delete("index"), s.filter((v) => v).forEach((v) => u.append("index", v));
3003
- let m = u.toString();
3004
- i.search = m ? `?${m}` : "";
3005
- }
3006
- }
3007
- return (!e || e === ".") && a.route.index && (i.search = i.search ? i.search.replace(/^\?/, "?index&") : "?index"), r !== "/" && (i.pathname = i.pathname === "/" ? r : N([r, i.pathname])), zt(i);
295
+ function X(t) {
296
+ const e = i.useMemo(() => t.options.model ?? {}, []);
297
+ return i.useRef(new x(e, e));
3008
298
  }
3009
- function No(e, t = {}) {
3010
- let r = f.useContext($n);
3011
- x(
3012
- r != null,
3013
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
3014
- );
3015
- let { basename: n } = Jn(
3016
- "useViewTransitionState"
3017
- /* useViewTransitionState */
3018
- ), a = ae(e, { relative: t.relative });
3019
- if (!r.isTransitioning)
3020
- return !1;
3021
- let i = z(r.currentLocation.pathname, n) || r.currentLocation.pathname, o = z(r.nextLocation.pathname, n) || r.nextLocation.pathname;
3022
- return me(a.pathname, o) != null || me(a.pathname, i) != null;
299
+ function Y() {
300
+ return i.useRef(/* @__PURE__ */ new Set());
3023
301
  }
3024
- [
3025
- ...wo
3026
- ];
3027
- function Fo() {
3028
- return f.useRef(null);
302
+ function Z() {
303
+ return i.useRef(null);
3029
304
  }
3030
- function $o({ using: e }) {
3031
- return ne() ? /* @__PURE__ */ fe(zo, { using: e }) : null;
305
+ function tt({ using: t, children: e }) {
306
+ return d.useInRouterContext() ? /* @__PURE__ */ m(et, { using: t, children: e }) : e();
3032
307
  }
3033
- function zo({ using: e }) {
3034
- const t = er(), r = $(), n = Gi(), a = Io();
3035
- return e.current = {
3036
- navigate: t,
3037
- location: r,
3038
- params: n,
3039
- searchParams: a
3040
- }, null;
308
+ function et({ using: t, children: e }) {
309
+ return t.current = {
310
+ navigate: d.useNavigate(),
311
+ location: d.useLocation(),
312
+ params: d.useParams(),
313
+ search: d.useSearchParams()
314
+ }, /* @__PURE__ */ m(B, { children: e() });
3041
315
  }
3042
- function Ho() {
3043
- const [e, t] = f.useReducer((r) => r + 1, 0);
3044
- return f.useMemo(() => ({ hash: e, rerender: t }), [e]);
316
+ function nt() {
317
+ const [t, e] = i.useReducer((n) => n + 1, 0);
318
+ return i.useMemo(() => ({ hash: t, rerender: e }), [t]);
3045
319
  }
3046
- function Uo({
3047
- options: e
320
+ function rt({
321
+ options: t
3048
322
  }) {
3049
- const t = bn(), r = Ho(), n = vi(), a = hi(), i = Fo(), o = yi({ options: e }), u = mi({ options: e, elements: a }), s = di({
3050
- app: t,
3051
- options: e,
3052
- update: r,
3053
- model: o,
3054
- logger: u,
3055
- queue: n
3056
- }), l = si({ app: t, options: e, model: o, dispatchers: s, router: i });
3057
- return li({ options: e, dispatchers: s, actions: l }), pi({ options: e, dispatchers: s, elements: a }), f.useMemo(() => (u.output({}), f.createElement(e.name, {
3058
- ref: a.customElement,
3059
- children: /* @__PURE__ */ Zn(Qn, { children: [
3060
- /* @__PURE__ */ fe($o, { using: i }),
3061
- e.view(l.view)
3062
- ] })
3063
- })), [r.hash]);
3064
- }
3065
- function Go(e) {
3066
- return (t) => f.memo(
3067
- (r) => Uo({
323
+ const e = A(), n = nt(), r = Y(), s = L(), o = Z(), u = X({ options: t }), a = K({ app: e, options: t, update: n, model: u, queue: r }), c = Q({ app: e, options: t, model: u, dispatchers: a, router: o });
324
+ return W({ options: t, dispatchers: a, actions: c }), V({ options: t, dispatchers: a, elements: s, router: o }), i.useMemo(() => i.createElement(t.name, {
325
+ ref: s.customElement,
326
+ children: /* @__PURE__ */ m(tt, { using: o, children: () => t.view(c.view) })
327
+ }), [n.hash]);
328
+ }
329
+ function ot(t) {
330
+ return (e) => i.memo(
331
+ (n) => rt({
3068
332
  options: {
3069
- ...t,
3070
- name: e.join(""),
3071
- props: r
333
+ ...e,
334
+ name: t.join(""),
335
+ props: n
3072
336
  }
3073
337
  }),
3074
- (r, n) => JSON.stringify(r) === JSON.stringify(n)
338
+ (n, r) => JSON.stringify(n) === JSON.stringify(r)
3075
339
  );
3076
340
  }
3077
- function Bo(e) {
3078
- return e;
3079
- }
3080
- function Wo(e) {
3081
- return new Promise((t) => setTimeout(t, e));
341
+ function st(t) {
342
+ return new Promise((e) => setTimeout(e, t));
3082
343
  }
3083
- function Ko(e) {
3084
- return e ? !!(e && typeof e != "symbol") : Symbol(`pk.${Date.now()}.${crypto.randomUUID()}`);
344
+ function ut(t) {
345
+ return t ? !!(t && typeof t != "symbol") : Symbol(`pk.${Date.now()}.${crypto.randomUUID()}`);
3085
346
  }
3086
- function Vo(e) {
3087
- return e instanceof fi;
347
+ function it(t) {
348
+ return t instanceof H;
3088
349
  }
3089
- const Zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
350
+ const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3090
351
  __proto__: null,
3091
- isEventError: Vo,
3092
- pk: Ko,
3093
- sleep: Wo
3094
- }, Symbol.toStringTag, { value: "Module" })), Qo = { app: ea, module: Go, model: ra, view: Bo, controller: ta };
352
+ isEventError: it,
353
+ pk: ut,
354
+ sleep: st
355
+ }, Symbol.toStringTag, { value: "Module" })), pt = { app: z, module: ot };
3095
356
  export {
3096
- fi as EventError,
3097
- X as Lifecycle,
3098
- na as State,
3099
- Qo as create,
3100
- Zo as utils
357
+ H as EventError,
358
+ h as Lifecycle,
359
+ F as State,
360
+ pt as create,
361
+ mt as utils
3101
362
  };