@attabot/complaint-app 1.0.2 → 1.0.4
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/README.md +159 -149
- package/dist/complaint-app.js +6130 -6129
- package/dist/complaint-app.js.map +1 -1
- package/dist/complaint-app.umd.js +12 -12
- package/dist/complaint-app.umd.js.map +1 -1
- package/dist/index.d.ts +214 -211
- package/dist/style.css +1 -1
- package/package.json +65 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complaint-app.js","sources":["../node_modules/@remix-run/router/dist/router.js","../node_modules/react-router/dist/index.js","../node_modules/react-router-dom/dist/index.js","../node_modules/axios/lib/helpers/bind.js","../node_modules/axios/lib/utils.js","../node_modules/axios/lib/helpers/parseHeaders.js","../node_modules/axios/lib/helpers/sanitizeHeaderValue.js","../node_modules/axios/lib/core/AxiosHeaders.js","../node_modules/axios/lib/core/AxiosError.js","../node_modules/axios/lib/helpers/null.js","../node_modules/axios/lib/helpers/toFormData.js","../node_modules/axios/lib/helpers/AxiosURLSearchParams.js","../node_modules/axios/lib/helpers/buildURL.js","../node_modules/axios/lib/core/InterceptorManager.js","../node_modules/axios/lib/defaults/transitional.js","../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js","../node_modules/axios/lib/platform/browser/classes/FormData.js","../node_modules/axios/lib/platform/browser/classes/Blob.js","../node_modules/axios/lib/platform/browser/index.js","../node_modules/axios/lib/platform/common/utils.js","../node_modules/axios/lib/platform/index.js","../node_modules/axios/lib/helpers/toURLEncodedForm.js","../node_modules/axios/lib/helpers/formDataToJSON.js","../node_modules/axios/lib/defaults/index.js","../node_modules/axios/lib/core/transformData.js","../node_modules/axios/lib/cancel/isCancel.js","../node_modules/axios/lib/cancel/CanceledError.js","../node_modules/axios/lib/core/settle.js","../node_modules/axios/lib/helpers/parseProtocol.js","../node_modules/axios/lib/helpers/speedometer.js","../node_modules/axios/lib/helpers/throttle.js","../node_modules/axios/lib/helpers/progressEventReducer.js","../node_modules/axios/lib/helpers/isURLSameOrigin.js","../node_modules/axios/lib/helpers/cookies.js","../node_modules/axios/lib/helpers/isAbsoluteURL.js","../node_modules/axios/lib/helpers/combineURLs.js","../node_modules/axios/lib/core/buildFullPath.js","../node_modules/axios/lib/core/mergeConfig.js","../node_modules/axios/lib/core/setFormDataHeaders.js","../node_modules/axios/lib/helpers/resolveConfig.js","../node_modules/axios/lib/adapters/xhr.js","../node_modules/axios/lib/helpers/composeSignals.js","../node_modules/axios/lib/helpers/trackStream.js","../node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js","../node_modules/axios/lib/env/data.js","../node_modules/axios/lib/adapters/fetch.js","../node_modules/axios/lib/adapters/adapters.js","../node_modules/axios/lib/core/dispatchRequest.js","../node_modules/axios/lib/helpers/validator.js","../node_modules/axios/lib/core/Axios.js","../node_modules/axios/lib/cancel/CancelToken.js","../node_modules/axios/lib/helpers/spread.js","../node_modules/axios/lib/helpers/isAxiosError.js","../node_modules/axios/lib/helpers/HttpStatusCode.js","../node_modules/axios/lib/axios.js","../node_modules/axios/index.js","../node_modules/js-cookie/dist/js.cookie.mjs","../src/utils/api.js","../src/context/ApiContext.jsx","../src/theme/defaultTheme.js","../src/theme/resolveTheme.js","../src/context/ThemeContext.jsx","../src/redux/complaint/actions.js","../src/redux/complaint/reducers.js","../src/redux/reducers.js","../src/redux/store.js","../src/components/atoms/Button.jsx","../src/components/atoms/PlusIcon.jsx","../src/components/atoms/Typography.jsx","../src/components/organisms/PageHeader.jsx","../src/components/atoms/StatusBadge.jsx","../src/components/molecules/CardHeader.jsx","../src/components/atoms/ChevronRightIcon.jsx","../src/components/molecules/CardFooter.jsx","../src/components/molecules/DataPoint.jsx","../src/components/atoms/Divider.jsx","../src/components/organisms/SystemCard.jsx","../src/components/organisms/SystemCardGrid.jsx","../src/components/atoms/Input.jsx","../src/components/atoms/SearchIcon.jsx","../src/components/molecules/SearchBar.jsx","../src/components/atoms/Loading.jsx","../src/data/demoSystems.js","../src/pages/ComplaintManagementPage.jsx","../src/components/organisms/Stepper.jsx","../src/context/SettingsWizardContext.jsx","../src/data/settingsSteps.js","../src/components/atoms/LayersIcon.jsx","../src/components/molecules/SettingsCardHeader.jsx","../src/components/organisms/SettingsCard.jsx","../src/components/atoms/FieldLabel.jsx","../src/components/atoms/ChevronDownIcon.jsx","../src/components/atoms/Select.jsx","../src/components/atoms/Textarea.jsx","../src/components/molecules/FormField.jsx","../src/components/atoms/Toggle.jsx","../src/components/molecules/ToggleField.jsx","../src/components/atoms/CloseIcon.jsx","../src/components/atoms/Tag.jsx","../src/components/molecules/RoleMultiSelect.jsx","../src/components/organisms/settings-steps/CategoryTypeStep.jsx","../src/components/organisms/settings-steps/DepartmentsStep.jsx","../src/components/atoms/Chip.jsx","../src/components/atoms/Radio.jsx","../src/components/atoms/DragHandleIcon.jsx","../src/components/organisms/settings-steps/PrioritiesStep.jsx","../src/components/organisms/settings-steps/WorkflowStep.jsx","../src/components/atoms/TrashIcon.jsx","../src/components/organisms/settings-steps/FormFieldsStep.jsx","../src/components/organisms/settings-steps/ReviewPublishStep.jsx","../src/pages/ComplaintSettingsPage.jsx","../src/router/index.jsx","../src/App.jsx","../src/ComplaintApp.jsx","../src/theme/tokens.js"],"sourcesContent":["/**\n * @remix-run/router v1.23.3\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route (<Route path=\"*\">) since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n // Treating this as a full URL will strip any trailing spaces so we need to\n // pre-encode them since they might be part of a matching splat param from\n // an ancestor route\n href = href.replace(/ $/, \"%20\");\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, String(index)];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/v6/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n return matchRoutesImpl(routes, locationArg, basename, false);\n}\nfunction matchRoutesImpl(routes, locationArg, basename, allowPartial) {\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n let decoded = decodePath(pathname);\n for (let i = 0; matches == null && i < branches.length; ++i) {\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n matches = matchRouteBranch(branches[i], decoded, allowPartial);\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname, allowPartial) {\n if (allowPartial === void 0) {\n allowPartial = false;\n }\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n let route = meta.route;\n if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {\n match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end: false\n }, remainingPathname);\n }\n if (!match) {\n return null;\n }\n Object.assign(matchedParams, match.params);\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/v6/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:([\\w-]+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/v6/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = (value || \"\").replace(/%2F/g, \"/\");\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:([\\w-]+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction decodePath(value) {\n try {\n return value.split(\"/\").map(v => decodeURIComponent(v).replace(/\\//g, \"%2F\")).join(\"/\");\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\nconst ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst isAbsoluteUrl = url => ABSOLUTE_URL_REGEX$1.test(url);\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/v6/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname;\n if (toPathname) {\n if (isAbsoluteUrl(toPathname)) {\n pathname = toPathname;\n } else {\n if (toPathname.includes(\"//\")) {\n let oldPathname = toPathname;\n toPathname = removeDoubleSlashes(toPathname);\n warning(false, \"Pathnames cannot have embedded double slashes - normalizing \" + (oldPathname + \" -> \" + toPathname));\n }\n if (toPathname.startsWith(\"/\")) {\n pathname = resolvePathname(toPathname.substring(1), \"/\");\n } else {\n pathname = resolvePathname(toPathname, fromPathname);\n }\n }\n } else {\n pathname = fromPathname;\n }\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in <Link to=\\\"...\\\"> and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\" element={<Link to=\"..\"}>\n * </Route>\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\">\n * <Route element={<AccountsLayout />}> // <-- Does not contribute\n * <Route index element={<Link to=\"..\"} /> // <-- Does not contribute\n * </Route\n * </Route>\n * </Route>\n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n// Return the array of pathnames for the current route matches - used to\n// generate the routePathnames input for resolveTo()\nfunction getResolveToMatches(matches, v7_relativeSplatPath) {\n let pathMatches = getPathContributingMatches(matches);\n // When v7_relativeSplatPath is enabled, use the full pathname for the leaf\n // match so we include splat values for \".\" links. See:\n // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329\n if (v7_relativeSplatPath) {\n return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);\n }\n return pathMatches.map(match => match.pathnameBase);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `<Link to>` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how <a href> works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n if (!isPathRelative && toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\nconst removeDoubleSlashes = path => path.replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst joinPaths = paths => removeDoubleSlashes(paths.join(\"/\"));\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n *\n * @deprecated The `json` method is deprecated in favor of returning raw objects.\n * This method will be removed in v7.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass DataWithResponseInit {\n constructor(data, init) {\n this.type = \"DataWithResponseInit\";\n this.data = data;\n this.init = init || null;\n }\n}\n/**\n * Create \"responses\" that contain `status`/`headers` without forcing\n * serialization into an actual `Response` - used by Remix single fetch\n */\nfunction data(data, init) {\n return new DataWithResponseInit(data, typeof init === \"number\" ? {\n status: init\n } : init);\n}\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\n/**\n * @deprecated The `defer` method is deprecated in favor of returning raw\n * objects. This method will be removed in v7.\n */\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * A redirect response that will perform a `history.replaceState` instead of a\n * `history.pushState` for client-side navigation redirects.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst replace = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Replace\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n let dataStrategyImpl = init.dataStrategy || defaultDataStrategy;\n let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation;\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_partialHydration: false,\n v7_prependBasename: false,\n v7_relativeSplatPath: false,\n v7_skipActionErrorRevalidation: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from <ScrollRestoration /> until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialMatchesIsFOW = false;\n let initialErrors = null;\n if (initialMatches == null && !patchRoutesOnNavigationImpl) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n // In SPA apps, if the user provided a patchRoutesOnNavigation implementation and\n // our initial match is a splat route, clear them out so we run through lazy\n // discovery on hydration in case there's a more accurate lazy route match.\n // In SSR apps (with `hydrationData`), we expect that the server will send\n // up the proper matched routes so we don't want to run lazy discovery on\n // initial hydration and want to hydrate into the splat route.\n if (initialMatches && !init.hydrationData) {\n let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active) {\n initialMatches = null;\n }\n }\n let initialized;\n if (!initialMatches) {\n initialized = false;\n initialMatches = [];\n // If partial hydration and fog of war is enabled, we will be running\n // `patchRoutesOnNavigation` during hydration so include any partial matches as\n // the initial matches so we can properly render `HydrateFallback`'s\n if (future.v7_partialHydration) {\n let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n initialMatchesIsFOW = true;\n initialMatches = fogOfWar.matches;\n }\n }\n } else if (initialMatches.some(m => m.route.lazy)) {\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n initialized = false;\n } else if (!initialMatches.some(m => m.route.loader)) {\n // If we've got no loaders to run, then we're good to go\n initialized = true;\n } else if (future.v7_partialHydration) {\n // If partial hydration is enabled, we're initialized so long as we were\n // provided with hydrationData for every route with a loader, and no loaders\n // were marked for explicit hydration\n let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n let errors = init.hydrationData ? init.hydrationData.errors : null;\n // If errors exist, don't consider routes below the boundary\n if (errors) {\n let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);\n initialized = initialMatches.slice(0, idx + 1).every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n } else {\n initialized = initialMatches.every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n }\n } else {\n // Without partial hydration - we're initialized if we were provided any\n // hydrationData - which is expected to be complete\n initialized = init.hydrationData != null;\n }\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = new Set();\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let unblockBlockerHistoryUpdate = undefined;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (unblockBlockerHistoryUpdate) {\n unblockBlockerHistoryUpdate();\n unblockBlockerHistoryUpdate = undefined;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n let nextHistoryUpdatePromise = new Promise(resolve => {\n unblockBlockerHistoryUpdate = resolve;\n });\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked, after the url\n // restoration is also complete. See:\n // https://github.com/remix-run/react-router/issues/11613\n nextHistoryUpdatePromise.then(() => init.history.go(delta));\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location, {\n initialHydration: true\n });\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Remove any lingering deleted fetchers that have already been removed\n // from state.fetchers\n deletedFetchers.forEach(key => {\n if (!state.fetchers.has(key) && !fetchControllers.has(key)) {\n deletedFetchersKeys.push(key);\n }\n });\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n viewTransitionOpts: opts.viewTransitionOpts,\n flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n } else {\n // We already called deleteFetcher() on these, can remove them from this\n // Set now that we've handed the keys off to the data layer\n deletedFetchersKeys.forEach(key => deletedFetchers.delete(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n // Commit any in-flight routes at the end of the HMR revalidation \"navigation\"\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation,\n // Proxy through any rending view transition\n enableViewTransition: pendingViewTransitionEnabled === true\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ?\n // `matchRoutes()` has already been called if we're in here via `router.initialize()`\n state.matches : matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial hydration will always\n // be \"same hash\". For example, on /page#hash and submit a <Form method=\"post\">\n // which will default to a navigation to /page\n if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n }, {\n flushSync\n });\n return;\n }\n let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionResult;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingActionResult = [findNearestBoundary(matches).route.id, {\n type: ResultType.error,\n error: opts.pendingError\n }];\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, {\n replace: opts.replace,\n flushSync\n });\n if (actionResult.shortCircuited) {\n return;\n }\n // If we received a 404 from handleAction, it's because we couldn't lazily\n // discover the destination route so we don't want to call loaders\n if (actionResult.pendingActionResult) {\n let [routeId, result] = actionResult.pendingActionResult;\n if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n pendingNavigationController = null;\n completeNavigation(location, {\n matches: actionResult.matches,\n loaderData: {},\n errors: {\n [routeId]: result.error\n }\n });\n return;\n }\n }\n matches = actionResult.matches || matches;\n pendingActionResult = actionResult.pendingActionResult;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = false;\n // No need to do fog of war matching again on loader execution\n fogOfWar.active = false;\n // Create a GET request for the loaders\n request = createClientSideRequest(init.history, request.url, request.signal);\n }\n // Call loaders\n let {\n shortCircuited,\n matches: updatedMatches,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches: updatedMatches || matches\n }, getActionDataForCommit(pendingActionResult), {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, isFogOfWar, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n }, {\n flushSync: opts.flushSync === true\n });\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n pendingActionResult: [boundaryId, {\n type: ResultType.error,\n error: discoverResult.error\n }]\n };\n } else if (!discoverResult.matches) {\n let {\n notFoundMatches,\n error,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n pendingActionResult: [route.id, {\n type: ResultType.error,\n error\n }]\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n let results = await callDataStrategy(\"action\", state, request, [actionMatch], matches, null);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n let location = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename, init.history);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, true, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions to the current location are REPLACE\n // navigations, but if the action threw an error that'll be rendered in\n // an errorElement, we fall back to PUSH so that the user can use the\n // back button to get back to the pre-submission form location to try\n // again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n matches,\n pendingActionResult: [boundaryMatch.route.id, result]\n };\n }\n return {\n matches,\n pendingActionResult: [actionMatch.route.id, result]\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n // If we have partialHydration enabled, then don't update the state for the\n // initial data load since it's not a \"navigation\"\n let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration);\n // When fog of war is enabled, we enter our `loading` state earlier so we\n // can discover new routes during the `loading` state. We skip this if\n // we've already run actions since we would have done our matching already.\n // If the children() function threw then, we want to proceed with the\n // partial matches it discovered.\n if (isFogOfWar) {\n if (shouldUpdateNavigationState) {\n let actionData = getUpdatedActionData(pendingActionResult);\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData !== undefined ? {\n actionData\n } : {}), {\n flushSync\n });\n }\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n loaderData: {},\n errors: {\n [boundaryId]: discoverResult.error\n }\n };\n } else if (!discoverResult.matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null\n }, getActionDataForCommit(pendingActionResult), updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n return {\n shortCircuited: true\n };\n }\n if (shouldUpdateNavigationState) {\n let updates = {};\n if (!isFogOfWar) {\n // Only update navigation/actionNData if we didn't already do it above\n updates.navigation = loadingNavigation;\n let actionData = getUpdatedActionData(pendingActionResult);\n if (actionData !== undefined) {\n updates.actionData = actionData;\n }\n }\n if (revalidatingFetchers.length > 0) {\n updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n }\n updateState(updates, {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n abortFetcher(rf.key);\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n // Preserve SSR errors during partial hydration\n if (future.v7_partialHydration && initialHydration && state.errors) {\n errors = _extends({}, state.errors, errors);\n }\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n matches,\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getUpdatedActionData(pendingActionResult) {\n if (pendingActionResult && !isErrorResult(pendingActionResult[1])) {\n // This is cast to `any` currently because `RouteData`uses any and it\n // would be a breaking change to use any.\n // TODO: v7 - change `RouteData` to use `unknown` instead of `any`\n return {\n [pendingActionResult[0]]: pendingActionResult[1].data\n };\n } else if (state.actionData) {\n if (Object.keys(state.actionData).length === 0) {\n return null;\n } else {\n return state.actionData;\n }\n }\n }\n function getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n return new Map(state.fetchers);\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n abortFetcher(key);\n let flushSync = (opts && opts.flushSync) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }), {\n flushSync\n });\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n let match = getTargetMatch(matches, path);\n let preventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n function detectAndHandle405Error(m) {\n if (!m.route.action && !m.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return true;\n }\n return false;\n }\n if (!isFogOfWar && detectAndHandle405Error(match)) {\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n requestMatches = discoverResult.matches;\n match = getTargetMatch(requestMatches, path);\n if (detectAndHandle405Error(match)) {\n return;\n }\n }\n }\n // Call the action for the fetcher\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResults = await callDataStrategy(\"action\", state, fetchRequest, [match], requestMatches, key);\n let actionResult = actionResults[match.route.id];\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n // When using v7_fetcherPersist, we don't want errors bubbling up to the UI\n // or redirects processed for unmounted fetchers so we just revert them to\n // idle\n if (future.v7_fetcherPersist && deletedFetchers.has(key)) {\n if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // Let SuccessResult's fall through for revalidation\n } else {\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n updateFetcherState(key, getLoadingFetcher(submission));\n return startRedirectNavigation(fetchRequest, actionResult, false, {\n fetcherSubmission: submission,\n preventScrollReset\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n abortFetcher(staleKey);\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n fetchers: new Map(state.fetchers)\n });\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n matches = discoverResult.matches;\n match = getTargetMatch(matches, path);\n }\n }\n // Call the loader for this fetcher route match\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let results = await callDataStrategy(\"loader\", state, fetchRequest, [match], matches, key);\n let result = results[match.route.id];\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // We don't want errors bubbling up or redirects followed for unmounted\n // fetchers, so short circuit here if it was removed from the UI\n if (deletedFetchers.has(key)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(fetchRequest, result, false, {\n preventScrollReset\n });\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n setFetcherError(key, routeId, result.error);\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n updateFetcherState(key, getDoneFetcher(result.data));\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(request, redirect, isNavigation, _temp2) {\n let {\n submission,\n fetcherSubmission,\n preventScrollReset,\n replace\n } = _temp2 === void 0 ? {} : _temp2;\n if (redirect.response.headers.has(\"X-Remix-Revalidate\")) {\n isRevalidationRequired = true;\n }\n let location = redirect.response.headers.get(\"Location\");\n invariant(location, \"Expected a Location header on the redirect Response\");\n location = normalizeRedirectLocation(location, new URL(request.url), basename, init.history);\n let redirectLocation = createLocation(state.location, location, {\n _isRedirect: true\n });\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.response.headers.has(\"X-Remix-Reload-Document\")) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(location)) {\n const url = init.history.createURL(location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(location);\n } else {\n routerWindow.location.assign(location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType\n } = state.navigation;\n if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {\n submission = getSubmissionFromNavigation(state.navigation);\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n let activeSubmission = submission || fetcherSubmission;\n if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: location\n }),\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n } else {\n // If we have a navigation submission, we will preserve it through the\n // redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, submission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Send fetcher submissions through for shouldRevalidate\n fetcherSubmission,\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n }\n }\n // Utility wrapper for calling dataStrategy client-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, state, request, matchesToLoad, matches, fetcherKey) {\n let results;\n let dataResults = {};\n try {\n results = await callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties);\n } catch (e) {\n // If the outer dataStrategy method throws, just return the error for all\n // matches - and it'll naturally bubble to the root\n matchesToLoad.forEach(m => {\n dataResults[m.route.id] = {\n type: ResultType.error,\n error: e\n };\n });\n return dataResults;\n }\n for (let [routeId, result] of Object.entries(results)) {\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n dataResults[routeId] = {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath)\n };\n } else {\n dataResults[routeId] = await convertDataStrategyResultToDataResult(result);\n }\n }\n return dataResults;\n }\n async function callLoadersAndMaybeResolveData(state, matches, matchesToLoad, fetchersToLoad, request) {\n let currentMatches = state.matches;\n // Kick off loaders and fetchers in parallel\n let loaderResultsPromise = callDataStrategy(\"loader\", state, request, matchesToLoad, matches, null);\n let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async f => {\n if (f.matches && f.match && f.controller) {\n let results = await callDataStrategy(\"loader\", state, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key);\n let result = results[f.match.route.id];\n // Fetcher results are keyed by fetcher key from here on out, not routeId\n return {\n [f.key]: result\n };\n } else {\n return Promise.resolve({\n [f.key]: {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n }\n });\n }\n }));\n let loaderResults = await loaderResultsPromise;\n let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {});\n await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]);\n return {\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.add(key);\n }\n abortFetcher(key);\n });\n }\n function updateFetcherState(key, fetcher, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function setFetcherError(key, routeId, error, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function getFetcher(key) {\n activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n // If this fetcher was previously marked for deletion, unmark it since we\n // have a new instance\n if (deletedFetchers.has(key)) {\n deletedFetchers.delete(key);\n }\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n // If we opted into the flag we can clear this now since we're calling\n // deleteFetcher() at the end of updateState() and we've already handed the\n // deleted fetcher keys off to the data layer.\n // If not, we're eagerly calling deleteFetcher() and we need to keep this\n // Set populated until the next updateState call, and we'll clear\n // `deletedFetchers` then\n if (future.v7_fetcherPersist) {\n deletedFetchers.delete(key);\n }\n cancelledFetcherLoads.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n if (!future.v7_fetcherPersist) {\n deleteFetcher(key);\n }\n } else {\n activeFetchers.set(key, count);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n if (controller) {\n controller.abort();\n fetchControllers.delete(key);\n }\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function handleNavigational404(pathname) {\n let error = getInternalRouterError(404, {\n pathname\n });\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let {\n matches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n return {\n notFoundMatches: matches,\n route,\n error\n };\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the <ScrollRestoration> component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered <ScrollRestoration/>\n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function checkFogOfWar(matches, routesToUse, pathname) {\n if (patchRoutesOnNavigationImpl) {\n if (!matches) {\n let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: fogMatches || []\n };\n } else {\n if (Object.keys(matches[0].params).length > 0) {\n // If we matched a dynamic param or a splat, it might only be because\n // we haven't yet discovered other routes that would match with a\n // higher score. Call patchRoutesOnNavigation just to be sure\n let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: partialMatches\n };\n }\n }\n }\n return {\n active: false,\n matches: null\n };\n }\n async function discoverRoutes(matches, pathname, signal, fetcherKey) {\n if (!patchRoutesOnNavigationImpl) {\n return {\n type: \"success\",\n matches\n };\n }\n let partialMatches = matches;\n while (true) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let localManifest = manifest;\n try {\n await patchRoutesOnNavigationImpl({\n signal,\n path: pathname,\n matches: partialMatches,\n fetcherKey,\n patch: (routeId, children) => {\n if (signal.aborted) return;\n patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);\n }\n });\n } catch (e) {\n return {\n type: \"error\",\n error: e,\n partialMatches\n };\n } finally {\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity so when we `updateState` at the end of\n // this navigation/fetch `router.routes` will be a new identity and\n // trigger a re-run of memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR && !signal.aborted) {\n dataRoutes = [...dataRoutes];\n }\n }\n if (signal.aborted) {\n return {\n type: \"aborted\"\n };\n }\n let newMatches = matchRoutes(routesToUse, pathname, basename);\n if (newMatches) {\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n // Avoid loops if the second pass results in the same partial matches\n if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) {\n return {\n type: \"success\",\n matches: null\n };\n }\n partialMatches = newPartialMatches;\n }\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n function patchRoutes(routeId, children) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties);\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity and trigger a reflow via `updateState`\n // to re-run memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR) {\n dataRoutes = [...dataRoutes];\n updateState({});\n }\n }\n router = {\n get basename() {\n return basename;\n },\n get future() {\n return future;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n get window() {\n return routerWindow;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher: deleteFetcherAndUpdateState,\n dispose,\n getBlocker,\n deleteBlocker,\n patchRoutes,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Config driven behavior flags\n let future = _extends({\n v7_relativeSplatPath: false,\n v7_throwAbortReason: false\n }, opts ? opts.future : null);\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n *\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n * the bubbling of errors which allows single-fetch-type implementations\n * where the client will handle the bubbling and we may need to return data\n * for the handling route\n */\n async function query(request, _temp3) {\n let {\n requestContext,\n skipLoaderErrorBubbling,\n dataStrategy\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n *\n * - `opts.routeId` allows you to specify the specific route handler to call.\n * If not provided the handler will determine the proper route by matching\n * against `request.url`\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n */\n async function queryRoute(request, _temp4) {\n let {\n routeId,\n requestContext,\n dataStrategy\n } = _temp4 === void 0 ? {} : _temp4;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction for a\n // `queryRoute` call, we throw the `DataStrategyResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isDataStrategyResult(e) && isResponse(e.result)) {\n if (e.type === ResultType.error) {\n throw e.result;\n }\n return e.result;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n let results = await callDataStrategy(\"action\", request, [actionMatch], matches, isRouteRequest, requestContext, dataStrategy);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.response.status,\n headers: {\n Location: result.response.headers.get(\"Location\")\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null);\n return _extends({}, context, {\n actionData: {\n [actionMatch.route.id]: result.data\n }\n }, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionHeaders: result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {}\n });\n }\n async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await callDataStrategy(\"loader\", request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy);\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n // Utility wrapper for calling dataStrategy server-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) {\n let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, type, null, request, matchesToLoad, matches, null, manifest, mapRouteProperties, requestContext);\n let dataResults = {};\n await Promise.all(matches.map(async match => {\n if (!(match.route.id in results)) {\n return;\n }\n let result = results[match.route.id];\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename, future.v7_relativeSplatPath);\n }\n if (isResponse(result.result) && isRouteRequest) {\n // For SSR single-route requests, we want to hand Responses back\n // directly without unwrapping\n throw result;\n }\n dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);\n }));\n return dataResults;\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: isRouteErrorResponse(error) ? error.status : 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest, future) {\n if (future.v7_throwAbortReason && request.signal.reason !== undefined) {\n throw request.signal.reason;\n }\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId) {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Account for `?index` params when routing to the current location\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch) {\n let nakedIndex = hasNakedIndexQuery(path.search);\n if (activeRouteMatch.route.index && !nakedIndex) {\n // Add one when we're targeting an index route\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n } else if (!activeRouteMatch.route.index && nakedIndex) {\n // Remove existing ones when we're not\n let params = new URLSearchParams(path.search);\n let indexValues = params.getAll(\"index\");\n params.delete(\"index\");\n indexValues.filter(v => v).forEach(v => params.append(\"index\", v));\n let qs = params.toString();\n path.search = qs ? \"?\" + qs : \"\";\n }\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref3) => {\n let [name, value] = _ref3;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes at/below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) {\n if (includeBoundary === void 0) {\n includeBoundary = false;\n }\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n return matches.slice(0, includeBoundary ? index + 1 : index);\n }\n return matches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {\n let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryMatches = matches;\n if (initialHydration && state.errors) {\n // On initial hydration, only consider matches up to _and including_ the boundary.\n // This is inclusive to handle cases where a server loader ran successfully,\n // a child server loader bubbled up to this route, but this route has\n // `clientLoader.hydrate` so we want to still run the `clientLoader` so that\n // we have a complete version of `loaderData`\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true);\n } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {\n // If an action threw an error, we call loaders up to, but not including the\n // boundary\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]);\n }\n // Don't revalidate loaders by default after action 4xx/5xx responses\n // when the flag is enabled. They can still opt-into revalidation via\n // `shouldRevalidate` via `actionResult`\n let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined;\n let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400;\n let navigationMatches = boundaryMatches.filter((match, index) => {\n let {\n route\n } = match;\n if (route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (route.loader == null) {\n return false;\n }\n if (initialHydration) {\n return shouldLoadRouteOnHydration(route, state.loaderData, state.errors);\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false :\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate:\n // - on initial hydration (shouldn't be any fetchers then anyway)\n // - if fetcher won't be present in the subsequent render\n // - no longer matches the URL (v7_fetcherPersist=false)\n // - was unmounted but persisted due to v7_fetcherPersist=true\n if (initialHydration || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.has(key)) {\n // Always mark for revalidation if the fetcher was cancelled\n cancelledFetcherLoads.delete(key);\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction shouldLoadRouteOnHydration(route, loaderData, errors) {\n // We dunno if we have a loader - gotta find out!\n if (route.lazy) {\n return true;\n }\n // No loader, nothing to initialize\n if (!route.loader) {\n return false;\n }\n let hasData = loaderData != null && loaderData[route.id] !== undefined;\n let hasError = errors != null && errors[route.id] !== undefined;\n // Don't run if we error'd during SSR\n if (!hasData && hasError) {\n return false;\n }\n // Explicitly opting-in to running on hydration\n if (typeof route.loader === \"function\" && route.loader.hydrate === true) {\n return true;\n }\n // Otherwise, run if we're not yet initialized with anything\n return !hasData && !hasError;\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\nfunction patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) {\n var _childrenToPatch;\n let childrenToPatch;\n if (routeId) {\n let route = manifest[routeId];\n invariant(route, \"No route found to patch children into: routeId = \" + routeId);\n if (!route.children) {\n route.children = [];\n }\n childrenToPatch = route.children;\n } else {\n childrenToPatch = routesToUse;\n }\n // Don't patch in routes we already know about so that `patch` is idempotent\n // to simplify user-land code. This is useful because we re-call the\n // `patchRoutesOnNavigation` function for matched routes with params.\n let uniqueChildren = children.filter(newRoute => !childrenToPatch.some(existingRoute => isSameRoute(newRoute, existingRoute)));\n let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [routeId || \"_\", \"patch\", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || \"0\")], manifest);\n childrenToPatch.push(...newRoutes);\n}\nfunction isSameRoute(newRoute, existingRoute) {\n // Most optimal check is by id\n if (\"id\" in newRoute && \"id\" in existingRoute && newRoute.id === existingRoute.id) {\n return true;\n }\n // Second is by pathing differences\n if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) {\n return false;\n }\n // Pathless layout routes are trickier since we need to check children.\n // If they have no children then they're the same as far as we can tell\n if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) {\n return true;\n }\n // Otherwise, we look to see if every child in the new route is already\n // represented in the existing route's children\n return newRoute.children.every((aChild, i) => {\n var _existingRoute$childr;\n return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some(bChild => isSameRoute(aChild, bChild));\n });\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\n// Default implementation of `dataStrategy` which fetches all loaders in parallel\nasync function defaultDataStrategy(_ref4) {\n let {\n matches\n } = _ref4;\n let matchesToLoad = matches.filter(m => m.shouldLoad);\n let results = await Promise.all(matchesToLoad.map(m => m.resolve()));\n return results.reduce((acc, result, i) => Object.assign(acc, {\n [matchesToLoad[i].route.id]: result\n }), {});\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties, requestContext) {\n let loadRouteDefinitionsPromises = matches.map(m => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties, manifest) : undefined);\n let dsMatches = matches.map((match, i) => {\n let loadRoutePromise = loadRouteDefinitionsPromises[i];\n let shouldLoad = matchesToLoad.some(m => m.route.id === match.route.id);\n // `resolve` encapsulates route.lazy(), executing the loader/action,\n // and mapping return values/thrown errors to a `DataStrategyResult`. Users\n // can pass a callback to take fine-grained control over the execution\n // of the loader/action\n let resolve = async handlerOverride => {\n if (handlerOverride && request.method === \"GET\" && (match.route.lazy || match.route.loader)) {\n shouldLoad = true;\n }\n return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n });\n // Send all matches here to allow for a middleware-type implementation.\n // handler will be a no-op for unneeded routes and we filter those results\n // back out below.\n let results = await dataStrategyImpl({\n matches: dsMatches,\n request,\n params: matches[0].params,\n fetcherKey,\n context: requestContext\n });\n // Wait for all routes to load here but 'swallow the error since we want\n // it to bubble up from the `await loadRoutePromise` in `callLoaderOrAction` -\n // called from `match.resolve()`\n try {\n await Promise.all(loadRouteDefinitionsPromises);\n } catch (e) {\n // No-op\n }\n return results;\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) {\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n // This will never resolve so safe to type it as Promise<DataStrategyResult> to\n // satisfy the function return value\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n let actualHandler = ctx => {\n if (typeof handler !== \"function\") {\n return Promise.reject(new Error(\"You cannot call the handler for a route which defines a boolean \" + (\"\\\"\" + type + \"\\\" [routeId: \" + match.route.id + \"]\")));\n }\n return handler({\n request,\n params: match.params,\n context: staticContext\n }, ...(ctx !== undefined ? [ctx] : []));\n };\n let handlerPromise = (async () => {\n try {\n let val = await (handlerOverride ? handlerOverride(ctx => actualHandler(ctx)) : actualHandler());\n return {\n type: \"data\",\n result: val\n };\n } catch (e) {\n return {\n type: \"error\",\n result: e\n };\n }\n })();\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n // If we have a route.lazy promise, await that first\n if (loadRoutePromise) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let handlerError;\n let [value] = await Promise.all([\n // If the handler throws, don't let it immediately bubble out,\n // since we need to let the lazy() execution finish so we know if this\n // route has a boundary that can handle the error\n runHandler(handler).catch(e => {\n handlerError = e;\n }), loadRoutePromise]);\n if (handlerError !== undefined) {\n throw handlerError;\n }\n result = value;\n } else {\n // Load lazy route module, then run any returned handler\n await loadRoutePromise;\n handler = match.route[type];\n if (handler) {\n // Handler still runs even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n result: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result.result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n // We should already be catching and converting normal handler executions to\n // DataStrategyResults and returning them, so anything that throws here is an\n // unexpected error we still need to wrap\n return {\n type: ResultType.error,\n result: e\n };\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n return result;\n}\nasync function convertDataStrategyResultToDataResult(dataStrategyResult) {\n let {\n result,\n type\n } = dataStrategyResult;\n if (isResponse(result)) {\n let data;\n try {\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n if (result.body == null) {\n data = null;\n } else {\n data = await result.json();\n }\n } else {\n data = await result.text();\n }\n } catch (e) {\n return {\n type: ResultType.error,\n error: e\n };\n }\n if (type === ResultType.error) {\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(result.status, result.statusText, data),\n statusCode: result.status,\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (type === ResultType.error) {\n if (isDataWithResponseInit(result)) {\n var _result$init3, _result$init4;\n if (result.data instanceof Error) {\n var _result$init, _result$init2;\n return {\n type: ResultType.error,\n error: result.data,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined\n };\n }\n // Convert thrown data() to ErrorResponse instances\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),\n statusCode: isRouteErrorResponse(result) ? result.status : undefined,\n headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : undefined\n };\n }\n if (isDeferredData(result)) {\n var _result$init5, _result$init6;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,\n headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)\n };\n }\n if (isDataWithResponseInit(result)) {\n var _result$init7, _result$init8;\n return {\n type: ResultType.data,\n data: result.data,\n statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,\n headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Support relative routing in internal redirects\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) {\n let location = response.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1);\n location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath);\n response.headers.set(\"Location\", location);\n }\n return response;\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {\n // Match Chrome's behavior:\n // https://github.com/chromium/chromium/blob/216dbeb61db0c667e62082e5f5400a32d6983df3/content/public/common/url_utils.cc#L82\n let invalidProtocols = [\"about:\", \"blob:\", \"chrome:\", \"chrome-untrusted:\", \"content:\", \"data:\", \"devtools:\", \"file:\", \"filesystem:\",\n // eslint-disable-next-line no-script-url\n \"javascript:\"];\n if (ABSOLUTE_URL_REGEX.test(location)) {\n // Strip off the protocol+origin for same-origin + same-basename absolute redirects\n let normalizedLocation = location;\n let url = normalizedLocation.startsWith(\"//\") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);\n if (invalidProtocols.includes(url.protocol)) {\n throw new Error(\"Invalid redirect location\");\n }\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return removeDoubleSlashes(url.pathname) + url.search + url.hash;\n }\n }\n try {\n let url = historyInstance.createURL(location);\n if (invalidProtocols.includes(url.protocol)) {\n throw new Error(\"Invalid redirect location\");\n }\n } catch (e) {}\n return location;\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined;\n // Process loader results into state.loaderData/state.errors\n matches.forEach(match => {\n if (!(match.route.id in results)) {\n return;\n }\n let id = match.route.id;\n let result = results[id];\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError !== undefined) {\n error = pendingError;\n pendingError = undefined;\n }\n errors = errors || {};\n if (skipLoaderErrorBubbling) {\n errors[id] = error;\n } else {\n // Look upwards from the matched route for the closest ancestor error\n // boundary, defaulting to the root match. Prefer higher error values\n // if lower errors bubble to the same boundary\n let boundaryMatch = findNearestBoundary(matches, id);\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n loaderData[id] = result.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError !== undefined && pendingActionResult) {\n errors = {\n [pendingActionResult[0]]: pendingError\n };\n loaderData[pendingActionResult[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, false // This method is only called client side so we always want to bubble\n );\n // Process results from our revalidating fetchers\n revalidatingFetchers.forEach(rf => {\n let {\n key,\n match,\n controller\n } = rf;\n let result = fetcherResults[key];\n invariant(result, \"Did not find corresponding fetcher result\");\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n return;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n });\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n if (!pendingActionResult) {\n return {};\n }\n return isErrorResult(pendingActionResult[1]) ? {\n // Clear out prior actionData on errors\n actionData: {}\n } : {\n actionData: {\n [pendingActionResult[0]]: pendingActionResult[1].data\n }\n };\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp5) {\n let {\n pathname,\n routeId,\n method,\n type,\n message\n } = _temp5 === void 0 ? {} : _temp5;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n let entries = Object.entries(results);\n for (let i = entries.length - 1; i >= 0; i--) {\n let [key, result] = entries[i];\n if (isRedirectResult(result)) {\n return {\n key,\n result\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDataStrategyResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectDataStrategyResultResult(result) {\n return isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDataWithResponseInit(value) {\n return typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) {\n let entries = Object.entries(results);\n for (let index = 0; index < entries.length; index++) {\n let [routeId, result] = entries[index];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && isRevalidatingLoader) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n await resolveDeferredData(result, signal, false).then(result => {\n if (result) {\n results[routeId] = result;\n }\n });\n }\n }\n}\nasync function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) {\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n routeId,\n controller\n } = revalidatingFetchers[index];\n let result = results[key];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n if (isDeferredResult(result)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n invariant(controller, \"Expected an AbortController for revalidating fetcher deferred result\");\n await resolveDeferredData(result, controller.signal, true).then(result => {\n if (result) {\n results[key] = result;\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n try {\n let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n if (sessionPositions) {\n let json = JSON.parse(sessionPositions);\n for (let [k, v] of Object.entries(json || {})) {\n if (v && Array.isArray(v)) {\n transitions.set(k, new Set(v || []));\n }\n }\n }\n } catch (e) {\n // no-op, use default empty object\n }\n}\nfunction persistAppliedTransitions(_window, transitions) {\n if (transitions.size > 0) {\n let json = {};\n for (let [k, v] of transitions) {\n json[k] = [...v];\n }\n try {\n _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n } catch (error) {\n warning(false, \"Failed to save applied view transitions in sessionStorage (\" + error + \").\");\n }\n }\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, data, defer, generatePath, getStaticContextFromError, getToPathname, isDataWithResponseInit, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.30.4\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_decodePath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\n\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level `<Router>` API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/v6/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a `<Router>`.\n *\n * @see https://reactrouter.com/v6/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/v6/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * `<NavLink>`.\n *\n * @see https://reactrouter.com/v6/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, UNSAFE_decodePath(pathname)), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by `<Link>`s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n future,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/v6/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by `<Outlet>` to render child routes.\n *\n * @see https://reactrouter.com/v6/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/v6/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/v6/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n future\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an `<Outlet>` to render their child route's\n * element.\n *\n * @see https://reactrouter.com/v6/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState, future) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different <Routes> under a <Route>\n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // <Routes>\n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // <Route path=\"blog\" element={<Blog />} />\n // <Route path=\"blog/feed\" element={<BlogFeed />} />\n // </Routes>\n //\n // function Blog() {\n // return (\n // <Routes>\n // <Route path=\"post/:id\" element={<Post />} />\n // </Routes>\n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant <Routes> (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under <Route path=\\\"\" + parentPath + \"\\\">) 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.\\n\\n\" + (\"Please change the parent <Route path=\\\"\" + parentPath + \"\\\"> to <Route \") + (\"path=\\\"\" + (parentPath === \"/\" ? \"*\" : parentPath + \"/*\") + \"\\\">.\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = pathname;\n if (parentPathnameBase !== \"/\") {\n // Determine the remaining pathname by removing the # of URL segments the\n // parentPathnameBase has, instead of removing based on character count.\n // This is because we can't guarantee that incoming/outgoing encodings/\n // decodings will match exactly.\n // We decode paths before matching on a per-segment basis with\n // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they\n // match what `window.location.pathname` would reflect. Those don't 100%\n // align when it comes to encoded URI characters such as % and &.\n //\n // So we may end up with:\n // pathname: \"/descendant/a%25b/match\"\n // parentPathnameBase: \"/descendant/a%b\"\n //\n // And the direct substring removal approach won't work :/\n let parentSegments = parentPathnameBase.replace(/^\\//, \"\").split(\"/\");\n let segments = pathname.replace(/^\\//, \"\").split(\"/\");\n remainingPathname = \"/\" + segments.slice(parentSegments.length).join(\"/\");\n }\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.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.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState, future);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error !== undefined ? props.error : state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState, future) {\n var _dataRouterState;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (future === void 0) {\n future = null;\n }\n if (matches == null) {\n var _future;\n if (!dataRouterState) {\n return null;\n }\n if (dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {\n // Don't bail if we're initializing with partial hydration and we have\n // router matches. That means we're actively running `patchRoutesOnNavigation`\n // so we should render down the partial matches to the appropriate\n // `HydrateFallback`. We only do this if `parentMatches` is empty so it\n // only impacts the root matches for `RouterProvider` and no descendant\n // `<Routes>`\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n // If we're in a partial hydration mode, detect if we need to render down to\n // a given HydrateFallback while we load the rest of the hydration data\n let renderFallback = false;\n let fallbackIndex = -1;\n if (dataRouterState && future && future.v7_partialHydration) {\n for (let i = 0; i < renderedMatches.length; i++) {\n let match = renderedMatches[i];\n // Track the deepest fallback up until the first route without data\n if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {\n fallbackIndex = i;\n }\n if (match.route.id) {\n let {\n loaderData,\n errors\n } = dataRouterState;\n let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);\n if (match.route.lazy || needsToRunLoader) {\n // We found the first route that's not ready to render (waiting on\n // lazy, or has a loader that hasn't run yet). Flag that we need to\n // render a fallback and render up until the appropriate fallback\n renderFallback = true;\n if (fallbackIndex >= 0) {\n renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n } else {\n renderedMatches = [renderedMatches[0]];\n }\n break;\n }\n }\n }\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n // Only data routers handle errors/fallbacks\n let error;\n let shouldRenderHydrateFallback = false;\n let errorElement = null;\n let hydrateFallbackElement = null;\n if (dataRouterState) {\n error = errors && match.route.id ? errors[match.route.id] : undefined;\n errorElement = match.route.errorElement || defaultErrorElement;\n if (renderFallback) {\n if (fallbackIndex < 0 && index === 0) {\n warningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = null;\n } else if (fallbackIndex === index) {\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = match.route.hydrateFallbackElement || null;\n }\n }\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (shouldRenderHydrateFallback) {\n children = hydrateFallbackElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `<Route Component={...}>` in `<Routes>` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n return state.actionData ? state.actionData[routeId] : undefined;\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error !== undefined) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor `<Await />` value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor `<Await />` value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned$1 = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned$1[key]) {\n alreadyWarned$1[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\nconst alreadyWarned = {};\nfunction warnOnce(key, message) {\n if (process.env.NODE_ENV !== \"production\" && !alreadyWarned[message]) {\n alreadyWarned[message] = true;\n console.warn(message);\n }\n}\nconst logDeprecation = (flag, msg, link) => warnOnce(flag, \"\\u26A0\\uFE0F React Router Future Flag Warning: \" + msg + \". \" + (\"You can use the `\" + flag + \"` future flag to opt-in early. \") + (\"For more information, see \" + link + \".\"));\nfunction logV6DeprecationWarnings(renderFuture, routerFuture) {\n if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === undefined) {\n logDeprecation(\"v7_startTransition\", \"React Router will begin wrapping state updates in `React.startTransition` in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_starttransition\");\n }\n if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === undefined && (!routerFuture || routerFuture.v7_relativeSplatPath === undefined)) {\n logDeprecation(\"v7_relativeSplatPath\", \"Relative route resolution within Splat routes is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath\");\n }\n if (routerFuture) {\n if (routerFuture.v7_fetcherPersist === undefined) {\n logDeprecation(\"v7_fetcherPersist\", \"The persistence behavior of fetchers is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist\");\n }\n if (routerFuture.v7_normalizeFormMethod === undefined) {\n logDeprecation(\"v7_normalizeFormMethod\", \"Casing of `formMethod` fields is being normalized to uppercase in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod\");\n }\n if (routerFuture.v7_partialHydration === undefined) {\n logDeprecation(\"v7_partialHydration\", \"`RouterProvider` hydration behavior is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_partialhydration\");\n }\n if (routerFuture.v7_skipActionErrorRevalidation === undefined) {\n logDeprecation(\"v7_skipActionErrorRevalidation\", \"The revalidation behavior after 4xx/5xx `action` responses is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation\");\n }\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n if (v7_startTransition && startTransitionImpl) {\n startTransitionImpl(() => setStateImpl(newState));\n } else {\n setStateImpl(newState);\n }\n }, [setStateImpl, v7_startTransition]);\n\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`<RouterProvider fallbackElement>` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n React.useEffect(() => logV6DeprecationWarnings(future, router.future), [router, future]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a <script> here\n // containing the hydrated server-side staticContext (from StaticRouterProvider).\n // useId relies on the component tree structure to generate deterministic id's\n // so we need to ensure it remains the same on the client even though\n // we don't need the <script> tag\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataRouterContext.Provider, {\n value: dataRouterContext\n }, /*#__PURE__*/React.createElement(DataRouterStateContext.Provider, {\n value: state\n }, /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n location: state.location,\n navigationType: state.historyAction,\n navigator: navigator,\n future: {\n v7_relativeSplatPath: router.future.v7_relativeSplatPath\n }\n }, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {\n routes: router.routes,\n future: router.future,\n state: state\n }) : fallbackElement))), null);\n}\nfunction DataRoutes(_ref2) {\n let {\n routes,\n future,\n state\n } = _ref2;\n return useRoutesImpl(routes, undefined, state, future);\n}\n/**\n * A `<Router>` that stores all entries in memory.\n *\n * @see https://reactrouter.com/v6/router-components/memory-router\n */\nfunction MemoryRouter(_ref3) {\n let {\n basename,\n children,\n initialEntries,\n initialIndex,\n future\n } = _ref3;\n let historyRef = React.useRef();\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({\n initialEntries,\n initialIndex,\n v5Compat: true\n });\n }\n let history = historyRef.current;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/v6/components/navigate\n */\nfunction Navigate(_ref4) {\n let {\n to,\n replace,\n state,\n relative\n } = _ref4;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n \"<Navigate> may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n future,\n static: isStatic\n } = React.useContext(NavigationContext);\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(!isStatic, \"<Navigate> must not be used on the initial render in a <StaticRouter>. \" + \"This is a no-op, but you should modify your code so the <Navigate> is \" + \"only ever rendered in response to some user interaction or state change.\") : void 0;\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let navigate = useNavigate();\n\n // Resolve the path outside of the effect so that when effects run twice in\n // StrictMode they navigate to the same place\n let path = resolveTo(to, UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === \"path\");\n let jsonPath = JSON.stringify(path);\n React.useEffect(() => navigate(JSON.parse(jsonPath), {\n replace,\n state,\n relative\n }), [navigate, jsonPath, relative, replace, state]);\n return null;\n}\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/v6/components/outlet\n */\nfunction Outlet(props) {\n return useOutlet(props.context);\n}\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/v6/components/route\n */\nfunction Route(_props) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"A <Route> is only ever to be used as the child of <Routes> element, \" + \"never rendered directly. Please wrap your <Route> in a <Routes>.\") : UNSAFE_invariant(false) ;\n}\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a `<Router>` directly. Instead, you'll render a\n * router that is more specific to your environment such as a `<BrowserRouter>`\n * in web browsers or a `<StaticRouter>` for server rendering.\n *\n * @see https://reactrouter.com/v6/router-components/router\n */\nfunction Router(_ref5) {\n let {\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = Action.Pop,\n navigator,\n static: staticProp = false,\n future\n } = _ref5;\n !!useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"You cannot render a <Router> inside another <Router>.\" + \" You should never have more than one in your app.\") : UNSAFE_invariant(false) : void 0;\n\n // Preserve trailing slashes on basename, so we can let the user control\n // the enforcement of trailing slashes throughout the app\n let basename = basenameProp.replace(/^\\/*/, \"/\");\n let navigationContext = React.useMemo(() => ({\n basename,\n navigator,\n static: staticProp,\n future: _extends({\n v7_relativeSplatPath: false\n }, future)\n }), [basename, future, navigator, staticProp]);\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\"\n } = locationProp;\n let locationContext = React.useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n if (trailingPathname == null) {\n return null;\n }\n return {\n location: {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key\n },\n navigationType\n };\n }, [basename, pathname, search, hash, state, key, navigationType]);\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(locationContext != null, \"<Router basename=\\\"\" + basename + \"\\\"> is not able to match the URL \" + (\"\\\"\" + pathname + search + hash + \"\\\" because it does not start with the \") + \"basename, so the <Router> won't render anything.\") : void 0;\n if (locationContext == null) {\n return null;\n }\n return /*#__PURE__*/React.createElement(NavigationContext.Provider, {\n value: navigationContext\n }, /*#__PURE__*/React.createElement(LocationContext.Provider, {\n children: children,\n value: locationContext\n }));\n}\n/**\n * A container for a nested tree of `<Route>` elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/v6/components/routes\n */\nfunction Routes(_ref6) {\n let {\n children,\n location\n } = _ref6;\n return useRoutes(createRoutesFromChildren(children), location);\n}\n/**\n * Component to use for rendering lazily loaded data from returning defer()\n * in a loader function\n */\nfunction Await(_ref7) {\n let {\n children,\n errorElement,\n resolve\n } = _ref7;\n return /*#__PURE__*/React.createElement(AwaitErrorBoundary, {\n resolve: resolve,\n errorElement: errorElement\n }, /*#__PURE__*/React.createElement(ResolveAwait, null, children));\n}\nvar AwaitRenderStatus = /*#__PURE__*/function (AwaitRenderStatus) {\n AwaitRenderStatus[AwaitRenderStatus[\"pending\"] = 0] = \"pending\";\n AwaitRenderStatus[AwaitRenderStatus[\"success\"] = 1] = \"success\";\n AwaitRenderStatus[AwaitRenderStatus[\"error\"] = 2] = \"error\";\n return AwaitRenderStatus;\n}(AwaitRenderStatus || {});\nconst neverSettledPromise = new Promise(() => {});\nclass AwaitErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n error: null\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"<Await> caught the following error during render\", error, errorInfo);\n }\n render() {\n let {\n children,\n errorElement,\n resolve\n } = this.props;\n let promise = null;\n let status = AwaitRenderStatus.pending;\n if (!(resolve instanceof Promise)) {\n // Didn't get a promise - provide as a resolved promise\n status = AwaitRenderStatus.success;\n promise = Promise.resolve();\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n Object.defineProperty(promise, \"_data\", {\n get: () => resolve\n });\n } else if (this.state.error) {\n // Caught a render error, provide it as a rejected promise\n status = AwaitRenderStatus.error;\n let renderError = this.state.error;\n promise = Promise.reject().catch(() => {}); // Avoid unhandled rejection warnings\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n Object.defineProperty(promise, \"_error\", {\n get: () => renderError\n });\n } else if (resolve._tracked) {\n // Already tracked promise - check contents\n promise = resolve;\n status = \"_error\" in promise ? AwaitRenderStatus.error : \"_data\" in promise ? AwaitRenderStatus.success : AwaitRenderStatus.pending;\n } else {\n // Raw (untracked) promise - track it\n status = AwaitRenderStatus.pending;\n Object.defineProperty(resolve, \"_tracked\", {\n get: () => true\n });\n promise = resolve.then(data => Object.defineProperty(resolve, \"_data\", {\n get: () => data\n }), error => Object.defineProperty(resolve, \"_error\", {\n get: () => error\n }));\n }\n if (status === AwaitRenderStatus.error && promise._error instanceof AbortedDeferredError) {\n // Freeze the UI by throwing a never resolved promise\n throw neverSettledPromise;\n }\n if (status === AwaitRenderStatus.error && !errorElement) {\n // No errorElement, throw to the nearest route-level error boundary\n throw promise._error;\n }\n if (status === AwaitRenderStatus.error) {\n // Render via our errorElement\n return /*#__PURE__*/React.createElement(AwaitContext.Provider, {\n value: promise,\n children: errorElement\n });\n }\n if (status === AwaitRenderStatus.success) {\n // Render children with resolved value\n return /*#__PURE__*/React.createElement(AwaitContext.Provider, {\n value: promise,\n children: children\n });\n }\n\n // Throw to the suspense boundary\n throw promise;\n }\n}\n\n/**\n * @private\n * Indirection to leverage useAsyncValue for a render-prop API on `<Await>`\n */\nfunction ResolveAwait(_ref8) {\n let {\n children\n } = _ref8;\n let data = useAsyncValue();\n let toRender = typeof children === \"function\" ? children(data) : children;\n return /*#__PURE__*/React.createElement(React.Fragment, null, toRender);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `<Route>` element or an array of them. Used internally by\n * `<Routes>` to create a route config from its children.\n *\n * @see https://reactrouter.com/v6/utils/create-routes-from-children\n */\nfunction createRoutesFromChildren(children, parentPath) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n let routes = [];\n React.Children.forEach(children, (element, index) => {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n let treePath = [...parentPath, index];\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));\n return;\n }\n !(element.type === Route) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"[\" + (typeof element.type === \"string\" ? element.type : element.type.name) + \"] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>\") : UNSAFE_invariant(false) : void 0;\n !(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"An index route cannot have child routes.\") : UNSAFE_invariant(false) : void 0;\n let route = {\n id: element.props.id || treePath.join(\"-\"),\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n Component: element.props.Component,\n index: element.props.index,\n path: element.props.path,\n loader: element.props.loader,\n action: element.props.action,\n errorElement: element.props.errorElement,\n ErrorBoundary: element.props.ErrorBoundary,\n hasErrorBoundary: element.props.ErrorBoundary != null || element.props.errorElement != null,\n shouldRevalidate: element.props.shouldRevalidate,\n handle: element.props.handle,\n lazy: element.props.lazy\n };\n if (element.props.children) {\n route.children = createRoutesFromChildren(element.props.children, treePath);\n }\n routes.push(route);\n });\n return routes;\n}\n\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\nfunction renderMatches(matches) {\n return _renderMatches(matches);\n}\n\nfunction mapRouteProperties(route) {\n let updates = {\n // Note: this check also occurs in createRoutesFromChildren so update\n // there if you change this -- please and thank you!\n hasErrorBoundary: route.ErrorBoundary != null || route.errorElement != null\n };\n if (route.Component) {\n if (process.env.NODE_ENV !== \"production\") {\n if (route.element) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"You should not include both `Component` and `element` on your route - \" + \"`Component` will be used.\") : void 0;\n }\n }\n Object.assign(updates, {\n element: /*#__PURE__*/React.createElement(route.Component),\n Component: undefined\n });\n }\n if (route.HydrateFallback) {\n if (process.env.NODE_ENV !== \"production\") {\n if (route.hydrateFallbackElement) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - \" + \"`HydrateFallback` will be used.\") : void 0;\n }\n }\n Object.assign(updates, {\n hydrateFallbackElement: /*#__PURE__*/React.createElement(route.HydrateFallback),\n HydrateFallback: undefined\n });\n }\n if (route.ErrorBoundary) {\n if (process.env.NODE_ENV !== \"production\") {\n if (route.errorElement) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"You should not include both `ErrorBoundary` and `errorElement` on your route - \" + \"`ErrorBoundary` will be used.\") : void 0;\n }\n }\n Object.assign(updates, {\n errorElement: /*#__PURE__*/React.createElement(route.ErrorBoundary),\n ErrorBoundary: undefined\n });\n }\n return updates;\n}\nfunction createMemoryRouter(routes, opts) {\n return createRouter({\n basename: opts == null ? void 0 : opts.basename,\n future: _extends({}, opts == null ? void 0 : opts.future, {\n v7_prependBasename: true\n }),\n history: createMemoryHistory({\n initialEntries: opts == null ? void 0 : opts.initialEntries,\n initialIndex: opts == null ? void 0 : opts.initialIndex\n }),\n hydrationData: opts == null ? void 0 : opts.hydrationData,\n routes,\n mapRouteProperties,\n dataStrategy: opts == null ? void 0 : opts.dataStrategy,\n patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation\n }).initialize();\n}\n\nexport { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, logV6DeprecationWarnings as UNSAFE_logV6DeprecationWarnings, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };\n//# sourceMappingURL=index.js.map\n","/**\n * React Router DOM v6.30.4\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { UNSAFE_mapRouteProperties, UNSAFE_logV6DeprecationWarnings, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, useBlocker } from 'react-router';\nexport { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';\nimport { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory, UNSAFE_ErrorResponseImpl, UNSAFE_invariant, joinPaths, IDLE_FETCHER, matchPath } from '@remix-run/router';\nexport { UNSAFE_ErrorResponseImpl } from '@remix-run/router';\n\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\n\nconst defaultMethod = \"get\";\nconst defaultEncType = \"application/x-www-form-urlencoded\";\nfunction isHtmlElement(object) {\n return object != null && typeof object.tagName === \"string\";\n}\nfunction isButtonElement(object) {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"button\";\n}\nfunction isFormElement(object) {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"form\";\n}\nfunction isInputElement(object) {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"input\";\n}\nfunction isModifiedEvent(event) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\nfunction shouldProcessLinkClick(event, target) {\n return event.button === 0 && (\n // Ignore everything but left clicks\n !target || target === \"_self\") &&\n // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n;\n}\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nfunction createSearchParams(init) {\n if (init === void 0) {\n init = \"\";\n }\n return new URLSearchParams(typeof init === \"string\" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);\n }, []));\n}\nfunction getSearchParamsForLocation(locationSearch, defaultSearchParams) {\n let searchParams = createSearchParams(locationSearch);\n if (defaultSearchParams) {\n // Use `defaultSearchParams.forEach(...)` here instead of iterating of\n // `defaultSearchParams.keys()` to work-around a bug in Firefox related to\n // web extensions. Relevant Bugzilla tickets:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1414602\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1023984\n defaultSearchParams.forEach((_, key) => {\n if (!searchParams.has(key)) {\n defaultSearchParams.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n });\n }\n return searchParams;\n}\n// One-time check for submitter support\nlet _formDataSupportsSubmitter = null;\nfunction isFormDataSubmitterSupported() {\n if (_formDataSupportsSubmitter === null) {\n try {\n new FormData(document.createElement(\"form\"),\n // @ts-expect-error if FormData supports the submitter parameter, this will throw\n 0);\n _formDataSupportsSubmitter = false;\n } catch (e) {\n _formDataSupportsSubmitter = true;\n }\n }\n return _formDataSupportsSubmitter;\n}\nconst supportedFormEncTypes = new Set([\"application/x-www-form-urlencoded\", \"multipart/form-data\", \"text/plain\"]);\nfunction getFormEncType(encType) {\n if (encType != null && !supportedFormEncTypes.has(encType)) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"\\\"\" + encType + \"\\\" is not a valid `encType` for `<Form>`/`<fetcher.Form>` \" + (\"and will default to \\\"\" + defaultEncType + \"\\\"\")) : void 0;\n return null;\n }\n return encType;\n}\nfunction getFormSubmissionInfo(target, basename) {\n let method;\n let action;\n let encType;\n let formData;\n let body;\n if (isFormElement(target)) {\n // When grabbing the action from the element, it will have had the basename\n // prefixed to ensure non-JS scenarios work, so strip it since we'll\n // re-prefix in the router\n let attr = target.getAttribute(\"action\");\n action = attr ? stripBasename(attr, basename) : null;\n method = target.getAttribute(\"method\") || defaultMethod;\n encType = getFormEncType(target.getAttribute(\"enctype\")) || defaultEncType;\n formData = new FormData(target);\n } else if (isButtonElement(target) || isInputElement(target) && (target.type === \"submit\" || target.type === \"image\")) {\n let form = target.form;\n if (form == null) {\n throw new Error(\"Cannot submit a <button> or <input type=\\\"submit\\\"> without a <form>\");\n }\n // <button>/<input type=\"submit\"> may override attributes of <form>\n // When grabbing the action from the element, it will have had the basename\n // prefixed to ensure non-JS scenarios work, so strip it since we'll\n // re-prefix in the router\n let attr = target.getAttribute(\"formaction\") || form.getAttribute(\"action\");\n action = attr ? stripBasename(attr, basename) : null;\n method = target.getAttribute(\"formmethod\") || form.getAttribute(\"method\") || defaultMethod;\n encType = getFormEncType(target.getAttribute(\"formenctype\")) || getFormEncType(form.getAttribute(\"enctype\")) || defaultEncType;\n // Build a FormData object populated from a form and submitter\n formData = new FormData(form, target);\n // If this browser doesn't support the `FormData(el, submitter)` format,\n // then tack on the submitter value at the end. This is a lightweight\n // solution that is not 100% spec compliant. For complete support in older\n // browsers, consider using the `formdata-submitter-polyfill` package\n if (!isFormDataSubmitterSupported()) {\n let {\n name,\n type,\n value\n } = target;\n if (type === \"image\") {\n let prefix = name ? name + \".\" : \"\";\n formData.append(prefix + \"x\", \"0\");\n formData.append(prefix + \"y\", \"0\");\n } else if (name) {\n formData.append(name, value);\n }\n }\n } else if (isHtmlElement(target)) {\n throw new Error(\"Cannot submit element that is not <form>, <button>, or \" + \"<input type=\\\"submit|image\\\">\");\n } else {\n method = defaultMethod;\n action = null;\n encType = defaultEncType;\n body = target;\n }\n // Send body for <Form encType=\"text/plain\" so we encode it into text\n if (formData && encType === \"text/plain\") {\n body = formData;\n formData = undefined;\n }\n return {\n action,\n method: method.toLowerCase(),\n encType,\n formData,\n body\n };\n}\n\nconst _excluded = [\"onClick\", \"relative\", \"reloadDocument\", \"replace\", \"state\", \"target\", \"to\", \"preventScrollReset\", \"viewTransition\"],\n _excluded2 = [\"aria-current\", \"caseSensitive\", \"className\", \"end\", \"style\", \"to\", \"viewTransition\", \"children\"],\n _excluded3 = [\"fetcherKey\", \"navigate\", \"reloadDocument\", \"replace\", \"state\", \"method\", \"action\", \"onSubmit\", \"relative\", \"preventScrollReset\", \"viewTransition\"];\n// HEY YOU! DON'T TOUCH THIS VARIABLE!\n//\n// It is replaced with the proper version at build time via a babel plugin in\n// the rollup config.\n//\n// Export a global property onto the window for React Router detection by the\n// Core Web Vitals Technology Report. This way they can configure the `wappalyzer`\n// to detect and properly classify live websites as being built with React Router:\n// https://github.com/HTTPArchive/wappalyzer/blob/main/src/technologies/r.json\nconst REACT_ROUTER_VERSION = \"6\";\ntry {\n window.__reactRouterVersion = REACT_ROUTER_VERSION;\n} catch (e) {\n // no-op\n}\nfunction createBrowserRouter(routes, opts) {\n return createRouter({\n basename: opts == null ? void 0 : opts.basename,\n future: _extends({}, opts == null ? void 0 : opts.future, {\n v7_prependBasename: true\n }),\n history: createBrowserHistory({\n window: opts == null ? void 0 : opts.window\n }),\n hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),\n routes,\n mapRouteProperties: UNSAFE_mapRouteProperties,\n dataStrategy: opts == null ? void 0 : opts.dataStrategy,\n patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,\n window: opts == null ? void 0 : opts.window\n }).initialize();\n}\nfunction createHashRouter(routes, opts) {\n return createRouter({\n basename: opts == null ? void 0 : opts.basename,\n future: _extends({}, opts == null ? void 0 : opts.future, {\n v7_prependBasename: true\n }),\n history: createHashHistory({\n window: opts == null ? void 0 : opts.window\n }),\n hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),\n routes,\n mapRouteProperties: UNSAFE_mapRouteProperties,\n dataStrategy: opts == null ? void 0 : opts.dataStrategy,\n patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,\n window: opts == null ? void 0 : opts.window\n }).initialize();\n}\nfunction parseHydrationData() {\n var _window;\n let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData;\n if (state && state.errors) {\n state = _extends({}, state, {\n errors: deserializeErrors(state.errors)\n });\n }\n return state;\n}\nfunction deserializeErrors(errors) {\n if (!errors) return null;\n let entries = Object.entries(errors);\n let serialized = {};\n for (let [key, val] of entries) {\n // Hey you! If you change this, please change the corresponding logic in\n // serializeErrors in react-router-dom/server.tsx :)\n if (val && val.__type === \"RouteErrorResponse\") {\n serialized[key] = new UNSAFE_ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);\n } else if (val && val.__type === \"Error\") {\n // Attempt to reconstruct the right type of Error (i.e., ReferenceError)\n if (val.__subType) {\n let ErrorConstructor = window[val.__subType];\n if (typeof ErrorConstructor === \"function\") {\n try {\n // @ts-expect-error\n let error = new ErrorConstructor(val.message);\n // Wipe away the client-side stack trace. Nothing to fill it in with\n // because we don't serialize SSR stack traces for security reasons\n error.stack = \"\";\n serialized[key] = error;\n } catch (e) {\n // no-op - fall through and create a normal Error\n }\n }\n }\n if (serialized[key] == null) {\n let error = new Error(val.message);\n // Wipe away the client-side stack trace. Nothing to fill it in with\n // because we don't serialize SSR stack traces for security reasons\n error.stack = \"\";\n serialized[key] = error;\n }\n } else {\n serialized[key] = val;\n }\n }\n return serialized;\n}\nconst ViewTransitionContext = /*#__PURE__*/React.createContext({\n isTransitioning: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n ViewTransitionContext.displayName = \"ViewTransition\";\n}\nconst FetchersContext = /*#__PURE__*/React.createContext(new Map());\nif (process.env.NODE_ENV !== \"production\") {\n FetchersContext.displayName = \"Fetchers\";\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Components\n////////////////////////////////////////////////////////////////////////////////\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\nconst FLUSH_SYNC = \"flushSync\";\nconst flushSyncImpl = ReactDOM[FLUSH_SYNC];\nconst USE_ID = \"useId\";\nconst useIdImpl = React[USE_ID];\nfunction startTransitionSafe(cb) {\n if (startTransitionImpl) {\n startTransitionImpl(cb);\n } else {\n cb();\n }\n}\nfunction flushSyncSafe(cb) {\n if (flushSyncImpl) {\n flushSyncImpl(cb);\n } else {\n cb();\n }\n}\nclass Deferred {\n constructor() {\n this.status = \"pending\";\n this.promise = new Promise((resolve, reject) => {\n this.resolve = value => {\n if (this.status === \"pending\") {\n this.status = \"resolved\";\n resolve(value);\n }\n };\n this.reject = reason => {\n if (this.status === \"pending\") {\n this.status = \"rejected\";\n reject(reason);\n }\n };\n });\n }\n}\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let [pendingState, setPendingState] = React.useState();\n let [vtContext, setVtContext] = React.useState({\n isTransitioning: false\n });\n let [renderDfd, setRenderDfd] = React.useState();\n let [transition, setTransition] = React.useState();\n let [interruption, setInterruption] = React.useState();\n let fetcherData = React.useRef(new Map());\n let {\n v7_startTransition\n } = future || {};\n let optInStartTransition = React.useCallback(cb => {\n if (v7_startTransition) {\n startTransitionSafe(cb);\n } else {\n cb();\n }\n }, [v7_startTransition]);\n let setState = React.useCallback((newState, _ref2) => {\n let {\n deletedFetchers,\n flushSync: flushSync,\n viewTransitionOpts: viewTransitionOpts\n } = _ref2;\n newState.fetchers.forEach((fetcher, key) => {\n if (fetcher.data !== undefined) {\n fetcherData.current.set(key, fetcher.data);\n }\n });\n deletedFetchers.forEach(key => fetcherData.current.delete(key));\n let isViewTransitionUnavailable = router.window == null || router.window.document == null || typeof router.window.document.startViewTransition !== \"function\";\n // If this isn't a view transition or it's not available in this browser,\n // just update and be done with it\n if (!viewTransitionOpts || isViewTransitionUnavailable) {\n if (flushSync) {\n flushSyncSafe(() => setStateImpl(newState));\n } else {\n optInStartTransition(() => setStateImpl(newState));\n }\n return;\n }\n // flushSync + startViewTransition\n if (flushSync) {\n // Flush through the context to mark DOM elements as transition=ing\n flushSyncSafe(() => {\n // Cancel any pending transitions\n if (transition) {\n renderDfd && renderDfd.resolve();\n transition.skipTransition();\n }\n setVtContext({\n isTransitioning: true,\n flushSync: true,\n currentLocation: viewTransitionOpts.currentLocation,\n nextLocation: viewTransitionOpts.nextLocation\n });\n });\n // Update the DOM\n let t = router.window.document.startViewTransition(() => {\n flushSyncSafe(() => setStateImpl(newState));\n });\n // Clean up after the animation completes\n t.finished.finally(() => {\n flushSyncSafe(() => {\n setRenderDfd(undefined);\n setTransition(undefined);\n setPendingState(undefined);\n setVtContext({\n isTransitioning: false\n });\n });\n });\n flushSyncSafe(() => setTransition(t));\n return;\n }\n // startTransition + startViewTransition\n if (transition) {\n // Interrupting an in-progress transition, cancel and let everything flush\n // out, and then kick off a new transition from the interruption state\n renderDfd && renderDfd.resolve();\n transition.skipTransition();\n setInterruption({\n state: newState,\n currentLocation: viewTransitionOpts.currentLocation,\n nextLocation: viewTransitionOpts.nextLocation\n });\n } else {\n // Completed navigation update with opted-in view transitions, let 'er rip\n setPendingState(newState);\n setVtContext({\n isTransitioning: true,\n flushSync: false,\n currentLocation: viewTransitionOpts.currentLocation,\n nextLocation: viewTransitionOpts.nextLocation\n });\n }\n }, [router.window, transition, renderDfd, fetcherData, optInStartTransition]);\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n // When we start a view transition, create a Deferred we can use for the\n // eventual \"completed\" render\n React.useEffect(() => {\n if (vtContext.isTransitioning && !vtContext.flushSync) {\n setRenderDfd(new Deferred());\n }\n }, [vtContext]);\n // Once the deferred is created, kick off startViewTransition() to update the\n // DOM and then wait on the Deferred to resolve (indicating the DOM update has\n // happened)\n React.useEffect(() => {\n if (renderDfd && pendingState && router.window) {\n let newState = pendingState;\n let renderPromise = renderDfd.promise;\n let transition = router.window.document.startViewTransition(async () => {\n optInStartTransition(() => setStateImpl(newState));\n await renderPromise;\n });\n transition.finished.finally(() => {\n setRenderDfd(undefined);\n setTransition(undefined);\n setPendingState(undefined);\n setVtContext({\n isTransitioning: false\n });\n });\n setTransition(transition);\n }\n }, [optInStartTransition, pendingState, renderDfd, router.window]);\n // When the new location finally renders and is committed to the DOM, this\n // effect will run to resolve the transition\n React.useEffect(() => {\n if (renderDfd && pendingState && state.location.key === pendingState.location.key) {\n renderDfd.resolve();\n }\n }, [renderDfd, transition, state.location, pendingState]);\n // If we get interrupted with a new navigation during a transition, we skip\n // the active transition, let it cleanup, then kick it off again here\n React.useEffect(() => {\n if (!vtContext.isTransitioning && interruption) {\n setPendingState(interruption.state);\n setVtContext({\n isTransitioning: true,\n flushSync: false,\n currentLocation: interruption.currentLocation,\n nextLocation: interruption.nextLocation\n });\n setInterruption(undefined);\n }\n }, [vtContext.isTransitioning, interruption]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`<RouterProvider fallbackElement>` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n let routerFuture = React.useMemo(() => ({\n v7_relativeSplatPath: router.future.v7_relativeSplatPath\n }), [router.future.v7_relativeSplatPath]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future, router.future), [future, router.future]);\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a <script> here\n // containing the hydrated server-side staticContext (from StaticRouterProvider).\n // useId relies on the component tree structure to generate deterministic id's\n // so we need to ensure it remains the same on the client even though\n // we don't need the <script> tag\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UNSAFE_DataRouterContext.Provider, {\n value: dataRouterContext\n }, /*#__PURE__*/React.createElement(UNSAFE_DataRouterStateContext.Provider, {\n value: state\n }, /*#__PURE__*/React.createElement(FetchersContext.Provider, {\n value: fetcherData.current\n }, /*#__PURE__*/React.createElement(ViewTransitionContext.Provider, {\n value: vtContext\n }, /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n location: state.location,\n navigationType: state.historyAction,\n navigator: navigator,\n future: routerFuture\n }, state.initialized || router.future.v7_partialHydration ? (/*#__PURE__*/React.createElement(MemoizedDataRoutes, {\n routes: router.routes,\n future: router.future,\n state: state\n })) : fallbackElement))))), null);\n}\n// Memoize to avoid re-renders when updating `ViewTransitionContext`\nconst MemoizedDataRoutes = /*#__PURE__*/React.memo(DataRoutes);\nfunction DataRoutes(_ref3) {\n let {\n routes,\n future,\n state\n } = _ref3;\n return UNSAFE_useRoutesImpl(routes, undefined, state, future);\n}\n/**\n * A `<Router>` for use in web browsers. Provides the cleanest URLs.\n */\nfunction BrowserRouter(_ref4) {\n let {\n basename,\n children,\n future,\n window\n } = _ref4;\n let historyRef = React.useRef();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({\n window,\n v5Compat: true\n });\n }\n let history = historyRef.current;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\n/**\n * A `<Router>` for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nfunction HashRouter(_ref5) {\n let {\n basename,\n children,\n future,\n window\n } = _ref5;\n let historyRef = React.useRef();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({\n window,\n v5Compat: true\n });\n }\n let history = historyRef.current;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\n/**\n * A `<Router>` that accepts a pre-instantiated history object. It's important\n * to note that using your own history object is highly discouraged and may add\n * two versions of the history library to your bundles unless you use the same\n * version of the history library that React Router uses internally.\n */\nfunction HistoryRouter(_ref6) {\n let {\n basename,\n children,\n future,\n history\n } = _ref6;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\nif (process.env.NODE_ENV !== \"production\") {\n HistoryRouter.displayName = \"unstable_HistoryRouter\";\n}\nconst isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.document.createElement !== \"undefined\";\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\n/**\n * The public API for rendering a history-aware `<a>`.\n */\nconst Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref7, ref) {\n let {\n onClick,\n relative,\n reloadDocument,\n replace,\n state,\n target,\n to,\n preventScrollReset,\n viewTransition\n } = _ref7,\n rest = _objectWithoutPropertiesLoose(_ref7, _excluded);\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n // Rendered into <a href> for absolute URLs\n let absoluteHref;\n let isExternal = false;\n if (typeof to === \"string\" && ABSOLUTE_URL_REGEX.test(to)) {\n // Render the absolute href server- and client-side\n absoluteHref = to;\n // Only check for external origins client-side\n if (isBrowser) {\n try {\n let currentUrl = new URL(window.location.href);\n let targetUrl = to.startsWith(\"//\") ? new URL(currentUrl.protocol + to) : new URL(to);\n let path = stripBasename(targetUrl.pathname, basename);\n if (targetUrl.origin === currentUrl.origin && path != null) {\n // Strip the protocol/origin/basename for same-origin absolute URLs\n to = path + targetUrl.search + targetUrl.hash;\n } else {\n isExternal = true;\n }\n } catch (e) {\n // We can't do external URL detection without a valid URL\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"<Link to=\\\"\" + to + \"\\\"> contains an invalid URL which will probably break \" + \"when clicked - please update to a valid URL path.\") : void 0;\n }\n }\n }\n // Rendered into <a href> for relative URLs\n let href = useHref(to, {\n relative\n });\n let internalOnClick = useLinkClickHandler(to, {\n replace,\n state,\n target,\n preventScrollReset,\n relative,\n viewTransition\n });\n function handleClick(event) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n React.createElement(\"a\", _extends({}, rest, {\n href: absoluteHref || href,\n onClick: isExternal || reloadDocument ? onClick : handleClick,\n ref: ref,\n target: target\n }))\n );\n});\nif (process.env.NODE_ENV !== \"production\") {\n Link.displayName = \"Link\";\n}\n/**\n * A `<Link>` wrapper that knows if it's \"active\" or not.\n */\nconst NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref8, ref) {\n let {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n viewTransition,\n children\n } = _ref8,\n rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);\n let path = useResolvedPath(to, {\n relative: rest.relative\n });\n let location = useLocation();\n let routerState = React.useContext(UNSAFE_DataRouterStateContext);\n let {\n navigator,\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let isTransitioning = routerState != null &&\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useViewTransitionState(path) && viewTransition === true;\n let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;\n let locationPathname = location.pathname;\n let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;\n toPathname = toPathname.toLowerCase();\n }\n if (nextLocationPathname && basename) {\n nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;\n }\n // If the `to` has a trailing slash, look at that exact spot. Otherwise,\n // we're looking for a slash _after_ what's in `to`. For example:\n //\n // <NavLink to=\"/users\"> and <NavLink to=\"/users/\">\n // both want to look for a / at index 6 to match URL `/users/matt`\n const endSlashPosition = toPathname !== \"/\" && toPathname.endsWith(\"/\") ? toPathname.length - 1 : toPathname.length;\n let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === \"/\";\n let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === \"/\");\n let renderProps = {\n isActive,\n isPending,\n isTransitioning\n };\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n let className;\n if (typeof classNameProp === \"function\") {\n className = classNameProp(renderProps);\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null, isPending ? \"pending\" : null, isTransitioning ? \"transitioning\" : null].filter(Boolean).join(\" \");\n }\n let style = typeof styleProp === \"function\" ? styleProp(renderProps) : styleProp;\n return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {\n \"aria-current\": ariaCurrent,\n className: className,\n ref: ref,\n style: style,\n to: to,\n viewTransition: viewTransition\n }), typeof children === \"function\" ? children(renderProps) : children);\n});\nif (process.env.NODE_ENV !== \"production\") {\n NavLink.displayName = \"NavLink\";\n}\n/**\n * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except\n * that the interaction with the server is with `fetch` instead of new document\n * requests, allowing components to add nicer UX to the page as the form is\n * submitted and returns with data.\n */\nconst Form = /*#__PURE__*/React.forwardRef((_ref9, forwardedRef) => {\n let {\n fetcherKey,\n navigate,\n reloadDocument,\n replace,\n state,\n method = defaultMethod,\n action,\n onSubmit,\n relative,\n preventScrollReset,\n viewTransition\n } = _ref9,\n props = _objectWithoutPropertiesLoose(_ref9, _excluded3);\n let submit = useSubmit();\n let formAction = useFormAction(action, {\n relative\n });\n let formMethod = method.toLowerCase() === \"get\" ? \"get\" : \"post\";\n let submitHandler = event => {\n onSubmit && onSubmit(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n let submitter = event.nativeEvent.submitter;\n let submitMethod = (submitter == null ? void 0 : submitter.getAttribute(\"formmethod\")) || method;\n submit(submitter || event.currentTarget, {\n fetcherKey,\n method: submitMethod,\n navigate,\n replace,\n state,\n relative,\n preventScrollReset,\n viewTransition\n });\n };\n return /*#__PURE__*/React.createElement(\"form\", _extends({\n ref: forwardedRef,\n method: formMethod,\n action: formAction,\n onSubmit: reloadDocument ? onSubmit : submitHandler\n }, props));\n});\nif (process.env.NODE_ENV !== \"production\") {\n Form.displayName = \"Form\";\n}\n/**\n * This component will emulate the browser's scroll restoration on location\n * changes.\n */\nfunction ScrollRestoration(_ref0) {\n let {\n getKey,\n storageKey\n } = _ref0;\n useScrollRestoration({\n getKey,\n storageKey\n });\n return null;\n}\nif (process.env.NODE_ENV !== \"production\") {\n ScrollRestoration.displayName = \"ScrollRestoration\";\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Hooks\n////////////////////////////////////////////////////////////////////////////////\nvar DataRouterHook;\n(function (DataRouterHook) {\n DataRouterHook[\"UseScrollRestoration\"] = \"useScrollRestoration\";\n DataRouterHook[\"UseSubmit\"] = \"useSubmit\";\n DataRouterHook[\"UseSubmitFetcher\"] = \"useSubmitFetcher\";\n DataRouterHook[\"UseFetcher\"] = \"useFetcher\";\n DataRouterHook[\"useViewTransitionState\"] = \"useViewTransitionState\";\n})(DataRouterHook || (DataRouterHook = {}));\nvar DataRouterStateHook;\n(function (DataRouterStateHook) {\n DataRouterStateHook[\"UseFetcher\"] = \"useFetcher\";\n DataRouterStateHook[\"UseFetchers\"] = \"useFetchers\";\n DataRouterStateHook[\"UseScrollRestoration\"] = \"useScrollRestoration\";\n})(DataRouterStateHook || (DataRouterStateHook = {}));\n// Internal hooks\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(UNSAFE_DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(UNSAFE_DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\n// External hooks\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nfunction useLinkClickHandler(to, _temp) {\n let {\n target,\n replace: replaceProp,\n state,\n preventScrollReset,\n relative,\n viewTransition\n } = _temp === void 0 ? {} : _temp;\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to, {\n relative\n });\n return React.useCallback(event => {\n if (shouldProcessLinkClick(event, target)) {\n event.preventDefault();\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here unless the replace prop is explicitly set\n let replace = replaceProp !== undefined ? replaceProp : createPath(location) === createPath(path);\n navigate(to, {\n replace,\n state,\n preventScrollReset,\n relative,\n viewTransition\n });\n }\n }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);\n}\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nfunction useSearchParams(defaultInit) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(typeof URLSearchParams !== \"undefined\", \"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.\") : void 0;\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n let hasSetSearchParamsRef = React.useRef(false);\n let location = useLocation();\n let searchParams = React.useMemo(() =>\n // Only merge in the defaults if we haven't yet called setSearchParams.\n // Once we call that we want those to take precedence, otherwise you can't\n // remove a param with setSearchParams({}) if it has an initial value\n getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);\n let navigate = useNavigate();\n let setSearchParams = React.useCallback((nextInit, navigateOptions) => {\n const newSearchParams = createSearchParams(typeof nextInit === \"function\" ? nextInit(searchParams) : nextInit);\n hasSetSearchParamsRef.current = true;\n navigate(\"?\" + newSearchParams, navigateOptions);\n }, [navigate, searchParams]);\n return [searchParams, setSearchParams];\n}\nfunction validateClientSideSubmission() {\n if (typeof document === \"undefined\") {\n throw new Error(\"You are calling submit during the server render. \" + \"Try calling submit within a `useEffect` or callback instead.\");\n }\n}\nlet fetcherId = 0;\nlet getUniqueFetcherId = () => \"__\" + String(++fetcherId) + \"__\";\n/**\n * Returns a function that may be used to programmatically submit a form (or\n * some arbitrary data) to the server.\n */\nfunction useSubmit() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseSubmit);\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let currentRouteId = UNSAFE_useRouteId();\n return React.useCallback(function (target, options) {\n if (options === void 0) {\n options = {};\n }\n validateClientSideSubmission();\n let {\n action,\n method,\n encType,\n formData,\n body\n } = getFormSubmissionInfo(target, basename);\n if (options.navigate === false) {\n let key = options.fetcherKey || getUniqueFetcherId();\n router.fetch(key, currentRouteId, options.action || action, {\n preventScrollReset: options.preventScrollReset,\n formData,\n body,\n formMethod: options.method || method,\n formEncType: options.encType || encType,\n flushSync: options.flushSync\n });\n } else {\n router.navigate(options.action || action, {\n preventScrollReset: options.preventScrollReset,\n formData,\n body,\n formMethod: options.method || method,\n formEncType: options.encType || encType,\n replace: options.replace,\n state: options.state,\n fromRouteId: currentRouteId,\n flushSync: options.flushSync,\n viewTransition: options.viewTransition\n });\n }\n }, [router, basename, currentRouteId]);\n}\n// v7: Eventually we should deprecate this entirely in favor of using the\n// router method directly?\nfunction useFormAction(action, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let routeContext = React.useContext(UNSAFE_RouteContext);\n !routeContext ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFormAction must be used inside a RouteContext\") : UNSAFE_invariant(false) : void 0;\n let [match] = routeContext.matches.slice(-1);\n // Shallow clone path so we can modify it below, otherwise we modify the\n // object referenced by useMemo inside useResolvedPath\n let path = _extends({}, useResolvedPath(action ? action : \".\", {\n relative\n }));\n // If no action was specified, browsers will persist current search params\n // when determining the path, so match that behavior\n // https://github.com/remix-run/remix/issues/927\n let location = useLocation();\n if (action == null) {\n // Safe to write to this directly here since if action was undefined, we\n // would have called useResolvedPath(\".\") which will never include a search\n path.search = location.search;\n // When grabbing search params from the URL, remove any included ?index param\n // since it might not apply to our contextual route. We add it back based\n // on match.route.index below\n let params = new URLSearchParams(path.search);\n let indexValues = params.getAll(\"index\");\n let hasNakedIndexParam = indexValues.some(v => v === \"\");\n if (hasNakedIndexParam) {\n params.delete(\"index\");\n indexValues.filter(v => v).forEach(v => params.append(\"index\", v));\n let qs = params.toString();\n path.search = qs ? \"?\" + qs : \"\";\n }\n }\n if ((!action || action === \".\") && match.route.index) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the form action. If this is a root navigation, then just use\n // the raw basename which allows the basename to have full control over the\n // presence of a trailing slash on root actions\n if (basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// TODO: (v7) Change the useFetcher generic default from `any` to `unknown`\n/**\n * Interacts with route loaders and actions without causing a navigation. Great\n * for any interaction that stays on the same page.\n */\nfunction useFetcher(_temp3) {\n var _route$matches;\n let {\n key\n } = _temp3 === void 0 ? {} : _temp3;\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseFetcher);\n let state = useDataRouterState(DataRouterStateHook.UseFetcher);\n let fetcherData = React.useContext(FetchersContext);\n let route = React.useContext(UNSAFE_RouteContext);\n let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;\n !fetcherData ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFetcher must be used inside a FetchersContext\") : UNSAFE_invariant(false) : void 0;\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFetcher must be used inside a RouteContext\") : UNSAFE_invariant(false) : void 0;\n !(routeId != null) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFetcher can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n // Fetcher key handling\n // OK to call conditionally to feature detect `useId`\n // eslint-disable-next-line react-hooks/rules-of-hooks\n let defaultKey = useIdImpl ? useIdImpl() : \"\";\n let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);\n if (key && key !== fetcherKey) {\n setFetcherKey(key);\n } else if (!fetcherKey) {\n // We will only fall through here when `useId` is not available\n setFetcherKey(getUniqueFetcherId());\n }\n // Registration/cleanup\n React.useEffect(() => {\n router.getFetcher(fetcherKey);\n return () => {\n // Tell the router we've unmounted - if v7_fetcherPersist is enabled this\n // will not delete immediately but instead queue up a delete after the\n // fetcher returns to an `idle` state\n router.deleteFetcher(fetcherKey);\n };\n }, [router, fetcherKey]);\n // Fetcher additions\n let load = React.useCallback((href, opts) => {\n !routeId ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"No routeId available for fetcher.load()\") : UNSAFE_invariant(false) : void 0;\n router.fetch(fetcherKey, routeId, href, opts);\n }, [fetcherKey, routeId, router]);\n let submitImpl = useSubmit();\n let submit = React.useCallback((target, opts) => {\n submitImpl(target, _extends({}, opts, {\n navigate: false,\n fetcherKey\n }));\n }, [fetcherKey, submitImpl]);\n let FetcherForm = React.useMemo(() => {\n let FetcherForm = /*#__PURE__*/React.forwardRef((props, ref) => {\n return /*#__PURE__*/React.createElement(Form, _extends({}, props, {\n navigate: false,\n fetcherKey: fetcherKey,\n ref: ref\n }));\n });\n if (process.env.NODE_ENV !== \"production\") {\n FetcherForm.displayName = \"fetcher.Form\";\n }\n return FetcherForm;\n }, [fetcherKey]);\n // Exposed FetcherWithComponents\n let fetcher = state.fetchers.get(fetcherKey) || IDLE_FETCHER;\n let data = fetcherData.get(fetcherKey);\n let fetcherWithComponents = React.useMemo(() => _extends({\n Form: FetcherForm,\n submit,\n load\n }, fetcher, {\n data\n }), [FetcherForm, submit, load, fetcher, data]);\n return fetcherWithComponents;\n}\n/**\n * Provides all fetchers currently on the page. Useful for layouts and parent\n * routes that need to provide pending/optimistic UI regarding the fetch.\n */\nfunction useFetchers() {\n let state = useDataRouterState(DataRouterStateHook.UseFetchers);\n return Array.from(state.fetchers.entries()).map(_ref1 => {\n let [key, fetcher] = _ref1;\n return _extends({}, fetcher, {\n key\n });\n });\n}\nconst SCROLL_RESTORATION_STORAGE_KEY = \"react-router-scroll-positions\";\nlet savedScrollPositions = {};\n/**\n * When rendered inside a RouterProvider, will restore scroll positions on navigations\n */\nfunction useScrollRestoration(_temp4) {\n let {\n getKey,\n storageKey\n } = _temp4 === void 0 ? {} : _temp4;\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseScrollRestoration);\n let {\n restoreScrollPosition,\n preventScrollReset\n } = useDataRouterState(DataRouterStateHook.UseScrollRestoration);\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let location = useLocation();\n let matches = useMatches();\n let navigation = useNavigation();\n // Trigger manual scroll restoration while we're active\n React.useEffect(() => {\n window.history.scrollRestoration = \"manual\";\n return () => {\n window.history.scrollRestoration = \"auto\";\n };\n }, []);\n // Save positions on pagehide\n usePageHide(React.useCallback(() => {\n if (navigation.state === \"idle\") {\n let key = (getKey ? getKey(location, matches) : null) || location.key;\n savedScrollPositions[key] = window.scrollY;\n }\n try {\n sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));\n } catch (error) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (\" + error + \").\") : void 0;\n }\n window.history.scrollRestoration = \"auto\";\n }, [storageKey, getKey, navigation.state, location, matches]));\n // Read in any saved scroll locations\n if (typeof document !== \"undefined\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n try {\n let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);\n if (sessionPositions) {\n savedScrollPositions = JSON.parse(sessionPositions);\n }\n } catch (e) {\n // no-op, use default empty object\n }\n }, [storageKey]);\n // Enable scroll restoration in the router\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n let getKeyWithoutBasename = getKey && basename !== \"/\" ? (location, matches) => getKey(// Strip the basename to match useLocation()\n _extends({}, location, {\n pathname: stripBasename(location.pathname, basename) || location.pathname\n }), matches) : getKey;\n let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);\n return () => disableScrollRestoration && disableScrollRestoration();\n }, [router, basename, getKey]);\n // Restore scrolling when state.restoreScrollPosition changes\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n // Explicit false means don't do anything (used for submissions)\n if (restoreScrollPosition === false) {\n return;\n }\n // been here before, scroll to it\n if (typeof restoreScrollPosition === \"number\") {\n window.scrollTo(0, restoreScrollPosition);\n return;\n }\n // try to scroll to the hash\n if (location.hash) {\n let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));\n if (el) {\n el.scrollIntoView();\n return;\n }\n }\n // Don't reset if this navigation opted out\n if (preventScrollReset === true) {\n return;\n }\n // otherwise go to the top on new locations\n window.scrollTo(0, 0);\n }, [location, restoreScrollPosition, preventScrollReset]);\n }\n}\n/**\n * Setup a callback to be fired on the window's `beforeunload` event. This is\n * useful for saving some data to `window.localStorage` just before the page\n * refreshes.\n *\n * Note: The `callback` argument should be a function created with\n * `React.useCallback()`.\n */\nfunction useBeforeUnload(callback, options) {\n let {\n capture\n } = options || {};\n React.useEffect(() => {\n let opts = capture != null ? {\n capture\n } : undefined;\n window.addEventListener(\"beforeunload\", callback, opts);\n return () => {\n window.removeEventListener(\"beforeunload\", callback, opts);\n };\n }, [callback, capture]);\n}\n/**\n * Setup a callback to be fired on the window's `pagehide` event. This is\n * useful for saving some data to `window.localStorage` just before the page\n * refreshes. This event is better supported than beforeunload across browsers.\n *\n * Note: The `callback` argument should be a function created with\n * `React.useCallback()`.\n */\nfunction usePageHide(callback, options) {\n let {\n capture\n } = options || {};\n React.useEffect(() => {\n let opts = capture != null ? {\n capture\n } : undefined;\n window.addEventListener(\"pagehide\", callback, opts);\n return () => {\n window.removeEventListener(\"pagehide\", callback, opts);\n };\n }, [callback, capture]);\n}\n/**\n * Wrapper around useBlocker to show a window.confirm prompt to users instead\n * of building a custom UI with useBlocker.\n *\n * Warning: This has *a lot of rough edges* and behaves very differently (and\n * very incorrectly in some cases) across browsers if user click addition\n * back/forward navigations while the confirm is open. Use at your own risk.\n */\nfunction usePrompt(_ref10) {\n let {\n when,\n message\n } = _ref10;\n let blocker = useBlocker(when);\n React.useEffect(() => {\n if (blocker.state === \"blocked\") {\n let proceed = window.confirm(message);\n if (proceed) {\n // This timeout is needed to avoid a weird \"race\" on POP navigations\n // between the `window.history` revert navigation and the result of\n // `window.confirm`\n setTimeout(blocker.proceed, 0);\n } else {\n blocker.reset();\n }\n }\n }, [blocker, message]);\n React.useEffect(() => {\n if (blocker.state === \"blocked\" && !when) {\n blocker.reset();\n }\n }, [blocker, when]);\n}\n/**\n * Return a boolean indicating if there is an active view transition to the\n * given href. You can use this value to render CSS classes or viewTransitionName\n * styles onto your elements\n *\n * @param href The destination href\n * @param [opts.relative] Relative routing type (\"route\" | \"path\")\n */\nfunction useViewTransitionState(to, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let vtContext = React.useContext(ViewTransitionContext);\n !(vtContext != null) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. \" + \"Did you accidentally import `RouterProvider` from `react-router`?\") : UNSAFE_invariant(false) : void 0;\n let {\n basename\n } = useDataRouterContext(DataRouterHook.useViewTransitionState);\n let path = useResolvedPath(to, {\n relative: opts.relative\n });\n if (!vtContext.isTransitioning) {\n return false;\n }\n let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;\n let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;\n // Transition is active if we're going to or coming from the indicated\n // destination. This ensures that other PUSH navigations that reverse\n // an indicated transition apply. I.e., on the list view you have:\n //\n // <NavLink to=\"/details/1\" viewTransition>\n //\n // If you click the breadcrumb back to the list view:\n //\n // <NavLink to=\"/list\" viewTransition>\n //\n // We should apply the transition because it's indicated as active going\n // from /list -> /details/1 and therefore should be active on the reverse\n // (even though this isn't strictly a POP reverse)\n return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;\n}\n//#endregion\n\nexport { BrowserRouter, Form, HashRouter, Link, NavLink, RouterProvider, ScrollRestoration, FetchersContext as UNSAFE_FetchersContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, useScrollRestoration as UNSAFE_useScrollRestoration, createBrowserRouter, createHashRouter, createSearchParams, HistoryRouter as unstable_HistoryRouter, usePrompt as unstable_usePrompt, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit, useViewTransitionState };\n//# sourceMappingURL=index.js.map\n","'use strict';\n\n/**\n * Create a bound version of a function with a specified `this` context\n *\n * @param {Function} fn - The function to bind\n * @param {*} thisArg - The value to be passed as the `this` parameter\n * @returns {Function} A new function that will call the original function with the specified `this` context\n */\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst { toString } = Object.prototype;\nconst { getPrototypeOf } = Object;\nconst { iterator, toStringTag } = Symbol;\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (\n ({ hasOwnProperty }) =>\n (obj, prop) =>\n hasOwnProperty.call(obj, prop)\n)(Object.prototype);\n\n/**\n * Walk the prototype chain (excluding the shared Object.prototype) looking for\n * an own `prop`. This distinguishes genuine own/inherited members — including\n * class accessors and template prototypes — from members injected via\n * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which\n * live on Object.prototype itself and are therefore never matched.\n *\n * @param {*} thing The value whose chain to inspect\n * @param {string|symbol} prop The property key to look for\n *\n * @returns {boolean} True when `prop` is owned below Object.prototype\n */\nconst hasOwnInPrototypeChain = (thing, prop) => {\n let obj = thing;\n const seen = [];\n\n while (obj != null && obj !== Object.prototype) {\n if (seen.indexOf(obj) !== -1) {\n return false;\n }\n seen.push(obj);\n\n if (hasOwnProperty(obj, prop)) {\n return true;\n }\n obj = getPrototypeOf(obj);\n }\n return false;\n};\n\n/**\n * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own\n * properties and members inherited from a non-Object.prototype source (a class\n * instance or template object) are honored; a value reachable only through a\n * polluted Object.prototype is ignored and `undefined` is returned.\n *\n * @param {*} obj The source object\n * @param {string|symbol} prop The property key to read\n *\n * @returns {*} The resolved value, or undefined when unsafe/absent\n */\nconst getSafeProp = (obj, prop) =>\n obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;\n\nconst kindOf = ((cache) => (thing) => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type;\n};\n\nconst typeOfTest = (type) => (thing) => typeof thing === type;\n\n/**\n * Determine if a value is a non-null object\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst { isArray } = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return (\n val !== null &&\n !isUndefined(val) &&\n val.constructor !== null &&\n !isUndefined(val.constructor) &&\n isFunction(val.constructor.isBuffer) &&\n val.constructor.isBuffer(val)\n );\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n result = ArrayBuffer.isView(val);\n } else {\n result = val && val.buffer && isArrayBuffer(val.buffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = (thing) => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (!isObject(val)) {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (\n (prototype === null ||\n prototype === Object.prototype ||\n getPrototypeOf(prototype) === null) &&\n // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or\n // Symbol.iterator as evidence the value is a tagged/iterable type rather\n // than a plain object, while ignoring keys injected onto Object.prototype.\n !hasOwnInPrototypeChain(val, toStringTag) &&\n !hasOwnInPrototypeChain(val, iterator)\n );\n};\n\n/**\n * Determine if a value is an empty object (safely handles Buffers)\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an empty object, otherwise false\n */\nconst isEmptyObject = (val) => {\n // Early return for non-objects or Buffers to prevent RangeError\n if (!isObject(val) || isBuffer(val)) {\n return false;\n }\n\n try {\n return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;\n } catch (e) {\n // Fallback for any other objects that might cause RangeError with Object.keys()\n return false;\n }\n};\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a React Native Blob\n * React Native \"blob\": an object with a `uri` attribute. Optionally, it can\n * also have a `name` and `type` attribute to specify filename and content type\n *\n * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71\n *\n * @param {*} value The value to test\n *\n * @returns {boolean} True if value is a React Native Blob, otherwise false\n */\nconst isReactNativeBlob = (value) => {\n return !!(value && typeof value.uri !== 'undefined');\n};\n\n/**\n * Determine if environment is React Native\n * ReactNative `FormData` has a non-standard `getParts()` method\n *\n * @param {*} formData The formData to test\n *\n * @returns {boolean} True if environment is React Native, otherwise false\n */\nconst isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a FileList, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\nconst isSet = kindOfTest('Set');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction getGlobal() {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n return {};\n}\n\nconst G = getGlobal();\nconst FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;\n\nconst isFormData = (thing) => {\n if (!thing) return false;\n if (FormDataCtor && thing instanceof FormDataCtor) return true;\n // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.\n const proto = getPrototypeOf(thing);\n if (!proto || proto === Object.prototype) return false;\n if (!isFunction(thing.append)) return false;\n const kind = kindOf(thing);\n return (\n kind === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n );\n};\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = [\n 'ReadableStream',\n 'Request',\n 'Response',\n 'Headers',\n].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => {\n return str.trim ? str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n};\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array<unknown>} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Object} [options]\n * @param {Boolean} [options.allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, { allOwnKeys = false } = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Buffer check\n if (isBuffer(obj)) {\n return;\n }\n\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\n/**\n * Finds a key in an object, case-insensitive, returning the actual key name.\n * Returns null if the object is a Buffer or if no match is found.\n *\n * @param {Object} obj - The object to search.\n * @param {string} key - The key to find (case-insensitive).\n * @returns {?string} The actual key name if found, otherwise null.\n */\nfunction findKey(obj, key) {\n if (isBuffer(obj)) {\n return null;\n }\n\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== 'undefined') return globalThis;\n return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * const result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(...objs) {\n const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};\n const result = {};\n const assignValue = (val, key) => {\n // Skip dangerous property names to prevent prototype pollution\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return;\n }\n\n // findKey lowercases the key, so caseless lookup only applies to strings —\n // symbol keys are identity-matched.\n const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;\n // Read via own-prop only — a bare `result[targetKey]` walks the prototype\n // chain, so a polluted Object.prototype value could surface here and get\n // copied into the merged result.\n const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;\n if (isPlainObject(existing) && isPlainObject(val)) {\n result[targetKey] = merge(existing, val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else if (!skipUndefined || !isUndefined(val)) {\n result[targetKey] = val;\n }\n };\n\n for (let i = 0, l = objs.length; i < l; i++) {\n const source = objs[i];\n if (!source || isBuffer(source)) {\n continue;\n }\n\n forEach(source, assignValue);\n\n if (typeof source !== 'object' || isArray(source)) {\n continue;\n }\n\n const symbols = Object.getOwnPropertySymbols(source);\n for (let j = 0; j < symbols.length; j++) {\n const symbol = symbols[j];\n if (propertyIsEnumerable.call(source, symbol)) {\n assignValue(source[symbol], symbol);\n }\n }\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Object} [options]\n * @param {Boolean} [options.allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, { allOwnKeys } = {}) => {\n forEach(\n b,\n (val, key) => {\n if (thisArg && isFunction(val)) {\n Object.defineProperty(a, key, {\n // Null-proto descriptor so a polluted Object.prototype.get cannot\n // hijack defineProperty's accessor-vs-data resolution.\n __proto__: null,\n value: bind(val, thisArg),\n writable: true,\n enumerable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(a, key, {\n __proto__: null,\n value: val,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n },\n { allOwnKeys }\n );\n return a;\n};\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xfeff) {\n content = content.slice(1);\n }\n return content;\n};\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n Object.defineProperty(constructor.prototype, 'constructor', {\n __proto__: null,\n value: constructor,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n Object.defineProperty(constructor, 'super', {\n __proto__: null,\n value: superConstructor.prototype,\n });\n props && Object.assign(constructor.prototype, props);\n};\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n};\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n};\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n};\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = ((TypedArray) => {\n // eslint-disable-next-line func-names\n return (thing) => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object<any, any>} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[iterator];\n\n const _iterator = generator.call(obj);\n\n let result;\n\n while ((result = _iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n};\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array<boolean>}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n};\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = (str) => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g, function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n });\n};\n\nconst { propertyIsEnumerable } = Object.prototype;\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n};\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].includes(name)) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error(\"Can not rewrite read-only method '\" + name + \"'\");\n };\n }\n });\n};\n\n/**\n * Converts an array or a delimited string into an object set with values as keys and true as values.\n * Useful for fast membership checks.\n *\n * @param {Array|string} arrayOrString - The array or string to convert.\n * @param {string} delimiter - The delimiter to use if input is a string.\n * @returns {Object} An object with keys from the array or string, values set to true.\n */\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach((value) => {\n obj[value] = true;\n });\n };\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n};\n\nconst noop = () => {};\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite((value = +value)) ? value : defaultValue;\n};\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(\n thing &&\n isFunction(thing.append) &&\n thing[toStringTag] === 'FormData' &&\n thing[iterator]\n );\n}\n\n/**\n * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.\n *\n * @param {Object} obj - The object to convert.\n * @returns {Object} The JSON-compatible object.\n */\nconst toJSONObject = (obj) => {\n const visited = new WeakSet();\n\n const visit = (source) => {\n if (isObject(source)) {\n if (visited.has(source)) {\n return;\n }\n\n //Buffer check\n if (isBuffer(source)) {\n return source;\n }\n\n if (!('toJSON' in source)) {\n // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).\n visited.add(source);\n\n let target;\n\n if (isSet(source)) {\n target = [];\n for (const value of source) {\n const reducedValue = visit(value);\n !isUndefined(reducedValue) && target.push(reducedValue);\n }\n } else {\n target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n }\n\n visited.delete(source);\n\n return target;\n }\n }\n\n return source;\n };\n\n return visit(obj);\n};\n\n/**\n * Determines if a value is an async function.\n *\n * @param {*} thing - The value to test.\n * @returns {boolean} True if value is an async function, otherwise false.\n */\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\n/**\n * Determines if a value is thenable (has then and catch methods).\n *\n * @param {*} thing - The value to test.\n * @returns {boolean} True if value is thenable, otherwise false.\n */\nconst isThenable = (thing) =>\n thing &&\n (isObject(thing) || isFunction(thing)) &&\n isFunction(thing.then) &&\n isFunction(thing.catch);\n\n// original code\n// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34\n\n/**\n * Provides a cross-platform setImmediate implementation.\n * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.\n *\n * @param {boolean} setImmediateSupported - Whether setImmediate is supported.\n * @param {boolean} postMessageSupported - Whether postMessage is supported.\n * @returns {Function} A function to schedule a callback asynchronously.\n */\nconst _setImmediate = ((setImmediateSupported, postMessageSupported) => {\n if (setImmediateSupported) {\n return setImmediate;\n }\n\n return postMessageSupported\n ? ((token, callbacks) => {\n _global.addEventListener(\n 'message',\n ({ source, data }) => {\n if (source === _global && data === token) {\n callbacks.length && callbacks.shift()();\n }\n },\n false\n );\n\n return (cb) => {\n callbacks.push(cb);\n _global.postMessage(token, '*');\n };\n })(`axios@${Math.random()}`, [])\n : (cb) => setTimeout(cb);\n})(typeof setImmediate === 'function', isFunction(_global.postMessage));\n\n/**\n * Schedules a microtask or asynchronous callback as soon as possible.\n * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.\n *\n * @type {Function}\n */\nconst asap =\n typeof queueMicrotask !== 'undefined'\n ? queueMicrotask.bind(_global)\n : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;\n\n// *********************\n\nconst isIterable = (thing) => thing != null && isFunction(thing[iterator]);\n\n/**\n * Determine if a value is iterable via an iterator that is NOT sourced solely\n * from a polluted Object.prototype. Use this instead of `isIterable` whenever\n * the iterable comes from untrusted input (e.g. user-supplied header sources),\n * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object\n * into an attacker-controlled entries iterator.\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value has a non-polluted iterator\n */\nconst isSafeIterable = (thing) =>\n thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isEmptyObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isReactNativeBlob,\n isReactNative,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n hasOwnInPrototypeChain,\n getSafeProp,\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable,\n setImmediate: _setImmediate,\n asap,\n isIterable,\n isSafeIterable,\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age',\n 'authorization',\n 'content-length',\n 'content-type',\n 'etag',\n 'expires',\n 'from',\n 'host',\n 'if-modified-since',\n 'if-unmodified-since',\n 'last-modified',\n 'location',\n 'max-forwards',\n 'proxy-authorization',\n 'referer',\n 'retry-after',\n 'user-agent',\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default (rawHeaders) => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders &&\n rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n const hasKey = utils.hasOwnProp(parsed, key);\n\n if (!key || (hasKey && utils.hasOwnProp(ignoreDuplicateOf, key))) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (hasKey) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = hasKey ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\nfunction trimSPorHTAB(str) {\n let start = 0;\n let end = str.length;\n\n while (start < end) {\n const code = str.charCodeAt(start);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n start += 1;\n }\n\n while (end > start) {\n const code = str.charCodeAt(end - 1);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n end -= 1;\n }\n\n return start === 0 && end === str.length ? str : str.slice(start, end);\n}\n\n// The control-code ranges are intentional: header sanitization strips C0/DEL bytes.\n// eslint-disable-next-line no-control-regex\nconst INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\\\u0000-\\\\u0008\\\\u000a-\\\\u001f\\\\u007f]+', 'g');\n// eslint-disable-next-line no-control-regex\nconst INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\\\u0009\\\\u0020-\\\\u007e\\\\u0080-\\\\u00ff]+', 'g');\n\nfunction sanitizeValue(value, invalidChars) {\n if (utils.isArray(value)) {\n return value.map((item) => sanitizeValue(item, invalidChars));\n }\n\n return trimSPorHTAB(String(value).replace(invalidChars, ''));\n}\n\nexport const sanitizeHeaderValue = (value) =>\n sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);\n\nexport const sanitizeByteStringHeaderValue = (value) =>\n sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);\n\nexport function toByteStringHeaderObject(headers) {\n const byteStringHeaders = Object.create(null);\n\n utils.forEach(headers.toJSON(), (value, header) => {\n byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);\n });\n\n return byteStringHeaders;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\nimport { sanitizeHeaderValue } from '../helpers/sanitizeHeaderValue.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst parameterNameRE = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nfunction trimOWS(value) {\n let start = 0;\n let end = value.length;\n\n while (start < end) {\n const code = value.charCodeAt(start);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n start += 1;\n }\n\n while (end > start) {\n const code = value.charCodeAt(end - 1);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n end -= 1;\n }\n\n return start === 0 && end === value.length ? value : value.slice(start, end);\n}\n\nfunction decodeQuotedString(value) {\n const last = value.length - 1;\n\n if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {\n return value;\n }\n\n let decoded = '';\n\n for (let i = 1; i < last; i++) {\n const code = value.charCodeAt(i);\n\n if (code === 0x22) {\n return value;\n }\n\n if (code === 0x5c) {\n i += 1;\n\n if (i >= last) {\n return value;\n }\n }\n\n decoded += value[i];\n }\n\n return decoded;\n}\n\nfunction parseParameters(value) {\n const parameters = Object.create(null);\n const str = String(value);\n let start = 0;\n let quoted = false;\n let escaped = false;\n\n function parseParameter(end) {\n const part = trimOWS(str.slice(start, end));\n const equals = part.indexOf('=');\n\n if (equals < 1) {\n return;\n }\n\n const name = trimOWS(part.slice(0, equals));\n\n if (!parameterNameRE.test(name)) {\n return;\n }\n\n const normalizedName = name.toLowerCase();\n\n if (\n normalizedName === '__proto__' ||\n normalizedName === 'constructor' ||\n normalizedName === 'prototype'\n ) {\n return;\n }\n\n const parameterValue = trimOWS(part.slice(equals + 1));\n parameters[normalizedName] = decodeQuotedString(parameterValue);\n }\n\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (quoted) {\n if (escaped) {\n escaped = false;\n } else if (code === 0x5c) {\n escaped = true;\n } else if (code === 0x22) {\n quoted = false;\n }\n } else if (code === 0x22) {\n quoted = true;\n } else if (code === 0x2c || code === 0x3b) {\n parseParameter(i);\n start = i + 1;\n }\n }\n\n parseParameter(str.length);\n\n return parameters;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header\n .trim()\n .toLowerCase()\n .replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach((methodName) => {\n Object.defineProperty(obj, methodName + accessorName, {\n // Null-proto descriptor so a polluted Object.prototype.get cannot turn\n // this data descriptor into an accessor descriptor on the way in.\n __proto__: null,\n value: function (arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true,\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n return;\n }\n\n const key = utils.findKey(self, lHeader);\n\n if (\n !key ||\n self[key] === undefined ||\n _rewrite === true ||\n (_rewrite === undefined && self[key] !== false)\n ) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite);\n } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isObject(header) && utils.isSafeIterable(header)) {\n let obj = Object.create(null),\n dest,\n key;\n for (const entry of header) {\n if (!utils.isArray(entry)) {\n throw new TypeError('Object iterator must return a key-value pair');\n }\n\n key = entry[0];\n\n if (utils.hasOwnProp(obj, key)) {\n dest = obj[key];\n obj[key] = utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];\n } else {\n obj[key] = entry[1];\n }\n }\n\n setHeaders(obj, valueOrRewrite);\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(\n key &&\n this[key] !== undefined &&\n (!matcher || matchHeaderValue(this, this[key], key, matcher))\n );\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null &&\n value !== false &&\n (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON())\n .map(([header, value]) => header + ': ' + value)\n .join('\\n');\n }\n\n getSetCookie() {\n const value = this.get('set-cookie');\n return utils.isArray(value) ? value : value == null || value === false ? [] : [value];\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static parseParameters(value) {\n return parseParameters(value);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals =\n (this[$internals] =\n this[$internals] =\n {\n accessors: {},\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor([\n 'Content-Type',\n 'Content-Length',\n 'Accept',\n 'Accept-Encoding',\n 'User-Agent',\n 'Authorization',\n]);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n },\n };\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nexport const REDACTED = '[REDACTED ****]';\n\nfunction hasOwnOrPrototypeToJSON(source) {\n if (utils.hasOwnProp(source, 'toJSON')) {\n return true;\n }\n\n let prototype = Object.getPrototypeOf(source);\n\n while (prototype && prototype !== Object.prototype) {\n if (utils.hasOwnProp(prototype, 'toJSON')) {\n return true;\n }\n\n prototype = Object.getPrototypeOf(prototype);\n }\n\n return false;\n}\n\n// Build a plain-object snapshot of `config` and replace the value of any key\n// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays\n// and AxiosHeaders, and short-circuits on circular references.\nfunction redactConfig(config, redactKeys) {\n const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));\n const seen = [];\n\n const visit = (source) => {\n if (source === null || typeof source !== 'object') return source;\n if (utils.isBuffer(source)) return source;\n if (seen.indexOf(source) !== -1) return undefined;\n\n if (source instanceof AxiosHeaders) {\n source = source.toJSON();\n }\n\n seen.push(source);\n\n let result;\n if (utils.isArray(source)) {\n result = [];\n source.forEach((v, i) => {\n const reducedValue = visit(v);\n if (!utils.isUndefined(reducedValue)) {\n result[i] = reducedValue;\n }\n });\n } else {\n if (!utils.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {\n seen.pop();\n return source;\n }\n\n result = Object.create(null);\n for (const [key, value] of Object.entries(source)) {\n const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);\n if (!utils.isUndefined(reducedValue)) {\n result[key] = reducedValue;\n }\n }\n }\n\n seen.pop();\n return result;\n };\n\n return visit(config);\n}\n\nfunction stringifySafely(value) {\n try {\n return String(value);\n } catch (err) {\n return '';\n }\n}\n\nfunction aggregateErrorMessage(error) {\n const message = error.errors\n .map((entry) => {\n try {\n return entry && entry.message ? stringifySafely(entry.message) : stringifySafely(entry);\n } catch (err) {\n return '';\n }\n })\n .filter(Boolean)\n .join('; ');\n\n return message || error.name || 'AggregateError';\n}\n\nclass AxiosError extends Error {\n static from(error, code, config, request, response, customProps) {\n // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection\n // failures) has an empty `message`; its detail lives in `errors[]`. Without\n // this, the wrapped error surfaces with a blank message (see #6721).\n let message = error.message;\n if (!message && utils.isArray(error.errors) && error.errors.length) {\n message = aggregateErrorMessage(error);\n }\n\n const axiosError = new AxiosError(message, code || error.code, config, request, response);\n // Match native `Error` `cause` semantics: non-enumerable. The wrapped\n // error often carries circular internals (sockets, requests, agents), so\n // an enumerable `cause` makes structured loggers (pino/winston) and any\n // own-property walk throw \"Converting circular structure to JSON\".\n // Regression from #6982; see #7205. `__proto__: null` mirrors the\n // `message` descriptor below (prototype-pollution-safe descriptor).\n Object.defineProperty(axiosError, 'cause', {\n __proto__: null,\n value: error,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n axiosError.name = error.name;\n\n // Preserve status from the original error if not already set from response\n if (error.status != null && axiosError.status == null) {\n axiosError.status = error.status;\n }\n\n customProps && Object.assign(axiosError, customProps);\n return axiosError;\n }\n\n /**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\n constructor(message, code, config, request, response) {\n super(message);\n\n // Make message enumerable to maintain backward compatibility\n // The native Error constructor sets message as non-enumerable,\n // but axios < v1.13.3 had it as enumerable\n Object.defineProperty(this, 'message', {\n // Null-proto descriptor so a polluted Object.prototype.get cannot turn\n // this data descriptor into an accessor descriptor on the way in.\n __proto__: null,\n value: message,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n\n this.name = 'AxiosError';\n this.isAxiosError = true;\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n if (response) {\n this.response = response;\n this.status = response.status;\n }\n }\n\n toJSON() {\n // Opt-in redaction: when the request config carries a `redact` array, the\n // value of any matching key (case-insensitive, at any depth) is replaced\n // with REDACTED in the serialized snapshot. Undefined or empty leaves the\n // existing serialization behavior unchanged.\n const config = this.config;\n const redactKeys = config && utils.hasOwnProp(config, 'redact') ? config.redact : undefined;\n const serializedConfig =\n utils.isArray(redactKeys) && redactKeys.length > 0\n ? redactConfig(config, redactKeys)\n : utils.toJSONObject(config);\n\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: serializedConfig,\n code: this.code,\n status: this.status,\n };\n }\n}\n\n// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.\nAxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';\nAxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';\nAxiosError.ECONNABORTED = 'ECONNABORTED';\nAxiosError.ETIMEDOUT = 'ETIMEDOUT';\nAxiosError.ECONNREFUSED = 'ECONNREFUSED';\nAxiosError.ERR_NETWORK = 'ERR_NETWORK';\nAxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';\nAxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';\nAxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';\nAxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';\nAxiosError.ERR_CANCELED = 'ERR_CANCELED';\nAxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';\nAxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';\nAxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\nimport PlatformBuffer from '../platform/node/classes/Buffer.js';\n\n// Default nesting limit shared with the inverse transform (formDataToJSON) so\n// the FormData <-> JSON round-trip stays symmetric.\nexport const DEFAULT_FORM_DATA_MAX_DEPTH = 100;\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path\n .concat(key)\n .map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n })\n .join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array<any>} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object<any, any>} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object<string, any>} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(\n options,\n {\n metaTokens: true,\n dots: false,\n indexes: false,\n },\n false,\n function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n }\n );\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);\n const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n const stack = [];\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (utils.isBoolean(value)) {\n return value.toString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n if (useBlob && typeof _Blob === 'function') {\n return new _Blob([value]);\n }\n if (PlatformBuffer && PlatformBuffer.isBufferAvailable()) {\n return PlatformBuffer.from(value);\n }\n throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT);\n }\n\n return value;\n }\n\n function throwIfMaxDepthExceeded(depth) {\n if (depth > maxDepth) {\n throw new AxiosError(\n 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,\n AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED\n );\n }\n }\n\n function stringifyWithDepthLimit(value, depth) {\n if (maxDepth === Infinity) {\n return JSON.stringify(value);\n }\n\n const ancestors = [];\n\n return JSON.stringify(value, function limitDepth(_key, currentValue) {\n if (!utils.isObject(currentValue)) {\n return currentValue;\n }\n\n while (ancestors.length && ancestors[ancestors.length - 1] !== this) {\n ancestors.pop();\n }\n\n ancestors.push(currentValue);\n throwIfMaxDepthExceeded(depth + ancestors.length - 1);\n\n return currentValue;\n });\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array<String|Number>} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (utils.isReactNative(formData) && utils.isReactNativeBlob(value)) {\n formData.append(renderKey(path, key, dots), convertValue(value));\n return false;\n }\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = stringifyWithDepthLimit(value, 1);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)))\n ) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) &&\n formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true\n ? renderKey([key], index, dots)\n : indexes === null\n ? key\n : key + '[]',\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable,\n });\n\n function build(value, path, depth = 0) {\n if (utils.isUndefined(value)) return;\n\n throwIfMaxDepthExceeded(depth);\n\n if (stack.indexOf(value) !== -1) {\n throw new Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result =\n !(utils.isUndefined(el) || el === null) &&\n visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key], depth + 1);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object<string, any>} params - The parameters to be converted to a FormData object.\n * @param {Object<string, any>} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder\n ? (value) => encoder.call(this, value, encode)\n : encode;\n\n return this._pairs\n .map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '')\n .join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from './AxiosURLSearchParams.js';\n\n/**\n * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with\n * their plain counterparts (`:`, `$`, `,`, `+`).\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nexport function encode(val) {\n return encodeURIComponent(val)\n .replace(/%3A/gi, ':')\n .replace(/%24/g, '$')\n .replace(/%2C/gi, ',')\n .replace(/%20/g, '+');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?(object|Function)} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n if (!params) {\n return url;\n }\n url = url || '';\n\n const _options = utils.isFunction(options)\n ? {\n serialize: options,\n }\n : options;\n\n // Read serializer options pollution-safely: own properties and methods on a\n // class/template prototype are honored, but values injected onto a polluted\n // Object.prototype are ignored.\n const _encode = utils.getSafeProp(_options, 'encode') || encode;\n const serializeFn = utils.getSafeProp(_options, 'serialize');\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, _options);\n } else {\n serializedParams = utils.isURLSearchParams(params)\n ? params.toString()\n : new AxiosURLSearchParams(params, _options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf('#');\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n * @param {Object} options The options for the interceptor, synchronous and runWhen\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null,\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {void}\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false,\n legacyInterceptorReqResOrdering: true,\n advertiseZstdAcceptEncoding: false,\n validateStatusUndefinedResolves: true,\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict';\n\nexport default typeof Blob !== 'undefined' ? Blob : null;\n","import URLSearchParams from './classes/URLSearchParams.js';\nimport FormData from './classes/FormData.js';\nimport Blob from './classes/Blob.js';\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob,\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\nconst _navigator = (typeof navigator === 'object' && navigator) || undefined;\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv =\n hasBrowserEnv &&\n (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = (hasBrowserEnv && window.location.href) || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n _navigator as navigator,\n origin,\n};\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform,\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), {\n visitor: function (value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n },\n ...options,\n });\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport { DEFAULT_FORM_DATA_MAX_DEPTH } from './toFormData.js';\n\nconst MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;\n\nfunction throwIfDepthExceeded(index) {\n if (index > MAX_DEPTH) {\n throw new AxiosError(\n 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,\n AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED\n );\n }\n}\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z] -> ['foo', 'x', 'y', 'z']\n // foo.x.y.z -> ['foo', 'x', 'y', 'z']\n // A path is split on `.` and on `[...]` groups. A segment — whether written\n // in dot notation or captured inside brackets — may contain any character\n // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept\n // literal instead of being split (#5402). `.`, `[` and `]` keep their existing\n // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.\n // Excluding `[` from the bracket group also makes the match fail fast at the\n // next `[`, so a malformed name cannot rescan to the end of the string from\n // every unmatched `[` — parsing stays linear in the length of the name.\n const path = [];\n const pattern = /[^.[\\]]+|\\[([^.[\\]]*)]/g;\n let match;\n\n while ((match = pattern.exec(name)) !== null) {\n throwIfDepthExceeded(path.length);\n path.push(match[0] === '[]' ? '' : match[1] || match[0]);\n }\n\n return path;\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array<any>} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object<string, any> | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n throwIfDepthExceeded(index);\n\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = utils.isArray(target[name])\n ? target[name].concat(value)\n : [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!utils.hasOwnProp(target, name) || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\nconst own = (obj, key) => (obj != null && utils.hasOwnProp(obj, key) ? obj[key] : undefined);\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [\n function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n const formSerializer = own(this, 'formSerializer');\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, formSerializer).toString();\n }\n\n if (\n (isFileList = utils.isFileList(data)) ||\n contentType.indexOf('multipart/form-data') > -1\n ) {\n const env = own(this, 'env');\n const _FormData = env && env.FormData;\n\n return toFormData(\n isFileList ? { 'files[]': data } : data,\n _FormData && new _FormData(),\n formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n },\n ],\n\n transformResponse: [\n function transformResponse(data) {\n const transitional = own(this, 'transitional') || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const responseType = own(this, 'responseType');\n const JSONRequested = responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (\n data &&\n utils.isString(data) &&\n ((forcedJSONParsing && !responseType) || JSONRequested)\n ) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data, own(this, 'parseReviver'));\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));\n }\n throw e;\n }\n }\n }\n\n return data;\n },\n ],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob,\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': undefined,\n },\n },\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from '../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\n\nclass CanceledError extends AxiosError {\n /**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\n constructor(message, config, request) {\n super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n this.__CANCEL__ = true;\n }\n}\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25}):(?:\\/\\/)?/.exec(url);\n return (match && match[1]) || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round((bytesCount * 1000) / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n let threshold = 1000 / freq;\n let lastArgs;\n let timer;\n\n const invoke = (args, now = Date.now()) => {\n timestamp = now;\n lastArgs = null;\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n fn(...args);\n };\n\n const throttled = (...args) => {\n const now = Date.now();\n const passed = now - timestamp;\n if (passed >= threshold) {\n invoke(args, now);\n } else {\n lastArgs = args;\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n invoke(lastArgs);\n }, threshold - passed);\n }\n }\n };\n\n const flush = () => lastArgs && invoke(lastArgs);\n\n return [throttled, flush];\n}\n\nexport default throttle;\n","import speedometer from './speedometer.js';\nimport throttle from './throttle.js';\nimport utils from '../utils.js';\n\nexport const progressEventReducer = (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle((e) => {\n if (!e || typeof e.loaded !== 'number') {\n return;\n }\n const rawLoaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);\n const progressBytes = Math.max(0, loaded - bytesNotified);\n const rate = _speedometer(progressBytes);\n\n bytesNotified = Math.max(bytesNotified, loaded);\n\n const data = {\n loaded,\n total,\n progress: total ? loaded / total : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null,\n [isDownloadStream ? 'download' : 'upload']: true,\n };\n\n listener(data);\n }, freq);\n};\n\nexport const progressEventDecorator = (total, throttled) => {\n const lengthComputable = total != null;\n\n return [\n (loaded) =>\n throttled[0]({\n lengthComputable,\n total,\n loaded,\n }),\n throttled[1],\n ];\n};\n\nexport const asyncDecorator =\n (fn, scheduler = utils.asap) =>\n (...args) =>\n scheduler(() => fn(...args));\n","import platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv\n ? ((origin, isMSIE) => (url) => {\n url = new URL(url, platform.origin);\n\n return (\n origin.protocol === url.protocol &&\n origin.host === url.host &&\n (isMSIE || origin.port === url.port)\n );\n })(\n new URL(platform.origin),\n platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)\n )\n : () => true;\n","import utils from '../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv\n ? // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure, sameSite) {\n if (typeof document === 'undefined') return;\n\n const cookie = [`${name}=${encodeURIComponent(value)}`];\n\n if (utils.isNumber(expires)) {\n cookie.push(`expires=${new Date(expires).toUTCString()}`);\n }\n if (utils.isString(path)) {\n cookie.push(`path=${path}`);\n }\n if (utils.isString(domain)) {\n cookie.push(`domain=${domain}`);\n }\n if (secure === true) {\n cookie.push('secure');\n }\n if (utils.isString(sameSite)) {\n cookie.push(`SameSite=${sameSite}`);\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n if (typeof document === 'undefined') return null;\n // Match name=value by splitting on the semicolon separator instead of building a\n // RegExp from `name` — interpolating an unescaped string into a RegExp would let\n // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or\n // match the wrong cookie. Browsers may serialize cookie pairs as either \";\" or\n // \"; \", so ignore optional whitespace before each cookie name.\n const cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].replace(/^\\s+/, '');\n const eq = cookie.indexOf('=');\n if (eq !== -1 && cookie.slice(0, eq) === name) {\n try {\n return decodeURIComponent(cookie.slice(eq + 1));\n } catch (e) {\n return cookie.slice(eq + 1);\n }\n }\n }\n return null;\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000, '/');\n },\n }\n : // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {},\n };\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n if (typeof url !== 'string') {\n return false;\n }\n\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n if (!relativeURL) {\n return baseURL;\n }\n\n let end = baseURL.length;\n\n while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {\n end--;\n }\n\n return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\\/+/, '');\n}\n","'use strict';\n\nimport AxiosError, { REDACTED } from './AxiosError.js';\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\nconst malformedHttpProtocol = /^https?:(?!\\/\\/)/i;\nconst httpProtocolControlCharacters = /[\\t\\n\\r]/g;\n\nfunction stripLeadingC0ControlOrSpace(url) {\n let i = 0;\n while (i < url.length && url.charCodeAt(i) <= 0x20) {\n i++;\n }\n return url.slice(i);\n}\n\nfunction normalizeURLForProtocolCheck(url) {\n return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');\n}\n\n// Redact the parts of a URL that can carry secrets before it is embedded in an\n// error message. AxiosError.toJSON() serializes `message` verbatim and errors\n// are commonly logged, while the opt-in `config.redact` model only cleans\n// config keys — it cannot reach the message. Redact only the genuinely\n// sensitive substrings — userinfo (credentials), query parameter values and\n// fragment contents — with the same REDACTED marker the config redaction uses,\n// while keeping the scheme, host, path and parameter names so the offending\n// request stays accurately identifiable.\nfunction redactFragment(fragment) {\n if (!fragment) {\n return fragment;\n }\n\n return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {\n return `${separator}${parameterName}${REDACTED}`;\n });\n}\n\nfunction redactSensitiveURLParts(url) {\n const redactedURL = url.replace(/^(https?:\\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);\n const fragmentIndex = redactedURL.indexOf('#');\n const urlWithoutFragment =\n fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);\n const redactedURLWithoutFragment = urlWithoutFragment.replace(\n /([?&][^=&#]*=)[^&#]*/g,\n `$1${REDACTED}`\n );\n\n if (fragmentIndex === -1) {\n return redactedURLWithoutFragment;\n }\n\n return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;\n}\n\nfunction assertValidHttpProtocolURL(url, config) {\n if (typeof url === 'string') {\n const normalizedURL = normalizeURLForProtocolCheck(url);\n if (malformedHttpProtocol.test(normalizedURL)) {\n throw new AxiosError(\n `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing \"//\" after protocol`,\n AxiosError.ERR_INVALID_URL,\n config\n );\n }\n }\n}\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {\n assertValidHttpProtocolURL(requestedURL, config);\n let isRelativeUrl = !isAbsoluteURL(requestedURL);\n if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {\n assertValidHttpProtocolURL(baseURL, config);\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);\n\nconst ownEnumerableKeys = (thing) => {\n if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {\n return Object.keys(thing).concat(\n Object.getOwnPropertySymbols(thing).filter(\n (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable\n )\n );\n }\n return Object.keys(thing);\n};\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config1 = config1 || {};\n config2 = config2 || {};\n\n // Use a null-prototype object so that downstream reads such as `config.auth`\n // or `config.baseURL` cannot inherit polluted values from Object.prototype.\n // `hasOwnProperty` is restored as a non-enumerable own slot to preserve\n // ergonomics for user code that relies on it.\n const config = Object.create(null);\n Object.defineProperty(config, 'hasOwnProperty', {\n // Null-proto descriptor so a polluted Object.prototype.get cannot turn\n // this data descriptor into an accessor descriptor on the way in.\n __proto__: null,\n value: Object.prototype.hasOwnProperty,\n enumerable: false,\n writable: true,\n configurable: true,\n });\n\n function getMergedValue(target, source, prop, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({ caseless }, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(a, b, prop, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, prop, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, prop, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n function getMergedTransitionalOption(prop) {\n const transitional2 = utils.hasOwnProp(config2, 'transitional')\n ? config2.transitional\n : undefined;\n\n if (!utils.isUndefined(transitional2)) {\n if (utils.isPlainObject(transitional2)) {\n if (utils.hasOwnProp(transitional2, prop)) {\n return transitional2[prop];\n }\n } else {\n return undefined;\n }\n }\n\n const transitional1 = utils.hasOwnProp(config1, 'transitional')\n ? config1.transitional\n : undefined;\n\n if (utils.isPlainObject(transitional1) && utils.hasOwnProp(transitional1, prop)) {\n return transitional1[prop];\n }\n\n return undefined;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (utils.hasOwnProp(config2, prop)) {\n return getMergedValue(a, b);\n } else if (utils.hasOwnProp(config1, prop)) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n allowedSocketPaths: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b, prop) =>\n mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),\n };\n\n utils.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {\n if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;\n const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;\n const a = utils.hasOwnProp(config1, prop) ? config1[prop] : undefined;\n const b = utils.hasOwnProp(config2, prop) ? config2[prop] : undefined;\n const configValue = merge(a, b, prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n if (\n utils.hasOwnProp(config2, 'validateStatus') &&\n utils.isUndefined(config2.validateStatus) &&\n getMergedTransitionalOption('validateStatusUndefinedResolves') === false\n ) {\n if (utils.hasOwnProp(config1, 'validateStatus')) {\n config.validateStatus = getMergedValue(undefined, config1.validateStatus);\n } else {\n delete config.validateStatus;\n }\n }\n\n return config;\n}\n","'use strict';\n\nconst FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];\n\n/**\n * Apply the headers generated by a FormData implementation to the request headers,\n * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the\n * content-* headers; otherwise merge all of them.\n *\n * @param {AxiosHeaders} headers - the request headers to mutate\n * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation\n * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value\n *\n * @returns {void}\n */\nexport default function setFormDataHeaders(headers, formHeaders, policy) {\n if (policy !== 'content-only') {\n headers.set(formHeaders);\n return;\n }\n\n Object.entries(formHeaders || {}).forEach(([key, val]) => {\n if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {\n headers.set(key, val);\n }\n });\n}\n","import platform from '../platform/index.js';\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport isURLSameOrigin from './isURLSameOrigin.js';\nimport cookies from './cookies.js';\nimport buildFullPath from '../core/buildFullPath.js';\nimport mergeConfig from '../core/mergeConfig.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport setFormDataHeaders from '../core/setFormDataHeaders.js';\nimport buildURL from './buildURL.js';\n\n/**\n * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().\n * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.\n *\n * @param {string} str The string to encode\n *\n * @returns {string} UTF-8 bytes as a Latin-1 string\n */\nconst encodeUTF8 = (str) =>\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>\n String.fromCharCode(parseInt(hex, 16))\n );\n\nfunction resolveConfig(config) {\n const newConfig = mergeConfig({}, config);\n\n // Read only own properties to prevent prototype pollution gadgets\n // (e.g. Object.prototype.baseURL = 'https://evil.com').\n const own = (key) => (utils.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);\n\n const data = own('data');\n let withXSRFToken = own('withXSRFToken');\n const xsrfHeaderName = own('xsrfHeaderName');\n const xsrfCookieName = own('xsrfCookieName');\n let headers = own('headers');\n const auth = own('auth');\n const baseURL = own('baseURL');\n const allowAbsoluteUrls = own('allowAbsoluteUrls');\n const url = own('url');\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(\n buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),\n own('params'),\n own('paramsSerializer')\n );\n\n // HTTP basic authentication\n if (auth) {\n const username = utils.getSafeProp(auth, 'username') || '';\n const password = utils.getSafeProp(auth, 'password') || '';\n\n try {\n headers.set(\n 'Authorization',\n 'Basic ' + btoa(username + ':' + (password ? encodeUTF8(password) : ''))\n );\n } catch (e) {\n throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);\n }\n }\n\n if (utils.isFormData(data)) {\n if (\n platform.hasStandardBrowserEnv ||\n platform.hasStandardBrowserWebWorkerEnv ||\n utils.isReactNative(data)\n ) {\n headers.setContentType(undefined); // browser/web worker/RN handles it\n } else if (utils.isFunction(data.getHeaders)) {\n // Node.js FormData (like form-data package)\n setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n if (utils.isFunction(withXSRFToken)) {\n withXSRFToken = withXSRFToken(newConfig);\n }\n\n // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)\n // and misconfigurations (e.g. \"false\") from short-circuiting the same-origin check and leaking\n // the XSRF token cross-origin.\n const shouldSendXSRF =\n withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));\n\n if (shouldSendXSRF) {\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\nexport default resolveConfig;\n","import utils from '../utils.js';\nimport settle from '../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport { progressEventReducer } from '../helpers/progressEventReducer.js';\nimport resolveConfig from '../helpers/resolveConfig.js';\nimport { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported &&\n function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let { responseType, onUploadProgress, onDownloadProgress } = _config;\n let onCanceled;\n let uploadThrottled, downloadThrottled;\n let flushUpload, flushDownload;\n\n function done() {\n flushUpload && flushUpload(); // flush events\n flushDownload && flushDownload(); // flush events\n\n _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);\n\n _config.signal && _config.signal.removeEventListener('abort', onCanceled);\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData =\n !responseType || responseType === 'text' || responseType === 'json'\n ? request.responseText\n : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request,\n };\n\n settle(\n function _resolve(value) {\n resolve(value);\n done();\n },\n function _reject(err) {\n reject(err);\n done();\n },\n response\n );\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (\n request.status === 0 &&\n !(request.responseURL && request.responseURL.startsWith('file:'))\n ) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n done();\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError(event) {\n // Browsers deliver a ProgressEvent in XHR onerror\n // (message may be empty; when present, surface it)\n // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event\n const msg = event && event.message ? event.message : 'Network Error';\n const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);\n // attach the underlying event for consumers who want details\n err.event = event || null;\n reject(err);\n done();\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout\n ? 'timeout of ' + _config.timeout + 'ms exceeded'\n : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(\n new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n request\n )\n );\n done();\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (onDownloadProgress) {\n [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);\n request.addEventListener('progress', downloadThrottled);\n }\n\n // Not all browsers support upload events\n if (onUploadProgress && request.upload) {\n [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);\n\n request.upload.addEventListener('progress', uploadThrottled);\n\n request.upload.addEventListener('loadend', flushUpload);\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = (cancel) => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n done();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted\n ? onCanceled()\n : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && !platform.protocols.includes(protocol)) {\n reject(\n new AxiosError(\n 'Unsupported protocol ' + protocol + ':',\n AxiosError.ERR_BAD_REQUEST,\n config\n )\n );\n done();\n return;\n }\n\n // Send the request\n request.send(requestData || null);\n });\n };\n","import CanceledError from '../cancel/CanceledError.js';\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\nconst composeSignals = (signals, timeout) => {\n signals = signals ? signals.filter(Boolean) : [];\n\n if (!timeout && !signals.length) {\n return;\n }\n\n const controller = new AbortController();\n\n let aborted = false;\n\n const onabort = function (reason) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = reason instanceof Error ? reason : this.reason;\n controller.abort(\n err instanceof AxiosError\n ? err\n : new CanceledError(err instanceof Error ? err.message : err)\n );\n }\n };\n\n let timer =\n timeout &&\n setTimeout(() => {\n timer = null;\n onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));\n }, timeout);\n\n const unsubscribe = () => {\n if (!signals) { return; }\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach((signal) => {\n signal.unsubscribe\n ? signal.unsubscribe(onabort)\n : signal.removeEventListener('abort', onabort);\n });\n signals = null;\n };\n\n signals.forEach((signal) => {\n if (aborted) {\n return;\n }\n\n if (signal.aborted) {\n onabort.call(signal);\n return;\n }\n\n signal.addEventListener('abort', onabort, { once: true });\n });\n\n const { signal } = controller;\n\n signal.unsubscribe = () => utils.asap(unsubscribe);\n\n return signal;\n};\n\nexport default composeSignals;\n","export const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n};\n\nexport const readBytes = async function* (iterable, chunkSize) {\n for await (const chunk of readStream(iterable)) {\n yield* streamChunk(chunk, chunkSize);\n }\n};\n\nconst readStream = async function* (stream) {\n if (stream[Symbol.asyncIterator]) {\n yield* stream;\n return;\n }\n\n const reader = stream.getReader();\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n yield value;\n }\n } finally {\n await reader.cancel();\n }\n};\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish) => {\n const iterator = readBytes(stream, chunkSize);\n\n let bytes = 0;\n let done;\n let _onFinish = (e) => {\n if (!done) {\n done = true;\n onFinish && onFinish(e);\n }\n };\n\n return new ReadableStream(\n {\n async pull(controller) {\n try {\n const { done, value } = await iterator.next();\n\n if (done) {\n _onFinish();\n controller.close();\n return;\n }\n\n let len = value.byteLength;\n if (onProgress) {\n let loadedBytes = (bytes += len);\n onProgress(loadedBytes);\n }\n controller.enqueue(new Uint8Array(value));\n } catch (err) {\n _onFinish(err);\n throw err;\n }\n },\n cancel(reason) {\n _onFinish(reason);\n return iterator.return();\n },\n },\n {\n highWaterMark: 2,\n }\n );\n};\n","/**\n * Estimate data: URL byte lengths *without* allocating large buffers.\n * - Fetch percent-decodes a base64 body before decoding it.\n * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the\n * raw body, including ignored characters and content after padding.\n * - Non-base64 data is percent-decoded and then encoded as UTF-8.\n */\nconst isHexDigit = (charCode) =>\n (charCode >= 48 && charCode <= 57) ||\n (charCode >= 65 && charCode <= 70) ||\n (charCode >= 97 && charCode <= 102);\n\nconst isPercentEncodedByte = (str, i, len) =>\n i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));\n\nconst hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);\n\nconst isBase64Char = (charCode) =>\n (charCode >= 65 && charCode <= 90) || // A-Z\n (charCode >= 97 && charCode <= 122) || // a-z\n (charCode >= 48 && charCode <= 57) || // 0-9\n charCode === 43 || // +\n charCode === 47 || // /\n charCode === 45 || // - (base64url)\n charCode === 95; // _ (base64url)\n\nconst isBase64Whitespace = (charCode) =>\n charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;\n\nconst base64Bytes = (significant) => {\n const groups = Math.floor(significant / 4);\n const remainder = significant % 4;\n return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);\n};\n\n// Buffer.byteLength(body, 'base64') uses the raw string length as an allocation\n// upper bound even when Buffer.from later ignores characters or stops at '='.\nconst estimateBase64BufferAllocation = (body) => {\n const len = body.length;\n let padding = 0;\n\n if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {\n padding++;\n\n if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {\n padding++;\n }\n }\n\n return Math.floor(((len - padding) * 3) / 4);\n};\n\nconst estimatePercentDecodedBase64Bytes = (body) => {\n const len = body.length;\n let significant = 0;\n let padding = 0;\n let invalid = false;\n\n for (let i = 0; i < len; i++) {\n let code = body.charCodeAt(i);\n\n if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {\n code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));\n i += 2;\n }\n\n if (isBase64Whitespace(code)) {\n continue;\n }\n\n if (code === 61 /* '=' */) {\n padding++;\n continue;\n }\n\n if (!isBase64Char(code) || padding > 0) {\n invalid = true;\n continue;\n }\n\n significant++;\n }\n\n // Fetch rejects malformed forgiving-base64 input. Returning the raw-size\n // allocation bound keeps that invalid input from becoming a pre-check bypass.\n if (\n invalid ||\n padding > 2 ||\n (padding > 0 && (significant + padding) % 4 !== 0) ||\n significant % 4 === 1\n ) {\n return estimateBase64BufferAllocation(body);\n }\n\n return base64Bytes(significant);\n};\n\nconst estimateDataURLBytes = (url, estimateBase64) => {\n if (!url || typeof url !== 'string') return 0;\n if (!url.startsWith('data:')) return 0;\n\n const comma = url.indexOf(',');\n if (comma < 0) return 0;\n\n const meta = url.slice(5, comma);\n const body = url.slice(comma + 1);\n const isBase64 = /;base64/i.test(meta);\n\n if (isBase64) {\n return estimateBase64(body);\n }\n\n // Compute UTF-8 byte length directly from UTF-16 code units without allocating\n // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).\n // Valid %XX triplets count as one decoded byte; this matches the bytes that\n // decodeURIComponent(body) would produce before Buffer re-encodes the string.\n let bytes = 0;\n for (let i = 0, len = body.length; i < len; i++) {\n const c = body.charCodeAt(i);\n if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {\n bytes += 1;\n i += 2;\n } else if (c < 0x80) {\n bytes += 1;\n } else if (c < 0x800) {\n bytes += 2;\n } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {\n const next = body.charCodeAt(i + 1);\n if (next >= 0xdc00 && next <= 0xdfff) {\n bytes += 4;\n i++;\n } else {\n bytes += 3;\n }\n } else {\n bytes += 3;\n }\n }\n return bytes;\n};\n\n/**\n * Estimate the percent-decoded payload size used by Fetch data: URLs.\n *\n * @param {string} url\n * @returns {number}\n */\nexport default function estimateDataURLDecodedBytes(url) {\n // Fetch removes URL fragments before processing a data: URL.\n const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;\n\n return estimateDataURLBytes(\n fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),\n estimatePercentDecodedBase64Bytes\n );\n}\n\n/**\n * Estimate the Buffer backing allocation used by Node's raw base64 decoder.\n *\n * @param {string} url\n * @returns {number}\n */\nexport function estimateDataURLBufferAllocation(url) {\n return estimateDataURLBytes(url, estimateBase64BufferAllocation);\n}\n","export const VERSION = \"1.19.0\";","import platform from '../platform/index.js';\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport composeSignals from '../helpers/composeSignals.js';\nimport { trackStream } from '../helpers/trackStream.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport {\n progressEventReducer,\n progressEventDecorator,\n asyncDecorator,\n} from '../helpers/progressEventReducer.js';\nimport resolveConfig from '../helpers/resolveConfig.js';\nimport settle from '../core/settle.js';\nimport estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';\nimport { VERSION } from '../env/data.js';\nimport { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst { isFunction } = utils;\n\n/**\n * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().\n * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.\n *\n * @param {string} str The string to encode\n *\n * @returns {string} UTF-8 bytes as a Latin-1 string\n */\nconst encodeUTF8 = (str) =>\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>\n String.fromCharCode(parseInt(hex, 16))\n );\n\n// Node's WHATWG URL parser returns `username` and `password` percent-encoded.\n// Decode before composing the `auth` option so credentials such as\n// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the\n// original value for malformed input so a bad encoding never throws.\nconst decodeURIComponentSafe = (value) => {\n if (!utils.isString(value)) {\n return value;\n }\n\n try {\n return decodeURIComponent(value);\n } catch (error) {\n return value;\n }\n};\n\nconst test = (fn, ...args) => {\n try {\n return !!fn(...args);\n } catch (e) {\n return false;\n }\n};\n\nconst maybeWithAuthCredentials = (url) => {\n const protocolIndex = url.indexOf('://');\n let urlToCheck = url;\n if (protocolIndex !== -1) {\n urlToCheck = urlToCheck.slice(protocolIndex + 3);\n }\n return urlToCheck.includes('@') || urlToCheck.includes(':');\n};\n\nconst factory = (env) => {\n const globalObject =\n utils.global !== undefined && utils.global !== null\n ? utils.global\n : globalThis;\n const { ReadableStream, TextEncoder } = globalObject;\n\n env = utils.merge.call(\n {\n skipUndefined: true,\n },\n {\n Request: globalObject.Request,\n Response: globalObject.Response,\n },\n env\n );\n\n const { fetch: envFetch, Request, Response } = env;\n const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';\n const isRequestSupported = isFunction(Request);\n const isResponseSupported = isFunction(Response);\n\n if (!isFetchSupported) {\n return false;\n }\n\n const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);\n\n const encodeText =\n isFetchSupported &&\n (typeof TextEncoder === 'function'\n ? (\n (encoder) => (str) =>\n encoder.encode(str)\n )(new TextEncoder())\n : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));\n\n const supportsRequestStream =\n isRequestSupported &&\n isReadableStreamSupported &&\n test(() => {\n let duplexAccessed = false;\n\n const request = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n });\n\n const hasContentType = request.headers.has('Content-Type');\n\n if (request.body != null) {\n request.body.cancel();\n }\n\n return duplexAccessed && !hasContentType;\n });\n\n const supportsResponseStream =\n isResponseSupported &&\n isReadableStreamSupported &&\n test(() => utils.isReadableStream(new Response('').body));\n\n const resolvers = {\n stream: supportsResponseStream && ((res) => res.body),\n };\n\n isFetchSupported &&\n (() => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {\n !resolvers[type] &&\n (resolvers[type] = (res, config) => {\n let method = res && res[type];\n\n if (method) {\n return method.call(res);\n }\n\n throw new AxiosError(\n `Response type '${type}' is not supported`,\n AxiosError.ERR_NOT_SUPPORT,\n config\n );\n });\n });\n })();\n\n const getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if (utils.isBlob(body)) {\n return body.size;\n }\n\n if (utils.isSpecCompliantForm(body)) {\n const _request = new Request(platform.origin, {\n method: 'POST',\n body,\n });\n return (await _request.arrayBuffer()).byteLength;\n }\n\n if (utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {\n return body.byteLength;\n }\n\n if (utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if (utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n };\n\n const resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n };\n\n return async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions,\n maxContentLength,\n maxBodyLength,\n } = resolveConfig(config);\n\n const hasMaxContentLength = utils.isNumber(maxContentLength) && maxContentLength > -1;\n const hasMaxBodyLength = utils.isNumber(maxBodyLength) && maxBodyLength > -1;\n const own = (key) => (utils.hasOwnProp(config, key) ? config[key] : undefined);\n\n let _fetch = envFetch || fetch;\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let composedSignal = composeSignals(\n [signal, cancelToken && cancelToken.toAbortSignal()],\n timeout\n );\n\n let request = null;\n\n const unsubscribe =\n composedSignal &&\n composedSignal.unsubscribe &&\n (() => {\n composedSignal.unsubscribe();\n });\n\n let requestContentLength;\n\n // AxiosError we raise while the request body is being streamed. Captured\n // by identity so the catch block can surface it directly, regardless of\n // how the runtime wraps the resulting fetch rejection (undici exposes it\n // as `err.cause`; some browsers drop the original error entirely).\n let pendingBodyError = null;\n\n const maxBodyLengthError = () =>\n new AxiosError(\n 'Request body larger than maxBodyLength limit',\n AxiosError.ERR_BAD_REQUEST,\n config,\n request\n );\n\n try {\n // HTTP basic authentication\n let auth = undefined;\n const configAuth = own('auth');\n\n if (configAuth) {\n const username = utils.getSafeProp(configAuth, 'username') || '';\n const password = utils.getSafeProp(configAuth, 'password') || '';\n auth = {\n username,\n password\n };\n }\n\n if (maybeWithAuthCredentials(url)) {\n const parsedURL = new URL(url, platform.origin);\n\n if (!auth && (parsedURL.username || parsedURL.password)) {\n const urlUsername = decodeURIComponentSafe(parsedURL.username);\n const urlPassword = decodeURIComponentSafe(parsedURL.password);\n auth = {\n username: urlUsername,\n password: urlPassword\n };\n }\n\n if (parsedURL.username || parsedURL.password) {\n parsedURL.username = '';\n parsedURL.password = '';\n url = parsedURL.href;\n }\n }\n\n if (auth) {\n headers.delete('authorization');\n headers.set(\n 'Authorization',\n 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))\n );\n }\n\n // Enforce maxContentLength for data: URLs up-front so we never materialize\n // an oversized payload. The HTTP adapter applies the same check (see http.js\n // \"if (protocol === 'data:')\" branch).\n if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {\n const estimated = estimateDataURLDecodedBytes(url);\n if (estimated > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n // Enforce maxBodyLength against known-size bodies before dispatch using\n // the body's *actual* size — never a caller-declared Content-Length,\n // which could under-report to slip an oversized body past the check.\n // Unknown-size streams return undefined here and are counted per-chunk\n // below as fetch consumes them.\n if (hasMaxBodyLength && method !== 'get' && method !== 'head') {\n const outboundLength = await getBodyLength(data);\n if (typeof outboundLength === 'number' && isFinite(outboundLength)) {\n requestContentLength = outboundLength;\n if (outboundLength > maxBodyLength) {\n throw maxBodyLengthError();\n }\n }\n }\n\n // A streamed body under maxBodyLength must be counted as fetch consumes\n // it; its size is never trusted from a caller-declared Content-Length.\n const mustEnforceStreamBody =\n hasMaxBodyLength && (utils.isReadableStream(data) || utils.isStream(data));\n\n const trackRequestStream = (stream, onProgress, flush) =>\n trackStream(\n stream,\n DEFAULT_CHUNK_SIZE,\n (loadedBytes) => {\n if (hasMaxBodyLength && loadedBytes > maxBodyLength) {\n throw (pendingBodyError = maxBodyLengthError());\n }\n onProgress && onProgress(loadedBytes);\n },\n flush\n );\n\n if (\n supportsRequestStream &&\n method !== 'get' &&\n method !== 'head' &&\n (onUploadProgress || mustEnforceStreamBody)\n ) {\n requestContentLength =\n requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;\n\n // A declared length of 0 is only trusted to skip the wrap when we are\n // not enforcing a stream limit (which must not rely on that header).\n if (requestContentLength !== 0 || mustEnforceStreamBody) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: 'half',\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader);\n }\n\n if (_request.body) {\n const [onProgress, flush] =\n (onUploadProgress &&\n progressEventDecorator(\n requestContentLength,\n progressEventReducer(asyncDecorator(onUploadProgress))\n )) ||\n [];\n\n data = trackRequestStream(_request.body, onProgress, flush);\n }\n }\n } else if (\n mustEnforceStreamBody &&\n !isRequestSupported &&\n isReadableStreamSupported &&\n method !== 'get' &&\n method !== 'head'\n ) {\n data = trackRequestStream(data);\n } else if (\n mustEnforceStreamBody &&\n isRequestSupported &&\n !supportsRequestStream &&\n method !== 'get' &&\n method !== 'head'\n ) {\n throw new AxiosError(\n 'Stream request bodies are not supported by the current fetch implementation',\n AxiosError.ERR_NOT_SUPPORT,\n config,\n request\n );\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'include' : 'omit';\n }\n\n // Cloudflare Workers throws when credentials are defined\n // see https://github.com/cloudflare/workerd/issues/902\n const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;\n\n // If data is FormData and Content-Type is multipart/form-data without boundary,\n // delete it so fetch can set it correctly with the boundary\n if (utils.isFormData(data)) {\n const contentType = headers.getContentType();\n if (\n contentType &&\n /^multipart\\/form-data/i.test(contentType) &&\n !/boundary=/i.test(contentType)\n ) {\n headers.delete('content-type');\n }\n }\n\n // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)\n headers.set('User-Agent', 'axios/' + VERSION, false);\n\n const resolvedOptions = {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: toByteStringHeaderObject(headers.normalize()),\n body: data,\n duplex: 'half',\n credentials: isCredentialsSupported ? withCredentials : undefined,\n };\n\n request = isRequestSupported && new Request(url, resolvedOptions);\n\n let response = await (isRequestSupported\n ? _fetch(request, fetchOptions)\n : _fetch(url, resolvedOptions));\n\n const responseHeaders = AxiosHeaders.from(response.headers);\n\n // Cheap pre-check: if the server honestly declares a content-length that\n // already exceeds the cap, reject before we start streaming.\n if (hasMaxContentLength) {\n const declaredLength = utils.toFiniteNumber(responseHeaders.getContentLength());\n if (declaredLength != null && declaredLength > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n const isStreamResponse =\n supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (\n supportsResponseStream &&\n response.body &&\n (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))\n ) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach((prop) => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(responseHeaders.getContentLength());\n\n const [onProgress, flush] =\n (onDownloadProgress &&\n progressEventDecorator(\n responseContentLength,\n progressEventReducer(asyncDecorator(onDownloadProgress), true)\n )) ||\n [];\n\n let bytesRead = 0;\n const onChunkProgress = (loadedBytes) => {\n if (hasMaxContentLength) {\n bytesRead = loadedBytes;\n if (bytesRead > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n onProgress && onProgress(loadedBytes);\n };\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {\n flush && flush();\n unsubscribe && unsubscribe();\n }),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](\n response,\n config\n );\n\n // Fallback enforcement for environments without ReadableStream support\n // (legacy runtimes). Detect materialized size from typed output; skip\n // streams/Response passthrough since the user will read those themselves.\n if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {\n let materializedSize;\n if (responseData != null) {\n if (typeof responseData.byteLength === 'number') {\n materializedSize = responseData.byteLength;\n } else if (typeof responseData.size === 'number') {\n materializedSize = responseData.size;\n } else if (typeof responseData === 'string') {\n materializedSize =\n typeof TextEncoder === 'function'\n ? new TextEncoder().encode(responseData).byteLength\n : responseData.length;\n }\n }\n if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n !isStreamResponse && unsubscribe && unsubscribe();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request,\n });\n });\n } catch (err) {\n unsubscribe && unsubscribe();\n\n // Safari can surface fetch aborts as a DOMException-like object whose\n // branded getters throw. Prefer our composed signal reason before reading\n // the caught error, preserving timeout vs cancellation semantics.\n if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {\n const canceledError = composedSignal.reason;\n canceledError.config = config;\n request && (canceledError.request = request);\n if (err !== canceledError) {\n // Non-enumerable to match native Error `cause` semantics so loggers\n // don't recurse into circular fetch internals (see #7205).\n Object.defineProperty(canceledError, 'cause', {\n __proto__: null,\n value: err,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n }\n throw canceledError;\n }\n\n // Surface a maxBodyLength violation we raised while the request body was\n // being streamed. Matching by identity (rather than reading\n // `err.cause.isAxiosError`) keeps the error deterministic across runtimes\n // and avoids both prototype-pollution reads and mis-attributing a foreign\n // AxiosError that merely happened to land in `err.cause`.\n if (pendingBodyError) {\n request && !pendingBodyError.request && (pendingBodyError.request = request);\n throw pendingBodyError;\n }\n\n // Re-throw AxiosErrors we raised synchronously (data: URL / content-length\n // pre-checks, response size enforcement) without re-wrapping them.\n if (err instanceof AxiosError) {\n request && !err.request && (err.request = request);\n throw err;\n }\n\n if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {\n const networkError = new AxiosError(\n 'Network Error',\n AxiosError.ERR_NETWORK,\n config,\n request,\n err && err.response\n );\n // Non-enumerable to match native Error `cause` semantics so loggers\n // don't recurse into circular fetch internals (see #7205).\n Object.defineProperty(networkError, 'cause', {\n __proto__: null,\n value: err.cause || err,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n throw networkError;\n }\n\n throw AxiosError.from(err, err && err.code, config, request, err && err.response);\n }\n };\n};\n\nconst seedCache = new Map();\n\nexport const getFetch = (config) => {\n let env = (config && config.env) || {};\n const { fetch, Request, Response } = env;\n const seeds = [Request, Response, fetch];\n\n let len = seeds.length,\n i = len,\n seed,\n target,\n map = seedCache;\n\n while (i--) {\n seed = seeds[i];\n target = map.get(seed);\n\n target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));\n\n map = target;\n }\n\n return target;\n};\n\nconst adapter = getFetch();\n\nexport default adapter;\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport * as fetchAdapter from './fetch.js';\nimport AxiosError from '../core/AxiosError.js';\n\n/**\n * Known adapters mapping.\n * Provides environment-specific adapters for Axios:\n * - `http` for Node.js\n * - `xhr` for browsers\n * - `fetch` for fetch API-based requests\n *\n * @type {Object<string, Function|Object>}\n */\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: {\n get: fetchAdapter.getFetch,\n },\n};\n\n// Assign adapter names for easier debugging and identification\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n // Null-proto descriptors so a polluted Object.prototype.get cannot turn\n // these data descriptors into accessor descriptors on the way in.\n Object.defineProperty(fn, 'name', { __proto__: null, value });\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', { __proto__: null, value });\n }\n});\n\n/**\n * Render a rejection reason string for unknown or unsupported adapters\n *\n * @param {string} reason\n * @returns {string}\n */\nconst renderReason = (reason) => `- ${reason}`;\n\n/**\n * Check if the adapter is resolved (function, null, or false)\n *\n * @param {Function|null|false} adapter\n * @returns {boolean}\n */\nconst isResolvedHandle = (adapter) =>\n utils.isFunction(adapter) || adapter === null || adapter === false;\n\n/**\n * Get the first suitable adapter from the provided list.\n * Tries each adapter in order until a supported one is found.\n * Throws an AxiosError if no adapter is suitable.\n *\n * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.\n * @param {Object} config - Axios request configuration\n * @throws {AxiosError} If no suitable adapter is available\n * @returns {Function} The resolved adapter function\n */\nfunction getAdapter(adapters, config) {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const { length } = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n const reasons = Object.entries(rejectedReasons).map(\n ([id, state]) =>\n `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length\n ? reasons.length > 1\n ? 'since :\\n' + reasons.map(renderReason).join('\\n')\n : ' ' + renderReason(reasons[0])\n : 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n AxiosError.ERR_NOT_SUPPORT\n );\n }\n\n return adapter;\n}\n\n/**\n * Exports Axios adapters and utility to resolve an adapter\n */\nexport default {\n /**\n * Resolve an adapter from a list of adapter names or functions.\n * @type {Function}\n */\n getAdapter,\n\n /**\n * Exposes all known adapters\n * @type {Object<string, Function|Object>}\n */\n adapters: knownAdapters,\n};\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from '../adapters/adapters.js';\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(config, config.transformRequest);\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);\n\n return adapter(config).then(\n function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Expose the current response on config so that transformResponse can\n // attach it to any AxiosError it throws (e.g. on JSON parse failure).\n // We clean it up afterwards to avoid polluting the config object.\n config.response = response;\n try {\n response.data = transformData.call(config, config.transformResponse, response);\n } finally {\n delete config.response;\n }\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n },\n function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n config.response = reason.response;\n try {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n } finally {\n delete config.response;\n }\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n }\n );\n}\n","'use strict';\n\nimport { VERSION } from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return (\n '[Axios v' +\n VERSION +\n \"] Transitional option '\" +\n opt +\n \"'\" +\n desc +\n (message ? '. ' + message : '')\n );\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\nvalidators.spelling = function spelling(correctSpelling) {\n return (value, opt) => {\n // eslint-disable-next-line no-console\n console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);\n return true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object' || options === null) {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply\n // a non-function validator and cause a TypeError.\n const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError(\n 'option ' + opt + ' must be ' + result,\n AxiosError.ERR_BAD_OPTION_VALUE\n );\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators,\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\nimport transitionalDefaults from '../defaults/transitional.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig || {};\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager(),\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy = {};\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = (() => {\n if (!dummy.stack) {\n return '';\n }\n\n const firstNewlineIndex = dummy.stack.indexOf('\\n');\n\n return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);\n })();\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack) {\n const firstNewlineIndex = stack.indexOf('\\n');\n const secondNewlineIndex =\n firstNewlineIndex === -1 ? -1 : stack.indexOf('\\n', firstNewlineIndex + 1);\n const stackWithoutTwoTopLines =\n secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);\n\n if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {\n err.stack += '\\n' + stack;\n }\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const { transitional, paramsSerializer, headers } = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(\n transitional,\n {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean),\n legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),\n advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),\n validateStatusUndefinedResolves: validators.transitional(validators.boolean),\n },\n false\n );\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer,\n };\n } else {\n validator.assertOptions(\n paramsSerializer,\n {\n encode: validators.function,\n serialize: validators.function,\n },\n true\n );\n }\n }\n\n // Set config.allowAbsoluteUrls\n if (config.allowAbsoluteUrls !== undefined) {\n // do nothing\n } else if (this.defaults.allowAbsoluteUrls !== undefined) {\n config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;\n } else {\n config.allowAbsoluteUrls = true;\n }\n\n validator.assertOptions(\n config,\n {\n baseUrl: validators.spelling('baseURL'),\n withXsrfToken: validators.spelling('withXSRFToken'),\n },\n true\n );\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(headers.common, headers[config.method]);\n\n headers &&\n utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {\n delete headers[method];\n });\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n const transitional = config.transitional || transitionalDefaults;\n const legacyInterceptorReqResOrdering =\n transitional && transitional.legacyInterceptorReqResOrdering;\n\n if (legacyInterceptorReqResOrdering) {\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n } else {\n requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n }\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift(...requestInterceptorChain);\n chain.push(...responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;\n } catch (error) {\n if (!onRejected) {\n promise = Promise.reject(error);\n break;\n }\n\n try {\n const rejectedResult = onRejected.call(this, error);\n\n if (utils.isThenable(rejectedResult)) {\n promise = Promise.resolve(rejectedResult).then(() =>\n dispatchRequest.call(this, newConfig)\n );\n }\n } catch (rejectedError) {\n promise = Promise.reject(rejectedError);\n }\n\n break;\n }\n }\n\n if (!promise) {\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n promise = Promise.reject(error);\n }\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function (url, config) {\n return this.request(\n mergeConfig(config || {}, {\n method,\n url,\n data: config && utils.hasOwnProp(config, 'data') ? config.data : undefined,\n })\n );\n };\n});\n\nutils.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(\n mergeConfig(config || {}, {\n method,\n headers: isForm\n ? {\n 'Content-Type': 'multipart/form-data',\n }\n : {},\n url,\n data,\n })\n );\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n // QUERY is a safe/idempotent read method; multipart form bodies don't fit\n // its semantics, so no queryForm shorthand is generated.\n if (method !== 'query') {\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n }\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then((cancel) => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = (onfulfilled) => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise((resolve) => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n toAbortSignal() {\n const controller = new AbortController();\n\n const abort = (err) => {\n controller.abort(err);\n };\n\n this.subscribe(abort);\n\n controller.signal.unsubscribe = () => this.unsubscribe(abort);\n\n return controller.signal;\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel,\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * const args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && payload.isAxiosError === true;\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n WebServerReturnsAnUnknownError: 520,\n WebServerIsDown: 521,\n ConnectionTimedOut: 522,\n OriginIsUnreachable: 523,\n TimeoutOccurred: 524,\n SslHandshakeFailed: 525,\n InvalidSslCertificate: 526,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport { VERSION } from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from './core/AxiosHeaders.js';\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, { allOwnKeys: true });\n\n // Copy context to instance\n utils.extend(instance, context, null, { allOwnKeys: true });\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios;\n","import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig,\n create,\n} = axios;\n\nexport {\n axios as default,\n create,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig,\n};\n","/*! js-cookie v3.0.8 | MIT */\nfunction assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (key === '__proto__') continue\n target[key] = source[key];\n }\n }\n return target\n}\n\nvar defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n};\n\nfunction init(converter, defaultAttributes) {\n function set(name, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n name = encodeURIComponent(name)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n name + '=' + converter.write(value, name) + stringifiedAttributes)\n }\n\n function get(name) {\n if (typeof document === 'undefined' || (arguments.length && !name)) {\n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var found = decodeURIComponent(parts[0]);\n if (!(found in jar)) jar[found] = converter.read(value, found);\n if (name === found) {\n break\n }\n } catch (_e) {\n // Do nothing...\n }\n }\n\n return name ? jar[name] : jar\n }\n\n return Object.create(\n {\n set: set,\n get: get,\n remove: function (name, attributes) {\n set(\n name,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n}\n\nvar api = init(defaultConverter, { path: '/' });\n\nexport { api as default };\n","import axios from 'axios';\nimport Cookies from 'js-cookie';\n\nlet BASE_URL_VALUE = 'https://api-grievance.airaops.com';\n\ntry {\n if (typeof import.meta !== 'undefined' && import.meta.env?.VITE_API_URL) {\n BASE_URL_VALUE = import.meta.env.VITE_API_URL;\n } else {\n // eslint-disable-next-line no-undef\n const nodeProcess = typeof process !== 'undefined' ? process : null;\n if (nodeProcess?.env?.VITE_API_URL) {\n BASE_URL_VALUE = nodeProcess.env.VITE_API_URL;\n }\n }\n} catch {\n // Ignore env resolution errors in non-Vite hosts\n}\n\n/** Runtime override for API host; updates the shared axios instance baseURL. */\nexport const setBaseUrl = (url) => {\n BASE_URL_VALUE = url || '';\n instance.defaults.baseURL = BASE_URL_VALUE;\n};\n\nexport const setAuthToken = (token) => {\n if (token) {\n Cookies.set('token', token, { secure: true, sameSite: 'Strict' });\n } else {\n Cookies.remove('token');\n }\n};\n\nconst getAccessToken = () => Cookies.get('token') || null;\n\nconst instance = axios.create({\n baseURL: BASE_URL_VALUE,\n transformRequest: [\n function (data, headers) {\n const accessToken = getAccessToken();\n if (accessToken) {\n headers.Authorization = `Bearer ${accessToken}`;\n } else {\n delete headers.Authorization;\n }\n if (data === undefined || data === null) return data;\n if (typeof data === 'string') return data;\n return JSON.stringify(data);\n },\n ],\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n});\n\nlet isRefreshing = false;\nlet refreshTokenPromise = null;\n\ninstance.interceptors.response.use(\n (response) => response,\n async (error) => {\n const originalRequest = error.config;\n const response = error.response;\n\n if (response && (response.status === 401 || response.status === 402)) {\n const refreshToken = Cookies.get('refreshToken');\n\n if (refreshToken) {\n try {\n if (!isRefreshing) {\n isRefreshing = true;\n refreshTokenPromise = axios.post(\n `${BASE_URL_VALUE}/api/v1/auth/refresh`,\n {},\n {\n headers: {\n Authorization: `Bearer ${refreshToken}`,\n },\n },\n );\n }\n\n const refreshResponse = await refreshTokenPromise;\n const { token: newToken, refreshToken: newRefreshToken } =\n refreshResponse.data;\n\n Cookies.set('token', newToken, { secure: true, sameSite: 'Strict' });\n if (newRefreshToken) {\n Cookies.set('refreshToken', newRefreshToken);\n }\n\n originalRequest.headers.Authorization = `Bearer ${newToken}`;\n return instance(originalRequest);\n } catch {\n Cookies.remove('token');\n Cookies.remove('refreshToken');\n } finally {\n isRefreshing = false;\n refreshTokenPromise = null;\n }\n }\n }\n\n return Promise.reject(error);\n },\n);\n\n/** Shared axios client used by package pages/hooks. Parent sets base URL + token via ApiProvider. */\nexport default instance;\n","import React, { createContext, useEffect } from 'react';\nimport { setBaseUrl, setAuthToken } from '../utils/api';\n\nconst ApiContext = createContext(null);\n\n/**\n * Provides runtime API base URL + auth token from the parent app.\n * All package requests go through `utils/api` (axios) so the parent owns auth.\n */\nexport const ApiProvider = ({ children, apiUrl, authToken }) => {\n useEffect(() => {\n if (apiUrl) {\n setBaseUrl(apiUrl);\n }\n }, [apiUrl]);\n\n useEffect(() => {\n setAuthToken(authToken || null);\n }, [authToken]);\n\n return (\n <ApiContext.Provider value={{ apiUrl, authToken }}>\n {children}\n </ApiContext.Provider>\n );\n};\n\nexport default ApiContext;\n","/**\n * Default light theme tokens.\n * Parent apps can import, extend, or replace via the `theme` prop.\n */\nexport const lightTheme = {\n mode: 'light',\n colors: {\n primary: '#2D64B8',\n primaryHover: '#2557A3',\n text: '#111827',\n textSecondary: '#6B7280',\n textMuted: '#9CA3AF',\n border: '#E5E7EB',\n borderLight: '#F3F4F6',\n background: '#F5F5F5',\n surface: '#FFFFFF',\n white: '#FFFFFF',\n onPrimary: '#FFFFFF',\n activeBg: '#ECFDF5',\n activeBorder: '#A7F3D0',\n activeText: '#059669',\n inactiveBg: '#F3F4F6',\n inactiveBorder: '#D1D5DB',\n inactiveText: '#6B7280',\n link: '#2D64B8',\n divider: '#E5E7EB',\n accentBorder: '#C5D7F0',\n accentBg: '#EEF4FB',\n stepDone: '#D6E4F7',\n success: '#22C55E',\n danger: '#EF4444',\n secondaryBtn: '#D1D5DB',\n secondaryBtnHover: '#C4C9D1',\n inputBg: '#FFFFFF',\n tableHeadBg: '#EEF4FB',\n sidebarBg: '#FAFBFD',\n overlay: 'rgba(16, 24, 40, 0.06)',\n },\n radii: {\n sm: '6px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n pill: '999px',\n },\n spacing: {\n xs: '4px',\n sm: '8px',\n md: '12px',\n lg: '16px',\n xl: '24px',\n xxl: '32px',\n },\n typography: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n h1Size: '28px',\n h2Size: '16px',\n bodySize: '14px',\n labelSize: '13px',\n valueSize: '22px',\n smallSize: '13px',\n },\n shadow: {\n card: '0 1px 2px rgba(16, 24, 40, 0.04)',\n settings: '0 1px 3px rgba(16, 24, 40, 0.06)',\n },\n};\n\n/**\n * Default dark theme tokens.\n */\nexport const darkTheme = {\n mode: 'dark',\n colors: {\n primary: '#5B8DEF',\n primaryHover: '#7BA3F3',\n text: '#F3F4F6',\n textSecondary: '#A1A1AA',\n textMuted: '#71717A',\n border: '#3F3F46',\n borderLight: '#27272A',\n background: '#0F1115',\n surface: '#18181B',\n white: '#FFFFFF',\n onPrimary: '#FFFFFF',\n activeBg: '#052E1C',\n activeBorder: '#166534',\n activeText: '#4ADE80',\n inactiveBg: '#27272A',\n inactiveBorder: '#3F3F46',\n inactiveText: '#A1A1AA',\n link: '#7BA3F3',\n divider: '#3F3F46',\n accentBorder: '#2A3A55',\n accentBg: '#1A2333',\n stepDone: '#1E3A5F',\n success: '#22C55E',\n danger: '#F87171',\n secondaryBtn: '#3F3F46',\n secondaryBtnHover: '#52525B',\n inputBg: '#18181B',\n tableHeadBg: '#1A2333',\n sidebarBg: '#12141A',\n overlay: 'rgba(0, 0, 0, 0.35)',\n },\n radii: {\n sm: '6px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n pill: '999px',\n },\n spacing: {\n xs: '4px',\n sm: '8px',\n md: '12px',\n lg: '16px',\n xl: '24px',\n xxl: '32px',\n },\n typography: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n h1Size: '28px',\n h2Size: '16px',\n bodySize: '14px',\n labelSize: '13px',\n valueSize: '22px',\n smallSize: '13px',\n },\n shadow: {\n card: '0 1px 2px rgba(0, 0, 0, 0.35)',\n settings: '0 1px 3px rgba(0, 0, 0, 0.4)',\n },\n};\n\n/** Bundled theme file shape parents can mirror / extend. */\nexport const defaultThemeFile = {\n light: lightTheme,\n dark: darkTheme,\n};\n","import { lightTheme, darkTheme } from './defaultTheme';\n\nfunction isObject(value) {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** Deep-merge plain objects (arrays / primitives replaced). */\nexport function deepMerge(base, override) {\n if (!isObject(override)) return base;\n const result = { ...base };\n Object.keys(override).forEach((key) => {\n const next = override[key];\n if (isObject(next) && isObject(base[key])) {\n result[key] = deepMerge(base[key], next);\n } else if (next !== undefined) {\n result[key] = next;\n }\n });\n return result;\n}\n\n/**\n * Normalize parent `theme` prop into { light, dark } packs.\n *\n * Supported shapes:\n * 1. Full theme file: `{ light: {...}, dark: {...} }`\n * 2. Flat tokens: `{ colors, radii, ... }` → applied to both modes (merged over defaults)\n * 3. Mode-specific partial: `{ light: { colors: { primary } } }`\n */\nexport function normalizeThemeFile(themeProp) {\n if (!themeProp || !isObject(themeProp)) {\n return { light: lightTheme, dark: darkTheme };\n }\n\n const hasModes = isObject(themeProp.light) || isObject(themeProp.dark);\n\n if (hasModes) {\n return {\n light: deepMerge(lightTheme, themeProp.light || {}),\n dark: deepMerge(darkTheme, themeProp.dark || {}),\n };\n }\n\n // Flat token object — treat as overrides for both modes\n return {\n light: deepMerge(lightTheme, themeProp),\n dark: deepMerge(darkTheme, themeProp),\n };\n}\n\n/**\n * Pick active theme for current mode and ensure mode flag is set.\n */\nexport function resolveActiveTheme(themeFile, darkMode = false) {\n const pack = normalizeThemeFile(themeFile);\n const active = darkMode ? pack.dark : pack.light;\n return {\n ...active,\n mode: darkMode ? 'dark' : 'light',\n __pack: pack,\n };\n}\n\n/** camelCase / nested keys → CSS custom property map for .ca-root */\nconst COLOR_VAR_MAP = {\n primary: '--ca-primary',\n primaryHover: '--ca-primary-hover',\n text: '--ca-text',\n textSecondary: '--ca-text-secondary',\n textMuted: '--ca-text-muted',\n border: '--ca-border',\n borderLight: '--ca-border-light',\n background: '--ca-bg',\n surface: '--ca-surface',\n white: '--ca-white',\n onPrimary: '--ca-on-primary',\n activeBg: '--ca-active-bg',\n activeBorder: '--ca-active-border',\n activeText: '--ca-active-text',\n inactiveBg: '--ca-inactive-bg',\n inactiveBorder: '--ca-inactive-border',\n inactiveText: '--ca-inactive-text',\n link: '--ca-link',\n divider: '--ca-divider',\n accentBorder: '--ca-accent-border',\n accentBg: '--ca-accent-bg',\n stepDone: '--ca-step-done',\n success: '--ca-success',\n danger: '--ca-danger',\n secondaryBtn: '--ca-secondary-btn',\n secondaryBtnHover: '--ca-secondary-btn-hover',\n inputBg: '--ca-input-bg',\n tableHeadBg: '--ca-table-head-bg',\n sidebarBg: '--ca-sidebar-bg',\n overlay: '--ca-overlay',\n};\n\nconst RADIUS_VAR_MAP = {\n sm: '--ca-radius-sm',\n md: '--ca-radius-md',\n lg: '--ca-radius-lg',\n xl: '--ca-radius-xl',\n pill: '--ca-radius-pill',\n};\n\nconst TYPE_VAR_MAP = {\n fontFamily: '--ca-font',\n h1Size: '--ca-h1-size',\n h2Size: '--ca-h2-size',\n bodySize: '--ca-body-size',\n labelSize: '--ca-label-size',\n valueSize: '--ca-value-size',\n smallSize: '--ca-small-size',\n};\n\nconst SHADOW_VAR_MAP = {\n card: '--ca-shadow-card',\n settings: '--ca-shadow-settings',\n};\n\n/**\n * Convert a resolved theme object into inline CSS variable styles.\n */\nexport function themeToCssVars(theme) {\n const vars = {};\n\n if (theme?.colors) {\n Object.entries(COLOR_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.colors[key] != null) vars[cssVar] = theme.colors[key];\n });\n }\n\n if (theme?.radii) {\n Object.entries(RADIUS_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.radii[key] != null) vars[cssVar] = theme.radii[key];\n });\n }\n\n if (theme?.typography) {\n Object.entries(TYPE_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.typography[key] != null) vars[cssVar] = theme.typography[key];\n });\n }\n\n if (theme?.shadow) {\n Object.entries(SHADOW_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.shadow[key] != null) vars[cssVar] = theme.shadow[key];\n });\n }\n\n // Ensure primary button text stays readable\n if (vars['--ca-on-primary'] && !vars['--ca-white']) {\n vars['--ca-white'] = vars['--ca-on-primary'];\n }\n\n return vars;\n}\n","import React, { createContext, useContext, useMemo } from 'react';\nimport { resolveActiveTheme, themeToCssVars } from '../theme/resolveTheme';\nimport { defaultThemeFile } from '../theme/defaultTheme';\n\nconst ThemeContext = createContext({\n darkMode: false,\n theme: null,\n themeFile: defaultThemeFile,\n cssVars: {},\n});\n\n/**\n * Applies parent theme + darkMode to the whole package via CSS variables on `.ca-root`.\n *\n * @param {object} [theme] - Static theme file / tokens from parent\n * @param {boolean} [darkMode=false] - Parent-controlled dark mode flag\n */\nexport function ThemeProvider({ theme, darkMode = false, children }) {\n const value = useMemo(() => {\n const active = resolveActiveTheme(theme, Boolean(darkMode));\n const cssVars = themeToCssVars(active);\n return {\n darkMode: Boolean(darkMode),\n theme: active,\n themeFile: active.__pack,\n cssVars,\n mode: active.mode,\n };\n }, [theme, darkMode]);\n\n return (\n <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n\nexport default ThemeContext;\n","import { createAsyncThunk } from '@reduxjs/toolkit';\nimport api from '../../utils/api';\n\nexport const COMPLAINT_ENDPOINTS = Object.freeze({\n types: '/api/v1/complaints/types',\n departments: '/api/v1/complaints/departments',\n departmentTree: '/api/v1/complaints/departments/tree',\n priorities: '/api/v1/complaints/priorities',\n workflows: '/api/v1/complaints/workflows',\n workflowSteps: '/api/v1/complaints/workflows/steps',\n statuses: '/api/v1/complaints/statuses',\n});\n\nconst rejectRequest = (error, thunkApi) =>\n thunkApi.rejectWithValue({\n status: error?.response?.status ?? error?.status,\n message:\n error?.response?.data?.message ??\n error?.response?.data?.error ??\n error?.message ??\n 'Something went wrong',\n });\n\nconst request = (type, handler) =>\n createAsyncThunk(type, async (params, thunkApi) => {\n try {\n const response = await handler(params, thunkApi);\n return response.data;\n } catch (error) {\n return rejectRequest(error, thunkApi);\n }\n });\n\nconst resourceActions = (resource, endpoint) => ({\n list: request(`complaint/${resource}/list`, (params, { signal }) =>\n api.get(endpoint, { params, signal }),\n ),\n getById: request(`complaint/${resource}/getById`, (id, { signal }) =>\n api.get(`${endpoint}/${id}`, { signal }),\n ),\n create: request(`complaint/${resource}/create`, (payload) =>\n api.post(endpoint, payload),\n ),\n update: request(`complaint/${resource}/update`, ({ id, data }) =>\n api.patch(`${endpoint}/${id}`, data),\n ),\n remove: request(`complaint/${resource}/remove`, (id) =>\n api.delete(`${endpoint}/${id}`),\n ),\n});\n\nexport const complaintTypeActions = resourceActions(\n 'types',\n COMPLAINT_ENDPOINTS.types,\n);\nexport const complaintDepartmentActions = resourceActions(\n 'departments',\n COMPLAINT_ENDPOINTS.departments,\n);\nexport const complaintPriorityActions = resourceActions(\n 'priorities',\n COMPLAINT_ENDPOINTS.priorities,\n);\nexport const complaintWorkflowActions = resourceActions(\n 'workflows',\n COMPLAINT_ENDPOINTS.workflows,\n);\nexport const complaintStatusActions = resourceActions(\n 'statuses',\n COMPLAINT_ENDPOINTS.statuses,\n);\n\nexport const getDepartmentTree = request(\n 'complaint/departments/getTree',\n (_params, { signal }) =>\n api.get(COMPLAINT_ENDPOINTS.departmentTree, { signal }),\n);\n\nexport const getWorkflowSteps = request(\n 'complaint/workflows/getSteps',\n (workflowId, { signal }) =>\n api.get(`${COMPLAINT_ENDPOINTS.workflowSteps}/${workflowId}`, { signal }),\n);\n\nexport const saveWorkflowSteps = request(\n 'complaint/workflows/saveSteps',\n (payload) => api.post(COMPLAINT_ENDPOINTS.workflowSteps, payload),\n);\n\nexport const deleteWorkflowSteps = request(\n 'complaint/workflows/deleteSteps',\n (workflowId) =>\n api.delete(`${COMPLAINT_ENDPOINTS.workflowSteps}/${workflowId}`),\n);\n\n// Product-module style named exports for consumers that prefer direct thunks.\nexport const getComplaintTypes = complaintTypeActions.list;\nexport const getComplaintTypeById = complaintTypeActions.getById;\nexport const createComplaintType = complaintTypeActions.create;\nexport const updateComplaintType = complaintTypeActions.update;\nexport const deleteComplaintType = complaintTypeActions.remove;\nexport const getComplaintDepartments = complaintDepartmentActions.list;\nexport const getComplaintDepartmentById = complaintDepartmentActions.getById;\nexport const createComplaintDepartment = complaintDepartmentActions.create;\nexport const updateComplaintDepartment = complaintDepartmentActions.update;\nexport const deleteComplaintDepartment = complaintDepartmentActions.remove;\nexport const getComplaintPriorities = complaintPriorityActions.list;\nexport const getComplaintPriorityById = complaintPriorityActions.getById;\nexport const createComplaintPriority = complaintPriorityActions.create;\nexport const updateComplaintPriority = complaintPriorityActions.update;\nexport const deleteComplaintPriority = complaintPriorityActions.remove;\nexport const getComplaintWorkflows = complaintWorkflowActions.list;\nexport const getComplaintWorkflowById = complaintWorkflowActions.getById;\nexport const createComplaintWorkflow = complaintWorkflowActions.create;\nexport const updateComplaintWorkflow = complaintWorkflowActions.update;\nexport const deleteComplaintWorkflow = complaintWorkflowActions.remove;\nexport const getComplaintStatuses = complaintStatusActions.list;\nexport const getComplaintStatusById = complaintStatusActions.getById;\nexport const createComplaintStatus = complaintStatusActions.create;\nexport const updateComplaintStatus = complaintStatusActions.update;\nexport const deleteComplaintStatus = complaintStatusActions.remove;\n","import { createSlice } from '@reduxjs/toolkit';\nimport {\n complaintTypeActions,\n complaintDepartmentActions,\n complaintPriorityActions,\n complaintWorkflowActions,\n complaintStatusActions,\n getDepartmentTree,\n getWorkflowSteps,\n saveWorkflowSteps,\n deleteWorkflowSteps,\n} from './actions';\n\nconst createResourceState = () => ({\n data: [],\n selected: null,\n pagination: null,\n isLoading: false,\n isMutating: false,\n error: null,\n});\n\nconst initialState = {\n types: createResourceState(),\n departments: createResourceState(),\n priorities: createResourceState(),\n workflows: createResourceState(),\n statuses: createResourceState(),\n departmentTree: [],\n workflowSteps: {},\n isLoadingDepartmentTree: false,\n isLoadingWorkflowSteps: false,\n error: null,\n};\n\nconst unwrapList = (payload) => {\n if (Array.isArray(payload)) return { data: payload, pagination: null };\n const body = payload?.data ?? payload;\n if (Array.isArray(body)) {\n return { data: body, pagination: payload?.pagination ?? null };\n }\n return {\n data: body?.results ?? body?.items ?? [],\n pagination: body?.pagination ?? payload?.pagination ?? null,\n };\n};\n\nconst unwrapEntity = (payload) => payload?.data ?? payload;\n\nconst entityId = (entity) => entity?.id ?? entity?._id;\n\nconst upsert = (items, entity) => {\n if (!entity || typeof entity !== 'object') return items;\n const id = entityId(entity);\n if (id === undefined || id === null) return items;\n const index = items.findIndex((item) => entityId(item) === id);\n if (index < 0) return [entity, ...items];\n const next = [...items];\n next[index] = entity;\n return next;\n};\n\nconst errorMessage = (action) =>\n action.payload?.message ?? action.error?.message ?? 'Something went wrong';\n\nconst registerResource = (builder, key, actions) => {\n builder\n .addCase(actions.list.pending, (state) => {\n state[key].isLoading = true;\n state[key].error = null;\n })\n .addCase(actions.list.fulfilled, (state, action) => {\n const result = unwrapList(action.payload);\n state[key].isLoading = false;\n state[key].data = result.data;\n state[key].pagination = result.pagination;\n })\n .addCase(actions.list.rejected, (state, action) => {\n state[key].isLoading = false;\n state[key].error = errorMessage(action);\n })\n .addCase(actions.getById.pending, (state) => {\n state[key].isLoading = true;\n state[key].error = null;\n })\n .addCase(actions.getById.fulfilled, (state, action) => {\n state[key].isLoading = false;\n state[key].selected = unwrapEntity(action.payload);\n })\n .addCase(actions.getById.rejected, (state, action) => {\n state[key].isLoading = false;\n state[key].error = errorMessage(action);\n });\n\n [actions.create, actions.update].forEach((actionCreator) => {\n builder\n .addCase(actionCreator.pending, (state) => {\n state[key].isMutating = true;\n state[key].error = null;\n })\n .addCase(actionCreator.fulfilled, (state, action) => {\n const entity = unwrapEntity(action.payload);\n state[key].isMutating = false;\n state[key].selected = entity;\n state[key].data = upsert(state[key].data, entity);\n })\n .addCase(actionCreator.rejected, (state, action) => {\n state[key].isMutating = false;\n state[key].error = errorMessage(action);\n });\n });\n\n builder\n .addCase(actions.remove.pending, (state) => {\n state[key].isMutating = true;\n state[key].error = null;\n })\n .addCase(actions.remove.fulfilled, (state, action) => {\n const deletedId = action.meta.arg;\n state[key].isMutating = false;\n state[key].data = state[key].data.filter(\n (item) => entityId(item) !== deletedId,\n );\n if (entityId(state[key].selected) === deletedId) {\n state[key].selected = null;\n }\n })\n .addCase(actions.remove.rejected, (state, action) => {\n state[key].isMutating = false;\n state[key].error = errorMessage(action);\n });\n};\n\nconst complaintSlice = createSlice({\n name: 'complaintAppComplaint',\n initialState,\n reducers: {\n clearComplaintError(state, action) {\n const resource = action.payload;\n if (resource && state[resource]?.error !== undefined) {\n state[resource].error = null;\n } else {\n state.error = null;\n }\n },\n clearSelectedComplaintResource(state, action) {\n const resource = action.payload;\n if (resource && state[resource]?.selected !== undefined) {\n state[resource].selected = null;\n }\n },\n resetComplaintState() {\n return initialState;\n },\n },\n extraReducers: (builder) => {\n registerResource(builder, 'types', complaintTypeActions);\n registerResource(builder, 'departments', complaintDepartmentActions);\n registerResource(builder, 'priorities', complaintPriorityActions);\n registerResource(builder, 'workflows', complaintWorkflowActions);\n registerResource(builder, 'statuses', complaintStatusActions);\n\n builder\n .addCase(getDepartmentTree.pending, (state) => {\n state.isLoadingDepartmentTree = true;\n state.error = null;\n })\n .addCase(getDepartmentTree.fulfilled, (state, action) => {\n state.isLoadingDepartmentTree = false;\n const value = unwrapEntity(action.payload);\n state.departmentTree = Array.isArray(value)\n ? value\n : value?.tree ?? value?.items ?? [];\n })\n .addCase(getDepartmentTree.rejected, (state, action) => {\n state.isLoadingDepartmentTree = false;\n state.error = errorMessage(action);\n })\n .addCase(getWorkflowSteps.pending, (state) => {\n state.isLoadingWorkflowSteps = true;\n state.error = null;\n })\n .addCase(getWorkflowSteps.fulfilled, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n state.workflowSteps[action.meta.arg] = unwrapEntity(action.payload);\n })\n .addCase(getWorkflowSteps.rejected, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n state.error = errorMessage(action);\n })\n .addCase(saveWorkflowSteps.pending, (state) => {\n state.isLoadingWorkflowSteps = true;\n state.error = null;\n })\n .addCase(saveWorkflowSteps.fulfilled, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n const result = unwrapEntity(action.payload);\n const workflowId =\n action.meta.arg?.workflowId ?? result?.workflowId ?? result?.id;\n if (workflowId !== undefined) state.workflowSteps[workflowId] = result;\n })\n .addCase(saveWorkflowSteps.rejected, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n state.error = errorMessage(action);\n })\n .addCase(deleteWorkflowSteps.fulfilled, (state, action) => {\n delete state.workflowSteps[action.meta.arg];\n });\n },\n});\n\nexport const {\n clearComplaintError,\n clearSelectedComplaintResource,\n resetComplaintState,\n} = complaintSlice.actions;\n\nexport default complaintSlice.reducer;\n","import { combineReducers } from '@reduxjs/toolkit';\nimport complaintAppComplaint from './complaint/reducers';\n\nconst rootReducer = combineReducers({\n complaintAppComplaint,\n});\n\nexport default rootReducer;\n","import { configureStore } from '@reduxjs/toolkit';\nimport rootReducer from './reducers';\n\nexport const createComplaintStore = (preloadedState) =>\n configureStore({\n reducer: rootReducer,\n preloadedState,\n middleware: (getDefaultMiddleware) =>\n getDefaultMiddleware({\n immutableCheck: false,\n serializableCheck: false,\n }),\n });\n\nconst store = createComplaintStore();\n\nexport { store };\nexport default store;\n","import React from 'react';\n\n/**\n * Button atom — primary | secondary | outline | ghost | link.\n */\nexport default function Button({\n children,\n variant = 'primary',\n size = 'md',\n startIcon,\n endIcon,\n className = '',\n type = 'button',\n disabled = false,\n onClick,\n ...props\n}) {\n const classes = [\n 'ca-btn',\n `ca-btn--${variant}`,\n size === 'sm' ? 'ca-btn--sm' : '',\n size === 'lg' ? 'ca-btn--lg' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n type={type}\n className={classes}\n disabled={disabled}\n onClick={onClick}\n {...props}\n >\n {startIcon ? <span className=\"ca-btn__icon\">{startIcon}</span> : null}\n {children}\n {endIcon ? <span className=\"ca-btn__icon\">{endIcon}</span> : null}\n </button>\n );\n}\n","import React from 'react';\n\n/** Plus icon for create actions. */\nexport default function PlusIcon({ size = 16, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M12 5v14M5 12h14\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\n\nconst VARIANT_CLASS = {\n h1: 'ca-h1',\n h2: 'ca-h2',\n body: 'ca-body',\n label: 'ca-label',\n value: 'ca-value',\n small: 'ca-small',\n link: 'ca-link',\n};\n\nconst VARIANT_TAG = {\n h1: 'h1',\n h2: 'h2',\n body: 'p',\n label: 'span',\n value: 'span',\n small: 'span',\n link: 'button',\n};\n\n/**\n * Typography atom — shared text styles across the package.\n */\nexport default function Typography({\n variant = 'body',\n as,\n className = '',\n children,\n ...props\n}) {\n const Tag = as || VARIANT_TAG[variant] || 'p';\n const baseClass = VARIANT_CLASS[variant] || VARIANT_CLASS.body;\n\n return (\n <Tag className={`${baseClass} ${className}`.trim()} {...props}>\n {children}\n </Tag>\n );\n}\n\nexport function Heading1(props) {\n return <Typography variant=\"h1\" {...props} />;\n}\n\nexport function Heading2(props) {\n return <Typography variant=\"h2\" {...props} />;\n}\n\nexport function BodyText(props) {\n return <Typography variant=\"body\" {...props} />;\n}\n\nexport function LabelText(props) {\n return <Typography variant=\"label\" {...props} />;\n}\n\nexport function ValueText(props) {\n return <Typography variant=\"value\" {...props} />;\n}\n\nexport function LinkText(props) {\n return <Typography variant=\"link\" type=\"button\" {...props} />;\n}\n","import React from 'react';\nimport Button from '../atoms/Button';\nimport PlusIcon from '../atoms/PlusIcon';\nimport { Heading1, BodyText } from '../atoms/Typography';\n\n/**\n * Page header organism — title, description, primary CTA.\n */\nexport default function PageHeader({\n title = 'Complaint Management',\n description,\n actionLabel = 'Create New Form',\n onAction,\n className = '',\n}) {\n return (\n <header className={`ca-page-header ${className}`.trim()}>\n <div className=\"ca-page-header__text\">\n <Heading1>{title}</Heading1>\n {description ? <BodyText>{description}</BodyText> : null}\n </div>\n <div className=\"ca-page-header__actions\">\n <Button startIcon={<PlusIcon />} onClick={onAction}>\n {actionLabel}\n </Button>\n </div>\n </header>\n );\n}\n","import React from 'react';\n\n/**\n * Pill-style status badge atom.\n * @param {'active' | 'inactive' | string} status\n */\nexport default function StatusBadge({ status = 'inactive', label, className = '' }) {\n const normalized = String(status).toLowerCase();\n const isActive = normalized === 'active';\n const text = label ?? (isActive ? 'Active' : 'Inactive');\n\n return (\n <span\n className={`ca-badge ca-badge--${isActive ? 'active' : 'inactive'} ${className}`.trim()}\n >\n {text}\n </span>\n );\n}\n","import React from 'react';\nimport { Heading2 } from '../atoms/Typography';\nimport StatusBadge from '../atoms/StatusBadge';\n\n/**\n * Card header molecule — system title + status badge.\n */\nexport default function CardHeader({\n title,\n status,\n statusLabel,\n titleAsLink = false,\n onTitleClick,\n className = '',\n}) {\n return (\n <div className={`ca-system-card__header ${className}`.trim()}>\n <div className=\"ca-system-card__title-wrap\">\n {titleAsLink ? (\n <button\n type=\"button\"\n className=\"ca-h2 ca-h2--link\"\n onClick={onTitleClick}\n >\n {title}\n </button>\n ) : (\n <Heading2>{title}</Heading2>\n )}\n </div>\n <StatusBadge status={status} label={statusLabel} />\n </div>\n );\n}\n","import React from 'react';\n\n/** Chevron-right icon (reused pattern from Icons/ChevronRightIcon). */\nexport default function ChevronRightIcon({ size = 16, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M9 6l6 6-6 6\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport Typography from '../atoms/Typography';\nimport Button from '../atoms/Button';\nimport ChevronRightIcon from '../atoms/ChevronRightIcon';\n\n/**\n * Card footer molecule — \"Updated on…\" text + Configure button.\n */\nexport default function CardFooter({\n updatedOn,\n configureLabel = 'Configure',\n onConfigure,\n className = '',\n}) {\n return (\n <div className={`ca-system-card__footer ${className}`.trim()}>\n <Typography variant=\"small\" as=\"span\">\n {updatedOn ? `Updated on ${updatedOn}` : ''}\n </Typography>\n <Button\n size=\"sm\"\n onClick={onConfigure}\n endIcon={<ChevronRightIcon size={14} color=\"#fff\" />}\n >\n {configureLabel}\n </Button>\n </div>\n );\n}\n","import React from 'react';\nimport { LabelText, ValueText } from '../atoms/Typography';\n\n/**\n * Data point molecule — label above value (e.g. Departments / 03).\n */\nexport default function DataPoint({ label, value, className = '' }) {\n const display =\n value === null || value === undefined\n ? '—'\n : typeof value === 'number'\n ? String(value).padStart(2, '0')\n : value;\n\n return (\n <div className={`ca-data-point ${className}`.trim()}>\n <LabelText>{label}</LabelText>\n <ValueText>{display}</ValueText>\n </div>\n );\n}\n","import React from 'react';\n\n/** Vertical divider used between data points in system cards. */\nexport default function Divider({ className = '' }) {\n return <div className={`ca-divider ${className}`.trim()} role=\"separator\" aria-orientation=\"vertical\" />;\n}\n","import React from 'react';\nimport CardHeader from '../molecules/CardHeader';\nimport CardFooter from '../molecules/CardFooter';\nimport DataPoint from '../molecules/DataPoint';\nimport Divider from '../atoms/Divider';\nimport { LinkText } from '../atoms/Typography';\n\n/**\n * System / template card organism.\n *\n * Props are data-only so the parent app owns API & auth.\n */\nexport default function SystemCard({\n id,\n title,\n status = 'inactive',\n statusLabel,\n description,\n descriptionHref,\n departments,\n workflows,\n fields,\n formsFilled,\n updatedOn,\n titleAsLink = false,\n onTitleClick,\n onDescriptionClick,\n onConfigure,\n className = '',\n}) {\n const handleConfigure = () => {\n onConfigure?.({\n id,\n title,\n status,\n departments,\n workflows,\n fields,\n formsFilled,\n updatedOn,\n });\n };\n\n const handleDescription = () => {\n if (onDescriptionClick) {\n onDescriptionClick({ id, title, descriptionHref });\n return;\n }\n if (descriptionHref && typeof window !== 'undefined') {\n window.open(descriptionHref, '_blank', 'noopener,noreferrer');\n }\n };\n\n const stats = [\n { label: 'Departments', value: departments },\n { label: 'Workflows', value: workflows },\n { label: 'Fields', value: fields },\n { label: 'Forms Filled', value: formsFilled },\n ];\n\n return (\n <article className={`ca-system-card ${className}`.trim()}>\n <CardHeader\n title={title}\n status={status}\n statusLabel={statusLabel}\n titleAsLink={titleAsLink}\n onTitleClick={() => onTitleClick?.({ id, title })}\n />\n\n {description ? (\n <LinkText onClick={handleDescription}>{description}</LinkText>\n ) : null}\n\n <div className=\"ca-system-card__stats\">\n {stats.map((stat, index) => (\n <React.Fragment key={stat.label}>\n {index > 0 ? <Divider /> : null}\n <DataPoint label={stat.label} value={stat.value} />\n </React.Fragment>\n ))}\n </div>\n\n <CardFooter updatedOn={updatedOn} onConfigure={handleConfigure} />\n </article>\n );\n}\n","import React from 'react';\nimport SystemCard from './SystemCard';\nimport { BodyText } from '../atoms/Typography';\n\n/**\n * Responsive grid of system cards.\n */\nexport default function SystemCardGrid({\n systems = [],\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n emptyMessage = 'No systems found.',\n className = '',\n}) {\n if (!systems.length) {\n return (\n <div className={`ca-system-grid ${className}`.trim()}>\n <div className=\"ca-empty\">\n <BodyText>{emptyMessage}</BodyText>\n </div>\n </div>\n );\n }\n\n return (\n <div className={`ca-system-grid ${className}`.trim()}>\n {systems.map((system) => (\n <SystemCard\n key={system.id ?? system.title}\n {...system}\n onConfigure={onConfigure}\n onTitleClick={onTitleClick}\n onDescriptionClick={onDescriptionClick}\n />\n ))}\n </div>\n );\n}\n","import React from 'react';\n\n/**\n * Text input atom. Supports an optional leading icon (e.g. search).\n */\nexport default function Input({\n value,\n onChange,\n placeholder,\n type = 'text',\n icon,\n className = '',\n inputClassName = '',\n ...props\n}) {\n return (\n <div className={`ca-input-wrap ${className}`.trim()}>\n {icon ? <span className=\"ca-input-wrap__icon\">{icon}</span> : null}\n <input\n type={type}\n className={`ca-input ${icon ? 'ca-input--with-icon' : ''} ${inputClassName}`.trim()}\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n {...props}\n />\n </div>\n );\n}\n","import React from 'react';\n\n/** Magnifying-glass icon for search inputs. */\nexport default function SearchIcon({ size = 18, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z\"\n stroke={color}\n strokeWidth=\"1.75\"\n />\n <path\n d=\"M16.5 16.5 21 21\"\n stroke={color}\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport Input from '../atoms/Input';\nimport SearchIcon from '../atoms/SearchIcon';\n\n/**\n * Search bar molecule — Input + search icon.\n */\nexport default function SearchBar({\n value,\n onChange,\n onSearch,\n placeholder = 'Search',\n className = '',\n}) {\n const handleKeyDown = (e) => {\n if (e.key === 'Enter' && onSearch) {\n onSearch(value);\n }\n };\n\n return (\n <div className={`ca-search ${className}`.trim()}>\n <Input\n value={value}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n icon={<SearchIcon />}\n aria-label={placeholder}\n />\n </div>\n );\n}\n","import React from 'react';\n\n/**\n * Generic loading atom (reused from previous package pattern).\n */\nexport default function Loading({ text = 'Loading', fullScreen = false }) {\n return (\n <div\n className=\"ca-loading\"\n style={fullScreen ? { minHeight: 'calc(100vh - 80px)' } : undefined}\n role=\"status\"\n aria-live=\"polite\"\n >\n <span className=\"ca-loading__spinner\" />\n <span>{text}…</span>\n </div>\n );\n}\n","/** Demo systems matching the Complaint Management design (used when no data is passed). */\nexport const DEMO_SYSTEMS = [\n {\n id: 'qms',\n title: 'QMS - Query Management System',\n status: 'active',\n description: 'Description of the template',\n departments: 3,\n workflows: 12,\n fields: 55,\n formsFilled: 234,\n updatedOn: '12 Mar 2024',\n titleAsLink: true,\n },\n {\n id: 'cms',\n title: 'CMS - Complaint Management System',\n status: 'active',\n description: 'Description of the template',\n departments: 5,\n workflows: 8,\n fields: 42,\n formsFilled: 189,\n updatedOn: '08 Mar 2024',\n },\n {\n id: 'fms',\n title: 'FMS - Feedback Management System',\n status: 'inactive',\n description: 'Description of the template',\n departments: 2,\n workflows: 4,\n fields: 28,\n formsFilled: 56,\n updatedOn: '01 Feb 2024',\n },\n {\n id: 'rms',\n title: 'RMS - Request Management System',\n status: 'active',\n description: 'Description of the template',\n departments: 4,\n workflows: 10,\n fields: 61,\n formsFilled: 312,\n updatedOn: '20 Mar 2024',\n },\n];\n\nexport const DEFAULT_PAGE_DESCRIPTION =\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.';\n","import React, { useMemo, useState, useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport PageHeader from '../components/organisms/PageHeader';\nimport SystemCardGrid from '../components/organisms/SystemCardGrid';\nimport SearchBar from '../components/molecules/SearchBar';\nimport Loading from '../components/atoms/Loading';\nimport { DEMO_SYSTEMS, DEFAULT_PAGE_DESCRIPTION } from '../data/demoSystems';\nimport api from '../utils/api';\n\n/**\n * Normalize API / parent payloads into SystemCard props.\n */\nfunction normalizeSystems(list = []) {\n return list.map((item, index) => ({\n id: item.id ?? item._id ?? `system-${index}`,\n title: item.title ?? item.name ?? 'Untitled',\n status: item.status ?? 'inactive',\n statusLabel: item.statusLabel,\n description: item.description ?? item.templateDescription,\n descriptionHref: item.descriptionHref ?? item.url,\n departments: item.departments ?? item.departmentCount ?? 0,\n workflows: item.workflows ?? item.workflowCount ?? 0,\n fields: item.fields ?? item.fieldCount ?? 0,\n formsFilled: item.formsFilled ?? item.formFilledCount ?? item.forms_filled ?? 0,\n updatedOn: item.updatedOn ?? item.updatedAt ?? item.updated_on,\n titleAsLink: Boolean(item.titleAsLink ?? item.isLink),\n }));\n}\n\n/**\n * Complaint Management page — composes header, search, and system cards.\n *\n * Data comes from:\n * 1. `systems` prop (parent-controlled), or\n * 2. `systemsEndpoint` fetched via shared api client (parent auth/base URL), or\n * 3. demo data (dev / design preview).\n */\nexport default function ComplaintManagementPage({\n title = 'Complaint Management',\n description = DEFAULT_PAGE_DESCRIPTION,\n systems: systemsProp,\n systemsEndpoint,\n useDemoData = true,\n createLabel = 'Create New Form',\n onCreateForm,\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n onSearch,\n}) {\n const navigate = useNavigate();\n const [search, setSearch] = useState('');\n const [fetchedSystems, setFetchedSystems] = useState(null);\n const [fetchError, setFetchError] = useState(null);\n const [fetchStatus, setFetchStatus] = useState(\n systemsEndpoint && !systemsProp ? 'loading' : 'idle',\n );\n\n useEffect(() => {\n if (!systemsEndpoint || systemsProp) {\n return undefined;\n }\n\n const controller = new AbortController();\n\n api\n .get(systemsEndpoint, { signal: controller.signal })\n .then((response) => {\n const payload = response?.data;\n const list = Array.isArray(payload)\n ? payload\n : payload?.data ?? payload?.systems ?? payload?.results ?? [];\n setFetchedSystems(normalizeSystems(list));\n setFetchError(null);\n setFetchStatus('success');\n })\n .catch((err) => {\n if (controller.signal.aborted) return;\n setFetchError(err?.message || 'Failed to load systems');\n setFetchedSystems([]);\n setFetchStatus('error');\n });\n\n return () => controller.abort();\n }, [systemsEndpoint, systemsProp]);\n\n const sourceSystems = useMemo(() => {\n if (systemsProp) return normalizeSystems(systemsProp);\n if (fetchedSystems) return fetchedSystems;\n if (useDemoData) return DEMO_SYSTEMS;\n return [];\n }, [systemsProp, fetchedSystems, useDemoData]);\n\n const filteredSystems = useMemo(() => {\n const q = search.trim().toLowerCase();\n if (!q) return sourceSystems;\n return sourceSystems.filter((s) => {\n const haystack = `${s.title} ${s.description ?? ''} ${s.status ?? ''}`.toLowerCase();\n return haystack.includes(q);\n });\n }, [sourceSystems, search]);\n\n const handleSearchChange = (e) => {\n const next = e.target.value;\n setSearch(next);\n onSearch?.(next);\n };\n\n const handleConfigure = (system) => {\n onConfigure?.(system);\n navigate(`/settings/${system.id ?? 'new'}?step=1`);\n };\n\n const handleCreate = () => {\n onCreateForm?.();\n navigate('/settings/new?step=1');\n };\n\n const loading = fetchStatus === 'loading';\n\n return (\n <>\n <PageHeader\n title={title}\n description={description}\n actionLabel={createLabel}\n onAction={handleCreate}\n />\n\n <SearchBar value={search} onChange={handleSearchChange} placeholder=\"Search\" />\n\n {loading ? (\n <Loading text=\"Loading systems\" />\n ) : fetchError ? (\n <div className=\"ca-empty\">\n <p className=\"ca-body\">{fetchError}</p>\n </div>\n ) : (\n <SystemCardGrid\n systems={filteredSystems}\n onConfigure={handleConfigure}\n onTitleClick={onTitleClick}\n onDescriptionClick={onDescriptionClick}\n emptyMessage={search ? 'No systems match your search.' : 'No systems found.'}\n />\n )}\n </>\n );\n}\n","import React from 'react';\n\n/**\n * Horizontal stepper organism.\n * Reflects URL-driven step (1-indexed).\n */\nexport default function Stepper({\n steps = [],\n currentStep = 1,\n onStepClick,\n className = '',\n size = 'md',\n}) {\n return (\n <nav\n className={`ca-stepper ca-stepper--${size} ${className}`.trim()}\n aria-label=\"Progress\"\n >\n {steps.map((step, index) => {\n const stepId = step.id ?? index + 1;\n const isActive = stepId === currentStep;\n const isDone = stepId < currentStep;\n const clickable = Boolean(onStepClick) && (isDone || isActive);\n\n return (\n <React.Fragment key={stepId}>\n {index > 0 ? (\n <div\n className={`ca-stepper__line ${isDone || isActive ? 'ca-stepper__line--active' : ''}`}\n />\n ) : null}\n <button\n type=\"button\"\n className={[\n 'ca-stepper__item',\n isActive ? 'ca-stepper__item--active' : '',\n isDone ? 'ca-stepper__item--done' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => clickable && onStepClick?.(stepId)}\n disabled={!clickable}\n aria-current={isActive ? 'step' : undefined}\n >\n <span className=\"ca-stepper__circle\">{stepId}</span>\n <span className=\"ca-stepper__label\">{step.label}</span>\n </button>\n </React.Fragment>\n );\n })}\n </nav>\n );\n}\n","import React, { createContext, useContext, useMemo, useState, useCallback } from 'react';\n\nconst SettingsWizardContext = createContext(null);\n\nconst createEmptyWizardState = () => ({\n categoryType: '',\n active: false,\n description: '',\n roles: [],\n departmentRows: [\n { id: '1', department: '', subDepartment: '', roles: '' },\n ],\n priorityDraft: '',\n priorities: [],\n defaultPriorityId: null,\n selectedDeptNode: null,\n workflow: {\n name: '',\n tatMinutes: '',\n description: '',\n statuses: [],\n steps: [],\n },\n fieldDraft: { name: '', type: '' },\n formFields: [],\n});\n\nexport function SettingsWizardProvider({ children, initialValues }) {\n const [state, setState] = useState(() => ({\n ...createEmptyWizardState(),\n ...initialValues,\n workflow: {\n ...createEmptyWizardState().workflow,\n ...initialValues?.workflow,\n },\n }));\n\n const update = useCallback((patch) => {\n setState((prev) => ({ ...prev, ...patch }));\n }, []);\n\n const updateWorkflow = useCallback((patch) => {\n setState((prev) => ({\n ...prev,\n workflow: { ...prev.workflow, ...patch },\n }));\n }, []);\n\n const value = useMemo(\n () => ({ state, setState, update, updateWorkflow }),\n [state, update, updateWorkflow],\n );\n\n return (\n <SettingsWizardContext.Provider value={value}>\n {children}\n </SettingsWizardContext.Provider>\n );\n}\n\n// Context hook co-located with provider (standard React pattern).\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useSettingsWizard() {\n const ctx = useContext(SettingsWizardContext);\n if (!ctx) {\n throw new Error('useSettingsWizard must be used within SettingsWizardProvider');\n }\n return ctx;\n}\n\nexport default SettingsWizardContext;\n","/** Settings wizard step definitions (1-indexed for URL ?step=). */\nexport const SETTINGS_STEPS = [\n {\n id: 1,\n key: 'category',\n label: 'Category Type',\n title: 'Category Type',\n description: 'Define the type and basic details for this category type.',\n },\n {\n id: 2,\n key: 'departments',\n label: 'Departments',\n title: 'Departments',\n description: '----',\n },\n {\n id: 3,\n key: 'priorities',\n label: 'Priorities',\n title: 'Priorities',\n description: '----',\n },\n {\n id: 4,\n key: 'workflow',\n label: 'Workflow',\n title: 'Workflow',\n description: '----',\n },\n {\n id: 5,\n key: 'formFields',\n label: 'Form Fields',\n title: 'Form Fields',\n description: '----',\n },\n {\n id: 6,\n key: 'review',\n label: 'Review & Publish',\n title: 'Review & Publish',\n description: 'Review your configuration and publish.',\n },\n];\n\nexport const WORKFLOW_SUBSTEPS = [\n { id: 1, label: 'Create Workflow' },\n { id: 2, label: 'Statuses' },\n { id: 3, label: 'Workflow Steps' },\n];\n\nexport const QUICK_PRIORITIES = ['Urgent', 'High', 'Medium', 'Low'];\n\nexport const FIELD_LIBRARY = [\n { id: 'short', label: 'Textfield / Short Answer', icon: 'text' },\n { id: 'long', label: 'Description / Long Answer', icon: 'doc' },\n { id: 'date', label: 'Date', icon: 'calendar' },\n { id: 'time', label: 'Time', icon: 'clock' },\n { id: 'single', label: 'Dropdown - Single Select', icon: 'chevron' },\n { id: 'multi', label: 'Dropdown - Multiple Select', icon: 'chevron' },\n];\n\nexport const DEMO_ROLES = [\n 'Store Staff',\n 'HR Executive',\n 'HR Manager',\n 'Store Manager',\n 'Admin',\n];\n\nexport const DEMO_CATEGORY_TYPES = [\n { value: 'qms', label: 'QMS - Query Management System' },\n { value: 'cms', label: 'CMS - Complaint Management System' },\n { value: 'fms', label: 'FMS - Feedback Management System' },\n { value: 'rms', label: 'RMS - Request Management System' },\n];\n\nexport const DEMO_DEPARTMENTS_TREE = [\n {\n id: 'hr',\n name: 'HR',\n children: [\n { id: 'payroll', name: 'Payroll' },\n { id: 'recruitment', name: 'Recruitment' },\n ],\n },\n {\n id: 'finance',\n name: 'Finance',\n children: [{ id: 'ap', name: 'Accounts Payable' }],\n },\n {\n id: 'it',\n name: 'IT',\n children: [],\n },\n];\n\nexport const PRIORITY_COLORS = [\n { value: '#EF4444', label: 'Red' },\n { value: '#F59E0B', label: 'Orange' },\n { value: '#EAB308', label: 'Yellow' },\n { value: '#22C55E', label: 'Green' },\n { value: '#3B82F6', label: 'Blue' },\n { value: '#8B5CF6', label: 'Purple' },\n];\n","import React from 'react';\n\n/** Stacked-layers icon used in settings card headers. */\nexport default function LayersIcon({ size = 28, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n style={{ color: 'var(--ca-primary)' }}\n {...props}\n >\n <path\n d=\"M12 3 3 8l9 5 9-5-9-5Z\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M3 12.5 12 17.5l9-5\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M3 16.5 12 21.5l9-5\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport LayersIcon from '../atoms/LayersIcon';\nimport Button from '../atoms/Button';\nimport ChevronRightIcon from '../atoms/ChevronRightIcon';\nimport { Heading2, BodyText } from '../atoms/Typography';\n\n/**\n * Settings card header — icon, title, description, Next button.\n */\nexport default function SettingsCardHeader({\n title,\n description,\n nextLabel = 'Next',\n onNext,\n showNext = true,\n nextDisabled = false,\n nextVariant = 'primary',\n className = '',\n}) {\n return (\n <div className={`ca-settings-card__header ${className}`.trim()}>\n <div className=\"ca-settings-card__heading\">\n <LayersIcon />\n <div>\n <Heading2>{title}</Heading2>\n {description ? <BodyText className=\"ca-settings-card__desc\">{description}</BodyText> : null}\n </div>\n </div>\n {showNext ? (\n <Button\n variant={nextVariant}\n disabled={nextDisabled}\n onClick={onNext}\n endIcon={<ChevronRightIcon size={14} color=\"currentColor\" />}\n >\n {nextLabel}\n </Button>\n ) : null}\n </div>\n );\n}\n","import React from 'react';\nimport SettingsCardHeader from '../molecules/SettingsCardHeader';\n\n/**\n * White bordered card shell for settings step content.\n */\nexport default function SettingsCard({\n title,\n description,\n onNext,\n nextLabel,\n showNext = true,\n nextDisabled,\n nextVariant,\n children,\n footer,\n className = '',\n}) {\n return (\n <section className={`ca-settings-card ${className}`.trim()}>\n <SettingsCardHeader\n title={title}\n description={description}\n onNext={onNext}\n nextLabel={nextLabel}\n showNext={showNext}\n nextDisabled={nextDisabled}\n nextVariant={nextVariant}\n />\n <div className=\"ca-settings-card__divider\" />\n <div className=\"ca-settings-card__body\">{children}</div>\n {footer ? <div className=\"ca-settings-card__footer\">{footer}</div> : null}\n </section>\n );\n}\n","import React from 'react';\n\n/**\n * Field label atom with optional trailing hint (e.g. character count).\n */\nexport default function FieldLabel({ children, hint, htmlFor, className = '' }) {\n return (\n <div className={`ca-field-label ${className}`.trim()}>\n <label className=\"ca-label\" htmlFor={htmlFor}>\n {children}\n </label>\n {hint != null ? <span className=\"ca-field-label__hint\">{hint}</span> : null}\n </div>\n );\n}\n","import React from 'react';\n\nexport default function ChevronDownIcon({ size = 16, color = 'currentColor', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <path\n d=\"M6 9l6 6 6-6\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport ChevronDownIcon from './ChevronDownIcon';\n\n/**\n * Select / dropdown atom.\n */\nexport default function Select({\n value,\n onChange,\n options = [],\n placeholder = 'Select',\n className = '',\n disabled = false,\n ...props\n}) {\n return (\n <div className={`ca-select ${className}`.trim()}>\n <select\n className=\"ca-select__control\"\n value={value ?? ''}\n onChange={onChange}\n disabled={disabled}\n {...props}\n >\n <option value=\"\" disabled>\n {placeholder}\n </option>\n {options.map((opt) => {\n const val = typeof opt === 'string' ? opt : opt.value;\n const label = typeof opt === 'string' ? opt : opt.label;\n return (\n <option key={val} value={val}>\n {label}\n </option>\n );\n })}\n </select>\n <span className=\"ca-select__chevron\">\n <ChevronDownIcon size={16} />\n </span>\n </div>\n );\n}\n","import React from 'react';\n\n/**\n * Multi-line text input atom.\n */\nexport default function Textarea({\n value,\n onChange,\n placeholder,\n maxLength,\n rows = 4,\n className = '',\n ...props\n}) {\n return (\n <textarea\n className={`ca-textarea ${className}`.trim()}\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows}\n {...props}\n />\n );\n}\n","import React from 'react';\nimport FieldLabel from '../atoms/FieldLabel';\nimport Input from '../atoms/Input';\nimport Select from '../atoms/Select';\nimport Textarea from '../atoms/Textarea';\n\n/**\n * Labeled form control molecule.\n */\nexport default function FormField({\n label,\n hint,\n children,\n className = '',\n htmlFor,\n}) {\n return (\n <div className={`ca-form-field ${className}`.trim()}>\n {label != null ? (\n <FieldLabel htmlFor={htmlFor} hint={hint}>\n {label}\n </FieldLabel>\n ) : null}\n {children}\n </div>\n );\n}\n\nexport function FormInput({ label, hint, ...inputProps }) {\n return (\n <FormField label={label} hint={hint} htmlFor={inputProps.id}>\n <Input {...inputProps} />\n </FormField>\n );\n}\n\nexport function FormSelect({ label, hint, ...selectProps }) {\n return (\n <FormField label={label} hint={hint} htmlFor={selectProps.id}>\n <Select {...selectProps} />\n </FormField>\n );\n}\n\nexport function FormTextarea({ label, hint, maxLength, value = '', ...textareaProps }) {\n const computedHint =\n hint ??\n (maxLength != null ? `${String(value).length}/${maxLength}` : undefined);\n\n return (\n <FormField label={label} hint={computedHint} htmlFor={textareaProps.id}>\n <Textarea value={value} maxLength={maxLength} {...textareaProps} />\n </FormField>\n );\n}\n","import React from 'react';\n\n/**\n * Toggle switch atom.\n */\nexport default function Toggle({\n checked = false,\n onChange,\n disabled = false,\n 'aria-label': ariaLabel = 'Toggle',\n className = '',\n}) {\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={ariaLabel}\n disabled={disabled}\n className={`ca-toggle ${checked ? 'ca-toggle--on' : ''} ${className}`.trim()}\n onClick={() => onChange?.(!checked)}\n >\n <span className=\"ca-toggle__thumb\" />\n </button>\n );\n}\n","import React from 'react';\nimport Toggle from '../atoms/Toggle';\nimport { LabelText } from '../atoms/Typography';\n\n/** Label + toggle molecule. */\nexport default function ToggleField({\n label = 'Active',\n checked,\n onChange,\n className = '',\n}) {\n return (\n <div className={`ca-toggle-field ${className}`.trim()}>\n <LabelText>{label}</LabelText>\n <Toggle checked={checked} onChange={onChange} aria-label={label} />\n </div>\n );\n}\n","import React from 'react';\n\nexport default function CloseIcon({ size = 12, color = 'currentColor', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <path\n d=\"M6 6l12 12M18 6L6 18\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport CloseIcon from './CloseIcon';\n\n/**\n * Removable tag / pill atom.\n */\nexport default function Tag({ label, onRemove, className = '' }) {\n return (\n <span className={`ca-tag ${className}`.trim()}>\n {label}\n {onRemove ? (\n <button\n type=\"button\"\n className=\"ca-tag__remove\"\n onClick={onRemove}\n aria-label={`Remove ${label}`}\n >\n <CloseIcon size={10} />\n </button>\n ) : null}\n </span>\n );\n}\n","import React, { useState } from 'react';\nimport Select from '../atoms/Select';\nimport Tag from '../atoms/Tag';\nimport FieldLabel from '../atoms/FieldLabel';\n\n/**\n * Multi-select via dropdown + removable tags.\n */\nexport default function RoleMultiSelect({\n label = 'Select Roles',\n options = [],\n value = [],\n onChange,\n placeholder = 'Select roles',\n className = '',\n}) {\n const [openValue, setOpenValue] = useState('');\n\n const available = options.filter((opt) => {\n const val = typeof opt === 'string' ? opt : opt.value;\n return !value.includes(val);\n });\n\n const handleSelect = (e) => {\n const next = e.target.value;\n if (!next) return;\n onChange?.([...value, next]);\n setOpenValue('');\n };\n\n const handleRemove = (role) => {\n onChange?.(value.filter((r) => r !== role));\n };\n\n return (\n <div className={`ca-role-select ${className}`.trim()}>\n <FieldLabel>{label}</FieldLabel>\n <Select\n value={openValue}\n onChange={handleSelect}\n options={available}\n placeholder={placeholder}\n />\n {value.length > 0 ? (\n <div className=\"ca-tag-list\">\n {value.map((role) => (\n <Tag key={role} label={role} onRemove={() => handleRemove(role)} />\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport { FormSelect, FormTextarea } from '../../molecules/FormField';\nimport ToggleField from '../../molecules/ToggleField';\nimport RoleMultiSelect from '../../molecules/RoleMultiSelect';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_CATEGORY_TYPES, DEMO_ROLES } from '../../../data/settingsSteps';\n\nexport default function CategoryTypeStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n onNext={onNext}\n >\n <div className=\"ca-step-section\">\n <div className=\"ca-step-row ca-step-row--category\">\n <FormSelect\n label=\"Category Type\"\n className=\"ca-step-row__grow\"\n value={state.categoryType}\n onChange={(e) => update({ categoryType: e.target.value })}\n options={DEMO_CATEGORY_TYPES}\n placeholder=\"Select category type\"\n />\n <ToggleField\n checked={state.active}\n onChange={(active) => update({ active })}\n />\n </div>\n </div>\n\n <div className=\"ca-step-section\">\n <FormTextarea\n label=\"Description\"\n placeholder=\"Enter description\"\n maxLength={500}\n value={state.description}\n onChange={(e) => update({ description: e.target.value })}\n rows={5}\n />\n </div>\n\n <div className=\"ca-step-section ca-step-section--last\">\n <RoleMultiSelect\n options={DEMO_ROLES}\n value={state.roles}\n onChange={(roles) => update({ roles })}\n />\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Select from '../../atoms/Select';\nimport Input from '../../atoms/Input';\nimport Button from '../../atoms/Button';\nimport PlusIcon from '../../atoms/PlusIcon';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_ROLES } from '../../../data/settingsSteps';\n\nconst DEPARTMENT_OPTIONS = ['HR', 'Finance', 'IT', 'Operations', 'Sales'];\n\nfunction newRow() {\n return {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,\n department: '',\n subDepartment: '',\n roles: '',\n };\n}\n\nexport default function DepartmentsStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n const rows = state.departmentRows;\n\n const patchRow = (id, patch) => {\n update({\n departmentRows: rows.map((r) => (r.id === id ? { ...r, ...patch } : r)),\n });\n };\n\n const addRow = () => {\n update({ departmentRows: [...rows, newRow()] });\n };\n\n return (\n <SettingsCard title={stepMeta.title} description={stepMeta.description} onNext={onNext}>\n <div className=\"ca-dept-table\">\n <div className=\"ca-dept-table__head\">\n <div>Department</div>\n <div>Sub-department</div>\n <div>Roles</div>\n <div />\n </div>\n {rows.map((row) => (\n <div className=\"ca-dept-table__row\" key={row.id}>\n <Select\n value={row.department}\n onChange={(e) => patchRow(row.id, { department: e.target.value })}\n options={DEPARTMENT_OPTIONS}\n placeholder=\"Select or add department\"\n />\n <div className=\"ca-input-with-action\">\n <Input\n value={row.subDepartment}\n onChange={(e) => patchRow(row.id, { subDepartment: e.target.value })}\n placeholder=\"Add sub-department\"\n />\n <button\n type=\"button\"\n className=\"ca-input-with-action__btn\"\n aria-label=\"Add sub-department\"\n onClick={() => {\n if (!row.subDepartment.trim()) return;\n }}\n >\n <PlusIcon size={14} color=\"currentColor\" />\n </button>\n </div>\n <Select\n value={row.roles}\n onChange={(e) => patchRow(row.id, { roles: e.target.value })}\n options={DEMO_ROLES}\n placeholder=\"Select roles\"\n />\n <Button variant=\"link\" size=\"sm\" onClick={addRow}>\n + Add\n </Button>\n </div>\n ))}\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\n\n/**\n * Chip / quick-add pill atom.\n */\nexport default function Chip({ children, onClick, className = '', active = false }) {\n return (\n <button\n type=\"button\"\n className={`ca-chip ${active ? 'ca-chip--active' : ''} ${className}`.trim()}\n onClick={onClick}\n >\n {children}\n </button>\n );\n}\n","import React from 'react';\n\n/**\n * Radio button atom.\n */\nexport default function Radio({\n checked = false,\n onChange,\n name,\n value,\n 'aria-label': ariaLabel,\n className = '',\n}) {\n return (\n <label className={`ca-radio ${className}`.trim()}>\n <input\n type=\"radio\"\n className=\"ca-radio__input\"\n name={name}\n value={value}\n checked={checked}\n onChange={onChange}\n aria-label={ariaLabel}\n />\n <span className=\"ca-radio__mark\" />\n </label>\n );\n}\n","import React from 'react';\n\nexport default function DragHandleIcon({ size = 16, color = '#9CA3AF', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <circle cx=\"5\" cy=\"4\" r=\"1.2\" fill={color} />\n <circle cx=\"11\" cy=\"4\" r=\"1.2\" fill={color} />\n <circle cx=\"5\" cy=\"8\" r=\"1.2\" fill={color} />\n <circle cx=\"11\" cy=\"8\" r=\"1.2\" fill={color} />\n <circle cx=\"5\" cy=\"12\" r=\"1.2\" fill={color} />\n <circle cx=\"11\" cy=\"12\" r=\"1.2\" fill={color} />\n </svg>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Input from '../../atoms/Input';\nimport Button from '../../atoms/Button';\nimport Chip from '../../atoms/Chip';\nimport Select from '../../atoms/Select';\nimport Radio from '../../atoms/Radio';\nimport DragHandleIcon from '../../atoms/DragHandleIcon';\nimport FieldLabel from '../../atoms/FieldLabel';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { QUICK_PRIORITIES, PRIORITY_COLORS } from '../../../data/settingsSteps';\n\nfunction makePriority(name) {\n return {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,\n name,\n color: '',\n };\n}\n\nexport default function PrioritiesStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n const { priorityDraft, priorities, defaultPriorityId } = state;\n\n const addPriority = (name) => {\n const trimmed = (name ?? priorityDraft).trim();\n if (!trimmed) return;\n if (priorities.some((p) => p.name.toLowerCase() === trimmed.toLowerCase())) {\n update({ priorityDraft: '' });\n return;\n }\n const next = [...priorities, makePriority(trimmed)];\n update({\n priorities: next,\n priorityDraft: '',\n defaultPriorityId: defaultPriorityId ?? next[0].id,\n });\n };\n\n const patchPriority = (id, patch) => {\n update({\n priorities: priorities.map((p) => (p.id === id ? { ...p, ...patch } : p)),\n });\n };\n\n const colorOptions = PRIORITY_COLORS.map((c) => ({\n value: c.value,\n label: c.label,\n }));\n\n return (\n <SettingsCard title={stepMeta.title} description={stepMeta.description} onNext={onNext}>\n <div className=\"ca-priority-add\">\n <FieldLabel>Priorities</FieldLabel>\n <div className=\"ca-priority-add__row\">\n <Input\n value={priorityDraft}\n onChange={(e) => update({ priorityDraft: e.target.value })}\n placeholder=\"Add priority\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n addPriority();\n }\n }}\n />\n <Button variant=\"outline\" onClick={() => addPriority()}>\n + Add\n </Button>\n </div>\n <div className=\"ca-chip-row\">\n {QUICK_PRIORITIES.map((p) => (\n <Chip key={p} onClick={() => addPriority(p)}>\n + {p}\n </Chip>\n ))}\n </div>\n </div>\n\n <div className=\"ca-priority-table\">\n <div className=\"ca-priority-table__head\">\n <div>Priority</div>\n <div>Color</div>\n <div>Default</div>\n </div>\n {(priorities.length ? priorities : [makePriority('')]).map((row, index) => {\n const isPlaceholder = !priorities.length;\n return (\n <div className=\"ca-priority-table__row\" key={row.id || index}>\n <div className=\"ca-priority-table__name\">\n <DragHandleIcon />\n <Input\n value={isPlaceholder ? priorityDraft : row.name}\n onChange={(e) => {\n if (isPlaceholder) {\n update({ priorityDraft: e.target.value });\n } else {\n patchPriority(row.id, { name: e.target.value });\n }\n }}\n placeholder=\"Add priority\"\n />\n </div>\n <Select\n value={row.color}\n onChange={(e) => {\n if (!isPlaceholder) patchPriority(row.id, { color: e.target.value });\n }}\n options={colorOptions}\n placeholder=\"Select color\"\n />\n <Radio\n name=\"default-priority\"\n value={row.id}\n checked={!isPlaceholder && defaultPriorityId === row.id}\n onChange={() => !isPlaceholder && update({ defaultPriorityId: row.id })}\n aria-label=\"Default priority\"\n />\n </div>\n );\n })}\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Stepper from '../../organisms/Stepper';\nimport { FormInput, FormTextarea } from '../../molecules/FormField';\nimport Button from '../../atoms/Button';\nimport ChevronRightIcon from '../../atoms/ChevronRightIcon';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_DEPARTMENTS_TREE, WORKFLOW_SUBSTEPS } from '../../../data/settingsSteps';\n\nexport default function WorkflowStep({\n onNext,\n stepMeta,\n substep = 1,\n onSubstepChange,\n}) {\n const { state, update, updateWorkflow } = useSettingsWizard();\n const { selectedDeptNode, workflow } = state;\n\n const handleNextSubstep = () => {\n if (substep < WORKFLOW_SUBSTEPS.length) {\n onSubstepChange?.(substep + 1);\n return;\n }\n onNext?.();\n };\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n onNext={onNext}\n nextVariant=\"secondary\"\n >\n <div className=\"ca-workflow\">\n <aside className=\"ca-workflow__sidebar\">\n <h3 className=\"ca-workflow__sidebar-title\">Select Department</h3>\n <p className=\"ca-small\">Add workflow for selected department</p>\n <ul className=\"ca-dept-tree\">\n {DEMO_DEPARTMENTS_TREE.map((dept) => (\n <li key={dept.id} className=\"ca-dept-tree__group\">\n <button\n type=\"button\"\n className={`ca-dept-tree__item ${\n selectedDeptNode === dept.id ? 'ca-dept-tree__item--active' : ''\n }`}\n onClick={() => update({ selectedDeptNode: dept.id })}\n >\n {dept.name}\n </button>\n {dept.children?.length ? (\n <ul className=\"ca-dept-tree__children\">\n {dept.children.map((child) => (\n <li key={child.id}>\n <button\n type=\"button\"\n className={`ca-dept-tree__item ca-dept-tree__item--child ${\n selectedDeptNode === child.id\n ? 'ca-dept-tree__item--active'\n : ''\n }`}\n onClick={() => update({ selectedDeptNode: child.id })}\n >\n <span className=\"ca-dept-tree__branch\" aria-hidden=\"true\">\n └\n </span>\n {child.name}\n </button>\n </li>\n ))}\n </ul>\n ) : null}\n </li>\n ))}\n </ul>\n </aside>\n\n <div className=\"ca-workflow__main\">\n <Stepper\n steps={WORKFLOW_SUBSTEPS}\n currentStep={substep}\n onStepClick={onSubstepChange}\n size=\"sm\"\n className=\"ca-workflow__substepper\"\n />\n\n {substep === 1 ? (\n <div className=\"ca-workflow__form\">\n <div className=\"ca-step-row\">\n <FormInput\n className=\"ca-step-row__grow\"\n label=\"Name\"\n placeholder=\"Enter name\"\n value={workflow.name}\n onChange={(e) => updateWorkflow({ name: e.target.value })}\n />\n <FormInput\n className=\"ca-step-row__grow\"\n label=\"TAT Minutes\"\n placeholder=\"Enter here\"\n value={workflow.tatMinutes}\n onChange={(e) => updateWorkflow({ tatMinutes: e.target.value })}\n />\n </div>\n <FormTextarea\n label=\"Description\"\n placeholder=\"Enter description\"\n value={workflow.description}\n onChange={(e) => updateWorkflow({ description: e.target.value })}\n rows={5}\n />\n </div>\n ) : null}\n\n {substep === 2 ? (\n <div className=\"ca-workflow__placeholder\">\n <p className=\"ca-body\">\n Configure workflow statuses for the selected department.\n </p>\n </div>\n ) : null}\n\n {substep === 3 ? (\n <div className=\"ca-workflow__placeholder\">\n <p className=\"ca-body\">Define ordered workflow steps and assignees.</p>\n </div>\n ) : null}\n\n <div className=\"ca-workflow__actions\">\n <Button\n onClick={handleNextSubstep}\n endIcon={<ChevronRightIcon size={14} color=\"#fff\" />}\n >\n Next Step\n </Button>\n </div>\n </div>\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\n\nexport default function TrashIcon({ size = 16, color = '#9CA3AF', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <path\n d=\"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m2 0v12a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V7h12Z\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Input from '../../atoms/Input';\nimport Select from '../../atoms/Select';\nimport Button from '../../atoms/Button';\nimport Toggle from '../../atoms/Toggle';\nimport DragHandleIcon from '../../atoms/DragHandleIcon';\nimport TrashIcon from '../../atoms/TrashIcon';\nimport FieldLabel from '../../atoms/FieldLabel';\nimport ChevronRightIcon from '../../atoms/ChevronRightIcon';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { FIELD_LIBRARY } from '../../../data/settingsSteps';\n\nconst FIELD_TYPE_OPTIONS = FIELD_LIBRARY.map((f) => ({\n value: f.id,\n label: f.label,\n}));\n\nfunction FieldLibraryIcon({ type }) {\n const map = {\n text: 'A',\n doc: '¶',\n calendar: '口',\n clock: '◷',\n chevron: '▾',\n };\n return <span className=\"ca-field-lib__glyph\">{map[type] || '▾'}</span>;\n}\n\nexport default function FormFieldsStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n const { fieldDraft, formFields } = state;\n\n const setDraft = (patch) => update({ fieldDraft: { ...fieldDraft, ...patch } });\n\n const addField = () => {\n if (!fieldDraft.name.trim() || !fieldDraft.type) return;\n const typeLabel =\n FIELD_TYPE_OPTIONS.find((o) => o.value === fieldDraft.type)?.label || fieldDraft.type;\n update({\n formFields: [\n ...formFields,\n {\n id: `${Date.now()}`,\n name: fieldDraft.name.trim(),\n type: fieldDraft.type,\n typeLabel,\n required: false,\n },\n ],\n fieldDraft: { name: '', type: '' },\n });\n };\n\n const patchField = (id, patch) => {\n update({\n formFields: formFields.map((f) => (f.id === id ? { ...f, ...patch } : f)),\n });\n };\n\n const removeField = (id) => {\n update({ formFields: formFields.filter((f) => f.id !== id) });\n };\n\n const applyLibraryType = (item) => {\n setDraft({ type: item.id });\n };\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n showNext={false}\n footer={\n <Button\n onClick={onNext}\n endIcon={<ChevronRightIcon size={14} color=\"#fff\" />}\n >\n Next\n </Button>\n }\n >\n <div className=\"ca-form-fields\">\n <aside className=\"ca-field-lib\">\n <h3 className=\"ca-field-lib__title\">Field Library</h3>\n <p className=\"ca-small\">Drag and drop the fields to add.</p>\n <ul className=\"ca-field-lib__list\">\n {FIELD_LIBRARY.map((item) => (\n <li key={item.id}>\n <button\n type=\"button\"\n className=\"ca-field-lib__item\"\n draggable\n onDragStart={(e) => {\n e.dataTransfer.setData('text/plain', item.id);\n }}\n onClick={() => applyLibraryType(item)}\n >\n <FieldLibraryIcon type={item.icon} />\n <span>{item.label}</span>\n </button>\n </li>\n ))}\n </ul>\n </aside>\n\n <div className=\"ca-form-fields__main\">\n <div\n className=\"ca-add-fields\"\n onDragOver={(e) => e.preventDefault()}\n onDrop={(e) => {\n e.preventDefault();\n const type = e.dataTransfer.getData('text/plain');\n if (type) setDraft({ type });\n }}\n >\n <div className=\"ca-add-fields__top\">\n <h3 className=\"ca-add-fields__title\">Add Fields</h3>\n <Button onClick={addField}>Add Field</Button>\n </div>\n <div className=\"ca-step-row\">\n <div className=\"ca-step-row__grow\">\n <FieldLabel>Name of Field</FieldLabel>\n <Input\n value={fieldDraft.name}\n onChange={(e) => setDraft({ name: e.target.value })}\n placeholder=\"Enter name of the field.\"\n />\n </div>\n <div className=\"ca-step-row__grow\">\n <FieldLabel>Type of Field</FieldLabel>\n <Select\n value={fieldDraft.type}\n onChange={(e) => setDraft({ type: e.target.value })}\n options={FIELD_TYPE_OPTIONS}\n placeholder=\"Select type of the field.\"\n />\n </div>\n </div>\n </div>\n\n <div className=\"ca-fields-table\">\n <div className=\"ca-fields-table__head\">\n <div>Field Name</div>\n <div>Field Type</div>\n <div>Required</div>\n <div />\n </div>\n {formFields.length === 0 ? (\n <div className=\"ca-fields-table__empty\">\n <p className=\"ca-small\">No fields added yet.</p>\n </div>\n ) : (\n formFields.map((field) => (\n <div className=\"ca-fields-table__row\" key={field.id}>\n <div className=\"ca-fields-table__name\">\n <DragHandleIcon />\n <Input\n value={field.name}\n onChange={(e) => patchField(field.id, { name: e.target.value })}\n />\n </div>\n <Select\n value={field.type}\n onChange={(e) => {\n const type = e.target.value;\n const typeLabel =\n FIELD_TYPE_OPTIONS.find((o) => o.value === type)?.label || type;\n patchField(field.id, { type, typeLabel });\n }}\n options={FIELD_TYPE_OPTIONS}\n placeholder=\"Select type\"\n />\n <Toggle\n checked={field.required}\n onChange={(required) => patchField(field.id, { required })}\n aria-label=\"Required\"\n />\n <button\n type=\"button\"\n className=\"ca-icon-btn\"\n aria-label=\"Delete field\"\n onClick={() => removeField(field.id)}\n >\n <TrashIcon />\n </button>\n </div>\n ))\n )}\n </div>\n </div>\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Button from '../../atoms/Button';\nimport { BodyText, LabelText, Heading2 } from '../../atoms/Typography';\nimport StatusBadge from '../../atoms/StatusBadge';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_CATEGORY_TYPES } from '../../../data/settingsSteps';\n\nexport default function ReviewPublishStep({ onPublish, stepMeta }) {\n const { state } = useSettingsWizard();\n const categoryLabel =\n DEMO_CATEGORY_TYPES.find((c) => c.value === state.categoryType)?.label ||\n state.categoryType;\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n nextLabel=\"Publish\"\n onNext={onPublish}\n >\n <div className=\"ca-review\">\n <section className=\"ca-review__block\">\n <Heading2>Category Type</Heading2>\n <div className=\"ca-review__row\">\n <LabelText>{categoryLabel}</LabelText>\n <StatusBadge status={state.active ? 'active' : 'inactive'} />\n </div>\n {state.description ? <BodyText>{state.description}</BodyText> : null}\n {state.roles.length ? (\n <BodyText>Roles: {state.roles.join(', ')}</BodyText>\n ) : null}\n </section>\n\n <section className=\"ca-review__block\">\n <Heading2>Departments</Heading2>\n <BodyText>\n {state.departmentRows.filter((r) => r.department).length} department row(s)\n configured\n </BodyText>\n </section>\n\n <section className=\"ca-review__block\">\n <Heading2>Priorities</Heading2>\n <BodyText>\n {state.priorities.length\n ? state.priorities.map((p) => p.name).join(', ')\n : 'No priorities added'}\n </BodyText>\n </section>\n\n <section className=\"ca-review__block\">\n <Heading2>Workflow</Heading2>\n <BodyText>\n {state.workflow.name\n ? `${state.workflow.name} (TAT: ${state.workflow.tatMinutes || '—'} min)`\n : 'No workflow created yet'}\n </BodyText>\n </section>\n\n <section className=\"ca-review__block ca-review__block--last\">\n <Heading2>Form Fields</Heading2>\n <BodyText>\n {state.formFields.length\n ? state.formFields.map((f) => f.name).join(', ')\n : 'No form fields added'}\n </BodyText>\n </section>\n\n <div className=\"ca-workflow__actions\">\n <Button onClick={onPublish}>Publish</Button>\n </div>\n </div>\n </SettingsCard>\n );\n}\n","import React, { useMemo, useCallback, useEffect } from 'react';\nimport { useNavigate, useParams, useSearchParams } from 'react-router-dom';\nimport { Heading1 } from '../components/atoms/Typography';\nimport Stepper from '../components/organisms/Stepper';\nimport { SettingsWizardProvider } from '../context/SettingsWizardContext';\nimport { SETTINGS_STEPS } from '../data/settingsSteps';\nimport CategoryTypeStep from '../components/organisms/settings-steps/CategoryTypeStep';\nimport DepartmentsStep from '../components/organisms/settings-steps/DepartmentsStep';\nimport PrioritiesStep from '../components/organisms/settings-steps/PrioritiesStep';\nimport WorkflowStep from '../components/organisms/settings-steps/WorkflowStep';\nimport FormFieldsStep from '../components/organisms/settings-steps/FormFieldsStep';\nimport ReviewPublishStep from '../components/organisms/settings-steps/ReviewPublishStep';\n\nfunction clampStep(value) {\n const n = Number(value);\n if (!Number.isFinite(n) || n < 1) return 1;\n if (n > SETTINGS_STEPS.length) return SETTINGS_STEPS.length;\n return Math.floor(n);\n}\n\nfunction clampSubstep(value) {\n const n = Number(value);\n if (!Number.isFinite(n) || n < 1) return 1;\n if (n > 3) return 3;\n return Math.floor(n);\n}\n\n/**\n * Complaint Management Settings wizard.\n * Step navigation is driven by URL search params: ?step=2&substep=1\n */\nexport default function ComplaintSettingsPage({\n title = 'Complaint Management Settings',\n onPublish,\n onStepChange,\n}) {\n const navigate = useNavigate();\n const { systemId } = useParams();\n const [searchParams, setSearchParams] = useSearchParams();\n\n const step = clampStep(searchParams.get('step') || 1);\n const substep = clampSubstep(searchParams.get('substep') || 1);\n\n // Keep URL in sync when step param is missing (e.g. /settings/qms → ?step=1)\n useEffect(() => {\n if (!searchParams.get('step')) {\n const params = new URLSearchParams(searchParams);\n params.set('step', '1');\n setSearchParams(params, { replace: true });\n }\n }, [searchParams, setSearchParams]);\n\n const stepMeta = useMemo(\n () => SETTINGS_STEPS.find((s) => s.id === step) || SETTINGS_STEPS[0],\n [step],\n );\n\n const setStep = useCallback(\n (nextStep, nextSubstep) => {\n const params = new URLSearchParams(searchParams);\n params.set('step', String(nextStep));\n if (nextStep === 4) {\n params.set('substep', String(nextSubstep ?? (nextStep === step ? substep : 1)));\n } else {\n params.delete('substep');\n }\n setSearchParams(params, { replace: false });\n onStepChange?.({ systemId, step: nextStep, substep: nextSubstep });\n },\n [searchParams, setSearchParams, onStepChange, systemId, step, substep],\n );\n\n const goNext = () => {\n if (step < SETTINGS_STEPS.length) {\n setStep(step + 1, 1);\n }\n };\n\n const handleSubstepChange = (next) => {\n setStep(4, next);\n };\n\n const handlePublish = () => {\n onPublish?.({ systemId, step });\n };\n\n return (\n <SettingsWizardProvider key={systemId || 'new'}>\n <div className=\"ca-settings-page\">\n <Heading1>{title}</Heading1>\n\n <Stepper\n steps={SETTINGS_STEPS}\n currentStep={step}\n onStepClick={(id) => setStep(id, id === 4 ? 1 : undefined)}\n className=\"ca-settings-page__stepper\"\n />\n\n {step === 1 ? (\n <CategoryTypeStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 2 ? (\n <DepartmentsStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 3 ? (\n <PrioritiesStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 4 ? (\n <WorkflowStep\n onNext={goNext}\n stepMeta={stepMeta}\n substep={substep}\n onSubstepChange={handleSubstepChange}\n />\n ) : null}\n {step === 5 ? (\n <FormFieldsStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 6 ? (\n <ReviewPublishStep onPublish={handlePublish} stepMeta={stepMeta} />\n ) : null}\n\n <button\n type=\"button\"\n className=\"ca-back-link\"\n onClick={() => navigate('/')}\n >\n ← Back to Complaint Management\n </button>\n </div>\n </SettingsWizardProvider>\n );\n}\n","import { Route, Routes } from 'react-router-dom';\nimport ComplaintManagementPage from '../pages/ComplaintManagementPage';\nimport ComplaintSettingsPage from '../pages/ComplaintSettingsPage';\n\nfunction ComplaintRouter({ pageProps, onPublish, onStepChange, children }) {\n const managementPage = children ?? <ComplaintManagementPage {...pageProps} />;\n\n return (\n <Routes>\n <Route path=\"/\" element={managementPage} />\n <Route\n path=\"/settings/:systemId\"\n element={\n <ComplaintSettingsPage\n onPublish={onPublish}\n onStepChange={onStepChange}\n />\n }\n />\n <Route path=\"*\" element={managementPage} />\n </Routes>\n );\n}\n\nexport default ComplaintRouter;\n","import ComplaintRouter from './router';\n\nfunction App({ pageProps, onPublish, onStepChange, children }) {\n return (\n <ComplaintRouter\n pageProps={pageProps}\n onPublish={onPublish}\n onStepChange={onStepChange}\n >\n {children}\n </ComplaintRouter>\n );\n}\n\nexport default App;\n","import React from 'react';\nimport { BrowserRouter } from 'react-router-dom';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { ApiProvider } from './context/ApiContext';\nimport { ThemeProvider, useTheme } from './context/ThemeContext';\nimport defaultStore from './redux/store';\nimport App from './App';\nimport './styles/index.css';\n\nfunction ThemedShell({ children }) {\n const { cssVars, darkMode, mode } = useTheme();\n\n return (\n <div\n className={`ca-root ${darkMode ? 'ca-root--dark' : 'ca-root--light'}`}\n data-ca-theme={mode}\n style={cssVars}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Root package component — mount inside the parent app.\n *\n * Theme & dark mode are parent-controlled:\n * <ComplaintApp theme={brandTheme} darkMode={parentIsDark} />\n */\nconst ComplaintApp = ({\n apiUrl,\n authToken,\n store = defaultStore,\n basePath = '/',\n theme,\n darkMode = false,\n title,\n description,\n systems,\n systemsEndpoint,\n useDemoData = true,\n createLabel,\n onCreateForm,\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n onSearch,\n onPublish,\n onStepChange,\n children,\n}) => {\n const pageProps = {\n title,\n description,\n systems,\n systemsEndpoint,\n useDemoData,\n createLabel,\n onCreateForm,\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n onSearch,\n };\n\n return (\n <ThemeProvider theme={theme} darkMode={darkMode}>\n <ReduxProvider store={store}>\n <ThemedShell>\n <ApiProvider apiUrl={apiUrl} authToken={authToken}>\n <BrowserRouter basename={basePath}>\n <App\n pageProps={pageProps}\n onPublish={onPublish}\n onStepChange={onStepChange}\n >\n {children}\n </App>\n </BrowserRouter>\n </ApiProvider>\n </ThemedShell>\n </ReduxProvider>\n </ThemeProvider>\n );\n};\n\nexport default ComplaintApp;\n","import { lightTheme } from './defaultTheme';\n\n/** @deprecated Prefer `lightTheme` / `darkTheme` from `./defaultTheme`. */\nexport const colors = lightTheme.colors;\nexport const radii = lightTheme.radii;\nexport const spacing = lightTheme.spacing;\nexport const typography = lightTheme.typography;\n"],"names":["_extends","n","e","t","Action","PopStateEventType","createBrowserHistory","options","createBrowserLocation","window","globalHistory","pathname","search","hash","createLocation","createBrowserHref","to","createPath","getUrlBasedHistory","invariant","value","message","warning","cond","createKey","getHistoryState","location","index","current","state","key","parsePath","_ref","path","parsedPath","hashIndex","searchIndex","getLocation","createHref","validateLocation","v5Compat","action","listener","getIndex","handlePop","nextIndex","delta","history","push","historyState","url","error","replace","createURL","base","href","fn","ResultType","matchRoutes","routes","locationArg","basename","matchRoutesImpl","allowPartial","stripBasename","branches","flattenRoutes","rankRouteBranches","matches","decoded","decodePath","i","matchRouteBranch","parentsMeta","parentPath","flattenRoute","route","relativePath","meta","joinPaths","routesMeta","computeScore","_route$path","exploded","explodeOptionalSegments","segments","first","rest","isOptional","required","restExploded","result","subpath","a","b","compareIndexes","paramRe","dynamicSegmentValue","indexRouteValue","emptySegmentValue","staticSegmentValue","splatPenalty","isSplat","s","initialScore","score","segment","branch","matchedParams","matchedPathname","end","remainingPathname","match","matchPath","normalizePathname","pattern","matcher","compiledParams","compilePath","pathnameBase","captureGroups","memo","paramName","splatValue","caseSensitive","params","regexpSource","_","v","startIndex","nextChar","ABSOLUTE_URL_REGEX$1","isAbsoluteUrl","resolvePath","fromPathname","toPathname","oldPathname","removeDoubleSlashes","resolvePathname","normalizeSearch","normalizeHash","getInvalidPathError","char","field","dest","getPathContributingMatches","getResolveToMatches","v7_relativeSplatPath","pathMatches","idx","resolveTo","toArg","routePathnames","locationPathname","isPathRelative","isEmptyPath","from","routePathnameIndex","toSegments","hasExplicitTrailingSlash","hasCurrentTrailingSlash","paths","isRouteErrorResponse","validMutationMethodsArr","validRequestMethodsArr","DataRouterContext","React","DataRouterStateContext","AwaitContext","NavigationContext","LocationContext","RouteContext","RouteErrorContext","useHref","_temp","relative","useInRouterContext","UNSAFE_invariant","navigator","useResolvedPath","joinedPathname","useLocation","navigateEffectWarning","useIsomorphicLayoutEffect","cb","useNavigate","isDataRoute","useNavigateStable","useNavigateUnstable","dataRouterContext","future","routePathnamesJson","UNSAFE_getResolveToMatches","activeRef","UNSAFE_warning","useParams","routeMatch","_temp2","useRoutes","useRoutesImpl","dataRouterState","parentMatches","parentParams","parentPathname","parentPathnameBase","parentRoute","warningOnce","locationFromContext","_parsedLocationArg$pa","parsedLocationArg","parentSegments","renderedMatches","_renderMatches","DefaultErrorComponent","useRouteError","stack","lightgrey","preStyles","codeStyles","devInfo","defaultErrorElement","RenderErrorBoundary","props","errorInfo","RenderedRoute","routeContext","children","_dataRouterState","_future","errors","errorIndex","m","renderFallback","fallbackIndex","loaderData","needsToRunLoader","outlet","shouldRenderHydrateFallback","errorElement","hydrateFallbackElement","getChildren","DataRouterHook","DataRouterStateHook","getDataRouterConsoleError","hookName","useDataRouterContext","ctx","useDataRouterState","useRouteContext","useCurrentRouteId","thisRoute","useRouteId","_state$errors","routeId","router","id","alreadyWarned$1","alreadyWarned","warnOnce","logDeprecation","flag","msg","link","logV6DeprecationWarnings","renderFuture","routerFuture","Route","_props","Router","_ref5","basenameProp","locationProp","navigationType","staticProp","navigationContext","locationContext","trailingPathname","Routes","_ref6","createRoutesFromChildren","element","treePath","_objectWithoutPropertiesLoose","r","defaultMethod","defaultEncType","isHtmlElement","object","isButtonElement","isFormElement","isInputElement","isModifiedEvent","event","shouldProcessLinkClick","target","createSearchParams","init","getSearchParamsForLocation","locationSearch","defaultSearchParams","searchParams","_formDataSupportsSubmitter","isFormDataSubmitterSupported","supportedFormEncTypes","getFormEncType","encType","getFormSubmissionInfo","method","formData","body","attr","form","name","type","prefix","_excluded","_excluded2","_excluded3","REACT_ROUTER_VERSION","ViewTransitionContext","FetchersContext","START_TRANSITION","startTransitionImpl","BrowserRouter","_ref4","historyRef","setStateImpl","v7_startTransition","setState","newState","UNSAFE_logV6DeprecationWarnings","isBrowser","ABSOLUTE_URL_REGEX","Link","_ref7","ref","onClick","reloadDocument","preventScrollReset","viewTransition","UNSAFE_NavigationContext","absoluteHref","isExternal","currentUrl","targetUrl","internalOnClick","useLinkClickHandler","handleClick","NavLink","_ref8","ariaCurrentProp","classNameProp","styleProp","routerState","UNSAFE_DataRouterStateContext","isTransitioning","useViewTransitionState","nextLocationPathname","endSlashPosition","isActive","isPending","renderProps","ariaCurrent","className","style","Form","_ref9","forwardedRef","fetcherKey","navigate","onSubmit","submit","useSubmit","formAction","useFormAction","formMethod","submitHandler","submitter","submitMethod","UNSAFE_DataRouterContext","replaceProp","useSearchParams","defaultInit","defaultSearchParamsRef","hasSetSearchParamsRef","setSearchParams","nextInit","navigateOptions","newSearchParams","validateClientSideSubmission","fetcherId","getUniqueFetcherId","currentRouteId","UNSAFE_useRouteId","UNSAFE_RouteContext","indexValues","qs","opts","vtContext","currentPath","nextPath","bind","thisArg","toString","getPrototypeOf","iterator","toStringTag","hasOwnProperty","obj","prop","hasOwnInPrototypeChain","thing","seen","getSafeProp","kindOf","cache","str","kindOfTest","typeOfTest","isArray","isUndefined","isBuffer","val","isFunction","isArrayBuffer","isArrayBufferView","isString","isNumber","isObject","isBoolean","isPlainObject","prototype","isEmptyObject","isDate","isFile","isReactNativeBlob","isReactNative","isBlob","isFileList","isSet","isStream","getGlobal","G","FormDataCtor","isFormData","proto","kind","isURLSearchParams","isReadableStream","isRequest","isResponse","isHeaders","trim","forEach","allOwnKeys","l","keys","len","findKey","_key","_global","isContextDefined","context","merge","objs","caseless","skipUndefined","assignValue","targetKey","existing","source","symbols","j","symbol","propertyIsEnumerable","extend","stripBOM","content","inherits","constructor","superConstructor","descriptors","toFlatObject","sourceObj","destObj","filter","propFilter","merged","endsWith","searchString","position","lastIndex","toArray","arr","isTypedArray","TypedArray","forEachEntry","_iterator","pair","matchAll","regExp","isHTMLForm","toCamelCase","p1","p2","isRegExp","reduceDescriptors","reducer","reducedDescriptors","descriptor","ret","freezeMethods","toObjectSet","arrayOrString","delimiter","define","noop","toFiniteNumber","defaultValue","isSpecCompliantForm","toJSONObject","visited","visit","reducedValue","isAsyncFn","isThenable","_setImmediate","setImmediateSupported","postMessageSupported","token","callbacks","data","asap","isIterable","isSafeIterable","utils$1","ignoreDuplicateOf","utils","parseHeaders","rawHeaders","parsed","line","hasKey","trimSPorHTAB","start","code","INVALID_UNICODE_HEADER_VALUE_CHARS","INVALID_BYTE_STRING_HEADER_VALUE_CHARS","sanitizeValue","invalidChars","item","sanitizeHeaderValue","sanitizeByteStringHeaderValue","toByteStringHeaderObject","headers","byteStringHeaders","header","$internals","normalizeHeader","normalizeValue","parseTokens","tokens","tokensRE","parameterNameRE","trimOWS","decodeQuotedString","last","parseParameters","parameters","quoted","escaped","parseParameter","part","equals","normalizedName","parameterValue","isValidHeaderName","matchHeaderValue","isHeaderNameFilter","formatHeader","w","buildAccessors","accessorName","methodName","arg1","arg2","arg3","AxiosHeaders$1","valueOrRewrite","rewrite","self","setHeader","_value","_header","_rewrite","lHeader","setHeaders","entry","parser","deleted","deleteHeader","format","normalized","targets","asStrings","computed","accessors","defineAccessor","AxiosHeaders","mapped","headerValue","REDACTED","hasOwnOrPrototypeToJSON","redactConfig","config","redactKeys","lowerKeys","k","stringifySafely","aggregateErrorMessage","AxiosError","request","response","customProps","axiosError","serializedConfig","httpAdapter","DEFAULT_FORM_DATA_MAX_DEPTH","isVisitable","removeBrackets","renderKey","dots","isFlatArray","predicates","toFormData","option","metaTokens","visitor","defaultVisitor","indexes","_Blob","maxDepth","useBlob","convertValue","throwIfMaxDepthExceeded","depth","stringifyWithDepthLimit","ancestors","currentValue","el","exposedHelpers","build","encode","charMap","AxiosURLSearchParams","encoder","_encode","buildURL","_options","serializeFn","serializedParams","hashmarkIndex","InterceptorManager","fulfilled","rejected","h","transitionalDefaults","URLSearchParams$1","FormData$1","Blob$1","platform$1","URLSearchParams","FormData","Blob","hasBrowserEnv","_navigator","hasStandardBrowserEnv","hasStandardBrowserWebWorkerEnv","origin","platform","toURLEncodedForm","helpers","MAX_DEPTH","throwIfDepthExceeded","parsePropPath","arrayToObject","formDataToJSON","buildPath","isNumericKey","isLast","own","rawValue","defaults","contentType","hasJSONContentType","isObjectPayload","formSerializer","env","_FormData","transitional","forcedJSONParsing","responseType","JSONRequested","strictJSONParsing","status","transformData","fns","isCancel","settle","resolve","reject","validateStatus","parseProtocol","speedometer","samplesCount","min","bytes","timestamps","head","tail","firstSampleTS","chunkLength","now","startedAt","bytesCount","passed","throttle","freq","timestamp","threshold","lastArgs","timer","invoke","args","progressEventReducer","isDownloadStream","bytesNotified","_speedometer","rawLoaded","total","loaded","progressBytes","rate","progressEventDecorator","throttled","lengthComputable","asyncDecorator","scheduler","isURLSameOrigin","isMSIE","cookies","expires","domain","secure","sameSite","cookie","eq","isAbsoluteURL","combineURLs","baseURL","relativeURL","malformedHttpProtocol","httpProtocolControlCharacters","stripLeadingC0ControlOrSpace","normalizeURLForProtocolCheck","redactFragment","fragment","separator","parameterName","redactSensitiveURLParts","redactedURL","fragmentIndex","redactedURLWithoutFragment","assertValidHttpProtocolURL","normalizedURL","buildFullPath","requestedURL","allowAbsoluteUrls","isRelativeUrl","headersToObject","ownEnumerableKeys","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","getMergedTransitionalOption","transitional2","transitional1","mergeDirectKeys","mergeMap","configValue","FORM_DATA_CONTENT_HEADERS","setFormDataHeaders","formHeaders","policy","encodeUTF8","hex","resolveConfig","newConfig","withXSRFToken","xsrfHeaderName","xsrfCookieName","auth","username","password","xsrfValue","isXHRAdapterSupported","xhrAdapter","_config","requestData","requestHeaders","onUploadProgress","onDownloadProgress","onCanceled","uploadThrottled","downloadThrottled","flushUpload","flushDownload","done","onloadend","responseHeaders","err","timeoutErrorMessage","cancel","CanceledError","protocol","composeSignals","signals","timeout","controller","aborted","onabort","reason","unsubscribe","signal","streamChunk","chunk","chunkSize","pos","readBytes","iterable","readStream","stream","reader","trackStream","onProgress","onFinish","_onFinish","loadedBytes","isHexDigit","charCode","isPercentEncodedByte","hexValue","isBase64Char","isBase64Whitespace","base64Bytes","significant","groups","remainder","estimateBase64BufferAllocation","padding","estimatePercentDecodedBase64Bytes","invalid","estimateDataURLBytes","estimateBase64","comma","c","next","estimateDataURLDecodedBytes","VERSION","DEFAULT_CHUNK_SIZE","decodeURIComponentSafe","test","maybeWithAuthCredentials","protocolIndex","urlToCheck","factory","globalObject","ReadableStream","TextEncoder","envFetch","Request","Response","isFetchSupported","isRequestSupported","isResponseSupported","isReadableStreamSupported","encodeText","supportsRequestStream","duplexAccessed","hasContentType","supportsResponseStream","resolvers","res","getBodyLength","resolveBodyLength","length","cancelToken","withCredentials","fetchOptions","maxContentLength","maxBodyLength","hasMaxContentLength","hasMaxBodyLength","_fetch","composedSignal","requestContentLength","pendingBodyError","maxBodyLengthError","configAuth","parsedURL","urlUsername","urlPassword","outboundLength","mustEnforceStreamBody","trackRequestStream","flush","_request","contentTypeHeader","isCredentialsSupported","resolvedOptions","declaredLength","isStreamResponse","responseContentLength","bytesRead","onChunkProgress","responseData","materializedSize","canceledError","networkError","seedCache","getFetch","fetch","seeds","seed","map","knownAdapters","fetchAdapter.getFetch","renderReason","isResolvedHandle","adapter","getAdapter","adapters","nameOrAdapter","rejectedReasons","reasons","throwIfCancellationRequested","dispatchRequest","validators","deprecatedWarnings","validator","version","formatMessage","opt","desc","correctSpelling","assertOptions","schema","allowUnknown","Axios$1","instanceConfig","configOrUrl","dummy","firstNewlineIndex","secondNewlineIndex","stackWithoutTwoTopLines","paramsSerializer","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","responseInterceptorChain","promise","chain","onFulfilled","onRejected","rejectedResult","rejectedError","fullPath","Axios","generateHTTPMethod","isForm","CancelToken$1","CancelToken","executor","resolvePromise","onfulfilled","_resolve","abort","spread","callback","isAxiosError","payload","HttpStatusCode","createInstance","defaultConfig","instance","axios","promises","all","Cancel","formToJSON","create","assign","defaultConverter","converter","defaultAttributes","set","attributes","stringifiedAttributes","attributeName","get","jar","parts","found","api","BASE_URL_VALUE","__vite_import_meta_env__","nodeProcess","setBaseUrl","setAuthToken","Cookies","getAccessToken","accessToken","isRefreshing","refreshTokenPromise","originalRequest","refreshToken","refreshResponse","newToken","newRefreshToken","ApiContext","createContext","ApiProvider","apiUrl","authToken","useEffect","jsx","lightTheme","darkTheme","defaultThemeFile","deepMerge","override","normalizeThemeFile","themeProp","resolveActiveTheme","themeFile","darkMode","pack","COLOR_VAR_MAP","RADIUS_VAR_MAP","TYPE_VAR_MAP","SHADOW_VAR_MAP","themeToCssVars","theme","vars","cssVar","ThemeContext","ThemeProvider","useMemo","active","cssVars","useTheme","useContext","COMPLAINT_ENDPOINTS","rejectRequest","thunkApi","handler","createAsyncThunk","resourceActions","resource","endpoint","complaintTypeActions","complaintDepartmentActions","complaintPriorityActions","complaintWorkflowActions","complaintStatusActions","getDepartmentTree","_params","getWorkflowSteps","workflowId","saveWorkflowSteps","deleteWorkflowSteps","getComplaintTypes","getComplaintTypeById","createComplaintType","updateComplaintType","deleteComplaintType","getComplaintDepartments","getComplaintDepartmentById","createComplaintDepartment","updateComplaintDepartment","deleteComplaintDepartment","getComplaintPriorities","getComplaintPriorityById","createComplaintPriority","updateComplaintPriority","deleteComplaintPriority","getComplaintWorkflows","getComplaintWorkflowById","createComplaintWorkflow","updateComplaintWorkflow","deleteComplaintWorkflow","getComplaintStatuses","getComplaintStatusById","createComplaintStatus","updateComplaintStatus","deleteComplaintStatus","createResourceState","initialState","unwrapList","unwrapEntity","entityId","entity","upsert","items","errorMessage","registerResource","builder","actions","actionCreator","deletedId","complaintSlice","createSlice","clearComplaintError","clearSelectedComplaintResource","resetComplaintState","complaintAppComplaint","rootReducer","combineReducers","createComplaintStore","preloadedState","configureStore","getDefaultMiddleware","store","Button","variant","size","startIcon","endIcon","disabled","classes","jsxs","PlusIcon","color","VARIANT_CLASS","VARIANT_TAG","Typography","as","Tag","baseClass","Heading1","Heading2","BodyText","LabelText","ValueText","LinkText","PageHeader","title","description","actionLabel","onAction","StatusBadge","label","text","CardHeader","statusLabel","titleAsLink","onTitleClick","ChevronRightIcon","CardFooter","updatedOn","configureLabel","onConfigure","DataPoint","display","Divider","SystemCard","descriptionHref","departments","workflows","fields","formsFilled","onDescriptionClick","handleConfigure","handleDescription","stats","stat","SystemCardGrid","systems","emptyMessage","system","Input","onChange","placeholder","icon","inputClassName","SearchIcon","SearchBar","onSearch","handleKeyDown","Loading","fullScreen","DEMO_SYSTEMS","DEFAULT_PAGE_DESCRIPTION","normalizeSystems","list","ComplaintManagementPage","systemsProp","systemsEndpoint","useDemoData","createLabel","onCreateForm","setSearch","useState","fetchedSystems","setFetchedSystems","fetchError","setFetchError","fetchStatus","setFetchStatus","sourceSystems","filteredSystems","q","Fragment","Stepper","steps","currentStep","onStepClick","step","stepId","isDone","clickable","SettingsWizardContext","createEmptyWizardState","SettingsWizardProvider","initialValues","update","useCallback","patch","prev","updateWorkflow","useSettingsWizard","SETTINGS_STEPS","WORKFLOW_SUBSTEPS","QUICK_PRIORITIES","FIELD_LIBRARY","DEMO_ROLES","DEMO_CATEGORY_TYPES","DEMO_DEPARTMENTS_TREE","PRIORITY_COLORS","LayersIcon","SettingsCardHeader","nextLabel","onNext","showNext","nextDisabled","nextVariant","SettingsCard","footer","FieldLabel","hint","htmlFor","ChevronDownIcon","Select","Textarea","maxLength","rows","FormField","FormInput","inputProps","FormSelect","selectProps","FormTextarea","textareaProps","computedHint","Toggle","checked","ariaLabel","ToggleField","CloseIcon","onRemove","RoleMultiSelect","openValue","setOpenValue","available","handleSelect","handleRemove","role","CategoryTypeStep","stepMeta","roles","DEPARTMENT_OPTIONS","newRow","DepartmentsStep","patchRow","addRow","row","Chip","Radio","DragHandleIcon","makePriority","PrioritiesStep","priorityDraft","priorities","defaultPriorityId","addPriority","trimmed","p","patchPriority","colorOptions","isPlaceholder","WorkflowStep","substep","onSubstepChange","selectedDeptNode","workflow","handleNextSubstep","dept","child","TrashIcon","FIELD_TYPE_OPTIONS","f","FieldLibraryIcon","FormFieldsStep","fieldDraft","formFields","setDraft","addField","typeLabel","o","patchField","removeField","applyLibraryType","ReviewPublishStep","onPublish","categoryLabel","clampStep","clampSubstep","ComplaintSettingsPage","onStepChange","systemId","setStep","nextStep","nextSubstep","goNext","ComplaintRouter","pageProps","managementPage","App","ThemedShell","mode","ComplaintApp","defaultStore","basePath","ReduxProvider","colors","radii","spacing","typography"],"mappings":";;;;;;AAUA,SAASA,KAAW;AAClB,SAAOA,KAAW,OAAO,SAAS,OAAO,OAAO,KAAI,IAAK,SAAUC,GAAG;AACpE,aAASC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AACzC,UAAIC,IAAI,UAAUD,CAAC;AACnB,eAAS,KAAKC,EAAG,EAAC,CAAA,GAAI,eAAe,KAAKA,GAAG,CAAC,MAAMF,EAAE,CAAC,IAAIE,EAAE,CAAC;AAAA,IAChE;AACA,WAAOF;AAAA,EACT,GAAGD,GAAS,MAAM,MA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,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]}
|
|
1
|
+
{"version":3,"file":"complaint-app.js","sources":["../node_modules/@remix-run/router/dist/router.js","../node_modules/react-router/dist/index.js","../node_modules/react-router-dom/dist/index.js","../node_modules/axios/lib/helpers/bind.js","../node_modules/axios/lib/utils.js","../node_modules/axios/lib/helpers/parseHeaders.js","../node_modules/axios/lib/helpers/sanitizeHeaderValue.js","../node_modules/axios/lib/core/AxiosHeaders.js","../node_modules/axios/lib/core/AxiosError.js","../node_modules/axios/lib/helpers/null.js","../node_modules/axios/lib/helpers/toFormData.js","../node_modules/axios/lib/helpers/AxiosURLSearchParams.js","../node_modules/axios/lib/helpers/buildURL.js","../node_modules/axios/lib/core/InterceptorManager.js","../node_modules/axios/lib/defaults/transitional.js","../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js","../node_modules/axios/lib/platform/browser/classes/FormData.js","../node_modules/axios/lib/platform/browser/classes/Blob.js","../node_modules/axios/lib/platform/browser/index.js","../node_modules/axios/lib/platform/common/utils.js","../node_modules/axios/lib/platform/index.js","../node_modules/axios/lib/helpers/toURLEncodedForm.js","../node_modules/axios/lib/helpers/formDataToJSON.js","../node_modules/axios/lib/defaults/index.js","../node_modules/axios/lib/core/transformData.js","../node_modules/axios/lib/cancel/isCancel.js","../node_modules/axios/lib/cancel/CanceledError.js","../node_modules/axios/lib/core/settle.js","../node_modules/axios/lib/helpers/parseProtocol.js","../node_modules/axios/lib/helpers/speedometer.js","../node_modules/axios/lib/helpers/throttle.js","../node_modules/axios/lib/helpers/progressEventReducer.js","../node_modules/axios/lib/helpers/isURLSameOrigin.js","../node_modules/axios/lib/helpers/cookies.js","../node_modules/axios/lib/helpers/isAbsoluteURL.js","../node_modules/axios/lib/helpers/combineURLs.js","../node_modules/axios/lib/core/buildFullPath.js","../node_modules/axios/lib/core/mergeConfig.js","../node_modules/axios/lib/core/setFormDataHeaders.js","../node_modules/axios/lib/helpers/resolveConfig.js","../node_modules/axios/lib/adapters/xhr.js","../node_modules/axios/lib/helpers/composeSignals.js","../node_modules/axios/lib/helpers/trackStream.js","../node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js","../node_modules/axios/lib/env/data.js","../node_modules/axios/lib/adapters/fetch.js","../node_modules/axios/lib/adapters/adapters.js","../node_modules/axios/lib/core/dispatchRequest.js","../node_modules/axios/lib/helpers/validator.js","../node_modules/axios/lib/core/Axios.js","../node_modules/axios/lib/cancel/CancelToken.js","../node_modules/axios/lib/helpers/spread.js","../node_modules/axios/lib/helpers/isAxiosError.js","../node_modules/axios/lib/helpers/HttpStatusCode.js","../node_modules/axios/lib/axios.js","../node_modules/axios/index.js","../node_modules/js-cookie/dist/js.cookie.mjs","../src/utils/api.js","../src/context/ApiContext.jsx","../src/theme/defaultTheme.js","../src/theme/resolveTheme.js","../src/context/ThemeContext.jsx","../src/redux/complaint/actions.js","../src/redux/complaint/reducers.js","../src/redux/reducers.js","../src/redux/store.js","../src/components/atoms/Button.jsx","../src/components/atoms/PlusIcon.jsx","../src/components/atoms/Typography.jsx","../src/components/organisms/PageHeader.jsx","../src/components/atoms/StatusBadge.jsx","../src/components/molecules/CardHeader.jsx","../src/components/atoms/ChevronRightIcon.jsx","../src/components/molecules/CardFooter.jsx","../src/components/molecules/DataPoint.jsx","../src/components/atoms/Divider.jsx","../src/components/organisms/SystemCard.jsx","../src/components/organisms/SystemCardGrid.jsx","../src/components/atoms/Input.jsx","../src/components/atoms/SearchIcon.jsx","../src/components/molecules/SearchBar.jsx","../src/components/atoms/Loading.jsx","../src/data/demoSystems.js","../src/pages/ComplaintManagementPage.jsx","../src/components/organisms/Stepper.jsx","../src/context/SettingsWizardContext.jsx","../src/data/settingsSteps.js","../src/components/atoms/LayersIcon.jsx","../src/components/molecules/SettingsCardHeader.jsx","../src/components/organisms/SettingsCard.jsx","../src/components/atoms/FieldLabel.jsx","../src/components/atoms/ChevronDownIcon.jsx","../src/components/atoms/Select.jsx","../src/components/atoms/Textarea.jsx","../src/components/molecules/FormField.jsx","../src/components/atoms/Toggle.jsx","../src/components/molecules/ToggleField.jsx","../src/components/atoms/CloseIcon.jsx","../src/components/atoms/Tag.jsx","../src/components/molecules/RoleMultiSelect.jsx","../src/components/organisms/settings-steps/CategoryTypeStep.jsx","../src/components/organisms/settings-steps/DepartmentsStep.jsx","../src/components/atoms/Chip.jsx","../src/components/atoms/Radio.jsx","../src/components/atoms/DragHandleIcon.jsx","../src/components/organisms/settings-steps/PrioritiesStep.jsx","../src/components/organisms/settings-steps/WorkflowStep.jsx","../src/components/atoms/TrashIcon.jsx","../src/components/organisms/settings-steps/FormFieldsStep.jsx","../src/components/organisms/settings-steps/ReviewPublishStep.jsx","../src/pages/ComplaintSettingsPage.jsx","../src/router/index.jsx","../src/App.jsx","../src/ComplaintApp.jsx","../src/theme/tokens.js"],"sourcesContent":["/**\n * @remix-run/router v1.23.3\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route (<Route path=\"*\">) since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n // Treating this as a full URL will strip any trailing spaces so we need to\n // pre-encode them since they might be part of a matching splat param from\n // an ancestor route\n href = href.replace(/ $/, \"%20\");\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, String(index)];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/v6/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n return matchRoutesImpl(routes, locationArg, basename, false);\n}\nfunction matchRoutesImpl(routes, locationArg, basename, allowPartial) {\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n let decoded = decodePath(pathname);\n for (let i = 0; matches == null && i < branches.length; ++i) {\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n matches = matchRouteBranch(branches[i], decoded, allowPartial);\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname, allowPartial) {\n if (allowPartial === void 0) {\n allowPartial = false;\n }\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n let route = meta.route;\n if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {\n match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end: false\n }, remainingPathname);\n }\n if (!match) {\n return null;\n }\n Object.assign(matchedParams, match.params);\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/v6/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:([\\w-]+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/v6/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = (value || \"\").replace(/%2F/g, \"/\");\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:([\\w-]+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction decodePath(value) {\n try {\n return value.split(\"/\").map(v => decodeURIComponent(v).replace(/\\//g, \"%2F\")).join(\"/\");\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\nconst ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst isAbsoluteUrl = url => ABSOLUTE_URL_REGEX$1.test(url);\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/v6/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname;\n if (toPathname) {\n if (isAbsoluteUrl(toPathname)) {\n pathname = toPathname;\n } else {\n if (toPathname.includes(\"//\")) {\n let oldPathname = toPathname;\n toPathname = removeDoubleSlashes(toPathname);\n warning(false, \"Pathnames cannot have embedded double slashes - normalizing \" + (oldPathname + \" -> \" + toPathname));\n }\n if (toPathname.startsWith(\"/\")) {\n pathname = resolvePathname(toPathname.substring(1), \"/\");\n } else {\n pathname = resolvePathname(toPathname, fromPathname);\n }\n }\n } else {\n pathname = fromPathname;\n }\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in <Link to=\\\"...\\\"> and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\" element={<Link to=\"..\"}>\n * </Route>\n *\n * <Route path=\"/\">\n * <Route path=\"accounts\">\n * <Route element={<AccountsLayout />}> // <-- Does not contribute\n * <Route index element={<Link to=\"..\"} /> // <-- Does not contribute\n * </Route\n * </Route>\n * </Route>\n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n// Return the array of pathnames for the current route matches - used to\n// generate the routePathnames input for resolveTo()\nfunction getResolveToMatches(matches, v7_relativeSplatPath) {\n let pathMatches = getPathContributingMatches(matches);\n // When v7_relativeSplatPath is enabled, use the full pathname for the leaf\n // match so we include splat values for \".\" links. See:\n // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329\n if (v7_relativeSplatPath) {\n return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);\n }\n return pathMatches.map(match => match.pathnameBase);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `<Link to>` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how <a href> works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n if (!isPathRelative && toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\nconst removeDoubleSlashes = path => path.replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst joinPaths = paths => removeDoubleSlashes(paths.join(\"/\"));\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n *\n * @deprecated The `json` method is deprecated in favor of returning raw objects.\n * This method will be removed in v7.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass DataWithResponseInit {\n constructor(data, init) {\n this.type = \"DataWithResponseInit\";\n this.data = data;\n this.init = init || null;\n }\n}\n/**\n * Create \"responses\" that contain `status`/`headers` without forcing\n * serialization into an actual `Response` - used by Remix single fetch\n */\nfunction data(data, init) {\n return new DataWithResponseInit(data, typeof init === \"number\" ? {\n status: init\n } : init);\n}\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\n/**\n * @deprecated The `defer` method is deprecated in favor of returning raw\n * objects. This method will be removed in v7.\n */\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * A redirect response that will perform a `history.replaceState` instead of a\n * `history.pushState` for client-side navigation redirects.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst replace = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Replace\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n let dataStrategyImpl = init.dataStrategy || defaultDataStrategy;\n let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation;\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_partialHydration: false,\n v7_prependBasename: false,\n v7_relativeSplatPath: false,\n v7_skipActionErrorRevalidation: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from <ScrollRestoration /> until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialMatchesIsFOW = false;\n let initialErrors = null;\n if (initialMatches == null && !patchRoutesOnNavigationImpl) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n // In SPA apps, if the user provided a patchRoutesOnNavigation implementation and\n // our initial match is a splat route, clear them out so we run through lazy\n // discovery on hydration in case there's a more accurate lazy route match.\n // In SSR apps (with `hydrationData`), we expect that the server will send\n // up the proper matched routes so we don't want to run lazy discovery on\n // initial hydration and want to hydrate into the splat route.\n if (initialMatches && !init.hydrationData) {\n let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active) {\n initialMatches = null;\n }\n }\n let initialized;\n if (!initialMatches) {\n initialized = false;\n initialMatches = [];\n // If partial hydration and fog of war is enabled, we will be running\n // `patchRoutesOnNavigation` during hydration so include any partial matches as\n // the initial matches so we can properly render `HydrateFallback`'s\n if (future.v7_partialHydration) {\n let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n initialMatchesIsFOW = true;\n initialMatches = fogOfWar.matches;\n }\n }\n } else if (initialMatches.some(m => m.route.lazy)) {\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n initialized = false;\n } else if (!initialMatches.some(m => m.route.loader)) {\n // If we've got no loaders to run, then we're good to go\n initialized = true;\n } else if (future.v7_partialHydration) {\n // If partial hydration is enabled, we're initialized so long as we were\n // provided with hydrationData for every route with a loader, and no loaders\n // were marked for explicit hydration\n let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n let errors = init.hydrationData ? init.hydrationData.errors : null;\n // If errors exist, don't consider routes below the boundary\n if (errors) {\n let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);\n initialized = initialMatches.slice(0, idx + 1).every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n } else {\n initialized = initialMatches.every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n }\n } else {\n // Without partial hydration - we're initialized if we were provided any\n // hydrationData - which is expected to be complete\n initialized = init.hydrationData != null;\n }\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = new Set();\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let unblockBlockerHistoryUpdate = undefined;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (unblockBlockerHistoryUpdate) {\n unblockBlockerHistoryUpdate();\n unblockBlockerHistoryUpdate = undefined;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n let nextHistoryUpdatePromise = new Promise(resolve => {\n unblockBlockerHistoryUpdate = resolve;\n });\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked, after the url\n // restoration is also complete. See:\n // https://github.com/remix-run/react-router/issues/11613\n nextHistoryUpdatePromise.then(() => init.history.go(delta));\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location, {\n initialHydration: true\n });\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Remove any lingering deleted fetchers that have already been removed\n // from state.fetchers\n deletedFetchers.forEach(key => {\n if (!state.fetchers.has(key) && !fetchControllers.has(key)) {\n deletedFetchersKeys.push(key);\n }\n });\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n viewTransitionOpts: opts.viewTransitionOpts,\n flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n } else {\n // We already called deleteFetcher() on these, can remove them from this\n // Set now that we've handed the keys off to the data layer\n deletedFetchersKeys.forEach(key => deletedFetchers.delete(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n // Commit any in-flight routes at the end of the HMR revalidation \"navigation\"\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation,\n // Proxy through any rending view transition\n enableViewTransition: pendingViewTransitionEnabled === true\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ?\n // `matchRoutes()` has already been called if we're in here via `router.initialize()`\n state.matches : matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial hydration will always\n // be \"same hash\". For example, on /page#hash and submit a <Form method=\"post\">\n // which will default to a navigation to /page\n if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n }, {\n flushSync\n });\n return;\n }\n let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionResult;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingActionResult = [findNearestBoundary(matches).route.id, {\n type: ResultType.error,\n error: opts.pendingError\n }];\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, {\n replace: opts.replace,\n flushSync\n });\n if (actionResult.shortCircuited) {\n return;\n }\n // If we received a 404 from handleAction, it's because we couldn't lazily\n // discover the destination route so we don't want to call loaders\n if (actionResult.pendingActionResult) {\n let [routeId, result] = actionResult.pendingActionResult;\n if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n pendingNavigationController = null;\n completeNavigation(location, {\n matches: actionResult.matches,\n loaderData: {},\n errors: {\n [routeId]: result.error\n }\n });\n return;\n }\n }\n matches = actionResult.matches || matches;\n pendingActionResult = actionResult.pendingActionResult;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = false;\n // No need to do fog of war matching again on loader execution\n fogOfWar.active = false;\n // Create a GET request for the loaders\n request = createClientSideRequest(init.history, request.url, request.signal);\n }\n // Call loaders\n let {\n shortCircuited,\n matches: updatedMatches,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches: updatedMatches || matches\n }, getActionDataForCommit(pendingActionResult), {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, isFogOfWar, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n }, {\n flushSync: opts.flushSync === true\n });\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n pendingActionResult: [boundaryId, {\n type: ResultType.error,\n error: discoverResult.error\n }]\n };\n } else if (!discoverResult.matches) {\n let {\n notFoundMatches,\n error,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n pendingActionResult: [route.id, {\n type: ResultType.error,\n error\n }]\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n let results = await callDataStrategy(\"action\", state, request, [actionMatch], matches, null);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n let location = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename, init.history);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, true, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions to the current location are REPLACE\n // navigations, but if the action threw an error that'll be rendered in\n // an errorElement, we fall back to PUSH so that the user can use the\n // back button to get back to the pre-submission form location to try\n // again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n matches,\n pendingActionResult: [boundaryMatch.route.id, result]\n };\n }\n return {\n matches,\n pendingActionResult: [actionMatch.route.id, result]\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n // If we have partialHydration enabled, then don't update the state for the\n // initial data load since it's not a \"navigation\"\n let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration);\n // When fog of war is enabled, we enter our `loading` state earlier so we\n // can discover new routes during the `loading` state. We skip this if\n // we've already run actions since we would have done our matching already.\n // If the children() function threw then, we want to proceed with the\n // partial matches it discovered.\n if (isFogOfWar) {\n if (shouldUpdateNavigationState) {\n let actionData = getUpdatedActionData(pendingActionResult);\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData !== undefined ? {\n actionData\n } : {}), {\n flushSync\n });\n }\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n loaderData: {},\n errors: {\n [boundaryId]: discoverResult.error\n }\n };\n } else if (!discoverResult.matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null\n }, getActionDataForCommit(pendingActionResult), updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n return {\n shortCircuited: true\n };\n }\n if (shouldUpdateNavigationState) {\n let updates = {};\n if (!isFogOfWar) {\n // Only update navigation/actionNData if we didn't already do it above\n updates.navigation = loadingNavigation;\n let actionData = getUpdatedActionData(pendingActionResult);\n if (actionData !== undefined) {\n updates.actionData = actionData;\n }\n }\n if (revalidatingFetchers.length > 0) {\n updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n }\n updateState(updates, {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n abortFetcher(rf.key);\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n // Preserve SSR errors during partial hydration\n if (future.v7_partialHydration && initialHydration && state.errors) {\n errors = _extends({}, state.errors, errors);\n }\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n matches,\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getUpdatedActionData(pendingActionResult) {\n if (pendingActionResult && !isErrorResult(pendingActionResult[1])) {\n // This is cast to `any` currently because `RouteData`uses any and it\n // would be a breaking change to use any.\n // TODO: v7 - change `RouteData` to use `unknown` instead of `any`\n return {\n [pendingActionResult[0]]: pendingActionResult[1].data\n };\n } else if (state.actionData) {\n if (Object.keys(state.actionData).length === 0) {\n return null;\n } else {\n return state.actionData;\n }\n }\n }\n function getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n return new Map(state.fetchers);\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n abortFetcher(key);\n let flushSync = (opts && opts.flushSync) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }), {\n flushSync\n });\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n let match = getTargetMatch(matches, path);\n let preventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n function detectAndHandle405Error(m) {\n if (!m.route.action && !m.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return true;\n }\n return false;\n }\n if (!isFogOfWar && detectAndHandle405Error(match)) {\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n requestMatches = discoverResult.matches;\n match = getTargetMatch(requestMatches, path);\n if (detectAndHandle405Error(match)) {\n return;\n }\n }\n }\n // Call the action for the fetcher\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResults = await callDataStrategy(\"action\", state, fetchRequest, [match], requestMatches, key);\n let actionResult = actionResults[match.route.id];\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n // When using v7_fetcherPersist, we don't want errors bubbling up to the UI\n // or redirects processed for unmounted fetchers so we just revert them to\n // idle\n if (future.v7_fetcherPersist && deletedFetchers.has(key)) {\n if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // Let SuccessResult's fall through for revalidation\n } else {\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n updateFetcherState(key, getLoadingFetcher(submission));\n return startRedirectNavigation(fetchRequest, actionResult, false, {\n fetcherSubmission: submission,\n preventScrollReset\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n abortFetcher(staleKey);\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n fetchers: new Map(state.fetchers)\n });\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n matches = discoverResult.matches;\n match = getTargetMatch(matches, path);\n }\n }\n // Call the loader for this fetcher route match\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let results = await callDataStrategy(\"loader\", state, fetchRequest, [match], matches, key);\n let result = results[match.route.id];\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // We don't want errors bubbling up or redirects followed for unmounted\n // fetchers, so short circuit here if it was removed from the UI\n if (deletedFetchers.has(key)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(fetchRequest, result, false, {\n preventScrollReset\n });\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n setFetcherError(key, routeId, result.error);\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n updateFetcherState(key, getDoneFetcher(result.data));\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(request, redirect, isNavigation, _temp2) {\n let {\n submission,\n fetcherSubmission,\n preventScrollReset,\n replace\n } = _temp2 === void 0 ? {} : _temp2;\n if (redirect.response.headers.has(\"X-Remix-Revalidate\")) {\n isRevalidationRequired = true;\n }\n let location = redirect.response.headers.get(\"Location\");\n invariant(location, \"Expected a Location header on the redirect Response\");\n location = normalizeRedirectLocation(location, new URL(request.url), basename, init.history);\n let redirectLocation = createLocation(state.location, location, {\n _isRedirect: true\n });\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.response.headers.has(\"X-Remix-Reload-Document\")) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(location)) {\n const url = init.history.createURL(location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(location);\n } else {\n routerWindow.location.assign(location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType\n } = state.navigation;\n if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {\n submission = getSubmissionFromNavigation(state.navigation);\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n let activeSubmission = submission || fetcherSubmission;\n if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: location\n }),\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n } else {\n // If we have a navigation submission, we will preserve it through the\n // redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, submission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Send fetcher submissions through for shouldRevalidate\n fetcherSubmission,\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n }\n }\n // Utility wrapper for calling dataStrategy client-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, state, request, matchesToLoad, matches, fetcherKey) {\n let results;\n let dataResults = {};\n try {\n results = await callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties);\n } catch (e) {\n // If the outer dataStrategy method throws, just return the error for all\n // matches - and it'll naturally bubble to the root\n matchesToLoad.forEach(m => {\n dataResults[m.route.id] = {\n type: ResultType.error,\n error: e\n };\n });\n return dataResults;\n }\n for (let [routeId, result] of Object.entries(results)) {\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n dataResults[routeId] = {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath)\n };\n } else {\n dataResults[routeId] = await convertDataStrategyResultToDataResult(result);\n }\n }\n return dataResults;\n }\n async function callLoadersAndMaybeResolveData(state, matches, matchesToLoad, fetchersToLoad, request) {\n let currentMatches = state.matches;\n // Kick off loaders and fetchers in parallel\n let loaderResultsPromise = callDataStrategy(\"loader\", state, request, matchesToLoad, matches, null);\n let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async f => {\n if (f.matches && f.match && f.controller) {\n let results = await callDataStrategy(\"loader\", state, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key);\n let result = results[f.match.route.id];\n // Fetcher results are keyed by fetcher key from here on out, not routeId\n return {\n [f.key]: result\n };\n } else {\n return Promise.resolve({\n [f.key]: {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n }\n });\n }\n }));\n let loaderResults = await loaderResultsPromise;\n let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {});\n await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]);\n return {\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.add(key);\n }\n abortFetcher(key);\n });\n }\n function updateFetcherState(key, fetcher, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function setFetcherError(key, routeId, error, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function getFetcher(key) {\n activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n // If this fetcher was previously marked for deletion, unmark it since we\n // have a new instance\n if (deletedFetchers.has(key)) {\n deletedFetchers.delete(key);\n }\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n // If we opted into the flag we can clear this now since we're calling\n // deleteFetcher() at the end of updateState() and we've already handed the\n // deleted fetcher keys off to the data layer.\n // If not, we're eagerly calling deleteFetcher() and we need to keep this\n // Set populated until the next updateState call, and we'll clear\n // `deletedFetchers` then\n if (future.v7_fetcherPersist) {\n deletedFetchers.delete(key);\n }\n cancelledFetcherLoads.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n if (!future.v7_fetcherPersist) {\n deleteFetcher(key);\n }\n } else {\n activeFetchers.set(key, count);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n if (controller) {\n controller.abort();\n fetchControllers.delete(key);\n }\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function handleNavigational404(pathname) {\n let error = getInternalRouterError(404, {\n pathname\n });\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let {\n matches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n return {\n notFoundMatches: matches,\n route,\n error\n };\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the <ScrollRestoration> component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered <ScrollRestoration/>\n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function checkFogOfWar(matches, routesToUse, pathname) {\n if (patchRoutesOnNavigationImpl) {\n if (!matches) {\n let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: fogMatches || []\n };\n } else {\n if (Object.keys(matches[0].params).length > 0) {\n // If we matched a dynamic param or a splat, it might only be because\n // we haven't yet discovered other routes that would match with a\n // higher score. Call patchRoutesOnNavigation just to be sure\n let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: partialMatches\n };\n }\n }\n }\n return {\n active: false,\n matches: null\n };\n }\n async function discoverRoutes(matches, pathname, signal, fetcherKey) {\n if (!patchRoutesOnNavigationImpl) {\n return {\n type: \"success\",\n matches\n };\n }\n let partialMatches = matches;\n while (true) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let localManifest = manifest;\n try {\n await patchRoutesOnNavigationImpl({\n signal,\n path: pathname,\n matches: partialMatches,\n fetcherKey,\n patch: (routeId, children) => {\n if (signal.aborted) return;\n patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);\n }\n });\n } catch (e) {\n return {\n type: \"error\",\n error: e,\n partialMatches\n };\n } finally {\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity so when we `updateState` at the end of\n // this navigation/fetch `router.routes` will be a new identity and\n // trigger a re-run of memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR && !signal.aborted) {\n dataRoutes = [...dataRoutes];\n }\n }\n if (signal.aborted) {\n return {\n type: \"aborted\"\n };\n }\n let newMatches = matchRoutes(routesToUse, pathname, basename);\n if (newMatches) {\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n // Avoid loops if the second pass results in the same partial matches\n if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) {\n return {\n type: \"success\",\n matches: null\n };\n }\n partialMatches = newPartialMatches;\n }\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n function patchRoutes(routeId, children) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties);\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity and trigger a reflow via `updateState`\n // to re-run memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR) {\n dataRoutes = [...dataRoutes];\n updateState({});\n }\n }\n router = {\n get basename() {\n return basename;\n },\n get future() {\n return future;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n get window() {\n return routerWindow;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher: deleteFetcherAndUpdateState,\n dispose,\n getBlocker,\n deleteBlocker,\n patchRoutes,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Config driven behavior flags\n let future = _extends({\n v7_relativeSplatPath: false,\n v7_throwAbortReason: false\n }, opts ? opts.future : null);\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n *\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n * the bubbling of errors which allows single-fetch-type implementations\n * where the client will handle the bubbling and we may need to return data\n * for the handling route\n */\n async function query(request, _temp3) {\n let {\n requestContext,\n skipLoaderErrorBubbling,\n dataStrategy\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n *\n * - `opts.routeId` allows you to specify the specific route handler to call.\n * If not provided the handler will determine the proper route by matching\n * against `request.url`\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n */\n async function queryRoute(request, _temp4) {\n let {\n routeId,\n requestContext,\n dataStrategy\n } = _temp4 === void 0 ? {} : _temp4;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction for a\n // `queryRoute` call, we throw the `DataStrategyResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isDataStrategyResult(e) && isResponse(e.result)) {\n if (e.type === ResultType.error) {\n throw e.result;\n }\n return e.result;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n let results = await callDataStrategy(\"action\", request, [actionMatch], matches, isRouteRequest, requestContext, dataStrategy);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.response.status,\n headers: {\n Location: result.response.headers.get(\"Location\")\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null);\n return _extends({}, context, {\n actionData: {\n [actionMatch.route.id]: result.data\n }\n }, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionHeaders: result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {}\n });\n }\n async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await callDataStrategy(\"loader\", request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy);\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n // Utility wrapper for calling dataStrategy server-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) {\n let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, type, null, request, matchesToLoad, matches, null, manifest, mapRouteProperties, requestContext);\n let dataResults = {};\n await Promise.all(matches.map(async match => {\n if (!(match.route.id in results)) {\n return;\n }\n let result = results[match.route.id];\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename, future.v7_relativeSplatPath);\n }\n if (isResponse(result.result) && isRouteRequest) {\n // For SSR single-route requests, we want to hand Responses back\n // directly without unwrapping\n throw result;\n }\n dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);\n }));\n return dataResults;\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: isRouteErrorResponse(error) ? error.status : 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest, future) {\n if (future.v7_throwAbortReason && request.signal.reason !== undefined) {\n throw request.signal.reason;\n }\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId) {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Account for `?index` params when routing to the current location\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch) {\n let nakedIndex = hasNakedIndexQuery(path.search);\n if (activeRouteMatch.route.index && !nakedIndex) {\n // Add one when we're targeting an index route\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n } else if (!activeRouteMatch.route.index && nakedIndex) {\n // Remove existing ones when we're not\n let params = new URLSearchParams(path.search);\n let indexValues = params.getAll(\"index\");\n params.delete(\"index\");\n indexValues.filter(v => v).forEach(v => params.append(\"index\", v));\n let qs = params.toString();\n path.search = qs ? \"?\" + qs : \"\";\n }\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref3) => {\n let [name, value] = _ref3;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes at/below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) {\n if (includeBoundary === void 0) {\n includeBoundary = false;\n }\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n return matches.slice(0, includeBoundary ? index + 1 : index);\n }\n return matches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {\n let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryMatches = matches;\n if (initialHydration && state.errors) {\n // On initial hydration, only consider matches up to _and including_ the boundary.\n // This is inclusive to handle cases where a server loader ran successfully,\n // a child server loader bubbled up to this route, but this route has\n // `clientLoader.hydrate` so we want to still run the `clientLoader` so that\n // we have a complete version of `loaderData`\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true);\n } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {\n // If an action threw an error, we call loaders up to, but not including the\n // boundary\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]);\n }\n // Don't revalidate loaders by default after action 4xx/5xx responses\n // when the flag is enabled. They can still opt-into revalidation via\n // `shouldRevalidate` via `actionResult`\n let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined;\n let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400;\n let navigationMatches = boundaryMatches.filter((match, index) => {\n let {\n route\n } = match;\n if (route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (route.loader == null) {\n return false;\n }\n if (initialHydration) {\n return shouldLoadRouteOnHydration(route, state.loaderData, state.errors);\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false :\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate:\n // - on initial hydration (shouldn't be any fetchers then anyway)\n // - if fetcher won't be present in the subsequent render\n // - no longer matches the URL (v7_fetcherPersist=false)\n // - was unmounted but persisted due to v7_fetcherPersist=true\n if (initialHydration || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.has(key)) {\n // Always mark for revalidation if the fetcher was cancelled\n cancelledFetcherLoads.delete(key);\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction shouldLoadRouteOnHydration(route, loaderData, errors) {\n // We dunno if we have a loader - gotta find out!\n if (route.lazy) {\n return true;\n }\n // No loader, nothing to initialize\n if (!route.loader) {\n return false;\n }\n let hasData = loaderData != null && loaderData[route.id] !== undefined;\n let hasError = errors != null && errors[route.id] !== undefined;\n // Don't run if we error'd during SSR\n if (!hasData && hasError) {\n return false;\n }\n // Explicitly opting-in to running on hydration\n if (typeof route.loader === \"function\" && route.loader.hydrate === true) {\n return true;\n }\n // Otherwise, run if we're not yet initialized with anything\n return !hasData && !hasError;\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\nfunction patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) {\n var _childrenToPatch;\n let childrenToPatch;\n if (routeId) {\n let route = manifest[routeId];\n invariant(route, \"No route found to patch children into: routeId = \" + routeId);\n if (!route.children) {\n route.children = [];\n }\n childrenToPatch = route.children;\n } else {\n childrenToPatch = routesToUse;\n }\n // Don't patch in routes we already know about so that `patch` is idempotent\n // to simplify user-land code. This is useful because we re-call the\n // `patchRoutesOnNavigation` function for matched routes with params.\n let uniqueChildren = children.filter(newRoute => !childrenToPatch.some(existingRoute => isSameRoute(newRoute, existingRoute)));\n let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [routeId || \"_\", \"patch\", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || \"0\")], manifest);\n childrenToPatch.push(...newRoutes);\n}\nfunction isSameRoute(newRoute, existingRoute) {\n // Most optimal check is by id\n if (\"id\" in newRoute && \"id\" in existingRoute && newRoute.id === existingRoute.id) {\n return true;\n }\n // Second is by pathing differences\n if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) {\n return false;\n }\n // Pathless layout routes are trickier since we need to check children.\n // If they have no children then they're the same as far as we can tell\n if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) {\n return true;\n }\n // Otherwise, we look to see if every child in the new route is already\n // represented in the existing route's children\n return newRoute.children.every((aChild, i) => {\n var _existingRoute$childr;\n return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some(bChild => isSameRoute(aChild, bChild));\n });\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\n// Default implementation of `dataStrategy` which fetches all loaders in parallel\nasync function defaultDataStrategy(_ref4) {\n let {\n matches\n } = _ref4;\n let matchesToLoad = matches.filter(m => m.shouldLoad);\n let results = await Promise.all(matchesToLoad.map(m => m.resolve()));\n return results.reduce((acc, result, i) => Object.assign(acc, {\n [matchesToLoad[i].route.id]: result\n }), {});\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties, requestContext) {\n let loadRouteDefinitionsPromises = matches.map(m => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties, manifest) : undefined);\n let dsMatches = matches.map((match, i) => {\n let loadRoutePromise = loadRouteDefinitionsPromises[i];\n let shouldLoad = matchesToLoad.some(m => m.route.id === match.route.id);\n // `resolve` encapsulates route.lazy(), executing the loader/action,\n // and mapping return values/thrown errors to a `DataStrategyResult`. Users\n // can pass a callback to take fine-grained control over the execution\n // of the loader/action\n let resolve = async handlerOverride => {\n if (handlerOverride && request.method === \"GET\" && (match.route.lazy || match.route.loader)) {\n shouldLoad = true;\n }\n return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n });\n // Send all matches here to allow for a middleware-type implementation.\n // handler will be a no-op for unneeded routes and we filter those results\n // back out below.\n let results = await dataStrategyImpl({\n matches: dsMatches,\n request,\n params: matches[0].params,\n fetcherKey,\n context: requestContext\n });\n // Wait for all routes to load here but 'swallow the error since we want\n // it to bubble up from the `await loadRoutePromise` in `callLoaderOrAction` -\n // called from `match.resolve()`\n try {\n await Promise.all(loadRouteDefinitionsPromises);\n } catch (e) {\n // No-op\n }\n return results;\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) {\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n // This will never resolve so safe to type it as Promise<DataStrategyResult> to\n // satisfy the function return value\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n let actualHandler = ctx => {\n if (typeof handler !== \"function\") {\n return Promise.reject(new Error(\"You cannot call the handler for a route which defines a boolean \" + (\"\\\"\" + type + \"\\\" [routeId: \" + match.route.id + \"]\")));\n }\n return handler({\n request,\n params: match.params,\n context: staticContext\n }, ...(ctx !== undefined ? [ctx] : []));\n };\n let handlerPromise = (async () => {\n try {\n let val = await (handlerOverride ? handlerOverride(ctx => actualHandler(ctx)) : actualHandler());\n return {\n type: \"data\",\n result: val\n };\n } catch (e) {\n return {\n type: \"error\",\n result: e\n };\n }\n })();\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n // If we have a route.lazy promise, await that first\n if (loadRoutePromise) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let handlerError;\n let [value] = await Promise.all([\n // If the handler throws, don't let it immediately bubble out,\n // since we need to let the lazy() execution finish so we know if this\n // route has a boundary that can handle the error\n runHandler(handler).catch(e => {\n handlerError = e;\n }), loadRoutePromise]);\n if (handlerError !== undefined) {\n throw handlerError;\n }\n result = value;\n } else {\n // Load lazy route module, then run any returned handler\n await loadRoutePromise;\n handler = match.route[type];\n if (handler) {\n // Handler still runs even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n result: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result.result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n // We should already be catching and converting normal handler executions to\n // DataStrategyResults and returning them, so anything that throws here is an\n // unexpected error we still need to wrap\n return {\n type: ResultType.error,\n result: e\n };\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n return result;\n}\nasync function convertDataStrategyResultToDataResult(dataStrategyResult) {\n let {\n result,\n type\n } = dataStrategyResult;\n if (isResponse(result)) {\n let data;\n try {\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n if (result.body == null) {\n data = null;\n } else {\n data = await result.json();\n }\n } else {\n data = await result.text();\n }\n } catch (e) {\n return {\n type: ResultType.error,\n error: e\n };\n }\n if (type === ResultType.error) {\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(result.status, result.statusText, data),\n statusCode: result.status,\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (type === ResultType.error) {\n if (isDataWithResponseInit(result)) {\n var _result$init3, _result$init4;\n if (result.data instanceof Error) {\n var _result$init, _result$init2;\n return {\n type: ResultType.error,\n error: result.data,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined\n };\n }\n // Convert thrown data() to ErrorResponse instances\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),\n statusCode: isRouteErrorResponse(result) ? result.status : undefined,\n headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : undefined\n };\n }\n if (isDeferredData(result)) {\n var _result$init5, _result$init6;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,\n headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)\n };\n }\n if (isDataWithResponseInit(result)) {\n var _result$init7, _result$init8;\n return {\n type: ResultType.data,\n data: result.data,\n statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,\n headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Support relative routing in internal redirects\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) {\n let location = response.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1);\n location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath);\n response.headers.set(\"Location\", location);\n }\n return response;\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {\n // Match Chrome's behavior:\n // https://github.com/chromium/chromium/blob/216dbeb61db0c667e62082e5f5400a32d6983df3/content/public/common/url_utils.cc#L82\n let invalidProtocols = [\"about:\", \"blob:\", \"chrome:\", \"chrome-untrusted:\", \"content:\", \"data:\", \"devtools:\", \"file:\", \"filesystem:\",\n // eslint-disable-next-line no-script-url\n \"javascript:\"];\n if (ABSOLUTE_URL_REGEX.test(location)) {\n // Strip off the protocol+origin for same-origin + same-basename absolute redirects\n let normalizedLocation = location;\n let url = normalizedLocation.startsWith(\"//\") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);\n if (invalidProtocols.includes(url.protocol)) {\n throw new Error(\"Invalid redirect location\");\n }\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return removeDoubleSlashes(url.pathname) + url.search + url.hash;\n }\n }\n try {\n let url = historyInstance.createURL(location);\n if (invalidProtocols.includes(url.protocol)) {\n throw new Error(\"Invalid redirect location\");\n }\n } catch (e) {}\n return location;\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined;\n // Process loader results into state.loaderData/state.errors\n matches.forEach(match => {\n if (!(match.route.id in results)) {\n return;\n }\n let id = match.route.id;\n let result = results[id];\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError !== undefined) {\n error = pendingError;\n pendingError = undefined;\n }\n errors = errors || {};\n if (skipLoaderErrorBubbling) {\n errors[id] = error;\n } else {\n // Look upwards from the matched route for the closest ancestor error\n // boundary, defaulting to the root match. Prefer higher error values\n // if lower errors bubble to the same boundary\n let boundaryMatch = findNearestBoundary(matches, id);\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n loaderData[id] = result.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError !== undefined && pendingActionResult) {\n errors = {\n [pendingActionResult[0]]: pendingError\n };\n loaderData[pendingActionResult[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, false // This method is only called client side so we always want to bubble\n );\n // Process results from our revalidating fetchers\n revalidatingFetchers.forEach(rf => {\n let {\n key,\n match,\n controller\n } = rf;\n let result = fetcherResults[key];\n invariant(result, \"Did not find corresponding fetcher result\");\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n return;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n });\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n if (!pendingActionResult) {\n return {};\n }\n return isErrorResult(pendingActionResult[1]) ? {\n // Clear out prior actionData on errors\n actionData: {}\n } : {\n actionData: {\n [pendingActionResult[0]]: pendingActionResult[1].data\n }\n };\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp5) {\n let {\n pathname,\n routeId,\n method,\n type,\n message\n } = _temp5 === void 0 ? {} : _temp5;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n let entries = Object.entries(results);\n for (let i = entries.length - 1; i >= 0; i--) {\n let [key, result] = entries[i];\n if (isRedirectResult(result)) {\n return {\n key,\n result\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDataStrategyResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectDataStrategyResultResult(result) {\n return isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDataWithResponseInit(value) {\n return typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) {\n let entries = Object.entries(results);\n for (let index = 0; index < entries.length; index++) {\n let [routeId, result] = entries[index];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && isRevalidatingLoader) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n await resolveDeferredData(result, signal, false).then(result => {\n if (result) {\n results[routeId] = result;\n }\n });\n }\n }\n}\nasync function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) {\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n routeId,\n controller\n } = revalidatingFetchers[index];\n let result = results[key];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n if (isDeferredResult(result)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n invariant(controller, \"Expected an AbortController for revalidating fetcher deferred result\");\n await resolveDeferredData(result, controller.signal, true).then(result => {\n if (result) {\n results[key] = result;\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n try {\n let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n if (sessionPositions) {\n let json = JSON.parse(sessionPositions);\n for (let [k, v] of Object.entries(json || {})) {\n if (v && Array.isArray(v)) {\n transitions.set(k, new Set(v || []));\n }\n }\n }\n } catch (e) {\n // no-op, use default empty object\n }\n}\nfunction persistAppliedTransitions(_window, transitions) {\n if (transitions.size > 0) {\n let json = {};\n for (let [k, v] of transitions) {\n json[k] = [...v];\n }\n try {\n _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n } catch (error) {\n warning(false, \"Failed to save applied view transitions in sessionStorage (\" + error + \").\");\n }\n }\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, data, defer, generatePath, getStaticContextFromError, getToPathname, isDataWithResponseInit, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.30.4\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_decodePath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\n\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level `<Router>` API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/v6/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a `<Router>`.\n *\n * @see https://reactrouter.com/v6/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/v6/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * `<NavLink>`.\n *\n * @see https://reactrouter.com/v6/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, UNSAFE_decodePath(pathname)), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by `<Link>`s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n future,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/v6/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by `<Outlet>` to render child routes.\n *\n * @see https://reactrouter.com/v6/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/v6/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/v6/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n future\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an `<Outlet>` to render their child route's\n * element.\n *\n * @see https://reactrouter.com/v6/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState, future) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different <Routes> under a <Route>\n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // <Routes>\n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // <Route path=\"blog\" element={<Blog />} />\n // <Route path=\"blog/feed\" element={<BlogFeed />} />\n // </Routes>\n //\n // function Blog() {\n // return (\n // <Routes>\n // <Route path=\"post/:id\" element={<Post />} />\n // </Routes>\n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant <Routes> (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under <Route path=\\\"\" + parentPath + \"\\\">) 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.\\n\\n\" + (\"Please change the parent <Route path=\\\"\" + parentPath + \"\\\"> to <Route \") + (\"path=\\\"\" + (parentPath === \"/\" ? \"*\" : parentPath + \"/*\") + \"\\\">.\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = pathname;\n if (parentPathnameBase !== \"/\") {\n // Determine the remaining pathname by removing the # of URL segments the\n // parentPathnameBase has, instead of removing based on character count.\n // This is because we can't guarantee that incoming/outgoing encodings/\n // decodings will match exactly.\n // We decode paths before matching on a per-segment basis with\n // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they\n // match what `window.location.pathname` would reflect. Those don't 100%\n // align when it comes to encoded URI characters such as % and &.\n //\n // So we may end up with:\n // pathname: \"/descendant/a%25b/match\"\n // parentPathnameBase: \"/descendant/a%b\"\n //\n // And the direct substring removal approach won't work :/\n let parentSegments = parentPathnameBase.replace(/^\\//, \"\").split(\"/\");\n let segments = pathname.replace(/^\\//, \"\").split(\"/\");\n remainingPathname = \"/\" + segments.slice(parentSegments.length).join(\"/\");\n }\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.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.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState, future);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error !== undefined ? props.error : state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState, future) {\n var _dataRouterState;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (future === void 0) {\n future = null;\n }\n if (matches == null) {\n var _future;\n if (!dataRouterState) {\n return null;\n }\n if (dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {\n // Don't bail if we're initializing with partial hydration and we have\n // router matches. That means we're actively running `patchRoutesOnNavigation`\n // so we should render down the partial matches to the appropriate\n // `HydrateFallback`. We only do this if `parentMatches` is empty so it\n // only impacts the root matches for `RouterProvider` and no descendant\n // `<Routes>`\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n // If we're in a partial hydration mode, detect if we need to render down to\n // a given HydrateFallback while we load the rest of the hydration data\n let renderFallback = false;\n let fallbackIndex = -1;\n if (dataRouterState && future && future.v7_partialHydration) {\n for (let i = 0; i < renderedMatches.length; i++) {\n let match = renderedMatches[i];\n // Track the deepest fallback up until the first route without data\n if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {\n fallbackIndex = i;\n }\n if (match.route.id) {\n let {\n loaderData,\n errors\n } = dataRouterState;\n let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);\n if (match.route.lazy || needsToRunLoader) {\n // We found the first route that's not ready to render (waiting on\n // lazy, or has a loader that hasn't run yet). Flag that we need to\n // render a fallback and render up until the appropriate fallback\n renderFallback = true;\n if (fallbackIndex >= 0) {\n renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n } else {\n renderedMatches = [renderedMatches[0]];\n }\n break;\n }\n }\n }\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n // Only data routers handle errors/fallbacks\n let error;\n let shouldRenderHydrateFallback = false;\n let errorElement = null;\n let hydrateFallbackElement = null;\n if (dataRouterState) {\n error = errors && match.route.id ? errors[match.route.id] : undefined;\n errorElement = match.route.errorElement || defaultErrorElement;\n if (renderFallback) {\n if (fallbackIndex < 0 && index === 0) {\n warningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = null;\n } else if (fallbackIndex === index) {\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = match.route.hydrateFallbackElement || null;\n }\n }\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (shouldRenderHydrateFallback) {\n children = hydrateFallbackElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `<Route Component={...}>` in `<Routes>` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n return state.actionData ? state.actionData[routeId] : undefined;\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error !== undefined) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor `<Await />` value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor `<Await />` value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned$1 = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned$1[key]) {\n alreadyWarned$1[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\nconst alreadyWarned = {};\nfunction warnOnce(key, message) {\n if (process.env.NODE_ENV !== \"production\" && !alreadyWarned[message]) {\n alreadyWarned[message] = true;\n console.warn(message);\n }\n}\nconst logDeprecation = (flag, msg, link) => warnOnce(flag, \"\\u26A0\\uFE0F React Router Future Flag Warning: \" + msg + \". \" + (\"You can use the `\" + flag + \"` future flag to opt-in early. \") + (\"For more information, see \" + link + \".\"));\nfunction logV6DeprecationWarnings(renderFuture, routerFuture) {\n if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === undefined) {\n logDeprecation(\"v7_startTransition\", \"React Router will begin wrapping state updates in `React.startTransition` in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_starttransition\");\n }\n if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === undefined && (!routerFuture || routerFuture.v7_relativeSplatPath === undefined)) {\n logDeprecation(\"v7_relativeSplatPath\", \"Relative route resolution within Splat routes is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath\");\n }\n if (routerFuture) {\n if (routerFuture.v7_fetcherPersist === undefined) {\n logDeprecation(\"v7_fetcherPersist\", \"The persistence behavior of fetchers is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist\");\n }\n if (routerFuture.v7_normalizeFormMethod === undefined) {\n logDeprecation(\"v7_normalizeFormMethod\", \"Casing of `formMethod` fields is being normalized to uppercase in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod\");\n }\n if (routerFuture.v7_partialHydration === undefined) {\n logDeprecation(\"v7_partialHydration\", \"`RouterProvider` hydration behavior is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_partialhydration\");\n }\n if (routerFuture.v7_skipActionErrorRevalidation === undefined) {\n logDeprecation(\"v7_skipActionErrorRevalidation\", \"The revalidation behavior after 4xx/5xx `action` responses is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation\");\n }\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n if (v7_startTransition && startTransitionImpl) {\n startTransitionImpl(() => setStateImpl(newState));\n } else {\n setStateImpl(newState);\n }\n }, [setStateImpl, v7_startTransition]);\n\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`<RouterProvider fallbackElement>` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n React.useEffect(() => logV6DeprecationWarnings(future, router.future), [router, future]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a <script> here\n // containing the hydrated server-side staticContext (from StaticRouterProvider).\n // useId relies on the component tree structure to generate deterministic id's\n // so we need to ensure it remains the same on the client even though\n // we don't need the <script> tag\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataRouterContext.Provider, {\n value: dataRouterContext\n }, /*#__PURE__*/React.createElement(DataRouterStateContext.Provider, {\n value: state\n }, /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n location: state.location,\n navigationType: state.historyAction,\n navigator: navigator,\n future: {\n v7_relativeSplatPath: router.future.v7_relativeSplatPath\n }\n }, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {\n routes: router.routes,\n future: router.future,\n state: state\n }) : fallbackElement))), null);\n}\nfunction DataRoutes(_ref2) {\n let {\n routes,\n future,\n state\n } = _ref2;\n return useRoutesImpl(routes, undefined, state, future);\n}\n/**\n * A `<Router>` that stores all entries in memory.\n *\n * @see https://reactrouter.com/v6/router-components/memory-router\n */\nfunction MemoryRouter(_ref3) {\n let {\n basename,\n children,\n initialEntries,\n initialIndex,\n future\n } = _ref3;\n let historyRef = React.useRef();\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({\n initialEntries,\n initialIndex,\n v5Compat: true\n });\n }\n let history = historyRef.current;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/v6/components/navigate\n */\nfunction Navigate(_ref4) {\n let {\n to,\n replace,\n state,\n relative\n } = _ref4;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n \"<Navigate> may be used only in the context of a <Router> component.\") : UNSAFE_invariant(false) : void 0;\n let {\n future,\n static: isStatic\n } = React.useContext(NavigationContext);\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(!isStatic, \"<Navigate> must not be used on the initial render in a <StaticRouter>. \" + \"This is a no-op, but you should modify your code so the <Navigate> is \" + \"only ever rendered in response to some user interaction or state change.\") : void 0;\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let navigate = useNavigate();\n\n // Resolve the path outside of the effect so that when effects run twice in\n // StrictMode they navigate to the same place\n let path = resolveTo(to, UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === \"path\");\n let jsonPath = JSON.stringify(path);\n React.useEffect(() => navigate(JSON.parse(jsonPath), {\n replace,\n state,\n relative\n }), [navigate, jsonPath, relative, replace, state]);\n return null;\n}\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/v6/components/outlet\n */\nfunction Outlet(props) {\n return useOutlet(props.context);\n}\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/v6/components/route\n */\nfunction Route(_props) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"A <Route> is only ever to be used as the child of <Routes> element, \" + \"never rendered directly. Please wrap your <Route> in a <Routes>.\") : UNSAFE_invariant(false) ;\n}\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a `<Router>` directly. Instead, you'll render a\n * router that is more specific to your environment such as a `<BrowserRouter>`\n * in web browsers or a `<StaticRouter>` for server rendering.\n *\n * @see https://reactrouter.com/v6/router-components/router\n */\nfunction Router(_ref5) {\n let {\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = Action.Pop,\n navigator,\n static: staticProp = false,\n future\n } = _ref5;\n !!useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"You cannot render a <Router> inside another <Router>.\" + \" You should never have more than one in your app.\") : UNSAFE_invariant(false) : void 0;\n\n // Preserve trailing slashes on basename, so we can let the user control\n // the enforcement of trailing slashes throughout the app\n let basename = basenameProp.replace(/^\\/*/, \"/\");\n let navigationContext = React.useMemo(() => ({\n basename,\n navigator,\n static: staticProp,\n future: _extends({\n v7_relativeSplatPath: false\n }, future)\n }), [basename, future, navigator, staticProp]);\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\"\n } = locationProp;\n let locationContext = React.useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n if (trailingPathname == null) {\n return null;\n }\n return {\n location: {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key\n },\n navigationType\n };\n }, [basename, pathname, search, hash, state, key, navigationType]);\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(locationContext != null, \"<Router basename=\\\"\" + basename + \"\\\"> is not able to match the URL \" + (\"\\\"\" + pathname + search + hash + \"\\\" because it does not start with the \") + \"basename, so the <Router> won't render anything.\") : void 0;\n if (locationContext == null) {\n return null;\n }\n return /*#__PURE__*/React.createElement(NavigationContext.Provider, {\n value: navigationContext\n }, /*#__PURE__*/React.createElement(LocationContext.Provider, {\n children: children,\n value: locationContext\n }));\n}\n/**\n * A container for a nested tree of `<Route>` elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/v6/components/routes\n */\nfunction Routes(_ref6) {\n let {\n children,\n location\n } = _ref6;\n return useRoutes(createRoutesFromChildren(children), location);\n}\n/**\n * Component to use for rendering lazily loaded data from returning defer()\n * in a loader function\n */\nfunction Await(_ref7) {\n let {\n children,\n errorElement,\n resolve\n } = _ref7;\n return /*#__PURE__*/React.createElement(AwaitErrorBoundary, {\n resolve: resolve,\n errorElement: errorElement\n }, /*#__PURE__*/React.createElement(ResolveAwait, null, children));\n}\nvar AwaitRenderStatus = /*#__PURE__*/function (AwaitRenderStatus) {\n AwaitRenderStatus[AwaitRenderStatus[\"pending\"] = 0] = \"pending\";\n AwaitRenderStatus[AwaitRenderStatus[\"success\"] = 1] = \"success\";\n AwaitRenderStatus[AwaitRenderStatus[\"error\"] = 2] = \"error\";\n return AwaitRenderStatus;\n}(AwaitRenderStatus || {});\nconst neverSettledPromise = new Promise(() => {});\nclass AwaitErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n error: null\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"<Await> caught the following error during render\", error, errorInfo);\n }\n render() {\n let {\n children,\n errorElement,\n resolve\n } = this.props;\n let promise = null;\n let status = AwaitRenderStatus.pending;\n if (!(resolve instanceof Promise)) {\n // Didn't get a promise - provide as a resolved promise\n status = AwaitRenderStatus.success;\n promise = Promise.resolve();\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n Object.defineProperty(promise, \"_data\", {\n get: () => resolve\n });\n } else if (this.state.error) {\n // Caught a render error, provide it as a rejected promise\n status = AwaitRenderStatus.error;\n let renderError = this.state.error;\n promise = Promise.reject().catch(() => {}); // Avoid unhandled rejection warnings\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n Object.defineProperty(promise, \"_error\", {\n get: () => renderError\n });\n } else if (resolve._tracked) {\n // Already tracked promise - check contents\n promise = resolve;\n status = \"_error\" in promise ? AwaitRenderStatus.error : \"_data\" in promise ? AwaitRenderStatus.success : AwaitRenderStatus.pending;\n } else {\n // Raw (untracked) promise - track it\n status = AwaitRenderStatus.pending;\n Object.defineProperty(resolve, \"_tracked\", {\n get: () => true\n });\n promise = resolve.then(data => Object.defineProperty(resolve, \"_data\", {\n get: () => data\n }), error => Object.defineProperty(resolve, \"_error\", {\n get: () => error\n }));\n }\n if (status === AwaitRenderStatus.error && promise._error instanceof AbortedDeferredError) {\n // Freeze the UI by throwing a never resolved promise\n throw neverSettledPromise;\n }\n if (status === AwaitRenderStatus.error && !errorElement) {\n // No errorElement, throw to the nearest route-level error boundary\n throw promise._error;\n }\n if (status === AwaitRenderStatus.error) {\n // Render via our errorElement\n return /*#__PURE__*/React.createElement(AwaitContext.Provider, {\n value: promise,\n children: errorElement\n });\n }\n if (status === AwaitRenderStatus.success) {\n // Render children with resolved value\n return /*#__PURE__*/React.createElement(AwaitContext.Provider, {\n value: promise,\n children: children\n });\n }\n\n // Throw to the suspense boundary\n throw promise;\n }\n}\n\n/**\n * @private\n * Indirection to leverage useAsyncValue for a render-prop API on `<Await>`\n */\nfunction ResolveAwait(_ref8) {\n let {\n children\n } = _ref8;\n let data = useAsyncValue();\n let toRender = typeof children === \"function\" ? children(data) : children;\n return /*#__PURE__*/React.createElement(React.Fragment, null, toRender);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `<Route>` element or an array of them. Used internally by\n * `<Routes>` to create a route config from its children.\n *\n * @see https://reactrouter.com/v6/utils/create-routes-from-children\n */\nfunction createRoutesFromChildren(children, parentPath) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n let routes = [];\n React.Children.forEach(children, (element, index) => {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n let treePath = [...parentPath, index];\n if (element.type === React.Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));\n return;\n }\n !(element.type === Route) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"[\" + (typeof element.type === \"string\" ? element.type : element.type.name) + \"] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>\") : UNSAFE_invariant(false) : void 0;\n !(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"An index route cannot have child routes.\") : UNSAFE_invariant(false) : void 0;\n let route = {\n id: element.props.id || treePath.join(\"-\"),\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n Component: element.props.Component,\n index: element.props.index,\n path: element.props.path,\n loader: element.props.loader,\n action: element.props.action,\n errorElement: element.props.errorElement,\n ErrorBoundary: element.props.ErrorBoundary,\n hasErrorBoundary: element.props.ErrorBoundary != null || element.props.errorElement != null,\n shouldRevalidate: element.props.shouldRevalidate,\n handle: element.props.handle,\n lazy: element.props.lazy\n };\n if (element.props.children) {\n route.children = createRoutesFromChildren(element.props.children, treePath);\n }\n routes.push(route);\n });\n return routes;\n}\n\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\nfunction renderMatches(matches) {\n return _renderMatches(matches);\n}\n\nfunction mapRouteProperties(route) {\n let updates = {\n // Note: this check also occurs in createRoutesFromChildren so update\n // there if you change this -- please and thank you!\n hasErrorBoundary: route.ErrorBoundary != null || route.errorElement != null\n };\n if (route.Component) {\n if (process.env.NODE_ENV !== \"production\") {\n if (route.element) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"You should not include both `Component` and `element` on your route - \" + \"`Component` will be used.\") : void 0;\n }\n }\n Object.assign(updates, {\n element: /*#__PURE__*/React.createElement(route.Component),\n Component: undefined\n });\n }\n if (route.HydrateFallback) {\n if (process.env.NODE_ENV !== \"production\") {\n if (route.hydrateFallbackElement) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - \" + \"`HydrateFallback` will be used.\") : void 0;\n }\n }\n Object.assign(updates, {\n hydrateFallbackElement: /*#__PURE__*/React.createElement(route.HydrateFallback),\n HydrateFallback: undefined\n });\n }\n if (route.ErrorBoundary) {\n if (process.env.NODE_ENV !== \"production\") {\n if (route.errorElement) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"You should not include both `ErrorBoundary` and `errorElement` on your route - \" + \"`ErrorBoundary` will be used.\") : void 0;\n }\n }\n Object.assign(updates, {\n errorElement: /*#__PURE__*/React.createElement(route.ErrorBoundary),\n ErrorBoundary: undefined\n });\n }\n return updates;\n}\nfunction createMemoryRouter(routes, opts) {\n return createRouter({\n basename: opts == null ? void 0 : opts.basename,\n future: _extends({}, opts == null ? void 0 : opts.future, {\n v7_prependBasename: true\n }),\n history: createMemoryHistory({\n initialEntries: opts == null ? void 0 : opts.initialEntries,\n initialIndex: opts == null ? void 0 : opts.initialIndex\n }),\n hydrationData: opts == null ? void 0 : opts.hydrationData,\n routes,\n mapRouteProperties,\n dataStrategy: opts == null ? void 0 : opts.dataStrategy,\n patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation\n }).initialize();\n}\n\nexport { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, logV6DeprecationWarnings as UNSAFE_logV6DeprecationWarnings, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };\n//# sourceMappingURL=index.js.map\n","/**\n * React Router DOM v6.30.4\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { UNSAFE_mapRouteProperties, UNSAFE_logV6DeprecationWarnings, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, Router, UNSAFE_useRoutesImpl, UNSAFE_NavigationContext, useHref, useResolvedPath, useLocation, useNavigate, createPath, UNSAFE_useRouteId, UNSAFE_RouteContext, useMatches, useNavigation, useBlocker } from 'react-router';\nexport { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';\nimport { stripBasename, UNSAFE_warning, createRouter, createBrowserHistory, createHashHistory, UNSAFE_ErrorResponseImpl, UNSAFE_invariant, joinPaths, IDLE_FETCHER, matchPath } from '@remix-run/router';\nexport { UNSAFE_ErrorResponseImpl } from '@remix-run/router';\n\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\n\nconst defaultMethod = \"get\";\nconst defaultEncType = \"application/x-www-form-urlencoded\";\nfunction isHtmlElement(object) {\n return object != null && typeof object.tagName === \"string\";\n}\nfunction isButtonElement(object) {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"button\";\n}\nfunction isFormElement(object) {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"form\";\n}\nfunction isInputElement(object) {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"input\";\n}\nfunction isModifiedEvent(event) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\nfunction shouldProcessLinkClick(event, target) {\n return event.button === 0 && (\n // Ignore everything but left clicks\n !target || target === \"_self\") &&\n // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n;\n}\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nfunction createSearchParams(init) {\n if (init === void 0) {\n init = \"\";\n }\n return new URLSearchParams(typeof init === \"string\" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);\n }, []));\n}\nfunction getSearchParamsForLocation(locationSearch, defaultSearchParams) {\n let searchParams = createSearchParams(locationSearch);\n if (defaultSearchParams) {\n // Use `defaultSearchParams.forEach(...)` here instead of iterating of\n // `defaultSearchParams.keys()` to work-around a bug in Firefox related to\n // web extensions. Relevant Bugzilla tickets:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1414602\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1023984\n defaultSearchParams.forEach((_, key) => {\n if (!searchParams.has(key)) {\n defaultSearchParams.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n });\n }\n return searchParams;\n}\n// One-time check for submitter support\nlet _formDataSupportsSubmitter = null;\nfunction isFormDataSubmitterSupported() {\n if (_formDataSupportsSubmitter === null) {\n try {\n new FormData(document.createElement(\"form\"),\n // @ts-expect-error if FormData supports the submitter parameter, this will throw\n 0);\n _formDataSupportsSubmitter = false;\n } catch (e) {\n _formDataSupportsSubmitter = true;\n }\n }\n return _formDataSupportsSubmitter;\n}\nconst supportedFormEncTypes = new Set([\"application/x-www-form-urlencoded\", \"multipart/form-data\", \"text/plain\"]);\nfunction getFormEncType(encType) {\n if (encType != null && !supportedFormEncTypes.has(encType)) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"\\\"\" + encType + \"\\\" is not a valid `encType` for `<Form>`/`<fetcher.Form>` \" + (\"and will default to \\\"\" + defaultEncType + \"\\\"\")) : void 0;\n return null;\n }\n return encType;\n}\nfunction getFormSubmissionInfo(target, basename) {\n let method;\n let action;\n let encType;\n let formData;\n let body;\n if (isFormElement(target)) {\n // When grabbing the action from the element, it will have had the basename\n // prefixed to ensure non-JS scenarios work, so strip it since we'll\n // re-prefix in the router\n let attr = target.getAttribute(\"action\");\n action = attr ? stripBasename(attr, basename) : null;\n method = target.getAttribute(\"method\") || defaultMethod;\n encType = getFormEncType(target.getAttribute(\"enctype\")) || defaultEncType;\n formData = new FormData(target);\n } else if (isButtonElement(target) || isInputElement(target) && (target.type === \"submit\" || target.type === \"image\")) {\n let form = target.form;\n if (form == null) {\n throw new Error(\"Cannot submit a <button> or <input type=\\\"submit\\\"> without a <form>\");\n }\n // <button>/<input type=\"submit\"> may override attributes of <form>\n // When grabbing the action from the element, it will have had the basename\n // prefixed to ensure non-JS scenarios work, so strip it since we'll\n // re-prefix in the router\n let attr = target.getAttribute(\"formaction\") || form.getAttribute(\"action\");\n action = attr ? stripBasename(attr, basename) : null;\n method = target.getAttribute(\"formmethod\") || form.getAttribute(\"method\") || defaultMethod;\n encType = getFormEncType(target.getAttribute(\"formenctype\")) || getFormEncType(form.getAttribute(\"enctype\")) || defaultEncType;\n // Build a FormData object populated from a form and submitter\n formData = new FormData(form, target);\n // If this browser doesn't support the `FormData(el, submitter)` format,\n // then tack on the submitter value at the end. This is a lightweight\n // solution that is not 100% spec compliant. For complete support in older\n // browsers, consider using the `formdata-submitter-polyfill` package\n if (!isFormDataSubmitterSupported()) {\n let {\n name,\n type,\n value\n } = target;\n if (type === \"image\") {\n let prefix = name ? name + \".\" : \"\";\n formData.append(prefix + \"x\", \"0\");\n formData.append(prefix + \"y\", \"0\");\n } else if (name) {\n formData.append(name, value);\n }\n }\n } else if (isHtmlElement(target)) {\n throw new Error(\"Cannot submit element that is not <form>, <button>, or \" + \"<input type=\\\"submit|image\\\">\");\n } else {\n method = defaultMethod;\n action = null;\n encType = defaultEncType;\n body = target;\n }\n // Send body for <Form encType=\"text/plain\" so we encode it into text\n if (formData && encType === \"text/plain\") {\n body = formData;\n formData = undefined;\n }\n return {\n action,\n method: method.toLowerCase(),\n encType,\n formData,\n body\n };\n}\n\nconst _excluded = [\"onClick\", \"relative\", \"reloadDocument\", \"replace\", \"state\", \"target\", \"to\", \"preventScrollReset\", \"viewTransition\"],\n _excluded2 = [\"aria-current\", \"caseSensitive\", \"className\", \"end\", \"style\", \"to\", \"viewTransition\", \"children\"],\n _excluded3 = [\"fetcherKey\", \"navigate\", \"reloadDocument\", \"replace\", \"state\", \"method\", \"action\", \"onSubmit\", \"relative\", \"preventScrollReset\", \"viewTransition\"];\n// HEY YOU! DON'T TOUCH THIS VARIABLE!\n//\n// It is replaced with the proper version at build time via a babel plugin in\n// the rollup config.\n//\n// Export a global property onto the window for React Router detection by the\n// Core Web Vitals Technology Report. This way they can configure the `wappalyzer`\n// to detect and properly classify live websites as being built with React Router:\n// https://github.com/HTTPArchive/wappalyzer/blob/main/src/technologies/r.json\nconst REACT_ROUTER_VERSION = \"6\";\ntry {\n window.__reactRouterVersion = REACT_ROUTER_VERSION;\n} catch (e) {\n // no-op\n}\nfunction createBrowserRouter(routes, opts) {\n return createRouter({\n basename: opts == null ? void 0 : opts.basename,\n future: _extends({}, opts == null ? void 0 : opts.future, {\n v7_prependBasename: true\n }),\n history: createBrowserHistory({\n window: opts == null ? void 0 : opts.window\n }),\n hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),\n routes,\n mapRouteProperties: UNSAFE_mapRouteProperties,\n dataStrategy: opts == null ? void 0 : opts.dataStrategy,\n patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,\n window: opts == null ? void 0 : opts.window\n }).initialize();\n}\nfunction createHashRouter(routes, opts) {\n return createRouter({\n basename: opts == null ? void 0 : opts.basename,\n future: _extends({}, opts == null ? void 0 : opts.future, {\n v7_prependBasename: true\n }),\n history: createHashHistory({\n window: opts == null ? void 0 : opts.window\n }),\n hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),\n routes,\n mapRouteProperties: UNSAFE_mapRouteProperties,\n dataStrategy: opts == null ? void 0 : opts.dataStrategy,\n patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation,\n window: opts == null ? void 0 : opts.window\n }).initialize();\n}\nfunction parseHydrationData() {\n var _window;\n let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData;\n if (state && state.errors) {\n state = _extends({}, state, {\n errors: deserializeErrors(state.errors)\n });\n }\n return state;\n}\nfunction deserializeErrors(errors) {\n if (!errors) return null;\n let entries = Object.entries(errors);\n let serialized = {};\n for (let [key, val] of entries) {\n // Hey you! If you change this, please change the corresponding logic in\n // serializeErrors in react-router-dom/server.tsx :)\n if (val && val.__type === \"RouteErrorResponse\") {\n serialized[key] = new UNSAFE_ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);\n } else if (val && val.__type === \"Error\") {\n // Attempt to reconstruct the right type of Error (i.e., ReferenceError)\n if (val.__subType) {\n let ErrorConstructor = window[val.__subType];\n if (typeof ErrorConstructor === \"function\") {\n try {\n // @ts-expect-error\n let error = new ErrorConstructor(val.message);\n // Wipe away the client-side stack trace. Nothing to fill it in with\n // because we don't serialize SSR stack traces for security reasons\n error.stack = \"\";\n serialized[key] = error;\n } catch (e) {\n // no-op - fall through and create a normal Error\n }\n }\n }\n if (serialized[key] == null) {\n let error = new Error(val.message);\n // Wipe away the client-side stack trace. Nothing to fill it in with\n // because we don't serialize SSR stack traces for security reasons\n error.stack = \"\";\n serialized[key] = error;\n }\n } else {\n serialized[key] = val;\n }\n }\n return serialized;\n}\nconst ViewTransitionContext = /*#__PURE__*/React.createContext({\n isTransitioning: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n ViewTransitionContext.displayName = \"ViewTransition\";\n}\nconst FetchersContext = /*#__PURE__*/React.createContext(new Map());\nif (process.env.NODE_ENV !== \"production\") {\n FetchersContext.displayName = \"Fetchers\";\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Components\n////////////////////////////////////////////////////////////////////////////////\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\nconst FLUSH_SYNC = \"flushSync\";\nconst flushSyncImpl = ReactDOM[FLUSH_SYNC];\nconst USE_ID = \"useId\";\nconst useIdImpl = React[USE_ID];\nfunction startTransitionSafe(cb) {\n if (startTransitionImpl) {\n startTransitionImpl(cb);\n } else {\n cb();\n }\n}\nfunction flushSyncSafe(cb) {\n if (flushSyncImpl) {\n flushSyncImpl(cb);\n } else {\n cb();\n }\n}\nclass Deferred {\n constructor() {\n this.status = \"pending\";\n this.promise = new Promise((resolve, reject) => {\n this.resolve = value => {\n if (this.status === \"pending\") {\n this.status = \"resolved\";\n resolve(value);\n }\n };\n this.reject = reason => {\n if (this.status === \"pending\") {\n this.status = \"rejected\";\n reject(reason);\n }\n };\n });\n }\n}\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let [pendingState, setPendingState] = React.useState();\n let [vtContext, setVtContext] = React.useState({\n isTransitioning: false\n });\n let [renderDfd, setRenderDfd] = React.useState();\n let [transition, setTransition] = React.useState();\n let [interruption, setInterruption] = React.useState();\n let fetcherData = React.useRef(new Map());\n let {\n v7_startTransition\n } = future || {};\n let optInStartTransition = React.useCallback(cb => {\n if (v7_startTransition) {\n startTransitionSafe(cb);\n } else {\n cb();\n }\n }, [v7_startTransition]);\n let setState = React.useCallback((newState, _ref2) => {\n let {\n deletedFetchers,\n flushSync: flushSync,\n viewTransitionOpts: viewTransitionOpts\n } = _ref2;\n newState.fetchers.forEach((fetcher, key) => {\n if (fetcher.data !== undefined) {\n fetcherData.current.set(key, fetcher.data);\n }\n });\n deletedFetchers.forEach(key => fetcherData.current.delete(key));\n let isViewTransitionUnavailable = router.window == null || router.window.document == null || typeof router.window.document.startViewTransition !== \"function\";\n // If this isn't a view transition or it's not available in this browser,\n // just update and be done with it\n if (!viewTransitionOpts || isViewTransitionUnavailable) {\n if (flushSync) {\n flushSyncSafe(() => setStateImpl(newState));\n } else {\n optInStartTransition(() => setStateImpl(newState));\n }\n return;\n }\n // flushSync + startViewTransition\n if (flushSync) {\n // Flush through the context to mark DOM elements as transition=ing\n flushSyncSafe(() => {\n // Cancel any pending transitions\n if (transition) {\n renderDfd && renderDfd.resolve();\n transition.skipTransition();\n }\n setVtContext({\n isTransitioning: true,\n flushSync: true,\n currentLocation: viewTransitionOpts.currentLocation,\n nextLocation: viewTransitionOpts.nextLocation\n });\n });\n // Update the DOM\n let t = router.window.document.startViewTransition(() => {\n flushSyncSafe(() => setStateImpl(newState));\n });\n // Clean up after the animation completes\n t.finished.finally(() => {\n flushSyncSafe(() => {\n setRenderDfd(undefined);\n setTransition(undefined);\n setPendingState(undefined);\n setVtContext({\n isTransitioning: false\n });\n });\n });\n flushSyncSafe(() => setTransition(t));\n return;\n }\n // startTransition + startViewTransition\n if (transition) {\n // Interrupting an in-progress transition, cancel and let everything flush\n // out, and then kick off a new transition from the interruption state\n renderDfd && renderDfd.resolve();\n transition.skipTransition();\n setInterruption({\n state: newState,\n currentLocation: viewTransitionOpts.currentLocation,\n nextLocation: viewTransitionOpts.nextLocation\n });\n } else {\n // Completed navigation update with opted-in view transitions, let 'er rip\n setPendingState(newState);\n setVtContext({\n isTransitioning: true,\n flushSync: false,\n currentLocation: viewTransitionOpts.currentLocation,\n nextLocation: viewTransitionOpts.nextLocation\n });\n }\n }, [router.window, transition, renderDfd, fetcherData, optInStartTransition]);\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n // When we start a view transition, create a Deferred we can use for the\n // eventual \"completed\" render\n React.useEffect(() => {\n if (vtContext.isTransitioning && !vtContext.flushSync) {\n setRenderDfd(new Deferred());\n }\n }, [vtContext]);\n // Once the deferred is created, kick off startViewTransition() to update the\n // DOM and then wait on the Deferred to resolve (indicating the DOM update has\n // happened)\n React.useEffect(() => {\n if (renderDfd && pendingState && router.window) {\n let newState = pendingState;\n let renderPromise = renderDfd.promise;\n let transition = router.window.document.startViewTransition(async () => {\n optInStartTransition(() => setStateImpl(newState));\n await renderPromise;\n });\n transition.finished.finally(() => {\n setRenderDfd(undefined);\n setTransition(undefined);\n setPendingState(undefined);\n setVtContext({\n isTransitioning: false\n });\n });\n setTransition(transition);\n }\n }, [optInStartTransition, pendingState, renderDfd, router.window]);\n // When the new location finally renders and is committed to the DOM, this\n // effect will run to resolve the transition\n React.useEffect(() => {\n if (renderDfd && pendingState && state.location.key === pendingState.location.key) {\n renderDfd.resolve();\n }\n }, [renderDfd, transition, state.location, pendingState]);\n // If we get interrupted with a new navigation during a transition, we skip\n // the active transition, let it cleanup, then kick it off again here\n React.useEffect(() => {\n if (!vtContext.isTransitioning && interruption) {\n setPendingState(interruption.state);\n setVtContext({\n isTransitioning: true,\n flushSync: false,\n currentLocation: interruption.currentLocation,\n nextLocation: interruption.nextLocation\n });\n setInterruption(undefined);\n }\n }, [vtContext.isTransitioning, interruption]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`<RouterProvider fallbackElement>` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n let routerFuture = React.useMemo(() => ({\n v7_relativeSplatPath: router.future.v7_relativeSplatPath\n }), [router.future.v7_relativeSplatPath]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future, router.future), [future, router.future]);\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a <script> here\n // containing the hydrated server-side staticContext (from StaticRouterProvider).\n // useId relies on the component tree structure to generate deterministic id's\n // so we need to ensure it remains the same on the client even though\n // we don't need the <script> tag\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UNSAFE_DataRouterContext.Provider, {\n value: dataRouterContext\n }, /*#__PURE__*/React.createElement(UNSAFE_DataRouterStateContext.Provider, {\n value: state\n }, /*#__PURE__*/React.createElement(FetchersContext.Provider, {\n value: fetcherData.current\n }, /*#__PURE__*/React.createElement(ViewTransitionContext.Provider, {\n value: vtContext\n }, /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n location: state.location,\n navigationType: state.historyAction,\n navigator: navigator,\n future: routerFuture\n }, state.initialized || router.future.v7_partialHydration ? (/*#__PURE__*/React.createElement(MemoizedDataRoutes, {\n routes: router.routes,\n future: router.future,\n state: state\n })) : fallbackElement))))), null);\n}\n// Memoize to avoid re-renders when updating `ViewTransitionContext`\nconst MemoizedDataRoutes = /*#__PURE__*/React.memo(DataRoutes);\nfunction DataRoutes(_ref3) {\n let {\n routes,\n future,\n state\n } = _ref3;\n return UNSAFE_useRoutesImpl(routes, undefined, state, future);\n}\n/**\n * A `<Router>` for use in web browsers. Provides the cleanest URLs.\n */\nfunction BrowserRouter(_ref4) {\n let {\n basename,\n children,\n future,\n window\n } = _ref4;\n let historyRef = React.useRef();\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({\n window,\n v5Compat: true\n });\n }\n let history = historyRef.current;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\n/**\n * A `<Router>` for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nfunction HashRouter(_ref5) {\n let {\n basename,\n children,\n future,\n window\n } = _ref5;\n let historyRef = React.useRef();\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({\n window,\n v5Compat: true\n });\n }\n let history = historyRef.current;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\n/**\n * A `<Router>` that accepts a pre-instantiated history object. It's important\n * to note that using your own history object is highly discouraged and may add\n * two versions of the history library to your bundles unless you use the same\n * version of the history library that React Router uses internally.\n */\nfunction HistoryRouter(_ref6) {\n let {\n basename,\n children,\n future,\n history\n } = _ref6;\n let [state, setStateImpl] = React.useState({\n action: history.action,\n location: history.location\n });\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => history.listen(setState), [history, setState]);\n React.useEffect(() => UNSAFE_logV6DeprecationWarnings(future), [future]);\n return /*#__PURE__*/React.createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history,\n future: future\n });\n}\nif (process.env.NODE_ENV !== \"production\") {\n HistoryRouter.displayName = \"unstable_HistoryRouter\";\n}\nconst isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.document.createElement !== \"undefined\";\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\n/**\n * The public API for rendering a history-aware `<a>`.\n */\nconst Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref7, ref) {\n let {\n onClick,\n relative,\n reloadDocument,\n replace,\n state,\n target,\n to,\n preventScrollReset,\n viewTransition\n } = _ref7,\n rest = _objectWithoutPropertiesLoose(_ref7, _excluded);\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n // Rendered into <a href> for absolute URLs\n let absoluteHref;\n let isExternal = false;\n if (typeof to === \"string\" && ABSOLUTE_URL_REGEX.test(to)) {\n // Render the absolute href server- and client-side\n absoluteHref = to;\n // Only check for external origins client-side\n if (isBrowser) {\n try {\n let currentUrl = new URL(window.location.href);\n let targetUrl = to.startsWith(\"//\") ? new URL(currentUrl.protocol + to) : new URL(to);\n let path = stripBasename(targetUrl.pathname, basename);\n if (targetUrl.origin === currentUrl.origin && path != null) {\n // Strip the protocol/origin/basename for same-origin absolute URLs\n to = path + targetUrl.search + targetUrl.hash;\n } else {\n isExternal = true;\n }\n } catch (e) {\n // We can't do external URL detection without a valid URL\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"<Link to=\\\"\" + to + \"\\\"> contains an invalid URL which will probably break \" + \"when clicked - please update to a valid URL path.\") : void 0;\n }\n }\n }\n // Rendered into <a href> for relative URLs\n let href = useHref(to, {\n relative\n });\n let internalOnClick = useLinkClickHandler(to, {\n replace,\n state,\n target,\n preventScrollReset,\n relative,\n viewTransition\n });\n function handleClick(event) {\n if (onClick) onClick(event);\n if (!event.defaultPrevented) {\n internalOnClick(event);\n }\n }\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n React.createElement(\"a\", _extends({}, rest, {\n href: absoluteHref || href,\n onClick: isExternal || reloadDocument ? onClick : handleClick,\n ref: ref,\n target: target\n }))\n );\n});\nif (process.env.NODE_ENV !== \"production\") {\n Link.displayName = \"Link\";\n}\n/**\n * A `<Link>` wrapper that knows if it's \"active\" or not.\n */\nconst NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref8, ref) {\n let {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n viewTransition,\n children\n } = _ref8,\n rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);\n let path = useResolvedPath(to, {\n relative: rest.relative\n });\n let location = useLocation();\n let routerState = React.useContext(UNSAFE_DataRouterStateContext);\n let {\n navigator,\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let isTransitioning = routerState != null &&\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useViewTransitionState(path) && viewTransition === true;\n let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;\n let locationPathname = location.pathname;\n let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;\n toPathname = toPathname.toLowerCase();\n }\n if (nextLocationPathname && basename) {\n nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;\n }\n // If the `to` has a trailing slash, look at that exact spot. Otherwise,\n // we're looking for a slash _after_ what's in `to`. For example:\n //\n // <NavLink to=\"/users\"> and <NavLink to=\"/users/\">\n // both want to look for a / at index 6 to match URL `/users/matt`\n const endSlashPosition = toPathname !== \"/\" && toPathname.endsWith(\"/\") ? toPathname.length - 1 : toPathname.length;\n let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === \"/\";\n let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === \"/\");\n let renderProps = {\n isActive,\n isPending,\n isTransitioning\n };\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n let className;\n if (typeof classNameProp === \"function\") {\n className = classNameProp(renderProps);\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for <NavLink />s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null, isPending ? \"pending\" : null, isTransitioning ? \"transitioning\" : null].filter(Boolean).join(\" \");\n }\n let style = typeof styleProp === \"function\" ? styleProp(renderProps) : styleProp;\n return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {\n \"aria-current\": ariaCurrent,\n className: className,\n ref: ref,\n style: style,\n to: to,\n viewTransition: viewTransition\n }), typeof children === \"function\" ? children(renderProps) : children);\n});\nif (process.env.NODE_ENV !== \"production\") {\n NavLink.displayName = \"NavLink\";\n}\n/**\n * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except\n * that the interaction with the server is with `fetch` instead of new document\n * requests, allowing components to add nicer UX to the page as the form is\n * submitted and returns with data.\n */\nconst Form = /*#__PURE__*/React.forwardRef((_ref9, forwardedRef) => {\n let {\n fetcherKey,\n navigate,\n reloadDocument,\n replace,\n state,\n method = defaultMethod,\n action,\n onSubmit,\n relative,\n preventScrollReset,\n viewTransition\n } = _ref9,\n props = _objectWithoutPropertiesLoose(_ref9, _excluded3);\n let submit = useSubmit();\n let formAction = useFormAction(action, {\n relative\n });\n let formMethod = method.toLowerCase() === \"get\" ? \"get\" : \"post\";\n let submitHandler = event => {\n onSubmit && onSubmit(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n let submitter = event.nativeEvent.submitter;\n let submitMethod = (submitter == null ? void 0 : submitter.getAttribute(\"formmethod\")) || method;\n submit(submitter || event.currentTarget, {\n fetcherKey,\n method: submitMethod,\n navigate,\n replace,\n state,\n relative,\n preventScrollReset,\n viewTransition\n });\n };\n return /*#__PURE__*/React.createElement(\"form\", _extends({\n ref: forwardedRef,\n method: formMethod,\n action: formAction,\n onSubmit: reloadDocument ? onSubmit : submitHandler\n }, props));\n});\nif (process.env.NODE_ENV !== \"production\") {\n Form.displayName = \"Form\";\n}\n/**\n * This component will emulate the browser's scroll restoration on location\n * changes.\n */\nfunction ScrollRestoration(_ref0) {\n let {\n getKey,\n storageKey\n } = _ref0;\n useScrollRestoration({\n getKey,\n storageKey\n });\n return null;\n}\nif (process.env.NODE_ENV !== \"production\") {\n ScrollRestoration.displayName = \"ScrollRestoration\";\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Hooks\n////////////////////////////////////////////////////////////////////////////////\nvar DataRouterHook;\n(function (DataRouterHook) {\n DataRouterHook[\"UseScrollRestoration\"] = \"useScrollRestoration\";\n DataRouterHook[\"UseSubmit\"] = \"useSubmit\";\n DataRouterHook[\"UseSubmitFetcher\"] = \"useSubmitFetcher\";\n DataRouterHook[\"UseFetcher\"] = \"useFetcher\";\n DataRouterHook[\"useViewTransitionState\"] = \"useViewTransitionState\";\n})(DataRouterHook || (DataRouterHook = {}));\nvar DataRouterStateHook;\n(function (DataRouterStateHook) {\n DataRouterStateHook[\"UseFetcher\"] = \"useFetcher\";\n DataRouterStateHook[\"UseFetchers\"] = \"useFetchers\";\n DataRouterStateHook[\"UseScrollRestoration\"] = \"useScrollRestoration\";\n})(DataRouterStateHook || (DataRouterStateHook = {}));\n// Internal hooks\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(UNSAFE_DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(UNSAFE_DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\n// External hooks\n/**\n * Handles the click behavior for router `<Link>` components. This is useful if\n * you need to create custom `<Link>` components with the same click behavior we\n * use in our exported `<Link>`.\n */\nfunction useLinkClickHandler(to, _temp) {\n let {\n target,\n replace: replaceProp,\n state,\n preventScrollReset,\n relative,\n viewTransition\n } = _temp === void 0 ? {} : _temp;\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to, {\n relative\n });\n return React.useCallback(event => {\n if (shouldProcessLinkClick(event, target)) {\n event.preventDefault();\n // If the URL hasn't changed, a regular <a> will do a replace instead of\n // a push, so do the same here unless the replace prop is explicitly set\n let replace = replaceProp !== undefined ? replaceProp : createPath(location) === createPath(path);\n navigate(to, {\n replace,\n state,\n preventScrollReset,\n relative,\n viewTransition\n });\n }\n }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);\n}\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\nfunction useSearchParams(defaultInit) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(typeof URLSearchParams !== \"undefined\", \"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.\") : void 0;\n let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));\n let hasSetSearchParamsRef = React.useRef(false);\n let location = useLocation();\n let searchParams = React.useMemo(() =>\n // Only merge in the defaults if we haven't yet called setSearchParams.\n // Once we call that we want those to take precedence, otherwise you can't\n // remove a param with setSearchParams({}) if it has an initial value\n getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);\n let navigate = useNavigate();\n let setSearchParams = React.useCallback((nextInit, navigateOptions) => {\n const newSearchParams = createSearchParams(typeof nextInit === \"function\" ? nextInit(searchParams) : nextInit);\n hasSetSearchParamsRef.current = true;\n navigate(\"?\" + newSearchParams, navigateOptions);\n }, [navigate, searchParams]);\n return [searchParams, setSearchParams];\n}\nfunction validateClientSideSubmission() {\n if (typeof document === \"undefined\") {\n throw new Error(\"You are calling submit during the server render. \" + \"Try calling submit within a `useEffect` or callback instead.\");\n }\n}\nlet fetcherId = 0;\nlet getUniqueFetcherId = () => \"__\" + String(++fetcherId) + \"__\";\n/**\n * Returns a function that may be used to programmatically submit a form (or\n * some arbitrary data) to the server.\n */\nfunction useSubmit() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseSubmit);\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let currentRouteId = UNSAFE_useRouteId();\n return React.useCallback(function (target, options) {\n if (options === void 0) {\n options = {};\n }\n validateClientSideSubmission();\n let {\n action,\n method,\n encType,\n formData,\n body\n } = getFormSubmissionInfo(target, basename);\n if (options.navigate === false) {\n let key = options.fetcherKey || getUniqueFetcherId();\n router.fetch(key, currentRouteId, options.action || action, {\n preventScrollReset: options.preventScrollReset,\n formData,\n body,\n formMethod: options.method || method,\n formEncType: options.encType || encType,\n flushSync: options.flushSync\n });\n } else {\n router.navigate(options.action || action, {\n preventScrollReset: options.preventScrollReset,\n formData,\n body,\n formMethod: options.method || method,\n formEncType: options.encType || encType,\n replace: options.replace,\n state: options.state,\n fromRouteId: currentRouteId,\n flushSync: options.flushSync,\n viewTransition: options.viewTransition\n });\n }\n }, [router, basename, currentRouteId]);\n}\n// v7: Eventually we should deprecate this entirely in favor of using the\n// router method directly?\nfunction useFormAction(action, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let routeContext = React.useContext(UNSAFE_RouteContext);\n !routeContext ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFormAction must be used inside a RouteContext\") : UNSAFE_invariant(false) : void 0;\n let [match] = routeContext.matches.slice(-1);\n // Shallow clone path so we can modify it below, otherwise we modify the\n // object referenced by useMemo inside useResolvedPath\n let path = _extends({}, useResolvedPath(action ? action : \".\", {\n relative\n }));\n // If no action was specified, browsers will persist current search params\n // when determining the path, so match that behavior\n // https://github.com/remix-run/remix/issues/927\n let location = useLocation();\n if (action == null) {\n // Safe to write to this directly here since if action was undefined, we\n // would have called useResolvedPath(\".\") which will never include a search\n path.search = location.search;\n // When grabbing search params from the URL, remove any included ?index param\n // since it might not apply to our contextual route. We add it back based\n // on match.route.index below\n let params = new URLSearchParams(path.search);\n let indexValues = params.getAll(\"index\");\n let hasNakedIndexParam = indexValues.some(v => v === \"\");\n if (hasNakedIndexParam) {\n params.delete(\"index\");\n indexValues.filter(v => v).forEach(v => params.append(\"index\", v));\n let qs = params.toString();\n path.search = qs ? \"?\" + qs : \"\";\n }\n }\n if ((!action || action === \".\") && match.route.index) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the form action. If this is a root navigation, then just use\n // the raw basename which allows the basename to have full control over the\n // presence of a trailing slash on root actions\n if (basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// TODO: (v7) Change the useFetcher generic default from `any` to `unknown`\n/**\n * Interacts with route loaders and actions without causing a navigation. Great\n * for any interaction that stays on the same page.\n */\nfunction useFetcher(_temp3) {\n var _route$matches;\n let {\n key\n } = _temp3 === void 0 ? {} : _temp3;\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseFetcher);\n let state = useDataRouterState(DataRouterStateHook.UseFetcher);\n let fetcherData = React.useContext(FetchersContext);\n let route = React.useContext(UNSAFE_RouteContext);\n let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;\n !fetcherData ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFetcher must be used inside a FetchersContext\") : UNSAFE_invariant(false) : void 0;\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFetcher must be used inside a RouteContext\") : UNSAFE_invariant(false) : void 0;\n !(routeId != null) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useFetcher can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n // Fetcher key handling\n // OK to call conditionally to feature detect `useId`\n // eslint-disable-next-line react-hooks/rules-of-hooks\n let defaultKey = useIdImpl ? useIdImpl() : \"\";\n let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);\n if (key && key !== fetcherKey) {\n setFetcherKey(key);\n } else if (!fetcherKey) {\n // We will only fall through here when `useId` is not available\n setFetcherKey(getUniqueFetcherId());\n }\n // Registration/cleanup\n React.useEffect(() => {\n router.getFetcher(fetcherKey);\n return () => {\n // Tell the router we've unmounted - if v7_fetcherPersist is enabled this\n // will not delete immediately but instead queue up a delete after the\n // fetcher returns to an `idle` state\n router.deleteFetcher(fetcherKey);\n };\n }, [router, fetcherKey]);\n // Fetcher additions\n let load = React.useCallback((href, opts) => {\n !routeId ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"No routeId available for fetcher.load()\") : UNSAFE_invariant(false) : void 0;\n router.fetch(fetcherKey, routeId, href, opts);\n }, [fetcherKey, routeId, router]);\n let submitImpl = useSubmit();\n let submit = React.useCallback((target, opts) => {\n submitImpl(target, _extends({}, opts, {\n navigate: false,\n fetcherKey\n }));\n }, [fetcherKey, submitImpl]);\n let FetcherForm = React.useMemo(() => {\n let FetcherForm = /*#__PURE__*/React.forwardRef((props, ref) => {\n return /*#__PURE__*/React.createElement(Form, _extends({}, props, {\n navigate: false,\n fetcherKey: fetcherKey,\n ref: ref\n }));\n });\n if (process.env.NODE_ENV !== \"production\") {\n FetcherForm.displayName = \"fetcher.Form\";\n }\n return FetcherForm;\n }, [fetcherKey]);\n // Exposed FetcherWithComponents\n let fetcher = state.fetchers.get(fetcherKey) || IDLE_FETCHER;\n let data = fetcherData.get(fetcherKey);\n let fetcherWithComponents = React.useMemo(() => _extends({\n Form: FetcherForm,\n submit,\n load\n }, fetcher, {\n data\n }), [FetcherForm, submit, load, fetcher, data]);\n return fetcherWithComponents;\n}\n/**\n * Provides all fetchers currently on the page. Useful for layouts and parent\n * routes that need to provide pending/optimistic UI regarding the fetch.\n */\nfunction useFetchers() {\n let state = useDataRouterState(DataRouterStateHook.UseFetchers);\n return Array.from(state.fetchers.entries()).map(_ref1 => {\n let [key, fetcher] = _ref1;\n return _extends({}, fetcher, {\n key\n });\n });\n}\nconst SCROLL_RESTORATION_STORAGE_KEY = \"react-router-scroll-positions\";\nlet savedScrollPositions = {};\n/**\n * When rendered inside a RouterProvider, will restore scroll positions on navigations\n */\nfunction useScrollRestoration(_temp4) {\n let {\n getKey,\n storageKey\n } = _temp4 === void 0 ? {} : _temp4;\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseScrollRestoration);\n let {\n restoreScrollPosition,\n preventScrollReset\n } = useDataRouterState(DataRouterStateHook.UseScrollRestoration);\n let {\n basename\n } = React.useContext(UNSAFE_NavigationContext);\n let location = useLocation();\n let matches = useMatches();\n let navigation = useNavigation();\n // Trigger manual scroll restoration while we're active\n React.useEffect(() => {\n window.history.scrollRestoration = \"manual\";\n return () => {\n window.history.scrollRestoration = \"auto\";\n };\n }, []);\n // Save positions on pagehide\n usePageHide(React.useCallback(() => {\n if (navigation.state === \"idle\") {\n let key = (getKey ? getKey(location, matches) : null) || location.key;\n savedScrollPositions[key] = window.scrollY;\n }\n try {\n sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));\n } catch (error) {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, \"Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (\" + error + \").\") : void 0;\n }\n window.history.scrollRestoration = \"auto\";\n }, [storageKey, getKey, navigation.state, location, matches]));\n // Read in any saved scroll locations\n if (typeof document !== \"undefined\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n try {\n let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);\n if (sessionPositions) {\n savedScrollPositions = JSON.parse(sessionPositions);\n }\n } catch (e) {\n // no-op, use default empty object\n }\n }, [storageKey]);\n // Enable scroll restoration in the router\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n let getKeyWithoutBasename = getKey && basename !== \"/\" ? (location, matches) => getKey(// Strip the basename to match useLocation()\n _extends({}, location, {\n pathname: stripBasename(location.pathname, basename) || location.pathname\n }), matches) : getKey;\n let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);\n return () => disableScrollRestoration && disableScrollRestoration();\n }, [router, basename, getKey]);\n // Restore scrolling when state.restoreScrollPosition changes\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n // Explicit false means don't do anything (used for submissions)\n if (restoreScrollPosition === false) {\n return;\n }\n // been here before, scroll to it\n if (typeof restoreScrollPosition === \"number\") {\n window.scrollTo(0, restoreScrollPosition);\n return;\n }\n // try to scroll to the hash\n if (location.hash) {\n let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));\n if (el) {\n el.scrollIntoView();\n return;\n }\n }\n // Don't reset if this navigation opted out\n if (preventScrollReset === true) {\n return;\n }\n // otherwise go to the top on new locations\n window.scrollTo(0, 0);\n }, [location, restoreScrollPosition, preventScrollReset]);\n }\n}\n/**\n * Setup a callback to be fired on the window's `beforeunload` event. This is\n * useful for saving some data to `window.localStorage` just before the page\n * refreshes.\n *\n * Note: The `callback` argument should be a function created with\n * `React.useCallback()`.\n */\nfunction useBeforeUnload(callback, options) {\n let {\n capture\n } = options || {};\n React.useEffect(() => {\n let opts = capture != null ? {\n capture\n } : undefined;\n window.addEventListener(\"beforeunload\", callback, opts);\n return () => {\n window.removeEventListener(\"beforeunload\", callback, opts);\n };\n }, [callback, capture]);\n}\n/**\n * Setup a callback to be fired on the window's `pagehide` event. This is\n * useful for saving some data to `window.localStorage` just before the page\n * refreshes. This event is better supported than beforeunload across browsers.\n *\n * Note: The `callback` argument should be a function created with\n * `React.useCallback()`.\n */\nfunction usePageHide(callback, options) {\n let {\n capture\n } = options || {};\n React.useEffect(() => {\n let opts = capture != null ? {\n capture\n } : undefined;\n window.addEventListener(\"pagehide\", callback, opts);\n return () => {\n window.removeEventListener(\"pagehide\", callback, opts);\n };\n }, [callback, capture]);\n}\n/**\n * Wrapper around useBlocker to show a window.confirm prompt to users instead\n * of building a custom UI with useBlocker.\n *\n * Warning: This has *a lot of rough edges* and behaves very differently (and\n * very incorrectly in some cases) across browsers if user click addition\n * back/forward navigations while the confirm is open. Use at your own risk.\n */\nfunction usePrompt(_ref10) {\n let {\n when,\n message\n } = _ref10;\n let blocker = useBlocker(when);\n React.useEffect(() => {\n if (blocker.state === \"blocked\") {\n let proceed = window.confirm(message);\n if (proceed) {\n // This timeout is needed to avoid a weird \"race\" on POP navigations\n // between the `window.history` revert navigation and the result of\n // `window.confirm`\n setTimeout(blocker.proceed, 0);\n } else {\n blocker.reset();\n }\n }\n }, [blocker, message]);\n React.useEffect(() => {\n if (blocker.state === \"blocked\" && !when) {\n blocker.reset();\n }\n }, [blocker, when]);\n}\n/**\n * Return a boolean indicating if there is an active view transition to the\n * given href. You can use this value to render CSS classes or viewTransitionName\n * styles onto your elements\n *\n * @param href The destination href\n * @param [opts.relative] Relative routing type (\"route\" | \"path\")\n */\nfunction useViewTransitionState(to, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let vtContext = React.useContext(ViewTransitionContext);\n !(vtContext != null) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. \" + \"Did you accidentally import `RouterProvider` from `react-router`?\") : UNSAFE_invariant(false) : void 0;\n let {\n basename\n } = useDataRouterContext(DataRouterHook.useViewTransitionState);\n let path = useResolvedPath(to, {\n relative: opts.relative\n });\n if (!vtContext.isTransitioning) {\n return false;\n }\n let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;\n let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;\n // Transition is active if we're going to or coming from the indicated\n // destination. This ensures that other PUSH navigations that reverse\n // an indicated transition apply. I.e., on the list view you have:\n //\n // <NavLink to=\"/details/1\" viewTransition>\n //\n // If you click the breadcrumb back to the list view:\n //\n // <NavLink to=\"/list\" viewTransition>\n //\n // We should apply the transition because it's indicated as active going\n // from /list -> /details/1 and therefore should be active on the reverse\n // (even though this isn't strictly a POP reverse)\n return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;\n}\n//#endregion\n\nexport { BrowserRouter, Form, HashRouter, Link, NavLink, RouterProvider, ScrollRestoration, FetchersContext as UNSAFE_FetchersContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, useScrollRestoration as UNSAFE_useScrollRestoration, createBrowserRouter, createHashRouter, createSearchParams, HistoryRouter as unstable_HistoryRouter, usePrompt as unstable_usePrompt, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, useSearchParams, useSubmit, useViewTransitionState };\n//# sourceMappingURL=index.js.map\n","'use strict';\n\n/**\n * Create a bound version of a function with a specified `this` context\n *\n * @param {Function} fn - The function to bind\n * @param {*} thisArg - The value to be passed as the `this` parameter\n * @returns {Function} A new function that will call the original function with the specified `this` context\n */\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst { toString } = Object.prototype;\nconst { getPrototypeOf } = Object;\nconst { iterator, toStringTag } = Symbol;\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (\n ({ hasOwnProperty }) =>\n (obj, prop) =>\n hasOwnProperty.call(obj, prop)\n)(Object.prototype);\n\n/**\n * Walk the prototype chain (excluding the shared Object.prototype) looking for\n * an own `prop`. This distinguishes genuine own/inherited members — including\n * class accessors and template prototypes — from members injected via\n * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which\n * live on Object.prototype itself and are therefore never matched.\n *\n * @param {*} thing The value whose chain to inspect\n * @param {string|symbol} prop The property key to look for\n *\n * @returns {boolean} True when `prop` is owned below Object.prototype\n */\nconst hasOwnInPrototypeChain = (thing, prop) => {\n let obj = thing;\n const seen = [];\n\n while (obj != null && obj !== Object.prototype) {\n if (seen.indexOf(obj) !== -1) {\n return false;\n }\n seen.push(obj);\n\n if (hasOwnProperty(obj, prop)) {\n return true;\n }\n obj = getPrototypeOf(obj);\n }\n return false;\n};\n\n/**\n * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own\n * properties and members inherited from a non-Object.prototype source (a class\n * instance or template object) are honored; a value reachable only through a\n * polluted Object.prototype is ignored and `undefined` is returned.\n *\n * @param {*} obj The source object\n * @param {string|symbol} prop The property key to read\n *\n * @returns {*} The resolved value, or undefined when unsafe/absent\n */\nconst getSafeProp = (obj, prop) =>\n obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;\n\nconst kindOf = ((cache) => (thing) => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type;\n};\n\nconst typeOfTest = (type) => (thing) => typeof thing === type;\n\n/**\n * Determine if a value is a non-null object\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst { isArray } = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return (\n val !== null &&\n !isUndefined(val) &&\n val.constructor !== null &&\n !isUndefined(val.constructor) &&\n isFunction(val.constructor.isBuffer) &&\n val.constructor.isBuffer(val)\n );\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n result = ArrayBuffer.isView(val);\n } else {\n result = val && val.buffer && isArrayBuffer(val.buffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = (thing) => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (!isObject(val)) {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (\n (prototype === null ||\n prototype === Object.prototype ||\n getPrototypeOf(prototype) === null) &&\n // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or\n // Symbol.iterator as evidence the value is a tagged/iterable type rather\n // than a plain object, while ignoring keys injected onto Object.prototype.\n !hasOwnInPrototypeChain(val, toStringTag) &&\n !hasOwnInPrototypeChain(val, iterator)\n );\n};\n\n/**\n * Determine if a value is an empty object (safely handles Buffers)\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an empty object, otherwise false\n */\nconst isEmptyObject = (val) => {\n // Early return for non-objects or Buffers to prevent RangeError\n if (!isObject(val) || isBuffer(val)) {\n return false;\n }\n\n try {\n return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;\n } catch (e) {\n // Fallback for any other objects that might cause RangeError with Object.keys()\n return false;\n }\n};\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a React Native Blob\n * React Native \"blob\": an object with a `uri` attribute. Optionally, it can\n * also have a `name` and `type` attribute to specify filename and content type\n *\n * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71\n *\n * @param {*} value The value to test\n *\n * @returns {boolean} True if value is a React Native Blob, otherwise false\n */\nconst isReactNativeBlob = (value) => {\n return !!(value && typeof value.uri !== 'undefined');\n};\n\n/**\n * Determine if environment is React Native\n * ReactNative `FormData` has a non-standard `getParts()` method\n *\n * @param {*} formData The formData to test\n *\n * @returns {boolean} True if environment is React Native, otherwise false\n */\nconst isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a FileList, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\nconst isSet = kindOfTest('Set');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction getGlobal() {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n return {};\n}\n\nconst G = getGlobal();\nconst FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;\n\nconst isFormData = (thing) => {\n if (!thing) return false;\n if (FormDataCtor && thing instanceof FormDataCtor) return true;\n // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.\n const proto = getPrototypeOf(thing);\n if (!proto || proto === Object.prototype) return false;\n if (!isFunction(thing.append)) return false;\n const kind = kindOf(thing);\n return (\n kind === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n );\n};\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = [\n 'ReadableStream',\n 'Request',\n 'Response',\n 'Headers',\n].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => {\n return str.trim ? str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n};\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array<unknown>} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Object} [options]\n * @param {Boolean} [options.allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, { allOwnKeys = false } = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Buffer check\n if (isBuffer(obj)) {\n return;\n }\n\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\n/**\n * Finds a key in an object, case-insensitive, returning the actual key name.\n * Returns null if the object is a Buffer or if no match is found.\n *\n * @param {Object} obj - The object to search.\n * @param {string} key - The key to find (case-insensitive).\n * @returns {?string} The actual key name if found, otherwise null.\n */\nfunction findKey(obj, key) {\n if (isBuffer(obj)) {\n return null;\n }\n\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== 'undefined') return globalThis;\n return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * const result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(...objs) {\n const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};\n const result = {};\n const assignValue = (val, key) => {\n // Skip dangerous property names to prevent prototype pollution\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return;\n }\n\n // findKey lowercases the key, so caseless lookup only applies to strings —\n // symbol keys are identity-matched.\n const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;\n // Read via own-prop only — a bare `result[targetKey]` walks the prototype\n // chain, so a polluted Object.prototype value could surface here and get\n // copied into the merged result.\n const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;\n if (isPlainObject(existing) && isPlainObject(val)) {\n result[targetKey] = merge(existing, val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else if (!skipUndefined || !isUndefined(val)) {\n result[targetKey] = val;\n }\n };\n\n for (let i = 0, l = objs.length; i < l; i++) {\n const source = objs[i];\n if (!source || isBuffer(source)) {\n continue;\n }\n\n forEach(source, assignValue);\n\n if (typeof source !== 'object' || isArray(source)) {\n continue;\n }\n\n const symbols = Object.getOwnPropertySymbols(source);\n for (let j = 0; j < symbols.length; j++) {\n const symbol = symbols[j];\n if (propertyIsEnumerable.call(source, symbol)) {\n assignValue(source[symbol], symbol);\n }\n }\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Object} [options]\n * @param {Boolean} [options.allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, { allOwnKeys } = {}) => {\n forEach(\n b,\n (val, key) => {\n if (thisArg && isFunction(val)) {\n Object.defineProperty(a, key, {\n // Null-proto descriptor so a polluted Object.prototype.get cannot\n // hijack defineProperty's accessor-vs-data resolution.\n __proto__: null,\n value: bind(val, thisArg),\n writable: true,\n enumerable: true,\n configurable: true,\n });\n } else {\n Object.defineProperty(a, key, {\n __proto__: null,\n value: val,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n },\n { allOwnKeys }\n );\n return a;\n};\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xfeff) {\n content = content.slice(1);\n }\n return content;\n};\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n Object.defineProperty(constructor.prototype, 'constructor', {\n __proto__: null,\n value: constructor,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n Object.defineProperty(constructor, 'super', {\n __proto__: null,\n value: superConstructor.prototype,\n });\n props && Object.assign(constructor.prototype, props);\n};\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n};\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n};\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n};\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = ((TypedArray) => {\n // eslint-disable-next-line func-names\n return (thing) => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object<any, any>} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[iterator];\n\n const _iterator = generator.call(obj);\n\n let result;\n\n while ((result = _iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n};\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array<boolean>}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n};\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = (str) => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g, function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n });\n};\n\nconst { propertyIsEnumerable } = Object.prototype;\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n};\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].includes(name)) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error(\"Can not rewrite read-only method '\" + name + \"'\");\n };\n }\n });\n};\n\n/**\n * Converts an array or a delimited string into an object set with values as keys and true as values.\n * Useful for fast membership checks.\n *\n * @param {Array|string} arrayOrString - The array or string to convert.\n * @param {string} delimiter - The delimiter to use if input is a string.\n * @returns {Object} An object with keys from the array or string, values set to true.\n */\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach((value) => {\n obj[value] = true;\n });\n };\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n};\n\nconst noop = () => {};\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite((value = +value)) ? value : defaultValue;\n};\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(\n thing &&\n isFunction(thing.append) &&\n thing[toStringTag] === 'FormData' &&\n thing[iterator]\n );\n}\n\n/**\n * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.\n *\n * @param {Object} obj - The object to convert.\n * @returns {Object} The JSON-compatible object.\n */\nconst toJSONObject = (obj) => {\n const visited = new WeakSet();\n\n const visit = (source) => {\n if (isObject(source)) {\n if (visited.has(source)) {\n return;\n }\n\n //Buffer check\n if (isBuffer(source)) {\n return source;\n }\n\n if (!('toJSON' in source)) {\n // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).\n visited.add(source);\n\n let target;\n\n if (isSet(source)) {\n target = [];\n for (const value of source) {\n const reducedValue = visit(value);\n !isUndefined(reducedValue) && target.push(reducedValue);\n }\n } else {\n target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n }\n\n visited.delete(source);\n\n return target;\n }\n }\n\n return source;\n };\n\n return visit(obj);\n};\n\n/**\n * Determines if a value is an async function.\n *\n * @param {*} thing - The value to test.\n * @returns {boolean} True if value is an async function, otherwise false.\n */\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\n/**\n * Determines if a value is thenable (has then and catch methods).\n *\n * @param {*} thing - The value to test.\n * @returns {boolean} True if value is thenable, otherwise false.\n */\nconst isThenable = (thing) =>\n thing &&\n (isObject(thing) || isFunction(thing)) &&\n isFunction(thing.then) &&\n isFunction(thing.catch);\n\n// original code\n// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34\n\n/**\n * Provides a cross-platform setImmediate implementation.\n * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.\n *\n * @param {boolean} setImmediateSupported - Whether setImmediate is supported.\n * @param {boolean} postMessageSupported - Whether postMessage is supported.\n * @returns {Function} A function to schedule a callback asynchronously.\n */\nconst _setImmediate = ((setImmediateSupported, postMessageSupported) => {\n if (setImmediateSupported) {\n return setImmediate;\n }\n\n return postMessageSupported\n ? ((token, callbacks) => {\n _global.addEventListener(\n 'message',\n ({ source, data }) => {\n if (source === _global && data === token) {\n callbacks.length && callbacks.shift()();\n }\n },\n false\n );\n\n return (cb) => {\n callbacks.push(cb);\n _global.postMessage(token, '*');\n };\n })(`axios@${Math.random()}`, [])\n : (cb) => setTimeout(cb);\n})(typeof setImmediate === 'function', isFunction(_global.postMessage));\n\n/**\n * Schedules a microtask or asynchronous callback as soon as possible.\n * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.\n *\n * @type {Function}\n */\nconst asap =\n typeof queueMicrotask !== 'undefined'\n ? queueMicrotask.bind(_global)\n : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;\n\n// *********************\n\nconst isIterable = (thing) => thing != null && isFunction(thing[iterator]);\n\n/**\n * Determine if a value is iterable via an iterator that is NOT sourced solely\n * from a polluted Object.prototype. Use this instead of `isIterable` whenever\n * the iterable comes from untrusted input (e.g. user-supplied header sources),\n * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object\n * into an attacker-controlled entries iterator.\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value has a non-polluted iterator\n */\nconst isSafeIterable = (thing) =>\n thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isEmptyObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isReactNativeBlob,\n isReactNative,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n hasOwnInPrototypeChain,\n getSafeProp,\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable,\n setImmediate: _setImmediate,\n asap,\n isIterable,\n isSafeIterable,\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age',\n 'authorization',\n 'content-length',\n 'content-type',\n 'etag',\n 'expires',\n 'from',\n 'host',\n 'if-modified-since',\n 'if-unmodified-since',\n 'last-modified',\n 'location',\n 'max-forwards',\n 'proxy-authorization',\n 'referer',\n 'retry-after',\n 'user-agent',\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default (rawHeaders) => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders &&\n rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n const hasKey = utils.hasOwnProp(parsed, key);\n\n if (!key || (hasKey && utils.hasOwnProp(ignoreDuplicateOf, key))) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (hasKey) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = hasKey ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\nfunction trimSPorHTAB(str) {\n let start = 0;\n let end = str.length;\n\n while (start < end) {\n const code = str.charCodeAt(start);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n start += 1;\n }\n\n while (end > start) {\n const code = str.charCodeAt(end - 1);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n end -= 1;\n }\n\n return start === 0 && end === str.length ? str : str.slice(start, end);\n}\n\n// The control-code ranges are intentional: header sanitization strips C0/DEL bytes.\n// eslint-disable-next-line no-control-regex\nconst INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\\\u0000-\\\\u0008\\\\u000a-\\\\u001f\\\\u007f]+', 'g');\n// eslint-disable-next-line no-control-regex\nconst INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\\\u0009\\\\u0020-\\\\u007e\\\\u0080-\\\\u00ff]+', 'g');\n\nfunction sanitizeValue(value, invalidChars) {\n if (utils.isArray(value)) {\n return value.map((item) => sanitizeValue(item, invalidChars));\n }\n\n return trimSPorHTAB(String(value).replace(invalidChars, ''));\n}\n\nexport const sanitizeHeaderValue = (value) =>\n sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);\n\nexport const sanitizeByteStringHeaderValue = (value) =>\n sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);\n\nexport function toByteStringHeaderObject(headers) {\n const byteStringHeaders = Object.create(null);\n\n utils.forEach(headers.toJSON(), (value, header) => {\n byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);\n });\n\n return byteStringHeaders;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\nimport { sanitizeHeaderValue } from '../helpers/sanitizeHeaderValue.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst parameterNameRE = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nfunction trimOWS(value) {\n let start = 0;\n let end = value.length;\n\n while (start < end) {\n const code = value.charCodeAt(start);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n start += 1;\n }\n\n while (end > start) {\n const code = value.charCodeAt(end - 1);\n\n if (code !== 0x09 && code !== 0x20) {\n break;\n }\n\n end -= 1;\n }\n\n return start === 0 && end === value.length ? value : value.slice(start, end);\n}\n\nfunction decodeQuotedString(value) {\n const last = value.length - 1;\n\n if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {\n return value;\n }\n\n let decoded = '';\n\n for (let i = 1; i < last; i++) {\n const code = value.charCodeAt(i);\n\n if (code === 0x22) {\n return value;\n }\n\n if (code === 0x5c) {\n i += 1;\n\n if (i >= last) {\n return value;\n }\n }\n\n decoded += value[i];\n }\n\n return decoded;\n}\n\nfunction parseParameters(value) {\n const parameters = Object.create(null);\n const str = String(value);\n let start = 0;\n let quoted = false;\n let escaped = false;\n\n function parseParameter(end) {\n const part = trimOWS(str.slice(start, end));\n const equals = part.indexOf('=');\n\n if (equals < 1) {\n return;\n }\n\n const name = trimOWS(part.slice(0, equals));\n\n if (!parameterNameRE.test(name)) {\n return;\n }\n\n const normalizedName = name.toLowerCase();\n\n if (\n normalizedName === '__proto__' ||\n normalizedName === 'constructor' ||\n normalizedName === 'prototype'\n ) {\n return;\n }\n\n const parameterValue = trimOWS(part.slice(equals + 1));\n parameters[normalizedName] = decodeQuotedString(parameterValue);\n }\n\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (quoted) {\n if (escaped) {\n escaped = false;\n } else if (code === 0x5c) {\n escaped = true;\n } else if (code === 0x22) {\n quoted = false;\n }\n } else if (code === 0x22) {\n quoted = true;\n } else if (code === 0x2c || code === 0x3b) {\n parseParameter(i);\n start = i + 1;\n }\n }\n\n parseParameter(str.length);\n\n return parameters;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header\n .trim()\n .toLowerCase()\n .replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach((methodName) => {\n Object.defineProperty(obj, methodName + accessorName, {\n // Null-proto descriptor so a polluted Object.prototype.get cannot turn\n // this data descriptor into an accessor descriptor on the way in.\n __proto__: null,\n value: function (arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true,\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n return;\n }\n\n const key = utils.findKey(self, lHeader);\n\n if (\n !key ||\n self[key] === undefined ||\n _rewrite === true ||\n (_rewrite === undefined && self[key] !== false)\n ) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite);\n } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isObject(header) && utils.isSafeIterable(header)) {\n let obj = Object.create(null),\n dest,\n key;\n for (const entry of header) {\n if (!utils.isArray(entry)) {\n throw new TypeError('Object iterator must return a key-value pair');\n }\n\n key = entry[0];\n\n if (utils.hasOwnProp(obj, key)) {\n dest = obj[key];\n obj[key] = utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];\n } else {\n obj[key] = entry[1];\n }\n }\n\n setHeaders(obj, valueOrRewrite);\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(\n key &&\n this[key] !== undefined &&\n (!matcher || matchHeaderValue(this, this[key], key, matcher))\n );\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null &&\n value !== false &&\n (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON())\n .map(([header, value]) => header + ': ' + value)\n .join('\\n');\n }\n\n getSetCookie() {\n const value = this.get('set-cookie');\n return utils.isArray(value) ? value : value == null || value === false ? [] : [value];\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static parseParameters(value) {\n return parseParameters(value);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals =\n (this[$internals] =\n this[$internals] =\n {\n accessors: {},\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor([\n 'Content-Type',\n 'Content-Length',\n 'Accept',\n 'Accept-Encoding',\n 'User-Agent',\n 'Authorization',\n]);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n },\n };\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nexport const REDACTED = '[REDACTED ****]';\n\nfunction hasOwnOrPrototypeToJSON(source) {\n if (utils.hasOwnProp(source, 'toJSON')) {\n return true;\n }\n\n let prototype = Object.getPrototypeOf(source);\n\n while (prototype && prototype !== Object.prototype) {\n if (utils.hasOwnProp(prototype, 'toJSON')) {\n return true;\n }\n\n prototype = Object.getPrototypeOf(prototype);\n }\n\n return false;\n}\n\n// Build a plain-object snapshot of `config` and replace the value of any key\n// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays\n// and AxiosHeaders, and short-circuits on circular references.\nfunction redactConfig(config, redactKeys) {\n const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));\n const seen = [];\n\n const visit = (source) => {\n if (source === null || typeof source !== 'object') return source;\n if (utils.isBuffer(source)) return source;\n if (seen.indexOf(source) !== -1) return undefined;\n\n if (source instanceof AxiosHeaders) {\n source = source.toJSON();\n }\n\n seen.push(source);\n\n let result;\n if (utils.isArray(source)) {\n result = [];\n source.forEach((v, i) => {\n const reducedValue = visit(v);\n if (!utils.isUndefined(reducedValue)) {\n result[i] = reducedValue;\n }\n });\n } else {\n if (!utils.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {\n seen.pop();\n return source;\n }\n\n result = Object.create(null);\n for (const [key, value] of Object.entries(source)) {\n const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);\n if (!utils.isUndefined(reducedValue)) {\n result[key] = reducedValue;\n }\n }\n }\n\n seen.pop();\n return result;\n };\n\n return visit(config);\n}\n\nfunction stringifySafely(value) {\n try {\n return String(value);\n } catch (err) {\n return '';\n }\n}\n\nfunction aggregateErrorMessage(error) {\n const message = error.errors\n .map((entry) => {\n try {\n return entry && entry.message ? stringifySafely(entry.message) : stringifySafely(entry);\n } catch (err) {\n return '';\n }\n })\n .filter(Boolean)\n .join('; ');\n\n return message || error.name || 'AggregateError';\n}\n\nclass AxiosError extends Error {\n static from(error, code, config, request, response, customProps) {\n // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection\n // failures) has an empty `message`; its detail lives in `errors[]`. Without\n // this, the wrapped error surfaces with a blank message (see #6721).\n let message = error.message;\n if (!message && utils.isArray(error.errors) && error.errors.length) {\n message = aggregateErrorMessage(error);\n }\n\n const axiosError = new AxiosError(message, code || error.code, config, request, response);\n // Match native `Error` `cause` semantics: non-enumerable. The wrapped\n // error often carries circular internals (sockets, requests, agents), so\n // an enumerable `cause` makes structured loggers (pino/winston) and any\n // own-property walk throw \"Converting circular structure to JSON\".\n // Regression from #6982; see #7205. `__proto__: null` mirrors the\n // `message` descriptor below (prototype-pollution-safe descriptor).\n Object.defineProperty(axiosError, 'cause', {\n __proto__: null,\n value: error,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n axiosError.name = error.name;\n\n // Preserve status from the original error if not already set from response\n if (error.status != null && axiosError.status == null) {\n axiosError.status = error.status;\n }\n\n customProps && Object.assign(axiosError, customProps);\n return axiosError;\n }\n\n /**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\n constructor(message, code, config, request, response) {\n super(message);\n\n // Make message enumerable to maintain backward compatibility\n // The native Error constructor sets message as non-enumerable,\n // but axios < v1.13.3 had it as enumerable\n Object.defineProperty(this, 'message', {\n // Null-proto descriptor so a polluted Object.prototype.get cannot turn\n // this data descriptor into an accessor descriptor on the way in.\n __proto__: null,\n value: message,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n\n this.name = 'AxiosError';\n this.isAxiosError = true;\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n if (response) {\n this.response = response;\n this.status = response.status;\n }\n }\n\n toJSON() {\n // Opt-in redaction: when the request config carries a `redact` array, the\n // value of any matching key (case-insensitive, at any depth) is replaced\n // with REDACTED in the serialized snapshot. Undefined or empty leaves the\n // existing serialization behavior unchanged.\n const config = this.config;\n const redactKeys = config && utils.hasOwnProp(config, 'redact') ? config.redact : undefined;\n const serializedConfig =\n utils.isArray(redactKeys) && redactKeys.length > 0\n ? redactConfig(config, redactKeys)\n : utils.toJSONObject(config);\n\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: serializedConfig,\n code: this.code,\n status: this.status,\n };\n }\n}\n\n// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.\nAxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';\nAxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';\nAxiosError.ECONNABORTED = 'ECONNABORTED';\nAxiosError.ETIMEDOUT = 'ETIMEDOUT';\nAxiosError.ECONNREFUSED = 'ECONNREFUSED';\nAxiosError.ERR_NETWORK = 'ERR_NETWORK';\nAxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';\nAxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';\nAxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';\nAxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';\nAxiosError.ERR_CANCELED = 'ERR_CANCELED';\nAxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';\nAxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';\nAxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\nimport PlatformBuffer from '../platform/node/classes/Buffer.js';\n\n// Default nesting limit shared with the inverse transform (formDataToJSON) so\n// the FormData <-> JSON round-trip stays symmetric.\nexport const DEFAULT_FORM_DATA_MAX_DEPTH = 100;\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path\n .concat(key)\n .map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n })\n .join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array<any>} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object<any, any>} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object<string, any>} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(\n options,\n {\n metaTokens: true,\n dots: false,\n indexes: false,\n },\n false,\n function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n }\n );\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);\n const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n const stack = [];\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (utils.isBoolean(value)) {\n return value.toString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n if (useBlob && typeof _Blob === 'function') {\n return new _Blob([value]);\n }\n if (PlatformBuffer && PlatformBuffer.isBufferAvailable()) {\n return PlatformBuffer.from(value);\n }\n throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT);\n }\n\n return value;\n }\n\n function throwIfMaxDepthExceeded(depth) {\n if (depth > maxDepth) {\n throw new AxiosError(\n 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,\n AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED\n );\n }\n }\n\n function stringifyWithDepthLimit(value, depth) {\n if (maxDepth === Infinity) {\n return JSON.stringify(value);\n }\n\n const ancestors = [];\n\n return JSON.stringify(value, function limitDepth(_key, currentValue) {\n if (!utils.isObject(currentValue)) {\n return currentValue;\n }\n\n while (ancestors.length && ancestors[ancestors.length - 1] !== this) {\n ancestors.pop();\n }\n\n ancestors.push(currentValue);\n throwIfMaxDepthExceeded(depth + ancestors.length - 1);\n\n return currentValue;\n });\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array<String|Number>} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (utils.isReactNative(formData) && utils.isReactNativeBlob(value)) {\n formData.append(renderKey(path, key, dots), convertValue(value));\n return false;\n }\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = stringifyWithDepthLimit(value, 1);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)))\n ) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) &&\n formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true\n ? renderKey([key], index, dots)\n : indexes === null\n ? key\n : key + '[]',\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable,\n });\n\n function build(value, path, depth = 0) {\n if (utils.isUndefined(value)) return;\n\n throwIfMaxDepthExceeded(depth);\n\n if (stack.indexOf(value) !== -1) {\n throw new Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result =\n !(utils.isUndefined(el) || el === null) &&\n visitor.call(formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers);\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key], depth + 1);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object<string, any>} params - The parameters to be converted to a FormData object.\n * @param {Object<string, any>} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder\n ? (value) => encoder.call(this, value, encode)\n : encode;\n\n return this._pairs\n .map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '')\n .join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from './AxiosURLSearchParams.js';\n\n/**\n * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with\n * their plain counterparts (`:`, `$`, `,`, `+`).\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nexport function encode(val) {\n return encodeURIComponent(val)\n .replace(/%3A/gi, ':')\n .replace(/%24/g, '$')\n .replace(/%2C/gi, ',')\n .replace(/%20/g, '+');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?(object|Function)} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n if (!params) {\n return url;\n }\n url = url || '';\n\n const _options = utils.isFunction(options)\n ? {\n serialize: options,\n }\n : options;\n\n // Read serializer options pollution-safely: own properties and methods on a\n // class/template prototype are honored, but values injected onto a polluted\n // Object.prototype are ignored.\n const _encode = utils.getSafeProp(_options, 'encode') || encode;\n const serializeFn = utils.getSafeProp(_options, 'serialize');\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, _options);\n } else {\n serializedParams = utils.isURLSearchParams(params)\n ? params.toString()\n : new AxiosURLSearchParams(params, _options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf('#');\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n * @param {Object} options The options for the interceptor, synchronous and runWhen\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null,\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {void}\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false,\n legacyInterceptorReqResOrdering: true,\n advertiseZstdAcceptEncoding: false,\n validateStatusUndefinedResolves: true,\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict';\n\nexport default typeof Blob !== 'undefined' ? Blob : null;\n","import URLSearchParams from './classes/URLSearchParams.js';\nimport FormData from './classes/FormData.js';\nimport Blob from './classes/Blob.js';\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob,\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\nconst _navigator = (typeof navigator === 'object' && navigator) || undefined;\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv =\n hasBrowserEnv &&\n (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = (hasBrowserEnv && window.location.href) || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n _navigator as navigator,\n origin,\n};\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform,\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), {\n visitor: function (value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n },\n ...options,\n });\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport { DEFAULT_FORM_DATA_MAX_DEPTH } from './toFormData.js';\n\nconst MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;\n\nfunction throwIfDepthExceeded(index) {\n if (index > MAX_DEPTH) {\n throw new AxiosError(\n 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,\n AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED\n );\n }\n}\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z] -> ['foo', 'x', 'y', 'z']\n // foo.x.y.z -> ['foo', 'x', 'y', 'z']\n // A path is split on `.` and on `[...]` groups. A segment — whether written\n // in dot notation or captured inside brackets — may contain any character\n // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept\n // literal instead of being split (#5402). `.`, `[` and `]` keep their existing\n // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.\n // Excluding `[` from the bracket group also makes the match fail fast at the\n // next `[`, so a malformed name cannot rescan to the end of the string from\n // every unmatched `[` — parsing stays linear in the length of the name.\n const path = [];\n const pattern = /[^.[\\]]+|\\[([^.[\\]]*)]/g;\n let match;\n\n while ((match = pattern.exec(name)) !== null) {\n throwIfDepthExceeded(path.length);\n path.push(match[0] === '[]' ? '' : match[1] || match[0]);\n }\n\n return path;\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array<any>} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object<string, any> | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n throwIfDepthExceeded(index);\n\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = utils.isArray(target[name])\n ? target[name].concat(value)\n : [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!utils.hasOwnProp(target, name) || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\nconst own = (obj, key) => (obj != null && utils.hasOwnProp(obj, key) ? obj[key] : undefined);\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [\n function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n const formSerializer = own(this, 'formSerializer');\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, formSerializer).toString();\n }\n\n if (\n (isFileList = utils.isFileList(data)) ||\n contentType.indexOf('multipart/form-data') > -1\n ) {\n const env = own(this, 'env');\n const _FormData = env && env.FormData;\n\n return toFormData(\n isFileList ? { 'files[]': data } : data,\n _FormData && new _FormData(),\n formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n },\n ],\n\n transformResponse: [\n function transformResponse(data) {\n const transitional = own(this, 'transitional') || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const responseType = own(this, 'responseType');\n const JSONRequested = responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (\n data &&\n utils.isString(data) &&\n ((forcedJSONParsing && !responseType) || JSONRequested)\n ) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data, own(this, 'parseReviver'));\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));\n }\n throw e;\n }\n }\n }\n\n return data;\n },\n ],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob,\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n Accept: 'application/json, text/plain, */*',\n 'Content-Type': undefined,\n },\n },\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from '../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\n\nclass CanceledError extends AxiosError {\n /**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\n constructor(message, config, request) {\n super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n this.__CANCEL__ = true;\n }\n}\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25}):(?:\\/\\/)?/.exec(url);\n return (match && match[1]) || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round((bytesCount * 1000) / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n let threshold = 1000 / freq;\n let lastArgs;\n let timer;\n\n const invoke = (args, now = Date.now()) => {\n timestamp = now;\n lastArgs = null;\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n fn(...args);\n };\n\n const throttled = (...args) => {\n const now = Date.now();\n const passed = now - timestamp;\n if (passed >= threshold) {\n invoke(args, now);\n } else {\n lastArgs = args;\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n invoke(lastArgs);\n }, threshold - passed);\n }\n }\n };\n\n const flush = () => lastArgs && invoke(lastArgs);\n\n return [throttled, flush];\n}\n\nexport default throttle;\n","import speedometer from './speedometer.js';\nimport throttle from './throttle.js';\nimport utils from '../utils.js';\n\nexport const progressEventReducer = (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle((e) => {\n if (!e || typeof e.loaded !== 'number') {\n return;\n }\n const rawLoaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);\n const progressBytes = Math.max(0, loaded - bytesNotified);\n const rate = _speedometer(progressBytes);\n\n bytesNotified = Math.max(bytesNotified, loaded);\n\n const data = {\n loaded,\n total,\n progress: total ? loaded / total : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null,\n [isDownloadStream ? 'download' : 'upload']: true,\n };\n\n listener(data);\n }, freq);\n};\n\nexport const progressEventDecorator = (total, throttled) => {\n const lengthComputable = total != null;\n\n return [\n (loaded) =>\n throttled[0]({\n lengthComputable,\n total,\n loaded,\n }),\n throttled[1],\n ];\n};\n\nexport const asyncDecorator =\n (fn, scheduler = utils.asap) =>\n (...args) =>\n scheduler(() => fn(...args));\n","import platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv\n ? ((origin, isMSIE) => (url) => {\n url = new URL(url, platform.origin);\n\n return (\n origin.protocol === url.protocol &&\n origin.host === url.host &&\n (isMSIE || origin.port === url.port)\n );\n })(\n new URL(platform.origin),\n platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)\n )\n : () => true;\n","import utils from '../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv\n ? // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure, sameSite) {\n if (typeof document === 'undefined') return;\n\n const cookie = [`${name}=${encodeURIComponent(value)}`];\n\n if (utils.isNumber(expires)) {\n cookie.push(`expires=${new Date(expires).toUTCString()}`);\n }\n if (utils.isString(path)) {\n cookie.push(`path=${path}`);\n }\n if (utils.isString(domain)) {\n cookie.push(`domain=${domain}`);\n }\n if (secure === true) {\n cookie.push('secure');\n }\n if (utils.isString(sameSite)) {\n cookie.push(`SameSite=${sameSite}`);\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n if (typeof document === 'undefined') return null;\n // Match name=value by splitting on the semicolon separator instead of building a\n // RegExp from `name` — interpolating an unescaped string into a RegExp would let\n // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or\n // match the wrong cookie. Browsers may serialize cookie pairs as either \";\" or\n // \"; \", so ignore optional whitespace before each cookie name.\n const cookies = document.cookie.split(';');\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].replace(/^\\s+/, '');\n const eq = cookie.indexOf('=');\n if (eq !== -1 && cookie.slice(0, eq) === name) {\n try {\n return decodeURIComponent(cookie.slice(eq + 1));\n } catch (e) {\n return cookie.slice(eq + 1);\n }\n }\n }\n return null;\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000, '/');\n },\n }\n : // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {},\n };\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"<scheme>://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n if (typeof url !== 'string') {\n return false;\n }\n\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n if (!relativeURL) {\n return baseURL;\n }\n\n let end = baseURL.length;\n\n while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {\n end--;\n }\n\n return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\\/+/, '');\n}\n","'use strict';\n\nimport AxiosError, { REDACTED } from './AxiosError.js';\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\nconst malformedHttpProtocol = /^https?:(?!\\/\\/)/i;\nconst httpProtocolControlCharacters = /[\\t\\n\\r]/g;\n\nfunction stripLeadingC0ControlOrSpace(url) {\n let i = 0;\n while (i < url.length && url.charCodeAt(i) <= 0x20) {\n i++;\n }\n return url.slice(i);\n}\n\nfunction normalizeURLForProtocolCheck(url) {\n return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');\n}\n\n// Redact the parts of a URL that can carry secrets before it is embedded in an\n// error message. AxiosError.toJSON() serializes `message` verbatim and errors\n// are commonly logged, while the opt-in `config.redact` model only cleans\n// config keys — it cannot reach the message. Redact only the genuinely\n// sensitive substrings — userinfo (credentials), query parameter values and\n// fragment contents — with the same REDACTED marker the config redaction uses,\n// while keeping the scheme, host, path and parameter names so the offending\n// request stays accurately identifiable.\nfunction redactFragment(fragment) {\n if (!fragment) {\n return fragment;\n }\n\n return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {\n return `${separator}${parameterName}${REDACTED}`;\n });\n}\n\nfunction redactSensitiveURLParts(url) {\n const redactedURL = url.replace(/^(https?:\\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);\n const fragmentIndex = redactedURL.indexOf('#');\n const urlWithoutFragment =\n fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);\n const redactedURLWithoutFragment = urlWithoutFragment.replace(\n /([?&][^=&#]*=)[^&#]*/g,\n `$1${REDACTED}`\n );\n\n if (fragmentIndex === -1) {\n return redactedURLWithoutFragment;\n }\n\n return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;\n}\n\nfunction assertValidHttpProtocolURL(url, config) {\n if (typeof url === 'string') {\n const normalizedURL = normalizeURLForProtocolCheck(url);\n if (malformedHttpProtocol.test(normalizedURL)) {\n throw new AxiosError(\n `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing \"//\" after protocol`,\n AxiosError.ERR_INVALID_URL,\n config\n );\n }\n }\n}\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {\n assertValidHttpProtocolURL(requestedURL, config);\n let isRelativeUrl = !isAbsoluteURL(requestedURL);\n if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {\n assertValidHttpProtocolURL(baseURL, config);\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);\n\nconst ownEnumerableKeys = (thing) => {\n if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {\n return Object.keys(thing).concat(\n Object.getOwnPropertySymbols(thing).filter(\n (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable\n )\n );\n }\n return Object.keys(thing);\n};\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config1 = config1 || {};\n config2 = config2 || {};\n\n // Use a null-prototype object so that downstream reads such as `config.auth`\n // or `config.baseURL` cannot inherit polluted values from Object.prototype.\n // `hasOwnProperty` is restored as a non-enumerable own slot to preserve\n // ergonomics for user code that relies on it.\n const config = Object.create(null);\n Object.defineProperty(config, 'hasOwnProperty', {\n // Null-proto descriptor so a polluted Object.prototype.get cannot turn\n // this data descriptor into an accessor descriptor on the way in.\n __proto__: null,\n value: Object.prototype.hasOwnProperty,\n enumerable: false,\n writable: true,\n configurable: true,\n });\n\n function getMergedValue(target, source, prop, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({ caseless }, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(a, b, prop, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, prop, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, prop, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n function getMergedTransitionalOption(prop) {\n const transitional2 = utils.hasOwnProp(config2, 'transitional')\n ? config2.transitional\n : undefined;\n\n if (!utils.isUndefined(transitional2)) {\n if (utils.isPlainObject(transitional2)) {\n if (utils.hasOwnProp(transitional2, prop)) {\n return transitional2[prop];\n }\n } else {\n return undefined;\n }\n }\n\n const transitional1 = utils.hasOwnProp(config1, 'transitional')\n ? config1.transitional\n : undefined;\n\n if (utils.isPlainObject(transitional1) && utils.hasOwnProp(transitional1, prop)) {\n return transitional1[prop];\n }\n\n return undefined;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (utils.hasOwnProp(config2, prop)) {\n return getMergedValue(a, b);\n } else if (utils.hasOwnProp(config1, prop)) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n allowedSocketPaths: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b, prop) =>\n mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),\n };\n\n utils.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {\n if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;\n const merge = utils.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;\n const a = utils.hasOwnProp(config1, prop) ? config1[prop] : undefined;\n const b = utils.hasOwnProp(config2, prop) ? config2[prop] : undefined;\n const configValue = merge(a, b, prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n if (\n utils.hasOwnProp(config2, 'validateStatus') &&\n utils.isUndefined(config2.validateStatus) &&\n getMergedTransitionalOption('validateStatusUndefinedResolves') === false\n ) {\n if (utils.hasOwnProp(config1, 'validateStatus')) {\n config.validateStatus = getMergedValue(undefined, config1.validateStatus);\n } else {\n delete config.validateStatus;\n }\n }\n\n return config;\n}\n","'use strict';\n\nconst FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];\n\n/**\n * Apply the headers generated by a FormData implementation to the request headers,\n * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the\n * content-* headers; otherwise merge all of them.\n *\n * @param {AxiosHeaders} headers - the request headers to mutate\n * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation\n * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value\n *\n * @returns {void}\n */\nexport default function setFormDataHeaders(headers, formHeaders, policy) {\n if (policy !== 'content-only') {\n headers.set(formHeaders);\n return;\n }\n\n Object.entries(formHeaders || {}).forEach(([key, val]) => {\n if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {\n headers.set(key, val);\n }\n });\n}\n","import platform from '../platform/index.js';\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport isURLSameOrigin from './isURLSameOrigin.js';\nimport cookies from './cookies.js';\nimport buildFullPath from '../core/buildFullPath.js';\nimport mergeConfig from '../core/mergeConfig.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport setFormDataHeaders from '../core/setFormDataHeaders.js';\nimport buildURL from './buildURL.js';\n\n/**\n * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().\n * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.\n *\n * @param {string} str The string to encode\n *\n * @returns {string} UTF-8 bytes as a Latin-1 string\n */\nconst encodeUTF8 = (str) =>\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>\n String.fromCharCode(parseInt(hex, 16))\n );\n\nfunction resolveConfig(config) {\n const newConfig = mergeConfig({}, config);\n\n // Read only own properties to prevent prototype pollution gadgets\n // (e.g. Object.prototype.baseURL = 'https://evil.com').\n const own = (key) => (utils.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);\n\n const data = own('data');\n let withXSRFToken = own('withXSRFToken');\n const xsrfHeaderName = own('xsrfHeaderName');\n const xsrfCookieName = own('xsrfCookieName');\n let headers = own('headers');\n const auth = own('auth');\n const baseURL = own('baseURL');\n const allowAbsoluteUrls = own('allowAbsoluteUrls');\n const url = own('url');\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(\n buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),\n own('params'),\n own('paramsSerializer')\n );\n\n // HTTP basic authentication\n if (auth) {\n const username = utils.getSafeProp(auth, 'username') || '';\n const password = utils.getSafeProp(auth, 'password') || '';\n\n try {\n headers.set(\n 'Authorization',\n 'Basic ' + btoa(username + ':' + (password ? encodeUTF8(password) : ''))\n );\n } catch (e) {\n throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);\n }\n }\n\n if (utils.isFormData(data)) {\n if (\n platform.hasStandardBrowserEnv ||\n platform.hasStandardBrowserWebWorkerEnv ||\n utils.isReactNative(data)\n ) {\n headers.setContentType(undefined); // browser/web worker/RN handles it\n } else if (utils.isFunction(data.getHeaders)) {\n // Node.js FormData (like form-data package)\n setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n if (utils.isFunction(withXSRFToken)) {\n withXSRFToken = withXSRFToken(newConfig);\n }\n\n // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)\n // and misconfigurations (e.g. \"false\") from short-circuiting the same-origin check and leaking\n // the XSRF token cross-origin.\n const shouldSendXSRF =\n withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));\n\n if (shouldSendXSRF) {\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\nexport default resolveConfig;\n","import utils from '../utils.js';\nimport settle from '../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport { progressEventReducer } from '../helpers/progressEventReducer.js';\nimport resolveConfig from '../helpers/resolveConfig.js';\nimport { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported &&\n function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let { responseType, onUploadProgress, onDownloadProgress } = _config;\n let onCanceled;\n let uploadThrottled, downloadThrottled;\n let flushUpload, flushDownload;\n\n function done() {\n flushUpload && flushUpload(); // flush events\n flushDownload && flushDownload(); // flush events\n\n _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);\n\n _config.signal && _config.signal.removeEventListener('abort', onCanceled);\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData =\n !responseType || responseType === 'text' || responseType === 'json'\n ? request.responseText\n : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request,\n };\n\n settle(\n function _resolve(value) {\n resolve(value);\n done();\n },\n function _reject(err) {\n reject(err);\n done();\n },\n response\n );\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (\n request.status === 0 &&\n !(request.responseURL && request.responseURL.startsWith('file:'))\n ) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));\n done();\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError(event) {\n // Browsers deliver a ProgressEvent in XHR onerror\n // (message may be empty; when present, surface it)\n // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event\n const msg = event && event.message ? event.message : 'Network Error';\n const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);\n // attach the underlying event for consumers who want details\n err.event = event || null;\n reject(err);\n done();\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout\n ? 'timeout of ' + _config.timeout + 'ms exceeded'\n : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(\n new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n request\n )\n );\n done();\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (onDownloadProgress) {\n [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);\n request.addEventListener('progress', downloadThrottled);\n }\n\n // Not all browsers support upload events\n if (onUploadProgress && request.upload) {\n [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);\n\n request.upload.addEventListener('progress', uploadThrottled);\n\n request.upload.addEventListener('loadend', flushUpload);\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = (cancel) => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n done();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted\n ? onCanceled()\n : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && !platform.protocols.includes(protocol)) {\n reject(\n new AxiosError(\n 'Unsupported protocol ' + protocol + ':',\n AxiosError.ERR_BAD_REQUEST,\n config\n )\n );\n done();\n return;\n }\n\n // Send the request\n request.send(requestData || null);\n });\n };\n","import CanceledError from '../cancel/CanceledError.js';\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\nconst composeSignals = (signals, timeout) => {\n signals = signals ? signals.filter(Boolean) : [];\n\n if (!timeout && !signals.length) {\n return;\n }\n\n const controller = new AbortController();\n\n let aborted = false;\n\n const onabort = function (reason) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = reason instanceof Error ? reason : this.reason;\n controller.abort(\n err instanceof AxiosError\n ? err\n : new CanceledError(err instanceof Error ? err.message : err)\n );\n }\n };\n\n let timer =\n timeout &&\n setTimeout(() => {\n timer = null;\n onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));\n }, timeout);\n\n const unsubscribe = () => {\n if (!signals) { return; }\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach((signal) => {\n signal.unsubscribe\n ? signal.unsubscribe(onabort)\n : signal.removeEventListener('abort', onabort);\n });\n signals = null;\n };\n\n signals.forEach((signal) => {\n if (aborted) {\n return;\n }\n\n if (signal.aborted) {\n onabort.call(signal);\n return;\n }\n\n signal.addEventListener('abort', onabort, { once: true });\n });\n\n const { signal } = controller;\n\n signal.unsubscribe = () => utils.asap(unsubscribe);\n\n return signal;\n};\n\nexport default composeSignals;\n","export const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n};\n\nexport const readBytes = async function* (iterable, chunkSize) {\n for await (const chunk of readStream(iterable)) {\n yield* streamChunk(chunk, chunkSize);\n }\n};\n\nconst readStream = async function* (stream) {\n if (stream[Symbol.asyncIterator]) {\n yield* stream;\n return;\n }\n\n const reader = stream.getReader();\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n yield value;\n }\n } finally {\n await reader.cancel();\n }\n};\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish) => {\n const iterator = readBytes(stream, chunkSize);\n\n let bytes = 0;\n let done;\n let _onFinish = (e) => {\n if (!done) {\n done = true;\n onFinish && onFinish(e);\n }\n };\n\n return new ReadableStream(\n {\n async pull(controller) {\n try {\n const { done, value } = await iterator.next();\n\n if (done) {\n _onFinish();\n controller.close();\n return;\n }\n\n let len = value.byteLength;\n if (onProgress) {\n let loadedBytes = (bytes += len);\n onProgress(loadedBytes);\n }\n controller.enqueue(new Uint8Array(value));\n } catch (err) {\n _onFinish(err);\n throw err;\n }\n },\n cancel(reason) {\n _onFinish(reason);\n return iterator.return();\n },\n },\n {\n highWaterMark: 2,\n }\n );\n};\n","/**\n * Estimate data: URL byte lengths *without* allocating large buffers.\n * - Fetch percent-decodes a base64 body before decoding it.\n * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the\n * raw body, including ignored characters and content after padding.\n * - Non-base64 data is percent-decoded and then encoded as UTF-8.\n */\nconst isHexDigit = (charCode) =>\n (charCode >= 48 && charCode <= 57) ||\n (charCode >= 65 && charCode <= 70) ||\n (charCode >= 97 && charCode <= 102);\n\nconst isPercentEncodedByte = (str, i, len) =>\n i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));\n\nconst hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);\n\nconst isBase64Char = (charCode) =>\n (charCode >= 65 && charCode <= 90) || // A-Z\n (charCode >= 97 && charCode <= 122) || // a-z\n (charCode >= 48 && charCode <= 57) || // 0-9\n charCode === 43 || // +\n charCode === 47 || // /\n charCode === 45 || // - (base64url)\n charCode === 95; // _ (base64url)\n\nconst isBase64Whitespace = (charCode) =>\n charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;\n\nconst base64Bytes = (significant) => {\n const groups = Math.floor(significant / 4);\n const remainder = significant % 4;\n return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);\n};\n\n// Buffer.byteLength(body, 'base64') uses the raw string length as an allocation\n// upper bound even when Buffer.from later ignores characters or stops at '='.\nconst estimateBase64BufferAllocation = (body) => {\n const len = body.length;\n let padding = 0;\n\n if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {\n padding++;\n\n if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {\n padding++;\n }\n }\n\n return Math.floor(((len - padding) * 3) / 4);\n};\n\nconst estimatePercentDecodedBase64Bytes = (body) => {\n const len = body.length;\n let significant = 0;\n let padding = 0;\n let invalid = false;\n\n for (let i = 0; i < len; i++) {\n let code = body.charCodeAt(i);\n\n if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {\n code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));\n i += 2;\n }\n\n if (isBase64Whitespace(code)) {\n continue;\n }\n\n if (code === 61 /* '=' */) {\n padding++;\n continue;\n }\n\n if (!isBase64Char(code) || padding > 0) {\n invalid = true;\n continue;\n }\n\n significant++;\n }\n\n // Fetch rejects malformed forgiving-base64 input. Returning the raw-size\n // allocation bound keeps that invalid input from becoming a pre-check bypass.\n if (\n invalid ||\n padding > 2 ||\n (padding > 0 && (significant + padding) % 4 !== 0) ||\n significant % 4 === 1\n ) {\n return estimateBase64BufferAllocation(body);\n }\n\n return base64Bytes(significant);\n};\n\nconst estimateDataURLBytes = (url, estimateBase64) => {\n if (!url || typeof url !== 'string') return 0;\n if (!url.startsWith('data:')) return 0;\n\n const comma = url.indexOf(',');\n if (comma < 0) return 0;\n\n const meta = url.slice(5, comma);\n const body = url.slice(comma + 1);\n const isBase64 = /;base64/i.test(meta);\n\n if (isBase64) {\n return estimateBase64(body);\n }\n\n // Compute UTF-8 byte length directly from UTF-16 code units without allocating\n // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).\n // Valid %XX triplets count as one decoded byte; this matches the bytes that\n // decodeURIComponent(body) would produce before Buffer re-encodes the string.\n let bytes = 0;\n for (let i = 0, len = body.length; i < len; i++) {\n const c = body.charCodeAt(i);\n if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {\n bytes += 1;\n i += 2;\n } else if (c < 0x80) {\n bytes += 1;\n } else if (c < 0x800) {\n bytes += 2;\n } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {\n const next = body.charCodeAt(i + 1);\n if (next >= 0xdc00 && next <= 0xdfff) {\n bytes += 4;\n i++;\n } else {\n bytes += 3;\n }\n } else {\n bytes += 3;\n }\n }\n return bytes;\n};\n\n/**\n * Estimate the percent-decoded payload size used by Fetch data: URLs.\n *\n * @param {string} url\n * @returns {number}\n */\nexport default function estimateDataURLDecodedBytes(url) {\n // Fetch removes URL fragments before processing a data: URL.\n const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;\n\n return estimateDataURLBytes(\n fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),\n estimatePercentDecodedBase64Bytes\n );\n}\n\n/**\n * Estimate the Buffer backing allocation used by Node's raw base64 decoder.\n *\n * @param {string} url\n * @returns {number}\n */\nexport function estimateDataURLBufferAllocation(url) {\n return estimateDataURLBytes(url, estimateBase64BufferAllocation);\n}\n","export const VERSION = \"1.19.0\";","import platform from '../platform/index.js';\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport composeSignals from '../helpers/composeSignals.js';\nimport { trackStream } from '../helpers/trackStream.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport {\n progressEventReducer,\n progressEventDecorator,\n asyncDecorator,\n} from '../helpers/progressEventReducer.js';\nimport resolveConfig from '../helpers/resolveConfig.js';\nimport settle from '../core/settle.js';\nimport estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';\nimport { VERSION } from '../env/data.js';\nimport { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst { isFunction } = utils;\n\n/**\n * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().\n * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.\n *\n * @param {string} str The string to encode\n *\n * @returns {string} UTF-8 bytes as a Latin-1 string\n */\nconst encodeUTF8 = (str) =>\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>\n String.fromCharCode(parseInt(hex, 16))\n );\n\n// Node's WHATWG URL parser returns `username` and `password` percent-encoded.\n// Decode before composing the `auth` option so credentials such as\n// `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the\n// original value for malformed input so a bad encoding never throws.\nconst decodeURIComponentSafe = (value) => {\n if (!utils.isString(value)) {\n return value;\n }\n\n try {\n return decodeURIComponent(value);\n } catch (error) {\n return value;\n }\n};\n\nconst test = (fn, ...args) => {\n try {\n return !!fn(...args);\n } catch (e) {\n return false;\n }\n};\n\nconst maybeWithAuthCredentials = (url) => {\n const protocolIndex = url.indexOf('://');\n let urlToCheck = url;\n if (protocolIndex !== -1) {\n urlToCheck = urlToCheck.slice(protocolIndex + 3);\n }\n return urlToCheck.includes('@') || urlToCheck.includes(':');\n};\n\nconst factory = (env) => {\n const globalObject =\n utils.global !== undefined && utils.global !== null\n ? utils.global\n : globalThis;\n const { ReadableStream, TextEncoder } = globalObject;\n\n env = utils.merge.call(\n {\n skipUndefined: true,\n },\n {\n Request: globalObject.Request,\n Response: globalObject.Response,\n },\n env\n );\n\n const { fetch: envFetch, Request, Response } = env;\n const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';\n const isRequestSupported = isFunction(Request);\n const isResponseSupported = isFunction(Response);\n\n if (!isFetchSupported) {\n return false;\n }\n\n const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);\n\n const encodeText =\n isFetchSupported &&\n (typeof TextEncoder === 'function'\n ? (\n (encoder) => (str) =>\n encoder.encode(str)\n )(new TextEncoder())\n : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));\n\n const supportsRequestStream =\n isRequestSupported &&\n isReadableStreamSupported &&\n test(() => {\n let duplexAccessed = false;\n\n const request = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n });\n\n const hasContentType = request.headers.has('Content-Type');\n\n if (request.body != null) {\n request.body.cancel();\n }\n\n return duplexAccessed && !hasContentType;\n });\n\n const supportsResponseStream =\n isResponseSupported &&\n isReadableStreamSupported &&\n test(() => utils.isReadableStream(new Response('').body));\n\n const resolvers = {\n stream: supportsResponseStream && ((res) => res.body),\n };\n\n isFetchSupported &&\n (() => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {\n !resolvers[type] &&\n (resolvers[type] = (res, config) => {\n let method = res && res[type];\n\n if (method) {\n return method.call(res);\n }\n\n throw new AxiosError(\n `Response type '${type}' is not supported`,\n AxiosError.ERR_NOT_SUPPORT,\n config\n );\n });\n });\n })();\n\n const getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if (utils.isBlob(body)) {\n return body.size;\n }\n\n if (utils.isSpecCompliantForm(body)) {\n const _request = new Request(platform.origin, {\n method: 'POST',\n body,\n });\n return (await _request.arrayBuffer()).byteLength;\n }\n\n if (utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {\n return body.byteLength;\n }\n\n if (utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if (utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n };\n\n const resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n };\n\n return async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions,\n maxContentLength,\n maxBodyLength,\n } = resolveConfig(config);\n\n const hasMaxContentLength = utils.isNumber(maxContentLength) && maxContentLength > -1;\n const hasMaxBodyLength = utils.isNumber(maxBodyLength) && maxBodyLength > -1;\n const own = (key) => (utils.hasOwnProp(config, key) ? config[key] : undefined);\n\n let _fetch = envFetch || fetch;\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let composedSignal = composeSignals(\n [signal, cancelToken && cancelToken.toAbortSignal()],\n timeout\n );\n\n let request = null;\n\n const unsubscribe =\n composedSignal &&\n composedSignal.unsubscribe &&\n (() => {\n composedSignal.unsubscribe();\n });\n\n let requestContentLength;\n\n // AxiosError we raise while the request body is being streamed. Captured\n // by identity so the catch block can surface it directly, regardless of\n // how the runtime wraps the resulting fetch rejection (undici exposes it\n // as `err.cause`; some browsers drop the original error entirely).\n let pendingBodyError = null;\n\n const maxBodyLengthError = () =>\n new AxiosError(\n 'Request body larger than maxBodyLength limit',\n AxiosError.ERR_BAD_REQUEST,\n config,\n request\n );\n\n try {\n // HTTP basic authentication\n let auth = undefined;\n const configAuth = own('auth');\n\n if (configAuth) {\n const username = utils.getSafeProp(configAuth, 'username') || '';\n const password = utils.getSafeProp(configAuth, 'password') || '';\n auth = {\n username,\n password\n };\n }\n\n if (maybeWithAuthCredentials(url)) {\n const parsedURL = new URL(url, platform.origin);\n\n if (!auth && (parsedURL.username || parsedURL.password)) {\n const urlUsername = decodeURIComponentSafe(parsedURL.username);\n const urlPassword = decodeURIComponentSafe(parsedURL.password);\n auth = {\n username: urlUsername,\n password: urlPassword\n };\n }\n\n if (parsedURL.username || parsedURL.password) {\n parsedURL.username = '';\n parsedURL.password = '';\n url = parsedURL.href;\n }\n }\n\n if (auth) {\n headers.delete('authorization');\n headers.set(\n 'Authorization',\n 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))\n );\n }\n\n // Enforce maxContentLength for data: URLs up-front so we never materialize\n // an oversized payload. The HTTP adapter applies the same check (see http.js\n // \"if (protocol === 'data:')\" branch).\n if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {\n const estimated = estimateDataURLDecodedBytes(url);\n if (estimated > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n // Enforce maxBodyLength against known-size bodies before dispatch using\n // the body's *actual* size — never a caller-declared Content-Length,\n // which could under-report to slip an oversized body past the check.\n // Unknown-size streams return undefined here and are counted per-chunk\n // below as fetch consumes them.\n if (hasMaxBodyLength && method !== 'get' && method !== 'head') {\n const outboundLength = await getBodyLength(data);\n if (typeof outboundLength === 'number' && isFinite(outboundLength)) {\n requestContentLength = outboundLength;\n if (outboundLength > maxBodyLength) {\n throw maxBodyLengthError();\n }\n }\n }\n\n // A streamed body under maxBodyLength must be counted as fetch consumes\n // it; its size is never trusted from a caller-declared Content-Length.\n const mustEnforceStreamBody =\n hasMaxBodyLength && (utils.isReadableStream(data) || utils.isStream(data));\n\n const trackRequestStream = (stream, onProgress, flush) =>\n trackStream(\n stream,\n DEFAULT_CHUNK_SIZE,\n (loadedBytes) => {\n if (hasMaxBodyLength && loadedBytes > maxBodyLength) {\n throw (pendingBodyError = maxBodyLengthError());\n }\n onProgress && onProgress(loadedBytes);\n },\n flush\n );\n\n if (\n supportsRequestStream &&\n method !== 'get' &&\n method !== 'head' &&\n (onUploadProgress || mustEnforceStreamBody)\n ) {\n requestContentLength =\n requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;\n\n // A declared length of 0 is only trusted to skip the wrap when we are\n // not enforcing a stream limit (which must not rely on that header).\n if (requestContentLength !== 0 || mustEnforceStreamBody) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: 'half',\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader);\n }\n\n if (_request.body) {\n const [onProgress, flush] =\n (onUploadProgress &&\n progressEventDecorator(\n requestContentLength,\n progressEventReducer(asyncDecorator(onUploadProgress))\n )) ||\n [];\n\n data = trackRequestStream(_request.body, onProgress, flush);\n }\n }\n } else if (\n mustEnforceStreamBody &&\n !isRequestSupported &&\n isReadableStreamSupported &&\n method !== 'get' &&\n method !== 'head'\n ) {\n data = trackRequestStream(data);\n } else if (\n mustEnforceStreamBody &&\n isRequestSupported &&\n !supportsRequestStream &&\n method !== 'get' &&\n method !== 'head'\n ) {\n throw new AxiosError(\n 'Stream request bodies are not supported by the current fetch implementation',\n AxiosError.ERR_NOT_SUPPORT,\n config,\n request\n );\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'include' : 'omit';\n }\n\n // Cloudflare Workers throws when credentials are defined\n // see https://github.com/cloudflare/workerd/issues/902\n const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;\n\n // If data is FormData and Content-Type is multipart/form-data without boundary,\n // delete it so fetch can set it correctly with the boundary\n if (utils.isFormData(data)) {\n const contentType = headers.getContentType();\n if (\n contentType &&\n /^multipart\\/form-data/i.test(contentType) &&\n !/boundary=/i.test(contentType)\n ) {\n headers.delete('content-type');\n }\n }\n\n // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)\n headers.set('User-Agent', 'axios/' + VERSION, false);\n\n const resolvedOptions = {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: toByteStringHeaderObject(headers.normalize()),\n body: data,\n duplex: 'half',\n credentials: isCredentialsSupported ? withCredentials : undefined,\n };\n\n request = isRequestSupported && new Request(url, resolvedOptions);\n\n let response = await (isRequestSupported\n ? _fetch(request, fetchOptions)\n : _fetch(url, resolvedOptions));\n\n const responseHeaders = AxiosHeaders.from(response.headers);\n\n // Cheap pre-check: if the server honestly declares a content-length that\n // already exceeds the cap, reject before we start streaming.\n if (hasMaxContentLength) {\n const declaredLength = utils.toFiniteNumber(responseHeaders.getContentLength());\n if (declaredLength != null && declaredLength > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n const isStreamResponse =\n supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (\n supportsResponseStream &&\n response.body &&\n (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))\n ) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach((prop) => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(responseHeaders.getContentLength());\n\n const [onProgress, flush] =\n (onDownloadProgress &&\n progressEventDecorator(\n responseContentLength,\n progressEventReducer(asyncDecorator(onDownloadProgress), true)\n )) ||\n [];\n\n let bytesRead = 0;\n const onChunkProgress = (loadedBytes) => {\n if (hasMaxContentLength) {\n bytesRead = loadedBytes;\n if (bytesRead > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n onProgress && onProgress(loadedBytes);\n };\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {\n flush && flush();\n unsubscribe && unsubscribe();\n }),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](\n response,\n config\n );\n\n // Fallback enforcement for environments without ReadableStream support\n // (legacy runtimes). Detect materialized size from typed output; skip\n // streams/Response passthrough since the user will read those themselves.\n if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {\n let materializedSize;\n if (responseData != null) {\n if (typeof responseData.byteLength === 'number') {\n materializedSize = responseData.byteLength;\n } else if (typeof responseData.size === 'number') {\n materializedSize = responseData.size;\n } else if (typeof responseData === 'string') {\n materializedSize =\n typeof TextEncoder === 'function'\n ? new TextEncoder().encode(responseData).byteLength\n : responseData.length;\n }\n }\n if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {\n throw new AxiosError(\n 'maxContentLength size of ' + maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n request\n );\n }\n }\n\n !isStreamResponse && unsubscribe && unsubscribe();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request,\n });\n });\n } catch (err) {\n unsubscribe && unsubscribe();\n\n // Safari can surface fetch aborts as a DOMException-like object whose\n // branded getters throw. Prefer our composed signal reason before reading\n // the caught error, preserving timeout vs cancellation semantics.\n if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {\n const canceledError = composedSignal.reason;\n canceledError.config = config;\n request && (canceledError.request = request);\n if (err !== canceledError) {\n // Non-enumerable to match native Error `cause` semantics so loggers\n // don't recurse into circular fetch internals (see #7205).\n Object.defineProperty(canceledError, 'cause', {\n __proto__: null,\n value: err,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n }\n throw canceledError;\n }\n\n // Surface a maxBodyLength violation we raised while the request body was\n // being streamed. Matching by identity (rather than reading\n // `err.cause.isAxiosError`) keeps the error deterministic across runtimes\n // and avoids both prototype-pollution reads and mis-attributing a foreign\n // AxiosError that merely happened to land in `err.cause`.\n if (pendingBodyError) {\n request && !pendingBodyError.request && (pendingBodyError.request = request);\n throw pendingBodyError;\n }\n\n // Re-throw AxiosErrors we raised synchronously (data: URL / content-length\n // pre-checks, response size enforcement) without re-wrapping them.\n if (err instanceof AxiosError) {\n request && !err.request && (err.request = request);\n throw err;\n }\n\n if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {\n const networkError = new AxiosError(\n 'Network Error',\n AxiosError.ERR_NETWORK,\n config,\n request,\n err && err.response\n );\n // Non-enumerable to match native Error `cause` semantics so loggers\n // don't recurse into circular fetch internals (see #7205).\n Object.defineProperty(networkError, 'cause', {\n __proto__: null,\n value: err.cause || err,\n writable: true,\n enumerable: false,\n configurable: true,\n });\n throw networkError;\n }\n\n throw AxiosError.from(err, err && err.code, config, request, err && err.response);\n }\n };\n};\n\nconst seedCache = new Map();\n\nexport const getFetch = (config) => {\n let env = (config && config.env) || {};\n const { fetch, Request, Response } = env;\n const seeds = [Request, Response, fetch];\n\n let len = seeds.length,\n i = len,\n seed,\n target,\n map = seedCache;\n\n while (i--) {\n seed = seeds[i];\n target = map.get(seed);\n\n target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));\n\n map = target;\n }\n\n return target;\n};\n\nconst adapter = getFetch();\n\nexport default adapter;\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport * as fetchAdapter from './fetch.js';\nimport AxiosError from '../core/AxiosError.js';\n\n/**\n * Known adapters mapping.\n * Provides environment-specific adapters for Axios:\n * - `http` for Node.js\n * - `xhr` for browsers\n * - `fetch` for fetch API-based requests\n *\n * @type {Object<string, Function|Object>}\n */\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: {\n get: fetchAdapter.getFetch,\n },\n};\n\n// Assign adapter names for easier debugging and identification\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n // Null-proto descriptors so a polluted Object.prototype.get cannot turn\n // these data descriptors into accessor descriptors on the way in.\n Object.defineProperty(fn, 'name', { __proto__: null, value });\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', { __proto__: null, value });\n }\n});\n\n/**\n * Render a rejection reason string for unknown or unsupported adapters\n *\n * @param {string} reason\n * @returns {string}\n */\nconst renderReason = (reason) => `- ${reason}`;\n\n/**\n * Check if the adapter is resolved (function, null, or false)\n *\n * @param {Function|null|false} adapter\n * @returns {boolean}\n */\nconst isResolvedHandle = (adapter) =>\n utils.isFunction(adapter) || adapter === null || adapter === false;\n\n/**\n * Get the first suitable adapter from the provided list.\n * Tries each adapter in order until a supported one is found.\n * Throws an AxiosError if no adapter is suitable.\n *\n * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.\n * @param {Object} config - Axios request configuration\n * @throws {AxiosError} If no suitable adapter is available\n * @returns {Function} The resolved adapter function\n */\nfunction getAdapter(adapters, config) {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const { length } = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter && (utils.isFunction(adapter) || (adapter = adapter.get(config)))) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n const reasons = Object.entries(rejectedReasons).map(\n ([id, state]) =>\n `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length\n ? reasons.length > 1\n ? 'since :\\n' + reasons.map(renderReason).join('\\n')\n : ' ' + renderReason(reasons[0])\n : 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n AxiosError.ERR_NOT_SUPPORT\n );\n }\n\n return adapter;\n}\n\n/**\n * Exports Axios adapters and utility to resolve an adapter\n */\nexport default {\n /**\n * Resolve an adapter from a list of adapter names or functions.\n * @type {Function}\n */\n getAdapter,\n\n /**\n * Exposes all known adapters\n * @type {Object<string, Function|Object>}\n */\n adapters: knownAdapters,\n};\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from '../adapters/adapters.js';\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(config, config.transformRequest);\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);\n\n return adapter(config).then(\n function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Expose the current response on config so that transformResponse can\n // attach it to any AxiosError it throws (e.g. on JSON parse failure).\n // We clean it up afterwards to avoid polluting the config object.\n config.response = response;\n try {\n response.data = transformData.call(config, config.transformResponse, response);\n } finally {\n delete config.response;\n }\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n },\n function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n config.response = reason.response;\n try {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n } finally {\n delete config.response;\n }\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n }\n );\n}\n","'use strict';\n\nimport { VERSION } from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return (\n '[Axios v' +\n VERSION +\n \"] Transitional option '\" +\n opt +\n \"'\" +\n desc +\n (message ? '. ' + message : '')\n );\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\nvalidators.spelling = function spelling(correctSpelling) {\n return (value, opt) => {\n // eslint-disable-next-line no-console\n console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);\n return true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object' || options === null) {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply\n // a non-function validator and cause a TypeError.\n const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError(\n 'option ' + opt + ' must be ' + result,\n AxiosError.ERR_BAD_OPTION_VALUE\n );\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators,\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\nimport transitionalDefaults from '../defaults/transitional.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig || {};\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager(),\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy = {};\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = (() => {\n if (!dummy.stack) {\n return '';\n }\n\n const firstNewlineIndex = dummy.stack.indexOf('\\n');\n\n return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);\n })();\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack) {\n const firstNewlineIndex = stack.indexOf('\\n');\n const secondNewlineIndex =\n firstNewlineIndex === -1 ? -1 : stack.indexOf('\\n', firstNewlineIndex + 1);\n const stackWithoutTwoTopLines =\n secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);\n\n if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {\n err.stack += '\\n' + stack;\n }\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const { transitional, paramsSerializer, headers } = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(\n transitional,\n {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean),\n legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),\n advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),\n validateStatusUndefinedResolves: validators.transitional(validators.boolean),\n },\n false\n );\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer,\n };\n } else {\n validator.assertOptions(\n paramsSerializer,\n {\n encode: validators.function,\n serialize: validators.function,\n },\n true\n );\n }\n }\n\n // Set config.allowAbsoluteUrls\n if (config.allowAbsoluteUrls !== undefined) {\n // do nothing\n } else if (this.defaults.allowAbsoluteUrls !== undefined) {\n config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;\n } else {\n config.allowAbsoluteUrls = true;\n }\n\n validator.assertOptions(\n config,\n {\n baseUrl: validators.spelling('baseURL'),\n withXsrfToken: validators.spelling('withXSRFToken'),\n },\n true\n );\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(headers.common, headers[config.method]);\n\n headers &&\n utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {\n delete headers[method];\n });\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n const transitional = config.transitional || transitionalDefaults;\n const legacyInterceptorReqResOrdering =\n transitional && transitional.legacyInterceptorReqResOrdering;\n\n if (legacyInterceptorReqResOrdering) {\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n } else {\n requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n }\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift(...requestInterceptorChain);\n chain.push(...responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;\n } catch (error) {\n if (!onRejected) {\n promise = Promise.reject(error);\n break;\n }\n\n try {\n const rejectedResult = onRejected.call(this, error);\n\n if (utils.isThenable(rejectedResult)) {\n promise = Promise.resolve(rejectedResult).then(() =>\n dispatchRequest.call(this, newConfig)\n );\n }\n } catch (rejectedError) {\n promise = Promise.reject(rejectedError);\n }\n\n break;\n }\n }\n\n if (!promise) {\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n promise = Promise.reject(error);\n }\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function (url, config) {\n return this.request(\n mergeConfig(config || {}, {\n method,\n url,\n data: config && utils.hasOwnProp(config, 'data') ? config.data : undefined,\n })\n );\n };\n});\n\nutils.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(\n mergeConfig(config || {}, {\n method,\n headers: isForm\n ? {\n 'Content-Type': 'multipart/form-data',\n }\n : {},\n url,\n data,\n })\n );\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n // QUERY is a safe/idempotent read method; multipart form bodies don't fit\n // its semantics, so no queryForm shorthand is generated.\n if (method !== 'query') {\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n }\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then((cancel) => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = (onfulfilled) => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise((resolve) => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n toAbortSignal() {\n const controller = new AbortController();\n\n const abort = (err) => {\n controller.abort(err);\n };\n\n this.subscribe(abort);\n\n controller.signal.unsubscribe = () => this.unsubscribe(abort);\n\n return controller.signal;\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel,\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * const args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && payload.isAxiosError === true;\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n WebServerReturnsAnUnknownError: 520,\n WebServerIsDown: 521,\n ConnectionTimedOut: 522,\n OriginIsUnreachable: 523,\n TimeoutOccurred: 524,\n SslHandshakeFailed: 525,\n InvalidSslCertificate: 526,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport { VERSION } from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from './core/AxiosHeaders.js';\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, { allOwnKeys: true });\n\n // Copy context to instance\n utils.extend(instance, context, null, { allOwnKeys: true });\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios;\n","import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig,\n create,\n} = axios;\n\nexport {\n axios as default,\n create,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig,\n};\n","/*! js-cookie v3.0.8 | MIT */\nfunction assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (key === '__proto__') continue\n target[key] = source[key];\n }\n }\n return target\n}\n\nvar defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n};\n\nfunction init(converter, defaultAttributes) {\n function set(name, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n name = encodeURIComponent(name)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n name + '=' + converter.write(value, name) + stringifiedAttributes)\n }\n\n function get(name) {\n if (typeof document === 'undefined' || (arguments.length && !name)) {\n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var found = decodeURIComponent(parts[0]);\n if (!(found in jar)) jar[found] = converter.read(value, found);\n if (name === found) {\n break\n }\n } catch (_e) {\n // Do nothing...\n }\n }\n\n return name ? jar[name] : jar\n }\n\n return Object.create(\n {\n set: set,\n get: get,\n remove: function (name, attributes) {\n set(\n name,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n}\n\nvar api = init(defaultConverter, { path: '/' });\n\nexport { api as default };\n","import axios from 'axios';\nimport Cookies from 'js-cookie';\n\nlet BASE_URL_VALUE = 'https://api-grievance.airaops.com';\nlet AUTH_TOKEN_VALUE = null;\n\ntry {\n if (typeof import.meta !== 'undefined' && import.meta.env?.VITE_API_URL) {\n BASE_URL_VALUE = import.meta.env.VITE_API_URL;\n } else {\n // eslint-disable-next-line no-undef\n const nodeProcess = typeof process !== 'undefined' ? process : null;\n if (nodeProcess?.env?.VITE_API_URL) {\n BASE_URL_VALUE = nodeProcess.env.VITE_API_URL;\n }\n }\n} catch {\n // Ignore env resolution errors in non-Vite hosts\n}\n\n/** Runtime override for API host; updates the shared axios instance baseURL. */\nexport const setBaseUrl = (url) => {\n BASE_URL_VALUE = url || '';\n instance.defaults.baseURL = BASE_URL_VALUE;\n};\n\nexport const setAuthToken = (token) => {\n // Keep the host-provided token in memory. Writing it to a shared `token`\n // cookie can overwrite the parent application's session and is unreliable\n // on non-HTTPS development hosts.\n AUTH_TOKEN_VALUE = token || null;\n};\n\nconst getAccessToken = () => AUTH_TOKEN_VALUE || Cookies.get('token') || null;\n\nconst instance = axios.create({\n baseURL: BASE_URL_VALUE,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n});\n\n// Resolve auth immediately before every request so token changes made by the\n// parent are picked up without recreating the client or waiting for an effect.\ninstance.interceptors.request.use((config) => {\n const accessToken = getAccessToken();\n config.headers = config.headers || {};\n\n if (accessToken) {\n config.headers.Authorization = `Bearer ${accessToken}`;\n } else {\n delete config.headers.Authorization;\n }\n\n return config;\n});\n\nlet isRefreshing = false;\nlet refreshTokenPromise = null;\n\ninstance.interceptors.response.use(\n (response) => response,\n async (error) => {\n const originalRequest = error.config;\n const response = error.response;\n\n if (response && (response.status === 401 || response.status === 402)) {\n const refreshToken = Cookies.get('refreshToken');\n\n if (refreshToken) {\n try {\n if (!isRefreshing) {\n isRefreshing = true;\n refreshTokenPromise = axios.post(\n `${BASE_URL_VALUE}/api/v1/auth/refresh`,\n {},\n {\n headers: {\n Authorization: `Bearer ${refreshToken}`,\n },\n },\n );\n }\n\n const refreshResponse = await refreshTokenPromise;\n const { token: newToken, refreshToken: newRefreshToken } =\n refreshResponse.data;\n\n setAuthToken(newToken);\n if (newRefreshToken) {\n Cookies.set('refreshToken', newRefreshToken);\n }\n\n originalRequest.headers.Authorization = `Bearer ${newToken}`;\n return instance(originalRequest);\n } catch {\n Cookies.remove('token');\n Cookies.remove('refreshToken');\n } finally {\n isRefreshing = false;\n refreshTokenPromise = null;\n }\n }\n }\n\n return Promise.reject(error);\n },\n);\n\n/** Shared axios client used by package pages/hooks. Parent sets base URL + token via ApiProvider. */\nexport default instance;\n","import React, { createContext } from 'react';\nimport { setBaseUrl, setAuthToken } from '../utils/api';\n\nconst ApiContext = createContext(null);\n\n/**\n * Provides runtime API base URL + auth token from the parent app.\n * All package requests go through `utils/api` (axios) so the parent owns auth.\n */\nexport const ApiProvider = ({ children, apiUrl, authToken }) => {\n // Configure before descendants render. A child may request data from a\n // layout/effect hook on its first mount, before a parent useEffect runs.\n if (apiUrl) setBaseUrl(apiUrl);\n setAuthToken(authToken || null);\n\n return (\n <ApiContext.Provider value={{ apiUrl, authToken }}>\n {children}\n </ApiContext.Provider>\n );\n};\n\nexport default ApiContext;\n","/**\n * Default light theme tokens.\n * Parent apps can import, extend, or replace via the `theme` prop.\n */\nexport const lightTheme = {\n mode: 'light',\n colors: {\n primary: '#2D64B8',\n primaryHover: '#2557A3',\n text: '#111827',\n textSecondary: '#6B7280',\n textMuted: '#9CA3AF',\n border: '#E5E7EB',\n borderLight: '#F3F4F6',\n background: '#F5F5F5',\n surface: '#FFFFFF',\n white: '#FFFFFF',\n onPrimary: '#FFFFFF',\n activeBg: '#ECFDF5',\n activeBorder: '#A7F3D0',\n activeText: '#059669',\n inactiveBg: '#F3F4F6',\n inactiveBorder: '#D1D5DB',\n inactiveText: '#6B7280',\n link: '#2D64B8',\n divider: '#E5E7EB',\n accentBorder: '#C5D7F0',\n accentBg: '#EEF4FB',\n stepDone: '#D6E4F7',\n success: '#22C55E',\n danger: '#EF4444',\n secondaryBtn: '#D1D5DB',\n secondaryBtnHover: '#C4C9D1',\n inputBg: '#FFFFFF',\n tableHeadBg: '#EEF4FB',\n sidebarBg: '#FAFBFD',\n overlay: 'rgba(16, 24, 40, 0.06)',\n },\n radii: {\n sm: '6px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n pill: '999px',\n },\n spacing: {\n xs: '4px',\n sm: '8px',\n md: '12px',\n lg: '16px',\n xl: '24px',\n xxl: '32px',\n },\n typography: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n h1Size: '28px',\n h2Size: '16px',\n bodySize: '14px',\n labelSize: '13px',\n valueSize: '22px',\n smallSize: '13px',\n },\n shadow: {\n card: '0 1px 2px rgba(16, 24, 40, 0.04)',\n settings: '0 1px 3px rgba(16, 24, 40, 0.06)',\n },\n};\n\n/**\n * Default dark theme tokens.\n */\nexport const darkTheme = {\n mode: 'dark',\n colors: {\n primary: '#5B8DEF',\n primaryHover: '#7BA3F3',\n text: '#F3F4F6',\n textSecondary: '#A1A1AA',\n textMuted: '#71717A',\n border: '#3F3F46',\n borderLight: '#27272A',\n background: '#0F1115',\n surface: '#18181B',\n white: '#FFFFFF',\n onPrimary: '#FFFFFF',\n activeBg: '#052E1C',\n activeBorder: '#166534',\n activeText: '#4ADE80',\n inactiveBg: '#27272A',\n inactiveBorder: '#3F3F46',\n inactiveText: '#A1A1AA',\n link: '#7BA3F3',\n divider: '#3F3F46',\n accentBorder: '#2A3A55',\n accentBg: '#1A2333',\n stepDone: '#1E3A5F',\n success: '#22C55E',\n danger: '#F87171',\n secondaryBtn: '#3F3F46',\n secondaryBtnHover: '#52525B',\n inputBg: '#18181B',\n tableHeadBg: '#1A2333',\n sidebarBg: '#12141A',\n overlay: 'rgba(0, 0, 0, 0.35)',\n },\n radii: {\n sm: '6px',\n md: '8px',\n lg: '12px',\n xl: '16px',\n pill: '999px',\n },\n spacing: {\n xs: '4px',\n sm: '8px',\n md: '12px',\n lg: '16px',\n xl: '24px',\n xxl: '32px',\n },\n typography: {\n fontFamily:\n '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n h1Size: '28px',\n h2Size: '16px',\n bodySize: '14px',\n labelSize: '13px',\n valueSize: '22px',\n smallSize: '13px',\n },\n shadow: {\n card: '0 1px 2px rgba(0, 0, 0, 0.35)',\n settings: '0 1px 3px rgba(0, 0, 0, 0.4)',\n },\n};\n\n/** Bundled theme file shape parents can mirror / extend. */\nexport const defaultThemeFile = {\n light: lightTheme,\n dark: darkTheme,\n};\n","import { lightTheme, darkTheme } from './defaultTheme';\n\nfunction isObject(value) {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/** Deep-merge plain objects (arrays / primitives replaced). */\nexport function deepMerge(base, override) {\n if (!isObject(override)) return base;\n const result = { ...base };\n Object.keys(override).forEach((key) => {\n const next = override[key];\n if (isObject(next) && isObject(base[key])) {\n result[key] = deepMerge(base[key], next);\n } else if (next !== undefined) {\n result[key] = next;\n }\n });\n return result;\n}\n\n/**\n * Normalize parent `theme` prop into { light, dark } packs.\n *\n * Supported shapes:\n * 1. Full theme file: `{ light: {...}, dark: {...} }`\n * 2. Flat tokens: `{ colors, radii, ... }` → applied to both modes (merged over defaults)\n * 3. Mode-specific partial: `{ light: { colors: { primary } } }`\n */\nexport function normalizeThemeFile(themeProp) {\n if (!themeProp || !isObject(themeProp)) {\n return { light: lightTheme, dark: darkTheme };\n }\n\n const hasModes = isObject(themeProp.light) || isObject(themeProp.dark);\n\n if (hasModes) {\n return {\n light: deepMerge(lightTheme, themeProp.light || {}),\n dark: deepMerge(darkTheme, themeProp.dark || {}),\n };\n }\n\n // Flat token object — treat as overrides for both modes\n return {\n light: deepMerge(lightTheme, themeProp),\n dark: deepMerge(darkTheme, themeProp),\n };\n}\n\n/**\n * Pick active theme for current mode and ensure mode flag is set.\n */\nexport function resolveActiveTheme(themeFile, darkMode = false) {\n const pack = normalizeThemeFile(themeFile);\n const active = darkMode ? pack.dark : pack.light;\n return {\n ...active,\n mode: darkMode ? 'dark' : 'light',\n __pack: pack,\n };\n}\n\n/** camelCase / nested keys → CSS custom property map for .ca-root */\nconst COLOR_VAR_MAP = {\n primary: '--ca-primary',\n primaryHover: '--ca-primary-hover',\n text: '--ca-text',\n textSecondary: '--ca-text-secondary',\n textMuted: '--ca-text-muted',\n border: '--ca-border',\n borderLight: '--ca-border-light',\n background: '--ca-bg',\n surface: '--ca-surface',\n white: '--ca-white',\n onPrimary: '--ca-on-primary',\n activeBg: '--ca-active-bg',\n activeBorder: '--ca-active-border',\n activeText: '--ca-active-text',\n inactiveBg: '--ca-inactive-bg',\n inactiveBorder: '--ca-inactive-border',\n inactiveText: '--ca-inactive-text',\n link: '--ca-link',\n divider: '--ca-divider',\n accentBorder: '--ca-accent-border',\n accentBg: '--ca-accent-bg',\n stepDone: '--ca-step-done',\n success: '--ca-success',\n danger: '--ca-danger',\n secondaryBtn: '--ca-secondary-btn',\n secondaryBtnHover: '--ca-secondary-btn-hover',\n inputBg: '--ca-input-bg',\n tableHeadBg: '--ca-table-head-bg',\n sidebarBg: '--ca-sidebar-bg',\n overlay: '--ca-overlay',\n};\n\nconst RADIUS_VAR_MAP = {\n sm: '--ca-radius-sm',\n md: '--ca-radius-md',\n lg: '--ca-radius-lg',\n xl: '--ca-radius-xl',\n pill: '--ca-radius-pill',\n};\n\nconst TYPE_VAR_MAP = {\n fontFamily: '--ca-font',\n h1Size: '--ca-h1-size',\n h2Size: '--ca-h2-size',\n bodySize: '--ca-body-size',\n labelSize: '--ca-label-size',\n valueSize: '--ca-value-size',\n smallSize: '--ca-small-size',\n};\n\nconst SHADOW_VAR_MAP = {\n card: '--ca-shadow-card',\n settings: '--ca-shadow-settings',\n};\n\n/**\n * Convert a resolved theme object into inline CSS variable styles.\n */\nexport function themeToCssVars(theme) {\n const vars = {};\n\n if (theme?.colors) {\n Object.entries(COLOR_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.colors[key] != null) vars[cssVar] = theme.colors[key];\n });\n }\n\n if (theme?.radii) {\n Object.entries(RADIUS_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.radii[key] != null) vars[cssVar] = theme.radii[key];\n });\n }\n\n if (theme?.typography) {\n Object.entries(TYPE_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.typography[key] != null) vars[cssVar] = theme.typography[key];\n });\n }\n\n if (theme?.shadow) {\n Object.entries(SHADOW_VAR_MAP).forEach(([key, cssVar]) => {\n if (theme.shadow[key] != null) vars[cssVar] = theme.shadow[key];\n });\n }\n\n // Ensure primary button text stays readable\n if (vars['--ca-on-primary'] && !vars['--ca-white']) {\n vars['--ca-white'] = vars['--ca-on-primary'];\n }\n\n return vars;\n}\n","import React, { createContext, useContext, useMemo } from 'react';\nimport { resolveActiveTheme, themeToCssVars } from '../theme/resolveTheme';\nimport { defaultThemeFile } from '../theme/defaultTheme';\n\nconst ThemeContext = createContext({\n darkMode: false,\n theme: null,\n themeFile: defaultThemeFile,\n cssVars: {},\n});\n\n/**\n * Applies parent theme + darkMode to the whole package via CSS variables on `.ca-root`.\n *\n * @param {object} [theme] - Static theme file / tokens from parent\n * @param {boolean} [darkMode=false] - Parent-controlled dark mode flag\n */\nexport function ThemeProvider({ theme, darkMode = false, children }) {\n const value = useMemo(() => {\n const active = resolveActiveTheme(theme, Boolean(darkMode));\n const cssVars = themeToCssVars(active);\n return {\n darkMode: Boolean(darkMode),\n theme: active,\n themeFile: active.__pack,\n cssVars,\n mode: active.mode,\n };\n }, [theme, darkMode]);\n\n return (\n <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n\nexport default ThemeContext;\n","import { createAsyncThunk } from '@reduxjs/toolkit';\nimport api from '../../utils/api';\n\nexport const COMPLAINT_ENDPOINTS = Object.freeze({\n types: '/api/v1/complaints/types',\n departments: '/api/v1/complaints/departments',\n departmentTree: '/api/v1/complaints/departments/tree',\n priorities: '/api/v1/complaints/priorities',\n workflows: '/api/v1/complaints/workflows',\n workflowSteps: '/api/v1/complaints/workflows/steps',\n statuses: '/api/v1/complaints/statuses',\n});\n\nconst rejectRequest = (error, thunkApi) =>\n thunkApi.rejectWithValue({\n status: error?.response?.status ?? error?.status,\n message:\n error?.response?.data?.message ??\n error?.response?.data?.error ??\n error?.message ??\n 'Something went wrong',\n });\n\nconst request = (type, handler) =>\n createAsyncThunk(type, async (params, thunkApi) => {\n try {\n const response = await handler(params, thunkApi);\n return response.data;\n } catch (error) {\n return rejectRequest(error, thunkApi);\n }\n });\n\nconst resourceActions = (resource, endpoint) => ({\n list: request(`complaint/${resource}/list`, (params, { signal }) =>\n api.get(endpoint, { params, signal }),\n ),\n getById: request(`complaint/${resource}/getById`, (id, { signal }) =>\n api.get(`${endpoint}/${id}`, { signal }),\n ),\n create: request(`complaint/${resource}/create`, (payload) =>\n api.post(endpoint, payload),\n ),\n update: request(`complaint/${resource}/update`, ({ id, data }) =>\n api.patch(`${endpoint}/${id}`, data),\n ),\n remove: request(`complaint/${resource}/remove`, (id) =>\n api.delete(`${endpoint}/${id}`),\n ),\n});\n\nexport const complaintTypeActions = resourceActions(\n 'types',\n COMPLAINT_ENDPOINTS.types,\n);\nexport const complaintDepartmentActions = resourceActions(\n 'departments',\n COMPLAINT_ENDPOINTS.departments,\n);\nexport const complaintPriorityActions = resourceActions(\n 'priorities',\n COMPLAINT_ENDPOINTS.priorities,\n);\nexport const complaintWorkflowActions = resourceActions(\n 'workflows',\n COMPLAINT_ENDPOINTS.workflows,\n);\nexport const complaintStatusActions = resourceActions(\n 'statuses',\n COMPLAINT_ENDPOINTS.statuses,\n);\n\nexport const getDepartmentTree = request(\n 'complaint/departments/getTree',\n (_params, { signal }) =>\n api.get(COMPLAINT_ENDPOINTS.departmentTree, { signal }),\n);\n\nexport const getWorkflowSteps = request(\n 'complaint/workflows/getSteps',\n (workflowId, { signal }) =>\n api.get(`${COMPLAINT_ENDPOINTS.workflowSteps}/${workflowId}`, { signal }),\n);\n\nexport const saveWorkflowSteps = request(\n 'complaint/workflows/saveSteps',\n (payload) => api.post(COMPLAINT_ENDPOINTS.workflowSteps, payload),\n);\n\nexport const deleteWorkflowSteps = request(\n 'complaint/workflows/deleteSteps',\n (workflowId) =>\n api.delete(`${COMPLAINT_ENDPOINTS.workflowSteps}/${workflowId}`),\n);\n\n// Product-module style named exports for consumers that prefer direct thunks.\nexport const getComplaintTypes = complaintTypeActions.list;\nexport const getComplaintTypeById = complaintTypeActions.getById;\nexport const createComplaintType = complaintTypeActions.create;\nexport const updateComplaintType = complaintTypeActions.update;\nexport const deleteComplaintType = complaintTypeActions.remove;\nexport const getComplaintDepartments = complaintDepartmentActions.list;\nexport const getComplaintDepartmentById = complaintDepartmentActions.getById;\nexport const createComplaintDepartment = complaintDepartmentActions.create;\nexport const updateComplaintDepartment = complaintDepartmentActions.update;\nexport const deleteComplaintDepartment = complaintDepartmentActions.remove;\nexport const getComplaintPriorities = complaintPriorityActions.list;\nexport const getComplaintPriorityById = complaintPriorityActions.getById;\nexport const createComplaintPriority = complaintPriorityActions.create;\nexport const updateComplaintPriority = complaintPriorityActions.update;\nexport const deleteComplaintPriority = complaintPriorityActions.remove;\nexport const getComplaintWorkflows = complaintWorkflowActions.list;\nexport const getComplaintWorkflowById = complaintWorkflowActions.getById;\nexport const createComplaintWorkflow = complaintWorkflowActions.create;\nexport const updateComplaintWorkflow = complaintWorkflowActions.update;\nexport const deleteComplaintWorkflow = complaintWorkflowActions.remove;\nexport const getComplaintStatuses = complaintStatusActions.list;\nexport const getComplaintStatusById = complaintStatusActions.getById;\nexport const createComplaintStatus = complaintStatusActions.create;\nexport const updateComplaintStatus = complaintStatusActions.update;\nexport const deleteComplaintStatus = complaintStatusActions.remove;\n","import { createSlice } from '@reduxjs/toolkit';\nimport {\n complaintTypeActions,\n complaintDepartmentActions,\n complaintPriorityActions,\n complaintWorkflowActions,\n complaintStatusActions,\n getDepartmentTree,\n getWorkflowSteps,\n saveWorkflowSteps,\n deleteWorkflowSteps,\n} from './actions';\n\nconst createResourceState = () => ({\n data: [],\n selected: null,\n pagination: null,\n isLoading: false,\n isMutating: false,\n error: null,\n});\n\nconst initialState = {\n types: createResourceState(),\n departments: createResourceState(),\n priorities: createResourceState(),\n workflows: createResourceState(),\n statuses: createResourceState(),\n departmentTree: [],\n workflowSteps: {},\n isLoadingDepartmentTree: false,\n isLoadingWorkflowSteps: false,\n error: null,\n};\n\nconst unwrapList = (payload) => {\n if (Array.isArray(payload)) return { data: payload, pagination: null };\n const body = payload?.data ?? payload;\n if (Array.isArray(body)) {\n return { data: body, pagination: payload?.pagination ?? null };\n }\n return {\n data: body?.results ?? body?.items ?? [],\n pagination: body?.pagination ?? payload?.pagination ?? null,\n };\n};\n\nconst unwrapEntity = (payload) => payload?.data ?? payload;\n\nconst entityId = (entity) => entity?.id ?? entity?._id;\n\nconst upsert = (items, entity) => {\n if (!entity || typeof entity !== 'object') return items;\n const id = entityId(entity);\n if (id === undefined || id === null) return items;\n const index = items.findIndex((item) => entityId(item) === id);\n if (index < 0) return [entity, ...items];\n const next = [...items];\n next[index] = entity;\n return next;\n};\n\nconst errorMessage = (action) =>\n action.payload?.message ?? action.error?.message ?? 'Something went wrong';\n\nconst registerResource = (builder, key, actions) => {\n builder\n .addCase(actions.list.pending, (state) => {\n state[key].isLoading = true;\n state[key].error = null;\n })\n .addCase(actions.list.fulfilled, (state, action) => {\n const result = unwrapList(action.payload);\n state[key].isLoading = false;\n state[key].data = result.data;\n state[key].pagination = result.pagination;\n })\n .addCase(actions.list.rejected, (state, action) => {\n state[key].isLoading = false;\n state[key].error = errorMessage(action);\n })\n .addCase(actions.getById.pending, (state) => {\n state[key].isLoading = true;\n state[key].error = null;\n })\n .addCase(actions.getById.fulfilled, (state, action) => {\n state[key].isLoading = false;\n state[key].selected = unwrapEntity(action.payload);\n })\n .addCase(actions.getById.rejected, (state, action) => {\n state[key].isLoading = false;\n state[key].error = errorMessage(action);\n });\n\n [actions.create, actions.update].forEach((actionCreator) => {\n builder\n .addCase(actionCreator.pending, (state) => {\n state[key].isMutating = true;\n state[key].error = null;\n })\n .addCase(actionCreator.fulfilled, (state, action) => {\n const entity = unwrapEntity(action.payload);\n state[key].isMutating = false;\n state[key].selected = entity;\n state[key].data = upsert(state[key].data, entity);\n })\n .addCase(actionCreator.rejected, (state, action) => {\n state[key].isMutating = false;\n state[key].error = errorMessage(action);\n });\n });\n\n builder\n .addCase(actions.remove.pending, (state) => {\n state[key].isMutating = true;\n state[key].error = null;\n })\n .addCase(actions.remove.fulfilled, (state, action) => {\n const deletedId = action.meta.arg;\n state[key].isMutating = false;\n state[key].data = state[key].data.filter(\n (item) => entityId(item) !== deletedId,\n );\n if (entityId(state[key].selected) === deletedId) {\n state[key].selected = null;\n }\n })\n .addCase(actions.remove.rejected, (state, action) => {\n state[key].isMutating = false;\n state[key].error = errorMessage(action);\n });\n};\n\nconst complaintSlice = createSlice({\n name: 'complaintAppComplaint',\n initialState,\n reducers: {\n clearComplaintError(state, action) {\n const resource = action.payload;\n if (resource && state[resource]?.error !== undefined) {\n state[resource].error = null;\n } else {\n state.error = null;\n }\n },\n clearSelectedComplaintResource(state, action) {\n const resource = action.payload;\n if (resource && state[resource]?.selected !== undefined) {\n state[resource].selected = null;\n }\n },\n resetComplaintState() {\n return initialState;\n },\n },\n extraReducers: (builder) => {\n registerResource(builder, 'types', complaintTypeActions);\n registerResource(builder, 'departments', complaintDepartmentActions);\n registerResource(builder, 'priorities', complaintPriorityActions);\n registerResource(builder, 'workflows', complaintWorkflowActions);\n registerResource(builder, 'statuses', complaintStatusActions);\n\n builder\n .addCase(getDepartmentTree.pending, (state) => {\n state.isLoadingDepartmentTree = true;\n state.error = null;\n })\n .addCase(getDepartmentTree.fulfilled, (state, action) => {\n state.isLoadingDepartmentTree = false;\n const value = unwrapEntity(action.payload);\n state.departmentTree = Array.isArray(value)\n ? value\n : value?.tree ?? value?.items ?? [];\n })\n .addCase(getDepartmentTree.rejected, (state, action) => {\n state.isLoadingDepartmentTree = false;\n state.error = errorMessage(action);\n })\n .addCase(getWorkflowSteps.pending, (state) => {\n state.isLoadingWorkflowSteps = true;\n state.error = null;\n })\n .addCase(getWorkflowSteps.fulfilled, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n state.workflowSteps[action.meta.arg] = unwrapEntity(action.payload);\n })\n .addCase(getWorkflowSteps.rejected, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n state.error = errorMessage(action);\n })\n .addCase(saveWorkflowSteps.pending, (state) => {\n state.isLoadingWorkflowSteps = true;\n state.error = null;\n })\n .addCase(saveWorkflowSteps.fulfilled, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n const result = unwrapEntity(action.payload);\n const workflowId =\n action.meta.arg?.workflowId ?? result?.workflowId ?? result?.id;\n if (workflowId !== undefined) state.workflowSteps[workflowId] = result;\n })\n .addCase(saveWorkflowSteps.rejected, (state, action) => {\n state.isLoadingWorkflowSteps = false;\n state.error = errorMessage(action);\n })\n .addCase(deleteWorkflowSteps.fulfilled, (state, action) => {\n delete state.workflowSteps[action.meta.arg];\n });\n },\n});\n\nexport const {\n clearComplaintError,\n clearSelectedComplaintResource,\n resetComplaintState,\n} = complaintSlice.actions;\n\nexport default complaintSlice.reducer;\n","import { combineReducers } from '@reduxjs/toolkit';\nimport complaintAppComplaint from './complaint/reducers';\n\nconst rootReducer = combineReducers({\n complaintAppComplaint,\n});\n\nexport default rootReducer;\n","import { configureStore } from '@reduxjs/toolkit';\nimport rootReducer from './reducers';\n\nexport const createComplaintStore = (preloadedState) =>\n configureStore({\n reducer: rootReducer,\n preloadedState,\n middleware: (getDefaultMiddleware) =>\n getDefaultMiddleware({\n immutableCheck: false,\n serializableCheck: false,\n }),\n });\n\nconst store = createComplaintStore();\n\nexport { store };\nexport default store;\n","import React from 'react';\n\n/**\n * Button atom — primary | secondary | outline | ghost | link.\n */\nexport default function Button({\n children,\n variant = 'primary',\n size = 'md',\n startIcon,\n endIcon,\n className = '',\n type = 'button',\n disabled = false,\n onClick,\n ...props\n}) {\n const classes = [\n 'ca-btn',\n `ca-btn--${variant}`,\n size === 'sm' ? 'ca-btn--sm' : '',\n size === 'lg' ? 'ca-btn--lg' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n type={type}\n className={classes}\n disabled={disabled}\n onClick={onClick}\n {...props}\n >\n {startIcon ? <span className=\"ca-btn__icon\">{startIcon}</span> : null}\n {children}\n {endIcon ? <span className=\"ca-btn__icon\">{endIcon}</span> : null}\n </button>\n );\n}\n","import React from 'react';\n\n/** Plus icon for create actions. */\nexport default function PlusIcon({ size = 16, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M12 5v14M5 12h14\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\n\nconst VARIANT_CLASS = {\n h1: 'ca-h1',\n h2: 'ca-h2',\n body: 'ca-body',\n label: 'ca-label',\n value: 'ca-value',\n small: 'ca-small',\n link: 'ca-link',\n};\n\nconst VARIANT_TAG = {\n h1: 'h1',\n h2: 'h2',\n body: 'p',\n label: 'span',\n value: 'span',\n small: 'span',\n link: 'button',\n};\n\n/**\n * Typography atom — shared text styles across the package.\n */\nexport default function Typography({\n variant = 'body',\n as,\n className = '',\n children,\n ...props\n}) {\n const Tag = as || VARIANT_TAG[variant] || 'p';\n const baseClass = VARIANT_CLASS[variant] || VARIANT_CLASS.body;\n\n return (\n <Tag className={`${baseClass} ${className}`.trim()} {...props}>\n {children}\n </Tag>\n );\n}\n\nexport function Heading1(props) {\n return <Typography variant=\"h1\" {...props} />;\n}\n\nexport function Heading2(props) {\n return <Typography variant=\"h2\" {...props} />;\n}\n\nexport function BodyText(props) {\n return <Typography variant=\"body\" {...props} />;\n}\n\nexport function LabelText(props) {\n return <Typography variant=\"label\" {...props} />;\n}\n\nexport function ValueText(props) {\n return <Typography variant=\"value\" {...props} />;\n}\n\nexport function LinkText(props) {\n return <Typography variant=\"link\" type=\"button\" {...props} />;\n}\n","import React from 'react';\nimport Button from '../atoms/Button';\nimport PlusIcon from '../atoms/PlusIcon';\nimport { Heading1, BodyText } from '../atoms/Typography';\n\n/**\n * Page header organism — title, description, primary CTA.\n */\nexport default function PageHeader({\n title = 'Complaint Management',\n description,\n actionLabel = 'Create New Form',\n onAction,\n className = '',\n}) {\n return (\n <header className={`ca-page-header ${className}`.trim()}>\n <div className=\"ca-page-header__text\">\n <Heading1>{title}</Heading1>\n {description ? <BodyText>{description}</BodyText> : null}\n </div>\n <div className=\"ca-page-header__actions\">\n <Button startIcon={<PlusIcon />} onClick={onAction}>\n {actionLabel}\n </Button>\n </div>\n </header>\n );\n}\n","import React from 'react';\n\n/**\n * Pill-style status badge atom.\n * @param {'active' | 'inactive' | string} status\n */\nexport default function StatusBadge({ status = 'inactive', label, className = '' }) {\n const normalized = String(status).toLowerCase();\n const isActive = normalized === 'active';\n const text = label ?? (isActive ? 'Active' : 'Inactive');\n\n return (\n <span\n className={`ca-badge ca-badge--${isActive ? 'active' : 'inactive'} ${className}`.trim()}\n >\n {text}\n </span>\n );\n}\n","import React from 'react';\nimport { Heading2 } from '../atoms/Typography';\nimport StatusBadge from '../atoms/StatusBadge';\n\n/**\n * Card header molecule — system title + status badge.\n */\nexport default function CardHeader({\n title,\n status,\n statusLabel,\n titleAsLink = false,\n onTitleClick,\n className = '',\n}) {\n return (\n <div className={`ca-system-card__header ${className}`.trim()}>\n <div className=\"ca-system-card__title-wrap\">\n {titleAsLink ? (\n <button\n type=\"button\"\n className=\"ca-h2 ca-h2--link\"\n onClick={onTitleClick}\n >\n {title}\n </button>\n ) : (\n <Heading2>{title}</Heading2>\n )}\n </div>\n <StatusBadge status={status} label={statusLabel} />\n </div>\n );\n}\n","import React from 'react';\n\n/** Chevron-right icon (reused pattern from Icons/ChevronRightIcon). */\nexport default function ChevronRightIcon({ size = 16, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M9 6l6 6-6 6\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport Typography from '../atoms/Typography';\nimport Button from '../atoms/Button';\nimport ChevronRightIcon from '../atoms/ChevronRightIcon';\n\n/**\n * Card footer molecule — \"Updated on…\" text + Configure button.\n */\nexport default function CardFooter({\n updatedOn,\n configureLabel = 'Configure',\n onConfigure,\n className = '',\n}) {\n return (\n <div className={`ca-system-card__footer ${className}`.trim()}>\n <Typography variant=\"small\" as=\"span\">\n {updatedOn ? `Updated on ${updatedOn}` : ''}\n </Typography>\n <Button\n size=\"sm\"\n onClick={onConfigure}\n endIcon={<ChevronRightIcon size={14} color=\"#fff\" />}\n >\n {configureLabel}\n </Button>\n </div>\n );\n}\n","import React from 'react';\nimport { LabelText, ValueText } from '../atoms/Typography';\n\n/**\n * Data point molecule — label above value (e.g. Departments / 03).\n */\nexport default function DataPoint({ label, value, className = '' }) {\n const display =\n value === null || value === undefined\n ? '—'\n : typeof value === 'number'\n ? String(value).padStart(2, '0')\n : value;\n\n return (\n <div className={`ca-data-point ${className}`.trim()}>\n <LabelText>{label}</LabelText>\n <ValueText>{display}</ValueText>\n </div>\n );\n}\n","import React from 'react';\n\n/** Vertical divider used between data points in system cards. */\nexport default function Divider({ className = '' }) {\n return <div className={`ca-divider ${className}`.trim()} role=\"separator\" aria-orientation=\"vertical\" />;\n}\n","import React from 'react';\nimport CardHeader from '../molecules/CardHeader';\nimport CardFooter from '../molecules/CardFooter';\nimport DataPoint from '../molecules/DataPoint';\nimport Divider from '../atoms/Divider';\nimport { LinkText } from '../atoms/Typography';\n\n/**\n * System / template card organism.\n *\n * Props are data-only so the parent app owns API & auth.\n */\nexport default function SystemCard({\n id,\n title,\n status = 'inactive',\n statusLabel,\n description,\n descriptionHref,\n departments,\n workflows,\n fields,\n formsFilled,\n updatedOn,\n titleAsLink = false,\n onTitleClick,\n onDescriptionClick,\n onConfigure,\n className = '',\n}) {\n const handleConfigure = () => {\n onConfigure?.({\n id,\n title,\n status,\n departments,\n workflows,\n fields,\n formsFilled,\n updatedOn,\n });\n };\n\n const handleDescription = () => {\n if (onDescriptionClick) {\n onDescriptionClick({ id, title, descriptionHref });\n return;\n }\n if (descriptionHref && typeof window !== 'undefined') {\n window.open(descriptionHref, '_blank', 'noopener,noreferrer');\n }\n };\n\n const stats = [\n { label: 'Departments', value: departments },\n { label: 'Workflows', value: workflows },\n { label: 'Fields', value: fields },\n { label: 'Forms Filled', value: formsFilled },\n ];\n\n return (\n <article className={`ca-system-card ${className}`.trim()}>\n <CardHeader\n title={title}\n status={status}\n statusLabel={statusLabel}\n titleAsLink={titleAsLink}\n onTitleClick={() => onTitleClick?.({ id, title })}\n />\n\n {description ? (\n <LinkText onClick={handleDescription}>{description}</LinkText>\n ) : null}\n\n <div className=\"ca-system-card__stats\">\n {stats.map((stat, index) => (\n <React.Fragment key={stat.label}>\n {index > 0 ? <Divider /> : null}\n <DataPoint label={stat.label} value={stat.value} />\n </React.Fragment>\n ))}\n </div>\n\n <CardFooter updatedOn={updatedOn} onConfigure={handleConfigure} />\n </article>\n );\n}\n","import React from 'react';\nimport SystemCard from './SystemCard';\nimport { BodyText } from '../atoms/Typography';\n\n/**\n * Responsive grid of system cards.\n */\nexport default function SystemCardGrid({\n systems = [],\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n emptyMessage = 'No systems found.',\n className = '',\n}) {\n if (!systems.length) {\n return (\n <div className={`ca-system-grid ${className}`.trim()}>\n <div className=\"ca-empty\">\n <BodyText>{emptyMessage}</BodyText>\n </div>\n </div>\n );\n }\n\n return (\n <div className={`ca-system-grid ${className}`.trim()}>\n {systems.map((system) => (\n <SystemCard\n key={system.id ?? system.title}\n {...system}\n onConfigure={onConfigure}\n onTitleClick={onTitleClick}\n onDescriptionClick={onDescriptionClick}\n />\n ))}\n </div>\n );\n}\n","import React from 'react';\n\n/**\n * Text input atom. Supports an optional leading icon (e.g. search).\n */\nexport default function Input({\n value,\n onChange,\n placeholder,\n type = 'text',\n icon,\n className = '',\n inputClassName = '',\n ...props\n}) {\n return (\n <div className={`ca-input-wrap ${className}`.trim()}>\n {icon ? <span className=\"ca-input-wrap__icon\">{icon}</span> : null}\n <input\n type={type}\n className={`ca-input ${icon ? 'ca-input--with-icon' : ''} ${inputClassName}`.trim()}\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n {...props}\n />\n </div>\n );\n}\n","import React from 'react';\n\n/** Magnifying-glass icon for search inputs. */\nexport default function SearchIcon({ size = 18, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z\"\n stroke={color}\n strokeWidth=\"1.75\"\n />\n <path\n d=\"M16.5 16.5 21 21\"\n stroke={color}\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport Input from '../atoms/Input';\nimport SearchIcon from '../atoms/SearchIcon';\n\n/**\n * Search bar molecule — Input + search icon.\n */\nexport default function SearchBar({\n value,\n onChange,\n onSearch,\n placeholder = 'Search',\n className = '',\n}) {\n const handleKeyDown = (e) => {\n if (e.key === 'Enter' && onSearch) {\n onSearch(value);\n }\n };\n\n return (\n <div className={`ca-search ${className}`.trim()}>\n <Input\n value={value}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n icon={<SearchIcon />}\n aria-label={placeholder}\n />\n </div>\n );\n}\n","import React from 'react';\n\n/**\n * Generic loading atom (reused from previous package pattern).\n */\nexport default function Loading({ text = 'Loading', fullScreen = false }) {\n return (\n <div\n className=\"ca-loading\"\n style={fullScreen ? { minHeight: 'calc(100vh - 80px)' } : undefined}\n role=\"status\"\n aria-live=\"polite\"\n >\n <span className=\"ca-loading__spinner\" />\n <span>{text}…</span>\n </div>\n );\n}\n","/** Demo systems matching the Complaint Management design (used when no data is passed). */\nexport const DEMO_SYSTEMS = [\n {\n id: 'qms',\n title: 'QMS - Query Management System',\n status: 'active',\n description: 'Description of the template',\n departments: 3,\n workflows: 12,\n fields: 55,\n formsFilled: 234,\n updatedOn: '12 Mar 2024',\n titleAsLink: true,\n },\n {\n id: 'cms',\n title: 'CMS - Complaint Management System',\n status: 'active',\n description: 'Description of the template',\n departments: 5,\n workflows: 8,\n fields: 42,\n formsFilled: 189,\n updatedOn: '08 Mar 2024',\n },\n {\n id: 'fms',\n title: 'FMS - Feedback Management System',\n status: 'inactive',\n description: 'Description of the template',\n departments: 2,\n workflows: 4,\n fields: 28,\n formsFilled: 56,\n updatedOn: '01 Feb 2024',\n },\n {\n id: 'rms',\n title: 'RMS - Request Management System',\n status: 'active',\n description: 'Description of the template',\n departments: 4,\n workflows: 10,\n fields: 61,\n formsFilled: 312,\n updatedOn: '20 Mar 2024',\n },\n];\n\nexport const DEFAULT_PAGE_DESCRIPTION =\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.';\n","import React, { useMemo, useState, useEffect } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport PageHeader from '../components/organisms/PageHeader';\nimport SystemCardGrid from '../components/organisms/SystemCardGrid';\nimport SearchBar from '../components/molecules/SearchBar';\nimport Loading from '../components/atoms/Loading';\nimport { DEMO_SYSTEMS, DEFAULT_PAGE_DESCRIPTION } from '../data/demoSystems';\nimport api from '../utils/api';\n\n/**\n * Normalize API / parent payloads into SystemCard props.\n */\nfunction normalizeSystems(list = []) {\n return list.map((item, index) => ({\n id: item.id ?? item._id ?? `system-${index}`,\n title: item.title ?? item.name ?? 'Untitled',\n status: item.status ?? 'inactive',\n statusLabel: item.statusLabel,\n description: item.description ?? item.templateDescription,\n descriptionHref: item.descriptionHref ?? item.url,\n departments: item.departments ?? item.departmentCount ?? 0,\n workflows: item.workflows ?? item.workflowCount ?? 0,\n fields: item.fields ?? item.fieldCount ?? 0,\n formsFilled: item.formsFilled ?? item.formFilledCount ?? item.forms_filled ?? 0,\n updatedOn: item.updatedOn ?? item.updatedAt ?? item.updated_on,\n titleAsLink: Boolean(item.titleAsLink ?? item.isLink),\n }));\n}\n\n/**\n * Complaint Management page — composes header, search, and system cards.\n *\n * Data comes from:\n * 1. `systems` prop (parent-controlled), or\n * 2. `systemsEndpoint` fetched via shared api client (parent auth/base URL), or\n * 3. demo data (dev / design preview).\n */\nexport default function ComplaintManagementPage({\n title = 'Complaint Management',\n description = DEFAULT_PAGE_DESCRIPTION,\n systems: systemsProp,\n systemsEndpoint,\n useDemoData = true,\n createLabel = 'Create New Form',\n onCreateForm,\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n onSearch,\n}) {\n const navigate = useNavigate();\n const [search, setSearch] = useState('');\n const [fetchedSystems, setFetchedSystems] = useState(null);\n const [fetchError, setFetchError] = useState(null);\n const [fetchStatus, setFetchStatus] = useState(\n systemsEndpoint && !systemsProp ? 'loading' : 'idle',\n );\n\n useEffect(() => {\n if (!systemsEndpoint || systemsProp) {\n return undefined;\n }\n\n const controller = new AbortController();\n\n api\n .get(systemsEndpoint, { signal: controller.signal })\n .then((response) => {\n const payload = response?.data;\n const list = Array.isArray(payload)\n ? payload\n : payload?.data ?? payload?.systems ?? payload?.results ?? [];\n setFetchedSystems(normalizeSystems(list));\n setFetchError(null);\n setFetchStatus('success');\n })\n .catch((err) => {\n if (controller.signal.aborted) return;\n setFetchError(err?.message || 'Failed to load systems');\n setFetchedSystems([]);\n setFetchStatus('error');\n });\n\n return () => controller.abort();\n }, [systemsEndpoint, systemsProp]);\n\n const sourceSystems = useMemo(() => {\n if (systemsProp) return normalizeSystems(systemsProp);\n if (fetchedSystems) return fetchedSystems;\n if (useDemoData) return DEMO_SYSTEMS;\n return [];\n }, [systemsProp, fetchedSystems, useDemoData]);\n\n const filteredSystems = useMemo(() => {\n const q = search.trim().toLowerCase();\n if (!q) return sourceSystems;\n return sourceSystems.filter((s) => {\n const haystack = `${s.title} ${s.description ?? ''} ${s.status ?? ''}`.toLowerCase();\n return haystack.includes(q);\n });\n }, [sourceSystems, search]);\n\n const handleSearchChange = (e) => {\n const next = e.target.value;\n setSearch(next);\n onSearch?.(next);\n };\n\n const handleConfigure = (system) => {\n onConfigure?.(system);\n navigate(`/settings/${system.id ?? 'new'}?step=1`);\n };\n\n const handleCreate = () => {\n onCreateForm?.();\n navigate('/settings/new?step=1');\n };\n\n const loading = fetchStatus === 'loading';\n\n return (\n <>\n <PageHeader\n title={title}\n description={description}\n actionLabel={createLabel}\n onAction={handleCreate}\n />\n\n <SearchBar value={search} onChange={handleSearchChange} placeholder=\"Search\" />\n\n {loading ? (\n <Loading text=\"Loading systems\" />\n ) : fetchError ? (\n <div className=\"ca-empty\">\n <p className=\"ca-body\">{fetchError}</p>\n </div>\n ) : (\n <SystemCardGrid\n systems={filteredSystems}\n onConfigure={handleConfigure}\n onTitleClick={onTitleClick}\n onDescriptionClick={onDescriptionClick}\n emptyMessage={search ? 'No systems match your search.' : 'No systems found.'}\n />\n )}\n </>\n );\n}\n","import React from 'react';\n\n/**\n * Horizontal stepper organism.\n * Reflects URL-driven step (1-indexed).\n */\nexport default function Stepper({\n steps = [],\n currentStep = 1,\n onStepClick,\n className = '',\n size = 'md',\n}) {\n return (\n <nav\n className={`ca-stepper ca-stepper--${size} ${className}`.trim()}\n aria-label=\"Progress\"\n >\n {steps.map((step, index) => {\n const stepId = step.id ?? index + 1;\n const isActive = stepId === currentStep;\n const isDone = stepId < currentStep;\n const clickable = Boolean(onStepClick) && (isDone || isActive);\n\n return (\n <React.Fragment key={stepId}>\n {index > 0 ? (\n <div\n className={`ca-stepper__line ${isDone || isActive ? 'ca-stepper__line--active' : ''}`}\n />\n ) : null}\n <button\n type=\"button\"\n className={[\n 'ca-stepper__item',\n isActive ? 'ca-stepper__item--active' : '',\n isDone ? 'ca-stepper__item--done' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => clickable && onStepClick?.(stepId)}\n disabled={!clickable}\n aria-current={isActive ? 'step' : undefined}\n >\n <span className=\"ca-stepper__circle\">{stepId}</span>\n <span className=\"ca-stepper__label\">{step.label}</span>\n </button>\n </React.Fragment>\n );\n })}\n </nav>\n );\n}\n","import React, { createContext, useContext, useMemo, useState, useCallback } from 'react';\n\nconst SettingsWizardContext = createContext(null);\n\nconst createEmptyWizardState = () => ({\n categoryType: '',\n active: false,\n description: '',\n roles: [],\n departmentRows: [\n { id: '1', department: '', subDepartment: '', roles: '' },\n ],\n priorityDraft: '',\n priorities: [],\n defaultPriorityId: null,\n selectedDeptNode: null,\n workflow: {\n name: '',\n tatMinutes: '',\n description: '',\n statuses: [],\n steps: [],\n },\n fieldDraft: { name: '', type: '' },\n formFields: [],\n});\n\nexport function SettingsWizardProvider({ children, initialValues }) {\n const [state, setState] = useState(() => ({\n ...createEmptyWizardState(),\n ...initialValues,\n workflow: {\n ...createEmptyWizardState().workflow,\n ...initialValues?.workflow,\n },\n }));\n\n const update = useCallback((patch) => {\n setState((prev) => ({ ...prev, ...patch }));\n }, []);\n\n const updateWorkflow = useCallback((patch) => {\n setState((prev) => ({\n ...prev,\n workflow: { ...prev.workflow, ...patch },\n }));\n }, []);\n\n const value = useMemo(\n () => ({ state, setState, update, updateWorkflow }),\n [state, update, updateWorkflow],\n );\n\n return (\n <SettingsWizardContext.Provider value={value}>\n {children}\n </SettingsWizardContext.Provider>\n );\n}\n\n// Context hook co-located with provider (standard React pattern).\n// eslint-disable-next-line react-refresh/only-export-components\nexport function useSettingsWizard() {\n const ctx = useContext(SettingsWizardContext);\n if (!ctx) {\n throw new Error('useSettingsWizard must be used within SettingsWizardProvider');\n }\n return ctx;\n}\n\nexport default SettingsWizardContext;\n","/** Settings wizard step definitions (1-indexed for URL ?step=). */\nexport const SETTINGS_STEPS = [\n {\n id: 1,\n key: 'category',\n label: 'Category Type',\n title: 'Category Type',\n description: 'Define the type and basic details for this category type.',\n },\n {\n id: 2,\n key: 'departments',\n label: 'Departments',\n title: 'Departments',\n description: '----',\n },\n {\n id: 3,\n key: 'priorities',\n label: 'Priorities',\n title: 'Priorities',\n description: '----',\n },\n {\n id: 4,\n key: 'workflow',\n label: 'Workflow',\n title: 'Workflow',\n description: '----',\n },\n {\n id: 5,\n key: 'formFields',\n label: 'Form Fields',\n title: 'Form Fields',\n description: '----',\n },\n {\n id: 6,\n key: 'review',\n label: 'Review & Publish',\n title: 'Review & Publish',\n description: 'Review your configuration and publish.',\n },\n];\n\nexport const WORKFLOW_SUBSTEPS = [\n { id: 1, label: 'Create Workflow' },\n { id: 2, label: 'Statuses' },\n { id: 3, label: 'Workflow Steps' },\n];\n\nexport const QUICK_PRIORITIES = ['Urgent', 'High', 'Medium', 'Low'];\n\nexport const FIELD_LIBRARY = [\n { id: 'short', label: 'Textfield / Short Answer', icon: 'text' },\n { id: 'long', label: 'Description / Long Answer', icon: 'doc' },\n { id: 'date', label: 'Date', icon: 'calendar' },\n { id: 'time', label: 'Time', icon: 'clock' },\n { id: 'single', label: 'Dropdown - Single Select', icon: 'chevron' },\n { id: 'multi', label: 'Dropdown - Multiple Select', icon: 'chevron' },\n];\n\nexport const DEMO_ROLES = [\n 'Store Staff',\n 'HR Executive',\n 'HR Manager',\n 'Store Manager',\n 'Admin',\n];\n\nexport const DEMO_CATEGORY_TYPES = [\n { value: 'qms', label: 'QMS - Query Management System' },\n { value: 'cms', label: 'CMS - Complaint Management System' },\n { value: 'fms', label: 'FMS - Feedback Management System' },\n { value: 'rms', label: 'RMS - Request Management System' },\n];\n\nexport const DEMO_DEPARTMENTS_TREE = [\n {\n id: 'hr',\n name: 'HR',\n children: [\n { id: 'payroll', name: 'Payroll' },\n { id: 'recruitment', name: 'Recruitment' },\n ],\n },\n {\n id: 'finance',\n name: 'Finance',\n children: [{ id: 'ap', name: 'Accounts Payable' }],\n },\n {\n id: 'it',\n name: 'IT',\n children: [],\n },\n];\n\nexport const PRIORITY_COLORS = [\n { value: '#EF4444', label: 'Red' },\n { value: '#F59E0B', label: 'Orange' },\n { value: '#EAB308', label: 'Yellow' },\n { value: '#22C55E', label: 'Green' },\n { value: '#3B82F6', label: 'Blue' },\n { value: '#8B5CF6', label: 'Purple' },\n];\n","import React from 'react';\n\n/** Stacked-layers icon used in settings card headers. */\nexport default function LayersIcon({ size = 28, color = 'currentColor', ...props }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n style={{ color: 'var(--ca-primary)' }}\n {...props}\n >\n <path\n d=\"M12 3 3 8l9 5 9-5-9-5Z\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M3 12.5 12 17.5l9-5\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n <path\n d=\"M3 16.5 12 21.5l9-5\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport LayersIcon from '../atoms/LayersIcon';\nimport Button from '../atoms/Button';\nimport ChevronRightIcon from '../atoms/ChevronRightIcon';\nimport { Heading2, BodyText } from '../atoms/Typography';\n\n/**\n * Settings card header — icon, title, description, Next button.\n */\nexport default function SettingsCardHeader({\n title,\n description,\n nextLabel = 'Next',\n onNext,\n showNext = true,\n nextDisabled = false,\n nextVariant = 'primary',\n className = '',\n}) {\n return (\n <div className={`ca-settings-card__header ${className}`.trim()}>\n <div className=\"ca-settings-card__heading\">\n <LayersIcon />\n <div>\n <Heading2>{title}</Heading2>\n {description ? <BodyText className=\"ca-settings-card__desc\">{description}</BodyText> : null}\n </div>\n </div>\n {showNext ? (\n <Button\n variant={nextVariant}\n disabled={nextDisabled}\n onClick={onNext}\n endIcon={<ChevronRightIcon size={14} color=\"currentColor\" />}\n >\n {nextLabel}\n </Button>\n ) : null}\n </div>\n );\n}\n","import React from 'react';\nimport SettingsCardHeader from '../molecules/SettingsCardHeader';\n\n/**\n * White bordered card shell for settings step content.\n */\nexport default function SettingsCard({\n title,\n description,\n onNext,\n nextLabel,\n showNext = true,\n nextDisabled,\n nextVariant,\n children,\n footer,\n className = '',\n}) {\n return (\n <section className={`ca-settings-card ${className}`.trim()}>\n <SettingsCardHeader\n title={title}\n description={description}\n onNext={onNext}\n nextLabel={nextLabel}\n showNext={showNext}\n nextDisabled={nextDisabled}\n nextVariant={nextVariant}\n />\n <div className=\"ca-settings-card__divider\" />\n <div className=\"ca-settings-card__body\">{children}</div>\n {footer ? <div className=\"ca-settings-card__footer\">{footer}</div> : null}\n </section>\n );\n}\n","import React from 'react';\n\n/**\n * Field label atom with optional trailing hint (e.g. character count).\n */\nexport default function FieldLabel({ children, hint, htmlFor, className = '' }) {\n return (\n <div className={`ca-field-label ${className}`.trim()}>\n <label className=\"ca-label\" htmlFor={htmlFor}>\n {children}\n </label>\n {hint != null ? <span className=\"ca-field-label__hint\">{hint}</span> : null}\n </div>\n );\n}\n","import React from 'react';\n\nexport default function ChevronDownIcon({ size = 16, color = 'currentColor', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <path\n d=\"M6 9l6 6 6-6\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport ChevronDownIcon from './ChevronDownIcon';\n\n/**\n * Select / dropdown atom.\n */\nexport default function Select({\n value,\n onChange,\n options = [],\n placeholder = 'Select',\n className = '',\n disabled = false,\n ...props\n}) {\n return (\n <div className={`ca-select ${className}`.trim()}>\n <select\n className=\"ca-select__control\"\n value={value ?? ''}\n onChange={onChange}\n disabled={disabled}\n {...props}\n >\n <option value=\"\" disabled>\n {placeholder}\n </option>\n {options.map((opt) => {\n const val = typeof opt === 'string' ? opt : opt.value;\n const label = typeof opt === 'string' ? opt : opt.label;\n return (\n <option key={val} value={val}>\n {label}\n </option>\n );\n })}\n </select>\n <span className=\"ca-select__chevron\">\n <ChevronDownIcon size={16} />\n </span>\n </div>\n );\n}\n","import React from 'react';\n\n/**\n * Multi-line text input atom.\n */\nexport default function Textarea({\n value,\n onChange,\n placeholder,\n maxLength,\n rows = 4,\n className = '',\n ...props\n}) {\n return (\n <textarea\n className={`ca-textarea ${className}`.trim()}\n value={value}\n onChange={onChange}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows}\n {...props}\n />\n );\n}\n","import React from 'react';\nimport FieldLabel from '../atoms/FieldLabel';\nimport Input from '../atoms/Input';\nimport Select from '../atoms/Select';\nimport Textarea from '../atoms/Textarea';\n\n/**\n * Labeled form control molecule.\n */\nexport default function FormField({\n label,\n hint,\n children,\n className = '',\n htmlFor,\n}) {\n return (\n <div className={`ca-form-field ${className}`.trim()}>\n {label != null ? (\n <FieldLabel htmlFor={htmlFor} hint={hint}>\n {label}\n </FieldLabel>\n ) : null}\n {children}\n </div>\n );\n}\n\nexport function FormInput({ label, hint, ...inputProps }) {\n return (\n <FormField label={label} hint={hint} htmlFor={inputProps.id}>\n <Input {...inputProps} />\n </FormField>\n );\n}\n\nexport function FormSelect({ label, hint, ...selectProps }) {\n return (\n <FormField label={label} hint={hint} htmlFor={selectProps.id}>\n <Select {...selectProps} />\n </FormField>\n );\n}\n\nexport function FormTextarea({ label, hint, maxLength, value = '', ...textareaProps }) {\n const computedHint =\n hint ??\n (maxLength != null ? `${String(value).length}/${maxLength}` : undefined);\n\n return (\n <FormField label={label} hint={computedHint} htmlFor={textareaProps.id}>\n <Textarea value={value} maxLength={maxLength} {...textareaProps} />\n </FormField>\n );\n}\n","import React from 'react';\n\n/**\n * Toggle switch atom.\n */\nexport default function Toggle({\n checked = false,\n onChange,\n disabled = false,\n 'aria-label': ariaLabel = 'Toggle',\n className = '',\n}) {\n return (\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-label={ariaLabel}\n disabled={disabled}\n className={`ca-toggle ${checked ? 'ca-toggle--on' : ''} ${className}`.trim()}\n onClick={() => onChange?.(!checked)}\n >\n <span className=\"ca-toggle__thumb\" />\n </button>\n );\n}\n","import React from 'react';\nimport Toggle from '../atoms/Toggle';\nimport { LabelText } from '../atoms/Typography';\n\n/** Label + toggle molecule. */\nexport default function ToggleField({\n label = 'Active',\n checked,\n onChange,\n className = '',\n}) {\n return (\n <div className={`ca-toggle-field ${className}`.trim()}>\n <LabelText>{label}</LabelText>\n <Toggle checked={checked} onChange={onChange} aria-label={label} />\n </div>\n );\n}\n","import React from 'react';\n\nexport default function CloseIcon({ size = 12, color = 'currentColor', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <path\n d=\"M6 6l12 12M18 6L6 18\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport CloseIcon from './CloseIcon';\n\n/**\n * Removable tag / pill atom.\n */\nexport default function Tag({ label, onRemove, className = '' }) {\n return (\n <span className={`ca-tag ${className}`.trim()}>\n {label}\n {onRemove ? (\n <button\n type=\"button\"\n className=\"ca-tag__remove\"\n onClick={onRemove}\n aria-label={`Remove ${label}`}\n >\n <CloseIcon size={10} />\n </button>\n ) : null}\n </span>\n );\n}\n","import React, { useState } from 'react';\nimport Select from '../atoms/Select';\nimport Tag from '../atoms/Tag';\nimport FieldLabel from '../atoms/FieldLabel';\n\n/**\n * Multi-select via dropdown + removable tags.\n */\nexport default function RoleMultiSelect({\n label = 'Select Roles',\n options = [],\n value = [],\n onChange,\n placeholder = 'Select roles',\n className = '',\n}) {\n const [openValue, setOpenValue] = useState('');\n\n const available = options.filter((opt) => {\n const val = typeof opt === 'string' ? opt : opt.value;\n return !value.includes(val);\n });\n\n const handleSelect = (e) => {\n const next = e.target.value;\n if (!next) return;\n onChange?.([...value, next]);\n setOpenValue('');\n };\n\n const handleRemove = (role) => {\n onChange?.(value.filter((r) => r !== role));\n };\n\n return (\n <div className={`ca-role-select ${className}`.trim()}>\n <FieldLabel>{label}</FieldLabel>\n <Select\n value={openValue}\n onChange={handleSelect}\n options={available}\n placeholder={placeholder}\n />\n {value.length > 0 ? (\n <div className=\"ca-tag-list\">\n {value.map((role) => (\n <Tag key={role} label={role} onRemove={() => handleRemove(role)} />\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport { FormSelect, FormTextarea } from '../../molecules/FormField';\nimport ToggleField from '../../molecules/ToggleField';\nimport RoleMultiSelect from '../../molecules/RoleMultiSelect';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_CATEGORY_TYPES, DEMO_ROLES } from '../../../data/settingsSteps';\n\nexport default function CategoryTypeStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n onNext={onNext}\n >\n <div className=\"ca-step-section\">\n <div className=\"ca-step-row ca-step-row--category\">\n <FormSelect\n label=\"Category Type\"\n className=\"ca-step-row__grow\"\n value={state.categoryType}\n onChange={(e) => update({ categoryType: e.target.value })}\n options={DEMO_CATEGORY_TYPES}\n placeholder=\"Select category type\"\n />\n <ToggleField\n checked={state.active}\n onChange={(active) => update({ active })}\n />\n </div>\n </div>\n\n <div className=\"ca-step-section\">\n <FormTextarea\n label=\"Description\"\n placeholder=\"Enter description\"\n maxLength={500}\n value={state.description}\n onChange={(e) => update({ description: e.target.value })}\n rows={5}\n />\n </div>\n\n <div className=\"ca-step-section ca-step-section--last\">\n <RoleMultiSelect\n options={DEMO_ROLES}\n value={state.roles}\n onChange={(roles) => update({ roles })}\n />\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Select from '../../atoms/Select';\nimport Input from '../../atoms/Input';\nimport Button from '../../atoms/Button';\nimport PlusIcon from '../../atoms/PlusIcon';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_ROLES } from '../../../data/settingsSteps';\n\nconst DEPARTMENT_OPTIONS = ['HR', 'Finance', 'IT', 'Operations', 'Sales'];\n\nfunction newRow() {\n return {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,\n department: '',\n subDepartment: '',\n roles: '',\n };\n}\n\nexport default function DepartmentsStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n const rows = state.departmentRows;\n\n const patchRow = (id, patch) => {\n update({\n departmentRows: rows.map((r) => (r.id === id ? { ...r, ...patch } : r)),\n });\n };\n\n const addRow = () => {\n update({ departmentRows: [...rows, newRow()] });\n };\n\n return (\n <SettingsCard title={stepMeta.title} description={stepMeta.description} onNext={onNext}>\n <div className=\"ca-dept-table\">\n <div className=\"ca-dept-table__head\">\n <div>Department</div>\n <div>Sub-department</div>\n <div>Roles</div>\n <div />\n </div>\n {rows.map((row) => (\n <div className=\"ca-dept-table__row\" key={row.id}>\n <Select\n value={row.department}\n onChange={(e) => patchRow(row.id, { department: e.target.value })}\n options={DEPARTMENT_OPTIONS}\n placeholder=\"Select or add department\"\n />\n <div className=\"ca-input-with-action\">\n <Input\n value={row.subDepartment}\n onChange={(e) => patchRow(row.id, { subDepartment: e.target.value })}\n placeholder=\"Add sub-department\"\n />\n <button\n type=\"button\"\n className=\"ca-input-with-action__btn\"\n aria-label=\"Add sub-department\"\n onClick={() => {\n if (!row.subDepartment.trim()) return;\n }}\n >\n <PlusIcon size={14} color=\"currentColor\" />\n </button>\n </div>\n <Select\n value={row.roles}\n onChange={(e) => patchRow(row.id, { roles: e.target.value })}\n options={DEMO_ROLES}\n placeholder=\"Select roles\"\n />\n <Button variant=\"link\" size=\"sm\" onClick={addRow}>\n + Add\n </Button>\n </div>\n ))}\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\n\n/**\n * Chip / quick-add pill atom.\n */\nexport default function Chip({ children, onClick, className = '', active = false }) {\n return (\n <button\n type=\"button\"\n className={`ca-chip ${active ? 'ca-chip--active' : ''} ${className}`.trim()}\n onClick={onClick}\n >\n {children}\n </button>\n );\n}\n","import React from 'react';\n\n/**\n * Radio button atom.\n */\nexport default function Radio({\n checked = false,\n onChange,\n name,\n value,\n 'aria-label': ariaLabel,\n className = '',\n}) {\n return (\n <label className={`ca-radio ${className}`.trim()}>\n <input\n type=\"radio\"\n className=\"ca-radio__input\"\n name={name}\n value={value}\n checked={checked}\n onChange={onChange}\n aria-label={ariaLabel}\n />\n <span className=\"ca-radio__mark\" />\n </label>\n );\n}\n","import React from 'react';\n\nexport default function DragHandleIcon({ size = 16, color = '#9CA3AF', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <circle cx=\"5\" cy=\"4\" r=\"1.2\" fill={color} />\n <circle cx=\"11\" cy=\"4\" r=\"1.2\" fill={color} />\n <circle cx=\"5\" cy=\"8\" r=\"1.2\" fill={color} />\n <circle cx=\"11\" cy=\"8\" r=\"1.2\" fill={color} />\n <circle cx=\"5\" cy=\"12\" r=\"1.2\" fill={color} />\n <circle cx=\"11\" cy=\"12\" r=\"1.2\" fill={color} />\n </svg>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Input from '../../atoms/Input';\nimport Button from '../../atoms/Button';\nimport Chip from '../../atoms/Chip';\nimport Select from '../../atoms/Select';\nimport Radio from '../../atoms/Radio';\nimport DragHandleIcon from '../../atoms/DragHandleIcon';\nimport FieldLabel from '../../atoms/FieldLabel';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { QUICK_PRIORITIES, PRIORITY_COLORS } from '../../../data/settingsSteps';\n\nfunction makePriority(name) {\n return {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,\n name,\n color: '',\n };\n}\n\nexport default function PrioritiesStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n const { priorityDraft, priorities, defaultPriorityId } = state;\n\n const addPriority = (name) => {\n const trimmed = (name ?? priorityDraft).trim();\n if (!trimmed) return;\n if (priorities.some((p) => p.name.toLowerCase() === trimmed.toLowerCase())) {\n update({ priorityDraft: '' });\n return;\n }\n const next = [...priorities, makePriority(trimmed)];\n update({\n priorities: next,\n priorityDraft: '',\n defaultPriorityId: defaultPriorityId ?? next[0].id,\n });\n };\n\n const patchPriority = (id, patch) => {\n update({\n priorities: priorities.map((p) => (p.id === id ? { ...p, ...patch } : p)),\n });\n };\n\n const colorOptions = PRIORITY_COLORS.map((c) => ({\n value: c.value,\n label: c.label,\n }));\n\n return (\n <SettingsCard title={stepMeta.title} description={stepMeta.description} onNext={onNext}>\n <div className=\"ca-priority-add\">\n <FieldLabel>Priorities</FieldLabel>\n <div className=\"ca-priority-add__row\">\n <Input\n value={priorityDraft}\n onChange={(e) => update({ priorityDraft: e.target.value })}\n placeholder=\"Add priority\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n addPriority();\n }\n }}\n />\n <Button variant=\"outline\" onClick={() => addPriority()}>\n + Add\n </Button>\n </div>\n <div className=\"ca-chip-row\">\n {QUICK_PRIORITIES.map((p) => (\n <Chip key={p} onClick={() => addPriority(p)}>\n + {p}\n </Chip>\n ))}\n </div>\n </div>\n\n <div className=\"ca-priority-table\">\n <div className=\"ca-priority-table__head\">\n <div>Priority</div>\n <div>Color</div>\n <div>Default</div>\n </div>\n {(priorities.length ? priorities : [makePriority('')]).map((row, index) => {\n const isPlaceholder = !priorities.length;\n return (\n <div className=\"ca-priority-table__row\" key={row.id || index}>\n <div className=\"ca-priority-table__name\">\n <DragHandleIcon />\n <Input\n value={isPlaceholder ? priorityDraft : row.name}\n onChange={(e) => {\n if (isPlaceholder) {\n update({ priorityDraft: e.target.value });\n } else {\n patchPriority(row.id, { name: e.target.value });\n }\n }}\n placeholder=\"Add priority\"\n />\n </div>\n <Select\n value={row.color}\n onChange={(e) => {\n if (!isPlaceholder) patchPriority(row.id, { color: e.target.value });\n }}\n options={colorOptions}\n placeholder=\"Select color\"\n />\n <Radio\n name=\"default-priority\"\n value={row.id}\n checked={!isPlaceholder && defaultPriorityId === row.id}\n onChange={() => !isPlaceholder && update({ defaultPriorityId: row.id })}\n aria-label=\"Default priority\"\n />\n </div>\n );\n })}\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Stepper from '../../organisms/Stepper';\nimport { FormInput, FormTextarea } from '../../molecules/FormField';\nimport Button from '../../atoms/Button';\nimport ChevronRightIcon from '../../atoms/ChevronRightIcon';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_DEPARTMENTS_TREE, WORKFLOW_SUBSTEPS } from '../../../data/settingsSteps';\n\nexport default function WorkflowStep({\n onNext,\n stepMeta,\n substep = 1,\n onSubstepChange,\n}) {\n const { state, update, updateWorkflow } = useSettingsWizard();\n const { selectedDeptNode, workflow } = state;\n\n const handleNextSubstep = () => {\n if (substep < WORKFLOW_SUBSTEPS.length) {\n onSubstepChange?.(substep + 1);\n return;\n }\n onNext?.();\n };\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n onNext={onNext}\n nextVariant=\"secondary\"\n >\n <div className=\"ca-workflow\">\n <aside className=\"ca-workflow__sidebar\">\n <h3 className=\"ca-workflow__sidebar-title\">Select Department</h3>\n <p className=\"ca-small\">Add workflow for selected department</p>\n <ul className=\"ca-dept-tree\">\n {DEMO_DEPARTMENTS_TREE.map((dept) => (\n <li key={dept.id} className=\"ca-dept-tree__group\">\n <button\n type=\"button\"\n className={`ca-dept-tree__item ${\n selectedDeptNode === dept.id ? 'ca-dept-tree__item--active' : ''\n }`}\n onClick={() => update({ selectedDeptNode: dept.id })}\n >\n {dept.name}\n </button>\n {dept.children?.length ? (\n <ul className=\"ca-dept-tree__children\">\n {dept.children.map((child) => (\n <li key={child.id}>\n <button\n type=\"button\"\n className={`ca-dept-tree__item ca-dept-tree__item--child ${\n selectedDeptNode === child.id\n ? 'ca-dept-tree__item--active'\n : ''\n }`}\n onClick={() => update({ selectedDeptNode: child.id })}\n >\n <span className=\"ca-dept-tree__branch\" aria-hidden=\"true\">\n └\n </span>\n {child.name}\n </button>\n </li>\n ))}\n </ul>\n ) : null}\n </li>\n ))}\n </ul>\n </aside>\n\n <div className=\"ca-workflow__main\">\n <Stepper\n steps={WORKFLOW_SUBSTEPS}\n currentStep={substep}\n onStepClick={onSubstepChange}\n size=\"sm\"\n className=\"ca-workflow__substepper\"\n />\n\n {substep === 1 ? (\n <div className=\"ca-workflow__form\">\n <div className=\"ca-step-row\">\n <FormInput\n className=\"ca-step-row__grow\"\n label=\"Name\"\n placeholder=\"Enter name\"\n value={workflow.name}\n onChange={(e) => updateWorkflow({ name: e.target.value })}\n />\n <FormInput\n className=\"ca-step-row__grow\"\n label=\"TAT Minutes\"\n placeholder=\"Enter here\"\n value={workflow.tatMinutes}\n onChange={(e) => updateWorkflow({ tatMinutes: e.target.value })}\n />\n </div>\n <FormTextarea\n label=\"Description\"\n placeholder=\"Enter description\"\n value={workflow.description}\n onChange={(e) => updateWorkflow({ description: e.target.value })}\n rows={5}\n />\n </div>\n ) : null}\n\n {substep === 2 ? (\n <div className=\"ca-workflow__placeholder\">\n <p className=\"ca-body\">\n Configure workflow statuses for the selected department.\n </p>\n </div>\n ) : null}\n\n {substep === 3 ? (\n <div className=\"ca-workflow__placeholder\">\n <p className=\"ca-body\">Define ordered workflow steps and assignees.</p>\n </div>\n ) : null}\n\n <div className=\"ca-workflow__actions\">\n <Button\n onClick={handleNextSubstep}\n endIcon={<ChevronRightIcon size={14} color=\"#fff\" />}\n >\n Next Step\n </Button>\n </div>\n </div>\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\n\nexport default function TrashIcon({ size = 16, color = '#9CA3AF', ...props }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" {...props}>\n <path\n d=\"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m2 0v12a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V7h12Z\"\n stroke={color}\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Input from '../../atoms/Input';\nimport Select from '../../atoms/Select';\nimport Button from '../../atoms/Button';\nimport Toggle from '../../atoms/Toggle';\nimport DragHandleIcon from '../../atoms/DragHandleIcon';\nimport TrashIcon from '../../atoms/TrashIcon';\nimport FieldLabel from '../../atoms/FieldLabel';\nimport ChevronRightIcon from '../../atoms/ChevronRightIcon';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { FIELD_LIBRARY } from '../../../data/settingsSteps';\n\nconst FIELD_TYPE_OPTIONS = FIELD_LIBRARY.map((f) => ({\n value: f.id,\n label: f.label,\n}));\n\nfunction FieldLibraryIcon({ type }) {\n const map = {\n text: 'A',\n doc: '¶',\n calendar: '口',\n clock: '◷',\n chevron: '▾',\n };\n return <span className=\"ca-field-lib__glyph\">{map[type] || '▾'}</span>;\n}\n\nexport default function FormFieldsStep({ onNext, stepMeta }) {\n const { state, update } = useSettingsWizard();\n const { fieldDraft, formFields } = state;\n\n const setDraft = (patch) => update({ fieldDraft: { ...fieldDraft, ...patch } });\n\n const addField = () => {\n if (!fieldDraft.name.trim() || !fieldDraft.type) return;\n const typeLabel =\n FIELD_TYPE_OPTIONS.find((o) => o.value === fieldDraft.type)?.label || fieldDraft.type;\n update({\n formFields: [\n ...formFields,\n {\n id: `${Date.now()}`,\n name: fieldDraft.name.trim(),\n type: fieldDraft.type,\n typeLabel,\n required: false,\n },\n ],\n fieldDraft: { name: '', type: '' },\n });\n };\n\n const patchField = (id, patch) => {\n update({\n formFields: formFields.map((f) => (f.id === id ? { ...f, ...patch } : f)),\n });\n };\n\n const removeField = (id) => {\n update({ formFields: formFields.filter((f) => f.id !== id) });\n };\n\n const applyLibraryType = (item) => {\n setDraft({ type: item.id });\n };\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n showNext={false}\n footer={\n <Button\n onClick={onNext}\n endIcon={<ChevronRightIcon size={14} color=\"#fff\" />}\n >\n Next\n </Button>\n }\n >\n <div className=\"ca-form-fields\">\n <aside className=\"ca-field-lib\">\n <h3 className=\"ca-field-lib__title\">Field Library</h3>\n <p className=\"ca-small\">Drag and drop the fields to add.</p>\n <ul className=\"ca-field-lib__list\">\n {FIELD_LIBRARY.map((item) => (\n <li key={item.id}>\n <button\n type=\"button\"\n className=\"ca-field-lib__item\"\n draggable\n onDragStart={(e) => {\n e.dataTransfer.setData('text/plain', item.id);\n }}\n onClick={() => applyLibraryType(item)}\n >\n <FieldLibraryIcon type={item.icon} />\n <span>{item.label}</span>\n </button>\n </li>\n ))}\n </ul>\n </aside>\n\n <div className=\"ca-form-fields__main\">\n <div\n className=\"ca-add-fields\"\n onDragOver={(e) => e.preventDefault()}\n onDrop={(e) => {\n e.preventDefault();\n const type = e.dataTransfer.getData('text/plain');\n if (type) setDraft({ type });\n }}\n >\n <div className=\"ca-add-fields__top\">\n <h3 className=\"ca-add-fields__title\">Add Fields</h3>\n <Button onClick={addField}>Add Field</Button>\n </div>\n <div className=\"ca-step-row\">\n <div className=\"ca-step-row__grow\">\n <FieldLabel>Name of Field</FieldLabel>\n <Input\n value={fieldDraft.name}\n onChange={(e) => setDraft({ name: e.target.value })}\n placeholder=\"Enter name of the field.\"\n />\n </div>\n <div className=\"ca-step-row__grow\">\n <FieldLabel>Type of Field</FieldLabel>\n <Select\n value={fieldDraft.type}\n onChange={(e) => setDraft({ type: e.target.value })}\n options={FIELD_TYPE_OPTIONS}\n placeholder=\"Select type of the field.\"\n />\n </div>\n </div>\n </div>\n\n <div className=\"ca-fields-table\">\n <div className=\"ca-fields-table__head\">\n <div>Field Name</div>\n <div>Field Type</div>\n <div>Required</div>\n <div />\n </div>\n {formFields.length === 0 ? (\n <div className=\"ca-fields-table__empty\">\n <p className=\"ca-small\">No fields added yet.</p>\n </div>\n ) : (\n formFields.map((field) => (\n <div className=\"ca-fields-table__row\" key={field.id}>\n <div className=\"ca-fields-table__name\">\n <DragHandleIcon />\n <Input\n value={field.name}\n onChange={(e) => patchField(field.id, { name: e.target.value })}\n />\n </div>\n <Select\n value={field.type}\n onChange={(e) => {\n const type = e.target.value;\n const typeLabel =\n FIELD_TYPE_OPTIONS.find((o) => o.value === type)?.label || type;\n patchField(field.id, { type, typeLabel });\n }}\n options={FIELD_TYPE_OPTIONS}\n placeholder=\"Select type\"\n />\n <Toggle\n checked={field.required}\n onChange={(required) => patchField(field.id, { required })}\n aria-label=\"Required\"\n />\n <button\n type=\"button\"\n className=\"ca-icon-btn\"\n aria-label=\"Delete field\"\n onClick={() => removeField(field.id)}\n >\n <TrashIcon />\n </button>\n </div>\n ))\n )}\n </div>\n </div>\n </div>\n </SettingsCard>\n );\n}\n","import React from 'react';\nimport SettingsCard from '../../organisms/SettingsCard';\nimport Button from '../../atoms/Button';\nimport { BodyText, LabelText, Heading2 } from '../../atoms/Typography';\nimport StatusBadge from '../../atoms/StatusBadge';\nimport { useSettingsWizard } from '../../../context/SettingsWizardContext';\nimport { DEMO_CATEGORY_TYPES } from '../../../data/settingsSteps';\n\nexport default function ReviewPublishStep({ onPublish, stepMeta }) {\n const { state } = useSettingsWizard();\n const categoryLabel =\n DEMO_CATEGORY_TYPES.find((c) => c.value === state.categoryType)?.label ||\n state.categoryType;\n\n return (\n <SettingsCard\n title={stepMeta.title}\n description={stepMeta.description}\n nextLabel=\"Publish\"\n onNext={onPublish}\n >\n <div className=\"ca-review\">\n <section className=\"ca-review__block\">\n <Heading2>Category Type</Heading2>\n <div className=\"ca-review__row\">\n <LabelText>{categoryLabel}</LabelText>\n <StatusBadge status={state.active ? 'active' : 'inactive'} />\n </div>\n {state.description ? <BodyText>{state.description}</BodyText> : null}\n {state.roles.length ? (\n <BodyText>Roles: {state.roles.join(', ')}</BodyText>\n ) : null}\n </section>\n\n <section className=\"ca-review__block\">\n <Heading2>Departments</Heading2>\n <BodyText>\n {state.departmentRows.filter((r) => r.department).length} department row(s)\n configured\n </BodyText>\n </section>\n\n <section className=\"ca-review__block\">\n <Heading2>Priorities</Heading2>\n <BodyText>\n {state.priorities.length\n ? state.priorities.map((p) => p.name).join(', ')\n : 'No priorities added'}\n </BodyText>\n </section>\n\n <section className=\"ca-review__block\">\n <Heading2>Workflow</Heading2>\n <BodyText>\n {state.workflow.name\n ? `${state.workflow.name} (TAT: ${state.workflow.tatMinutes || '—'} min)`\n : 'No workflow created yet'}\n </BodyText>\n </section>\n\n <section className=\"ca-review__block ca-review__block--last\">\n <Heading2>Form Fields</Heading2>\n <BodyText>\n {state.formFields.length\n ? state.formFields.map((f) => f.name).join(', ')\n : 'No form fields added'}\n </BodyText>\n </section>\n\n <div className=\"ca-workflow__actions\">\n <Button onClick={onPublish}>Publish</Button>\n </div>\n </div>\n </SettingsCard>\n );\n}\n","import React, { useMemo, useCallback, useEffect } from 'react';\nimport { useNavigate, useParams, useSearchParams } from 'react-router-dom';\nimport { Heading1 } from '../components/atoms/Typography';\nimport Stepper from '../components/organisms/Stepper';\nimport { SettingsWizardProvider } from '../context/SettingsWizardContext';\nimport { SETTINGS_STEPS } from '../data/settingsSteps';\nimport CategoryTypeStep from '../components/organisms/settings-steps/CategoryTypeStep';\nimport DepartmentsStep from '../components/organisms/settings-steps/DepartmentsStep';\nimport PrioritiesStep from '../components/organisms/settings-steps/PrioritiesStep';\nimport WorkflowStep from '../components/organisms/settings-steps/WorkflowStep';\nimport FormFieldsStep from '../components/organisms/settings-steps/FormFieldsStep';\nimport ReviewPublishStep from '../components/organisms/settings-steps/ReviewPublishStep';\n\nfunction clampStep(value) {\n const n = Number(value);\n if (!Number.isFinite(n) || n < 1) return 1;\n if (n > SETTINGS_STEPS.length) return SETTINGS_STEPS.length;\n return Math.floor(n);\n}\n\nfunction clampSubstep(value) {\n const n = Number(value);\n if (!Number.isFinite(n) || n < 1) return 1;\n if (n > 3) return 3;\n return Math.floor(n);\n}\n\n/**\n * Complaint Management Settings wizard.\n * Step navigation is driven by URL search params: ?step=2&substep=1\n */\nexport default function ComplaintSettingsPage({\n title = 'Complaint Management Settings',\n onPublish,\n onStepChange,\n}) {\n const navigate = useNavigate();\n const { systemId } = useParams();\n const [searchParams, setSearchParams] = useSearchParams();\n\n const step = clampStep(searchParams.get('step') || 1);\n const substep = clampSubstep(searchParams.get('substep') || 1);\n\n // Keep URL in sync when step param is missing (e.g. /settings/qms → ?step=1)\n useEffect(() => {\n if (!searchParams.get('step')) {\n const params = new URLSearchParams(searchParams);\n params.set('step', '1');\n setSearchParams(params, { replace: true });\n }\n }, [searchParams, setSearchParams]);\n\n const stepMeta = useMemo(\n () => SETTINGS_STEPS.find((s) => s.id === step) || SETTINGS_STEPS[0],\n [step],\n );\n\n const setStep = useCallback(\n (nextStep, nextSubstep) => {\n const params = new URLSearchParams(searchParams);\n params.set('step', String(nextStep));\n if (nextStep === 4) {\n params.set('substep', String(nextSubstep ?? (nextStep === step ? substep : 1)));\n } else {\n params.delete('substep');\n }\n setSearchParams(params, { replace: false });\n onStepChange?.({ systemId, step: nextStep, substep: nextSubstep });\n },\n [searchParams, setSearchParams, onStepChange, systemId, step, substep],\n );\n\n const goNext = () => {\n if (step < SETTINGS_STEPS.length) {\n setStep(step + 1, 1);\n }\n };\n\n const handleSubstepChange = (next) => {\n setStep(4, next);\n };\n\n const handlePublish = () => {\n onPublish?.({ systemId, step });\n };\n\n return (\n <SettingsWizardProvider key={systemId || 'new'}>\n <div className=\"ca-settings-page\">\n <Heading1>{title}</Heading1>\n\n <Stepper\n steps={SETTINGS_STEPS}\n currentStep={step}\n onStepClick={(id) => setStep(id, id === 4 ? 1 : undefined)}\n className=\"ca-settings-page__stepper\"\n />\n\n {step === 1 ? (\n <CategoryTypeStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 2 ? (\n <DepartmentsStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 3 ? (\n <PrioritiesStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 4 ? (\n <WorkflowStep\n onNext={goNext}\n stepMeta={stepMeta}\n substep={substep}\n onSubstepChange={handleSubstepChange}\n />\n ) : null}\n {step === 5 ? (\n <FormFieldsStep onNext={goNext} stepMeta={stepMeta} />\n ) : null}\n {step === 6 ? (\n <ReviewPublishStep onPublish={handlePublish} stepMeta={stepMeta} />\n ) : null}\n\n <button\n type=\"button\"\n className=\"ca-back-link\"\n onClick={() => navigate('/')}\n >\n ← Back to Complaint Management\n </button>\n </div>\n </SettingsWizardProvider>\n );\n}\n","import { Route, Routes } from 'react-router-dom';\nimport ComplaintManagementPage from '../pages/ComplaintManagementPage';\nimport ComplaintSettingsPage from '../pages/ComplaintSettingsPage';\n\nfunction ComplaintRouter({ pageProps, onPublish, onStepChange, children }) {\n const managementPage = children ?? <ComplaintManagementPage {...pageProps} />;\n\n return (\n <Routes>\n <Route path=\"/\" element={managementPage} />\n <Route\n path=\"/settings/:systemId\"\n element={\n <ComplaintSettingsPage\n onPublish={onPublish}\n onStepChange={onStepChange}\n />\n }\n />\n <Route path=\"*\" element={managementPage} />\n </Routes>\n );\n}\n\nexport default ComplaintRouter;\n","import ComplaintRouter from './router';\n\nfunction App({ pageProps, onPublish, onStepChange, children }) {\n return (\n <ComplaintRouter\n pageProps={pageProps}\n onPublish={onPublish}\n onStepChange={onStepChange}\n >\n {children}\n </ComplaintRouter>\n );\n}\n\nexport default App;\n","import React, { useContext } from 'react';\nimport { BrowserRouter, useInRouterContext } from 'react-router-dom';\nimport {\n Provider as ReduxProvider,\n ReactReduxContext,\n} from 'react-redux';\nimport { ApiProvider } from './context/ApiContext';\nimport { ThemeProvider, useTheme } from './context/ThemeContext';\nimport defaultStore from './redux/store';\nimport App from './App';\nimport './styles/index.css';\n\nfunction ThemedShell({ children }) {\n const { cssVars, darkMode, mode } = useTheme();\n\n return (\n <div\n className={`ca-root ${darkMode ? 'ca-root--dark' : 'ca-root--light'}`}\n data-ca-theme={mode}\n style={cssVars}\n >\n {children}\n </div>\n );\n}\n\nfunction OptionalRouter({ basePath, children }) {\n const hasParentRouter = useInRouterContext();\n\n if (hasParentRouter) return children;\n return <BrowserRouter basename={basePath}>{children}</BrowserRouter>;\n}\n\nfunction OptionalReduxProvider({ store, children }) {\n const parentRedux = useContext(ReactReduxContext);\n\n // Reuse the parent's provider by default. An explicit store remains useful\n // for isolation, while the package store keeps standalone previews working.\n if (!store && parentRedux?.store) return children;\n return <ReduxProvider store={store || defaultStore}>{children}</ReduxProvider>;\n}\n\n/**\n * Root package component — mount inside the parent app.\n *\n * Theme & dark mode are parent-controlled:\n * <ComplaintApp theme={brandTheme} darkMode={parentIsDark} />\n */\nconst ComplaintApp = ({\n apiUrl,\n authToken,\n store,\n basePath = '/',\n theme,\n darkMode = false,\n title,\n description,\n systems,\n systemsEndpoint,\n useDemoData = true,\n createLabel,\n onCreateForm,\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n onSearch,\n onPublish,\n onStepChange,\n children,\n}) => {\n const pageProps = {\n title,\n description,\n systems,\n systemsEndpoint,\n useDemoData,\n createLabel,\n onCreateForm,\n onConfigure,\n onTitleClick,\n onDescriptionClick,\n onSearch,\n };\n\n return (\n <ThemeProvider theme={theme} darkMode={darkMode}>\n <OptionalReduxProvider store={store}>\n <ThemedShell>\n <ApiProvider apiUrl={apiUrl} authToken={authToken}>\n <OptionalRouter basePath={basePath}>\n <App\n pageProps={pageProps}\n onPublish={onPublish}\n onStepChange={onStepChange}\n >\n {children}\n </App>\n </OptionalRouter>\n </ApiProvider>\n </ThemedShell>\n </OptionalReduxProvider>\n </ThemeProvider>\n );\n};\n\nexport default ComplaintApp;\n","import { lightTheme } from './defaultTheme';\n\n/** @deprecated Prefer `lightTheme` / `darkTheme` from `./defaultTheme`. */\nexport const colors = lightTheme.colors;\nexport const radii = lightTheme.radii;\nexport const spacing = lightTheme.spacing;\nexport const typography = lightTheme.typography;\n"],"names":["_extends","n","e","t","Action","PopStateEventType","createBrowserHistory","options","createBrowserLocation","window","globalHistory","pathname","search","hash","createLocation","createBrowserHref","to","createPath","getUrlBasedHistory","invariant","value","message","warning","cond","createKey","getHistoryState","location","index","current","state","key","parsePath","_ref","path","parsedPath","hashIndex","searchIndex","getLocation","createHref","validateLocation","v5Compat","action","listener","getIndex","handlePop","nextIndex","delta","history","push","historyState","url","error","replace","createURL","base","href","fn","ResultType","matchRoutes","routes","locationArg","basename","matchRoutesImpl","allowPartial","stripBasename","branches","flattenRoutes","rankRouteBranches","matches","decoded","decodePath","i","matchRouteBranch","parentsMeta","parentPath","flattenRoute","route","relativePath","meta","joinPaths","routesMeta","computeScore","_route$path","exploded","explodeOptionalSegments","segments","first","rest","isOptional","required","restExploded","result","subpath","a","b","compareIndexes","paramRe","dynamicSegmentValue","indexRouteValue","emptySegmentValue","staticSegmentValue","splatPenalty","isSplat","s","initialScore","score","segment","branch","matchedParams","matchedPathname","end","remainingPathname","match","matchPath","normalizePathname","pattern","matcher","compiledParams","compilePath","pathnameBase","captureGroups","memo","paramName","splatValue","caseSensitive","params","regexpSource","_","v","startIndex","nextChar","ABSOLUTE_URL_REGEX$1","isAbsoluteUrl","resolvePath","fromPathname","toPathname","oldPathname","removeDoubleSlashes","resolvePathname","normalizeSearch","normalizeHash","getInvalidPathError","char","field","dest","getPathContributingMatches","getResolveToMatches","v7_relativeSplatPath","pathMatches","idx","resolveTo","toArg","routePathnames","locationPathname","isPathRelative","isEmptyPath","from","routePathnameIndex","toSegments","hasExplicitTrailingSlash","hasCurrentTrailingSlash","paths","isRouteErrorResponse","validMutationMethodsArr","validRequestMethodsArr","DataRouterContext","React","DataRouterStateContext","AwaitContext","NavigationContext","LocationContext","RouteContext","RouteErrorContext","useHref","_temp","relative","useInRouterContext","UNSAFE_invariant","navigator","useResolvedPath","joinedPathname","useLocation","navigateEffectWarning","useIsomorphicLayoutEffect","cb","useNavigate","isDataRoute","useNavigateStable","useNavigateUnstable","dataRouterContext","future","routePathnamesJson","UNSAFE_getResolveToMatches","activeRef","UNSAFE_warning","useParams","routeMatch","_temp2","useRoutes","useRoutesImpl","dataRouterState","parentMatches","parentParams","parentPathname","parentPathnameBase","parentRoute","warningOnce","locationFromContext","_parsedLocationArg$pa","parsedLocationArg","parentSegments","renderedMatches","_renderMatches","DefaultErrorComponent","useRouteError","stack","lightgrey","preStyles","codeStyles","devInfo","defaultErrorElement","RenderErrorBoundary","props","errorInfo","RenderedRoute","routeContext","children","_dataRouterState","_future","errors","errorIndex","m","renderFallback","fallbackIndex","loaderData","needsToRunLoader","outlet","shouldRenderHydrateFallback","errorElement","hydrateFallbackElement","getChildren","DataRouterHook","DataRouterStateHook","getDataRouterConsoleError","hookName","useDataRouterContext","ctx","useDataRouterState","useRouteContext","useCurrentRouteId","thisRoute","useRouteId","_state$errors","routeId","router","id","alreadyWarned$1","alreadyWarned","warnOnce","logDeprecation","flag","msg","link","logV6DeprecationWarnings","renderFuture","routerFuture","Route","_props","Router","_ref5","basenameProp","locationProp","navigationType","staticProp","navigationContext","locationContext","trailingPathname","Routes","_ref6","createRoutesFromChildren","element","treePath","_objectWithoutPropertiesLoose","r","defaultMethod","defaultEncType","isHtmlElement","object","isButtonElement","isFormElement","isInputElement","isModifiedEvent","event","shouldProcessLinkClick","target","createSearchParams","init","getSearchParamsForLocation","locationSearch","defaultSearchParams","searchParams","_formDataSupportsSubmitter","isFormDataSubmitterSupported","supportedFormEncTypes","getFormEncType","encType","getFormSubmissionInfo","method","formData","body","attr","form","name","type","prefix","_excluded","_excluded2","_excluded3","REACT_ROUTER_VERSION","ViewTransitionContext","FetchersContext","START_TRANSITION","startTransitionImpl","BrowserRouter","_ref4","historyRef","setStateImpl","v7_startTransition","setState","newState","UNSAFE_logV6DeprecationWarnings","isBrowser","ABSOLUTE_URL_REGEX","Link","_ref7","ref","onClick","reloadDocument","preventScrollReset","viewTransition","UNSAFE_NavigationContext","absoluteHref","isExternal","currentUrl","targetUrl","internalOnClick","useLinkClickHandler","handleClick","NavLink","_ref8","ariaCurrentProp","classNameProp","styleProp","routerState","UNSAFE_DataRouterStateContext","isTransitioning","useViewTransitionState","nextLocationPathname","endSlashPosition","isActive","isPending","renderProps","ariaCurrent","className","style","Form","_ref9","forwardedRef","fetcherKey","navigate","onSubmit","submit","useSubmit","formAction","useFormAction","formMethod","submitHandler","submitter","submitMethod","UNSAFE_DataRouterContext","replaceProp","useSearchParams","defaultInit","defaultSearchParamsRef","hasSetSearchParamsRef","setSearchParams","nextInit","navigateOptions","newSearchParams","validateClientSideSubmission","fetcherId","getUniqueFetcherId","currentRouteId","UNSAFE_useRouteId","UNSAFE_RouteContext","indexValues","qs","opts","vtContext","currentPath","nextPath","bind","thisArg","toString","getPrototypeOf","iterator","toStringTag","hasOwnProperty","obj","prop","hasOwnInPrototypeChain","thing","seen","getSafeProp","kindOf","cache","str","kindOfTest","typeOfTest","isArray","isUndefined","isBuffer","val","isFunction","isArrayBuffer","isArrayBufferView","isString","isNumber","isObject","isBoolean","isPlainObject","prototype","isEmptyObject","isDate","isFile","isReactNativeBlob","isReactNative","isBlob","isFileList","isSet","isStream","getGlobal","G","FormDataCtor","isFormData","proto","kind","isURLSearchParams","isReadableStream","isRequest","isResponse","isHeaders","trim","forEach","allOwnKeys","l","keys","len","findKey","_key","_global","isContextDefined","context","merge","objs","caseless","skipUndefined","assignValue","targetKey","existing","source","symbols","j","symbol","propertyIsEnumerable","extend","stripBOM","content","inherits","constructor","superConstructor","descriptors","toFlatObject","sourceObj","destObj","filter","propFilter","merged","endsWith","searchString","position","lastIndex","toArray","arr","isTypedArray","TypedArray","forEachEntry","_iterator","pair","matchAll","regExp","isHTMLForm","toCamelCase","p1","p2","isRegExp","reduceDescriptors","reducer","reducedDescriptors","descriptor","ret","freezeMethods","toObjectSet","arrayOrString","delimiter","define","noop","toFiniteNumber","defaultValue","isSpecCompliantForm","toJSONObject","visited","visit","reducedValue","isAsyncFn","isThenable","_setImmediate","setImmediateSupported","postMessageSupported","token","callbacks","data","asap","isIterable","isSafeIterable","utils$1","ignoreDuplicateOf","utils","parseHeaders","rawHeaders","parsed","line","hasKey","trimSPorHTAB","start","code","INVALID_UNICODE_HEADER_VALUE_CHARS","INVALID_BYTE_STRING_HEADER_VALUE_CHARS","sanitizeValue","invalidChars","item","sanitizeHeaderValue","sanitizeByteStringHeaderValue","toByteStringHeaderObject","headers","byteStringHeaders","header","$internals","normalizeHeader","normalizeValue","parseTokens","tokens","tokensRE","parameterNameRE","trimOWS","decodeQuotedString","last","parseParameters","parameters","quoted","escaped","parseParameter","part","equals","normalizedName","parameterValue","isValidHeaderName","matchHeaderValue","isHeaderNameFilter","formatHeader","w","buildAccessors","accessorName","methodName","arg1","arg2","arg3","AxiosHeaders$1","valueOrRewrite","rewrite","self","setHeader","_value","_header","_rewrite","lHeader","setHeaders","entry","parser","deleted","deleteHeader","format","normalized","targets","asStrings","computed","accessors","defineAccessor","AxiosHeaders","mapped","headerValue","REDACTED","hasOwnOrPrototypeToJSON","redactConfig","config","redactKeys","lowerKeys","k","stringifySafely","aggregateErrorMessage","AxiosError","request","response","customProps","axiosError","serializedConfig","httpAdapter","DEFAULT_FORM_DATA_MAX_DEPTH","isVisitable","removeBrackets","renderKey","dots","isFlatArray","predicates","toFormData","option","metaTokens","visitor","defaultVisitor","indexes","_Blob","maxDepth","useBlob","convertValue","throwIfMaxDepthExceeded","depth","stringifyWithDepthLimit","ancestors","currentValue","el","exposedHelpers","build","encode","charMap","AxiosURLSearchParams","encoder","_encode","buildURL","_options","serializeFn","serializedParams","hashmarkIndex","InterceptorManager","fulfilled","rejected","h","transitionalDefaults","URLSearchParams$1","FormData$1","Blob$1","platform$1","URLSearchParams","FormData","Blob","hasBrowserEnv","_navigator","hasStandardBrowserEnv","hasStandardBrowserWebWorkerEnv","origin","platform","toURLEncodedForm","helpers","MAX_DEPTH","throwIfDepthExceeded","parsePropPath","arrayToObject","formDataToJSON","buildPath","isNumericKey","isLast","own","rawValue","defaults","contentType","hasJSONContentType","isObjectPayload","formSerializer","env","_FormData","transitional","forcedJSONParsing","responseType","JSONRequested","strictJSONParsing","status","transformData","fns","isCancel","settle","resolve","reject","validateStatus","parseProtocol","speedometer","samplesCount","min","bytes","timestamps","head","tail","firstSampleTS","chunkLength","now","startedAt","bytesCount","passed","throttle","freq","timestamp","threshold","lastArgs","timer","invoke","args","progressEventReducer","isDownloadStream","bytesNotified","_speedometer","rawLoaded","total","loaded","progressBytes","rate","progressEventDecorator","throttled","lengthComputable","asyncDecorator","scheduler","isURLSameOrigin","isMSIE","cookies","expires","domain","secure","sameSite","cookie","eq","isAbsoluteURL","combineURLs","baseURL","relativeURL","malformedHttpProtocol","httpProtocolControlCharacters","stripLeadingC0ControlOrSpace","normalizeURLForProtocolCheck","redactFragment","fragment","separator","parameterName","redactSensitiveURLParts","redactedURL","fragmentIndex","redactedURLWithoutFragment","assertValidHttpProtocolURL","normalizedURL","buildFullPath","requestedURL","allowAbsoluteUrls","isRelativeUrl","headersToObject","ownEnumerableKeys","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","getMergedTransitionalOption","transitional2","transitional1","mergeDirectKeys","mergeMap","configValue","FORM_DATA_CONTENT_HEADERS","setFormDataHeaders","formHeaders","policy","encodeUTF8","hex","resolveConfig","newConfig","withXSRFToken","xsrfHeaderName","xsrfCookieName","auth","username","password","xsrfValue","isXHRAdapterSupported","xhrAdapter","_config","requestData","requestHeaders","onUploadProgress","onDownloadProgress","onCanceled","uploadThrottled","downloadThrottled","flushUpload","flushDownload","done","onloadend","responseHeaders","err","timeoutErrorMessage","cancel","CanceledError","protocol","composeSignals","signals","timeout","controller","aborted","onabort","reason","unsubscribe","signal","streamChunk","chunk","chunkSize","pos","readBytes","iterable","readStream","stream","reader","trackStream","onProgress","onFinish","_onFinish","loadedBytes","isHexDigit","charCode","isPercentEncodedByte","hexValue","isBase64Char","isBase64Whitespace","base64Bytes","significant","groups","remainder","estimateBase64BufferAllocation","padding","estimatePercentDecodedBase64Bytes","invalid","estimateDataURLBytes","estimateBase64","comma","c","next","estimateDataURLDecodedBytes","VERSION","DEFAULT_CHUNK_SIZE","decodeURIComponentSafe","test","maybeWithAuthCredentials","protocolIndex","urlToCheck","factory","globalObject","ReadableStream","TextEncoder","envFetch","Request","Response","isFetchSupported","isRequestSupported","isResponseSupported","isReadableStreamSupported","encodeText","supportsRequestStream","duplexAccessed","hasContentType","supportsResponseStream","resolvers","res","getBodyLength","resolveBodyLength","length","cancelToken","withCredentials","fetchOptions","maxContentLength","maxBodyLength","hasMaxContentLength","hasMaxBodyLength","_fetch","composedSignal","requestContentLength","pendingBodyError","maxBodyLengthError","configAuth","parsedURL","urlUsername","urlPassword","outboundLength","mustEnforceStreamBody","trackRequestStream","flush","_request","contentTypeHeader","isCredentialsSupported","resolvedOptions","declaredLength","isStreamResponse","responseContentLength","bytesRead","onChunkProgress","responseData","materializedSize","canceledError","networkError","seedCache","getFetch","fetch","seeds","seed","map","knownAdapters","fetchAdapter.getFetch","renderReason","isResolvedHandle","adapter","getAdapter","adapters","nameOrAdapter","rejectedReasons","reasons","throwIfCancellationRequested","dispatchRequest","validators","deprecatedWarnings","validator","version","formatMessage","opt","desc","correctSpelling","assertOptions","schema","allowUnknown","Axios$1","instanceConfig","configOrUrl","dummy","firstNewlineIndex","secondNewlineIndex","stackWithoutTwoTopLines","paramsSerializer","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","responseInterceptorChain","promise","chain","onFulfilled","onRejected","rejectedResult","rejectedError","fullPath","Axios","generateHTTPMethod","isForm","CancelToken$1","CancelToken","executor","resolvePromise","onfulfilled","_resolve","abort","spread","callback","isAxiosError","payload","HttpStatusCode","createInstance","defaultConfig","instance","axios","promises","all","Cancel","formToJSON","create","assign","defaultConverter","converter","defaultAttributes","set","attributes","stringifiedAttributes","attributeName","get","jar","parts","found","api","BASE_URL_VALUE","AUTH_TOKEN_VALUE","__vite_import_meta_env__","nodeProcess","setBaseUrl","setAuthToken","getAccessToken","Cookies","accessToken","isRefreshing","refreshTokenPromise","originalRequest","refreshToken","refreshResponse","newToken","newRefreshToken","ApiContext","createContext","ApiProvider","apiUrl","authToken","jsx","lightTheme","darkTheme","defaultThemeFile","deepMerge","override","normalizeThemeFile","themeProp","resolveActiveTheme","themeFile","darkMode","pack","COLOR_VAR_MAP","RADIUS_VAR_MAP","TYPE_VAR_MAP","SHADOW_VAR_MAP","themeToCssVars","theme","vars","cssVar","ThemeContext","ThemeProvider","useMemo","active","cssVars","useTheme","useContext","COMPLAINT_ENDPOINTS","rejectRequest","thunkApi","handler","createAsyncThunk","resourceActions","resource","endpoint","complaintTypeActions","complaintDepartmentActions","complaintPriorityActions","complaintWorkflowActions","complaintStatusActions","getDepartmentTree","_params","getWorkflowSteps","workflowId","saveWorkflowSteps","deleteWorkflowSteps","getComplaintTypes","getComplaintTypeById","createComplaintType","updateComplaintType","deleteComplaintType","getComplaintDepartments","getComplaintDepartmentById","createComplaintDepartment","updateComplaintDepartment","deleteComplaintDepartment","getComplaintPriorities","getComplaintPriorityById","createComplaintPriority","updateComplaintPriority","deleteComplaintPriority","getComplaintWorkflows","getComplaintWorkflowById","createComplaintWorkflow","updateComplaintWorkflow","deleteComplaintWorkflow","getComplaintStatuses","getComplaintStatusById","createComplaintStatus","updateComplaintStatus","deleteComplaintStatus","createResourceState","initialState","unwrapList","unwrapEntity","entityId","entity","upsert","items","errorMessage","registerResource","builder","actions","actionCreator","deletedId","complaintSlice","createSlice","clearComplaintError","clearSelectedComplaintResource","resetComplaintState","complaintAppComplaint","rootReducer","combineReducers","createComplaintStore","preloadedState","configureStore","getDefaultMiddleware","store","Button","variant","size","startIcon","endIcon","disabled","classes","jsxs","PlusIcon","color","VARIANT_CLASS","VARIANT_TAG","Typography","as","Tag","baseClass","Heading1","Heading2","BodyText","LabelText","ValueText","LinkText","PageHeader","title","description","actionLabel","onAction","StatusBadge","label","text","CardHeader","statusLabel","titleAsLink","onTitleClick","ChevronRightIcon","CardFooter","updatedOn","configureLabel","onConfigure","DataPoint","display","Divider","SystemCard","descriptionHref","departments","workflows","fields","formsFilled","onDescriptionClick","handleConfigure","handleDescription","stats","stat","SystemCardGrid","systems","emptyMessage","system","Input","onChange","placeholder","icon","inputClassName","SearchIcon","SearchBar","onSearch","handleKeyDown","Loading","fullScreen","DEMO_SYSTEMS","DEFAULT_PAGE_DESCRIPTION","normalizeSystems","list","ComplaintManagementPage","systemsProp","systemsEndpoint","useDemoData","createLabel","onCreateForm","setSearch","useState","fetchedSystems","setFetchedSystems","fetchError","setFetchError","fetchStatus","setFetchStatus","useEffect","sourceSystems","filteredSystems","q","Fragment","Stepper","steps","currentStep","onStepClick","step","stepId","isDone","clickable","SettingsWizardContext","createEmptyWizardState","SettingsWizardProvider","initialValues","update","useCallback","patch","prev","updateWorkflow","useSettingsWizard","SETTINGS_STEPS","WORKFLOW_SUBSTEPS","QUICK_PRIORITIES","FIELD_LIBRARY","DEMO_ROLES","DEMO_CATEGORY_TYPES","DEMO_DEPARTMENTS_TREE","PRIORITY_COLORS","LayersIcon","SettingsCardHeader","nextLabel","onNext","showNext","nextDisabled","nextVariant","SettingsCard","footer","FieldLabel","hint","htmlFor","ChevronDownIcon","Select","Textarea","maxLength","rows","FormField","FormInput","inputProps","FormSelect","selectProps","FormTextarea","textareaProps","computedHint","Toggle","checked","ariaLabel","ToggleField","CloseIcon","onRemove","RoleMultiSelect","openValue","setOpenValue","available","handleSelect","handleRemove","role","CategoryTypeStep","stepMeta","roles","DEPARTMENT_OPTIONS","newRow","DepartmentsStep","patchRow","addRow","row","Chip","Radio","DragHandleIcon","makePriority","PrioritiesStep","priorityDraft","priorities","defaultPriorityId","addPriority","trimmed","p","patchPriority","colorOptions","isPlaceholder","WorkflowStep","substep","onSubstepChange","selectedDeptNode","workflow","handleNextSubstep","dept","child","TrashIcon","FIELD_TYPE_OPTIONS","f","FieldLibraryIcon","FormFieldsStep","fieldDraft","formFields","setDraft","addField","typeLabel","o","patchField","removeField","applyLibraryType","ReviewPublishStep","onPublish","categoryLabel","clampStep","clampSubstep","ComplaintSettingsPage","onStepChange","systemId","setStep","nextStep","nextSubstep","goNext","ComplaintRouter","pageProps","managementPage","App","ThemedShell","mode","OptionalRouter","basePath","OptionalReduxProvider","parentRedux","ReactReduxContext","ReduxProvider","defaultStore","ComplaintApp","colors","radii","spacing","typography"],"mappings":";;;;;;AAUA,SAASA,KAAW;AAClB,SAAOA,KAAW,OAAO,SAAS,OAAO,OAAO,KAAI,IAAK,SAAUC,GAAG;AACpE,aAASC,IAAI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A,cAAAL;AAAA,MACA,oBAAAe;AAAA,MACA,UAAAgB;AAAA,IAAA;AAAA,IAWY,WAAAyI;AAAA,IACA,cAAAK;AAAA,IAEC,UAAA9lC;AAAA,EAAA;AAAA,EACH,CACF,EAAA,CACF,GACF,EAAA,CACF,EAAA,CACF,GClGSknC,KAASnU,GAAW,QACpBoU,KAAQpU,GAAW,OACnBqU,KAAUrU,GAAW,SACrBsU,KAAatU,GAAW;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,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,51,52,53,54,55,56]}
|