"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; }/** * react-router v7.7.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ var _chunk7OQROU2Djs = require('./chunk-7OQROU2D.js'); // lib/components.tsx var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); function mapRouteProperties(route) { let updates = { // Note: this check also occurs in createRoutesFromChildren so update // there if you change this -- please and thank you! hasErrorBoundary: route.hasErrorBoundary || route.ErrorBoundary != null || route.errorElement != null }; if (route.Component) { if (_chunk7OQROU2Djs.ENABLE_DEV_WARNINGS) { if (route.element) { _chunk7OQROU2Djs.warning.call(void 0, false, "You should not include both `Component` and `element` on your route - `Component` will be used." ); } } Object.assign(updates, { element: React.createElement(route.Component), Component: void 0 }); } if (route.HydrateFallback) { if (_chunk7OQROU2Djs.ENABLE_DEV_WARNINGS) { if (route.hydrateFallbackElement) { _chunk7OQROU2Djs.warning.call(void 0, false, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used." ); } } Object.assign(updates, { hydrateFallbackElement: React.createElement(route.HydrateFallback), HydrateFallback: void 0 }); } if (route.ErrorBoundary) { if (_chunk7OQROU2Djs.ENABLE_DEV_WARNINGS) { if (route.errorElement) { _chunk7OQROU2Djs.warning.call(void 0, false, "You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used." ); } } Object.assign(updates, { errorElement: React.createElement(route.ErrorBoundary), ErrorBoundary: void 0 }); } return updates; } var hydrationRouteProperties = [ "HydrateFallback", "hydrateFallbackElement" ]; function createMemoryRouter(routes, opts) { return _chunk7OQROU2Djs.createRouter.call(void 0, { basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]), unstable_getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.unstable_getContext]), future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]), history: _chunk7OQROU2Djs.createMemoryHistory.call(void 0, { initialEntries: _optionalChain([opts, 'optionalAccess', _5 => _5.initialEntries]), initialIndex: _optionalChain([opts, 'optionalAccess', _6 => _6.initialIndex]) }), hydrationData: _optionalChain([opts, 'optionalAccess', _7 => _7.hydrationData]), routes, hydrationRouteProperties, mapRouteProperties, dataStrategy: _optionalChain([opts, 'optionalAccess', _8 => _8.dataStrategy]), patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _9 => _9.patchRoutesOnNavigation]) }).initialize(); } var Deferred = class { constructor() { this.status = "pending"; this.promise = new Promise((resolve, reject) => { this.resolve = (value) => { if (this.status === "pending") { this.status = "resolved"; resolve(value); } }; this.reject = (reason) => { if (this.status === "pending") { this.status = "rejected"; reject(reason); } }; }); } }; function RouterProvider({ router, flushSync: reactDomFlushSyncImpl }) { let [state, setStateImpl] = React.useState(router.state); let [pendingState, setPendingState] = React.useState(); let [vtContext, setVtContext] = React.useState({ isTransitioning: false }); let [renderDfd, setRenderDfd] = React.useState(); let [transition, setTransition] = React.useState(); let [interruption, setInterruption] = React.useState(); let fetcherData = React.useRef(/* @__PURE__ */ new Map()); let setState = React.useCallback( (newState, { deletedFetchers, flushSync, viewTransitionOpts }) => { newState.fetchers.forEach((fetcher, key) => { if (fetcher.data !== void 0) { fetcherData.current.set(key, fetcher.data); } }); deletedFetchers.forEach((key) => fetcherData.current.delete(key)); _chunk7OQROU2Djs.warnOnce.call(void 0, flushSync === false || reactDomFlushSyncImpl != null, 'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.' ); let isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === "function"; _chunk7OQROU2Djs.warnOnce.call(void 0, viewTransitionOpts == null || isViewTransitionAvailable, "You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available." ); if (!viewTransitionOpts || !isViewTransitionAvailable) { if (reactDomFlushSyncImpl && flushSync) { reactDomFlushSyncImpl(() => setStateImpl(newState)); } else { React.startTransition(() => setStateImpl(newState)); } return; } if (reactDomFlushSyncImpl && flushSync) { reactDomFlushSyncImpl(() => { if (transition) { renderDfd && renderDfd.resolve(); transition.skipTransition(); } setVtContext({ isTransitioning: true, flushSync: true, currentLocation: viewTransitionOpts.currentLocation, nextLocation: viewTransitionOpts.nextLocation }); }); let t = router.window.document.startViewTransition(() => { reactDomFlushSyncImpl(() => setStateImpl(newState)); }); t.finished.finally(() => { reactDomFlushSyncImpl(() => { setRenderDfd(void 0); setTransition(void 0); setPendingState(void 0); setVtContext({ isTransitioning: false }); }); }); reactDomFlushSyncImpl(() => setTransition(t)); return; } if (transition) { renderDfd && renderDfd.resolve(); transition.skipTransition(); setInterruption({ state: newState, currentLocation: viewTransitionOpts.currentLocation, nextLocation: viewTransitionOpts.nextLocation }); } else { setPendingState(newState); setVtContext({ isTransitioning: true, flushSync: false, currentLocation: viewTransitionOpts.currentLocation, nextLocation: viewTransitionOpts.nextLocation }); } }, [router.window, reactDomFlushSyncImpl, transition, renderDfd] ); React.useLayoutEffect(() => router.subscribe(setState), [router, setState]); React.useEffect(() => { if (vtContext.isTransitioning && !vtContext.flushSync) { setRenderDfd(new Deferred()); } }, [vtContext]); React.useEffect(() => { if (renderDfd && pendingState && router.window) { let newState = pendingState; let renderPromise = renderDfd.promise; let transition2 = router.window.document.startViewTransition(async () => { React.startTransition(() => setStateImpl(newState)); await renderPromise; }); transition2.finished.finally(() => { setRenderDfd(void 0); setTransition(void 0); setPendingState(void 0); setVtContext({ isTransitioning: false }); }); setTransition(transition2); } }, [pendingState, renderDfd, router.window]); React.useEffect(() => { if (renderDfd && pendingState && state.location.key === pendingState.location.key) { renderDfd.resolve(); } }, [renderDfd, transition, state.location, pendingState]); React.useEffect(() => { if (!vtContext.isTransitioning && interruption) { setPendingState(interruption.state); setVtContext({ isTransitioning: true, flushSync: false, currentLocation: interruption.currentLocation, nextLocation: interruption.nextLocation }); setInterruption(void 0); } }, [vtContext.isTransitioning, interruption]); let navigator = React.useMemo(() => { return { createHref: router.createHref, encodeLocation: router.encodeLocation, go: (n) => router.navigate(n), push: (to, state2, opts) => router.navigate(to, { state: state2, preventScrollReset: _optionalChain([opts, 'optionalAccess', _10 => _10.preventScrollReset]) }), replace: (to, state2, opts) => router.navigate(to, { replace: true, state: state2, preventScrollReset: _optionalChain([opts, 'optionalAccess', _11 => _11.preventScrollReset]) }) }; }, [router]); let basename = router.basename || "/"; let dataRouterContext = React.useMemo( () => ({ router, navigator, static: false, basename }), [router, navigator, basename] ); return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React.createElement( Router, { basename, location: state.location, navigationType: state.historyAction, navigator }, /* @__PURE__ */ React.createElement( MemoizedDataRoutes, { routes: router.routes, future: router.future, state } ) ))))), null); } var MemoizedDataRoutes = React.memo(DataRoutes); function DataRoutes({ routes, future, state }) { return _chunk7OQROU2Djs.useRoutesImpl.call(void 0, routes, void 0, state, future); } function MemoryRouter({ basename, children, initialEntries, initialIndex }) { let historyRef = React.useRef(); if (historyRef.current == null) { historyRef.current = _chunk7OQROU2Djs.createMemoryHistory.call(void 0, { initialEntries, initialIndex, v5Compat: true }); } let history = historyRef.current; let [state, setStateImpl] = React.useState({ action: history.action, location: history.location }); let setState = React.useCallback( (newState) => { React.startTransition(() => setStateImpl(newState)); }, [setStateImpl] ); React.useLayoutEffect(() => history.listen(setState), [history, setState]); return /* @__PURE__ */ React.createElement( Router, { basename, children, location: state.location, navigationType: state.action, navigator: history } ); } function Navigate({ to, replace, state, relative }) { _chunk7OQROU2Djs.invariant.call(void 0, _chunk7OQROU2Djs.useInRouterContext.call(void 0, ), // TODO: This error is probably because they somehow have 2 versions of // the router loaded. We can help them understand how to avoid that. ` may be used only in the context of a component.` ); let { static: isStatic } = React.useContext(_chunk7OQROU2Djs.NavigationContext); _chunk7OQROU2Djs.warning.call(void 0, !isStatic, ` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.` ); let { matches } = React.useContext(_chunk7OQROU2Djs.RouteContext); let { pathname: locationPathname } = _chunk7OQROU2Djs.useLocation.call(void 0, ); let navigate = _chunk7OQROU2Djs.useNavigate.call(void 0, ); let path = _chunk7OQROU2Djs.resolveTo.call(void 0, to, _chunk7OQROU2Djs.getResolveToMatches.call(void 0, matches), locationPathname, relative === "path" ); let jsonPath = JSON.stringify(path); React.useEffect(() => { navigate(JSON.parse(jsonPath), { replace, state, relative }); }, [navigate, jsonPath, relative, replace, state]); return null; } function Outlet(props) { return _chunk7OQROU2Djs.useOutlet.call(void 0, props.context); } function Route(props) { _chunk7OQROU2Djs.invariant.call(void 0, false, `A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .` ); } function Router({ basename: basenameProp = "/", children = null, location: locationProp, navigationType = "POP" /* Pop */, navigator, static: staticProp = false }) { _chunk7OQROU2Djs.invariant.call(void 0, !_chunk7OQROU2Djs.useInRouterContext.call(void 0, ), `You cannot render a inside another . You should never have more than one in your app.` ); let basename = basenameProp.replace(/^\/*/, "/"); let navigationContext = React.useMemo( () => ({ basename, navigator, static: staticProp, future: {} }), [basename, navigator, staticProp] ); if (typeof locationProp === "string") { locationProp = _chunk7OQROU2Djs.parsePath.call(void 0, locationProp); } let { pathname = "/", search = "", hash = "", state = null, key = "default" } = locationProp; let locationContext = React.useMemo(() => { let trailingPathname = _chunk7OQROU2Djs.stripBasename.call(void 0, pathname, basename); if (trailingPathname == null) { return null; } return { location: { pathname: trailingPathname, search, hash, state, key }, navigationType }; }, [basename, pathname, search, hash, state, key, navigationType]); _chunk7OQROU2Djs.warning.call(void 0, locationContext != null, ` is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the won't render anything.` ); if (locationContext == null) { return null; } return /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.LocationContext.Provider, { children, value: locationContext })); } function Routes({ children, location }) { return _chunk7OQROU2Djs.useRoutes.call(void 0, createRoutesFromChildren(children), location); } function Await({ children, errorElement, resolve }) { return /* @__PURE__ */ React.createElement(AwaitErrorBoundary, { resolve, errorElement }, /* @__PURE__ */ React.createElement(ResolveAwait, null, children)); } var AwaitErrorBoundary = class extends React.Component { constructor(props) { super(props); this.state = { error: null }; } static getDerivedStateFromError(error) { return { error }; } componentDidCatch(error, errorInfo) { console.error( " caught the following error during render", error, errorInfo ); } render() { let { children, errorElement, resolve } = this.props; let promise = null; let status = 0 /* pending */; if (!(resolve instanceof Promise)) { status = 1 /* success */; promise = Promise.resolve(); Object.defineProperty(promise, "_tracked", { get: () => true }); Object.defineProperty(promise, "_data", { get: () => resolve }); } else if (this.state.error) { status = 2 /* error */; let renderError = this.state.error; promise = Promise.reject().catch(() => { }); Object.defineProperty(promise, "_tracked", { get: () => true }); Object.defineProperty(promise, "_error", { get: () => renderError }); } else if (resolve._tracked) { promise = resolve; status = "_error" in promise ? 2 /* error */ : "_data" in promise ? 1 /* success */ : 0 /* pending */; } else { status = 0 /* pending */; Object.defineProperty(resolve, "_tracked", { get: () => true }); promise = resolve.then( (data) => Object.defineProperty(resolve, "_data", { get: () => data }), (error) => Object.defineProperty(resolve, "_error", { get: () => error }) ); } if (status === 2 /* error */ && !errorElement) { throw promise._error; } if (status === 2 /* error */) { return /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.AwaitContext.Provider, { value: promise, children: errorElement }); } if (status === 1 /* success */) { return /* @__PURE__ */ React.createElement(_chunk7OQROU2Djs.AwaitContext.Provider, { value: promise, children }); } throw promise; } }; function ResolveAwait({ children }) { let data = _chunk7OQROU2Djs.useAsyncValue.call(void 0, ); let toRender = typeof children === "function" ? children(data) : children; return /* @__PURE__ */ React.createElement(React.Fragment, null, toRender); } function createRoutesFromChildren(children, parentPath = []) { let routes = []; React.Children.forEach(children, (element, index) => { if (!React.isValidElement(element)) { return; } let treePath = [...parentPath, index]; if (element.type === React.Fragment) { routes.push.apply( routes, createRoutesFromChildren(element.props.children, treePath) ); return; } _chunk7OQROU2Djs.invariant.call(void 0, element.type === Route, `[${typeof element.type === "string" ? element.type : element.type.name}] is not a component. All component children of must be a or ` ); _chunk7OQROU2Djs.invariant.call(void 0, !element.props.index || !element.props.children, "An index route cannot have child routes." ); let route = { id: element.props.id || treePath.join("-"), caseSensitive: element.props.caseSensitive, element: element.props.element, Component: element.props.Component, index: element.props.index, path: element.props.path, loader: element.props.loader, action: element.props.action, hydrateFallbackElement: element.props.hydrateFallbackElement, HydrateFallback: element.props.HydrateFallback, errorElement: element.props.errorElement, ErrorBoundary: element.props.ErrorBoundary, hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null, shouldRevalidate: element.props.shouldRevalidate, handle: element.props.handle, lazy: element.props.lazy }; if (element.props.children) { route.children = createRoutesFromChildren( element.props.children, treePath ); } routes.push(route); }); return routes; } var createRoutesFromElements = createRoutesFromChildren; function renderMatches(matches) { return _chunk7OQROU2Djs._renderMatches.call(void 0, matches); } function useRouteComponentProps() { return { params: _chunk7OQROU2Djs.useParams.call(void 0, ), loaderData: _chunk7OQROU2Djs.useLoaderData.call(void 0, ), actionData: _chunk7OQROU2Djs.useActionData.call(void 0, ), matches: _chunk7OQROU2Djs.useMatches.call(void 0, ) }; } function WithComponentProps({ children }) { const props = useRouteComponentProps(); return React.cloneElement(children, props); } function withComponentProps(Component2) { return function WithComponentProps2() { const props = useRouteComponentProps(); return React.createElement(Component2, props); }; } function useHydrateFallbackProps() { return { params: _chunk7OQROU2Djs.useParams.call(void 0, ), loaderData: _chunk7OQROU2Djs.useLoaderData.call(void 0, ), actionData: _chunk7OQROU2Djs.useActionData.call(void 0, ) }; } function WithHydrateFallbackProps({ children }) { const props = useHydrateFallbackProps(); return React.cloneElement(children, props); } function withHydrateFallbackProps(HydrateFallback) { return function WithHydrateFallbackProps2() { const props = useHydrateFallbackProps(); return React.createElement(HydrateFallback, props); }; } function useErrorBoundaryProps() { return { params: _chunk7OQROU2Djs.useParams.call(void 0, ), loaderData: _chunk7OQROU2Djs.useLoaderData.call(void 0, ), actionData: _chunk7OQROU2Djs.useActionData.call(void 0, ), error: _chunk7OQROU2Djs.useRouteError.call(void 0, ) }; } function WithErrorBoundaryProps({ children }) { const props = useErrorBoundaryProps(); return React.cloneElement(children, props); } function withErrorBoundaryProps(ErrorBoundary) { return function WithErrorBoundaryProps2() { const props = useErrorBoundaryProps(); return React.createElement(ErrorBoundary, props); }; } // lib/dom/dom.ts var defaultMethod = "get"; var defaultEncType = "application/x-www-form-urlencoded"; function isHtmlElement(object) { return object != null && typeof object.tagName === "string"; } function isButtonElement(object) { return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; } function isFormElement(object) { return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; } function isInputElement(object) { return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; } function isModifiedEvent(event) { return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); } function shouldProcessLinkClick(event, target) { return event.button === 0 && // Ignore everything but left clicks (!target || target === "_self") && // Let browser handle "target=_blank" etc. !isModifiedEvent(event); } function createSearchParams(init = "") { return new URLSearchParams( typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo2, key) => { let value = init[key]; return memo2.concat( Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]] ); }, []) ); } function getSearchParamsForLocation(locationSearch, defaultSearchParams) { let searchParams = createSearchParams(locationSearch); if (defaultSearchParams) { defaultSearchParams.forEach((_, key) => { if (!searchParams.has(key)) { defaultSearchParams.getAll(key).forEach((value) => { searchParams.append(key, value); }); } }); } return searchParams; } var _formDataSupportsSubmitter = null; function isFormDataSubmitterSupported() { if (_formDataSupportsSubmitter === null) { try { new FormData( document.createElement("form"), // @ts-expect-error if FormData supports the submitter parameter, this will throw 0 ); _formDataSupportsSubmitter = false; } catch (e) { _formDataSupportsSubmitter = true; } } return _formDataSupportsSubmitter; } var supportedFormEncTypes = /* @__PURE__ */ new Set([ "application/x-www-form-urlencoded", "multipart/form-data", "text/plain" ]); function getFormEncType(encType) { if (encType != null && !supportedFormEncTypes.has(encType)) { _chunk7OQROU2Djs.warning.call(void 0, false, `"${encType}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${defaultEncType}"` ); return null; } return encType; } function getFormSubmissionInfo(target, basename) { let method; let action; let encType; let formData; let body; if (isFormElement(target)) { let attr = target.getAttribute("action"); action = attr ? _chunk7OQROU2Djs.stripBasename.call(void 0, attr, basename) : null; method = target.getAttribute("method") || defaultMethod; encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType; formData = new FormData(target); } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { let form = target.form; if (form == null) { throw new Error( `Cannot submit a