UNPKG

46 kBJavaScriptView Raw
1"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2 * react-router v7.10.0
3 *
4 * Copyright (c) Remix Software Inc.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE.md file in the root directory of this source tree.
8 *
9 * @license MIT
10 */
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51var _chunkSKXBY33Fjs = require('./chunk-SKXBY33F.js');
52
53// lib/dom/dom.ts
54var defaultMethod = "get";
55var defaultEncType = "application/x-www-form-urlencoded";
56function isHtmlElement(object) {
57 return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
58}
59function isButtonElement(object) {
60 return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
61}
62function isFormElement(object) {
63 return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
64}
65function isInputElement(object) {
66 return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
67}
68function isModifiedEvent(event) {
69 return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
70}
71function shouldProcessLinkClick(event, target) {
72 return event.button === 0 && // Ignore everything but left clicks
73 (!target || target === "_self") && // Let browser handle "target=_blank" etc.
74 !isModifiedEvent(event);
75}
76function createSearchParams(init = "") {
77 return new URLSearchParams(
78 typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
79 let value = init[key];
80 return memo.concat(
81 Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]
82 );
83 }, [])
84 );
85}
86function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
87 let searchParams = createSearchParams(locationSearch);
88 if (defaultSearchParams) {
89 defaultSearchParams.forEach((_, key) => {
90 if (!searchParams.has(key)) {
91 defaultSearchParams.getAll(key).forEach((value) => {
92 searchParams.append(key, value);
93 });
94 }
95 });
96 }
97 return searchParams;
98}
99var _formDataSupportsSubmitter = null;
100function isFormDataSubmitterSupported() {
101 if (_formDataSupportsSubmitter === null) {
102 try {
103 new FormData(
104 document.createElement("form"),
105 // @ts-expect-error if FormData supports the submitter parameter, this will throw
106 0
107 );
108 _formDataSupportsSubmitter = false;
109 } catch (e) {
110 _formDataSupportsSubmitter = true;
111 }
112 }
113 return _formDataSupportsSubmitter;
114}
115var supportedFormEncTypes = /* @__PURE__ */ new Set([
116 "application/x-www-form-urlencoded",
117 "multipart/form-data",
118 "text/plain"
119]);
120function getFormEncType(encType) {
121 if (encType != null && !supportedFormEncTypes.has(encType)) {
122 _chunkSKXBY33Fjs.warning.call(void 0,
123 false,
124 `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
125 );
126 return null;
127 }
128 return encType;
129}
130function getFormSubmissionInfo(target, basename) {
131 let method;
132 let action;
133 let encType;
134 let formData;
135 let body;
136 if (isFormElement(target)) {
137 let attr = target.getAttribute("action");
138 action = attr ? _chunkSKXBY33Fjs.stripBasename.call(void 0, attr, basename) : null;
139 method = target.getAttribute("method") || defaultMethod;
140 encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
141 formData = new FormData(target);
142 } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
143 let form = target.form;
144 if (form == null) {
145 throw new Error(
146 `Cannot submit a <button> or <input type="submit"> without a <form>`
147 );
148 }
149 let attr = target.getAttribute("formaction") || form.getAttribute("action");
150 action = attr ? _chunkSKXBY33Fjs.stripBasename.call(void 0, attr, basename) : null;
151 method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
152 encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
153 formData = new FormData(form, target);
154 if (!isFormDataSubmitterSupported()) {
155 let { name, type, value } = target;
156 if (type === "image") {
157 let prefix = name ? `${name}.` : "";
158 formData.append(`${prefix}x`, "0");
159 formData.append(`${prefix}y`, "0");
160 } else if (name) {
161 formData.append(name, value);
162 }
163 }
164 } else if (isHtmlElement(target)) {
165 throw new Error(
166 `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
167 );
168 } else {
169 method = defaultMethod;
170 action = null;
171 encType = defaultEncType;
172 body = target;
173 }
174 if (formData && encType === "text/plain") {
175 body = formData;
176 formData = void 0;
177 }
178 return { action, method: method.toLowerCase(), encType, formData, body };
179}
180
181// lib/dom/lib.tsx
182var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
183var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
184try {
185 if (isBrowser) {
186 window.__reactRouterVersion = // @ts-expect-error
187 "7.10.0";
188 }
189} catch (e) {
190}
191function createBrowserRouter(routes, opts) {
192 return _chunkSKXBY33Fjs.createRouter.call(void 0, {
193 basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
194 getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
195 future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
196 history: _chunkSKXBY33Fjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
197 hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
198 routes,
199 mapRouteProperties: _chunkSKXBY33Fjs.mapRouteProperties,
200 hydrationRouteProperties: _chunkSKXBY33Fjs.hydrationRouteProperties,
201 dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
202 patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
203 window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
204 unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.unstable_instrumentations])
205 }).initialize();
206}
207function createHashRouter(routes, opts) {
208 return _chunkSKXBY33Fjs.createRouter.call(void 0, {
209 basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
210 getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
211 future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
212 history: _chunkSKXBY33Fjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
213 hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
214 routes,
215 mapRouteProperties: _chunkSKXBY33Fjs.mapRouteProperties,
216 hydrationRouteProperties: _chunkSKXBY33Fjs.hydrationRouteProperties,
217 dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
218 patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
219 window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
220 unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.unstable_instrumentations])
221 }).initialize();
222}
223function parseHydrationData() {
224 let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]);
225 if (state && state.errors) {
226 state = {
227 ...state,
228 errors: deserializeErrors(state.errors)
229 };
230 }
231 return state;
232}
233function deserializeErrors(errors) {
234 if (!errors) return null;
235 let entries = Object.entries(errors);
236 let serialized = {};
237 for (let [key, val] of entries) {
238 if (val && val.__type === "RouteErrorResponse") {
239 serialized[key] = new (0, _chunkSKXBY33Fjs.ErrorResponseImpl)(
240 val.status,
241 val.statusText,
242 val.data,
243 val.internal === true
244 );
245 } else if (val && val.__type === "Error") {
246 if (val.__subType) {
247 let ErrorConstructor = window[val.__subType];
248 if (typeof ErrorConstructor === "function") {
249 try {
250 let error = new ErrorConstructor(val.message);
251 error.stack = "";
252 serialized[key] = error;
253 } catch (e) {
254 }
255 }
256 }
257 if (serialized[key] == null) {
258 let error = new Error(val.message);
259 error.stack = "";
260 serialized[key] = error;
261 }
262 } else {
263 serialized[key] = val;
264 }
265 }
266 return serialized;
267}
268function BrowserRouter({
269 basename,
270 children,
271 unstable_useTransitions,
272 window: window2
273}) {
274 let historyRef = React.useRef();
275 if (historyRef.current == null) {
276 historyRef.current = _chunkSKXBY33Fjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
277 }
278 let history = historyRef.current;
279 let [state, setStateImpl] = React.useState({
280 action: history.action,
281 location: history.location
282 });
283 let setState = React.useCallback(
284 (newState) => {
285 if (unstable_useTransitions === false) {
286 setStateImpl(newState);
287 } else {
288 React.startTransition(() => setStateImpl(newState));
289 }
290 },
291 [unstable_useTransitions]
292 );
293 React.useLayoutEffect(() => history.listen(setState), [history, setState]);
294 return /* @__PURE__ */ React.createElement(
295 _chunkSKXBY33Fjs.Router,
296 {
297 basename,
298 children,
299 location: state.location,
300 navigationType: state.action,
301 navigator: history,
302 unstable_useTransitions: unstable_useTransitions === true
303 }
304 );
305}
306function HashRouter({
307 basename,
308 children,
309 unstable_useTransitions,
310 window: window2
311}) {
312 let historyRef = React.useRef();
313 if (historyRef.current == null) {
314 historyRef.current = _chunkSKXBY33Fjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
315 }
316 let history = historyRef.current;
317 let [state, setStateImpl] = React.useState({
318 action: history.action,
319 location: history.location
320 });
321 let setState = React.useCallback(
322 (newState) => {
323 if (unstable_useTransitions === false) {
324 setStateImpl(newState);
325 } else {
326 React.startTransition(() => setStateImpl(newState));
327 }
328 },
329 [unstable_useTransitions]
330 );
331 React.useLayoutEffect(() => history.listen(setState), [history, setState]);
332 return /* @__PURE__ */ React.createElement(
333 _chunkSKXBY33Fjs.Router,
334 {
335 basename,
336 children,
337 location: state.location,
338 navigationType: state.action,
339 navigator: history,
340 unstable_useTransitions: unstable_useTransitions === true
341 }
342 );
343}
344function HistoryRouter({
345 basename,
346 children,
347 history,
348 unstable_useTransitions
349}) {
350 let [state, setStateImpl] = React.useState({
351 action: history.action,
352 location: history.location
353 });
354 let setState = React.useCallback(
355 (newState) => {
356 if (unstable_useTransitions === false) {
357 setStateImpl(newState);
358 } else {
359 React.startTransition(() => setStateImpl(newState));
360 }
361 },
362 [unstable_useTransitions]
363 );
364 React.useLayoutEffect(() => history.listen(setState), [history, setState]);
365 return /* @__PURE__ */ React.createElement(
366 _chunkSKXBY33Fjs.Router,
367 {
368 basename,
369 children,
370 location: state.location,
371 navigationType: state.action,
372 navigator: history,
373 unstable_useTransitions: unstable_useTransitions === true
374 }
375 );
376}
377HistoryRouter.displayName = "unstable_HistoryRouter";
378var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
379var Link = React.forwardRef(
380 function LinkWithRef({
381 onClick,
382 discover = "render",
383 prefetch = "none",
384 relative,
385 reloadDocument,
386 replace,
387 state,
388 target,
389 to,
390 preventScrollReset,
391 viewTransition,
392 ...rest
393 }, forwardedRef) {
394 let { basename, unstable_useTransitions } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
395 let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
396 let absoluteHref;
397 let isExternal = false;
398 if (typeof to === "string" && isAbsolute) {
399 absoluteHref = to;
400 if (isBrowser) {
401 try {
402 let currentUrl = new URL(window.location.href);
403 let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
404 let path = _chunkSKXBY33Fjs.stripBasename.call(void 0, targetUrl.pathname, basename);
405 if (targetUrl.origin === currentUrl.origin && path != null) {
406 to = path + targetUrl.search + targetUrl.hash;
407 } else {
408 isExternal = true;
409 }
410 } catch (e) {
411 _chunkSKXBY33Fjs.warning.call(void 0,
412 false,
413 `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
414 );
415 }
416 }
417 }
418 let href = _chunkSKXBY33Fjs.useHref.call(void 0, to, { relative });
419 let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkSKXBY33Fjs.usePrefetchBehavior.call(void 0,
420 prefetch,
421 rest
422 );
423 let internalOnClick = useLinkClickHandler(to, {
424 replace,
425 state,
426 target,
427 preventScrollReset,
428 relative,
429 viewTransition,
430 unstable_useTransitions
431 });
432 function handleClick(event) {
433 if (onClick) onClick(event);
434 if (!event.defaultPrevented) {
435 internalOnClick(event);
436 }
437 }
438 let link = (
439 // eslint-disable-next-line jsx-a11y/anchor-has-content
440 /* @__PURE__ */ React.createElement(
441 "a",
442 {
443 ...rest,
444 ...prefetchHandlers,
445 href: absoluteHref || href,
446 onClick: isExternal || reloadDocument ? onClick : handleClick,
447 ref: _chunkSKXBY33Fjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
448 target,
449 "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
450 }
451 )
452 );
453 return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkSKXBY33Fjs.PrefetchPageLinks, { page: href })) : link;
454 }
455);
456Link.displayName = "Link";
457var NavLink = React.forwardRef(
458 function NavLinkWithRef({
459 "aria-current": ariaCurrentProp = "page",
460 caseSensitive = false,
461 className: classNameProp = "",
462 end = false,
463 style: styleProp,
464 to,
465 viewTransition,
466 children,
467 ...rest
468 }, ref) {
469 let path = _chunkSKXBY33Fjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
470 let location = _chunkSKXBY33Fjs.useLocation.call(void 0, );
471 let routerState = React.useContext(_chunkSKXBY33Fjs.DataRouterStateContext);
472 let { navigator, basename } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
473 let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
474 // eslint-disable-next-line react-hooks/rules-of-hooks
475 useViewTransitionState(path) && viewTransition === true;
476 let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
477 let locationPathname = location.pathname;
478 let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
479 if (!caseSensitive) {
480 locationPathname = locationPathname.toLowerCase();
481 nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
482 toPathname = toPathname.toLowerCase();
483 }
484 if (nextLocationPathname && basename) {
485 nextLocationPathname = _chunkSKXBY33Fjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
486 }
487 const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
488 let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
489 let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
490 let renderProps = {
491 isActive,
492 isPending,
493 isTransitioning
494 };
495 let ariaCurrent = isActive ? ariaCurrentProp : void 0;
496 let className;
497 if (typeof classNameProp === "function") {
498 className = classNameProp(renderProps);
499 } else {
500 className = [
501 classNameProp,
502 isActive ? "active" : null,
503 isPending ? "pending" : null,
504 isTransitioning ? "transitioning" : null
505 ].filter(Boolean).join(" ");
506 }
507 let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
508 return /* @__PURE__ */ React.createElement(
509 Link,
510 {
511 ...rest,
512 "aria-current": ariaCurrent,
513 className,
514 ref,
515 style,
516 to,
517 viewTransition
518 },
519 typeof children === "function" ? children(renderProps) : children
520 );
521 }
522);
523NavLink.displayName = "NavLink";
524var Form = React.forwardRef(
525 ({
526 discover = "render",
527 fetcherKey,
528 navigate,
529 reloadDocument,
530 replace,
531 state,
532 method = defaultMethod,
533 action,
534 onSubmit,
535 relative,
536 preventScrollReset,
537 viewTransition,
538 ...props
539 }, forwardedRef) => {
540 let { unstable_useTransitions } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
541 let submit = useSubmit();
542 let formAction = useFormAction(action, { relative });
543 let formMethod = method.toLowerCase() === "get" ? "get" : "post";
544 let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
545 let submitHandler = (event) => {
546 onSubmit && onSubmit(event);
547 if (event.defaultPrevented) return;
548 event.preventDefault();
549 let submitter = event.nativeEvent.submitter;
550 let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method;
551 let doSubmit = () => submit(submitter || event.currentTarget, {
552 fetcherKey,
553 method: submitMethod,
554 navigate,
555 replace,
556 state,
557 relative,
558 preventScrollReset,
559 viewTransition
560 });
561 if (unstable_useTransitions && navigate !== false) {
562 React.startTransition(() => doSubmit());
563 } else {
564 doSubmit();
565 }
566 };
567 return /* @__PURE__ */ React.createElement(
568 "form",
569 {
570 ref: forwardedRef,
571 method: formMethod,
572 action: formAction,
573 onSubmit: reloadDocument ? onSubmit : submitHandler,
574 ...props,
575 "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
576 }
577 );
578 }
579);
580Form.displayName = "Form";
581function ScrollRestoration({
582 getKey,
583 storageKey,
584 ...props
585}) {
586 let remixContext = React.useContext(_chunkSKXBY33Fjs.FrameworkContext);
587 let { basename } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
588 let location = _chunkSKXBY33Fjs.useLocation.call(void 0, );
589 let matches = _chunkSKXBY33Fjs.useMatches.call(void 0, );
590 useScrollRestoration({ getKey, storageKey });
591 let ssrKey = React.useMemo(
592 () => {
593 if (!remixContext || !getKey) return null;
594 let userKey = getScrollRestorationKey(
595 location,
596 matches,
597 basename,
598 getKey
599 );
600 return userKey !== location.key ? userKey : null;
601 },
602 // Nah, we only need this the first time for the SSR render
603 // eslint-disable-next-line react-hooks/exhaustive-deps
604 []
605 );
606 if (!remixContext || remixContext.isSpaMode) {
607 return null;
608 }
609 let restoreScroll = ((storageKey2, restoreKey) => {
610 if (!window.history.state || !window.history.state.key) {
611 let key = Math.random().toString(32).slice(2);
612 window.history.replaceState({ key }, "");
613 }
614 try {
615 let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}");
616 let storedY = positions[restoreKey || window.history.state.key];
617 if (typeof storedY === "number") {
618 window.scrollTo(0, storedY);
619 }
620 } catch (error) {
621 console.error(error);
622 sessionStorage.removeItem(storageKey2);
623 }
624 }).toString();
625 return /* @__PURE__ */ React.createElement(
626 "script",
627 {
628 ...props,
629 suppressHydrationWarning: true,
630 dangerouslySetInnerHTML: {
631 __html: `(${restoreScroll})(${JSON.stringify(
632 storageKey || SCROLL_RESTORATION_STORAGE_KEY
633 )}, ${JSON.stringify(ssrKey)})`
634 }
635 }
636 );
637}
638ScrollRestoration.displayName = "ScrollRestoration";
639function getDataRouterConsoleError(hookName) {
640 return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
641}
642function useDataRouterContext(hookName) {
643 let ctx = React.useContext(_chunkSKXBY33Fjs.DataRouterContext);
644 _chunkSKXBY33Fjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
645 return ctx;
646}
647function useDataRouterState(hookName) {
648 let state = React.useContext(_chunkSKXBY33Fjs.DataRouterStateContext);
649 _chunkSKXBY33Fjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
650 return state;
651}
652function useLinkClickHandler(to, {
653 target,
654 replace: replaceProp,
655 state,
656 preventScrollReset,
657 relative,
658 viewTransition,
659 unstable_useTransitions
660} = {}) {
661 let navigate = _chunkSKXBY33Fjs.useNavigate.call(void 0, );
662 let location = _chunkSKXBY33Fjs.useLocation.call(void 0, );
663 let path = _chunkSKXBY33Fjs.useResolvedPath.call(void 0, to, { relative });
664 return React.useCallback(
665 (event) => {
666 if (shouldProcessLinkClick(event, target)) {
667 event.preventDefault();
668 let replace = replaceProp !== void 0 ? replaceProp : _chunkSKXBY33Fjs.createPath.call(void 0, location) === _chunkSKXBY33Fjs.createPath.call(void 0, path);
669 let doNavigate = () => navigate(to, {
670 replace,
671 state,
672 preventScrollReset,
673 relative,
674 viewTransition
675 });
676 if (unstable_useTransitions) {
677 React.startTransition(() => doNavigate());
678 } else {
679 doNavigate();
680 }
681 }
682 },
683 [
684 location,
685 navigate,
686 path,
687 replaceProp,
688 state,
689 target,
690 to,
691 preventScrollReset,
692 relative,
693 viewTransition,
694 unstable_useTransitions
695 ]
696 );
697}
698function useSearchParams(defaultInit) {
699 _chunkSKXBY33Fjs.warning.call(void 0,
700 typeof URLSearchParams !== "undefined",
701 `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
702 );
703 let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
704 let hasSetSearchParamsRef = React.useRef(false);
705 let location = _chunkSKXBY33Fjs.useLocation.call(void 0, );
706 let searchParams = React.useMemo(
707 () => (
708 // Only merge in the defaults if we haven't yet called setSearchParams.
709 // Once we call that we want those to take precedence, otherwise you can't
710 // remove a param with setSearchParams({}) if it has an initial value
711 getSearchParamsForLocation(
712 location.search,
713 hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
714 )
715 ),
716 [location.search]
717 );
718 let navigate = _chunkSKXBY33Fjs.useNavigate.call(void 0, );
719 let setSearchParams = React.useCallback(
720 (nextInit, navigateOptions) => {
721 const newSearchParams = createSearchParams(
722 typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
723 );
724 hasSetSearchParamsRef.current = true;
725 navigate("?" + newSearchParams, navigateOptions);
726 },
727 [navigate, searchParams]
728 );
729 return [searchParams, setSearchParams];
730}
731var fetcherId = 0;
732var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
733function useSubmit() {
734 let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
735 let { basename } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
736 let currentRouteId = _chunkSKXBY33Fjs.useRouteId.call(void 0, );
737 let routerFetch = router.fetch;
738 let routerNavigate = router.navigate;
739 return React.useCallback(
740 async (target, options = {}) => {
741 let { action, method, encType, formData, body } = getFormSubmissionInfo(
742 target,
743 basename
744 );
745 if (options.navigate === false) {
746 let key = options.fetcherKey || getUniqueFetcherId();
747 await routerFetch(key, currentRouteId, options.action || action, {
748 preventScrollReset: options.preventScrollReset,
749 formData,
750 body,
751 formMethod: options.method || method,
752 formEncType: options.encType || encType,
753 flushSync: options.flushSync
754 });
755 } else {
756 await routerNavigate(options.action || action, {
757 preventScrollReset: options.preventScrollReset,
758 formData,
759 body,
760 formMethod: options.method || method,
761 formEncType: options.encType || encType,
762 replace: options.replace,
763 state: options.state,
764 fromRouteId: currentRouteId,
765 flushSync: options.flushSync,
766 viewTransition: options.viewTransition
767 });
768 }
769 },
770 [routerFetch, routerNavigate, basename, currentRouteId]
771 );
772}
773function useFormAction(action, { relative } = {}) {
774 let { basename } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
775 let routeContext = React.useContext(_chunkSKXBY33Fjs.RouteContext);
776 _chunkSKXBY33Fjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
777 let [match] = routeContext.matches.slice(-1);
778 let path = { ..._chunkSKXBY33Fjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
779 let location = _chunkSKXBY33Fjs.useLocation.call(void 0, );
780 if (action == null) {
781 path.search = location.search;
782 let params = new URLSearchParams(path.search);
783 let indexValues = params.getAll("index");
784 let hasNakedIndexParam = indexValues.some((v) => v === "");
785 if (hasNakedIndexParam) {
786 params.delete("index");
787 indexValues.filter((v) => v).forEach((v) => params.append("index", v));
788 let qs = params.toString();
789 path.search = qs ? `?${qs}` : "";
790 }
791 }
792 if ((!action || action === ".") && match.route.index) {
793 path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
794 }
795 if (basename !== "/") {
796 path.pathname = path.pathname === "/" ? basename : _chunkSKXBY33Fjs.joinPaths.call(void 0, [basename, path.pathname]);
797 }
798 return _chunkSKXBY33Fjs.createPath.call(void 0, path);
799}
800function useFetcher({
801 key
802} = {}) {
803 let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
804 let state = useDataRouterState("useFetcher" /* UseFetcher */);
805 let fetcherData = React.useContext(_chunkSKXBY33Fjs.FetchersContext);
806 let route = React.useContext(_chunkSKXBY33Fjs.RouteContext);
807 let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
808 _chunkSKXBY33Fjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
809 _chunkSKXBY33Fjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
810 _chunkSKXBY33Fjs.invariant.call(void 0,
811 routeId != null,
812 `useFetcher can only be used on routes that contain a unique "id"`
813 );
814 let defaultKey = React.useId();
815 let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
816 if (key && key !== fetcherKey) {
817 setFetcherKey(key);
818 }
819 let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router;
820 React.useEffect(() => {
821 getFetcher(fetcherKey);
822 return () => deleteFetcher(fetcherKey);
823 }, [deleteFetcher, getFetcher, fetcherKey]);
824 let load = React.useCallback(
825 async (href, opts) => {
826 _chunkSKXBY33Fjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
827 await routerFetch(fetcherKey, routeId, href, opts);
828 },
829 [fetcherKey, routeId, routerFetch]
830 );
831 let submitImpl = useSubmit();
832 let submit = React.useCallback(
833 async (target, opts) => {
834 await submitImpl(target, {
835 ...opts,
836 navigate: false,
837 fetcherKey
838 });
839 },
840 [fetcherKey, submitImpl]
841 );
842 let reset = React.useCallback(
843 (opts) => resetFetcher(fetcherKey, opts),
844 [resetFetcher, fetcherKey]
845 );
846 let FetcherForm = React.useMemo(() => {
847 let FetcherForm2 = React.forwardRef(
848 (props, ref) => {
849 return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref });
850 }
851 );
852 FetcherForm2.displayName = "fetcher.Form";
853 return FetcherForm2;
854 }, [fetcherKey]);
855 let fetcher = state.fetchers.get(fetcherKey) || _chunkSKXBY33Fjs.IDLE_FETCHER;
856 let data = fetcherData.get(fetcherKey);
857 let fetcherWithComponents = React.useMemo(
858 () => ({
859 Form: FetcherForm,
860 submit,
861 load,
862 reset,
863 ...fetcher,
864 data
865 }),
866 [FetcherForm, submit, load, reset, fetcher, data]
867 );
868 return fetcherWithComponents;
869}
870function useFetchers() {
871 let state = useDataRouterState("useFetchers" /* UseFetchers */);
872 return Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({
873 ...fetcher,
874 key
875 }));
876}
877var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
878var savedScrollPositions = {};
879function getScrollRestorationKey(location, matches, basename, getKey) {
880 let key = null;
881 if (getKey) {
882 if (basename !== "/") {
883 key = getKey(
884 {
885 ...location,
886 pathname: _chunkSKXBY33Fjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
887 },
888 matches
889 );
890 } else {
891 key = getKey(location, matches);
892 }
893 }
894 if (key == null) {
895 key = location.key;
896 }
897 return key;
898}
899function useScrollRestoration({
900 getKey,
901 storageKey
902} = {}) {
903 let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */);
904 let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
905 "useScrollRestoration" /* UseScrollRestoration */
906 );
907 let { basename } = React.useContext(_chunkSKXBY33Fjs.NavigationContext);
908 let location = _chunkSKXBY33Fjs.useLocation.call(void 0, );
909 let matches = _chunkSKXBY33Fjs.useMatches.call(void 0, );
910 let navigation = _chunkSKXBY33Fjs.useNavigation.call(void 0, );
911 React.useEffect(() => {
912 window.history.scrollRestoration = "manual";
913 return () => {
914 window.history.scrollRestoration = "auto";
915 };
916 }, []);
917 usePageHide(
918 React.useCallback(() => {
919 if (navigation.state === "idle") {
920 let key = getScrollRestorationKey(location, matches, basename, getKey);
921 savedScrollPositions[key] = window.scrollY;
922 }
923 try {
924 sessionStorage.setItem(
925 storageKey || SCROLL_RESTORATION_STORAGE_KEY,
926 JSON.stringify(savedScrollPositions)
927 );
928 } catch (error) {
929 _chunkSKXBY33Fjs.warning.call(void 0,
930 false,
931 `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
932 );
933 }
934 window.history.scrollRestoration = "auto";
935 }, [navigation.state, getKey, basename, location, matches, storageKey])
936 );
937 if (typeof document !== "undefined") {
938 React.useLayoutEffect(() => {
939 try {
940 let sessionPositions = sessionStorage.getItem(
941 storageKey || SCROLL_RESTORATION_STORAGE_KEY
942 );
943 if (sessionPositions) {
944 savedScrollPositions = JSON.parse(sessionPositions);
945 }
946 } catch (e) {
947 }
948 }, [storageKey]);
949 React.useLayoutEffect(() => {
950 let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28(
951 savedScrollPositions,
952 () => window.scrollY,
953 getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
954 )]);
955 return () => disableScrollRestoration && disableScrollRestoration();
956 }, [router, basename, getKey]);
957 React.useLayoutEffect(() => {
958 if (restoreScrollPosition === false) {
959 return;
960 }
961 if (typeof restoreScrollPosition === "number") {
962 window.scrollTo(0, restoreScrollPosition);
963 return;
964 }
965 try {
966 if (location.hash) {
967 let el = document.getElementById(
968 decodeURIComponent(location.hash.slice(1))
969 );
970 if (el) {
971 el.scrollIntoView();
972 return;
973 }
974 }
975 } catch (e2) {
976 _chunkSKXBY33Fjs.warning.call(void 0,
977 false,
978 `"${location.hash.slice(
979 1
980 )}" is not a decodable element ID. The view will not scroll to it.`
981 );
982 }
983 if (preventScrollReset === true) {
984 return;
985 }
986 window.scrollTo(0, 0);
987 }, [location, restoreScrollPosition, preventScrollReset]);
988 }
989}
990function useBeforeUnload(callback, options) {
991 let { capture } = options || {};
992 React.useEffect(() => {
993 let opts = capture != null ? { capture } : void 0;
994 window.addEventListener("beforeunload", callback, opts);
995 return () => {
996 window.removeEventListener("beforeunload", callback, opts);
997 };
998 }, [callback, capture]);
999}
1000function usePageHide(callback, options) {
1001 let { capture } = options || {};
1002 React.useEffect(() => {
1003 let opts = capture != null ? { capture } : void 0;
1004 window.addEventListener("pagehide", callback, opts);
1005 return () => {
1006 window.removeEventListener("pagehide", callback, opts);
1007 };
1008 }, [callback, capture]);
1009}
1010function usePrompt({
1011 when,
1012 message
1013}) {
1014 let blocker = _chunkSKXBY33Fjs.useBlocker.call(void 0, when);
1015 React.useEffect(() => {
1016 if (blocker.state === "blocked") {
1017 let proceed = window.confirm(message);
1018 if (proceed) {
1019 setTimeout(blocker.proceed, 0);
1020 } else {
1021 blocker.reset();
1022 }
1023 }
1024 }, [blocker, message]);
1025 React.useEffect(() => {
1026 if (blocker.state === "blocked" && !when) {
1027 blocker.reset();
1028 }
1029 }, [blocker, when]);
1030}
1031function useViewTransitionState(to, { relative } = {}) {
1032 let vtContext = React.useContext(_chunkSKXBY33Fjs.ViewTransitionContext);
1033 _chunkSKXBY33Fjs.invariant.call(void 0,
1034 vtContext != null,
1035 "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1036 );
1037 let { basename } = useDataRouterContext(
1038 "useViewTransitionState" /* useViewTransitionState */
1039 );
1040 let path = _chunkSKXBY33Fjs.useResolvedPath.call(void 0, to, { relative });
1041 if (!vtContext.isTransitioning) {
1042 return false;
1043 }
1044 let currentPath = _chunkSKXBY33Fjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1045 let nextPath = _chunkSKXBY33Fjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1046 return _chunkSKXBY33Fjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkSKXBY33Fjs.matchPath.call(void 0, path.pathname, currentPath) != null;
1047}
1048
1049// lib/dom/server.tsx
1050
1051function StaticRouter({
1052 basename,
1053 children,
1054 location: locationProp = "/"
1055}) {
1056 if (typeof locationProp === "string") {
1057 locationProp = _chunkSKXBY33Fjs.parsePath.call(void 0, locationProp);
1058 }
1059 let action = "POP" /* Pop */;
1060 let location = {
1061 pathname: locationProp.pathname || "/",
1062 search: locationProp.search || "",
1063 hash: locationProp.hash || "",
1064 state: locationProp.state != null ? locationProp.state : null,
1065 key: locationProp.key || "default"
1066 };
1067 let staticNavigator = getStatelessNavigator();
1068 return /* @__PURE__ */ React2.createElement(
1069 _chunkSKXBY33Fjs.Router,
1070 {
1071 basename,
1072 children,
1073 location,
1074 navigationType: action,
1075 navigator: staticNavigator,
1076 static: true,
1077 unstable_useTransitions: false
1078 }
1079 );
1080}
1081function StaticRouterProvider({
1082 context,
1083 router,
1084 hydrate = true,
1085 nonce
1086}) {
1087 _chunkSKXBY33Fjs.invariant.call(void 0,
1088 router && context,
1089 "You must provide `router` and `context` to <StaticRouterProvider>"
1090 );
1091 let dataRouterContext = {
1092 router,
1093 navigator: getStatelessNavigator(),
1094 static: true,
1095 staticContext: context,
1096 basename: context.basename || "/"
1097 };
1098 let fetchersContext = /* @__PURE__ */ new Map();
1099 let hydrateScript = "";
1100 if (hydrate !== false) {
1101 let data = {
1102 loaderData: context.loaderData,
1103 actionData: context.actionData,
1104 errors: serializeErrors(context.errors)
1105 };
1106 let json = htmlEscape(JSON.stringify(JSON.stringify(data)));
1107 hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
1108 }
1109 let { state } = dataRouterContext.router;
1110 return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkSKXBY33Fjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkSKXBY33Fjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkSKXBY33Fjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkSKXBY33Fjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
1111 _chunkSKXBY33Fjs.Router,
1112 {
1113 basename: dataRouterContext.basename,
1114 location: state.location,
1115 navigationType: state.historyAction,
1116 navigator: dataRouterContext.navigator,
1117 static: dataRouterContext.static,
1118 unstable_useTransitions: false
1119 },
1120 /* @__PURE__ */ React2.createElement(
1121 DataRoutes,
1122 {
1123 routes: router.routes,
1124 future: router.future,
1125 state
1126 }
1127 )
1128 ))))), hydrateScript ? /* @__PURE__ */ React2.createElement(
1129 "script",
1130 {
1131 suppressHydrationWarning: true,
1132 nonce,
1133 dangerouslySetInnerHTML: { __html: hydrateScript }
1134 }
1135 ) : null);
1136}
1137function DataRoutes({
1138 routes,
1139 future,
1140 state
1141}) {
1142 return _chunkSKXBY33Fjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
1143}
1144function serializeErrors(errors) {
1145 if (!errors) return null;
1146 let entries = Object.entries(errors);
1147 let serialized = {};
1148 for (let [key, val] of entries) {
1149 if (_chunkSKXBY33Fjs.isRouteErrorResponse.call(void 0, val)) {
1150 serialized[key] = { ...val, __type: "RouteErrorResponse" };
1151 } else if (val instanceof Error) {
1152 serialized[key] = {
1153 message: val.message,
1154 __type: "Error",
1155 // If this is a subclass (i.e., ReferenceError), send up the type so we
1156 // can re-create the same type during hydration.
1157 ...val.name !== "Error" ? {
1158 __subType: val.name
1159 } : {}
1160 };
1161 } else {
1162 serialized[key] = val;
1163 }
1164 }
1165 return serialized;
1166}
1167function getStatelessNavigator() {
1168 return {
1169 createHref,
1170 encodeLocation,
1171 push(to) {
1172 throw new Error(
1173 `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.`
1174 );
1175 },
1176 replace(to) {
1177 throw new Error(
1178 `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.`
1179 );
1180 },
1181 go(delta) {
1182 throw new Error(
1183 `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.`
1184 );
1185 },
1186 back() {
1187 throw new Error(
1188 `You cannot use navigator.back() on the server because it is a stateless environment.`
1189 );
1190 },
1191 forward() {
1192 throw new Error(
1193 `You cannot use navigator.forward() on the server because it is a stateless environment.`
1194 );
1195 }
1196 };
1197}
1198function createStaticHandler2(routes, opts) {
1199 return _chunkSKXBY33Fjs.createStaticHandler.call(void 0, routes, {
1200 ...opts,
1201 mapRouteProperties: _chunkSKXBY33Fjs.mapRouteProperties
1202 });
1203}
1204function createStaticRouter(routes, context, opts = {}) {
1205 let manifest = {};
1206 let dataRoutes = _chunkSKXBY33Fjs.convertRoutesToDataRoutes.call(void 0,
1207 routes,
1208 _chunkSKXBY33Fjs.mapRouteProperties,
1209 void 0,
1210 manifest
1211 );
1212 let matches = context.matches.map((match) => {
1213 let route = manifest[match.route.id] || match.route;
1214 return {
1215 ...match,
1216 route
1217 };
1218 });
1219 let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`;
1220 return {
1221 get basename() {
1222 return context.basename;
1223 },
1224 get future() {
1225 return {
1226 v8_middleware: false,
1227 ..._optionalChain([opts, 'optionalAccess', _29 => _29.future])
1228 };
1229 },
1230 get state() {
1231 return {
1232 historyAction: "POP" /* Pop */,
1233 location: context.location,
1234 matches,
1235 loaderData: context.loaderData,
1236 actionData: context.actionData,
1237 errors: context.errors,
1238 initialized: true,
1239 navigation: _chunkSKXBY33Fjs.IDLE_NAVIGATION,
1240 restoreScrollPosition: null,
1241 preventScrollReset: false,
1242 revalidation: "idle",
1243 fetchers: /* @__PURE__ */ new Map(),
1244 blockers: /* @__PURE__ */ new Map()
1245 };
1246 },
1247 get routes() {
1248 return dataRoutes;
1249 },
1250 get window() {
1251 return void 0;
1252 },
1253 initialize() {
1254 throw msg("initialize");
1255 },
1256 subscribe() {
1257 throw msg("subscribe");
1258 },
1259 enableScrollRestoration() {
1260 throw msg("enableScrollRestoration");
1261 },
1262 navigate() {
1263 throw msg("navigate");
1264 },
1265 fetch() {
1266 throw msg("fetch");
1267 },
1268 revalidate() {
1269 throw msg("revalidate");
1270 },
1271 createHref,
1272 encodeLocation,
1273 getFetcher() {
1274 return _chunkSKXBY33Fjs.IDLE_FETCHER;
1275 },
1276 deleteFetcher() {
1277 throw msg("deleteFetcher");
1278 },
1279 resetFetcher() {
1280 throw msg("resetFetcher");
1281 },
1282 dispose() {
1283 throw msg("dispose");
1284 },
1285 getBlocker() {
1286 return _chunkSKXBY33Fjs.IDLE_BLOCKER;
1287 },
1288 deleteBlocker() {
1289 throw msg("deleteBlocker");
1290 },
1291 patchRoutes() {
1292 throw msg("patchRoutes");
1293 },
1294 _internalFetchControllers: /* @__PURE__ */ new Map(),
1295 _internalSetRoutes() {
1296 throw msg("_internalSetRoutes");
1297 },
1298 _internalSetStateDoNotUseOrYouWillBreakYourApp() {
1299 throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp");
1300 }
1301 };
1302}
1303function createHref(to) {
1304 return typeof to === "string" ? to : _chunkSKXBY33Fjs.createPath.call(void 0, to);
1305}
1306function encodeLocation(to) {
1307 let href = typeof to === "string" ? to : _chunkSKXBY33Fjs.createPath.call(void 0, to);
1308 href = href.replace(/ $/, "%20");
1309 let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
1310 return {
1311 pathname: encoded.pathname,
1312 search: encoded.search,
1313 hash: encoded.hash
1314 };
1315}
1316var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1317var ESCAPE_LOOKUP = {
1318 "&": "\\u0026",
1319 ">": "\\u003e",
1320 "<": "\\u003c",
1321 "\u2028": "\\u2028",
1322 "\u2029": "\\u2029"
1323};
1324var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
1325function htmlEscape(str) {
1326 return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
1327}
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter;