@standardbeagle/virtual-router 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,993 +1,341 @@
1
- import pe, { createContext as ve, useReducer as Lr, forwardRef as Mr, useContext as k, Children as Yr, isValidElement as Vr } from "react";
2
- var le = { exports: {} }, q = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var Ue;
13
- function Ur() {
14
- if (Ue)
15
- return q;
16
- Ue = 1;
17
- var r = pe, t = Symbol.for("react.element"), a = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, u = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function s(l, d, g) {
19
- var b, y = {}, _ = null, x = null;
20
- g !== void 0 && (_ = "" + g), d.key !== void 0 && (_ = "" + d.key), d.ref !== void 0 && (x = d.ref);
21
- for (b in d)
22
- o.call(d, b) && !c.hasOwnProperty(b) && (y[b] = d[b]);
23
- if (l && l.defaultProps)
24
- for (b in d = l.defaultProps, d)
25
- y[b] === void 0 && (y[b] = d[b]);
26
- return { $$typeof: t, type: l, key: _, ref: x, props: y, _owner: u.current };
1
+ import { j as jsxRuntimeExports, P as PathContext, a as PathDispatchContext, n as navigate, b as back, f as forward, R as RouteContext, m as matchPath } from "./provider-F-pulqTx.js";
2
+ import { c } from "./provider-F-pulqTx.js";
3
+ import require$$0, { createContext, useState, useCallback, useContext, Component, forwardRef, Children, isValidElement } from "react";
4
+ const combineRoutes = (base, child) => {
5
+ if (!base || !child)
6
+ return base ?? child ?? "";
7
+ const baseSegments = base.split("/").filter((s) => s !== "");
8
+ const childSegments = child.split("/").filter((s) => s !== "");
9
+ if (baseSegments.length > 0 && baseSegments.at(-1) === "*")
10
+ baseSegments.pop();
11
+ if (baseSegments.length === 0)
12
+ return `/${childSegments.join("/")}`;
13
+ return `/${baseSegments.join("/")}/${childSegments.join("/")}`;
14
+ };
15
+ const ErrorContext = createContext(null);
16
+ function ErrorProvider({ children }) {
17
+ const [errors, setErrors] = useState([]);
18
+ const addError = useCallback((error) => {
19
+ setErrors((prev) => [...prev, { ...error, timestamp: Date.now() }]);
20
+ }, []);
21
+ const clearErrors = useCallback(() => {
22
+ setErrors([]);
23
+ }, []);
24
+ const clearError = useCallback((timestamp) => {
25
+ setErrors((prev) => prev.filter((error) => error.timestamp !== timestamp));
26
+ }, []);
27
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorContext.Provider, { value: { errors, addError, clearErrors, clearError }, children });
28
+ }
29
+ function useRouteError() {
30
+ const context = useContext(ErrorContext);
31
+ if (!context) {
32
+ return null;
27
33
  }
28
- return q.Fragment = a, q.jsx = s, q.jsxs = s, q;
34
+ return context.errors[0] || null;
29
35
  }
30
- var B = {};
31
- /**
32
- * @license React
33
- * react-jsx-runtime.development.js
34
- *
35
- * Copyright (c) Facebook, Inc. and its affiliates.
36
- *
37
- * This source code is licensed under the MIT license found in the
38
- * LICENSE file in the root directory of this source tree.
39
- */
40
- var qe;
41
- function qr() {
42
- return qe || (qe = 1, process.env.NODE_ENV !== "production" && function() {
43
- var r = pe, t = Symbol.for("react.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), l = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), P = Symbol.iterator, I = "@@iterator";
44
- function A(e) {
45
- if (e === null || typeof e != "object")
46
- return null;
47
- var n = P && e[P] || e[I];
48
- return typeof n == "function" ? n : null;
49
- }
50
- var W = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
- function w(e) {
52
- {
53
- for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), f = 1; f < n; f++)
54
- i[f - 1] = arguments[f];
55
- ir("error", e, i);
56
- }
57
- }
58
- function ir(e, n, i) {
59
- {
60
- var f = W.ReactDebugCurrentFrame, h = f.getStackAddendum();
61
- h !== "" && (n += "%s", i = i.concat([h]));
62
- var m = i.map(function(v) {
63
- return String(v);
64
- });
65
- m.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, m);
66
- }
67
- }
68
- var ur = !1, sr = !1, cr = !1, fr = !1, lr = !1, be;
69
- be = Symbol.for("react.module.reference");
70
- function dr(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === o || e === c || lr || e === u || e === g || e === b || fr || e === x || ur || sr || cr || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === y || e.$$typeof === s || e.$$typeof === l || e.$$typeof === d || // This needs to include all possible module reference object
72
- // types supported by any Flight configuration anywhere since
73
- // we don't know which Flight build this will end up being used
74
- // with.
75
- e.$$typeof === be || e.getModuleId !== void 0));
76
- }
77
- function pr(e, n, i) {
78
- var f = e.displayName;
79
- if (f)
80
- return f;
81
- var h = n.displayName || n.name || "";
82
- return h !== "" ? i + "(" + h + ")" : i;
83
- }
84
- function Ee(e) {
85
- return e.displayName || "Context";
86
- }
87
- function j(e) {
88
- if (e == null)
89
- return null;
90
- if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
- return e.displayName || e.name || null;
92
- if (typeof e == "string")
93
- return e;
94
- switch (e) {
95
- case o:
96
- return "Fragment";
97
- case a:
98
- return "Portal";
99
- case c:
100
- return "Profiler";
101
- case u:
102
- return "StrictMode";
103
- case g:
104
- return "Suspense";
105
- case b:
106
- return "SuspenseList";
107
- }
108
- if (typeof e == "object")
109
- switch (e.$$typeof) {
110
- case l:
111
- var n = e;
112
- return Ee(n) + ".Consumer";
113
- case s:
114
- var i = e;
115
- return Ee(i._context) + ".Provider";
116
- case d:
117
- return pr(e, e.render, "ForwardRef");
118
- case y:
119
- var f = e.displayName || null;
120
- return f !== null ? f : j(e.type) || "Memo";
121
- case _: {
122
- var h = e, m = h._payload, v = h._init;
123
- try {
124
- return j(v(m));
125
- } catch {
126
- return null;
127
- }
128
- }
129
- }
130
- return null;
131
- }
132
- var $ = Object.assign, V = 0, Re, _e, we, Se, Pe, Oe, xe;
133
- function je() {
134
- }
135
- je.__reactDisabledLog = !0;
136
- function vr() {
137
- {
138
- if (V === 0) {
139
- Re = console.log, _e = console.info, we = console.warn, Se = console.error, Pe = console.group, Oe = console.groupCollapsed, xe = console.groupEnd;
140
- var e = {
141
- configurable: !0,
142
- enumerable: !0,
143
- value: je,
144
- writable: !0
145
- };
146
- Object.defineProperties(console, {
147
- info: e,
148
- log: e,
149
- warn: e,
150
- error: e,
151
- group: e,
152
- groupCollapsed: e,
153
- groupEnd: e
154
- });
155
- }
156
- V++;
157
- }
158
- }
159
- function hr() {
160
- {
161
- if (V--, V === 0) {
162
- var e = {
163
- configurable: !0,
164
- enumerable: !0,
165
- writable: !0
166
- };
167
- Object.defineProperties(console, {
168
- log: $({}, e, {
169
- value: Re
170
- }),
171
- info: $({}, e, {
172
- value: _e
173
- }),
174
- warn: $({}, e, {
175
- value: we
176
- }),
177
- error: $({}, e, {
178
- value: Se
179
- }),
180
- group: $({}, e, {
181
- value: Pe
182
- }),
183
- groupCollapsed: $({}, e, {
184
- value: Oe
185
- }),
186
- groupEnd: $({}, e, {
187
- value: xe
188
- })
189
- });
190
- }
191
- V < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
- }
193
- }
194
- var re = W.ReactCurrentDispatcher, te;
195
- function J(e, n, i) {
196
- {
197
- if (te === void 0)
198
- try {
199
- throw Error();
200
- } catch (h) {
201
- var f = h.stack.trim().match(/\n( *(at )?)/);
202
- te = f && f[1] || "";
203
- }
204
- return `
205
- ` + te + e;
206
- }
207
- }
208
- var ne = !1, z;
209
- {
210
- var gr = typeof WeakMap == "function" ? WeakMap : Map;
211
- z = new gr();
212
- }
213
- function Ce(e, n) {
214
- if (!e || ne)
215
- return "";
216
- {
217
- var i = z.get(e);
218
- if (i !== void 0)
219
- return i;
220
- }
221
- var f;
222
- ne = !0;
223
- var h = Error.prepareStackTrace;
224
- Error.prepareStackTrace = void 0;
225
- var m;
226
- m = re.current, re.current = null, vr();
227
- try {
228
- if (n) {
229
- var v = function() {
230
- throw Error();
231
- };
232
- if (Object.defineProperty(v.prototype, "props", {
233
- set: function() {
234
- throw Error();
235
- }
236
- }), typeof Reflect == "object" && Reflect.construct) {
237
- try {
238
- Reflect.construct(v, []);
239
- } catch (C) {
240
- f = C;
241
- }
242
- Reflect.construct(e, [], v);
243
- } else {
244
- try {
245
- v.call();
246
- } catch (C) {
247
- f = C;
248
- }
249
- e.call(v.prototype);
250
- }
251
- } else {
252
- try {
253
- throw Error();
254
- } catch (C) {
255
- f = C;
256
- }
257
- e();
258
- }
259
- } catch (C) {
260
- if (C && f && typeof C.stack == "string") {
261
- for (var p = C.stack.split(`
262
- `), S = f.stack.split(`
263
- `), E = p.length - 1, R = S.length - 1; E >= 1 && R >= 0 && p[E] !== S[R]; )
264
- R--;
265
- for (; E >= 1 && R >= 0; E--, R--)
266
- if (p[E] !== S[R]) {
267
- if (E !== 1 || R !== 1)
268
- do
269
- if (E--, R--, R < 0 || p[E] !== S[R]) {
270
- var O = `
271
- ` + p[E].replace(" at new ", " at ");
272
- return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && z.set(e, O), O;
273
- }
274
- while (E >= 1 && R >= 0);
275
- break;
276
- }
277
- }
278
- } finally {
279
- ne = !1, re.current = m, hr(), Error.prepareStackTrace = h;
280
- }
281
- var L = e ? e.displayName || e.name : "", Ve = L ? J(L) : "";
282
- return typeof e == "function" && z.set(e, Ve), Ve;
283
- }
284
- function yr(e, n, i) {
285
- return Ce(e, !1);
286
- }
287
- function mr(e) {
288
- var n = e.prototype;
289
- return !!(n && n.isReactComponent);
290
- }
291
- function H(e, n, i) {
292
- if (e == null)
293
- return "";
294
- if (typeof e == "function")
295
- return Ce(e, mr(e));
296
- if (typeof e == "string")
297
- return J(e);
298
- switch (e) {
299
- case g:
300
- return J("Suspense");
301
- case b:
302
- return J("SuspenseList");
303
- }
304
- if (typeof e == "object")
305
- switch (e.$$typeof) {
306
- case d:
307
- return yr(e.render);
308
- case y:
309
- return H(e.type, n, i);
310
- case _: {
311
- var f = e, h = f._payload, m = f._init;
312
- try {
313
- return H(m(h), n, i);
314
- } catch {
315
- }
316
- }
317
- }
318
- return "";
319
- }
320
- var Z = Object.prototype.hasOwnProperty, Te = {}, ke = W.ReactDebugCurrentFrame;
321
- function X(e) {
322
- if (e) {
323
- var n = e._owner, i = H(e.type, e._source, n ? n.type : null);
324
- ke.setExtraStackFrame(i);
325
- } else
326
- ke.setExtraStackFrame(null);
327
- }
328
- function br(e, n, i, f, h) {
329
- {
330
- var m = Function.call.bind(Z);
331
- for (var v in e)
332
- if (m(e, v)) {
333
- var p = void 0;
334
- try {
335
- if (typeof e[v] != "function") {
336
- var S = Error((f || "React class") + ": " + i + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
- throw S.name = "Invariant Violation", S;
338
- }
339
- p = e[v](n, v, f, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
- } catch (E) {
341
- p = E;
342
- }
343
- p && !(p instanceof Error) && (X(h), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", f || "React class", i, v, typeof p), X(null)), p instanceof Error && !(p.message in Te) && (Te[p.message] = !0, X(h), w("Failed %s type: %s", i, p.message), X(null));
344
- }
345
- }
346
- }
347
- var Er = Array.isArray;
348
- function ae(e) {
349
- return Er(e);
350
- }
351
- function Rr(e) {
352
- {
353
- var n = typeof Symbol == "function" && Symbol.toStringTag, i = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
- return i;
355
- }
356
- }
357
- function _r(e) {
358
- try {
359
- return Ae(e), !1;
360
- } catch {
361
- return !0;
362
- }
363
- }
364
- function Ae(e) {
365
- return "" + e;
366
- }
367
- function $e(e) {
368
- if (_r(e))
369
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Rr(e)), Ae(e);
370
- }
371
- var U = W.ReactCurrentOwner, wr = {
372
- key: !0,
373
- ref: !0,
374
- __self: !0,
375
- __source: !0
376
- }, De, Fe, oe;
377
- oe = {};
378
- function Sr(e) {
379
- if (Z.call(e, "ref")) {
380
- var n = Object.getOwnPropertyDescriptor(e, "ref").get;
381
- if (n && n.isReactWarning)
382
- return !1;
383
- }
384
- return e.ref !== void 0;
385
- }
386
- function Pr(e) {
387
- if (Z.call(e, "key")) {
388
- var n = Object.getOwnPropertyDescriptor(e, "key").get;
389
- if (n && n.isReactWarning)
390
- return !1;
391
- }
392
- return e.key !== void 0;
393
- }
394
- function Or(e, n) {
395
- if (typeof e.ref == "string" && U.current && n && U.current.stateNode !== n) {
396
- var i = j(U.current.type);
397
- oe[i] || (w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', j(U.current.type), e.ref), oe[i] = !0);
398
- }
399
- }
400
- function xr(e, n) {
401
- {
402
- var i = function() {
403
- De || (De = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
404
- };
405
- i.isReactWarning = !0, Object.defineProperty(e, "key", {
406
- get: i,
407
- configurable: !0
408
- });
409
- }
410
- }
411
- function jr(e, n) {
412
- {
413
- var i = function() {
414
- Fe || (Fe = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
415
- };
416
- i.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
- get: i,
418
- configurable: !0
419
- });
420
- }
421
- }
422
- var Cr = function(e, n, i, f, h, m, v) {
423
- var p = {
424
- // This tag allows us to uniquely identify this as a React Element
425
- $$typeof: t,
426
- // Built-in properties that belong on the element
427
- type: e,
428
- key: n,
429
- ref: i,
430
- props: v,
431
- // Record the component responsible for creating this element.
432
- _owner: m
433
- };
434
- return p._store = {}, Object.defineProperty(p._store, "validated", {
435
- configurable: !1,
436
- enumerable: !1,
437
- writable: !0,
438
- value: !1
439
- }), Object.defineProperty(p, "_self", {
440
- configurable: !1,
441
- enumerable: !1,
442
- writable: !1,
443
- value: f
444
- }), Object.defineProperty(p, "_source", {
445
- configurable: !1,
446
- enumerable: !1,
447
- writable: !1,
448
- value: h
449
- }), Object.freeze && (Object.freeze(p.props), Object.freeze(p)), p;
36
+ function useRouteErrors() {
37
+ return useContext(ErrorContext);
38
+ }
39
+ class RouterErrorBoundary extends Component {
40
+ constructor(props) {
41
+ super(props);
42
+ this.state = { hasError: false };
43
+ }
44
+ static getDerivedStateFromError(error) {
45
+ return {
46
+ hasError: true,
47
+ error
450
48
  };
451
- function Tr(e, n, i, f, h) {
452
- {
453
- var m, v = {}, p = null, S = null;
454
- i !== void 0 && ($e(i), p = "" + i), Pr(n) && ($e(n.key), p = "" + n.key), Sr(n) && (S = n.ref, Or(n, h));
455
- for (m in n)
456
- Z.call(n, m) && !wr.hasOwnProperty(m) && (v[m] = n[m]);
457
- if (e && e.defaultProps) {
458
- var E = e.defaultProps;
459
- for (m in E)
460
- v[m] === void 0 && (v[m] = E[m]);
461
- }
462
- if (p || S) {
463
- var R = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
- p && xr(v, R), S && jr(v, R);
465
- }
466
- return Cr(e, p, S, h, f, U.current, v);
467
- }
468
- }
469
- var ie = W.ReactCurrentOwner, Ie = W.ReactDebugCurrentFrame;
470
- function N(e) {
471
- if (e) {
472
- var n = e._owner, i = H(e.type, e._source, n ? n.type : null);
473
- Ie.setExtraStackFrame(i);
474
- } else
475
- Ie.setExtraStackFrame(null);
476
- }
477
- var ue;
478
- ue = !1;
479
- function se(e) {
480
- return typeof e == "object" && e !== null && e.$$typeof === t;
481
- }
482
- function We() {
483
- {
484
- if (ie.current) {
485
- var e = j(ie.current.type);
486
- if (e)
487
- return `
488
-
489
- Check the render method of \`` + e + "`.";
490
- }
491
- return "";
492
- }
493
- }
494
- function kr(e) {
495
- {
496
- if (e !== void 0) {
497
- var n = e.fileName.replace(/^.*[\\\/]/, ""), i = e.lineNumber;
498
- return `
499
-
500
- Check your code at ` + n + ":" + i + ".";
501
- }
502
- return "";
503
- }
504
- }
505
- var Ne = {};
506
- function Ar(e) {
507
- {
508
- var n = We();
509
- if (!n) {
510
- var i = typeof e == "string" ? e : e.displayName || e.name;
511
- i && (n = `
512
-
513
- Check the top-level render call using <` + i + ">.");
514
- }
515
- return n;
516
- }
517
- }
518
- function Le(e, n) {
519
- {
520
- if (!e._store || e._store.validated || e.key != null)
521
- return;
522
- e._store.validated = !0;
523
- var i = Ar(n);
524
- if (Ne[i])
525
- return;
526
- Ne[i] = !0;
527
- var f = "";
528
- e && e._owner && e._owner !== ie.current && (f = " It was passed a child from " + j(e._owner.type) + "."), N(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, f), N(null);
529
- }
49
+ }
50
+ componentDidCatch(error, errorInfo) {
51
+ this.setState({
52
+ error,
53
+ errorInfo
54
+ });
55
+ if (this.props.onError) {
56
+ this.props.onError(error, errorInfo);
530
57
  }
531
- function Me(e, n) {
532
- {
533
- if (typeof e != "object")
534
- return;
535
- if (ae(e))
536
- for (var i = 0; i < e.length; i++) {
537
- var f = e[i];
538
- se(f) && Le(f, n);
539
- }
540
- else if (se(e))
541
- e._store && (e._store.validated = !0);
542
- else if (e) {
543
- var h = A(e);
544
- if (typeof h == "function" && h !== e.entries)
545
- for (var m = h.call(e), v; !(v = m.next()).done; )
546
- se(v.value) && Le(v.value, n);
547
- }
58
+ console.error("Virtual Router Error:", error, errorInfo);
59
+ }
60
+ render() {
61
+ var _a;
62
+ if (this.state.hasError) {
63
+ if (this.props.fallback) {
64
+ return this.props.fallback;
548
65
  }
549
- }
550
- function $r(e) {
551
- {
552
- var n = e.type;
553
- if (n == null || typeof n == "string")
554
- return;
555
- var i;
556
- if (typeof n == "function")
557
- i = n.propTypes;
558
- else if (typeof n == "object" && (n.$$typeof === d || // Note: Memo only checks outer props here.
559
- // Inner props are checked in the reconciler.
560
- n.$$typeof === y))
561
- i = n.propTypes;
562
- else
563
- return;
564
- if (i) {
565
- var f = j(n);
566
- br(i, e.props, "prop", f, e);
567
- } else if (n.PropTypes !== void 0 && !ue) {
568
- ue = !0;
569
- var h = j(n);
570
- w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", h || "Unknown");
66
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: "20px", border: "1px solid #ff6b6b", borderRadius: "4px", backgroundColor: "#ffe0e0" }, children: [
67
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: "Something went wrong with routing" }),
68
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("details", { style: { whiteSpace: "pre-wrap" }, children: [
69
+ this.state.error && this.state.error.toString(),
70
+ /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
71
+ (_a = this.state.errorInfo) == null ? void 0 : _a.componentStack
72
+ ] })
73
+ ] });
74
+ }
75
+ return this.props.children;
76
+ }
77
+ }
78
+ function Form({
79
+ action = "",
80
+ method = "GET",
81
+ onSubmit,
82
+ children,
83
+ ...props
84
+ }) {
85
+ const navigate2 = useNavigate();
86
+ const handleSubmit = (event) => {
87
+ event.preventDefault();
88
+ const form = event.currentTarget;
89
+ const formData = new window.FormData(form);
90
+ const data = {};
91
+ for (const [key, value] of formData.entries()) {
92
+ if (data[key]) {
93
+ if (Array.isArray(data[key])) {
94
+ data[key].push(value);
95
+ } else {
96
+ data[key] = [data[key], value];
571
97
  }
572
- typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
98
+ } else {
99
+ data[key] = value;
573
100
  }
574
101
  }
575
- function Dr(e) {
576
- {
577
- for (var n = Object.keys(e.props), i = 0; i < n.length; i++) {
578
- var f = n[i];
579
- if (f !== "children" && f !== "key") {
580
- N(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), N(null);
581
- break;
582
- }
583
- }
584
- e.ref !== null && (N(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
102
+ if (onSubmit) {
103
+ onSubmit(data, navigate2);
104
+ } else if (action) {
105
+ if (method === "GET") {
106
+ const queryString = convertFormDataToQueryString(data);
107
+ const targetPath = queryString ? `${action}?${queryString}` : action;
108
+ navigate2(targetPath);
109
+ } else {
110
+ navigate2(`${action}#formData=${encodeFormData(data)}`);
585
111
  }
586
112
  }
587
- function Ye(e, n, i, f, h, m) {
588
- {
589
- var v = dr(e);
590
- if (!v) {
591
- var p = "";
592
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (p += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
593
- var S = kr(h);
594
- S ? p += S : p += We();
595
- var E;
596
- e === null ? E = "null" : ae(e) ? E = "array" : e !== void 0 && e.$$typeof === t ? (E = "<" + (j(e.type) || "Unknown") + " />", p = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, p);
597
- }
598
- var R = Tr(e, n, i, h, m);
599
- if (R == null)
600
- return R;
601
- if (v) {
602
- var O = n.children;
603
- if (O !== void 0)
604
- if (f)
605
- if (ae(O)) {
606
- for (var L = 0; L < O.length; L++)
607
- Me(O[L], e);
608
- Object.freeze && Object.freeze(O);
609
- } else
610
- w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
611
- else
612
- Me(O, e);
113
+ };
114
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { ...props, onSubmit: handleSubmit, children });
115
+ }
116
+ function convertFormDataToQueryString(data) {
117
+ const params = new URLSearchParams();
118
+ Object.entries(data).forEach(([key, value]) => {
119
+ if (Array.isArray(value)) {
120
+ value.forEach((v) => {
121
+ if (typeof v === "string") {
122
+ params.append(key, v);
613
123
  }
614
- return e === o ? Dr(R) : $r(R), R;
615
- }
124
+ });
125
+ } else if (typeof value === "string") {
126
+ params.append(key, value);
616
127
  }
617
- function Fr(e, n, i) {
618
- return Ye(e, n, i, !0);
619
- }
620
- function Ir(e, n, i) {
621
- return Ye(e, n, i, !1);
622
- }
623
- var Wr = Ir, Nr = Fr;
624
- B.Fragment = o, B.jsx = Wr, B.jsxs = Nr;
625
- }()), B;
128
+ });
129
+ return params.toString();
626
130
  }
627
- process.env.NODE_ENV === "production" ? le.exports = Ur() : le.exports = qr();
628
- var T = le.exports;
629
- const Br = (r, t) => {
630
- if (!r || !t)
631
- return r ?? t ?? "";
632
- const a = r.split("/").filter((u) => u !== ""), o = t.split("/").filter((u) => u !== "");
633
- return a.length > 0 && a.at(-1) === "*" && a.pop(), a.length === 0 ? `/${o.join("/")}` : `/${a.join("/")}/${o.join("/")}`;
634
- }, Gr = (r, t) => {
635
- var l, d, g, b;
636
- const a = r.split("/").filter((y) => y !== "");
637
- let o = t.split("/").filter((y) => y !== "");
638
- if (a.length > o.length)
639
- return { isMatch: !1, remainer: "", data: {}, query: "", hash: "", path: "" };
640
- if (a.length < o.length && a.at(-1) !== "*")
641
- return { isMatch: !1, remainer: "", data: {}, query: "", hash: "", path: "" };
642
- let u = {}, c = "", s = "";
643
- for (let y = 0; y < a.length; ++y) {
644
- const _ = a[y], P = [...o[y].matchAll(/([?#]?)((?:(?![?#]).)*)/g)], I = ((l = P == null ? void 0 : P.find((A) => A[1] === "")) == null ? void 0 : l[2]) ?? "";
645
- if (c = ((d = P == null ? void 0 : P.find((A) => A[1] === "?")) == null ? void 0 : d[2]) ?? "", s = ((g = P == null ? void 0 : P.find((A) => A[1] === "#")) == null ? void 0 : g[2]) ?? "", _.startsWith(":") && I && I !== "") {
646
- u[_.substring(1)] = I;
647
- continue;
648
- }
649
- if (_ === "*")
650
- return { isMatch: !0, data: u, remainer: o.splice(y, -1).join("/"), query: c, hash: s, path: o.join("/") };
651
- if (_ !== I)
652
- return { isMatch: !1, data: {}, remainer: "", query: "", hash: "", path: "" };
653
- }
654
- return { isMatch: !0, remainer: "", data: u, query: c, hash: s, path: ((b = t == null ? void 0 : t.split("?")) == null ? void 0 : b[0]) ?? "" };
655
- };
656
- function M(r, t, ...a) {
657
- if (import.meta.NODE_ENV !== "production" && t === void 0)
658
- throw new Error("invariant requires an error message argument");
659
- if (!r) {
660
- let o;
661
- if (t === void 0)
662
- o = new Error(
663
- "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
664
- );
665
- else {
666
- let u = 0;
667
- o = new Error(
668
- t.replace(/%s/g, function() {
669
- return a[u++];
670
- })
671
- ), o.name = "Invariant Violation";
131
+ function encodeFormData(data) {
132
+ const serializable = {};
133
+ Object.entries(data).forEach(([key, value]) => {
134
+ if (Array.isArray(value)) {
135
+ serializable[key] = value.filter((v) => typeof v === "string").map((v) => v);
136
+ } else if (typeof value === "string") {
137
+ serializable[key] = value;
672
138
  }
673
- throw o.framesToPop = 1, o;
674
- }
675
- }
676
- const D = (r) => typeof r == "function", Kr = (r) => r.length === 0, Be = (r) => r.toString(), ce = (r) => typeof r == "string", he = "/", Q = "||", F = (r) => r, Ge = (r) => r === null;
677
- function Ke(r, t = F, a) {
678
- M(
679
- D(t) || Ge(t),
680
- "Expected payloadCreator to be a function, undefined or null"
681
- );
682
- const o = Ge(t) || t === F ? F : (l, ...d) => l instanceof Error ? l : t(l, ...d), u = D(a), c = r.toString(), s = (...l) => {
683
- const d = o(...l), g = { type: r };
684
- return d instanceof Error && (g.error = !0), d !== void 0 && (g.payload = d), u && (g.meta = a(...l)), g;
685
- };
686
- return s.toString = () => c, s;
687
- }
688
- const Y = (r) => {
689
- if (typeof r != "object" || r === null)
690
- return !1;
691
- let t = r;
692
- for (; Object.getPrototypeOf(t) !== null; )
693
- t = Object.getPrototypeOf(t);
694
- return Object.getPrototypeOf(r) === t;
695
- }, Je = (r) => Array.isArray(r), Xe = (r) => r == null, Jr = (r) => r[r.length - 1], zr = /\s/, Hr = /([-.:_])/, Zr = /([a-z][A-Z]|[A-Z][a-z])/, fe = "/", Xr = /[\W_]+(.|$)/g, Qr = (r) => r.replace(Xr, (t, a) => a ? " " + a : ""), et = /(.)([A-Z]+)/g, rt = (r) => r.replace(
696
- et,
697
- (t, a, o) => a + " " + o.toLowerCase().split("").join(" ")
698
- ), tt = (r) => zr.test(r) ? r.toLowerCase() : Hr.test(r) ? (Qr(r) || r).toLowerCase() : Zr.test(r) ? rt(r).toLowerCase() : r.toLowerCase(), nt = (r) => tt(r).replace(/[\W_]+(.|$)/g, (t, a) => a ? " " + a : "").trim(), ze = (r) => nt(r).replace(
699
- /\s(\w)/g,
700
- (t, a) => a.toUpperCase()
701
- ), Qe = (r) => r.includes(fe) ? r.split(fe).map(ze).join(fe) : ze(r), de = (r, t) => r.reduce(
702
- (a, o) => t(a, o),
703
- {}
704
- ), ee = (r) => typeof Map < "u" && r instanceof Map;
705
- function ge(r) {
706
- if (ee(r))
707
- return Array.from(r.keys());
708
- if (typeof Reflect < "u" && typeof Reflect.ownKeys == "function")
709
- return Reflect.ownKeys(r);
710
- let t = Object.getOwnPropertyNames(r);
711
- return typeof Object.getOwnPropertySymbols == "function" && (t = t.concat(Object.getOwnPropertySymbols(r))), t;
712
- }
713
- function er(r, t) {
714
- return ee(t) ? t.get(r) : t[r];
139
+ });
140
+ return encodeURIComponent(JSON.stringify(serializable));
715
141
  }
716
- const rr = (r) => function t(a, { namespace: o = he, prefix: u } = {}, c = {}, s = "") {
717
- function l(g) {
718
- if (!s)
719
- return g;
720
- const b = g.toString().split(Q), y = s.split(Q);
721
- return [].concat(
722
- ...y.map((_) => b.map((x) => `${_}${o}${x}`))
723
- ).join(Q);
724
- }
725
- function d(g) {
726
- return s || !u || u && new RegExp(`^${u}${o}`).test(g) ? g : `${u}${o}${g}`;
142
+ function useFormData() {
143
+ const { hash } = useSearchParams();
144
+ if (!hash)
145
+ return null;
146
+ const formDataMatch = hash.match(/formData=([^&]*)/);
147
+ if (!formDataMatch) {
148
+ return null;
727
149
  }
728
- return ge(a).forEach((g) => {
729
- const b = d(l(g)), y = er(g, a);
730
- r(y) ? t(y, { namespace: o, prefix: u }, c, b) : c[b] = y;
731
- }), c;
732
- }, at = rr(Y);
733
- function ot(r, { namespace: t = he, prefix: a } = {}) {
734
- function o(c, s, l) {
735
- const d = Qe(l.shift());
736
- Kr(l) ? s[d] = r[c] : (s[d] || (s[d] = {}), o(
737
- c,
738
- s[d],
739
- l
740
- ));
150
+ try {
151
+ const decoded = decodeURIComponent(formDataMatch[1]);
152
+ return JSON.parse(decoded);
153
+ } catch {
154
+ return null;
741
155
  }
742
- const u = {};
743
- return Object.getOwnPropertyNames(r).forEach((c) => {
744
- const s = a ? c.replace(`${a}${t}`, "") : c;
745
- return o(
746
- c,
747
- u,
748
- s.split(t)
749
- );
750
- }), u;
751
- }
752
- function it(r, ...t) {
753
- const a = Y(Jr(t)) ? t.pop() : {};
754
- return M(
755
- t.every(ce) && (ce(r) || Y(r)),
756
- "Expected optional object followed by string action types"
757
- ), ce(r) ? He(
758
- [r, ...t],
759
- a
760
- ) : {
761
- ...ut(r, a),
762
- ...He(t, a)
763
- };
764
156
  }
765
- function ut(r, t) {
766
- const a = at(r, t), o = tr(a);
767
- return ot(o, t);
768
- }
769
- function tr(r, { prefix: t, namespace: a = he } = {}) {
770
- function o(u) {
771
- if (D(u) || Xe(u))
772
- return !0;
773
- if (Je(u)) {
774
- const [c = F, s] = u;
775
- return D(c) && D(s);
776
- }
777
- return !1;
778
- }
779
- return de(
780
- Object.keys(r),
781
- (u, c) => {
782
- const s = r[c];
783
- M(
784
- o(s),
785
- `Expected function, undefined, null, or array with payload and meta functions for ${c}`
786
- );
787
- const l = t ? `${t}${a}${c}` : c, d = Je(s) ? Ke(l, ...s) : Ke(l, s);
788
- return { ...u, [c]: d };
157
+ function SubmitButton({
158
+ formAction,
159
+ formMethod,
160
+ children,
161
+ type = "submit",
162
+ ...props
163
+ }) {
164
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
165
+ "button",
166
+ {
167
+ type,
168
+ formAction,
169
+ formMethod,
170
+ ...props,
171
+ children
789
172
  }
790
173
  );
791
174
  }
792
- function He(r, t) {
793
- const a = de(
794
- r,
795
- (u, c) => ({ ...u, [c]: F })
796
- ), o = tr(a, t);
797
- return de(
798
- Object.keys(o),
799
- (u, c) => ({
800
- ...u,
801
- [Qe(c)]: o[c]
802
- })
803
- );
804
- }
805
- const st = (r) => r === void 0;
806
- function ct(r, t = F, a) {
807
- const o = Be(r).split(Q);
808
- M(
809
- !st(a),
810
- `defaultState for reducer handling ${o.join(", ")} should be defined`
811
- ), M(
812
- D(t) || Y(t),
813
- "Expected reducer to be a function or object with next and throw reducers"
814
- );
815
- const [u, c] = D(t) ? [t, t] : [t.next, t.throw].map(
816
- (s) => Xe(s) ? F : s
817
- );
818
- return (s = a, l) => {
819
- const { type: d } = l;
820
- return !d || !o.includes(Be(d)) ? s : (l.error === !0 ? c : u)(s, l);
821
- };
822
- }
823
- const ft = function() {
824
- for (var r = arguments.length, t = Array(r), a = 0; a < r; a++)
825
- t[a] = arguments[a];
826
- var o = typeof t[0] != "function" && t.shift(), u = t;
827
- if (typeof o > "u")
828
- throw new TypeError("The initial state may not be undefined. If you do not want to set a value for this reducer, you can use null instead of undefined.");
829
- return function(c, s) {
830
- for (var l = arguments.length, d = Array(l > 2 ? l - 2 : 0), g = 2; g < l; g++)
831
- d[g - 2] = arguments[g];
832
- var b = typeof c > "u", y = typeof s > "u";
833
- return b && y && o ? o : u.reduce(function(_, x, P) {
834
- if (typeof x > "u")
835
- throw new TypeError("An undefined reducer was passed in at index " + P);
836
- return x.apply(void 0, [_, s].concat(d));
837
- }, b && !y && o ? o : c);
175
+ function useFormSubmission() {
176
+ return {
177
+ isSubmitting: false,
178
+ lastSubmission: null,
179
+ error: null
838
180
  };
839
- };
840
- function lt(r) {
841
- const t = ge(r), a = t.every(
842
- (o) => o === "next" || o === "throw"
843
- );
844
- return t.length > 0 && t.length <= 2 && a;
845
- }
846
- const dt = rr(
847
- (r) => (Y(r) || ee(r)) && !lt(r)
848
- );
849
- function pt(r, t, a = {}) {
850
- M(
851
- Y(r) || ee(r),
852
- "Expected handlers to be a plain object."
853
- );
854
- const o = dt(r, a), u = ge(o).map(
855
- (s) => ct(s, er(s, o), t)
856
- ), c = ft(t, ...u);
857
- return (s = t, l) => c(s, l);
858
181
  }
859
- const vt = (r, t) => {
860
- if (t.startsWith("/"))
861
- return Ze(t, "");
862
- const [a] = r.split("?") ?? [""];
863
- return Ze(a, t);
864
- }, Ze = (r, t) => {
865
- const a = r.split("/").concat(t.split("/")), o = [];
866
- for (const u of a)
867
- if (u === "..")
868
- o.pop();
869
- else if (u.startsWith("?")) {
870
- const c = o.pop();
871
- o.push(c + u);
872
- } else
873
- u !== "." && u !== "" && o.push(u);
874
- return "/" + o.join("/");
875
- }, ye = { path: "/", history: [], location: 0 }, nr = { path: "*", data: {}, hash: "", query: "" }, ht = pt(
876
- {
877
- NAVIGATE: (r, t) => {
878
- let { history: a, location: o } = r;
879
- return console.log("history", a, "location", o, "action", t.payload), o > 0 && (a = a.slice(o)), {
880
- path: vt(r.path, t.payload),
881
- history: [t.payload, ...a],
882
- location: 0
883
- };
884
- },
885
- BACK: (r, t) => {
886
- const a = r.location + t.payload, o = r.history.at(a);
887
- return o ? {
888
- path: o,
889
- history: r.history,
890
- location: a
891
- } : r;
892
- },
893
- FORWARD: (r, t) => {
894
- const a = r.location - t.payload, o = r.history.at(a);
895
- return o ? {
896
- path: o,
897
- history: r.history,
898
- location: a
899
- } : r;
182
+ function FormLink({
183
+ to,
184
+ formData,
185
+ method = "GET",
186
+ children,
187
+ onClick,
188
+ ...props
189
+ }) {
190
+ const navigate2 = useNavigate();
191
+ const handleClick = (event) => {
192
+ event.preventDefault();
193
+ if (onClick) {
194
+ onClick();
195
+ }
196
+ if (formData) {
197
+ if (method === "GET") {
198
+ const queryString = convertFormDataToQueryString(formData);
199
+ const targetPath = queryString ? `${to}?${queryString}` : to;
200
+ navigate2(targetPath);
201
+ } else {
202
+ navigate2(`${to}#formData=${encodeFormData(formData)}`);
203
+ }
204
+ } else {
205
+ navigate2(to);
900
206
  }
901
- },
902
- ye
903
- ), K = ve(ye), me = ve(null), G = ve(nr);
904
- function Et({ path: r, children: t }) {
905
- const a = r ? { path: r, history: [], location: 0 } : ye, [o, u] = Lr(ht, a);
906
- return /* @__PURE__ */ T.jsx(K.Provider, { value: o, children: /* @__PURE__ */ T.jsx(me.Provider, { value: u, children: /* @__PURE__ */ T.jsx(G.Provider, { value: nr, children: t }) }) });
207
+ };
208
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: to, onClick: handleClick, ...props, children });
907
209
  }
908
- const { navigate: ar, back: gt, forward: yt } = it({
909
- NAVIGATE: (r) => r,
910
- BACK: (r = 1) => r,
911
- FORWARD: (r = 1) => r
912
- });
913
- function Rt() {
914
- return k(K).path;
210
+ function usePath() {
211
+ const pathState = useContext(PathContext);
212
+ const fullPath = pathState.path;
213
+ const queryIndex = fullPath.indexOf("?");
214
+ const hashIndex = fullPath.indexOf("#");
215
+ let endIndex = fullPath.length;
216
+ if (queryIndex !== -1)
217
+ endIndex = Math.min(endIndex, queryIndex);
218
+ if (hashIndex !== -1)
219
+ endIndex = Math.min(endIndex, hashIndex);
220
+ return fullPath.substring(0, endIndex);
915
221
  }
916
- function _t() {
917
- return k(K).history;
222
+ function useHistory() {
223
+ const pathState = useContext(PathContext);
224
+ if (!pathState) {
225
+ throw new Error("useHistory must be used within a PathProvider");
226
+ }
227
+ return pathState.history;
918
228
  }
919
- function mt() {
920
- const r = k(me);
921
- return (t) => r(ar(t));
229
+ function useNavigate() {
230
+ const dispatch = useContext(PathDispatchContext);
231
+ if (!dispatch) {
232
+ throw new Error("useNavigate must be used within a PathProvider");
233
+ }
234
+ return (path) => dispatch(navigate(path));
922
235
  }
923
- function wt() {
924
- const r = k(me), t = k(K);
236
+ function useNavigation() {
237
+ const dispatch = useContext(PathDispatchContext);
238
+ const pathState = useContext(PathContext);
239
+ if (!dispatch || !pathState) {
240
+ throw new Error("useNavigation must be used within a PathProvider");
241
+ }
925
242
  return {
926
- navigate: (a) => r(ar(a)),
927
- back: (a = 1) => r(gt(a)),
928
- forward: (a = 1) => r(yt(a)),
929
- hasBack: t.location < t.history.length - 1,
930
- ...t
243
+ navigate: (path) => dispatch(navigate(path)),
244
+ back: (count = 1) => dispatch(back(count)),
245
+ forward: (count = 1) => dispatch(forward(count)),
246
+ hasBack: pathState.location < pathState.history.length,
247
+ hasForward: pathState.location > 0,
248
+ path: pathState.path,
249
+ history: pathState.history,
250
+ location: pathState.location
931
251
  };
932
252
  }
933
- function St() {
934
- return k(G).data;
935
- }
936
- function Pt() {
937
- var { query: r, hash: t } = k(G);
938
- return { search: new URLSearchParams(r), hash: t };
253
+ function useParams() {
254
+ const routeContext = useContext(RouteContext);
255
+ if (!routeContext) {
256
+ throw new Error("useParams must be used within a PathProvider");
257
+ }
258
+ return routeContext.data;
939
259
  }
940
- function Ot() {
941
- return {};
260
+ function useSearchParams() {
261
+ const routeContext = useContext(RouteContext);
262
+ if (!routeContext) {
263
+ throw new Error("useSearchParams must be used within a PathProvider");
264
+ }
265
+ const { query, hash } = routeContext;
266
+ return { search: new URLSearchParams(query), hash, query };
942
267
  }
943
- const xt = Mr((r, t) => {
944
- const { to: a, children: o, ...u } = r, c = mt(), s = (l) => {
945
- l.defaultPrevented || l.preventDefault(), c(a);
268
+ const Link = forwardRef(({ to, children, ...rest }, ref) => {
269
+ const navigate2 = useNavigate();
270
+ const handleClick = (event) => {
271
+ if (!event.defaultPrevented) {
272
+ event.preventDefault();
273
+ navigate2(to);
274
+ }
946
275
  };
947
- return /* @__PURE__ */ T.jsx(
276
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
948
277
  "a",
949
278
  {
950
- ...u,
951
- href: a,
952
- ref: t,
953
- onClick: s,
954
- children: o
279
+ ...rest,
280
+ href: to,
281
+ ref,
282
+ onClick: handleClick,
283
+ children
955
284
  }
956
285
  );
957
286
  });
958
- function jt(r) {
959
- const { children: t } = r, a = k(G), o = k(K), u = [];
960
- return or(u, t, a.path, o.path), console.log(u, a.path, o.path), /* @__PURE__ */ T.jsx(T.Fragment, { children: u.map(({ children: c, match: s }, l) => /* @__PURE__ */ T.jsx(G.Provider, { value: { ...s }, children: c }, l)) });
287
+ Link.displayName = "Link";
288
+ function Routes({ children }) {
289
+ const routeContext = useContext(RouteContext);
290
+ const pathContext = useContext(PathContext);
291
+ if (!routeContext || !pathContext) {
292
+ throw new Error("Routes must be used within a PathProvider");
293
+ }
294
+ const result = [];
295
+ flattenActiveRoutes(result, children, routeContext.routePath, pathContext.path);
296
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: result.map(({ children: children2, match }, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(RouteContext.Provider, { value: { ...match }, children: children2 }, index)) });
961
297
  }
962
- function Ct(r) {
963
- return /* @__PURE__ */ T.jsx(T.Fragment, {});
298
+ function Route(_) {
299
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
964
300
  }
965
- function or(r, t, a, o) {
966
- Yr.forEach(t, (u) => {
967
- if (!Vr(u))
301
+ function flattenActiveRoutes(result, children, base, path) {
302
+ Children.forEach(children, (element) => {
303
+ if (!isValidElement(element))
968
304
  return;
969
- if (u.type === pe.Fragment) {
970
- or(r, u.props.children, a, o);
305
+ if (element.type === require$$0.Fragment) {
306
+ flattenActiveRoutes(result, element.props.children, base, path);
971
307
  return;
972
308
  }
973
- const c = Br(a, u.props.path), s = Gr(c, o);
974
- s.isMatch && r.push({
975
- children: u.props.children,
976
- match: s
977
- });
309
+ const elementRoute = combineRoutes(base, element.props.path);
310
+ const match = matchPath(elementRoute, path);
311
+ if (match.isMatch) {
312
+ result.push({
313
+ routePath: elementRoute,
314
+ children: element.props.children,
315
+ match
316
+ });
317
+ }
978
318
  });
979
319
  }
980
320
  export {
981
- xt as Link,
982
- Et as PathProvider,
983
- Ct as Route,
984
- jt as Routes,
985
- _t as useHistory,
986
- mt as useNavigate,
987
- wt as useNavigation,
988
- St as useParams,
989
- Rt as usePath,
990
- Ot as useRouteError,
991
- Pt as useSearchParams
321
+ ErrorProvider,
322
+ Form,
323
+ FormLink,
324
+ Link,
325
+ c as PathProvider,
326
+ Route,
327
+ RouterErrorBoundary,
328
+ Routes,
329
+ SubmitButton,
330
+ useFormData,
331
+ useFormSubmission,
332
+ useHistory,
333
+ useNavigate,
334
+ useNavigation,
335
+ useParams,
336
+ usePath,
337
+ useRouteError,
338
+ useRouteErrors,
339
+ useSearchParams
992
340
  };
993
341
  //# sourceMappingURL=index.es.js.map