@konstructio/ui 0.1.0-alpha.3 → 0.1.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/{Combination-b348x__d.js → Combination-Cvr3uETz.js} +102 -102
  2. package/dist/{Modal-B2ujmsSW.js → Modal-DXYBiafI.js} +3 -3
  3. package/dist/components/Alert/Alert.js +1 -1
  4. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  5. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  6. package/dist/components/AlertDialog/components/index.js +1 -1
  7. package/dist/components/Badge/Badge.js +2 -2
  8. package/dist/components/Breadcrumb/components/Item/Item.js +1 -1
  9. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  10. package/dist/components/Button/Button.js +1 -1
  11. package/dist/components/Checkbox/Checkbox.js +3 -3
  12. package/dist/components/Command/Command.js +2 -2
  13. package/dist/components/Command/components/Command.js +1 -1
  14. package/dist/components/Command/components/CommandEmpty.js +1 -1
  15. package/dist/components/Command/components/CommandGroup.js +1 -1
  16. package/dist/components/Command/components/CommandInput.js +1 -1
  17. package/dist/components/Command/components/CommandItem.js +1 -1
  18. package/dist/components/Command/components/CommandList.js +1 -1
  19. package/dist/components/Command/components/CommandSeparator.js +1 -1
  20. package/dist/components/Command/components/DialogContent.js +1 -1
  21. package/dist/components/Command/components/DialogOverlay.js +1 -1
  22. package/dist/components/Datepicker/DatePicker.js +3 -3
  23. package/dist/components/Dropdown/components/List/List.js +48 -15
  24. package/dist/components/Dropdown/components/List/List.variants.js +6 -4
  25. package/dist/components/Dropdown/components/ListItem/ListItem.js +21 -17
  26. package/dist/components/Dropdown/components/Wrapper.js +78 -70
  27. package/dist/components/Loading/Loading.js +2 -2
  28. package/dist/components/Modal/Modal.js +2 -2
  29. package/dist/components/Modal/components/Body/Body.js +1 -1
  30. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  31. package/dist/components/Modal/components/Header/Header.js +1 -1
  32. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -3
  33. package/dist/components/Modal/components/index.js +1 -1
  34. package/dist/components/NumberInput/NumberInput.js +1 -1
  35. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  36. package/dist/components/Range/Range.js +1 -1
  37. package/dist/components/Slider/Slider.js +1 -1
  38. package/dist/components/Switch/Switch.js +2 -2
  39. package/dist/components/Tabs/Tabs.js +1 -1
  40. package/dist/components/Tabs/components/Content.js +1 -1
  41. package/dist/components/Tabs/components/List.js +1 -1
  42. package/dist/components/Tabs/components/Trigger.js +1 -1
  43. package/dist/components/Tag/Tag.js +1 -1
  44. package/dist/components/TimePicker/components/Wrapper/Wrapper.js +2 -2
  45. package/dist/components/Toast/Toast.js +6 -6
  46. package/dist/components/Tooltip/Tooltip.js +1 -1
  47. package/dist/components/Typography/Typography.js +14 -16
  48. package/dist/components/index.js +1 -1
  49. package/dist/{createLucideIcon-BA2PlKw1.js → createLucideIcon-vyksFS6P.js} +4 -4
  50. package/dist/{index-BRcC_VTj.js → index--EmNlyHx.js} +1 -1
  51. package/dist/{index-Ud3-A7-K.js → index-1RDo-S_f.js} +5 -5
  52. package/dist/index-B5MIi2tR.js +83 -0
  53. package/dist/{index-ObZsP5Eh.js → index-BCGvACM9.js} +1 -1
  54. package/dist/{index-xPmNHv1y.js → index-BuxebbOg.js} +2 -2
  55. package/dist/{index-55GVbfLI.js → index-BvCZBMfr.js} +3 -3
  56. package/dist/{index-C2xwUZXm.js → index-CvfCCTEO.js} +4 -4
  57. package/dist/{index-DmCJ8fIR.js → index-Cz09twLl.js} +3 -3
  58. package/dist/{index-CQ6ORxI_.js → index-DNRcvRTB.js} +2 -2
  59. package/dist/{index-Y44iCJcQ.js → index-Dm-ooN_M.js} +1 -1
  60. package/dist/{index-B-qIIQlg.js → index-rUBNhTeF.js} +1 -1
  61. package/dist/index.d.ts +5 -0
  62. package/dist/index.js +1 -1
  63. package/dist/package.json +28 -28
  64. package/dist/styles.css +1 -1
  65. package/dist/useBreadcrumb-DMERrNkJ.js +1280 -0
  66. package/package.json +28 -28
  67. package/dist/index-tIydFizp.js +0 -83
  68. package/dist/useBreadcrumb-BsIeMoR1.js +0 -1279
@@ -1,1279 +0,0 @@
1
- import * as u from "react";
2
- /**
3
- * react-router v7.1.3
4
- *
5
- * Copyright (c) Remix Software Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE.md file in the root directory of this source tree.
9
- *
10
- * @license MIT
11
- */
12
- function x(e, t) {
13
- if (e === !1 || e === null || typeof e > "u")
14
- throw new Error(t);
15
- }
16
- function b(e, t) {
17
- if (!e) {
18
- typeof console < "u" && console.warn(t);
19
- try {
20
- throw new Error(t);
21
- } catch {
22
- }
23
- }
24
- }
25
- function j({
26
- pathname: e = "/",
27
- search: t = "",
28
- hash: n = ""
29
- }) {
30
- return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), n && n !== "#" && (e += n.charAt(0) === "#" ? n : "#" + n), e;
31
- }
32
- function Y(e) {
33
- let t = {};
34
- if (e) {
35
- let n = e.indexOf("#");
36
- n >= 0 && (t.hash = e.substring(n), e = e.substring(0, n));
37
- let a = e.indexOf("?");
38
- a >= 0 && (t.search = e.substring(a), e = e.substring(0, a)), e && (t.pathname = e);
39
- }
40
- return t;
41
- }
42
- function le(e, t, n = "/") {
43
- return xe(e, t, n, !1);
44
- }
45
- function xe(e, t, n, a) {
46
- let r = typeof t == "string" ? Y(t) : t, l = F(r.pathname || "/", n);
47
- if (l == null)
48
- return null;
49
- let s = oe(e);
50
- Ce(s);
51
- let c = null;
52
- for (let i = 0; c == null && i < s.length; ++i) {
53
- let o = De(l);
54
- c = Fe(
55
- s[i],
56
- o,
57
- a
58
- );
59
- }
60
- return c;
61
- }
62
- function oe(e, t = [], n = [], a = "") {
63
- let r = (l, s, c) => {
64
- let i = {
65
- relativePath: c === void 0 ? l.path || "" : c,
66
- caseSensitive: l.caseSensitive === !0,
67
- childrenIndex: s,
68
- route: l
69
- };
70
- i.relativePath.startsWith("/") && (x(
71
- i.relativePath.startsWith(a),
72
- `Absolute route path "${i.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
73
- ), i.relativePath = i.relativePath.slice(a.length));
74
- let o = R([a, i.relativePath]), f = n.concat(i);
75
- l.children && l.children.length > 0 && (x(
76
- // Our types know better, but runtime JS may not!
77
- // @ts-expect-error
78
- l.index !== !0,
79
- `Index routes must not have child routes. Please remove all child routes from route path "${o}".`
80
- ), oe(l.children, t, f, o)), !(l.path == null && !l.index) && t.push({
81
- path: o,
82
- score: ke(o, l.index),
83
- routesMeta: f
84
- });
85
- };
86
- return e.forEach((l, s) => {
87
- var c;
88
- if (l.path === "" || !((c = l.path) != null && c.includes("?")))
89
- r(l, s);
90
- else
91
- for (let i of ie(l.path))
92
- r(l, s, i);
93
- }), t;
94
- }
95
- function ie(e) {
96
- let t = e.split("/");
97
- if (t.length === 0) return [];
98
- let [n, ...a] = t, r = n.endsWith("?"), l = n.replace(/\?$/, "");
99
- if (a.length === 0)
100
- return r ? [l, ""] : [l];
101
- let s = ie(a.join("/")), c = [];
102
- return c.push(
103
- ...s.map(
104
- (i) => i === "" ? l : [l, i].join("/")
105
- )
106
- ), r && c.push(...s), c.map(
107
- (i) => e.startsWith("/") && i === "" ? "/" : i
108
- );
109
- }
110
- function Ce(e) {
111
- e.sort(
112
- (t, n) => t.score !== n.score ? n.score - t.score : $e(
113
- t.routesMeta.map((a) => a.childrenIndex),
114
- n.routesMeta.map((a) => a.childrenIndex)
115
- )
116
- );
117
- }
118
- var Ee = /^:[\w-]+$/, Re = 3, be = 2, Pe = 1, Le = 10, Se = -2, ne = (e) => e === "*";
119
- function ke(e, t) {
120
- let n = e.split("/"), a = n.length;
121
- return n.some(ne) && (a += Se), t && (a += be), n.filter((r) => !ne(r)).reduce(
122
- (r, l) => r + (Ee.test(l) ? Re : l === "" ? Pe : Le),
123
- a
124
- );
125
- }
126
- function $e(e, t) {
127
- return e.length === t.length && e.slice(0, -1).every((a, r) => a === t[r]) ? (
128
- // If two routes are siblings, we should try to match the earlier sibling
129
- // first. This allows people to have fine-grained control over the matching
130
- // behavior by simply putting routes with identical paths in the order they
131
- // want them tried.
132
- e[e.length - 1] - t[t.length - 1]
133
- ) : (
134
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
135
- // so they sort equally.
136
- 0
137
- );
138
- }
139
- function Fe(e, t, n = !1) {
140
- let { routesMeta: a } = e, r = {}, l = "/", s = [];
141
- for (let c = 0; c < a.length; ++c) {
142
- let i = a[c], o = c === a.length - 1, f = l === "/" ? t : t.slice(l.length) || "/", d = H(
143
- { path: i.relativePath, caseSensitive: i.caseSensitive, end: o },
144
- f
145
- ), m = i.route;
146
- if (!d && o && n && !a[a.length - 1].route.index && (d = H(
147
- {
148
- path: i.relativePath,
149
- caseSensitive: i.caseSensitive,
150
- end: !1
151
- },
152
- f
153
- )), !d)
154
- return null;
155
- Object.assign(r, d.params), s.push({
156
- // TODO: Can this as be avoided?
157
- params: r,
158
- pathname: R([l, d.pathname]),
159
- pathnameBase: Be(
160
- R([l, d.pathnameBase])
161
- ),
162
- route: m
163
- }), d.pathnameBase !== "/" && (l = R([l, d.pathnameBase]));
164
- }
165
- return s;
166
- }
167
- function H(e, t) {
168
- typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
169
- let [n, a] = Ie(
170
- e.path,
171
- e.caseSensitive,
172
- e.end
173
- ), r = t.match(n);
174
- if (!r) return null;
175
- let l = r[0], s = l.replace(/(.)\/+$/, "$1"), c = r.slice(1);
176
- return {
177
- params: a.reduce(
178
- (o, { paramName: f, isOptional: d }, m) => {
179
- if (f === "*") {
180
- let v = c[m] || "";
181
- s = l.slice(0, l.length - v.length).replace(/(.)\/+$/, "$1");
182
- }
183
- const p = c[m];
184
- return d && !p ? o[f] = void 0 : o[f] = (p || "").replace(/%2F/g, "/"), o;
185
- },
186
- {}
187
- ),
188
- pathname: l,
189
- pathnameBase: s,
190
- pattern: e
191
- };
192
- }
193
- function Ie(e, t = !1, n = !0) {
194
- b(
195
- e === "*" || !e.endsWith("*") || e.endsWith("/*"),
196
- `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(/\*$/, "/*")}".`
197
- );
198
- let a = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
199
- /\/:([\w-]+)(\?)?/g,
200
- (s, c, i) => (a.push({ paramName: c, isOptional: i != null }), i ? "/?([^\\/]+)?" : "/([^\\/]+)")
201
- );
202
- return e.endsWith("*") ? (a.push({ paramName: "*" }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), a];
203
- }
204
- function De(e) {
205
- try {
206
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
207
- } catch (t) {
208
- return b(
209
- !1,
210
- `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}).`
211
- ), e;
212
- }
213
- }
214
- function F(e, t) {
215
- if (t === "/") return e;
216
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
217
- return null;
218
- let n = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(n);
219
- return a && a !== "/" ? null : e.slice(n) || "/";
220
- }
221
- function Ne(e, t = "/") {
222
- let {
223
- pathname: n,
224
- search: a = "",
225
- hash: r = ""
226
- } = typeof e == "string" ? Y(e) : e;
227
- return {
228
- pathname: n ? n.startsWith("/") ? n : Te(n, t) : t,
229
- search: Me(a),
230
- hash: We(r)
231
- };
232
- }
233
- function Te(e, t) {
234
- let n = t.replace(/\/+$/, "").split("/");
235
- return e.split("/").forEach((r) => {
236
- r === ".." ? n.length > 1 && n.pop() : r !== "." && n.push(r);
237
- }), n.length > 1 ? n.join("/") : "/";
238
- }
239
- function J(e, t, n, a) {
240
- return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
241
- a
242
- )}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
243
- }
244
- function Ae(e) {
245
- return e.filter(
246
- (t, n) => n === 0 || t.route.path && t.route.path.length > 0
247
- );
248
- }
249
- function ue(e) {
250
- let t = Ae(e);
251
- return t.map(
252
- (n, a) => a === t.length - 1 ? n.pathname : n.pathnameBase
253
- );
254
- }
255
- function se(e, t, n, a = !1) {
256
- let r;
257
- typeof e == "string" ? r = Y(e) : (r = { ...e }, x(
258
- !r.pathname || !r.pathname.includes("?"),
259
- J("?", "pathname", "search", r)
260
- ), x(
261
- !r.pathname || !r.pathname.includes("#"),
262
- J("#", "pathname", "hash", r)
263
- ), x(
264
- !r.search || !r.search.includes("#"),
265
- J("#", "search", "hash", r)
266
- ));
267
- let l = e === "" || r.pathname === "", s = l ? "/" : r.pathname, c;
268
- if (s == null)
269
- c = n;
270
- else {
271
- let d = t.length - 1;
272
- if (!a && s.startsWith("..")) {
273
- let m = s.split("/");
274
- for (; m[0] === ".."; )
275
- m.shift(), d -= 1;
276
- r.pathname = m.join("/");
277
- }
278
- c = d >= 0 ? t[d] : "/";
279
- }
280
- let i = Ne(r, c), o = s && s !== "/" && s.endsWith("/"), f = (l || s === ".") && n.endsWith("/");
281
- return !i.pathname.endsWith("/") && (o || f) && (i.pathname += "/"), i;
282
- }
283
- var R = (e) => e.join("/").replace(/\/\/+/g, "/"), Be = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Me = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, We = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
284
- function Oe(e) {
285
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
286
- }
287
- var ce = [
288
- "POST",
289
- "PUT",
290
- "PATCH",
291
- "DELETE"
292
- ];
293
- new Set(
294
- ce
295
- );
296
- var Ue = [
297
- "GET",
298
- ...ce
299
- ];
300
- new Set(Ue);
301
- var D = u.createContext(null);
302
- D.displayName = "DataRouter";
303
- var _ = u.createContext(null);
304
- _.displayName = "DataRouterState";
305
- var fe = u.createContext({
306
- isTransitioning: !1
307
- });
308
- fe.displayName = "ViewTransition";
309
- var He = u.createContext(
310
- /* @__PURE__ */ new Map()
311
- );
312
- He.displayName = "Fetchers";
313
- var _e = u.createContext(null);
314
- _e.displayName = "Await";
315
- var P = u.createContext(
316
- null
317
- );
318
- P.displayName = "Navigation";
319
- var q = u.createContext(
320
- null
321
- );
322
- q.displayName = "Location";
323
- var L = u.createContext({
324
- outlet: null,
325
- matches: [],
326
- isDataRoute: !1
327
- });
328
- L.displayName = "Route";
329
- var G = u.createContext(null);
330
- G.displayName = "RouteError";
331
- function Ve(e, { relative: t } = {}) {
332
- x(
333
- V(),
334
- // TODO: This error is probably because they somehow have 2 versions of the
335
- // router loaded. We can help them understand how to avoid that.
336
- "useHref() may be used only in the context of a <Router> component."
337
- );
338
- let { basename: n, navigator: a } = u.useContext(P), { hash: r, pathname: l, search: s } = A(e, { relative: t }), c = l;
339
- return n !== "/" && (c = l === "/" ? n : R([n, l])), a.createHref({ pathname: c, search: s, hash: r });
340
- }
341
- function V() {
342
- return u.useContext(q) != null;
343
- }
344
- function k() {
345
- return x(
346
- V(),
347
- // TODO: This error is probably because they somehow have 2 versions of the
348
- // router loaded. We can help them understand how to avoid that.
349
- "useLocation() may be used only in the context of a <Router> component."
350
- ), u.useContext(q).location;
351
- }
352
- var de = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
353
- function he(e) {
354
- u.useContext(P).static || u.useLayoutEffect(e);
355
- }
356
- function ze() {
357
- let { isDataRoute: e } = u.useContext(L);
358
- return e ? rt() : Je();
359
- }
360
- function Je() {
361
- x(
362
- V(),
363
- // TODO: This error is probably because they somehow have 2 versions of the
364
- // router loaded. We can help them understand how to avoid that.
365
- "useNavigate() may be used only in the context of a <Router> component."
366
- );
367
- let e = u.useContext(D), { basename: t, navigator: n } = u.useContext(P), { matches: a } = u.useContext(L), { pathname: r } = k(), l = JSON.stringify(ue(a)), s = u.useRef(!1);
368
- return he(() => {
369
- s.current = !0;
370
- }), u.useCallback(
371
- (i, o = {}) => {
372
- if (b(s.current, de), !s.current) return;
373
- if (typeof i == "number") {
374
- n.go(i);
375
- return;
376
- }
377
- let f = se(
378
- i,
379
- JSON.parse(l),
380
- r,
381
- o.relative === "path"
382
- );
383
- e == null && t !== "/" && (f.pathname = f.pathname === "/" ? t : R([t, f.pathname])), (o.replace ? n.replace : n.push)(
384
- f,
385
- o.state,
386
- o
387
- );
388
- },
389
- [
390
- t,
391
- n,
392
- l,
393
- r,
394
- e
395
- ]
396
- );
397
- }
398
- u.createContext(null);
399
- function A(e, { relative: t } = {}) {
400
- let { matches: n } = u.useContext(L), { pathname: a } = k(), r = JSON.stringify(ue(n));
401
- return u.useMemo(
402
- () => se(
403
- e,
404
- JSON.parse(r),
405
- a,
406
- t === "path"
407
- ),
408
- [e, r, a, t]
409
- );
410
- }
411
- function Ke(e, t, n, a) {
412
- x(
413
- V(),
414
- // TODO: This error is probably because they somehow have 2 versions of the
415
- // router loaded. We can help them understand how to avoid that.
416
- "useRoutes() may be used only in the context of a <Router> component."
417
- );
418
- let { navigator: r } = u.useContext(P), { matches: l } = u.useContext(L), s = l[l.length - 1], c = s ? s.params : {}, i = s ? s.pathname : "/", o = s ? s.pathnameBase : "/", f = s && s.route;
419
- {
420
- let h = f && f.path || "";
421
- me(
422
- i,
423
- !f || h.endsWith("*") || h.endsWith("*?"),
424
- `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${i}" (under <Route path="${h}">) 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.
425
-
426
- Please change the parent <Route path="${h}"> to <Route path="${h === "/" ? "*" : `${h}/*`}">.`
427
- );
428
- }
429
- let d = k(), m;
430
- m = d;
431
- let p = m.pathname || "/", v = p;
432
- if (o !== "/") {
433
- let h = o.replace(/^\//, "").split("/");
434
- v = "/" + p.replace(/^\//, "").split("/").slice(h.length).join("/");
435
- }
436
- let g = le(e, { pathname: v });
437
- return b(
438
- f || g != null,
439
- `No routes matched location "${m.pathname}${m.search}${m.hash}" `
440
- ), b(
441
- g == null || g[g.length - 1].route.element !== void 0 || g[g.length - 1].route.Component !== void 0 || g[g.length - 1].route.lazy !== void 0,
442
- `Matched leaf route at location "${m.pathname}${m.search}${m.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.`
443
- ), Xe(
444
- g && g.map(
445
- (h) => Object.assign({}, h, {
446
- params: Object.assign({}, c, h.params),
447
- pathname: R([
448
- o,
449
- // Re-encode pathnames that were decoded inside matchRoutes
450
- r.encodeLocation ? r.encodeLocation(h.pathname).pathname : h.pathname
451
- ]),
452
- pathnameBase: h.pathnameBase === "/" ? o : R([
453
- o,
454
- // Re-encode pathnames that were decoded inside matchRoutes
455
- r.encodeLocation ? r.encodeLocation(h.pathnameBase).pathname : h.pathnameBase
456
- ])
457
- })
458
- ),
459
- l,
460
- n,
461
- a
462
- );
463
- }
464
- function je() {
465
- let e = nt(), t = Oe(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), n = e instanceof Error ? e.stack : null, a = "rgba(200,200,200, 0.5)", r = { padding: "0.5rem", backgroundColor: a }, l = { padding: "2px 4px", backgroundColor: a }, s = null;
466
- return console.error(
467
- "Error handled by React Router default ErrorBoundary:",
468
- e
469
- ), s = /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ u.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ u.createElement("code", { style: l }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ u.createElement("code", { style: l }, "errorElement"), " prop on your route.")), /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ u.createElement("h3", { style: { fontStyle: "italic" } }, t), n ? /* @__PURE__ */ u.createElement("pre", { style: r }, n) : null, s);
470
- }
471
- var Ye = /* @__PURE__ */ u.createElement(je, null), qe = class extends u.Component {
472
- constructor(e) {
473
- super(e), this.state = {
474
- location: e.location,
475
- revalidation: e.revalidation,
476
- error: e.error
477
- };
478
- }
479
- static getDerivedStateFromError(e) {
480
- return { error: e };
481
- }
482
- static getDerivedStateFromProps(e, t) {
483
- return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
484
- error: e.error,
485
- location: e.location,
486
- revalidation: e.revalidation
487
- } : {
488
- error: e.error !== void 0 ? e.error : t.error,
489
- location: t.location,
490
- revalidation: e.revalidation || t.revalidation
491
- };
492
- }
493
- componentDidCatch(e, t) {
494
- console.error(
495
- "React Router caught the following error during render",
496
- e,
497
- t
498
- );
499
- }
500
- render() {
501
- return this.state.error !== void 0 ? /* @__PURE__ */ u.createElement(L.Provider, { value: this.props.routeContext }, /* @__PURE__ */ u.createElement(
502
- G.Provider,
503
- {
504
- value: this.state.error,
505
- children: this.props.component
506
- }
507
- )) : this.props.children;
508
- }
509
- };
510
- function Ge({ routeContext: e, match: t, children: n }) {
511
- let a = u.useContext(D);
512
- return a && a.static && a.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (a.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ u.createElement(L.Provider, { value: e }, n);
513
- }
514
- function Xe(e, t = [], n = null, a = null) {
515
- if (e == null) {
516
- if (!n)
517
- return null;
518
- if (n.errors)
519
- e = n.matches;
520
- else if (t.length === 0 && !n.initialized && n.matches.length > 0)
521
- e = n.matches;
522
- else
523
- return null;
524
- }
525
- let r = e, l = n == null ? void 0 : n.errors;
526
- if (l != null) {
527
- let i = r.findIndex(
528
- (o) => o.route.id && (l == null ? void 0 : l[o.route.id]) !== void 0
529
- );
530
- x(
531
- i >= 0,
532
- `Could not find a matching route for errors on route IDs: ${Object.keys(
533
- l
534
- ).join(",")}`
535
- ), r = r.slice(
536
- 0,
537
- Math.min(r.length, i + 1)
538
- );
539
- }
540
- let s = !1, c = -1;
541
- if (n)
542
- for (let i = 0; i < r.length; i++) {
543
- let o = r[i];
544
- if ((o.route.HydrateFallback || o.route.hydrateFallbackElement) && (c = i), o.route.id) {
545
- let { loaderData: f, errors: d } = n, m = o.route.loader && !f.hasOwnProperty(o.route.id) && (!d || d[o.route.id] === void 0);
546
- if (o.route.lazy || m) {
547
- s = !0, c >= 0 ? r = r.slice(0, c + 1) : r = [r[0]];
548
- break;
549
- }
550
- }
551
- }
552
- return r.reduceRight((i, o, f) => {
553
- let d, m = !1, p = null, v = null;
554
- n && (d = l && o.route.id ? l[o.route.id] : void 0, p = o.route.errorElement || Ye, s && (c < 0 && f === 0 ? (me(
555
- "route-fallback",
556
- !1,
557
- "No `HydrateFallback` element provided to render during initial hydration"
558
- ), m = !0, v = null) : c === f && (m = !0, v = o.route.hydrateFallbackElement || null)));
559
- let g = t.concat(r.slice(0, f + 1)), y = () => {
560
- let h;
561
- return d ? h = p : m ? h = v : o.route.Component ? h = /* @__PURE__ */ u.createElement(o.route.Component, null) : o.route.element ? h = o.route.element : h = i, /* @__PURE__ */ u.createElement(
562
- Ge,
563
- {
564
- match: o,
565
- routeContext: {
566
- outlet: i,
567
- matches: g,
568
- isDataRoute: n != null
569
- },
570
- children: h
571
- }
572
- );
573
- };
574
- return n && (o.route.ErrorBoundary || o.route.errorElement || f === 0) ? /* @__PURE__ */ u.createElement(
575
- qe,
576
- {
577
- location: n.location,
578
- revalidation: n.revalidation,
579
- component: p,
580
- error: d,
581
- children: y(),
582
- routeContext: { outlet: null, matches: g, isDataRoute: !0 }
583
- }
584
- ) : y();
585
- }, null);
586
- }
587
- function X(e) {
588
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
589
- }
590
- function Qe(e) {
591
- let t = u.useContext(D);
592
- return x(t, X(e)), t;
593
- }
594
- function Ze(e) {
595
- let t = u.useContext(_);
596
- return x(t, X(e)), t;
597
- }
598
- function et(e) {
599
- let t = u.useContext(L);
600
- return x(t, X(e)), t;
601
- }
602
- function Q(e) {
603
- let t = et(e), n = t.matches[t.matches.length - 1];
604
- return x(
605
- n.route.id,
606
- `${e} can only be used on routes that contain a unique "id"`
607
- ), n.route.id;
608
- }
609
- function tt() {
610
- return Q(
611
- "useRouteId"
612
- /* UseRouteId */
613
- );
614
- }
615
- function nt() {
616
- var a;
617
- let e = u.useContext(G), t = Ze(
618
- "useRouteError"
619
- /* UseRouteError */
620
- ), n = Q(
621
- "useRouteError"
622
- /* UseRouteError */
623
- );
624
- return e !== void 0 ? e : (a = t.errors) == null ? void 0 : a[n];
625
- }
626
- function rt() {
627
- let { router: e } = Qe(
628
- "useNavigate"
629
- /* UseNavigateStable */
630
- ), t = Q(
631
- "useNavigate"
632
- /* UseNavigateStable */
633
- ), n = u.useRef(!1);
634
- return he(() => {
635
- n.current = !0;
636
- }), u.useCallback(
637
- async (r, l = {}) => {
638
- b(n.current, de), n.current && (typeof r == "number" ? e.navigate(r) : await e.navigate(r, { fromRouteId: t, ...l }));
639
- },
640
- [e, t]
641
- );
642
- }
643
- var re = {};
644
- function me(e, t, n) {
645
- !t && !re[e] && (re[e] = !0, b(!1, n));
646
- }
647
- u.memo(at);
648
- function at({
649
- routes: e,
650
- future: t,
651
- state: n
652
- }) {
653
- return Ke(e, void 0, n, t);
654
- }
655
- var O = "get", U = "application/x-www-form-urlencoded";
656
- function z(e) {
657
- return e != null && typeof e.tagName == "string";
658
- }
659
- function lt(e) {
660
- return z(e) && e.tagName.toLowerCase() === "button";
661
- }
662
- function ot(e) {
663
- return z(e) && e.tagName.toLowerCase() === "form";
664
- }
665
- function it(e) {
666
- return z(e) && e.tagName.toLowerCase() === "input";
667
- }
668
- function ut(e) {
669
- return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
670
- }
671
- function st(e, t) {
672
- return e.button === 0 && // Ignore everything but left clicks
673
- (!t || t === "_self") && // Let browser handle "target=_blank" etc.
674
- !ut(e);
675
- }
676
- var W = null;
677
- function ct() {
678
- if (W === null)
679
- try {
680
- new FormData(
681
- document.createElement("form"),
682
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
683
- 0
684
- ), W = !1;
685
- } catch {
686
- W = !0;
687
- }
688
- return W;
689
- }
690
- var ft = /* @__PURE__ */ new Set([
691
- "application/x-www-form-urlencoded",
692
- "multipart/form-data",
693
- "text/plain"
694
- ]);
695
- function K(e) {
696
- return e != null && !ft.has(e) ? (b(
697
- !1,
698
- `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${U}"`
699
- ), null) : e;
700
- }
701
- function dt(e, t) {
702
- let n, a, r, l, s;
703
- if (ot(e)) {
704
- let c = e.getAttribute("action");
705
- a = c ? F(c, t) : null, n = e.getAttribute("method") || O, r = K(e.getAttribute("enctype")) || U, l = new FormData(e);
706
- } else if (lt(e) || it(e) && (e.type === "submit" || e.type === "image")) {
707
- let c = e.form;
708
- if (c == null)
709
- throw new Error(
710
- 'Cannot submit a <button> or <input type="submit"> without a <form>'
711
- );
712
- let i = e.getAttribute("formaction") || c.getAttribute("action");
713
- if (a = i ? F(i, t) : null, n = e.getAttribute("formmethod") || c.getAttribute("method") || O, r = K(e.getAttribute("formenctype")) || K(c.getAttribute("enctype")) || U, l = new FormData(c, e), !ct()) {
714
- let { name: o, type: f, value: d } = e;
715
- if (f === "image") {
716
- let m = o ? `${o}.` : "";
717
- l.append(`${m}x`, "0"), l.append(`${m}y`, "0");
718
- } else o && l.append(o, d);
719
- }
720
- } else {
721
- if (z(e))
722
- throw new Error(
723
- 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
724
- );
725
- n = O, a = null, r = U, s = e;
726
- }
727
- return l && r === "text/plain" && (s = l, l = void 0), { action: a, method: n.toLowerCase(), encType: r, formData: l, body: s };
728
- }
729
- function Z(e, t) {
730
- if (e === !1 || e === null || typeof e > "u")
731
- throw new Error(t);
732
- }
733
- async function ht(e, t) {
734
- if (e.id in t)
735
- return t[e.id];
736
- try {
737
- let n = await import(
738
- /* @vite-ignore */
739
- /* webpackIgnore: true */
740
- e.module
741
- );
742
- return t[e.id] = n, n;
743
- } catch (n) {
744
- return console.error(
745
- `Error loading route module \`${e.module}\`, reloading page...`
746
- ), console.error(n), window.location.reload(), new Promise(() => {
747
- });
748
- }
749
- }
750
- function mt(e) {
751
- 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";
752
- }
753
- async function pt(e, t, n) {
754
- let a = await Promise.all(
755
- e.map(async (r) => {
756
- let l = t.routes[r.route.id];
757
- if (l) {
758
- let s = await ht(l, n);
759
- return s.links ? s.links() : [];
760
- }
761
- return [];
762
- })
763
- );
764
- return wt(
765
- a.flat(1).filter(mt).filter((r) => r.rel === "stylesheet" || r.rel === "preload").map(
766
- (r) => r.rel === "stylesheet" ? { ...r, rel: "prefetch", as: "style" } : { ...r, rel: "prefetch" }
767
- )
768
- );
769
- }
770
- function ae(e, t, n, a, r, l) {
771
- let s = (i, o) => n[o] ? i.route.id !== n[o].route.id : !0, c = (i, o) => {
772
- var f;
773
- return (
774
- // param change, /users/123 -> /users/456
775
- n[o].pathname !== i.pathname || // splat param changed, which is not present in match.path
776
- // e.g. /files/images/avatar.jpg -> files/finances.xls
777
- ((f = n[o].route.path) == null ? void 0 : f.endsWith("*")) && n[o].params["*"] !== i.params["*"]
778
- );
779
- };
780
- return l === "assets" ? t.filter(
781
- (i, o) => s(i, o) || c(i, o)
782
- ) : l === "data" ? t.filter((i, o) => {
783
- var d;
784
- let f = a.routes[i.route.id];
785
- if (!f || !f.hasLoader)
786
- return !1;
787
- if (s(i, o) || c(i, o))
788
- return !0;
789
- if (i.route.shouldRevalidate) {
790
- let m = i.route.shouldRevalidate({
791
- currentUrl: new URL(
792
- r.pathname + r.search + r.hash,
793
- window.origin
794
- ),
795
- currentParams: ((d = n[0]) == null ? void 0 : d.params) || {},
796
- nextUrl: new URL(e, window.origin),
797
- nextParams: i.params,
798
- defaultShouldRevalidate: !0
799
- });
800
- if (typeof m == "boolean")
801
- return m;
802
- }
803
- return !0;
804
- }) : [];
805
- }
806
- function gt(e, t) {
807
- return vt(
808
- e.map((n) => {
809
- let a = t.routes[n.route.id];
810
- if (!a) return [];
811
- let r = [a.module];
812
- return a.imports && (r = r.concat(a.imports)), r;
813
- }).flat(1)
814
- );
815
- }
816
- function vt(e) {
817
- return [...new Set(e)];
818
- }
819
- function yt(e) {
820
- let t = {}, n = Object.keys(e).sort();
821
- for (let a of n)
822
- t[a] = e[a];
823
- return t;
824
- }
825
- function wt(e, t) {
826
- let n = /* @__PURE__ */ new Set();
827
- return new Set(t), e.reduce((a, r) => {
828
- let l = JSON.stringify(yt(r));
829
- return n.has(l) || (n.add(l), a.push({ key: l, link: r })), a;
830
- }, []);
831
- }
832
- function xt(e) {
833
- let t = typeof e == "string" ? new URL(
834
- e,
835
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
836
- // don't assume window is available
837
- typeof window > "u" ? "server://singlefetch/" : window.location.origin
838
- ) : e;
839
- return t.pathname === "/" ? t.pathname = "_root.data" : t.pathname = `${t.pathname.replace(/\/$/, "")}.data`, t;
840
- }
841
- function Ct() {
842
- let e = u.useContext(D);
843
- return Z(
844
- e,
845
- "You must render this element inside a <DataRouterContext.Provider> element"
846
- ), e;
847
- }
848
- function Et() {
849
- let e = u.useContext(_);
850
- return Z(
851
- e,
852
- "You must render this element inside a <DataRouterStateContext.Provider> element"
853
- ), e;
854
- }
855
- var ee = u.createContext(void 0);
856
- ee.displayName = "FrameworkContext";
857
- function pe() {
858
- let e = u.useContext(ee);
859
- return Z(
860
- e,
861
- "You must render this element inside a <HydratedRouter> element"
862
- ), e;
863
- }
864
- function Rt(e, t) {
865
- let n = u.useContext(ee), [a, r] = u.useState(!1), [l, s] = u.useState(!1), { onFocus: c, onBlur: i, onMouseEnter: o, onMouseLeave: f, onTouchStart: d } = t, m = u.useRef(null);
866
- u.useEffect(() => {
867
- if (e === "render" && s(!0), e === "viewport") {
868
- let g = (h) => {
869
- h.forEach((C) => {
870
- s(C.isIntersecting);
871
- });
872
- }, y = new IntersectionObserver(g, { threshold: 0.5 });
873
- return m.current && y.observe(m.current), () => {
874
- y.disconnect();
875
- };
876
- }
877
- }, [e]), u.useEffect(() => {
878
- if (a) {
879
- let g = setTimeout(() => {
880
- s(!0);
881
- }, 100);
882
- return () => {
883
- clearTimeout(g);
884
- };
885
- }
886
- }, [a]);
887
- let p = () => {
888
- r(!0);
889
- }, v = () => {
890
- r(!1), s(!1);
891
- };
892
- return n ? e !== "intent" ? [l, m, {}] : [
893
- l,
894
- m,
895
- {
896
- onFocus: T(c, p),
897
- onBlur: T(i, v),
898
- onMouseEnter: T(o, p),
899
- onMouseLeave: T(f, v),
900
- onTouchStart: T(d, p)
901
- }
902
- ] : [!1, m, {}];
903
- }
904
- function T(e, t) {
905
- return (n) => {
906
- e && e(n), n.defaultPrevented || t(n);
907
- };
908
- }
909
- function bt({
910
- page: e,
911
- ...t
912
- }) {
913
- let { router: n } = Ct(), a = u.useMemo(
914
- () => le(n.routes, e, n.basename),
915
- [n.routes, e, n.basename]
916
- );
917
- return a ? /* @__PURE__ */ u.createElement(Lt, { page: e, matches: a, ...t }) : null;
918
- }
919
- function Pt(e) {
920
- let { manifest: t, routeModules: n } = pe(), [a, r] = u.useState([]);
921
- return u.useEffect(() => {
922
- let l = !1;
923
- return pt(e, t, n).then(
924
- (s) => {
925
- l || r(s);
926
- }
927
- ), () => {
928
- l = !0;
929
- };
930
- }, [e, t, n]), a;
931
- }
932
- function Lt({
933
- page: e,
934
- matches: t,
935
- ...n
936
- }) {
937
- let a = k(), { manifest: r, routeModules: l } = pe(), { loaderData: s, matches: c } = Et(), i = u.useMemo(
938
- () => ae(
939
- e,
940
- t,
941
- c,
942
- r,
943
- a,
944
- "data"
945
- ),
946
- [e, t, c, r, a]
947
- ), o = u.useMemo(
948
- () => ae(
949
- e,
950
- t,
951
- c,
952
- r,
953
- a,
954
- "assets"
955
- ),
956
- [e, t, c, r, a]
957
- ), f = u.useMemo(() => {
958
- if (e === a.pathname + a.search + a.hash)
959
- return [];
960
- let p = /* @__PURE__ */ new Set(), v = !1;
961
- if (t.forEach((y) => {
962
- var C;
963
- let h = r.routes[y.route.id];
964
- !h || !h.hasLoader || (!i.some((w) => w.route.id === y.route.id) && y.route.id in s && ((C = l[y.route.id]) != null && C.shouldRevalidate) || h.hasClientLoader ? v = !0 : p.add(y.route.id));
965
- }), p.size === 0)
966
- return [];
967
- let g = xt(e);
968
- return v && p.size > 0 && g.searchParams.set(
969
- "_routes",
970
- t.filter((y) => p.has(y.route.id)).map((y) => y.route.id).join(",")
971
- ), [g.pathname + g.search];
972
- }, [
973
- s,
974
- a,
975
- r,
976
- i,
977
- t,
978
- e,
979
- l
980
- ]), d = u.useMemo(
981
- () => gt(o, r),
982
- [o, r]
983
- ), m = Pt(o);
984
- return /* @__PURE__ */ u.createElement(u.Fragment, null, f.map((p) => /* @__PURE__ */ u.createElement("link", { key: p, rel: "prefetch", as: "fetch", href: p, ...n })), d.map((p) => /* @__PURE__ */ u.createElement("link", { key: p, rel: "modulepreload", href: p, ...n })), m.map(({ key: p, link: v }) => (
985
- // these don't spread `linkProps` because they are full link descriptors
986
- // already with their own props
987
- /* @__PURE__ */ u.createElement("link", { key: p, ...v })
988
- )));
989
- }
990
- function St(...e) {
991
- return (t) => {
992
- e.forEach((n) => {
993
- typeof n == "function" ? n(t) : n != null && (n.current = t);
994
- });
995
- };
996
- }
997
- var ge = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
998
- try {
999
- ge && (window.__reactRouterVersion = "7.1.3");
1000
- } catch {
1001
- }
1002
- var ve = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, ye = u.forwardRef(
1003
- function({
1004
- onClick: t,
1005
- discover: n = "render",
1006
- prefetch: a = "none",
1007
- relative: r,
1008
- reloadDocument: l,
1009
- replace: s,
1010
- state: c,
1011
- target: i,
1012
- to: o,
1013
- preventScrollReset: f,
1014
- viewTransition: d,
1015
- ...m
1016
- }, p) {
1017
- let { basename: v } = u.useContext(P), g = typeof o == "string" && ve.test(o), y, h = !1;
1018
- if (typeof o == "string" && g && (y = o, ge))
1019
- try {
1020
- let E = new URL(window.location.href), I = o.startsWith("//") ? new URL(E.protocol + o) : new URL(o), te = F(I.pathname, v);
1021
- I.origin === E.origin && te != null ? o = te + I.search + I.hash : h = !0;
1022
- } catch {
1023
- b(
1024
- !1,
1025
- `<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
1026
- );
1027
- }
1028
- let C = Ve(o, { relative: r }), [w, S, $] = Rt(
1029
- a,
1030
- m
1031
- ), B = It(o, {
1032
- replace: s,
1033
- state: c,
1034
- target: i,
1035
- preventScrollReset: f,
1036
- relative: r,
1037
- viewTransition: d
1038
- });
1039
- function N(E) {
1040
- t && t(E), E.defaultPrevented || B(E);
1041
- }
1042
- let M = (
1043
- // eslint-disable-next-line jsx-a11y/anchor-has-content
1044
- /* @__PURE__ */ u.createElement(
1045
- "a",
1046
- {
1047
- ...m,
1048
- ...$,
1049
- href: y || C,
1050
- onClick: h || l ? t : N,
1051
- ref: St(p, S),
1052
- target: i,
1053
- "data-discover": !g && n === "render" ? "true" : void 0
1054
- }
1055
- )
1056
- );
1057
- return w && !g ? /* @__PURE__ */ u.createElement(u.Fragment, null, M, /* @__PURE__ */ u.createElement(bt, { page: C })) : M;
1058
- }
1059
- );
1060
- ye.displayName = "Link";
1061
- var kt = u.forwardRef(
1062
- function({
1063
- "aria-current": t = "page",
1064
- caseSensitive: n = !1,
1065
- className: a = "",
1066
- end: r = !1,
1067
- style: l,
1068
- to: s,
1069
- viewTransition: c,
1070
- children: i,
1071
- ...o
1072
- }, f) {
1073
- let d = A(s, { relative: o.relative }), m = k(), p = u.useContext(_), { navigator: v, basename: g } = u.useContext(P), y = p != null && // Conditional usage is OK here because the usage of a data router is static
1074
- // eslint-disable-next-line react-hooks/rules-of-hooks
1075
- Bt(d) && c === !0, h = v.encodeLocation ? v.encodeLocation(d).pathname : d.pathname, C = m.pathname, w = p && p.navigation && p.navigation.location ? p.navigation.location.pathname : null;
1076
- n || (C = C.toLowerCase(), w = w ? w.toLowerCase() : null, h = h.toLowerCase()), w && g && (w = F(w, g) || w);
1077
- const S = h !== "/" && h.endsWith("/") ? h.length - 1 : h.length;
1078
- let $ = C === h || !r && C.startsWith(h) && C.charAt(S) === "/", B = w != null && (w === h || !r && w.startsWith(h) && w.charAt(h.length) === "/"), N = {
1079
- isActive: $,
1080
- isPending: B,
1081
- isTransitioning: y
1082
- }, M = $ ? t : void 0, E;
1083
- typeof a == "function" ? E = a(N) : E = [
1084
- a,
1085
- $ ? "active" : null,
1086
- B ? "pending" : null,
1087
- y ? "transitioning" : null
1088
- ].filter(Boolean).join(" ");
1089
- let I = typeof l == "function" ? l(N) : l;
1090
- return /* @__PURE__ */ u.createElement(
1091
- ye,
1092
- {
1093
- ...o,
1094
- "aria-current": M,
1095
- className: E,
1096
- ref: f,
1097
- style: I,
1098
- to: s,
1099
- viewTransition: c
1100
- },
1101
- typeof i == "function" ? i(N) : i
1102
- );
1103
- }
1104
- );
1105
- kt.displayName = "NavLink";
1106
- var $t = u.forwardRef(
1107
- ({
1108
- discover: e = "render",
1109
- fetcherKey: t,
1110
- navigate: n,
1111
- reloadDocument: a,
1112
- replace: r,
1113
- state: l,
1114
- method: s = O,
1115
- action: c,
1116
- onSubmit: i,
1117
- relative: o,
1118
- preventScrollReset: f,
1119
- viewTransition: d,
1120
- ...m
1121
- }, p) => {
1122
- let v = Tt(), g = At(c, { relative: o }), y = s.toLowerCase() === "get" ? "get" : "post", h = typeof c == "string" && ve.test(c), C = (w) => {
1123
- if (i && i(w), w.defaultPrevented) return;
1124
- w.preventDefault();
1125
- let S = w.nativeEvent.submitter, $ = (S == null ? void 0 : S.getAttribute("formmethod")) || s;
1126
- v(S || w.currentTarget, {
1127
- fetcherKey: t,
1128
- method: $,
1129
- navigate: n,
1130
- replace: r,
1131
- state: l,
1132
- relative: o,
1133
- preventScrollReset: f,
1134
- viewTransition: d
1135
- });
1136
- };
1137
- return /* @__PURE__ */ u.createElement(
1138
- "form",
1139
- {
1140
- ref: p,
1141
- method: y,
1142
- action: g,
1143
- onSubmit: a ? i : C,
1144
- ...m,
1145
- "data-discover": !h && e === "render" ? "true" : void 0
1146
- }
1147
- );
1148
- }
1149
- );
1150
- $t.displayName = "Form";
1151
- function Ft(e) {
1152
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1153
- }
1154
- function we(e) {
1155
- let t = u.useContext(D);
1156
- return x(t, Ft(e)), t;
1157
- }
1158
- function It(e, {
1159
- target: t,
1160
- replace: n,
1161
- state: a,
1162
- preventScrollReset: r,
1163
- relative: l,
1164
- viewTransition: s
1165
- } = {}) {
1166
- let c = ze(), i = k(), o = A(e, { relative: l });
1167
- return u.useCallback(
1168
- (f) => {
1169
- if (st(f, t)) {
1170
- f.preventDefault();
1171
- let d = n !== void 0 ? n : j(i) === j(o);
1172
- c(e, {
1173
- replace: d,
1174
- state: a,
1175
- preventScrollReset: r,
1176
- relative: l,
1177
- viewTransition: s
1178
- });
1179
- }
1180
- },
1181
- [
1182
- i,
1183
- c,
1184
- o,
1185
- n,
1186
- a,
1187
- t,
1188
- e,
1189
- r,
1190
- l,
1191
- s
1192
- ]
1193
- );
1194
- }
1195
- var Dt = 0, Nt = () => `__${String(++Dt)}__`;
1196
- function Tt() {
1197
- let { router: e } = we(
1198
- "useSubmit"
1199
- /* UseSubmit */
1200
- ), { basename: t } = u.useContext(P), n = tt();
1201
- return u.useCallback(
1202
- async (a, r = {}) => {
1203
- let { action: l, method: s, encType: c, formData: i, body: o } = dt(
1204
- a,
1205
- t
1206
- );
1207
- if (r.navigate === !1) {
1208
- let f = r.fetcherKey || Nt();
1209
- await e.fetch(f, n, r.action || l, {
1210
- preventScrollReset: r.preventScrollReset,
1211
- formData: i,
1212
- body: o,
1213
- formMethod: r.method || s,
1214
- formEncType: r.encType || c,
1215
- flushSync: r.flushSync
1216
- });
1217
- } else
1218
- await e.navigate(r.action || l, {
1219
- preventScrollReset: r.preventScrollReset,
1220
- formData: i,
1221
- body: o,
1222
- formMethod: r.method || s,
1223
- formEncType: r.encType || c,
1224
- replace: r.replace,
1225
- state: r.state,
1226
- fromRouteId: n,
1227
- flushSync: r.flushSync,
1228
- viewTransition: r.viewTransition
1229
- });
1230
- },
1231
- [e, t, n]
1232
- );
1233
- }
1234
- function At(e, { relative: t } = {}) {
1235
- let { basename: n } = u.useContext(P), a = u.useContext(L);
1236
- x(a, "useFormAction must be used inside a RouteContext");
1237
- let [r] = a.matches.slice(-1), l = { ...A(e || ".", { relative: t }) }, s = k();
1238
- if (e == null) {
1239
- l.search = s.search;
1240
- let c = new URLSearchParams(l.search), i = c.getAll("index");
1241
- if (i.some((f) => f === "")) {
1242
- c.delete("index"), i.filter((d) => d).forEach((d) => c.append("index", d));
1243
- let f = c.toString();
1244
- l.search = f ? `?${f}` : "";
1245
- }
1246
- }
1247
- return (!e || e === ".") && r.route.index && (l.search = l.search ? l.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (l.pathname = l.pathname === "/" ? n : R([n, l.pathname])), j(l);
1248
- }
1249
- function Bt(e, t = {}) {
1250
- let n = u.useContext(fe);
1251
- x(
1252
- n != null,
1253
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1254
- );
1255
- let { basename: a } = we(
1256
- "useViewTransitionState"
1257
- /* useViewTransitionState */
1258
- ), r = A(e, { relative: t.relative });
1259
- if (!n.isTransitioning)
1260
- return !1;
1261
- let l = F(n.currentLocation.pathname, a) || n.currentLocation.pathname, s = F(n.nextLocation.pathname, a) || n.nextLocation.pathname;
1262
- return H(r.pathname, s) != null || H(r.pathname, l) != null;
1263
- }
1264
- new TextEncoder();
1265
- const Mt = () => {
1266
- try {
1267
- return k(), {
1268
- isInsideRouter: !0
1269
- };
1270
- } catch {
1271
- return {
1272
- isInsideRouter: !1
1273
- };
1274
- }
1275
- };
1276
- export {
1277
- ye as L,
1278
- Mt as u
1279
- };