@konstructio/ui 0.0.13-alpha.2 → 0.1.0-alpha.11
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/{Combination-b348x__d.js → Combination-VYaRRJBZ.js} +155 -157
- package/dist/DatePicker.css +1 -0
- package/dist/Modal-CrG0m703.js +98 -0
- package/dist/assets/icons/components/Search.js +26 -0
- package/dist/assets/icons/components/Warning.js +22 -0
- package/dist/assets/icons/components/index.js +6 -0
- package/dist/chevron-down-UW8ts6wI.js +11 -0
- package/dist/{chevron-up-DgLBQCKD.js → chevron-up-RLP4nX7V.js} +1 -1
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +55 -41
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +79 -0
- package/dist/components/Badge/Badge.variants.js +68 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +44 -53
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +10 -41
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -23
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +43 -56
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +30 -26
- package/dist/components/Button/Button.variants.js +116 -29
- package/dist/components/Checkbox/Checkbox.js +300 -185
- package/dist/components/Checkbox/Checkbox.variants.js +12 -15
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +2 -2
- package/dist/components/Command/components/CommandItem.js +1 -1
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +2 -2
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +2722 -0
- package/dist/components/Datepicker/DatePicker.variants.js +5 -0
- package/dist/components/Divider/Divider.variants.js +9 -12
- package/dist/components/Dropdown/components/List/List.js +55 -18
- package/dist/components/Dropdown/components/List/List.variants.js +5 -3
- package/dist/components/Dropdown/components/ListItem/ListItem.js +28 -22
- package/dist/components/Dropdown/components/Wrapper.js +110 -86
- package/dist/components/Dropdown/contexts/dropdown.context.js +6 -2
- package/dist/components/Dropdown/contexts/dropdown.hook.js +5 -3
- package/dist/components/Dropdown/contexts/dropdown.provider.js +18 -11
- package/dist/components/Filter/Filter.js +20 -0
- package/dist/components/Filter/Filter.variants.js +22 -0
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +87 -0
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +95 -0
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +87 -0
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +90 -0
- package/dist/components/Filter/components/ResetButton/ResetButton.js +18 -0
- package/dist/components/Filter/components/index.js +8 -0
- package/dist/components/Filter/events/index.js +12 -0
- package/dist/components/Input/Input.js +134 -163
- package/dist/components/Input/Input.variants.js +15 -13
- package/dist/components/Loading/Loading.js +14 -99
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -4
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +4 -6
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +2 -2
- package/dist/components/Radio/Radio.variants.js +14 -12
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +141 -126
- package/dist/components/Tabs/Tabs.js +24 -0
- package/dist/components/Tabs/Tabs.variants.js +58 -0
- package/dist/components/Tabs/components/Content.js +19 -0
- package/dist/components/Tabs/components/List.js +20 -0
- package/dist/components/Tabs/components/Trigger.js +26 -0
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/TimePicker/TimePicker.js +8 -0
- package/dist/components/TimePicker/TimePicker.variants.js +62 -0
- package/dist/components/TimePicker/components/HoursList/HoursList.js +93 -0
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +68 -0
- package/dist/components/TimePicker/components/MinutesList/MinutesList.js +60 -0
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +96 -0
- package/dist/components/TimePicker/components/WrapperList/WrapperList.js +51 -0
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +16 -0
- package/dist/components/TimePicker/components/index.js +4 -0
- package/dist/components/TimePicker/contexts/index.js +8 -0
- package/dist/components/TimePicker/contexts/time-picker.context.js +22 -0
- package/dist/components/TimePicker/contexts/time-picker.hook.js +13 -0
- package/dist/components/TimePicker/contexts/time-picker.provider.js +46 -0
- package/dist/components/TimePicker/utils/index.js +6 -0
- package/dist/components/Toast/Toast.js +38 -36
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Typography/Typography.js +14 -16
- package/dist/components/index.js +78 -66
- package/dist/createLucideIcon-ByJ0JZvK.js +94 -0
- package/dist/index--EmNlyHx.js +31 -0
- package/dist/{index-Bk324h27.js → index-B5MIi2tR.js} +6 -5
- package/dist/{index-g-TFwd6Y.js → index-BCGvACM9.js} +2 -1
- package/dist/{index-AM3avohj.js → index-BNU3RH-3.js} +3 -3
- package/dist/{index-Bry5AFQ2.js → index-Bc1LNrRD.js} +1 -1
- package/dist/index-BdMNhZnh.js +9 -0
- package/dist/index-BvCZBMfr.js +432 -0
- package/dist/index-Cq1I1cG9.js +129 -0
- package/dist/index-Cs8Lv8Wj.js +13 -0
- package/dist/index-CvfCCTEO.js +323 -0
- package/dist/{index-DvFiic6N.js → index-DLYwlPRZ.js} +96 -102
- package/dist/{index-YaQrdkGE.js → index-DNRcvRTB.js} +31 -30
- package/dist/{index-dRxIWVBr.js → index-Dkt8F6CZ.js} +6 -5
- package/dist/{index-G_6jG4Qc.js → index-Dm-ooN_M.js} +18 -18
- package/dist/index-DwYXX2sM.js +13 -0
- package/dist/{index-C5psggHV.js → index-h-Ul0anl.js} +1 -2
- package/dist/{index-D9BbbgUq.js → index-rUBNhTeF.js} +2 -2
- package/dist/index.d.ts +128 -17
- package/dist/index.js +84 -72
- package/dist/package.json +37 -37
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +263 -0
- package/dist/ui/kubefirst-theme.css +1 -1
- package/dist/ui/theme.css +11 -0
- package/dist/ui/utilities.css +11 -2
- package/dist/useBreadcrumb-DMERrNkJ.js +1280 -0
- package/dist/utils/index.js +3 -3
- package/dist/{x-DU-Zw-L_.js → x-BPcqkRZd.js} +1 -1
- package/package.json +37 -37
- package/dist/Modal-i7eolhYH.js +0 -926
- package/dist/index-BOx5P4tS.js +0 -423
- package/dist/index-CWKdynYu.js +0 -32
- package/dist/index-bYyfdsls.js +0 -118
- package/dist/useBreadcrumb-BsIeMoR1.js +0 -1279
|
@@ -0,0 +1,1280 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
/**
|
|
3
|
+
* react-router v7.6.0
|
|
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 C(e, t) {
|
|
13
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
14
|
+
throw new Error(t);
|
|
15
|
+
}
|
|
16
|
+
function P(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 K({
|
|
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 l = e.indexOf("?");
|
|
38
|
+
l >= 0 && (t.search = e.substring(l), e = e.substring(0, l)), e && (t.pathname = e);
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
function le(e, t, n = "/") {
|
|
43
|
+
return Ce(e, t, n, !1);
|
|
44
|
+
}
|
|
45
|
+
function Ce(e, t, n, l) {
|
|
46
|
+
let r = typeof t == "string" ? Y(t) : t, a = S(r.pathname || "/", n);
|
|
47
|
+
if (a == null)
|
|
48
|
+
return null;
|
|
49
|
+
let c = oe(e);
|
|
50
|
+
Ee(c);
|
|
51
|
+
let s = null;
|
|
52
|
+
for (let o = 0; s == null && o < c.length; ++o) {
|
|
53
|
+
let i = De(a);
|
|
54
|
+
s = Ie(
|
|
55
|
+
c[o],
|
|
56
|
+
i,
|
|
57
|
+
l
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return s;
|
|
61
|
+
}
|
|
62
|
+
function oe(e, t = [], n = [], l = "") {
|
|
63
|
+
let r = (a, c, s) => {
|
|
64
|
+
let o = {
|
|
65
|
+
relativePath: s === void 0 ? a.path || "" : s,
|
|
66
|
+
caseSensitive: a.caseSensitive === !0,
|
|
67
|
+
childrenIndex: c,
|
|
68
|
+
route: a
|
|
69
|
+
};
|
|
70
|
+
o.relativePath.startsWith("/") && (C(
|
|
71
|
+
o.relativePath.startsWith(l),
|
|
72
|
+
`Absolute route path "${o.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
73
|
+
), o.relativePath = o.relativePath.slice(l.length));
|
|
74
|
+
let i = b([l, o.relativePath]), f = n.concat(o);
|
|
75
|
+
a.children && a.children.length > 0 && (C(
|
|
76
|
+
// Our types know better, but runtime JS may not!
|
|
77
|
+
// @ts-expect-error
|
|
78
|
+
a.index !== !0,
|
|
79
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${i}".`
|
|
80
|
+
), oe(a.children, t, f, i)), !(a.path == null && !a.index) && t.push({
|
|
81
|
+
path: i,
|
|
82
|
+
score: $e(i, a.index),
|
|
83
|
+
routesMeta: f
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return e.forEach((a, c) => {
|
|
87
|
+
var s;
|
|
88
|
+
if (a.path === "" || !((s = a.path) != null && s.includes("?")))
|
|
89
|
+
r(a, c);
|
|
90
|
+
else
|
|
91
|
+
for (let o of ie(a.path))
|
|
92
|
+
r(a, c, o);
|
|
93
|
+
}), t;
|
|
94
|
+
}
|
|
95
|
+
function ie(e) {
|
|
96
|
+
let t = e.split("/");
|
|
97
|
+
if (t.length === 0) return [];
|
|
98
|
+
let [n, ...l] = t, r = n.endsWith("?"), a = n.replace(/\?$/, "");
|
|
99
|
+
if (l.length === 0)
|
|
100
|
+
return r ? [a, ""] : [a];
|
|
101
|
+
let c = ie(l.join("/")), s = [];
|
|
102
|
+
return s.push(
|
|
103
|
+
...c.map(
|
|
104
|
+
(o) => o === "" ? a : [a, o].join("/")
|
|
105
|
+
)
|
|
106
|
+
), r && s.push(...c), s.map(
|
|
107
|
+
(o) => e.startsWith("/") && o === "" ? "/" : o
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function Ee(e) {
|
|
111
|
+
e.sort(
|
|
112
|
+
(t, n) => t.score !== n.score ? n.score - t.score : Fe(
|
|
113
|
+
t.routesMeta.map((l) => l.childrenIndex),
|
|
114
|
+
n.routesMeta.map((l) => l.childrenIndex)
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
var Re = /^:[\w-]+$/, be = 3, Pe = 2, Le = 1, ke = 10, Se = -2, ne = (e) => e === "*";
|
|
119
|
+
function $e(e, t) {
|
|
120
|
+
let n = e.split("/"), l = n.length;
|
|
121
|
+
return n.some(ne) && (l += Se), t && (l += Pe), n.filter((r) => !ne(r)).reduce(
|
|
122
|
+
(r, a) => r + (Re.test(a) ? be : a === "" ? Le : ke),
|
|
123
|
+
l
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function Fe(e, t) {
|
|
127
|
+
return e.length === t.length && e.slice(0, -1).every((l, r) => l === 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 Ie(e, t, n = !1) {
|
|
140
|
+
let { routesMeta: l } = e, r = {}, a = "/", c = [];
|
|
141
|
+
for (let s = 0; s < l.length; ++s) {
|
|
142
|
+
let o = l[s], i = s === l.length - 1, f = a === "/" ? t : t.slice(a.length) || "/", d = H(
|
|
143
|
+
{ path: o.relativePath, caseSensitive: o.caseSensitive, end: i },
|
|
144
|
+
f
|
|
145
|
+
), h = o.route;
|
|
146
|
+
if (!d && i && n && !l[l.length - 1].route.index && (d = H(
|
|
147
|
+
{
|
|
148
|
+
path: o.relativePath,
|
|
149
|
+
caseSensitive: o.caseSensitive,
|
|
150
|
+
end: !1
|
|
151
|
+
},
|
|
152
|
+
f
|
|
153
|
+
)), !d)
|
|
154
|
+
return null;
|
|
155
|
+
Object.assign(r, d.params), c.push({
|
|
156
|
+
// TODO: Can this as be avoided?
|
|
157
|
+
params: r,
|
|
158
|
+
pathname: b([a, d.pathname]),
|
|
159
|
+
pathnameBase: Be(
|
|
160
|
+
b([a, d.pathnameBase])
|
|
161
|
+
),
|
|
162
|
+
route: h
|
|
163
|
+
}), d.pathnameBase !== "/" && (a = b([a, d.pathnameBase]));
|
|
164
|
+
}
|
|
165
|
+
return c;
|
|
166
|
+
}
|
|
167
|
+
function H(e, t) {
|
|
168
|
+
typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
|
|
169
|
+
let [n, l] = Ne(
|
|
170
|
+
e.path,
|
|
171
|
+
e.caseSensitive,
|
|
172
|
+
e.end
|
|
173
|
+
), r = t.match(n);
|
|
174
|
+
if (!r) return null;
|
|
175
|
+
let a = r[0], c = a.replace(/(.)\/+$/, "$1"), s = r.slice(1);
|
|
176
|
+
return {
|
|
177
|
+
params: l.reduce(
|
|
178
|
+
(i, { paramName: f, isOptional: d }, h) => {
|
|
179
|
+
if (f === "*") {
|
|
180
|
+
let y = s[h] || "";
|
|
181
|
+
c = a.slice(0, a.length - y.length).replace(/(.)\/+$/, "$1");
|
|
182
|
+
}
|
|
183
|
+
const g = s[h];
|
|
184
|
+
return d && !g ? i[f] = void 0 : i[f] = (g || "").replace(/%2F/g, "/"), i;
|
|
185
|
+
},
|
|
186
|
+
{}
|
|
187
|
+
),
|
|
188
|
+
pathname: a,
|
|
189
|
+
pathnameBase: c,
|
|
190
|
+
pattern: e
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function Ne(e, t = !1, n = !0) {
|
|
194
|
+
P(
|
|
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 l = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
199
|
+
/\/:([\w-]+)(\?)?/g,
|
|
200
|
+
(c, s, o) => (l.push({ paramName: s, isOptional: o != null }), o ? "/?([^\\/]+)?" : "/([^\\/]+)")
|
|
201
|
+
);
|
|
202
|
+
return e.endsWith("*") ? (l.push({ paramName: "*" }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), l];
|
|
203
|
+
}
|
|
204
|
+
function De(e) {
|
|
205
|
+
try {
|
|
206
|
+
return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
|
|
207
|
+
} catch (t) {
|
|
208
|
+
return P(
|
|
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 S(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, l = e.charAt(n);
|
|
219
|
+
return l && l !== "/" ? null : e.slice(n) || "/";
|
|
220
|
+
}
|
|
221
|
+
function Te(e, t = "/") {
|
|
222
|
+
let {
|
|
223
|
+
pathname: n,
|
|
224
|
+
search: l = "",
|
|
225
|
+
hash: r = ""
|
|
226
|
+
} = typeof e == "string" ? Y(e) : e;
|
|
227
|
+
return {
|
|
228
|
+
pathname: n ? n.startsWith("/") ? n : Me(n, t) : t,
|
|
229
|
+
search: Oe(l),
|
|
230
|
+
hash: We(r)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function Me(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, l) {
|
|
240
|
+
return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
|
|
241
|
+
l
|
|
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, l) => l === t.length - 1 ? n.pathname : n.pathnameBase
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function se(e, t, n, l = !1) {
|
|
256
|
+
let r;
|
|
257
|
+
typeof e == "string" ? r = Y(e) : (r = { ...e }, C(
|
|
258
|
+
!r.pathname || !r.pathname.includes("?"),
|
|
259
|
+
j("?", "pathname", "search", r)
|
|
260
|
+
), C(
|
|
261
|
+
!r.pathname || !r.pathname.includes("#"),
|
|
262
|
+
j("#", "pathname", "hash", r)
|
|
263
|
+
), C(
|
|
264
|
+
!r.search || !r.search.includes("#"),
|
|
265
|
+
j("#", "search", "hash", r)
|
|
266
|
+
));
|
|
267
|
+
let a = e === "" || r.pathname === "", c = a ? "/" : r.pathname, s;
|
|
268
|
+
if (c == null)
|
|
269
|
+
s = n;
|
|
270
|
+
else {
|
|
271
|
+
let d = t.length - 1;
|
|
272
|
+
if (!l && c.startsWith("..")) {
|
|
273
|
+
let h = c.split("/");
|
|
274
|
+
for (; h[0] === ".."; )
|
|
275
|
+
h.shift(), d -= 1;
|
|
276
|
+
r.pathname = h.join("/");
|
|
277
|
+
}
|
|
278
|
+
s = d >= 0 ? t[d] : "/";
|
|
279
|
+
}
|
|
280
|
+
let o = Te(r, s), i = c && c !== "/" && c.endsWith("/"), f = (a || c === ".") && n.endsWith("/");
|
|
281
|
+
return !o.pathname.endsWith("/") && (i || f) && (o.pathname += "/"), o;
|
|
282
|
+
}
|
|
283
|
+
var b = (e) => e.join("/").replace(/\/\/+/g, "/"), Be = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Oe = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, We = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
|
|
284
|
+
function Ue(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 He = [
|
|
297
|
+
"GET",
|
|
298
|
+
...ce
|
|
299
|
+
];
|
|
300
|
+
new Set(He);
|
|
301
|
+
var N = u.createContext(null);
|
|
302
|
+
N.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 _e = u.createContext(
|
|
310
|
+
/* @__PURE__ */ new Map()
|
|
311
|
+
);
|
|
312
|
+
_e.displayName = "Fetchers";
|
|
313
|
+
var Ve = u.createContext(null);
|
|
314
|
+
Ve.displayName = "Await";
|
|
315
|
+
var L = u.createContext(
|
|
316
|
+
null
|
|
317
|
+
);
|
|
318
|
+
L.displayName = "Navigation";
|
|
319
|
+
var q = u.createContext(
|
|
320
|
+
null
|
|
321
|
+
);
|
|
322
|
+
q.displayName = "Location";
|
|
323
|
+
var k = u.createContext({
|
|
324
|
+
outlet: null,
|
|
325
|
+
matches: [],
|
|
326
|
+
isDataRoute: !1
|
|
327
|
+
});
|
|
328
|
+
k.displayName = "Route";
|
|
329
|
+
var G = u.createContext(null);
|
|
330
|
+
G.displayName = "RouteError";
|
|
331
|
+
function ze(e, { relative: t } = {}) {
|
|
332
|
+
C(
|
|
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: l } = u.useContext(L), { hash: r, pathname: a, search: c } = M(e, { relative: t }), s = a;
|
|
339
|
+
return n !== "/" && (s = a === "/" ? n : b([n, a])), l.createHref({ pathname: s, search: c, hash: r });
|
|
340
|
+
}
|
|
341
|
+
function V() {
|
|
342
|
+
return u.useContext(q) != null;
|
|
343
|
+
}
|
|
344
|
+
function $() {
|
|
345
|
+
return C(
|
|
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(L).static || u.useLayoutEffect(e);
|
|
355
|
+
}
|
|
356
|
+
function je() {
|
|
357
|
+
let { isDataRoute: e } = u.useContext(k);
|
|
358
|
+
return e ? at() : Je();
|
|
359
|
+
}
|
|
360
|
+
function Je() {
|
|
361
|
+
C(
|
|
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(N), { basename: t, navigator: n } = u.useContext(L), { matches: l } = u.useContext(k), { pathname: r } = $(), a = JSON.stringify(ue(l)), c = u.useRef(!1);
|
|
368
|
+
return he(() => {
|
|
369
|
+
c.current = !0;
|
|
370
|
+
}), u.useCallback(
|
|
371
|
+
(o, i = {}) => {
|
|
372
|
+
if (P(c.current, de), !c.current) return;
|
|
373
|
+
if (typeof o == "number") {
|
|
374
|
+
n.go(o);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
let f = se(
|
|
378
|
+
o,
|
|
379
|
+
JSON.parse(a),
|
|
380
|
+
r,
|
|
381
|
+
i.relative === "path"
|
|
382
|
+
);
|
|
383
|
+
e == null && t !== "/" && (f.pathname = f.pathname === "/" ? t : b([t, f.pathname])), (i.replace ? n.replace : n.push)(
|
|
384
|
+
f,
|
|
385
|
+
i.state,
|
|
386
|
+
i
|
|
387
|
+
);
|
|
388
|
+
},
|
|
389
|
+
[
|
|
390
|
+
t,
|
|
391
|
+
n,
|
|
392
|
+
a,
|
|
393
|
+
r,
|
|
394
|
+
e
|
|
395
|
+
]
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
u.createContext(null);
|
|
399
|
+
function M(e, { relative: t } = {}) {
|
|
400
|
+
let { matches: n } = u.useContext(k), { pathname: l } = $(), r = JSON.stringify(ue(n));
|
|
401
|
+
return u.useMemo(
|
|
402
|
+
() => se(
|
|
403
|
+
e,
|
|
404
|
+
JSON.parse(r),
|
|
405
|
+
l,
|
|
406
|
+
t === "path"
|
|
407
|
+
),
|
|
408
|
+
[e, r, l, t]
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
function Ke(e, t, n, l) {
|
|
412
|
+
C(
|
|
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, static: a } = u.useContext(L), { matches: c } = u.useContext(k), s = c[c.length - 1], o = s ? s.params : {}, i = s ? s.pathname : "/", f = s ? s.pathnameBase : "/", d = s && s.route;
|
|
419
|
+
{
|
|
420
|
+
let p = d && d.path || "";
|
|
421
|
+
me(
|
|
422
|
+
i,
|
|
423
|
+
!d || p.endsWith("*") || p.endsWith("*?"),
|
|
424
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${i}" (under <Route path="${p}">) 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="${p}"> to <Route path="${p === "/" ? "*" : `${p}/*`}">.`
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
let h = $(), g;
|
|
430
|
+
g = h;
|
|
431
|
+
let y = g.pathname || "/", w = y;
|
|
432
|
+
if (f !== "/") {
|
|
433
|
+
let p = f.replace(/^\//, "").split("/");
|
|
434
|
+
w = "/" + y.replace(/^\//, "").split("/").slice(p.length).join("/");
|
|
435
|
+
}
|
|
436
|
+
let v = !a && n && n.matches && n.matches.length > 0 ? n.matches : le(e, { pathname: w });
|
|
437
|
+
return P(
|
|
438
|
+
d || v != null,
|
|
439
|
+
`No routes matched location "${g.pathname}${g.search}${g.hash}" `
|
|
440
|
+
), P(
|
|
441
|
+
v == null || v[v.length - 1].route.element !== void 0 || v[v.length - 1].route.Component !== void 0 || v[v.length - 1].route.lazy !== void 0,
|
|
442
|
+
`Matched leaf route at location "${g.pathname}${g.search}${g.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
|
+
), Qe(
|
|
444
|
+
v && v.map(
|
|
445
|
+
(p) => Object.assign({}, p, {
|
|
446
|
+
params: Object.assign({}, o, p.params),
|
|
447
|
+
pathname: b([
|
|
448
|
+
f,
|
|
449
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
450
|
+
r.encodeLocation ? r.encodeLocation(p.pathname).pathname : p.pathname
|
|
451
|
+
]),
|
|
452
|
+
pathnameBase: p.pathnameBase === "/" ? f : b([
|
|
453
|
+
f,
|
|
454
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
455
|
+
r.encodeLocation ? r.encodeLocation(p.pathnameBase).pathname : p.pathnameBase
|
|
456
|
+
])
|
|
457
|
+
})
|
|
458
|
+
),
|
|
459
|
+
c,
|
|
460
|
+
n,
|
|
461
|
+
l
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
function Ye() {
|
|
465
|
+
let e = rt(), t = Ue(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), n = e instanceof Error ? e.stack : null, l = "rgba(200,200,200, 0.5)", r = { padding: "0.5rem", backgroundColor: l }, a = { padding: "2px 4px", backgroundColor: l }, c = null;
|
|
466
|
+
return console.error(
|
|
467
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
468
|
+
e
|
|
469
|
+
), c = /* @__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: a }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ u.createElement("code", { style: a }, "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, c);
|
|
470
|
+
}
|
|
471
|
+
var qe = /* @__PURE__ */ u.createElement(Ye, null), Ge = 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(k.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 Xe({ routeContext: e, match: t, children: n }) {
|
|
511
|
+
let l = u.useContext(N);
|
|
512
|
+
return l && l.static && l.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (l.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ u.createElement(k.Provider, { value: e }, n);
|
|
513
|
+
}
|
|
514
|
+
function Qe(e, t = [], n = null, l = 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, a = n == null ? void 0 : n.errors;
|
|
526
|
+
if (a != null) {
|
|
527
|
+
let o = r.findIndex(
|
|
528
|
+
(i) => i.route.id && (a == null ? void 0 : a[i.route.id]) !== void 0
|
|
529
|
+
);
|
|
530
|
+
C(
|
|
531
|
+
o >= 0,
|
|
532
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
533
|
+
a
|
|
534
|
+
).join(",")}`
|
|
535
|
+
), r = r.slice(
|
|
536
|
+
0,
|
|
537
|
+
Math.min(r.length, o + 1)
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
let c = !1, s = -1;
|
|
541
|
+
if (n)
|
|
542
|
+
for (let o = 0; o < r.length; o++) {
|
|
543
|
+
let i = r[o];
|
|
544
|
+
if ((i.route.HydrateFallback || i.route.hydrateFallbackElement) && (s = o), i.route.id) {
|
|
545
|
+
let { loaderData: f, errors: d } = n, h = i.route.loader && !f.hasOwnProperty(i.route.id) && (!d || d[i.route.id] === void 0);
|
|
546
|
+
if (i.route.lazy || h) {
|
|
547
|
+
c = !0, s >= 0 ? r = r.slice(0, s + 1) : r = [r[0]];
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
return r.reduceRight((o, i, f) => {
|
|
553
|
+
let d, h = !1, g = null, y = null;
|
|
554
|
+
n && (d = a && i.route.id ? a[i.route.id] : void 0, g = i.route.errorElement || qe, c && (s < 0 && f === 0 ? (me(
|
|
555
|
+
"route-fallback",
|
|
556
|
+
!1,
|
|
557
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
558
|
+
), h = !0, y = null) : s === f && (h = !0, y = i.route.hydrateFallbackElement || null)));
|
|
559
|
+
let w = t.concat(r.slice(0, f + 1)), v = () => {
|
|
560
|
+
let m;
|
|
561
|
+
return d ? m = g : h ? m = y : i.route.Component ? m = /* @__PURE__ */ u.createElement(i.route.Component, null) : i.route.element ? m = i.route.element : m = o, /* @__PURE__ */ u.createElement(
|
|
562
|
+
Xe,
|
|
563
|
+
{
|
|
564
|
+
match: i,
|
|
565
|
+
routeContext: {
|
|
566
|
+
outlet: o,
|
|
567
|
+
matches: w,
|
|
568
|
+
isDataRoute: n != null
|
|
569
|
+
},
|
|
570
|
+
children: m
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
};
|
|
574
|
+
return n && (i.route.ErrorBoundary || i.route.errorElement || f === 0) ? /* @__PURE__ */ u.createElement(
|
|
575
|
+
Ge,
|
|
576
|
+
{
|
|
577
|
+
location: n.location,
|
|
578
|
+
revalidation: n.revalidation,
|
|
579
|
+
component: g,
|
|
580
|
+
error: d,
|
|
581
|
+
children: v(),
|
|
582
|
+
routeContext: { outlet: null, matches: w, isDataRoute: !0 }
|
|
583
|
+
}
|
|
584
|
+
) : v();
|
|
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 Ze(e) {
|
|
591
|
+
let t = u.useContext(N);
|
|
592
|
+
return C(t, X(e)), t;
|
|
593
|
+
}
|
|
594
|
+
function et(e) {
|
|
595
|
+
let t = u.useContext(_);
|
|
596
|
+
return C(t, X(e)), t;
|
|
597
|
+
}
|
|
598
|
+
function tt(e) {
|
|
599
|
+
let t = u.useContext(k);
|
|
600
|
+
return C(t, X(e)), t;
|
|
601
|
+
}
|
|
602
|
+
function Q(e) {
|
|
603
|
+
let t = tt(e), n = t.matches[t.matches.length - 1];
|
|
604
|
+
return C(
|
|
605
|
+
n.route.id,
|
|
606
|
+
`${e} can only be used on routes that contain a unique "id"`
|
|
607
|
+
), n.route.id;
|
|
608
|
+
}
|
|
609
|
+
function nt() {
|
|
610
|
+
return Q(
|
|
611
|
+
"useRouteId"
|
|
612
|
+
/* UseRouteId */
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
function rt() {
|
|
616
|
+
var l;
|
|
617
|
+
let e = u.useContext(G), t = et(
|
|
618
|
+
"useRouteError"
|
|
619
|
+
/* UseRouteError */
|
|
620
|
+
), n = Q(
|
|
621
|
+
"useRouteError"
|
|
622
|
+
/* UseRouteError */
|
|
623
|
+
);
|
|
624
|
+
return e !== void 0 ? e : (l = t.errors) == null ? void 0 : l[n];
|
|
625
|
+
}
|
|
626
|
+
function at() {
|
|
627
|
+
let { router: e } = Ze(
|
|
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, a = {}) => {
|
|
638
|
+
P(n.current, de), n.current && (typeof r == "number" ? e.navigate(r) : await e.navigate(r, { fromRouteId: t, ...a }));
|
|
639
|
+
},
|
|
640
|
+
[e, t]
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
var re = {};
|
|
644
|
+
function me(e, t, n) {
|
|
645
|
+
!t && !re[e] && (re[e] = !0, P(!1, n));
|
|
646
|
+
}
|
|
647
|
+
u.memo(lt);
|
|
648
|
+
function lt({
|
|
649
|
+
routes: e,
|
|
650
|
+
future: t,
|
|
651
|
+
state: n
|
|
652
|
+
}) {
|
|
653
|
+
return Ke(e, void 0, n, t);
|
|
654
|
+
}
|
|
655
|
+
var W = "get", U = "application/x-www-form-urlencoded";
|
|
656
|
+
function z(e) {
|
|
657
|
+
return e != null && typeof e.tagName == "string";
|
|
658
|
+
}
|
|
659
|
+
function ot(e) {
|
|
660
|
+
return z(e) && e.tagName.toLowerCase() === "button";
|
|
661
|
+
}
|
|
662
|
+
function it(e) {
|
|
663
|
+
return z(e) && e.tagName.toLowerCase() === "form";
|
|
664
|
+
}
|
|
665
|
+
function ut(e) {
|
|
666
|
+
return z(e) && e.tagName.toLowerCase() === "input";
|
|
667
|
+
}
|
|
668
|
+
function st(e) {
|
|
669
|
+
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
670
|
+
}
|
|
671
|
+
function ct(e, t) {
|
|
672
|
+
return e.button === 0 && // Ignore everything but left clicks
|
|
673
|
+
(!t || t === "_self") && // Let browser handle "target=_blank" etc.
|
|
674
|
+
!st(e);
|
|
675
|
+
}
|
|
676
|
+
var O = null;
|
|
677
|
+
function ft() {
|
|
678
|
+
if (O === 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
|
+
), O = !1;
|
|
685
|
+
} catch {
|
|
686
|
+
O = !0;
|
|
687
|
+
}
|
|
688
|
+
return O;
|
|
689
|
+
}
|
|
690
|
+
var dt = /* @__PURE__ */ new Set([
|
|
691
|
+
"application/x-www-form-urlencoded",
|
|
692
|
+
"multipart/form-data",
|
|
693
|
+
"text/plain"
|
|
694
|
+
]);
|
|
695
|
+
function J(e) {
|
|
696
|
+
return e != null && !dt.has(e) ? (P(
|
|
697
|
+
!1,
|
|
698
|
+
`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${U}"`
|
|
699
|
+
), null) : e;
|
|
700
|
+
}
|
|
701
|
+
function ht(e, t) {
|
|
702
|
+
let n, l, r, a, c;
|
|
703
|
+
if (it(e)) {
|
|
704
|
+
let s = e.getAttribute("action");
|
|
705
|
+
l = s ? S(s, t) : null, n = e.getAttribute("method") || W, r = J(e.getAttribute("enctype")) || U, a = new FormData(e);
|
|
706
|
+
} else if (ot(e) || ut(e) && (e.type === "submit" || e.type === "image")) {
|
|
707
|
+
let s = e.form;
|
|
708
|
+
if (s == null)
|
|
709
|
+
throw new Error(
|
|
710
|
+
'Cannot submit a <button> or <input type="submit"> without a <form>'
|
|
711
|
+
);
|
|
712
|
+
let o = e.getAttribute("formaction") || s.getAttribute("action");
|
|
713
|
+
if (l = o ? S(o, t) : null, n = e.getAttribute("formmethod") || s.getAttribute("method") || W, r = J(e.getAttribute("formenctype")) || J(s.getAttribute("enctype")) || U, a = new FormData(s, e), !ft()) {
|
|
714
|
+
let { name: i, type: f, value: d } = e;
|
|
715
|
+
if (f === "image") {
|
|
716
|
+
let h = i ? `${i}.` : "";
|
|
717
|
+
a.append(`${h}x`, "0"), a.append(`${h}y`, "0");
|
|
718
|
+
} else i && a.append(i, 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 = W, l = null, r = U, c = e;
|
|
726
|
+
}
|
|
727
|
+
return a && r === "text/plain" && (c = a, a = void 0), { action: l, method: n.toLowerCase(), encType: r, formData: a, body: c };
|
|
728
|
+
}
|
|
729
|
+
function Z(e, t) {
|
|
730
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
731
|
+
throw new Error(t);
|
|
732
|
+
}
|
|
733
|
+
async function mt(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 pt(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 gt(e, t, n) {
|
|
754
|
+
let l = await Promise.all(
|
|
755
|
+
e.map(async (r) => {
|
|
756
|
+
let a = t.routes[r.route.id];
|
|
757
|
+
if (a) {
|
|
758
|
+
let c = await mt(a, n);
|
|
759
|
+
return c.links ? c.links() : [];
|
|
760
|
+
}
|
|
761
|
+
return [];
|
|
762
|
+
})
|
|
763
|
+
);
|
|
764
|
+
return xt(
|
|
765
|
+
l.flat(1).filter(pt).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, l, r, a) {
|
|
771
|
+
let c = (o, i) => n[i] ? o.route.id !== n[i].route.id : !0, s = (o, i) => {
|
|
772
|
+
var f;
|
|
773
|
+
return (
|
|
774
|
+
// param change, /users/123 -> /users/456
|
|
775
|
+
n[i].pathname !== o.pathname || // splat param changed, which is not present in match.path
|
|
776
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
777
|
+
((f = n[i].route.path) == null ? void 0 : f.endsWith("*")) && n[i].params["*"] !== o.params["*"]
|
|
778
|
+
);
|
|
779
|
+
};
|
|
780
|
+
return a === "assets" ? t.filter(
|
|
781
|
+
(o, i) => c(o, i) || s(o, i)
|
|
782
|
+
) : a === "data" ? t.filter((o, i) => {
|
|
783
|
+
var d;
|
|
784
|
+
let f = l.routes[o.route.id];
|
|
785
|
+
if (!f || !f.hasLoader)
|
|
786
|
+
return !1;
|
|
787
|
+
if (c(o, i) || s(o, i))
|
|
788
|
+
return !0;
|
|
789
|
+
if (o.route.shouldRevalidate) {
|
|
790
|
+
let h = o.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: o.params,
|
|
798
|
+
defaultShouldRevalidate: !0
|
|
799
|
+
});
|
|
800
|
+
if (typeof h == "boolean")
|
|
801
|
+
return h;
|
|
802
|
+
}
|
|
803
|
+
return !0;
|
|
804
|
+
}) : [];
|
|
805
|
+
}
|
|
806
|
+
function yt(e, t, { includeHydrateFallback: n } = {}) {
|
|
807
|
+
return vt(
|
|
808
|
+
e.map((l) => {
|
|
809
|
+
let r = t.routes[l.route.id];
|
|
810
|
+
if (!r) return [];
|
|
811
|
+
let a = [r.module];
|
|
812
|
+
return r.clientActionModule && (a = a.concat(r.clientActionModule)), r.clientLoaderModule && (a = a.concat(r.clientLoaderModule)), n && r.hydrateFallbackModule && (a = a.concat(r.hydrateFallbackModule)), r.imports && (a = a.concat(r.imports)), a;
|
|
813
|
+
}).flat(1)
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
function vt(e) {
|
|
817
|
+
return [...new Set(e)];
|
|
818
|
+
}
|
|
819
|
+
function wt(e) {
|
|
820
|
+
let t = {}, n = Object.keys(e).sort();
|
|
821
|
+
for (let l of n)
|
|
822
|
+
t[l] = e[l];
|
|
823
|
+
return t;
|
|
824
|
+
}
|
|
825
|
+
function xt(e, t) {
|
|
826
|
+
let n = /* @__PURE__ */ new Set();
|
|
827
|
+
return new Set(t), e.reduce((l, r) => {
|
|
828
|
+
let a = JSON.stringify(wt(r));
|
|
829
|
+
return n.has(a) || (n.add(a), l.push({ key: a, link: r })), l;
|
|
830
|
+
}, []);
|
|
831
|
+
}
|
|
832
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
833
|
+
function Ct(e, t) {
|
|
834
|
+
let n = typeof e == "string" ? new URL(
|
|
835
|
+
e,
|
|
836
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
837
|
+
// don't assume window is available
|
|
838
|
+
typeof window > "u" ? "server://singlefetch/" : window.location.origin
|
|
839
|
+
) : e;
|
|
840
|
+
return n.pathname === "/" ? n.pathname = "_root.data" : t && S(n.pathname, t) === "/" ? n.pathname = `${t.replace(/\/$/, "")}/_root.data` : n.pathname = `${n.pathname.replace(/\/$/, "")}.data`, n;
|
|
841
|
+
}
|
|
842
|
+
function pe() {
|
|
843
|
+
let e = u.useContext(N);
|
|
844
|
+
return Z(
|
|
845
|
+
e,
|
|
846
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
847
|
+
), e;
|
|
848
|
+
}
|
|
849
|
+
function Et() {
|
|
850
|
+
let e = u.useContext(_);
|
|
851
|
+
return Z(
|
|
852
|
+
e,
|
|
853
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
854
|
+
), e;
|
|
855
|
+
}
|
|
856
|
+
var ee = u.createContext(void 0);
|
|
857
|
+
ee.displayName = "FrameworkContext";
|
|
858
|
+
function ge() {
|
|
859
|
+
let e = u.useContext(ee);
|
|
860
|
+
return Z(
|
|
861
|
+
e,
|
|
862
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
863
|
+
), e;
|
|
864
|
+
}
|
|
865
|
+
function Rt(e, t) {
|
|
866
|
+
let n = u.useContext(ee), [l, r] = u.useState(!1), [a, c] = u.useState(!1), { onFocus: s, onBlur: o, onMouseEnter: i, onMouseLeave: f, onTouchStart: d } = t, h = u.useRef(null);
|
|
867
|
+
u.useEffect(() => {
|
|
868
|
+
if (e === "render" && c(!0), e === "viewport") {
|
|
869
|
+
let w = (m) => {
|
|
870
|
+
m.forEach((p) => {
|
|
871
|
+
c(p.isIntersecting);
|
|
872
|
+
});
|
|
873
|
+
}, v = new IntersectionObserver(w, { threshold: 0.5 });
|
|
874
|
+
return h.current && v.observe(h.current), () => {
|
|
875
|
+
v.disconnect();
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
}, [e]), u.useEffect(() => {
|
|
879
|
+
if (l) {
|
|
880
|
+
let w = setTimeout(() => {
|
|
881
|
+
c(!0);
|
|
882
|
+
}, 100);
|
|
883
|
+
return () => {
|
|
884
|
+
clearTimeout(w);
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
}, [l]);
|
|
888
|
+
let g = () => {
|
|
889
|
+
r(!0);
|
|
890
|
+
}, y = () => {
|
|
891
|
+
r(!1), c(!1);
|
|
892
|
+
};
|
|
893
|
+
return n ? e !== "intent" ? [a, h, {}] : [
|
|
894
|
+
a,
|
|
895
|
+
h,
|
|
896
|
+
{
|
|
897
|
+
onFocus: T(s, g),
|
|
898
|
+
onBlur: T(o, y),
|
|
899
|
+
onMouseEnter: T(i, g),
|
|
900
|
+
onMouseLeave: T(f, y),
|
|
901
|
+
onTouchStart: T(d, g)
|
|
902
|
+
}
|
|
903
|
+
] : [!1, h, {}];
|
|
904
|
+
}
|
|
905
|
+
function T(e, t) {
|
|
906
|
+
return (n) => {
|
|
907
|
+
e && e(n), n.defaultPrevented || t(n);
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function bt({
|
|
911
|
+
page: e,
|
|
912
|
+
...t
|
|
913
|
+
}) {
|
|
914
|
+
let { router: n } = pe(), l = u.useMemo(
|
|
915
|
+
() => le(n.routes, e, n.basename),
|
|
916
|
+
[n.routes, e, n.basename]
|
|
917
|
+
);
|
|
918
|
+
return l ? /* @__PURE__ */ u.createElement(Lt, { page: e, matches: l, ...t }) : null;
|
|
919
|
+
}
|
|
920
|
+
function Pt(e) {
|
|
921
|
+
let { manifest: t, routeModules: n } = ge(), [l, r] = u.useState([]);
|
|
922
|
+
return u.useEffect(() => {
|
|
923
|
+
let a = !1;
|
|
924
|
+
return gt(e, t, n).then(
|
|
925
|
+
(c) => {
|
|
926
|
+
a || r(c);
|
|
927
|
+
}
|
|
928
|
+
), () => {
|
|
929
|
+
a = !0;
|
|
930
|
+
};
|
|
931
|
+
}, [e, t, n]), l;
|
|
932
|
+
}
|
|
933
|
+
function Lt({
|
|
934
|
+
page: e,
|
|
935
|
+
matches: t,
|
|
936
|
+
...n
|
|
937
|
+
}) {
|
|
938
|
+
let l = $(), { manifest: r, routeModules: a } = ge(), { basename: c } = pe(), { loaderData: s, matches: o } = Et(), i = u.useMemo(
|
|
939
|
+
() => ae(
|
|
940
|
+
e,
|
|
941
|
+
t,
|
|
942
|
+
o,
|
|
943
|
+
r,
|
|
944
|
+
l,
|
|
945
|
+
"data"
|
|
946
|
+
),
|
|
947
|
+
[e, t, o, r, l]
|
|
948
|
+
), f = u.useMemo(
|
|
949
|
+
() => ae(
|
|
950
|
+
e,
|
|
951
|
+
t,
|
|
952
|
+
o,
|
|
953
|
+
r,
|
|
954
|
+
l,
|
|
955
|
+
"assets"
|
|
956
|
+
),
|
|
957
|
+
[e, t, o, r, l]
|
|
958
|
+
), d = u.useMemo(() => {
|
|
959
|
+
if (e === l.pathname + l.search + l.hash)
|
|
960
|
+
return [];
|
|
961
|
+
let y = /* @__PURE__ */ new Set(), w = !1;
|
|
962
|
+
if (t.forEach((m) => {
|
|
963
|
+
var x;
|
|
964
|
+
let p = r.routes[m.route.id];
|
|
965
|
+
!p || !p.hasLoader || (!i.some((R) => R.route.id === m.route.id) && m.route.id in s && ((x = a[m.route.id]) != null && x.shouldRevalidate) || p.hasClientLoader ? w = !0 : y.add(m.route.id));
|
|
966
|
+
}), y.size === 0)
|
|
967
|
+
return [];
|
|
968
|
+
let v = Ct(e, c);
|
|
969
|
+
return w && y.size > 0 && v.searchParams.set(
|
|
970
|
+
"_routes",
|
|
971
|
+
t.filter((m) => y.has(m.route.id)).map((m) => m.route.id).join(",")
|
|
972
|
+
), [v.pathname + v.search];
|
|
973
|
+
}, [
|
|
974
|
+
c,
|
|
975
|
+
s,
|
|
976
|
+
l,
|
|
977
|
+
r,
|
|
978
|
+
i,
|
|
979
|
+
t,
|
|
980
|
+
e,
|
|
981
|
+
a
|
|
982
|
+
]), h = u.useMemo(
|
|
983
|
+
() => yt(f, r),
|
|
984
|
+
[f, r]
|
|
985
|
+
), g = Pt(f);
|
|
986
|
+
return /* @__PURE__ */ u.createElement(u.Fragment, null, d.map((y) => /* @__PURE__ */ u.createElement("link", { key: y, rel: "prefetch", as: "fetch", href: y, ...n })), h.map((y) => /* @__PURE__ */ u.createElement("link", { key: y, rel: "modulepreload", href: y, ...n })), g.map(({ key: y, link: w }) => (
|
|
987
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
988
|
+
// already with their own props
|
|
989
|
+
/* @__PURE__ */ u.createElement("link", { key: y, ...w })
|
|
990
|
+
)));
|
|
991
|
+
}
|
|
992
|
+
function kt(...e) {
|
|
993
|
+
return (t) => {
|
|
994
|
+
e.forEach((n) => {
|
|
995
|
+
typeof n == "function" ? n(t) : n != null && (n.current = t);
|
|
996
|
+
});
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
var ye = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
1000
|
+
try {
|
|
1001
|
+
ye && (window.__reactRouterVersion = "7.6.0");
|
|
1002
|
+
} catch {
|
|
1003
|
+
}
|
|
1004
|
+
var ve = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, we = u.forwardRef(
|
|
1005
|
+
function({
|
|
1006
|
+
onClick: t,
|
|
1007
|
+
discover: n = "render",
|
|
1008
|
+
prefetch: l = "none",
|
|
1009
|
+
relative: r,
|
|
1010
|
+
reloadDocument: a,
|
|
1011
|
+
replace: c,
|
|
1012
|
+
state: s,
|
|
1013
|
+
target: o,
|
|
1014
|
+
to: i,
|
|
1015
|
+
preventScrollReset: f,
|
|
1016
|
+
viewTransition: d,
|
|
1017
|
+
...h
|
|
1018
|
+
}, g) {
|
|
1019
|
+
let { basename: y } = u.useContext(L), w = typeof i == "string" && ve.test(i), v, m = !1;
|
|
1020
|
+
if (typeof i == "string" && w && (v = i, ye))
|
|
1021
|
+
try {
|
|
1022
|
+
let E = new URL(window.location.href), I = i.startsWith("//") ? new URL(E.protocol + i) : new URL(i), te = S(I.pathname, y);
|
|
1023
|
+
I.origin === E.origin && te != null ? i = te + I.search + I.hash : m = !0;
|
|
1024
|
+
} catch {
|
|
1025
|
+
P(
|
|
1026
|
+
!1,
|
|
1027
|
+
`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
let p = ze(i, { relative: r }), [x, R, F] = Rt(
|
|
1031
|
+
l,
|
|
1032
|
+
h
|
|
1033
|
+
), A = It(i, {
|
|
1034
|
+
replace: c,
|
|
1035
|
+
state: s,
|
|
1036
|
+
target: o,
|
|
1037
|
+
preventScrollReset: f,
|
|
1038
|
+
relative: r,
|
|
1039
|
+
viewTransition: d
|
|
1040
|
+
});
|
|
1041
|
+
function D(E) {
|
|
1042
|
+
t && t(E), E.defaultPrevented || A(E);
|
|
1043
|
+
}
|
|
1044
|
+
let B = (
|
|
1045
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
1046
|
+
/* @__PURE__ */ u.createElement(
|
|
1047
|
+
"a",
|
|
1048
|
+
{
|
|
1049
|
+
...h,
|
|
1050
|
+
...F,
|
|
1051
|
+
href: v || p,
|
|
1052
|
+
onClick: m || a ? t : D,
|
|
1053
|
+
ref: kt(g, R),
|
|
1054
|
+
target: o,
|
|
1055
|
+
"data-discover": !w && n === "render" ? "true" : void 0
|
|
1056
|
+
}
|
|
1057
|
+
)
|
|
1058
|
+
);
|
|
1059
|
+
return x && !w ? /* @__PURE__ */ u.createElement(u.Fragment, null, B, /* @__PURE__ */ u.createElement(bt, { page: p })) : B;
|
|
1060
|
+
}
|
|
1061
|
+
);
|
|
1062
|
+
we.displayName = "Link";
|
|
1063
|
+
var St = u.forwardRef(
|
|
1064
|
+
function({
|
|
1065
|
+
"aria-current": t = "page",
|
|
1066
|
+
caseSensitive: n = !1,
|
|
1067
|
+
className: l = "",
|
|
1068
|
+
end: r = !1,
|
|
1069
|
+
style: a,
|
|
1070
|
+
to: c,
|
|
1071
|
+
viewTransition: s,
|
|
1072
|
+
children: o,
|
|
1073
|
+
...i
|
|
1074
|
+
}, f) {
|
|
1075
|
+
let d = M(c, { relative: i.relative }), h = $(), g = u.useContext(_), { navigator: y, basename: w } = u.useContext(L), v = g != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1076
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1077
|
+
At(d) && s === !0, m = y.encodeLocation ? y.encodeLocation(d).pathname : d.pathname, p = h.pathname, x = g && g.navigation && g.navigation.location ? g.navigation.location.pathname : null;
|
|
1078
|
+
n || (p = p.toLowerCase(), x = x ? x.toLowerCase() : null, m = m.toLowerCase()), x && w && (x = S(x, w) || x);
|
|
1079
|
+
const R = m !== "/" && m.endsWith("/") ? m.length - 1 : m.length;
|
|
1080
|
+
let F = p === m || !r && p.startsWith(m) && p.charAt(R) === "/", A = x != null && (x === m || !r && x.startsWith(m) && x.charAt(m.length) === "/"), D = {
|
|
1081
|
+
isActive: F,
|
|
1082
|
+
isPending: A,
|
|
1083
|
+
isTransitioning: v
|
|
1084
|
+
}, B = F ? t : void 0, E;
|
|
1085
|
+
typeof l == "function" ? E = l(D) : E = [
|
|
1086
|
+
l,
|
|
1087
|
+
F ? "active" : null,
|
|
1088
|
+
A ? "pending" : null,
|
|
1089
|
+
v ? "transitioning" : null
|
|
1090
|
+
].filter(Boolean).join(" ");
|
|
1091
|
+
let I = typeof a == "function" ? a(D) : a;
|
|
1092
|
+
return /* @__PURE__ */ u.createElement(
|
|
1093
|
+
we,
|
|
1094
|
+
{
|
|
1095
|
+
...i,
|
|
1096
|
+
"aria-current": B,
|
|
1097
|
+
className: E,
|
|
1098
|
+
ref: f,
|
|
1099
|
+
style: I,
|
|
1100
|
+
to: c,
|
|
1101
|
+
viewTransition: s
|
|
1102
|
+
},
|
|
1103
|
+
typeof o == "function" ? o(D) : o
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
);
|
|
1107
|
+
St.displayName = "NavLink";
|
|
1108
|
+
var $t = u.forwardRef(
|
|
1109
|
+
({
|
|
1110
|
+
discover: e = "render",
|
|
1111
|
+
fetcherKey: t,
|
|
1112
|
+
navigate: n,
|
|
1113
|
+
reloadDocument: l,
|
|
1114
|
+
replace: r,
|
|
1115
|
+
state: a,
|
|
1116
|
+
method: c = W,
|
|
1117
|
+
action: s,
|
|
1118
|
+
onSubmit: o,
|
|
1119
|
+
relative: i,
|
|
1120
|
+
preventScrollReset: f,
|
|
1121
|
+
viewTransition: d,
|
|
1122
|
+
...h
|
|
1123
|
+
}, g) => {
|
|
1124
|
+
let y = Tt(), w = Mt(s, { relative: i }), v = c.toLowerCase() === "get" ? "get" : "post", m = typeof s == "string" && ve.test(s), p = (x) => {
|
|
1125
|
+
if (o && o(x), x.defaultPrevented) return;
|
|
1126
|
+
x.preventDefault();
|
|
1127
|
+
let R = x.nativeEvent.submitter, F = (R == null ? void 0 : R.getAttribute("formmethod")) || c;
|
|
1128
|
+
y(R || x.currentTarget, {
|
|
1129
|
+
fetcherKey: t,
|
|
1130
|
+
method: F,
|
|
1131
|
+
navigate: n,
|
|
1132
|
+
replace: r,
|
|
1133
|
+
state: a,
|
|
1134
|
+
relative: i,
|
|
1135
|
+
preventScrollReset: f,
|
|
1136
|
+
viewTransition: d
|
|
1137
|
+
});
|
|
1138
|
+
};
|
|
1139
|
+
return /* @__PURE__ */ u.createElement(
|
|
1140
|
+
"form",
|
|
1141
|
+
{
|
|
1142
|
+
ref: g,
|
|
1143
|
+
method: v,
|
|
1144
|
+
action: w,
|
|
1145
|
+
onSubmit: l ? o : p,
|
|
1146
|
+
...h,
|
|
1147
|
+
"data-discover": !m && e === "render" ? "true" : void 0
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
}
|
|
1151
|
+
);
|
|
1152
|
+
$t.displayName = "Form";
|
|
1153
|
+
function Ft(e) {
|
|
1154
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1155
|
+
}
|
|
1156
|
+
function xe(e) {
|
|
1157
|
+
let t = u.useContext(N);
|
|
1158
|
+
return C(t, Ft(e)), t;
|
|
1159
|
+
}
|
|
1160
|
+
function It(e, {
|
|
1161
|
+
target: t,
|
|
1162
|
+
replace: n,
|
|
1163
|
+
state: l,
|
|
1164
|
+
preventScrollReset: r,
|
|
1165
|
+
relative: a,
|
|
1166
|
+
viewTransition: c
|
|
1167
|
+
} = {}) {
|
|
1168
|
+
let s = je(), o = $(), i = M(e, { relative: a });
|
|
1169
|
+
return u.useCallback(
|
|
1170
|
+
(f) => {
|
|
1171
|
+
if (ct(f, t)) {
|
|
1172
|
+
f.preventDefault();
|
|
1173
|
+
let d = n !== void 0 ? n : K(o) === K(i);
|
|
1174
|
+
s(e, {
|
|
1175
|
+
replace: d,
|
|
1176
|
+
state: l,
|
|
1177
|
+
preventScrollReset: r,
|
|
1178
|
+
relative: a,
|
|
1179
|
+
viewTransition: c
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
[
|
|
1184
|
+
o,
|
|
1185
|
+
s,
|
|
1186
|
+
i,
|
|
1187
|
+
n,
|
|
1188
|
+
l,
|
|
1189
|
+
t,
|
|
1190
|
+
e,
|
|
1191
|
+
r,
|
|
1192
|
+
a,
|
|
1193
|
+
c
|
|
1194
|
+
]
|
|
1195
|
+
);
|
|
1196
|
+
}
|
|
1197
|
+
var Nt = 0, Dt = () => `__${String(++Nt)}__`;
|
|
1198
|
+
function Tt() {
|
|
1199
|
+
let { router: e } = xe(
|
|
1200
|
+
"useSubmit"
|
|
1201
|
+
/* UseSubmit */
|
|
1202
|
+
), { basename: t } = u.useContext(L), n = nt();
|
|
1203
|
+
return u.useCallback(
|
|
1204
|
+
async (l, r = {}) => {
|
|
1205
|
+
let { action: a, method: c, encType: s, formData: o, body: i } = ht(
|
|
1206
|
+
l,
|
|
1207
|
+
t
|
|
1208
|
+
);
|
|
1209
|
+
if (r.navigate === !1) {
|
|
1210
|
+
let f = r.fetcherKey || Dt();
|
|
1211
|
+
await e.fetch(f, n, r.action || a, {
|
|
1212
|
+
preventScrollReset: r.preventScrollReset,
|
|
1213
|
+
formData: o,
|
|
1214
|
+
body: i,
|
|
1215
|
+
formMethod: r.method || c,
|
|
1216
|
+
formEncType: r.encType || s,
|
|
1217
|
+
flushSync: r.flushSync
|
|
1218
|
+
});
|
|
1219
|
+
} else
|
|
1220
|
+
await e.navigate(r.action || a, {
|
|
1221
|
+
preventScrollReset: r.preventScrollReset,
|
|
1222
|
+
formData: o,
|
|
1223
|
+
body: i,
|
|
1224
|
+
formMethod: r.method || c,
|
|
1225
|
+
formEncType: r.encType || s,
|
|
1226
|
+
replace: r.replace,
|
|
1227
|
+
state: r.state,
|
|
1228
|
+
fromRouteId: n,
|
|
1229
|
+
flushSync: r.flushSync,
|
|
1230
|
+
viewTransition: r.viewTransition
|
|
1231
|
+
});
|
|
1232
|
+
},
|
|
1233
|
+
[e, t, n]
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
function Mt(e, { relative: t } = {}) {
|
|
1237
|
+
let { basename: n } = u.useContext(L), l = u.useContext(k);
|
|
1238
|
+
C(l, "useFormAction must be used inside a RouteContext");
|
|
1239
|
+
let [r] = l.matches.slice(-1), a = { ...M(e || ".", { relative: t }) }, c = $();
|
|
1240
|
+
if (e == null) {
|
|
1241
|
+
a.search = c.search;
|
|
1242
|
+
let s = new URLSearchParams(a.search), o = s.getAll("index");
|
|
1243
|
+
if (o.some((f) => f === "")) {
|
|
1244
|
+
s.delete("index"), o.filter((d) => d).forEach((d) => s.append("index", d));
|
|
1245
|
+
let f = s.toString();
|
|
1246
|
+
a.search = f ? `?${f}` : "";
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
return (!e || e === ".") && r.route.index && (a.search = a.search ? a.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (a.pathname = a.pathname === "/" ? n : b([n, a.pathname])), K(a);
|
|
1250
|
+
}
|
|
1251
|
+
function At(e, t = {}) {
|
|
1252
|
+
let n = u.useContext(fe);
|
|
1253
|
+
C(
|
|
1254
|
+
n != null,
|
|
1255
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1256
|
+
);
|
|
1257
|
+
let { basename: l } = xe(
|
|
1258
|
+
"useViewTransitionState"
|
|
1259
|
+
/* useViewTransitionState */
|
|
1260
|
+
), r = M(e, { relative: t.relative });
|
|
1261
|
+
if (!n.isTransitioning)
|
|
1262
|
+
return !1;
|
|
1263
|
+
let a = S(n.currentLocation.pathname, l) || n.currentLocation.pathname, c = S(n.nextLocation.pathname, l) || n.nextLocation.pathname;
|
|
1264
|
+
return H(r.pathname, c) != null || H(r.pathname, a) != null;
|
|
1265
|
+
}
|
|
1266
|
+
const Bt = () => {
|
|
1267
|
+
try {
|
|
1268
|
+
return $(), {
|
|
1269
|
+
isInsideRouter: !0
|
|
1270
|
+
};
|
|
1271
|
+
} catch {
|
|
1272
|
+
return {
|
|
1273
|
+
isInsideRouter: !1
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
export {
|
|
1278
|
+
we as L,
|
|
1279
|
+
Bt as u
|
|
1280
|
+
};
|