{"version":3,"file":"formik-form-components-8ffa99c5.js","sources":["../../node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js","../../node_modules/.pnpm/react@17.0.2/node_modules/react/cjs/react.production.min.js","../../node_modules/.pnpm/react@17.0.2/node_modules/react/index.js","../../node_modules/.pnpm/react@17.0.2/node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/.pnpm/react@17.0.2/node_modules/react/jsx-runtime.js","../../node_modules/.pnpm/scheduler@0.20.2/node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/.pnpm/scheduler@0.20.2/node_modules/scheduler/index.js","../../node_modules/.pnpm/react-dom@17.0.2_react@17.0.2/node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/.pnpm/react-dom@17.0.2_react@17.0.2/node_modules/react-dom/index.js","../../node_modules/.pnpm/swr@1.3.0_react@17.0.2/node_modules/swr/dist/index.mjs","../../src/lib/api-mutate-hooks.ts","../../src/lib/auth.ts","../../src/lib/fetcher.ts","../../node_modules/.pnpm/@remix-run+router@1.3.2/node_modules/@remix-run/router/dist/router.js","../../node_modules/.pnpm/react-router@6.8.1_react@17.0.2/node_modules/react-router/dist/index.js","../../node_modules/.pnpm/react-router-dom@6.8.1_react-dom@17.0.2_react@17.0.2/node_modules/react-router-dom/dist/index.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/ArrowLeftIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/ArrowRightIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/Bars3Icon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/BarsArrowUpIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/BellIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/ChevronDownIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/ChevronLeftIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/DocumentIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/ExclamationTriangleIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/FolderIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/MinusCircleIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/MoonIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/PencilIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/PlusCircleIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/PlusIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/SunIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/TrashIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/XMarkIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/24/outline/index.js","../../node_modules/.pnpm/clsx@2.0.0/node_modules/clsx/dist/clsx.mjs","../../node_modules/.pnpm/tailwind-merge@2.0.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs","../../src/lib/text-utils.ts","../../src/lib/globalStateContext.ts","../../src/components/spinners.tsx","../../node_modules/.pnpm/@fortawesome+free-solid-svg-icons@6.3.0/node_modules/@fortawesome/free-solid-svg-icons/index.mjs","../../node_modules/.pnpm/@fortawesome+fontawesome-svg-core@6.3.0/node_modules/@fortawesome/fontawesome-svg-core/index.mjs","../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js","../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js","../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js","../../node_modules/.pnpm/@fortawesome+react-fontawesome@0.2.0_@fortawesome+fontawesome-svg-core@6.3.0_react@17.0.2/node_modules/@fortawesome/react-fontawesome/index.es.js","../../node_modules/.pnpm/react-fast-compare@2.0.4/node_modules/react-fast-compare/index.js","../../node_modules/.pnpm/deepmerge@2.2.1/node_modules/deepmerge/dist/es.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getPrototype.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isPlainObject.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackClear.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackDelete.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackGet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackHas.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stackSet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Stack.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayEach.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_defineProperty.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAssignValue.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignValue.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyObject.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAssign.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeysIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeysIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keysIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAssignIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneBuffer.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayFilter.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbols.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copySymbols.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayPush.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getSymbolsIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copySymbolsIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetAllKeys.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeys.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getAllKeysIn.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_DataView.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Promise.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_WeakMap.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneArrayBuffer.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneDataView.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneRegExp.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneSymbol.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneTypedArray.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneByTag.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseCreate.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneObject.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsMap.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isMap.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsSet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSet.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClone.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/clone.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/memoize.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_memoizeCapped.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_stringToPath.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toKey.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseToString.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toString.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toPath.js","../../node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js","../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js","../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.js","../../node_modules/.pnpm/formik@2.2.9_react@17.0.2/node_modules/formik/dist/formik.esm.js","../../node_modules/.pnpm/nanoclone@0.2.1/node_modules/nanoclone/src/index.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/printValue.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/locale.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/has.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/isSchema.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/Condition.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/toArray.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/ValidationError.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/runTests.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createBaseFor.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFor.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isBuffer.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsTypedArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUnary.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nodeUtil.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isTypedArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeys.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeys.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseForOwn.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cacheHas.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalArrays.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalByTag.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetAllKeys.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayFilter.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getSymbols.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getAllKeys.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalObjects.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_DataView.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Promise.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Set.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_WeakMap.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getTag.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsMatch.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isStrictComparable.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMatchData.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_matchesStrictComparable.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatches.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyDeep.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapValues.js","../../node_modules/.pnpm/property-expr@2.0.5/node_modules/property-expr/index.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/Reference.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/createValidation.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/reach.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/ReferenceSet.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/schema.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/mixed.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/isAbsent.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/boolean.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/string.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/number.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/isodate.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/date.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castSlice.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicode.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiToArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeToArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToArray.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCaseFirst.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/upperFirst.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/capitalize.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js","../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapKeys.js","../../node_modules/.pnpm/toposort@2.0.2/node_modules/toposort/index.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/sortFields.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/util/sortByKeyOrder.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/object.js","../../node_modules/.pnpm/yup@0.32.11/node_modules/yup/es/array.js","../../src/components/buttons.tsx","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/toInteger/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/toDate/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/addMilliseconds/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultOptions/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/compareAsc/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/constants/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isDate/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isValid/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInCalendarMonths/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMilliseconds/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/roundingMethods/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfDay/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/endOfMonth/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isLastDayOfMonth/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInMonths/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/differenceInSeconds/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/subMilliseconds/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeek/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/formatters/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/format/longFormatters/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/protectedTokens/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/match/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/format/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/assign/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/cloneObject/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/formatDistance/index.js","../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/parseISO/index.js","../../src/lib/date-utils.tsx","../../src/components/message-indicators.tsx","../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js","../../node_modules/.pnpm/immer@9.0.19/node_modules/immer/dist/immer.esm.mjs","../../node_modules/.pnpm/@reduxjs+toolkit@1.9.3_react@17.0.2/node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js","../../node_modules/.pnpm/tiny-emitter@2.1.0/node_modules/tiny-emitter/index.js","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/helper/number.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/error.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/add.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/ampersand.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/divide.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/equal.mjs","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/utils/error.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/utils/common.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/text.js","../../node_modules/.pnpm/jstat@1.9.6/node_modules/jstat/dist/jstat.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/utils/criteria-eval.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/miscellaneous.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/statistical.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/information.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/math-trig.js","../../node_modules/.pnpm/bessel@1.0.2/node_modules/bessel/bessel.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/engineering.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/date-time.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/compatibility.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/database.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/logical.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/financial.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/lib/lookup-reference.js","../../node_modules/.pnpm/@handsontable+formulajs@2.0.2/node_modules/@handsontable/formulajs/index.js","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/supported-formulas.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/formula-function.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/greater-than.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/greater-than-or-equal.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/less-than.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/less-than-or-equal.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/minus.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/multiply.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/not-equal.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/operator/power.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/evaluate-by-operator/evaluate-by-operator.mjs","../../node_modules/.pnpm/hot-formula-parser@4.0.0/node_modules/hot-formula-parser/grammar-parser/grammar-parser.mjs","../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/index.js","../../node_modules/.pnpm/use-context-selector@1.4.1_react-dom@17.0.2_react@17.0.2_scheduler@0.23.0/node_modules/use-context-selector/dist/index.modern.js","../../node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/isArguments.js","../../node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/implementation.js","../../node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js","../../node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.js","../../node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.js","../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/implementation.js","../../node_modules/.pnpm/function-bind@1.1.1/node_modules/function-bind/index.js","../../node_modules/.pnpm/has@1.0.3/node_modules/has/src/index.js","../../node_modules/.pnpm/get-intrinsic@1.2.0/node_modules/get-intrinsic/index.js","../../node_modules/.pnpm/has-property-descriptors@1.0.0/node_modules/has-property-descriptors/index.js","../../node_modules/.pnpm/define-properties@1.1.4/node_modules/define-properties/index.js","../../node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/index.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/abs.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/5/Type.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/Type.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/floor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/isNaN.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/isFinite.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsIntegralNumber.js","../../node_modules/.pnpm/has-proto@1.0.1/node_modules/has-proto/index.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ArrayCreate.js","../../__vite-browser-external","../../node_modules/.pnpm/object-inspect@1.12.3/node_modules/object-inspect/index.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsPropertyKey.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/Get.js","../../node_modules/.pnpm/call-bind@1.0.2/node_modules/call-bind/callBound.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/IsArray.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsArray.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/GetIntrinsic.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/isPropertyDescriptor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/DefineOwnProperty.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/isMatchRecord.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/assertRecord.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/fromPropertyDescriptor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/FromPropertyDescriptor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsAccessorDescriptor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsDataDescriptor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/SameValue.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToBoolean.js","../../node_modules/.pnpm/is-callable@1.2.7/node_modules/is-callable/index.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsCallable.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToPropertyDescriptor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/DefinePropertyOrThrow.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsConstructor.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ArraySpeciesCreate.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/maxSafeInteger.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/Call.js","../../node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.js","../../node_modules/.pnpm/has-tostringtag@1.0.0/node_modules/has-tostringtag/shams.js","../../node_modules/.pnpm/is-regex@1.1.4/node_modules/is-regex/index.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsRegExp.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/OrdinaryGetOwnProperty.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/isPrimitive.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/IsExtensible.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/CreateDataProperty.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/CreateDataPropertyOrThrow.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/HasProperty.js","../../node_modules/.pnpm/es-to-primitive@1.2.1/node_modules/es-to-primitive/helpers/isPrimitive.js","../../node_modules/.pnpm/is-date-object@1.0.5/node_modules/is-date-object/index.js","../../node_modules/.pnpm/is-symbol@1.0.4/node_modules/is-symbol/index.js","../../node_modules/.pnpm/es-to-primitive@1.2.1/node_modules/es-to-primitive/es2015.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToPrimitive.js","../../node_modules/.pnpm/safe-regex-test@1.0.0/node_modules/safe-regex-test/index.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/StringToNumber.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToNumber.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/helpers/sign.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToIntegerOrInfinity.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToLength.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/LengthOfArrayLike.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToString.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/FlattenIntoArray.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/5/CheckObjectCoercible.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/RequireObjectCoercible.js","../../node_modules/.pnpm/es-abstract@1.21.1/node_modules/es-abstract/2022/ToObject.js","../../node_modules/.pnpm/array.prototype.flatmap@1.3.1/node_modules/array.prototype.flatmap/implementation.js","../../node_modules/.pnpm/array.prototype.flatmap@1.3.1/node_modules/array.prototype.flatmap/polyfill.js","../../node_modules/.pnpm/es-shim-unscopables@1.0.0/node_modules/es-shim-unscopables/index.js","../../node_modules/.pnpm/array.prototype.flatmap@1.3.1/node_modules/array.prototype.flatmap/shim.js","../../node_modules/.pnpm/array.prototype.flatmap@1.3.1/node_modules/array.prototype.flatmap/index.js","../../node_modules/.pnpm/react-spreadsheet@0.7.8_react-dom@17.0.2_react@17.0.2_scheduler@0.23.0/node_modules/react-spreadsheet/dist/es/index.js","../../src/components/tabbed-content.tsx","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/ArrowDownIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/ArrowLeftIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/ArrowUturnLeftIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/ArrowUturnRightIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/PlusCircleIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/TrashIcon.js","../../node_modules/.pnpm/@heroicons+react@2.0.17_react@17.0.2/node_modules/@heroicons/react/20/solid/index.js","../../src/pages/experiments/characterization-results/scatter-plots/scatter-plots-form-dataseries.tsx","../../src/pages/experiments/characterization-results/scatter-plots/scatter-plots-form-main.tsx","../../node_modules/.pnpm/@kurkle+color@0.3.2/node_modules/@kurkle/color/dist/color.esm.js","../../node_modules/.pnpm/chart.js@4.2.1/node_modules/chart.js/dist/chunks/helpers.segment.js","../../node_modules/.pnpm/chart.js@4.2.1/node_modules/chart.js/dist/chart.js","../../node_modules/.pnpm/react-chartjs-2@5.2.0_chart.js@4.2.1_react@17.0.2/node_modules/react-chartjs-2/dist/index.js","../../src/components/plotting/chartjs-viewers.tsx","../../node_modules/.pnpm/@silevis+reactgrid@4.0.4_react-dom@17.0.2_react@17.0.2/node_modules/@silevis/reactgrid/core/handleStateUpdate-aabb5225.js","../../src/components/datagrids/reactgrid-wrappers.tsx","../../src/components/formik-form-components.tsx"],"sourcesContent":["/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/** @license React v17.0.2\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=require(\"object-assign\"),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;\nif(\"function\"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w(\"react.element\");p=w(\"react.portal\");exports.Fragment=w(\"react.fragment\");exports.StrictMode=w(\"react.strict_mode\");exports.Profiler=w(\"react.profiler\");q=w(\"react.provider\");r=w(\"react.context\");t=w(\"react.forward_ref\");exports.Suspense=w(\"react.suspense\");u=w(\"react.memo\");v=w(\"react.lazy\")}var x=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction y(a){if(null===a||\"object\"!==typeof a)return null;a=x&&a[x]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}function z(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c=\nE};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1;\nfunction T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}}\nfunction V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if(\"function\"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5;\nexports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)};\nexports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}};\nexports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();\"object\"===typeof c&&null!==c?(c=c.delay,c=\"number\"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a};\nexports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/** @license React v17.0.2\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),m=require(\"object-assign\"),r=require(\"scheduler\");function y(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var D={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1)});var oa=/[\\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(oa,\npa);D[b]=new B(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1)});\nD.xlinkHref=new B(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2h||e[g]!==f[h])return\"\\n\"+e[g].replace(\" at new \",\" at \");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Na(a):\"\"}\nfunction Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na(\"Lazy\");case 13:return Na(\"Suspense\");case 19:return Na(\"SuspenseList\");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return\"\"}}\nfunction Ra(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ua:return\"Fragment\";case ta:return\"Portal\";case xa:return\"Profiler\";case wa:return\"StrictMode\";case Ba:return\"Suspense\";case Ca:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case za:return(a.displayName||\"Context\")+\".Consumer\";case ya:return(a._context.displayName||\"Context\")+\".Provider\";case Aa:var b=a.render;b=b.displayName||b.name||\"\";\nreturn a.displayName||(\"\"!==b?\"ForwardRef(\"+b+\")\":\"ForwardRef\");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"object\":case \"string\":case \"undefined\":return a;default:return\"\"}}function Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return m({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function $a(a,b){b=b.checked;null!=b&&qa(a,\"checked\",b,!1)}\nfunction ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?bb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction cb(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction bb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}function db(a){var b=\"\";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}function eb(a,b){a=m({children:void 0},b);if(b=db(b.children))a.children=b;return a}\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e=c.length))throw Error(y(93));c=c[0]}b=c}null==b&&(b=\"\");c=b}a._wrapperState={initialValue:Sa(c)}}\nfunction ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=\"\"+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=\"\"+d)}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&\"\"!==b&&null!==b&&(a.value=b)}var kb={html:\"http://www.w3.org/1999/xhtml\",mathml:\"http://www.w3.org/1998/Math/MathML\",svg:\"http://www.w3.org/2000/svg\"};\nfunction lb(a){switch(a){case \"svg\":return\"http://www.w3.org/2000/svg\";case \"math\":return\"http://www.w3.org/1998/Math/MathML\";default:return\"http://www.w3.org/1999/xhtml\"}}function mb(a,b){return null==a||\"http://www.w3.org/1999/xhtml\"===a?lb(b):\"http://www.w3.org/2000/svg\"===a&&\"foreignObject\"===b?\"http://www.w3.org/1999/xhtml\":a}\nvar nb,ob=function(a){return\"undefined\"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==kb.svg||\"innerHTML\"in a)a.innerHTML=b;else{nb=nb||document.createElement(\"div\");nb.innerHTML=\"\"+b.valueOf().toString()+\"\";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,\nfloodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a]})});function sb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(\"\"+b).trim():b+\"px\"}\nfunction tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=sb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var ub=m({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y(60));if(!(\"object\"===typeof b.dangerouslySetInnerHTML&&\"__html\"in b.dangerouslySetInnerHTML))throw Error(y(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(y(62));}}\nfunction wb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(y(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;ad?0:1<c;c++)b.push(a);return b}\nfunction $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=r.unstable_UserBlockingPriority,ed=r.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d)}finally{(Kb=f)||Mb()}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d))}\nfunction hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Ke(c)}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nvar Pe=fa&&\"documentMode\"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Af||(a.current=zf[Af],zf[Af]=null,Af--)}function I(a,b){Af++;zf[Af]=a.current;a.current=b}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;\nfunction Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H(N);H(M)}function Hf(a,b,c){if(M.current!==Cf)throw Error(y(168));I(M,b);I(N,c)}\nfunction If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y(108,Ra(b)||\"Unknown\",e));return m({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I(M,a);I(N,N.current);return!0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H(N),H(M),I(M,a)):H(N);I(N,c)}\nvar Lf=null,Mf=null,Nf=r.unstable_runWithPriority,Of=r.unstable_scheduleCallback,Pf=r.unstable_cancelCallback,Qf=r.unstable_shouldYield,Rf=r.unstable_requestPaint,Sf=r.unstable_now,Tf=r.unstable_getCurrentPriorityLevel,Uf=r.unstable_ImmediatePriority,Vf=r.unstable_UserBlockingPriority,Wf=r.unstable_NormalPriority,Xf=r.unstable_LowPriority,Yf=r.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg};\nfunction eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a)}jg()}\nfunction jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;az?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null===\nn.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q}if(z===h.length)return c(e,u),l;if(null===u){for(;zz?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&&\nu.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k=\"object\"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l=\"object\"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling);\nd=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h)}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=\nWg(f,a.mode,h);d.return=a;a=d}return g(a)}if(\"string\"===typeof f||\"number\"===typeof f)return f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if(\"undefined\"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y(152,Ra(a.type)||\"Component\"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);\nfunction dh(a){if(a===$g)throw Error(y(174));return a}function eh(a,b){I(ch,b);I(bh,a);I(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a)}H(ah);I(ah,b)}function fh(){H(ah);H(bh);H(ch)}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I(bh,a),I(ah,c))}function hh(a){bh.current===a&&(H(ah),H(bh))}var P=Bf(0);\nfunction ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var jh=null,kh=null,lh=!1;\nfunction mh(a,b){var c=nh(5,null,null,0);c.elementType=\"DELETED\";c.type=\"DELETED\";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=\"\"===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return!1;default:return!1}}\nfunction ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c)}jh=a;kh=rf(b.firstChild)}else a.flags=a.flags&-1025|2,lh=!1,jh=a}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a}\nfunction rh(a){if(a!==jh)return!1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||\"head\"!==b&&\"body\"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if(\"/$\"===c){if(0===b){kh=rf(a.nextSibling);break a}b--}else\"$\"!==c&&\"$!\"!==c&&\"$?\"!==c||b++}a=a.nextSibling}kh=null}}else kh=jh?rf(a.stateNode.nextSibling):null;return!0}\nfunction sh(){kh=jh=null;lh=!1}var th=[];function uh(){for(var a=0;af))throw Error(y(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e)}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T}\nfunction Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else{if(null===a)throw Error(y(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a}return T}function Jh(a,b){return\"function\"===typeof b?b(a):b}\nfunction Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g}d.baseQueue=e=f;c.pending=null}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else{var n={lane:l,action:k.action,eagerReducer:k.eagerReducer,\neagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l}k=k.next}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d}return[b.memoizedState,c.dispatch]}\nfunction Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f}return[f,d]}\nfunction Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y(350));}\nfunction Nh(a,b,c,d){var e=U;if(null===e)throw Error(y(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d=\ne.entanglements,h=a;0c?98:c,function(){a(!0)});gg(97\\x3c/script>\",a=a.removeChild(a.firstChild)):\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case \"dialog\":G(\"cancel\",a);G(\"close\",a);\ne=d;break;case \"iframe\":case \"object\":case \"embed\":G(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eJi&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432)}else{if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&\"hidden\"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|=\n64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g)}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&\"unstable-defer-without-hiding\"!==d.mode&&(b.flags|=4),null}throw Error(y(156,b.tag));}\nfunction Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H(N);H(M);uh();b=a.flags;if(0!==(b&64))throw Error(y(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}}\nfunction Mi(a,b){try{var c=\"\",d=b;do c+=Qa(d),d=d.return;while(d);var e=c}catch(f){e=\"\\nError generating stack: \"+f.message+\"\\n\"+f.stack}return{value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}var Oi=\"function\"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b)};return c}\nfunction Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if(\"function\"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)}}var f=a.stateNode;null!==f&&\"function\"===typeof f.componentDidCatch&&(c.callback=function(){\"function\"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:\"\"})});return c}var Ui=\"function\"===typeof WeakSet?WeakSet:Set;\nfunction Vi(a){var b=a.ref;if(null!==b)if(\"function\"===typeof b)try{b(null)}catch(c){Wi(a,c)}else b.current=null}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y(163));}\nfunction Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d()}a=a.next}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d,\nb.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}Eg(c,b,a)}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c))));\nreturn;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y(163));}\nfunction aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,\"function\"===typeof d.setProperty?d.setProperty(\"display\",\"none\",\"important\"):d.display=\"none\";else{d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty(\"display\")?e.display:null;d.style.display=sb(\"display\",e)}}else if(6===c.tag)c.stateNode.nodeValue=b?\"\":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===\na)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return}c.sibling.return=c.return;c=c.sibling}}\nfunction bj(a,b){if(Mf&&\"function\"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b)}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else{d=b;try{e()}catch(f){Wi(d,f)}}c=c.next}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(f){Wi(b,\nf)}break;case 5:Vi(b);break;case 4:cj(a,b)}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null}function ej(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return}throw Error(y(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y(161));}c.flags&16&&(pb(b,\"\"),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===\nc.child||4===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b)}\nfunction gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling}\nfunction hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling}\nfunction cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return}d=!0}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else{if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return}k.sibling.return=k.return;k=k.sibling}f?(g=e,h=c.stateNode,\n8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode)}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1)}c.sibling.return=c.return;c=c.sibling}}\nfunction ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;\"input\"===a&&\"radio\"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;ee&&(e=g);c&=~f}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>\nc?4320:1960*nj(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.\")}5!==V&&(V=2);k=Mi(k,h);p=\ng;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&(\"function\"===typeof K.getDerivedStateFromError||null!==Q&&\"function\"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return}while(null!==p)}Zj(c)}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)}\nfunction Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e)}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y)}function Rj(){for(;null!==Y&&!Qf();)bk(Y)}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null}\nfunction Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});\"function\"===typeof t.focus&&t.focus();for(t=\n0;tO()-jj?Qj(a,0):uj|=c);Mj(a,b)}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c))}var ck;\nck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else{ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I(P,P.current&1);b=hi(a,b,c);return null!==\nb?b.sibling:null}I(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if(\"object\"===\ntypeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;\"function\"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c)}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);\na=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y(306,e,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y(282));\nd=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else{e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\n\nvar noop = function () { };\n// Using noop() as the undefined value as undefined can possibly be replaced\n// by something else. Prettier ignore and extra parentheses are necessary here\n// to ensure that tsc doesn't remove the __NOINLINE__ comment.\n// prettier-ignore\nvar UNDEFINED = ( /*#__NOINLINE__*/noop());\nvar OBJECT = Object;\nvar isUndefined = function (v) { return v === UNDEFINED; };\nvar isFunction = function (v) { return typeof v == 'function'; };\nvar mergeObjects = function (a, b) { return OBJECT.assign({}, a, b); };\nvar STR_UNDEFINED = 'undefined';\n// NOTE: Use function to guarantee it's re-evaluated between jsdom and node runtime for tests.\nvar hasWindow = function () { return typeof window != STR_UNDEFINED; };\nvar hasDocument = function () { return typeof document != STR_UNDEFINED; };\nvar hasRequestAnimationFrame = function () {\n return hasWindow() && typeof window['requestAnimationFrame'] != STR_UNDEFINED;\n};\n\n// use WeakMap to store the object->key mapping\n// so the objects can be garbage collected.\n// WeakMap uses a hashtable under the hood, so the lookup\n// complexity is almost O(1).\nvar table = new WeakMap();\n// counter of the key\nvar counter = 0;\n// A stable hash implementation that supports:\n// - Fast and ensures unique hash properties\n// - Handles unserializable values\n// - Handles object key ordering\n// - Generates short results\n//\n// This is not a serialization function, and the result is not guaranteed to be\n// parsible.\nvar stableHash = function (arg) {\n var type = typeof arg;\n var constructor = arg && arg.constructor;\n var isDate = constructor == Date;\n var result;\n var index;\n if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {\n // Object/function, not null/date/regexp. Use WeakMap to store the id first.\n // If it's already hashed, directly return the result.\n result = table.get(arg);\n if (result)\n return result;\n // Store the hash first for circular reference detection before entering the\n // recursive `stableHash` calls.\n // For other objects like set and map, we use this id directly as the hash.\n result = ++counter + '~';\n table.set(arg, result);\n if (constructor == Array) {\n // Array.\n result = '@';\n for (index = 0; index < arg.length; index++) {\n result += stableHash(arg[index]) + ',';\n }\n table.set(arg, result);\n }\n if (constructor == OBJECT) {\n // Object, sort keys.\n result = '#';\n var keys = OBJECT.keys(arg).sort();\n while (!isUndefined((index = keys.pop()))) {\n if (!isUndefined(arg[index])) {\n result += index + ':' + stableHash(arg[index]) + ',';\n }\n }\n table.set(arg, result);\n }\n }\n else {\n result = isDate\n ? arg.toJSON()\n : type == 'symbol'\n ? arg.toString()\n : type == 'string'\n ? JSON.stringify(arg)\n : '' + arg;\n }\n return result;\n};\n\n/**\n * Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,\n * it's not reliable to detect if the browser is currently online or offline\n * based on `navigator.onLine`.\n * As a work around, we always assume it's online on first load, and change\n * the status upon `online` or `offline` events.\n */\nvar online = true;\nvar isOnline = function () { return online; };\nvar hasWin = hasWindow();\nvar hasDoc = hasDocument();\n// For node and React Native, `add/removeEventListener` doesn't exist on window.\nvar onWindowEvent = hasWin && window.addEventListener\n ? window.addEventListener.bind(window)\n : noop;\nvar onDocumentEvent = hasDoc ? document.addEventListener.bind(document) : noop;\nvar offWindowEvent = hasWin && window.removeEventListener\n ? window.removeEventListener.bind(window)\n : noop;\nvar offDocumentEvent = hasDoc\n ? document.removeEventListener.bind(document)\n : noop;\nvar isVisible = function () {\n var visibilityState = hasDoc && document.visibilityState;\n return isUndefined(visibilityState) || visibilityState !== 'hidden';\n};\nvar initFocus = function (callback) {\n // focus revalidate\n onDocumentEvent('visibilitychange', callback);\n onWindowEvent('focus', callback);\n return function () {\n offDocumentEvent('visibilitychange', callback);\n offWindowEvent('focus', callback);\n };\n};\nvar initReconnect = function (callback) {\n // revalidate on reconnected\n var onOnline = function () {\n online = true;\n callback();\n };\n // nothing to revalidate, just update the status\n var onOffline = function () {\n online = false;\n };\n onWindowEvent('online', onOnline);\n onWindowEvent('offline', onOffline);\n return function () {\n offWindowEvent('online', onOnline);\n offWindowEvent('offline', onOffline);\n };\n};\nvar preset = {\n isOnline: isOnline,\n isVisible: isVisible\n};\nvar defaultConfigOptions = {\n initFocus: initFocus,\n initReconnect: initReconnect\n};\n\nvar IS_SERVER = !hasWindow() || 'Deno' in window;\n// Polyfill requestAnimationFrame\nvar rAF = function (f) {\n return hasRequestAnimationFrame() ? window['requestAnimationFrame'](f) : setTimeout(f, 1);\n};\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\nvar useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;\n// This assignment is to extend the Navigator type to use effectiveType.\nvar navigatorConnection = typeof navigator !== 'undefined' &&\n navigator.connection;\n// Adjust the config based on slow connection status (<= 70Kbps).\nvar slowConnection = !IS_SERVER &&\n navigatorConnection &&\n (['slow-2g', '2g'].includes(navigatorConnection.effectiveType) ||\n navigatorConnection.saveData);\n\nvar serialize = function (key) {\n if (isFunction(key)) {\n try {\n key = key();\n }\n catch (err) {\n // dependencies not ready\n key = '';\n }\n }\n var args = [].concat(key);\n // If key is not falsy, or not an empty array, hash it.\n key =\n typeof key == 'string'\n ? key\n : (Array.isArray(key) ? key.length : key)\n ? stableHash(key)\n : '';\n var infoKey = key ? '$swr$' + key : '';\n return [key, args, infoKey];\n};\n\n// Global state used to deduplicate requests and store listeners\nvar SWRGlobalState = new WeakMap();\n\nvar FOCUS_EVENT = 0;\nvar RECONNECT_EVENT = 1;\nvar MUTATE_EVENT = 2;\n\nvar broadcastState = function (cache, key, data, error, isValidating, revalidate, broadcast) {\n if (broadcast === void 0) { broadcast = true; }\n var _a = SWRGlobalState.get(cache), EVENT_REVALIDATORS = _a[0], STATE_UPDATERS = _a[1], FETCH = _a[3];\n var revalidators = EVENT_REVALIDATORS[key];\n var updaters = STATE_UPDATERS[key];\n // Cache was populated, update states of all hooks.\n if (broadcast && updaters) {\n for (var i = 0; i < updaters.length; ++i) {\n updaters[i](data, error, isValidating);\n }\n }\n // If we also need to revalidate, only do it for the first hook.\n if (revalidate) {\n // Invalidate the key by deleting the concurrent request markers so new\n // requests will not be deduped.\n delete FETCH[key];\n if (revalidators && revalidators[0]) {\n return revalidators[0](MUTATE_EVENT).then(function () {\n return cache.get(key);\n });\n }\n }\n return cache.get(key);\n};\n\n// Global timestamp.\nvar __timestamp = 0;\nvar getTimestamp = function () { return ++__timestamp; };\n\nvar internalMutate = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(void 0, void 0, void 0, function () {\n var cache, _key, _data, _opts, options, populateCache, revalidate, rollbackOnError, customOptimisticData, _a, key, keyInfo, _b, MUTATION, data, error, beforeMutationTs, hasCustomOptimisticData, rollbackData, optimisticData, res;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n cache = args[0], _key = args[1], _data = args[2], _opts = args[3];\n options = typeof _opts === 'boolean' ? { revalidate: _opts } : _opts || {};\n populateCache = isUndefined(options.populateCache)\n ? true\n : options.populateCache;\n revalidate = options.revalidate !== false;\n rollbackOnError = options.rollbackOnError !== false;\n customOptimisticData = options.optimisticData;\n _a = serialize(_key), key = _a[0], keyInfo = _a[2];\n if (!key)\n return [2 /*return*/];\n _b = SWRGlobalState.get(cache), MUTATION = _b[2];\n // If there is no new data provided, revalidate the key with current state.\n if (args.length < 3) {\n // Revalidate and broadcast state.\n return [2 /*return*/, broadcastState(cache, key, cache.get(key), UNDEFINED, UNDEFINED, revalidate, true)];\n }\n data = _data;\n beforeMutationTs = getTimestamp();\n MUTATION[key] = [beforeMutationTs, 0];\n hasCustomOptimisticData = !isUndefined(customOptimisticData);\n rollbackData = cache.get(key);\n // Do optimistic data update.\n if (hasCustomOptimisticData) {\n optimisticData = isFunction(customOptimisticData)\n ? customOptimisticData(rollbackData)\n : customOptimisticData;\n cache.set(key, optimisticData);\n broadcastState(cache, key, optimisticData);\n }\n if (isFunction(data)) {\n // `data` is a function, call it passing current cache value.\n try {\n data = data(cache.get(key));\n }\n catch (err) {\n // If it throws an error synchronously, we shouldn't update the cache.\n error = err;\n }\n }\n if (!(data && isFunction(data.then))) return [3 /*break*/, 2];\n return [4 /*yield*/, data.catch(function (err) {\n error = err;\n })\n // Check if other mutations have occurred since we've started this mutation.\n // If there's a race we don't update cache or broadcast the change,\n // just return the data.\n ];\n case 1:\n // This means that the mutation is async, we need to check timestamps to\n // avoid race conditions.\n data = _c.sent();\n // Check if other mutations have occurred since we've started this mutation.\n // If there's a race we don't update cache or broadcast the change,\n // just return the data.\n if (beforeMutationTs !== MUTATION[key][0]) {\n if (error)\n throw error;\n return [2 /*return*/, data];\n }\n else if (error && hasCustomOptimisticData && rollbackOnError) {\n // Rollback. Always populate the cache in this case but without\n // transforming the data.\n populateCache = true;\n data = rollbackData;\n cache.set(key, rollbackData);\n }\n _c.label = 2;\n case 2:\n // If we should write back the cache after request.\n if (populateCache) {\n if (!error) {\n // Transform the result into data.\n if (isFunction(populateCache)) {\n data = populateCache(data, rollbackData);\n }\n // Only update cached data if there's no error. Data can be `undefined` here.\n cache.set(key, data);\n }\n // Always update or reset the error.\n cache.set(keyInfo, mergeObjects(cache.get(keyInfo), { error: error }));\n }\n // Reset the timestamp to mark the mutation has ended.\n MUTATION[key][1] = getTimestamp();\n return [4 /*yield*/, broadcastState(cache, key, data, error, UNDEFINED, revalidate, !!populateCache)\n // Throw error or return data\n ];\n case 3:\n res = _c.sent();\n // Throw error or return data\n if (error)\n throw error;\n return [2 /*return*/, populateCache ? res : data];\n }\n });\n });\n};\n\nvar revalidateAllKeys = function (revalidators, type) {\n for (var key in revalidators) {\n if (revalidators[key][0])\n revalidators[key][0](type);\n }\n};\nvar initCache = function (provider, options) {\n // The global state for a specific provider will be used to deduplicate\n // requests and store listeners. As well as a mutate function that bound to\n // the cache.\n // Provider's global state might be already initialized. Let's try to get the\n // global state associated with the provider first.\n if (!SWRGlobalState.has(provider)) {\n var opts = mergeObjects(defaultConfigOptions, options);\n // If there's no global state bound to the provider, create a new one with the\n // new mutate function.\n var EVENT_REVALIDATORS = {};\n var mutate = internalMutate.bind(UNDEFINED, provider);\n var unmount = noop;\n // Update the state if it's new, or the provider has been extended.\n SWRGlobalState.set(provider, [EVENT_REVALIDATORS, {}, {}, {}, mutate]);\n // This is a new provider, we need to initialize it and setup DOM events\n // listeners for `focus` and `reconnect` actions.\n if (!IS_SERVER) {\n // When listening to the native events for auto revalidations,\n // we intentionally put a delay (setTimeout) here to make sure they are\n // fired after immediate JavaScript executions, which can possibly be\n // React's state updates.\n // This avoids some unnecessary revalidations such as\n // https://github.com/vercel/swr/issues/1680.\n var releaseFocus_1 = opts.initFocus(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT)));\n var releaseReconnect_1 = opts.initReconnect(setTimeout.bind(UNDEFINED, revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT)));\n unmount = function () {\n releaseFocus_1 && releaseFocus_1();\n releaseReconnect_1 && releaseReconnect_1();\n // When un-mounting, we need to remove the cache provider from the state\n // storage too because it's a side-effect. Otherwise when re-mounting we\n // will not re-register those event listeners.\n SWRGlobalState.delete(provider);\n };\n }\n // We might want to inject an extra layer on top of `provider` in the future,\n // such as key serialization, auto GC, etc.\n // For now, it's just a `Map` interface without any modifications.\n return [provider, mutate, unmount];\n }\n return [provider, SWRGlobalState.get(provider)[4]];\n};\n\n// error retry\nvar onErrorRetry = function (_, __, config, revalidate, opts) {\n var maxRetryCount = config.errorRetryCount;\n var currentRetryCount = opts.retryCount;\n // Exponential backoff\n var timeout = ~~((Math.random() + 0.5) *\n (1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;\n if (!isUndefined(maxRetryCount) && currentRetryCount > maxRetryCount) {\n return;\n }\n setTimeout(revalidate, timeout, opts);\n};\n// Default cache provider\nvar _a = initCache(new Map()), cache = _a[0], mutate = _a[1];\n// Default config\nvar defaultConfig = mergeObjects({\n // events\n onLoadingSlow: noop,\n onSuccess: noop,\n onError: noop,\n onErrorRetry: onErrorRetry,\n onDiscarded: noop,\n // switches\n revalidateOnFocus: true,\n revalidateOnReconnect: true,\n revalidateIfStale: true,\n shouldRetryOnError: true,\n // timeouts\n errorRetryInterval: slowConnection ? 10000 : 5000,\n focusThrottleInterval: 5 * 1000,\n dedupingInterval: 2 * 1000,\n loadingTimeout: slowConnection ? 5000 : 3000,\n // providers\n compare: function (currentData, newData) {\n return stableHash(currentData) == stableHash(newData);\n },\n isPaused: function () { return false; },\n cache: cache,\n mutate: mutate,\n fallback: {}\n}, \n// use web preset by default\npreset);\n\nvar mergeConfigs = function (a, b) {\n // Need to create a new object to avoid mutating the original here.\n var v = mergeObjects(a, b);\n // If two configs are provided, merge their `use` and `fallback` options.\n if (b) {\n var u1 = a.use, f1 = a.fallback;\n var u2 = b.use, f2 = b.fallback;\n if (u1 && u2) {\n v.use = u1.concat(u2);\n }\n if (f1 && f2) {\n v.fallback = mergeObjects(f1, f2);\n }\n }\n return v;\n};\n\nvar SWRConfigContext = createContext({});\nvar SWRConfig$1 = function (props) {\n var value = props.value;\n // Extend parent context values and middleware.\n var extendedConfig = mergeConfigs(useContext(SWRConfigContext), value);\n // Should not use the inherited provider.\n var provider = value && value.provider;\n // Use a lazy initialized state to create the cache on first access.\n var cacheContext = useState(function () {\n return provider\n ? initCache(provider(extendedConfig.cache || cache), value)\n : UNDEFINED;\n })[0];\n // Override the cache if a new provider is given.\n if (cacheContext) {\n extendedConfig.cache = cacheContext[0];\n extendedConfig.mutate = cacheContext[1];\n }\n // Unsubscribe events.\n useIsomorphicLayoutEffect(function () { return (cacheContext ? cacheContext[2] : UNDEFINED); }, []);\n return createElement(SWRConfigContext.Provider, mergeObjects(props, {\n value: extendedConfig\n }));\n};\n\n/**\n * An implementation of state with dependency-tracking.\n */\nvar useStateWithDeps = function (state, unmountedRef) {\n var rerender = useState({})[1];\n var stateRef = useRef(state);\n // If a state property (data, error or isValidating) is accessed by the render\n // function, we mark the property as a dependency so if it is updated again\n // in the future, we trigger a rerender.\n // This is also known as dependency-tracking.\n var stateDependenciesRef = useRef({\n data: false,\n error: false,\n isValidating: false\n });\n /**\n * @param payload To change stateRef, pass the values explicitly to setState:\n * @example\n * ```js\n * setState({\n * isValidating: false\n * data: newData // set data to newData\n * error: undefined // set error to undefined\n * })\n *\n * setState({\n * isValidating: false\n * data: undefined // set data to undefined\n * error: err // set error to err\n * })\n * ```\n */\n var setState = useCallback(function (payload) {\n var shouldRerender = false;\n var currentState = stateRef.current;\n for (var _ in payload) {\n var k = _;\n // If the property has changed, update the state and mark rerender as\n // needed.\n if (currentState[k] !== payload[k]) {\n currentState[k] = payload[k];\n // If the property is accessed by the component, a rerender should be\n // triggered.\n if (stateDependenciesRef.current[k]) {\n shouldRerender = true;\n }\n }\n }\n if (shouldRerender && !unmountedRef.current) {\n rerender({});\n }\n }, \n // config.suspense isn't allowed to change during the lifecycle\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n // Always update the state reference.\n useIsomorphicLayoutEffect(function () {\n stateRef.current = state;\n });\n return [stateRef, stateDependenciesRef.current, setState];\n};\n\nvar normalize = function (args) {\n return isFunction(args[1])\n ? [args[0], args[1], args[2] || {}]\n : [args[0], null, (args[1] === null ? args[2] : args[1]) || {}];\n};\n\nvar useSWRConfig = function () {\n return mergeObjects(defaultConfig, useContext(SWRConfigContext));\n};\n\n// It's tricky to pass generic types as parameters, so we just directly override\n// the types here.\nvar withArgs = function (hook) {\n return function useSWRArgs() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // Get the default and inherited configuration.\n var fallbackConfig = useSWRConfig();\n // Normalize arguments.\n var _a = normalize(args), key = _a[0], fn = _a[1], _config = _a[2];\n // Merge configurations.\n var config = mergeConfigs(fallbackConfig, _config);\n // Apply middleware\n var next = hook;\n var use = config.use;\n if (use) {\n for (var i = use.length; i-- > 0;) {\n next = use[i](next);\n }\n }\n return next(key, fn || config.fetcher, config);\n };\n};\n\n// Add a callback function to a list of keyed callback functions and return\n// the unsubscribe function.\nvar subscribeCallback = function (key, callbacks, callback) {\n var keyedRevalidators = callbacks[key] || (callbacks[key] = []);\n keyedRevalidators.push(callback);\n return function () {\n var index = keyedRevalidators.indexOf(callback);\n if (index >= 0) {\n // O(1): faster than splice\n keyedRevalidators[index] = keyedRevalidators[keyedRevalidators.length - 1];\n keyedRevalidators.pop();\n }\n };\n};\n\nvar WITH_DEDUPE = { dedupe: true };\nvar useSWRHandler = function (_key, fetcher, config) {\n var cache = config.cache, compare = config.compare, fallbackData = config.fallbackData, suspense = config.suspense, revalidateOnMount = config.revalidateOnMount, refreshInterval = config.refreshInterval, refreshWhenHidden = config.refreshWhenHidden, refreshWhenOffline = config.refreshWhenOffline;\n var _a = SWRGlobalState.get(cache), EVENT_REVALIDATORS = _a[0], STATE_UPDATERS = _a[1], MUTATION = _a[2], FETCH = _a[3];\n // `key` is the identifier of the SWR `data` state, `keyInfo` holds extra\n // states such as `error` and `isValidating` inside,\n // all of them are derived from `_key`.\n // `fnArgs` is an array of arguments parsed from the key, which will be passed\n // to the fetcher.\n var _b = serialize(_key), key = _b[0], fnArgs = _b[1], keyInfo = _b[2];\n // If it's the initial render of this hook.\n var initialMountedRef = useRef(false);\n // If the hook is unmounted already. This will be used to prevent some effects\n // to be called after unmounting.\n var unmountedRef = useRef(false);\n // Refs to keep the key and config.\n var keyRef = useRef(key);\n var fetcherRef = useRef(fetcher);\n var configRef = useRef(config);\n var getConfig = function () { return configRef.current; };\n var isActive = function () { return getConfig().isVisible() && getConfig().isOnline(); };\n var patchFetchInfo = function (info) {\n return cache.set(keyInfo, mergeObjects(cache.get(keyInfo), info));\n };\n // Get the current state that SWR should return.\n var cached = cache.get(key);\n var fallback = isUndefined(fallbackData)\n ? config.fallback[key]\n : fallbackData;\n var data = isUndefined(cached) ? fallback : cached;\n var info = cache.get(keyInfo) || {};\n var error = info.error;\n var isInitialMount = !initialMountedRef.current;\n // - Suspense mode and there's stale data for the initial render.\n // - Not suspense mode and there is no fallback data and `revalidateIfStale` is enabled.\n // - `revalidateIfStale` is enabled but `data` is not defined.\n var shouldRevalidate = function () {\n // If `revalidateOnMount` is set, we take the value directly.\n if (isInitialMount && !isUndefined(revalidateOnMount))\n return revalidateOnMount;\n // If it's paused, we skip revalidation.\n if (getConfig().isPaused())\n return false;\n // Under suspense mode, it will always fetch on render if there is no\n // stale data so no need to revalidate immediately on mount again.\n // If data exists, only revalidate if `revalidateIfStale` is true.\n if (suspense)\n return isUndefined(data) ? false : config.revalidateIfStale;\n // If there is no stale data, we need to revalidate on mount;\n // If `revalidateIfStale` is set to true, we will always revalidate.\n return isUndefined(data) || config.revalidateIfStale;\n };\n // Resolve the current validating state.\n var resolveValidating = function () {\n if (!key || !fetcher)\n return false;\n if (info.isValidating)\n return true;\n // If it's not mounted yet and it should revalidate on mount, revalidate.\n return isInitialMount && shouldRevalidate();\n };\n var isValidating = resolveValidating();\n var _c = useStateWithDeps({\n data: data,\n error: error,\n isValidating: isValidating\n }, unmountedRef), stateRef = _c[0], stateDependencies = _c[1], setState = _c[2];\n // The revalidation function is a carefully crafted wrapper of the original\n // `fetcher`, to correctly handle the many edge cases.\n var revalidate = useCallback(function (revalidateOpts) { return __awaiter(void 0, void 0, void 0, function () {\n var currentFetcher, newData, startAt, loading, opts, shouldStartNewRequest, isCurrentKeyMounted, cleanupState, newState, finishRequestAndUpdateState, mutationInfo, err_1;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n currentFetcher = fetcherRef.current;\n if (!key ||\n !currentFetcher ||\n unmountedRef.current ||\n getConfig().isPaused()) {\n return [2 /*return*/, false];\n }\n loading = true;\n opts = revalidateOpts || {};\n shouldStartNewRequest = !FETCH[key] || !opts.dedupe;\n isCurrentKeyMounted = function () {\n return !unmountedRef.current &&\n key === keyRef.current &&\n initialMountedRef.current;\n };\n cleanupState = function () {\n // Check if it's still the same request before deleting.\n var requestInfo = FETCH[key];\n if (requestInfo && requestInfo[1] === startAt) {\n delete FETCH[key];\n }\n };\n newState = { isValidating: false };\n finishRequestAndUpdateState = function () {\n patchFetchInfo({ isValidating: false });\n // We can only set state if it's safe (still mounted with the same key).\n if (isCurrentKeyMounted()) {\n setState(newState);\n }\n };\n // Start fetching. Change the `isValidating` state, update the cache.\n patchFetchInfo({\n isValidating: true\n });\n setState({ isValidating: true });\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n if (shouldStartNewRequest) {\n // Tell all other hooks to change the `isValidating` state.\n broadcastState(cache, key, stateRef.current.data, stateRef.current.error, true);\n // If no cache being rendered currently (it shows a blank page),\n // we trigger the loading slow event.\n if (config.loadingTimeout && !cache.get(key)) {\n setTimeout(function () {\n if (loading && isCurrentKeyMounted()) {\n getConfig().onLoadingSlow(key, config);\n }\n }, config.loadingTimeout);\n }\n // Start the request and save the timestamp.\n FETCH[key] = [currentFetcher.apply(void 0, fnArgs), getTimestamp()];\n }\n _a = FETCH[key], newData = _a[0], startAt = _a[1];\n return [4 /*yield*/, newData];\n case 2:\n newData = _b.sent();\n if (shouldStartNewRequest) {\n // If the request isn't interrupted, clean it up after the\n // deduplication interval.\n setTimeout(cleanupState, config.dedupingInterval);\n }\n // If there're other ongoing request(s), started after the current one,\n // we need to ignore the current one to avoid possible race conditions:\n // req1------------------>res1 (current one)\n // req2---------------->res2\n // the request that fired later will always be kept.\n // The timestamp maybe be `undefined` or a number\n if (!FETCH[key] || FETCH[key][1] !== startAt) {\n if (shouldStartNewRequest) {\n if (isCurrentKeyMounted()) {\n getConfig().onDiscarded(key);\n }\n }\n return [2 /*return*/, false];\n }\n // Clear error.\n patchFetchInfo({\n error: UNDEFINED\n });\n newState.error = UNDEFINED;\n mutationInfo = MUTATION[key];\n if (!isUndefined(mutationInfo) &&\n // case 1\n (startAt <= mutationInfo[0] ||\n // case 2\n startAt <= mutationInfo[1] ||\n // case 3\n mutationInfo[1] === 0)) {\n finishRequestAndUpdateState();\n if (shouldStartNewRequest) {\n if (isCurrentKeyMounted()) {\n getConfig().onDiscarded(key);\n }\n }\n return [2 /*return*/, false];\n }\n // Deep compare with latest state to avoid extra re-renders.\n // For local state, compare and assign.\n if (!compare(stateRef.current.data, newData)) {\n newState.data = newData;\n }\n else {\n // data and newData are deeply equal\n // it should be safe to broadcast the stale data\n newState.data = stateRef.current.data;\n // At the end of this function, `brocastState` invokes the `onStateUpdate` function,\n // which takes care of avoiding the re-render\n }\n // For global state, it's possible that the key has changed.\n // https://github.com/vercel/swr/pull/1058\n if (!compare(cache.get(key), newData)) {\n cache.set(key, newData);\n }\n // Trigger the successful callback if it's the original request.\n if (shouldStartNewRequest) {\n if (isCurrentKeyMounted()) {\n getConfig().onSuccess(newData, key, config);\n }\n }\n return [3 /*break*/, 4];\n case 3:\n err_1 = _b.sent();\n cleanupState();\n // Not paused, we continue handling the error. Otherwise discard it.\n if (!getConfig().isPaused()) {\n // Get a new error, don't use deep comparison for errors.\n patchFetchInfo({ error: err_1 });\n newState.error = err_1;\n // Error event and retry logic. Only for the actual request, not\n // deduped ones.\n if (shouldStartNewRequest && isCurrentKeyMounted()) {\n getConfig().onError(err_1, key, config);\n if ((typeof config.shouldRetryOnError === 'boolean' &&\n config.shouldRetryOnError) ||\n (isFunction(config.shouldRetryOnError) &&\n config.shouldRetryOnError(err_1))) {\n // When retrying, dedupe is always enabled\n if (isActive()) {\n // If it's active, stop. It will auto revalidate when refocusing\n // or reconnecting.\n getConfig().onErrorRetry(err_1, key, config, revalidate, {\n retryCount: (opts.retryCount || 0) + 1,\n dedupe: true\n });\n }\n }\n }\n }\n return [3 /*break*/, 4];\n case 4:\n // Mark loading as stopped.\n loading = false;\n // Update the current hook's state.\n finishRequestAndUpdateState();\n // Here is the source of the request, need to tell all other hooks to\n // update their states.\n if (isCurrentKeyMounted() && shouldStartNewRequest) {\n broadcastState(cache, key, newState.data, newState.error, false);\n }\n return [2 /*return*/, true];\n }\n });\n }); }, \n // `setState` is immutable, and `eventsCallback`, `fnArgs`, `keyInfo`,\n // and `keyValidating` are depending on `key`, so we can exclude them from\n // the deps array.\n //\n // FIXME:\n // `fn` and `config` might be changed during the lifecycle,\n // but they might be changed every render like this.\n // `useSWR('key', () => fetch('/api/'), { suspense: true })`\n // So we omit the values from the deps array\n // even though it might cause unexpected behaviors.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [key]);\n // Similar to the global mutate, but bound to the current cache and key.\n // `cache` isn't allowed to change during the lifecycle.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n var boundMutate = useCallback(\n // By using `bind` we don't need to modify the size of the rest arguments.\n // Due to https://github.com/microsoft/TypeScript/issues/37181, we have to\n // cast it to any for now.\n internalMutate.bind(UNDEFINED, cache, function () { return keyRef.current; }), \n // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n // Always update fetcher and config refs.\n useIsomorphicLayoutEffect(function () {\n fetcherRef.current = fetcher;\n configRef.current = config;\n });\n // After mounted or key changed.\n useIsomorphicLayoutEffect(function () {\n if (!key)\n return;\n var keyChanged = key !== keyRef.current;\n var softRevalidate = revalidate.bind(UNDEFINED, WITH_DEDUPE);\n // Expose state updater to global event listeners. So we can update hook's\n // internal state from the outside.\n var onStateUpdate = function (updatedData, updatedError, updatedIsValidating) {\n setState(mergeObjects({\n error: updatedError,\n isValidating: updatedIsValidating\n }, \n // Since `setState` only shallowly compares states, we do a deep\n // comparison here.\n compare(stateRef.current.data, updatedData)\n ? UNDEFINED\n : {\n data: updatedData\n }));\n };\n // Expose revalidators to global event listeners. So we can trigger\n // revalidation from the outside.\n var nextFocusRevalidatedAt = 0;\n var onRevalidate = function (type) {\n if (type == FOCUS_EVENT) {\n var now = Date.now();\n if (getConfig().revalidateOnFocus &&\n now > nextFocusRevalidatedAt &&\n isActive()) {\n nextFocusRevalidatedAt = now + getConfig().focusThrottleInterval;\n softRevalidate();\n }\n }\n else if (type == RECONNECT_EVENT) {\n if (getConfig().revalidateOnReconnect && isActive()) {\n softRevalidate();\n }\n }\n else if (type == MUTATE_EVENT) {\n return revalidate();\n }\n return;\n };\n var unsubUpdate = subscribeCallback(key, STATE_UPDATERS, onStateUpdate);\n var unsubEvents = subscribeCallback(key, EVENT_REVALIDATORS, onRevalidate);\n // Mark the component as mounted and update corresponding refs.\n unmountedRef.current = false;\n keyRef.current = key;\n initialMountedRef.current = true;\n // When `key` updates, reset the state to the initial value\n // and trigger a rerender if necessary.\n if (keyChanged) {\n setState({\n data: data,\n error: error,\n isValidating: isValidating\n });\n }\n // Trigger a revalidation.\n if (shouldRevalidate()) {\n if (isUndefined(data) || IS_SERVER) {\n // Revalidate immediately.\n softRevalidate();\n }\n else {\n // Delay the revalidate if we have data to return so we won't block\n // rendering.\n rAF(softRevalidate);\n }\n }\n return function () {\n // Mark it as unmounted.\n unmountedRef.current = true;\n unsubUpdate();\n unsubEvents();\n };\n }, [key, revalidate]);\n // Polling\n useIsomorphicLayoutEffect(function () {\n var timer;\n function next() {\n // Use the passed interval\n // ...or invoke the function with the updated data to get the interval\n var interval = isFunction(refreshInterval)\n ? refreshInterval(data)\n : refreshInterval;\n // We only start next interval if `refreshInterval` is not 0, and:\n // - `force` is true, which is the start of polling\n // - or `timer` is not 0, which means the effect wasn't canceled\n if (interval && timer !== -1) {\n timer = setTimeout(execute, interval);\n }\n }\n function execute() {\n // Check if it's OK to execute:\n // Only revalidate when the page is visible, online and not errored.\n if (!stateRef.current.error &&\n (refreshWhenHidden || getConfig().isVisible()) &&\n (refreshWhenOffline || getConfig().isOnline())) {\n revalidate(WITH_DEDUPE).then(next);\n }\n else {\n // Schedule next interval to check again.\n next();\n }\n }\n next();\n return function () {\n if (timer) {\n clearTimeout(timer);\n timer = -1;\n }\n };\n }, [refreshInterval, refreshWhenHidden, refreshWhenOffline, revalidate]);\n // Display debug info in React DevTools.\n useDebugValue(data);\n // In Suspense mode, we can't return the empty `data` state.\n // If there is `error`, the `error` needs to be thrown to the error boundary.\n // If there is no `error`, the `revalidation` promise needs to be thrown to\n // the suspense boundary.\n if (suspense && isUndefined(data) && key) {\n // Always update fetcher and config refs even with the Suspense mode.\n fetcherRef.current = fetcher;\n configRef.current = config;\n unmountedRef.current = false;\n throw isUndefined(error) ? revalidate(WITH_DEDUPE) : error;\n }\n return {\n mutate: boundMutate,\n get data() {\n stateDependencies.data = true;\n return data;\n },\n get error() {\n stateDependencies.error = true;\n return error;\n },\n get isValidating() {\n stateDependencies.isValidating = true;\n return isValidating;\n }\n };\n};\nvar SWRConfig = OBJECT.defineProperty(SWRConfig$1, 'default', {\n value: defaultConfig\n});\nvar unstable_serialize = function (key) { return serialize(key)[0]; };\nvar useSWR = withArgs(useSWRHandler);\n\n// useSWR\n\nexport { SWRConfig, useSWR as default, mutate, unstable_serialize, useSWRConfig };\n","// Hooks that are higher-order wrappers around the Fetch API for mutating specific API resources\n\nimport { useCallback } from \"react\";\nimport useSWR from \"swr\";\nimport { fetcherPatch } from \"./fetcher\";\n\n// Idea is that we want to have read access to data via SWR as well as a simple\n// API for patching (updating), creating, or deleting model instances.\n\n// Define available endpoints\nexport type TResourceName =\n | \"users\"\n | \"user_metadata\"\n | \"simple_experiment_dumps\"\n | \"simple_experiment_dump_detail\"\n | \"groups\"\n | \"group_metadatas\"\n | \"institutions\"\n | \"unregistered_authors\"\n | \"publications\"\n | \"publications_choicelist\"\n | \"projects\"\n | \"projects_choicelist\"\n | \"experiments\"\n | \"experiments_choicelist\"\n | \"materials\"\n | \"datafiles\"\n | \"procedures\"\n | \"procedures_simple\"\n | \"proceduresteps\"\n | \"proceduresteptypes\"\n | \"proceduregraphedges\"\n | \"analyses\"\n | \"characterization_results\"\n | \"characterization_types\"\n | \"scatter_plots\"\n | \"scatter_plot_data_series\";\n\n// Also associate each resource name with a certain Typescript type defined in\n// models.d.ts.\nexport const resourceToTSType = {\n users: \"IUser\",\n user_metadata: \"IUserMetadata\",\n simple_experiment_dumps: \"\",\n simple_experiment_dump_detail: \"\",\n groups: \"IGroup\",\n group_metadatas: \"IGroupMetadata\",\n institutions: \"IInstitution\",\n unregistered_authors: \"IUnregisteredAuthor\",\n publications: \"IPublication\",\n publications_choicelist: \"IPublicationChoicelistChoice\",\n projects: \"IProject\",\n projects_choicelist: \"IProjectChoicelistChoice\",\n experiments: \"IExperiment\",\n experiments_choicelist: \"IExperimentChoicelistChoice\",\n materials: \"IMaterial\",\n datafiles: \"IDataFile\",\n procedures: \"IProcedure\",\n procedures_simple: \"IProcedureSimple\",\n proceduresteps: \"IProcedureStep\",\n proceduresteptypes: \"IProcedureStepType\",\n proceduregraphedges: \"IProcedureGraphEdge\",\n analyses: \"IAnalysis\",\n characterization_results: \"ICharacterizationResult\",\n characterization_types: \"ICharacterizationType\",\n scatter_plots: \"IScatterPlot\",\n scatter_plot_data_series: \"IScatterPlotDataSeries\",\n};\n\ninterface IGetUrl {\n endpointUrl: TResourceName;\n pk?: number;\n actionStr?: string;\n queryParams?: Record;\n}\nexport const getUrl: ({ endpointUrl, pk, actionStr }: IGetUrl) => string = ({\n endpointUrl,\n pk = undefined,\n actionStr = undefined,\n queryParams = undefined,\n}) => {\n var resultStr = `${import.meta.env.VITE_API_URL}/api/v1/${endpointUrl}/`;\n if (pk) {\n resultStr = resultStr.concat(pk.toString(), \"/\");\n }\n if (actionStr) {\n resultStr = resultStr.concat(actionStr.toString(), \"/\");\n }\n\n // Don't add trailing \"?\" and params unless they are defined and non-empty.\n if (queryParams && Object.keys(queryParams).length !== 0) {\n resultStr = resultStr + \"?\" + new URLSearchParams(queryParams);\n }\n return resultStr;\n};\n\n// Generic types for the fetcherPatch wrapper handler\ninterface IHandleCreateModelInstance extends IGetUrl {\n id?: never;\n operation: \"create\";\n body: Partial>;\n}\ninterface IHandleUpdateModelInstance extends IGetUrl {\n id: number;\n operation: \"update\";\n body: Partial;\n}\ninterface IHandleDestroyModelInstance extends IGetUrl {\n id: number;\n operation: \"destroy\";\n body?: never;\n}\n\ntype THandleSubmitChangeModelInstance =\n | IHandleCreateModelInstance\n | IHandleUpdateModelInstance\n | IHandleDestroyModelInstance;\n\nexport type THandleSubmitChangeModelInstanceResult =\n // Success state: API returns created/updated object of type T\n | T\n // ...or will return just some detail about what might have gone right/wrong.\n | {\n detail?: string;\n }\n // ...or will have field and non-field errors to display\n | { [Property in keyof T]: string[] };\n\nconst handleUpdateModelInstance: (\n props: THandleSubmitChangeModelInstance\n) => Promise | undefined> = async <\n T\n>({\n endpointUrl,\n operation,\n actionStr,\n id,\n body,\n}: THandleSubmitChangeModelInstance) => {\n var result;\n var targetUrl;\n if (operation === \"create\") {\n targetUrl = getUrl({ endpointUrl, actionStr });\n result = await fetcherPatch>(\n targetUrl,\n body,\n \"POST\"\n );\n return result;\n } else if ([\"update\", \"destroy\"].includes(operation)) {\n targetUrl = getUrl({ endpointUrl, pk: id, actionStr });\n\n if (operation === \"destroy\") {\n result = await fetcherPatch>(\n targetUrl,\n {},\n \"DELETE\"\n );\n } else {\n result = await fetcherPatch>(\n targetUrl,\n body,\n \"PATCH\"\n );\n }\n\n return result;\n }\n};\n\n// Now want some hooks: one for a single model instance and one for a list of\n// model instance (like ListView and DetailView in DRF).\ninterface IUseApiModelDetailView {\n // The object type for which we're requesting data, corresponding to one of\n // the main MASC API endpoints representing resources like \"user\",\n // \"experiments\", \"projects\", etc.\n resourceName: TResourceName;\n\n // The primary key ID of the single object we're getting.\n id?: number;\n\n // Automatically run the SWR bound mutate() on this object after creating,\n // updating, or destroying this object?\n mutateAfterChange?: boolean;\n\n // Unlikely that we won't want to get data for a read operation, but\n // leaving the switch here for more flexibility.\n shouldGetData?: boolean;\n\n // Explicit list of fields to retrieve in each record, to be passed as a\n // query param for DRF flexfields.\n fields?: (keyof T)[];\n\n // Explicit list of fields to omit from each record, to be passed as a query\n // param for DRF flexfields.\n omit?: (keyof T)[];\n\n // Explicit list of DRF-flexfield-expandable fields to that should be\n // expanded, to be passed as a query param for DRF flexfields.\n expand?: (keyof T)[];\n\n // Any additional query params that should be added to the end of the URL.\n queryParams?: Record;\n}\n\n// Also want to be able to use the types of create, update, and destroy\n// handlers elsewhere.\nexport type TCreateSingleModelInstance = ({\n body,\n}: Omit<\n IHandleCreateModelInstance,\n \"id\" | \"operation\" | \"endpointUrl\"\n>) => Promise | undefined>;\n\nexport type TUpdateSingleModelInstance = ({\n body,\n}: Omit<\n IHandleCreateModelInstance,\n \"id\" | \"operation\" | \"endpointUrl\"\n>) => Promise | undefined>;\n\nexport type TDestroySingleModelInstance = () => Promise<\n THandleSubmitChangeModelInstanceResult | undefined\n>;\n\nexport const useApiModelDetailView = ({\n resourceName,\n id,\n shouldGetData,\n mutateAfterChange = true,\n fields = undefined,\n omit = undefined,\n expand = undefined,\n queryParams = undefined,\n}: IUseApiModelDetailView) => {\n // Use SWR to read single record, if user said that we should be reading data.\n const targetUrl = getUrl({\n endpointUrl: resourceName,\n pk: id,\n queryParams: {\n ...(fields ? { fields: fields.join(\",\") } : undefined),\n ...(omit ? { omit: omit.join(\",\") } : undefined),\n ...(expand ? { expand: expand.join(\",\") } : undefined),\n ...queryParams,\n },\n });\n const { data, error, mutate } = useSWR(() =>\n id && shouldGetData ? targetUrl : null\n );\n\n // Then, want individual handlers for updating stuff and optionally calling\n // SWR mutate() automatically.\n\n // Updater\n const updateSingleModelInstance: TUpdateSingleModelInstance = useCallback(\n async ({ body }) => {\n var result;\n if (id) {\n result = await handleUpdateModelInstance({\n endpointUrl: resourceName,\n id,\n operation: \"update\",\n body,\n });\n if (mutateAfterChange) {\n await mutate();\n }\n return result;\n }\n },\n [id]\n );\n\n // Creator\n const createSingleModelInstance: TCreateSingleModelInstance = useCallback(\n async ({ body }) => {\n var result;\n result = await handleUpdateModelInstance({\n endpointUrl: resourceName,\n operation: \"create\",\n body,\n });\n if (mutateAfterChange) {\n await mutate();\n }\n return result;\n },\n [id]\n );\n\n // Destroyer\n const destroySingleModelInstance: TDestroySingleModelInstance =\n useCallback(async () => {\n var result;\n if (id) {\n result = await handleUpdateModelInstance({\n endpointUrl: resourceName,\n id,\n operation: \"destroy\",\n });\n\n // Not going to mutate after deleting, even if user requested, because\n // object doesn't exist and thus can't be refetched.\n\n return result;\n }\n }, [id]);\n\n return {\n data,\n error,\n mutate,\n createSingleModelInstance,\n updateSingleModelInstance,\n destroySingleModelInstance,\n };\n};\n\n// Also want a hook for just retrieving the list of records\ninterface IUseApiModelListView {\n // The object type for which we're requesting data, corresponding to one of\n // the main MASC API endpoints representing resources like \"user\",\n // \"experiments\", \"projects\", etc.\n resourceName: TResourceName;\n\n // Unlikely that we won't want to get data for a read operation, but\n // leaving the switch here for more flexibility.\n shouldGetData?: boolean;\n\n // Explicit list of fields to retrieve in each record, to be passed as a\n // query param for DRF flexfields.\n fields?: (keyof T)[];\n\n // Explicit list of fields to omit from each record, to be passed as a query\n // param for DRF flexfields.\n omit?: (keyof T)[];\n\n // Explicit list of DRF-flexfield-expandable fields to that should be\n // expanded, to be passed as a query param for DRF flexfields.\n expand?: (keyof T)[];\n\n // Any additional query params that should be added to the end of the URL.\n queryParams?: Record;\n}\nexport const useApiModelListView = ({\n resourceName,\n shouldGetData = false,\n fields = undefined,\n omit = undefined,\n expand = undefined,\n queryParams = undefined,\n}: IUseApiModelListView) => {\n // Use SWR to read single record, if user said that we should be reading data.\n const targetUrl = getUrl({\n endpointUrl: resourceName,\n queryParams: {\n ...(fields ? { fields: fields.join(\",\") } : undefined),\n ...(omit ? { omit: omit.join(\",\") } : undefined),\n ...(expand ? { expand: expand.join(\",\") } : undefined),\n ...queryParams,\n },\n });\n const { data, error, mutate } = useSWR<\n Paginated extends true ? PaginatedListResponse : T[]\n >(() => (shouldGetData ? targetUrl : null));\n\n return { data, error, mutate };\n};\n","// Utilities for user login, logout, and authentication\nimport { useState } from \"react\";\nimport useSWR from \"swr\";\nimport {\n IPasswordResetConfirmInput,\n IPasswordResetConfirmResponse,\n} from \"../pages/login-auth-registration/password-reset-confirm\";\nimport { IPasswordResetRequestInput } from \"../pages/login-auth-registration/password-reset-request\";\nimport { IRegistrationInput } from \"../pages/login-auth-registration/registration\";\nimport { IRequestNewVerificationEmailResponse } from \"../pages/login-auth-registration/request-new-verification-email\";\nimport {\n IVerifyKeyInput,\n IVerifyKeyResponse,\n} from \"../pages/login-auth-registration/verify-email\";\nimport { useApiModelDetailView } from \"./api-mutate-hooks\";\nimport { fetcherPatch } from \"./fetcher\";\n\n// Some other code thanks to\n// https://www.digitalocean.com/community/tutorials/how-to-add-login-authentication-to-react-applications#prerequisites\n\n// Set up hook to get and set session token\nexport type TUserToken = {\n expiry: string;\n token: string;\n};\n\nexport const getToken = () => {\n const tokenString = localStorage.getItem(\"token\");\n\n if (tokenString === null || typeof tokenString === \"undefined\") {\n return false;\n } else {\n const userToken: TUserToken = JSON.parse(tokenString);\n if (typeof userToken === \"undefined\") {\n return false;\n }\n return userToken.token;\n }\n};\n\nconst saveToken = (userToken: TUserToken) => {\n localStorage.setItem(\"token\", JSON.stringify(userToken));\n};\n\nexport default function useToken() {\n const [token, setToken] = useState(getToken());\n\n const hookSaveToken = (userToken: TUserToken) => {\n setToken(userToken.token);\n saveToken(userToken);\n };\n\n return { token, setToken: hookSaveToken };\n}\n\nexport type TKnoxCurrentKnoxUser = {\n email: string;\n detail?: string;\n pk: number;\n first_name: string;\n last_name: string;\n};\n\ninterface IUseCurrentKnoxUser {\n // If false, don't attempt to get Knox user information even if a token is\n // present. Use this to reduce the number of requests in a form where the\n // Knox user info is conditionally required.\n shouldGetData?: boolean;\n}\nexport const useCurrentKnoxUser = ({\n shouldGetData = true,\n}: IUseCurrentKnoxUser) => {\n const { token } = useToken();\n const {\n data: currentKnoxUser,\n error: currentKnoxUserError,\n mutate,\n } = useSWR(() =>\n token && shouldGetData\n ? `${import.meta.env.VITE_API_URL}/api/knox/user/`\n : null\n );\n\n return {\n currentKnoxUser,\n currentKnoxUserError,\n mutate,\n };\n};\n\n// Also have convenience wrapper hook to just get full user info quickly\ninterface IUseFullCurrentUser {\n shouldGetData?: boolean;\n}\nexport const useFullCurrentUser = ({\n shouldGetData = false,\n}: IUseFullCurrentUser) => {\n const { currentKnoxUser, currentKnoxUserError } = useCurrentKnoxUser({\n shouldGetData,\n });\n\n // Dependent query to get full user info\n const {\n data: fullUser,\n error: fullUserError,\n mutate: fullUserMutate,\n } = useApiModelDetailView({\n resourceName: \"users\",\n id: currentKnoxUser?.pk,\n shouldGetData: !!(currentKnoxUser && !currentKnoxUserError),\n });\n\n return { fullUser, fullUserError, fullUserMutate };\n};\n\ninterface ILoginUser {\n username: string;\n password: string;\n}\ninterface ILoginUserResponse extends TUserToken {\n non_field_errors?: string[];\n}\n\nexport async function loginUser(creds: ILoginUser) {\n // var res = await fetch(`${import.meta.env.VITE_API_URL}/api/knox/login/`, {\n // method: \"POST\",\n // headers: { \"Content-Type\": \"application/json\" },\n // body: JSON.stringify(creds),\n // });\n\n // var data = await res.json();\n\n const data = await fetcherPatch(\n `${import.meta.env.VITE_API_URL}/api/knox/login/`,\n creds,\n \"POST\"\n );\n\n console.log(\"[loginUser] data:\", data);\n\n if (data && Object.hasOwnProperty.call(data, \"token\")) {\n saveToken(data);\n }\n\n return data;\n}\n\nexport interface ILogoutUserArgs {\n type: \"this_device\" | \"all_devices\";\n}\nexport async function logoutUser(args: ILogoutUserArgs) {\n var token = getToken();\n var url;\n if (args.type === \"all_devices\") {\n url = `${import.meta.env.VITE_API_URL}/api/knox/logoutall/`;\n } else {\n url = `${import.meta.env.VITE_API_URL}/api/knox/logout/`;\n }\n var res = await fetch(url, {\n method: \"POST\",\n headers: { Authorization: `Token ${token}` },\n });\n\n var data = await res.json();\n\n // Clear local token if logout was successful\n if (data.message.toLowerCase().includes(\"logged out\")) {\n localStorage.removeItem(\"token\");\n }\n return data;\n}\n\n// Post registration information to the API endpoint to register a new user\ninterface IRegistrationResponse\n extends Partial {}\nexport async function registerNewUser(values: IRegistrationInput) {\n // Assume that validation has been done at the form level and post directly to API endpoint.\n\n // Attempt to register users, and allow errors to flow up to the form\n // component.\n var result_json = await fetcherPatch(\n `${import.meta.env.VITE_API_URL}/api/registration/register/`,\n values,\n \"POST\"\n );\n\n return result_json;\n}\n\n// Post email HMAC verification key to email confirmation endpoint\nexport async function confirmEmail(values: IVerifyKeyInput) {\n var result_json: IVerifyKeyResponse | undefined = {\n error: [\"Irrecoverable error\"],\n };\n try {\n result_json = await fetcherPatch(\n `${import.meta.env.VITE_API_URL}/api/registration/verify-email/`,\n values,\n \"POST\"\n );\n } catch (err) {\n // Not sure what the error is. Log it.\n console.log(\n \"[registration] Error posting to email verification endpoint\",\n err\n );\n }\n\n return result_json;\n}\n\n// Also have wrapper to resend confirmation email\n\nexport async function resendEmail(values: IVerifyKeyInput) {\n var result_json = await fetcherPatch(\n `${import.meta.env.VITE_API_URL}/api/registration/resend-email-from-hmac/`,\n values,\n \"POST\"\n );\n\n return result_json;\n}\n\n// And the option to resend the email confirmation using just the user's email address\ninterface IResendEmailFromEmailAddressInput {\n email: string;\n}\n\nexport async function resendEmailFromEmailAddress(\n values: IResendEmailFromEmailAddressInput\n): Promise {\n let result_json = await fetcherPatch<\n IResendEmailFromEmailAddressInput,\n IRequestNewVerificationEmailResponse\n >(\n `${import.meta.env.VITE_API_URL}/api/registration/resend-email/`,\n values,\n \"POST\"\n );\n return result_json;\n}\n\n// Send password reset confirmation form\nexport async function confirmPasswordReset(values: IPasswordResetConfirmInput) {\n let result_json = await fetcherPatch<\n IPasswordResetConfirmInput,\n IPasswordResetConfirmResponse\n >(\n `${import.meta.env.VITE_API_URL}/api/registration/password/reset/confirm/`,\n values,\n \"POST\"\n );\n return result_json;\n}\n\n// Send request to let user request a new password reset\n// Send password reset confirmation form\nexport async function requestPasswordReset(values: IPasswordResetRequestInput) {\n var result_json = await fetcherPatch(\n `${import.meta.env.VITE_API_URL}/api/registration/password/reset/`,\n values,\n \"POST\"\n );\n\n return result_json;\n}\n","// Utilities for AJAX requests\n// Currently just using the browser `fetch` interface.\n\nimport { getToken } from \"./auth\";\n\nexport type TFetcherGETError = Error & {\n status?: number;\n info?: { [Property in keyof T]: string[] } | string;\n detail?: string;\n};\n\nconst fetcher = async (\n url: RequestInfo | URL | string,\n options?: RequestInit\n) => {\n // If token if present, add it to auth header on requests.\n const token = getToken();\n // console.log(`Token is: ${token}`);\n // console.log(`Args: ${args}`);\n // console.log(\"[fetcher]: Token exists; using auth header.\");\n const res = await fetch(url, {\n headers: {\n ...(options ? options.headers : undefined),\n ...(token ? { Authorization: `Token ${token}` } : undefined),\n },\n });\n\n // Throw error object if fetch fails for any reason.\n if (!res.ok) {\n const error: TFetcherGETError = new Error(\n `Error during request to ${res.url}`\n );\n\n try {\n error.info = (await res.json()) as { [Property in keyof T]: string[] };\n } catch (err) {\n // If unable to parse JSON, just skip it.\n }\n error.status = res.status;\n\n throw error;\n }\n\n // At this point, request is successful. Now try parsing JSON.\n try {\n return (await res.json()) as T;\n } catch (err) {\n console.log(\"No JSON response, or unable to parse. Continuing silently.\");\n }\n};\nexport default fetcher;\n\nexport type TFetchGeneralError = Error & {\n info?: { [Property in keyof T]: string[] } & {\n non_field_errors?: string[];\n detail?: string;\n };\n status?: number;\n detail?: string;\n non_field_errors?: string[];\n};\n\nexport const fetcherPatch = async (\n url: RequestInfo | URL | string,\n body: T,\n method: \"PATCH\" | \"POST\" | \"PUT\" | \"GET\" | \"OPTIONS\" | \"DELETE\" = \"PATCH\",\n additionalOptions?: RequestInit\n) => {\n // Special fetcher just for updating things.\n\n const token = getToken();\n var authHeader = {};\n if (typeof token === \"string\") {\n authHeader = { Authorization: `Token ${token}` };\n }\n\n const res = await fetch(url, {\n method,\n body: JSON.stringify(body),\n headers: {\n ...(additionalOptions ? additionalOptions.headers : undefined),\n ...authHeader,\n \"Content-Type\": \"application/json\",\n },\n });\n\n // Handle general request errors\n\n if (!res.ok) {\n const error: TFetchGeneralError = new Error(\n `Error with request to ${res.url}`\n );\n error.status = res.status;\n try {\n error.info = (await res.json()) as { [Property in keyof R]: string[] };\n } catch (err) {\n // If unable to parse JSON, just skip it.\n }\n throw error;\n }\n\n // At this point, request is successful. Now try parsing JSON. Response may\n // have extra fields, like \"detail\".\n try {\n return (await res.json()) as R & { detail?: string };\n } catch (err) {\n console.log(\"No JSON response, or unable to parse. Continuing silently.\");\n }\n};\n\n// Also have a fetcher that posts multipart/formdata, for uploading files.\nexport const fetcherMultipartFormdata = async (\n url: RequestInfo | URL | string,\n body: FormData,\n method: \"PATCH\" | \"POST\" | \"PUT\" | \"GET\" | \"OPTIONS\" | \"DELETE\" = \"PATCH\",\n additionalOptions?: RequestInit\n) => {\n // Special fetcher just for updating things.\n\n const token = getToken();\n var authHeader = {};\n if (typeof token === \"string\") {\n authHeader = { Authorization: `Token ${token}` };\n }\n\n try {\n // Try request as normal, and turn any server errors into JavaScript errors\n // that we cna trap.\n let res = await fetch(url, {\n method,\n body,\n headers: {\n ...(additionalOptions ? additionalOptions.headers : undefined),\n ...authHeader,\n // We don't set Content-Type: multipart/form-data here, because browser\n // will do this automatically, using the multipart delimiter it chooses.\n // See\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects#sect4.\n },\n });\n\n // Handle general request errors\n\n if (!res.ok) {\n const error: TFetchGeneralError = new Error(\n `Error with request to ${res.url}`\n );\n error.status = res.status;\n try {\n error.info = (await res.json()) as { [Property in keyof R]: string[] };\n } catch (err) {\n // If unable to parse JSON, just skip it.\n }\n throw error;\n }\n\n // At this point, request is successful. Now try parsing JSON. Response may\n // have extra fields, like \"detail\".\n try {\n return (await res.json()) as R & { detail?: string };\n } catch (err) {\n console.log(\"No JSON response, or unable to parse. Continuing silently.\");\n }\n } catch (err) {\n // However, if there is actually a client-side error with running the fetch\n // call, deal with it more directly.\n if (err instanceof TypeError) {\n // This can happen if the user is sending a request that is too large\n // (i.e., exceeds max client body size). In this case, throw a new\n // TFetchGeneralError with the same kinds of details as in the server\n // error case.\n const error: TFetchGeneralError = new Error(\"Client-side error\");\n\n // Use non-standard client error code\n error.status = 452;\n\n error.detail =\n \"Request could not be initiated, and TypeError arose upon Fetch invocation.\";\n\n throw error;\n } else {\n // Bubble up any other errors that aren't TypeErrors.\n throw err;\n }\n }\n};\n","/**\n * @remix-run/router v1.3.2\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\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n\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\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\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\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 */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n\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\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n\n function getCurrentLocation() {\n return entries[index];\n }\n\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning$1(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n let history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return getCurrentLocation();\n },\n\n createHref,\n\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\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\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\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\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\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\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 */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\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 }, // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\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 */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n return createLocation(\"\", {\n pathname,\n search,\n hash\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\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n\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\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n\n function validateHashLocation(location, to) {\n warning$1(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\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}\n\nfunction warning$1(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\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); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\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 */\n\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 */\n\n\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\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\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\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 */\n\nfunction parsePath(path) {\n let parsedPath = {};\n\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n let searchIndex = path.indexOf(\"?\");\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\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(); // 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\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\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); // try...catch because iOS limits us to 100 pushState calls :/\n\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\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\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\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\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\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 invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n\n let history = {\n get action() {\n return action;\n },\n\n get location() {\n return getLocation(window, globalHistory);\n },\n\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n\n createHref(to) {\n return createHref(window, to);\n },\n\n createURL,\n\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\n push,\n replace,\n\n go(n) {\n return globalHistory.go(n);\n }\n\n };\n return history;\n} //#endregion\n\nvar ResultType;\n\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\n\nfunction isIndexRoute(route) {\n return route.index === true;\n} // Walk the route tree generating unique IDs where necessary so we are working\n// solely with AgnosticDataRouteObject's within the Router\n\n\nfunction convertRoutesToDataRoutes(routes, parentPath, allIds) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n\n if (allIds === void 0) {\n allIds = new Set();\n }\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(!allIds.has(id), \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n allIds.add(id);\n\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, {\n id\n });\n\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, {\n id,\n children: route.children ? convertRoutesToDataRoutes(route.children, treePath, allIds) : undefined\n });\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 */\n\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n\n if (pathname == null) {\n return null;\n }\n\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(branches[i], // 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 safelyDecodeURI(pathname));\n }\n\n return matches;\n}\n\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n\n if (parentPath === void 0) {\n parentPath = \"\";\n }\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\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\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta); // 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\n if (route.children && route.children.length > 0) {\n invariant( // 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 } // 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\n\n if (route.path == null && !route.index) {\n return;\n }\n\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n\n routes.forEach((route, index) => {\n var _route$path;\n\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 */\n\n\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments; // Optional path segments are denoted by a trailing `?`\n\n let isOptional = first.endsWith(\"?\"); // Compute the corresponding required segment: `foo?` -> `foo`\n\n let required = first.replace(/\\?$/, \"\");\n\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\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = []; // 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 explodes _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\"))); // Then if this is an optional value, add all child versions without\n\n if (isOptional) {\n result.push(...restExploded);\n } // for absolute paths, ensure `/` instead of empty segment\n\n\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\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}\n\nconst paramRe = /^:\\w+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\n\nconst isSplat = s => s === \"*\";\n\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n\n if (index) {\n initialScore += indexRouteValue;\n }\n\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\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 ? // 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] : // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\n\nfunction matchRouteBranch(branch, pathname) {\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n\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\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\n\n\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n\n let path = originalPath;\n\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\n return path.replace(/^:(\\w+)(\\??)/g, (_, key, optional) => {\n let param = params[key];\n\n if (optional === \"?\") {\n return param == null ? \"\" : param;\n }\n\n if (param == null) {\n invariant(false, \"Missing \\\":\" + key + \"\\\" param\");\n }\n\n return param;\n }).replace(/\\/:(\\w+)(\\??)/g, (_, key, optional) => {\n let param = params[key];\n\n if (optional === \"?\") {\n return param == null ? \"\" : \"/\" + param;\n }\n\n if (param == null) {\n invariant(false, \"Missing \\\":\" + key + \"\\\" param\");\n }\n\n return \"/\" + param;\n }) // Remove any optional markers from optional static segments\n .replace(/\\?/g, \"\").replace(/(\\/?)\\*/, (_, prefix, __, str) => {\n const star = \"*\";\n\n if (params[star] == null) {\n // If no splat was provided, trim the trailing slash _unless_ it's\n // the entire path\n return str === \"/*\" ? \"/\" : \"\";\n } // Apply the splat\n\n\n return \"\" + prefix + params[star];\n });\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 */\n\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n\n let [matcher, paramNames] = 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 = paramNames.reduce((memo, paramName, index) => {\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\n memo[paramName] = safelyDecodeURIComponent(captureGroups[index] || \"\", paramName);\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\n\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n\n if (end === void 0) {\n end = true;\n }\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 paramNames = [];\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) => {\n paramNames.push(paramName);\n return \"/([^\\\\/]+)\";\n });\n\n if (path.endsWith(\"*\")) {\n paramNames.push(\"*\");\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\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, paramNames];\n}\n\nfunction safelyDecodeURI(value) {\n try {\n return decodeURI(value);\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\nfunction safelyDecodeURIComponent(value, paramName) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(false, \"The value for the URL param \\\"\" + paramName + \"\\\" will not be decoded because\" + (\" the string \\\"\" + value + \"\\\" is a malformed URL segment. This is probably\") + (\" due to a bad percent encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\n\n\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\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\n\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * @private\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\n try {\n // Welcome to debugging @remix-run/router!\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); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\n\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\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}\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}\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 */\n\n\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n/**\n * @private\n */\n\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n\n let to;\n\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\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from; // 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\n if (isPathRelative || toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\"); // Each leading .. segment means \"go up one route\" instead of \"go up one\n // URL segment\". This is a key difference from how works and a\n // major reason we call this a \"to\" value instead of a \"href\".\n\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n\n to.pathname = toSegments.join(\"/\");\n } // If there are more \"..\" segments than parent routes, resolve relative to\n // the root / URL.\n\n\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n\n let path = resolvePath(to, from); // Ensure the pathname has a trailing slash if the original \"to\" had one\n\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\"); // Or if this was a link to the current path which has a trailing slash\n\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n\n return path;\n}\n/**\n * @private\n */\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 */\n\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\n\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\n\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\n\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\n\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\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\"); // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref) => {\n let [key, value] = _ref;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n\n this.init = responseInit;\n }\n\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key); // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, null, data), error => this.onSettle(promise, key, error)); // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\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\n this.pendingKeysSet.delete(key);\n\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n\n if (error) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n\n async resolveData(signal) {\n let aborted = false;\n\n if (!this.done) {\n let onAbort = () => this.cancel();\n\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n\n return aborted;\n }\n\n get done() {\n return this.pendingKeysSet.size === 0;\n }\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, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n\n}\n\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\n\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n\n if (value._error) {\n throw value._error;\n }\n\n return value._data;\n}\n\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\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 */\n\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n\n let responseInit = init;\n\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\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 * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n */\n\nclass ErrorResponse {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n\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/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\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};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: 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 isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.document.createElement !== \"undefined\";\nconst isServer = !isBrowser; //#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Create a router and listen to history POP navigations\n */\n\nfunction createRouter(init) {\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let dataRoutes = convertRoutesToDataRoutes(init.routes); // Cleanup function for history\n\n let unlistenHistory = null; // Externally-provided functions to call on all state changes\n\n let subscribers = new Set(); // Externally-provided object to hold scroll restoration locations during routing\n\n let savedScrollPositions = null; // Externally-provided function to get scroll restoration keys\n\n let getScrollRestorationKey = null; // Externally-provided function to get current scroll position\n\n let getScrollPosition = null; // 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\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, init.basename);\n let initialErrors = null;\n\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\n let initialized = !initialMatches.some(m => m.route.loader) || init.hydrationData != null;\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 }; // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n\n let pendingAction = Action.Pop; // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n\n let pendingPreventScrollReset = false; // AbortController for the active navigation\n\n let pendingNavigationController; // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n\n let isUninterruptedRevalidation = false; // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidate()\n // - X-Remix-Revalidate (from redirect)\n\n let isRevalidationRequired = false; // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n\n let cancelledDeferredRoutes = []; // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n\n let cancelledFetcherLoads = []; // AbortControllers for any in-flight fetchers\n\n let fetchControllers = new Map(); // Track loads based on the order in which they started\n\n let incrementingLoadId = 0; // 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\n let pendingNavigationLoadId = -1; // Fetchers that triggered data reloads as a result of their actions\n\n let fetchReloadIds = new Map(); // Fetchers that triggered redirect navigations from their actions\n\n let fetchRedirectIds = new Set(); // Most recent href/match for fetcher.load calls for fetchers\n\n let fetchLoadMatches = new Map(); // 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\n let activeDeferreds = new Map(); // 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\n let blockerFunctions = new Map(); // 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\n let ignoreNextHistoryUpdate = false; // 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\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\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\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\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); // Put the blocker into a blocked state\n\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n }); // Re-do the same POP navigation we just blocked\n\n init.history.go(delta);\n },\n\n reset() {\n deleteBlocker(blockerKey);\n updateState({\n blockers: new Map(router.state.blockers)\n });\n }\n\n });\n return;\n }\n\n return startNavigation(historyAction, location);\n }); // Kick off initial data load if needed. Use Pop to avoid modifying history\n\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location);\n }\n\n return router;\n } // Clean up a router and it's side effects\n\n\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n } // Subscribe to state updates for the router\n\n\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n } // Update our state and notify the calling context of the change\n\n\n function updateState(newState) {\n state = _extends({}, state, newState);\n subscribers.forEach(subscriber => subscriber(state));\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\n\n function completeNavigation(location, newState) {\n var _location$state, _location$state2;\n\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\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 } // Always preserve any existing loaderData from re-used routes\n\n\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData; // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n\n for (let [key] of blockerFunctions) {\n deleteBlocker(key);\n } // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n\n\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 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: new Map(state.blockers)\n }));\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 } // Reset stateful navigation vars\n\n\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n cancelledFetcherLoads = [];\n } // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n\n\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(to, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state); // 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\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n\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\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n }); // Send the same navigation through\n\n navigate(to, opts);\n },\n\n reset() {\n deleteBlocker(blockerKey);\n updateState({\n blockers: new Map(state.blockers)\n });\n }\n\n });\n return;\n }\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 });\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\n\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\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\n if (state.navigation.state === \"submitting\") {\n return;\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\n\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\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\n\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation\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\n\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; // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(dataRoutes, location, init.basename); // Short circuit with a 404 on the root error boundary if we match nothing\n\n if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes); // Cancel all pending deferred on 404s since we don't keep any routes\n\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n });\n return;\n } // Short circuit if it's only a hash change and not a mutation submission\n // For example, on /page#hash and submit a
which will\n // default to a navigation to /page\n\n\n if (isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n });\n return;\n } // Create a controller/Request for this navigation\n\n\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionData;\n let pendingError;\n\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 pendingError = {\n [findNearestBoundary(matches).route.id]: opts.pendingError\n };\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionOutput = await handleAction(request, location, opts.submission, matches, {\n replace: opts.replace\n });\n\n if (actionOutput.shortCircuited) {\n return;\n }\n\n pendingActionData = actionOutput.pendingActionData;\n pendingError = actionOutput.pendingActionError;\n\n let navigation = _extends({\n state: \"loading\",\n location\n }, opts.submission);\n\n loadingNavigation = navigation; // Create a GET request for the loaders\n\n request = new Request(request.url, {\n signal: request.signal\n });\n } // Call loaders\n\n\n let {\n shortCircuited,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.replace, pendingActionData, pendingError);\n\n if (shortCircuited) {\n return;\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\n\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, {\n loaderData,\n errors\n }));\n } // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n\n\n async function handleAction(request, location, submission, matches, opts) {\n interruptActiveLoads(); // Put us in a submitting state\n\n let navigation = _extends({\n state: \"submitting\",\n location\n }, submission);\n\n updateState({\n navigation\n }); // Call our action and get the result\n\n let result;\n let actionMatch = getTargetMatch(matches, location);\n\n if (!actionMatch.route.action) {\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 result = await callLoaderOrAction(\"action\", request, actionMatch, matches, router.basename);\n\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n\n if (isRedirectResult(result)) {\n let replace;\n\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 replace = result.location === state.location.pathname + state.location.search;\n }\n\n await startRedirectNavigation(state, result, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\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); // 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\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n\n return {\n // Send back an empty object we can use to clear out any prior actionData\n pendingActionData: {},\n pendingActionError: {\n [boundaryMatch.route.id]: result.error\n }\n };\n }\n\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n\n return {\n pendingActionData: {\n [actionMatch.route.id]: result.data\n }\n };\n } // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n\n\n async function handleLoaders(request, location, matches, overrideNavigation, submission, replace, pendingActionData, pendingError) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation;\n\n if (!loadingNavigation) {\n let navigation = _extends({\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n }, submission);\n\n loadingNavigation = navigation;\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\n\n let activeSubmission = submission ? submission : loadingNavigation.formMethod && loadingNavigation.formAction && loadingNavigation.formData && loadingNavigation.formEncType ? {\n formMethod: loadingNavigation.formMethod,\n formAction: loadingNavigation.formAction,\n formData: loadingNavigation.formData,\n formEncType: loadingNavigation.formEncType\n } : undefined;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, pendingActionData, pendingError, fetchLoadMatches); // 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\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId)); // Short circuit if we have no loaders to run\n\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingError || null\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}));\n return {\n shortCircuited: true\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\n\n if (!isUninterruptedRevalidation) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = {\n state: \"loading\",\n data: fetcher && fetcher.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n let actionData = pendingActionData || state.actionData;\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData ? Object.keys(actionData).length === 0 ? {\n actionData: null\n } : {\n actionData\n } : {}, revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n }\n\n pendingNavigationLoadId = ++incrementingLoadId;\n revalidatingFetchers.forEach(rf => fetchControllers.set(rf.key, pendingNavigationController));\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request);\n\n if (request.signal.aborted) {\n return {\n shortCircuited: true\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\n\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key)); // If any loaders returned a redirect Response, start a new REPLACE navigation\n\n let redirect = findRedirect(results);\n\n if (redirect) {\n await startRedirectNavigation(state, redirect, {\n replace\n });\n return {\n shortCircuited: true\n };\n } // Process and commit output from loaders\n\n\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds); // Wire up subscribers to update loaderData as promises settle\n\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 markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n return _extends({\n loaderData,\n errors\n }, didAbortFetchLoads || revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n\n function getFetcher(key) {\n return state.fetchers.get(key) || IDLE_FETCHER;\n } // Trigger a fetcher load/submit for the given fetcher key\n\n\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\n if (fetchControllers.has(key)) abortFetcher(key);\n let matches = matchRoutes(dataRoutes, href, init.basename);\n\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: href\n }));\n return;\n }\n\n let {\n path,\n submission\n } = normalizeNavigateOptions(href, opts, true);\n let match = getTargetMatch(matches, path);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, submission);\n return;\n } // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n\n\n fetchLoadMatches.set(key, {\n routeId,\n path,\n match,\n matches\n });\n handleFetcherLoader(key, routeId, path, match, matches, submission);\n } // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n\n\n async function handleFetcherAction(key, routeId, path, match, requestMatches, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n\n if (!match.route.action) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error);\n return;\n } // Put this fetcher into it's submitting state\n\n\n let existingFetcher = state.fetchers.get(key);\n\n let fetcher = _extends({\n state: \"submitting\"\n }, submission, {\n data: existingFetcher && existingFetcher.data,\n \" _hasFetcherDoneAnything \": true\n });\n\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }); // Call the action for the fetcher\n\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n fetchControllers.set(key, abortController);\n let actionResult = await callLoaderOrAction(\"action\", fetchRequest, match, requestMatches, router.basename);\n\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by ou 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\n return;\n }\n\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n fetchRedirectIds.add(key);\n\n let loadingFetcher = _extends({\n state: \"loading\"\n }, submission, {\n data: undefined,\n \" _hasFetcherDoneAnything \": true\n });\n\n state.fetchers.set(key, loadingFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n return startRedirectNavigation(state, actionResult, {\n isFetchActionRedirect: true\n });\n } // Process any non-redirect errors thrown\n\n\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 } // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n\n\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(dataRoutes, state.navigation.location, init.basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n\n let loadFetcher = _extends({\n state: \"loading\",\n data: actionResult.data\n }, submission, {\n \" _hasFetcherDoneAnything \": true\n });\n\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, {\n [match.route.id]: actionResult.data\n }, undefined, // No need to send through errors since we short circuit above\n fetchLoadMatches); // 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\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = {\n state: \"loading\",\n data: existingFetcher && existingFetcher.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(staleKey, revalidatingFetcher);\n fetchControllers.set(staleKey, abortController);\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n\n if (abortController.signal.aborted) {\n return;\n }\n\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(results);\n\n if (redirect) {\n return startRedirectNavigation(state, redirect);\n } // Process and commit output from loaders\n\n\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n let doneFetcher = {\n state: \"idle\",\n data: actionResult.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n let didAbortFetchLoads = abortStaleFetchLoads(loadId); // 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\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(_extends({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors)\n }, didAbortFetchLoads ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n isRevalidationRequired = false;\n }\n } // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n\n\n async function handleFetcherLoader(key, routeId, path, match, matches, submission) {\n let existingFetcher = state.fetchers.get(key); // Put this fetcher into it's loading state\n\n let loadingFetcher = _extends({\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n }, submission, {\n data: existingFetcher && existingFetcher.data,\n \" _hasFetcherDoneAnything \": true\n });\n\n state.fetchers.set(key, loadingFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }); // Call the loader for this fetcher route match\n\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n fetchControllers.set(key, abortController);\n let result = await callLoaderOrAction(\"loader\", fetchRequest, match, matches, router.basename); // 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\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n } // We can delete this so long as we weren't aborted by ou our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n\n\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n\n if (fetchRequest.signal.aborted) {\n return;\n } // If the loader threw a redirect Response, start a new REPLACE navigation\n\n\n if (isRedirectResult(result)) {\n await startRedirectNavigation(state, result);\n return;\n } // Process any non-redirect errors thrown\n\n\n if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n state.fetchers.delete(key); // TODO: In remix, this would reset to IDLE_NAVIGATION if it was a catch -\n // do we need to behave any differently with our non-redirect errors?\n // What if it was a non-redirect Response?\n\n updateState({\n fetchers: new Map(state.fetchers),\n errors: {\n [boundaryMatch.route.id]: result.error\n }\n });\n return;\n }\n\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\"); // Put the fetcher back into an idle state\n\n let doneFetcher = {\n state: \"idle\",\n data: result.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\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\n\n async function startRedirectNavigation(state, redirect, _temp) {\n var _window;\n\n let {\n submission,\n replace,\n isFetchActionRedirect\n } = _temp === void 0 ? {} : _temp;\n\n if (redirect.revalidate) {\n isRevalidationRequired = true;\n }\n\n let redirectLocation = createLocation(state.location, redirect.location, // TODO: This can be removed once we get rid of useTransition in Remix v2\n _extends({\n _isRedirect: true\n }, isFetchActionRedirect ? {\n _isFetchActionRedirect: true\n } : {}));\n invariant(redirectLocation, \"Expected a location on the redirect navigation\"); // Check if this an absolute external redirect that goes to a new origin\n\n if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser && typeof ((_window = window) == null ? void 0 : _window.location) !== \"undefined\") {\n let newOrigin = init.history.createURL(redirect.location).origin;\n\n if (window.location.origin !== newOrigin) {\n if (replace) {\n window.location.replace(redirect.location);\n } else {\n window.location.assign(redirect.location);\n }\n\n return;\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\n\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true ? Action.Replace : Action.Push; // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n\n let {\n formMethod,\n formAction,\n formEncType,\n formData\n } = state.navigation;\n\n if (!submission && formMethod && formAction && formData && formEncType) {\n submission = {\n formMethod,\n formAction,\n formEncType,\n formData\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\n\n if (redirectPreserveMethodStatusCodes.has(redirect.status) && submission && isMutationMethod(submission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, submission, {\n formAction: redirect.location\n }),\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else {\n // Otherwise, we kick off a new loading navigation, preserving the\n // submission info for the duration of this navigation\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation: {\n state: \"loading\",\n location: redirectLocation,\n formMethod: submission ? submission.formMethod : undefined,\n formAction: submission ? submission.formAction : undefined,\n formEncType: submission ? submission.formEncType : undefined,\n formData: submission ? submission.formData : undefined\n },\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n }\n }\n\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n // Call all navigation loaders and revalidating fetcher loaders in parallel,\n // then slice off the results into separate arrays so we can handle them\n // accordingly\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, router.basename)), ...fetchersToLoad.map(f => callLoaderOrAction(\"loader\", createClientSideRequest(init.history, f.path, request.signal), f.match, f.matches, router.basename))]);\n let loaderResults = results.slice(0, matchesToLoad.length);\n let fetcherResults = results.slice(matchesToLoad.length);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, request.signal, false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, request.signal, true)]);\n return {\n results,\n loaderResults,\n fetcherResults\n };\n }\n\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true; // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n\n cancelledDeferredRoutes.push(...cancelActiveDeferreds()); // Abort in-flight fetcher loads\n\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.push(key);\n abortFetcher(key);\n }\n });\n }\n\n function setFetcherError(key, routeId, error) {\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 }\n\n function deleteFetcher(key) {\n if (fetchControllers.has(key)) abortFetcher(key);\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n state.fetchers.delete(key);\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\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = {\n state: \"idle\",\n data: fetcher.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n }\n }\n\n function markFetchRedirectsDone() {\n let doneKeys = [];\n\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n }\n }\n\n markFetchersDone(doneKeys);\n }\n\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n\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\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n\n return blocker;\n }\n\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n } // Utility function to update blockers, ensuring valid state transitions\n\n\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER; // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n\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 state.blockers.set(key, newBlocker);\n updateState({\n blockers: new Map(state.blockers)\n });\n }\n\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n\n if (blockerFunctions.size === 0) {\n return;\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\n\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n\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 } // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n\n\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\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 } // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n\n\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n\n getScrollRestorationKey = getKey || (location => location.key); // 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\n\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollRestorationKey && getScrollPosition) {\n let userMatches = matches.map(m => createUseMatchesMatch(m, state.loaderData));\n let key = getScrollRestorationKey(location, userMatches) || location.key;\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollRestorationKey && getScrollPosition) {\n let userMatches = matches.map(m => createUseMatchesMatch(m, state.loaderData));\n let key = getScrollRestorationKey(location, userMatches) || location.key;\n let y = savedScrollPositions[key];\n\n if (typeof y === \"number\") {\n return y;\n }\n }\n\n return null;\n }\n\n router = {\n get basename() {\n return init.basename;\n },\n\n get state() {\n return state;\n },\n\n get routes() {\n return dataRoutes;\n },\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,\n dispose,\n getBlocker,\n deleteBlocker,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds\n };\n return router;\n} //#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\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 dataRoutes = convertRoutesToDataRoutes(routes);\n let basename = (opts ? opts.basename : null) || \"/\";\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\n async function query(request, _temp2) {\n let {\n requestContext\n } = _temp2 === void 0 ? {} : _temp2;\n let url = new URL(request.url);\n let method = request.method.toLowerCase();\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't\n\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\n let result = await queryImpl(request, location, matches, requestContext);\n\n if (isResponse(result)) {\n return result;\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\n\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\n\n async function queryRoute(request, _temp3) {\n let {\n routeId,\n requestContext\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method.toLowerCase();\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't\n\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\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n\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\n let result = await queryImpl(request, location, matches, requestContext, match);\n\n if (isResponse(result)) {\n return result;\n }\n\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n\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 } // Pick off the right state value to return\n\n\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n\n if (result.loaderData) {\n var _result$activeDeferre;\n\n let data = Object.values(result.loaderData)[0];\n\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n\n return data;\n }\n\n return undefined;\n }\n\n async function queryImpl(request, location, matches, requestContext, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, routeMatch != null);\n return result;\n }\n\n let result = await loadRouteData(request, matches, requestContext, 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, we throw\n // it to bail out and then return or throw here based on whether the user\n // returned or threw\n if (isQueryRouteResponse(e)) {\n if (e.type === ResultType.error && !isRedirectResponse(e.response)) {\n throw e.response;\n }\n\n return e.response;\n } // Redirects are always returned since they don't propagate to catch\n // boundaries\n\n\n if (isRedirectResponse(e)) {\n return e;\n }\n\n throw e;\n }\n }\n\n async function submit(request, matches, actionMatch, requestContext, isRouteRequest) {\n let result;\n\n if (!actionMatch.route.action) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n\n if (isRouteRequest) {\n throw error;\n }\n\n result = {\n type: ResultType.error,\n error\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, basename, true, isRouteRequest, requestContext);\n\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted\");\n }\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.status,\n headers: {\n Location: result.location\n }\n });\n }\n\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n\n if (isRouteRequest) {\n throw error;\n }\n\n result = {\n type: ResultType.error,\n error\n };\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\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\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 let context = await loadRouteData(request, matches, requestContext, undefined, {\n [boundaryMatch.route.id]: result.error\n }); // action status codes take precedence over loader status codes\n\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n } // Create a GET request for the loaders\n\n\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n let context = await loadRouteData(loaderRequest, matches, requestContext);\n return _extends({}, context, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionData: {\n [actionMatch.route.id]: result.data\n },\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n\n async function loadRouteData(request, matches, requestContext, routeMatch, pendingActionError) {\n let isRouteRequest = routeMatch != null; // Short circuit if we have no loaders to run (queryRoute())\n\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader)) {\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\n let requestMatches = routeMatch ? [routeMatch] : getLoaderMatchesUntilBoundary(matches, Object.keys(pendingActionError || {})[0]);\n let matchesToLoad = requestMatches.filter(m => m.route.loader); // Short circuit if we have no loaders to run (query())\n\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: pendingActionError || null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, basename, true, isRouteRequest, requestContext))]);\n\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted\");\n } // Process and commit output from loaders\n\n\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, matchesToLoad, results, pendingActionError, activeDeferreds); // Add a null for any non-loader matches for proper revalidation on the client\n\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\n return {\n dataRoutes,\n query,\n queryRoute\n };\n} //#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\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 */\n\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n\n return newContext;\n}\n\nfunction isSubmissionNavigation(opts) {\n return opts != null && \"formData\" in opts;\n} // Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\n\n\nfunction normalizeNavigateOptions(to, opts, isFetcher) {\n if (isFetcher === void 0) {\n isFetcher = false;\n }\n\n let path = typeof to === \"string\" ? to : createPath(to); // Return location verbatim on non-submission navigations\n\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n } // Create a Submission on non-GET navigations\n\n\n let submission;\n\n if (opts.formData) {\n submission = {\n formMethod: opts.formMethod || \"get\",\n formAction: stripHashFromPath(path),\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData: opts.formData\n };\n\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n } // Flatten submission onto URLSearchParams for GET submissions\n\n\n let parsedPath = parsePath(path);\n let searchParams = convertFormDataToSearchParams(opts.formData); // Since fetcher GET submissions only run a single loader (as opposed to\n // navigation GET submissions which run all loaders), we need to preserve\n // any incoming ?index params\n\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\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\n\n\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n\n return boundaryMatches;\n}\n\nfunction getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, pendingActionData, pendingError, fetchLoadMatches) {\n let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n let defaultShouldRevalidate = // Forced revalidation due to submission, useRevalidate, or X-Remix-Revalidate\n isRevalidationRequired || // Clicked the same link, resubmitted a GET form\n currentUrl.toString() === nextUrl.toString() || // Search params affect all loaders\n currentUrl.search !== nextUrl.search; // Pick navigation matches that are net-new or qualify for revalidation\n\n let boundaryId = pendingError ? Object.keys(pendingError)[0] : undefined;\n let boundaryMatches = getLoaderMatchesUntilBoundary(matches, boundaryId);\n let navigationMatches = boundaryMatches.filter((match, index) => {\n if (match.route.loader == null) {\n return false;\n } // Always call the loader on new route instances and pending defer cancellations\n\n\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\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\n\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 defaultShouldRevalidate: defaultShouldRevalidate || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n }); // Pick fetcher.loads that need to be revalidated\n\n let revalidatingFetchers = [];\n fetchLoadMatches && fetchLoadMatches.forEach((f, key) => {\n if (!matches.some(m => m.route.id === f.routeId)) {\n // This fetcher is not going to be present in the subsequent render so\n // there's no need to revalidate it\n return;\n } else if (cancelledFetcherLoads.includes(key)) {\n // This fetcher was cancelled from a prior action submission - force reload\n revalidatingFetchers.push(_extends({\n key\n }, f));\n } else {\n // Revalidating fetchers are decoupled from the route matches since they\n // hit a static href, so they _always_ check shouldRevalidate and the\n // default is strictly if a revalidation is explicitly required (action\n // submissions, useRevalidator, X-Remix-Revalidate).\n let shouldRevalidate = shouldRevalidateLoader(f.match, _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 defaultShouldRevalidate\n }));\n\n if (shouldRevalidate) {\n revalidatingFetchers.push(_extends({\n key\n }, f));\n }\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\n\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew = // [a] -> [a, b]\n !currentMatch || // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id; // 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\n let isMissingData = currentLoaderData[match.route.id] === undefined; // Always load if this is a net-new route or we don't yet have data\n\n return isNew || isMissingData;\n}\n\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (// param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname || // 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}\n\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n\n return arg.defaultShouldRevalidate;\n}\n\nasync function callLoaderOrAction(type, request, match, matches, basename, isStaticRequest, isRouteRequest, requestContext) {\n if (basename === void 0) {\n basename = \"/\";\n }\n\n if (isStaticRequest === void 0) {\n isStaticRequest = false;\n }\n\n if (isRouteRequest === void 0) {\n isRouteRequest = false;\n }\n\n let resultType;\n let result; // Setup a promise we can race against so that abort signals short circuit\n\n let reject;\n let abortPromise = new Promise((_, r) => reject = r);\n\n let onReject = () => reject();\n\n request.signal.addEventListener(\"abort\", onReject);\n\n try {\n let handler = match.route[type];\n invariant(handler, \"Could not find the \" + type + \" to run on the \\\"\" + match.route.id + \"\\\" route\");\n result = await Promise.race([handler({\n request,\n params: match.params,\n context: requestContext\n }), abortPromise]);\n invariant(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 resultType = ResultType.error;\n result = e;\n } finally {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n\n if (isResponse(result)) {\n let status = result.status; // Process redirects\n\n if (redirectStatusCodes.has(status)) {\n let location = result.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\"); // Support relative routing in internal redirects\n\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n let activeMatches = matches.slice(0, matches.indexOf(match) + 1);\n let routePathnames = getPathContributingMatches(activeMatches).map(match => match.pathnameBase);\n let resolvedLocation = resolveTo(location, routePathnames, new URL(request.url).pathname);\n invariant(createPath(resolvedLocation), \"Unable to resolve redirect location: \" + location); // Prepend the basename to the redirect location if we have one\n\n if (basename) {\n let path = resolvedLocation.pathname;\n resolvedLocation.pathname = path === \"/\" ? basename : joinPaths([basename, path]);\n }\n\n location = createPath(resolvedLocation);\n } else if (!isStaticRequest) {\n // Strip off the protocol+origin for same-origin absolute redirects.\n // If this is a static reques, we can let it go back to the browser\n // as-is\n let currentUrl = new URL(request.url);\n let url = location.startsWith(\"//\") ? new URL(currentUrl.protocol + location) : new URL(location);\n\n if (url.origin === currentUrl.origin) {\n location = url.pathname + url.search + url.hash;\n }\n } // Don't process redirects in the router during static requests requests.\n // Instead, throw the Response and let the server handle it with an HTTP\n // redirect. We also update the Location header in place in this flow so\n // basename and relative routing is taken into account\n\n\n if (isStaticRequest) {\n result.headers.set(\"Location\", location);\n throw result;\n }\n\n return {\n type: ResultType.redirect,\n status,\n location,\n revalidate: result.headers.get(\"X-Remix-Revalidate\") !== null\n };\n } // For SSR single-route requests, we want to hand Responses back directly\n // without unwrapping. We do this with the QueryRouteResponse wrapper\n // interface so we can know whether it was returned or thrown\n\n\n if (isRouteRequest) {\n // eslint-disable-next-line no-throw-literal\n throw {\n type: resultType || ResultType.data,\n response: result\n };\n }\n\n let data;\n let contentType = result.headers.get(\"Content-Type\"); // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n data = await result.json();\n } else {\n data = await result.text();\n }\n\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: new ErrorResponse(status, result.statusText, data),\n headers: result.headers\n };\n }\n\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: result\n };\n }\n\n if (result instanceof DeferredData) {\n return {\n type: ResultType.deferred,\n deferredData: result\n };\n }\n\n return {\n type: ResultType.data,\n data: result\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)\n\n\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType,\n formData\n } = submission;\n init.method = formMethod.toUpperCase();\n init.body = formEncType === \"application/x-www-form-urlencoded\" ? convertFormDataToSearchParams(formData) : formData;\n } // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n\n\n return new Request(url, init);\n}\n\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n\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, value instanceof File ? value.name : value);\n }\n\n return searchParams;\n}\n\nfunction processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds) {\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 = {}; // Process loader results into state.loaderData/state.errors\n\n results.forEach((result, index) => {\n let id = matchesToLoad[index].route.id;\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n\n if (isErrorResult(result)) {\n // Look upwards from the matched route for the closest ancestor\n // error boundary, defaulting to the root match\n let boundaryMatch = findNearestBoundary(matches, id);\n let error = result.error; // 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\n if (pendingError) {\n error = Object.values(pendingError)[0];\n pendingError = undefined;\n }\n\n errors = errors || {}; // Prefer higher error values if lower errors bubble to the same boundary\n\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n } // Clear our any prior loaderData for the throwing route\n\n\n loaderData[id] = undefined; // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\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 } 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\n\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n\n if (result.headers) {\n loaderHeaders[id] = result.headers;\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\n if (pendingError) {\n errors = pendingError;\n loaderData[Object.keys(pendingError)[0]] = undefined;\n }\n\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\n\nfunction processLoaderData(state, matches, matchesToLoad, results, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds); // Process results from our revalidating fetchers\n\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index]; // Process fetcher non-redirect errors\n\n if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match.route.id);\n\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\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 = {\n state: \"idle\",\n data: result.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n }\n }\n\n return {\n loaderData,\n errors\n };\n}\n\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n\n for (let match of matches) {\n let id = match.route.id;\n\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined) {\n mergedLoaderData[id] = loaderData[id];\n }\n\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n\n return mergedLoaderData;\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\n\n\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}\n\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = 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}\n\nfunction getInternalRouterError(status, _temp4) {\n let {\n pathname,\n routeId,\n method,\n type\n } = _temp4 === void 0 ? {} : _temp4;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n\n if (status === 400) {\n statusText = \"Bad Request\";\n\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 }\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\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\n return new ErrorResponse(status || 500, statusText, new Error(errorMessage), true);\n} // Find any returned redirect errors, starting from the lowest match\n\n\nfunction findRedirect(results) {\n for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n\n if (isRedirectResult(result)) {\n return result;\n }\n }\n}\n\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\n\nfunction isHashChangeOnly(a, b) {\n return a.pathname === b.pathname && a.search === b.search && a.hash !== b.hash;\n}\n\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\n\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\n\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\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}\n\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\n\nfunction isQueryRouteResponse(obj) {\n return obj && isResponse(obj.response) && (obj.type === ResultType.data || ResultType.error);\n}\n\nfunction isValidMethod(method) {\n return validRequestMethods.has(method);\n}\n\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method);\n}\n\nasync function resolveDeferredResults(currentMatches, matchesToLoad, results, signal, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\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\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 await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\n }\n });\n }\n }\n}\n\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n\n let aborted = await result.deferredData.resolveData(signal);\n\n if (aborted) {\n return;\n }\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\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\n\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n} // Note: This should match the format exported by useMatches, so if you change\n// this please also change that :) Eventually we'll DRY this up\n\n\nfunction createUseMatchesMatch(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}\n\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n\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 } // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n\n\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n} //#endregion\n\nexport { AbortedDeferredError, Action, ErrorResponse, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, invariant, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, resolvePath, resolveTo, stripBasename, warning };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.8.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 */\nimport { invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, warning, resolveTo, parsePath, matchRoutes, Action, isRouteErrorResponse, createMemoryHistory, stripBasename, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from '@remix-run/router';\nimport * as React from 'react';\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\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n\nfunction isPolyfill(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nconst is = typeof Object.is === \"function\" ? Object.is : isPolyfill; // Intentionally not using named imports because Rollup uses dynamic\n// dispatch for CommonJS interop named imports.\n\nconst {\n useState,\n useEffect,\n useLayoutEffect,\n useDebugValue\n} = React;\nlet didWarnOld18Alpha = false;\nlet didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!didWarnOld18Alpha) {\n if (\"startTransition\" in React) {\n didWarnOld18Alpha = true;\n console.error(\"You are using an outdated, pre-release alpha of React 18 that \" + \"does not support useSyncExternalStore. The \" + \"use-sync-external-store shim will not work correctly. Upgrade \" + \"to a newer pre-release.\");\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n const value = getSnapshot();\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!didWarnUncachedGetSnapshot) {\n const cachedValue = getSnapshot();\n\n if (!is(value, cachedValue)) {\n console.error(\"The result of getSnapshot should be cached to avoid an infinite loop\");\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n const [{\n inst\n }, forceUpdate] = useState({\n inst: {\n value,\n getSnapshot\n }\n }); // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n useLayoutEffect(() => {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst\n });\n } // eslint-disable-next-line react-hooks/exhaustive-deps\n\n }, [subscribe, value, getSnapshot]);\n useEffect(() => {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst\n });\n }\n\n const handleStoreChange = () => {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange); // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n const latestGetSnapshot = inst.getSnapshot;\n const prevValue = inst.value;\n\n try {\n const nextValue = latestGetSnapshot();\n return !is(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\n/**\n * Inlined into the react-router repo since use-sync-external-store does not\n * provide a UMD-compatible package, so we need this to be able to distribute\n * UMD react-router bundles\n */\nconst canUseDOM = !!(typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.document.createElement !== \"undefined\");\nconst isServerEnvironment = !canUseDOM;\nconst shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;\nconst useSyncExternalStore = \"useSyncExternalStore\" in React ? (module => module.useSyncExternalStore)(React) : shim;\n\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\n\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\n\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\n\nconst LocationContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\n\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: []\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\n\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/hooks/use-href\n */\n\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname; // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n/**\n * Returns true if this component is a descendant of a .\n *\n * @see https://reactrouter.com/hooks/use-in-router-context\n */\n\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/hooks/use-location\n */\n\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/hooks/use-navigation-type\n */\n\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * .\n *\n * @see https://reactrouter.com/hooks/use-match\n */\n\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);\n}\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\n/**\n * Returns an imperative method for changing the location. Used by s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/hooks/use-navigate\n */\nfunction useNavigate() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));\n let activeRef = React.useRef(false);\n React.useEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(activeRef.current, \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\") : void 0;\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\"); // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history. If this is a root navigation, then we\n // navigate to the raw basename which allows the basename to have full\n // control over the presence of a trailing slash on root links\n\n if (basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/hooks/use-outlet-context\n */\n\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by to render child routes.\n *\n * @see https://reactrouter.com/hooks/use-outlet\n */\n\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n\n return outlet;\n}\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/hooks/use-params\n */\n\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/hooks/use-resolved-path\n */\n\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an to render their child route's\n * element.\n *\n * @see https://reactrouter.com/hooks/use-routes\n */\n\nfunction useRoutes(routes, locationArg) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let dataRouterStateContext = React.useContext(DataRouterStateContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under ) but the \") + \"parent route path has no trailing \\\"*\\\". This means if you navigate \" + \"deeper, the parent won't match anymore and therefore the child \" + \"routes will never render.\\n\\n\" + (\"Please change the parent to .\"));\n }\n\n let locationFromContext = useLocation();\n let location;\n\n if (locationArg) {\n var _parsedLocationArg$pa;\n\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n\n let pathname = location.pathname || \"/\";\n let remainingPathname = parentPathnameBase === \"/\" ? pathname : pathname.slice(parentPathnameBase.length) || \"/\";\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? warning(matches == null || matches[matches.length - 1].route.element !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.hash + \"\\\" does not have an element. \" + \"This means it will render an with a null value by default resulting in an \\\"empty\\\" page.\") : void 0;\n }\n\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase, // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase, // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterStateContext || undefined); // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n\n\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n\n return renderedMatches;\n}\n\nfunction DefaultErrorElement() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n\n if (process.env.NODE_ENV !== \"production\") {\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own\\xA0\", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" props on\\xA0\", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"\")));\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\n\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n error: props.error\n };\n }\n\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location) {\n return {\n error: props.error,\n location: props.location\n };\n } // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n\n\n return {\n error: props.error || state.error,\n location: state.location\n };\n }\n\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n\n render() {\n return this.state.error ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n\n}\n\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext); // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && match.route.errorElement) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\n\nfunction _renderMatches(matches, parentMatches, dataRouterState) {\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n\n if (matches == null) {\n if (dataRouterState != null && dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n\n let renderedMatches = matches; // If we have data errors, trim matches to the highest error boundary\n\n let errors = dataRouterState == null ? void 0 : dataRouterState.errors;\n\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Could not find a matching route for the current errors: \" + errors) : invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null; // Only data routers handle errors\n\n let errorElement = dataRouterState ? match.route.errorElement || /*#__PURE__*/React.createElement(DefaultErrorElement, null) : null;\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n\n let getChildren = () => /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches\n }\n }, error ? errorElement : match.route.element !== undefined ? match.route.element : outlet); // Only wrap in an error boundary within data router usages when we have an\n // errorElement on this route. Otherwise let it bubble up to an ancestor\n // errorElement\n\n\n return dataRouterState && (match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook;\n\n(function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n})(DataRouterHook || (DataRouterHook = {}));\n\nvar DataRouterStateHook;\n\n(function (DataRouterStateHook) {\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n})(DataRouterStateHook || (DataRouterStateHook = {}));\n\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/routers/picking-a-router.\";\n}\n\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;\n return ctx;\n}\n\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;\n return state;\n}\n\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;\n return route;\n}\n\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : invariant(false) : void 0;\n return thisRoute.route.id;\n}\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\n\n\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\n\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return {\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n };\n}\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\n\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(match => {\n let {\n pathname,\n params\n } = match; // Note: This structure matches that created by createUseMatchesMatch\n // in the @remix-run/router , so if you change this please also change\n // that :) Eventually we'll DRY this up\n\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id],\n handle: match.route.handle\n };\n }), [matches, loaderData]);\n}\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\n\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n\n return state.loaderData[routeId];\n}\n/**\n * Returns the loaderData for the given routeId\n */\n\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n/**\n * Returns the action data for the nearest ancestor Route action\n */\n\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"useActionData must be used inside a RouteContext\") : invariant(false) : void 0;\n return Object.values((state == null ? void 0 : state.actionData) || {})[0];\n}\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * errorElement to display a proper error message.\n */\n\nfunction useRouteError() {\n var _state$errors;\n\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError); // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n\n if (error) {\n return error;\n } // Otherwise look for errors from our data router state\n\n\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n/**\n * Returns the happy-path data from the nearest ancestor value\n */\n\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n/**\n * Returns the error from the nearest ancestor value\n */\n\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\n\nfunction useBlocker(shouldBlock) {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let [blockerKey] = React.useState(() => String(++blockerId));\n let blockerFunction = React.useCallback(args => {\n return typeof shouldBlock === \"function\" ? !!shouldBlock(args) : !!shouldBlock;\n }, [shouldBlock]);\n let blocker = router.getBlocker(blockerKey, blockerFunction); // Cleanup on unmount\n\n React.useEffect(() => () => router.deleteBlocker(blockerKey), [router, blockerKey]);\n return blocker;\n}\nconst alreadyWarned = {};\n\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n process.env.NODE_ENV !== \"production\" ? warning(false, message) : void 0;\n }\n}\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router\n } = _ref;\n // Sync router state to our component state to force re-renders\n let state = useSyncExternalStore(router.subscribe, () => router.state, // We have to provide this so React@18 doesn't complain during hydration,\n // but we pass our serialized hydration data into the router so state here\n // is already synced with what the server saw\n () => router.state);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\"; // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a