From b63033fe861aa35d784b5a536d09b6fae6522ec4 Mon Sep 17 00:00:00 2001 From: dehall Date: Wed, 26 Jun 2024 11:54:45 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20syntheti?= =?UTF-8?q?chealth/spt@2fd7da09c2c0305e887ae20871eab3001664caf1=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/bundle.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/js/bundle.js b/js/bundle.js index 85d2e51..4bb56af 100644 --- a/js/bundle.js +++ b/js/bundle.js @@ -775,7 +775,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createFilterOptions: () => (/* reexport safe */ _mui_base__WEBPACK_IMPORTED_MODULE_19__.createFilterOptions),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_24__);\n/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! clsx */ \"./node_modules/clsx/dist/clsx.mjs\");\n/* harmony import */ var _mui_utils_integerPropType__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @mui/utils/integerPropType */ \"./node_modules/@mui/utils/integerPropType/integerPropType.js\");\n/* harmony import */ var _mui_utils_chainPropTypes__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! @mui/utils/chainPropTypes */ \"./node_modules/@mui/utils/chainPropTypes/chainPropTypes.js\");\n/* harmony import */ var _mui_base__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @mui/base */ \"./node_modules/@mui/base/useAutocomplete/useAutocomplete.js\");\n/* harmony import */ var _mui_utils_composeClasses__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @mui/utils/composeClasses */ \"./node_modules/@mui/utils/composeClasses/composeClasses.js\");\n/* harmony import */ var _mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @mui/system/colorManipulator */ \"./node_modules/@mui/system/colorManipulator.js\");\n/* harmony import */ var _Popper__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Popper */ \"./node_modules/@mui/material/Popper/Popper.js\");\n/* harmony import */ var _ListSubheader__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../ListSubheader */ \"./node_modules/@mui/material/ListSubheader/ListSubheader.js\");\n/* harmony import */ var _Paper__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Paper */ \"./node_modules/@mui/material/Paper/Paper.js\");\n/* harmony import */ var _IconButton__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../IconButton */ \"./node_modules/@mui/material/IconButton/IconButton.js\");\n/* harmony import */ var _Chip__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../Chip */ \"./node_modules/@mui/material/Chip/Chip.js\");\n/* harmony import */ var _Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Input/inputClasses */ \"./node_modules/@mui/material/Input/inputClasses.js\");\n/* harmony import */ var _InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../InputBase/inputBaseClasses */ \"./node_modules/@mui/material/InputBase/inputBaseClasses.js\");\n/* harmony import */ var _OutlinedInput_outlinedInputClasses__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../OutlinedInput/outlinedInputClasses */ \"./node_modules/@mui/material/OutlinedInput/outlinedInputClasses.js\");\n/* harmony import */ var _FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../FilledInput/filledInputClasses */ \"./node_modules/@mui/material/FilledInput/filledInputClasses.js\");\n/* harmony import */ var _internal_svg_icons_Close__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../internal/svg-icons/Close */ \"./node_modules/@mui/material/internal/svg-icons/Close.js\");\n/* harmony import */ var _internal_svg_icons_ArrowDropDown__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../internal/svg-icons/ArrowDropDown */ \"./node_modules/@mui/material/internal/svg-icons/ArrowDropDown.js\");\n/* harmony import */ var _zero_styled__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../zero-styled */ \"./node_modules/@mui/material/zero-styled/index.js\");\n/* harmony import */ var _zero_styled__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../zero-styled */ \"./node_modules/@mui/material/styles/styled.js\");\n/* harmony import */ var _autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./autocompleteClasses */ \"./node_modules/@mui/material/Autocomplete/autocompleteClasses.js\");\n/* harmony import */ var _utils_capitalize__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/capitalize */ \"./node_modules/@mui/material/utils/capitalize.js\");\n/* harmony import */ var _utils_useForkRef__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../utils/useForkRef */ \"./node_modules/@mui/material/utils/useForkRef.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n'use client';\n\n\n\nvar _ClearIcon, _ArrowDropDownIcon;\nconst _excluded = [\"autoComplete\", \"autoHighlight\", \"autoSelect\", \"blurOnSelect\", \"ChipProps\", \"className\", \"clearIcon\", \"clearOnBlur\", \"clearOnEscape\", \"clearText\", \"closeText\", \"componentsProps\", \"defaultValue\", \"disableClearable\", \"disableCloseOnSelect\", \"disabled\", \"disabledItemsFocusable\", \"disableListWrap\", \"disablePortal\", \"filterOptions\", \"filterSelectedOptions\", \"forcePopupIcon\", \"freeSolo\", \"fullWidth\", \"getLimitTagsText\", \"getOptionDisabled\", \"getOptionKey\", \"getOptionLabel\", \"isOptionEqualToValue\", \"groupBy\", \"handleHomeEndKeys\", \"id\", \"includeInputInList\", \"inputValue\", \"limitTags\", \"ListboxComponent\", \"ListboxProps\", \"loading\", \"loadingText\", \"multiple\", \"noOptionsText\", \"onChange\", \"onClose\", \"onHighlightChange\", \"onInputChange\", \"onOpen\", \"open\", \"openOnFocus\", \"openText\", \"options\", \"PaperComponent\", \"PopperComponent\", \"popupIcon\", \"readOnly\", \"renderGroup\", \"renderInput\", \"renderOption\", \"renderTags\", \"selectOnFocus\", \"size\", \"slotProps\", \"value\"],\n _excluded2 = [\"ref\"],\n _excluded3 = [\"key\"],\n _excluded4 = [\"key\"];\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst useThemeProps = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_5__.createUseThemeProps)('MuiAutocomplete');\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n disablePortal,\n expanded,\n focused,\n fullWidth,\n hasClearIcon,\n hasPopupIcon,\n inputFocused,\n popupOpen,\n size\n } = ownerState;\n const slots = {\n root: ['root', expanded && 'expanded', focused && 'focused', fullWidth && 'fullWidth', hasClearIcon && 'hasClearIcon', hasPopupIcon && 'hasPopupIcon'],\n inputRoot: ['inputRoot'],\n input: ['input', inputFocused && 'inputFocused'],\n tag: ['tag', `tagSize${(0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(size)}`],\n endAdornment: ['endAdornment'],\n clearIndicator: ['clearIndicator'],\n popupIndicator: ['popupIndicator', popupOpen && 'popupIndicatorOpen'],\n popper: ['popper', disablePortal && 'popperDisablePortal'],\n paper: ['paper'],\n listbox: ['listbox'],\n loading: ['loading'],\n noOptions: ['noOptions'],\n option: ['option'],\n groupLabel: ['groupLabel'],\n groupUl: ['groupUl']\n };\n return (0,_mui_utils_composeClasses__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(slots, _autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__.getAutocompleteUtilityClass, classes);\n};\nconst AutocompleteRoot = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n const {\n fullWidth,\n hasClearIcon,\n hasPopupIcon,\n inputFocused,\n size\n } = ownerState;\n return [{\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: styles.tag\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: styles[`tagSize${(0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(size)}`]\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inputRoot}`]: styles.inputRoot\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: styles.input\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: inputFocused && styles.inputFocused\n }, styles.root, fullWidth && styles.fullWidth, hasPopupIcon && styles.hasPopupIcon, hasClearIcon && styles.hasClearIcon];\n }\n})({\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: {\n margin: 3,\n maxWidth: 'calc(100% - 6px)'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inputRoot}`]: {\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}&, .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 26 + 4\n },\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 52 + 4\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n width: 0,\n minWidth: 30\n }\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focused}`]: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].clearIndicator}`]: {\n visibility: 'visible'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n minWidth: 0\n }\n },\n /* Avoid double tap issue on iOS */\n '@media (pointer: fine)': {\n [`&:hover .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].clearIndicator}`]: {\n visibility: 'visible'\n },\n [`&:hover .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n minWidth: 0\n }\n },\n [`& .${_Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__[\"default\"].root}`]: {\n paddingBottom: 1,\n '& .MuiInput-input': {\n padding: '4px 4px 4px 0px'\n }\n },\n [`& .${_Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n [`& .${_Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__[\"default\"].input}`]: {\n padding: '2px 4px 3px 0'\n }\n },\n [`& .${_OutlinedInput_outlinedInputClasses__WEBPACK_IMPORTED_MODULE_12__[\"default\"].root}`]: {\n padding: 9,\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}&, .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 26 + 4 + 9\n },\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 52 + 4 + 9\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n padding: '7.5px 4px 7.5px 5px'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].endAdornment}`]: {\n right: 9\n }\n },\n [`& .${_OutlinedInput_outlinedInputClasses__WEBPACK_IMPORTED_MODULE_12__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n // Don't specify paddingRight, as it overrides the default value set when there is only\n // one of the popup or clear icon as the specificity is equal so the latter one wins\n paddingTop: 6,\n paddingBottom: 6,\n paddingLeft: 6,\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n padding: '2.5px 4px 2.5px 8px'\n }\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}`]: {\n paddingTop: 19,\n paddingLeft: 8,\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}&, .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 26 + 4 + 9\n },\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 52 + 4 + 9\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].input}`]: {\n padding: '7px 4px'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].endAdornment}`]: {\n right: 9\n }\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n paddingBottom: 1,\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].input}`]: {\n padding: '2.5px 4px'\n }\n },\n [`& .${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].hiddenLabel}`]: {\n paddingTop: 8\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].hiddenLabel}`]: {\n paddingTop: 0,\n paddingBottom: 0,\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n paddingTop: 16,\n paddingBottom: 17\n }\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].hiddenLabel}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n paddingTop: 8,\n paddingBottom: 9\n }\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n flexGrow: 1,\n textOverflow: 'ellipsis',\n opacity: 0\n },\n variants: [{\n props: {\n fullWidth: true\n },\n style: {\n width: '100%'\n }\n }, {\n props: {\n size: 'small'\n },\n style: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: {\n margin: 2,\n maxWidth: 'calc(100% - 4px)'\n }\n }\n }, {\n props: {\n inputFocused: true\n },\n style: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n opacity: 1\n }\n }\n }, {\n props: {\n multiple: true\n },\n style: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inputRoot}`]: {\n flexWrap: 'wrap'\n }\n }\n }]\n});\nconst AutocompleteEndAdornment = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'EndAdornment',\n overridesResolver: (props, styles) => styles.endAdornment\n})({\n // We use a position absolute to support wrapping tags.\n position: 'absolute',\n right: 0,\n top: '50%',\n transform: 'translate(0, -50%)'\n});\nconst AutocompleteClearIndicator = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_IconButton__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'ClearIndicator',\n overridesResolver: (props, styles) => styles.clearIndicator\n})({\n marginRight: -2,\n padding: 4,\n visibility: 'hidden'\n});\nconst AutocompletePopupIndicator = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_IconButton__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'PopupIndicator',\n overridesResolver: ({\n ownerState\n }, styles) => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, styles.popupIndicator, ownerState.popupOpen && styles.popupIndicatorOpen)\n})({\n padding: 2,\n marginRight: -2,\n variants: [{\n props: {\n popupOpen: true\n },\n style: {\n transform: 'rotate(180deg)'\n }\n }]\n});\nconst AutocompletePopper = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_Popper__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'Popper',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [{\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].option}`]: styles.option\n }, styles.popper, ownerState.disablePortal && styles.popperDisablePortal];\n }\n})(({\n theme\n}) => ({\n zIndex: (theme.vars || theme).zIndex.modal,\n variants: [{\n props: {\n disablePortal: true\n },\n style: {\n position: 'absolute'\n }\n }]\n}));\nconst AutocompletePaper = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_Paper__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'Paper',\n overridesResolver: (props, styles) => styles.paper\n})(({\n theme\n}) => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, theme.typography.body1, {\n overflow: 'auto'\n}));\nconst AutocompleteLoading = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'Loading',\n overridesResolver: (props, styles) => styles.loading\n})(({\n theme\n}) => ({\n color: (theme.vars || theme).palette.text.secondary,\n padding: '14px 16px'\n}));\nconst AutocompleteNoOptions = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'NoOptions',\n overridesResolver: (props, styles) => styles.noOptions\n})(({\n theme\n}) => ({\n color: (theme.vars || theme).palette.text.secondary,\n padding: '14px 16px'\n}));\nconst AutocompleteListbox = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'Listbox',\n overridesResolver: (props, styles) => styles.listbox\n})(({\n theme\n}) => ({\n listStyle: 'none',\n margin: 0,\n padding: '8px 0',\n maxHeight: '40vh',\n overflow: 'auto',\n position: 'relative',\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].option}`]: {\n minHeight: 48,\n display: 'flex',\n overflow: 'hidden',\n justifyContent: 'flex-start',\n alignItems: 'center',\n cursor: 'pointer',\n paddingTop: 6,\n boxSizing: 'border-box',\n outline: '0',\n WebkitTapHighlightColor: 'transparent',\n paddingBottom: 6,\n paddingLeft: 16,\n paddingRight: 16,\n [theme.breakpoints.up('sm')]: {\n minHeight: 'auto'\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focused}`]: {\n backgroundColor: (theme.vars || theme).palette.action.hover,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n },\n '&[aria-disabled=\"true\"]': {\n opacity: (theme.vars || theme).palette.action.disabledOpacity,\n pointerEvents: 'none'\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focusVisible}`]: {\n backgroundColor: (theme.vars || theme).palette.action.focus\n },\n '&[aria-selected=\"true\"]': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0,_mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity),\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focused}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : (0,_mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: (theme.vars || theme).palette.action.selected\n }\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focusVisible}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : (0,_mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity)\n }\n }\n }\n}));\nconst AutocompleteGroupLabel = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_ListSubheader__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'GroupLabel',\n overridesResolver: (props, styles) => styles.groupLabel\n})(({\n theme\n}) => ({\n backgroundColor: (theme.vars || theme).palette.background.paper,\n top: -8\n}));\nconst AutocompleteGroupUl = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('ul', {\n name: 'MuiAutocomplete',\n slot: 'GroupUl',\n overridesResolver: (props, styles) => styles.groupUl\n})({\n padding: 0,\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].option}`]: {\n paddingLeft: 24\n }\n});\n\nconst Autocomplete = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.forwardRef(function Autocomplete(inProps, ref) {\n var _slotProps$clearIndic, _slotProps$paper, _slotProps$popper, _slotProps$popupIndic;\n const props = useThemeProps({\n props: inProps,\n name: 'MuiAutocomplete'\n });\n\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const {\n autoComplete = false,\n autoHighlight = false,\n autoSelect = false,\n blurOnSelect = false,\n ChipProps,\n className,\n clearIcon = _ClearIcon || (_ClearIcon = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_internal_svg_icons_Close__WEBPACK_IMPORTED_MODULE_20__[\"default\"], {\n fontSize: \"small\"\n })),\n clearOnBlur = !props.freeSolo,\n clearOnEscape = false,\n clearText = 'Clear',\n closeText = 'Close',\n componentsProps = {},\n defaultValue = props.multiple ? [] : null,\n disableClearable = false,\n disableCloseOnSelect = false,\n disabled = false,\n disabledItemsFocusable = false,\n disableListWrap = false,\n disablePortal = false,\n filterSelectedOptions = false,\n forcePopupIcon = 'auto',\n freeSolo = false,\n fullWidth = false,\n getLimitTagsText = more => `+${more}`,\n getOptionLabel: getOptionLabelProp,\n groupBy,\n handleHomeEndKeys = !props.freeSolo,\n includeInputInList = false,\n limitTags = -1,\n ListboxComponent = 'ul',\n ListboxProps,\n loading = false,\n loadingText = 'Loading…',\n multiple = false,\n noOptionsText = 'No options',\n openOnFocus = false,\n openText = 'Open',\n PaperComponent = _Paper__WEBPACK_IMPORTED_MODULE_16__[\"default\"],\n PopperComponent = _Popper__WEBPACK_IMPORTED_MODULE_15__[\"default\"],\n popupIcon = _ArrowDropDownIcon || (_ArrowDropDownIcon = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_internal_svg_icons_ArrowDropDown__WEBPACK_IMPORTED_MODULE_21__[\"default\"], {})),\n readOnly = false,\n renderGroup: renderGroupProp,\n renderInput,\n renderOption: renderOptionProp,\n renderTags,\n selectOnFocus = !props.freeSolo,\n size = 'medium',\n slotProps = {}\n } = props,\n other = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(props, _excluded);\n /* eslint-enable @typescript-eslint/no-unused-vars */\n\n const {\n getRootProps,\n getInputProps,\n getInputLabelProps,\n getPopupIndicatorProps,\n getClearProps,\n getTagProps,\n getListboxProps,\n getOptionProps,\n value,\n dirty,\n expanded,\n id,\n popupOpen,\n focused,\n focusedTag,\n anchorEl,\n setAnchorEl,\n inputValue,\n groupedOptions\n } = (0,_mui_base__WEBPACK_IMPORTED_MODULE_19__.useAutocomplete)((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, props, {\n componentName: 'Autocomplete'\n }));\n const hasClearIcon = !disableClearable && !disabled && dirty && !readOnly;\n const hasPopupIcon = (!freeSolo || forcePopupIcon === true) && forcePopupIcon !== false;\n const {\n onMouseDown: handleInputMouseDown\n } = getInputProps();\n const {\n ref: externalListboxRef\n } = ListboxProps != null ? ListboxProps : {};\n const _getListboxProps = getListboxProps(),\n {\n ref: listboxRef\n } = _getListboxProps,\n otherListboxProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(_getListboxProps, _excluded2);\n const combinedListboxRef = (0,_utils_useForkRef__WEBPACK_IMPORTED_MODULE_22__[\"default\"])(listboxRef, externalListboxRef);\n const defaultGetOptionLabel = option => {\n var _option$label;\n return (_option$label = option.label) != null ? _option$label : option;\n };\n const getOptionLabel = getOptionLabelProp || defaultGetOptionLabel;\n\n // If you modify this, make sure to keep the `AutocompleteOwnerState` type in sync.\n const ownerState = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, props, {\n disablePortal,\n expanded,\n focused,\n fullWidth,\n getOptionLabel,\n hasClearIcon,\n hasPopupIcon,\n inputFocused: focusedTag === -1,\n popupOpen,\n size\n });\n const classes = useUtilityClasses(ownerState);\n let startAdornment;\n if (multiple && value.length > 0) {\n const getCustomizedTagProps = params => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n className: classes.tag,\n disabled\n }, getTagProps(params));\n if (renderTags) {\n startAdornment = renderTags(value, getCustomizedTagProps, ownerState);\n } else {\n startAdornment = value.map((option, index) => {\n const _getCustomizedTagProp = getCustomizedTagProps({\n index\n }),\n {\n key\n } = _getCustomizedTagProp,\n customTagProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(_getCustomizedTagProp, _excluded3);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_Chip__WEBPACK_IMPORTED_MODULE_23__[\"default\"], (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n label: getOptionLabel(option),\n size: size\n }, customTagProps, ChipProps), key);\n });\n }\n }\n if (limitTags > -1 && Array.isArray(startAdornment)) {\n const more = startAdornment.length - limitTags;\n if (!focused && more > 0) {\n startAdornment = startAdornment.splice(0, limitTags);\n startAdornment.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: classes.tag,\n children: getLimitTagsText(more)\n }, startAdornment.length));\n }\n }\n const defaultRenderGroup = params => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"li\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteGroupLabel, {\n className: classes.groupLabel,\n ownerState: ownerState,\n component: \"div\",\n children: params.group\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteGroupUl, {\n className: classes.groupUl,\n ownerState: ownerState,\n children: params.children\n })]\n }, params.key);\n const renderGroup = renderGroupProp || defaultRenderGroup;\n const defaultRenderOption = (props2, option) => {\n // Need to clearly apply key because of https://github.com/vercel/next.js/issues/55642\n const {\n key\n } = props2,\n otherProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(props2, _excluded4);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, otherProps, {\n children: getOptionLabel(option)\n }), key);\n };\n const renderOption = renderOptionProp || defaultRenderOption;\n const renderListOption = (option, index) => {\n const optionProps = getOptionProps({\n option,\n index\n });\n return renderOption((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, optionProps, {\n className: classes.option\n }), option, {\n selected: optionProps['aria-selected'],\n index,\n inputValue\n }, ownerState);\n };\n const clearIndicatorSlotProps = (_slotProps$clearIndic = slotProps.clearIndicator) != null ? _slotProps$clearIndic : componentsProps.clearIndicator;\n const paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;\n const popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;\n const popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;\n const renderAutocompletePopperChildren = children => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompletePopper, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n as: PopperComponent,\n disablePortal: disablePortal,\n style: {\n width: anchorEl ? anchorEl.clientWidth : null\n },\n ownerState: ownerState,\n role: \"presentation\",\n anchorEl: anchorEl,\n open: popupOpen\n }, popperSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompletePaper, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n ownerState: ownerState,\n as: PaperComponent\n }, paperSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),\n children: children\n }))\n }));\n let autocompletePopper = null;\n if (groupedOptions.length > 0) {\n autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteListbox, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n as: ListboxComponent,\n className: classes.listbox,\n ownerState: ownerState\n }, otherListboxProps, ListboxProps, {\n ref: combinedListboxRef,\n children: groupedOptions.map((option, index) => {\n if (groupBy) {\n return renderGroup({\n key: option.key,\n group: option.group,\n children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))\n });\n }\n return renderListOption(option, index);\n })\n })));\n } else if (loading && groupedOptions.length === 0) {\n autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteLoading, {\n className: classes.loading,\n ownerState: ownerState,\n children: loadingText\n }));\n } else if (groupedOptions.length === 0 && !freeSolo && !loading) {\n autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteNoOptions, {\n className: classes.noOptions,\n ownerState: ownerState,\n role: \"presentation\",\n onMouseDown: event => {\n // Prevent input blur when interacting with the \"no options\" content\n event.preventDefault();\n },\n children: noOptionsText\n }));\n }\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react__WEBPACK_IMPORTED_MODULE_2__.Fragment, {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteRoot, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n ref: ref,\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.root, className),\n ownerState: ownerState\n }, getRootProps(other), {\n children: renderInput({\n id,\n disabled,\n fullWidth: true,\n size: size === 'small' ? 'small' : undefined,\n InputLabelProps: getInputLabelProps(),\n InputProps: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n ref: setAnchorEl,\n className: classes.inputRoot,\n startAdornment,\n onClick: event => {\n if (event.target === event.currentTarget) {\n handleInputMouseDown(event);\n }\n }\n }, (hasClearIcon || hasPopupIcon) && {\n endAdornment: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(AutocompleteEndAdornment, {\n className: classes.endAdornment,\n ownerState: ownerState,\n children: [hasClearIcon ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteClearIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, getClearProps(), {\n \"aria-label\": clearText,\n title: clearText,\n ownerState: ownerState\n }, clearIndicatorSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.clearIndicator, clearIndicatorSlotProps == null ? void 0 : clearIndicatorSlotProps.className),\n children: clearIcon\n })) : null, hasPopupIcon ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompletePopupIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, getPopupIndicatorProps(), {\n disabled: disabled,\n \"aria-label\": popupOpen ? closeText : openText,\n title: popupOpen ? closeText : openText,\n ownerState: ownerState\n }, popupIndicatorSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.popupIndicator, popupIndicatorSlotProps == null ? void 0 : popupIndicatorSlotProps.className),\n children: popupIcon\n })) : null]\n })\n }),\n inputProps: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n className: classes.input,\n disabled,\n readOnly\n }, getInputProps())\n })\n })), anchorEl ? autocompletePopper : null]\n });\n});\n true ? Autocomplete.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * If `true`, the portion of the selected suggestion that the user hasn't typed,\n * known as the completion string, appears inline after the input cursor in the textbox.\n * The inline completion string is visually highlighted and has a selected state.\n * @default false\n */\n autoComplete: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the first option is automatically highlighted.\n * @default false\n */\n autoHighlight: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the selected option becomes the value of the input\n * when the Autocomplete loses focus unless the user chooses\n * a different option or changes the character string in the input.\n *\n * When using the `freeSolo` mode, the typed value will be the input value\n * if the Autocomplete loses focus without highlighting an option.\n * @default false\n */\n autoSelect: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Control if the input should be blurred when an option is selected:\n *\n * - `false` the input is not blurred.\n * - `true` the input is always blurred.\n * - `touch` the input is blurred after a touch event.\n * - `mouse` the input is blurred after a mouse event.\n * @default false\n */\n blurOnSelect: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOf(['mouse', 'touch']), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool)]),\n /**\n * Props applied to the [`Chip`](/material-ui/api/chip/) element.\n */\n ChipProps: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n /**\n * Override or extend the styles applied to the component.\n */\n classes: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n /**\n * @ignore\n */\n className: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * The icon to display in place of the default clear icon.\n * @default \n */\n clearIcon: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * If `true`, the input's text is cleared on blur if no value is selected.\n *\n * Set it to `true` if you want to help the user enter a new value.\n * Set it to `false` if you want to help the user resume their search.\n * @default !props.freeSolo\n */\n clearOnBlur: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, clear all values when the user presses escape and the popup is closed.\n * @default false\n */\n clearOnEscape: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Override the default text for the *clear* icon button.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Clear'\n */\n clearText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * Override the default text for the *close popup* icon button.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Close'\n */\n closeText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * The props used for each slot inside.\n * @default {}\n */\n componentsProps: prop_types__WEBPACK_IMPORTED_MODULE_24___default().shape({\n clearIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n paper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popupIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object)\n }),\n /**\n * The default value. Use when the component is not controlled.\n * @default props.multiple ? [] : null\n */\n defaultValue: (0,_mui_utils_chainPropTypes__WEBPACK_IMPORTED_MODULE_25__[\"default\"])((prop_types__WEBPACK_IMPORTED_MODULE_24___default().any), props => {\n if (props.multiple && props.defaultValue !== undefined && !Array.isArray(props.defaultValue)) {\n return new Error(['MUI: The Autocomplete expects the `defaultValue` prop to be an array when `multiple={true}` or undefined.', `However, ${props.defaultValue} was provided.`].join('\\n'));\n }\n return null;\n }),\n /**\n * If `true`, the input can't be cleared.\n * @default false\n */\n disableClearable: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the popup won't close when a value is selected.\n * @default false\n */\n disableCloseOnSelect: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the component is disabled.\n * @default false\n */\n disabled: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, will allow focus on disabled items.\n * @default false\n */\n disabledItemsFocusable: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the list box in the popup will not wrap focus.\n * @default false\n */\n disableListWrap: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the `Popper` content will be under the DOM hierarchy of the parent component.\n * @default false\n */\n disablePortal: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * A function that determines the filtered options to be rendered on search.\n *\n * @default createFilterOptions()\n * @param {Value[]} options The options to render.\n * @param {object} state The state of the component.\n * @returns {Value[]}\n */\n filterOptions: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, hide the selected options from the list box.\n * @default false\n */\n filterSelectedOptions: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Force the visibility display of the popup icon.\n * @default 'auto'\n */\n forcePopupIcon: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOf(['auto']), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool)]),\n /**\n * If `true`, the Autocomplete is free solo, meaning that the user input is not bound to provided options.\n * @default false\n */\n freeSolo: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the input will take up the full width of its container.\n * @default false\n */\n fullWidth: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * The label to display when the tags are truncated (`limitTags`).\n *\n * @param {number} more The number of truncated tags.\n * @returns {ReactNode}\n * @default (more) => `+${more}`\n */\n getLimitTagsText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Used to determine the disabled state for a given option.\n *\n * @param {Value} option The option to test.\n * @returns {boolean}\n */\n getOptionDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Used to determine the key for a given option.\n * This can be useful when the labels of options are not unique (since labels are used as keys by default).\n *\n * @param {Value} option The option to get the key for.\n * @returns {string | number}\n */\n getOptionKey: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Used to determine the string value for a given option.\n * It's used to fill the input (and the list box options if `renderOption` is not provided).\n *\n * If used in free solo mode, it must accept both the type of the options and a string.\n *\n * @param {Value} option\n * @returns {string}\n * @default (option) => option.label ?? option\n */\n getOptionLabel: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If provided, the options will be grouped under the returned string.\n * The groupBy value is also used as the text for group headings when `renderGroup` is not provided.\n *\n * @param {Value} options The options to group.\n * @returns {string}\n */\n groupBy: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, the component handles the \"Home\" and \"End\" keys when the popup is open.\n * It should move focus to the first option and last option, respectively.\n * @default !props.freeSolo\n */\n handleHomeEndKeys: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * This prop is used to help implement the accessibility logic.\n * If you don't provide an id it will fall back to a randomly generated one.\n */\n id: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * If `true`, the highlight can move to the input.\n * @default false\n */\n includeInputInList: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * The input value.\n */\n inputValue: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * Used to determine if the option represents the given value.\n * Uses strict equality by default.\n * ⚠️ Both arguments need to be handled, an option can only match with one value.\n *\n * @param {Value} option The option to test.\n * @param {Value} value The value to test against.\n * @returns {boolean}\n */\n isOptionEqualToValue: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * The maximum number of tags that will be visible when not focused.\n * Set `-1` to disable the limit.\n * @default -1\n */\n limitTags: _mui_utils_integerPropType__WEBPACK_IMPORTED_MODULE_26__[\"default\"],\n /**\n * The component used to render the listbox.\n * @default 'ul'\n */\n ListboxComponent: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().elementType),\n /**\n * Props applied to the Listbox element.\n */\n ListboxProps: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n /**\n * If `true`, the component is in a loading state.\n * This shows the `loadingText` in place of suggestions (only if there are no suggestions to show, for example `options` are empty).\n * @default false\n */\n loading: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Text to display when in a loading state.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Loading…'\n */\n loadingText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * If `true`, `value` must be an array and the menu will support multiple selections.\n * @default false\n */\n multiple: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Text to display when there are no options.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'No options'\n */\n noOptionsText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * Callback fired when the value changes.\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {Value|Value[]} value The new value of the component.\n * @param {string} reason One of \"createOption\", \"selectOption\", \"removeOption\", \"blur\" or \"clear\".\n * @param {string} [details]\n */\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the popup requests to be closed.\n * Use in controlled mode (see open).\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {string} reason Can be: `\"toggleInput\"`, `\"escape\"`, `\"selectOption\"`, `\"removeOption\"`, `\"blur\"`.\n */\n onClose: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the highlight option changes.\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {Value} option The highlighted option.\n * @param {string} reason Can be: `\"keyboard\"`, `\"auto\"`, `\"mouse\"`, `\"touch\"`.\n */\n onHighlightChange: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the input value changes.\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {string} value The new value of the text input.\n * @param {string} reason Can be: `\"input\"` (user input), `\"reset\"` (programmatic change), `\"clear\"`.\n */\n onInputChange: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * @ignore\n */\n onKeyDown: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the popup requests to be opened.\n * Use in controlled mode (see open).\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n */\n onOpen: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, the component is shown.\n */\n open: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the popup will open on input focus.\n * @default false\n */\n openOnFocus: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Override the default text for the *open popup* icon button.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Open'\n */\n openText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * Array of options.\n */\n options: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().array).isRequired,\n /**\n * The component used to render the body of the popup.\n * @default Paper\n */\n PaperComponent: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().elementType),\n /**\n * The component used to position the popup.\n * @default Popper\n */\n PopperComponent: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().elementType),\n /**\n * The icon to display in place of the default popup icon.\n * @default \n */\n popupIcon: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * If `true`, the component becomes readonly. It is also supported for multiple tags where the tag cannot be deleted.\n * @default false\n */\n readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Render the group.\n *\n * @param {AutocompleteRenderGroupParams} params The group to render.\n * @returns {ReactNode}\n */\n renderGroup: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Render the input.\n *\n * @param {object} params\n * @returns {ReactNode}\n */\n renderInput: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func).isRequired,\n /**\n * Render the option, use `getOptionLabel` by default.\n *\n * @param {object} props The props to apply on the li element.\n * @param {Value} option The option to render.\n * @param {object} state The state of each option.\n * @param {object} ownerState The state of the Autocomplete component.\n * @returns {ReactNode}\n */\n renderOption: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Render the selected value.\n *\n * @param {Value[]} value The `value` provided to the component.\n * @param {function} getTagProps A tag props getter.\n * @param {object} ownerState The state of the Autocomplete component.\n * @returns {ReactNode}\n */\n renderTags: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, the input's text is selected on focus.\n * It helps the user clear the selected value.\n * @default !props.freeSolo\n */\n selectOnFocus: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * The size of the component.\n * @default 'medium'\n */\n size: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOf(['small', 'medium']), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string)]),\n /**\n * The props used for each slot inside.\n * @default {}\n */\n slotProps: prop_types__WEBPACK_IMPORTED_MODULE_24___default().shape({\n clearIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n paper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popupIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object)\n }),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_24___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool)])), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object)]),\n /**\n * The value of the autocomplete.\n *\n * The value must have reference equality with the option in order to be selected.\n * You can customize the equality behavior with the `isOptionEqualToValue` prop.\n */\n value: (0,_mui_utils_chainPropTypes__WEBPACK_IMPORTED_MODULE_25__[\"default\"])((prop_types__WEBPACK_IMPORTED_MODULE_24___default().any), props => {\n if (props.multiple && props.value !== undefined && !Array.isArray(props.value)) {\n return new Error(['MUI: The Autocomplete expects the `value` prop to be an array when `multiple={true}` or undefined.', `However, ${props.value} was provided.`].join('\\n'));\n }\n return null;\n })\n} : 0;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Autocomplete);\n\n//# sourceURL=webpack://spt/./node_modules/@mui/material/Autocomplete/Autocomplete.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createFilterOptions: () => (/* reexport safe */ _mui_base__WEBPACK_IMPORTED_MODULE_19__.createFilterOptions),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_24__);\n/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! clsx */ \"./node_modules/clsx/dist/clsx.mjs\");\n/* harmony import */ var _mui_utils_integerPropType__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! @mui/utils/integerPropType */ \"./node_modules/@mui/utils/integerPropType/integerPropType.js\");\n/* harmony import */ var _mui_utils_chainPropTypes__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! @mui/utils/chainPropTypes */ \"./node_modules/@mui/utils/chainPropTypes/chainPropTypes.js\");\n/* harmony import */ var _mui_base__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @mui/base */ \"./node_modules/@mui/base/useAutocomplete/useAutocomplete.js\");\n/* harmony import */ var _mui_utils_composeClasses__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @mui/utils/composeClasses */ \"./node_modules/@mui/utils/composeClasses/composeClasses.js\");\n/* harmony import */ var _mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @mui/system/colorManipulator */ \"./node_modules/@mui/system/colorManipulator.js\");\n/* harmony import */ var _Popper__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Popper */ \"./node_modules/@mui/material/Popper/Popper.js\");\n/* harmony import */ var _ListSubheader__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../ListSubheader */ \"./node_modules/@mui/material/ListSubheader/ListSubheader.js\");\n/* harmony import */ var _Paper__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Paper */ \"./node_modules/@mui/material/Paper/Paper.js\");\n/* harmony import */ var _IconButton__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../IconButton */ \"./node_modules/@mui/material/IconButton/IconButton.js\");\n/* harmony import */ var _Chip__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../Chip */ \"./node_modules/@mui/material/Chip/Chip.js\");\n/* harmony import */ var _Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Input/inputClasses */ \"./node_modules/@mui/material/Input/inputClasses.js\");\n/* harmony import */ var _InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../InputBase/inputBaseClasses */ \"./node_modules/@mui/material/InputBase/inputBaseClasses.js\");\n/* harmony import */ var _OutlinedInput_outlinedInputClasses__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../OutlinedInput/outlinedInputClasses */ \"./node_modules/@mui/material/OutlinedInput/outlinedInputClasses.js\");\n/* harmony import */ var _FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../FilledInput/filledInputClasses */ \"./node_modules/@mui/material/FilledInput/filledInputClasses.js\");\n/* harmony import */ var _internal_svg_icons_Close__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../internal/svg-icons/Close */ \"./node_modules/@mui/material/internal/svg-icons/Close.js\");\n/* harmony import */ var _internal_svg_icons_ArrowDropDown__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../internal/svg-icons/ArrowDropDown */ \"./node_modules/@mui/material/internal/svg-icons/ArrowDropDown.js\");\n/* harmony import */ var _zero_styled__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../zero-styled */ \"./node_modules/@mui/material/zero-styled/index.js\");\n/* harmony import */ var _zero_styled__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../zero-styled */ \"./node_modules/@mui/material/styles/styled.js\");\n/* harmony import */ var _autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./autocompleteClasses */ \"./node_modules/@mui/material/Autocomplete/autocompleteClasses.js\");\n/* harmony import */ var _utils_capitalize__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/capitalize */ \"./node_modules/@mui/material/utils/capitalize.js\");\n/* harmony import */ var _utils_useForkRef__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../utils/useForkRef */ \"./node_modules/@mui/material/utils/useForkRef.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n'use client';\n\n\n\nvar _ClearIcon, _ArrowDropDownIcon;\nconst _excluded = [\"autoComplete\", \"autoHighlight\", \"autoSelect\", \"blurOnSelect\", \"ChipProps\", \"className\", \"clearIcon\", \"clearOnBlur\", \"clearOnEscape\", \"clearText\", \"closeText\", \"componentsProps\", \"defaultValue\", \"disableClearable\", \"disableCloseOnSelect\", \"disabled\", \"disabledItemsFocusable\", \"disableListWrap\", \"disablePortal\", \"filterOptions\", \"filterSelectedOptions\", \"forcePopupIcon\", \"freeSolo\", \"fullWidth\", \"getLimitTagsText\", \"getOptionDisabled\", \"getOptionKey\", \"getOptionLabel\", \"isOptionEqualToValue\", \"groupBy\", \"handleHomeEndKeys\", \"id\", \"includeInputInList\", \"inputValue\", \"limitTags\", \"ListboxComponent\", \"ListboxProps\", \"loading\", \"loadingText\", \"multiple\", \"noOptionsText\", \"onChange\", \"onClose\", \"onHighlightChange\", \"onInputChange\", \"onOpen\", \"open\", \"openOnFocus\", \"openText\", \"options\", \"PaperComponent\", \"PopperComponent\", \"popupIcon\", \"readOnly\", \"renderGroup\", \"renderInput\", \"renderOption\", \"renderTags\", \"selectOnFocus\", \"size\", \"slotProps\", \"value\"],\n _excluded2 = [\"ref\"],\n _excluded3 = [\"key\"],\n _excluded4 = [\"key\"];\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst useThemeProps = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_5__.createUseThemeProps)('MuiAutocomplete');\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n disablePortal,\n expanded,\n focused,\n fullWidth,\n hasClearIcon,\n hasPopupIcon,\n inputFocused,\n popupOpen,\n size\n } = ownerState;\n const slots = {\n root: ['root', expanded && 'expanded', focused && 'focused', fullWidth && 'fullWidth', hasClearIcon && 'hasClearIcon', hasPopupIcon && 'hasPopupIcon'],\n inputRoot: ['inputRoot'],\n input: ['input', inputFocused && 'inputFocused'],\n tag: ['tag', `tagSize${(0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(size)}`],\n endAdornment: ['endAdornment'],\n clearIndicator: ['clearIndicator'],\n popupIndicator: ['popupIndicator', popupOpen && 'popupIndicatorOpen'],\n popper: ['popper', disablePortal && 'popperDisablePortal'],\n paper: ['paper'],\n listbox: ['listbox'],\n loading: ['loading'],\n noOptions: ['noOptions'],\n option: ['option'],\n groupLabel: ['groupLabel'],\n groupUl: ['groupUl']\n };\n return (0,_mui_utils_composeClasses__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(slots, _autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__.getAutocompleteUtilityClass, classes);\n};\nconst AutocompleteRoot = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n const {\n fullWidth,\n hasClearIcon,\n hasPopupIcon,\n inputFocused,\n size\n } = ownerState;\n return [{\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: styles.tag\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: styles[`tagSize${(0,_utils_capitalize__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(size)}`]\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inputRoot}`]: styles.inputRoot\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: styles.input\n }, {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: inputFocused && styles.inputFocused\n }, styles.root, fullWidth && styles.fullWidth, hasPopupIcon && styles.hasPopupIcon, hasClearIcon && styles.hasClearIcon];\n }\n})({\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focused} .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].clearIndicator}`]: {\n visibility: 'visible'\n },\n /* Avoid double tap issue on iOS */\n '@media (pointer: fine)': {\n [`&:hover .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].clearIndicator}`]: {\n visibility: 'visible'\n }\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: {\n margin: 3,\n maxWidth: 'calc(100% - 6px)'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inputRoot}`]: {\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}&, .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 26 + 4\n },\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 52 + 4\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n width: 0,\n minWidth: 30\n }\n },\n [`& .${_Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__[\"default\"].root}`]: {\n paddingBottom: 1,\n '& .MuiInput-input': {\n padding: '4px 4px 4px 0px'\n }\n },\n [`& .${_Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n [`& .${_Input_inputClasses__WEBPACK_IMPORTED_MODULE_10__[\"default\"].input}`]: {\n padding: '2px 4px 3px 0'\n }\n },\n [`& .${_OutlinedInput_outlinedInputClasses__WEBPACK_IMPORTED_MODULE_12__[\"default\"].root}`]: {\n padding: 9,\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}&, .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 26 + 4 + 9\n },\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 52 + 4 + 9\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n padding: '7.5px 4px 7.5px 5px'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].endAdornment}`]: {\n right: 9\n }\n },\n [`& .${_OutlinedInput_outlinedInputClasses__WEBPACK_IMPORTED_MODULE_12__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n // Don't specify paddingRight, as it overrides the default value set when there is only\n // one of the popup or clear icon as the specificity is equal so the latter one wins\n paddingTop: 6,\n paddingBottom: 6,\n paddingLeft: 6,\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n padding: '2.5px 4px 2.5px 8px'\n }\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}`]: {\n paddingTop: 19,\n paddingLeft: 8,\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}&, .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 26 + 4 + 9\n },\n [`.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasPopupIcon}.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].hasClearIcon}&`]: {\n paddingRight: 52 + 4 + 9\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].input}`]: {\n padding: '7px 4px'\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].endAdornment}`]: {\n right: 9\n }\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n paddingBottom: 1,\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].input}`]: {\n padding: '2.5px 4px'\n }\n },\n [`& .${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].hiddenLabel}`]: {\n paddingTop: 8\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].hiddenLabel}`]: {\n paddingTop: 0,\n paddingBottom: 0,\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n paddingTop: 16,\n paddingBottom: 17\n }\n },\n [`& .${_FilledInput_filledInputClasses__WEBPACK_IMPORTED_MODULE_13__[\"default\"].root}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].hiddenLabel}.${_InputBase_inputBaseClasses__WEBPACK_IMPORTED_MODULE_11__[\"default\"].sizeSmall}`]: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n paddingTop: 8,\n paddingBottom: 9\n }\n },\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n flexGrow: 1,\n textOverflow: 'ellipsis',\n opacity: 0\n },\n variants: [{\n props: {\n fullWidth: true\n },\n style: {\n width: '100%'\n }\n }, {\n props: {\n size: 'small'\n },\n style: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].tag}`]: {\n margin: 2,\n maxWidth: 'calc(100% - 4px)'\n }\n }\n }, {\n props: {\n inputFocused: true\n },\n style: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].input}`]: {\n opacity: 1\n }\n }\n }, {\n props: {\n multiple: true\n },\n style: {\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inputRoot}`]: {\n flexWrap: 'wrap'\n }\n }\n }]\n});\nconst AutocompleteEndAdornment = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'EndAdornment',\n overridesResolver: (props, styles) => styles.endAdornment\n})({\n // We use a position absolute to support wrapping tags.\n position: 'absolute',\n right: 0,\n top: '50%',\n transform: 'translate(0, -50%)'\n});\nconst AutocompleteClearIndicator = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_IconButton__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'ClearIndicator',\n overridesResolver: (props, styles) => styles.clearIndicator\n})({\n marginRight: -2,\n padding: 4,\n visibility: 'hidden'\n});\nconst AutocompletePopupIndicator = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_IconButton__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'PopupIndicator',\n overridesResolver: ({\n ownerState\n }, styles) => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, styles.popupIndicator, ownerState.popupOpen && styles.popupIndicatorOpen)\n})({\n padding: 2,\n marginRight: -2,\n variants: [{\n props: {\n popupOpen: true\n },\n style: {\n transform: 'rotate(180deg)'\n }\n }]\n});\nconst AutocompletePopper = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_Popper__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'Popper',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [{\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].option}`]: styles.option\n }, styles.popper, ownerState.disablePortal && styles.popperDisablePortal];\n }\n})(({\n theme\n}) => ({\n zIndex: (theme.vars || theme).zIndex.modal,\n variants: [{\n props: {\n disablePortal: true\n },\n style: {\n position: 'absolute'\n }\n }]\n}));\nconst AutocompletePaper = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_Paper__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'Paper',\n overridesResolver: (props, styles) => styles.paper\n})(({\n theme\n}) => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, theme.typography.body1, {\n overflow: 'auto'\n}));\nconst AutocompleteLoading = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'Loading',\n overridesResolver: (props, styles) => styles.loading\n})(({\n theme\n}) => ({\n color: (theme.vars || theme).palette.text.secondary,\n padding: '14px 16px'\n}));\nconst AutocompleteNoOptions = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'NoOptions',\n overridesResolver: (props, styles) => styles.noOptions\n})(({\n theme\n}) => ({\n color: (theme.vars || theme).palette.text.secondary,\n padding: '14px 16px'\n}));\nconst AutocompleteListbox = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('div', {\n name: 'MuiAutocomplete',\n slot: 'Listbox',\n overridesResolver: (props, styles) => styles.listbox\n})(({\n theme\n}) => ({\n listStyle: 'none',\n margin: 0,\n padding: '8px 0',\n maxHeight: '40vh',\n overflow: 'auto',\n position: 'relative',\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].option}`]: {\n minHeight: 48,\n display: 'flex',\n overflow: 'hidden',\n justifyContent: 'flex-start',\n alignItems: 'center',\n cursor: 'pointer',\n paddingTop: 6,\n boxSizing: 'border-box',\n outline: '0',\n WebkitTapHighlightColor: 'transparent',\n paddingBottom: 6,\n paddingLeft: 16,\n paddingRight: 16,\n [theme.breakpoints.up('sm')]: {\n minHeight: 'auto'\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focused}`]: {\n backgroundColor: (theme.vars || theme).palette.action.hover,\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n },\n '&[aria-disabled=\"true\"]': {\n opacity: (theme.vars || theme).palette.action.disabledOpacity,\n pointerEvents: 'none'\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focusVisible}`]: {\n backgroundColor: (theme.vars || theme).palette.action.focus\n },\n '&[aria-selected=\"true\"]': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : (0,_mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity),\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focused}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : (0,_mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: (theme.vars || theme).palette.action.selected\n }\n },\n [`&.${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].focusVisible}`]: {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : (0,_mui_system_colorManipulator__WEBPACK_IMPORTED_MODULE_17__.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity)\n }\n }\n }\n}));\nconst AutocompleteGroupLabel = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(_ListSubheader__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n name: 'MuiAutocomplete',\n slot: 'GroupLabel',\n overridesResolver: (props, styles) => styles.groupLabel\n})(({\n theme\n}) => ({\n backgroundColor: (theme.vars || theme).palette.background.paper,\n top: -8\n}));\nconst AutocompleteGroupUl = (0,_zero_styled__WEBPACK_IMPORTED_MODULE_9__[\"default\"])('ul', {\n name: 'MuiAutocomplete',\n slot: 'GroupUl',\n overridesResolver: (props, styles) => styles.groupUl\n})({\n padding: 0,\n [`& .${_autocompleteClasses__WEBPACK_IMPORTED_MODULE_8__[\"default\"].option}`]: {\n paddingLeft: 24\n }\n});\n\nconst Autocomplete = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.forwardRef(function Autocomplete(inProps, ref) {\n var _slotProps$clearIndic, _slotProps$paper, _slotProps$popper, _slotProps$popupIndic;\n const props = useThemeProps({\n props: inProps,\n name: 'MuiAutocomplete'\n });\n\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const {\n autoComplete = false,\n autoHighlight = false,\n autoSelect = false,\n blurOnSelect = false,\n ChipProps,\n className,\n clearIcon = _ClearIcon || (_ClearIcon = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_internal_svg_icons_Close__WEBPACK_IMPORTED_MODULE_20__[\"default\"], {\n fontSize: \"small\"\n })),\n clearOnBlur = !props.freeSolo,\n clearOnEscape = false,\n clearText = 'Clear',\n closeText = 'Close',\n componentsProps = {},\n defaultValue = props.multiple ? [] : null,\n disableClearable = false,\n disableCloseOnSelect = false,\n disabled = false,\n disabledItemsFocusable = false,\n disableListWrap = false,\n disablePortal = false,\n filterSelectedOptions = false,\n forcePopupIcon = 'auto',\n freeSolo = false,\n fullWidth = false,\n getLimitTagsText = more => `+${more}`,\n getOptionLabel: getOptionLabelProp,\n groupBy,\n handleHomeEndKeys = !props.freeSolo,\n includeInputInList = false,\n limitTags = -1,\n ListboxComponent = 'ul',\n ListboxProps,\n loading = false,\n loadingText = 'Loading…',\n multiple = false,\n noOptionsText = 'No options',\n openOnFocus = false,\n openText = 'Open',\n PaperComponent = _Paper__WEBPACK_IMPORTED_MODULE_16__[\"default\"],\n PopperComponent = _Popper__WEBPACK_IMPORTED_MODULE_15__[\"default\"],\n popupIcon = _ArrowDropDownIcon || (_ArrowDropDownIcon = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_internal_svg_icons_ArrowDropDown__WEBPACK_IMPORTED_MODULE_21__[\"default\"], {})),\n readOnly = false,\n renderGroup: renderGroupProp,\n renderInput,\n renderOption: renderOptionProp,\n renderTags,\n selectOnFocus = !props.freeSolo,\n size = 'medium',\n slotProps = {}\n } = props,\n other = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(props, _excluded);\n /* eslint-enable @typescript-eslint/no-unused-vars */\n\n const {\n getRootProps,\n getInputProps,\n getInputLabelProps,\n getPopupIndicatorProps,\n getClearProps,\n getTagProps,\n getListboxProps,\n getOptionProps,\n value,\n dirty,\n expanded,\n id,\n popupOpen,\n focused,\n focusedTag,\n anchorEl,\n setAnchorEl,\n inputValue,\n groupedOptions\n } = (0,_mui_base__WEBPACK_IMPORTED_MODULE_19__.useAutocomplete)((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, props, {\n componentName: 'Autocomplete'\n }));\n const hasClearIcon = !disableClearable && !disabled && dirty && !readOnly;\n const hasPopupIcon = (!freeSolo || forcePopupIcon === true) && forcePopupIcon !== false;\n const {\n onMouseDown: handleInputMouseDown\n } = getInputProps();\n const {\n ref: externalListboxRef\n } = ListboxProps != null ? ListboxProps : {};\n const _getListboxProps = getListboxProps(),\n {\n ref: listboxRef\n } = _getListboxProps,\n otherListboxProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(_getListboxProps, _excluded2);\n const combinedListboxRef = (0,_utils_useForkRef__WEBPACK_IMPORTED_MODULE_22__[\"default\"])(listboxRef, externalListboxRef);\n const defaultGetOptionLabel = option => {\n var _option$label;\n return (_option$label = option.label) != null ? _option$label : option;\n };\n const getOptionLabel = getOptionLabelProp || defaultGetOptionLabel;\n\n // If you modify this, make sure to keep the `AutocompleteOwnerState` type in sync.\n const ownerState = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, props, {\n disablePortal,\n expanded,\n focused,\n fullWidth,\n getOptionLabel,\n hasClearIcon,\n hasPopupIcon,\n inputFocused: focusedTag === -1,\n popupOpen,\n size\n });\n const classes = useUtilityClasses(ownerState);\n let startAdornment;\n if (multiple && value.length > 0) {\n const getCustomizedTagProps = params => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n className: classes.tag,\n disabled\n }, getTagProps(params));\n if (renderTags) {\n startAdornment = renderTags(value, getCustomizedTagProps, ownerState);\n } else {\n startAdornment = value.map((option, index) => {\n const _getCustomizedTagProp = getCustomizedTagProps({\n index\n }),\n {\n key\n } = _getCustomizedTagProp,\n customTagProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(_getCustomizedTagProp, _excluded3);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_Chip__WEBPACK_IMPORTED_MODULE_23__[\"default\"], (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n label: getOptionLabel(option),\n size: size\n }, customTagProps, ChipProps), key);\n });\n }\n }\n if (limitTags > -1 && Array.isArray(startAdornment)) {\n const more = startAdornment.length - limitTags;\n if (!focused && more > 0) {\n startAdornment = startAdornment.splice(0, limitTags);\n startAdornment.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"span\", {\n className: classes.tag,\n children: getLimitTagsText(more)\n }, startAdornment.length));\n }\n }\n const defaultRenderGroup = params => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(\"li\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteGroupLabel, {\n className: classes.groupLabel,\n ownerState: ownerState,\n component: \"div\",\n children: params.group\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteGroupUl, {\n className: classes.groupUl,\n ownerState: ownerState,\n children: params.children\n })]\n }, params.key);\n const renderGroup = renderGroupProp || defaultRenderGroup;\n const defaultRenderOption = (props2, option) => {\n // Need to clearly apply key because of https://github.com/vercel/next.js/issues/55642\n const {\n key\n } = props2,\n otherProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(props2, _excluded4);\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(\"li\", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, otherProps, {\n children: getOptionLabel(option)\n }), key);\n };\n const renderOption = renderOptionProp || defaultRenderOption;\n const renderListOption = (option, index) => {\n const optionProps = getOptionProps({\n option,\n index\n });\n return renderOption((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, optionProps, {\n className: classes.option\n }), option, {\n selected: optionProps['aria-selected'],\n index,\n inputValue\n }, ownerState);\n };\n const clearIndicatorSlotProps = (_slotProps$clearIndic = slotProps.clearIndicator) != null ? _slotProps$clearIndic : componentsProps.clearIndicator;\n const paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;\n const popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;\n const popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;\n const renderAutocompletePopperChildren = children => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompletePopper, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n as: PopperComponent,\n disablePortal: disablePortal,\n style: {\n width: anchorEl ? anchorEl.clientWidth : null\n },\n ownerState: ownerState,\n role: \"presentation\",\n anchorEl: anchorEl,\n open: popupOpen\n }, popperSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompletePaper, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n ownerState: ownerState,\n as: PaperComponent\n }, paperSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),\n children: children\n }))\n }));\n let autocompletePopper = null;\n if (groupedOptions.length > 0) {\n autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteListbox, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n as: ListboxComponent,\n className: classes.listbox,\n ownerState: ownerState\n }, otherListboxProps, ListboxProps, {\n ref: combinedListboxRef,\n children: groupedOptions.map((option, index) => {\n if (groupBy) {\n return renderGroup({\n key: option.key,\n group: option.group,\n children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))\n });\n }\n return renderListOption(option, index);\n })\n })));\n } else if (loading && groupedOptions.length === 0) {\n autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteLoading, {\n className: classes.loading,\n ownerState: ownerState,\n children: loadingText\n }));\n } else if (groupedOptions.length === 0 && !freeSolo && !loading) {\n autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteNoOptions, {\n className: classes.noOptions,\n ownerState: ownerState,\n role: \"presentation\",\n onMouseDown: event => {\n // Prevent input blur when interacting with the \"no options\" content\n event.preventDefault();\n },\n children: noOptionsText\n }));\n }\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react__WEBPACK_IMPORTED_MODULE_2__.Fragment, {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteRoot, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n ref: ref,\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.root, className),\n ownerState: ownerState\n }, getRootProps(other), {\n children: renderInput({\n id,\n disabled,\n fullWidth: true,\n size: size === 'small' ? 'small' : undefined,\n InputLabelProps: getInputLabelProps(),\n InputProps: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n ref: setAnchorEl,\n className: classes.inputRoot,\n startAdornment,\n onClick: event => {\n if (event.target === event.currentTarget) {\n handleInputMouseDown(event);\n }\n }\n }, (hasClearIcon || hasPopupIcon) && {\n endAdornment: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(AutocompleteEndAdornment, {\n className: classes.endAdornment,\n ownerState: ownerState,\n children: [hasClearIcon ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompleteClearIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, getClearProps(), {\n \"aria-label\": clearText,\n title: clearText,\n ownerState: ownerState\n }, clearIndicatorSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.clearIndicator, clearIndicatorSlotProps == null ? void 0 : clearIndicatorSlotProps.className),\n children: clearIcon\n })) : null, hasPopupIcon ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(AutocompletePopupIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, getPopupIndicatorProps(), {\n disabled: disabled,\n \"aria-label\": popupOpen ? closeText : openText,\n title: popupOpen ? closeText : openText,\n ownerState: ownerState\n }, popupIndicatorSlotProps, {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(classes.popupIndicator, popupIndicatorSlotProps == null ? void 0 : popupIndicatorSlotProps.className),\n children: popupIcon\n })) : null]\n })\n }),\n inputProps: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n className: classes.input,\n disabled,\n readOnly\n }, getInputProps())\n })\n })), anchorEl ? autocompletePopper : null]\n });\n});\n true ? Autocomplete.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the d.ts file and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * If `true`, the portion of the selected suggestion that the user hasn't typed,\n * known as the completion string, appears inline after the input cursor in the textbox.\n * The inline completion string is visually highlighted and has a selected state.\n * @default false\n */\n autoComplete: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the first option is automatically highlighted.\n * @default false\n */\n autoHighlight: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the selected option becomes the value of the input\n * when the Autocomplete loses focus unless the user chooses\n * a different option or changes the character string in the input.\n *\n * When using the `freeSolo` mode, the typed value will be the input value\n * if the Autocomplete loses focus without highlighting an option.\n * @default false\n */\n autoSelect: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Control if the input should be blurred when an option is selected:\n *\n * - `false` the input is not blurred.\n * - `true` the input is always blurred.\n * - `touch` the input is blurred after a touch event.\n * - `mouse` the input is blurred after a mouse event.\n * @default false\n */\n blurOnSelect: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOf(['mouse', 'touch']), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool)]),\n /**\n * Props applied to the [`Chip`](/material-ui/api/chip/) element.\n */\n ChipProps: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n /**\n * Override or extend the styles applied to the component.\n */\n classes: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n /**\n * @ignore\n */\n className: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * The icon to display in place of the default clear icon.\n * @default \n */\n clearIcon: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * If `true`, the input's text is cleared on blur if no value is selected.\n *\n * Set it to `true` if you want to help the user enter a new value.\n * Set it to `false` if you want to help the user resume their search.\n * @default !props.freeSolo\n */\n clearOnBlur: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, clear all values when the user presses escape and the popup is closed.\n * @default false\n */\n clearOnEscape: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Override the default text for the *clear* icon button.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Clear'\n */\n clearText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * Override the default text for the *close popup* icon button.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Close'\n */\n closeText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * The props used for each slot inside.\n * @default {}\n */\n componentsProps: prop_types__WEBPACK_IMPORTED_MODULE_24___default().shape({\n clearIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n paper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popupIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object)\n }),\n /**\n * The default value. Use when the component is not controlled.\n * @default props.multiple ? [] : null\n */\n defaultValue: (0,_mui_utils_chainPropTypes__WEBPACK_IMPORTED_MODULE_25__[\"default\"])((prop_types__WEBPACK_IMPORTED_MODULE_24___default().any), props => {\n if (props.multiple && props.defaultValue !== undefined && !Array.isArray(props.defaultValue)) {\n return new Error(['MUI: The Autocomplete expects the `defaultValue` prop to be an array when `multiple={true}` or undefined.', `However, ${props.defaultValue} was provided.`].join('\\n'));\n }\n return null;\n }),\n /**\n * If `true`, the input can't be cleared.\n * @default false\n */\n disableClearable: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the popup won't close when a value is selected.\n * @default false\n */\n disableCloseOnSelect: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the component is disabled.\n * @default false\n */\n disabled: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, will allow focus on disabled items.\n * @default false\n */\n disabledItemsFocusable: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the list box in the popup will not wrap focus.\n * @default false\n */\n disableListWrap: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the `Popper` content will be under the DOM hierarchy of the parent component.\n * @default false\n */\n disablePortal: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * A function that determines the filtered options to be rendered on search.\n *\n * @default createFilterOptions()\n * @param {Value[]} options The options to render.\n * @param {object} state The state of the component.\n * @returns {Value[]}\n */\n filterOptions: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, hide the selected options from the list box.\n * @default false\n */\n filterSelectedOptions: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Force the visibility display of the popup icon.\n * @default 'auto'\n */\n forcePopupIcon: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOf(['auto']), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool)]),\n /**\n * If `true`, the Autocomplete is free solo, meaning that the user input is not bound to provided options.\n * @default false\n */\n freeSolo: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the input will take up the full width of its container.\n * @default false\n */\n fullWidth: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * The label to display when the tags are truncated (`limitTags`).\n *\n * @param {number} more The number of truncated tags.\n * @returns {ReactNode}\n * @default (more) => `+${more}`\n */\n getLimitTagsText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Used to determine the disabled state for a given option.\n *\n * @param {Value} option The option to test.\n * @returns {boolean}\n */\n getOptionDisabled: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Used to determine the key for a given option.\n * This can be useful when the labels of options are not unique (since labels are used as keys by default).\n *\n * @param {Value} option The option to get the key for.\n * @returns {string | number}\n */\n getOptionKey: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Used to determine the string value for a given option.\n * It's used to fill the input (and the list box options if `renderOption` is not provided).\n *\n * If used in free solo mode, it must accept both the type of the options and a string.\n *\n * @param {Value} option\n * @returns {string}\n * @default (option) => option.label ?? option\n */\n getOptionLabel: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If provided, the options will be grouped under the returned string.\n * The groupBy value is also used as the text for group headings when `renderGroup` is not provided.\n *\n * @param {Value} options The options to group.\n * @returns {string}\n */\n groupBy: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, the component handles the \"Home\" and \"End\" keys when the popup is open.\n * It should move focus to the first option and last option, respectively.\n * @default !props.freeSolo\n */\n handleHomeEndKeys: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * This prop is used to help implement the accessibility logic.\n * If you don't provide an id it will fall back to a randomly generated one.\n */\n id: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * If `true`, the highlight can move to the input.\n * @default false\n */\n includeInputInList: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * The input value.\n */\n inputValue: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * Used to determine if the option represents the given value.\n * Uses strict equality by default.\n * ⚠️ Both arguments need to be handled, an option can only match with one value.\n *\n * @param {Value} option The option to test.\n * @param {Value} value The value to test against.\n * @returns {boolean}\n */\n isOptionEqualToValue: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * The maximum number of tags that will be visible when not focused.\n * Set `-1` to disable the limit.\n * @default -1\n */\n limitTags: _mui_utils_integerPropType__WEBPACK_IMPORTED_MODULE_26__[\"default\"],\n /**\n * The component used to render the listbox.\n * @default 'ul'\n */\n ListboxComponent: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().elementType),\n /**\n * Props applied to the Listbox element.\n */\n ListboxProps: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n /**\n * If `true`, the component is in a loading state.\n * This shows the `loadingText` in place of suggestions (only if there are no suggestions to show, for example `options` are empty).\n * @default false\n */\n loading: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Text to display when in a loading state.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Loading…'\n */\n loadingText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * If `true`, `value` must be an array and the menu will support multiple selections.\n * @default false\n */\n multiple: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Text to display when there are no options.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'No options'\n */\n noOptionsText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * Callback fired when the value changes.\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {Value|Value[]} value The new value of the component.\n * @param {string} reason One of \"createOption\", \"selectOption\", \"removeOption\", \"blur\" or \"clear\".\n * @param {string} [details]\n */\n onChange: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the popup requests to be closed.\n * Use in controlled mode (see open).\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {string} reason Can be: `\"toggleInput\"`, `\"escape\"`, `\"selectOption\"`, `\"removeOption\"`, `\"blur\"`.\n */\n onClose: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the highlight option changes.\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {Value} option The highlighted option.\n * @param {string} reason Can be: `\"keyboard\"`, `\"auto\"`, `\"mouse\"`, `\"touch\"`.\n */\n onHighlightChange: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the input value changes.\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n * @param {string} value The new value of the text input.\n * @param {string} reason Can be: `\"input\"` (user input), `\"reset\"` (programmatic change), `\"clear\"`.\n */\n onInputChange: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * @ignore\n */\n onKeyDown: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Callback fired when the popup requests to be opened.\n * Use in controlled mode (see open).\n *\n * @param {React.SyntheticEvent} event The event source of the callback.\n */\n onOpen: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, the component is shown.\n */\n open: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * If `true`, the popup will open on input focus.\n * @default false\n */\n openOnFocus: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Override the default text for the *open popup* icon button.\n *\n * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).\n * @default 'Open'\n */\n openText: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string),\n /**\n * Array of options.\n */\n options: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().array).isRequired,\n /**\n * The component used to render the body of the popup.\n * @default Paper\n */\n PaperComponent: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().elementType),\n /**\n * The component used to position the popup.\n * @default Popper\n */\n PopperComponent: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().elementType),\n /**\n * The icon to display in place of the default popup icon.\n * @default \n */\n popupIcon: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().node),\n /**\n * If `true`, the component becomes readonly. It is also supported for multiple tags where the tag cannot be deleted.\n * @default false\n */\n readOnly: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * Render the group.\n *\n * @param {AutocompleteRenderGroupParams} params The group to render.\n * @returns {ReactNode}\n */\n renderGroup: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Render the input.\n *\n * @param {object} params\n * @returns {ReactNode}\n */\n renderInput: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func).isRequired,\n /**\n * Render the option, use `getOptionLabel` by default.\n *\n * @param {object} props The props to apply on the li element.\n * @param {Value} option The option to render.\n * @param {object} state The state of each option.\n * @param {object} ownerState The state of the Autocomplete component.\n * @returns {ReactNode}\n */\n renderOption: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * Render the selected value.\n *\n * @param {Value[]} value The `value` provided to the component.\n * @param {function} getTagProps A tag props getter.\n * @param {object} ownerState The state of the Autocomplete component.\n * @returns {ReactNode}\n */\n renderTags: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func),\n /**\n * If `true`, the input's text is selected on focus.\n * It helps the user clear the selected value.\n * @default !props.freeSolo\n */\n selectOnFocus: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool),\n /**\n * The size of the component.\n * @default 'medium'\n */\n size: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOf(['small', 'medium']), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().string)]),\n /**\n * The props used for each slot inside.\n * @default {}\n */\n slotProps: prop_types__WEBPACK_IMPORTED_MODULE_24___default().shape({\n clearIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n paper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popper: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object),\n popupIndicator: (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object)\n }),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_24___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_24___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_24___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().bool)])), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_24___default().object)]),\n /**\n * The value of the autocomplete.\n *\n * The value must have reference equality with the option in order to be selected.\n * You can customize the equality behavior with the `isOptionEqualToValue` prop.\n */\n value: (0,_mui_utils_chainPropTypes__WEBPACK_IMPORTED_MODULE_25__[\"default\"])((prop_types__WEBPACK_IMPORTED_MODULE_24___default().any), props => {\n if (props.multiple && props.value !== undefined && !Array.isArray(props.value)) {\n return new Error(['MUI: The Autocomplete expects the `value` prop to be an array when `multiple={true}` or undefined.', `However, ${props.value} was provided.`].join('\\n'));\n }\n return null;\n })\n} : 0;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Autocomplete);\n\n//# sourceURL=webpack://spt/./node_modules/@mui/material/Autocomplete/Autocomplete.js?"); /***/ }), @@ -3569,7 +3569,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ deepmerge),\n/* harmony export */ isPlainObject: () => (/* binding */ isPlainObject)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n\n// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js\nfunction isPlainObject(item) {\n if (typeof item !== 'object' || item === null) {\n return false;\n }\n const prototype = Object.getPrototypeOf(item);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);\n}\nfunction deepClone(source) {\n if (!isPlainObject(source)) {\n return source;\n }\n const output = {};\n Object.keys(source).forEach(key => {\n output[key] = deepClone(source[key]);\n });\n return output;\n}\nfunction deepmerge(target, source, options = {\n clone: true\n}) {\n const output = options.clone ? (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, target) : target;\n if (isPlainObject(target) && isPlainObject(source)) {\n Object.keys(source).forEach(key => {\n // Avoid prototype pollution\n if (key === '__proto__') {\n return;\n }\n if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {\n // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.\n output[key] = deepmerge(target[key], source[key], options);\n } else if (options.clone) {\n output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];\n } else {\n output[key] = source[key];\n }\n });\n }\n return output;\n}\n\n//# sourceURL=webpack://spt/./node_modules/@mui/utils/deepmerge/deepmerge.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ deepmerge),\n/* harmony export */ isPlainObject: () => (/* binding */ isPlainObject)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n\n// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js\nfunction isPlainObject(item) {\n if (typeof item !== 'object' || item === null) {\n return false;\n }\n const prototype = Object.getPrototypeOf(item);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);\n}\nfunction deepClone(source) {\n if (!isPlainObject(source)) {\n return source;\n }\n const output = {};\n Object.keys(source).forEach(key => {\n output[key] = deepClone(source[key]);\n });\n return output;\n}\nfunction deepmerge(target, source, options = {\n clone: true\n}) {\n const output = options.clone ? (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, target) : target;\n if (isPlainObject(target) && isPlainObject(source)) {\n Object.keys(source).forEach(key => {\n if (isPlainObject(source[key]) &&\n // Avoid prototype pollution\n Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {\n // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.\n output[key] = deepmerge(target[key], source[key], options);\n } else if (options.clone) {\n output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];\n } else {\n output[key] = source[key];\n }\n });\n }\n return output;\n}\n\n//# sourceURL=webpack://spt/./node_modules/@mui/utils/deepmerge/deepmerge.js?"); /***/ }), @@ -3844,7 +3844,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ useControlled)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n'use client';\n\n/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\n\nfunction useControlled({\n controlled,\n default: defaultProp,\n name,\n state = 'value'\n}) {\n // isControlled is ignored in the hook dependency lists as it should never change.\n const {\n current: isControlled\n } = react__WEBPACK_IMPORTED_MODULE_0__.useRef(controlled !== undefined);\n const [valueState, setValue] = react__WEBPACK_IMPORTED_MODULE_0__.useState(defaultProp);\n const value = isControlled ? controlled : valueState;\n if (true) {\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n if (isControlled !== (controlled !== undefined)) {\n console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [state, name, controlled]);\n const {\n current: defaultValue\n } = react__WEBPACK_IMPORTED_MODULE_0__.useRef(defaultProp);\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n if (!isControlled && defaultValue !== defaultProp) {\n console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\\n'));\n }\n }, [JSON.stringify(defaultProp)]);\n }\n const setValueIfUncontrolled = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(newValue => {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}\n\n//# sourceURL=webpack://spt/./node_modules/@mui/utils/useControlled/useControlled.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ useControlled)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n'use client';\n\n/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\n\nfunction useControlled({\n controlled,\n default: defaultProp,\n name,\n state = 'value'\n}) {\n // isControlled is ignored in the hook dependency lists as it should never change.\n const {\n current: isControlled\n } = react__WEBPACK_IMPORTED_MODULE_0__.useRef(controlled !== undefined);\n const [valueState, setValue] = react__WEBPACK_IMPORTED_MODULE_0__.useState(defaultProp);\n const value = isControlled ? controlled : valueState;\n if (true) {\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n if (isControlled !== (controlled !== undefined)) {\n console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [state, name, controlled]);\n const {\n current: defaultValue\n } = react__WEBPACK_IMPORTED_MODULE_0__.useRef(defaultProp);\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n if (!isControlled && !Object.is(defaultValue, defaultProp)) {\n console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\\n'));\n }\n }, [JSON.stringify(defaultProp)]);\n }\n const setValueIfUncontrolled = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(newValue => {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}\n\n//# sourceURL=webpack://spt/./node_modules/@mui/utils/useControlled/useControlled.js?"); /***/ }), @@ -4570,7 +4570,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortedDeferredError: () => (/* binding */ AbortedDeferredError),\n/* harmony export */ Action: () => (/* binding */ Action),\n/* harmony export */ IDLE_BLOCKER: () => (/* binding */ IDLE_BLOCKER),\n/* harmony export */ IDLE_FETCHER: () => (/* binding */ IDLE_FETCHER),\n/* harmony export */ IDLE_NAVIGATION: () => (/* binding */ IDLE_NAVIGATION),\n/* harmony export */ UNSAFE_DEFERRED_SYMBOL: () => (/* binding */ UNSAFE_DEFERRED_SYMBOL),\n/* harmony export */ UNSAFE_DeferredData: () => (/* binding */ DeferredData),\n/* harmony export */ UNSAFE_ErrorResponseImpl: () => (/* binding */ ErrorResponseImpl),\n/* harmony export */ UNSAFE_convertRouteMatchToUiMatch: () => (/* binding */ convertRouteMatchToUiMatch),\n/* harmony export */ UNSAFE_convertRoutesToDataRoutes: () => (/* binding */ convertRoutesToDataRoutes),\n/* harmony export */ UNSAFE_getResolveToMatches: () => (/* binding */ getResolveToMatches),\n/* harmony export */ UNSAFE_invariant: () => (/* binding */ invariant),\n/* harmony export */ UNSAFE_warning: () => (/* binding */ warning),\n/* harmony export */ createBrowserHistory: () => (/* binding */ createBrowserHistory),\n/* harmony export */ createHashHistory: () => (/* binding */ createHashHistory),\n/* harmony export */ createMemoryHistory: () => (/* binding */ createMemoryHistory),\n/* harmony export */ createPath: () => (/* binding */ createPath),\n/* harmony export */ createRouter: () => (/* binding */ createRouter),\n/* harmony export */ createStaticHandler: () => (/* binding */ createStaticHandler),\n/* harmony export */ defer: () => (/* binding */ defer),\n/* harmony export */ generatePath: () => (/* binding */ generatePath),\n/* harmony export */ getStaticContextFromError: () => (/* binding */ getStaticContextFromError),\n/* harmony export */ getToPathname: () => (/* binding */ getToPathname),\n/* harmony export */ isDeferredData: () => (/* binding */ isDeferredData),\n/* harmony export */ isRouteErrorResponse: () => (/* binding */ isRouteErrorResponse),\n/* harmony export */ joinPaths: () => (/* binding */ joinPaths),\n/* harmony export */ json: () => (/* binding */ json),\n/* harmony export */ matchPath: () => (/* binding */ matchPath),\n/* harmony export */ matchRoutes: () => (/* binding */ matchRoutes),\n/* harmony export */ normalizePathname: () => (/* binding */ normalizePathname),\n/* harmony export */ parsePath: () => (/* binding */ parsePath),\n/* harmony export */ redirect: () => (/* binding */ redirect),\n/* harmony export */ redirectDocument: () => (/* binding */ redirectDocument),\n/* harmony export */ resolvePath: () => (/* binding */ resolvePath),\n/* harmony export */ resolveTo: () => (/* binding */ resolveTo),\n/* harmony export */ stripBasename: () => (/* binding */ stripBasename)\n/* harmony export */ });\n/**\n * @remix-run/router v1.16.1\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 _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, 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 () 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, 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/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\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 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 let decoded = decodePath(pathname);\n matches = matchRouteBranch(branches[i], decoded);\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) {\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 if (!match) return null;\n Object.assign(matchedParams, match.params);\n let route = meta.route;\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/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/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}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/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 = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\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 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 * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \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 === matches.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 `` 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 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}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\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 */\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 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}\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 * @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.unstable_dataStrategy || defaultDataStrategy;\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 unstable_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 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 initialErrors = null;\n if (initialMatches == null) {\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 let initialized;\n let hasLazyRoutes = initialMatches.some(m => m.route.lazy);\n let hasLoaders = initialMatches.some(m => m.route.loader);\n if (hasLazyRoutes) {\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 (!hasLoaders) {\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 let isRouteInitialized = m => {\n // No loader, nothing to initialize\n if (!m.route.loader) {\n return true;\n }\n // Explicitly opting-in to running on hydration\n if (typeof m.route.loader === \"function\" && m.route.loader.hydrate === true) {\n return false;\n }\n // Otherwise, initialized if hydrated with data or an error\n return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined;\n };\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(isRouteInitialized);\n } else {\n initialized = initialMatches.every(isRouteInitialized);\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 = [];\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 ignoreNextHistoryUpdate = false;\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 (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\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 ignoreNextHistoryUpdate = true;\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\n 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 // 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 unstable_viewTransitionOpts: opts.viewTransitionOpts,\n unstable_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 }\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 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 cancelledFetcherLoads = [];\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.unstable_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.unstable_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 });\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 = matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\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 load will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (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 // 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, {\n replace: opts.replace,\n flushSync\n });\n if (actionResult.shortCircuited) {\n return;\n }\n pendingActionResult = actionResult.pendingActionResult;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = 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 loaderData,\n errors\n } = await handleLoaders(request, location, matches, 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\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, 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 // 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\", request, [actionMatch], matches);\n result = results[0];\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);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, {\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 are REPLACE navigations, but if the\n // action threw an error that'll be rendered in an errorElement, we fall\n // back to PUSH so that the user can use the back button to get back to\n // the pre-submission form location to try again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n pendingActionResult: [boundaryMatch.route.id, result]\n };\n }\n return {\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, 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 let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.unstable_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 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 if (!isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration)) {\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 let actionData;\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 actionData = {\n [pendingActionResult[0]]: pendingActionResult[1].data\n };\n } else if (state.actionData) {\n if (Object.keys(state.actionData).length === 0) {\n actionData = null;\n } else {\n actionData = state.actionData;\n }\n }\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData !== undefined ? {\n actionData\n } : {}, revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n if (fetchControllers.has(rf.key)) {\n abortFetcher(rf.key);\n }\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, 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, ...fetcherResults]);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\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 let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n await startRedirectNavigation(request, redirect.result, {\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, matchesToLoad, 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 // During partial hydration, preserve SSR errors for routes that don't re-run\n if (future.v7_partialHydration && initialHydration && state.errors) {\n Object.entries(state.errors).filter(_ref2 => {\n let [id] = _ref2;\n return !matchesToLoad.some(m => m.route.id === id);\n }).forEach(_ref3 => {\n let [routeId, error] = _ref3;\n errors = Object.assign(errors || {}, {\n [routeId]: error\n });\n });\n }\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\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 if (fetchControllers.has(key)) abortFetcher(key);\n let flushSync = (opts && opts.unstable_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 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 pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, flushSync, 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, flushSync, 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, flushSync, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n if (!match.route.action && !match.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;\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 // Call the action for the fetcher\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResults = await callDataStrategy(\"action\", fetchRequest, [match], requestMatches);\n let actionResult = actionResults[0];\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, {\n fetcherSubmission: submission\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.unstable_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 if (fetchControllers.has(staleKey)) {\n abortFetcher(staleKey);\n }\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, 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, ...fetcherResults]);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\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 let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n return startRedirectNavigation(revalidationRequest, redirect.result);\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, 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, flushSync, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n // Call the loader for this fetcher route match\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let results = await callDataStrategy(\"loader\", fetchRequest, [match], matches);\n let result = results[0];\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);\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, _temp2) {\n let {\n submission,\n fetcherSubmission,\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);\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 ? 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 this flag across redirects\n preventScrollReset: pendingPreventScrollReset\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 this flag across redirects\n preventScrollReset: pendingPreventScrollReset\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, request, matchesToLoad, matches) {\n try {\n let results = await callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties);\n return await Promise.all(results.map((result, i) => {\n if (isRedirectHandlerResult(result)) {\n let response = result.result;\n return {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].route.id, matches, basename, future.v7_relativeSplatPath)\n };\n }\n return convertHandlerResultToDataResult(result);\n }));\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 return matchesToLoad.map(() => ({\n type: ResultType.error,\n error: e\n }));\n }\n }\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n let [loaderResults, ...fetcherResults] = await Promise.all([matchesToLoad.length ? callDataStrategy(\"loader\", request, matchesToLoad, matches) : [], ...fetchersToLoad.map(f => {\n if (f.matches && f.match && f.controller) {\n let fetcherRequest = createClientSideRequest(init.history, f.path, f.controller.signal);\n return callDataStrategy(\"loader\", fetcherRequest, [f.match], f.matches).then(r => r[0]);\n } else {\n return Promise.resolve({\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n });\n }\n })]);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]);\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.push(key);\n abortFetcher(key);\n }\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 if (future.v7_fetcherPersist) {\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 }\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 deletedFetchers.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n if (future.v7_fetcherPersist) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n } else {\n activeFetchers.set(key, count);\n }\n } else {\n deleteFetcher(key);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n invariant(controller, \"Expected fetch controller: \" + key);\n controller.abort();\n fetchControllers.delete(key);\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(_ref4) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref4;\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 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 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 \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 _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\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 _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 unstable_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, unstable_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 unstable_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, unstable_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, unstable_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, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, unstable_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 `HandlerResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isHandlerResult(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, unstable_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, unstable_dataStrategy);\n result = results[0];\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, unstable_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, unstable_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, unstable_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, unstable_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, matchesToLoad, 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, unstable_dataStrategy) {\n let results = await callDataStrategyImpl(unstable_dataStrategy || defaultDataStrategy, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext);\n return await Promise.all(results.map((result, i) => {\n if (isRedirectHandlerResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].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 return convertHandlerResultToDataResult(result);\n }));\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 // Add an ?index param for matched index routes if we don't already have one\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\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, _ref5) => {\n let [name, value] = _ref5;\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 below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, isInitialLoad, 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 boundaryId = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[0] : undefined;\n let boundaryMatches = boundaryId ? getLoaderMatchesUntilBoundary(matches, boundaryId) : matches;\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 (isInitialLoad) {\n if (typeof route.loader !== \"function\" || route.loader.hydrate) {\n return true;\n }\n return state.loaderData[route.id] === undefined && (\n // Don't re-run if the loader ran and threw an error\n !state.errors || state.errors[route.id] === undefined);\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 unstable_actionStatus: 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 load (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 (isInitialLoad || !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.includes(key)) {\n // Always revalidate if the fetcher was cancelled\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 unstable_actionStatus: 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 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}\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\nfunction defaultDataStrategy(opts) {\n return Promise.all(opts.matches.map(m => m.resolve()));\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext) {\n let routeIdsToLoad = matchesToLoad.reduce((acc, m) => acc.add(m.route.id), new Set());\n let loadedMatches = new Set();\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: matches.map(match => {\n let shouldLoad = routeIdsToLoad.has(match.route.id);\n // `resolve` encapsulates the route.lazy, executing the\n // loader/action, and mapping return values/thrown errors to a\n // HandlerResult. Users can pass a callback to take fine-grained control\n // over the execution of the loader/action\n let resolve = handlerOverride => {\n loadedMatches.add(match.route.id);\n return shouldLoad ? callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n }),\n request,\n params: matches[0].params,\n context: requestContext\n });\n // Throw if any loadRoute implementations not called since they are what\n // ensures a route is fully loaded\n matches.forEach(m => invariant(loadedMatches.has(m.route.id), \"`match.resolve()` was not called for route id \\\"\" + m.route.id + \"\\\". \" + \"You must call `match.resolve()` on every match passed to \" + \"`dataStrategy` to ensure all routes are properly loaded.\"));\n // Filter out any middleware-only matches for which we didn't need to run handlers\n return results.filter((_, i) => routeIdsToLoad.has(matches[i].route.id));\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, manifest, mapRouteProperties, 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 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;\n if (handlerOverride) {\n handlerPromise = handlerOverride(ctx => actualHandler(ctx));\n } else {\n handlerPromise = (async () => {\n try {\n let val = await 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 }\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n if (match.route.lazy) {\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 }), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]);\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 loadLazyRouteModule(match.route, mapRouteProperties, manifest);\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 // HandlerResults 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 convertHandlerResultToDataResult(handlerResult) {\n let {\n result,\n type,\n status\n } = handlerResult;\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 return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : status\n };\n }\n if (isDeferredData(result)) {\n var _result$init, _result$init2;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: ((_result$init2 = result.init) == null ? void 0 : _result$init2.headers) && new Headers(result.init.headers)\n };\n }\n return {\n type: ResultType.data,\n data: result,\n statusCode: status\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) {\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 let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return url.pathname + url.search + url.hash;\n }\n }\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, matchesToLoad, 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 results.forEach((result, index) => {\n let id = matchesToLoad[index].route.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, matchesToLoad, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, 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 for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match,\n controller\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index];\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\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 } = _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 for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return {\n result,\n idx: i\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 isHandlerResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectHandlerResult(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 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 resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\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) && (isFetcher || 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 let signal = signals[index];\n invariant(signal, \"Expected an AbortSignal for revalidating fetcher deferred result\");\n await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\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\n\n//# sourceMappingURL=router.js.map\n\n\n//# sourceURL=webpack://spt/./node_modules/@remix-run/router/dist/router.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortedDeferredError: () => (/* binding */ AbortedDeferredError),\n/* harmony export */ Action: () => (/* binding */ Action),\n/* harmony export */ IDLE_BLOCKER: () => (/* binding */ IDLE_BLOCKER),\n/* harmony export */ IDLE_FETCHER: () => (/* binding */ IDLE_FETCHER),\n/* harmony export */ IDLE_NAVIGATION: () => (/* binding */ IDLE_NAVIGATION),\n/* harmony export */ UNSAFE_DEFERRED_SYMBOL: () => (/* binding */ UNSAFE_DEFERRED_SYMBOL),\n/* harmony export */ UNSAFE_DeferredData: () => (/* binding */ DeferredData),\n/* harmony export */ UNSAFE_ErrorResponseImpl: () => (/* binding */ ErrorResponseImpl),\n/* harmony export */ UNSAFE_convertRouteMatchToUiMatch: () => (/* binding */ convertRouteMatchToUiMatch),\n/* harmony export */ UNSAFE_convertRoutesToDataRoutes: () => (/* binding */ convertRoutesToDataRoutes),\n/* harmony export */ UNSAFE_getResolveToMatches: () => (/* binding */ getResolveToMatches),\n/* harmony export */ UNSAFE_invariant: () => (/* binding */ invariant),\n/* harmony export */ UNSAFE_warning: () => (/* binding */ warning),\n/* harmony export */ createBrowserHistory: () => (/* binding */ createBrowserHistory),\n/* harmony export */ createHashHistory: () => (/* binding */ createHashHistory),\n/* harmony export */ createMemoryHistory: () => (/* binding */ createMemoryHistory),\n/* harmony export */ createPath: () => (/* binding */ createPath),\n/* harmony export */ createRouter: () => (/* binding */ createRouter),\n/* harmony export */ createStaticHandler: () => (/* binding */ createStaticHandler),\n/* harmony export */ defer: () => (/* binding */ defer),\n/* harmony export */ generatePath: () => (/* binding */ generatePath),\n/* harmony export */ getStaticContextFromError: () => (/* binding */ getStaticContextFromError),\n/* harmony export */ getToPathname: () => (/* binding */ getToPathname),\n/* harmony export */ isDeferredData: () => (/* binding */ isDeferredData),\n/* harmony export */ isRouteErrorResponse: () => (/* binding */ isRouteErrorResponse),\n/* harmony export */ joinPaths: () => (/* binding */ joinPaths),\n/* harmony export */ json: () => (/* binding */ json),\n/* harmony export */ matchPath: () => (/* binding */ matchPath),\n/* harmony export */ matchRoutes: () => (/* binding */ matchRoutes),\n/* harmony export */ normalizePathname: () => (/* binding */ normalizePathname),\n/* harmony export */ parsePath: () => (/* binding */ parsePath),\n/* harmony export */ redirect: () => (/* binding */ redirect),\n/* harmony export */ redirectDocument: () => (/* binding */ redirectDocument),\n/* harmony export */ resolvePath: () => (/* binding */ resolvePath),\n/* harmony export */ resolveTo: () => (/* binding */ resolveTo),\n/* harmony export */ stripBasename: () => (/* binding */ stripBasename)\n/* harmony export */ });\n/**\n * @remix-run/router v1.17.0\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 _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, 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 () 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/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 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 let decoded = decodePath(pathname);\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/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/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}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/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 = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\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 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 * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \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 === matches.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 `` 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 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}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\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 */\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 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}\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 * @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.unstable_dataStrategy || defaultDataStrategy;\n let patchRoutesOnMissImpl = init.unstable_patchRoutesOnMiss;\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 unstable_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 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 initialErrors = null;\n if (initialMatches == null && !patchRoutesOnMissImpl) {\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 let initialized;\n if (!initialMatches) {\n // We need to run patchRoutesOnMiss in initialize()\n initialized = false;\n initialMatches = [];\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 let isRouteInitialized = m => {\n // No loader, nothing to initialize\n if (!m.route.loader) {\n return true;\n }\n // Explicitly opting-in to running on hydration\n if (typeof m.route.loader === \"function\" && m.route.loader.hydrate === true) {\n return false;\n }\n // Otherwise, initialized if hydrated with data or an error\n return loaderData && loaderData[m.route.id] !== undefined || errors && errors[m.route.id] !== undefined;\n };\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(isRouteInitialized);\n } else {\n initialized = initialMatches.every(isRouteInitialized);\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 = [];\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 // Map of pending patchRoutesOnMiss() promises (keyed by path/matches) so\n // that we only kick them off once for a given combo\n let pendingPatchRoutes = 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 ignoreNextHistoryUpdate = false;\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 (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\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 ignoreNextHistoryUpdate = true;\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\n 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 // 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 unstable_viewTransitionOpts: opts.viewTransitionOpts,\n unstable_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 }\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 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 cancelledFetcherLoads = [];\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.unstable_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.unstable_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 });\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 = matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\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 // 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 load will always\n // be \"same hash\". For example, on /page#hash and submit a \n // which will default to a navigation to /page\n if (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 // 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 {\n error,\n notFoundMatches,\n route\n } = handleDiscoverRouteError(location.pathname, discoverResult);\n return {\n matches: notFoundMatches,\n pendingActionResult: [route.id, {\n type: ResultType.error,\n 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\", request, [actionMatch], matches);\n result = results[0];\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);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, {\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 {\n error,\n notFoundMatches,\n route\n } = handleDiscoverRouteError(location.pathname, discoverResult);\n return {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: 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.unstable_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 if (fetchControllers.has(rf.key)) {\n abortFetcher(rf.key);\n }\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, 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, ...fetcherResults]);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\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 let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n await startRedirectNavigation(request, redirect.result, {\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, matchesToLoad, 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 // During partial hydration, preserve SSR errors for routes that don't re-run\n if (future.v7_partialHydration && initialHydration && state.errors) {\n Object.entries(state.errors).filter(_ref2 => {\n let [id] = _ref2;\n return !matchesToLoad.some(m => m.route.id === id);\n }).forEach(_ref3 => {\n let [routeId, error] = _ref3;\n errors = Object.assign(errors || {}, {\n [routeId]: error\n });\n });\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 if (fetchControllers.has(key)) abortFetcher(key);\n let flushSync = (opts && opts.unstable_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 pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, 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, 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, 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, path, fetchRequest.signal);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n let {\n error\n } = handleDiscoverRouteError(path, discoverResult);\n setFetcherError(key, routeId, 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\", fetchRequest, [match], requestMatches);\n let actionResult = actionResults[0];\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, {\n fetcherSubmission: submission\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.unstable_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 if (fetchControllers.has(staleKey)) {\n abortFetcher(staleKey);\n }\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, 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, ...fetcherResults]);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\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 let fetcherKey = revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n return startRedirectNavigation(revalidationRequest, redirect.result);\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, 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, 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, path, fetchRequest.signal);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n let {\n error\n } = handleDiscoverRouteError(path, discoverResult);\n setFetcherError(key, routeId, 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\", fetchRequest, [match], matches);\n let result = results[0];\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);\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, _temp2) {\n let {\n submission,\n fetcherSubmission,\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);\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 ? 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 this flag across redirects\n preventScrollReset: pendingPreventScrollReset\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 this flag across redirects\n preventScrollReset: pendingPreventScrollReset\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, request, matchesToLoad, matches) {\n try {\n let results = await callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties);\n return await Promise.all(results.map((result, i) => {\n if (isRedirectHandlerResult(result)) {\n let response = result.result;\n return {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].route.id, matches, basename, future.v7_relativeSplatPath)\n };\n }\n return convertHandlerResultToDataResult(result);\n }));\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 return matchesToLoad.map(() => ({\n type: ResultType.error,\n error: e\n }));\n }\n }\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n let [loaderResults, ...fetcherResults] = await Promise.all([matchesToLoad.length ? callDataStrategy(\"loader\", request, matchesToLoad, matches) : [], ...fetchersToLoad.map(f => {\n if (f.matches && f.match && f.controller) {\n let fetcherRequest = createClientSideRequest(init.history, f.path, f.controller.signal);\n return callDataStrategy(\"loader\", fetcherRequest, [f.match], f.matches).then(r => r[0]);\n } else {\n return Promise.resolve({\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n });\n }\n })]);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]);\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.push(key);\n abortFetcher(key);\n }\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 if (future.v7_fetcherPersist) {\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 }\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 deletedFetchers.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n if (future.v7_fetcherPersist) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n } else {\n activeFetchers.set(key, count);\n }\n } else {\n deleteFetcher(key);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n invariant(controller, \"Expected fetch controller: \" + key);\n controller.abort();\n fetchControllers.delete(key);\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(_ref4) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref4;\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 handleDiscoverRouteError(pathname, discoverResult) {\n let matches = discoverResult.partialMatches;\n let route = matches[matches.length - 1].route;\n let error = getInternalRouterError(400, {\n type: \"route-discovery\",\n routeId: route.id,\n pathname,\n message: discoverResult.error != null && \"message\" in discoverResult.error ? discoverResult.error : String(discoverResult.error)\n });\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 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 \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 (patchRoutesOnMissImpl) {\n if (!matches) {\n let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: fogMatches || []\n };\n } else {\n let leafRoute = matches[matches.length - 1].route;\n if (leafRoute.path === \"*\") {\n // If we matched a splat, it might only be because we haven't yet fetched\n // the children that would match with a higher score, so let's fetch\n // around and find out\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) {\n let partialMatches = matches;\n let route = partialMatches.length > 0 ? partialMatches[partialMatches.length - 1].route : null;\n while (true) {\n try {\n await loadLazyRouteChildren(patchRoutesOnMissImpl, pathname, partialMatches, dataRoutes || inFlightDataRoutes, manifest, mapRouteProperties, pendingPatchRoutes, signal);\n } catch (e) {\n return {\n type: \"error\",\n error: e,\n partialMatches\n };\n }\n if (signal.aborted) {\n return {\n type: \"aborted\"\n };\n }\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let newMatches = matchRoutes(routesToUse, pathname, basename);\n let matchedSplat = false;\n if (newMatches) {\n let leafRoute = newMatches[newMatches.length - 1].route;\n if (leafRoute.index) {\n // If we found an index route, we can stop\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n if (leafRoute.path && leafRoute.path.length > 0) {\n if (leafRoute.path === \"*\") {\n // If we found a splat route, we can't be sure there's not a\n // higher-scoring route down some partial matches trail so we need\n // to check that out\n matchedSplat = true;\n } else {\n // If we found a non-splat route, we can stop\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n }\n }\n let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n // If we are no longer partially matching anything, this was either a\n // legit splat match above, or it's a 404. Also avoid loops if the\n // second pass results in the same partial matches\n if (!newPartialMatches || partialMatches.map(m => m.route.id).join(\"-\") === newPartialMatches.map(m => m.route.id).join(\"-\")) {\n return {\n type: \"success\",\n matches: matchedSplat ? newMatches : null\n };\n }\n partialMatches = newPartialMatches;\n route = partialMatches[partialMatches.length - 1].route;\n if (route.path === \"*\") {\n // The splat is still our most accurate partial, so run with it\n return {\n type: \"success\",\n matches: partialMatches\n };\n }\n }\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\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(routeId, children) {\n return patchRoutes(routeId, children, dataRoutes || inFlightDataRoutes, manifest, mapRouteProperties);\n },\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 unstable_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, unstable_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 unstable_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, unstable_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, unstable_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, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, unstable_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 `HandlerResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isHandlerResult(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, unstable_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, unstable_dataStrategy);\n result = results[0];\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, unstable_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, unstable_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, unstable_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, unstable_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, matchesToLoad, 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, unstable_dataStrategy) {\n let results = await callDataStrategyImpl(unstable_dataStrategy || defaultDataStrategy, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext);\n return await Promise.all(results.map((result, i) => {\n if (isRedirectHandlerResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, matchesToLoad[i].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 return convertHandlerResultToDataResult(result);\n }));\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 // Add an ?index param for matched index routes if we don't already have one\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\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, _ref5) => {\n let [name, value] = _ref5;\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 below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, isInitialLoad, 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 boundaryId = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[0] : undefined;\n let boundaryMatches = boundaryId ? getLoaderMatchesUntilBoundary(matches, boundaryId) : matches;\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 (isInitialLoad) {\n if (typeof route.loader !== \"function\" || route.loader.hydrate) {\n return true;\n }\n return state.loaderData[route.id] === undefined && (\n // Don't re-run if the loader ran and threw an error\n !state.errors || state.errors[route.id] === undefined);\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 unstable_actionStatus: 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 load (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 (isInitialLoad || !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.includes(key)) {\n // Always revalidate if the fetcher was cancelled\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 unstable_actionStatus: 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 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}\n/**\n * Idempotent utility to execute route.children() method to lazily load route\n * definitions and update the routes/routeManifest\n */\nasync function loadLazyRouteChildren(patchRoutesOnMissImpl, path, matches, routes, manifest, mapRouteProperties, pendingRouteChildren, signal) {\n let key = [path, ...matches.map(m => m.route.id)].join(\"-\");\n try {\n let pending = pendingRouteChildren.get(key);\n if (!pending) {\n pending = patchRoutesOnMissImpl({\n path,\n matches,\n patch: (routeId, children) => {\n if (!signal.aborted) {\n patchRoutes(routeId, children, routes, manifest, mapRouteProperties);\n }\n }\n });\n pendingRouteChildren.set(key, pending);\n }\n if (pending && isPromise(pending)) {\n await pending;\n }\n } finally {\n pendingRouteChildren.delete(key);\n }\n}\nfunction patchRoutes(routeId, children, routes, manifest, mapRouteProperties) {\n if (routeId) {\n var _route$children;\n let route = manifest[routeId];\n invariant(route, \"No route found to patch children into: routeId = \" + routeId);\n let dataChildren = convertRoutesToDataRoutes(children, mapRouteProperties, [routeId, \"patch\", String(((_route$children = route.children) == null ? void 0 : _route$children.length) || \"0\")], manifest);\n if (route.children) {\n route.children.push(...dataChildren);\n } else {\n route.children = dataChildren;\n }\n } else {\n let dataChildren = convertRoutesToDataRoutes(children, mapRouteProperties, [\"patch\", String(routes.length || \"0\")], manifest);\n routes.push(...dataChildren);\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\nfunction defaultDataStrategy(opts) {\n return Promise.all(opts.matches.map(m => m.resolve()));\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, manifest, mapRouteProperties, requestContext) {\n let routeIdsToLoad = matchesToLoad.reduce((acc, m) => acc.add(m.route.id), new Set());\n let loadedMatches = new Set();\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: matches.map(match => {\n let shouldLoad = routeIdsToLoad.has(match.route.id);\n // `resolve` encapsulates the route.lazy, executing the\n // loader/action, and mapping return values/thrown errors to a\n // HandlerResult. Users can pass a callback to take fine-grained control\n // over the execution of the loader/action\n let resolve = handlerOverride => {\n loadedMatches.add(match.route.id);\n return shouldLoad ? callLoaderOrAction(type, request, match, manifest, mapRouteProperties, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n }),\n request,\n params: matches[0].params,\n context: requestContext\n });\n // Throw if any loadRoute implementations not called since they are what\n // ensures a route is fully loaded\n matches.forEach(m => invariant(loadedMatches.has(m.route.id), \"`match.resolve()` was not called for route id \\\"\" + m.route.id + \"\\\". \" + \"You must call `match.resolve()` on every match passed to \" + \"`dataStrategy` to ensure all routes are properly loaded.\"));\n // Filter out any middleware-only matches for which we didn't need to run handlers\n return results.filter((_, i) => routeIdsToLoad.has(matches[i].route.id));\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, manifest, mapRouteProperties, 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 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;\n if (handlerOverride) {\n handlerPromise = handlerOverride(ctx => actualHandler(ctx));\n } else {\n handlerPromise = (async () => {\n try {\n let val = await 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 }\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n if (match.route.lazy) {\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 }), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]);\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 loadLazyRouteModule(match.route, mapRouteProperties, manifest);\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 // HandlerResults 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 convertHandlerResultToDataResult(handlerResult) {\n let {\n result,\n type,\n status\n } = handlerResult;\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 return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : status\n };\n }\n if (isDeferredData(result)) {\n var _result$init, _result$init2;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: ((_result$init2 = result.init) == null ? void 0 : _result$init2.headers) && new Headers(result.init.headers)\n };\n }\n return {\n type: ResultType.data,\n data: result,\n statusCode: status\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) {\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 let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return url.pathname + url.search + url.hash;\n }\n }\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, matchesToLoad, 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 results.forEach((result, index) => {\n let id = matchesToLoad[index].route.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, matchesToLoad, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, 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 for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match,\n controller\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index];\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\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 (type === \"route-discovery\") {\n errorMessage = \"Unable to match URL \\\"\" + pathname + \"\\\" - the `children()` function for \" + (\"route `\" + routeId + \"` threw the following error:\\n\" + message);\n } else 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 for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return {\n result,\n idx: i\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 isPromise(val) {\n return typeof val === \"object\" && val != null && \"then\" in val;\n}\nfunction isHandlerResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectHandlerResult(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 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 resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\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) && (isFetcher || 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 let signal = signals[index];\n invariant(signal, \"Expected an AbortSignal for revalidating fetcher deferred result\");\n await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\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\n\n//# sourceMappingURL=router.js.map\n\n\n//# sourceURL=webpack://spt/./node_modules/@remix-run/router/dist/router.js?"); /***/ }), @@ -4580,7 +4580,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { -eval("/**\n * @welldone-software/why-did-you-render 8.0.1\n * MIT Licensed\n * Generated by Vitali Zaidman (https://github.com/vzaidman)\n * Generated at 2023-12-26\n */\n\n(function (global, factory) {\n true ? module.exports = factory(__webpack_require__(/*! react */ \"./node_modules/react/index.js\"), __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\")) :\n 0;\n})(this, (function (React, lodash) { 'use strict';\n\n function _interopNamespaceDefault(e) {\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== 'default') {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(n, k, d.get ? d : {\n enumerable: true,\n get: function () { return e[k]; }\n });\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n }\n\n var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);\n\n var wdyrStore = {\n /* The React object we patch */\n React: undefined,\n /* Processed user options for WDYR */\n options: undefined,\n /* The original React.createElement function */\n origCreateElement: undefined,\n /* The original React.createFactory function */\n origCreateFactory: undefined,\n /* The original React.cloneElement function */\n origCloneElement: undefined,\n /* A weak map of all React elements to their WDYR patched react elements */\n componentsMap: new WeakMap(),\n /* A weak map of props to the owner element that passed them */\n ownerDataMap: new WeakMap(),\n /* An array of hooks tracked during one render */\n hooksPerRender: []\n };\n\n function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n }\n function ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n }\n function _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n }\n function _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n }\n function _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : String(i);\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n }\n function _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n }\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n }\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n }\n function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n }\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n }\n function _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return _assertThisInitialized(self);\n }\n function _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n }\n function _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n return object;\n }\n function _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n return desc.value;\n };\n }\n return _get.apply(this, arguments);\n }\n function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n }\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n }\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n }\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n }\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _createForOfIteratorHelper(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (!it) {\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function () {};\n return {\n s: F,\n n: function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function (e) {\n throw e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function () {\n it = it.call(o);\n },\n n: function () {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function (e) {\n didErr = true;\n err = e;\n },\n f: function () {\n try {\n if (!normalCompletion && it.return != null) it.return();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n }\n\n var diffTypes = {\n 'different': 'different',\n 'deepEquals': 'deepEquals',\n 'date': 'date',\n 'regex': 'regex',\n 'reactElement': 'reactElement',\n 'function': 'function',\n 'same': 'same'\n };\n var diffTypesDescriptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, diffTypes.different, 'different objects'), diffTypes.deepEquals, 'different objects that are equal by value'), diffTypes.date, 'different date objects with the same value'), diffTypes.regex, 'different regular expressions with the same value'), diffTypes.reactElement, 'different React elements (remember that the syntax always produces a *NEW* immutable React element so a component that receives as props always re-renders)'), diffTypes[\"function\"], 'different functions with the same name'), diffTypes.same, 'same objects by ref (===)');\n\n // copied from packages/shared/ReactSymbols.js in https://github.com/facebook/react\n var hasSymbol$1 = typeof Symbol === 'function' && Symbol[\"for\"];\n var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol[\"for\"]('react.memo') : 0xead3;\n var REACT_FORWARD_REF_TYPE = hasSymbol$1 ? Symbol[\"for\"]('react.forward_ref') : 0xead0;\n var REACT_STRICT_MODE = 8;\n\n var hasElementType = typeof Element !== 'undefined';\n\n // copied from https://github.com/facebook/react/packages/shared/ReactSymbols.js\n var hasSymbol = typeof Symbol === 'function' && Symbol[\"for\"];\n var REACT_ELEMENT_TYPE = hasSymbol ? Symbol[\"for\"]('react.element') : 0xeac7;\n var isReactElement = function isReactElement(object) {\n return object.$$typeof === REACT_ELEMENT_TYPE;\n };\n // end\n\n function trackDiff(a, b, diffsAccumulator, pathString, diffType) {\n diffsAccumulator.push({\n diffType: diffType,\n pathString: pathString,\n prevValue: a,\n nextValue: b\n });\n return diffType !== diffTypes.different;\n }\n function isGetter(obj, prop) {\n return !!Object.getOwnPropertyDescriptor(obj, prop)['get'];\n }\n var dependenciesMap = new WeakMap();\n function accumulateDeepEqualDiffs(a, b, diffsAccumulator) {\n var pathString = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';\n var _ref = arguments.length > 4 ? arguments[4] : undefined,\n detailed = _ref.detailed;\n if (a === b) {\n if (detailed) {\n trackDiff(a, b, diffsAccumulator, pathString, diffTypes.same);\n }\n return true;\n }\n if (!a || !b) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isArray(a) && lodash.isArray(b)) {\n var arrayLength = a.length;\n if (arrayLength !== b.length) {\n return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.different);\n }\n var arrayItemDiffs = [];\n var numberOfDeepEqualsItems = 0;\n for (var i = arrayLength; i--; i > 0) {\n var diffEquals = accumulateDeepEqualDiffs(a[i], b[i], arrayItemDiffs, \"\".concat(pathString, \"[\").concat(i, \"]\"), {\n detailed: detailed\n });\n if (diffEquals) {\n numberOfDeepEqualsItems++;\n }\n }\n if (detailed || numberOfDeepEqualsItems !== arrayLength) {\n diffsAccumulator.push.apply(diffsAccumulator, arrayItemDiffs);\n }\n if (numberOfDeepEqualsItems === arrayLength) {\n return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.deepEquals);\n }\n return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isSet(a) && lodash.isSet(b)) {\n if (a.size !== b.size) {\n return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.different);\n }\n var _iterator = _createForOfIteratorHelper(a),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var valA = _step.value;\n if (!b.has(valA)) {\n return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.different);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.deepEquals);\n }\n if (lodash.isDate(a) && lodash.isDate(b)) {\n return a.getTime() === b.getTime() ? trackDiff(new Date(a), new Date(b), diffsAccumulator, pathString, diffTypes.date) : trackDiff(new Date(a), new Date(b), diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isRegExp(a) && lodash.isRegExp(b)) {\n return a.toString() === b.toString() ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes.regex) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (hasElementType && a instanceof Element && b instanceof Element) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (isReactElement(a) && isReactElement(b)) {\n if (a.type !== b.type) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n var reactElementPropsAreDeepEqual = accumulateDeepEqualDiffs(a.props, b.props, [], \"\".concat(pathString, \".props\"), {\n detailed: detailed\n });\n return reactElementPropsAreDeepEqual ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes.reactElement) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isFunction(a) && lodash.isFunction(b)) {\n if (a.name !== b.name) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n var aDependenciesObj = dependenciesMap.get(a);\n var bDependenciesObj = dependenciesMap.get(b);\n if (aDependenciesObj && bDependenciesObj) {\n var dependenciesAreDeepEqual = accumulateDeepEqualDiffs(aDependenciesObj.deps, bDependenciesObj.deps, diffsAccumulator, \"\".concat(pathString, \":parent-hook-\").concat(aDependenciesObj.hookName, \"-deps\"), {\n detailed: detailed\n });\n return dependenciesAreDeepEqual ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes[\"function\"]) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes[\"function\"]);\n }\n if (_typeof(a) === 'object' && _typeof(b) === 'object' && Object.getPrototypeOf(a) === Object.getPrototypeOf(b)) {\n var aKeys = Object.getOwnPropertyNames(a);\n var bKeys = Object.getOwnPropertyNames(b);\n var allKeys = lodash.uniq([].concat(_toConsumableArray(aKeys), _toConsumableArray(bKeys)));\n var clonedA = lodash.isPlainObject(a) ? _objectSpread2({}, a) : a;\n var clonedB = lodash.isPlainObject(b) ? _objectSpread2({}, b) : b;\n if (allKeys.length !== aKeys.length || allKeys.length !== bKeys.length) {\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different);\n }\n var relevantKeys = allKeys.filter(function (key) {\n // do not compare the stack as it differ even though the errors are identical.\n if (key === 'stack' && lodash.isError(a)) {\n return false;\n }\n\n // getters checking is causing too much problems because of how it's used in js.\n // not only getters can throw errors, they also cause side effects in many cases.\n if (isGetter(a, key)) {\n return false;\n }\n return true;\n });\n var keysLength = relevantKeys.length;\n for (var _i = keysLength; _i--; _i > 0) {\n if (!lodash.has(b, relevantKeys[_i])) {\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different);\n }\n }\n var objectValuesDiffs = [];\n var numberOfDeepEqualsObjectValues = 0;\n for (var _i2 = keysLength; _i2--; _i2 > 0) {\n var key = relevantKeys[_i2];\n var deepEquals = accumulateDeepEqualDiffs(a[key], b[key], objectValuesDiffs, \"\".concat(pathString, \".\").concat(key), {\n detailed: detailed\n });\n if (deepEquals) {\n numberOfDeepEqualsObjectValues++;\n }\n }\n if (detailed || numberOfDeepEqualsObjectValues !== keysLength) {\n diffsAccumulator.push.apply(diffsAccumulator, objectValuesDiffs);\n }\n if (numberOfDeepEqualsObjectValues === keysLength) {\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.deepEquals);\n }\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different);\n }\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n function calculateDeepEqualDiffs(a, b, initialPathString) {\n var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},\n _ref2$detailed = _ref2.detailed,\n detailed = _ref2$detailed === void 0 ? false : _ref2$detailed;\n try {\n var diffs = [];\n accumulateDeepEqualDiffs(a, b, diffs, initialPathString, {\n detailed: detailed\n });\n return diffs;\n } catch (error) {\n if (error.message && error.message.match(/stack|recursion/i) || error.number === -2146828260) {\n // warn on circular references, don't crash.\n // browsers throw different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n // eslint-disable-next-line no-console\n console.warn('Warning: why-did-you-render couldn\\'t handle circular references in props.', error.name, error.message);\n return false;\n }\n throw error;\n }\n }\n\n function printDiff(value1, value2, _ref) {\n var pathString = _ref.pathString,\n consoleLog = _ref.consoleLog;\n var diffs = calculateDeepEqualDiffs(value1, value2, pathString, {\n detailed: true\n });\n var keysLength = Math.max.apply(Math, _toConsumableArray(diffs.map(function (diff) {\n return diff.pathString.length;\n }))) + 2;\n Object.entries(lodash.groupBy(lodash.sortBy(diffs, 'pathString'), 'diffType')).forEach(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n diffType = _ref3[0],\n diffs = _ref3[1];\n consoleLog(\"%c\".concat(diffTypesDescriptions[diffType], \":\"), 'text-decoration: underline; color: blue;');\n diffs.forEach(function (diff) {\n consoleLog(\"\".concat(diff.pathString, \":\").padEnd(keysLength, ' '), diff.prevValue);\n });\n });\n }\n\n var moreInfoUrl = 'http://bit.ly/wdyr02';\n var moreInfoHooksUrl = 'http://bit.ly/wdyr3';\n var inHotReload = false;\n function shouldLog(reason, Component) {\n if (inHotReload) {\n return false;\n }\n if (wdyrStore.options.logOnDifferentValues) {\n return true;\n }\n if (Component.whyDidYouRender && Component.whyDidYouRender.logOnDifferentValues) {\n return true;\n }\n var hasDifferentValues = reason.propsDifferences && reason.propsDifferences.some(function (diff) {\n return diff.diffType === diffTypes.different;\n }) || reason.stateDifferences && reason.stateDifferences.some(function (diff) {\n return diff.diffType === diffTypes.different;\n }) || reason.hookDifferences && reason.hookDifferences.some(function (diff) {\n return diff.diffType === diffTypes.different;\n });\n return !hasDifferentValues;\n }\n function logDifference(_ref) {\n var Component = _ref.Component,\n displayName = _ref.displayName,\n hookName = _ref.hookName,\n prefixMessage = _ref.prefixMessage,\n diffObjType = _ref.diffObjType,\n differences = _ref.differences,\n values = _ref.values;\n if (differences && differences.length > 0) {\n wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), \"\".concat(prefixMessage, \" of \").concat(diffObjType, \" changes:\"));\n differences.forEach(function (_ref2) {\n var pathString = _ref2.pathString,\n diffType = _ref2.diffType,\n prevValue = _ref2.prevValue,\n nextValue = _ref2.nextValue;\n function diffFn() {\n printDiff(prevValue, nextValue, {\n pathString: pathString,\n consoleLog: wdyrStore.options.consoleLog\n });\n }\n wdyrStore.options.consoleGroup(\"%c\".concat(diffObjType === 'hook' ? \"[hook \".concat(hookName, \" result]\") : \"\".concat(diffObjType, \".\"), \"%c\").concat(pathString, \"%c\"), \"color:\".concat(wdyrStore.options.diffNameColor, \";\"), \"color:\".concat(wdyrStore.options.diffPathColor, \";\"), 'color:default;');\n wdyrStore.options.consoleLog(\"\".concat(diffTypesDescriptions[diffType], \". (more info at \").concat(hookName ? moreInfoHooksUrl : moreInfoUrl, \")\"));\n wdyrStore.options.consoleLog(_defineProperty({}, \"prev \".concat(pathString), prevValue), '!==', _defineProperty({}, \"next \".concat(pathString), nextValue));\n if (diffType === diffTypes.deepEquals) {\n wdyrStore.options.consoleLog({\n 'For detailed diff, right click the following fn, save as global, and run: ': diffFn\n });\n }\n wdyrStore.options.consoleGroupEnd();\n });\n } else if (differences) {\n wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), \"\".concat(prefixMessage, \" the \").concat(diffObjType, \" object itself changed but its values are all equal.\"), diffObjType === 'props' ? 'This could have been avoided by making the component pure, or by preventing its father from re-rendering.' : 'This usually means this component called setState when no changes in its state actually occurred.', \"More info at \".concat(moreInfoUrl));\n wdyrStore.options.consoleLog(\"prev \".concat(diffObjType, \":\"), values.prev, ' !== ', values.next, \":next \".concat(diffObjType));\n }\n }\n function defaultNotifier(updateInfo) {\n var Component = updateInfo.Component,\n displayName = updateInfo.displayName,\n hookName = updateInfo.hookName,\n prevProps = updateInfo.prevProps,\n prevState = updateInfo.prevState,\n prevHook = updateInfo.prevHook,\n nextProps = updateInfo.nextProps,\n nextState = updateInfo.nextState,\n nextHook = updateInfo.nextHook,\n reason = updateInfo.reason;\n if (!shouldLog(reason, Component, wdyrStore.options)) {\n return;\n }\n wdyrStore.options.consoleGroup(\"%c\".concat(displayName), \"color: \".concat(wdyrStore.options.titleColor, \";\"));\n var prefixMessage = 'Re-rendered because';\n if (reason.propsDifferences) {\n logDifference({\n Component: Component,\n displayName: displayName,\n prefixMessage: prefixMessage,\n diffObjType: 'props',\n differences: reason.propsDifferences,\n values: {\n prev: prevProps,\n next: nextProps\n }\n });\n prefixMessage = 'And because';\n }\n if (reason.stateDifferences) {\n logDifference({\n Component: Component,\n displayName: displayName,\n prefixMessage: prefixMessage,\n diffObjType: 'state',\n differences: reason.stateDifferences,\n values: {\n prev: prevState,\n next: nextState\n }\n });\n }\n if (reason.hookDifferences) {\n logDifference({\n Component: Component,\n displayName: displayName,\n prefixMessage: prefixMessage,\n diffObjType: 'hook',\n differences: reason.hookDifferences,\n values: {\n prev: prevHook,\n next: nextHook\n },\n hookName: hookName\n });\n }\n if (reason.propsDifferences && reason.ownerDifferences) {\n var prevOwnerData = wdyrStore.ownerDataMap.get(prevProps);\n var nextOwnerData = wdyrStore.ownerDataMap.get(nextProps);\n wdyrStore.options.consoleGroup(\"Rendered by \".concat(nextOwnerData.displayName));\n var _prefixMessage = 'Re-rendered because';\n if (reason.ownerDifferences.propsDifferences) {\n logDifference({\n Component: nextOwnerData.Component,\n displayName: nextOwnerData.displayName,\n prefixMessage: _prefixMessage,\n diffObjType: 'props',\n differences: reason.ownerDifferences.propsDifferences,\n values: {\n prev: prevOwnerData.props,\n next: nextOwnerData.props\n }\n });\n _prefixMessage = 'And because';\n }\n if (reason.ownerDifferences.stateDifferences) {\n logDifference({\n Component: nextOwnerData.Component,\n displayName: nextOwnerData.displayName,\n prefixMessage: _prefixMessage,\n diffObjType: 'state',\n differences: reason.ownerDifferences.stateDifferences,\n values: {\n prev: prevOwnerData.state,\n next: nextOwnerData.state\n }\n });\n }\n if (reason.ownerDifferences.hookDifferences) {\n reason.ownerDifferences.hookDifferences.forEach(function (_ref3, i) {\n var hookName = _ref3.hookName,\n differences = _ref3.differences;\n return logDifference({\n Component: nextOwnerData.Component,\n displayName: nextOwnerData.displayName,\n prefixMessage: _prefixMessage,\n diffObjType: 'hook',\n differences: differences,\n values: {\n prev: prevOwnerData.hooks[i].result,\n next: nextOwnerData.hooks[i].result\n },\n hookName: hookName\n });\n });\n }\n wdyrStore.options.consoleGroupEnd();\n }\n if (!reason.propsDifferences && !reason.stateDifferences && !reason.hookDifferences) {\n wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), 'Re-rendered although props and state objects are the same.', 'This usually means there was a call to this.forceUpdate() inside the component.', \"more info at \".concat(moreInfoUrl));\n }\n wdyrStore.options.consoleGroupEnd();\n }\n function createDefaultNotifier(hotReloadBufferMs) {\n if (hotReloadBufferMs) {\n if (false) {}\n }\n return defaultNotifier;\n }\n\n var emptyFn = function emptyFn() {};\n function normalizeOptions() {\n var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var consoleGroup = console.group;\n var consoleGroupEnd = console.groupEnd;\n if (userOptions.collapseGroups) {\n consoleGroup = console.groupCollapsed;\n } else if (userOptions.onlyLogs) {\n consoleGroup = console.log;\n consoleGroupEnd = emptyFn;\n }\n var notifier = userOptions.notifier || createDefaultNotifier('hotReloadBufferMs' in userOptions ? userOptions.hotReloadBufferMs : 500);\n return _objectSpread2({\n include: null,\n exclude: null,\n notifier: notifier,\n onlyLogs: false,\n consoleLog: console.log,\n consoleGroup: consoleGroup,\n consoleGroupEnd: consoleGroupEnd,\n logOnDifferentValues: false,\n logOwnerReasons: true,\n trackHooks: true,\n titleColor: '#058',\n diffNameColor: 'blue',\n diffPathColor: 'red',\n trackExtraHooks: [],\n trackAllPureComponents: false\n }, userOptions);\n }\n\n function getDisplayName(type) {\n return type.displayName || type.name || type.type && getDisplayName(type.type) || type.render && getDisplayName(type.render) || (lodash.isString(type) ? type : 'Unknown');\n }\n\n function getDefaultProps(type) {\n return type.defaultProps || type.type && getDefaultProps(type.type) || type.render && getDefaultProps(type.render) || {};\n }\n\n var emptyObject = {};\n function findObjectsDifferences(userPrevObj, userNextObj) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n _ref$shallow = _ref.shallow,\n shallow = _ref$shallow === void 0 ? true : _ref$shallow;\n if (userPrevObj === userNextObj) {\n return false;\n }\n if (!shallow) {\n return calculateDeepEqualDiffs(userPrevObj, userNextObj);\n }\n var prevObj = userPrevObj || emptyObject;\n var nextObj = userNextObj || emptyObject;\n var keysOfBothObjects = Object.keys(_objectSpread2(_objectSpread2({}, prevObj), nextObj));\n return lodash.reduce(keysOfBothObjects, function (result, key) {\n var deepEqualDiffs = calculateDeepEqualDiffs(prevObj[key], nextObj[key], key);\n if (deepEqualDiffs) {\n result = [].concat(_toConsumableArray(result), _toConsumableArray(deepEqualDiffs));\n }\n return result;\n }, []);\n }\n\n function getOwnerDifferences(_ref) {\n var prevOwnerData = _ref.prevOwnerData,\n nextOwnerData = _ref.nextOwnerData;\n if (!prevOwnerData || !nextOwnerData) {\n return false;\n }\n\n // in strict mode prevOwnerData might be twice as lengthy because of double renders\n var prevOwnerDataHooks = prevOwnerData.hooks.length === nextOwnerData.hooks.length * 2 ? prevOwnerData.hooks.slice(prevOwnerData.hooks.length / 2) : prevOwnerData.hooks;\n var hookDifferences = prevOwnerDataHooks.map(function (_ref2, i) {\n var hookName = _ref2.hookName,\n result = _ref2.result;\n return {\n hookName: hookName,\n differences: findObjectsDifferences(result, nextOwnerData.hooks[i].result, {\n shallow: false\n })\n };\n });\n return {\n propsDifferences: findObjectsDifferences(prevOwnerData.props, nextOwnerData.props),\n stateDifferences: findObjectsDifferences(prevOwnerData.state, nextOwnerData.state),\n hookDifferences: hookDifferences.length > 0 ? hookDifferences : false\n };\n }\n function getUpdateReason(prevProps, prevState, prevHook, nextProps, nextState, nextHook) {\n var prevOwnerData = wdyrStore.ownerDataMap.get(prevProps);\n var nextOwnerData = wdyrStore.ownerDataMap.get(nextProps);\n return {\n propsDifferences: findObjectsDifferences(prevProps, nextProps),\n stateDifferences: findObjectsDifferences(prevState, nextState),\n hookDifferences: findObjectsDifferences(prevHook, nextHook, {\n shallow: false\n }),\n ownerDifferences: getOwnerDifferences({\n prevOwnerData: prevOwnerData,\n nextOwnerData: nextOwnerData\n })\n };\n }\n function getUpdateInfo(_ref3) {\n var Component = _ref3.Component,\n displayName = _ref3.displayName,\n hookName = _ref3.hookName,\n prevProps = _ref3.prevProps,\n prevState = _ref3.prevState,\n prevHook = _ref3.prevHook,\n nextProps = _ref3.nextProps,\n nextState = _ref3.nextState,\n nextHook = _ref3.nextHook;\n return {\n Component: Component,\n displayName: displayName,\n hookName: hookName,\n prevProps: prevProps,\n prevState: prevState,\n prevHook: prevHook,\n nextProps: nextProps,\n nextState: nextState,\n nextHook: nextHook,\n reason: getUpdateReason(prevProps, prevState, prevHook, nextProps, nextState, nextHook)\n };\n }\n\n // copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js\n\n // based on \"findStrictRoot\" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js\n // notice: this is only used for class components. functional components doesn't render twice inside strict mode\n function checkIfInsideAStrictModeTree(reactComponentInstance) {\n var reactInternalFiber = reactComponentInstance && (reactComponentInstance._reactInternalFiber || reactComponentInstance._reactInternals);\n while (reactInternalFiber) {\n if (reactInternalFiber.mode & REACT_STRICT_MODE) {\n return true;\n }\n reactInternalFiber = reactInternalFiber[\"return\"];\n }\n return false;\n }\n function isReactClassComponent(Component) {\n return Component.prototype && !!Component.prototype.isReactComponent;\n }\n function isMemoComponent(Component) {\n return Component.$$typeof === REACT_MEMO_TYPE;\n }\n function isForwardRefComponent(Component) {\n return Component.$$typeof === REACT_FORWARD_REF_TYPE;\n }\n\n function shouldInclude(displayName) {\n return wdyrStore.options.include && wdyrStore.options.include.length > 0 && wdyrStore.options.include.some(function (regex) {\n return regex.test(displayName);\n });\n }\n function shouldExclude(displayName) {\n return wdyrStore.options.exclude && wdyrStore.options.exclude.length > 0 && wdyrStore.options.exclude.some(function (regex) {\n return regex.test(displayName);\n });\n }\n function shouldTrack(Component, _ref) {\n var isHookChange = _ref.isHookChange;\n var displayName = getDisplayName(Component);\n if (shouldExclude(displayName)) {\n return false;\n }\n if (Component.whyDidYouRender === false) {\n return false;\n }\n if (isHookChange && Component.whyDidYouRender && Component.whyDidYouRender.trackHooks === false) {\n return false;\n }\n return !!(Component.whyDidYouRender || wdyrStore.options.trackAllPureComponents && (Component && Component.prototype instanceof wdyrStore.React.PureComponent || isMemoComponent(Component)) || shouldInclude(displayName));\n }\n\n function patchClassComponent(ClassComponent, _ref) {\n var displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var WDYRPatchedClassComponent = /*#__PURE__*/function (_ClassComponent) {\n _inherits(WDYRPatchedClassComponent, _ClassComponent);\n var _super = _createSuper(WDYRPatchedClassComponent);\n function WDYRPatchedClassComponent(props, context) {\n var _thisSuper, _this;\n _classCallCheck(this, WDYRPatchedClassComponent);\n _this = _super.call(this, props, context);\n _this._WDYR = {\n renderNumber: 0\n };\n var origRender = _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(WDYRPatchedClassComponent.prototype)), \"render\", _thisSuper) || _this.render;\n\n // this probably means that render is an arrow function or this.render.bind(this) was called on the original class\n var renderIsABindedFunction = origRender !== ClassComponent.prototype.render;\n if (renderIsABindedFunction) {\n _this.render = function () {\n WDYRPatchedClassComponent.prototype.render.apply(_assertThisInitialized(_this));\n return origRender();\n };\n }\n return _this;\n }\n _createClass(WDYRPatchedClassComponent, [{\n key: \"render\",\n value: function render() {\n this._WDYR.renderNumber++;\n if (!('isStrictMode' in this._WDYR)) {\n this._WDYR.isStrictMode = checkIfInsideAStrictModeTree(this);\n }\n\n // in strict mode- ignore every other render\n if (!(this._WDYR.isStrictMode && this._WDYR.renderNumber % 2 === 1)) {\n if (this._WDYR.prevProps) {\n var updateInfo = getUpdateInfo({\n Component: ClassComponent,\n displayName: displayName,\n prevProps: this._WDYR.prevProps,\n prevState: this._WDYR.prevState,\n nextProps: this.props,\n nextState: this.state\n });\n wdyrStore.options.notifier(updateInfo);\n }\n this._WDYR.prevProps = this.props;\n this._WDYR.prevState = this.state;\n }\n return _get(_getPrototypeOf(WDYRPatchedClassComponent.prototype), \"render\", this) ? _get(_getPrototypeOf(WDYRPatchedClassComponent.prototype), \"render\", this).call(this) : null;\n }\n }]);\n return WDYRPatchedClassComponent;\n }(ClassComponent);\n try {\n WDYRPatchedClassComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRPatchedClassComponent.defaultProps = defaultProps;\n lodash.defaults(WDYRPatchedClassComponent, ClassComponent);\n return WDYRPatchedClassComponent;\n }\n\n var getFunctionalComponentFromStringComponent = function getFunctionalComponentFromStringComponent(componentTypeStr) {\n return function (props) {\n return wdyrStore.React.createElement(componentTypeStr, props);\n };\n };\n function patchFunctionalOrStrComponent(FunctionalOrStringComponent, _ref) {\n var isPure = _ref.isPure,\n displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var FunctionalComponent = typeof FunctionalOrStringComponent === 'string' ? getFunctionalComponentFromStringComponent(FunctionalOrStringComponent) : FunctionalOrStringComponent;\n function WDYRFunctionalComponent() {\n var nextProps = arguments[0];\n var ref = wdyrStore.React.useRef();\n var prevProps = ref.current;\n ref.current = nextProps;\n if (prevProps) {\n var updateInfo = getUpdateInfo({\n Component: FunctionalComponent,\n displayName: displayName,\n prevProps: prevProps,\n nextProps: nextProps\n });\n var notifiedByHooks = !updateInfo.reason.propsDifferences || isPure && updateInfo.reason.propsDifferences.length === 0;\n if (!notifiedByHooks) {\n wdyrStore.options.notifier(updateInfo);\n }\n }\n return FunctionalComponent.apply(void 0, arguments);\n }\n try {\n WDYRFunctionalComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRFunctionalComponent.defaultProps = defaultProps;\n WDYRFunctionalComponent.ComponentForHooksTracking = FunctionalComponent;\n lodash.defaults(WDYRFunctionalComponent, FunctionalComponent);\n return WDYRFunctionalComponent;\n }\n\n function patchMemoComponent(MemoComponent, _ref) {\n var displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var InnerMemoComponent = MemoComponent.type;\n var isInnerMemoComponentAClassComponent = isReactClassComponent(InnerMemoComponent);\n var isInnerMemoComponentForwardRefs = isForwardRefComponent(InnerMemoComponent);\n var isInnerMemoComponentAnotherMemoComponent = isMemoComponent(InnerMemoComponent);\n var WrappedFunctionalComponent = isInnerMemoComponentForwardRefs ? InnerMemoComponent.render : InnerMemoComponent;\n var PatchedInnerComponent = isInnerMemoComponentAClassComponent ? patchClassComponent(WrappedFunctionalComponent, {\n displayName: displayName,\n defaultProps: defaultProps\n }) : isInnerMemoComponentAnotherMemoComponent ? patchMemoComponent(WrappedFunctionalComponent, {\n displayName: displayName,\n defaultProps: defaultProps\n }) : patchFunctionalOrStrComponent(WrappedFunctionalComponent, {\n displayName: displayName,\n isPure: true\n });\n try {\n PatchedInnerComponent.displayName = getDisplayName(WrappedFunctionalComponent);\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n PatchedInnerComponent.ComponentForHooksTracking = MemoComponent;\n lodash.defaults(PatchedInnerComponent, WrappedFunctionalComponent);\n var WDYRMemoizedFunctionalComponent = wdyrStore.React.memo(isInnerMemoComponentForwardRefs ? wdyrStore.React.forwardRef(PatchedInnerComponent) : PatchedInnerComponent, MemoComponent.compare);\n try {\n WDYRMemoizedFunctionalComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRMemoizedFunctionalComponent.defaultProps = defaultProps;\n lodash.defaults(WDYRMemoizedFunctionalComponent, MemoComponent);\n return WDYRMemoizedFunctionalComponent;\n }\n\n function patchForwardRefComponent(ForwardRefComponent, _ref) {\n var displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var InnerForwardRefComponent = ForwardRefComponent.render;\n var isInnerComponentMemoized = isMemoComponent(InnerForwardRefComponent);\n var WrappedFunctionalComponent = isInnerComponentMemoized ? InnerForwardRefComponent.type : InnerForwardRefComponent;\n var WDYRWrappedByReactForwardRefFunctionalComponent = patchFunctionalOrStrComponent(WrappedFunctionalComponent, {\n isPure: isInnerComponentMemoized,\n displayName: displayName\n });\n WDYRWrappedByReactForwardRefFunctionalComponent.displayName = getDisplayName(WrappedFunctionalComponent);\n WDYRWrappedByReactForwardRefFunctionalComponent.ComponentForHooksTracking = WrappedFunctionalComponent;\n lodash.defaults(WDYRWrappedByReactForwardRefFunctionalComponent, WrappedFunctionalComponent);\n var WDYRForwardRefFunctionalComponent = wdyrStore.React.forwardRef(isInnerComponentMemoized ? wdyrStore.React.memo(WDYRWrappedByReactForwardRefFunctionalComponent, InnerForwardRefComponent.compare) : WDYRWrappedByReactForwardRefFunctionalComponent);\n try {\n WDYRForwardRefFunctionalComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRForwardRefFunctionalComponent.defaultProps = defaultProps;\n lodash.defaults(WDYRForwardRefFunctionalComponent, ForwardRefComponent);\n return WDYRForwardRefFunctionalComponent;\n }\n\n var initialHookValue = Symbol('initial-hook-value');\n function trackHookChanges(hookName, _ref, hookResult) {\n var hookPath = _ref.path;\n var nextHook = hookPath ? lodash.get(hookResult, hookPath) : hookResult;\n var renderNumberForTheHook = wdyrStore.React.useRef(true);\n\n // TODO: improve\n var isSecondCycleOfRenders = wdyrStore.hooksPerRender[0] && wdyrStore.hooksPerRender[0].renderNumberForTheHook !== renderNumberForTheHook.current;\n if (isSecondCycleOfRenders) {\n wdyrStore.hooksPerRender = [];\n }\n wdyrStore.hooksPerRender.push({\n hookName: hookName,\n result: nextHook,\n renderNumberForTheHook: renderNumberForTheHook.current\n });\n renderNumberForTheHook.current++;\n var ComponentHookDispatchedFromInstance = wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;\n var prevHookRef = wdyrStore.React.useRef(initialHookValue);\n if (!ComponentHookDispatchedFromInstance) {\n return hookResult;\n }\n var Component = ComponentHookDispatchedFromInstance.type.ComponentForHooksTracking || ComponentHookDispatchedFromInstance.type;\n var displayName = getDisplayName(Component);\n var isShouldTrack = shouldTrack(Component, {\n isHookChange: true\n });\n if (!isShouldTrack) {\n return hookResult;\n }\n var newPrevHookRef = prevHookRef.current;\n prevHookRef.current = hookResult;\n if (newPrevHookRef !== initialHookValue) {\n var notification = getUpdateInfo({\n Component: Component,\n displayName: displayName,\n hookName: hookName,\n prevHook: hookPath ? lodash.get(newPrevHookRef, hookPath) : newPrevHookRef,\n nextHook: nextHook\n });\n if (notification.reason.hookDifferences) {\n wdyrStore.options.notifier(notification);\n }\n }\n return hookResult;\n }\n function createPatchedComponent(Component, _ref2) {\n var displayName = _ref2.displayName,\n defaultProps = _ref2.defaultProps;\n if (isMemoComponent(Component)) {\n return patchMemoComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n }\n if (isForwardRefComponent(Component)) {\n return patchForwardRefComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n }\n if (isReactClassComponent(Component)) {\n return patchClassComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n }\n return patchFunctionalOrStrComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps,\n isPure: false\n });\n }\n function getPatchedComponent(Component, _ref3) {\n var displayName = _ref3.displayName,\n defaultProps = _ref3.defaultProps;\n if (wdyrStore.componentsMap.has(Component)) {\n return wdyrStore.componentsMap.get(Component);\n }\n var WDYRPatchedComponent = createPatchedComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n wdyrStore.componentsMap.set(Component, WDYRPatchedComponent);\n return WDYRPatchedComponent;\n }\n function getIsSupportedComponentType(Comp) {\n if (!Comp) {\n return false;\n }\n if (isMemoComponent(Comp)) {\n return getIsSupportedComponentType(Comp.type);\n }\n if (isForwardRefComponent(Comp)) {\n return getIsSupportedComponentType(Comp.render);\n }\n if (typeof Comp === 'function') {\n return true;\n }\n }\n var hooksConfig = {\n useState: {\n path: '0'\n },\n useReducer: {\n path: '0'\n },\n useContext: undefined,\n useSyncExternalStore: undefined,\n useMemo: {\n dependenciesPath: '1',\n dontReport: true\n },\n useCallback: {\n dependenciesPath: '1',\n dontReport: true\n }\n };\n function storeOwnerData(element) {\n var OwnerInstance = wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;\n if (OwnerInstance) {\n var Component = OwnerInstance.type.ComponentForHooksTracking || OwnerInstance.type;\n var displayName = getDisplayName(Component);\n var additionalOwnerData = {};\n if (wdyrStore.options.getAdditionalOwnerData) {\n additionalOwnerData = wdyrStore.options.getAdditionalOwnerData(element);\n }\n wdyrStore.ownerDataMap.set(element.props, {\n Component: Component,\n displayName: displayName,\n props: OwnerInstance.pendingProps,\n state: OwnerInstance.stateNode ? OwnerInstance.stateNode.state : null,\n hooks: wdyrStore.hooksPerRender,\n additionalOwnerData: additionalOwnerData\n });\n }\n }\n function resetHooksPerRenderIfNeeded() {\n // Intercept assignments to ReactCurrentOwner.current to reset hooksPerRender\n var currentOwner = null;\n if (wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) {\n Object.defineProperty(wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, 'current', {\n get: function get() {\n return currentOwner;\n },\n set: function set(value) {\n currentOwner = value;\n wdyrStore.hooksPerRender = [];\n }\n });\n }\n }\n function trackHooksIfNeeded() {\n var hooksSupported = !!wdyrStore.React.useState;\n if (wdyrStore.options.trackHooks && hooksSupported) {\n var nativeHooks = Object.entries(hooksConfig).map(function (_ref4) {\n var _ref5 = _slicedToArray(_ref4, 2),\n hookName = _ref5[0],\n hookTrackingConfig = _ref5[1];\n return [wdyrStore.React, hookName, hookTrackingConfig];\n });\n var hooksToTrack = [].concat(_toConsumableArray(nativeHooks), _toConsumableArray(wdyrStore.options.trackExtraHooks));\n hooksToTrack.forEach(function (_ref6) {\n var _ref7 = _slicedToArray(_ref6, 3),\n hookParent = _ref7[0],\n hookName = _ref7[1],\n _ref7$ = _ref7[2],\n hookTrackingConfig = _ref7$ === void 0 ? {} : _ref7$;\n var originalHook = hookParent[hookName];\n var newHookName = hookName[0].toUpperCase() + hookName.slice(1);\n var newHook = function WhyDidYouRenderReWrittenHook() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var hookResult = originalHook.call.apply(originalHook, [this].concat(args));\n var dependenciesPath = hookTrackingConfig.dependenciesPath,\n dontReport = hookTrackingConfig.dontReport;\n if (dependenciesPath && lodash.isFunction(hookResult)) {\n dependenciesMap.set(hookResult, {\n hookName: hookName,\n deps: lodash.get(args, dependenciesPath)\n });\n }\n if (!dontReport) {\n trackHookChanges(hookName, hookTrackingConfig, hookResult);\n }\n return hookResult;\n };\n Object.defineProperty(newHook, 'name', {\n value: newHookName,\n writable: false\n });\n Object.assign(newHook, {\n originalHook: originalHook\n });\n hookParent[hookName] = newHook;\n });\n }\n }\n function getWDYRType(origType) {\n var isShouldTrack = getIsSupportedComponentType(origType) && shouldTrack(origType, {\n isHookChange: false\n });\n if (!isShouldTrack) {\n return null;\n }\n var displayName = origType && origType.whyDidYouRender && origType.whyDidYouRender.customName || getDisplayName(origType);\n var defaultProps = getDefaultProps(origType);\n var WDYRPatchedComponent = getPatchedComponent(origType, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n return WDYRPatchedComponent;\n }\n function whyDidYouRender(React, userOptions) {\n if (React.__IS_WDYR__) {\n return;\n }\n React.__IS_WDYR__ = true;\n Object.assign(wdyrStore, {\n React: React,\n options: normalizeOptions(userOptions),\n origCreateElement: React.createElement,\n origCreateFactory: React.createFactory,\n origCloneElement: React.cloneElement,\n componentsMap: new WeakMap()\n });\n resetHooksPerRenderIfNeeded();\n React.createElement = function (origType) {\n var WDYRType = getWDYRType(origType);\n for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n rest[_key2 - 1] = arguments[_key2];\n }\n if (WDYRType) {\n try {\n var element = wdyrStore.origCreateElement.apply(React, [WDYRType].concat(rest));\n if (wdyrStore.options.logOwnerReasons) {\n storeOwnerData(element);\n }\n return element;\n } catch (e) {\n wdyrStore.options.consoleLog('whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.', {\n errorInfo: {\n error: e,\n componentNameOrComponent: origType,\n rest: rest,\n options: wdyrStore.options\n }\n });\n }\n }\n return wdyrStore.origCreateElement.apply(React, [origType].concat(rest));\n };\n Object.assign(React.createElement, wdyrStore.origCreateElement);\n React.createFactory = function (type) {\n var factory = React.createElement.bind(null, type);\n factory.type = type;\n return factory;\n };\n Object.assign(React.createFactory, wdyrStore.origCreateFactory);\n React.cloneElement = function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n var element = wdyrStore.origCloneElement.apply(React, args);\n if (wdyrStore.options.logOwnerReasons) {\n storeOwnerData(element);\n }\n return element;\n };\n Object.assign(React.cloneElement, wdyrStore.origCloneElement);\n trackHooksIfNeeded();\n React.__REVERT_WHY_DID_YOU_RENDER__ = function () {\n Object.assign(React, {\n createElement: wdyrStore.origCreateElement,\n createFactory: wdyrStore.origCreateFactory,\n cloneElement: wdyrStore.origCloneElement\n });\n wdyrStore.componentsMap = null;\n var hooksToRevert = [].concat(_toConsumableArray(Object.keys(hooksConfig).map(function (hookName) {\n return [React, hookName];\n })), _toConsumableArray(wdyrStore.options.trackExtraHooks));\n hooksToRevert.forEach(function (_ref8) {\n var _ref9 = _slicedToArray(_ref8, 2),\n hookParent = _ref9[0],\n hookName = _ref9[1];\n if (hookParent[hookName].originalHook) {\n hookParent[hookName] = hookParent[hookName].originalHook;\n }\n });\n delete React.__REVERT_WHY_DID_YOU_RENDER__;\n delete React.__IS_WDYR__;\n };\n return React;\n }\n\n whyDidYouRender.defaultNotifier = defaultNotifier;\n whyDidYouRender.wdyrStore = wdyrStore;\n whyDidYouRender.storeOwnerData = storeOwnerData;\n whyDidYouRender.getWDYRType = getWDYRType;\n Object.assign(whyDidYouRender, React__namespace);\n\n return whyDidYouRender;\n\n}));\n//# sourceMappingURL=whyDidYouRender.js.map\n\n\n//# sourceURL=webpack://spt/./node_modules/@welldone-software/why-did-you-render/dist/whyDidYouRender.js?"); +eval("/**\n * @welldone-software/why-did-you-render 8.0.3\n * MIT Licensed\n * Generated by Vitali Zaidman (https://github.com/vzaidman)\n * Generated at 2024-06-08\n */\n\n(function (global, factory) {\n true ? module.exports = factory(__webpack_require__(/*! react */ \"./node_modules/react/index.js\"), __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\")) :\n 0;\n})(this, (function (React, lodash) { 'use strict';\n\n function _interopNamespaceDefault(e) {\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== 'default') {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(n, k, d.get ? d : {\n enumerable: true,\n get: function () { return e[k]; }\n });\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n }\n\n var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);\n\n var wdyrStore = {\n /* The React object we patch */\n React: undefined,\n /* Processed user options for WDYR */\n options: undefined,\n /* The original React.createElement function */\n origCreateElement: undefined,\n /* The original React.createFactory function */\n origCreateFactory: undefined,\n /* The original React.cloneElement function */\n origCloneElement: undefined,\n /* A weak map of all React elements to their WDYR patched react elements */\n componentsMap: new WeakMap(),\n /* A weak map of props to the owner element that passed them */\n ownerDataMap: new WeakMap(),\n /* An array of hooks tracked during one render */\n hooksPerRender: []\n };\n\n function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n }\n function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n }\n function _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return _arrayLikeToArray(r);\n }\n function _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n }\n function _callSuper(t, o, e) {\n return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));\n }\n function _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n }\n function _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n }\n function _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n }\n function _createForOfIteratorHelper(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (!t) {\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e ) {\n t && (r = t);\n var n = 0,\n F = function () {};\n return {\n s: F,\n n: function () {\n return n >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[n++]\n };\n },\n e: function (r) {\n throw r;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var o,\n a = !0,\n u = !1;\n return {\n s: function () {\n t = t.call(r);\n },\n n: function () {\n var r = t.next();\n return a = r.done, r;\n },\n e: function (r) {\n u = !0, o = r;\n },\n f: function () {\n try {\n a || null == t.return || t.return();\n } finally {\n if (u) throw o;\n }\n }\n };\n }\n function _defineProperty(e, r, t) {\n return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n }\n function _get() {\n return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {\n var p = _superPropBase(e, t);\n if (p) {\n var n = Object.getOwnPropertyDescriptor(p, t);\n return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;\n }\n }, _get.apply(null, arguments);\n }\n function _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n }\n function _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e && _setPrototypeOf(t, e);\n }\n function _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function () {\n return !!t;\n })();\n }\n function _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n }\n function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n }\n function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n function ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n }\n function _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n }\n function _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == typeof e || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return _assertThisInitialized(t);\n }\n function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n }\n function _slicedToArray(r, e) {\n return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();\n }\n function _superPropBase(t, o) {\n for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););\n return t;\n }\n function _toConsumableArray(r) {\n return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();\n }\n function _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n }\n function _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n }\n function _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n }\n\n var diffTypes = {\n 'different': 'different',\n 'deepEquals': 'deepEquals',\n 'date': 'date',\n 'regex': 'regex',\n 'reactElement': 'reactElement',\n 'function': 'function',\n 'same': 'same'\n };\n var diffTypesDescriptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, diffTypes.different, 'different objects'), diffTypes.deepEquals, 'different objects that are equal by value'), diffTypes.date, 'different date objects with the same value'), diffTypes.regex, 'different regular expressions with the same value'), diffTypes.reactElement, 'different React elements (remember that the syntax always produces a *NEW* immutable React element so a component that receives as props always re-renders)'), diffTypes[\"function\"], 'different functions with the same name'), diffTypes.same, 'same objects by ref (===)');\n\n // copied from packages/shared/ReactSymbols.js in https://github.com/facebook/react\n var hasSymbol$1 = typeof Symbol === 'function' && Symbol[\"for\"];\n var REACT_MEMO_TYPE = hasSymbol$1 ? Symbol[\"for\"]('react.memo') : 0xead3;\n var REACT_FORWARD_REF_TYPE = hasSymbol$1 ? Symbol[\"for\"]('react.forward_ref') : 0xead0;\n var REACT_STRICT_MODE = 8;\n\n var hasElementType = typeof Element !== 'undefined';\n\n // copied from https://github.com/facebook/react/packages/shared/ReactSymbols.js\n var hasSymbol = typeof Symbol === 'function' && Symbol[\"for\"];\n var REACT_ELEMENT_TYPE = hasSymbol ? Symbol[\"for\"]('react.element') : 0xeac7;\n var isReactElement = function isReactElement(object) {\n return object.$$typeof === REACT_ELEMENT_TYPE;\n };\n // end\n\n function trackDiff(a, b, diffsAccumulator, pathString, diffType) {\n diffsAccumulator.push({\n diffType: diffType,\n pathString: pathString,\n prevValue: a,\n nextValue: b\n });\n return diffType !== diffTypes.different;\n }\n function isGetter(obj, prop) {\n return !!Object.getOwnPropertyDescriptor(obj, prop)['get'];\n }\n var dependenciesMap = new WeakMap();\n function accumulateDeepEqualDiffs(a, b, diffsAccumulator) {\n var pathString = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';\n var _ref = arguments.length > 4 ? arguments[4] : undefined,\n detailed = _ref.detailed;\n if (a === b) {\n if (detailed) {\n trackDiff(a, b, diffsAccumulator, pathString, diffTypes.same);\n }\n return true;\n }\n if (!a || !b) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isArray(a) && lodash.isArray(b)) {\n var arrayLength = a.length;\n if (arrayLength !== b.length) {\n return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.different);\n }\n var arrayItemDiffs = [];\n var numberOfDeepEqualsItems = 0;\n for (var i = arrayLength; i--; i > 0) {\n var diffEquals = accumulateDeepEqualDiffs(a[i], b[i], arrayItemDiffs, \"\".concat(pathString, \"[\").concat(i, \"]\"), {\n detailed: detailed\n });\n if (diffEquals) {\n numberOfDeepEqualsItems++;\n }\n }\n if (detailed || numberOfDeepEqualsItems !== arrayLength) {\n diffsAccumulator.push.apply(diffsAccumulator, arrayItemDiffs);\n }\n if (numberOfDeepEqualsItems === arrayLength) {\n return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.deepEquals);\n }\n return trackDiff(_toConsumableArray(a), _toConsumableArray(b), diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isSet(a) && lodash.isSet(b)) {\n if (a.size !== b.size) {\n return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.different);\n }\n var _iterator = _createForOfIteratorHelper(a),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var valA = _step.value;\n if (!b.has(valA)) {\n return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.different);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return trackDiff(new Set(a), new Set(b), diffsAccumulator, pathString, diffTypes.deepEquals);\n }\n if (lodash.isDate(a) && lodash.isDate(b)) {\n return a.getTime() === b.getTime() ? trackDiff(new Date(a), new Date(b), diffsAccumulator, pathString, diffTypes.date) : trackDiff(new Date(a), new Date(b), diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isRegExp(a) && lodash.isRegExp(b)) {\n return a.toString() === b.toString() ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes.regex) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (hasElementType && a instanceof Element && b instanceof Element) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (isReactElement(a) && isReactElement(b)) {\n if (a.type !== b.type) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n var reactElementPropsAreDeepEqual = accumulateDeepEqualDiffs(a.props, b.props, [], \"\".concat(pathString, \".props\"), {\n detailed: detailed\n });\n return reactElementPropsAreDeepEqual ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes.reactElement) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n if (lodash.isFunction(a) && lodash.isFunction(b)) {\n if (a.name !== b.name) {\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n var aDependenciesObj = dependenciesMap.get(a);\n var bDependenciesObj = dependenciesMap.get(b);\n if (aDependenciesObj && bDependenciesObj) {\n var dependenciesAreDeepEqual = accumulateDeepEqualDiffs(aDependenciesObj.deps, bDependenciesObj.deps, diffsAccumulator, \"\".concat(pathString, \":parent-hook-\").concat(aDependenciesObj.hookName, \"-deps\"), {\n detailed: detailed\n });\n return dependenciesAreDeepEqual ? trackDiff(a, b, diffsAccumulator, pathString, diffTypes[\"function\"]) : trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes[\"function\"]);\n }\n if (_typeof(a) === 'object' && _typeof(b) === 'object' && Object.getPrototypeOf(a) === Object.getPrototypeOf(b)) {\n var aKeys = Object.getOwnPropertyNames(a);\n var bKeys = Object.getOwnPropertyNames(b);\n var allKeys = lodash.uniq([].concat(_toConsumableArray(aKeys), _toConsumableArray(bKeys)));\n var clonedA = lodash.isPlainObject(a) ? _objectSpread2({}, a) : a;\n var clonedB = lodash.isPlainObject(b) ? _objectSpread2({}, b) : b;\n if (allKeys.length !== aKeys.length || allKeys.length !== bKeys.length) {\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different);\n }\n var relevantKeys = allKeys.filter(function (key) {\n // do not compare the stack as it differ even though the errors are identical.\n if (key === 'stack' && lodash.isError(a)) {\n return false;\n }\n\n // getters checking is causing too much problems because of how it's used in js.\n // not only getters can throw errors, they also cause side effects in many cases.\n if (isGetter(a, key)) {\n return false;\n }\n return true;\n });\n var keysLength = relevantKeys.length;\n for (var _i = keysLength; _i--; _i > 0) {\n if (!lodash.has(b, relevantKeys[_i])) {\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different);\n }\n }\n var objectValuesDiffs = [];\n var numberOfDeepEqualsObjectValues = 0;\n for (var _i2 = keysLength; _i2--; _i2 > 0) {\n var key = relevantKeys[_i2];\n var deepEquals = accumulateDeepEqualDiffs(a[key], b[key], objectValuesDiffs, \"\".concat(pathString, \".\").concat(key), {\n detailed: detailed\n });\n if (deepEquals) {\n numberOfDeepEqualsObjectValues++;\n }\n }\n if (detailed || numberOfDeepEqualsObjectValues !== keysLength) {\n diffsAccumulator.push.apply(diffsAccumulator, objectValuesDiffs);\n }\n if (numberOfDeepEqualsObjectValues === keysLength) {\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.deepEquals);\n }\n return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different);\n }\n return trackDiff(a, b, diffsAccumulator, pathString, diffTypes.different);\n }\n function calculateDeepEqualDiffs(a, b, initialPathString) {\n var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},\n _ref2$detailed = _ref2.detailed,\n detailed = _ref2$detailed === void 0 ? false : _ref2$detailed;\n try {\n var diffs = [];\n accumulateDeepEqualDiffs(a, b, diffs, initialPathString, {\n detailed: detailed\n });\n return diffs;\n } catch (error) {\n if (error.message && error.message.match(/stack|recursion/i) || error.number === -2146828260) {\n // warn on circular references, don't crash.\n // browsers throw different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n // eslint-disable-next-line no-console\n console.warn('Warning: why-did-you-render couldn\\'t handle circular references in props.', error.name, error.message);\n return false;\n }\n throw error;\n }\n }\n\n function printDiff(value1, value2, _ref) {\n var pathString = _ref.pathString,\n consoleLog = _ref.consoleLog;\n var diffs = calculateDeepEqualDiffs(value1, value2, pathString, {\n detailed: true\n });\n var keysLength = Math.max.apply(Math, _toConsumableArray(diffs.map(function (diff) {\n return diff.pathString.length;\n }))) + 2;\n Object.entries(lodash.groupBy(lodash.sortBy(diffs, 'pathString'), 'diffType')).forEach(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n diffType = _ref3[0],\n diffs = _ref3[1];\n consoleLog(\"%c\".concat(diffTypesDescriptions[diffType], \":\"), 'text-decoration: underline; color: blue;');\n diffs.forEach(function (diff) {\n consoleLog(\"\".concat(diff.pathString, \":\").padEnd(keysLength, ' '), diff.prevValue);\n });\n });\n }\n\n var moreInfoUrl = 'http://bit.ly/wdyr02';\n var moreInfoHooksUrl = 'http://bit.ly/wdyr3';\n var inHotReload = false;\n function shouldLog(reason, Component) {\n if (inHotReload) {\n return false;\n }\n if (wdyrStore.options.logOnDifferentValues) {\n return true;\n }\n if (Component.whyDidYouRender && Component.whyDidYouRender.logOnDifferentValues) {\n return true;\n }\n var hasDifferentValues = reason.propsDifferences && reason.propsDifferences.some(function (diff) {\n return diff.diffType === diffTypes.different;\n }) || reason.stateDifferences && reason.stateDifferences.some(function (diff) {\n return diff.diffType === diffTypes.different;\n }) || reason.hookDifferences && reason.hookDifferences.some(function (diff) {\n return diff.diffType === diffTypes.different;\n });\n return !hasDifferentValues;\n }\n function logDifference(_ref) {\n var Component = _ref.Component,\n displayName = _ref.displayName,\n hookName = _ref.hookName,\n prefixMessage = _ref.prefixMessage,\n diffObjType = _ref.diffObjType,\n differences = _ref.differences,\n values = _ref.values;\n if (differences && differences.length > 0) {\n wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), \"\".concat(prefixMessage, \" of \").concat(diffObjType, \" changes:\"));\n differences.forEach(function (_ref2) {\n var pathString = _ref2.pathString,\n diffType = _ref2.diffType,\n prevValue = _ref2.prevValue,\n nextValue = _ref2.nextValue;\n function diffFn() {\n printDiff(prevValue, nextValue, {\n pathString: pathString,\n consoleLog: wdyrStore.options.consoleLog\n });\n }\n wdyrStore.options.consoleGroup(\"%c\".concat(diffObjType === 'hook' ? \"[hook \".concat(hookName, \" result]\") : \"\".concat(diffObjType, \".\"), \"%c\").concat(pathString, \"%c\"), \"color:\".concat(wdyrStore.options.diffNameColor, \";\"), \"color:\".concat(wdyrStore.options.diffPathColor, \";\"), 'color:default;');\n wdyrStore.options.consoleLog(\"\".concat(diffTypesDescriptions[diffType], \". (more info at \").concat(hookName ? moreInfoHooksUrl : moreInfoUrl, \")\"));\n wdyrStore.options.consoleLog(_defineProperty({}, \"prev \".concat(pathString), prevValue), '!==', _defineProperty({}, \"next \".concat(pathString), nextValue));\n if (diffType === diffTypes.deepEquals) {\n wdyrStore.options.consoleLog({\n 'For detailed diff, right click the following fn, save as global, and run: ': diffFn\n });\n }\n wdyrStore.options.consoleGroupEnd();\n });\n } else if (differences) {\n wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), \"\".concat(prefixMessage, \" the \").concat(diffObjType, \" object itself changed but its values are all equal.\"), diffObjType === 'props' ? 'This could have been avoided by making the component pure, or by preventing its father from re-rendering.' : 'This usually means this component called setState when no changes in its state actually occurred.', \"More info at \".concat(moreInfoUrl));\n wdyrStore.options.consoleLog(\"prev \".concat(diffObjType, \":\"), values.prev, ' !== ', values.next, \":next \".concat(diffObjType));\n }\n }\n function defaultNotifier(updateInfo) {\n var Component = updateInfo.Component,\n displayName = updateInfo.displayName,\n hookName = updateInfo.hookName,\n prevProps = updateInfo.prevProps,\n prevState = updateInfo.prevState,\n prevHook = updateInfo.prevHook,\n nextProps = updateInfo.nextProps,\n nextState = updateInfo.nextState,\n nextHook = updateInfo.nextHook,\n reason = updateInfo.reason;\n if (!shouldLog(reason, Component, wdyrStore.options)) {\n return;\n }\n wdyrStore.options.consoleGroup(\"%c\".concat(displayName), \"color: \".concat(wdyrStore.options.titleColor, \";\"));\n var prefixMessage = 'Re-rendered because';\n if (reason.propsDifferences) {\n logDifference({\n Component: Component,\n displayName: displayName,\n prefixMessage: prefixMessage,\n diffObjType: 'props',\n differences: reason.propsDifferences,\n values: {\n prev: prevProps,\n next: nextProps\n }\n });\n prefixMessage = 'And because';\n }\n if (reason.stateDifferences) {\n logDifference({\n Component: Component,\n displayName: displayName,\n prefixMessage: prefixMessage,\n diffObjType: 'state',\n differences: reason.stateDifferences,\n values: {\n prev: prevState,\n next: nextState\n }\n });\n }\n if (reason.hookDifferences) {\n logDifference({\n Component: Component,\n displayName: displayName,\n prefixMessage: prefixMessage,\n diffObjType: 'hook',\n differences: reason.hookDifferences,\n values: {\n prev: prevHook,\n next: nextHook\n },\n hookName: hookName\n });\n }\n if (reason.propsDifferences && reason.ownerDifferences) {\n var prevOwnerData = wdyrStore.ownerDataMap.get(prevProps);\n var nextOwnerData = wdyrStore.ownerDataMap.get(nextProps);\n wdyrStore.options.consoleGroup(\"Rendered by \".concat(nextOwnerData.displayName));\n var _prefixMessage = 'Re-rendered because';\n if (reason.ownerDifferences.propsDifferences) {\n logDifference({\n Component: nextOwnerData.Component,\n displayName: nextOwnerData.displayName,\n prefixMessage: _prefixMessage,\n diffObjType: 'props',\n differences: reason.ownerDifferences.propsDifferences,\n values: {\n prev: prevOwnerData.props,\n next: nextOwnerData.props\n }\n });\n _prefixMessage = 'And because';\n }\n if (reason.ownerDifferences.stateDifferences) {\n logDifference({\n Component: nextOwnerData.Component,\n displayName: nextOwnerData.displayName,\n prefixMessage: _prefixMessage,\n diffObjType: 'state',\n differences: reason.ownerDifferences.stateDifferences,\n values: {\n prev: prevOwnerData.state,\n next: nextOwnerData.state\n }\n });\n }\n if (reason.ownerDifferences.hookDifferences) {\n reason.ownerDifferences.hookDifferences.forEach(function (_ref3, i) {\n var hookName = _ref3.hookName,\n differences = _ref3.differences;\n return logDifference({\n Component: nextOwnerData.Component,\n displayName: nextOwnerData.displayName,\n prefixMessage: _prefixMessage,\n diffObjType: 'hook',\n differences: differences,\n values: {\n prev: prevOwnerData.hooks[i].result,\n next: nextOwnerData.hooks[i].result\n },\n hookName: hookName\n });\n });\n }\n wdyrStore.options.consoleGroupEnd();\n }\n if (!reason.propsDifferences && !reason.stateDifferences && !reason.hookDifferences) {\n wdyrStore.options.consoleLog(_defineProperty({}, displayName, Component), 'Re-rendered although props and state objects are the same.', 'This usually means there was a call to this.forceUpdate() inside the component.', \"more info at \".concat(moreInfoUrl));\n }\n wdyrStore.options.consoleGroupEnd();\n }\n function createDefaultNotifier(hotReloadBufferMs) {\n if (hotReloadBufferMs) {\n if (false) {}\n }\n return defaultNotifier;\n }\n\n var emptyFn = function emptyFn() {};\n function normalizeOptions() {\n var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var consoleGroup = console.group;\n var consoleGroupEnd = console.groupEnd;\n if (userOptions.collapseGroups) {\n consoleGroup = console.groupCollapsed;\n } else if (userOptions.onlyLogs) {\n consoleGroup = console.log;\n consoleGroupEnd = emptyFn;\n }\n var notifier = userOptions.notifier || createDefaultNotifier('hotReloadBufferMs' in userOptions ? userOptions.hotReloadBufferMs : 500);\n return _objectSpread2({\n include: null,\n exclude: null,\n notifier: notifier,\n onlyLogs: false,\n consoleLog: console.log,\n consoleGroup: consoleGroup,\n consoleGroupEnd: consoleGroupEnd,\n logOnDifferentValues: false,\n logOwnerReasons: true,\n trackHooks: true,\n titleColor: '#058',\n diffNameColor: 'blue',\n diffPathColor: 'red',\n trackExtraHooks: [],\n trackAllPureComponents: false\n }, userOptions);\n }\n\n function getDisplayName(type) {\n return type.displayName || type.name || type.type && getDisplayName(type.type) || type.render && getDisplayName(type.render) || (lodash.isString(type) ? type : 'Unknown');\n }\n\n function getDefaultProps(type) {\n return type.defaultProps || type.type && getDefaultProps(type.type) || type.render && getDefaultProps(type.render) || undefined;\n }\n\n var emptyObject = {};\n function findObjectsDifferences(userPrevObj, userNextObj) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n _ref$shallow = _ref.shallow,\n shallow = _ref$shallow === void 0 ? true : _ref$shallow;\n if (userPrevObj === userNextObj) {\n return false;\n }\n if (!shallow) {\n return calculateDeepEqualDiffs(userPrevObj, userNextObj);\n }\n var prevObj = userPrevObj || emptyObject;\n var nextObj = userNextObj || emptyObject;\n var keysOfBothObjects = Object.keys(_objectSpread2(_objectSpread2({}, prevObj), nextObj));\n return lodash.reduce(keysOfBothObjects, function (result, key) {\n var deepEqualDiffs = calculateDeepEqualDiffs(prevObj[key], nextObj[key], key);\n if (deepEqualDiffs) {\n result = [].concat(_toConsumableArray(result), _toConsumableArray(deepEqualDiffs));\n }\n return result;\n }, []);\n }\n\n function getOwnerDifferences(_ref) {\n var prevOwnerData = _ref.prevOwnerData,\n nextOwnerData = _ref.nextOwnerData;\n if (!prevOwnerData || !nextOwnerData) {\n return false;\n }\n\n // in strict mode prevOwnerData might be twice as lengthy because of double renders\n var prevOwnerDataHooks = prevOwnerData.hooks.length === nextOwnerData.hooks.length * 2 ? prevOwnerData.hooks.slice(prevOwnerData.hooks.length / 2) : prevOwnerData.hooks;\n var hookDifferences = prevOwnerDataHooks.map(function (_ref2, i) {\n var hookName = _ref2.hookName,\n result = _ref2.result;\n return {\n hookName: hookName,\n differences: findObjectsDifferences(result, nextOwnerData.hooks[i].result, {\n shallow: false\n })\n };\n });\n return {\n propsDifferences: findObjectsDifferences(prevOwnerData.props, nextOwnerData.props),\n stateDifferences: findObjectsDifferences(prevOwnerData.state, nextOwnerData.state),\n hookDifferences: hookDifferences.length > 0 ? hookDifferences : false\n };\n }\n function getUpdateReason(prevProps, prevState, prevHook, nextProps, nextState, nextHook) {\n var prevOwnerData = wdyrStore.ownerDataMap.get(prevProps);\n var nextOwnerData = wdyrStore.ownerDataMap.get(nextProps);\n return {\n propsDifferences: findObjectsDifferences(prevProps, nextProps),\n stateDifferences: findObjectsDifferences(prevState, nextState),\n hookDifferences: findObjectsDifferences(prevHook, nextHook, {\n shallow: false\n }),\n ownerDifferences: getOwnerDifferences({\n prevOwnerData: prevOwnerData,\n nextOwnerData: nextOwnerData\n })\n };\n }\n function getUpdateInfo(_ref3) {\n var Component = _ref3.Component,\n displayName = _ref3.displayName,\n hookName = _ref3.hookName,\n prevProps = _ref3.prevProps,\n prevState = _ref3.prevState,\n prevHook = _ref3.prevHook,\n nextProps = _ref3.nextProps,\n nextState = _ref3.nextState,\n nextHook = _ref3.nextHook;\n return {\n Component: Component,\n displayName: displayName,\n hookName: hookName,\n prevProps: prevProps,\n prevState: prevState,\n prevHook: prevHook,\n nextProps: nextProps,\n nextState: nextState,\n nextHook: nextHook,\n reason: getUpdateReason(prevProps, prevState, prevHook, nextProps, nextState, nextHook)\n };\n }\n\n // copied from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactTypeOfMode.js\n\n // based on \"findStrictRoot\" from https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactStrictModeWarnings.js\n // notice: this is only used for class components. functional components doesn't render twice inside strict mode\n function checkIfInsideAStrictModeTree(reactComponentInstance) {\n var reactInternalFiber = reactComponentInstance && (reactComponentInstance._reactInternalFiber || reactComponentInstance._reactInternals);\n while (reactInternalFiber) {\n if (reactInternalFiber.mode & REACT_STRICT_MODE) {\n return true;\n }\n reactInternalFiber = reactInternalFiber[\"return\"];\n }\n return false;\n }\n function isReactClassComponent(Component) {\n return Component.prototype && !!Component.prototype.isReactComponent;\n }\n function isMemoComponent(Component) {\n return Component.$$typeof === REACT_MEMO_TYPE;\n }\n function isForwardRefComponent(Component) {\n return Component.$$typeof === REACT_FORWARD_REF_TYPE;\n }\n\n function shouldInclude(displayName) {\n return wdyrStore.options.include && wdyrStore.options.include.length > 0 && wdyrStore.options.include.some(function (regex) {\n return regex.test(displayName);\n });\n }\n function shouldExclude(displayName) {\n return wdyrStore.options.exclude && wdyrStore.options.exclude.length > 0 && wdyrStore.options.exclude.some(function (regex) {\n return regex.test(displayName);\n });\n }\n function shouldTrack(Component, _ref) {\n var isHookChange = _ref.isHookChange;\n var displayName = getDisplayName(Component);\n if (shouldExclude(displayName)) {\n return false;\n }\n if (Component.whyDidYouRender === false) {\n return false;\n }\n if (isHookChange && Component.whyDidYouRender && Component.whyDidYouRender.trackHooks === false) {\n return false;\n }\n return !!(Component.whyDidYouRender || wdyrStore.options.trackAllPureComponents && (Component && Component.prototype instanceof wdyrStore.React.PureComponent || isMemoComponent(Component)) || shouldInclude(displayName));\n }\n\n function patchClassComponent(ClassComponent, _ref) {\n var displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var WDYRPatchedClassComponent = /*#__PURE__*/function (_ClassComponent) {\n function WDYRPatchedClassComponent(props, context) {\n var _this;\n _classCallCheck(this, WDYRPatchedClassComponent);\n _this = _callSuper(this, WDYRPatchedClassComponent, [props, context]);\n _this._WDYR = {\n renderNumber: 0\n };\n var origRender = _get((_getPrototypeOf(WDYRPatchedClassComponent.prototype)), \"render\", _this) || _this.render;\n\n // this probably means that render is an arrow function or this.render.bind(this) was called on the original class\n var renderIsABindedFunction = origRender !== ClassComponent.prototype.render;\n if (renderIsABindedFunction) {\n _this.render = function () {\n WDYRPatchedClassComponent.prototype.render.apply(_this);\n return origRender();\n };\n }\n return _this;\n }\n _inherits(WDYRPatchedClassComponent, _ClassComponent);\n return _createClass(WDYRPatchedClassComponent, [{\n key: \"render\",\n value: function render() {\n this._WDYR.renderNumber++;\n if (!('isStrictMode' in this._WDYR)) {\n this._WDYR.isStrictMode = checkIfInsideAStrictModeTree(this);\n }\n\n // in strict mode- ignore every other render\n if (!(this._WDYR.isStrictMode && this._WDYR.renderNumber % 2 === 1)) {\n if (this._WDYR.prevProps) {\n var updateInfo = getUpdateInfo({\n Component: ClassComponent,\n displayName: displayName,\n prevProps: this._WDYR.prevProps,\n prevState: this._WDYR.prevState,\n nextProps: this.props,\n nextState: this.state\n });\n wdyrStore.options.notifier(updateInfo);\n }\n this._WDYR.prevProps = this.props;\n this._WDYR.prevState = this.state;\n }\n return _get(_getPrototypeOf(WDYRPatchedClassComponent.prototype), \"render\", this) ? _get(_getPrototypeOf(WDYRPatchedClassComponent.prototype), \"render\", this).call(this) : null;\n }\n }]);\n }(ClassComponent);\n try {\n WDYRPatchedClassComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRPatchedClassComponent.defaultProps = defaultProps;\n lodash.defaults(WDYRPatchedClassComponent, ClassComponent);\n return WDYRPatchedClassComponent;\n }\n\n var getFunctionalComponentFromStringComponent = function getFunctionalComponentFromStringComponent(componentTypeStr) {\n return function (props) {\n return wdyrStore.React.createElement(componentTypeStr, props);\n };\n };\n function patchFunctionalOrStrComponent(FunctionalOrStringComponent, _ref) {\n var isPure = _ref.isPure,\n displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var FunctionalComponent = typeof FunctionalOrStringComponent === 'string' ? getFunctionalComponentFromStringComponent(FunctionalOrStringComponent) : FunctionalOrStringComponent;\n function WDYRFunctionalComponent() {\n var nextProps = arguments[0];\n var ref = wdyrStore.React.useRef();\n var prevProps = ref.current;\n ref.current = nextProps;\n if (prevProps) {\n var updateInfo = getUpdateInfo({\n Component: FunctionalComponent,\n displayName: displayName,\n prevProps: prevProps,\n nextProps: nextProps\n });\n var notifiedByHooks = !updateInfo.reason.propsDifferences || isPure && updateInfo.reason.propsDifferences.length === 0;\n if (!notifiedByHooks) {\n wdyrStore.options.notifier(updateInfo);\n }\n }\n return FunctionalComponent.apply(void 0, arguments);\n }\n try {\n WDYRFunctionalComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRFunctionalComponent.defaultProps = defaultProps;\n WDYRFunctionalComponent.ComponentForHooksTracking = FunctionalComponent;\n lodash.defaults(WDYRFunctionalComponent, FunctionalComponent);\n return WDYRFunctionalComponent;\n }\n\n function patchMemoComponent(MemoComponent, _ref) {\n var displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var InnerMemoComponent = MemoComponent.type;\n var isInnerMemoComponentAClassComponent = isReactClassComponent(InnerMemoComponent);\n var isInnerMemoComponentForwardRefs = isForwardRefComponent(InnerMemoComponent);\n var isInnerMemoComponentAnotherMemoComponent = isMemoComponent(InnerMemoComponent);\n var WrappedFunctionalComponent = isInnerMemoComponentForwardRefs ? InnerMemoComponent.render : InnerMemoComponent;\n var PatchedInnerComponent = isInnerMemoComponentAClassComponent ? patchClassComponent(WrappedFunctionalComponent, {\n displayName: displayName,\n defaultProps: defaultProps\n }) : isInnerMemoComponentAnotherMemoComponent ? patchMemoComponent(WrappedFunctionalComponent, {\n displayName: displayName,\n defaultProps: defaultProps\n }) : patchFunctionalOrStrComponent(WrappedFunctionalComponent, {\n displayName: displayName,\n isPure: true\n });\n try {\n PatchedInnerComponent.displayName = getDisplayName(WrappedFunctionalComponent);\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n PatchedInnerComponent.ComponentForHooksTracking = MemoComponent;\n lodash.defaults(PatchedInnerComponent, WrappedFunctionalComponent);\n var WDYRMemoizedFunctionalComponent = wdyrStore.React.memo(isInnerMemoComponentForwardRefs ? wdyrStore.React.forwardRef(PatchedInnerComponent) : PatchedInnerComponent, MemoComponent.compare);\n try {\n WDYRMemoizedFunctionalComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRMemoizedFunctionalComponent.defaultProps = defaultProps;\n lodash.defaults(WDYRMemoizedFunctionalComponent, MemoComponent);\n return WDYRMemoizedFunctionalComponent;\n }\n\n function patchForwardRefComponent(ForwardRefComponent, _ref) {\n var displayName = _ref.displayName,\n defaultProps = _ref.defaultProps;\n var InnerForwardRefComponent = ForwardRefComponent.render;\n var isInnerComponentMemoized = isMemoComponent(InnerForwardRefComponent);\n var WrappedFunctionalComponent = isInnerComponentMemoized ? InnerForwardRefComponent.type : InnerForwardRefComponent;\n var WDYRWrappedByReactForwardRefFunctionalComponent = patchFunctionalOrStrComponent(WrappedFunctionalComponent, {\n isPure: isInnerComponentMemoized,\n displayName: displayName\n });\n WDYRWrappedByReactForwardRefFunctionalComponent.displayName = getDisplayName(WrappedFunctionalComponent);\n WDYRWrappedByReactForwardRefFunctionalComponent.ComponentForHooksTracking = WrappedFunctionalComponent;\n lodash.defaults(WDYRWrappedByReactForwardRefFunctionalComponent, WrappedFunctionalComponent);\n var WDYRForwardRefFunctionalComponent = wdyrStore.React.forwardRef(isInnerComponentMemoized ? wdyrStore.React.memo(WDYRWrappedByReactForwardRefFunctionalComponent, InnerForwardRefComponent.compare) : WDYRWrappedByReactForwardRefFunctionalComponent);\n try {\n WDYRForwardRefFunctionalComponent.displayName = displayName;\n } catch (e) {\n // not crucial if displayName couldn't be set\n }\n WDYRForwardRefFunctionalComponent.defaultProps = defaultProps;\n lodash.defaults(WDYRForwardRefFunctionalComponent, ForwardRefComponent);\n return WDYRForwardRefFunctionalComponent;\n }\n\n var initialHookValue = Symbol('initial-hook-value');\n function trackHookChanges(hookName, _ref, hookResult) {\n var hookPath = _ref.path;\n var nextHook = hookPath ? lodash.get(hookResult, hookPath) : hookResult;\n var renderNumberForTheHook = wdyrStore.React.useRef(true);\n\n // TODO: improve\n var isSecondCycleOfRenders = wdyrStore.hooksPerRender[0] && wdyrStore.hooksPerRender[0].renderNumberForTheHook !== renderNumberForTheHook.current;\n if (isSecondCycleOfRenders) {\n wdyrStore.hooksPerRender = [];\n }\n wdyrStore.hooksPerRender.push({\n hookName: hookName,\n result: nextHook,\n renderNumberForTheHook: renderNumberForTheHook.current\n });\n renderNumberForTheHook.current++;\n var ComponentHookDispatchedFromInstance = wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;\n var prevHookRef = wdyrStore.React.useRef(initialHookValue);\n if (!ComponentHookDispatchedFromInstance) {\n return hookResult;\n }\n var Component = ComponentHookDispatchedFromInstance.type.ComponentForHooksTracking || ComponentHookDispatchedFromInstance.type;\n var displayName = getDisplayName(Component);\n var isShouldTrack = shouldTrack(Component, {\n isHookChange: true\n });\n if (!isShouldTrack) {\n return hookResult;\n }\n var newPrevHookRef = prevHookRef.current;\n prevHookRef.current = hookResult;\n if (newPrevHookRef !== initialHookValue) {\n var notification = getUpdateInfo({\n Component: Component,\n displayName: displayName,\n hookName: hookName,\n prevHook: hookPath ? lodash.get(newPrevHookRef, hookPath) : newPrevHookRef,\n nextHook: nextHook\n });\n if (notification.reason.hookDifferences) {\n wdyrStore.options.notifier(notification);\n }\n }\n return hookResult;\n }\n function createPatchedComponent(Component, _ref2) {\n var displayName = _ref2.displayName,\n defaultProps = _ref2.defaultProps;\n if (isMemoComponent(Component)) {\n return patchMemoComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n }\n if (isForwardRefComponent(Component)) {\n return patchForwardRefComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n }\n if (isReactClassComponent(Component)) {\n return patchClassComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n }\n return patchFunctionalOrStrComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps,\n isPure: false\n });\n }\n function getPatchedComponent(Component, _ref3) {\n var displayName = _ref3.displayName,\n defaultProps = _ref3.defaultProps;\n if (wdyrStore.componentsMap.has(Component)) {\n return wdyrStore.componentsMap.get(Component);\n }\n var WDYRPatchedComponent = createPatchedComponent(Component, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n wdyrStore.componentsMap.set(Component, WDYRPatchedComponent);\n return WDYRPatchedComponent;\n }\n function getIsSupportedComponentType(Comp) {\n if (!Comp) {\n return false;\n }\n if (isMemoComponent(Comp)) {\n return getIsSupportedComponentType(Comp.type);\n }\n if (isForwardRefComponent(Comp)) {\n return getIsSupportedComponentType(Comp.render);\n }\n if (typeof Comp === 'function') {\n return true;\n }\n }\n var hooksConfig = {\n useState: {\n path: '0'\n },\n useReducer: {\n path: '0'\n },\n useContext: undefined,\n useSyncExternalStore: undefined,\n useMemo: {\n dependenciesPath: '1',\n dontReport: true\n },\n useCallback: {\n dependenciesPath: '1',\n dontReport: true\n }\n };\n function storeOwnerData(element) {\n var OwnerInstance = wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner.current;\n if (OwnerInstance) {\n var Component = OwnerInstance.type.ComponentForHooksTracking || OwnerInstance.type;\n var displayName = getDisplayName(Component);\n var additionalOwnerData = {};\n if (wdyrStore.options.getAdditionalOwnerData) {\n additionalOwnerData = wdyrStore.options.getAdditionalOwnerData(element);\n }\n wdyrStore.ownerDataMap.set(element.props, {\n Component: Component,\n displayName: displayName,\n props: OwnerInstance.pendingProps,\n state: OwnerInstance.stateNode ? OwnerInstance.stateNode.state : null,\n hooks: wdyrStore.hooksPerRender,\n additionalOwnerData: additionalOwnerData\n });\n }\n }\n function resetHooksPerRenderIfNeeded() {\n // Intercept assignments to ReactCurrentOwner.current to reset hooksPerRender\n var currentOwner = null;\n if (wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) {\n Object.defineProperty(wdyrStore.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, 'current', {\n get: function get() {\n return currentOwner;\n },\n set: function set(value) {\n currentOwner = value;\n wdyrStore.hooksPerRender = [];\n }\n });\n }\n }\n function trackHooksIfNeeded() {\n var hooksSupported = !!wdyrStore.React.useState;\n if (wdyrStore.options.trackHooks && hooksSupported) {\n var nativeHooks = Object.entries(hooksConfig).map(function (_ref4) {\n var _ref5 = _slicedToArray(_ref4, 2),\n hookName = _ref5[0],\n hookTrackingConfig = _ref5[1];\n return [wdyrStore.React, hookName, hookTrackingConfig];\n });\n var hooksToTrack = [].concat(_toConsumableArray(nativeHooks), _toConsumableArray(wdyrStore.options.trackExtraHooks));\n hooksToTrack.forEach(function (_ref6) {\n var _ref7 = _slicedToArray(_ref6, 3),\n hookParent = _ref7[0],\n hookName = _ref7[1],\n _ref7$ = _ref7[2],\n hookTrackingConfig = _ref7$ === void 0 ? {} : _ref7$;\n var originalHook = hookParent[hookName];\n var newHookName = hookName[0].toUpperCase() + hookName.slice(1);\n var newHook = function WhyDidYouRenderReWrittenHook() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var hookResult = originalHook.call.apply(originalHook, [this].concat(args));\n var dependenciesPath = hookTrackingConfig.dependenciesPath,\n dontReport = hookTrackingConfig.dontReport;\n if (dependenciesPath && lodash.isFunction(hookResult)) {\n dependenciesMap.set(hookResult, {\n hookName: hookName,\n deps: lodash.get(args, dependenciesPath)\n });\n }\n if (!dontReport) {\n trackHookChanges(hookName, hookTrackingConfig, hookResult);\n }\n return hookResult;\n };\n Object.defineProperty(newHook, 'name', {\n value: newHookName,\n writable: false\n });\n Object.assign(newHook, {\n originalHook: originalHook\n });\n hookParent[hookName] = newHook;\n });\n }\n }\n function getWDYRType(origType) {\n var isShouldTrack = getIsSupportedComponentType(origType) && shouldTrack(origType, {\n isHookChange: false\n });\n if (!isShouldTrack) {\n return null;\n }\n var displayName = origType && origType.whyDidYouRender && origType.whyDidYouRender.customName || getDisplayName(origType);\n var defaultProps = getDefaultProps(origType);\n var WDYRPatchedComponent = getPatchedComponent(origType, {\n displayName: displayName,\n defaultProps: defaultProps\n });\n return WDYRPatchedComponent;\n }\n function whyDidYouRender(React, userOptions) {\n if (React.__IS_WDYR__) {\n return;\n }\n React.__IS_WDYR__ = true;\n Object.assign(wdyrStore, {\n React: React,\n options: normalizeOptions(userOptions),\n origCreateElement: React.createElement,\n origCreateFactory: React.createFactory,\n origCloneElement: React.cloneElement,\n componentsMap: new WeakMap()\n });\n resetHooksPerRenderIfNeeded();\n React.createElement = function (origType) {\n var WDYRType = getWDYRType(origType);\n for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n rest[_key2 - 1] = arguments[_key2];\n }\n if (WDYRType) {\n try {\n var element = wdyrStore.origCreateElement.apply(React, [WDYRType].concat(rest));\n if (wdyrStore.options.logOwnerReasons) {\n storeOwnerData(element);\n }\n return element;\n } catch (e) {\n wdyrStore.options.consoleLog('whyDidYouRender error. Please file a bug at https://github.com/welldone-software/why-did-you-render/issues.', {\n errorInfo: {\n error: e,\n componentNameOrComponent: origType,\n rest: rest,\n options: wdyrStore.options\n }\n });\n }\n }\n return wdyrStore.origCreateElement.apply(React, [origType].concat(rest));\n };\n Object.assign(React.createElement, wdyrStore.origCreateElement);\n React.createFactory = function (type) {\n var factory = React.createElement.bind(null, type);\n factory.type = type;\n return factory;\n };\n Object.assign(React.createFactory, wdyrStore.origCreateFactory);\n React.cloneElement = function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n var element = wdyrStore.origCloneElement.apply(React, args);\n if (wdyrStore.options.logOwnerReasons) {\n storeOwnerData(element);\n }\n return element;\n };\n Object.assign(React.cloneElement, wdyrStore.origCloneElement);\n trackHooksIfNeeded();\n React.__REVERT_WHY_DID_YOU_RENDER__ = function () {\n Object.assign(React, {\n createElement: wdyrStore.origCreateElement,\n createFactory: wdyrStore.origCreateFactory,\n cloneElement: wdyrStore.origCloneElement\n });\n wdyrStore.componentsMap = null;\n var hooksToRevert = [].concat(_toConsumableArray(Object.keys(hooksConfig).map(function (hookName) {\n return [React, hookName];\n })), _toConsumableArray(wdyrStore.options.trackExtraHooks));\n hooksToRevert.forEach(function (_ref8) {\n var _ref9 = _slicedToArray(_ref8, 2),\n hookParent = _ref9[0],\n hookName = _ref9[1];\n if (hookParent[hookName].originalHook) {\n hookParent[hookName] = hookParent[hookName].originalHook;\n }\n });\n delete React.__REVERT_WHY_DID_YOU_RENDER__;\n delete React.__IS_WDYR__;\n };\n return React;\n }\n\n whyDidYouRender.defaultNotifier = defaultNotifier;\n whyDidYouRender.wdyrStore = wdyrStore;\n whyDidYouRender.storeOwnerData = storeOwnerData;\n whyDidYouRender.getWDYRType = getWDYRType;\n Object.assign(whyDidYouRender, React__namespace);\n\n return whyDidYouRender;\n\n}));\n//# sourceMappingURL=whyDidYouRender.js.map\n\n\n//# sourceURL=webpack://spt/./node_modules/@welldone-software/why-did-you-render/dist/whyDidYouRender.js?"); /***/ }), @@ -5650,6 +5650,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ }), +/***/ "./src/ui/components/PatientViewer/FilterPresets.jsx": +/*!***********************************************************!*\ + !*** ./src/ui/components/PatientViewer/FilterPresets.jsx ***! + \***********************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// map a list to a group of fhir ORs, eg [1,2,3] --> string \"'1' | '2' | '3'\"\nconst fhirList = list => list.map(i => \"'\".concat(i, \"'\")).join(' | ');\nconst DR_CONDITIONS = ['44054006',\n// diabetes\n'15777000',\n// prediabetes\n'1551000119108',\n// NPDR\n'1501000119109',\n// PDR\n'97331000119101',\n// DME\n'60951000119105' // blindness\n];\nconst SDOH_CONDITIONS = ['314529007', '5251000175109', '424393004', '160903007', '706893006', '73595000', '160904001', '741062008', '10939881000119105', '422650009', '423315002', '706893006', '266948004', '5251000175109'];\nconst FILTER_PRESETS = Object.freeze({\n \"Hide Resolved Conditions\": {\n description: \"Hides conditions with an abatement date\",\n mode: 'exclude',\n filterOnGroupByEncounter: false,\n filters: {\n Condition: ['Condition.abatement'] // is not null\n }\n },\n \"Hide Stopped Medications\": {\n description: \"Hides medications with a status of 'stopped'\",\n mode: 'exclude',\n filterOnGroupByEncounter: false,\n filters: {\n MedicationRequest: [\"MedicationRequest.status = 'stopped'\"]\n }\n },\n 'Disease Focus: Diabetic Retinopathy': {\n description: 'Keeps entries relevant to Diabetic Retinopathy',\n mode: 'include',\n filterOnGroupByEncounter: true,\n filters: {\n Encounter: [\"Encounter.type.coding.code = '185349003'\"],\n Condition: [\"Condition.code.coding.code in (\".concat(fhirList(DR_CONDITIONS), \")\")],\n Observation: []\n }\n },\n 'Hide SDOH Conditions': {\n description: 'Hides most SDOH conditions, such as \"stress\", employment status, etc',\n mode: 'exclude',\n filterOnGroupByEncounter: true,\n filters: {\n Condition: [\"Condition.code.coding.code in (\".concat(fhirList(SDOH_CONDITIONS), \")\")]\n }\n }\n // Coming soon...\n // 'Cardiology': {\n // description: 'Keeps entries relevant to Cardiology',\n // mode: 'include',\n // filters: {\n\n // }\n // }\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FILTER_PRESETS);\n\n//# sourceURL=webpack://spt/./src/ui/components/PatientViewer/FilterPresets.jsx?"); + +/***/ }), + /***/ "./src/ui/components/PatientViewer/PatientViewer.jsx": /*!***********************************************************!*\ !*** ./src/ui/components/PatientViewer/PatientViewer.jsx ***! @@ -5657,7 +5668,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/dist/index.js\");\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! use-local-storage */ \"./node_modules/use-local-storage/dist/index.js\");\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(use_local_storage__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var fhir_visualizers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fhir-visualizers */ \"./node_modules/fhir-visualizers/build/index.js\");\n/* harmony import */ var _ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ResourceTables/ResourceTables */ \"./src/ui/components/ResourceTables/ResourceTables.jsx\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router/dist/index.js\");\n/* harmony import */ var react_router_hash_link__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! react-router-hash-link */ \"./node_modules/react-router-hash-link/dist/react-router-hash-link.esm.js\");\n/* harmony import */ var _mui_material_Box__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @mui/material/Box */ \"./node_modules/@mui/material/Box/Box.js\");\n/* harmony import */ var _mui_material_Paper__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @mui/material/Paper */ \"./node_modules/@mui/material/Paper/Paper.js\");\n/* harmony import */ var _mui_material_Button__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @mui/material/Button */ \"./node_modules/@mui/material/Button/Button.js\");\n/* harmony import */ var react_accessible_accordion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-accessible-accordion */ \"./node_modules/react-accessible-accordion/dist/es/index.js\");\n/* harmony import */ var _EncounterGroupedRecord__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./EncounterGroupedRecord */ \"./src/ui/components/PatientViewer/EncounterGroupedRecord.jsx\");\n/* harmony import */ var _Settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Settings */ \"./src/ui/components/PatientViewer/Settings.jsx\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ \"./src/ui/components/PatientViewer/utils.jsx\");\n/* harmony import */ var react_accessible_accordion_dist_fancy_example_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-accessible-accordion/dist/fancy-example.css */ \"./node_modules/react-accessible-accordion/dist/fancy-example.css\");\n/* harmony import */ var react_dropzone__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! react-dropzone */ \"./node_modules/react-dropzone/dist/es/index.js\");\n/* harmony import */ var _SyntheticMass_api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../SyntheticMass/api */ \"./src/ui/components/SyntheticMass/api.js\");\n/* harmony import */ var _github__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../github */ \"./src/ui/github.jsx\");\n/* harmony import */ var _csvToFhir__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./csvToFhir */ \"./src/ui/components/PatientViewer/csvToFhir.js\");\n/* harmony import */ var _fhirpath_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../fhirpath_utils */ \"./src/ui/fhirpath_utils.jsx\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Demo styles, see 'Styles' section below for some notes on use.\n\n\n\n\n\n\nconst getDropzone = (setLoading, callback) => {\n const onDrop = files => {\n const reader = new FileReader();\n reader.readAsText(files[0]);\n setLoading(true);\n reader.onload = () => {\n if (reader.result) {\n const json = JSON.parse(reader.result);\n setLoading(false);\n callback(json);\n }\n };\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_dropzone__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n onDrop: onDrop\n }, _ref => {\n let {\n getRootProps,\n getInputProps\n } = _ref;\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", getRootProps({\n style: {\n height: '100vh',\n width: '100%',\n background: '#F0F8FF',\n padding: \"2rem\"\n }\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", getInputProps()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Box__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n minHeight: \"100%\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Box__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n sx: {\n p: 2,\n border: '1px dashed grey',\n textAlign: 'center'\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, \"Drag & drop a FHIR JSON file here\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, \"or \", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n style: {\n textDecoration: 'underline',\n color: 'blue'\n }\n }, \"click to select a file\"), \".\")))));\n });\n};\nfunction getPatient(id) {\n if (id.startsWith('csv/')) {\n return (0,_csvToFhir__WEBPACK_IMPORTED_MODULE_11__[\"default\"])(id.slice(4)); // slice off the \"csv/\" bit\n } else if (id.startsWith('github/')) {\n return (0,_github__WEBPACK_IMPORTED_MODULE_10__.getPatientOnGitHub)(id);\n } else {\n return (0,_SyntheticMass_api__WEBPACK_IMPORTED_MODULE_9__.getPatientById)(id);\n }\n}\nconst PatientViewer = props => {\n const location = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_15__.useLocation)();\n const [urlParams, setUrlParams] = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_16__.useSearchParams)();\n const id = props.id || urlParams.get('patient');\n const [bundle, _setBundle] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();\n const [previousBundle, setPreviousBundle] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"previousBundle\", bundle);\n const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!bundle);\n const setBundle = bundle => {\n _setBundle(bundle);\n setPreviousBundle(bundle);\n setIsLoading(false);\n };\n const [isGroupByEncounter, setIsGroupByEncounter] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"group-by-encounter\", false);\n const [filters, setFilters] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"filters\", {});\n const [filterMode, setFilterMode] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"filter-mode\", \"include\");\n\n // TODO: probably a better way to make these generic. don't want to pass around 100 variables for different settings\n const [hideStoppedMeds, setHideStoppedMeds] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"Hide Stopped Medications\", false);\n const [hideResolvedConditions, setHideResolvedConditions] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"Hide Resolved Conditions\", false);\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n if (id && !bundle) {\n setIsLoading(true);\n getPatient(id).then(patientEverythingBundle => {\n setBundle(patientEverythingBundle);\n });\n }\n }, [id, bundle]);\n if (!id && !bundle) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, previousBundle && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n variant: \"contained\",\n onClick: () => setBundle(previousBundle),\n style: {\n textTransform: \"none\"\n }\n }, \"Reload Last Patient\"), getDropzone(setIsLoading, setBundle));\n }\n if (isLoading) return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"img\", {\n src: \"https://i.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.webp\",\n alt: \"loading...\"\n });\n let allResources = bundle.entry.map(e => e.resource);\n if (Object.keys(filters).length) {\n allResources = allResources.filter(r => {\n const filtersByResourceType = filters[r.resourceType];\n if (!filtersByResourceType) return true;\n const anyMatch = filtersByResourceType.some(f => (0,_fhirpath_utils__WEBPACK_IMPORTED_MODULE_12__.appliesToResource)(r, f));\n return filterMode === 'exclude' ? !anyMatch : anyMatch;\n });\n }\n const patient = allResources.find(r => r.resourceType === 'Patient');\n const toggleGroup = event => {\n event.preventDefault();\n setIsGroupByEncounter(!isGroupByEncounter);\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Paper__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n style: {\n margin: \"1rem\",\n padding: \"1rem\"\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Settings__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(fhir_visualizers__WEBPACK_IMPORTED_MODULE_2__.PatientVisualizer, {\n patient: patient\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n href: \"#\",\n onClick: toggleGroup\n }, isGroupByEncounter ? \"Ungroup\" : \"Group\", \" by Encounter\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null), isGroupByEncounter ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_EncounterGroupedRecord__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n allResources: allResources\n }) :\n /*#__PURE__*/\n // !isGroupByEncounter\n react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(LinksByType, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(EntireRecord, {\n allResources: allResources,\n hideResolvedConditions: hideResolvedConditions,\n hideStoppedMeds: hideStoppedMeds\n })));\n};\nconst LinksByType = () => {\n const types = ['Conditions', 'Medications', 'Observations', 'Reports', 'CarePlans', 'Procedures', 'Encounters', 'Allergies', 'Immunizations', 'Documents'];\n const location = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_15__.useLocation)();\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, \"Jump To:\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null), types.map((t, i) => {\n // newLocation preserves any query, like if we're in a patient via syntheticmass\n const newLocation = {\n ...location,\n hash: '#' + t\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, i > 0 && ' | ', /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_router_hash_link__WEBPACK_IMPORTED_MODULE_19__.HashLink, {\n to: newLocation\n }, t));\n }));\n};\nconst EntireRecord = props => {\n const {\n allResources,\n hideStoppedMeds,\n hideResolvedConditions\n } = props;\n const getByType = type => allResources.filter(r => r.resourceType === type);\n let conditions = getByType('Condition');\n if (hideResolvedConditions) {\n conditions = conditions.filter(c => !c.abatementDateTime);\n }\n let medications = getByType('MedicationRequest');\n if (hideStoppedMeds) {\n medications = medications.filter(m => m.status !== 'stopped');\n }\n const meds = getByType('Medication');\n medications.forEach(m => {\n if (m.medicationReference) {\n const referencedMed = meds.find(med => (0,_utils__WEBPACK_IMPORTED_MODULE_7__.isMatchingReference)(med, m.medicationReference.reference, 'Medication'));\n if (referencedMed) {\n m.medicationCodeableConcept = referencedMed.code;\n }\n }\n });\n let observations = getByType('Observation');\n const reports = getByType('DiagnosticReport');\n reports.forEach(r => {\n if (r.result) {\n r.observations = r.result.map(res => observations.find(o => (0,_utils__WEBPACK_IMPORTED_MODULE_7__.isMatchingReference)(o, res.reference, 'Observation')));\n observations = observations.filter(o => !r.observations.includes(o));\n }\n });\n const careplans = getByType('CarePlan');\n const goals = getByType('Goal');\n // note that the syntheticmass server doesn't currently return goals in Patient$everything\n\n careplans.forEach(cp => {\n if (cp.goal) {\n cp.goals = cp.goal.map(cpg => goals.find(g => (0,_utils__WEBPACK_IMPORTED_MODULE_7__.isMatchingReference)(g, cpg.reference, 'Goal'))).filter(g => g);\n }\n });\n const procedures = getByType('Procedure');\n const encounters = getByType('Encounter');\n const allergies = getByType('AllergyIntolerance');\n const immunizations = getByType('Immunization');\n const documents = getByType('DocumentReference');\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Section, {\n conditions: conditions,\n medications: medications,\n observations: observations,\n reports: reports,\n careplans: careplans,\n procedures: procedures,\n encounters: encounters,\n allergies: allergies,\n immunizations: immunizations,\n documents: documents\n });\n};\nconst isNotEmpty = rows => rows != null && rows.length > 0;\nconst Section = props => {\n const show = props.showEmptySections ? _rows => true : rows => isNotEmpty(rows);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, show(props.conditions) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ConditionsTable, {\n rows: props.conditions\n }), show(props.medications) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.MedicationRequestsTable, {\n rows: props.medications\n }), show(props.observations) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ObservationsTable, {\n rows: props.observations\n }), show(props.reports) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ReportsTable, {\n rows: props.reports\n }), show(props.careplans) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.CarePlansTable, {\n rows: props.careplans\n }), show(props.procedures) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ProceduresTable, {\n rows: props.procedures\n }), show(props.encounters) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.EncountersTable, {\n rows: props.encounters\n }), show(props.allergies) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.AllergiesTable, {\n rows: props.allergies\n }), show(props.immunizations) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ImmunizationsTable, {\n rows: props.immunizations\n }), show(props.documents) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.DocumentReferencesTable, {\n rows: props.documents\n }));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PatientViewer);\n\n//# sourceURL=webpack://spt/./src/ui/components/PatientViewer/PatientViewer.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/dist/index.js\");\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! use-local-storage */ \"./node_modules/use-local-storage/dist/index.js\");\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(use_local_storage__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var fhir_visualizers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fhir-visualizers */ \"./node_modules/fhir-visualizers/build/index.js\");\n/* harmony import */ var _ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ResourceTables/ResourceTables */ \"./src/ui/components/ResourceTables/ResourceTables.jsx\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router/dist/index.js\");\n/* harmony import */ var react_router_hash_link__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! react-router-hash-link */ \"./node_modules/react-router-hash-link/dist/react-router-hash-link.esm.js\");\n/* harmony import */ var _mui_material_Box__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @mui/material/Box */ \"./node_modules/@mui/material/Box/Box.js\");\n/* harmony import */ var _mui_material_Paper__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @mui/material/Paper */ \"./node_modules/@mui/material/Paper/Paper.js\");\n/* harmony import */ var _mui_material_Button__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @mui/material/Button */ \"./node_modules/@mui/material/Button/Button.js\");\n/* harmony import */ var react_accessible_accordion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-accessible-accordion */ \"./node_modules/react-accessible-accordion/dist/es/index.js\");\n/* harmony import */ var _EncounterGroupedRecord__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./EncounterGroupedRecord */ \"./src/ui/components/PatientViewer/EncounterGroupedRecord.jsx\");\n/* harmony import */ var _Settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Settings */ \"./src/ui/components/PatientViewer/Settings.jsx\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ \"./src/ui/components/PatientViewer/utils.jsx\");\n/* harmony import */ var react_accessible_accordion_dist_fancy_example_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-accessible-accordion/dist/fancy-example.css */ \"./node_modules/react-accessible-accordion/dist/fancy-example.css\");\n/* harmony import */ var react_dropzone__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! react-dropzone */ \"./node_modules/react-dropzone/dist/es/index.js\");\n/* harmony import */ var _SyntheticMass_api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../SyntheticMass/api */ \"./src/ui/components/SyntheticMass/api.js\");\n/* harmony import */ var _github__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../github */ \"./src/ui/github.jsx\");\n/* harmony import */ var _csvToFhir__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./csvToFhir */ \"./src/ui/components/PatientViewer/csvToFhir.js\");\n/* harmony import */ var _fhirpath_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../fhirpath_utils */ \"./src/ui/fhirpath_utils.jsx\");\n/* harmony import */ var _FilterPresets__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./FilterPresets */ \"./src/ui/components/PatientViewer/FilterPresets.jsx\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Demo styles, see 'Styles' section below for some notes on use.\n\n\n\n\n\n\n\nconst getDropzone = (setLoading, callback) => {\n const onDrop = files => {\n const reader = new FileReader();\n reader.readAsText(files[0]);\n setLoading(true);\n reader.onload = () => {\n if (reader.result) {\n const json = JSON.parse(reader.result);\n setLoading(false);\n callback(json);\n }\n };\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_dropzone__WEBPACK_IMPORTED_MODULE_14__[\"default\"], {\n onDrop: onDrop\n }, _ref => {\n let {\n getRootProps,\n getInputProps\n } = _ref;\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", getRootProps({\n style: {\n height: '100vh',\n width: '100%',\n background: '#F0F8FF',\n padding: \"2rem\"\n }\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"input\", getInputProps()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Box__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n minHeight: \"100%\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Box__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n sx: {\n p: 2,\n border: '1px dashed grey',\n textAlign: 'center'\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, \"Drag & drop a FHIR JSON file here\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"h2\", null, \"or \", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", {\n style: {\n textDecoration: 'underline',\n color: 'blue'\n }\n }, \"click to select a file\"), \".\")))));\n });\n};\nfunction getPatient(id) {\n if (id.startsWith('csv/')) {\n return (0,_csvToFhir__WEBPACK_IMPORTED_MODULE_11__[\"default\"])(id.slice(4)); // slice off the \"csv/\" bit\n } else if (id.startsWith('github/')) {\n return (0,_github__WEBPACK_IMPORTED_MODULE_10__.getPatientOnGitHub)(id);\n } else {\n return (0,_SyntheticMass_api__WEBPACK_IMPORTED_MODULE_9__.getPatientById)(id);\n }\n}\nconst PatientViewer = props => {\n const location = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_16__.useLocation)();\n const [urlParams, setUrlParams] = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_17__.useSearchParams)();\n const id = props.id || urlParams.get('patient');\n const [bundle, _setBundle] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)();\n const [previousBundle, setPreviousBundle] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"previousBundle\", bundle);\n const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!bundle);\n const setBundle = bundle => {\n _setBundle(bundle);\n setPreviousBundle(bundle);\n setIsLoading(false);\n };\n const [isGroupByEncounter, setIsGroupByEncounter] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(\"group-by-encounter\", false);\n const loadedPresets = [];\n for (const presetKey of Object.keys(_FilterPresets__WEBPACK_IMPORTED_MODULE_13__[\"default\"])) {\n const [isPresetLoaded] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(presetKey, false);\n if (isPresetLoaded) {\n loadedPresets.push(presetKey);\n }\n }\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n if (id && !bundle) {\n setIsLoading(true);\n getPatient(id).then(patientEverythingBundle => {\n setBundle(patientEverythingBundle);\n });\n }\n }, [id, bundle]);\n if (!id && !bundle) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, previousBundle && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n variant: \"contained\",\n onClick: () => setBundle(previousBundle),\n style: {\n textTransform: \"none\"\n }\n }, \"Reload Last Patient\"), getDropzone(setIsLoading, setBundle));\n }\n if (isLoading) return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"img\", {\n src: \"https://i.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.webp\",\n alt: \"loading...\"\n });\n let allResources = bundle.entry.map(e => e.resource);\n for (const presetKey of loadedPresets) {\n const preset = _FilterPresets__WEBPACK_IMPORTED_MODULE_13__[\"default\"][presetKey];\n if (isGroupByEncounter && !preset.filterOnGroupByEncounter) continue;\n allResources = allResources.filter(r => {\n const filtersByResourceType = preset.filters[r.resourceType];\n if (!filtersByResourceType) return true;\n const anyMatch = filtersByResourceType.some(f => (0,_fhirpath_utils__WEBPACK_IMPORTED_MODULE_12__.appliesToResource)(r, f));\n return preset.mode === 'exclude' ? !anyMatch : anyMatch;\n });\n }\n const patient = allResources.find(r => r.resourceType === 'Patient');\n const toggleGroup = event => {\n event.preventDefault();\n setIsGroupByEncounter(!isGroupByEncounter);\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Paper__WEBPACK_IMPORTED_MODULE_19__[\"default\"], {\n style: {\n margin: \"1rem\",\n padding: \"1rem\"\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Settings__WEBPACK_IMPORTED_MODULE_6__[\"default\"], null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(fhir_visualizers__WEBPACK_IMPORTED_MODULE_2__.PatientVisualizer, {\n patient: patient\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"a\", {\n href: \"#\",\n onClick: toggleGroup\n }, isGroupByEncounter ? \"Ungroup\" : \"Group\", \" by Encounter\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null), isGroupByEncounter ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_EncounterGroupedRecord__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n allResources: allResources\n }) :\n /*#__PURE__*/\n // !isGroupByEncounter\n react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(LinksByType, null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(EntireRecord, {\n allResources: allResources\n })));\n};\nconst LinksByType = () => {\n const types = ['Conditions', 'Medications', 'Observations', 'Reports', 'CarePlans', 'Procedures', 'Encounters', 'Allergies', 'Immunizations', 'Documents'];\n const location = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_16__.useLocation)();\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, \"Jump To:\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null), types.map((t, i) => {\n // newLocation preserves any query, like if we're in a patient via syntheticmass\n const newLocation = {\n ...location,\n hash: '#' + t\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, i > 0 && ' | ', /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_router_hash_link__WEBPACK_IMPORTED_MODULE_20__.HashLink, {\n to: newLocation\n }, t));\n }));\n};\nconst EntireRecord = props => {\n const {\n allResources\n } = props;\n const getByType = type => allResources.filter(r => r.resourceType === type);\n const conditions = getByType('Condition');\n const medications = getByType('MedicationRequest');\n const meds = getByType('Medication');\n medications.forEach(m => {\n if (m.medicationReference) {\n const referencedMed = meds.find(med => (0,_utils__WEBPACK_IMPORTED_MODULE_7__.isMatchingReference)(med, m.medicationReference.reference, 'Medication'));\n if (referencedMed) {\n m.medicationCodeableConcept = referencedMed.code;\n }\n }\n });\n let observations = getByType('Observation');\n const reports = getByType('DiagnosticReport');\n reports.forEach(r => {\n if (r.result) {\n r.observations = r.result.map(res => observations.find(o => (0,_utils__WEBPACK_IMPORTED_MODULE_7__.isMatchingReference)(o, res.reference, 'Observation')));\n observations = observations.filter(o => !r.observations.includes(o));\n }\n });\n const careplans = getByType('CarePlan');\n const goals = getByType('Goal');\n // note that the syntheticmass server doesn't currently return goals in Patient$everything\n\n careplans.forEach(cp => {\n if (cp.goal) {\n cp.goals = cp.goal.map(cpg => goals.find(g => (0,_utils__WEBPACK_IMPORTED_MODULE_7__.isMatchingReference)(g, cpg.reference, 'Goal'))).filter(g => g);\n }\n });\n const procedures = getByType('Procedure');\n const encounters = getByType('Encounter');\n const allergies = getByType('AllergyIntolerance');\n const immunizations = getByType('Immunization');\n const documents = getByType('DocumentReference');\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Section, {\n conditions: conditions,\n medications: medications,\n observations: observations,\n reports: reports,\n careplans: careplans,\n procedures: procedures,\n encounters: encounters,\n allergies: allergies,\n immunizations: immunizations,\n documents: documents\n });\n};\nconst isNotEmpty = rows => rows != null && rows.length > 0;\nconst Section = props => {\n const show = props.showEmptySections ? _rows => true : rows => isNotEmpty(rows);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, show(props.conditions) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ConditionsTable, {\n rows: props.conditions\n }), show(props.medications) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.MedicationRequestsTable, {\n rows: props.medications\n }), show(props.observations) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ObservationsTable, {\n rows: props.observations\n }), show(props.reports) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ReportsTable, {\n rows: props.reports\n }), show(props.careplans) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.CarePlansTable, {\n rows: props.careplans\n }), show(props.procedures) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ProceduresTable, {\n rows: props.procedures\n }), show(props.encounters) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.EncountersTable, {\n rows: props.encounters\n }), show(props.allergies) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.AllergiesTable, {\n rows: props.allergies\n }), show(props.immunizations) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.ImmunizationsTable, {\n rows: props.immunizations\n }), show(props.documents) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_ResourceTables_ResourceTables__WEBPACK_IMPORTED_MODULE_3__.DocumentReferencesTable, {\n rows: props.documents\n }));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PatientViewer);\n\n//# sourceURL=webpack://spt/./src/ui/components/PatientViewer/PatientViewer.jsx?"); /***/ }), @@ -5668,7 +5679,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! use-local-storage */ \"./node_modules/use-local-storage/dist/index.js\");\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(use_local_storage__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _mui_icons_material_Settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @mui/icons-material/Settings */ \"./node_modules/@mui/icons-material/Settings.js\");\n/* harmony import */ var _mui_material_Box__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @mui/material/Box */ \"./node_modules/@mui/material/Box/Box.js\");\n/* harmony import */ var _mui_material_Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @mui/material/Button */ \"./node_modules/@mui/material/Button/Button.js\");\n/* harmony import */ var _mui_material_Typography__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @mui/material/Typography */ \"./node_modules/@mui/material/Typography/Typography.js\");\n/* harmony import */ var _mui_material_Modal__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @mui/material/Modal */ \"./node_modules/@mui/material/Modal/Modal.js\");\n/* harmony import */ var _mui_material_Checkbox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @mui/material/Checkbox */ \"./node_modules/@mui/material/Checkbox/Checkbox.js\");\n/* harmony import */ var _mui_material_Tooltip__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @mui/material/Tooltip */ \"./node_modules/@mui/material/Tooltip/Tooltip.js\");\n/* harmony import */ var _mui_material_TextField__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @mui/material/TextField */ \"./node_modules/@mui/material/TextField/TextField.js\");\n/* harmony import */ var _mui_icons_material_Info__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @mui/icons-material/Info */ \"./node_modules/@mui/icons-material/Info.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst style = {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n width: '65%',\n bgcolor: 'background.paper',\n border: '2px solid #000',\n boxShadow: 24,\n p: 4\n};\nconst CONFIG_OPTIONS = [\n// { key: \"filters\", defaultValue: \"{}\", \n// description: \"TBD\" },\n{\n key: \"Hide Resolved Conditions\",\n defaultValue: false,\n type: \"boolean\",\n description: \"If true, conditions with an abatement date will be hidden\"\n}, {\n key: \"Hide Stopped Medications\",\n defaultValue: false,\n type: \"boolean\",\n description: \"If true, medications with a status of 'stopped' will be hidden\"\n}];\nconst Settings = () => {\n const [open, setOpen] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);\n const handleOpen = () => setOpen(true);\n const handleClose = () => setOpen(false);\n const hooks = {};\n for (const configOpt of CONFIG_OPTIONS) {\n const [configValue, setConfigValue] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(configOpt.key, configOpt.defaultValue);\n hooks[configOpt.key] = {\n value: configValue,\n set: setConfigValue\n };\n }\n const handleChangeText = evt => {\n hooks[evt.target.name].set(evt.target.value);\n };\n const handleChangeBoolean = evt => {\n hooks[evt.target.name].set(evt.target.checked);\n };\n const fields = [];\n for (const configOpt of CONFIG_OPTIONS) {\n const key = configOpt.key;\n if (configOpt.type == 'boolean') {\n var _hooks$key$value;\n fields.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: key\n }, key, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Checkbox__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n id: key,\n name: key,\n label: key,\n defaultChecked: (_hooks$key$value = hooks[key].value) !== null && _hooks$key$value !== void 0 ? _hooks$key$value : configOpt.defaultValue,\n onChange: handleChangeBoolean\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Tooltip__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n title: configOpt.description,\n disableInteractive: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n disabled: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_icons_material_Info__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n fontSize: \"small\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null)));\n } else {\n var _hooks$key$value2;\n fields.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: key\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_TextField__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n id: key,\n name: key,\n type: configOpt.type,\n label: key,\n defaultValue: (_hooks$key$value2 = hooks[key].value) !== null && _hooks$key$value2 !== void 0 ? _hooks$key$value2 : configOpt.defaultValue,\n variant: \"outlined\",\n onChange: handleChangeText\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Tooltip__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n title: configOpt.description,\n disableInteractive: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n disabled: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_icons_material_Info__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n fontSize: \"small\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null)));\n }\n }\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n style: {\n position: 'relative',\n float: 'right'\n },\n onClick: handleOpen\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_icons_material_Settings__WEBPACK_IMPORTED_MODULE_7__[\"default\"], null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Modal__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n open: open,\n onClose: handleClose,\n \"aria-labelledby\": \"modal-modal-title\",\n \"aria-describedby\": \"modal-modal-description\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Box__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n sx: style\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Typography__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n id: \"modal-modal-description\",\n component: \"pre\"\n }, fields))));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Settings);\n\n//# sourceURL=webpack://spt/./src/ui/components/PatientViewer/Settings.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! use-local-storage */ \"./node_modules/use-local-storage/dist/index.js\");\n/* harmony import */ var use_local_storage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(use_local_storage__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _mui_icons_material_Settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @mui/icons-material/Settings */ \"./node_modules/@mui/icons-material/Settings.js\");\n/* harmony import */ var _mui_material_Box__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @mui/material/Box */ \"./node_modules/@mui/material/Box/Box.js\");\n/* harmony import */ var _mui_material_Button__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @mui/material/Button */ \"./node_modules/@mui/material/Button/Button.js\");\n/* harmony import */ var _mui_material_Typography__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @mui/material/Typography */ \"./node_modules/@mui/material/Typography/Typography.js\");\n/* harmony import */ var _mui_material_Modal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @mui/material/Modal */ \"./node_modules/@mui/material/Modal/Modal.js\");\n/* harmony import */ var _mui_material_Checkbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @mui/material/Checkbox */ \"./node_modules/@mui/material/Checkbox/Checkbox.js\");\n/* harmony import */ var _mui_material_Tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @mui/material/Tooltip */ \"./node_modules/@mui/material/Tooltip/Tooltip.js\");\n/* harmony import */ var _mui_material_TextField__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @mui/material/TextField */ \"./node_modules/@mui/material/TextField/TextField.js\");\n/* harmony import */ var _mui_icons_material_Info__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @mui/icons-material/Info */ \"./node_modules/@mui/icons-material/Info.js\");\n/* harmony import */ var _FilterPresets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FilterPresets */ \"./src/ui/components/PatientViewer/FilterPresets.jsx\");\n\n\n\n\n\n\n\n\n\n\n\n\nconst style = {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n width: '65%',\n bgcolor: 'background.paper',\n border: '2px solid #000',\n boxShadow: 24,\n p: 4\n};\nconst CONFIG_OPTIONS = [\n// { key: \"filters\", defaultValue: \"{}\", \n// description: \"TBD\" },\n// { key: \"Hide Resolved Conditions\", defaultValue: false, type: \"boolean\",\n// description: \"If true, conditions with an abatement date will be hidden\" }, \n// { key: \"Hide Stopped Medications\", defaultValue: false, type: \"boolean\",\n// description: \"If true, medications with a status of 'stopped' will be hidden\" },\n...Object.entries(_FilterPresets__WEBPACK_IMPORTED_MODULE_2__[\"default\"]).map(_ref => {\n let [key, value] = _ref;\n return {\n key,\n description: value.description,\n type: \"boolean\"\n };\n})];\nconst Settings = () => {\n const [open, setOpen] = react__WEBPACK_IMPORTED_MODULE_0___default().useState(false);\n const handleOpen = () => setOpen(true);\n const handleClose = () => setOpen(false);\n const hooks = {};\n for (const configOpt of CONFIG_OPTIONS) {\n const [configValue, setConfigValue] = use_local_storage__WEBPACK_IMPORTED_MODULE_1___default()(configOpt.key, configOpt.defaultValue);\n hooks[configOpt.key] = {\n value: configValue,\n set: setConfigValue\n };\n }\n const handleChangeText = evt => {\n hooks[evt.target.name].set(evt.target.value);\n };\n const handleChangeBoolean = evt => {\n hooks[evt.target.name].set(evt.target.checked);\n };\n const fields = [];\n for (const configOpt of CONFIG_OPTIONS) {\n const key = configOpt.key;\n if (configOpt.type == 'separator') {\n fields.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"hr\", null));\n } else if (configOpt.type == 'header') {\n fields.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Typography__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n component: \"h4\"\n }, \" \", configOpt.key));\n } else if (configOpt.type == 'boolean') {\n var _hooks$key$value;\n fields.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: key\n }, key, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Checkbox__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n id: key,\n name: key,\n label: key,\n defaultChecked: (_hooks$key$value = hooks[key].value) !== null && _hooks$key$value !== void 0 ? _hooks$key$value : configOpt.defaultValue,\n onChange: handleChangeBoolean\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Tooltip__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n title: configOpt.description,\n disableInteractive: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n disabled: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_icons_material_Info__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n fontSize: \"small\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null)));\n } else {\n var _hooks$key$value2;\n fields.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n key: key\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_TextField__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n id: key,\n name: key,\n type: configOpt.type,\n label: key,\n defaultValue: (_hooks$key$value2 = hooks[key].value) !== null && _hooks$key$value2 !== void 0 ? _hooks$key$value2 : configOpt.defaultValue,\n variant: \"outlined\",\n onChange: handleChangeText\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Tooltip__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n title: configOpt.description,\n disableInteractive: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"span\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n disabled: true\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_icons_material_Info__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n fontSize: \"small\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"br\", null)));\n }\n }\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Button__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n style: {\n position: 'relative',\n float: 'right'\n },\n onClick: handleOpen\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_icons_material_Settings__WEBPACK_IMPORTED_MODULE_9__[\"default\"], null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Modal__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n open: open,\n onClose: handleClose,\n \"aria-labelledby\": \"modal-modal-title\",\n \"aria-describedby\": \"modal-modal-description\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Box__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n sx: style\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_mui_material_Typography__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n id: \"modal-modal-description\",\n component: \"pre\"\n }, fields))));\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Settings);\n\n//# sourceURL=webpack://spt/./src/ui/components/PatientViewer/Settings.jsx?"); /***/ }), @@ -8342,7 +8353,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("var react_dom__WEBPACK_IMPORTED_MODULE_1___namespace_cache;\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AbortedDeferredError: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.AbortedDeferredError),\n/* harmony export */ Await: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.Await),\n/* harmony export */ BrowserRouter: () => (/* binding */ BrowserRouter),\n/* harmony export */ Form: () => (/* binding */ Form),\n/* harmony export */ HashRouter: () => (/* binding */ HashRouter),\n/* harmony export */ Link: () => (/* binding */ Link),\n/* harmony export */ MemoryRouter: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.MemoryRouter),\n/* harmony export */ NavLink: () => (/* binding */ NavLink),\n/* harmony export */ Navigate: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.Navigate),\n/* harmony export */ NavigationType: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.Action),\n/* harmony export */ Outlet: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.Outlet),\n/* harmony export */ Route: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.Route),\n/* harmony export */ Router: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.Router),\n/* harmony export */ RouterProvider: () => (/* binding */ RouterProvider),\n/* harmony export */ Routes: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.Routes),\n/* harmony export */ ScrollRestoration: () => (/* binding */ ScrollRestoration),\n/* harmony export */ UNSAFE_DataRouterContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.UNSAFE_DataRouterContext),\n/* harmony export */ UNSAFE_DataRouterStateContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.UNSAFE_DataRouterStateContext),\n/* harmony export */ UNSAFE_ErrorResponseImpl: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.UNSAFE_ErrorResponseImpl),\n/* harmony export */ UNSAFE_FetchersContext: () => (/* binding */ FetchersContext),\n/* harmony export */ UNSAFE_LocationContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.UNSAFE_LocationContext),\n/* harmony export */ UNSAFE_NavigationContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.UNSAFE_NavigationContext),\n/* harmony export */ UNSAFE_RouteContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.UNSAFE_RouteContext),\n/* harmony export */ UNSAFE_ViewTransitionContext: () => (/* binding */ ViewTransitionContext),\n/* harmony export */ UNSAFE_useRouteId: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.UNSAFE_useRouteId),\n/* harmony export */ UNSAFE_useScrollRestoration: () => (/* binding */ useScrollRestoration),\n/* harmony export */ createBrowserRouter: () => (/* binding */ createBrowserRouter),\n/* harmony export */ createHashRouter: () => (/* binding */ createHashRouter),\n/* harmony export */ createMemoryRouter: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.createMemoryRouter),\n/* harmony export */ createPath: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.createPath),\n/* harmony export */ createRoutesFromChildren: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.createRoutesFromChildren),\n/* harmony export */ createRoutesFromElements: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.createRoutesFromElements),\n/* harmony export */ createSearchParams: () => (/* binding */ createSearchParams),\n/* harmony export */ defer: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.defer),\n/* harmony export */ generatePath: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.generatePath),\n/* harmony export */ isRouteErrorResponse: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.isRouteErrorResponse),\n/* harmony export */ json: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.json),\n/* harmony export */ matchPath: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.matchPath),\n/* harmony export */ matchRoutes: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.matchRoutes),\n/* harmony export */ parsePath: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.parsePath),\n/* harmony export */ redirect: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.redirect),\n/* harmony export */ redirectDocument: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.redirectDocument),\n/* harmony export */ renderMatches: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.renderMatches),\n/* harmony export */ resolvePath: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_2__.resolvePath),\n/* harmony export */ unstable_HistoryRouter: () => (/* binding */ HistoryRouter),\n/* harmony export */ unstable_usePrompt: () => (/* binding */ usePrompt),\n/* harmony export */ unstable_useViewTransitionState: () => (/* binding */ useViewTransitionState),\n/* harmony export */ useActionData: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useActionData),\n/* harmony export */ useAsyncError: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useAsyncError),\n/* harmony export */ useAsyncValue: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useAsyncValue),\n/* harmony export */ useBeforeUnload: () => (/* binding */ useBeforeUnload),\n/* harmony export */ useBlocker: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useBlocker),\n/* harmony export */ useFetcher: () => (/* binding */ useFetcher),\n/* harmony export */ useFetchers: () => (/* binding */ useFetchers),\n/* harmony export */ useFormAction: () => (/* binding */ useFormAction),\n/* harmony export */ useHref: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useHref),\n/* harmony export */ useInRouterContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useInRouterContext),\n/* harmony export */ useLinkClickHandler: () => (/* binding */ useLinkClickHandler),\n/* harmony export */ useLoaderData: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useLoaderData),\n/* harmony export */ useLocation: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useLocation),\n/* harmony export */ useMatch: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useMatch),\n/* harmony export */ useMatches: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useMatches),\n/* harmony export */ useNavigate: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useNavigate),\n/* harmony export */ useNavigation: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useNavigation),\n/* harmony export */ useNavigationType: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useNavigationType),\n/* harmony export */ useOutlet: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useOutlet),\n/* harmony export */ useOutletContext: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useOutletContext),\n/* harmony export */ useParams: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useParams),\n/* harmony export */ useResolvedPath: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useResolvedPath),\n/* harmony export */ useRevalidator: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useRevalidator),\n/* harmony export */ useRouteError: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useRouteError),\n/* harmony export */ useRouteLoaderData: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useRouteLoaderData),\n/* harmony export */ useRoutes: () => (/* reexport safe */ react_router__WEBPACK_IMPORTED_MODULE_3__.useRoutes),\n/* harmony export */ useSearchParams: () => (/* binding */ useSearchParams),\n/* harmony export */ useSubmit: () => (/* binding */ useSubmit)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-router */ \"./node_modules/react-router/dist/index.js\");\n/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @remix-run/router */ \"./node_modules/@remix-run/router/dist/router.js\");\n/**\n * React Router DOM v6.23.1\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 */\n\n\n\n\n\n\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\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 true ? (0,react_router__WEBPACK_IMPORTED_MODULE_2__.UNSAFE_warning)(false, \"\\\"\" + encType + \"\\\" is not a valid `encType` for ``/`` \" + (\"and will default to \\\"\" + defaultEncType + \"\\\"\")) : 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 ? (0,react_router__WEBPACK_IMPORTED_MODULE_2__.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