{"version":3,"file":"application.fcb0da16.js","sources":["../../../node_modules/scheduler/cjs/scheduler.production.min.js","../../../node_modules/scheduler/index.js","../../../node_modules/react-dom/cjs/react-dom.production.min.js","../../../node_modules/react-dom/index.js","../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../node_modules/history/index.js","../../../node_modules/react-router/index.js","../../../node_modules/react-router-dom/index.js","../../../node_modules/@tanstack/query-core/build/lib/subscribable.esm.js","../../../node_modules/@tanstack/query-core/build/lib/utils.esm.js","../../../node_modules/@tanstack/query-core/build/lib/focusManager.esm.js","../../../node_modules/@tanstack/query-core/build/lib/onlineManager.esm.js","../../../node_modules/@tanstack/query-core/build/lib/retryer.esm.js","../../../node_modules/@tanstack/query-core/build/lib/logger.esm.js","../../../node_modules/@tanstack/query-core/build/lib/notifyManager.esm.js","../../../node_modules/@tanstack/query-core/build/lib/removable.esm.js","../../../node_modules/@tanstack/query-core/build/lib/query.esm.js","../../../node_modules/@tanstack/query-core/build/lib/queryCache.esm.js","../../../node_modules/@tanstack/query-core/build/lib/mutation.esm.js","../../../node_modules/@tanstack/query-core/build/lib/mutationCache.esm.js","../../../node_modules/@tanstack/query-core/build/lib/infiniteQueryBehavior.esm.js","../../../node_modules/@tanstack/query-core/build/lib/queryClient.esm.js","../../../node_modules/@tanstack/query-core/build/lib/queryObserver.esm.js","../../../node_modules/@tanstack/query-core/build/lib/infiniteQueryObserver.esm.js","../../../node_modules/@tanstack/query-core/build/lib/mutationObserver.esm.js","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../../../node_modules/use-sync-external-store/shim/index.js","../../../node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.esm.js","../../../node_modules/@tanstack/react-query/build/lib/QueryClientProvider.esm.js","../../../node_modules/@tanstack/react-query/build/lib/isRestoring.esm.js","../../../node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.esm.js","../../../node_modules/@tanstack/react-query/build/lib/utils.esm.js","../../../node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.esm.js","../../../node_modules/@tanstack/react-query/build/lib/suspense.esm.js","../../../node_modules/@tanstack/react-query/build/lib/useBaseQuery.esm.js","../../../node_modules/@tanstack/react-query/build/lib/useQuery.esm.js","../../../node_modules/@tanstack/react-query/build/lib/useMutation.esm.js","../../../node_modules/@tanstack/react-query/build/lib/useInfiniteQuery.esm.js","../../../node_modules/clsx/dist/clsx.m.js","../../../spa/components/shared/FlashMessage/FlashMessage.tsx","../../../spa/components/shared/FlashMessage/FlashMessageContext.tsx","../../../node_modules/cross-fetch/dist/browser-ponyfill.js","../../../spa/hooks/useCurrentUser.ts","../../../node_modules/react-toastify/dist/react-toastify.esm.js","../../../node_modules/@headlessui/react/dist/utils/ssr.js","../../../node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js","../../../node_modules/@headlessui/react/dist/hooks/use-latest-value.js","../../../node_modules/@headlessui/react/dist/utils/micro-task.js","../../../node_modules/@headlessui/react/dist/utils/disposables.js","../../../node_modules/@headlessui/react/dist/hooks/use-disposables.js","../../../node_modules/@headlessui/react/dist/hooks/use-event.js","../../../node_modules/@headlessui/react/dist/hooks/use-server-handoff-complete.js","../../../node_modules/@headlessui/react/dist/hooks/use-id.js","../../../node_modules/@headlessui/react/dist/utils/match.js","../../../node_modules/@headlessui/react/dist/utils/owner.js","../../../node_modules/@headlessui/react/dist/utils/focus-management.js","../../../node_modules/@headlessui/react/dist/hooks/use-document-event.js","../../../node_modules/@headlessui/react/dist/hooks/use-outside-click.js","../../../node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js","../../../node_modules/@headlessui/react/dist/hooks/use-sync-refs.js","../../../node_modules/@headlessui/react/dist/hooks/use-tree-walker.js","../../../node_modules/@headlessui/react/dist/utils/calculate-active-index.js","../../../node_modules/@headlessui/react/dist/utils/render.js","../../../node_modules/@headlessui/react/dist/utils/bugs.js","../../../node_modules/@headlessui/react/dist/utils/form.js","../../../node_modules/@headlessui/react/dist/internal/hidden.js","../../../node_modules/@headlessui/react/dist/internal/open-closed.js","../../../node_modules/@headlessui/react/dist/components/keyboard.js","../../../node_modules/@headlessui/react/dist/hooks/use-controllable.js","../../../node_modules/@headlessui/react/dist/hooks/use-watch.js","../../../node_modules/@headlessui/react/dist/hooks/use-window-event.js","../../../node_modules/@headlessui/react/dist/hooks/use-tab-direction.js","../../../node_modules/@headlessui/react/dist/hooks/use-is-mounted.js","../../../node_modules/@headlessui/react/dist/hooks/use-owner.js","../../../node_modules/@headlessui/react/dist/hooks/use-event-listener.js","../../../node_modules/@headlessui/react/dist/components/focus-trap/focus-trap.js","../../../node_modules/@headlessui/react/dist/hooks/use-inert-others.js","../../../node_modules/@headlessui/react/dist/internal/portal-force-root.js","../../../node_modules/@headlessui/react/dist/components/portal/portal.js","../../../node_modules/@headlessui/react/dist/components/description/description.js","../../../node_modules/@headlessui/react/dist/internal/stack-context.js","../../../node_modules/@headlessui/react/dist/utils/platform.js","../../../node_modules/@headlessui/react/dist/components/dialog/dialog.js","../../../node_modules/@headlessui/react/dist/components/disclosure/disclosure.js","../../../node_modules/@headlessui/react/dist/components/menu/menu.js","../../../node_modules/@headlessui/react/dist/hooks/use-flags.js","../../../node_modules/@headlessui/react/dist/components/label/label.js","../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.js","../../../node_modules/@headlessui/react/dist/components/switch/switch.js","../../../node_modules/@headlessui/react/dist/utils/once.js","../../../node_modules/@headlessui/react/dist/components/transitions/utils/transition.js","../../../node_modules/@headlessui/react/dist/hooks/use-transition.js","../../../node_modules/@headlessui/react/dist/components/transitions/transition.js","../../../node_modules/@heroicons/react/outline/esm/ArrowsExpandIcon.js","../../../node_modules/@heroicons/react/outline/esm/InformationCircleIcon.js","../../../node_modules/@heroicons/react/outline/esm/MenuIcon.js","../../../node_modules/@heroicons/react/outline/esm/PencilAltIcon.js","../../../node_modules/@heroicons/react/outline/esm/XIcon.js","../../../node_modules/ramda/es/internal/_isPlaceholder.js","../../../node_modules/ramda/es/internal/_curry1.js","../../../node_modules/ramda/es/internal/_curry2.js","../../../node_modules/ramda/es/internal/_arity.js","../../../node_modules/ramda/es/internal/_curryN.js","../../../node_modules/ramda/es/curryN.js","../../../node_modules/ramda/es/internal/_curry3.js","../../../node_modules/ramda/es/internal/_isArray.js","../../../node_modules/ramda/es/internal/_isTransformer.js","../../../node_modules/ramda/es/internal/_dispatchable.js","../../../node_modules/ramda/es/internal/_reduced.js","../../../node_modules/ramda/es/internal/_xfBase.js","../../../node_modules/ramda/es/internal/_map.js","../../../node_modules/ramda/es/internal/_isString.js","../../../node_modules/ramda/es/internal/_isArrayLike.js","../../../node_modules/ramda/es/internal/_xwrap.js","../../../node_modules/ramda/es/bind.js","../../../node_modules/ramda/es/internal/_reduce.js","../../../node_modules/ramda/es/internal/_xmap.js","../../../node_modules/ramda/es/internal/_has.js","../../../node_modules/ramda/es/internal/_isArguments.js","../../../node_modules/ramda/es/keys.js","../../../node_modules/ramda/es/map.js","../../../node_modules/ramda/es/internal/_isInteger.js","../../../node_modules/ramda/es/nth.js","../../../node_modules/ramda/es/prop.js","../../../node_modules/ramda/es/ascend.js","../../../node_modules/ramda/es/internal/_makeFlat.js","../../../node_modules/ramda/es/internal/_forceReduced.js","../../../node_modules/ramda/es/internal/_flatCat.js","../../../node_modules/ramda/es/internal/_xchain.js","../../../node_modules/ramda/es/chain.js","../../../node_modules/ramda/es/internal/_cloneRegExp.js","../../../node_modules/ramda/es/type.js","../../../node_modules/ramda/es/internal/_clone.js","../../../node_modules/ramda/es/clone.js","../../../node_modules/ramda/es/comparator.js","../../../node_modules/ramda/es/internal/_checkForMethod.js","../../../node_modules/ramda/es/slice.js","../../../node_modules/ramda/es/internal/_arrayFromIterator.js","../../../node_modules/ramda/es/internal/_includesWith.js","../../../node_modules/ramda/es/internal/_functionName.js","../../../node_modules/ramda/es/internal/_objectIs.js","../../../node_modules/ramda/es/internal/_equals.js","../../../node_modules/ramda/es/equals.js","../../../node_modules/ramda/es/internal/_isObject.js","../../../node_modules/ramda/es/internal/_xreduceBy.js","../../../node_modules/ramda/es/reduceBy.js","../../../node_modules/ramda/es/differenceWith.js","../../../node_modules/ramda/es/or.js","../../../node_modules/ramda/es/internal/_isTypedArray.js","../../../node_modules/ramda/es/empty.js","../../../node_modules/ramda/es/internal/_xfind.js","../../../node_modules/ramda/es/find.js","../../../node_modules/ramda/es/groupBy.js","../../../node_modules/ramda/es/isEmpty.js","../../../node_modules/ramda/es/internal/_isNumber.js","../../../node_modules/ramda/es/propEq.js","../../../node_modules/ramda/es/range.js","../../../node_modules/ramda/es/sort.js","../../../node_modules/ramda/es/sortWith.js","../../../node_modules/ramda/es/splitEvery.js","../../../spa/utils/network/denormalizer/index.ts","../../../spa/utils/api.ts","../../../spa/hooks/useBanner.ts","../../../node_modules/tslib/tslib.es6.js","../../../node_modules/react-fast-compare/index.js","../../../node_modules/deepmerge/dist/es.js","../../../node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/react-is/index.js","../../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../node_modules/prop-types/lib/ReactPropTypesSecret.js","../../../node_modules/prop-types/factoryWithThrowingShims.js","../../../node_modules/prop-types/index.js","../../../node_modules/gud/index.js","../../../node_modules/fbjs/lib/emptyFunction.js","../../../node_modules/fbjs/lib/warning.js","../../../node_modules/create-react-context/lib/implementation.js","../../../node_modules/create-react-context/lib/index.js","../../../node_modules/tiny-warning/dist/tiny-warning.esm.js","../../../node_modules/lodash-es/_listCacheClear.js","../../../node_modules/lodash-es/eq.js","../../../node_modules/lodash-es/_assocIndexOf.js","../../../node_modules/lodash-es/_listCacheDelete.js","../../../node_modules/lodash-es/_listCacheGet.js","../../../node_modules/lodash-es/_listCacheHas.js","../../../node_modules/lodash-es/_listCacheSet.js","../../../node_modules/lodash-es/_ListCache.js","../../../node_modules/lodash-es/_stackClear.js","../../../node_modules/lodash-es/_stackDelete.js","../../../node_modules/lodash-es/_stackGet.js","../../../node_modules/lodash-es/_stackHas.js","../../../node_modules/lodash-es/_freeGlobal.js","../../../node_modules/lodash-es/_root.js","../../../node_modules/lodash-es/_Symbol.js","../../../node_modules/lodash-es/_getRawTag.js","../../../node_modules/lodash-es/_objectToString.js","../../../node_modules/lodash-es/_baseGetTag.js","../../../node_modules/lodash-es/isObject.js","../../../node_modules/lodash-es/isFunction.js","../../../node_modules/lodash-es/_coreJsData.js","../../../node_modules/lodash-es/_isMasked.js","../../../node_modules/lodash-es/_toSource.js","../../../node_modules/lodash-es/_baseIsNative.js","../../../node_modules/lodash-es/_getValue.js","../../../node_modules/lodash-es/_getNative.js","../../../node_modules/lodash-es/_Map.js","../../../node_modules/lodash-es/_nativeCreate.js","../../../node_modules/lodash-es/_hashClear.js","../../../node_modules/lodash-es/_hashDelete.js","../../../node_modules/lodash-es/_hashGet.js","../../../node_modules/lodash-es/_hashHas.js","../../../node_modules/lodash-es/_hashSet.js","../../../node_modules/lodash-es/_Hash.js","../../../node_modules/lodash-es/_mapCacheClear.js","../../../node_modules/lodash-es/_isKeyable.js","../../../node_modules/lodash-es/_getMapData.js","../../../node_modules/lodash-es/_mapCacheDelete.js","../../../node_modules/lodash-es/_mapCacheGet.js","../../../node_modules/lodash-es/_mapCacheHas.js","../../../node_modules/lodash-es/_mapCacheSet.js","../../../node_modules/lodash-es/_MapCache.js","../../../node_modules/lodash-es/_stackSet.js","../../../node_modules/lodash-es/_Stack.js","../../../node_modules/lodash-es/_arrayEach.js","../../../node_modules/lodash-es/_defineProperty.js","../../../node_modules/lodash-es/_baseAssignValue.js","../../../node_modules/lodash-es/_assignValue.js","../../../node_modules/lodash-es/_copyObject.js","../../../node_modules/lodash-es/_baseTimes.js","../../../node_modules/lodash-es/isObjectLike.js","../../../node_modules/lodash-es/_baseIsArguments.js","../../../node_modules/lodash-es/isArguments.js","../../../node_modules/lodash-es/isArray.js","../../../node_modules/lodash-es/stubFalse.js","../../../node_modules/lodash-es/isBuffer.js","../../../node_modules/lodash-es/_isIndex.js","../../../node_modules/lodash-es/isLength.js","../../../node_modules/lodash-es/_baseIsTypedArray.js","../../../node_modules/lodash-es/_baseUnary.js","../../../node_modules/lodash-es/_nodeUtil.js","../../../node_modules/lodash-es/isTypedArray.js","../../../node_modules/lodash-es/_arrayLikeKeys.js","../../../node_modules/lodash-es/_isPrototype.js","../../../node_modules/lodash-es/_overArg.js","../../../node_modules/lodash-es/_nativeKeys.js","../../../node_modules/lodash-es/_baseKeys.js","../../../node_modules/lodash-es/isArrayLike.js","../../../node_modules/lodash-es/keys.js","../../../node_modules/lodash-es/_baseAssign.js","../../../node_modules/lodash-es/_nativeKeysIn.js","../../../node_modules/lodash-es/_baseKeysIn.js","../../../node_modules/lodash-es/keysIn.js","../../../node_modules/lodash-es/_baseAssignIn.js","../../../node_modules/lodash-es/_cloneBuffer.js","../../../node_modules/lodash-es/_copyArray.js","../../../node_modules/lodash-es/_arrayFilter.js","../../../node_modules/lodash-es/stubArray.js","../../../node_modules/lodash-es/_getSymbols.js","../../../node_modules/lodash-es/_copySymbols.js","../../../node_modules/lodash-es/_arrayPush.js","../../../node_modules/lodash-es/_getPrototype.js","../../../node_modules/lodash-es/_getSymbolsIn.js","../../../node_modules/lodash-es/_copySymbolsIn.js","../../../node_modules/lodash-es/_baseGetAllKeys.js","../../../node_modules/lodash-es/_getAllKeys.js","../../../node_modules/lodash-es/_getAllKeysIn.js","../../../node_modules/lodash-es/_DataView.js","../../../node_modules/lodash-es/_Promise.js","../../../node_modules/lodash-es/_Set.js","../../../node_modules/lodash-es/_WeakMap.js","../../../node_modules/lodash-es/_getTag.js","../../../node_modules/lodash-es/_initCloneArray.js","../../../node_modules/lodash-es/_Uint8Array.js","../../../node_modules/lodash-es/_cloneArrayBuffer.js","../../../node_modules/lodash-es/_cloneDataView.js","../../../node_modules/lodash-es/_cloneRegExp.js","../../../node_modules/lodash-es/_cloneSymbol.js","../../../node_modules/lodash-es/_cloneTypedArray.js","../../../node_modules/lodash-es/_initCloneByTag.js","../../../node_modules/lodash-es/_baseCreate.js","../../../node_modules/lodash-es/_initCloneObject.js","../../../node_modules/lodash-es/_baseIsMap.js","../../../node_modules/lodash-es/isMap.js","../../../node_modules/lodash-es/_baseIsSet.js","../../../node_modules/lodash-es/isSet.js","../../../node_modules/lodash-es/_baseClone.js","../../../node_modules/lodash-es/clone.js","../../../node_modules/lodash-es/_arrayMap.js","../../../node_modules/lodash-es/isSymbol.js","../../../node_modules/lodash-es/memoize.js","../../../node_modules/lodash-es/_memoizeCapped.js","../../../node_modules/lodash-es/_stringToPath.js","../../../node_modules/lodash-es/_toKey.js","../../../node_modules/lodash-es/_baseToString.js","../../../node_modules/lodash-es/toString.js","../../../node_modules/lodash-es/toPath.js","../../../node_modules/lodash-es/cloneDeep.js","../../../node_modules/formik/dist/formik.esm.js","../../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../../node_modules/lodash-es/_baseHas.js","../../../node_modules/lodash-es/_isKey.js","../../../node_modules/lodash-es/_castPath.js","../../../node_modules/lodash-es/_hasPath.js","../../../node_modules/lodash-es/has.js","../../../node_modules/lodash-es/cloneDeepWith.js","../../../node_modules/lodash-es/isString.js","../../../node_modules/lodash-es/_iteratorToArray.js","../../../node_modules/lodash-es/_mapToArray.js","../../../node_modules/lodash-es/_setToArray.js","../../../node_modules/lodash-es/_asciiToArray.js","../../../node_modules/lodash-es/_hasUnicode.js","../../../node_modules/lodash-es/_unicodeToArray.js","../../../node_modules/lodash-es/_stringToArray.js","../../../node_modules/lodash-es/_baseValues.js","../../../node_modules/lodash-es/values.js","../../../node_modules/lodash-es/toArray.js","../../../node_modules/yup/es/util/printValue.js","../../../node_modules/yup/es/locale.js","../../../node_modules/yup/es/util/isSchema.js","../../../node_modules/yup/es/Condition.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../node_modules/synchronous-promise/index.js","../../../node_modules/yup/es/ValidationError.js","../../../node_modules/yup/es/util/runValidations.js","../../../node_modules/yup/es/util/prependDeep.js","../../../node_modules/lodash-es/_createBaseFor.js","../../../node_modules/lodash-es/_baseFor.js","../../../node_modules/lodash-es/_baseForOwn.js","../../../node_modules/lodash-es/_setCacheAdd.js","../../../node_modules/lodash-es/_setCacheHas.js","../../../node_modules/lodash-es/_SetCache.js","../../../node_modules/lodash-es/_arraySome.js","../../../node_modules/lodash-es/_cacheHas.js","../../../node_modules/lodash-es/_equalArrays.js","../../../node_modules/lodash-es/_equalByTag.js","../../../node_modules/lodash-es/_equalObjects.js","../../../node_modules/lodash-es/_baseIsEqualDeep.js","../../../node_modules/lodash-es/_baseIsEqual.js","../../../node_modules/lodash-es/_baseIsMatch.js","../../../node_modules/lodash-es/_isStrictComparable.js","../../../node_modules/lodash-es/_getMatchData.js","../../../node_modules/lodash-es/_matchesStrictComparable.js","../../../node_modules/lodash-es/_baseMatches.js","../../../node_modules/lodash-es/_baseGet.js","../../../node_modules/lodash-es/get.js","../../../node_modules/lodash-es/_baseHasIn.js","../../../node_modules/lodash-es/hasIn.js","../../../node_modules/lodash-es/_baseMatchesProperty.js","../../../node_modules/lodash-es/identity.js","../../../node_modules/lodash-es/_baseProperty.js","../../../node_modules/lodash-es/_basePropertyDeep.js","../../../node_modules/lodash-es/property.js","../../../node_modules/lodash-es/_baseIteratee.js","../../../node_modules/lodash-es/mapValues.js","../../../node_modules/property-expr/index.js","../../../node_modules/yup/es/Reference.js","../../../node_modules/yup/es/util/createValidation.js","../../../node_modules/yup/es/util/reach.js","../../../node_modules/yup/es/mixed.js","../../../node_modules/yup/es/util/inherits.js","../../../node_modules/yup/es/boolean.js","../../../node_modules/yup/es/util/isAbsent.js","../../../node_modules/yup/es/string.js","../../../node_modules/yup/es/number.js","../../../node_modules/yup/es/util/isodate.js","../../../node_modules/yup/es/date.js","../../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js","../../../node_modules/lodash-es/_arrayReduce.js","../../../node_modules/lodash-es/_basePropertyOf.js","../../../node_modules/lodash-es/_deburrLetter.js","../../../node_modules/lodash-es/deburr.js","../../../node_modules/lodash-es/_asciiWords.js","../../../node_modules/lodash-es/_hasUnicodeWord.js","../../../node_modules/lodash-es/_unicodeWords.js","../../../node_modules/lodash-es/words.js","../../../node_modules/lodash-es/_createCompounder.js","../../../node_modules/lodash-es/snakeCase.js","../../../node_modules/lodash-es/_baseSlice.js","../../../node_modules/lodash-es/_castSlice.js","../../../node_modules/lodash-es/_createCaseFirst.js","../../../node_modules/lodash-es/upperFirst.js","../../../node_modules/lodash-es/capitalize.js","../../../node_modules/lodash-es/camelCase.js","../../../node_modules/lodash-es/mapKeys.js","../../../node_modules/toposort/index.js","../../../node_modules/yup/es/util/sortFields.js","../../../node_modules/yup/es/util/sortByKeyOrder.js","../../../node_modules/yup/es/util/makePath.js","../../../node_modules/yup/es/object.js","../../../node_modules/yup/es/array.js","../../../node_modules/yup/es/index.js","../../../spa/components/shared/Checkbox/Checkbox.tsx","../../../node_modules/react-laag/dist/react-laag.esm.js","../../../spa/components/shared/Dropdown/Dropdown.tsx","../../../spa/components/shared/SelectGroup/SelectGroup.tsx","../../../spa/components/shared/Select/Select.tsx","../../../node_modules/slate/node_modules/is-plain-object/dist/is-plain-object.mjs","../../../node_modules/immer/dist/immer.esm.js","../../../node_modules/slate/dist/index.es.js","../../../node_modules/direction/index.js","../../../node_modules/lodash/isObject.js","../../../node_modules/lodash/_freeGlobal.js","../../../node_modules/lodash/_root.js","../../../node_modules/lodash/now.js","../../../node_modules/lodash/_trimmedEndIndex.js","../../../node_modules/lodash/_baseTrim.js","../../../node_modules/lodash/_Symbol.js","../../../node_modules/lodash/_getRawTag.js","../../../node_modules/lodash/_objectToString.js","../../../node_modules/lodash/_baseGetTag.js","../../../node_modules/lodash/isObjectLike.js","../../../node_modules/lodash/isSymbol.js","../../../node_modules/lodash/toNumber.js","../../../node_modules/lodash/debounce.js","../../../node_modules/lodash/throttle.js","../../../node_modules/compute-scroll-into-view/dist/index.module.js","../../../node_modules/scroll-into-view-if-needed/es/index.js","../../../node_modules/is-hotkey/lib/index.js","../../../node_modules/slate-react/dist/index.es.js","../../../node_modules/slate-history/node_modules/is-plain-object/dist/is-plain-object.mjs","../../../node_modules/slate-history/dist/index.es.js","../../../spa/components/shared/RichTextEditor/icons.tsx","../../../spa/components/shared/RichTextEditor/plugins/formattable.tsx","../../../node_modules/is-url/index.js","../../../node_modules/escape-html/index.js","../../../node_modules/airbnb-prop-types/build/mocks/index.js","../../../node_modules/airbnb-prop-types/index.js","../../../node_modules/consolidated-events/lib/index.esm.js","../../../node_modules/object-keys/isArguments.js","../../../node_modules/object-keys/implementation.js","../../../node_modules/object-keys/index.js","../../../node_modules/define-properties/index.js","../../../node_modules/function-bind/implementation.js","../../../node_modules/function-bind/index.js","../../../node_modules/call-bind/node_modules/has-symbols/shams.js","../../../node_modules/call-bind/node_modules/has-symbols/index.js","../../../node_modules/has/src/index.js","../../../node_modules/call-bind/node_modules/get-intrinsic/index.js","../../../node_modules/call-bind/index.js","../../../node_modules/has-symbols/shams.js","../../../node_modules/has-symbols/index.js","../../../node_modules/get-intrinsic/index.js","../../../node_modules/es-abstract/5/CheckObjectCoercible.js","../../../node_modules/es-abstract/2021/RequireObjectCoercible.js","../../../node_modules/call-bind/callBound.js","../../../node_modules/object.values/implementation.js","../../../node_modules/object.values/polyfill.js","../../../node_modules/object.values/shim.js","../../../node_modules/object.values/index.js","../../../node_modules/document.contains/implementation.js","../../../node_modules/document.contains/polyfill.js","../../../node_modules/document.contains/shim.js","../../../node_modules/document.contains/index.js","../../../node_modules/react-outside-click-handler/build/OutsideClickHandler.js","../../../node_modules/react-outside-click-handler/index.js","../../../spa/utils/deps/react-outside-click-handler.ts","../../../spa/components/shared/RichTextEditor/plugins/linkable.tsx","../../../spa/components/shared/RichTextEditor/RichTextEditor.tsx","../../../spa/components/App/navigation/SitewideBanner.tsx","../../../spa/images/logo-ac@2x.png","../../../spa/components/App/navigation/AdminCenterNavigation.tsx","../../../spa/images/404.png","../../../spa/components/App/NotFoundPage/NotFoundPage.tsx","../../../spa/utils/network/paramBuilder/index.ts","../../../spa/hooks/useInfiniteQueryResult.ts","../../../spa/hooks/useScrollPosition.ts","../../../spa/components/pages/admin/AdminDashboardPage/Tabs/tabs.tsx","../../../spa/components/pages/admin/AdminDashboardPage/ActivityTitles/ActivityTitles.tsx","../../../spa/utils/string.ts","../../../spa/components/pages/admin/AdminDashboardPage/ActivityList/ActivityList.tsx","../../../spa/components/pages/admin/AdminDashboardPage/AdminDashboardPage.tsx","../../../spa/hooks/useWindowDimensions.ts","../../../spa/components/pages/admin/MediaResourcesPage/Tabs/Tabs.tsx","../../../spa/components/shared/Table/Table.tsx","../../../node_modules/toggle-selection/index.js","../../../node_modules/copy-to-clipboard/index.js","../../../node_modules/react-copy-to-clipboard/lib/Component.js","../../../node_modules/react-copy-to-clipboard/lib/index.js","../../../spa/components/shared/CopyLink/CopyLink.tsx","../../../spa/components/shared/PopoverMenu/PopoverMenu.tsx","../../../spa/components/shared/NoResults/NoResults.tsx","../../../spa/hooks/useToast.tsx","../../../spa/components/pages/admin/MediaResourcesPage/ResourceTable/ResourcesTable.tsx","../../../node_modules/lodash-es/isPlainObject.js","../../../node_modules/formik-latest/dist/formik.esm.js","../../../spa/hooks/useFlashMessage.ts","../../../spa/components/shared/SlideOver/SlideOver.tsx","../../../spa/utils/formatBytes.ts","../../../node_modules/activestorage/app/assets/javascripts/activestorage.js","../../../spa/hooks/useActiveStorage.ts","../../../spa/utils/fileValidator.ts","../../../spa/hooks/useActiveStoragePreview.tsx","../../../spa/components/shared/FilePickerAdmin/FilePickerAdmin.tsx","../../../spa/components/shared/Input/Input.tsx","../../../node_modules/use-debounce/dist/index.module.js","../../../spa/components/shared/FormBlock/FormBlock.tsx","../../../spa/components/shared/RadioButtonGroup/RadioButtonGroup.tsx","../../../spa/components/shared/Modal/Modal.tsx","../../../spa/components/shared/Modal/DeleteConfirmationModal.tsx","../../../spa/components/pages/admin/MediaResourcesPage/UpdateConfirmationModal.tsx","../../../node_modules/lodash/lodash.js","../../../spa/components/pages/admin/MediaResourcesPage/ResourcesForm.tsx","../../../spa/components/shared/Admin/AdminHeader/AdminHeader.tsx","../../../spa/components/pages/admin/MediaResourcesPage/MediaResourcesPage.tsx","../../../spa/components/shared/Tooltip/Tooltip.tsx","../../../node_modules/react-tooltip/node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/react-tooltip/node_modules/uuid/dist/esm-browser/bytesToUuid.js","../../../node_modules/react-tooltip/node_modules/uuid/dist/esm-browser/v4.js","../../../node_modules/react-tooltip/dist/index.es.js","../../../spa/components/shared/Admin/Columns/Columns.tsx","../../../spa/components/shared/ToogleButton/ToggleButton.tsx","../../../spa/components/pages/admin/CentersPage/CentersTable.tsx","../../../spa/components/pages/admin/CentersPage/CenterSkeletonTable.tsx","../../../spa/components/pages/admin/CentersPage/CentersPage.tsx","../../../spa/components/pages/admin/FocusAreasPage/FocusAreaTable.tsx","../../../spa/hooks/useTextareaAutosize.ts","../../../spa/components/shared/Label/Label.tsx","../../../spa/components/pages/admin/FocusAreasPage/UpdateConfirmationModal.tsx","../../../spa/components/pages/admin/FocusAreasPage/FocusSlider.tsx","../../../spa/components/pages/admin/FocusAreasPage/FocusAreaForm.tsx","../../../spa/components/pages/admin/FocusAreasPage/FocusAreasPage.tsx","../../../node_modules/moment/dist/moment.js","../../../node_modules/date-fns/esm/_lib/toInteger/index.js","../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../../node_modules/date-fns/esm/toDate/index.js","../../../node_modules/date-fns/esm/addDays/index.js","../../../node_modules/date-fns/esm/addMonths/index.js","../../../node_modules/date-fns/esm/addMilliseconds/index.js","../../../node_modules/date-fns/esm/addHours/index.js","../../../node_modules/date-fns/esm/_lib/defaultOptions/index.js","../../../node_modules/date-fns/esm/startOfWeek/index.js","../../../node_modules/date-fns/esm/startOfISOWeek/index.js","../../../node_modules/date-fns/esm/getISOWeekYear/index.js","../../../node_modules/date-fns/esm/startOfISOWeekYear/index.js","../../../node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","../../../node_modules/date-fns/esm/startOfDay/index.js","../../../node_modules/date-fns/esm/differenceInCalendarDays/index.js","../../../node_modules/date-fns/esm/addMinutes/index.js","../../../node_modules/date-fns/esm/addWeeks/index.js","../../../node_modules/date-fns/esm/addYears/index.js","../../../node_modules/date-fns/esm/max/index.js","../../../node_modules/date-fns/esm/min/index.js","../../../node_modules/date-fns/esm/compareAsc/index.js","../../../node_modules/date-fns/esm/constants/index.js","../../../node_modules/date-fns/esm/isSameDay/index.js","../../../node_modules/date-fns/esm/isDate/index.js","../../../node_modules/date-fns/esm/isValid/index.js","../../../node_modules/date-fns/esm/differenceInCalendarMonths/index.js","../../../node_modules/date-fns/esm/getQuarter/index.js","../../../node_modules/date-fns/esm/differenceInCalendarYears/index.js","../../../node_modules/date-fns/esm/differenceInMilliseconds/index.js","../../../node_modules/date-fns/esm/_lib/roundingMethods/index.js","../../../node_modules/date-fns/esm/endOfDay/index.js","../../../node_modules/date-fns/esm/endOfMonth/index.js","../../../node_modules/date-fns/esm/isLastDayOfMonth/index.js","../../../node_modules/date-fns/esm/differenceInMonths/index.js","../../../node_modules/date-fns/esm/differenceInSeconds/index.js","../../../node_modules/date-fns/esm/startOfQuarter/index.js","../../../node_modules/date-fns/esm/startOfMonth/index.js","../../../node_modules/date-fns/esm/startOfYear/index.js","../../../node_modules/date-fns/esm/subMilliseconds/index.js","../../../node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js","../../../node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js","../../../node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js","../../../node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js","../../../node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js","../../../node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js","../../../node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js","../../../node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js","../../../node_modules/date-fns/esm/_lib/getUTCWeek/index.js","../../../node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","../../../node_modules/date-fns/esm/_lib/format/lightFormatters/index.js","../../../node_modules/date-fns/esm/_lib/format/formatters/index.js","../../../node_modules/date-fns/esm/_lib/format/longFormatters/index.js","../../../node_modules/date-fns/esm/_lib/protectedTokens/index.js","../../../node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js","../../../node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js","../../../node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js","../../../node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js","../../../node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js","../../../node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js","../../../node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js","../../../node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js","../../../node_modules/date-fns/esm/locale/en-US/_lib/match/index.js","../../../node_modules/date-fns/esm/locale/en-US/index.js","../../../node_modules/date-fns/esm/format/index.js","../../../node_modules/date-fns/esm/_lib/assign/index.js","../../../node_modules/date-fns/esm/_lib/cloneObject/index.js","../../../node_modules/date-fns/esm/formatDistance/index.js","../../../node_modules/date-fns/esm/formatDistanceToNow/index.js","../../../node_modules/date-fns/esm/getDate/index.js","../../../node_modules/date-fns/esm/getDay/index.js","../../../node_modules/date-fns/esm/getDaysInMonth/index.js","../../../node_modules/date-fns/esm/getHours/index.js","../../../node_modules/date-fns/esm/getISOWeek/index.js","../../../node_modules/date-fns/esm/getMinutes/index.js","../../../node_modules/date-fns/esm/getMonth/index.js","../../../node_modules/date-fns/esm/getSeconds/index.js","../../../node_modules/date-fns/esm/getTime/index.js","../../../node_modules/date-fns/esm/getYear/index.js","../../../node_modules/date-fns/esm/isAfter/index.js","../../../node_modules/date-fns/esm/isBefore/index.js","../../../node_modules/date-fns/esm/isEqual/index.js","../../../node_modules/date-fns/esm/parse/_lib/Setter.js","../../../node_modules/date-fns/esm/parse/_lib/Parser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js","../../../node_modules/date-fns/esm/parse/_lib/constants.js","../../../node_modules/date-fns/esm/parse/_lib/utils.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js","../../../node_modules/date-fns/esm/_lib/setUTCWeek/index.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js","../../../node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js","../../../node_modules/date-fns/esm/_lib/setUTCDay/index.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js","../../../node_modules/date-fns/esm/_lib/setUTCISODay/index.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js","../../../node_modules/date-fns/esm/parse/_lib/parsers/index.js","../../../node_modules/date-fns/esm/parse/index.js","../../../node_modules/date-fns/esm/isSameMonth/index.js","../../../node_modules/date-fns/esm/isSameQuarter/index.js","../../../node_modules/date-fns/esm/isSameYear/index.js","../../../node_modules/date-fns/esm/isWithinInterval/index.js","../../../node_modules/date-fns/esm/subDays/index.js","../../../node_modules/date-fns/esm/parseISO/index.js","../../../node_modules/date-fns/esm/setMonth/index.js","../../../node_modules/date-fns/esm/setHours/index.js","../../../node_modules/date-fns/esm/setMinutes/index.js","../../../node_modules/date-fns/esm/setQuarter/index.js","../../../node_modules/date-fns/esm/setSeconds/index.js","../../../node_modules/date-fns/esm/setYear/index.js","../../../node_modules/date-fns/esm/subMonths/index.js","../../../node_modules/date-fns/esm/subWeeks/index.js","../../../node_modules/date-fns/esm/subYears/index.js","../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../../node_modules/redux/es/redux.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/components/Context.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/utils/batch.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/utils/Subscription.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/components/Provider.js","../../../node_modules/react-beautiful-dnd/node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/react-beautiful-dnd/node_modules/react-is/index.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/components/connectAdvanced.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/utils/shallowEqual.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/utils/bindActionCreators.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/connect/wrapMapToProps.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/connect/mapDispatchToProps.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/connect/mapStateToProps.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/connect/mergeProps.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/connect/selectorFactory.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/connect/connect.js","../../../node_modules/react-beautiful-dnd/node_modules/react-redux/es/index.js","../../../node_modules/use-memo-one/dist/use-memo-one.esm.js","../../../node_modules/tiny-invariant/dist/tiny-invariant.esm.js","../../../node_modules/css-box-model/dist/css-box-model.esm.js","../../../node_modules/memoize-one/dist/memoize-one.esm.js","../../../node_modules/raf-schd/dist/raf-schd.esm.js","../../../node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js","../../../node_modules/@heroicons/react/solid/esm/DocumentTextIcon.js","../../../node_modules/@heroicons/react/solid/esm/DotsHorizontalIcon.js","../../../node_modules/@heroicons/react/solid/esm/PencilAltIcon.js","../../../node_modules/@heroicons/react/solid/esm/TrashIcon.js","../../../node_modules/@heroicons/react/solid/esm/ZoomInIcon.js","../../../node_modules/@heroicons/react/solid/esm/ZoomOutIcon.js","../../../spa/components/pages/admin/DailyNewsPage/DailyNewsDetail/NewsItem/NewsItemCard.tsx","../../../spa/hooks/useOptimistic.ts","../../../spa/components/pages/admin/DailyNewsPage/DailyNewsDetail/NewsItem/NewsItemList.tsx","../../../node_modules/classnames/index.js","../../../node_modules/react-onclickoutside/dist/react-onclickoutside.es.js","../../../node_modules/react-popper/lib/esm/Manager.js","../../../node_modules/react-popper/lib/esm/utils.js","../../../node_modules/@popperjs/core/lib/enums.js","../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../node_modules/@popperjs/core/lib/utils/math.js","../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../../node_modules/@popperjs/core/lib/utils/within.js","../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../../node_modules/@popperjs/core/lib/utils/debounce.js","../../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../../node_modules/@popperjs/core/lib/createPopper.js","../../../node_modules/@popperjs/core/lib/popper.js","../../../node_modules/react-popper/node_modules/react-fast-compare/index.js","../../../node_modules/react-popper/lib/esm/usePopper.js","../../../node_modules/react-popper/lib/esm/Popper.js","../../../node_modules/react-popper/lib/esm/Reference.js","../../../node_modules/react-datepicker/dist/es/index.js","../../../spa/components/shared/SearchBar/SearchBar.tsx","../../../spa/components/shared/UserPicker/UserPicker.tsx","../../../spa/components/pages/admin/DailyNewsPage/DailyNewsDetail/NewsItem/NewsItemForm.tsx","../../../spa/components/shared/DatePicker/DatePicker.tsx","../../../spa/components/pages/admin/DailyNewsPage/DailyNewsDetail/DailyNewsDetail.tsx","../../../spa/components/pages/admin/DailyNewsPage/DailyNewsTable/DailyNewsTable.tsx","../../../spa/components/pages/admin/DailyNewsPage/DailyNewsPage.tsx","../../../spa/components/pages/admin/AnnouncementsPage/AnnouncementTable.tsx","../../../spa/components/pages/admin/AnnouncementsPage/AnnouncementForm.tsx","../../../spa/components/pages/admin/AnnouncementsPage/AnnouncementsPage.tsx","../../../spa/components/pages/admin/EventsPage/EventSkeletonContent.tsx","../../../spa/components/pages/admin/EventsPage/EventsTable.tsx","../../../spa/utils/csrf-fetch.ts","../../../spa/components/pages/admin/EventsPage/sortEvents.tsx","../../../spa/components/pages/admin/EventsPage/EventsSlider.tsx","../../../spa/components/pages/admin/EventsPage/UpdateConfirmationModal.tsx","../../../spa/components/pages/admin/EventsPage/ArchiveConfirmationModal.tsx","../../../spa/components/pages/admin/EventsPage/EventsForm.tsx","../../../spa/components/pages/admin/EventsPage/EventsPage.tsx","../../../node_modules/react-autosize-textarea/node_modules/autosize/dist/autosize.js","../../../node_modules/computed-style/dist/computedStyle.commonjs.js","../../../node_modules/line-height/lib/line-height.js","../../../node_modules/react-autosize-textarea/lib/TextareaAutosize.js","../../../node_modules/react-autosize-textarea/lib/index.js","../../../spa/components/shared/TextArea/TextArea.tsx","../../../spa/components/shared/VanityText/VanityText.tsx","../../../spa/components/shared/Admin/SectionGroup/SectionGroup.tsx","../../../spa/components/pages/admin/CentersPage/CentersForm/BasicDetails.tsx","../../../spa/components/pages/admin/CentersPage/CentersForm/Appeareance.tsx","../../../spa/components/shared/Autocomplete/SuggestionsList.tsx","../../../spa/components/shared/Autocomplete/Autocomplete.tsx","../../../spa/components/pages/admin/CentersPage/CentersForm/ContactPoints/ContactPointItem.tsx","../../../spa/components/pages/admin/CentersPage/CentersForm/ContactPoints/ContactPoints.tsx","../../../spa/components/pages/admin/CentersPage/CentersForm/mapCenter.ts","../../../spa/components/shared/Modal/ConfirmationModal.tsx","../../../spa/utils/requestValidation.ts","../../../spa/components/pages/admin/CentersPage/CentersForm/CenterForm.tsx","../../../spa/components/pages/admin/ResearchPage/ResearchCardSkeleton.tsx","../../../spa/components/pages/admin/ResearchPage/ResearchTable.tsx","../../../spa/hooks/useURLFilter.ts","../../../spa/components/shared/Filter/Filter.tsx","../../../spa/components/shared/CheckboxGroup/CheckboxGroup.tsx","../../../spa/components/shared/Pill/Pill.tsx","../../../spa/components/shared/FilterToolbar/FilterToolbar.tsx","../../../spa/components/pages/admin/ResearchPage/ResearchFilter.tsx","../../../spa/components/pages/admin/ResearchPage/ResearchPage.tsx","../../../spa/components/shared/MembersGroup/MembersGroup.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativesTable.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativesSkeletonTable.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativesFilter.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativesPage.tsx","../../../spa/components/pages/admin/ResearchStudiesPage/ResearchStudiesFilter.tsx","../../../spa/components/pages/admin/ResearchStudiesPage/ResearchStudiesRowSkeleton.tsx","../../../spa/components/pages/admin/ResearchStudiesPage/ResearchStudiesTable.tsx","../../../spa/components/pages/admin/ResearchStudiesPage/ResearchStudiesPage.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/SummaryTab/SummaryStatus.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/SummaryTab/SummaryPatientEnrollment.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/SummaryTab/CurrentClinicalTrials.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/SummaryTab/PatientEnrollmentByClinicalSite.tsx","../../../spa/components/shared/Loading/Loading.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/SummaryTab/SummaryTab.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/AllTab/ClinicalTrialsSkeletonTable.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/AllTab/ClinicalTrialsTable.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/AllTab/ClinicalTrialsFilter.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/AllTab/AllTab.tsx","../../../spa/components/pages/admin/ClinicalTrialsPage/ClinicalTrialsPage.tsx","../../../spa/components/pages/admin/PeoplesPage/PeopleFilter.tsx","../../../spa/components/pages/admin/PeoplesPage/PeopleCardSkeleton.tsx","../../../spa/components/pages/admin/PeoplesPage/PeopleTable.tsx","../../../spa/components/pages/admin/PeoplesPage/CenterOrInstitutionInput/CenterOrInstitutionInput.tsx","../../../spa/components/pages/admin/PeoplesPage/UserForm.tsx","../../../spa/components/pages/admin/PeoplesPage/UpdateConfirmationModal.tsx","../../../spa/components/pages/admin/PeoplesPage/EditFormParts/BasicInfo.tsx","../../../spa/components/shared/Tabs/Tabs.tsx","../../../spa/components/pages/admin/PeoplesPage/EditFormParts/ProfessionalInfo.tsx","../../../spa/components/pages/admin/PeoplesPage/EditFormParts/ProjectsInfo.tsx","../../../spa/components/pages/AccountSettingsPage/EmailNotificationsTab/preferences.ts","../../../spa/components/pages/admin/PeoplesPage/EditFormParts/EmailPreferences.tsx","../../../spa/components/pages/admin/PeoplesPage/SuspendConfirmationModal.tsx","../../../spa/components/pages/admin/PeoplesPage/ArchiveConfirmationModal.tsx","../../../spa/components/pages/admin/PeoplesPage/UserEditForm.tsx","../../../spa/components/pages/admin/PeoplesPage/PeoplesPage.tsx","../../../spa/components/shared/FullWideForm/FullWideForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/BasicDetailsForm/BasicDetailsForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/filters.tsx","../../../spa/components/shared/ResultList/ResultList.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/ProjectParticipantsForm/CenterForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/ProjectParticipantsForm/ExternalMemberForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/ProjectParticipantsForm/UserForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/ProjectParticipantsForm/ProjectParticipantsForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/ProjectDetailsForm/ProjectDetailsForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/SalesforceForm/SalesforceForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/TimelineForm/TimelineForm.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/SkeletonForm.tsx","../../../spa/components/pages/admin/ProjectPage/shared/lib.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/defaults.tsx","../../../spa/components/pages/admin/InitiativesPage/InitiativeForm/InitiativeForm.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/NotificationEmail.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/Tabs/Tabs.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/DetailedOverview/DetailedOverviewSkeleton.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/DetailedOverview/DetailedOverview.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/calculateOverdue.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/Sections/PctPatentPending.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/Sections/NationalPatentPending.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/getFirstFiling.ts","../../../spa/components/pages/admin/PatentDeadlinesPage/Sections/PctPatentExpired.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/Sections/NationalPatentExpired.tsx","../../../spa/components/pages/admin/PatentDeadlinesPage/PatentDeadlinesPage.tsx","../../../spa/components/pages/admin/InventionsPage/InventionSkeleton.tsx","../../../spa/components/shared/Inventions/defaults.tsx","../../../spa/components/pages/admin/InventionsPage/InventionsTable.tsx","../../../spa/components/pages/admin/InventionsPage/InventionsFilter.tsx","../../../spa/components/pages/admin/InventionsPage/InternalReviewModal.tsx","../../../spa/components/pages/admin/InventionsPage/TabContent/TabContent.tsx","../../../spa/components/pages/admin/InventionsPage/SummaryTab/ScoreItem.tsx","../../../spa/components/pages/admin/InventionsPage/SummaryTab/InventionsHistory.tsx","../../../spa/components/pages/admin/InventionsPage/SummaryTab/LicensedInventions.tsx","../../../spa/components/pages/admin/InventionsPage/SummaryTab/SummaryTab.tsx","../../../spa/components/pages/admin/InventionsPage/InventionsPage.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatSkeletonTable.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsTable.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsPage.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsForm/BasicDetailForm.tsx","../../../spa/components/shared/ButtonIcon/ButtonIcon.tsx","../../../spa/components/shared/Retreat/ImageGallery/ImageGallery.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsForm/ImageGalleryForm.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsForm/defaults.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsForm/ArticleCards.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsForm/SkeletonForm.tsx","../../../spa/components/pages/admin/RetreatsPage/RetreatsForm/RetreatsForm.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticleSkeletonTable.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesTable.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesPage.tsx","../../../spa/components/shared/Aside/Aside.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticleAside/SpeakerItemRow.tsx","../../../spa/components/shared/Retreat/Article/defaults.ts","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/defaults.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticleAside/ResourceLinkFormModal.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticleAside/ResourceLinkRow.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticleAside/ArticlesAside.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticlesSlideshow.tsx","../../../spa/components/shared/Retreat/Article/ArticleTitle.tsx","../../../spa/images/empty_image.png","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticleSections/SectionSelectorsModal.tsx","../../../spa/components/shared/RichText/RichText.tsx","../../../spa/components/shared/Retreat/Article/SectionEditors/useViewMode.ts","../../../spa/components/shared/Retreat/Article/SectionEditors/TextSectionEditor.tsx","../../../spa/components/shared/Retreat/Article/SectionEditors/TableSectionEditor.tsx","../../../spa/components/shared/Retreat/Article/SectionEditors/ImageSelector.tsx","../../../spa/components/shared/Retreat/Article/SectionEditors/ImageSectionEditor.tsx","../../../spa/components/shared/DraggableWrapper/DraggableWrapper.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticleSections/ArticleSections.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/SkeletonForm.tsx","../../../spa/components/pages/admin/ArticlesPage/ArticlesForm/ArticlesForm.tsx","../../../spa/components/pages/admin/TopInventorsPage/Skeleton.tsx","../../../spa/components/pages/admin/TopInventorsPage/TopInventorsPage.tsx","../../../spa/components/App/AdminRouter.tsx","../../../spa/hooks/usePageView.ts","../../../node_modules/@rooks/use-mutation-observer/lib/index.esm.js","../../../node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js","../../../node_modules/@reactour/utils/dist/utils.esm.js","../../../node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js","../../../node_modules/stylis/src/Enum.js","../../../node_modules/stylis/src/Utility.js","../../../node_modules/stylis/src/Tokenizer.js","../../../node_modules/stylis/src/Parser.js","../../../node_modules/stylis/src/Prefixer.js","../../../node_modules/stylis/src/Serializer.js","../../../node_modules/stylis/src/Middleware.js","../../../node_modules/@emotion/memoize/dist/emotion-memoize.browser.esm.js","../../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../../node_modules/@emotion/hash/dist/hash.browser.esm.js","../../../node_modules/@emotion/unitless/dist/unitless.browser.esm.js","../../../node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js","../../../node_modules/@emotion/react/dist/emotion-element-cbed451f.browser.esm.js","../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../../node_modules/@reactour/mask/dist/mask.esm.js","../../../node_modules/@reactour/popover/dist/popover.esm.js","../../../node_modules/@react-aria/ssr/dist/module.js","../../../node_modules/@react-stately/utils/dist/module.js","../../../node_modules/@react-aria/utils/dist/module.js","../../../node_modules/@react-aria/interactions/dist/module.js","../../../node_modules/@react-aria/focus/dist/module.js","../../../node_modules/@reactour/tour/dist/tour.esm.js","../../../spa/components/shared/GuidedTourSteps/GuidedTourSteps.tsx","../../../spa/images/logo-mc@2x.png","../../../spa/utils/createArrow.ts","../../../spa/components/App/navigation/MemberCenterNavigation.tsx","../../../spa/components/shared/FilterTags/FilterTags.tsx","../../../spa/components/shared/Accordion/Accordion.tsx","../../../spa/components/shared/AuthorList/AuthorList.tsx","../../../spa/components/PatternLibrary/Pages/SelectPage.tsx","../../../spa/hooks/useTrackVisit.ts","../../../node_modules/react-from-dom/esm/helpers.js","../../../node_modules/react-from-dom/esm/index.js","../../../node_modules/exenv/index.js","../../../node_modules/react-inlinesvg/esm/helpers.js","../../../node_modules/react-inlinesvg/esm/index.js","../../../spa/images/center-banner-placeholder.png","../../../spa/components/pages/MembersPage/CenterCard/CenterCard.tsx","../../../spa/components/shared/UsersList/UsersList.tsx","../../../spa/components/pages/MembersPage/Filters/Filters.tsx","../../../spa/components/pages/MembersPage/LoadingMembers/LoadingMembers.tsx","../../../spa/components/pages/MembersPage/MembersPage.tsx","../../../spa/components/pages/MembersPage/MemberDetail/Header.tsx","../../../spa/components/pages/MembersPage/MemberDetail/ProjectsTab/Filters.tsx","../../../spa/components/shared/FocusAreaTags/FocusAreaTags.tsx","../../../spa/images/project-photo-placeholder.png","../../../spa/components/shared/ProjectsTable/ProjectsTable.tsx","../../../spa/components/pages/MembersPage/MemberDetail/ProjectsTab/ProjectsTab.tsx","../../../spa/components/pages/MembersPage/MemberDetail/ExperienceTab/ExperienceTab.tsx","../../../spa/components/pages/MembersPage/MemberDetail/BiographyTab/BiographyTab.tsx","../../../spa/components/pages/MembersPage/MemberDetail/ResearchTab/Filters.tsx","../../../spa/components/shared/ResearchTable/ResearchCardSkeleton.tsx","../../../spa/utils/authorsToDisplay.ts","../../../spa/components/shared/ResearchTable/ResearchTable.tsx","../../../spa/components/pages/MembersPage/MemberDetail/ResearchTab/ResearchTab.tsx","../../../spa/components/pages/MembersPage/MemberDetail/MemberDetail.tsx","../../../spa/components/pages/CentersPage/CenterDetail/Header.tsx","../../../spa/components/pages/CentersPage/CenterDetail/ProjectsTab/Filters.tsx","../../../spa/components/pages/CentersPage/CenterDetail/ProjectsTab/ProjectsTab.tsx","../../../spa/components/pages/CentersPage/CenterDetail/MembersTab/Filters/Filters.tsx","../../../spa/components/pages/CentersPage/CenterDetail/MembersTab/MembersTab.tsx","../../../spa/components/pages/CentersPage/CenterDetail/ResearchTab/Filters.tsx","../../../spa/components/pages/CentersPage/CenterDetail/ResearchTab/ResearchTab.tsx","../../../spa/components/shared/Inventions/AdvancedFiltersModal.tsx","../../../node_modules/react-csv/src/core.js","../../../node_modules/react-csv/src/metaProps.js","../../../node_modules/react-csv/src/components/Download.js","../../../node_modules/react-csv/src/components/Link.jsx","../../../node_modules/react-csv/src/index.js","../../../spa/utils/formik/dates.ts","../../../spa/components/shared/Inventions/CSVConfiguration.tsx","../../../spa/components/shared/Inventions/ExportModal.tsx","../../../spa/components/shared/Inventions/Filters.tsx","../../../spa/components/shared/InventionsTable/InventionCardSkeleton.tsx","../../../spa/components/shared/InventionsTable/InventionsTable.tsx","../../../spa/components/pages/CentersPage/CenterDetail/InventionsTab/InventionsTab.tsx","../../../spa/components/pages/CentersPage/CenterDetail/CenterDetail.tsx","../../../node_modules/@sentry/types/esm/severity.js","../../../node_modules/@sentry/utils/esm/async.js","../../../node_modules/@sentry/utils/esm/env.js","../../../node_modules/@sentry/utils/esm/node.js","../../../node_modules/@sentry/utils/esm/global.js","../../../node_modules/@sentry/utils/esm/is.js","../../../node_modules/@sentry/utils/esm/browser.js","../../../node_modules/@sentry/utils/esm/polyfill.js","../../../node_modules/@sentry/utils/esm/error.js","../../../node_modules/@sentry/utils/esm/flags.js","../../../node_modules/@sentry/utils/esm/dsn.js","../../../node_modules/@sentry/utils/esm/enums.js","../../../node_modules/@sentry/utils/esm/logger.js","../../../node_modules/@sentry/utils/esm/string.js","../../../node_modules/@sentry/utils/esm/object.js","../../../node_modules/@sentry/utils/esm/stacktrace.js","../../../node_modules/@sentry/utils/esm/supports.js","../../../node_modules/@sentry/utils/esm/instrument.js","../../../node_modules/@sentry/utils/esm/memo.js","../../../node_modules/@sentry/utils/esm/misc.js","../../../node_modules/@sentry/utils/esm/normalize.js","../../../node_modules/@sentry/utils/esm/syncpromise.js","../../../node_modules/@sentry/utils/esm/promisebuffer.js","../../../node_modules/@sentry/utils/esm/severity.js","../../../node_modules/@sentry/utils/esm/status.js","../../../node_modules/@sentry/utils/esm/time.js","../../../node_modules/@sentry/utils/esm/envelope.js","../../../node_modules/@sentry/utils/esm/clientreport.js","../../../node_modules/@sentry/utils/esm/ratelimit.js","../../../node_modules/@sentry/hub/esm/scope.js","../../../node_modules/@sentry/hub/esm/session.js","../../../node_modules/@sentry/hub/esm/flags.js","../../../node_modules/@sentry/hub/esm/hub.js","../../../node_modules/@sentry/minimal/esm/index.js","../../../node_modules/@sentry/core/esm/api.js","../../../node_modules/@sentry/core/esm/flags.js","../../../node_modules/@sentry/core/esm/integration.js","../../../node_modules/@sentry/core/esm/baseclient.js","../../../node_modules/@sentry/core/esm/request.js","../../../node_modules/@sentry/core/esm/transports/noop.js","../../../node_modules/@sentry/core/esm/basebackend.js","../../../node_modules/@sentry/core/esm/sdk.js","../../../node_modules/@sentry/core/esm/transports/base.js","../../../node_modules/@sentry/core/esm/version.js","../../../node_modules/@sentry/core/esm/integrations/functiontostring.js","../../../node_modules/@sentry/core/esm/integrations/inboundfilters.js","../../../node_modules/@sentry/browser/esm/stack-parsers.js","../../../node_modules/@sentry/browser/esm/eventbuilder.js","../../../node_modules/@sentry/browser/esm/flags.js","../../../node_modules/@sentry/browser/esm/transports/utils.js","../../../node_modules/@sentry/browser/esm/transports/base.js","../../../node_modules/@sentry/browser/esm/transports/fetch.js","../../../node_modules/@sentry/browser/esm/transports/xhr.js","../../../node_modules/@sentry/browser/esm/transports/new-fetch.js","../../../node_modules/@sentry/browser/esm/transports/new-xhr.js","../../../node_modules/@sentry/browser/esm/backend.js","../../../node_modules/@sentry/browser/esm/helpers.js","../../../node_modules/@sentry/browser/esm/integrations/globalhandlers.js","../../../node_modules/@sentry/browser/esm/integrations/trycatch.js","../../../node_modules/@sentry/browser/esm/integrations/breadcrumbs.js","../../../node_modules/@sentry/browser/esm/integrations/linkederrors.js","../../../node_modules/@sentry/browser/esm/integrations/useragent.js","../../../node_modules/@sentry/browser/esm/integrations/dedupe.js","../../../node_modules/@sentry/browser/esm/client.js","../../../node_modules/@sentry/browser/esm/sdk.js","../../../node_modules/@sentry/react/esm/sdk.js","../../../node_modules/@sentry/react/esm/flags.js","../../../node_modules/@sentry/react/esm/errorboundary.js","../../../spa/components/pages/ResourcesPage/ErrorFallback.tsx","../../../spa/components/pages/ResourcesPage/ResourceListSkeleton.tsx","../../../spa/components/pages/ResourcesPage/ResourcesPage.tsx","../../../spa/components/pages/ResourcesPage/ResourceDetail.tsx","../../../spa/components/pages/ResearchDocumentsPage/Filters.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentsPage.tsx","../../../__vite-browser-external","../../../node_modules/pdfjs-dist/legacy/build/pdf.js","../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../../node_modules/make-event-props/dist/entry.js","../../../node_modules/make-cancellable-promise/dist/index.js","../../../node_modules/merge-class-names/dist/esm/index.js","../../../node_modules/react-pdf/dist/esm/DocumentContext.js","../../../node_modules/react-pdf/dist/esm/Message.js","../../../node_modules/react-pdf/dist/esm/LinkService.js","../../../node_modules/react-pdf/dist/esm/PasswordResponses.js","../../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../../../node_modules/react-pdf/dist/esm/shared/utils.js","../../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../../../node_modules/react-pdf/dist/esm/shared/propTypes.js","../../../node_modules/react-pdf/dist/esm/Document.js","../../../node_modules/react-pdf/dist/esm/OutlineItem.js","../../../node_modules/react-pdf/dist/esm/Outline.js","../../../node_modules/merge-refs/dist/esm/index.js","../../../node_modules/react-pdf/dist/esm/PageContext.js","../../../node_modules/react-pdf/dist/esm/Page/PageCanvas.js","../../../node_modules/react-pdf/dist/esm/Page/PageSVG.js","../../../node_modules/react-pdf/dist/esm/Page/TextLayerItem.js","../../../node_modules/react-pdf/dist/esm/Page/TextLayer.js","../../../node_modules/react-pdf/dist/esm/Page/AnnotationLayer.js","../../../node_modules/react-pdf/dist/esm/Page.js","../../../node_modules/react-pdf/dist/esm/entry.js","../../../node_modules/react-intersection-observer/react-intersection-observer.esm.js","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/Preview/Preview.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/Preview/PreviewContext.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/OverviewTab/Header.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/OverviewTab/OverviewTab.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/ViewersTab/ViewersTab.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/RelatedProjectsTab.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/OptModal.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/Aside/Aside.tsx","../../../spa/components/shared/Breadcrumb/Breadcrumb.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentDetail/ResearchDocumentDetail.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/Progress.tsx","../../../node_modules/xstate/es/_virtual/_tslib.js","../../../node_modules/xstate/es/types.js","../../../node_modules/xstate/es/actionTypes.js","../../../node_modules/xstate/es/constants.js","../../../node_modules/xstate/es/environment.js","../../../node_modules/xstate/es/utils.js","../../../node_modules/xstate/es/actions.js","../../../node_modules/xstate/es/serviceScope.js","../../../node_modules/xstate/es/Actor.js","../../../node_modules/xstate/es/stateUtils.js","../../../node_modules/xstate/es/State.js","../../../node_modules/xstate/es/scheduler.js","../../../node_modules/xstate/es/registry.js","../../../node_modules/xstate/es/devTools.js","../../../node_modules/xstate/es/behaviors.js","../../../node_modules/xstate/es/interpreter.js","../../../node_modules/xstate/es/invokeUtils.js","../../../node_modules/xstate/es/StateNode.js","../../../node_modules/xstate/es/Machine.js","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/stepsMachine.ts","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../../../node_modules/use-sync-external-store/shim/with-selector.js","../../../node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js","../../../node_modules/@xstate/react/es/useConstant.js","../../../node_modules/@xstate/react/es/useInterpret.js","../../../node_modules/@xstate/react/es/utils.js","../../../node_modules/@xstate/react/es/useMachine.js","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/data.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/ResearchDocumentFormContext.ts","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/ResearchDocumentFormStep1.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/AuthorListCreator.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/ResearchDocumentFormStep2.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/ResearchDocumentFormStep3.tsx","../../../spa/components/shared/FilePicker/FilePicker.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/CompletedForm.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentForm/ResearchDocumentForm.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentEditForm/AuthorPicker.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentEditForm/ResearchDocumentSchema.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentEditForm/ResearchResource.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentEditForm/RelatedProjectPicker.tsx","../../../spa/components/pages/ResearchDocumentsPage/ResearchDocumentEditForm/ResearchDocumentEditForm.tsx","../../../spa/components/pages/InventionsPage/Inventions/Inventions.tsx","../../../node_modules/recharts/es6/util/types.js","../../../node_modules/recharts/es6/container/Surface.js","../../../node_modules/recharts/es6/container/Layer.js","../../../node_modules/lodash/isFunction.js","../../../node_modules/lodash/_listCacheClear.js","../../../node_modules/lodash/eq.js","../../../node_modules/lodash/_assocIndexOf.js","../../../node_modules/lodash/_listCacheDelete.js","../../../node_modules/lodash/_listCacheGet.js","../../../node_modules/lodash/_listCacheHas.js","../../../node_modules/lodash/_listCacheSet.js","../../../node_modules/lodash/_ListCache.js","../../../node_modules/lodash/_stackClear.js","../../../node_modules/lodash/_stackDelete.js","../../../node_modules/lodash/_stackGet.js","../../../node_modules/lodash/_stackHas.js","../../../node_modules/lodash/_coreJsData.js","../../../node_modules/lodash/_isMasked.js","../../../node_modules/lodash/_toSource.js","../../../node_modules/lodash/_baseIsNative.js","../../../node_modules/lodash/_getValue.js","../../../node_modules/lodash/_getNative.js","../../../node_modules/lodash/_Map.js","../../../node_modules/lodash/_nativeCreate.js","../../../node_modules/lodash/_hashClear.js","../../../node_modules/lodash/_hashDelete.js","../../../node_modules/lodash/_hashGet.js","../../../node_modules/lodash/_hashHas.js","../../../node_modules/lodash/_hashSet.js","../../../node_modules/lodash/_Hash.js","../../../node_modules/lodash/_mapCacheClear.js","../../../node_modules/lodash/_isKeyable.js","../../../node_modules/lodash/_getMapData.js","../../../node_modules/lodash/_mapCacheDelete.js","../../../node_modules/lodash/_mapCacheGet.js","../../../node_modules/lodash/_mapCacheHas.js","../../../node_modules/lodash/_mapCacheSet.js","../../../node_modules/lodash/_MapCache.js","../../../node_modules/lodash/_stackSet.js","../../../node_modules/lodash/_Stack.js","../../../node_modules/lodash/_setCacheAdd.js","../../../node_modules/lodash/_setCacheHas.js","../../../node_modules/lodash/_SetCache.js","../../../node_modules/lodash/_arraySome.js","../../../node_modules/lodash/_cacheHas.js","../../../node_modules/lodash/_equalArrays.js","../../../node_modules/lodash/_Uint8Array.js","../../../node_modules/lodash/_mapToArray.js","../../../node_modules/lodash/_setToArray.js","../../../node_modules/lodash/_equalByTag.js","../../../node_modules/lodash/_arrayPush.js","../../../node_modules/lodash/isArray.js","../../../node_modules/lodash/_baseGetAllKeys.js","../../../node_modules/lodash/_arrayFilter.js","../../../node_modules/lodash/stubArray.js","../../../node_modules/lodash/_getSymbols.js","../../../node_modules/lodash/_baseTimes.js","../../../node_modules/lodash/_baseIsArguments.js","../../../node_modules/lodash/isArguments.js","../../../node_modules/lodash/stubFalse.js","../../../node_modules/lodash/isBuffer.js","../../../node_modules/lodash/_isIndex.js","../../../node_modules/lodash/isLength.js","../../../node_modules/lodash/_baseIsTypedArray.js","../../../node_modules/lodash/_baseUnary.js","../../../node_modules/lodash/_nodeUtil.js","../../../node_modules/lodash/isTypedArray.js","../../../node_modules/lodash/_arrayLikeKeys.js","../../../node_modules/lodash/_isPrototype.js","../../../node_modules/lodash/_overArg.js","../../../node_modules/lodash/_nativeKeys.js","../../../node_modules/lodash/_baseKeys.js","../../../node_modules/lodash/isArrayLike.js","../../../node_modules/lodash/keys.js","../../../node_modules/lodash/_getAllKeys.js","../../../node_modules/lodash/_equalObjects.js","../../../node_modules/lodash/_DataView.js","../../../node_modules/lodash/_Promise.js","../../../node_modules/lodash/_Set.js","../../../node_modules/lodash/_WeakMap.js","../../../node_modules/lodash/_getTag.js","../../../node_modules/lodash/_baseIsEqualDeep.js","../../../node_modules/lodash/_baseIsEqual.js","../../../node_modules/lodash/_baseIsMatch.js","../../../node_modules/lodash/_isStrictComparable.js","../../../node_modules/lodash/_getMatchData.js","../../../node_modules/lodash/_matchesStrictComparable.js","../../../node_modules/lodash/_baseMatches.js","../../../node_modules/lodash/_isKey.js","../../../node_modules/lodash/memoize.js","../../../node_modules/lodash/_memoizeCapped.js","../../../node_modules/lodash/_stringToPath.js","../../../node_modules/lodash/_arrayMap.js","../../../node_modules/lodash/_baseToString.js","../../../node_modules/lodash/toString.js","../../../node_modules/lodash/_castPath.js","../../../node_modules/lodash/_toKey.js","../../../node_modules/lodash/_baseGet.js","../../../node_modules/lodash/get.js","../../../node_modules/lodash/_baseHasIn.js","../../../node_modules/lodash/_hasPath.js","../../../node_modules/lodash/hasIn.js","../../../node_modules/lodash/_baseMatchesProperty.js","../../../node_modules/lodash/identity.js","../../../node_modules/lodash/_baseProperty.js","../../../node_modules/lodash/_basePropertyDeep.js","../../../node_modules/lodash/property.js","../../../node_modules/lodash/_baseIteratee.js","../../../node_modules/lodash/_baseFindIndex.js","../../../node_modules/lodash/_baseIsNaN.js","../../../node_modules/lodash/_strictIndexOf.js","../../../node_modules/lodash/_baseIndexOf.js","../../../node_modules/lodash/_arrayIncludes.js","../../../node_modules/lodash/_arrayIncludesWith.js","../../../node_modules/lodash/noop.js","../../../node_modules/lodash/_createSet.js","../../../node_modules/lodash/_baseUniq.js","../../../node_modules/lodash/uniqBy.js","../../../node_modules/lodash/_baseSlice.js","../../../node_modules/lodash/_castSlice.js","../../../node_modules/lodash/_hasUnicode.js","../../../node_modules/lodash/_asciiToArray.js","../../../node_modules/lodash/_unicodeToArray.js","../../../node_modules/lodash/_stringToArray.js","../../../node_modules/lodash/_createCaseFirst.js","../../../node_modules/lodash/upperFirst.js","../../../node_modules/d3-path/src/path.js","../../../node_modules/d3-shape/src/constant.js","../../../node_modules/d3-shape/src/math.js","../../../node_modules/d3-shape/src/array.js","../../../node_modules/d3-shape/src/curve/linear.js","../../../node_modules/d3-shape/src/point.js","../../../node_modules/d3-shape/src/line.js","../../../node_modules/d3-shape/src/area.js","../../../node_modules/d3-shape/src/symbol/circle.js","../../../node_modules/d3-shape/src/symbol/cross.js","../../../node_modules/d3-shape/src/symbol/diamond.js","../../../node_modules/d3-shape/src/symbol/star.js","../../../node_modules/d3-shape/src/symbol/square.js","../../../node_modules/d3-shape/src/symbol/triangle.js","../../../node_modules/d3-shape/src/symbol/wye.js","../../../node_modules/d3-shape/src/symbol.js","../../../node_modules/d3-shape/src/noop.js","../../../node_modules/d3-shape/src/curve/basis.js","../../../node_modules/d3-shape/src/curve/basisClosed.js","../../../node_modules/d3-shape/src/curve/basisOpen.js","../../../node_modules/d3-shape/src/curve/linearClosed.js","../../../node_modules/d3-shape/src/curve/monotone.js","../../../node_modules/d3-shape/src/curve/natural.js","../../../node_modules/d3-shape/src/curve/step.js","../../../node_modules/d3-shape/src/offset/none.js","../../../node_modules/d3-shape/src/order/none.js","../../../node_modules/d3-shape/src/stack.js","../../../node_modules/d3-shape/src/offset/expand.js","../../../node_modules/d3-shape/src/offset/silhouette.js","../../../node_modules/d3-shape/src/offset/wiggle.js","../../../node_modules/recharts/es6/shape/Symbols.js","../../../node_modules/recharts/es6/component/DefaultLegendContent.js","../../../node_modules/lodash/isNumber.js","../../../node_modules/lodash/isNaN.js","../../../node_modules/lodash/isString.js","../../../node_modules/recharts/es6/util/DataUtils.js","../../../node_modules/recharts/es6/component/Legend.js","../../../node_modules/lodash/isNil.js","../../../node_modules/fast-equals/dist/fast-equals.esm.js","../../../node_modules/react-smooth/es6/setRafTimeout.js","../../../node_modules/react-smooth/es6/AnimateManager.js","../../../node_modules/react-smooth/es6/util.js","../../../node_modules/react-smooth/es6/easing.js","../../../node_modules/react-smooth/es6/configUpdate.js","../../../node_modules/react-smooth/es6/Animate.js","../../../node_modules/react-smooth/es6/AnimateGroupChild.js","../../../node_modules/react-smooth/es6/AnimateGroup.js","../../../node_modules/lodash/_isFlattenable.js","../../../node_modules/lodash/_baseFlatten.js","../../../node_modules/lodash/_createBaseFor.js","../../../node_modules/lodash/_baseFor.js","../../../node_modules/lodash/_baseForOwn.js","../../../node_modules/lodash/_createBaseEach.js","../../../node_modules/lodash/_baseEach.js","../../../node_modules/lodash/_baseMap.js","../../../node_modules/lodash/_baseSortBy.js","../../../node_modules/lodash/_compareAscending.js","../../../node_modules/lodash/_compareMultiple.js","../../../node_modules/lodash/_baseOrderBy.js","../../../node_modules/lodash/_apply.js","../../../node_modules/lodash/_overRest.js","../../../node_modules/lodash/constant.js","../../../node_modules/lodash/_defineProperty.js","../../../node_modules/lodash/_baseSetToString.js","../../../node_modules/lodash/_shortOut.js","../../../node_modules/lodash/_setToString.js","../../../node_modules/lodash/_baseRest.js","../../../node_modules/lodash/_isIterateeCall.js","../../../node_modules/lodash/sortBy.js","../../../node_modules/recharts/es6/component/DefaultTooltipContent.js","../../../node_modules/recharts/es6/util/Global.js","../../../node_modules/recharts/es6/component/Tooltip.js","../../../node_modules/react-resize-detector/build/index.esm.js","../../../node_modules/recharts/es6/util/LogUtils.js","../../../node_modules/recharts/es6/component/ResponsiveContainer.js","../../../node_modules/recharts/es6/component/Cell.js","../../../node_modules/postcss-value-parser/lib/parse.js","../../../node_modules/postcss-value-parser/lib/walk.js","../../../node_modules/postcss-value-parser/lib/stringify.js","../../../node_modules/postcss-value-parser/lib/unit.js","../../../node_modules/postcss-value-parser/lib/index.js","../../../node_modules/reduce-css-calc/dist/parser.js","../../../node_modules/css-unit-converter/index.js","../../../node_modules/reduce-css-calc/dist/lib/convert.js","../../../node_modules/reduce-css-calc/dist/lib/reducer.js","../../../node_modules/reduce-css-calc/dist/lib/stringifier.js","../../../node_modules/reduce-css-calc/dist/index.js","../../../node_modules/recharts/es6/util/DOMUtils.js","../../../node_modules/recharts/es6/component/Text.js","../../../node_modules/recharts/es6/util/ShallowEqual.js","../../../node_modules/recharts/es6/util/ReactUtils.js","../../../node_modules/lodash/isEqual.js","../../../node_modules/lodash/_baseExtremum.js","../../../node_modules/lodash/_baseGt.js","../../../node_modules/lodash/max.js","../../../node_modules/lodash/_baseLt.js","../../../node_modules/lodash/min.js","../../../node_modules/lodash/map.js","../../../node_modules/lodash/flatMap.js","../../../node_modules/decimal.js-light/decimal.mjs","../../../node_modules/recharts-scale/es6/util/utils.js","../../../node_modules/recharts-scale/es6/util/arithmetic.js","../../../node_modules/recharts-scale/es6/getNiceTickValues.js","../../../node_modules/d3-array/src/ascending.js","../../../node_modules/d3-array/src/bisector.js","../../../node_modules/d3-array/src/number.js","../../../node_modules/d3-array/src/bisect.js","../../../node_modules/d3-array/src/ticks.js","../../../node_modules/d3-array/src/max.js","../../../node_modules/d3-array/src/min.js","../../../node_modules/d3-array/src/quickselect.js","../../../node_modules/d3-array/src/quantile.js","../../../node_modules/d3-array/src/range.js","../../../node_modules/d3-scale/src/init.js","../../../node_modules/d3-scale/src/ordinal.js","../../../node_modules/d3-scale/src/band.js","../../../node_modules/d3-color/src/define.js","../../../node_modules/d3-color/src/color.js","../../../node_modules/d3-interpolate/src/constant.js","../../../node_modules/d3-interpolate/src/color.js","../../../node_modules/d3-interpolate/src/rgb.js","../../../node_modules/d3-interpolate/src/numberArray.js","../../../node_modules/d3-interpolate/src/array.js","../../../node_modules/d3-interpolate/src/date.js","../../../node_modules/d3-interpolate/src/number.js","../../../node_modules/d3-interpolate/src/object.js","../../../node_modules/d3-interpolate/src/string.js","../../../node_modules/d3-interpolate/src/value.js","../../../node_modules/d3-interpolate/src/round.js","../../../node_modules/d3-interpolate/src/piecewise.js","../../../node_modules/d3-scale/src/constant.js","../../../node_modules/d3-scale/src/number.js","../../../node_modules/d3-scale/src/continuous.js","../../../node_modules/d3-format/src/formatDecimal.js","../../../node_modules/d3-format/src/exponent.js","../../../node_modules/d3-format/src/formatGroup.js","../../../node_modules/d3-format/src/formatNumerals.js","../../../node_modules/d3-format/src/formatSpecifier.js","../../../node_modules/d3-format/src/formatTrim.js","../../../node_modules/d3-format/src/formatPrefixAuto.js","../../../node_modules/d3-format/src/formatRounded.js","../../../node_modules/d3-format/src/formatTypes.js","../../../node_modules/d3-format/src/identity.js","../../../node_modules/d3-format/src/locale.js","../../../node_modules/d3-format/src/defaultLocale.js","../../../node_modules/d3-format/src/precisionFixed.js","../../../node_modules/d3-format/src/precisionPrefix.js","../../../node_modules/d3-format/src/precisionRound.js","../../../node_modules/d3-scale/src/tickFormat.js","../../../node_modules/d3-scale/src/linear.js","../../../node_modules/d3-scale/src/identity.js","../../../node_modules/d3-scale/src/nice.js","../../../node_modules/d3-scale/src/log.js","../../../node_modules/d3-scale/src/symlog.js","../../../node_modules/d3-scale/src/pow.js","../../../node_modules/d3-scale/src/radial.js","../../../node_modules/d3-scale/src/quantile.js","../../../node_modules/d3-scale/src/quantize.js","../../../node_modules/d3-scale/src/threshold.js","../../../node_modules/d3-time/src/interval.js","../../../node_modules/d3-time/src/millisecond.js","../../../node_modules/d3-time/src/duration.js","../../../node_modules/d3-time/src/second.js","../../../node_modules/d3-time/src/minute.js","../../../node_modules/d3-time/src/hour.js","../../../node_modules/d3-time/src/day.js","../../../node_modules/d3-time/src/week.js","../../../node_modules/d3-time/src/month.js","../../../node_modules/d3-time/src/year.js","../../../node_modules/d3-time/src/utcMinute.js","../../../node_modules/d3-time/src/utcHour.js","../../../node_modules/d3-time/src/utcDay.js","../../../node_modules/d3-time/src/utcWeek.js","../../../node_modules/d3-time/src/utcMonth.js","../../../node_modules/d3-time/src/utcYear.js","../../../node_modules/d3-time/src/ticks.js","../../../node_modules/d3-time-format/src/locale.js","../../../node_modules/d3-time-format/src/defaultLocale.js","../../../node_modules/d3-scale/src/time.js","../../../node_modules/d3-scale/src/utcTime.js","../../../node_modules/d3-scale/src/sequential.js","../../../node_modules/d3-scale/src/sequentialQuantile.js","../../../node_modules/d3-scale/src/diverging.js","../../../node_modules/recharts/es6/util/ChartUtils.js","../../../node_modules/recharts/es6/util/PolarUtils.js","../../../node_modules/recharts/es6/component/Label.js","../../../node_modules/lodash/last.js","../../../node_modules/recharts/es6/component/LabelList.js","../../../node_modules/recharts/es6/shape/Sector.js","../../../node_modules/recharts/es6/shape/Curve.js","../../../node_modules/recharts/es6/shape/Rectangle.js","../../../node_modules/recharts/es6/shape/Polygon.js","../../../node_modules/recharts/es6/shape/Dot.js","../../../node_modules/recharts/es6/shape/Cross.js","../../../node_modules/lodash/minBy.js","../../../node_modules/lodash/maxBy.js","../../../node_modules/recharts/es6/polar/PolarRadiusAxis.js","../../../node_modules/recharts/es6/polar/PolarAngleAxis.js","../../../node_modules/lodash/_getPrototype.js","../../../node_modules/lodash/isPlainObject.js","../../../node_modules/recharts/es6/polar/Pie.js","../../../node_modules/lodash/_baseRange.js","../../../node_modules/lodash/toFinite.js","../../../node_modules/lodash/_createRange.js","../../../node_modules/lodash/range.js","../../../node_modules/recharts/es6/util/CssPrefixUtils.js","../../../node_modules/recharts/es6/cartesian/Brush.js","../../../node_modules/lodash/_baseSome.js","../../../node_modules/lodash/some.js","../../../node_modules/recharts/es6/util/IfOverflowMatches.js","../../../node_modules/lodash/_arrayEvery.js","../../../node_modules/lodash/_baseEvery.js","../../../node_modules/lodash/every.js","../../../node_modules/lodash/_baseAssignValue.js","../../../node_modules/lodash/mapValues.js","../../../node_modules/recharts/es6/util/CartesianUtils.js","../../../node_modules/recharts/es6/cartesian/ReferenceLine.js","../../../node_modules/recharts/es6/cartesian/ReferenceDot.js","../../../node_modules/recharts/es6/cartesian/ReferenceArea.js","../../../node_modules/recharts/es6/cartesian/CartesianAxis.js","../../../node_modules/recharts/es6/cartesian/CartesianGrid.js","../../../node_modules/recharts/es6/cartesian/ErrorBar.js","../../../node_modules/recharts/es6/cartesian/Line.js","../../../node_modules/recharts/es6/cartesian/Area.js","../../../node_modules/recharts/es6/cartesian/Bar.js","../../../node_modules/recharts/es6/cartesian/ZAxis.js","../../../node_modules/recharts/es6/cartesian/Scatter.js","../../../node_modules/recharts/es6/cartesian/XAxis.js","../../../node_modules/recharts/es6/cartesian/YAxis.js","../../../node_modules/lodash/_createFind.js","../../../node_modules/lodash/toInteger.js","../../../node_modules/lodash/findIndex.js","../../../node_modules/lodash/find.js","../../../node_modules/lodash/isBoolean.js","../../../node_modules/recharts/es6/util/DetectReferenceElementsDomain.js","../../../node_modules/eventemitter3/index.js","../../../node_modules/recharts/es6/util/Events.js","../../../node_modules/recharts/es6/chart/generateCategoricalChart.js","../../../node_modules/recharts/es6/chart/LineChart.js","../../../node_modules/recharts/es6/chart/BarChart.js","../../../node_modules/recharts/es6/chart/PieChart.js","../../../node_modules/recharts/es6/chart/ScatterChart.js","../../../node_modules/recharts/es6/chart/AreaChart.js","../../../spa/components/pages/InventionsPage/Insights/Charts/AcceptedDeclined/StackedTooltip.tsx","../../../spa/components/pages/InventionsPage/Insights/Charts/AcceptedDeclined/computeTotal.ts","../../../spa/components/pages/InventionsPage/Insights/Charts/AcceptedDeclined/Colors.ts","../../../spa/components/pages/InventionsPage/Insights/Charts/AcceptedDeclined/Thumbnail.tsx","../../../spa/components/pages/InventionsPage/Insights/Charts/AcceptedDeclined/FullSize.tsx","../../../spa/components/shared/ChartsTooltip/Tooltip.tsx","../../../spa/components/shared/ThumbnailPieChart/Colors.ts","../../../spa/components/shared/ThumbnailPieChart/ThumbnailPieChart.tsx","../../../spa/hooks/useRerender.ts","../../../spa/components/shared/ChartsLabel/CustomizedLabel.tsx","../../../spa/components/shared/FullsizePieChart/Colors.ts","../../../spa/components/shared/FullsizePieChart/FullsizePieChart.tsx","../../../spa/components/shared/ThumbnailBarChart/Colors.ts","../../../spa/components/shared/ThumbnailBarChart/ThumbnailBarChart.tsx","../../../spa/components/shared/FullsizeBarChart/Colors.ts","../../../spa/components/shared/FullsizeBarChart/FullsizeBarChart.tsx","../../../spa/components/shared/ChartsTooltipWithTotal/Tooltip.tsx","../../../spa/components/shared/ThumbnailBarVerticalChart/Colors.ts","../../../spa/components/shared/ThumbnailBarVerticalChart/ThumbnailBarVerticalChart.tsx","../../../spa/components/shared/FullsizeBarVerticalChart/Colors.ts","../../../spa/components/shared/FullsizeBarVerticalChart/FullsizeBarVerticalChart.tsx","../../../spa/components/shared/HorizontalStackedBarChart/StackedTooltip.tsx","../../../spa/components/shared/HorizontalStackedBarChart/Colors.ts","../../../spa/components/shared/HorizontalStackedBarChart/HorizontalStackedBarChart.tsx","../../../spa/components/shared/HorizontalStackedBarChart/HorizontalStackedBarChartFullSize.tsx","../../../spa/components/pages/InventionsPage/Insights/Charts/Charts.tsx","../../../spa/components/pages/InventionsPage/Insights/Insights.tsx","../../../spa/components/pages/InventionsPage/InventionsPage.tsx","../../../spa/components/shared/SimpleTags/SimpleTags.tsx","../../../spa/components/pages/InventionsPage/InventionDetail/Overview/Overview.tsx","../../../spa/components/pages/InventionsPage/InventionDetail/Inventors/Inventors.tsx","../../../node_modules/striptags/src/striptags.js","../../../spa/components/pages/InventionsPage/InventionDetail/ReferenceMaterials/ReferenceMaterials.tsx","../../../spa/components/shared/Timeline/Timeline.tsx","../../../spa/components/pages/InventionsPage/InventionDetail/Aside/Aside.tsx","../../../spa/components/pages/InventionsPage/InventionDetail/InventionDetail.tsx","../../../spa/components/pages/ProjectsPage/ProjectsPage/NewProjectModal.tsx","../../../spa/components/pages/ProjectsPage/ProjectsPage/Filters.tsx","../../../spa/images/project-photo-placeholder@2x.png","../../../spa/images/project-photo-placeholder@3x.png","../../../node_modules/@brainhubeu/react-carousel/lib/react-carousel.js","../../../spa/components/pages/ProjectsPage/ProjectsPage/Slider.tsx","../../../spa/components/pages/ProjectsPage/ProjectsPage/ProjectsPage.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/Aside.tsx","../../../spa/components/shared/PreviewText/PreviewText.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/OverviewTab.tsx","../../../spa/components/shared/EnrollmentTable/EnrollmentTable.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/ClinicalProgressTab.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/MembersTab.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/UpdatesTab.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/RelatedProjectsTab.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/ProjectDetail.tsx","../../../spa/components/pages/ProjectsPage/ProjectDetail/UpdateDetail.tsx","../../../spa/components/shared/PdfViewer/PdfViewer.tsx","../../../spa/components/pages/AnnouncementPage/AnnouncementPage.tsx","../../../spa/components/pages/GlobalSearchPage/Filters.tsx","../../../spa/components/pages/GlobalSearchPage/SearchItems.tsx","../../../spa/components/pages/GlobalSearchPage/GlobalSearchContent.tsx","../../../spa/components/pages/GlobalSearchPage/GlobalSearchPage.tsx","../../../node_modules/ellipsed/lib/ellipsed.js","../../../spa/components/pages/DashboardPage/FeaturedProjects.tsx","../../../spa/components/pages/DashboardPage/MonthlyActivity.tsx","../../../spa/components/shared/NewsItem/NewsItem.tsx","../../../spa/components/pages/DashboardPage/NewsFeedPreview.tsx","../../../spa/components/pages/DashboardPage/Announcement.tsx","../../../spa/components/shared/Retreat/RetreatHero/dateFormat.ts","../../../spa/components/shared/Retreat/RetreatHero/RetreatHero.tsx","../../../spa/components/pages/DashboardPage/Aside.tsx","../../../spa/components/pages/DashboardPage/DashboardPage.tsx","../../../spa/utils/array.ts","../../../spa/components/pages/DailyNewsPage/DailyNewsPage.tsx","../../../spa/components/pages/AccountSettingsPage/AccountSettingsPage.tsx","../../../spa/images/blank_avatar.png","../../../spa/components/shared/AvatarPicker/AvatarPicker.tsx","../../../spa/components/pages/AccountSettingsPage/BasicInfoTab/BasicInfoTab.tsx","../../../spa/components/pages/AccountSettingsPage/ProfessionalInfoTab/ProfessionalInfoTab.tsx","../../../spa/components/pages/AccountSettingsPage/ProjectsTab/ProjectsTab.tsx","../../../spa/components/pages/AccountSettingsPage/ResearchTab/ResearchTab.tsx","../../../spa/components/pages/AccountSettingsPage/EmailNotificationsTab/EmailNotificationsTab.tsx","../../../spa/hooks/useCSRFToken.ts","../../../spa/components/pages/AccountSettingsPage/MemberCenterHelpTab/MemberCenterHelpTab.tsx","../../../spa/components/pages/AccountSettingsPage/VersionTab/VersionTab.tsx","../../../spa/components/pages/AccountSettingsPage/PublicationHistoryTab/PublicationHistoryTab.tsx","../../../spa/components/pages/AccountSettingsPage/PublicationHistoryTab/PublicationHistoryForm.tsx","../../../spa/components/pages/InsightsPage/Examples/ChartExample.tsx","../../../spa/components/pages/InsightsPage/Examples/ChartExampleThree.tsx","../../../spa/components/pages/InsightsPage/Examples/ChartExampleTwo.tsx","../../../spa/components/pages/InsightsPage/InsightsPage.tsx","../../../spa/components/pages/InsightsPage/shared/Hero/Hero.tsx","../../../spa/components/pages/InsightsPage/Examples/ChartPage.tsx","../../../spa/components/pages/InsightsPage/shared/InsightCard/InsightCard.tsx","../../../spa/components/shared/Charts/SimpleAreaChart/SimpleAreaChart.tsx","../../../spa/components/shared/Charts/PieChart/InsightPieChart.tsx","../../../spa/components/shared/Charts/BarChart/InsightBarChart.tsx","../../../spa/components/pages/InsightsPage/shared/HeaderCard/HeaderCards.tsx","../../../spa/components/shared/Charts/LinesChart/InsightLineChart.tsx","../../../spa/components/pages/InsightsPage/InsightPage/InsightSkeleton/InsightsSkeleton.tsx","../../../spa/components/pages/InsightsPage/InsightPage/Members/Members.tsx","../../../spa/components/shared/Charts/ScatterChart/InsightScatterChart.tsx","../../../spa/components/pages/InsightsPage/InsightPage/ResearchInsight/ResearchInsight.tsx","../../../spa/components/pages/InsightsPage/InsightPage/ProjectsInsight/ProjectsInsight.tsx","../../../spa/components/shared/Charts/BubbleChart/BubbleChart.tsx","../../../spa/components/pages/InsightsPage/InsightPage/Inventions/Inventions.tsx","../../../spa/components/shared/Charts/InsightMultiLevelPieChart/InsightMultiLevelPieChart.tsx","../../../spa/components/shared/Charts/InsightPieChartWithSelectCenter/InsightPieChartWithSelectCenter.tsx","../../../spa/components/pages/InsightsPage/InsightPage/Centers/Centers.tsx","../../../spa/components/shared/Retreat/ArticleCard/ArticleCard.tsx","../../../spa/components/pages/RetreatsPage/RetreatSkeletonPage.tsx","../../../spa/components/pages/RetreatsPage/RetreatPage.tsx","../../../spa/components/shared/Slideshow/SlideShow.tsx","../../../spa/components/pages/RetreatsPage/default.ts","../../../spa/components/pages/RetreatsPage/ArticlePage.tsx","../../../spa/images/logo-login.png","../../../spa/components/shared/OnboardingLayout/OnboardingLayout.tsx","../../../spa/components/pages/UserOnboarding/Start/Start.tsx","../../../spa/components/pages/UserOnboarding/Picture/Picture.tsx","../../../spa/components/pages/UserOnboarding/Professional/Professional.tsx","../../../spa/components/pages/ConfidentialityPage/ConfidentialityPage.tsx","../../../spa/components/App/AuthenticatedRouter.tsx","../../../spa/images/logo-login@2x.png","../../../spa/components/shared/LoginLayout/LoginLayout.tsx","../../../spa/components/pages/LoginPage/LoginPage.tsx","../../../spa/components/pages/ForgotPasswordPage/ForgotPasswordPage.tsx","../../../spa/components/pages/ForgotPasswordPage/CheckYourInboxPage.tsx","../../../spa/components/pages/ForgotPasswordPage/ResetPasswordPage.tsx","../../../spa/components/App/SiteRouter.tsx","../../../spa/components/App/App.tsx","../../../spa/components/App/setupSentry.tsx","../../../spa/entrypoints/application.jsx"],"sourcesContent":["/** @license React v0.20.2\n * scheduler.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 f,g,h,k;if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}\nif(\"undefined\"===typeof window||\"function\"!==typeof MessageChannel){var t=null,u=null,w=function(){if(null!==t)try{var a=exports.unstable_now();t(!0,a);t=null}catch(b){throw setTimeout(w,0),b;}};f=function(a){null!==t?setTimeout(f,0,a):(t=a,setTimeout(w,0))};g=function(a,b){u=setTimeout(a,b)};h=function(){clearTimeout(u)};exports.unstable_shouldYield=function(){return!1};k=exports.unstable_forceFrameRate=function(){}}else{var x=window.setTimeout,y=window.clearTimeout;if(\"undefined\"!==typeof console){var z=\nwindow.cancelAnimationFrame;\"function\"!==typeof window.requestAnimationFrame&&console.error(\"This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills\");\"function\"!==typeof z&&console.error(\"This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills\")}var A=!1,B=null,C=-1,D=5,E=0;exports.unstable_shouldYield=function(){return exports.unstable_now()>=\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) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var 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\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","/**\n * React Router v6.3.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { parsePath, createMemoryHistory, Action } from 'history';\nexport { Action as NavigationType, createPath, parsePath } from 'history';\nimport { createContext, useContext, useMemo, useRef, useEffect, useCallback, createElement, useState, useLayoutEffect, Children, isValidElement, Fragment } from 'react';\n\nconst NavigationContext = /*#__PURE__*/createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\n\nconst LocationContext = /*#__PURE__*/createContext(null);\n\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\n\nconst RouteContext = /*#__PURE__*/createContext({\n outlet: null,\n matches: []\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\n\nfunction invariant(cond, message) {\n if (!cond) throw new Error(message);\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 React 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}\nconst alreadyWarned = {};\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 * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/docs/en/v6/api#generatepath\n */\nfunction generatePath(path, params) {\n if (params === void 0) {\n params = {};\n }\n\n return path.replace(/:(\\w+)/g, (_, key) => {\n !(params[key] != null) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Missing \\\":\" + key + \"\\\" param\") : invariant(false) : void 0;\n return params[key];\n }).replace(/\\/*\\*$/, _ => params[\"*\"] == null ? \"\" : params[\"*\"].replace(/^\\/*/, \"/\"));\n}\n/**\n * A RouteMatch contains info about how a route matched a URL.\n */\n\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/docs/en/v6/api#matchroutes\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], 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 routes.forEach((route, index) => {\n let meta = {\n relativePath: route.path || \"\",\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n\n if (meta.relativePath.startsWith(\"/\")) {\n !meta.relativePath.startsWith(parentPath) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"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.\") : invariant(false) : void 0;\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 !(route.index !== true) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\")) : invariant(false) : void 0;\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 return branches;\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 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 * A PathPattern is used to match on some portion of a URL pathname.\n */\n\n\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/docs/en/v6/api#matchpath\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 process.env.NODE_ENV !== \"production\" ? 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(/\\*$/, \"/*\") + \"\\\".\")) : void 0;\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 {\n regexpSource += end ? \"\\\\/*$\" // When matching to the end, ignore trailing slashes\n : // Otherwise, match a word boundary or a proceeding /. The word boundary restricts\n // parent routes to matching only their own words and nothing more, e.g. parent\n // route \"/home\" should not match \"/home2\".\n // Additionally, allow paths starting with `.`, `-`, `~`, and url-encoded entities,\n // but do not consume the character in the matched path so they can match against\n // nested paths.\n \"(?:(?=[.~-]|%[0-9A-F]{2})|\\\\b|\\\\/|$)\";\n }\n\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, paramNames];\n}\n\nfunction safelyDecodeURIComponent(value, paramName) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n process.env.NODE_ENV !== \"production\" ? 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 + \").\")) : void 0;\n return value;\n }\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/docs/en/v6/api#resolvepath\n */\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 resolveTo(toArg, routePathnames, locationPathname) {\n let to = typeof toArg === \"string\" ? parsePath(toArg) : toArg;\n let toPathname = toArg === \"\" || to.pathname === \"\" ? \"/\" : to.pathname; // 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 let from;\n\n if (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 value had one.\n\n if (toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\") && !path.pathname.endsWith(\"/\")) {\n path.pathname += \"/\";\n }\n\n return path;\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}\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n\n let nextChar = pathname.charAt(basename.length);\n\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n\n return pathname.slice(basename.length) || \"/\";\n}\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\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/docs/en/v6/api#usehref\n */\n\nfunction useHref(to) {\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 } = useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to);\n let joinedPathname = pathname;\n\n if (basename !== \"/\") {\n let toPathname = getToPathname(to);\n let endsWithSlash = toPathname != null && toPathname.endsWith(\"/\");\n joinedPathname = pathname === \"/\" ? basename + (endsWithSlash ? \"/\" : \"\") : 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/docs/en/v6/api#useinroutercontext\n */\n\nfunction useInRouterContext() {\n return 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/docs/en/v6/api#uselocation\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 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/docs/en/v6/api#usenavigationtype\n */\n\nfunction useNavigationType() {\n return useContext(LocationContext).navigationType;\n}\n/**\n * Returns true if the URL for the given \"to\" value 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/docs/en/v6/api#usematch\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 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/docs/en/v6/api#usenavigate\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 } = useContext(NavigationContext);\n let {\n matches\n } = useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(matches.map(match => match.pathnameBase));\n let activeRef = useRef(false);\n useEffect(() => {\n activeRef.current = true;\n });\n let navigate = 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);\n\n if (basename !== \"/\") {\n path.pathname = joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state);\n }, [basename, navigator, routePathnamesJson, locationPathname]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/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/docs/en/v6/api#useoutletcontext\n */\n\nfunction useOutletContext() {\n return 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/docs/en/v6/api#useoutlet\n */\n\nfunction useOutlet(context) {\n let outlet = useContext(RouteContext).outlet;\n\n if (outlet) {\n return /*#__PURE__*/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/docs/en/v6/api#useparams\n */\n\nfunction useParams() {\n let {\n matches\n } = 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/docs/en/v6/api#useresolvedpath\n */\n\nfunction useResolvedPath(to) {\n let {\n matches\n } = useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(matches.map(match => match.pathnameBase));\n return useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname), [to, routePathnamesJson, locationPathname]);\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/docs/en/v6/api#useroutes\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 matches: parentMatches\n } = 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 return _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase, match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase, match.pathnameBase])\n })), parentMatches);\n}\nfunction _renderMatches(matches, parentMatches) {\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n\n if (matches == null) return null;\n return matches.reduceRight((outlet, match, index) => {\n return /*#__PURE__*/createElement(RouteContext.Provider, {\n children: match.route.element !== undefined ? match.route.element : outlet,\n value: {\n outlet,\n matches: parentMatches.concat(matches.slice(0, index + 1))\n }\n });\n }, null);\n}\n\n/**\n * A that stores all entries in memory.\n *\n * @see https://reactrouter.com/docs/en/v6/api#memoryrouter\n */\nfunction MemoryRouter(_ref) {\n let {\n basename,\n children,\n initialEntries,\n initialIndex\n } = _ref;\n let historyRef = useRef();\n\n if (historyRef.current == null) {\n historyRef.current = createMemoryHistory({\n initialEntries,\n initialIndex\n });\n }\n\n let history = historyRef.current;\n let [state, setState] = useState({\n action: history.action,\n location: history.location\n });\n useLayoutEffect(() => history.listen(setState), [history]);\n return /*#__PURE__*/createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history\n });\n}\n\n/**\n * Changes the current location.\n *\n * Note: This API is mostly useful in React.Component subclasses that are not\n * able to use hooks. In functional components, we recommend you use the\n * `useNavigate` hook instead.\n *\n * @see https://reactrouter.com/docs/en/v6/api#navigate\n */\nfunction Navigate(_ref2) {\n let {\n to,\n replace,\n state\n } = _ref2;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of\n // the router loaded. We can help them understand how to avoid that.\n \" may be used only in the context of a component.\") : invariant(false) : void 0;\n process.env.NODE_ENV !== \"production\" ? warning(!useContext(NavigationContext).static, \" must not be used on the initial render in a . \" + \"This is a no-op, but you should modify your code so the is \" + \"only ever rendered in response to some user interaction or state change.\") : void 0;\n let navigate = useNavigate();\n useEffect(() => {\n navigate(to, {\n replace,\n state\n });\n });\n return null;\n}\n\n/**\n * Renders the child route's element, if there is one.\n *\n * @see https://reactrouter.com/docs/en/v6/api#outlet\n */\nfunction Outlet(props) {\n return useOutlet(props.context);\n}\n\n/**\n * Declares an element that should be rendered at a certain URL path.\n *\n * @see https://reactrouter.com/docs/en/v6/api#route\n */\nfunction Route(_props) {\n process.env.NODE_ENV !== \"production\" ? invariant(false, \"A is only ever to be used as the child of element, \" + \"never rendered directly. Please wrap your in a .\") : invariant(false) ;\n}\n\n/**\n * Provides location context for the rest of the app.\n *\n * Note: You usually won't render a directly. Instead, you'll render a\n * router that is more specific to your environment such as a \n * in web browsers or a for server rendering.\n *\n * @see https://reactrouter.com/docs/en/v6/api#router\n */\nfunction Router(_ref3) {\n let {\n basename: basenameProp = \"/\",\n children = null,\n location: locationProp,\n navigationType = Action.Pop,\n navigator,\n static: staticProp = false\n } = _ref3;\n !!useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"You cannot render a inside another .\" + \" You should never have more than one in your app.\") : invariant(false) : void 0;\n let basename = normalizePathname(basenameProp);\n let navigationContext = useMemo(() => ({\n basename,\n navigator,\n static: staticProp\n }), [basename, navigator, staticProp]);\n\n if (typeof locationProp === \"string\") {\n locationProp = parsePath(locationProp);\n }\n\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n state = null,\n key = \"default\"\n } = locationProp;\n let location = useMemo(() => {\n let trailingPathname = stripBasename(pathname, basename);\n\n if (trailingPathname == null) {\n return null;\n }\n\n return {\n pathname: trailingPathname,\n search,\n hash,\n state,\n key\n };\n }, [basename, pathname, search, hash, state, key]);\n process.env.NODE_ENV !== \"production\" ? warning(location != null, \" is not able to match the URL \" + (\"\\\"\" + pathname + search + hash + \"\\\" because it does not start with the \") + \"basename, so the won't render anything.\") : void 0;\n\n if (location == null) {\n return null;\n }\n\n return /*#__PURE__*/createElement(NavigationContext.Provider, {\n value: navigationContext\n }, /*#__PURE__*/createElement(LocationContext.Provider, {\n children: children,\n value: {\n location,\n navigationType\n }\n }));\n}\n\n/**\n * A container for a nested tree of elements that renders the branch\n * that best matches the current location.\n *\n * @see https://reactrouter.com/docs/en/v6/api#routes\n */\nfunction Routes(_ref4) {\n let {\n children,\n location\n } = _ref4;\n return useRoutes(createRoutesFromChildren(children), location);\n} ///////////////////////////////////////////////////////////////////////////////\n// UTILS\n///////////////////////////////////////////////////////////////////////////////\n\n/**\n * Creates a route config from a React \"children\" object, which is usually\n * either a `` element or an array of them. Used internally by\n * `` to create a route config from its children.\n *\n * @see https://reactrouter.com/docs/en/v6/api#createroutesfromchildren\n */\n\nfunction createRoutesFromChildren(children) {\n let routes = [];\n Children.forEach(children, element => {\n if (! /*#__PURE__*/isValidElement(element)) {\n // Ignore non-elements. This allows people to more easily inline\n // conditionals in their route config.\n return;\n }\n\n if (element.type === Fragment) {\n // Transparently support React.Fragment and its children.\n routes.push.apply(routes, createRoutesFromChildren(element.props.children));\n return;\n }\n\n !(element.type === Route) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"[\" + (typeof element.type === \"string\" ? element.type : element.type.name) + \"] is not a component. All component children of must be a or \") : invariant(false) : void 0;\n let route = {\n caseSensitive: element.props.caseSensitive,\n element: element.props.element,\n index: element.props.index,\n path: element.props.path\n };\n\n if (element.props.children) {\n route.children = createRoutesFromChildren(element.props.children);\n }\n\n routes.push(route);\n });\n return routes;\n}\n/**\n * Renders the result of `matchRoutes()` into a React element.\n */\n\nfunction renderMatches(matches) {\n return _renderMatches(matches);\n}\n\nexport { MemoryRouter, Navigate, Outlet, Route, Router, Routes, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, createRoutesFromChildren, generatePath, matchPath, matchRoutes, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes };\n//# sourceMappingURL=index.js.map\n","/**\n * React Router DOM v6.3.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { useRef, useState, useLayoutEffect, createElement, forwardRef, useCallback, useMemo } from 'react';\nimport { createBrowserHistory, createHashHistory } from 'history';\nimport { Router, useHref, createPath, useLocation, useResolvedPath, useNavigate } from 'react-router';\nexport { MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, generatePath, matchPath, matchRoutes, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes } from 'react-router';\n\nfunction _extends() {\n _extends = Object.assign || 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\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nconst _excluded = [\"onClick\", \"reloadDocument\", \"replace\", \"state\", \"target\", \"to\"],\n _excluded2 = [\"aria-current\", \"caseSensitive\", \"className\", \"end\", \"style\", \"to\", \"children\"];\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 React 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// COMPONENTS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A `` for use in web browsers. Provides the cleanest URLs.\n */\nfunction BrowserRouter(_ref) {\n let {\n basename,\n children,\n window\n } = _ref;\n let historyRef = useRef();\n\n if (historyRef.current == null) {\n historyRef.current = createBrowserHistory({\n window\n });\n }\n\n let history = historyRef.current;\n let [state, setState] = useState({\n action: history.action,\n location: history.location\n });\n useLayoutEffect(() => history.listen(setState), [history]);\n return /*#__PURE__*/createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history\n });\n}\n\n/**\n * A `` for use in web browsers. Stores the location in the hash\n * portion of the URL so it is not sent to the server.\n */\nfunction HashRouter(_ref2) {\n let {\n basename,\n children,\n window\n } = _ref2;\n let historyRef = useRef();\n\n if (historyRef.current == null) {\n historyRef.current = createHashHistory({\n window\n });\n }\n\n let history = historyRef.current;\n let [state, setState] = useState({\n action: history.action,\n location: history.location\n });\n useLayoutEffect(() => history.listen(setState), [history]);\n return /*#__PURE__*/createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history\n });\n}\n\n/**\n * A `` that accepts a pre-instantiated history object. It's important\n * to note that using your own history object is highly discouraged and may add\n * two versions of the history library to your bundles unless you use the same\n * version of the history library that React Router uses internally.\n */\nfunction HistoryRouter(_ref3) {\n let {\n basename,\n children,\n history\n } = _ref3;\n const [state, setState] = useState({\n action: history.action,\n location: history.location\n });\n useLayoutEffect(() => history.listen(setState), [history]);\n return /*#__PURE__*/createElement(Router, {\n basename: basename,\n children: children,\n location: state.location,\n navigationType: state.action,\n navigator: history\n });\n}\n\nif (process.env.NODE_ENV !== \"production\") {\n HistoryRouter.displayName = \"unstable_HistoryRouter\";\n}\n\nfunction isModifiedEvent(event) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\n/**\n * The public API for rendering a history-aware .\n */\nconst Link = /*#__PURE__*/forwardRef(function LinkWithRef(_ref4, ref) {\n let {\n onClick,\n reloadDocument,\n replace = false,\n state,\n target,\n to\n } = _ref4,\n rest = _objectWithoutPropertiesLoose(_ref4, _excluded);\n\n let href = useHref(to);\n let internalOnClick = useLinkClickHandler(to, {\n replace,\n state,\n target\n });\n\n function handleClick(event) {\n if (onClick) onClick(event);\n\n if (!event.defaultPrevented && !reloadDocument) {\n internalOnClick(event);\n }\n }\n\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n createElement(\"a\", _extends({}, rest, {\n href: href,\n onClick: handleClick,\n ref: ref,\n target: target\n }))\n );\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n Link.displayName = \"Link\";\n}\n\n/**\n * A wrapper that knows if it's \"active\" or not.\n */\nconst NavLink = /*#__PURE__*/forwardRef(function NavLinkWithRef(_ref5, ref) {\n let {\n \"aria-current\": ariaCurrentProp = \"page\",\n caseSensitive = false,\n className: classNameProp = \"\",\n end = false,\n style: styleProp,\n to,\n children\n } = _ref5,\n rest = _objectWithoutPropertiesLoose(_ref5, _excluded2);\n\n let location = useLocation();\n let path = useResolvedPath(to);\n let locationPathname = location.pathname;\n let toPathname = path.pathname;\n\n if (!caseSensitive) {\n locationPathname = locationPathname.toLowerCase();\n toPathname = toPathname.toLowerCase();\n }\n\n let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === \"/\";\n let ariaCurrent = isActive ? ariaCurrentProp : undefined;\n let className;\n\n if (typeof classNameProp === \"function\") {\n className = classNameProp({\n isActive\n });\n } else {\n // If the className prop is not a function, we use a default `active`\n // class for s that are active. In v5 `active` was the default\n // value for `activeClassName`, but we are removing that API and can still\n // use the old default behavior for a cleaner upgrade path and keep the\n // simple styling rules working as they currently do.\n className = [classNameProp, isActive ? \"active\" : null].filter(Boolean).join(\" \");\n }\n\n let style = typeof styleProp === \"function\" ? styleProp({\n isActive\n }) : styleProp;\n return /*#__PURE__*/createElement(Link, _extends({}, rest, {\n \"aria-current\": ariaCurrent,\n className: className,\n ref: ref,\n style: style,\n to: to\n }), typeof children === \"function\" ? children({\n isActive\n }) : children);\n});\n\nif (process.env.NODE_ENV !== \"production\") {\n NavLink.displayName = \"NavLink\";\n} ////////////////////////////////////////////////////////////////////////////////\n// HOOKS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Handles the click behavior for router `` components. This is useful if\n * you need to create custom `` components with the same click behavior we\n * use in our exported ``.\n */\n\n\nfunction useLinkClickHandler(to, _temp) {\n let {\n target,\n replace: replaceProp,\n state\n } = _temp === void 0 ? {} : _temp;\n let navigate = useNavigate();\n let location = useLocation();\n let path = useResolvedPath(to);\n return useCallback(event => {\n if (event.button === 0 && ( // Ignore everything but left clicks\n !target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n ) {\n event.preventDefault(); // If the URL hasn't changed, a regular will do a replace instead of\n // a push, so do the same here.\n\n let replace = !!replaceProp || createPath(location) === createPath(path);\n navigate(to, {\n replace,\n state\n });\n }\n }, [location, navigate, path, replaceProp, state, target, to]);\n}\n/**\n * A convenient wrapper for reading and writing search parameters via the\n * URLSearchParams interface.\n */\n\nfunction useSearchParams(defaultInit) {\n process.env.NODE_ENV !== \"production\" ? warning(typeof URLSearchParams !== \"undefined\", \"You cannot use the `useSearchParams` hook in a browser that does not \" + \"support the URLSearchParams API. If you need to support Internet \" + \"Explorer 11, we recommend you load a polyfill such as \" + \"https://github.com/ungap/url-search-params\\n\\n\" + \"If you're unsure how to load polyfills, we recommend you check out \" + \"https://polyfill.io/v3/ which provides some recommendations about how \" + \"to load polyfills only for users that need them, instead of for every \" + \"user.\") : void 0;\n let defaultSearchParamsRef = useRef(createSearchParams(defaultInit));\n let location = useLocation();\n let searchParams = useMemo(() => {\n let searchParams = createSearchParams(location.search);\n\n for (let key of defaultSearchParamsRef.current.keys()) {\n if (!searchParams.has(key)) {\n defaultSearchParamsRef.current.getAll(key).forEach(value => {\n searchParams.append(key, value);\n });\n }\n }\n\n return searchParams;\n }, [location.search]);\n let navigate = useNavigate();\n let setSearchParams = useCallback((nextInit, navigateOptions) => {\n navigate(\"?\" + createSearchParams(nextInit), navigateOptions);\n }, [navigate]);\n return [searchParams, setSearchParams];\n}\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nfunction createSearchParams(init) {\n if (init === void 0) {\n init = \"\";\n }\n\n return new URLSearchParams(typeof init === \"string\" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);\n }, []));\n}\n\nexport { BrowserRouter, HashRouter, Link, NavLink, createSearchParams, HistoryRouter as unstable_HistoryRouter, useLinkClickHandler, useSearchParams };\n//# sourceMappingURL=index.js.map\n","class Subscribable {\n constructor() {\n this.listeners = [];\n this.subscribe = this.subscribe.bind(this);\n }\n\n subscribe(listener) {\n this.listeners.push(listener);\n this.onSubscribe();\n return () => {\n this.listeners = this.listeners.filter(x => x !== listener);\n this.onUnsubscribe();\n };\n }\n\n hasListeners() {\n return this.listeners.length > 0;\n }\n\n onSubscribe() {// Do nothing\n }\n\n onUnsubscribe() {// Do nothing\n }\n\n}\n\nexport { Subscribable };\n//# sourceMappingURL=subscribable.esm.js.map\n","// TYPES\n// UTILS\nconst isServer = typeof window === 'undefined' || 'Deno' in window;\nfunction noop() {\n return undefined;\n}\nfunction functionalUpdate(updater, input) {\n return typeof updater === 'function' ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n return typeof value === 'number' && value >= 0 && value !== Infinity;\n}\nfunction difference(array1, array2) {\n return array1.filter(x => array2.indexOf(x) === -1);\n}\nfunction replaceAt(array, index, value) {\n const copy = array.slice(0);\n copy[index] = value;\n return copy;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction parseQueryArgs(arg1, arg2, arg3) {\n if (!isQueryKey(arg1)) {\n return arg1;\n }\n\n if (typeof arg2 === 'function') {\n return { ...arg3,\n queryKey: arg1,\n queryFn: arg2\n };\n }\n\n return { ...arg2,\n queryKey: arg1\n };\n}\nfunction parseMutationArgs(arg1, arg2, arg3) {\n if (isQueryKey(arg1)) {\n if (typeof arg2 === 'function') {\n return { ...arg3,\n mutationKey: arg1,\n mutationFn: arg2\n };\n }\n\n return { ...arg2,\n mutationKey: arg1\n };\n }\n\n if (typeof arg1 === 'function') {\n return { ...arg2,\n mutationFn: arg1\n };\n }\n\n return { ...arg1\n };\n}\nfunction parseFilterArgs(arg1, arg2, arg3) {\n return isQueryKey(arg1) ? [{ ...arg2,\n queryKey: arg1\n }, arg3] : [arg1 || {}, arg2];\n}\nfunction parseMutationFilterArgs(arg1, arg2, arg3) {\n return isQueryKey(arg1) ? [{ ...arg2,\n mutationKey: arg1\n }, arg3] : [arg1 || {}, arg2];\n}\nfunction matchQuery(filters, query) {\n const {\n type = 'all',\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale\n } = filters;\n\n if (isQueryKey(queryKey)) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n\n if (type !== 'all') {\n const isActive = query.isActive();\n\n if (type === 'active' && !isActive) {\n return false;\n }\n\n if (type === 'inactive' && isActive) {\n return false;\n }\n }\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false;\n }\n\n if (typeof fetchStatus !== 'undefined' && fetchStatus !== query.state.fetchStatus) {\n return false;\n }\n\n if (predicate && !predicate(query)) {\n return false;\n }\n\n return true;\n}\nfunction matchMutation(filters, mutation) {\n const {\n exact,\n fetching,\n predicate,\n mutationKey\n } = filters;\n\n if (isQueryKey(mutationKey)) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n\n if (exact) {\n if (hashQueryKey(mutation.options.mutationKey) !== hashQueryKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n\n if (typeof fetching === 'boolean' && mutation.state.status === 'loading' !== fetching) {\n return false;\n }\n\n if (predicate && !predicate(mutation)) {\n return false;\n }\n\n return true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n const hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashQueryKey;\n return hashFn(queryKey);\n}\n/**\n * Default query keys hash function.\n * Hashes the value into a stable hash.\n */\n\nfunction hashQueryKey(queryKey) {\n return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n result[key] = val[key];\n return result;\n }, {}) : val);\n}\n/**\n * Checks if key `b` partially matches with key `a`.\n */\n\nfunction partialMatchKey(a, b) {\n return partialDeepEqual(a, b);\n}\n/**\n * Checks if `b` partially matches with `a`.\n */\n\nfunction partialDeepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));\n }\n\n return false;\n}\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\n\nfunction replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n\n const array = isPlainArray(a) && isPlainArray(b);\n\n if (array || isPlainObject(a) && isPlainObject(b)) {\n const aSize = array ? a.length : Object.keys(a).length;\n const bItems = array ? b : Object.keys(b);\n const bSize = bItems.length;\n const copy = array ? [] : {};\n let equalItems = 0;\n\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i];\n copy[key] = replaceEqualDeep(a[key], b[key]);\n\n if (copy[key] === a[key]) {\n equalItems++;\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n\n return b;\n}\n/**\n * Shallow compare objects. Only works with objects that always have the same properties.\n */\n\nfunction shallowEqualObjects(a, b) {\n if (a && !b || b && !a) {\n return false;\n }\n\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n\n return true;\n}\nfunction isPlainArray(value) {\n return Array.isArray(value) && value.length === Object.keys(value).length;\n} // Copied from: https://github.com/jonschlinkert/is-plain-object\n\nfunction isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n } // If has modified constructor\n\n\n const ctor = o.constructor;\n\n if (typeof ctor === 'undefined') {\n return true;\n } // If has modified prototype\n\n\n const prot = ctor.prototype;\n\n if (!hasObjectPrototype(prot)) {\n return false;\n } // If constructor does not have an Object-specific method\n\n\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false;\n } // Most likely a plain Object\n\n\n return true;\n}\n\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isQueryKey(value) {\n return Array.isArray(value);\n}\nfunction isError(value) {\n return value instanceof Error;\n}\nfunction sleep(timeout) {\n return new Promise(resolve => {\n setTimeout(resolve, timeout);\n });\n}\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\n\nfunction scheduleMicrotask(callback) {\n sleep(0).then(callback);\n}\nfunction getAbortController() {\n if (typeof AbortController === 'function') {\n return new AbortController();\n }\n\n return;\n}\nfunction replaceData(prevData, data, options) {\n // Use prev data if an isDataEqual function is defined and returns `true`\n if (options.isDataEqual != null && options.isDataEqual(prevData, data)) {\n return prevData;\n } else if (typeof options.structuralSharing === 'function') {\n return options.structuralSharing(prevData, data);\n } else if (options.structuralSharing !== false) {\n // Structurally share data between prev and new data if needed\n return replaceEqualDeep(prevData, data);\n }\n\n return data;\n}\n\nexport { difference, functionalUpdate, getAbortController, hashQueryKey, hashQueryKeyByOptions, isError, isPlainArray, isPlainObject, isQueryKey, isServer, isValidTimeout, matchMutation, matchQuery, noop, parseFilterArgs, parseMutationArgs, parseMutationFilterArgs, parseQueryArgs, partialDeepEqual, partialMatchKey, replaceAt, replaceData, replaceEqualDeep, scheduleMicrotask, shallowEqualObjects, sleep, timeUntilStale };\n//# sourceMappingURL=utils.esm.js.map\n","import { Subscribable } from './subscribable.esm.js';\nimport { isServer } from './utils.esm.js';\n\nclass FocusManager extends Subscribable {\n constructor() {\n super();\n\n this.setup = onFocus => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus(); // Listen to visibillitychange and focus\n\n\n window.addEventListener('visibilitychange', listener, false);\n window.addEventListener('focus', listener, false);\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener);\n window.removeEventListener('focus', listener);\n };\n }\n\n return;\n };\n }\n\n onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n }\n\n onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n }\n\n setEventListener(setup) {\n var _this$cleanup2;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(focused => {\n if (typeof focused === 'boolean') {\n this.setFocused(focused);\n } else {\n this.onFocus();\n }\n });\n }\n\n setFocused(focused) {\n this.focused = focused;\n\n if (focused) {\n this.onFocus();\n }\n }\n\n onFocus() {\n this.listeners.forEach(listener => {\n listener();\n });\n }\n\n isFocused() {\n if (typeof this.focused === 'boolean') {\n return this.focused;\n } // document global can be unavailable in react native\n\n\n if (typeof document === 'undefined') {\n return true;\n }\n\n return [undefined, 'visible', 'prerender'].includes(document.visibilityState);\n }\n\n}\nconst focusManager = new FocusManager();\n\nexport { FocusManager, focusManager };\n//# sourceMappingURL=focusManager.esm.js.map\n","import { Subscribable } from './subscribable.esm.js';\nimport { isServer } from './utils.esm.js';\n\nclass OnlineManager extends Subscribable {\n constructor() {\n super();\n\n this.setup = onOnline => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const listener = () => onOnline(); // Listen to online\n\n\n window.addEventListener('online', listener, false);\n window.addEventListener('offline', listener, false);\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('online', listener);\n window.removeEventListener('offline', listener);\n };\n }\n\n return;\n };\n }\n\n onSubscribe() {\n if (!this.cleanup) {\n this.setEventListener(this.setup);\n }\n }\n\n onUnsubscribe() {\n if (!this.hasListeners()) {\n var _this$cleanup;\n\n (_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);\n this.cleanup = undefined;\n }\n }\n\n setEventListener(setup) {\n var _this$cleanup2;\n\n this.setup = setup;\n (_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);\n this.cleanup = setup(online => {\n if (typeof online === 'boolean') {\n this.setOnline(online);\n } else {\n this.onOnline();\n }\n });\n }\n\n setOnline(online) {\n this.online = online;\n\n if (online) {\n this.onOnline();\n }\n }\n\n onOnline() {\n this.listeners.forEach(listener => {\n listener();\n });\n }\n\n isOnline() {\n if (typeof this.online === 'boolean') {\n return this.online;\n }\n\n if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {\n return true;\n }\n\n return navigator.onLine;\n }\n\n}\nconst onlineManager = new OnlineManager();\n\nexport { OnlineManager, onlineManager };\n//# sourceMappingURL=onlineManager.esm.js.map\n","import { focusManager } from './focusManager.esm.js';\nimport { onlineManager } from './onlineManager.esm.js';\nimport { sleep } from './utils.esm.js';\n\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1000 * 2 ** failureCount, 30000);\n}\n\nfunction canFetch(networkMode) {\n return (networkMode != null ? networkMode : 'online') === 'online' ? onlineManager.isOnline() : true;\n}\nclass CancelledError {\n constructor(options) {\n this.revert = options == null ? void 0 : options.revert;\n this.silent = options == null ? void 0 : options.silent;\n }\n\n}\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let isResolved = false;\n let continueFn;\n let promiseResolve;\n let promiseReject;\n const promise = new Promise((outerResolve, outerReject) => {\n promiseResolve = outerResolve;\n promiseReject = outerReject;\n });\n\n const cancel = cancelOptions => {\n if (!isResolved) {\n reject(new CancelledError(cancelOptions));\n config.abort == null ? void 0 : config.abort();\n }\n };\n\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n\n const shouldPause = () => !focusManager.isFocused() || config.networkMode !== 'always' && !onlineManager.isOnline();\n\n const resolve = value => {\n if (!isResolved) {\n isResolved = true;\n config.onSuccess == null ? void 0 : config.onSuccess(value);\n continueFn == null ? void 0 : continueFn();\n promiseResolve(value);\n }\n };\n\n const reject = value => {\n if (!isResolved) {\n isResolved = true;\n config.onError == null ? void 0 : config.onError(value);\n continueFn == null ? void 0 : continueFn();\n promiseReject(value);\n }\n };\n\n const pause = () => {\n return new Promise(continueResolve => {\n continueFn = value => {\n const canContinue = isResolved || !shouldPause();\n\n if (canContinue) {\n continueResolve(value);\n }\n\n return canContinue;\n };\n\n config.onPause == null ? void 0 : config.onPause();\n }).then(() => {\n continueFn = undefined;\n\n if (!isResolved) {\n config.onContinue == null ? void 0 : config.onContinue();\n }\n });\n }; // Create loop function\n\n\n const run = () => {\n // Do nothing if already resolved\n if (isResolved) {\n return;\n }\n\n let promiseOrValue; // Execute query\n\n try {\n promiseOrValue = config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n\n Promise.resolve(promiseOrValue).then(resolve).catch(error => {\n var _config$retry, _config$retryDelay;\n\n // Stop if the fetch is already resolved\n if (isResolved) {\n return;\n } // Do we need to retry the request?\n\n\n const retry = (_config$retry = config.retry) != null ? _config$retry : 3;\n const retryDelay = (_config$retryDelay = config.retryDelay) != null ? _config$retryDelay : defaultRetryDelay;\n const delay = typeof retryDelay === 'function' ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === 'number' && failureCount < retry || typeof retry === 'function' && retry(failureCount, error);\n\n if (isRetryCancelled || !shouldRetry) {\n // We are done if the query does not need to be retried\n reject(error);\n return;\n }\n\n failureCount++; // Notify on fail\n\n config.onFail == null ? void 0 : config.onFail(failureCount, error); // Delay\n\n sleep(delay) // Pause if the document is not visible or when the device is offline\n .then(() => {\n if (shouldPause()) {\n return pause();\n }\n\n return;\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n }; // Start loop\n\n\n if (canFetch(config.networkMode)) {\n run();\n } else {\n pause().then(run);\n }\n\n return {\n promise,\n cancel,\n continue: () => {\n const didContinue = continueFn == null ? void 0 : continueFn();\n return didContinue ? promise : Promise.resolve();\n },\n cancelRetry,\n continueRetry\n };\n}\n\nexport { CancelledError, canFetch, createRetryer, isCancelledError };\n//# sourceMappingURL=retryer.esm.js.map\n","const defaultLogger = console;\n\nexport { defaultLogger };\n//# sourceMappingURL=logger.esm.js.map\n","import { scheduleMicrotask } from './utils.esm.js';\n\nfunction createNotifyManager() {\n let queue = [];\n let transactions = 0;\n\n let notifyFn = callback => {\n callback();\n };\n\n let batchNotifyFn = callback => {\n callback();\n };\n\n const batch = callback => {\n let result;\n transactions++;\n\n try {\n result = callback();\n } finally {\n transactions--;\n\n if (!transactions) {\n flush();\n }\n }\n\n return result;\n };\n\n const schedule = callback => {\n if (transactions) {\n queue.push(callback);\n } else {\n scheduleMicrotask(() => {\n notifyFn(callback);\n });\n }\n };\n /**\n * All calls to the wrapped function will be batched.\n */\n\n\n const batchCalls = callback => {\n return (...args) => {\n schedule(() => {\n callback(...args);\n });\n };\n };\n\n const flush = () => {\n const originalQueue = queue;\n queue = [];\n\n if (originalQueue.length) {\n scheduleMicrotask(() => {\n batchNotifyFn(() => {\n originalQueue.forEach(callback => {\n notifyFn(callback);\n });\n });\n });\n }\n };\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n\n\n const setNotifyFunction = fn => {\n notifyFn = fn;\n };\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n\n\n const setBatchNotifyFunction = fn => {\n batchNotifyFn = fn;\n };\n\n return {\n batch,\n batchCalls,\n schedule,\n setNotifyFunction,\n setBatchNotifyFunction\n };\n} // SINGLETON\n\nconst notifyManager = createNotifyManager();\n\nexport { createNotifyManager, notifyManager };\n//# sourceMappingURL=notifyManager.esm.js.map\n","import { isValidTimeout, isServer } from './utils.esm.js';\n\nclass Removable {\n destroy() {\n this.clearGcTimeout();\n }\n\n scheduleGc() {\n this.clearGcTimeout();\n\n if (isValidTimeout(this.cacheTime)) {\n this.gcTimeout = setTimeout(() => {\n this.optionalRemove();\n }, this.cacheTime);\n }\n }\n\n updateCacheTime(newCacheTime) {\n // Default to 5 minutes (Infinity for server-side) if no cache time is set\n this.cacheTime = Math.max(this.cacheTime || 0, newCacheTime != null ? newCacheTime : isServer ? Infinity : 5 * 60 * 1000);\n }\n\n clearGcTimeout() {\n if (this.gcTimeout) {\n clearTimeout(this.gcTimeout);\n this.gcTimeout = undefined;\n }\n }\n\n}\n\nexport { Removable };\n//# sourceMappingURL=removable.esm.js.map\n","import { replaceData, noop, timeUntilStale, getAbortController } from './utils.esm.js';\nimport { defaultLogger } from './logger.esm.js';\nimport { notifyManager } from './notifyManager.esm.js';\nimport { createRetryer, isCancelledError, canFetch } from './retryer.esm.js';\nimport { Removable } from './removable.esm.js';\n\n// CLASS\nclass Query extends Removable {\n constructor(config) {\n super();\n this.abortSignalConsumed = false;\n this.defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.cache = config.cache;\n this.logger = config.logger || defaultLogger;\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.initialState = config.state || getDefaultState(this.options);\n this.state = this.initialState;\n this.scheduleGc();\n }\n\n get meta() {\n return this.options.meta;\n }\n\n setOptions(options) {\n this.options = { ...this.defaultOptions,\n ...options\n };\n this.updateCacheTime(this.options.cacheTime);\n }\n\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === 'idle') {\n this.cache.remove(this);\n }\n }\n\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options); // Set data and mark it as cached\n\n this.dispatch({\n data,\n type: 'success',\n dataUpdatedAt: options == null ? void 0 : options.updatedAt,\n manual: options == null ? void 0 : options.manual\n });\n return data;\n }\n\n setState(state, setStateOptions) {\n this.dispatch({\n type: 'setState',\n state,\n setStateOptions\n });\n }\n\n cancel(options) {\n var _this$retryer;\n\n const promise = this.promise;\n (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n\n destroy() {\n super.destroy();\n this.cancel({\n silent: true\n });\n }\n\n reset() {\n this.destroy();\n this.setState(this.initialState);\n }\n\n isActive() {\n return this.observers.some(observer => observer.options.enabled !== false);\n }\n\n isDisabled() {\n return this.getObserversCount() > 0 && !this.isActive();\n }\n\n isStale() {\n return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some(observer => observer.getCurrentResult().isStale);\n }\n\n isStaleByTime(staleTime = 0) {\n return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n\n onFocus() {\n var _this$retryer2;\n\n const observer = this.observers.find(x => x.shouldFetchOnWindowFocus());\n\n if (observer) {\n observer.refetch({\n cancelRefetch: false\n });\n } // Continue fetch if currently paused\n\n\n (_this$retryer2 = this.retryer) == null ? void 0 : _this$retryer2.continue();\n }\n\n onOnline() {\n var _this$retryer3;\n\n const observer = this.observers.find(x => x.shouldFetchOnReconnect());\n\n if (observer) {\n observer.refetch({\n cancelRefetch: false\n });\n } // Continue fetch if currently paused\n\n\n (_this$retryer3 = this.retryer) == null ? void 0 : _this$retryer3.continue();\n }\n\n addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer); // Stop the query from being garbage collected\n\n this.clearGcTimeout();\n this.cache.notify({\n type: 'observerAdded',\n query: this,\n observer\n });\n }\n }\n\n removeObserver(observer) {\n if (this.observers.indexOf(observer) !== -1) {\n this.observers = this.observers.filter(x => x !== observer);\n\n if (!this.observers.length) {\n // If the transport layer does not support cancellation\n // we'll let the query continue so the result can be cached\n if (this.retryer) {\n if (this.abortSignalConsumed) {\n this.retryer.cancel({\n revert: true\n });\n } else {\n this.retryer.cancelRetry();\n }\n }\n\n this.scheduleGc();\n }\n\n this.cache.notify({\n type: 'observerRemoved',\n query: this,\n observer\n });\n }\n }\n\n getObserversCount() {\n return this.observers.length;\n }\n\n invalidate() {\n if (!this.state.isInvalidated) {\n this.dispatch({\n type: 'invalidate'\n });\n }\n }\n\n fetch(options, fetchOptions) {\n var _this$options$behavio, _context$fetchOptions;\n\n if (this.state.fetchStatus !== 'idle') {\n if (this.state.dataUpdatedAt && fetchOptions != null && fetchOptions.cancelRefetch) {\n // Silently cancel current fetch if the user wants to cancel refetches\n this.cancel({\n silent: true\n });\n } else if (this.promise) {\n var _this$retryer4;\n\n // make sure that retries that were potentially cancelled due to unmounts can continue\n (_this$retryer4 = this.retryer) == null ? void 0 : _this$retryer4.continueRetry(); // Return current promise if we are already fetching\n\n return this.promise;\n }\n } // Update config if passed, otherwise the config from the last execution is used\n\n\n if (options) {\n this.setOptions(options);\n } // Use the options from the first observer with a query function if no function is found.\n // This can happen when the query is hydrated or created with setQueryData.\n\n\n if (!this.options.queryFn) {\n const observer = this.observers.find(x => x.options.queryFn);\n\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n\n if (!Array.isArray(this.options.queryKey)) {\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(\"As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']\");\n }\n }\n\n const abortController = getAbortController(); // Create query function context\n\n const queryFnContext = {\n queryKey: this.queryKey,\n pageParam: undefined,\n meta: this.meta\n }; // Adds an enumerable signal property to the object that\n // which sets abortSignalConsumed to true when the signal\n // is read.\n\n const addSignalProperty = object => {\n Object.defineProperty(object, 'signal', {\n enumerable: true,\n get: () => {\n if (abortController) {\n this.abortSignalConsumed = true;\n return abortController.signal;\n }\n\n return undefined;\n }\n });\n };\n\n addSignalProperty(queryFnContext); // Create fetch function\n\n const fetchFn = () => {\n if (!this.options.queryFn) {\n return Promise.reject('Missing queryFn');\n }\n\n this.abortSignalConsumed = false;\n return this.options.queryFn(queryFnContext);\n }; // Trigger behavior hook\n\n\n const context = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n state: this.state,\n fetchFn\n };\n addSignalProperty(context);\n (_this$options$behavio = this.options.behavior) == null ? void 0 : _this$options$behavio.onFetch(context); // Store state in case the current fetch needs to be reverted\n\n this.revertState = this.state; // Set to fetching state if not already in it\n\n if (this.state.fetchStatus === 'idle' || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {\n var _context$fetchOptions2;\n\n this.dispatch({\n type: 'fetch',\n meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta\n });\n }\n\n const onError = error => {\n // Optimistically update state if needed\n if (!(isCancelledError(error) && error.silent)) {\n this.dispatch({\n type: 'error',\n error: error\n });\n }\n\n if (!isCancelledError(error)) {\n var _this$cache$config$on, _this$cache$config, _this$cache$config$on2, _this$cache$config2;\n\n // Notify cache callback\n (_this$cache$config$on = (_this$cache$config = this.cache.config).onError) == null ? void 0 : _this$cache$config$on.call(_this$cache$config, error, this);\n (_this$cache$config$on2 = (_this$cache$config2 = this.cache.config).onSettled) == null ? void 0 : _this$cache$config$on2.call(_this$cache$config2, this.state.data, error, this);\n\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(error);\n }\n }\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc();\n }\n\n this.isFetchingOptimistic = false;\n }; // Try to fetch the data\n\n\n this.retryer = createRetryer({\n fn: context.fetchFn,\n abort: abortController == null ? void 0 : abortController.abort.bind(abortController),\n onSuccess: data => {\n var _this$cache$config$on3, _this$cache$config3, _this$cache$config$on4, _this$cache$config4;\n\n if (typeof data === 'undefined') {\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(\"Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: \" + this.queryHash);\n }\n\n onError(new Error('undefined'));\n return;\n }\n\n this.setData(data); // Notify cache callback\n\n (_this$cache$config$on3 = (_this$cache$config3 = this.cache.config).onSuccess) == null ? void 0 : _this$cache$config$on3.call(_this$cache$config3, data, this);\n (_this$cache$config$on4 = (_this$cache$config4 = this.cache.config).onSettled) == null ? void 0 : _this$cache$config$on4.call(_this$cache$config4, data, this.state.error, this);\n\n if (!this.isFetchingOptimistic) {\n // Schedule query gc after fetching\n this.scheduleGc();\n }\n\n this.isFetchingOptimistic = false;\n },\n onError,\n onFail: (failureCount, error) => {\n this.dispatch({\n type: 'failed',\n failureCount,\n error\n });\n },\n onPause: () => {\n this.dispatch({\n type: 'pause'\n });\n },\n onContinue: () => {\n this.dispatch({\n type: 'continue'\n });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode\n });\n this.promise = this.retryer.promise;\n return this.promise;\n }\n\n dispatch(action) {\n const reducer = state => {\n var _action$meta, _action$dataUpdatedAt;\n\n switch (action.type) {\n case 'failed':\n return { ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error\n };\n\n case 'pause':\n return { ...state,\n fetchStatus: 'paused'\n };\n\n case 'continue':\n return { ...state,\n fetchStatus: 'fetching'\n };\n\n case 'fetch':\n return { ...state,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,\n fetchStatus: canFetch(this.options.networkMode) ? 'fetching' : 'paused',\n ...(!state.dataUpdatedAt && {\n error: null,\n status: 'loading'\n })\n };\n\n case 'success':\n return { ...state,\n data: action.data,\n dataUpdateCount: state.dataUpdateCount + 1,\n dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),\n error: null,\n isInvalidated: false,\n status: 'success',\n ...(!action.manual && {\n fetchStatus: 'idle',\n fetchFailureCount: 0,\n fetchFailureReason: null\n })\n };\n\n case 'error':\n const error = action.error;\n\n if (isCancelledError(error) && error.revert && this.revertState) {\n return { ...this.revertState\n };\n }\n\n return { ...state,\n error: error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: 'idle',\n status: 'error'\n };\n\n case 'invalidate':\n return { ...state,\n isInvalidated: true\n };\n\n case 'setState':\n return { ...state,\n ...action.state\n };\n }\n };\n\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach(observer => {\n observer.onQueryUpdate(action);\n });\n this.cache.notify({\n query: this,\n type: 'updated',\n action\n });\n });\n }\n\n}\n\nfunction getDefaultState(options) {\n const data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;\n const hasData = typeof data !== 'undefined';\n const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? 'success' : 'loading',\n fetchStatus: 'idle'\n };\n}\n\nexport { Query };\n//# sourceMappingURL=query.esm.js.map\n","import { hashQueryKeyByOptions, parseFilterArgs, matchQuery } from './utils.esm.js';\nimport { Query } from './query.esm.js';\nimport { notifyManager } from './notifyManager.esm.js';\nimport { Subscribable } from './subscribable.esm.js';\n\n// CLASS\nclass QueryCache extends Subscribable {\n constructor(config) {\n super();\n this.config = config || {};\n this.queries = [];\n this.queriesMap = {};\n }\n\n build(client, options, state) {\n var _options$queryHash;\n\n const queryKey = options.queryKey;\n const queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : hashQueryKeyByOptions(queryKey, options);\n let query = this.get(queryHash);\n\n if (!query) {\n query = new Query({\n cache: this,\n logger: client.getLogger(),\n queryKey,\n queryHash,\n options: client.defaultQueryOptions(options),\n state,\n defaultOptions: client.getQueryDefaults(queryKey)\n });\n this.add(query);\n }\n\n return query;\n }\n\n add(query) {\n if (!this.queriesMap[query.queryHash]) {\n this.queriesMap[query.queryHash] = query;\n this.queries.push(query);\n this.notify({\n type: 'added',\n query\n });\n }\n }\n\n remove(query) {\n const queryInMap = this.queriesMap[query.queryHash];\n\n if (queryInMap) {\n query.destroy();\n this.queries = this.queries.filter(x => x !== query);\n\n if (queryInMap === query) {\n delete this.queriesMap[query.queryHash];\n }\n\n this.notify({\n type: 'removed',\n query\n });\n }\n }\n\n clear() {\n notifyManager.batch(() => {\n this.queries.forEach(query => {\n this.remove(query);\n });\n });\n }\n\n get(queryHash) {\n return this.queriesMap[queryHash];\n }\n\n getAll() {\n return this.queries;\n }\n\n find(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.queries.find(query => matchQuery(filters, query));\n }\n\n findAll(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n return Object.keys(filters).length > 0 ? this.queries.filter(query => matchQuery(filters, query)) : this.queries;\n }\n\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach(listener => {\n listener(event);\n });\n });\n }\n\n onFocus() {\n notifyManager.batch(() => {\n this.queries.forEach(query => {\n query.onFocus();\n });\n });\n }\n\n onOnline() {\n notifyManager.batch(() => {\n this.queries.forEach(query => {\n query.onOnline();\n });\n });\n }\n\n}\n\nexport { QueryCache };\n//# sourceMappingURL=queryCache.esm.js.map\n","import { defaultLogger } from './logger.esm.js';\nimport { notifyManager } from './notifyManager.esm.js';\nimport { Removable } from './removable.esm.js';\nimport { createRetryer, canFetch } from './retryer.esm.js';\n\n// CLASS\nclass Mutation extends Removable {\n constructor(config) {\n super();\n this.options = { ...config.defaultOptions,\n ...config.options\n };\n this.mutationId = config.mutationId;\n this.mutationCache = config.mutationCache;\n this.logger = config.logger || defaultLogger;\n this.observers = [];\n this.state = config.state || getDefaultState();\n this.updateCacheTime(this.options.cacheTime);\n this.scheduleGc();\n }\n\n get meta() {\n return this.options.meta;\n }\n\n setState(state) {\n this.dispatch({\n type: 'setState',\n state\n });\n }\n\n addObserver(observer) {\n if (this.observers.indexOf(observer) === -1) {\n this.observers.push(observer); // Stop the mutation from being garbage collected\n\n this.clearGcTimeout();\n this.mutationCache.notify({\n type: 'observerAdded',\n mutation: this,\n observer\n });\n }\n }\n\n removeObserver(observer) {\n this.observers = this.observers.filter(x => x !== observer);\n this.scheduleGc();\n this.mutationCache.notify({\n type: 'observerRemoved',\n mutation: this,\n observer\n });\n }\n\n optionalRemove() {\n if (!this.observers.length) {\n if (this.state.status === 'loading') {\n this.scheduleGc();\n } else {\n this.mutationCache.remove(this);\n }\n }\n }\n\n continue() {\n var _this$retryer$continu, _this$retryer;\n\n return (_this$retryer$continu = (_this$retryer = this.retryer) == null ? void 0 : _this$retryer.continue()) != null ? _this$retryer$continu : this.execute();\n }\n\n async execute() {\n const executeMutation = () => {\n var _this$options$retry;\n\n this.retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject('No mutationFn found');\n }\n\n return this.options.mutationFn(this.state.variables);\n },\n onFail: (failureCount, error) => {\n this.dispatch({\n type: 'failed',\n failureCount,\n error\n });\n },\n onPause: () => {\n this.dispatch({\n type: 'pause'\n });\n },\n onContinue: () => {\n this.dispatch({\n type: 'continue'\n });\n },\n retry: (_this$options$retry = this.options.retry) != null ? _this$options$retry : 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode\n });\n return this.retryer.promise;\n };\n\n const restored = this.state.status === 'loading';\n\n try {\n var _this$mutationCache$c3, _this$mutationCache$c4, _this$options$onSucce, _this$options2, _this$mutationCache$c5, _this$mutationCache$c6, _this$options$onSettl, _this$options3;\n\n if (!restored) {\n var _this$mutationCache$c, _this$mutationCache$c2, _this$options$onMutat, _this$options;\n\n this.dispatch({\n type: 'loading',\n variables: this.options.variables\n }); // Notify cache callback\n\n await ((_this$mutationCache$c = (_this$mutationCache$c2 = this.mutationCache.config).onMutate) == null ? void 0 : _this$mutationCache$c.call(_this$mutationCache$c2, this.state.variables, this));\n const context = await ((_this$options$onMutat = (_this$options = this.options).onMutate) == null ? void 0 : _this$options$onMutat.call(_this$options, this.state.variables));\n\n if (context !== this.state.context) {\n this.dispatch({\n type: 'loading',\n context,\n variables: this.state.variables\n });\n }\n }\n\n const data = await executeMutation(); // Notify cache callback\n\n await ((_this$mutationCache$c3 = (_this$mutationCache$c4 = this.mutationCache.config).onSuccess) == null ? void 0 : _this$mutationCache$c3.call(_this$mutationCache$c4, data, this.state.variables, this.state.context, this));\n await ((_this$options$onSucce = (_this$options2 = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options2, data, this.state.variables, this.state.context)); // Notify cache callback\n\n await ((_this$mutationCache$c5 = (_this$mutationCache$c6 = this.mutationCache.config).onSettled) == null ? void 0 : _this$mutationCache$c5.call(_this$mutationCache$c6, data, null, this.state.variables, this.state.context, this));\n await ((_this$options$onSettl = (_this$options3 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options3, data, null, this.state.variables, this.state.context));\n this.dispatch({\n type: 'success',\n data\n });\n return data;\n } catch (error) {\n try {\n var _this$mutationCache$c7, _this$mutationCache$c8, _this$options$onError, _this$options4, _this$mutationCache$c9, _this$mutationCache$c10, _this$options$onSettl2, _this$options5;\n\n // Notify cache callback\n await ((_this$mutationCache$c7 = (_this$mutationCache$c8 = this.mutationCache.config).onError) == null ? void 0 : _this$mutationCache$c7.call(_this$mutationCache$c8, error, this.state.variables, this.state.context, this));\n\n if (process.env.NODE_ENV !== 'production') {\n this.logger.error(error);\n }\n\n await ((_this$options$onError = (_this$options4 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options4, error, this.state.variables, this.state.context)); // Notify cache callback\n\n await ((_this$mutationCache$c9 = (_this$mutationCache$c10 = this.mutationCache.config).onSettled) == null ? void 0 : _this$mutationCache$c9.call(_this$mutationCache$c10, undefined, error, this.state.variables, this.state.context, this));\n await ((_this$options$onSettl2 = (_this$options5 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options5, undefined, error, this.state.variables, this.state.context));\n throw error;\n } finally {\n this.dispatch({\n type: 'error',\n error: error\n });\n }\n }\n }\n\n dispatch(action) {\n const reducer = state => {\n switch (action.type) {\n case 'failed':\n return { ...state,\n failureCount: action.failureCount,\n failureReason: action.error\n };\n\n case 'pause':\n return { ...state,\n isPaused: true\n };\n\n case 'continue':\n return { ...state,\n isPaused: false\n };\n\n case 'loading':\n return { ...state,\n context: action.context,\n data: undefined,\n failureCount: 0,\n failureReason: null,\n error: null,\n isPaused: !canFetch(this.options.networkMode),\n status: 'loading',\n variables: action.variables\n };\n\n case 'success':\n return { ...state,\n data: action.data,\n failureCount: 0,\n failureReason: null,\n error: null,\n status: 'success',\n isPaused: false\n };\n\n case 'error':\n return { ...state,\n data: undefined,\n error: action.error,\n failureCount: state.failureCount + 1,\n failureReason: action.error,\n isPaused: false,\n status: 'error'\n };\n\n case 'setState':\n return { ...state,\n ...action.state\n };\n }\n };\n\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach(observer => {\n observer.onMutationUpdate(action);\n });\n this.mutationCache.notify({\n mutation: this,\n type: 'updated',\n action\n });\n });\n }\n\n}\nfunction getDefaultState() {\n return {\n context: undefined,\n data: undefined,\n error: null,\n failureCount: 0,\n failureReason: null,\n isPaused: false,\n status: 'idle',\n variables: undefined\n };\n}\n\nexport { Mutation, getDefaultState };\n//# sourceMappingURL=mutation.esm.js.map\n","import { notifyManager } from './notifyManager.esm.js';\nimport { Mutation } from './mutation.esm.js';\nimport { matchMutation, noop } from './utils.esm.js';\nimport { Subscribable } from './subscribable.esm.js';\n\n// CLASS\nclass MutationCache extends Subscribable {\n constructor(config) {\n super();\n this.config = config || {};\n this.mutations = [];\n this.mutationId = 0;\n }\n\n build(client, options, state) {\n const mutation = new Mutation({\n mutationCache: this,\n logger: client.getLogger(),\n mutationId: ++this.mutationId,\n options: client.defaultMutationOptions(options),\n state,\n defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : undefined\n });\n this.add(mutation);\n return mutation;\n }\n\n add(mutation) {\n this.mutations.push(mutation);\n this.notify({\n type: 'added',\n mutation\n });\n }\n\n remove(mutation) {\n this.mutations = this.mutations.filter(x => x !== mutation);\n this.notify({\n type: 'removed',\n mutation\n });\n }\n\n clear() {\n notifyManager.batch(() => {\n this.mutations.forEach(mutation => {\n this.remove(mutation);\n });\n });\n }\n\n getAll() {\n return this.mutations;\n }\n\n find(filters) {\n if (typeof filters.exact === 'undefined') {\n filters.exact = true;\n }\n\n return this.mutations.find(mutation => matchMutation(filters, mutation));\n }\n\n findAll(filters) {\n return this.mutations.filter(mutation => matchMutation(filters, mutation));\n }\n\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach(listener => {\n listener(event);\n });\n });\n }\n\n resumePausedMutations() {\n var _this$resuming;\n\n this.resuming = ((_this$resuming = this.resuming) != null ? _this$resuming : Promise.resolve()).then(() => {\n const pausedMutations = this.mutations.filter(x => x.state.isPaused);\n return notifyManager.batch(() => pausedMutations.reduce((promise, mutation) => promise.then(() => mutation.continue().catch(noop)), Promise.resolve()));\n }).then(() => {\n this.resuming = undefined;\n });\n return this.resuming;\n }\n\n}\n\nexport { MutationCache };\n//# sourceMappingURL=mutationCache.esm.js.map\n","function infiniteQueryBehavior() {\n return {\n onFetch: context => {\n context.fetchFn = () => {\n var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;\n\n const refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;\n const fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;\n const pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;\n const isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'forward';\n const isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'backward';\n const oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];\n const oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];\n let newPageParams = oldPageParams;\n let cancelled = false;\n\n const addSignalProperty = object => {\n Object.defineProperty(object, 'signal', {\n enumerable: true,\n get: () => {\n var _context$signal;\n\n if ((_context$signal = context.signal) != null && _context$signal.aborted) {\n cancelled = true;\n } else {\n var _context$signal2;\n\n (_context$signal2 = context.signal) == null ? void 0 : _context$signal2.addEventListener('abort', () => {\n cancelled = true;\n });\n }\n\n return context.signal;\n }\n });\n }; // Get query function\n\n\n const queryFn = context.options.queryFn || (() => Promise.reject('Missing queryFn'));\n\n const buildNewPages = (pages, param, page, previous) => {\n newPageParams = previous ? [param, ...newPageParams] : [...newPageParams, param];\n return previous ? [page, ...pages] : [...pages, page];\n }; // Create function to fetch a page\n\n\n const fetchPage = (pages, manual, param, previous) => {\n if (cancelled) {\n return Promise.reject('Cancelled');\n }\n\n if (typeof param === 'undefined' && !manual && pages.length) {\n return Promise.resolve(pages);\n }\n\n const queryFnContext = {\n queryKey: context.queryKey,\n pageParam: param,\n meta: context.options.meta\n };\n addSignalProperty(queryFnContext);\n const queryFnResult = queryFn(queryFnContext);\n const promise = Promise.resolve(queryFnResult).then(page => buildNewPages(pages, param, page, previous));\n return promise;\n };\n\n let promise; // Fetch first page?\n\n if (!oldPages.length) {\n promise = fetchPage([]);\n } // Fetch next page?\n else if (isFetchingNextPage) {\n const manual = typeof pageParam !== 'undefined';\n const param = manual ? pageParam : getNextPageParam(context.options, oldPages);\n promise = fetchPage(oldPages, manual, param);\n } // Fetch previous page?\n else if (isFetchingPreviousPage) {\n const manual = typeof pageParam !== 'undefined';\n const param = manual ? pageParam : getPreviousPageParam(context.options, oldPages);\n promise = fetchPage(oldPages, manual, param, true);\n } // Refetch pages\n else {\n newPageParams = [];\n const manual = typeof context.options.getNextPageParam === 'undefined';\n const shouldFetchFirstPage = refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true; // Fetch first page\n\n promise = shouldFetchFirstPage ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0])); // Fetch remaining pages\n\n for (let i = 1; i < oldPages.length; i++) {\n promise = promise.then(pages => {\n const shouldFetchNextPage = refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true;\n\n if (shouldFetchNextPage) {\n const param = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);\n return fetchPage(pages, manual, param);\n }\n\n return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));\n });\n }\n }\n\n const finalPromise = promise.then(pages => ({\n pages,\n pageParams: newPageParams\n }));\n return finalPromise;\n };\n }\n };\n}\nfunction getNextPageParam(options, pages) {\n return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);\n}\nfunction getPreviousPageParam(options, pages) {\n return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);\n}\n/**\n * Checks if there is a next page.\n * Returns `undefined` if it cannot be determined.\n */\n\nfunction hasNextPage(options, pages) {\n if (options.getNextPageParam && Array.isArray(pages)) {\n const nextPageParam = getNextPageParam(options, pages);\n return typeof nextPageParam !== 'undefined' && nextPageParam !== null && nextPageParam !== false;\n }\n\n return;\n}\n/**\n * Checks if there is a previous page.\n * Returns `undefined` if it cannot be determined.\n */\n\nfunction hasPreviousPage(options, pages) {\n if (options.getPreviousPageParam && Array.isArray(pages)) {\n const previousPageParam = getPreviousPageParam(options, pages);\n return typeof previousPageParam !== 'undefined' && previousPageParam !== null && previousPageParam !== false;\n }\n\n return;\n}\n\nexport { getNextPageParam, getPreviousPageParam, hasNextPage, hasPreviousPage, infiniteQueryBehavior };\n//# sourceMappingURL=infiniteQueryBehavior.esm.js.map\n","import { parseFilterArgs, parseQueryArgs, functionalUpdate, noop, hashQueryKey, partialMatchKey, hashQueryKeyByOptions } from './utils.esm.js';\nimport { QueryCache } from './queryCache.esm.js';\nimport { MutationCache } from './mutationCache.esm.js';\nimport { focusManager } from './focusManager.esm.js';\nimport { onlineManager } from './onlineManager.esm.js';\nimport { notifyManager } from './notifyManager.esm.js';\nimport { infiniteQueryBehavior } from './infiniteQueryBehavior.esm.js';\nimport { defaultLogger } from './logger.esm.js';\n\n// CLASS\nclass QueryClient {\n constructor(config = {}) {\n this.queryCache = config.queryCache || new QueryCache();\n this.mutationCache = config.mutationCache || new MutationCache();\n this.logger = config.logger || defaultLogger;\n this.defaultOptions = config.defaultOptions || {};\n this.queryDefaults = [];\n this.mutationDefaults = [];\n this.mountCount = 0;\n\n if (process.env.NODE_ENV !== 'production' && config.logger) {\n this.logger.error(\"Passing a custom logger has been deprecated and will be removed in the next major version.\");\n }\n }\n\n mount() {\n this.mountCount++;\n if (this.mountCount !== 1) return;\n this.unsubscribeFocus = focusManager.subscribe(() => {\n if (focusManager.isFocused()) {\n this.resumePausedMutations();\n this.queryCache.onFocus();\n }\n });\n this.unsubscribeOnline = onlineManager.subscribe(() => {\n if (onlineManager.isOnline()) {\n this.resumePausedMutations();\n this.queryCache.onOnline();\n }\n });\n }\n\n unmount() {\n var _this$unsubscribeFocu, _this$unsubscribeOnli;\n\n this.mountCount--;\n if (this.mountCount !== 0) return;\n (_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);\n this.unsubscribeFocus = undefined;\n (_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);\n this.unsubscribeOnline = undefined;\n }\n\n isFetching(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n filters.fetchStatus = 'fetching';\n return this.queryCache.findAll(filters).length;\n }\n\n isMutating(filters) {\n return this.mutationCache.findAll({ ...filters,\n fetching: true\n }).length;\n }\n\n getQueryData(queryKey, filters) {\n var _this$queryCache$find;\n\n return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;\n }\n\n ensureQueryData(arg1, arg2, arg3) {\n const parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n const cachedData = this.getQueryData(parsedOptions.queryKey);\n return cachedData ? Promise.resolve(cachedData) : this.fetchQuery(parsedOptions);\n }\n\n getQueriesData(queryKeyOrFilters) {\n return this.getQueryCache().findAll(queryKeyOrFilters).map(({\n queryKey,\n state\n }) => {\n const data = state.data;\n return [queryKey, data];\n });\n }\n\n setQueryData(queryKey, updater, options) {\n const query = this.queryCache.find(queryKey);\n const prevData = query == null ? void 0 : query.state.data;\n const data = functionalUpdate(updater, prevData);\n\n if (typeof data === 'undefined') {\n return undefined;\n }\n\n const parsedOptions = parseQueryArgs(queryKey);\n const defaultedOptions = this.defaultQueryOptions(parsedOptions);\n return this.queryCache.build(this, defaultedOptions).setData(data, { ...options,\n manual: true\n });\n }\n\n setQueriesData(queryKeyOrFilters, updater, options) {\n return notifyManager.batch(() => this.getQueryCache().findAll(queryKeyOrFilters).map(({\n queryKey\n }) => [queryKey, this.setQueryData(queryKey, updater, options)]));\n }\n\n getQueryState(queryKey, filters) {\n var _this$queryCache$find2;\n\n return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;\n }\n\n removeQueries(arg1, arg2) {\n const [filters] = parseFilterArgs(arg1, arg2);\n const queryCache = this.queryCache;\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach(query => {\n queryCache.remove(query);\n });\n });\n }\n\n resetQueries(arg1, arg2, arg3) {\n const [filters, options] = parseFilterArgs(arg1, arg2, arg3);\n const queryCache = this.queryCache;\n const refetchFilters = {\n type: 'active',\n ...filters\n };\n return notifyManager.batch(() => {\n queryCache.findAll(filters).forEach(query => {\n query.reset();\n });\n return this.refetchQueries(refetchFilters, options);\n });\n }\n\n cancelQueries(arg1, arg2, arg3) {\n const [filters, cancelOptions = {}] = parseFilterArgs(arg1, arg2, arg3);\n\n if (typeof cancelOptions.revert === 'undefined') {\n cancelOptions.revert = true;\n }\n\n const promises = notifyManager.batch(() => this.queryCache.findAll(filters).map(query => query.cancel(cancelOptions)));\n return Promise.all(promises).then(noop).catch(noop);\n }\n\n invalidateQueries(arg1, arg2, arg3) {\n const [filters, options] = parseFilterArgs(arg1, arg2, arg3);\n return notifyManager.batch(() => {\n var _ref, _filters$refetchType;\n\n this.queryCache.findAll(filters).forEach(query => {\n query.invalidate();\n });\n\n if (filters.refetchType === 'none') {\n return Promise.resolve();\n }\n\n const refetchFilters = { ...filters,\n type: (_ref = (_filters$refetchType = filters.refetchType) != null ? _filters$refetchType : filters.type) != null ? _ref : 'active'\n };\n return this.refetchQueries(refetchFilters, options);\n });\n }\n\n refetchQueries(arg1, arg2, arg3) {\n const [filters, options] = parseFilterArgs(arg1, arg2, arg3);\n const promises = notifyManager.batch(() => this.queryCache.findAll(filters).filter(query => !query.isDisabled()).map(query => {\n var _options$cancelRefetc;\n\n return query.fetch(undefined, { ...options,\n cancelRefetch: (_options$cancelRefetc = options == null ? void 0 : options.cancelRefetch) != null ? _options$cancelRefetc : true,\n meta: {\n refetchPage: filters.refetchPage\n }\n });\n }));\n let promise = Promise.all(promises).then(noop);\n\n if (!(options != null && options.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n }\n\n fetchQuery(arg1, arg2, arg3) {\n const parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n const defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652\n\n if (typeof defaultedOptions.retry === 'undefined') {\n defaultedOptions.retry = false;\n }\n\n const query = this.queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n }\n\n prefetchQuery(arg1, arg2, arg3) {\n return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);\n }\n\n fetchInfiniteQuery(arg1, arg2, arg3) {\n const parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n parsedOptions.behavior = infiniteQueryBehavior();\n return this.fetchQuery(parsedOptions);\n }\n\n prefetchInfiniteQuery(arg1, arg2, arg3) {\n return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);\n }\n\n resumePausedMutations() {\n return this.mutationCache.resumePausedMutations();\n }\n\n getQueryCache() {\n return this.queryCache;\n }\n\n getMutationCache() {\n return this.mutationCache;\n }\n\n getLogger() {\n return this.logger;\n }\n\n getDefaultOptions() {\n return this.defaultOptions;\n }\n\n setDefaultOptions(options) {\n this.defaultOptions = options;\n }\n\n setQueryDefaults(queryKey, options) {\n const result = this.queryDefaults.find(x => hashQueryKey(queryKey) === hashQueryKey(x.queryKey));\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.queryDefaults.push({\n queryKey,\n defaultOptions: options\n });\n }\n }\n\n getQueryDefaults(queryKey) {\n if (!queryKey) {\n return undefined;\n } // Get the first matching defaults\n\n\n const firstMatchingDefaults = this.queryDefaults.find(x => partialMatchKey(queryKey, x.queryKey)); // Additional checks and error in dev mode\n\n if (process.env.NODE_ENV !== 'production') {\n // Retrieve all matching defaults for the given key\n const matchingDefaults = this.queryDefaults.filter(x => partialMatchKey(queryKey, x.queryKey)); // It is ok not having defaults, but it is error prone to have more than 1 default for a given key\n\n if (matchingDefaults.length > 1) {\n this.logger.error(\"[QueryClient] Several query defaults match with key '\" + JSON.stringify(queryKey) + \"'. The first matching query defaults are used. Please check how query defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydefaults.\");\n }\n }\n\n return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;\n }\n\n setMutationDefaults(mutationKey, options) {\n const result = this.mutationDefaults.find(x => hashQueryKey(mutationKey) === hashQueryKey(x.mutationKey));\n\n if (result) {\n result.defaultOptions = options;\n } else {\n this.mutationDefaults.push({\n mutationKey,\n defaultOptions: options\n });\n }\n }\n\n getMutationDefaults(mutationKey) {\n if (!mutationKey) {\n return undefined;\n } // Get the first matching defaults\n\n\n const firstMatchingDefaults = this.mutationDefaults.find(x => partialMatchKey(mutationKey, x.mutationKey)); // Additional checks and error in dev mode\n\n if (process.env.NODE_ENV !== 'production') {\n // Retrieve all matching defaults for the given key\n const matchingDefaults = this.mutationDefaults.filter(x => partialMatchKey(mutationKey, x.mutationKey)); // It is ok not having defaults, but it is error prone to have more than 1 default for a given key\n\n if (matchingDefaults.length > 1) {\n this.logger.error(\"[QueryClient] Several mutation defaults match with key '\" + JSON.stringify(mutationKey) + \"'. The first matching mutation defaults are used. Please check how mutation defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetmutationdefaults.\");\n }\n }\n\n return firstMatchingDefaults == null ? void 0 : firstMatchingDefaults.defaultOptions;\n }\n\n defaultQueryOptions(options) {\n if (options != null && options._defaulted) {\n return options;\n }\n\n const defaultedOptions = { ...this.defaultOptions.queries,\n ...this.getQueryDefaults(options == null ? void 0 : options.queryKey),\n ...options,\n _defaulted: true\n };\n\n if (!defaultedOptions.queryHash && defaultedOptions.queryKey) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);\n } // dependent default values\n\n\n if (typeof defaultedOptions.refetchOnReconnect === 'undefined') {\n defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== 'always';\n }\n\n if (typeof defaultedOptions.useErrorBoundary === 'undefined') {\n defaultedOptions.useErrorBoundary = !!defaultedOptions.suspense;\n }\n\n return defaultedOptions;\n }\n\n defaultMutationOptions(options) {\n if (options != null && options._defaulted) {\n return options;\n }\n\n return { ...this.defaultOptions.mutations,\n ...this.getMutationDefaults(options == null ? void 0 : options.mutationKey),\n ...options,\n _defaulted: true\n };\n }\n\n clear() {\n this.queryCache.clear();\n this.mutationCache.clear();\n }\n\n}\n\nexport { QueryClient };\n//# sourceMappingURL=queryClient.esm.js.map\n","import { shallowEqualObjects, noop, isServer, isValidTimeout, timeUntilStale, replaceData } from './utils.esm.js';\nimport { notifyManager } from './notifyManager.esm.js';\nimport { focusManager } from './focusManager.esm.js';\nimport { Subscribable } from './subscribable.esm.js';\nimport { canFetch, isCancelledError } from './retryer.esm.js';\n\nclass QueryObserver extends Subscribable {\n constructor(client, options) {\n super();\n this.client = client;\n this.options = options;\n this.trackedProps = new Set();\n this.selectError = null;\n this.bindMethods();\n this.setOptions(options);\n }\n\n bindMethods() {\n this.remove = this.remove.bind(this);\n this.refetch = this.refetch.bind(this);\n }\n\n onSubscribe() {\n if (this.listeners.length === 1) {\n this.currentQuery.addObserver(this);\n\n if (shouldFetchOnMount(this.currentQuery, this.options)) {\n this.executeFetch();\n }\n\n this.updateTimers();\n }\n }\n\n onUnsubscribe() {\n if (!this.listeners.length) {\n this.destroy();\n }\n }\n\n shouldFetchOnReconnect() {\n return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);\n }\n\n shouldFetchOnWindowFocus() {\n return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);\n }\n\n destroy() {\n this.listeners = [];\n this.clearStaleTimeout();\n this.clearRefetchInterval();\n this.currentQuery.removeObserver(this);\n }\n\n setOptions(options, notifyOptions) {\n const prevOptions = this.options;\n const prevQuery = this.currentQuery;\n this.options = this.client.defaultQueryOptions(options);\n\n if (process.env.NODE_ENV !== 'production' && typeof (options == null ? void 0 : options.isDataEqual) !== 'undefined') {\n this.client.getLogger().error(\"The isDataEqual option has been deprecated and will be removed in the next major version. You can achieve the same functionality by passing a function as the structuralSharing option\");\n }\n\n if (!shallowEqualObjects(prevOptions, this.options)) {\n this.client.getQueryCache().notify({\n type: 'observerOptionsUpdated',\n query: this.currentQuery,\n observer: this\n });\n }\n\n if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {\n throw new Error('Expected enabled to be a boolean');\n } // Keep previous query key if the user does not supply one\n\n\n if (!this.options.queryKey) {\n this.options.queryKey = prevOptions.queryKey;\n }\n\n this.updateQuery();\n const mounted = this.hasListeners(); // Fetch if there are subscribers\n\n if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {\n this.executeFetch();\n } // Update result\n\n\n this.updateResult(notifyOptions); // Update stale interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {\n this.updateStaleTimeout();\n }\n\n const nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed\n\n if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {\n this.updateRefetchInterval(nextRefetchInterval);\n }\n }\n\n getOptimisticResult(options) {\n const query = this.client.getQueryCache().build(this.client, options);\n return this.createResult(query, options);\n }\n\n getCurrentResult() {\n return this.currentResult;\n }\n\n trackResult(result) {\n const trackedResult = {};\n Object.keys(result).forEach(key => {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: () => {\n this.trackedProps.add(key);\n return result[key];\n }\n });\n });\n return trackedResult;\n }\n\n getCurrentQuery() {\n return this.currentQuery;\n }\n\n remove() {\n this.client.getQueryCache().remove(this.currentQuery);\n }\n\n refetch({\n refetchPage,\n ...options\n } = {}) {\n return this.fetch({ ...options,\n meta: {\n refetchPage\n }\n });\n }\n\n fetchOptimistic(options) {\n const defaultedOptions = this.client.defaultQueryOptions(options);\n const query = this.client.getQueryCache().build(this.client, defaultedOptions);\n query.isFetchingOptimistic = true;\n return query.fetch().then(() => this.createResult(query, defaultedOptions));\n }\n\n fetch(fetchOptions) {\n var _fetchOptions$cancelR;\n\n return this.executeFetch({ ...fetchOptions,\n cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true\n }).then(() => {\n this.updateResult();\n return this.currentResult;\n });\n }\n\n executeFetch(fetchOptions) {\n // Make sure we reference the latest query as the current one might have been removed\n this.updateQuery(); // Fetch\n\n let promise = this.currentQuery.fetch(this.options, fetchOptions);\n\n if (!(fetchOptions != null && fetchOptions.throwOnError)) {\n promise = promise.catch(noop);\n }\n\n return promise;\n }\n\n updateStaleTimeout() {\n this.clearStaleTimeout();\n\n if (isServer || this.currentResult.isStale || !isValidTimeout(this.options.staleTime)) {\n return;\n }\n\n const time = timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.\n // To mitigate this issue we always add 1 ms to the timeout.\n\n const timeout = time + 1;\n this.staleTimeoutId = setTimeout(() => {\n if (!this.currentResult.isStale) {\n this.updateResult();\n }\n }, timeout);\n }\n\n computeRefetchInterval() {\n var _this$options$refetch;\n\n return typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;\n }\n\n updateRefetchInterval(nextInterval) {\n this.clearRefetchInterval();\n this.currentRefetchInterval = nextInterval;\n\n if (isServer || this.options.enabled === false || !isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {\n return;\n }\n\n this.refetchIntervalId = setInterval(() => {\n if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {\n this.executeFetch();\n }\n }, this.currentRefetchInterval);\n }\n\n updateTimers() {\n this.updateStaleTimeout();\n this.updateRefetchInterval(this.computeRefetchInterval());\n }\n\n clearStaleTimeout() {\n if (this.staleTimeoutId) {\n clearTimeout(this.staleTimeoutId);\n this.staleTimeoutId = undefined;\n }\n }\n\n clearRefetchInterval() {\n if (this.refetchIntervalId) {\n clearInterval(this.refetchIntervalId);\n this.refetchIntervalId = undefined;\n }\n }\n\n createResult(query, options) {\n const prevQuery = this.currentQuery;\n const prevOptions = this.options;\n const prevResult = this.currentResult;\n const prevResultState = this.currentResultState;\n const prevResultOptions = this.currentResultOptions;\n const queryChange = query !== prevQuery;\n const queryInitialState = queryChange ? query.state : this.currentQueryInitialState;\n const prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;\n const {\n state\n } = query;\n let {\n dataUpdatedAt,\n error,\n errorUpdatedAt,\n fetchStatus,\n status\n } = state;\n let isPreviousData = false;\n let isPlaceholderData = false;\n let data; // Optimistically set result in fetching state if needed\n\n if (options._optimisticResults) {\n const mounted = this.hasListeners();\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n\n if (fetchOnMount || fetchOptionally) {\n fetchStatus = canFetch(query.options.networkMode) ? 'fetching' : 'paused';\n\n if (!dataUpdatedAt) {\n status = 'loading';\n }\n }\n\n if (options._optimisticResults === 'isRestoring') {\n fetchStatus = 'idle';\n }\n } // Keep previous data if needed\n\n\n if (options.keepPreviousData && !state.dataUpdatedAt && prevQueryResult != null && prevQueryResult.isSuccess && status !== 'error') {\n data = prevQueryResult.data;\n dataUpdatedAt = prevQueryResult.dataUpdatedAt;\n status = prevQueryResult.status;\n isPreviousData = true;\n } // Select data if needed\n else if (options.select && typeof state.data !== 'undefined') {\n // Memoize select result\n if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {\n data = this.selectResult;\n } else {\n try {\n this.selectFn = options.select;\n data = options.select(state.data);\n data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);\n this.selectResult = data;\n this.selectError = null;\n } catch (selectError) {\n if (process.env.NODE_ENV !== 'production') {\n this.client.getLogger().error(selectError);\n }\n\n this.selectError = selectError;\n }\n }\n } // Use query data\n else {\n data = state.data;\n } // Show placeholder data if needed\n\n\n if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && status === 'loading') {\n let placeholderData; // Memoize placeholder data\n\n if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {\n placeholderData = prevResult.data;\n } else {\n placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;\n\n if (options.select && typeof placeholderData !== 'undefined') {\n try {\n placeholderData = options.select(placeholderData);\n this.selectError = null;\n } catch (selectError) {\n if (process.env.NODE_ENV !== 'production') {\n this.client.getLogger().error(selectError);\n }\n\n this.selectError = selectError;\n }\n }\n }\n\n if (typeof placeholderData !== 'undefined') {\n status = 'success';\n data = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);\n isPlaceholderData = true;\n }\n }\n\n if (this.selectError) {\n error = this.selectError;\n data = this.selectResult;\n errorUpdatedAt = Date.now();\n status = 'error';\n }\n\n const isFetching = fetchStatus === 'fetching';\n const isLoading = status === 'loading';\n const isError = status === 'error';\n const result = {\n status,\n fetchStatus,\n isLoading,\n isSuccess: status === 'success',\n isError,\n isInitialLoading: isLoading && isFetching,\n data,\n dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: state.fetchFailureCount,\n failureReason: state.fetchFailureReason,\n errorUpdateCount: state.errorUpdateCount,\n isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,\n isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isLoading,\n isLoadingError: isError && state.dataUpdatedAt === 0,\n isPaused: fetchStatus === 'paused',\n isPlaceholderData,\n isPreviousData,\n isRefetchError: isError && state.dataUpdatedAt !== 0,\n isStale: isStale(query, options),\n refetch: this.refetch,\n remove: this.remove\n };\n return result;\n }\n\n updateResult(notifyOptions) {\n const prevResult = this.currentResult;\n const nextResult = this.createResult(this.currentQuery, this.options);\n this.currentResultState = this.currentQuery.state;\n this.currentResultOptions = this.options; // Only notify and update result if something has changed\n\n if (shallowEqualObjects(nextResult, prevResult)) {\n return;\n }\n\n this.currentResult = nextResult; // Determine which callbacks to trigger\n\n const defaultNotifyOptions = {\n cache: true\n };\n\n const shouldNotifyListeners = () => {\n if (!prevResult) {\n return true;\n }\n\n const {\n notifyOnChangeProps\n } = this.options;\n\n if (notifyOnChangeProps === 'all' || !notifyOnChangeProps && !this.trackedProps.size) {\n return true;\n }\n\n const includedProps = new Set(notifyOnChangeProps != null ? notifyOnChangeProps : this.trackedProps);\n\n if (this.options.useErrorBoundary) {\n includedProps.add('error');\n }\n\n return Object.keys(this.currentResult).some(key => {\n const typedKey = key;\n const changed = this.currentResult[typedKey] !== prevResult[typedKey];\n return changed && includedProps.has(typedKey);\n });\n };\n\n if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {\n defaultNotifyOptions.listeners = true;\n }\n\n this.notify({ ...defaultNotifyOptions,\n ...notifyOptions\n });\n }\n\n updateQuery() {\n const query = this.client.getQueryCache().build(this.client, this.options);\n\n if (query === this.currentQuery) {\n return;\n }\n\n const prevQuery = this.currentQuery;\n this.currentQuery = query;\n this.currentQueryInitialState = query.state;\n this.previousQueryResult = this.currentResult;\n\n if (this.hasListeners()) {\n prevQuery == null ? void 0 : prevQuery.removeObserver(this);\n query.addObserver(this);\n }\n }\n\n onQueryUpdate(action) {\n const notifyOptions = {};\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = !action.manual;\n } else if (action.type === 'error' && !isCancelledError(action.error)) {\n notifyOptions.onError = true;\n }\n\n this.updateResult(notifyOptions);\n\n if (this.hasListeners()) {\n this.updateTimers();\n }\n }\n\n notify(notifyOptions) {\n notifyManager.batch(() => {\n // First trigger the configuration callbacks\n if (notifyOptions.onSuccess) {\n var _this$options$onSucce, _this$options, _this$options$onSettl, _this$options2;\n\n (_this$options$onSucce = (_this$options = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options, this.currentResult.data);\n (_this$options$onSettl = (_this$options2 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options2, this.currentResult.data, null);\n } else if (notifyOptions.onError) {\n var _this$options$onError, _this$options3, _this$options$onSettl2, _this$options4;\n\n (_this$options$onError = (_this$options3 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options3, this.currentResult.error);\n (_this$options$onSettl2 = (_this$options4 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options4, undefined, this.currentResult.error);\n } // Then trigger the listeners\n\n\n if (notifyOptions.listeners) {\n this.listeners.forEach(listener => {\n listener(this.currentResult);\n });\n } // Then the cache listeners\n\n\n if (notifyOptions.cache) {\n this.client.getQueryCache().notify({\n query: this.currentQuery,\n type: 'observerResultsUpdated'\n });\n }\n });\n }\n\n}\n\nfunction shouldLoadOnMount(query, options) {\n return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);\n}\n\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\n\nfunction shouldFetchOn(query, options, field) {\n if (options.enabled !== false) {\n const value = typeof field === 'function' ? field(query) : field;\n return value === 'always' || value !== false && isStale(query, options);\n }\n\n return false;\n}\n\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);\n}\n\nfunction isStale(query, options) {\n return query.isStaleByTime(options.staleTime);\n}\n\nexport { QueryObserver };\n//# sourceMappingURL=queryObserver.esm.js.map\n","import { QueryObserver } from './queryObserver.esm.js';\nimport { infiniteQueryBehavior, hasNextPage, hasPreviousPage } from './infiniteQueryBehavior.esm.js';\n\nclass InfiniteQueryObserver extends QueryObserver {\n // Type override\n // Type override\n // Type override\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(client, options) {\n super(client, options);\n }\n\n bindMethods() {\n super.bindMethods();\n this.fetchNextPage = this.fetchNextPage.bind(this);\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this);\n }\n\n setOptions(options, notifyOptions) {\n super.setOptions({ ...options,\n behavior: infiniteQueryBehavior()\n }, notifyOptions);\n }\n\n getOptimisticResult(options) {\n options.behavior = infiniteQueryBehavior();\n return super.getOptimisticResult(options);\n }\n\n fetchNextPage({\n pageParam,\n ...options\n } = {}) {\n return this.fetch({ ...options,\n meta: {\n fetchMore: {\n direction: 'forward',\n pageParam\n }\n }\n });\n }\n\n fetchPreviousPage({\n pageParam,\n ...options\n } = {}) {\n return this.fetch({ ...options,\n meta: {\n fetchMore: {\n direction: 'backward',\n pageParam\n }\n }\n });\n }\n\n createResult(query, options) {\n var _state$fetchMeta, _state$fetchMeta$fetc, _state$fetchMeta2, _state$fetchMeta2$fet, _state$data, _state$data2;\n\n const {\n state\n } = query;\n const result = super.createResult(query, options);\n const {\n isFetching,\n isRefetching\n } = result;\n const isFetchingNextPage = isFetching && ((_state$fetchMeta = state.fetchMeta) == null ? void 0 : (_state$fetchMeta$fetc = _state$fetchMeta.fetchMore) == null ? void 0 : _state$fetchMeta$fetc.direction) === 'forward';\n const isFetchingPreviousPage = isFetching && ((_state$fetchMeta2 = state.fetchMeta) == null ? void 0 : (_state$fetchMeta2$fet = _state$fetchMeta2.fetchMore) == null ? void 0 : _state$fetchMeta2$fet.direction) === 'backward';\n return { ...result,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, (_state$data = state.data) == null ? void 0 : _state$data.pages),\n hasPreviousPage: hasPreviousPage(options, (_state$data2 = state.data) == null ? void 0 : _state$data2.pages),\n isFetchingNextPage,\n isFetchingPreviousPage,\n isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage\n };\n }\n\n}\n\nexport { InfiniteQueryObserver };\n//# sourceMappingURL=infiniteQueryObserver.esm.js.map\n","import { getDefaultState } from './mutation.esm.js';\nimport { notifyManager } from './notifyManager.esm.js';\nimport { Subscribable } from './subscribable.esm.js';\nimport { shallowEqualObjects } from './utils.esm.js';\n\n// CLASS\nclass MutationObserver extends Subscribable {\n constructor(client, options) {\n super();\n this.client = client;\n this.setOptions(options);\n this.bindMethods();\n this.updateResult();\n }\n\n bindMethods() {\n this.mutate = this.mutate.bind(this);\n this.reset = this.reset.bind(this);\n }\n\n setOptions(options) {\n const prevOptions = this.options;\n this.options = this.client.defaultMutationOptions(options);\n\n if (!shallowEqualObjects(prevOptions, this.options)) {\n this.client.getMutationCache().notify({\n type: 'observerOptionsUpdated',\n mutation: this.currentMutation,\n observer: this\n });\n }\n }\n\n onUnsubscribe() {\n if (!this.listeners.length) {\n var _this$currentMutation;\n\n (_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.removeObserver(this);\n }\n }\n\n onMutationUpdate(action) {\n this.updateResult(); // Determine which callbacks to trigger\n\n const notifyOptions = {\n listeners: true\n };\n\n if (action.type === 'success') {\n notifyOptions.onSuccess = true;\n } else if (action.type === 'error') {\n notifyOptions.onError = true;\n }\n\n this.notify(notifyOptions);\n }\n\n getCurrentResult() {\n return this.currentResult;\n }\n\n reset() {\n this.currentMutation = undefined;\n this.updateResult();\n this.notify({\n listeners: true\n });\n }\n\n mutate(variables, options) {\n this.mutateOptions = options;\n\n if (this.currentMutation) {\n this.currentMutation.removeObserver(this);\n }\n\n this.currentMutation = this.client.getMutationCache().build(this.client, { ...this.options,\n variables: typeof variables !== 'undefined' ? variables : this.options.variables\n });\n this.currentMutation.addObserver(this);\n return this.currentMutation.execute();\n }\n\n updateResult() {\n const state = this.currentMutation ? this.currentMutation.state : getDefaultState();\n const result = { ...state,\n isLoading: state.status === 'loading',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset\n };\n this.currentResult = result;\n }\n\n notify(options) {\n notifyManager.batch(() => {\n // First trigger the mutate callbacks\n if (this.mutateOptions && this.hasListeners()) {\n if (options.onSuccess) {\n var _this$mutateOptions$o, _this$mutateOptions, _this$mutateOptions$o2, _this$mutateOptions2;\n\n (_this$mutateOptions$o = (_this$mutateOptions = this.mutateOptions).onSuccess) == null ? void 0 : _this$mutateOptions$o.call(_this$mutateOptions, this.currentResult.data, this.currentResult.variables, this.currentResult.context);\n (_this$mutateOptions$o2 = (_this$mutateOptions2 = this.mutateOptions).onSettled) == null ? void 0 : _this$mutateOptions$o2.call(_this$mutateOptions2, this.currentResult.data, null, this.currentResult.variables, this.currentResult.context);\n } else if (options.onError) {\n var _this$mutateOptions$o3, _this$mutateOptions3, _this$mutateOptions$o4, _this$mutateOptions4;\n\n (_this$mutateOptions$o3 = (_this$mutateOptions3 = this.mutateOptions).onError) == null ? void 0 : _this$mutateOptions$o3.call(_this$mutateOptions3, this.currentResult.error, this.currentResult.variables, this.currentResult.context);\n (_this$mutateOptions$o4 = (_this$mutateOptions4 = this.mutateOptions).onSettled) == null ? void 0 : _this$mutateOptions$o4.call(_this$mutateOptions4, undefined, this.currentResult.error, this.currentResult.variables, this.currentResult.context);\n }\n } // Then trigger the listeners\n\n\n if (options.listeners) {\n this.listeners.forEach(listener => {\n listener(this.currentResult);\n });\n }\n });\n }\n\n}\n\nexport { MutationObserver };\n//# sourceMappingURL=mutationObserver.esm.js.map\n","/**\n * @license React\n * use-sync-external-store-shim.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 e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import { useSyncExternalStore as useSyncExternalStore$1 } from 'use-sync-external-store/shim/index.js';\n\n// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601\nconst useSyncExternalStore = useSyncExternalStore$1;\n\nexport { useSyncExternalStore };\n//# sourceMappingURL=useSyncExternalStore.esm.js.map\n","import * as React from 'react';\n\nconst defaultContext = /*#__PURE__*/React.createContext(undefined);\nconst QueryClientSharingContext = /*#__PURE__*/React.createContext(false); // If we are given a context, we will use it.\n// Otherwise, if contextSharing is on, we share the first and at least one\n// instance of the context across the window\n// to ensure that if React Query is used across\n// different bundles or microfrontends they will\n// all use the same **instance** of context, regardless\n// of module scoping.\n\nfunction getQueryClientContext(context, contextSharing) {\n if (context) {\n return context;\n }\n\n if (contextSharing && typeof window !== 'undefined') {\n if (!window.ReactQueryClientContext) {\n window.ReactQueryClientContext = defaultContext;\n }\n\n return window.ReactQueryClientContext;\n }\n\n return defaultContext;\n}\n\nconst useQueryClient = ({\n context\n} = {}) => {\n const queryClient = React.useContext(getQueryClientContext(context, React.useContext(QueryClientSharingContext)));\n\n if (!queryClient) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one');\n }\n\n return queryClient;\n};\nconst QueryClientProvider = ({\n client,\n children,\n context,\n contextSharing = false\n}) => {\n React.useEffect(() => {\n client.mount();\n return () => {\n client.unmount();\n };\n }, [client]);\n\n if (process.env.NODE_ENV !== 'production' && contextSharing) {\n client.getLogger().error(\"The contextSharing option has been deprecated and will be removed in the next major version\");\n }\n\n const Context = getQueryClientContext(context, contextSharing);\n return /*#__PURE__*/React.createElement(QueryClientSharingContext.Provider, {\n value: !context && contextSharing\n }, /*#__PURE__*/React.createElement(Context.Provider, {\n value: client\n }, children));\n};\n\nexport { QueryClientProvider, defaultContext, useQueryClient };\n//# sourceMappingURL=QueryClientProvider.esm.js.map\n","import * as React from 'react';\n\nconst IsRestoringContext = /*#__PURE__*/React.createContext(false);\nconst useIsRestoring = () => React.useContext(IsRestoringContext);\nconst IsRestoringProvider = IsRestoringContext.Provider;\n\nexport { IsRestoringProvider, useIsRestoring };\n//# sourceMappingURL=isRestoring.esm.js.map\n","import * as React from 'react';\n\nfunction createValue() {\n let isReset = false;\n return {\n clearReset: () => {\n isReset = false;\n },\n reset: () => {\n isReset = true;\n },\n isReset: () => {\n return isReset;\n }\n };\n}\n\nconst QueryErrorResetBoundaryContext = /*#__PURE__*/React.createContext(createValue()); // HOOK\n\nconst useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); // COMPONENT\n\nconst QueryErrorResetBoundary = ({\n children\n}) => {\n const [value] = React.useState(() => createValue());\n return /*#__PURE__*/React.createElement(QueryErrorResetBoundaryContext.Provider, {\n value: value\n }, typeof children === 'function' ? children(value) : children);\n};\n\nexport { QueryErrorResetBoundary, useQueryErrorResetBoundary };\n//# sourceMappingURL=QueryErrorResetBoundary.esm.js.map\n","function shouldThrowError(_useErrorBoundary, params) {\n // Allow useErrorBoundary function to override throwing behavior on a per-error basis\n if (typeof _useErrorBoundary === 'function') {\n return _useErrorBoundary(...params);\n }\n\n return !!_useErrorBoundary;\n}\n\nexport { shouldThrowError };\n//# sourceMappingURL=utils.esm.js.map\n","import * as React from 'react';\nimport { shouldThrowError } from './utils.esm.js';\n\nconst ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {\n if (options.suspense || options.useErrorBoundary) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false;\n }\n }\n};\nconst useClearResetErrorBoundary = errorResetBoundary => {\n React.useEffect(() => {\n errorResetBoundary.clearReset();\n }, [errorResetBoundary]);\n};\nconst getHasError = ({\n result,\n errorResetBoundary,\n useErrorBoundary,\n query\n}) => {\n return result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(useErrorBoundary, [result.error, query]);\n};\n\nexport { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };\n//# sourceMappingURL=errorBoundaryUtils.esm.js.map\n","const ensureStaleTime = defaultedOptions => {\n if (defaultedOptions.suspense) {\n // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (typeof defaultedOptions.staleTime !== 'number') {\n defaultedOptions.staleTime = 1000;\n }\n }\n};\nconst willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;\nconst shouldSuspend = (defaultedOptions, result, isRestoring) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && willFetch(result, isRestoring);\nconst fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).then(({\n data\n}) => {\n defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);\n}).catch(error => {\n errorResetBoundary.clearReset();\n defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);\n defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);\n});\n\nexport { ensureStaleTime, fetchOptimistic, shouldSuspend, willFetch };\n//# sourceMappingURL=suspense.esm.js.map\n","import * as React from 'react';\nimport { useSyncExternalStore } from './useSyncExternalStore.esm.js';\nimport { notifyManager } from '@tanstack/query-core';\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary.esm.js';\nimport { useQueryClient } from './QueryClientProvider.esm.js';\nimport { useIsRestoring } from './isRestoring.esm.js';\nimport { ensurePreventErrorBoundaryRetry, useClearResetErrorBoundary, getHasError } from './errorBoundaryUtils.esm.js';\nimport { ensureStaleTime, shouldSuspend, fetchOptimistic } from './suspense.esm.js';\n\nfunction useBaseQuery(options, Observer) {\n const queryClient = useQueryClient({\n context: options.context\n });\n const isRestoring = useIsRestoring();\n const errorResetBoundary = useQueryErrorResetBoundary();\n const defaultedOptions = queryClient.defaultQueryOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options\n\n defaultedOptions._optimisticResults = isRestoring ? 'isRestoring' : 'optimistic'; // Include callbacks in batch renders\n\n if (defaultedOptions.onError) {\n defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);\n }\n\n if (defaultedOptions.onSuccess) {\n defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);\n }\n\n if (defaultedOptions.onSettled) {\n defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);\n }\n\n ensureStaleTime(defaultedOptions);\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);\n useClearResetErrorBoundary(errorResetBoundary);\n const [observer] = React.useState(() => new Observer(queryClient, defaultedOptions));\n const result = observer.getOptimisticResult(defaultedOptions);\n useSyncExternalStore(React.useCallback(onStoreChange => isRestoring ? () => undefined : observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n React.useEffect(() => {\n // Do not notify on updates because of changes in the options because\n // these changes should already be reflected in the optimistic result.\n observer.setOptions(defaultedOptions, {\n listeners: false\n });\n }, [defaultedOptions, observer]); // Handle suspense\n\n if (shouldSuspend(defaultedOptions, result, isRestoring)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);\n } // Handle error boundary\n\n\n if (getHasError({\n result,\n errorResetBoundary,\n useErrorBoundary: defaultedOptions.useErrorBoundary,\n query: observer.getCurrentQuery()\n })) {\n throw result.error;\n } // Handle result property usage tracking\n\n\n return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;\n}\n\nexport { useBaseQuery };\n//# sourceMappingURL=useBaseQuery.esm.js.map\n","import { parseQueryArgs, QueryObserver } from '@tanstack/query-core';\nimport { useBaseQuery } from './useBaseQuery.esm.js';\n\nfunction useQuery(arg1, arg2, arg3) {\n const parsedOptions = parseQueryArgs(arg1, arg2, arg3);\n return useBaseQuery(parsedOptions, QueryObserver);\n}\n\nexport { useQuery };\n//# sourceMappingURL=useQuery.esm.js.map\n","import * as React from 'react';\nimport { useSyncExternalStore } from './useSyncExternalStore.esm.js';\nimport { parseMutationArgs, MutationObserver, notifyManager } from '@tanstack/query-core';\nimport { useQueryClient } from './QueryClientProvider.esm.js';\nimport { shouldThrowError } from './utils.esm.js';\n\nfunction useMutation(arg1, arg2, arg3) {\n const options = parseMutationArgs(arg1, arg2, arg3);\n const queryClient = useQueryClient({\n context: options.context\n });\n const [observer] = React.useState(() => new MutationObserver(queryClient, options));\n React.useEffect(() => {\n observer.setOptions(options);\n }, [observer, options]);\n const result = useSyncExternalStore(React.useCallback(onStoreChange => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());\n const mutate = React.useCallback((variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop);\n }, [observer]);\n\n if (result.error && shouldThrowError(observer.options.useErrorBoundary, [result.error])) {\n throw result.error;\n }\n\n return { ...result,\n mutate,\n mutateAsync: result.mutate\n };\n} // eslint-disable-next-line @typescript-eslint/no-empty-function\n\nfunction noop() {}\n\nexport { useMutation };\n//# sourceMappingURL=useMutation.esm.js.map\n","import { parseQueryArgs, InfiniteQueryObserver } from '@tanstack/query-core';\nimport { useBaseQuery } from './useBaseQuery.esm.js';\n\nfunction useInfiniteQuery(arg1, arg2, arg3) {\n const options = parseQueryArgs(arg1, arg2, arg3);\n return useBaseQuery(options, InfiniteQueryObserver);\n}\n\nexport { useInfiniteQuery };\n//# sourceMappingURL=useInfiniteQuery.esm.js.map\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e))for(t=0;t void;\n};\n\nfunction FlashMessage({\n className = \"\",\n duration = 5000,\n flash,\n setFlash,\n}: FlashMessageProps) {\n const close = () => {\n setFlash({\n visible: false,\n success: true,\n message: \"\",\n });\n };\n setTimeout(() => {\n close();\n }, duration);\n\n return (\n \n close()}\n />\n
\n \n
\n {flash?.message}\n
\n
\n \n );\n}\n\nexport default FlashMessage;\n","import { createContext } from \"react\";\nimport { FlashType } from \"./interfaces\";\n\nconst FlashMessageContext = createContext({\n setFlash: (_: FlashType) => {},\n});\n\nexport default FlashMessageContext;\n","var global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","import { useQuery } from \"@tanstack/react-query\";\nimport fetch from \"cross-fetch\";\n\nfunction fetchCurrentUser() {\n const fields: string[] = [\n \"id\",\n \"email\",\n \"fullName\",\n \"role\",\n \"avatarUrl\",\n \"avatar\",\n \"slug\",\n \"isStaff\",\n \"isLegal\",\n \"isBoardMember\",\n \"firstName\",\n \"lastName\",\n \"phoneNumber\",\n \"centerId\",\n \"centerNameOrInstitution\",\n \"googleScholarUrl\",\n \"cvOrBiosketch\",\n \"guidedTourCompleted\",\n \"didCloseBanner\",\n \"digestedJobTitle\",\n \"type\",\n ];\n const options = \"&preload=none\";\n return fetch(\n `/api/users/me?fields[users]=${fields.join(\",\")}${options}`,\n ).then(res => {\n if (res?.ok) return res.json();\n });\n}\n\nfunction useCurrentUser() {\n const { data } = useQuery([\"current-user\"], fetchCurrentUser);\n\n return data?.data;\n}\n\nexport default useCurrentUser;\n","import React__default, { isValidElement, useRef, useLayoutEffect, useEffect, useReducer, cloneElement, useState, createElement } from 'react';\nimport cx from 'clsx';\nimport { render } from 'react-dom';\n\nfunction _extends() {\n _extends = Object.assign || 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\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction isNum(v) {\n return typeof v === 'number' && !isNaN(v);\n}\nfunction isBool(v) {\n return typeof v === 'boolean';\n}\nfunction isStr(v) {\n return typeof v === 'string';\n}\nfunction isFn(v) {\n return typeof v === 'function';\n}\nfunction parseClassName(v) {\n return isStr(v) || isFn(v) ? v : null;\n}\nfunction isToastIdValid(toastId) {\n return toastId === 0 || toastId;\n}\nfunction getAutoCloseDelay(toastAutoClose, containerAutoClose) {\n return toastAutoClose === false || isNum(toastAutoClose) && toastAutoClose > 0 ? toastAutoClose : containerAutoClose;\n}\nvar canUseDom = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\nfunction canBeRendered(content) {\n return isValidElement(content) || isStr(content) || isFn(content) || isNum(content);\n}\n\nvar POSITION = {\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right',\n TOP_CENTER: 'top-center',\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n BOTTOM_CENTER: 'bottom-center'\n};\nvar TYPE = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n DEFAULT: 'default',\n DARK: 'dark'\n};\n\n/**\r\n * Used to collapse toast after exit animation\r\n */\nfunction collapseToast(node, done, duration\n/* COLLAPSE_DURATION */\n) {\n if (duration === void 0) {\n duration = 300;\n }\n\n var height = node.scrollHeight;\n var style = node.style;\n requestAnimationFrame(function () {\n style.minHeight = 'initial';\n style.height = height + 'px';\n style.transition = \"all \" + duration + \"ms\";\n requestAnimationFrame(function () {\n style.height = '0';\n style.padding = '0';\n style.margin = '0';\n setTimeout(done, duration);\n });\n });\n}\n\n/**\r\n * Css animation that just work.\r\n * You could use animate.css for instance\r\n *\r\n *\r\n * ```\r\n * cssTransition({\r\n * enter: \"animate__animated animate__bounceIn\",\r\n * exit: \"animate__animated animate__bounceOut\"\r\n * })\r\n * ```\r\n *\r\n */\n\nfunction cssTransition(_ref) {\n var enter = _ref.enter,\n exit = _ref.exit,\n _ref$appendPosition = _ref.appendPosition,\n appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition,\n _ref$collapse = _ref.collapse,\n collapse = _ref$collapse === void 0 ? true : _ref$collapse,\n _ref$collapseDuration = _ref.collapseDuration,\n collapseDuration = _ref$collapseDuration === void 0 ? 300 : _ref$collapseDuration;\n return function ToastTransition(_ref2) {\n var children = _ref2.children,\n position = _ref2.position,\n preventExitTransition = _ref2.preventExitTransition,\n done = _ref2.done,\n nodeRef = _ref2.nodeRef,\n isIn = _ref2.isIn;\n var enterClassName = appendPosition ? enter + \"--\" + position : enter;\n var exitClassName = appendPosition ? exit + \"--\" + position : exit;\n var baseClassName = useRef();\n var animationStep = useRef(0\n /* Enter */\n );\n useLayoutEffect(function () {\n onEnter();\n }, []);\n useEffect(function () {\n if (!isIn) preventExitTransition ? onExited() : onExit();\n }, [isIn]);\n\n function onEnter() {\n var node = nodeRef.current;\n baseClassName.current = node.className;\n node.className += \" \" + enterClassName;\n node.addEventListener('animationend', onEntered);\n }\n\n function onEntered() {\n var node = nodeRef.current;\n node.removeEventListener('animationend', onEntered);\n\n if (animationStep.current === 0\n /* Enter */\n ) {\n node.className = baseClassName.current;\n }\n }\n\n function onExit() {\n animationStep.current = 1\n /* Exit */\n ;\n var node = nodeRef.current;\n node.className += \" \" + exitClassName;\n node.addEventListener('animationend', onExited);\n }\n\n function onExited() {\n var node = nodeRef.current;\n node.removeEventListener('animationend', onExited);\n collapse ? collapseToast(node, done, collapseDuration) : done();\n }\n\n return React__default.createElement(React__default.Fragment, null, children);\n };\n}\n\nvar eventManager = {\n list: /*#__PURE__*/new Map(),\n emitQueue: /*#__PURE__*/new Map(),\n on: function on(event, callback) {\n this.list.has(event) || this.list.set(event, []);\n this.list.get(event).push(callback);\n return this;\n },\n off: function off(event, callback) {\n if (callback) {\n var cb = this.list.get(event).filter(function (cb) {\n return cb !== callback;\n });\n this.list.set(event, cb);\n return this;\n }\n\n this.list[\"delete\"](event);\n return this;\n },\n cancelEmit: function cancelEmit(event) {\n var timers = this.emitQueue.get(event);\n\n if (timers) {\n timers.forEach(clearTimeout);\n this.emitQueue[\"delete\"](event);\n }\n\n return this;\n },\n\n /**\r\n * Enqueue the event at the end of the call stack\r\n * Doing so let the user call toast as follow:\r\n * toast('1')\r\n * toast('2')\r\n * toast('3')\r\n * Without setTimemout the code above will not work\r\n */\n emit: function emit(event) {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n this.list.has(event) && this.list.get(event).forEach(function (callback) {\n var timer = setTimeout(function () {\n // @ts-ignore\n callback.apply(void 0, args);\n }, 0);\n _this.emitQueue.has(event) || _this.emitQueue.set(event, []);\n\n _this.emitQueue.get(event).push(timer);\n });\n }\n};\n\n/**\r\n * `useKeeper` is a helper around `useRef`.\r\n *\r\n * You don't need to access the `.current`property to get the value\r\n * If refresh is set to true. The ref will be updated every render\r\n */\n\nfunction useKeeper(arg, refresh) {\n if (refresh === void 0) {\n refresh = false;\n }\n\n var ref = useRef(arg);\n useEffect(function () {\n if (refresh) ref.current = arg;\n });\n return ref.current;\n}\n\nfunction reducer(state, action) {\n switch (action.type) {\n case 0\n /* ADD */\n :\n return [].concat(state, [action.toastId]).filter(function (id) {\n return id !== action.staleId;\n });\n\n case 1\n /* REMOVE */\n :\n return isToastIdValid(action.toastId) ? state.filter(function (id) {\n return id !== action.toastId;\n }) : [];\n }\n}\n\nfunction useToastContainer(props) {\n var _useReducer = useReducer(function (x) {\n return x + 1;\n }, 0),\n forceUpdate = _useReducer[1];\n\n var _useReducer2 = useReducer(reducer, []),\n toast = _useReducer2[0],\n dispatch = _useReducer2[1];\n\n var containerRef = useRef(null);\n var toastCount = useKeeper(0);\n var queue = useKeeper([]);\n var collection = useKeeper({});\n var instance = useKeeper({\n toastKey: 1,\n displayedToast: 0,\n props: props,\n containerId: null,\n isToastActive: isToastActive,\n getToast: function getToast(id) {\n return collection[id] || null;\n }\n });\n useEffect(function () {\n instance.containerId = props.containerId;\n eventManager.cancelEmit(3\n /* WillUnmount */\n ).on(0\n /* Show */\n , buildToast).on(1\n /* Clear */\n , function (toastId) {\n return containerRef.current && removeToast(toastId);\n }).on(5\n /* ClearWaitingQueue */\n , clearWaitingQueue).emit(2\n /* DidMount */\n , instance);\n return function () {\n return eventManager.emit(3\n /* WillUnmount */\n , instance);\n };\n }, []);\n useEffect(function () {\n instance.isToastActive = isToastActive;\n instance.displayedToast = toast.length;\n eventManager.emit(4\n /* Change */\n , toast.length, props.containerId);\n }, [toast]);\n useEffect(function () {\n instance.props = props;\n });\n\n function isToastActive(id) {\n return toast.indexOf(id) !== -1;\n }\n\n function clearWaitingQueue(_ref) {\n var containerId = _ref.containerId;\n var limit = instance.props.limit;\n\n if (limit && (!containerId || instance.containerId === containerId)) {\n toastCount -= queue.length;\n queue = [];\n }\n }\n\n function removeToast(toastId) {\n dispatch({\n type: 1\n /* REMOVE */\n ,\n toastId: toastId\n });\n }\n\n function dequeueToast() {\n var _queue$shift = queue.shift(),\n toastContent = _queue$shift.toastContent,\n toastProps = _queue$shift.toastProps,\n staleId = _queue$shift.staleId;\n\n appendToast(toastContent, toastProps, staleId);\n }\n /**\r\n * check if a container is attached to the dom\r\n * check for multi-container, build only if associated\r\n * check for duplicate toastId if no update\r\n */\n\n\n function isNotValid(_ref2) {\n var containerId = _ref2.containerId,\n toastId = _ref2.toastId,\n updateId = _ref2.updateId;\n return !containerRef.current || instance.props.enableMultiContainer && containerId !== instance.props.containerId || collection[toastId] && updateId == null ? true : false;\n } // this function and all the function called inside needs to rely on ref(`useKeeper`)\n\n\n function buildToast(content, _ref3) {\n var delay = _ref3.delay,\n staleId = _ref3.staleId,\n options = _objectWithoutPropertiesLoose(_ref3, [\"delay\", \"staleId\"]);\n\n if (!canBeRendered(content) || isNotValid(options)) return;\n var toastId = options.toastId,\n updateId = options.updateId;\n var props = instance.props;\n\n var closeToast = function closeToast() {\n return removeToast(toastId);\n };\n\n var isNotAnUpdate = options.updateId == null;\n if (isNotAnUpdate) toastCount++;\n var toastProps = {\n toastId: toastId,\n updateId: updateId,\n isIn: false,\n key: options.key || instance.toastKey++,\n type: options.type,\n closeToast: closeToast,\n closeButton: options.closeButton,\n rtl: props.rtl,\n position: options.position || props.position,\n transition: options.transition || props.transition,\n className: parseClassName(options.className || props.toastClassName),\n bodyClassName: parseClassName(options.bodyClassName || props.bodyClassName),\n style: options.style || props.toastStyle,\n bodyStyle: options.bodyStyle || props.bodyStyle,\n onClick: options.onClick || props.onClick,\n pauseOnHover: isBool(options.pauseOnHover) ? options.pauseOnHover : props.pauseOnHover,\n pauseOnFocusLoss: isBool(options.pauseOnFocusLoss) ? options.pauseOnFocusLoss : props.pauseOnFocusLoss,\n draggable: isBool(options.draggable) ? options.draggable : props.draggable,\n draggablePercent: isNum(options.draggablePercent) ? options.draggablePercent : props.draggablePercent,\n draggableDirection: options.draggableDirection || props.draggableDirection,\n closeOnClick: isBool(options.closeOnClick) ? options.closeOnClick : props.closeOnClick,\n progressClassName: parseClassName(options.progressClassName || props.progressClassName),\n progressStyle: options.progressStyle || props.progressStyle,\n autoClose: getAutoCloseDelay(options.autoClose, props.autoClose),\n hideProgressBar: isBool(options.hideProgressBar) ? options.hideProgressBar : props.hideProgressBar,\n progress: options.progress,\n role: isStr(options.role) ? options.role : props.role,\n deleteToast: function deleteToast() {\n removeFromCollection(toastId);\n }\n };\n if (isFn(options.onOpen)) toastProps.onOpen = options.onOpen;\n if (isFn(options.onClose)) toastProps.onClose = options.onClose; // tweak for vertical dragging\n\n if (toastProps.draggableDirection === \"y\"\n /* Y */\n && toastProps.draggablePercent === 80\n /* DRAGGABLE_PERCENT */\n ) {\n toastProps.draggablePercent *= 1.5;\n }\n\n var closeButton = props.closeButton;\n\n if (options.closeButton === false || canBeRendered(options.closeButton)) {\n closeButton = options.closeButton;\n } else if (options.closeButton === true) {\n closeButton = canBeRendered(props.closeButton) ? props.closeButton : true;\n }\n\n toastProps.closeButton = closeButton;\n var toastContent = content;\n\n if (isValidElement(content) && !isStr(content.type)) {\n toastContent = cloneElement(content, {\n closeToast: closeToast,\n toastProps: toastProps\n });\n } else if (isFn(content)) {\n toastContent = content({\n closeToast: closeToast,\n toastProps: toastProps\n });\n } // not handling limit + delay by design. Waiting for user feedback first\n\n\n if (props.limit && props.limit > 0 && toastCount > props.limit && isNotAnUpdate) {\n queue.push({\n toastContent: toastContent,\n toastProps: toastProps,\n staleId: staleId\n });\n } else if (isNum(delay) && delay > 0) {\n setTimeout(function () {\n appendToast(toastContent, toastProps, staleId);\n }, delay);\n } else {\n appendToast(toastContent, toastProps, staleId);\n }\n }\n\n function appendToast(content, toastProps, staleId) {\n var toastId = toastProps.toastId;\n if (staleId) delete collection[staleId];\n collection[toastId] = {\n content: content,\n props: toastProps\n };\n dispatch({\n type: 0\n /* ADD */\n ,\n toastId: toastId,\n staleId: staleId\n });\n }\n\n function removeFromCollection(toastId) {\n delete collection[toastId];\n var queueLen = queue.length;\n toastCount = isToastIdValid(toastId) ? toastCount - 1 : toastCount - instance.displayedToast;\n if (toastCount < 0) toastCount = 0;\n\n if (queueLen > 0) {\n var freeSlot = isToastIdValid(toastId) ? 1 : instance.props.limit;\n\n if (queueLen === 1 || freeSlot === 1) {\n instance.displayedToast++;\n dequeueToast();\n } else {\n var toDequeue = freeSlot > queueLen ? queueLen : freeSlot;\n instance.displayedToast = toDequeue;\n\n for (var i = 0; i < toDequeue; i++) {\n dequeueToast();\n }\n }\n } else {\n forceUpdate();\n }\n }\n\n function getToastToRender(cb) {\n var toastToRender = {};\n var toastList = props.newestOnTop ? Object.keys(collection).reverse() : Object.keys(collection);\n\n for (var i = 0; i < toastList.length; i++) {\n var _toast = collection[toastList[i]];\n var position = _toast.props.position;\n toastToRender[position] || (toastToRender[position] = []);\n toastToRender[position].push(_toast);\n }\n\n return Object.keys(toastToRender).map(function (p) {\n return cb(p, toastToRender[p]);\n });\n }\n\n return {\n getToastToRender: getToastToRender,\n collection: collection,\n containerRef: containerRef,\n isToastActive: isToastActive\n };\n}\n\nfunction getX(e) {\n return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;\n}\n\nfunction getY(e) {\n return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;\n}\n\nfunction useToast(props) {\n var _useState = useState(true),\n isRunning = _useState[0],\n setIsRunning = _useState[1];\n\n var _useState2 = useState(false),\n preventExitTransition = _useState2[0],\n setPreventExitTransition = _useState2[1];\n\n var toastRef = useRef(null);\n var drag = useKeeper({\n start: 0,\n x: 0,\n y: 0,\n delta: 0,\n removalDistance: 0,\n canCloseOnClick: true,\n canDrag: false,\n boundingRect: null\n });\n var syncProps = useKeeper(props, true);\n var autoClose = props.autoClose,\n pauseOnHover = props.pauseOnHover,\n closeToast = props.closeToast,\n onClick = props.onClick,\n closeOnClick = props.closeOnClick;\n useEffect(function () {\n if (isFn(props.onOpen)) props.onOpen(isValidElement(props.children) && props.children.props);\n return function () {\n if (isFn(syncProps.onClose)) syncProps.onClose(isValidElement(syncProps.children) && syncProps.children.props);\n };\n }, []);\n useEffect(function () {\n props.draggable && bindDragEvents();\n return function () {\n props.draggable && unbindDragEvents();\n };\n }, [props.draggable]);\n useEffect(function () {\n props.pauseOnFocusLoss && bindFocusEvents();\n return function () {\n props.pauseOnFocusLoss && unbindFocusEvents();\n };\n }, [props.pauseOnFocusLoss]);\n\n function onDragStart(e) {\n if (props.draggable) {\n var toast = toastRef.current;\n drag.canCloseOnClick = true;\n drag.canDrag = true;\n drag.boundingRect = toast.getBoundingClientRect();\n toast.style.transition = '';\n drag.x = getX(e.nativeEvent);\n drag.y = getY(e.nativeEvent);\n\n if (props.draggableDirection === \"x\"\n /* X */\n ) {\n drag.start = drag.x;\n drag.removalDistance = toast.offsetWidth * (props.draggablePercent / 100);\n } else {\n drag.start = drag.y;\n drag.removalDistance = toast.offsetHeight * (props.draggablePercent / 100);\n }\n }\n }\n\n function onDragTransitionEnd() {\n if (drag.boundingRect) {\n var _drag$boundingRect = drag.boundingRect,\n top = _drag$boundingRect.top,\n bottom = _drag$boundingRect.bottom,\n left = _drag$boundingRect.left,\n right = _drag$boundingRect.right;\n\n if (props.pauseOnHover && drag.x >= left && drag.x <= right && drag.y >= top && drag.y <= bottom) {\n pauseToast();\n } else {\n playToast();\n }\n }\n }\n\n function playToast() {\n setIsRunning(true);\n }\n\n function pauseToast() {\n setIsRunning(false);\n }\n\n function bindFocusEvents() {\n if (!document.hasFocus()) pauseToast();\n window.addEventListener('focus', playToast);\n window.addEventListener('blur', pauseToast);\n }\n\n function unbindFocusEvents() {\n window.removeEventListener('focus', playToast);\n window.removeEventListener('blur', pauseToast);\n }\n\n function bindDragEvents() {\n document.addEventListener('mousemove', onDragMove);\n document.addEventListener('mouseup', onDragEnd);\n document.addEventListener('touchmove', onDragMove);\n document.addEventListener('touchend', onDragEnd);\n }\n\n function unbindDragEvents() {\n document.removeEventListener('mousemove', onDragMove);\n document.removeEventListener('mouseup', onDragEnd);\n document.removeEventListener('touchmove', onDragMove);\n document.removeEventListener('touchend', onDragEnd);\n }\n\n function onDragMove(e) {\n if (drag.canDrag) {\n e.preventDefault();\n var toast = toastRef.current;\n if (isRunning) pauseToast();\n drag.x = getX(e);\n drag.y = getY(e);\n\n if (props.draggableDirection === \"x\"\n /* X */\n ) {\n drag.delta = drag.x - drag.start;\n } else {\n drag.delta = drag.y - drag.start;\n } // prevent false positif during a toast click\n\n\n if (drag.start !== drag.x) drag.canCloseOnClick = false;\n toast.style.transform = \"translate\" + props.draggableDirection + \"(\" + drag.delta + \"px)\";\n toast.style.opacity = \"\" + (1 - Math.abs(drag.delta / drag.removalDistance));\n }\n }\n\n function onDragEnd() {\n var toast = toastRef.current;\n\n if (drag.canDrag) {\n drag.canDrag = false;\n\n if (Math.abs(drag.delta) > drag.removalDistance) {\n setPreventExitTransition(true);\n props.closeToast();\n return;\n }\n\n toast.style.transition = 'transform 0.2s, opacity 0.2s';\n toast.style.transform = \"translate\" + props.draggableDirection + \"(0)\";\n toast.style.opacity = '1';\n }\n }\n\n var eventHandlers = {\n onMouseDown: onDragStart,\n onTouchStart: onDragStart,\n onMouseUp: onDragTransitionEnd,\n onTouchEnd: onDragTransitionEnd\n };\n\n if (autoClose && pauseOnHover) {\n eventHandlers.onMouseEnter = pauseToast;\n eventHandlers.onMouseLeave = playToast;\n } // prevent toast from closing when user drags the toast\n\n\n if (closeOnClick) {\n eventHandlers.onClick = function (e) {\n onClick && onClick(e);\n drag.canCloseOnClick && closeToast();\n };\n }\n\n return {\n playToast: playToast,\n pauseToast: pauseToast,\n isRunning: isRunning,\n preventExitTransition: preventExitTransition,\n toastRef: toastRef,\n eventHandlers: eventHandlers\n };\n}\n\nfunction CloseButton(_ref) {\n var closeToast = _ref.closeToast,\n type = _ref.type,\n _ref$ariaLabel = _ref.ariaLabel,\n ariaLabel = _ref$ariaLabel === void 0 ? 'close' : _ref$ariaLabel;\n return createElement(\"button\", {\n className: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__close-button \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__close-button--\" + type,\n type: \"button\",\n onClick: function onClick(e) {\n e.stopPropagation();\n closeToast(e);\n },\n \"aria-label\": ariaLabel\n }, createElement(\"svg\", {\n \"aria-hidden\": \"true\",\n viewBox: \"0 0 14 16\"\n }, createElement(\"path\", {\n fillRule: \"evenodd\",\n d: \"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z\"\n })));\n}\n\nfunction ProgressBar(_ref) {\n var _cx, _animationEvent;\n\n var delay = _ref.delay,\n isRunning = _ref.isRunning,\n closeToast = _ref.closeToast,\n type = _ref.type,\n hide = _ref.hide,\n className = _ref.className,\n userStyle = _ref.style,\n controlledProgress = _ref.controlledProgress,\n progress = _ref.progress,\n rtl = _ref.rtl,\n isIn = _ref.isIn;\n\n var style = _extends({}, userStyle, {\n animationDuration: delay + \"ms\",\n animationPlayState: isRunning ? 'running' : 'paused',\n opacity: hide ? 0 : 1\n });\n\n if (controlledProgress) style.transform = \"scaleX(\" + progress + \")\";\n var defaultClassName = cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar\", controlledProgress ? \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--controlled\" : \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--animated\", \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--\" + type, (_cx = {}, _cx[\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--rtl\"] = rtl, _cx));\n var classNames = isFn(className) ? className({\n rtl: rtl,\n type: type,\n defaultClassName: defaultClassName\n }) : cx(defaultClassName, className); // 🧐 controlledProgress is derived from progress\n // so if controlledProgress is set\n // it means that this is also the case for progress\n\n var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && progress >= 1 ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && progress < 1 ? null : function () {\n isIn && closeToast();\n }, _animationEvent); // TODO: add aria-valuenow, aria-valuemax, aria-valuemin\n\n return createElement(\"div\", Object.assign({\n role: \"progressbar\",\n \"aria-hidden\": hide ? 'true' : 'false',\n \"aria-label\": \"notification timer\",\n className: classNames,\n style: style\n }, animationEvent));\n}\nProgressBar.defaultProps = {\n type: TYPE.DEFAULT,\n hide: false\n};\n\nvar Toast = function Toast(props) {\n var _cx;\n\n var _useToast = useToast(props),\n isRunning = _useToast.isRunning,\n preventExitTransition = _useToast.preventExitTransition,\n toastRef = _useToast.toastRef,\n eventHandlers = _useToast.eventHandlers;\n\n var closeButton = props.closeButton,\n children = props.children,\n autoClose = props.autoClose,\n onClick = props.onClick,\n type = props.type,\n hideProgressBar = props.hideProgressBar,\n closeToast = props.closeToast,\n Transition = props.transition,\n position = props.position,\n className = props.className,\n style = props.style,\n bodyClassName = props.bodyClassName,\n bodyStyle = props.bodyStyle,\n progressClassName = props.progressClassName,\n progressStyle = props.progressStyle,\n updateId = props.updateId,\n role = props.role,\n progress = props.progress,\n rtl = props.rtl,\n toastId = props.toastId,\n deleteToast = props.deleteToast,\n isIn = props.isIn;\n var defaultClassName = cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast\", \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast--\" + type, (_cx = {}, _cx[\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast--rtl\"] = rtl, _cx));\n var cssClasses = isFn(className) ? className({\n rtl: rtl,\n position: position,\n type: type,\n defaultClassName: defaultClassName\n }) : cx(defaultClassName, className);\n var isProgressControlled = !!progress;\n\n function renderCloseButton(closeButton) {\n if (!closeButton) return;\n var props = {\n closeToast: closeToast,\n type: type\n };\n if (isFn(closeButton)) return closeButton(props);\n if (isValidElement(closeButton)) return cloneElement(closeButton, props);\n }\n\n return createElement(Transition, {\n isIn: isIn,\n done: deleteToast,\n position: position,\n preventExitTransition: preventExitTransition,\n nodeRef: toastRef\n }, createElement(\"div\", Object.assign({\n id: toastId,\n onClick: onClick,\n className: cssClasses\n }, eventHandlers, {\n style: style,\n ref: toastRef\n }), createElement(\"div\", Object.assign({}, isIn && {\n role: role\n }, {\n className: isFn(bodyClassName) ? bodyClassName({\n type: type\n }) : cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-body\", bodyClassName),\n style: bodyStyle\n }), children), renderCloseButton(closeButton), (autoClose || isProgressControlled) && createElement(ProgressBar, Object.assign({}, updateId && !isProgressControlled ? {\n key: \"pb-\" + updateId\n } : {}, {\n rtl: rtl,\n delay: autoClose,\n isRunning: isRunning,\n isIn: isIn,\n closeToast: closeToast,\n hide: hideProgressBar,\n type: type,\n style: progressStyle,\n className: progressClassName,\n controlledProgress: isProgressControlled,\n progress: progress\n }))));\n};\n\nvar Bounce = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__bounce-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__bounce-exit\",\n appendPosition: true\n});\nvar Slide = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__slide-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__slide-exit\",\n appendPosition: true\n});\nvar Zoom = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__zoom-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__zoom-exit\"\n});\nvar Flip = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__flip-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__flip-exit\"\n});\n\nvar ToastContainer = function ToastContainer(props) {\n var _useToastContainer = useToastContainer(props),\n getToastToRender = _useToastContainer.getToastToRender,\n containerRef = _useToastContainer.containerRef,\n isToastActive = _useToastContainer.isToastActive;\n\n var className = props.className,\n style = props.style,\n rtl = props.rtl,\n containerId = props.containerId;\n\n function getClassName(position) {\n var _cx;\n\n var defaultClassName = cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-container\", \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-container--\" + position, (_cx = {}, _cx[\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-container--rtl\"] = rtl, _cx));\n return isFn(className) ? className({\n position: position,\n rtl: rtl,\n defaultClassName: defaultClassName\n }) : cx(defaultClassName, parseClassName(className));\n }\n\n return createElement(\"div\", {\n ref: containerRef,\n className: \"Toastify\"\n /* CSS_NAMESPACE */\n ,\n id: containerId\n }, getToastToRender(function (position, toastList) {\n var containerStyle = toastList.length === 0 ? _extends({}, style, {\n pointerEvents: 'none'\n }) : _extends({}, style);\n return createElement(\"div\", {\n className: getClassName(position),\n style: containerStyle,\n key: \"container-\" + position\n }, toastList.map(function (_ref) {\n var content = _ref.content,\n toastProps = _ref.props;\n return createElement(Toast, Object.assign({}, toastProps, {\n isIn: isToastActive(toastProps.toastId),\n key: \"toast-\" + toastProps.key,\n closeButton: toastProps.closeButton === true ? CloseButton : toastProps.closeButton\n }), content);\n }));\n }));\n};\nToastContainer.defaultProps = {\n position: POSITION.TOP_RIGHT,\n transition: Bounce,\n rtl: false,\n autoClose: 5000,\n hideProgressBar: false,\n closeButton: CloseButton,\n pauseOnHover: true,\n pauseOnFocusLoss: true,\n closeOnClick: true,\n newestOnTop: false,\n draggable: true,\n draggablePercent: 80\n /* DRAGGABLE_PERCENT */\n ,\n draggableDirection: \"x\"\n /* X */\n ,\n role: 'alert'\n};\n\nvar containers = /*#__PURE__*/new Map();\nvar latestInstance;\nvar containerDomNode;\nvar containerConfig;\nvar queue = [];\nvar lazy = false;\n/**\r\n * Check whether any container is currently mounted in the DOM\r\n */\n\nfunction isAnyContainerMounted() {\n return containers.size > 0;\n}\n/**\r\n * Get the toast by id, given it's in the DOM, otherwise returns null\r\n */\n\n\nfunction getToast(toastId, _ref) {\n var containerId = _ref.containerId;\n var container = containers.get(containerId || latestInstance);\n if (!container) return null;\n return container.getToast(toastId);\n}\n/**\r\n * Generate a random toastId\r\n */\n\n\nfunction generateToastId() {\n return Math.random().toString(36).substr(2, 9);\n}\n/**\r\n * Generate a toastId or use the one provided\r\n */\n\n\nfunction getToastId(options) {\n if (options && (isStr(options.toastId) || isNum(options.toastId))) {\n return options.toastId;\n }\n\n return generateToastId();\n}\n/**\r\n * If the container is not mounted, the toast is enqueued and\r\n * the container lazy mounted\r\n */\n\n\nfunction dispatchToast(content, options) {\n if (isAnyContainerMounted()) {\n eventManager.emit(0\n /* Show */\n , content, options);\n } else {\n queue.push({\n content: content,\n options: options\n });\n\n if (lazy && canUseDom) {\n lazy = false;\n containerDomNode = document.createElement('div');\n document.body.appendChild(containerDomNode);\n render(createElement(ToastContainer, Object.assign({}, containerConfig)), containerDomNode);\n }\n }\n\n return options.toastId;\n}\n/**\r\n * Merge provided options with the defaults settings and generate the toastId\r\n */\n\n\nfunction mergeOptions(type, options) {\n return _extends({}, options, {\n type: options && options.type || type,\n toastId: getToastId(options)\n });\n}\n\nvar createToastByType = function createToastByType(type) {\n return function (content, options) {\n return dispatchToast(content, mergeOptions(type, options));\n };\n};\n\nvar toast = function toast(content, options) {\n return dispatchToast(content, mergeOptions(TYPE.DEFAULT, options));\n};\n\ntoast.success = /*#__PURE__*/createToastByType(TYPE.SUCCESS);\ntoast.info = /*#__PURE__*/createToastByType(TYPE.INFO);\ntoast.error = /*#__PURE__*/createToastByType(TYPE.ERROR);\ntoast.warning = /*#__PURE__*/createToastByType(TYPE.WARNING);\ntoast.dark = /*#__PURE__*/createToastByType(TYPE.DARK);\ntoast.warn = toast.warning;\n/**\r\n * Remove toast programmaticaly\r\n */\n\ntoast.dismiss = function (id) {\n return eventManager.emit(1\n /* Clear */\n , id);\n};\n/**\r\n * Clear waiting queue when limit is used\r\n */\n\n\ntoast.clearWaitingQueue = function (params) {\n if (params === void 0) {\n params = {};\n }\n\n return eventManager.emit(5\n /* ClearWaitingQueue */\n , params);\n};\n/**\r\n * return true if one container is displaying the toast\r\n */\n\n\ntoast.isActive = function (id) {\n var isToastActive = false;\n containers.forEach(function (container) {\n if (container.isToastActive && container.isToastActive(id)) {\n isToastActive = true;\n }\n });\n return isToastActive;\n};\n\ntoast.update = function (toastId, options) {\n if (options === void 0) {\n options = {};\n }\n\n // if you call toast and toast.update directly nothing will be displayed\n // this is why I defered the update\n setTimeout(function () {\n var toast = getToast(toastId, options);\n\n if (toast) {\n var oldOptions = toast.props,\n oldContent = toast.content;\n\n var nextOptions = _extends({}, oldOptions, options, {\n toastId: options.toastId || toastId,\n updateId: generateToastId()\n });\n\n if (nextOptions.toastId !== toastId) nextOptions.staleId = toastId;\n var content = nextOptions.render || oldContent;\n delete nextOptions.render;\n dispatchToast(content, nextOptions);\n }\n }, 0);\n};\n/**\r\n * Used for controlled progress bar.\r\n */\n\n\ntoast.done = function (id) {\n toast.update(id, {\n progress: 1\n });\n};\n/**\r\n * Track changes. The callback get the number of toast displayed\r\n *\r\n */\n\n\ntoast.onChange = function (callback) {\n if (isFn(callback)) {\n eventManager.on(4\n /* Change */\n , callback);\n }\n\n return function () {\n isFn(callback) && eventManager.off(4\n /* Change */\n , callback);\n };\n};\n/**\r\n * Configure the ToastContainer when lazy mounted\r\n */\n\n\ntoast.configure = function (config) {\n if (config === void 0) {\n config = {};\n }\n\n lazy = true;\n containerConfig = config;\n};\n\ntoast.POSITION = POSITION;\ntoast.TYPE = TYPE;\n/**\r\n * Wait until the ToastContainer is mounted to dispatch the toast\r\n * and attach isActive method\r\n */\n\neventManager.on(2\n/* DidMount */\n, function (containerInstance) {\n latestInstance = containerInstance.containerId || containerInstance;\n containers.set(latestInstance, containerInstance);\n queue.forEach(function (item) {\n eventManager.emit(0\n /* Show */\n , item.content, item.options);\n });\n queue = [];\n}).on(3\n/* WillUnmount */\n, function (containerInstance) {\n containers[\"delete\"](containerInstance.containerId || containerInstance);\n\n if (containers.size === 0) {\n eventManager.off(0\n /* Show */\n ).off(1\n /* Clear */\n ).off(5\n /* ClearWaitingQueue */\n );\n }\n\n if (canUseDom && containerDomNode) {\n document.body.removeChild(containerDomNode);\n }\n});\n\nexport { Bounce, Flip, Slide, ToastContainer, Zoom, collapseToast, cssTransition, toast, useToast, useToastContainer };\n//# sourceMappingURL=react-toastify.esm.js.map\n","const e=typeof window==\"undefined\"||typeof document==\"undefined\";export{e as isServer};\n","import{useLayoutEffect as e,useEffect as f}from\"react\";import{isServer as o}from'../utils/ssr.js';let s=o?f:e;export{s as useIsoMorphicEffect};\n","import{useRef as t}from\"react\";import{useIsoMorphicEffect as o}from'./use-iso-morphic-effect.js';function s(e){let r=t(e);return o(()=>{r.current=e},[e]),r}export{s as useLatestValue};\n","function t(e){typeof queueMicrotask==\"function\"?queueMicrotask(e):Promise.resolve().then(e).catch(o=>setTimeout(()=>{throw o}))}export{t as microTask};\n","import{microTask as s}from'./micro-task.js';function m(){let n=[],i=[],r={enqueue(e){i.push(e)},addEventListener(e,t,a,o){return e.addEventListener(t,a,o),r.add(()=>e.removeEventListener(t,a,o))},requestAnimationFrame(...e){let t=requestAnimationFrame(...e);return r.add(()=>cancelAnimationFrame(t))},nextFrame(...e){return r.requestAnimationFrame(()=>r.requestAnimationFrame(...e))},setTimeout(...e){let t=setTimeout(...e);return r.add(()=>clearTimeout(t))},microTask(...e){let t={current:!0};return s(()=>{t.current&&e[0]()}),r.add(()=>{t.current=!1})},add(e){return n.push(e),()=>{let t=n.indexOf(e);if(t>=0){let[a]=n.splice(t,1);a()}}},dispose(){for(let e of n.splice(0))e()},async workQueue(){for(let e of i.splice(0))await e()}};return r}export{m as disposables};\n","import{useState as s,useEffect as o}from\"react\";import{disposables as t}from'../utils/disposables.js';function p(){let[e]=s(t);return o(()=>()=>e.dispose(),[e]),e}export{p as useDisposables};\n","import a from\"react\";import{useLatestValue as n}from'./use-latest-value.js';let o=function(t){let e=n(t);return a.useCallback((...r)=>e.current(...r),[e])};export{o as useEvent};\n","import{useState as o,useEffect as t}from\"react\";let r={serverHandoffComplete:!1};function a(){let[e,f]=o(r.serverHandoffComplete);return t(()=>{e!==!0&&f(!0)},[e]),t(()=>{r.serverHandoffComplete===!1&&(r.serverHandoffComplete=!0)},[]),e}export{a as useServerHandoffComplete};\n","var u;import t from\"react\";import{useIsoMorphicEffect as d}from'./use-iso-morphic-effect.js';import{useServerHandoffComplete as f}from'./use-server-handoff-complete.js';let l=0;function r(){return++l}let I=(u=t.useId)!=null?u:function(){let n=f(),[e,o]=t.useState(n?r:null);return d(()=>{e===null&&o(r())},[e]),e!=null?\"\"+e:void 0};export{I as useId};\n","function u(r,n,...a){if(r in n){let e=n[r];return typeof e==\"function\"?e(...a):e}let t=new Error(`Tried to handle \"${r}\" but there is no handler defined. Only defined handlers are: ${Object.keys(n).map(e=>`\"${e}\"`).join(\", \")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,u),t}export{u as match};\n","import{isServer as n}from'./ssr.js';function e(r){return n?null:r instanceof Node?r.ownerDocument:r!=null&&r.hasOwnProperty(\"current\")&&r.current instanceof Node?r.current.ownerDocument:document}export{e as getOwnerDocument};\n","import{disposables as p}from'./disposables.js';import{match as L}from'./match.js';import{getOwnerDocument as c}from'./owner.js';let m=[\"[contentEditable=true]\",\"[tabindex]\",\"a[href]\",\"area[href]\",\"button:not([disabled])\",\"iframe\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].map(e=>`${e}:not([tabindex='-1'])`).join(\",\");var T=(n=>(n[n.First=1]=\"First\",n[n.Previous=2]=\"Previous\",n[n.Next=4]=\"Next\",n[n.Last=8]=\"Last\",n[n.WrapAround=16]=\"WrapAround\",n[n.NoScroll=32]=\"NoScroll\",n))(T||{}),M=(o=>(o[o.Error=0]=\"Error\",o[o.Overflow=1]=\"Overflow\",o[o.Success=2]=\"Success\",o[o.Underflow=3]=\"Underflow\",o))(M||{}),b=(r=>(r[r.Previous=-1]=\"Previous\",r[r.Next=1]=\"Next\",r))(b||{});function d(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(m))}var N=(r=>(r[r.Strict=0]=\"Strict\",r[r.Loose=1]=\"Loose\",r))(N||{});function F(e,t=0){var r;return e===((r=c(e))==null?void 0:r.body)?!1:L(t,{[0](){return e.matches(m)},[1](){let l=e;for(;l!==null;){if(l.matches(m))return!0;l=l.parentElement}return!1}})}function I(e){let t=c(e);p().nextFrame(()=>{t&&!F(t.activeElement,0)&&h(e)})}function h(e){e==null||e.focus({preventScroll:!0})}let w=[\"textarea\",\"input\"].join(\",\");function H(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,w))!=null?r:!1}function S(e,t=r=>r){return e.slice().sort((r,l)=>{let o=t(r),s=t(l);if(o===null||s===null)return 0;let n=o.compareDocumentPosition(s);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function D(e,t){return O(d(),t,!0,e)}function O(e,t,r=!0,l=null){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,s=Array.isArray(e)?r?S(e):e:d(e);l=l!=null?l:o.activeElement;let n=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error(\"Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last\")})(),E=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,s.indexOf(l))-1;if(t&4)return Math.max(0,s.indexOf(l))+1;if(t&8)return s.length-1;throw new Error(\"Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last\")})(),x=t&32?{preventScroll:!0}:{},f=0,i=s.length,u;do{if(f>=i||f+i<=0)return 0;let a=E+f;if(t&16)a=(a+i)%i;else{if(a<0)return 3;if(a>=i)return 1}u=s[a],u==null||u.focus(x),f+=n}while(u!==o.activeElement);return t&6&&H(u)&&u.select(),u.hasAttribute(\"tabindex\")||u.setAttribute(\"tabindex\",\"0\"),2}export{T as Focus,M as FocusResult,N as FocusableMode,h as focusElement,D as focusFrom,O as focusIn,d as getFocusableElements,F as isFocusableElement,I as restoreFocusIfNecessary,S as sortByDomNode};\n","import{useEffect as m}from\"react\";import{useLatestValue as c}from'./use-latest-value.js';function d(e,r,n){let o=c(r);m(()=>{function t(u){o.current(u)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)},[e,n])}export{d as useDocumentEvent};\n","import{useEffect as C,useRef as a}from\"react\";import{FocusableMode as d,isFocusableElement as v}from'../utils/focus-management.js';import{useDocumentEvent as o}from'./use-document-event.js';function L(f,m,i=!0){let l=a(!1);C(()=>{requestAnimationFrame(()=>{l.current=i})},[i]);function c(t,E){if(!l.current||t.defaultPrevented)return;let s=function r(e){return typeof e==\"function\"?r(e()):Array.isArray(e)||e instanceof Set?e:[e]}(f),n=E(t);if(n!==null&&!!n.ownerDocument.documentElement.contains(n)){for(let r of s){if(r===null)continue;let e=r instanceof HTMLElement?r:r.current;if(e!=null&&e.contains(n))return}return!v(n,d.Loose)&&n.tabIndex!==-1&&t.preventDefault(),m(t,n)}}let u=a(null);o(\"mousedown\",t=>{l.current&&(u.current=t.target)},!0),o(\"click\",t=>{!u.current||(c(t,()=>u.current),u.current=null)},!0),o(\"blur\",t=>c(t,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}export{L as useOutsideClick};\n","import{useState as o}from\"react\";import{useIsoMorphicEffect as r}from'./use-iso-morphic-effect.js';function i(t){var n;if(t.type)return t.type;let e=(n=t.as)!=null?n:\"button\";if(typeof e==\"string\"&&e.toLowerCase()===\"button\")return\"button\"}function s(t,e){let[n,u]=o(()=>i(t));return r(()=>{u(i(t))},[t.type,t.as]),r(()=>{n||!e.current||e.current instanceof HTMLButtonElement&&!e.current.hasAttribute(\"type\")&&u(\"button\")},[n,e]),n}export{s as useResolveButtonType};\n","import{useRef as l,useEffect as i}from\"react\";import{useEvent as r}from'./use-event.js';let u=Symbol();function T(t,n=!0){return Object.assign(t,{[u]:n})}function y(...t){let n=l(t);i(()=>{n.current=t},[t]);let c=r(e=>{for(let o of n.current)o!=null&&(typeof o==\"function\"?o(e):o.current=e)});return t.every(e=>e==null||(e==null?void 0:e[u]))?void 0:c}export{T as optionalRef,y as useSyncRefs};\n","import{useRef as E,useEffect as m}from\"react\";import{useIsoMorphicEffect as T}from'./use-iso-morphic-effect.js';import{getOwnerDocument as N}from'../utils/owner.js';function F({container:e,accept:t,walk:r,enabled:c=!0}){let o=E(t),l=E(r);m(()=>{o.current=t,l.current=r},[t,r]),T(()=>{if(!e||!c)return;let n=N(e);if(!n)return;let f=o.current,p=l.current,d=Object.assign(i=>f(i),{acceptNode:f}),u=n.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,d,!1);for(;u.nextNode();)p(u.currentNode)},[e,c,o,l])}export{F as useTreeWalker};\n","function f(r){throw new Error(\"Unexpected object: \"+r)}var a=(e=>(e[e.First=0]=\"First\",e[e.Previous=1]=\"Previous\",e[e.Next=2]=\"Next\",e[e.Last=3]=\"Last\",e[e.Specific=4]=\"Specific\",e[e.Nothing=5]=\"Nothing\",e))(a||{});function x(r,n){let t=n.resolveItems();if(t.length<=0)return null;let l=n.resolveActiveIndex(),s=l!=null?l:-1,d=(()=>{switch(r.focus){case 0:return t.findIndex(e=>!n.resolveDisabled(e));case 1:{let e=t.slice().reverse().findIndex((i,c,u)=>s!==-1&&u.length-c-1>=s?!1:!n.resolveDisabled(i));return e===-1?e:t.length-1-e}case 2:return t.findIndex((e,i)=>i<=s?!1:!n.resolveDisabled(e));case 3:{let e=t.slice().reverse().findIndex(i=>!n.resolveDisabled(i));return e===-1?e:t.length-1-e}case 4:return t.findIndex(e=>n.resolveId(e)===r.id);case 5:return null;default:f(r)}})();return d===-1?l:d}export{a as Focus,x as calculateActiveIndex};\n","import{Fragment as c,cloneElement as P,createElement as b,forwardRef as E,isValidElement as x}from\"react\";import{match as R}from'./match.js';var S=(a=>(a[a.None=0]=\"None\",a[a.RenderStrategy=1]=\"RenderStrategy\",a[a.Static=2]=\"Static\",a))(S||{}),j=(e=>(e[e.Unmount=0]=\"Unmount\",e[e.Hidden=1]=\"Hidden\",e))(j||{});function $({ourProps:r,theirProps:t,slot:e,defaultTag:a,features:o,visible:n=!0,name:l}){let s=T(t,r);if(n)return p(s,e,a,l);let u=o!=null?o:0;if(u&2){let{static:i=!1,...d}=s;if(i)return p(d,e,a,l)}if(u&1){let{unmount:i=!0,...d}=s;return R(i?0:1,{[0](){return null},[1](){return p({...d,hidden:!0,style:{display:\"none\"}},e,a,l)}})}return p(s,e,a,l)}function p(r,t={},e,a){let{as:o=e,children:n,refName:l=\"ref\",...s}=m(r,[\"unmount\",\"static\"]),u=r.ref!==void 0?{[l]:r.ref}:{},i=typeof n==\"function\"?n(t):n;s.className&&typeof s.className==\"function\"&&(s.className=s.className(t));let d={};if(t){let f=!1,y=[];for(let[h,g]of Object.entries(t))typeof g==\"boolean\"&&(f=!0),g===!0&&y.push(h);f&&(d[\"data-headlessui-state\"]=y.join(\" \"))}if(o===c&&Object.keys(F(s)).length>0){if(!x(i)||Array.isArray(i)&&i.length>1)throw new Error(['Passing props on \"Fragment\"!',\"\",`The current component <${a} /> is rendering a \"Fragment\".`,\"However we need to passthrough the following props:\",Object.keys(s).map(f=>` - ${f}`).join(`\n`),\"\",\"You can apply a few solutions:\",['Add an `as=\"...\"` prop, to ensure that we render an actual element instead of a \"Fragment\".',\"Render a single element as the child so that we can forward the props onto that element.\"].map(f=>` - ${f}`).join(`\n`)].join(`\n`));return P(i,Object.assign({},T(i.props,F(m(s,[\"ref\"]))),d,u,w(i.ref,u.ref)))}return b(o,Object.assign({},m(s,[\"ref\"]),o!==c&&u,o!==c&&d),i)}function w(...r){return{ref:r.every(t=>t==null)?void 0:t=>{for(let e of r)e!=null&&(typeof e==\"function\"?e(t):e.current=t)}}}function T(...r){var a;if(r.length===0)return{};if(r.length===1)return r[0];let t={},e={};for(let o of r)for(let n in o)n.startsWith(\"on\")&&typeof o[n]==\"function\"?((a=e[n])!=null||(e[n]=[]),e[n].push(o[n])):t[n]=o[n];if(t.disabled||t[\"aria-disabled\"])return Object.assign(t,Object.fromEntries(Object.keys(e).map(o=>[o,void 0])));for(let o in e)Object.assign(t,{[o](n,...l){let s=e[o];for(let u of s){if((n instanceof Event||(n==null?void 0:n.nativeEvent)instanceof Event)&&n.defaultPrevented)return;u(n,...l)}}});return t}function C(r){var t;return Object.assign(E(r),{displayName:(t=r.displayName)!=null?t:r.name})}function F(r){let t=Object.assign({},r);for(let e in t)t[e]===void 0&&delete t[e];return t}function m(r,t=[]){let e=Object.assign({},r);for(let a of t)a in e&&delete e[a];return e}export{S as Features,j as RenderStrategy,F as compact,C as forwardRefWithAs,$ as render};\n","function r(n){let e=n.parentElement,l=null;for(;e&&!(e instanceof HTMLFieldSetElement);)e instanceof HTMLLegendElement&&(l=e),e=e.parentElement;let t=(e==null?void 0:e.getAttribute(\"disabled\"))===\"\";return t&&i(l)?!1:t}function i(n){if(!n)return!1;let e=n.previousElementSibling;for(;e!==null;){if(e instanceof HTMLLegendElement)return!1;e=e.previousElementSibling}return!0}export{r as isDisabledReactIssue7711};\n","function e(n={},r=null,t=[]){for(let[i,o]of Object.entries(n))f(t,s(r,i),o);return t}function s(n,r){return n?n+\"[\"+r+\"]\":r}function f(n,r,t){if(Array.isArray(t))for(let[i,o]of t.entries())f(n,s(r,i.toString()),o);else t instanceof Date?n.push([r,t.toISOString()]):typeof t==\"boolean\"?n.push([r,t?\"1\":\"0\"]):typeof t==\"string\"?n.push([r,t]):typeof t==\"number\"?n.push([r,`${t}`]):t==null?n.push([r,\"\"]):e(t,r,n)}function p(n){var t;let r=(t=n==null?void 0:n.form)!=null?t:n.closest(\"form\");if(!!r){for(let i of r.elements)if(i.tagName===\"INPUT\"&&i.type===\"submit\"||i.tagName===\"BUTTON\"&&i.type===\"submit\"||i.nodeName===\"INPUT\"&&i.type===\"image\"){i.click();return}}}export{p as attemptSubmit,e as objectToFormEntries};\n","import{forwardRefWithAs as i,render as n}from'../utils/render.js';let a=\"div\";var s=(e=>(e[e.None=1]=\"None\",e[e.Focusable=2]=\"Focusable\",e[e.Hidden=4]=\"Hidden\",e))(s||{});let h=i(function(t,o){let{features:e=1,...r}=t,d={ref:o,\"aria-hidden\":(e&2)===2?!0:void 0,style:{position:\"fixed\",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:\"hidden\",clip:\"rect(0, 0, 0, 0)\",whiteSpace:\"nowrap\",borderWidth:\"0\",...(e&4)===4&&(e&2)!==2&&{display:\"none\"}}};return n({ourProps:d,theirProps:r,slot:{},defaultTag:a,name:\"Hidden\"})});export{s as Features,h as Hidden};\n","import r,{createContext as l,useContext as d}from\"react\";let o=l(null);o.displayName=\"OpenClosedContext\";var p=(e=>(e[e.Open=0]=\"Open\",e[e.Closed=1]=\"Closed\",e))(p||{});function s(){return d(o)}function C({value:t,children:n}){return r.createElement(o.Provider,{value:t},n)}export{C as OpenClosedProvider,p as State,s as useOpenClosed};\n","var o=(r=>(r.Space=\" \",r.Enter=\"Enter\",r.Escape=\"Escape\",r.Backspace=\"Backspace\",r.Delete=\"Delete\",r.ArrowLeft=\"ArrowLeft\",r.ArrowUp=\"ArrowUp\",r.ArrowRight=\"ArrowRight\",r.ArrowDown=\"ArrowDown\",r.Home=\"Home\",r.End=\"End\",r.PageUp=\"PageUp\",r.PageDown=\"PageDown\",r.Tab=\"Tab\",r))(o||{});export{o as Keys};\n","import{useState as f}from\"react\";import{useEvent as d}from'./use-event.js';function p(e,t,u){let[l,s]=f(u),i=e!==void 0;return[i?e:l,d(r=>(i||s(r),t==null?void 0:t(r)))]}export{p as useControllable};\n","import{useEffect as s,useRef as f}from\"react\";import{useEvent as i}from'./use-event.js';function m(u,t){let e=f([]),r=i(u);s(()=>{let o=[...e.current];for(let[n,a]of t.entries())if(e.current[n]!==a){let l=r(t,o);return e.current=t,l}},[r,...t])}export{m as useWatch};\n","import{useEffect as d}from\"react\";import{useLatestValue as a}from'./use-latest-value.js';function s(e,r,n){let o=a(r);d(()=>{function t(i){o.current(i)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)},[e,n])}export{s as useWindowEvent};\n","import{useRef as t}from\"react\";import{useWindowEvent as a}from'./use-window-event.js';var s=(r=>(r[r.Forwards=0]=\"Forwards\",r[r.Backwards=1]=\"Backwards\",r))(s||{});function n(){let e=t(0);return a(\"keydown\",o=>{o.key===\"Tab\"&&(e.current=o.shiftKey?1:0)},!0),e}export{s as Direction,n as useTabDirection};\n","import{useRef as r}from\"react\";import{useIsoMorphicEffect as t}from'./use-iso-morphic-effect.js';function f(){let e=r(!1);return t(()=>(e.current=!0,()=>{e.current=!1}),[]),e}export{f as useIsMounted};\n","import{useMemo as t}from\"react\";import{getOwnerDocument as o}from'../utils/owner.js';function n(...e){return t(()=>o(...e),[...e])}export{n as useOwnerDocument};\n","import{useEffect as d}from\"react\";import{useLatestValue as s}from'./use-latest-value.js';function E(n,e,a,t){let i=s(a);d(()=>{n=n!=null?n:window;function r(o){i.current(o)}return n.addEventListener(e,r,t),()=>n.removeEventListener(e,r,t)},[n,e,t])}export{E as useEventListener};\n","import i,{useEffect as h,useRef as m}from\"react\";import{forwardRefWithAs as y,render as S}from'../../utils/render.js';import{useServerHandoffComplete as g}from'../../hooks/use-server-handoff-complete.js';import{useSyncRefs as B}from'../../hooks/use-sync-refs.js';import{Features as M,Hidden as L}from'../../internal/hidden.js';import{focusElement as f,focusIn as b,Focus as E,FocusResult as I}from'../../utils/focus-management.js';import{match as P}from'../../utils/match.js';import{useEvent as _}from'../../hooks/use-event.js';import{useTabDirection as U,Direction as d}from'../../hooks/use-tab-direction.js';import{useIsMounted as H}from'../../hooks/use-is-mounted.js';import{useOwnerDocument as C}from'../../hooks/use-owner.js';import{useEventListener as R}from'../../hooks/use-event-listener.js';import{microTask as F}from'../../utils/micro-task.js';import{useWatch as O}from'../../hooks/use-watch.js';let N=\"div\";var v=(r=>(r[r.None=1]=\"None\",r[r.InitialFocus=2]=\"InitialFocus\",r[r.TabLock=4]=\"TabLock\",r[r.FocusLock=8]=\"FocusLock\",r[r.RestoreFocus=16]=\"RestoreFocus\",r[r.All=30]=\"All\",r))(v||{});let fe=Object.assign(y(function(u,e){let l=m(null),o=B(l,e),{initialFocus:a,containers:r,features:n=30,...c}=u;g()||(n=1);let s=C(l);V({ownerDocument:s},Boolean(n&16));let j=x({ownerDocument:s,container:l,initialFocus:a},Boolean(n&2));G({ownerDocument:s,container:l,containers:r,previousActiveElement:j},Boolean(n&8));let k=U(),p=_(()=>{let T=l.current;!T||P(k.current,{[d.Forwards]:()=>b(T,E.First),[d.Backwards]:()=>b(T,E.Last)})}),A={ref:o};return i.createElement(i.Fragment,null,Boolean(n&4)&&i.createElement(L,{as:\"button\",type:\"button\",onFocus:p,features:M.Focusable}),S({ourProps:A,theirProps:c,defaultTag:N,name:\"FocusTrap\"}),Boolean(n&4)&&i.createElement(L,{as:\"button\",type:\"button\",onFocus:p,features:M.Focusable}))}),{features:v});function V({ownerDocument:t},u){let e=m(null);R(t==null?void 0:t.defaultView,\"focusout\",o=>{!u||e.current||(e.current=o.target)},!0),O(()=>{u||((t==null?void 0:t.activeElement)===(t==null?void 0:t.body)&&f(e.current),e.current=null)},[u]);let l=m(!1);h(()=>(l.current=!1,()=>{l.current=!0,F(()=>{!l.current||(f(e.current),e.current=null)})}),[])}function x({ownerDocument:t,container:u,initialFocus:e},l){let o=m(null),a=H();return O(()=>{if(!l)return;let r=u.current;!r||F(()=>{if(!a.current)return;let n=t==null?void 0:t.activeElement;if(e!=null&&e.current){if((e==null?void 0:e.current)===n){o.current=n;return}}else if(r.contains(n)){o.current=n;return}e!=null&&e.current?f(e.current):b(r,E.First)===I.Error&&console.warn(\"There are no focusable elements inside the \"),o.current=t==null?void 0:t.activeElement})},[l]),o}function G({ownerDocument:t,container:u,containers:e,previousActiveElement:l},o){let a=H();R(t==null?void 0:t.defaultView,\"focus\",r=>{if(!o||!a.current)return;let n=new Set(e==null?void 0:e.current);n.add(u);let c=l.current;if(!c)return;let s=r.target;s&&s instanceof HTMLElement?W(n,s)?(l.current=s,f(s)):(r.preventDefault(),r.stopPropagation(),f(c)):f(l.current)},!0)}function W(t,u){var e;for(let l of t)if((e=l.current)!=null&&e.contains(u))return!0;return!1}export{fe as FocusTrap};\n","import{getOwnerDocument as s}from'../utils/owner.js';import{useIsoMorphicEffect as d}from'./use-iso-morphic-effect.js';let i=new Set,r=new Map;function u(t){t.setAttribute(\"aria-hidden\",\"true\"),t.inert=!0}function l(t){let n=r.get(t);!n||(n[\"aria-hidden\"]===null?t.removeAttribute(\"aria-hidden\"):t.setAttribute(\"aria-hidden\",n[\"aria-hidden\"]),t.inert=n.inert)}function M(t,n=!0){d(()=>{if(!n||!t.current)return;let o=t.current,a=s(o);if(!!a){i.add(o);for(let e of r.keys())e.contains(o)&&(l(e),r.delete(e));return a.querySelectorAll(\"body > *\").forEach(e=>{if(e instanceof HTMLElement){for(let f of i)if(e.contains(f))return;i.size===1&&(r.set(e,{\"aria-hidden\":e.getAttribute(\"aria-hidden\"),inert:e.inert}),u(e))}}),()=>{if(i.delete(o),i.size>0)a.querySelectorAll(\"body > *\").forEach(e=>{if(e instanceof HTMLElement&&!r.has(e)){for(let f of i)if(e.contains(f))return;r.set(e,{\"aria-hidden\":e.getAttribute(\"aria-hidden\"),inert:e.inert}),u(e)}});else for(let e of r.keys())l(e),r.delete(e)}}},[n])}export{M as useInertOthers};\n","import t,{createContext as r,useContext as c}from\"react\";let e=r(!1);function l(){return c(e)}function P(o){return t.createElement(e.Provider,{value:o.force},o.children)}export{P as ForcePortalRoot,l as usePortalRoot};\n","import h,{Fragment as s,createContext as L,useContext as y,useEffect as m,useRef as d,useState as T}from\"react\";import{createPortal as G}from\"react-dom\";import{forwardRefWithAs as P,render as R}from'../../utils/render.js';import{useIsoMorphicEffect as M}from'../../hooks/use-iso-morphic-effect.js';import{usePortalRoot as v}from'../../internal/portal-force-root.js';import{useServerHandoffComplete as C}from'../../hooks/use-server-handoff-complete.js';import{optionalRef as O,useSyncRefs as g}from'../../hooks/use-sync-refs.js';import{useOwnerDocument as c}from'../../hooks/use-owner.js';import{microTask as H}from'../../utils/micro-task.js';import{isServer as E}from'../../utils/ssr.js';function x(i){let u=v(),o=y(A),e=c(i),[r,f]=T(()=>{if(!u&&o!==null||E)return null;let n=e==null?void 0:e.getElementById(\"headlessui-portal-root\");if(n)return n;if(e===null)return null;let t=e.createElement(\"div\");return t.setAttribute(\"id\",\"headlessui-portal-root\"),e.body.appendChild(t)});return m(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),m(()=>{u||o!==null&&f(o.current)},[o,f,u]),r}let _=s,U=P(function(u,o){let e=u,r=d(null),f=g(O(a=>{r.current=a}),o),n=c(r),t=x(r),[l]=T(()=>{var a;return E?null:(a=n==null?void 0:n.createElement(\"div\"))!=null?a:null}),b=C(),p=d(!1);return M(()=>{if(p.current=!1,!(!t||!l))return t.contains(l)||(l.setAttribute(\"data-headlessui-portal\",\"\"),t.appendChild(l)),()=>{p.current=!0,H(()=>{var a;!p.current||!t||!l||(t.removeChild(l),t.childNodes.length<=0&&((a=t.parentElement)==null||a.removeChild(t)))})}},[t,l]),b?!t||!l?null:G(R({ourProps:{ref:f},theirProps:e,defaultTag:_,name:\"Portal\"}),l):null}),j=s,A=L(null),F=P(function(u,o){let{target:e,...r}=u,n={ref:g(o)};return h.createElement(A.Provider,{value:e},R({ourProps:n,theirProps:r,defaultTag:j,name:\"Popover.Group\"}))}),$=Object.assign(U,{Group:F});export{$ as Portal};\n","import f,{createContext as m,useContext as D,useMemo as l,useState as P}from\"react\";import{useId as T}from'../../hooks/use-id.js';import{forwardRefWithAs as g,render as x}from'../../utils/render.js';import{useIsoMorphicEffect as E}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as h}from'../../hooks/use-sync-refs.js';import{useEvent as v}from'../../hooks/use-event.js';let d=m(null);function u(){let r=D(d);if(r===null){let t=new Error(\"You used a component, but it is not inside a relevant parent.\");throw Error.captureStackTrace&&Error.captureStackTrace(t,u),t}return r}function k(){let[r,t]=P([]);return[r.length>0?r.join(\" \"):void 0,l(()=>function(e){let i=v(n=>(t(o=>[...o,n]),()=>t(o=>{let c=o.slice(),p=c.indexOf(n);return p!==-1&&c.splice(p,1),c}))),s=l(()=>({register:i,slot:e.slot,name:e.name,props:e.props}),[i,e.slot,e.name,e.props]);return f.createElement(d.Provider,{value:s},e.children)},[t])]}let S=\"p\",F=g(function(t,a){let e=u(),i=`headlessui-description-${T()}`,s=h(a);E(()=>e.register(i),[i,e.register]);let n=t,o={ref:s,...e.props,id:i};return x({ourProps:o,theirProps:n,slot:e.slot||{},defaultTag:S,name:e.name||\"Description\"})});export{F as Description,k as useDescriptions};\n","import d,{createContext as c,useContext as m}from\"react\";import{useIsoMorphicEffect as f}from'../hooks/use-iso-morphic-effect.js';import{useEvent as p}from'../hooks/use-event.js';let a=c(()=>{});a.displayName=\"StackContext\";var s=(e=>(e[e.Add=0]=\"Add\",e[e.Remove=1]=\"Remove\",e))(s||{});function x(){return m(a)}function M({children:i,onUpdate:r,type:e,element:n,enabled:u}){let l=x(),o=p((...t)=>{r==null||r(...t),l(...t)});return f(()=>{let t=u===void 0||u===!0;return t&&o(0,e,n),()=>{t&&o(1,e,n)}},[o,e,n,u]),d.createElement(a.Provider,{value:o},i)}export{s as StackMessage,M as StackProvider,x as useStackContext};\n","function o(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}export{o as isIOS};\n","import c,{createContext as oe,createRef as re,useContext as Y,useEffect as F,useMemo as b,useReducer as le,useRef as x,useState as ne}from\"react\";import{match as k}from'../../utils/match.js';import{forwardRefWithAs as A,render as E,Features as j}from'../../utils/render.js';import{useSyncRefs as v}from'../../hooks/use-sync-refs.js';import{Keys as ie}from'../keyboard.js';import{isDisabledReactIssue7711 as ae}from'../../utils/bugs.js';import{useId as O}from'../../hooks/use-id.js';import{FocusTrap as C}from'../../components/focus-trap/focus-trap.js';import{useInertOthers as se}from'../../hooks/use-inert-others.js';import{Portal as I}from'../../components/portal/portal.js';import{ForcePortalRoot as H}from'../../internal/portal-force-root.js';import{Description as pe,useDescriptions as de}from'../description/description.js';import{useOpenClosed as ue,State as N}from'../../internal/open-closed.js';import{useServerHandoffComplete as fe}from'../../hooks/use-server-handoff-complete.js';import{StackProvider as ce,StackMessage as V}from'../../internal/stack-context.js';import{useOutsideClick as ge}from'../../hooks/use-outside-click.js';import{useOwnerDocument as Te}from'../../hooks/use-owner.js';import{useEventListener as me}from'../../hooks/use-event-listener.js';import{Hidden as Pe,Features as De}from'../../internal/hidden.js';import{useEvent as S}from'../../hooks/use-event.js';import{disposables as ye}from'../../utils/disposables.js';import{isIOS as he}from'../../utils/platform.js';var Re=(r=>(r[r.Open=0]=\"Open\",r[r.Closed=1]=\"Closed\",r))(Re||{}),be=(e=>(e[e.SetTitleId=0]=\"SetTitleId\",e))(be||{});let Ae={[0](l,e){return l.titleId===e.id?l:{...l,titleId:e.id}}},M=oe(null);M.displayName=\"DialogContext\";function L(l){let e=Y(M);if(e===null){let r=new Error(`<${l} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,L),r}return e}function Ee(l,e){F(()=>{var p;if(!e||!l)return;let r=ye();function t(n,d,m){let i=n.style.getPropertyValue(d);return Object.assign(n.style,{[d]:m}),r.add(()=>{Object.assign(n.style,{[d]:i})})}let o=l.documentElement,s=((p=l.defaultView)!=null?p:window).innerWidth-o.clientWidth;if(t(o,\"overflow\",\"hidden\"),s>0){let n=o.clientWidth-o.offsetWidth,d=s-n;t(o,\"paddingRight\",`${d}px`)}if(he()){let n=window.pageYOffset;t(o,\"position\",\"fixed\"),t(o,\"marginTop\",`-${n}px`),t(o,\"width\",\"100%\"),r.add(()=>window.scrollTo(0,n))}return r.dispose},[l,e])}function ve(l,e){return k(e.type,Ae,l,e)}let Oe=\"div\",Ce=j.RenderStrategy|j.Static,Se=A(function(e,r){let{open:t,onClose:o,initialFocus:a,__demoMode:s=!1,...p}=e,[n,d]=ne(0),m=ue();t===void 0&&m!==null&&(t=k(m,{[N.Open]:!0,[N.Closed]:!1}));let i=x(new Set),T=x(null),K=v(T,r),W=x(null),P=Te(T),B=e.hasOwnProperty(\"open\")||m!==null,G=e.hasOwnProperty(\"onClose\");if(!B&&!G)throw new Error(\"You have to provide an `open` and an `onClose` prop to the `Dialog` component.\");if(!B)throw new Error(\"You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.\");if(!G)throw new Error(\"You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.\");if(typeof t!=\"boolean\")throw new Error(`You provided an \\`open\\` prop to the \\`Dialog\\`, but the value is not a boolean. Received: ${t}`);if(typeof o!=\"function\")throw new Error(`You provided an \\`onClose\\` prop to the \\`Dialog\\`, but the value is not a function. Received: ${o}`);let u=t?0:1,[y,q]=le(ve,{titleId:null,descriptionId:null,panelRef:re()}),h=S(()=>o(!1)),U=S(f=>q({type:0,id:f})),_=fe()?s?!1:u===0:!1,w=n>1,z=Y(M)!==null,J=w?\"parent\":\"leaf\";se(T,w?_:!1),ge(()=>{var R,g;return[...Array.from((R=P==null?void 0:P.querySelectorAll(\"body > *, [data-headlessui-portal]\"))!=null?R:[]).filter(D=>!(!(D instanceof HTMLElement)||D.contains(W.current)||y.panelRef.current&&D.contains(y.panelRef.current))),(g=y.panelRef.current)!=null?g:T.current]},h,_&&!w),me(P==null?void 0:P.defaultView,\"keydown\",f=>{f.defaultPrevented||f.key===ie.Escape&&u===0&&(w||(f.preventDefault(),f.stopPropagation(),h()))}),Ee(P,u===0&&!z),F(()=>{if(u!==0||!T.current)return;let f=new IntersectionObserver(R=>{for(let g of R)g.boundingClientRect.x===0&&g.boundingClientRect.y===0&&g.boundingClientRect.width===0&&g.boundingClientRect.height===0&&h()});return f.observe(T.current),()=>f.disconnect()},[u,T,h]);let[Q,X]=de(),Z=`headlessui-dialog-${O()}`,ee=b(()=>[{dialogState:u,close:h,setTitleId:U},y],[u,y,h,U]),$=b(()=>({open:u===0}),[u]),te={ref:K,id:Z,role:\"dialog\",\"aria-modal\":u===0?!0:void 0,\"aria-labelledby\":y.titleId,\"aria-describedby\":Q};return c.createElement(ce,{type:\"Dialog\",enabled:u===0,element:T,onUpdate:S((f,R,g)=>{R===\"Dialog\"&&k(f,{[V.Add](){i.current.add(g),d(D=>D+1)},[V.Remove](){i.current.add(g),d(D=>D-1)}})})},c.createElement(H,{force:!0},c.createElement(I,null,c.createElement(M.Provider,{value:ee},c.createElement(I.Group,{target:T},c.createElement(H,{force:!1},c.createElement(X,{slot:$,name:\"Dialog.Description\"},c.createElement(C,{initialFocus:a,containers:i,features:_?k(J,{parent:C.features.RestoreFocus,leaf:C.features.All&~C.features.FocusLock}):C.features.None},E({ourProps:te,theirProps:p,slot:$,defaultTag:Oe,features:Ce,visible:u===0,name:\"Dialog\"})))))))),c.createElement(Pe,{features:De.Hidden,ref:W}))}),Le=\"div\",we=A(function(e,r){let[{dialogState:t,close:o}]=L(\"Dialog.Overlay\"),a=v(r),s=`headlessui-dialog-overlay-${O()}`,p=S(i=>{if(i.target===i.currentTarget){if(ae(i.currentTarget))return i.preventDefault();i.preventDefault(),i.stopPropagation(),o()}}),n=b(()=>({open:t===0}),[t]);return E({ourProps:{ref:a,id:s,\"aria-hidden\":!0,onClick:p},theirProps:e,slot:n,defaultTag:Le,name:\"Dialog.Overlay\"})}),Fe=\"div\",ke=A(function(e,r){let[{dialogState:t},o]=L(\"Dialog.Backdrop\"),a=v(r),s=`headlessui-dialog-backdrop-${O()}`;F(()=>{if(o.panelRef.current===null)throw new Error(\"A component is being used, but a component is missing.\")},[o.panelRef]);let p=b(()=>({open:t===0}),[t]);return c.createElement(H,{force:!0},c.createElement(I,null,E({ourProps:{ref:a,id:s,\"aria-hidden\":!0},theirProps:e,slot:p,defaultTag:Fe,name:\"Dialog.Backdrop\"})))}),Me=\"div\",_e=A(function(e,r){let[{dialogState:t},o]=L(\"Dialog.Panel\"),a=v(r,o.panelRef),s=`headlessui-dialog-panel-${O()}`,p=b(()=>({open:t===0}),[t]),n=S(i=>{i.stopPropagation()});return E({ourProps:{ref:a,id:s,onClick:n},theirProps:e,slot:p,defaultTag:Me,name:\"Dialog.Panel\"})}),xe=\"h2\",Ie=A(function(e,r){let[{dialogState:t,setTitleId:o}]=L(\"Dialog.Title\"),a=`headlessui-dialog-title-${O()}`,s=v(r);F(()=>(o(a),()=>o(null)),[a,o]);let p=b(()=>({open:t===0}),[t]);return E({ourProps:{ref:s,id:a},theirProps:e,slot:p,defaultTag:xe,name:\"Dialog.Title\"})}),gt=Object.assign(Se,{Backdrop:ke,Panel:_e,Overlay:we,Title:Ie,Description:pe});export{gt as Dialog};\n","import S,{Fragment as w,createContext as I,useContext as L,useEffect as F,useMemo as g,useReducer as N,useRef as E}from\"react\";import{match as O}from'../../utils/match.js';import{forwardRefWithAs as k,render as M,Features as _}from'../../utils/render.js';import{optionalRef as G,useSyncRefs as x}from'../../hooks/use-sync-refs.js';import{useId as K}from'../../hooks/use-id.js';import{Keys as y}from'../keyboard.js';import{isDisabledReactIssue7711 as W}from'../../utils/bugs.js';import{OpenClosedProvider as $,State as v,useOpenClosed as q}from'../../internal/open-closed.js';import{useResolveButtonType as z}from'../../hooks/use-resolve-button-type.js';import{getOwnerDocument as J}from'../../utils/owner.js';import{useEvent as R}from'../../hooks/use-event.js';var Q=(o=>(o[o.Open=0]=\"Open\",o[o.Closed=1]=\"Closed\",o))(Q||{}),V=(n=>(n[n.ToggleDisclosure=0]=\"ToggleDisclosure\",n[n.CloseDisclosure=1]=\"CloseDisclosure\",n[n.SetButtonId=2]=\"SetButtonId\",n[n.SetPanelId=3]=\"SetPanelId\",n[n.LinkPanel=4]=\"LinkPanel\",n[n.UnlinkPanel=5]=\"UnlinkPanel\",n))(V||{});let X={[0]:e=>({...e,disclosureState:O(e.disclosureState,{[0]:1,[1]:0})}),[1]:e=>e.disclosureState===1?e:{...e,disclosureState:1},[4](e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},[5](e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},[2](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[3](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},B=I(null);B.displayName=\"DisclosureContext\";function h(e){let t=L(B);if(t===null){let o=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,h),o}return t}let H=I(null);H.displayName=\"DisclosureAPIContext\";function j(e){let t=L(H);if(t===null){let o=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,j),o}return t}let U=I(null);U.displayName=\"DisclosurePanelContext\";function Y(){return L(U)}function Z(e,t){return O(t.type,X,e,t)}let ee=w,te=k(function(t,o){let{defaultOpen:l=!1,...i}=t,s=`headlessui-disclosure-button-${K()}`,n=`headlessui-disclosure-panel-${K()}`,u=E(null),D=x(o,G(f=>{u.current=f},t.as===void 0||t.as===w)),T=E(null),m=E(null),c=N(Z,{disclosureState:l?0:1,linkedPanel:!1,buttonRef:m,panelRef:T,buttonId:s,panelId:n}),[{disclosureState:p},a]=c;F(()=>a({type:2,buttonId:s}),[s,a]),F(()=>a({type:3,panelId:n}),[n,a]);let P=R(f=>{a({type:1});let C=J(u);if(!C)return;let A=(()=>f?f instanceof HTMLElement?f:f.current instanceof HTMLElement?f.current:C.getElementById(s):C.getElementById(s))();A==null||A.focus()}),b=g(()=>({close:P}),[P]),r=g(()=>({open:p===0,close:P}),[p,P]),d={ref:D};return S.createElement(B.Provider,{value:c},S.createElement(H.Provider,{value:b},S.createElement($,{value:O(p,{[0]:v.Open,[1]:v.Closed})},M({ourProps:d,theirProps:i,slot:r,defaultTag:ee,name:\"Disclosure\"}))))}),ne=\"button\",le=k(function(t,o){let[l,i]=h(\"Disclosure.Button\"),s=Y(),n=s===null?!1:s===l.panelId,u=E(null),D=x(u,o,n?null:l.buttonRef),T=R(r=>{var d;if(n){if(l.disclosureState===1)return;switch(r.key){case y.Space:case y.Enter:r.preventDefault(),r.stopPropagation(),i({type:0}),(d=l.buttonRef.current)==null||d.focus();break}}else switch(r.key){case y.Space:case y.Enter:r.preventDefault(),r.stopPropagation(),i({type:0});break}}),m=R(r=>{switch(r.key){case y.Space:r.preventDefault();break}}),c=R(r=>{var d;W(r.currentTarget)||t.disabled||(n?(i({type:0}),(d=l.buttonRef.current)==null||d.focus()):i({type:0}))}),p=g(()=>({open:l.disclosureState===0}),[l]),a=z(t,u),P=t,b=n?{ref:D,type:a,onKeyDown:T,onClick:c}:{ref:D,id:l.buttonId,type:a,\"aria-expanded\":t.disabled?void 0:l.disclosureState===0,\"aria-controls\":l.linkedPanel?l.panelId:void 0,onKeyDown:T,onKeyUp:m,onClick:c};return M({ourProps:b,theirProps:P,slot:p,defaultTag:ne,name:\"Disclosure.Button\"})}),oe=\"div\",re=_.RenderStrategy|_.Static,se=k(function(t,o){let[l,i]=h(\"Disclosure.Panel\"),{close:s}=j(\"Disclosure.Panel\"),n=x(o,l.panelRef,p=>{i({type:p?4:5})}),u=q(),D=(()=>u!==null?u===v.Open:l.disclosureState===0)(),T=g(()=>({open:l.disclosureState===0,close:s}),[l,s]),m=t,c={ref:n,id:l.panelId};return S.createElement(U.Provider,{value:l.panelId},M({ourProps:c,theirProps:m,slot:T,defaultTag:oe,features:re,visible:D,name:\"Disclosure.Panel\"}))}),Oe=Object.assign(te,{Button:le,Panel:se});export{Oe as Disclosure};\n","import U,{Fragment as G,createContext as W,createRef as B,useContext as V,useEffect as $,useMemo as S,useReducer as q,useRef as K}from\"react\";import{match as _}from'../../utils/match.js';import{forwardRefWithAs as h,render as P,Features as N}from'../../utils/render.js';import{disposables as O}from'../../utils/disposables.js';import{useDisposables as H}from'../../hooks/use-disposables.js';import{useIsoMorphicEffect as E}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as x}from'../../hooks/use-sync-refs.js';import{useId as F}from'../../hooks/use-id.js';import{Keys as m}from'../keyboard.js';import{Focus as y,calculateActiveIndex as J}from'../../utils/calculate-active-index.js';import{isDisabledReactIssue7711 as z}from'../../utils/bugs.js';import{isFocusableElement as X,FocusableMode as Y,sortByDomNode as Z,Focus as j,focusFrom as ee,restoreFocusIfNecessary as Q}from'../../utils/focus-management.js';import{useOutsideClick as te}from'../../hooks/use-outside-click.js';import{useTreeWalker as re}from'../../hooks/use-tree-walker.js';import{useOpenClosed as ne,State as L,OpenClosedProvider as oe}from'../../internal/open-closed.js';import{useResolveButtonType as ae}from'../../hooks/use-resolve-button-type.js';import{useOwnerDocument as ie}from'../../hooks/use-owner.js';import{useEvent as I}from'../../hooks/use-event.js';var ue=(o=>(o[o.Open=0]=\"Open\",o[o.Closed=1]=\"Closed\",o))(ue||{}),se=(o=>(o[o.Pointer=0]=\"Pointer\",o[o.Other=1]=\"Other\",o))(se||{}),le=(a=>(a[a.OpenMenu=0]=\"OpenMenu\",a[a.CloseMenu=1]=\"CloseMenu\",a[a.GoToItem=2]=\"GoToItem\",a[a.Search=3]=\"Search\",a[a.ClearSearch=4]=\"ClearSearch\",a[a.RegisterItem=5]=\"RegisterItem\",a[a.UnregisterItem=6]=\"UnregisterItem\",a))(le||{});function k(t,i=o=>o){let o=t.activeItemIndex!==null?t.items[t.activeItemIndex]:null,e=Z(i(t.items.slice()),u=>u.dataRef.current.domRef.current),n=o?e.indexOf(o):null;return n===-1&&(n=null),{items:e,activeItemIndex:n}}let ce={[1](t){return t.menuState===1?t:{...t,activeItemIndex:null,menuState:1}},[0](t){return t.menuState===0?t:{...t,menuState:0}},[2]:(t,i)=>{var n;let o=k(t),e=J(i,{resolveItems:()=>o.items,resolveActiveIndex:()=>o.activeItemIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...t,...o,searchQuery:\"\",activeItemIndex:e,activationTrigger:(n=i.trigger)!=null?n:1}},[3]:(t,i)=>{let e=t.searchQuery!==\"\"?0:1,n=t.searchQuery+i.value.toLowerCase(),s=(t.activeItemIndex!==null?t.items.slice(t.activeItemIndex+e).concat(t.items.slice(0,t.activeItemIndex+e)):t.items).find(c=>{var p;return((p=c.dataRef.current.textValue)==null?void 0:p.startsWith(n))&&!c.dataRef.current.disabled}),a=s?t.items.indexOf(s):-1;return a===-1||a===t.activeItemIndex?{...t,searchQuery:n}:{...t,searchQuery:n,activeItemIndex:a,activationTrigger:1}},[4](t){return t.searchQuery===\"\"?t:{...t,searchQuery:\"\",searchActiveItemIndex:null}},[5]:(t,i)=>{let o=k(t,e=>[...e,{id:i.id,dataRef:i.dataRef}]);return{...t,...o}},[6]:(t,i)=>{let o=k(t,e=>{let n=e.findIndex(u=>u.id===i.id);return n!==-1&&e.splice(n,1),e});return{...t,...o,activationTrigger:1}}},w=W(null);w.displayName=\"MenuContext\";function D(t){let i=V(w);if(i===null){let o=new Error(`<${t} /> is missing a parent
component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,D),o}return i}function pe(t,i){return _(i.type,ce,t,i)}let me=G,de=h(function(i,o){let e=q(pe,{menuState:1,buttonRef:B(),itemsRef:B(),items:[],searchQuery:\"\",activeItemIndex:null,activationTrigger:1}),[{menuState:n,itemsRef:u,buttonRef:s},a]=e,c=x(o);te([s,u],(M,R)=>{var f;a({type:1}),X(R,Y.Loose)||(M.preventDefault(),(f=s.current)==null||f.focus())},n===0);let p=S(()=>({open:n===0}),[n]),g=i,d={ref:c};return U.createElement(w.Provider,{value:e},U.createElement(oe,{value:_(n,{[0]:L.Open,[1]:L.Closed})},P({ourProps:d,theirProps:g,slot:p,defaultTag:me,name:\"Menu\"})))}),fe=\"button\",Te=h(function(i,o){var f;let[e,n]=D(\"Menu.Button\"),u=x(e.buttonRef,o),s=`headlessui-menu-button-${F()}`,a=H(),c=I(l=>{switch(l.key){case m.Space:case m.Enter:case m.ArrowDown:l.preventDefault(),l.stopPropagation(),n({type:0}),a.nextFrame(()=>n({type:2,focus:y.First}));break;case m.ArrowUp:l.preventDefault(),l.stopPropagation(),n({type:0}),a.nextFrame(()=>n({type:2,focus:y.Last}));break}}),p=I(l=>{switch(l.key){case m.Space:l.preventDefault();break}}),g=I(l=>{if(z(l.currentTarget))return l.preventDefault();i.disabled||(e.menuState===0?(n({type:1}),a.nextFrame(()=>{var b;return(b=e.buttonRef.current)==null?void 0:b.focus({preventScroll:!0})})):(l.preventDefault(),n({type:0})))}),d=S(()=>({open:e.menuState===0}),[e]),M=i,R={ref:u,id:s,type:ae(i,e.buttonRef),\"aria-haspopup\":!0,\"aria-controls\":(f=e.itemsRef.current)==null?void 0:f.id,\"aria-expanded\":i.disabled?void 0:e.menuState===0,onKeyDown:c,onKeyUp:p,onClick:g};return P({ourProps:R,theirProps:M,slot:d,defaultTag:fe,name:\"Menu.Button\"})}),ye=\"div\",Ie=N.RenderStrategy|N.Static,ge=h(function(i,o){var b,C;let[e,n]=D(\"Menu.Items\"),u=x(e.itemsRef,o),s=ie(e.itemsRef),a=`headlessui-menu-items-${F()}`,c=H(),p=ne(),g=(()=>p!==null?p===L.Open:e.menuState===0)();$(()=>{let r=e.itemsRef.current;!r||e.menuState===0&&r!==(s==null?void 0:s.activeElement)&&r.focus({preventScroll:!0})},[e.menuState,e.itemsRef,s]),re({container:e.itemsRef.current,enabled:e.menuState===0,accept(r){return r.getAttribute(\"role\")===\"menuitem\"?NodeFilter.FILTER_REJECT:r.hasAttribute(\"role\")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(r){r.setAttribute(\"role\",\"none\")}});let d=I(r=>{var T,A;switch(c.dispose(),r.key){case m.Space:if(e.searchQuery!==\"\")return r.preventDefault(),r.stopPropagation(),n({type:3,value:r.key});case m.Enter:if(r.preventDefault(),r.stopPropagation(),n({type:1}),e.activeItemIndex!==null){let{dataRef:v}=e.items[e.activeItemIndex];(A=(T=v.current)==null?void 0:T.domRef.current)==null||A.click()}Q(e.buttonRef.current);break;case m.ArrowDown:return r.preventDefault(),r.stopPropagation(),n({type:2,focus:y.Next});case m.ArrowUp:return r.preventDefault(),r.stopPropagation(),n({type:2,focus:y.Previous});case m.Home:case m.PageUp:return r.preventDefault(),r.stopPropagation(),n({type:2,focus:y.First});case m.End:case m.PageDown:return r.preventDefault(),r.stopPropagation(),n({type:2,focus:y.Last});case m.Escape:r.preventDefault(),r.stopPropagation(),n({type:1}),O().nextFrame(()=>{var v;return(v=e.buttonRef.current)==null?void 0:v.focus({preventScroll:!0})});break;case m.Tab:r.preventDefault(),r.stopPropagation(),n({type:1}),O().nextFrame(()=>{ee(e.buttonRef.current,r.shiftKey?j.Previous:j.Next)});break;default:r.key.length===1&&(n({type:3,value:r.key}),c.setTimeout(()=>n({type:4}),350));break}}),M=I(r=>{switch(r.key){case m.Space:r.preventDefault();break}}),R=S(()=>({open:e.menuState===0}),[e]),f=i,l={\"aria-activedescendant\":e.activeItemIndex===null||(b=e.items[e.activeItemIndex])==null?void 0:b.id,\"aria-labelledby\":(C=e.buttonRef.current)==null?void 0:C.id,id:a,onKeyDown:d,onKeyUp:M,role:\"menu\",tabIndex:0,ref:u};return P({ourProps:l,theirProps:f,slot:R,defaultTag:ye,features:Ie,visible:g,name:\"Menu.Items\"})}),Me=G,Re=h(function(i,o){let{disabled:e=!1,...n}=i,[u,s]=D(\"Menu.Item\"),a=`headlessui-menu-item-${F()}`,c=u.activeItemIndex!==null?u.items[u.activeItemIndex].id===a:!1,p=K(null),g=x(o,p);E(()=>{if(u.menuState!==0||!c||u.activationTrigger===0)return;let r=O();return r.requestAnimationFrame(()=>{var T,A;(A=(T=p.current)==null?void 0:T.scrollIntoView)==null||A.call(T,{block:\"nearest\"})}),r.dispose},[p,c,u.menuState,u.activationTrigger,u.activeItemIndex]);let d=K({disabled:e,domRef:p});E(()=>{d.current.disabled=e},[d,e]),E(()=>{var r,T;d.current.textValue=(T=(r=p.current)==null?void 0:r.textContent)==null?void 0:T.toLowerCase()},[d,p]),E(()=>(s({type:5,id:a,dataRef:d}),()=>s({type:6,id:a})),[d,a]);let M=I(r=>{if(e)return r.preventDefault();s({type:1}),Q(u.buttonRef.current)}),R=I(()=>{if(e)return s({type:2,focus:y.Nothing});s({type:2,focus:y.Specific,id:a})}),f=I(()=>{e||c||s({type:2,focus:y.Specific,id:a,trigger:0})}),l=I(()=>{e||!c||s({type:2,focus:y.Nothing})}),b=S(()=>({active:c,disabled:e}),[c,e]);return P({ourProps:{id:a,ref:g,role:\"menuitem\",tabIndex:e===!0?void 0:-1,\"aria-disabled\":e===!0?!0:void 0,disabled:void 0,onClick:M,onFocus:R,onPointerMove:f,onMouseMove:f,onPointerLeave:l,onMouseLeave:l},theirProps:n,slot:b,defaultTag:Me,name:\"Menu.Item\"})}),qe=Object.assign(de,{Button:Te,Items:ge,Item:Re});export{qe as Menu};\n","import{useState as m,useCallback as t}from\"react\";function b(g=0){let[r,l]=m(g),u=t(e=>l(a=>a|e),[r]),n=t(e=>Boolean(r&e),[r]),o=t(e=>l(a=>a&~e),[l]),s=t(e=>l(a=>a^e),[l]);return{addFlag:u,hasFlag:n,removeFlag:o,toggleFlag:s}}export{b as useFlags};\n","import p,{createContext as m,useContext as L,useMemo as f,useState as b}from\"react\";import{useId as g}from'../../hooks/use-id.js';import{forwardRefWithAs as x,render as T}from'../../utils/render.js';import{useIsoMorphicEffect as E}from'../../hooks/use-iso-morphic-effect.js';import{useSyncRefs as P}from'../../hooks/use-sync-refs.js';import{useEvent as v}from'../../hooks/use-event.js';let u=m(null);function c(){let o=L(u);if(o===null){let t=new Error(\"You used a
\n\n function setter(element) {\n if (!element || element === storedReference.current) {\n return;\n }\n\n storedReference.current = element;\n onRefChange(element);\n }\n\n return setter;\n}\n/**\r\n * Utility hook that stores mutable state.\r\n * Since a getter function is used, it will always return the most\r\n * up-to-date state. This is useful when you want to get certain state within\r\n * an effect, without triggering the same effect when the same state changes.\r\n * Note: may be seen as an anti-pattern.\r\n */\n\nfunction useMutableStore(initialState) {\n var state = useRef(initialState);\n return useMemo(function () {\n function set(setter) {\n if (typeof setter === \"function\") {\n state.current = setter(state.current);\n } else {\n state.current = setter;\n }\n }\n\n function get() {\n return state.current;\n }\n\n return [get, set];\n }, []);\n}\n/**\r\n * Utility hook that keeps track of active event listeners and how\r\n * to remove these listeners\r\n */\n\nfunction useEventSubscriptions() {\n var subscriptions = useRef([]);\n return useMemo(function () {\n function hasEventSubscriptions() {\n return subscriptions.current.length > 0;\n }\n\n function removeAllEventSubscriptions() {\n for (var _iterator = _createForOfIteratorHelperLoose(subscriptions.current), _step; !(_step = _iterator()).done;) {\n var unsubscribe = _step.value;\n unsubscribe();\n }\n\n subscriptions.current = [];\n }\n\n function addEventSubscription(unsubscriber) {\n subscriptions.current.push(unsubscriber);\n }\n\n return {\n hasEventSubscriptions: hasEventSubscriptions,\n removeAllEventSubscriptions: removeAllEventSubscriptions,\n addEventSubscription: addEventSubscription\n };\n }, []);\n}\n/**\r\n * SSR-safe effect hook\r\n */\n\nvar useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n/**\r\n * Utility hook that tracks an state object.\r\n * If `enabled=false` it will discard changes and reset the lastState to `null`\r\n */\n\nfunction useLastState(currentState, enabled) {\n var lastState = useRef(currentState);\n\n if (!enabled) {\n lastState.current = null;\n return lastState;\n }\n\n lastState.current = currentState;\n return lastState;\n}\nvar EMPTY_BOUNDS = {\n top: 0,\n left: 0,\n right: 1,\n bottom: 1,\n width: 1,\n height: 1\n};\n/**\r\n * @description Utility hook that lets you use the mouse-position as source of the trigger.\r\n * This is useful in scenario's like context-menu's.\r\n *\r\n * @example\r\n * ```tsx\r\n * const {\r\n * hasMousePosition,\r\n * resetMousePosition,\r\n * handleMouseEvent,\r\n * trigger\r\n * } = useMousePositionAsTrigger();\r\n *\r\n * const { renderLayer, layerProps } = useLayer({\r\n * isOpen: hasMousePosition,\r\n * trigger,\r\n * onOutsideClick: resetMousePosition\r\n * });\r\n *\r\n * return (\r\n * <>\r\n * {isOpen && renderLayer(
)}\r\n *
\r\n * \r\n * );\r\n * ```\r\n */\n\nfunction useMousePositionAsTrigger(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$enabled = _ref.enabled,\n enabled = _ref$enabled === void 0 ? true : _ref$enabled,\n _ref$preventDefault = _ref.preventDefault,\n preventDefault = _ref$preventDefault === void 0 ? true : _ref$preventDefault;\n\n var parentRef = useRef(null);\n\n var _useState = useState(EMPTY_BOUNDS),\n mouseBounds = _useState[0],\n setMouseBounds = _useState[1];\n\n function resetMousePosition() {\n setMouseBounds(EMPTY_BOUNDS);\n }\n\n var hasMousePosition = mouseBounds !== EMPTY_BOUNDS;\n\n function handleMouseEvent(evt) {\n if (!enabled) {\n return;\n }\n\n if (preventDefault) {\n evt.preventDefault();\n }\n\n var left = evt.clientX,\n top = evt.clientY;\n setMouseBounds({\n top: top,\n left: left,\n width: 1,\n height: 1,\n right: left + 1,\n bottom: top + 1\n });\n }\n\n return {\n hasMousePosition: hasMousePosition,\n resetMousePosition: resetMousePosition,\n handleMouseEvent: handleMouseEvent,\n trigger: {\n getBounds: function getBounds() {\n return mouseBounds;\n },\n getParent: parentRef.current ? function () {\n return parentRef.current;\n } : undefined\n },\n parentRef: parentRef\n };\n}\n\n/**\r\n * Convert a pixel value into a numeric value\r\n * @param value string value (ie. '12px')\r\n */\nfunction getPixelValue(value) {\n return parseFloat(value.replace(\"px\", \"\"));\n}\n/**\r\n * Returns a numeric value that doesn't exceed min or max\r\n */\n\nfunction limit(value, min, max) {\n return value < min ? min : value > max ? max : value;\n}\n/**\r\n * Utility function which ensures whether a value is truthy\r\n */\n\nfunction isSet(value) {\n return value === null || value === undefined ? false : true;\n}\n/**\r\n * Utility function that let's you assign multiple references to a 'ref' prop\r\n * @param refs list of MutableRefObject's and / or callbacks\r\n */\n\nfunction mergeRefs() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n\n return function (element) {\n for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done;) {\n var ref = _step.value;\n\n if (!ref) {\n continue;\n }\n\n if (typeof ref === \"function\") {\n ref(element);\n } else {\n ref.current = element;\n }\n }\n };\n}\n\n/**\r\n * Utility to get the correct ResizeObserver class\r\n */\n\nfunction getResizeObserver(environment, polyfill) {\n if (typeof environment === \"undefined\") {\n return undefined;\n }\n\n return polyfill || environment.ResizeObserver;\n}\n/**\r\n * Utility function that given a element traverses up in the html-hierarchy\r\n * to find and return all ancestors that have scroll behavior\r\n */\n\nfunction findScrollContainers(element, environment) {\n var result = [];\n\n if (!element || !environment || element === document.body) {\n return result;\n }\n\n var _environment$getCompu = environment.getComputedStyle(element),\n overflow = _environment$getCompu.overflow,\n overflowX = _environment$getCompu.overflowX,\n overflowY = _environment$getCompu.overflowY;\n\n if ([overflow, overflowX, overflowY].some(function (prop) {\n return [\"auto\", \"scroll\"].includes(prop);\n })) {\n result.push(element);\n }\n\n return [].concat(result, findScrollContainers(element.parentElement, environment));\n}\n\nfunction createReferenceError(subject) {\n return \"react-laag: Could not find a valid reference for the \" + subject + \" element. There might be 2 causes:\\n - Make sure that the 'ref' is set correctly on the \" + subject + \" element when isOpen: true. Also make sure your component forwards the ref with \\\"forwardRef()\\\".\\n - Make sure that you are actually rendering the \" + subject + \" when the isOpen prop is set to true\";\n}\n/**\r\n * This hook has the responsibility to track the bounds of:\r\n * - the trigger element\r\n * - the layer element\r\n * - the arrow element\r\n * - the scroll-containers of which the trigger element is a descendant of\r\n *\r\n * It will call the `onChange` callback with a collection of these elements when any\r\n * of the tracked elements bounds have changed\r\n *\r\n * It will detect these changes by listening:\r\n * - when the reference of the trigger element changes\r\n * - when the reference of the layer element changes\r\n * - when the trigger, layer or document body changes in size\r\n * - when the user scrolls the page, or any of the scroll containers\r\n */\n\n\nfunction useTrackElements(_ref) {\n var enabled = _ref.enabled,\n onChange = _ref.onChange,\n environment = _ref.environment,\n ResizeObserverPolyfill = _ref.ResizeObserverPolyfill,\n overflowContainer = _ref.overflowContainer,\n triggerOption = _ref.triggerOption;\n // get the correct reference to the ResizeObserver class\n var ResizeObserver = getResizeObserver(environment, ResizeObserverPolyfill); // warn the user when no valid ResizeObserver class could be found\n\n useEffect(function () {\n process.env.NODE_ENV !== \"production\" ? warning(ResizeObserver, \"This browser does not support ResizeObserver out of the box. We recommend to add a polyfill in order to utilize the full capabilities of react-laag. See: https://github.com/everweij/react-laag#resize-observer\") : void 0;\n }, [ResizeObserver]); // keep reference of the optional arrow-component\n\n var arrowRef = useRef(null); // if user has provided the trigger-option we should ingore certain things elsewhere\n\n var hasTriggerOption = Boolean(triggerOption); // Keep track of mutable element related state\n // It is generally better to use React.useState, but unfortunately that causes to many re-renders\n\n var _useMutableStore = useMutableStore({\n scrollContainers: [],\n trigger: null,\n layer: null\n }),\n get = _useMutableStore[0],\n set = _useMutableStore[1]; // utility to keep track of the scroll and resize listeners and how to unsubscribe them\n\n\n var _useEventSubscription = useEventSubscriptions(),\n hasEventSubscriptions = _useEventSubscription.hasEventSubscriptions,\n addEventSubscription = _useEventSubscription.addEventSubscription,\n removeAllEventSubscriptions = _useEventSubscription.removeAllEventSubscriptions; // All scroll and resize changes eventually end up here, where the collection of bounds (subjectsBounds) is\n // constructed in order to notifiy the `onBoundsChange` callback\n\n\n var handleChange = useCallback(function handleChange() {\n var _get = get(),\n layer = _get.layer,\n trigger = _get.trigger,\n scrollContainers = _get.scrollContainers;\n\n var closestScrollContainer = scrollContainers[0];\n\n if (!layer) {\n throw new Error(createReferenceError(\"layer\"));\n } // ignore when user has provided the trigger-option\n\n\n if (!trigger && !hasTriggerOption) {\n throw new Error(createReferenceError(\"trigger\"));\n }\n\n var scrollOffsets = {\n top: 0,\n left: 0\n };\n\n if (closestScrollContainer) {\n var scrollLeft = closestScrollContainer.scrollLeft,\n scrollTop = closestScrollContainer.scrollTop;\n scrollOffsets = {\n top: scrollTop,\n left: scrollLeft\n };\n } else {\n var scrollX = environment.scrollX,\n scrollY = environment.scrollY;\n scrollOffsets = {\n top: scrollY,\n left: scrollX\n };\n }\n\n var borderOffsets = {\n left: 0,\n top: 0\n };\n\n if (closestScrollContainer) {\n var _environment$getCompu2 = environment.getComputedStyle(closestScrollContainer),\n borderLeftWidth = _environment$getCompu2.borderLeftWidth,\n borderTopWidth = _environment$getCompu2.borderTopWidth;\n\n borderOffsets = {\n left: getPixelValue(borderLeftWidth) || 0,\n top: getPixelValue(borderTopWidth) || 0\n };\n }\n\n onChange({\n layer: layer,\n trigger: trigger,\n scrollContainers: scrollContainers,\n arrow: arrowRef.current\n }, scrollOffsets, borderOffsets);\n }, [get, onChange, environment, arrowRef, hasTriggerOption]); // responsible for adding the scroll and resize listeners to the correct\n // html elements\n\n var addEventListeners = useCallback(function addEventListeners() {\n var _get2 = get(),\n trigger = _get2.trigger,\n layer = _get2.layer,\n scrollContainers = _get2.scrollContainers;\n\n if (!layer) {\n throw new Error(createReferenceError(\"layer\"));\n }\n\n if (!trigger && !hasTriggerOption) {\n // ignore when user has provided the trigger-option\n throw new Error(createReferenceError(\"trigger\"));\n }\n\n if (ResizeObserver) {\n var ignoredInitialCall = false;\n\n var observerCallback = function observerCallback() {\n if (!ignoredInitialCall) {\n ignoredInitialCall = true;\n return;\n }\n\n handleChange();\n };\n\n var observer = new ResizeObserver(observerCallback);\n\n for (var _i = 0, _arr = [trigger, layer, document.body]; _i < _arr.length; _i++) {\n var element = _arr[_i];\n if (element) observer.observe(element);\n }\n\n addEventSubscription(function () {\n for (var _i2 = 0, _arr2 = [trigger, layer, document.body]; _i2 < _arr2.length; _i2++) {\n var _element = _arr2[_i2];\n if (_element) observer.unobserve(_element);\n }\n\n observer.disconnect();\n });\n }\n\n var listenForScrollElements = [environment].concat(scrollContainers);\n\n var _loop = function _loop() {\n var element = _step.value;\n element.addEventListener(\"scroll\", handleChange);\n addEventSubscription(function () {\n return element.removeEventListener(\"scroll\", handleChange);\n });\n };\n\n for (var _iterator = _createForOfIteratorHelperLoose(listenForScrollElements), _step; !(_step = _iterator()).done;) {\n _loop();\n }\n }, [get, addEventSubscription, handleChange, environment, ResizeObserver, hasTriggerOption]); // when either the reference to the trigger or layer element changes\n // we should reset the event listeners and trigger a `onChange`\n\n var resetWhenReferenceChangedWhileTracking = useCallback(function (previous, next) {\n if (enabled && previous && previous !== next) {\n removeAllEventSubscriptions();\n addEventListeners();\n handleChange();\n }\n }, [removeAllEventSubscriptions, addEventListeners, handleChange, enabled]); // Logic when reference to layer changes\n\n var layerRef = useTrackRef(useCallback(function (layer) {\n var _get3 = get(),\n previousLayer = _get3.layer; // store new reference\n\n\n set(function (state) {\n return _extends({}, state, {\n layer: layer\n });\n }); // check if we should reset the event listeners\n\n resetWhenReferenceChangedWhileTracking(previousLayer, layer);\n }, [get, set, resetWhenReferenceChangedWhileTracking]));\n var getScrollContainers = useCallback(function handleScrollContainers(element) {\n var scrollContainers = findScrollContainers(element, environment);\n var closestScrollContainer = scrollContainers[0];\n\n if (closestScrollContainer) {\n // Check if we should warn the user about 'position: relative; stuff...'\n var position = environment.getComputedStyle(closestScrollContainer).position;\n var closestScrollContainerHasCorrectStyling = [\"relative\", \"absolute\", \"fixed\"].includes(position) || overflowContainer;\n\n if (!closestScrollContainerHasCorrectStyling) {\n closestScrollContainer.style.position = \"relative\";\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(closestScrollContainerHasCorrectStyling, \"react-laag: Set the 'position' style of the nearest scroll-container to 'relative', 'absolute' or 'fixed', or set the 'overflowContainer' prop to true. This is needed in order to position the layer properly. Currently the scroll-container is positioned: \\\"\" + position + \"\\\". For now, \\\"position: relative;\\\" is added for you, but this behavior might be removed in the future. Visit https://react-laag.com/docs/#position-relative for more info.\") : void 0;\n }\n\n return scrollContainers;\n }, [environment, overflowContainer]); // Logic when reference to trigger changes\n // Note: this will have no effect when user provided the trigger-option\n\n var triggerRef = useTrackRef(useCallback(function (trigger) {\n // collect list of scroll containers\n var scrollContainers = getScrollContainers(trigger);\n\n var _get4 = get(),\n previousTrigger = _get4.trigger; // store new references\n\n\n set(function (state) {\n return _extends({}, state, {\n trigger: trigger,\n scrollContainers: scrollContainers\n });\n }); // check if we should reset the event listeners\n\n resetWhenReferenceChangedWhileTracking(previousTrigger, trigger);\n }, [get, set, resetWhenReferenceChangedWhileTracking, getScrollContainers])); // when user has provided the trigger-option, it monitors the optional parent-element\n // in order to determine the scroll-containers\n\n var triggerOptionParent = triggerOption == null ? void 0 : triggerOption.getParent == null ? void 0 : triggerOption.getParent();\n useIsomorphicLayoutEffect(function () {\n if (!triggerOptionParent) {\n return;\n }\n\n set(function (state) {\n return _extends({}, state, {\n scrollContainers: getScrollContainers(triggerOptionParent)\n });\n });\n }, [triggerOptionParent, set, getScrollContainers]);\n useIsomorphicLayoutEffect(function () {\n if (enabled) {\n // add event listeners if necessary\n if (!hasEventSubscriptions()) {\n addEventListeners();\n }\n }\n\n return function () {\n if (hasEventSubscriptions()) {\n removeAllEventSubscriptions();\n }\n };\n }, [enabled, hasEventSubscriptions, addEventListeners, removeAllEventSubscriptions]); // run this effect after every render\n\n useIsomorphicLayoutEffect(function () {\n if (enabled) {\n // eventually call `handleChange` with latest elements-refs\n handleChange();\n }\n });\n return {\n triggerRef: triggerRef,\n layerRef: layerRef,\n arrowRef: arrowRef,\n closestScrollContainer: get().scrollContainers[0] || null\n };\n}\n\nvar GroupContext = /*#__PURE__*/createContext({}); // Provider that wraps arround the layer in order to provide other useLayers\n// down in the hiearchy (child layers) with means to communicate with the parent.\n// This provider receives a `registrations` Set which can be used to add and\n// delete registrations.\n\nfunction GroupProvider(_ref) {\n var children = _ref.children,\n registrations = _ref.registrations;\n // registration function that is used as 'context payload' for child layers\n // to call. It returns a function to unregister.\n var handleRegister = useCallback(function register(registration) {\n registrations.current.add(registration);\n return function () {\n return registrations.current.delete(registration);\n };\n }, [registrations]);\n return createElement(GroupContext.Provider, {\n value: handleRegister\n }, children);\n} // asks child layers if they would close given the documents click event\n// if there's one that signals not to close, return early (false)\n\nfunction getShouldCloseAccordingToChildren(registrations, event) {\n for (var _iterator = _createForOfIteratorHelperLoose(registrations), _step; !(_step = _iterator()).done;) {\n var shouldCloseWhenClickedOutside = _step.value.shouldCloseWhenClickedOutside;\n\n if (!shouldCloseWhenClickedOutside(event)) {\n return false;\n }\n }\n\n return true;\n}\n/**\r\n * Responsible for close behavior\r\n * When the `onOutsideClick` callback is provided by the user, it will listen for clicks\r\n * in the document, and tell whether the user clicked outside -> not on layer / trigger.\r\n * It keeps track of nested useLayers a.k.a child layers (`registrations` Set), through which\r\n * we can ask whether they `shouldCloseWhenClickedOutside`, or tell them to close.\r\n *\r\n * Behavior:\r\n * - `onOutsideClick` only works on the most outer parent, and not on children. The parent will ask\r\n * the child layers whether they would close, and will handle accordingly. The parent may\r\n * command the children to close indirectly with the help of `onParentClose`\r\n * - When the parent just was closed, it will make sure that any children will also close\r\n * with the help of `onParentClose`\r\n */\n\n\nfunction useGroup(_ref2) {\n var isOpen = _ref2.isOpen,\n onOutsideClick = _ref2.onOutsideClick,\n onParentClose = _ref2.onParentClose;\n // store references to the dom-elements\n // we need these to later determine wether the clicked outside or not\n var trigger = useRef(null);\n var layer = useRef(null); // a Set which keeps track of callbacks given by the child layers through context\n\n var registrations = useRef(new Set()); // if this instance is a child itself, we should use this function to register\n // some callbacks to the parent\n\n var possibleRegisterFn = useContext(GroupContext); // recursively checks whether to close or not. This mechanism has some similarities\n // with event bubbling.\n\n var shouldCloseWhenClickedOutside = useCallback(function shouldCloseWhenClickedOutside(event) {\n var target = event.target;\n var clickedOnTrigger = trigger.current && trigger.current.contains(target);\n var clickedOnLayer = layer.current && layer.current.contains(target);\n var shouldCloseAccordingToChildren = getShouldCloseAccordingToChildren(registrations.current, event); // when clicked on own layer, but the child would have closed ->\n // let child close\n\n if (clickedOnLayer && shouldCloseAccordingToChildren) {\n registrations.current.forEach(function (_ref3) {\n var closeChild = _ref3.closeChild;\n return closeChild();\n });\n }\n\n return !clickedOnTrigger && !clickedOnLayer && shouldCloseAccordingToChildren;\n }, [trigger, layer, registrations]); // registration stuff\n\n useEffect(function () {\n if (typeof possibleRegisterFn !== \"function\") {\n return;\n } // 'possibleRegisterFn' will return a function that will unregister\n // on cleanup\n\n\n return possibleRegisterFn({\n shouldCloseWhenClickedOutside: shouldCloseWhenClickedOutside,\n closeChild: function closeChild() {\n process.env.NODE_ENV !== \"production\" ? warning(onParentClose, \"react-laag: You are using useLayer() in a nested setting but forgot to set the 'onParentClose()' callback in the options. This could lead to unexpected behavior.\") : void 0;\n\n if (onParentClose) {\n onParentClose();\n }\n }\n });\n }, [possibleRegisterFn, shouldCloseWhenClickedOutside, onParentClose, registrations]); // document click handling\n\n useEffect(function () {\n var isChild = typeof possibleRegisterFn === \"function\";\n var shouldNotListen = !isOpen || !onOutsideClick || isChild;\n\n if (shouldNotListen) {\n return;\n }\n\n function handleClick(event) {\n if (shouldCloseWhenClickedOutside(event)) {\n onOutsideClick();\n }\n }\n\n document.addEventListener(\"click\", handleClick, true);\n return function () {\n return document.removeEventListener(\"click\", handleClick, true);\n };\n }, [isOpen, onOutsideClick, shouldCloseWhenClickedOutside, possibleRegisterFn]); // When this 'useLayer' gets closed -> tell child layers to close as well\n\n useEffect(function () {\n if (!isOpen) {\n registrations.current.forEach(function (_ref4) {\n var closeChild = _ref4.closeChild;\n return closeChild();\n });\n }\n }, [isOpen]);\n return {\n closeOnOutsideClickRefs: {\n trigger: trigger,\n layer: layer\n },\n registrations: registrations\n };\n}\n\nvar PLACEMENT_TYPES = [\"bottom-start\", \"bottom-end\", \"bottom-center\", \"top-start\", \"top-center\", \"top-end\", \"left-end\", \"left-center\", \"left-start\", \"right-end\", \"right-center\", \"right-start\", \"center\"];\n\nvar OPPOSITES = {\n top: \"bottom\",\n left: \"right\",\n bottom: \"top\",\n right: \"left\",\n center: \"center\"\n};\n\nvar SideBase = /*#__PURE__*/function () {\n function SideBase(prop, opposite, isHorizontal, sizeProp, oppositeSizeProp, cssProp, oppositeCssProp, isCenter, isPush // left | top\n ) {\n this.prop = void 0;\n this.opposite = void 0;\n this.isHorizontal = void 0;\n this.sizeProp = void 0;\n this.oppositeSizeProp = void 0;\n this.cssProp = void 0;\n this.oppositeCssProp = void 0;\n this.isCenter = void 0;\n this.isPush = void 0;\n this.prop = prop;\n this.opposite = opposite;\n this.isHorizontal = isHorizontal;\n this.sizeProp = sizeProp;\n this.oppositeSizeProp = oppositeSizeProp;\n this.cssProp = cssProp;\n this.oppositeCssProp = oppositeCssProp;\n this.isCenter = isCenter;\n this.isPush = isPush;\n }\n\n var _proto = SideBase.prototype;\n\n _proto.factor = function factor(value) {\n return value * (this.isPush ? 1 : -1);\n };\n\n _proto.isOppositeDirection = function isOppositeDirection(side) {\n return this.isHorizontal !== side.isHorizontal;\n };\n\n return SideBase;\n}();\n\nfunction createSide(prop, recursive) {\n if (recursive === void 0) {\n recursive = true;\n }\n\n var isHorizontal = [\"left\", \"right\"].includes(prop);\n return new SideBase(prop, recursive ? createSide(OPPOSITES[prop], false) : null, isHorizontal, isHorizontal ? \"width\" : \"height\", isHorizontal ? \"height\" : \"width\", isHorizontal ? \"left\" : \"top\", isHorizontal ? \"top\" : \"left\", prop === \"center\", ![\"right\", \"bottom\"].includes(prop));\n}\n\nvar BoundSide = {\n top: /*#__PURE__*/createSide(\"top\"),\n bottom: /*#__PURE__*/createSide(\"bottom\"),\n left: /*#__PURE__*/createSide(\"left\"),\n right: /*#__PURE__*/createSide(\"right\")\n};\nvar Side = /*#__PURE__*/_extends({}, BoundSide, {\n center: /*#__PURE__*/createSide(\"center\")\n});\n\nvar SIDES = [\"top\", \"left\", \"bottom\", \"right\"];\n/**\r\n * A class containing the positional properties which represent the distance\r\n * between two Bounds instances for each side\r\n */\n\nvar BoundsOffsets = /*#__PURE__*/function () {\n function BoundsOffsets(offsets) {\n this.top = void 0;\n this.left = void 0;\n this.right = void 0;\n this.bottom = void 0;\n return Object.assign(this, offsets);\n }\n /**\r\n * Takes multiple BoundsOffets instances and creates a new BoundsOffsets instance\r\n * by taking the smallest value for each side\r\n * @param boundsOffsets list of BoundsOffsets instances\r\n */\n\n\n BoundsOffsets.mergeSmallestSides = function mergeSmallestSides(boundsOffsets) {\n var first = boundsOffsets[0],\n rest = boundsOffsets.slice(1);\n\n if (!first) {\n throw new Error(\"Please provide at least 1 bounds objects in order to merge\");\n }\n\n var result = Object.fromEntries(SIDES.map(function (side) {\n return [side, first[side]];\n }));\n\n for (var _iterator = _createForOfIteratorHelperLoose(rest), _step; !(_step = _iterator()).done;) {\n var boundsOffset = _step.value;\n\n for (var _iterator2 = _createForOfIteratorHelperLoose(SIDES), _step2; !(_step2 = _iterator2()).done;) {\n var side = _step2.value;\n result[side] = Math.min(result[side], boundsOffset[side]);\n }\n }\n\n return new BoundsOffsets(result);\n }\n /**\r\n * Checks whether all sides sides are positive, meaning the corresponding Bounds instance\r\n * fits perfectly within a parent Bounds instance\r\n */\n ;\n\n _createClass(BoundsOffsets, [{\n key: \"allSidesArePositive\",\n get: function get() {\n var _this = this;\n\n return SIDES.every(function (side) {\n return _this[side] >= 0;\n });\n }\n /**\r\n * Returns a partial IBoundsOffsets with sides that are negative, meaning sides aren't entirely\r\n * visible in respect to a parent Bounds instance\r\n */\n\n }, {\n key: \"negativeSides\",\n get: function get() {\n var _this2 = this;\n\n return Object.fromEntries(SIDES.filter(function (side) {\n return _this2[side] < 0;\n }).map(function (side) {\n return [side, _this2[side]];\n }));\n }\n }]);\n\n return BoundsOffsets;\n}();\n\n/**\r\n * Utility function that returns sum of various computed styles\r\n * @param propertyValues list of computed styles (ie. '12px')\r\n */\n\nfunction sumOfPropertyValues() {\n for (var _len = arguments.length, propertyValues = new Array(_len), _key = 0; _key < _len; _key++) {\n propertyValues[_key] = arguments[_key];\n }\n\n return propertyValues.reduce(function (sum, propertyValue) {\n return sum + (propertyValue ? getPixelValue(propertyValue) : 0);\n }, 0);\n}\n\nfunction boundsToObject(_ref) {\n var top = _ref.top,\n left = _ref.left,\n right = _ref.right,\n bottom = _ref.bottom,\n width = _ref.width,\n height = _ref.height;\n return {\n top: top,\n left: left,\n right: right,\n bottom: bottom,\n width: width,\n height: height\n };\n}\nvar EMPTY = {\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n width: 0,\n height: 0\n};\n/**\r\n * A class containing the positional properties of the native DOM's ClientRect\r\n * (`element.getBoundingClientRect()`), together with some utility methods\r\n */\n\nvar Bounds = /*#__PURE__*/function () {\n /**\r\n * Creates a new Bounds class\r\n * @param bounds An object that adheres to the `IBounds` interface\r\n */\n Bounds.create = function create(bounds) {\n return new Bounds(bounds);\n }\n /**\r\n * Creates a new Bounds class from a DOM-element\r\n * @param element reference to the DOM-element\r\n * @param options optional options object\r\n */\n ;\n\n Bounds.fromElement = function fromElement(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$withTransfor = _options.withTransform,\n withTransform = _options$withTransfor === void 0 ? true : _options$withTransfor,\n _options$environment = _options.environment,\n environment = _options$environment === void 0 ? window : _options$environment,\n _options$withScrollba = _options.withScrollbars,\n withScrollbars = _options$withScrollba === void 0 ? true : _options$withScrollba;\n var plain = boundsToObject(element.getBoundingClientRect());\n var bounds = new Bounds(plain);\n\n if (!withTransform) {\n var _environment$getCompu = environment.getComputedStyle(element),\n width = _environment$getCompu.width,\n height = _environment$getCompu.height,\n boxSizing = _environment$getCompu.boxSizing,\n borderLeft = _environment$getCompu.borderLeft,\n borderRight = _environment$getCompu.borderRight,\n borderTop = _environment$getCompu.borderTop,\n borderBottom = _environment$getCompu.borderBottom,\n paddingLeft = _environment$getCompu.paddingLeft,\n paddingRight = _environment$getCompu.paddingRight,\n paddingTop = _environment$getCompu.paddingTop,\n paddingBottom = _environment$getCompu.paddingBottom;\n\n var boxWidth = boxSizing === \"border-box\" ? getPixelValue(width) : sumOfPropertyValues(width, borderLeft, borderRight, paddingLeft, paddingRight);\n var boxHeight = boxSizing === \"border-box\" ? getPixelValue(height) : sumOfPropertyValues(height, borderTop, borderBottom, paddingTop, paddingBottom);\n bounds = new Bounds(_extends({}, bounds, {\n width: boxWidth,\n height: boxHeight\n }));\n }\n\n if (!withScrollbars) {\n var scrollbarWidth = bounds.width - element.clientWidth;\n var scrollbarHeight = bounds.height - element.clientHeight;\n return bounds.substract({\n right: scrollbarWidth,\n bottom: scrollbarHeight\n });\n }\n\n return bounds;\n }\n /**\r\n * Creates an empty Bounds class\r\n */\n ;\n\n Bounds.empty = function empty() {\n return new Bounds();\n }\n /**\r\n * Creates a Bounds class from the window's dimensions\r\n * @param environment reference to the window-object (needed when working with iframes for instance). Defaults to `window`\r\n */\n ;\n\n Bounds.fromWindow = function fromWindow(environment) {\n var _ref2 = environment || {},\n _ref2$innerWidth = _ref2.innerWidth,\n width = _ref2$innerWidth === void 0 ? 0 : _ref2$innerWidth,\n _ref2$innerHeight = _ref2.innerHeight,\n height = _ref2$innerHeight === void 0 ? 0 : _ref2$innerHeight;\n\n return new Bounds({\n width: width,\n height: height,\n right: width,\n bottom: height\n });\n };\n\n function Bounds(bounds) {\n if (bounds === void 0) {\n bounds = {};\n }\n\n this.top = void 0;\n this.left = void 0;\n this.right = void 0;\n this.bottom = void 0;\n this.width = void 0;\n this.height = void 0;\n return Object.assign(this, EMPTY, bounds);\n }\n /**\r\n * Returns the square surface of the bounds in pixels\r\n */\n\n\n var _proto = Bounds.prototype;\n\n /**\r\n * Returns a plain object containing only positional properties\r\n */\n _proto.toObject = function toObject() {\n return boundsToObject(this);\n };\n\n _proto.merge = function merge(partialBoundsOrMergeFn) {\n var current = this.toObject();\n return new Bounds(_extends({}, current, typeof partialBoundsOrMergeFn === \"function\" ? partialBoundsOrMergeFn(current) : partialBoundsOrMergeFn));\n }\n /**\r\n * Return a new Bounds instance by subtracting each property of the provided IBounds object\r\n * @param bounds partial IBounds object to substract with\r\n */\n ;\n\n _proto.substract = function substract(bounds) {\n var result = this.toObject();\n var entries = Object.entries(bounds);\n\n for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {\n var _entries$_i = _entries[_i],\n prop = _entries$_i[0],\n value = _entries$_i[1];\n\n if (prop in BoundSide) {\n // if `prop` is one of 'top', 'left', 'bottom' or 'right'...\n var boundSide = BoundSide[prop]; // decide if we should add or substract\n\n result[prop] += boundSide.factor(value); // make sure that the size-properties are also updated\n\n result[boundSide.isHorizontal ? \"width\" : \"height\"] -= value;\n } else {\n // prop is 'width' or 'height'\n result[prop] -= value || 0;\n }\n }\n\n return new Bounds(result);\n }\n /**\r\n * Returns a new BoundsOffsets instance by determining the distance for each bound-side:\r\n * (child -> parent)\r\n * @param child child bounds instance\r\n */\n ;\n\n _proto.offsetsTo = function offsetsTo(child) {\n return new BoundsOffsets({\n top: child.top - this.top,\n bottom: this.bottom - child.bottom,\n left: child.left - this.left,\n right: this.right - child.right\n });\n }\n /**\r\n * Return a new Bounds instance by mapping over each bound-side\r\n * @param mapper callback that takes a boundSide + value in pixels, returning a new value for that side\r\n */\n ;\n\n _proto.mapSides = function mapSides(mapper) {\n var result = this.toObject();\n var boundSides = Object.values(BoundSide);\n\n for (var _i2 = 0, _boundSides = boundSides; _i2 < _boundSides.length; _i2++) {\n var boundSide = _boundSides[_i2];\n result[boundSide.prop] = mapper(boundSide, result[boundSide.prop]);\n }\n\n return new Bounds(result);\n };\n\n _createClass(Bounds, [{\n key: \"surface\",\n get: function get() {\n return this.width * this.height;\n }\n }]);\n\n return Bounds;\n}();\n\n/**\r\n * Class for various calculations based on a placement-type. I.e 'top-left';\r\n */\n\nvar Placement = /*#__PURE__*/function () {\n function Placement(primary, secondary, subjectBounds, layerDimensions, offsets) {\n this.primary = void 0;\n this.secondary = void 0;\n this.offsets = void 0;\n this.subjectsBounds = void 0;\n this._cachedLayerBounds = null;\n this._cachedContainerOffsets = null;\n this.primary = primary;\n this.secondary = secondary;\n this.offsets = offsets;\n this.setSubjectsBounds(subjectBounds, layerDimensions);\n }\n /**\r\n * Set subjectsBounds that are specific for this placement\r\n * @param subjectBounds original SubjectBounds instance\r\n * @param layerDimensions possible config prodvided by the user\r\n */\n\n\n var _proto = Placement.prototype;\n\n _proto.setSubjectsBounds = function setSubjectsBounds(subjectBounds, layerDimensions) {\n // if user did not provide any layerDimensions config...\n if (!layerDimensions) {\n this.subjectsBounds = subjectBounds;\n return;\n } // get anticipated layer-dimensions provided by the user\n\n\n var dimensions = // if the user passed a callback, call it with the layerSide corresponding to\n // the placement\n typeof layerDimensions === \"function\" ? layerDimensions(this.primary.prop) : layerDimensions; // create new SubjectsBounds instance by merging our newly create layer-bounds\n\n this.subjectsBounds = subjectBounds.merge({\n layer: _extends({}, subjectBounds.layer, dimensions)\n });\n }\n /**\r\n * Returns the string respresentation of this placement (ie. 'top-start')\r\n */\n ;\n\n /**\r\n * Calculates the actual boundaries based on the placement\r\n * @param secondaryOffset optional offset on the secondary-side\r\n */\n _proto.getLayerBounds = function getLayerBounds(secondaryOffset) {\n if (secondaryOffset === void 0) {\n secondaryOffset = 0;\n }\n\n // return cached version if possible\n if (this._cachedLayerBounds && secondaryOffset === 0) {\n return this._cachedLayerBounds;\n }\n\n var primary = this.primary,\n secondary = this.secondary,\n subjectsBounds = this.subjectsBounds;\n var trigger = subjectsBounds.trigger,\n layer = subjectsBounds.layer,\n arrow = subjectsBounds.arrow;\n var isHorizontal = primary.isHorizontal,\n oppositeCssProp = primary.oppositeCssProp,\n oppositeSizeProp = primary.oppositeSizeProp,\n prop = primary.prop,\n opposite = primary.opposite;\n var result = Bounds.empty(); // let's take the placement 'top-start' as an example...\n // the offsets are the following:\n // trigger -> 8px\n // container -> 10px;\n // arrow -> 2px;\n // PRIMARY STUFF\n // bottom = trigger.top + 8;\n\n result[opposite.prop] = trigger[prop] - primary.factor(this.offsets.trigger); // top = bottom - layer.height\n\n result[prop] = result[opposite.prop] - primary.factor(layer[primary.sizeProp]); // SECONDARY STUFF\n // arrowOffsetBase = 4\n\n var arrowOffsetBase = this.offsets.arrow * 2; // limitMin = trigger.left - (layer.width - arrow.width) + 4\n\n var limitMin = trigger[oppositeCssProp] - (layer[oppositeSizeProp] - arrow[oppositeSizeProp]) + arrowOffsetBase; // limitMax = trigger.left + (trigger.width - arrow.width) - 4\n\n var limitMax = trigger[oppositeCssProp] + (trigger[oppositeSizeProp] - arrow[oppositeSizeProp]) - arrowOffsetBase;\n\n if (!secondary.isPush) {\n // if secondary is bottom or right -> add the width or height of the layer\n limitMin += layer[oppositeSizeProp];\n limitMax += layer[oppositeSizeProp];\n }\n\n if (secondary.isCenter) {\n var propertyA = (isHorizontal ? BoundSide.top : BoundSide.left).prop;\n var propertyB = (isHorizontal ? BoundSide.bottom : BoundSide.right).prop; // left = limit(\n // trigger.left + trigger.width / 2 - layer.width / 2 + secondaryOffset,\n // limitMin,\n // limitMax\n // )\n\n result[propertyA] = limit(trigger[propertyA] + trigger[oppositeSizeProp] / 2 - layer[oppositeSizeProp] / 2 + secondaryOffset, limitMin, limitMax); // right = left + layer.width\n\n result[propertyB] = result[propertyA] + layer[oppositeSizeProp];\n } else {\n var sec = secondary;\n var triggerValue = trigger[sec.prop]; // Under some conditions, when the layer is not able to align with the trigger\n // due to arrow-size and arrow-offsets, we need to compensate.\n // Otherwise, the secondary-offset will have no impact\n\n var arrowCompensation = triggerValue < limitMin ? limitMin - triggerValue : triggerValue > limitMax ? limitMax - triggerValue : 0; // left = limit(\n // trigger.left + secondaryOffset + arrowCompensation,\n // limitMin,\n // limitMax\n // )\n\n result[sec.prop] = limit(triggerValue + secondaryOffset + arrowCompensation, limitMin, limitMax); // right = left + layer.width\n\n result[sec.opposite.prop] = result[sec.prop] + secondary.factor(layer[oppositeSizeProp]);\n } // set the correct dimensions\n\n\n result.width = result.right - result.left;\n result.height = result.bottom - result.top; // create new bounds object\n\n var layerBounds = Bounds.create(result);\n\n if (secondaryOffset === 0) {\n this._cachedLayerBounds = layerBounds;\n }\n\n return layerBounds;\n }\n /**\r\n * Checks whether the trigger is bigger on the opposite side\r\n * ie. placement \"top-start\" -> has trigger a bigger width?\r\n */\n ;\n\n /**\r\n * returns getLayerBounds(), including container-offsets\r\n */\n _proto.getLayerCollisionBounds = function getLayerCollisionBounds() {\n var container = this.offsets.container;\n return this.getLayerBounds().mapSides(function (side, value) {\n return value -= side.factor(container);\n }).merge(function (_ref) {\n var width = _ref.width,\n height = _ref.height;\n return {\n width: width + container * 2,\n height: height + container * 2\n };\n });\n }\n /**\r\n * Returns a BoundsOffsets instance containing merged offsets to containers with the most\r\n * negative scenario\r\n */\n ;\n\n _proto.getContainerOffsets = function getContainerOffsets(layerBounds) {\n if (this._cachedContainerOffsets && !layerBounds) {\n return this._cachedContainerOffsets;\n }\n\n var subjectBounds = this.subjectsBounds.merge({\n layer: layerBounds || this.getLayerCollisionBounds()\n });\n var offsets = BoundsOffsets.mergeSmallestSides(subjectBounds.layerOffsetsToScrollContainers);\n\n if (!layerBounds) {\n this._cachedContainerOffsets = offsets;\n }\n\n return offsets;\n };\n\n _createClass(Placement, [{\n key: \"type\",\n get: function get() {\n return this.primary.prop + \"-\" + (this.secondary.prop === \"center\" ? \"center\" : [\"bottom\", \"right\"].includes(this.secondary.prop) ? \"end\" : \"start\");\n }\n }, {\n key: \"triggerIsBigger\",\n get: function get() {\n var isHorizontal = this.secondary.isHorizontal;\n var _this$subjectsBounds = this.subjectsBounds,\n triggerHasBiggerWidth = _this$subjectsBounds.triggerHasBiggerWidth,\n triggerHasBiggerHeight = _this$subjectsBounds.triggerHasBiggerHeight;\n return isHorizontal && triggerHasBiggerWidth || !isHorizontal && triggerHasBiggerHeight;\n }\n /**\r\n * Checks whether the placement fits within all it's container (including container-offset)\r\n */\n\n }, {\n key: \"fitsContainer\",\n get: function get() {\n return this.getContainerOffsets().allSidesArePositive;\n }\n /**\r\n * Returns the surface in square pixels of the visible part of the layer\r\n */\n\n }, {\n key: \"visibleSurface\",\n get: function get() {\n var layerBounds = this.getLayerBounds();\n var containerOffsets = this.getContainerOffsets(layerBounds);\n var substract = containerOffsets.negativeSides;\n\n for (var side in substract) {\n // @ts-ignore\n substract[side] = -substract[side]; // make positive for substraction;\n }\n\n return layerBounds.substract(substract).surface;\n }\n /**\r\n * Returns a BoundSide by looking at the most negative offset that is the opposite direction\r\n */\n\n }, {\n key: \"secondaryOffsetSide\",\n get: function get() {\n var _Object$entries$map$f,\n _Object$entries$map$f2,\n _this = this;\n\n // Given placement 'top-start' and containerOffsets { left: -20, top: -10, right: -10, bottom: 200 }...\n // the only negative offsets on the opposite side are { left: -20, right: -10 }\n // since we have to return only 1 side, we pick the most negative, which is 'left'\n var containerOffsets = this.getContainerOffsets();\n\n var _ref2 = (_Object$entries$map$f = (_Object$entries$map$f2 = Object.entries(containerOffsets.negativeSides).map(function (_ref3) {\n var side = _ref3[0],\n value = _ref3[1];\n return [BoundSide[side], value];\n }).filter(function (_ref4) {\n var side = _ref4[0];\n return _this.primary.isOppositeDirection(side);\n }).sort(function (_ref5, _ref6) {\n var a = _ref5[1];\n var b = _ref6[1];\n return b - a;\n })) == null ? void 0 : _Object$entries$map$f2[0]) != null ? _Object$entries$map$f : [],\n mostNegativeSide = _ref2[0];\n\n return mostNegativeSide || null;\n }\n }]);\n\n return Placement;\n}();\nvar PlacementCenter = /*#__PURE__*/function (_Placement) {\n _inheritsLoose(PlacementCenter, _Placement);\n\n function PlacementCenter() {\n return _Placement.apply(this, arguments) || this;\n }\n\n var _proto2 = PlacementCenter.prototype;\n\n _proto2.getLayerBounds = function getLayerBounds() {\n var _this$subjectsBounds2 = this.subjectsBounds,\n trigger = _this$subjectsBounds2.trigger,\n layer = _this$subjectsBounds2.layer;\n var result = Bounds.empty();\n result.top = trigger.top + trigger.height / 2 - layer.height / 2;\n result.bottom = result.top + layer.height;\n result.left = trigger.left + trigger.width / 2 - layer.width / 2;\n result.right = result.left + layer.width;\n result.width = result.right - result.left;\n result.height = result.bottom - result.top;\n return result;\n };\n\n return PlacementCenter;\n}(Placement);\n\nfunction getNegativeOffsetBetweenLayerCenterAndTrigger(subjectsBounds, placement, arrowOffset) {\n var layer = subjectsBounds.layer,\n trigger = subjectsBounds.trigger,\n arrow = subjectsBounds.arrow;\n var sizeProperty = placement.primary.oppositeSizeProp;\n\n var _ref = !placement.primary.isHorizontal ? [\"left\", \"right\"] : [\"top\", \"bottom\"],\n sideA = _ref[0],\n sideB = _ref[1];\n\n var offsetA = layer[sideA] + layer[sizeProperty] / 2 - trigger[sideA] - arrow[sizeProperty] / 2 - arrowOffset;\n var offsetB = layer[sideB] - layer[sizeProperty] / 2 - trigger[sideB] + arrow[sizeProperty] / 2 + arrowOffset;\n return (offsetA < 0 ? -offsetA : 0) + (offsetB > 0 ? -offsetB : 0);\n}\n\nvar STYLE_BASE = {\n position: \"absolute\",\n willChange: \"top, left\",\n left: null,\n right: null,\n top: null,\n bottom: null\n};\nfunction getArrowStyle(subjectsBounds, placement, arrowOffset) {\n var _extends2;\n\n if (placement.primary.isCenter) {\n return STYLE_BASE;\n }\n\n var layer = subjectsBounds.layer,\n trigger = subjectsBounds.trigger,\n arrow = subjectsBounds.arrow;\n var sizeProperty = placement.primary.oppositeSizeProp;\n var triggerIsBigger = trigger[sizeProperty] > layer[sizeProperty];\n var min = arrowOffset + arrow[sizeProperty] / 2;\n var max = layer[sizeProperty] - arrow[sizeProperty] / 2 - arrowOffset;\n var negativeOffset = getNegativeOffsetBetweenLayerCenterAndTrigger(subjectsBounds, placement, arrowOffset);\n var primarySide = placement.primary.prop;\n var secondarySide = placement.primary.oppositeCssProp;\n var secondaryValue = triggerIsBigger ? layer[sizeProperty] / 2 + negativeOffset : trigger[secondarySide] + trigger[sizeProperty] / 2 - layer[secondarySide];\n return _extends({}, STYLE_BASE, (_extends2 = {}, _extends2[primarySide] = \"100%\", _extends2[secondarySide] = limit(secondaryValue, min, max), _extends2));\n}\n\n/**\r\n * Class mostly concerned about calculating and finding the right placement\r\n */\n\nvar Placements = /*#__PURE__*/function () {\n function Placements(placements, config, subjectsBounds) {\n this.placements = void 0;\n this.config = void 0;\n this.subjectsBounds = void 0;\n this.placements = placements;\n this.config = config;\n this.subjectsBounds = subjectsBounds;\n }\n /**\r\n * Converts a placement-type into a primary-side and a secondary-side\r\n */\n\n\n Placements.getSidesFromPlacementType = function getSidesFromPlacementType(type) {\n var _type$split = type.split(\"-\"),\n a = _type$split[0],\n b = _type$split[1];\n\n var primary = BoundSide[a];\n var secondary;\n\n if (b === \"center\") {\n secondary = Side.center;\n } else if (primary.isHorizontal) {\n secondary = b === \"start\" ? Side.top : Side.bottom;\n } else {\n secondary = b === \"start\" ? Side.left : Side.right;\n }\n\n return [primary, secondary];\n }\n /**\r\n * Main static method to create a Placements instance\r\n * @param subjectsBounds instance of the SubjectsBounds class\r\n * @param config config provided by the user\r\n */\n ;\n\n Placements.create = function create(subjectsBounds, config) {\n // create offsets-object from user config\n var offsets = {\n arrow: config.arrowOffset,\n container: config.containerOffset,\n trigger: config.triggerOffset\n }; // function which creates a prioritized list of possible placments\n // by looking at user-config\n\n function getListOfPlacements(preferedPlacement) {\n if (preferedPlacement === void 0) {\n preferedPlacement = config.placement;\n }\n\n var _Placements$getSidesF = Placements.getSidesFromPlacementType(preferedPlacement),\n primary = _Placements$getSidesF[0],\n secondary = _Placements$getSidesF[1];\n\n var preferredSide = BoundSide[primary.isHorizontal ? config.preferY : config.preferX]; // some priorities may alter when the trigger is bigger\n\n var triggerIsBigger = !primary.isHorizontal && subjectsBounds.triggerHasBiggerWidth || primary.isHorizontal && subjectsBounds.triggerHasBiggerHeight; // utility function which constructs a placement by primary and secondary sides\n\n function placementFrom(primary, secondary) {\n return new Placement(primary, secondary, subjectsBounds, config.layerDimensions, offsets);\n } // creating the list\n\n\n var list = [];\n list[0] = placementFrom(primary, secondary);\n list[1] = placementFrom(primary, secondary.isCenter ? preferredSide : Side.center);\n list[2] = placementFrom(primary, Side[(secondary.opposite.isCenter ? preferredSide.opposite : secondary.opposite).prop]);\n list[3] = placementFrom(preferredSide, triggerIsBigger ? primary : Side[primary.opposite.prop]);\n list[4] = placementFrom(preferredSide, Side.center);\n list[5] = placementFrom(preferredSide, triggerIsBigger ? Side[primary.opposite.prop] : primary);\n list[6] = placementFrom(BoundSide[preferredSide.opposite.prop], triggerIsBigger ? primary : Side[primary.opposite.prop]);\n list[7] = placementFrom(BoundSide[preferredSide.opposite.prop], Side.center);\n list[8] = placementFrom(BoundSide[preferredSide.opposite.prop], triggerIsBigger ? Side[primary.opposite.prop] : primary);\n list[9] = placementFrom(BoundSide[primary.opposite.prop], secondary);\n list[10] = placementFrom(BoundSide[primary.opposite.prop], secondary.isCenter ? preferredSide : Side.center);\n list[11] = placementFrom(BoundSide[primary.opposite.prop], Side[(secondary.opposite.isCenter ? preferredSide.opposite : secondary.opposite).prop]); // only include placements that are part of 'possible-placements'\n\n list = list.filter(function (placement) {\n return placement.type === config.placement || config.possiblePlacements.includes(placement.type);\n });\n return list;\n } // treat placement 'center' a little bit different\n\n\n if (config.placement === \"center\") {\n return new Placements([new PlacementCenter(Side.center, Side.center, subjectsBounds, config.layerDimensions, offsets)].concat(getListOfPlacements(config.preferY + \"-\" + config.preferX)), config, subjectsBounds);\n }\n\n return new Placements(getListOfPlacements(), config, subjectsBounds);\n };\n\n var _proto = Placements.prototype;\n\n _proto.filterPlacementsBySide = function filterPlacementsBySide(side) {\n return this.placements.filter(function (placement) {\n return placement.primary === side;\n });\n };\n\n _proto.findFirstPlacementThatFits = function findFirstPlacementThatFits() {\n return this.placements.find(function (placement) {\n return placement.fitsContainer;\n });\n };\n\n _proto.placementWithBiggestVisibleSurface = function placementWithBiggestVisibleSurface() {\n var _this$placements$map$ = this.placements.map(function (placement) {\n return {\n placement: placement,\n surface: placement.visibleSurface\n };\n }) // sort -> biggest surface first\n . // sort -> biggest surface first\n sort(function (a, b) {\n return b.surface - a.surface;\n }),\n placementWithBiggestSurface = _this$placements$map$[0].placement;\n\n return placementWithBiggestSurface;\n };\n\n _proto.findSuitablePlacement = function findSuitablePlacement() {\n if (!this.config.auto) {\n return this.placements[0];\n }\n\n return this.findFirstPlacementThatFits() || this.placementWithBiggestVisibleSurface();\n }\n /**\r\n * secondary offset: the number of pixels between the edge of the\r\n * scroll-container and the current placement, on the side of the layer\r\n * that didn't fit.\r\n * Eventually this secondary offset gets added / subtracted from the\r\n * placement that does fit in order to move the layer closer to the\r\n * position of the placement that just would not fit.\r\n * This creates the effect that the layer is moving gradually from one\r\n * placement to the next as the users scrolls the page or scroll-container\r\n */\n ;\n\n _proto.getSecondaryOffset = function getSecondaryOffset(placement) {\n var _this$config = this.config,\n auto = _this$config.auto,\n snap = _this$config.snap; // return early when we're not interested...\n\n if (!auto || snap || placement instanceof PlacementCenter) {\n return 0;\n } // if current placement fits and is prefered placement...\n // return early\n\n\n var placementsOnSameSide = this.filterPlacementsBySide(placement.primary);\n var currentPlacementHasHighestPriority = placementsOnSameSide.indexOf(placement) === 0;\n\n if (currentPlacementHasHighestPriority && placement.fitsContainer) {\n return 0;\n }\n\n var firstPlacementThatDoesNotFit = placementsOnSameSide.find(function (placement) {\n return !placement.fitsContainer;\n });\n\n if (!firstPlacementThatDoesNotFit) {\n return 0;\n }\n\n var secondaryOffsetSide = firstPlacementThatDoesNotFit.secondaryOffsetSide;\n\n if (!secondaryOffsetSide) {\n return 0;\n }\n\n var containerOffsets = placement.getContainerOffsets(); // determine whether we should add or substract the secondary-offset\n\n var secondary = placement.secondary;\n var factor;\n\n if (placement.triggerIsBigger || firstPlacementThatDoesNotFit === placement) {\n factor = secondaryOffsetSide.isPush ? -1 : 1;\n } else {\n factor = secondary === Side.left || [Side.top, Side.center].includes(secondary) && secondaryOffsetSide.isPush ? -1 : 1;\n } // get number of pixels between placement that did not fit and current\n // placement\n\n\n var secondaryOffset = containerOffsets[secondaryOffsetSide.prop];\n return secondaryOffset * factor;\n };\n\n _proto.getStyles = function getStyles(layerBounds, placement, scrollOffsets, borderOffsets) {\n var layerStyleBase = {\n willChange: \"top, left, width, height\"\n };\n var arrow = getArrowStyle(this.subjectsBounds.merge({\n layer: layerBounds\n }), placement, this.config.arrowOffset);\n var layer = this.config.overflowContainer ? _extends({}, layerStyleBase, {\n position: \"fixed\",\n top: layerBounds.top,\n left: layerBounds.left\n }) : _extends({}, layerStyleBase, {\n position: \"absolute\",\n top: layerBounds.top - this.subjectsBounds.parent.top + scrollOffsets.top - borderOffsets.top,\n left: layerBounds.left - this.subjectsBounds.parent.left + scrollOffsets.left - borderOffsets.left\n });\n return {\n arrow: arrow,\n layer: layer\n };\n };\n\n _proto.getHasDisappeared = function getHasDisappeared(layerBounds) {\n var subject = this.config.overflowContainer ? this.subjectsBounds.trigger : layerBounds;\n var containerOffsets = BoundsOffsets.mergeSmallestSides(this.subjectsBounds.offsetsToScrollContainers(subject, true));\n var entries = Object.entries(containerOffsets.negativeSides);\n var hasFullyDisappeared = entries.some(function (_ref) {\n var prop = _ref[0],\n value = _ref[1];\n var side = BoundSide[prop];\n return value <= -subject[side.sizeProp];\n });\n\n if (hasFullyDisappeared) {\n return \"full\";\n }\n\n if (!containerOffsets.allSidesArePositive) {\n return \"partial\";\n }\n\n return null;\n };\n\n _proto.result = function result(scrollOffsets, borderOffsets) {\n var suitablePlacement = this.findSuitablePlacement();\n var secondaryOffset = this.getSecondaryOffset(suitablePlacement);\n var layerBounds = suitablePlacement.getLayerBounds(secondaryOffset);\n var styles = this.getStyles(layerBounds, suitablePlacement, scrollOffsets, borderOffsets);\n var layerSide = suitablePlacement.primary.prop;\n return {\n styles: styles,\n layerSide: layerSide,\n placement: suitablePlacement,\n layerBounds: layerBounds,\n hasDisappeared: this.getHasDisappeared(layerBounds)\n };\n };\n\n return Placements;\n}();\n\nvar SubjectsBounds = /*#__PURE__*/function () {\n function SubjectsBounds(subjectsBounds, overflowContainer) {\n this.overflowContainer = void 0;\n this.trigger = void 0;\n this.layer = void 0;\n this.arrow = void 0;\n this.parent = void 0;\n this.window = void 0;\n this.scrollContainers = void 0;\n this.overflowContainer = overflowContainer;\n Object.assign(this, subjectsBounds);\n }\n\n SubjectsBounds.create = function create(environment, layer, trigger, parent, arrow, scrollContainers, overflowContainer, getTriggerBounds) {\n var window = Bounds.fromWindow(environment);\n return new SubjectsBounds({\n layer: Bounds.fromElement(layer, {\n environment: environment,\n withTransform: false\n }),\n trigger: getTriggerBounds ? Bounds.create(boundsToObject(getTriggerBounds())) : Bounds.fromElement(trigger),\n arrow: arrow ? Bounds.fromElement(arrow) : Bounds.empty(),\n parent: parent ? Bounds.fromElement(parent) : window,\n window: window,\n scrollContainers: [window].concat(scrollContainers.map(function (container) {\n return Bounds.fromElement(container, {\n withScrollbars: false\n });\n }))\n }, overflowContainer);\n };\n\n var _proto = SubjectsBounds.prototype;\n\n _proto.merge = function merge(subjectsBounds) {\n return new SubjectsBounds(_extends({}, this, subjectsBounds), this.overflowContainer);\n };\n\n _proto.offsetsToScrollContainers = function offsetsToScrollContainers(subject, allContainers) {\n if (allContainers === void 0) {\n allContainers = false;\n }\n\n var scrollContainers = this.overflowContainer && !allContainers ? [this.window] : this.scrollContainers;\n return scrollContainers.map(function (scrollContainer) {\n return scrollContainer.offsetsTo(subject);\n });\n };\n\n _createClass(SubjectsBounds, [{\n key: \"layerOffsetsToScrollContainers\",\n get: function get() {\n return this.offsetsToScrollContainers(this.layer);\n }\n }, {\n key: \"triggerHasBiggerWidth\",\n get: function get() {\n return this.trigger.width > this.layer.width;\n }\n }, {\n key: \"triggerHasBiggerHeight\",\n get: function get() {\n return this.trigger.height > this.layer.height;\n }\n }]);\n\n return SubjectsBounds;\n}();\n\nvar GLOBAL_CONTAINER = null;\nfunction setGlobalContainer(container) {\n if (typeof document === \"undefined\") {\n return;\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(!(GLOBAL_CONTAINER instanceof HTMLElement), \"react-laag: You've called 'setGlobalContainer() previously'. It is recommended to only set the global container once, otherwise this may lead to unexpected behaviour.\") : void 0;\n\n if (typeof container === \"function\") {\n GLOBAL_CONTAINER = container();\n } else if (typeof container === \"string\") {\n GLOBAL_CONTAINER = document.getElementById(container);\n } else {\n GLOBAL_CONTAINER = container;\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(GLOBAL_CONTAINER instanceof HTMLElement, \"react-laag: You've called 'setGlobalContainer()', but it didn't result in a valid html-element\") : void 0;\n}\nvar DEFAULT_OPTIONS = {\n auto: false,\n arrowOffset: 0,\n containerOffset: 10,\n triggerOffset: 0,\n overflowContainer: true,\n placement: \"top-center\",\n possiblePlacements: PLACEMENT_TYPES,\n preferX: \"right\",\n preferY: \"bottom\",\n snap: false,\n container: undefined,\n trigger: undefined\n};\nfunction useLayer(_ref) {\n var _triggerBoundsRef$cur;\n\n var _ref$isOpen = _ref.isOpen,\n isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,\n _ref$overflowContaine = _ref.overflowContainer,\n overflowContainer = _ref$overflowContaine === void 0 ? DEFAULT_OPTIONS.overflowContainer : _ref$overflowContaine,\n _ref$environment = _ref.environment,\n environment = _ref$environment === void 0 ? typeof window !== \"undefined\" ? window : undefined : _ref$environment,\n ResizeObserverPolyfill = _ref.ResizeObserver,\n _ref$placement = _ref.placement,\n placement = _ref$placement === void 0 ? DEFAULT_OPTIONS.placement : _ref$placement,\n _ref$possiblePlacemen = _ref.possiblePlacements,\n possiblePlacements = _ref$possiblePlacemen === void 0 ? DEFAULT_OPTIONS.possiblePlacements : _ref$possiblePlacemen,\n _ref$preferX = _ref.preferX,\n preferX = _ref$preferX === void 0 ? DEFAULT_OPTIONS.preferX : _ref$preferX,\n _ref$preferY = _ref.preferY,\n preferY = _ref$preferY === void 0 ? DEFAULT_OPTIONS.preferY : _ref$preferY,\n _ref$auto = _ref.auto,\n auto = _ref$auto === void 0 ? DEFAULT_OPTIONS.auto : _ref$auto,\n _ref$snap = _ref.snap,\n snap = _ref$snap === void 0 ? DEFAULT_OPTIONS.snap : _ref$snap,\n _ref$triggerOffset = _ref.triggerOffset,\n triggerOffset = _ref$triggerOffset === void 0 ? DEFAULT_OPTIONS.triggerOffset : _ref$triggerOffset,\n _ref$containerOffset = _ref.containerOffset,\n containerOffset = _ref$containerOffset === void 0 ? DEFAULT_OPTIONS.containerOffset : _ref$containerOffset,\n _ref$arrowOffset = _ref.arrowOffset,\n arrowOffset = _ref$arrowOffset === void 0 ? DEFAULT_OPTIONS.arrowOffset : _ref$arrowOffset,\n _ref$container = _ref.container,\n container = _ref$container === void 0 ? DEFAULT_OPTIONS.container : _ref$container,\n _ref$layerDimensions = _ref.layerDimensions,\n layerDimensions = _ref$layerDimensions === void 0 ? null : _ref$layerDimensions,\n onDisappear = _ref.onDisappear,\n onOutsideClick = _ref.onOutsideClick,\n onParentClose = _ref.onParentClose,\n triggerOption = _ref.trigger;\n\n // initialize styles\n var _useState = useState(function () {\n return {\n layerSide: placement === \"center\" ? \"center\" : Placements.getSidesFromPlacementType(placement)[0].prop,\n styles: {\n layer: {\n position: overflowContainer ? \"fixed\" : \"absolute\",\n top: 0,\n left: 0\n },\n arrow: {\n position: \"absolute\",\n top: 0,\n left: 0\n }\n }\n };\n }),\n state = _useState[0],\n setState = _useState[1];\n\n var triggerBoundsRef = useRef(null); // tracks state in order for us to use read inside functions that require dependencies,\n // like `useCallback`, without triggering an update\n\n var lastState = useLastState(state, isOpen); // keeps track of scheduled animation-frames\n\n var raf = useRef(null);\n useEffect(function () {\n return function () {\n // when this hook unmounts, make sure to cancel any scheduled animation-frames\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n raf.current = null;\n }\n };\n }, []); // Most important function regarding positioning\n // It receives boundaries collected by `useTrackElements`, does some calculations,\n // sets new styles, and handles when a layer has disappeared.\n\n var handlePositioning = useCallback(function handlePositioning(_ref2, scrollOffsets, borderOffsets) {\n var arrow = _ref2.arrow,\n layer = _ref2.layer,\n scrollContainers = _ref2.scrollContainers,\n trigger = _ref2.trigger;\n var parent = scrollContainers[0];\n var subjectsBounds = SubjectsBounds.create(environment, layer, trigger, parent, arrow, scrollContainers, overflowContainer, triggerOption == null ? void 0 : triggerOption.getBounds);\n var config = {\n placement: placement,\n possiblePlacements: possiblePlacements,\n auto: auto,\n layerDimensions: layerDimensions,\n arrowOffset: arrowOffset,\n containerOffset: containerOffset,\n triggerOffset: triggerOffset,\n preferX: preferX,\n preferY: preferY,\n snap: snap,\n overflowContainer: overflowContainer\n };\n\n var _Placements$create$re = Placements.create(subjectsBounds, config).result(scrollOffsets, borderOffsets),\n hasDisappeared = _Placements$create$re.hasDisappeared,\n layerSide = _Placements$create$re.layerSide,\n styles = _Placements$create$re.styles;\n\n var newState = {\n layerSide: layerSide,\n styles: styles\n };\n\n if (!lastState.current || didStateChange(lastState.current, newState)) {\n lastState.current = newState; // optimistically update lastState to prevent infinite loop\n\n /**\r\n * We're using requestAnimationFrame-features here to ensure that position updates will\r\n * happen max once per frame.\r\n * If during a frame there's already an update scheduled, the existing update will be cancelled\r\n * and the new update will take precedence.\r\n */\n\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n }\n\n raf.current = requestAnimationFrame(function () {\n setState(newState);\n raf.current = null;\n });\n }\n\n if (isSet(hasDisappeared) && isSet(onDisappear)) {\n onDisappear(hasDisappeared);\n }\n }, [arrowOffset, auto, containerOffset, environment, layerDimensions, onDisappear, overflowContainer, placement, possiblePlacements, preferX, preferY, snap, triggerOffset, lastState, triggerOption]);\n\n var _useTrackElements = useTrackElements({\n ResizeObserverPolyfill: ResizeObserverPolyfill,\n environment: environment,\n enabled: isOpen,\n overflowContainer: overflowContainer,\n onChange: handlePositioning,\n triggerOption: triggerOption\n }),\n triggerRef = _useTrackElements.triggerRef,\n layerRef = _useTrackElements.layerRef,\n arrowRef = _useTrackElements.arrowRef,\n closestScrollContainer = _useTrackElements.closestScrollContainer;\n\n var _useGroup = useGroup({\n isOpen: isOpen,\n onOutsideClick: onOutsideClick,\n onParentClose: onParentClose\n }),\n closeOnOutsideClickRefs = _useGroup.closeOnOutsideClickRefs,\n registrations = _useGroup.registrations;\n\n var props = {\n triggerProps: Boolean(triggerOption) ? {} // when using the `trigger` option, make `triggerProps` useless\n : {\n ref: mergeRefs(triggerRef, closeOnOutsideClickRefs.trigger, triggerBoundsRef)\n },\n layerProps: {\n ref: mergeRefs(layerRef, closeOnOutsideClickRefs.layer),\n style: state.styles.layer\n },\n arrowProps: {\n ref: arrowRef,\n style: state.styles.arrow,\n layerSide: state.layerSide\n },\n layerSide: state.layerSide,\n triggerBounds: isOpen ? triggerOption ? triggerOption.getBounds() : (_triggerBoundsRef$cur = triggerBoundsRef.current) == null ? void 0 : _triggerBoundsRef$cur.getBoundingClientRect() : null,\n renderLayer: function renderLayer(children) {\n return typeof document !== \"undefined\" ? createPortal(createElement(GroupProvider, {\n registrations: registrations,\n children: children\n }), overflowContainer || !closestScrollContainer ? getContainerElement(container) : closestScrollContainer) : null;\n }\n };\n return props;\n}\n\nfunction didStateChange(previous, next) {\n if (previous.layerSide !== next.layerSide) {\n return true;\n }\n\n var styleProps = [\"position\", \"top\", \"left\", \"right\", \"bottom\"];\n\n for (var _i = 0, _styleProps = styleProps; _i < _styleProps.length; _i++) {\n var prop = _styleProps[_i];\n\n if (previous.styles.layer[prop] !== next.styles.layer[prop] || previous.styles.arrow[prop] !== next.styles.arrow[prop]) {\n return true;\n }\n }\n\n return false;\n}\n\nvar DEFAULT_CONTAINER_ID = \"layers\";\n\nfunction getContainerElement(container) {\n var element;\n\n if (typeof container === \"function\") {\n element = container();\n\n if (!element || !(element instanceof HTMLElement)) {\n throw new Error(\"react-laag: You've passed a function to the 'container' prop, but it returned no valid HTMLElement\");\n }\n } else if (container instanceof HTMLElement) {\n element = container;\n } else if (typeof container === \"string\") {\n element = document.getElementById(container);\n\n if (!element) {\n throw new Error(\"react-laag: You've passed element with id '\" + container + \"' to the 'container' prop, but it returned no valid HTMLElement\");\n }\n } else if (GLOBAL_CONTAINER instanceof HTMLElement) {\n return GLOBAL_CONTAINER;\n } else {\n element = document.getElementById(DEFAULT_CONTAINER_ID);\n\n if (!element) {\n element = document.createElement(\"div\");\n element.id = DEFAULT_CONTAINER_ID;\n element.style.cssText = \"\\n position: absolute;\\n top: 0px;\\n left: 0px;\\n right: 0px;\\n \";\n document.body.appendChild(element);\n }\n }\n\n return element;\n}\n\nvar _excluded = [\"size\", \"angle\", \"borderWidth\", \"borderColor\", \"roundness\", \"backgroundColor\", \"layerSide\", \"style\"];\nvar LEFT = \"left\";\nvar TOP = \"top\";\nvar BOTTOM = \"bottom\";\nvar RIGHT = \"right\";\n\nfunction getWidthBasedOnAngle(angle, size) {\n return Math.tan(angle * (Math.PI / 180)) * size;\n}\n\nfunction getViewBox(sizeA, sizeB, side, borderWidth) {\n var _map;\n\n var map = (_map = {}, _map[BOTTOM] = \"0 \" + -borderWidth + \" \" + sizeB + \" \" + sizeA, _map[TOP] = \"0 0 \" + sizeB + \" \" + (sizeA + borderWidth), _map[RIGHT] = -borderWidth + \" 0 \" + sizeA + \" \" + sizeB, _map[LEFT] = \"0 0 \" + (sizeA + borderWidth) + \" \" + sizeB, _map);\n return map[side.prop];\n}\n\nfunction getTrianglePath(sizeA, sizeB, side, roundness, angle) {\n var _BOTTOM$TOP$RIGHT$LEF, _BOTTOM$TOP$RIGHT$LEF2, _BOTTOM$TOP$RIGHT$LEF3;\n\n var relativeRoundness = roundness / 10 * sizeA * 2;\n var A = (_BOTTOM$TOP$RIGHT$LEF = {}, _BOTTOM$TOP$RIGHT$LEF[BOTTOM] = [0, sizeA], _BOTTOM$TOP$RIGHT$LEF[TOP] = [0, 0], _BOTTOM$TOP$RIGHT$LEF[RIGHT] = [sizeA, sizeB], _BOTTOM$TOP$RIGHT$LEF[LEFT] = [0, sizeB], _BOTTOM$TOP$RIGHT$LEF)[side.prop].join(\" \");\n var B = side.isHorizontal ? \"V 0\" : \"H \" + sizeB;\n var cPoint = sizeB / 2;\n var c1A = sizeB / 2 + getWidthBasedOnAngle(angle, sizeA / 8);\n var c1B = sizeA / 8;\n var C = (_BOTTOM$TOP$RIGHT$LEF2 = {}, _BOTTOM$TOP$RIGHT$LEF2[BOTTOM] = [\"C\", c1A, c1B, cPoint + relativeRoundness, 0, cPoint, 0], _BOTTOM$TOP$RIGHT$LEF2[TOP] = [\"C\", c1A, sizeA - c1B, cPoint + relativeRoundness, sizeA, cPoint, sizeA], _BOTTOM$TOP$RIGHT$LEF2[RIGHT] = [\"C\", c1B, sizeB - c1A, 0, cPoint - relativeRoundness, 0, cPoint], _BOTTOM$TOP$RIGHT$LEF2[LEFT] = [\"C\", sizeA - c1B, sizeB - c1A, sizeA, cPoint - relativeRoundness, sizeA, cPoint], _BOTTOM$TOP$RIGHT$LEF2)[side.prop].join(\" \");\n var d1A = sizeB / 2 - getWidthBasedOnAngle(angle, sizeA / 8);\n var d1B = sizeA / 8;\n var D = (_BOTTOM$TOP$RIGHT$LEF3 = {}, _BOTTOM$TOP$RIGHT$LEF3[BOTTOM] = [\"C\", cPoint - relativeRoundness, 0, d1A, d1B, A], _BOTTOM$TOP$RIGHT$LEF3[TOP] = [\"C\", cPoint - relativeRoundness, sizeA, d1A, sizeA - d1B, A], _BOTTOM$TOP$RIGHT$LEF3[RIGHT] = [\"C\", 0, cPoint + relativeRoundness, d1B, sizeB - d1A, A], _BOTTOM$TOP$RIGHT$LEF3[LEFT] = [\"C\", sizeA, cPoint + relativeRoundness, sizeA - d1B, sizeB - d1A, A], _BOTTOM$TOP$RIGHT$LEF3)[side.prop].join(\" \");\n return [\"M\", A, B, C, D].join(\" \");\n}\n\nfunction getBorderMaskPath(sizeA, sizeB, borderWidth, side, angle) {\n var borderOffset = getWidthBasedOnAngle(angle, borderWidth);\n\n var _ref = !side.isPush ? [sizeA, sizeA - borderWidth] : [0, borderWidth],\n A = _ref[0],\n B = _ref[1];\n\n if (side.isHorizontal) {\n return [\"M\", A, borderWidth, \"V\", sizeB - borderWidth, \"L\", B, sizeB - borderWidth - borderOffset, \"V\", borderOffset + borderWidth, \"Z\"].join(\" \");\n }\n\n return [\"M\", borderWidth, A, \"H\", sizeB - borderWidth, \"L\", sizeB - borderWidth - borderOffset, B, \"H\", borderOffset + borderWidth, \"Z\"].join(\" \");\n}\n\nvar Arrow = /*#__PURE__*/forwardRef(function Arrow(_ref2, ref) {\n var _ref2$size = _ref2.size,\n size = _ref2$size === void 0 ? 8 : _ref2$size,\n _ref2$angle = _ref2.angle,\n angle = _ref2$angle === void 0 ? 45 : _ref2$angle,\n _ref2$borderWidth = _ref2.borderWidth,\n borderWidth = _ref2$borderWidth === void 0 ? 0 : _ref2$borderWidth,\n _ref2$borderColor = _ref2.borderColor,\n borderColor = _ref2$borderColor === void 0 ? \"black\" : _ref2$borderColor,\n _ref2$roundness = _ref2.roundness,\n roundness = _ref2$roundness === void 0 ? 0 : _ref2$roundness,\n _ref2$backgroundColor = _ref2.backgroundColor,\n backgroundColor = _ref2$backgroundColor === void 0 ? \"white\" : _ref2$backgroundColor,\n _ref2$layerSide = _ref2.layerSide,\n layerSide = _ref2$layerSide === void 0 ? \"top\" : _ref2$layerSide,\n _ref2$style = _ref2.style,\n style = _ref2$style === void 0 ? {} : _ref2$style,\n rest = _objectWithoutPropertiesLoose(_ref2, _excluded);\n\n if (layerSide === \"center\") {\n return null;\n }\n\n var side = BoundSide[layerSide];\n var sizeA = size;\n var sizeB = getWidthBasedOnAngle(angle, size) * 2;\n var maxSize = Math.max(sizeA, sizeB);\n return createElement(\"svg\", _extends({\n ref: ref\n }, rest, {\n style: _extends({}, style, {\n transform: \"translate\" + (side.isHorizontal ? \"Y\" : \"X\") + \"(-50%)\"\n }),\n width: maxSize,\n height: maxSize,\n preserveAspectRatio: side.isPush ? \"xMinYMin\" : \"xMaxYMax\",\n viewBox: getViewBox(sizeA, sizeB, side, borderWidth)\n }), createElement(\"path\", {\n fill: backgroundColor,\n strokeWidth: borderWidth,\n stroke: borderColor,\n d: getTrianglePath(sizeA, sizeB, side, roundness, angle)\n }), createElement(\"path\", {\n fill: backgroundColor,\n d: getBorderMaskPath(sizeA, sizeB, borderWidth, side, angle)\n }));\n});\n\nvar Status;\n\n(function (Status) {\n Status[Status[\"ENTERING\"] = 0] = \"ENTERING\";\n Status[Status[\"LEAVING\"] = 1] = \"LEAVING\";\n Status[Status[\"IDLE\"] = 2] = \"IDLE\";\n})(Status || (Status = {}));\n\nfunction useHover(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$delayEnter = _ref.delayEnter,\n delayEnter = _ref$delayEnter === void 0 ? 0 : _ref$delayEnter,\n _ref$delayLeave = _ref.delayLeave,\n delayLeave = _ref$delayLeave === void 0 ? 0 : _ref$delayLeave,\n _ref$hideOnScroll = _ref.hideOnScroll,\n hideOnScroll = _ref$hideOnScroll === void 0 ? true : _ref$hideOnScroll;\n\n var _useState = useState(false),\n show = _useState[0],\n setShow = _useState[1];\n\n var timeout = useRef(null);\n var status = useRef(Status.IDLE);\n var hasTouchMoved = useRef(false);\n var removeTimeout = useCallback(function removeTimeout() {\n clearTimeout(timeout.current);\n timeout.current = null;\n status.current = Status.IDLE;\n }, []);\n\n function onMouseEnter() {\n // if was leaving, stop leaving\n if (status.current === Status.LEAVING && timeout.current) {\n removeTimeout();\n }\n\n if (show) {\n return;\n }\n\n status.current = Status.ENTERING;\n timeout.current = window.setTimeout(function () {\n setShow(true);\n timeout.current = null;\n status.current = Status.IDLE;\n }, delayEnter);\n }\n\n function onMouseLeave(_, immediate) {\n // if was waiting for entering,\n // clear timeout\n if (status.current === Status.ENTERING && timeout.current) {\n removeTimeout();\n }\n\n if (!show) {\n return;\n }\n\n if (immediate) {\n setShow(false);\n timeout.current = null;\n status.current = Status.IDLE;\n return;\n }\n\n status.current = Status.LEAVING;\n timeout.current = window.setTimeout(function () {\n setShow(false);\n timeout.current = null;\n status.current = Status.IDLE;\n }, delayLeave);\n } // make sure to clear timeout on unmount\n\n\n useEffect(function () {\n function onScroll() {\n if (show && hideOnScroll) {\n removeTimeout();\n setShow(false);\n }\n }\n\n function onTouchEnd() {\n if (show) {\n removeTimeout();\n setShow(false);\n }\n }\n\n window.addEventListener(\"scroll\", onScroll, true);\n window.addEventListener(\"touchend\", onTouchEnd, true);\n return function () {\n window.removeEventListener(\"scroll\", onScroll, true);\n window.removeEventListener(\"touchend\", onTouchEnd, true);\n\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n };\n }, [show, hideOnScroll, removeTimeout]);\n var hoverProps = {\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onTouchStart: function onTouchStart() {\n hasTouchMoved.current = false;\n },\n onTouchMove: function onTouchMove() {\n hasTouchMoved.current = true;\n },\n onTouchEnd: function onTouchEnd() {\n if (!hasTouchMoved.current && !show) {\n setShow(true);\n }\n\n hasTouchMoved.current = false;\n }\n };\n return [show, hoverProps, function () {\n return onMouseLeave(null, true);\n }];\n}\n\n/**\r\n * @deprecated\r\n * Note: this component is marked as deprecated and will be removed and a possible\r\n * future release\r\n */\n\nfunction Transition(_ref) {\n var isOpenExternal = _ref.isOpen,\n children = _ref.children;\n\n var _useState = useState({\n isOpenInternal: isOpenExternal,\n isLeaving: false\n }),\n state = _useState[0],\n setState = _useState[1];\n\n var didMount = useRef(false);\n useEffect(function () {\n if (isOpenExternal) {\n setState({\n isOpenInternal: true,\n isLeaving: false\n });\n } else if (didMount.current) {\n setState({\n isOpenInternal: false,\n isLeaving: true\n });\n }\n }, [isOpenExternal, setState]);\n useEffect(function () {\n process.env.NODE_ENV !== \"production\" ? warning(children, \"react-laag: You are using 'Transition'. Note that this component is marked as deprecated and will be removed at future releases\") : void 0;\n }, [children]);\n useEffect(function () {\n didMount.current = true;\n }, []);\n\n if (!isOpenExternal && !state.isOpenInternal && !state.isLeaving) {\n return null;\n }\n\n return children(state.isOpenInternal, function () {\n if (!state.isOpenInternal) {\n setState(function (s) {\n return _extends({}, s, {\n isLeaving: false\n });\n });\n }\n }, state.isLeaving);\n}\n\nexport { Arrow, DEFAULT_OPTIONS, PLACEMENT_TYPES, Transition, mergeRefs, setGlobalContainer, useHover, useLayer, useMousePositionAsTrigger };\n//# sourceMappingURL=react-laag.esm.js.map\n","import * as React from \"react\";\nimport { useState, useEffect, createContext, useContext } from \"react\";\nimport { useLayer } from \"react-laag\";\nimport clsx from \"clsx\";\n\ntype DropdownContextType = {\n open: boolean;\n setOpen: (_: boolean) => void;\n closeOnSelect: boolean;\n renderLayer: any;\n triggerProps: any;\n layerProps: any;\n};\n\nconst DropdownContext = createContext({\n open: false,\n setOpen: null,\n closeOnSelect: true,\n renderLayer: null,\n triggerProps: null,\n layerProps: null,\n});\n\nfunction Dropdown({\n children,\n closeOnSelect = true,\n onToggle = () => {},\n className = \"\",\n placementOpt = \"\",\n}: {\n children: any;\n closeOnSelect?: boolean;\n onToggle?: (_: boolean) => void;\n className?: string;\n placementOpt?: string;\n}) {\n const [open, setOpen] = useState(false);\n\n const { renderLayer, triggerProps, layerProps } = useLayer({\n isOpen: open,\n onOutsideClick: () => setOpen(false), // close the menu when the user clicks outside\n overflowContainer: true, // keep the menu positioned inside the container\n auto: true, // automatically find the best placement\n placement: placementOpt || \"bottom-start\", // we prefer to place the menu \"top-end\"\n possiblePlacements: [\"bottom-start\", \"bottom-end\", \"bottom-center\"],\n triggerOffset: 12, // keep some distance to the trigger\n containerOffset: 16, // give the menu some room to breath relative to the container\n arrowOffset: 16, // let the arrow have some room to breath also\n });\n\n useEffect(() => {\n onToggle(open);\n }, [open]);\n\n return (\n
\n \n {children}\n \n
\n );\n}\n\nfunction DropdownLabel({\n children,\n className = \"\",\n disabled = false,\n ...props\n}) {\n const { open, setOpen, triggerProps } = useContext(DropdownContext);\n const toggle = () => setOpen(!open);\n\n return (\n \n {children}\n \n );\n}\n\nfunction DropdownContent({ children, className = \"\" }) {\n const { open, setOpen, closeOnSelect, renderLayer, layerProps } = useContext(\n DropdownContext,\n );\n const isFn = typeof children === \"function\";\n\n return (\n <>\n {open &&\n renderLayer(\n closeOnSelect && setOpen(false)}\n className={clsx(\n \"bg-white border border-dark-25 shadow-lg rounded\",\n className,\n )}\n style={{\n // minWidth: triggerBounds.width,\n ...layerProps.style,\n }}\n >\n {isFn && children({ setOpen })}\n {!isFn && children}\n
,\n )}\n \n );\n}\n\nDropdown.Label = DropdownLabel;\nDropdown.Content = DropdownContent;\n\nexport default Dropdown;\n","import * as React from \"react\";\nimport clsx from \"clsx\";\nimport { FilterOption } from \"@/types\";\n\nconst _accessor = option => option.name;\n\nfunction SelectGroup({\n options,\n selectedOption,\n setSelectedOption,\n className = \"\",\n accessor = _accessor,\n onEditClick,\n}: {\n options: FilterOption[];\n selectedOption: FilterOption | null;\n setSelectedOption: (option: any) => void;\n className?: string;\n accessor?: Function;\n onEditClick?: Function;\n}) {\n return (\n
\n {options?.map(option => (\n
\n setSelectedOption(option)}\n >\n {accessor(option)}\n \n {onEditClick && option.id.toString() !== \"0\" && (\n onEditClick(option.id)}\n >\n \n \n )}\n
\n ))}\n
\n );\n}\n\nexport default SelectGroup;\n","import React from \"react\";\nimport clsx from \"clsx\";\nimport Dropdown from \"@/components/shared/Dropdown\";\nimport SelectGroup from \"@/components/shared/SelectGroup\";\n\nconst _accessor = option => option.name;\n\nfunction Select({\n selected,\n setSelected,\n options,\n placeholder = \"Select an option\",\n className = \"\",\n classNameContainer = \"\",\n classNameSelectGroup = \"\",\n accessor = _accessor,\n error = false,\n placement = \"\",\n ...props\n}) {\n const selectedOption = options?.find(\n option => String(option.id) === String(selected),\n );\n\n return (\n
\n \n \n \n {selectedOption ? accessor(selectedOption) : placeholder}\n \n \n \n \n setSelected(option.id)}\n accessor={accessor}\n className={classNameSelectGroup}\n />\n \n \n
\n );\n}\n\nexport default Select;\n","/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexport { isPlainObject };\n","function n(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;e3?t.i-4:t.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,t){return 2===o(n)?n.has(t):Object.prototype.hasOwnProperty.call(n,t)}function a(n,t){return 2===o(n)?n.get(t):n[t]}function f(n,t,r){var e=o(n);2===e?n.set(t,r):3===e?(n.delete(t),n.add(r)):n[t]=r}function c(n,t){return n===t?0!==n||1/n==1/t:n!=n&&t!=t}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var t=tn(n);delete t[Q];for(var r=nn(t),e=0;e1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,t){return d(t,!0)}),!0),n)}function h(){n(2)}function y(n){return null==n||\"object\"!=typeof n||Object.isFrozen(n)}function b(t){var r=rn[t];return r||n(18,t),r}function m(n,t){rn[n]||(rn[n]=t)}function _(){return\"production\"===process.env.NODE_ENV||U||n(0),U}function j(n,t){t&&(b(\"Patches\"),n.u=[],n.s=[],n.v=t)}function O(n){g(n),n.p.forEach(S),n.p=null}function g(n){n===U&&(U=n.l)}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var t=n[Q];0===t.i||1===t.i?t.j():t.O=!0}function P(t,e){e._=e.p.length;var i=e.p[0],o=void 0!==t&&t!==i;return e.h.g||b(\"ES5\").S(e,t,o),o?(i[Q].P&&(O(e),n(4)),r(t)&&(t=M(e,t),e.l||x(e,t)),e.u&&b(\"Patches\").M(i[Q],t,e.u,e.s)):t=M(e,i,[]),O(e),e.u&&e.v(e.u,e.s),t!==H?t:void 0}function M(n,t,r){if(y(t))return t;var e=t[Q];if(!e)return i(t,(function(i,o){return A(n,e,t,i,o,r)}),!0),t;if(e.A!==n)return t;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o;i(3===e.i?new Set(o):o,(function(t,i){return A(n,e,o,t,i,r)})),x(n,o,!1),r&&n.u&&b(\"Patches\").R(e,r,n.u,n.s)}return e.o}function A(e,i,o,a,c,s){if(\"production\"!==process.env.NODE_ENV&&c===o&&n(5),t(c)){var v=M(e,c,s&&i&&3!==i.i&&!u(i.D,a)?s.concat(a):void 0);if(f(o,a,v),!t(v))return;e.m=!1}if(r(c)&&!y(c)){if(!e.h.F&&e._<1)return;M(e,c),i&&i.A.l||x(e,c)}}function x(n,t,r){void 0===r&&(r=!1),n.h.F&&n.m&&d(t,r)}function z(n,t){var r=n[Q];return(r?p(r):n)[t]}function I(n,t){if(t in n)for(var r=Object.getPrototypeOf(n);r;){var e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=Object.getPrototypeOf(r)}}function k(n){n.P||(n.P=!0,n.l&&k(n.l))}function E(n){n.o||(n.o=l(n.t))}function R(n,t,r){var e=s(t)?b(\"MapSet\").N(t,r):v(t)?b(\"MapSet\").T(t,r):n.g?function(n,t){var r=Array.isArray(n),e={i:r?1:0,A:t?t.A:_(),P:!1,I:!1,D:{},l:t,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;r&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(t,r):b(\"ES5\").J(t,r);return(r?r.A:_()).p.push(e),e}function D(e){return t(e)||n(22,e),function n(t){if(!r(t))return t;var e,u=t[Q],c=o(t);if(u){if(!u.P&&(u.i<4||!b(\"ES5\").K(u)))return u.t;u.I=!0,e=F(t,c),u.I=!1}else e=F(t,c);return i(e,(function(t,r){u&&a(u.t,t)===r||f(e,t,n(r))})),3===c?new Set(e):e}(e)}function F(n,t){switch(t){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}function N(){function r(n,t){var r=s[n];return r?r.enumerable=t:s[n]=r={configurable:!0,enumerable:t,get:function(){var t=this[Q];return\"production\"!==process.env.NODE_ENV&&f(t),en.get(t,n)},set:function(t){var r=this[Q];\"production\"!==process.env.NODE_ENV&&f(r),en.set(r,n,t)}},r}function e(n){for(var t=n.length-1;t>=0;t--){var r=n[t][Q];if(!r.P)switch(r.i){case 5:a(r)&&k(r);break;case 4:o(r)&&k(r)}}}function o(n){for(var t=n.t,r=n.k,e=nn(r),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=t[o];if(void 0===a&&!u(t,o))return!0;var f=r[o],s=f&&f[Q];if(s?s.t!==a:!c(f,a))return!0}}var v=!!t[Q];return e.length!==nn(t).length+(v?0:1)}function a(n){var t=n.k;if(t.length!==n.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}function f(t){t.O&&n(3,JSON.stringify(p(t)))}var s={};m(\"ES5\",{J:function(n,t){var e=Array.isArray(n),i=function(n,t){if(n){for(var e=Array(t.length),i=0;i1?r-1:0),o=1;o1?r-1:0),o=1;o=0;e--){var i=r[e];if(0===i.path.length&&\"replace\"===i.op){n=i.value;break}}var o=b(\"Patches\").$;return t(n)?o(n,r):this.produce(n,(function(n){return o(n,r.slice(e+1))}))},e}(),an=new un,fn=an.produce,cn=an.produceWithPatches.bind(an),sn=an.setAutoFreeze.bind(an),vn=an.setUseProxies.bind(an),pn=an.applyPatches.bind(an),ln=an.createDraft.bind(an),dn=an.finishDraft.bind(an);export default fn;export{un as Immer,pn as applyPatches,K as castDraft,$ as castImmutable,ln as createDraft,D as current,J as enableAllPlugins,N as enableES5,C as enableMapSet,T as enablePatches,dn as finishDraft,d as freeze,L as immerable,t as isDraft,r as isDraftable,H as nothing,e as original,fn as produce,cn as produceWithPatches,sn as setAutoFreeze,vn as setUseProxies};\n//# sourceMappingURL=immer.esm.js.map\n","import { isPlainObject } from 'is-plain-object';\nimport { produce, createDraft, finishDraft, isDraft } from 'immer';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nvar DIRTY_PATHS = new WeakMap();\nvar DIRTY_PATH_KEYS = new WeakMap();\nvar FLUSHING = new WeakMap();\nvar NORMALIZING = new WeakMap();\nvar PATH_REFS = new WeakMap();\nvar POINT_REFS = new WeakMap();\nvar RANGE_REFS = new WeakMap();\n\nfunction ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n/**\r\n * Create a new Slate `Editor` object.\r\n */\n\nvar createEditor = () => {\n var editor = {\n children: [],\n operations: [],\n selection: null,\n marks: null,\n isInline: () => false,\n isVoid: () => false,\n markableVoid: () => false,\n onChange: () => {},\n apply: op => {\n for (var ref of Editor.pathRefs(editor)) {\n PathRef.transform(ref, op);\n }\n\n for (var _ref of Editor.pointRefs(editor)) {\n PointRef.transform(_ref, op);\n }\n\n for (var _ref2 of Editor.rangeRefs(editor)) {\n RangeRef.transform(_ref2, op);\n }\n\n var oldDirtyPaths = DIRTY_PATHS.get(editor) || [];\n var oldDirtyPathKeys = DIRTY_PATH_KEYS.get(editor) || new Set();\n var dirtyPaths;\n var dirtyPathKeys;\n\n var add = path => {\n if (path) {\n var key = path.join(',');\n\n if (!dirtyPathKeys.has(key)) {\n dirtyPathKeys.add(key);\n dirtyPaths.push(path);\n }\n }\n };\n\n if (Path.operationCanTransformPath(op)) {\n dirtyPaths = [];\n dirtyPathKeys = new Set();\n\n for (var path of oldDirtyPaths) {\n var newPath = Path.transform(path, op);\n add(newPath);\n }\n } else {\n dirtyPaths = oldDirtyPaths;\n dirtyPathKeys = oldDirtyPathKeys;\n }\n\n var newDirtyPaths = editor.getDirtyPaths(op);\n\n for (var _path of newDirtyPaths) {\n add(_path);\n }\n\n DIRTY_PATHS.set(editor, dirtyPaths);\n DIRTY_PATH_KEYS.set(editor, dirtyPathKeys);\n Transforms.transform(editor, op);\n editor.operations.push(op);\n Editor.normalize(editor, {\n operation: op\n }); // Clear any formats applied to the cursor if the selection changes.\n\n if (op.type === 'set_selection') {\n editor.marks = null;\n }\n\n if (!FLUSHING.get(editor)) {\n FLUSHING.set(editor, true);\n Promise.resolve().then(() => {\n FLUSHING.set(editor, false);\n editor.onChange({\n operation: op\n });\n editor.operations = [];\n });\n }\n },\n addMark: (key, value) => {\n var {\n selection,\n markableVoid\n } = editor;\n\n if (selection) {\n var match = (node, path) => {\n if (!Text.isText(node)) {\n return false; // marks can only be applied to text\n }\n\n var [parentNode, parentPath] = Editor.parent(editor, path);\n return !editor.isVoid(parentNode) || editor.markableVoid(parentNode);\n };\n\n var expandedSelection = Range.isExpanded(selection);\n var markAcceptingVoidSelected = false;\n\n if (!expandedSelection) {\n var [selectedNode, selectedPath] = Editor.node(editor, selection);\n\n if (selectedNode && match(selectedNode, selectedPath)) {\n var [parentNode] = Editor.parent(editor, selectedPath);\n markAcceptingVoidSelected = parentNode && editor.markableVoid(parentNode);\n }\n }\n\n if (expandedSelection || markAcceptingVoidSelected) {\n Transforms.setNodes(editor, {\n [key]: value\n }, {\n match,\n split: true,\n voids: true\n });\n } else {\n var marks = _objectSpread$9(_objectSpread$9({}, Editor.marks(editor) || {}), {}, {\n [key]: value\n });\n\n editor.marks = marks;\n\n if (!FLUSHING.get(editor)) {\n editor.onChange();\n }\n }\n }\n },\n deleteBackward: unit => {\n var {\n selection\n } = editor;\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.delete(editor, {\n unit,\n reverse: true\n });\n }\n },\n deleteForward: unit => {\n var {\n selection\n } = editor;\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.delete(editor, {\n unit\n });\n }\n },\n deleteFragment: direction => {\n var {\n selection\n } = editor;\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.delete(editor, {\n reverse: direction === 'backward'\n });\n }\n },\n getFragment: () => {\n var {\n selection\n } = editor;\n\n if (selection) {\n return Node.fragment(editor, selection);\n }\n\n return [];\n },\n insertBreak: () => {\n Transforms.splitNodes(editor, {\n always: true\n });\n },\n insertSoftBreak: () => {\n Transforms.splitNodes(editor, {\n always: true\n });\n },\n insertFragment: fragment => {\n Transforms.insertFragment(editor, fragment);\n },\n insertNode: node => {\n Transforms.insertNodes(editor, node);\n },\n insertText: text => {\n var {\n selection,\n marks\n } = editor;\n\n if (selection) {\n if (marks) {\n var node = _objectSpread$9({\n text\n }, marks);\n\n Transforms.insertNodes(editor, node);\n } else {\n Transforms.insertText(editor, text);\n }\n\n editor.marks = null;\n }\n },\n normalizeNode: entry => {\n var [node, path] = entry; // There are no core normalizations for text nodes.\n\n if (Text.isText(node)) {\n return;\n } // Ensure that block and inline nodes have at least one text child.\n\n\n if (Element.isElement(node) && node.children.length === 0) {\n var child = {\n text: ''\n };\n Transforms.insertNodes(editor, child, {\n at: path.concat(0),\n voids: true\n });\n return;\n } // Determine whether the node should have block or inline children.\n\n\n var shouldHaveInlines = Editor.isEditor(node) ? false : Element.isElement(node) && (editor.isInline(node) || node.children.length === 0 || Text.isText(node.children[0]) || editor.isInline(node.children[0])); // Since we'll be applying operations while iterating, keep track of an\n // index that accounts for any added/removed nodes.\n\n var n = 0;\n\n for (var i = 0; i < node.children.length; i++, n++) {\n var currentNode = Node.get(editor, path);\n if (Text.isText(currentNode)) continue;\n var _child = node.children[i];\n var prev = currentNode.children[n - 1];\n var isLast = i === node.children.length - 1;\n var isInlineOrText = Text.isText(_child) || Element.isElement(_child) && editor.isInline(_child); // Only allow block nodes in the top-level children and parent blocks\n // that only contain block nodes. Similarly, only allow inline nodes in\n // other inline nodes, or parent blocks that only contain inlines and\n // text.\n\n if (isInlineOrText !== shouldHaveInlines) {\n Transforms.removeNodes(editor, {\n at: path.concat(n),\n voids: true\n });\n n--;\n } else if (Element.isElement(_child)) {\n // Ensure that inline nodes are surrounded by text nodes.\n if (editor.isInline(_child)) {\n if (prev == null || !Text.isText(prev)) {\n var newChild = {\n text: ''\n };\n Transforms.insertNodes(editor, newChild, {\n at: path.concat(n),\n voids: true\n });\n n++;\n } else if (isLast) {\n var _newChild = {\n text: ''\n };\n Transforms.insertNodes(editor, _newChild, {\n at: path.concat(n + 1),\n voids: true\n });\n n++;\n }\n }\n } else {\n // Merge adjacent text nodes that are empty or match.\n if (prev != null && Text.isText(prev)) {\n if (Text.equals(_child, prev, {\n loose: true\n })) {\n Transforms.mergeNodes(editor, {\n at: path.concat(n),\n voids: true\n });\n n--;\n } else if (prev.text === '') {\n Transforms.removeNodes(editor, {\n at: path.concat(n - 1),\n voids: true\n });\n n--;\n } else if (_child.text === '') {\n Transforms.removeNodes(editor, {\n at: path.concat(n),\n voids: true\n });\n n--;\n }\n }\n }\n }\n },\n removeMark: key => {\n var {\n selection\n } = editor;\n\n if (selection) {\n var match = (node, path) => {\n if (!Text.isText(node)) {\n return false; // marks can only be applied to text\n }\n\n var [parentNode, parentPath] = Editor.parent(editor, path);\n return !editor.isVoid(parentNode) || editor.markableVoid(parentNode);\n };\n\n var expandedSelection = Range.isExpanded(selection);\n var markAcceptingVoidSelected = false;\n\n if (!expandedSelection) {\n var [selectedNode, selectedPath] = Editor.node(editor, selection);\n\n if (selectedNode && match(selectedNode, selectedPath)) {\n var [parentNode] = Editor.parent(editor, selectedPath);\n markAcceptingVoidSelected = parentNode && editor.markableVoid(parentNode);\n }\n }\n\n if (expandedSelection || markAcceptingVoidSelected) {\n Transforms.unsetNodes(editor, key, {\n match,\n split: true,\n voids: true\n });\n } else {\n var marks = _objectSpread$9({}, Editor.marks(editor) || {});\n\n delete marks[key];\n editor.marks = marks;\n\n if (!FLUSHING.get(editor)) {\n editor.onChange();\n }\n }\n }\n },\n\n /**\r\n * Get the \"dirty\" paths generated from an operation.\r\n */\n getDirtyPaths: op => {\n switch (op.type) {\n case 'insert_text':\n case 'remove_text':\n case 'set_node':\n {\n var {\n path\n } = op;\n return Path.levels(path);\n }\n\n case 'insert_node':\n {\n var {\n node,\n path: _path2\n } = op;\n var levels = Path.levels(_path2);\n var descendants = Text.isText(node) ? [] : Array.from(Node.nodes(node), _ref3 => {\n var [, p] = _ref3;\n return _path2.concat(p);\n });\n return [...levels, ...descendants];\n }\n\n case 'merge_node':\n {\n var {\n path: _path3\n } = op;\n var ancestors = Path.ancestors(_path3);\n var previousPath = Path.previous(_path3);\n return [...ancestors, previousPath];\n }\n\n case 'move_node':\n {\n var {\n path: _path4,\n newPath\n } = op;\n\n if (Path.equals(_path4, newPath)) {\n return [];\n }\n\n var oldAncestors = [];\n var newAncestors = [];\n\n for (var ancestor of Path.ancestors(_path4)) {\n var p = Path.transform(ancestor, op);\n oldAncestors.push(p);\n }\n\n for (var _ancestor of Path.ancestors(newPath)) {\n var _p = Path.transform(_ancestor, op);\n\n newAncestors.push(_p);\n }\n\n var newParent = newAncestors[newAncestors.length - 1];\n var newIndex = newPath[newPath.length - 1];\n var resultPath = newParent.concat(newIndex);\n return [...oldAncestors, ...newAncestors, resultPath];\n }\n\n case 'remove_node':\n {\n var {\n path: _path5\n } = op;\n\n var _ancestors = Path.ancestors(_path5);\n\n return [..._ancestors];\n }\n\n case 'split_node':\n {\n var {\n path: _path6\n } = op;\n\n var _levels = Path.levels(_path6);\n\n var nextPath = Path.next(_path6);\n return [..._levels, nextPath];\n }\n\n default:\n {\n return [];\n }\n }\n },\n shouldNormalize: _ref4 => {\n var {\n iteration,\n initialDirtyPathsLength\n } = _ref4;\n var maxIterations = initialDirtyPathsLength * 42; // HACK: better way?\n\n if (iteration > maxIterations) {\n throw new Error(\"Could not completely normalize the editor after \".concat(maxIterations, \" iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state.\"));\n }\n\n return true;\n }\n };\n return editor;\n};\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = _objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n// Character (grapheme cluster) boundaries are determined according to\n// the default grapheme cluster boundary specification, extended grapheme clusters variant[1].\n//\n// References:\n//\n// [1] https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table\n// [2] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt\n// [3] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.html\n// [4] https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt\n\n/**\r\n * Get the distance to the end of the first character in a string of text.\r\n */\nvar getCharacterDistance = function getCharacterDistance(str) {\n var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var isLTR = !isRTL;\n var codepoints = isRTL ? codepointsIteratorRTL(str) : str;\n var left = CodepointType.None;\n var right = CodepointType.None;\n var distance = 0; // Evaluation of these conditions are deferred.\n\n var gb11 = null; // Is GB11 applicable?\n\n var gb12Or13 = null; // Is GB12 or GB13 applicable?\n\n for (var char of codepoints) {\n var code = char.codePointAt(0);\n if (!code) break;\n var type = getCodepointType(char, code);\n [left, right] = isLTR ? [right, type] : [type, left];\n\n if (intersects(left, CodepointType.ZWJ) && intersects(right, CodepointType.ExtPict)) {\n if (isLTR) {\n gb11 = endsWithEmojiZWJ(str.substring(0, distance));\n } else {\n gb11 = endsWithEmojiZWJ(str.substring(0, str.length - distance));\n }\n\n if (!gb11) break;\n }\n\n if (intersects(left, CodepointType.RI) && intersects(right, CodepointType.RI)) {\n if (gb12Or13 !== null) {\n gb12Or13 = !gb12Or13;\n } else {\n if (isLTR) {\n gb12Or13 = true;\n } else {\n gb12Or13 = endsWithOddNumberOfRIs(str.substring(0, str.length - distance));\n }\n }\n\n if (!gb12Or13) break;\n }\n\n if (left !== CodepointType.None && right !== CodepointType.None && isBoundaryPair(left, right)) {\n break;\n }\n\n distance += char.length;\n }\n\n return distance || 1;\n};\nvar SPACE = /\\s/;\nvar PUNCTUATION = /[\\u0021-\\u0023\\u0025-\\u002A\\u002C-\\u002F\\u003A\\u003B\\u003F\\u0040\\u005B-\\u005D\\u005F\\u007B\\u007D\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]/;\nvar CHAMELEON = /['\\u2018\\u2019]/;\n/**\r\n * Get the distance to the end of the first word in a string of text.\r\n */\n\nvar getWordDistance = function getWordDistance(text) {\n var isRTL = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var dist = 0;\n var started = false;\n\n while (text.length > 0) {\n var charDist = getCharacterDistance(text, isRTL);\n var [char, remaining] = splitByCharacterDistance(text, charDist, isRTL);\n\n if (isWordCharacter(char, remaining, isRTL)) {\n started = true;\n dist += charDist;\n } else if (!started) {\n dist += charDist;\n } else {\n break;\n }\n\n text = remaining;\n }\n\n return dist;\n};\n/**\r\n * Split a string in two parts at a given distance starting from the end when\r\n * `isRTL` is set to `true`.\r\n */\n\nvar splitByCharacterDistance = (str, dist, isRTL) => {\n if (isRTL) {\n var at = str.length - dist;\n return [str.slice(at, str.length), str.slice(0, at)];\n }\n\n return [str.slice(0, dist), str.slice(dist)];\n};\n/**\r\n * Check if a character is a word character. The `remaining` argument is used\r\n * because sometimes you must read subsequent characters to truly determine it.\r\n */\n\nvar isWordCharacter = function isWordCharacter(char, remaining) {\n var isRTL = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (SPACE.test(char)) {\n return false;\n } // Chameleons count as word characters as long as they're in a word, so\n // recurse to see if the next one is a word character or not.\n\n\n if (CHAMELEON.test(char)) {\n var charDist = getCharacterDistance(remaining, isRTL);\n var [nextChar, nextRemaining] = splitByCharacterDistance(remaining, charDist, isRTL);\n\n if (isWordCharacter(nextChar, nextRemaining, isRTL)) {\n return true;\n }\n }\n\n if (PUNCTUATION.test(char)) {\n return false;\n }\n\n return true;\n};\n/**\r\n * Iterate on codepoints from right to left.\r\n */\n\n\nvar codepointsIteratorRTL = function* codepointsIteratorRTL(str) {\n var end = str.length - 1;\n\n for (var i = 0; i < str.length; i++) {\n var char1 = str.charAt(end - i);\n\n if (isLowSurrogate(char1.charCodeAt(0))) {\n var char2 = str.charAt(end - i - 1);\n\n if (isHighSurrogate(char2.charCodeAt(0))) {\n yield char2 + char1;\n i++;\n continue;\n }\n }\n\n yield char1;\n }\n};\n/**\r\n * Is `charCode` a high surrogate.\r\n *\r\n * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates\r\n */\n\nvar isHighSurrogate = charCode => {\n return charCode >= 0xd800 && charCode <= 0xdbff;\n};\n/**\r\n * Is `charCode` a low surrogate.\r\n *\r\n * https://en.wikipedia.org/wiki/Universal_Character_Set_characters#Surrogates\r\n */\n\n\nvar isLowSurrogate = charCode => {\n return charCode >= 0xdc00 && charCode <= 0xdfff;\n};\n\nvar CodepointType;\n\n(function (CodepointType) {\n CodepointType[CodepointType[\"None\"] = 0] = \"None\";\n CodepointType[CodepointType[\"Extend\"] = 1] = \"Extend\";\n CodepointType[CodepointType[\"ZWJ\"] = 2] = \"ZWJ\";\n CodepointType[CodepointType[\"RI\"] = 4] = \"RI\";\n CodepointType[CodepointType[\"Prepend\"] = 8] = \"Prepend\";\n CodepointType[CodepointType[\"SpacingMark\"] = 16] = \"SpacingMark\";\n CodepointType[CodepointType[\"L\"] = 32] = \"L\";\n CodepointType[CodepointType[\"V\"] = 64] = \"V\";\n CodepointType[CodepointType[\"T\"] = 128] = \"T\";\n CodepointType[CodepointType[\"LV\"] = 256] = \"LV\";\n CodepointType[CodepointType[\"LVT\"] = 512] = \"LVT\";\n CodepointType[CodepointType[\"ExtPict\"] = 1024] = \"ExtPict\";\n CodepointType[CodepointType[\"Any\"] = 2048] = \"Any\";\n})(CodepointType || (CodepointType = {}));\n\nvar reExtend = /^(?:[\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09BE\\u09C1-\\u09C4\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01\\u0B3C\\u0B3E\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE\\u0BC0\\u0BCD\\u0BD7\\u0C00\\u0C04\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81\\u0CBC\\u0CBF\\u0CC2\\u0CC6\\u0CCC\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0D00\\u0D01\\u0D3B\\u0D3C\\u0D3E\\u0D41-\\u0D44\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D81\\u0DCA\\u0DCF\\u0DD2-\\u0DD4\\u0DD6\\u0DDF\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4\\u17B5\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A1B\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1AB0-\\u1AC0\\u1B00-\\u1B03\\u1B34-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BAB-\\u1BAD\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1CF4\\u1CF8\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u200C\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA82C\\uA8C4\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uA9BD\\uA9E5\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEC\\uAAED\\uAAF6\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDEAB\\uDEAC\\uDF46-\\uDF50]|\\uD804[\\uDC01\\uDC38-\\uDC46\\uDC7F-\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDD00-\\uDD02\\uDD27-\\uDD2B\\uDD2D-\\uDD34\\uDD73\\uDD80\\uDD81\\uDDB6-\\uDDBE\\uDDC9-\\uDDCC\\uDDCF\\uDE2F-\\uDE31\\uDE34\\uDE36\\uDE37\\uDE3E\\uDEDF\\uDEE3-\\uDEEA\\uDF00\\uDF01\\uDF3B\\uDF3C\\uDF3E\\uDF40\\uDF57\\uDF66-\\uDF6C\\uDF70-\\uDF74]|\\uD805[\\uDC38-\\uDC3F\\uDC42-\\uDC44\\uDC46\\uDC5E\\uDCB0\\uDCB3-\\uDCB8\\uDCBA\\uDCBD\\uDCBF\\uDCC0\\uDCC2\\uDCC3\\uDDAF\\uDDB2-\\uDDB5\\uDDBC\\uDDBD\\uDDBF\\uDDC0\\uDDDC\\uDDDD\\uDE33-\\uDE3A\\uDE3D\\uDE3F\\uDE40\\uDEAB\\uDEAD\\uDEB0-\\uDEB5\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF25\\uDF27-\\uDF2B]|\\uD806[\\uDC2F-\\uDC37\\uDC39\\uDC3A\\uDD30\\uDD3B\\uDD3C\\uDD3E\\uDD43\\uDDD4-\\uDDD7\\uDDDA\\uDDDB\\uDDE0\\uDE01-\\uDE0A\\uDE33-\\uDE38\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE56\\uDE59-\\uDE5B\\uDE8A-\\uDE96\\uDE98\\uDE99]|\\uD807[\\uDC30-\\uDC36\\uDC38-\\uDC3D\\uDC3F\\uDC92-\\uDCA7\\uDCAA-\\uDCB0\\uDCB2\\uDCB3\\uDCB5\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD45\\uDD47\\uDD90\\uDD91\\uDD95\\uDD97\\uDEF3\\uDEF4]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDF4F\\uDF8F-\\uDF92\\uDFE4]|\\uD82F[\\uDC9D\\uDC9E]|\\uD834[\\uDD65\\uDD67-\\uDD69\\uDD6E-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDD30-\\uDD36\\uDEEC-\\uDEEF]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF])$/;\nvar rePrepend = /^(?:[\\u0600-\\u0605\\u06DD\\u070F\\u0890\\u0891\\u08E2\\u0D4E]|\\uD804[\\uDCBD\\uDCCD\\uDDC2\\uDDC3]|\\uD806[\\uDD3F\\uDD41\\uDE3A\\uDE84-\\uDE89]|\\uD807\\uDD46)$/;\nvar reSpacingMark = /^(?:[\\u0903\\u093B\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u094F\\u0982\\u0983\\u09BF\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0\\u0CC1\\u0CC3\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0D02\\u0D03\\u0D3F\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D82\\u0D83\\u0DD0\\u0DD1\\u0DD8-\\u0DDE\\u0DF2\\u0DF3\\u0E33\\u0EB3\\u0F3E\\u0F3F\\u0F7F\\u1031\\u103B\\u103C\\u1056\\u1057\\u1084\\u1715\\u1734\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u1A19\\u1A1A\\u1A55\\u1A57\\u1A6D-\\u1A72\\u1B04\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1BE7\\u1BEA-\\u1BEC\\u1BEE\\u1BF2\\u1BF3\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF7\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BE-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAAEB\\uAAEE\\uAAEF\\uAAF5\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]|\\uD804[\\uDC00\\uDC02\\uDC82\\uDCB0-\\uDCB2\\uDCB7\\uDCB8\\uDD2C\\uDD45\\uDD46\\uDD82\\uDDB3-\\uDDB5\\uDDBF\\uDDC0\\uDDCE\\uDE2C-\\uDE2E\\uDE32\\uDE33\\uDE35\\uDEE0-\\uDEE2\\uDF02\\uDF03\\uDF3F\\uDF41-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF62\\uDF63]|\\uD805[\\uDC35-\\uDC37\\uDC40\\uDC41\\uDC45\\uDCB1\\uDCB2\\uDCB9\\uDCBB\\uDCBC\\uDCBE\\uDCC1\\uDDB0\\uDDB1\\uDDB8-\\uDDBB\\uDDBE\\uDE30-\\uDE32\\uDE3B\\uDE3C\\uDE3E\\uDEAC\\uDEAE\\uDEAF\\uDEB6\\uDF26]|\\uD806[\\uDC2C-\\uDC2E\\uDC38\\uDD31-\\uDD35\\uDD37\\uDD38\\uDD3D\\uDD40\\uDD42\\uDDD1-\\uDDD3\\uDDDC-\\uDDDF\\uDDE4\\uDE39\\uDE57\\uDE58\\uDE97]|\\uD807[\\uDC2F\\uDC3E\\uDCA9\\uDCB1\\uDCB4\\uDD8A-\\uDD8E\\uDD93\\uDD94\\uDD96\\uDEF5\\uDEF6]|\\uD81B[\\uDF51-\\uDF87\\uDFF0\\uDFF1]|\\uD834[\\uDD66\\uDD6D])$/;\nvar reL = /^[\\u1100-\\u115F\\uA960-\\uA97C]$/;\nvar reV = /^[\\u1160-\\u11A7\\uD7B0-\\uD7C6]$/;\nvar reT = /^[\\u11A8-\\u11FF\\uD7CB-\\uD7FB]$/;\nvar reLV = /^[\\uAC00\\uAC1C\\uAC38\\uAC54\\uAC70\\uAC8C\\uACA8\\uACC4\\uACE0\\uACFC\\uAD18\\uAD34\\uAD50\\uAD6C\\uAD88\\uADA4\\uADC0\\uADDC\\uADF8\\uAE14\\uAE30\\uAE4C\\uAE68\\uAE84\\uAEA0\\uAEBC\\uAED8\\uAEF4\\uAF10\\uAF2C\\uAF48\\uAF64\\uAF80\\uAF9C\\uAFB8\\uAFD4\\uAFF0\\uB00C\\uB028\\uB044\\uB060\\uB07C\\uB098\\uB0B4\\uB0D0\\uB0EC\\uB108\\uB124\\uB140\\uB15C\\uB178\\uB194\\uB1B0\\uB1CC\\uB1E8\\uB204\\uB220\\uB23C\\uB258\\uB274\\uB290\\uB2AC\\uB2C8\\uB2E4\\uB300\\uB31C\\uB338\\uB354\\uB370\\uB38C\\uB3A8\\uB3C4\\uB3E0\\uB3FC\\uB418\\uB434\\uB450\\uB46C\\uB488\\uB4A4\\uB4C0\\uB4DC\\uB4F8\\uB514\\uB530\\uB54C\\uB568\\uB584\\uB5A0\\uB5BC\\uB5D8\\uB5F4\\uB610\\uB62C\\uB648\\uB664\\uB680\\uB69C\\uB6B8\\uB6D4\\uB6F0\\uB70C\\uB728\\uB744\\uB760\\uB77C\\uB798\\uB7B4\\uB7D0\\uB7EC\\uB808\\uB824\\uB840\\uB85C\\uB878\\uB894\\uB8B0\\uB8CC\\uB8E8\\uB904\\uB920\\uB93C\\uB958\\uB974\\uB990\\uB9AC\\uB9C8\\uB9E4\\uBA00\\uBA1C\\uBA38\\uBA54\\uBA70\\uBA8C\\uBAA8\\uBAC4\\uBAE0\\uBAFC\\uBB18\\uBB34\\uBB50\\uBB6C\\uBB88\\uBBA4\\uBBC0\\uBBDC\\uBBF8\\uBC14\\uBC30\\uBC4C\\uBC68\\uBC84\\uBCA0\\uBCBC\\uBCD8\\uBCF4\\uBD10\\uBD2C\\uBD48\\uBD64\\uBD80\\uBD9C\\uBDB8\\uBDD4\\uBDF0\\uBE0C\\uBE28\\uBE44\\uBE60\\uBE7C\\uBE98\\uBEB4\\uBED0\\uBEEC\\uBF08\\uBF24\\uBF40\\uBF5C\\uBF78\\uBF94\\uBFB0\\uBFCC\\uBFE8\\uC004\\uC020\\uC03C\\uC058\\uC074\\uC090\\uC0AC\\uC0C8\\uC0E4\\uC100\\uC11C\\uC138\\uC154\\uC170\\uC18C\\uC1A8\\uC1C4\\uC1E0\\uC1FC\\uC218\\uC234\\uC250\\uC26C\\uC288\\uC2A4\\uC2C0\\uC2DC\\uC2F8\\uC314\\uC330\\uC34C\\uC368\\uC384\\uC3A0\\uC3BC\\uC3D8\\uC3F4\\uC410\\uC42C\\uC448\\uC464\\uC480\\uC49C\\uC4B8\\uC4D4\\uC4F0\\uC50C\\uC528\\uC544\\uC560\\uC57C\\uC598\\uC5B4\\uC5D0\\uC5EC\\uC608\\uC624\\uC640\\uC65C\\uC678\\uC694\\uC6B0\\uC6CC\\uC6E8\\uC704\\uC720\\uC73C\\uC758\\uC774\\uC790\\uC7AC\\uC7C8\\uC7E4\\uC800\\uC81C\\uC838\\uC854\\uC870\\uC88C\\uC8A8\\uC8C4\\uC8E0\\uC8FC\\uC918\\uC934\\uC950\\uC96C\\uC988\\uC9A4\\uC9C0\\uC9DC\\uC9F8\\uCA14\\uCA30\\uCA4C\\uCA68\\uCA84\\uCAA0\\uCABC\\uCAD8\\uCAF4\\uCB10\\uCB2C\\uCB48\\uCB64\\uCB80\\uCB9C\\uCBB8\\uCBD4\\uCBF0\\uCC0C\\uCC28\\uCC44\\uCC60\\uCC7C\\uCC98\\uCCB4\\uCCD0\\uCCEC\\uCD08\\uCD24\\uCD40\\uCD5C\\uCD78\\uCD94\\uCDB0\\uCDCC\\uCDE8\\uCE04\\uCE20\\uCE3C\\uCE58\\uCE74\\uCE90\\uCEAC\\uCEC8\\uCEE4\\uCF00\\uCF1C\\uCF38\\uCF54\\uCF70\\uCF8C\\uCFA8\\uCFC4\\uCFE0\\uCFFC\\uD018\\uD034\\uD050\\uD06C\\uD088\\uD0A4\\uD0C0\\uD0DC\\uD0F8\\uD114\\uD130\\uD14C\\uD168\\uD184\\uD1A0\\uD1BC\\uD1D8\\uD1F4\\uD210\\uD22C\\uD248\\uD264\\uD280\\uD29C\\uD2B8\\uD2D4\\uD2F0\\uD30C\\uD328\\uD344\\uD360\\uD37C\\uD398\\uD3B4\\uD3D0\\uD3EC\\uD408\\uD424\\uD440\\uD45C\\uD478\\uD494\\uD4B0\\uD4CC\\uD4E8\\uD504\\uD520\\uD53C\\uD558\\uD574\\uD590\\uD5AC\\uD5C8\\uD5E4\\uD600\\uD61C\\uD638\\uD654\\uD670\\uD68C\\uD6A8\\uD6C4\\uD6E0\\uD6FC\\uD718\\uD734\\uD750\\uD76C\\uD788]$/;\nvar reLVT = /^[\\uAC01-\\uAC1B\\uAC1D-\\uAC37\\uAC39-\\uAC53\\uAC55-\\uAC6F\\uAC71-\\uAC8B\\uAC8D-\\uACA7\\uACA9-\\uACC3\\uACC5-\\uACDF\\uACE1-\\uACFB\\uACFD-\\uAD17\\uAD19-\\uAD33\\uAD35-\\uAD4F\\uAD51-\\uAD6B\\uAD6D-\\uAD87\\uAD89-\\uADA3\\uADA5-\\uADBF\\uADC1-\\uADDB\\uADDD-\\uADF7\\uADF9-\\uAE13\\uAE15-\\uAE2F\\uAE31-\\uAE4B\\uAE4D-\\uAE67\\uAE69-\\uAE83\\uAE85-\\uAE9F\\uAEA1-\\uAEBB\\uAEBD-\\uAED7\\uAED9-\\uAEF3\\uAEF5-\\uAF0F\\uAF11-\\uAF2B\\uAF2D-\\uAF47\\uAF49-\\uAF63\\uAF65-\\uAF7F\\uAF81-\\uAF9B\\uAF9D-\\uAFB7\\uAFB9-\\uAFD3\\uAFD5-\\uAFEF\\uAFF1-\\uB00B\\uB00D-\\uB027\\uB029-\\uB043\\uB045-\\uB05F\\uB061-\\uB07B\\uB07D-\\uB097\\uB099-\\uB0B3\\uB0B5-\\uB0CF\\uB0D1-\\uB0EB\\uB0ED-\\uB107\\uB109-\\uB123\\uB125-\\uB13F\\uB141-\\uB15B\\uB15D-\\uB177\\uB179-\\uB193\\uB195-\\uB1AF\\uB1B1-\\uB1CB\\uB1CD-\\uB1E7\\uB1E9-\\uB203\\uB205-\\uB21F\\uB221-\\uB23B\\uB23D-\\uB257\\uB259-\\uB273\\uB275-\\uB28F\\uB291-\\uB2AB\\uB2AD-\\uB2C7\\uB2C9-\\uB2E3\\uB2E5-\\uB2FF\\uB301-\\uB31B\\uB31D-\\uB337\\uB339-\\uB353\\uB355-\\uB36F\\uB371-\\uB38B\\uB38D-\\uB3A7\\uB3A9-\\uB3C3\\uB3C5-\\uB3DF\\uB3E1-\\uB3FB\\uB3FD-\\uB417\\uB419-\\uB433\\uB435-\\uB44F\\uB451-\\uB46B\\uB46D-\\uB487\\uB489-\\uB4A3\\uB4A5-\\uB4BF\\uB4C1-\\uB4DB\\uB4DD-\\uB4F7\\uB4F9-\\uB513\\uB515-\\uB52F\\uB531-\\uB54B\\uB54D-\\uB567\\uB569-\\uB583\\uB585-\\uB59F\\uB5A1-\\uB5BB\\uB5BD-\\uB5D7\\uB5D9-\\uB5F3\\uB5F5-\\uB60F\\uB611-\\uB62B\\uB62D-\\uB647\\uB649-\\uB663\\uB665-\\uB67F\\uB681-\\uB69B\\uB69D-\\uB6B7\\uB6B9-\\uB6D3\\uB6D5-\\uB6EF\\uB6F1-\\uB70B\\uB70D-\\uB727\\uB729-\\uB743\\uB745-\\uB75F\\uB761-\\uB77B\\uB77D-\\uB797\\uB799-\\uB7B3\\uB7B5-\\uB7CF\\uB7D1-\\uB7EB\\uB7ED-\\uB807\\uB809-\\uB823\\uB825-\\uB83F\\uB841-\\uB85B\\uB85D-\\uB877\\uB879-\\uB893\\uB895-\\uB8AF\\uB8B1-\\uB8CB\\uB8CD-\\uB8E7\\uB8E9-\\uB903\\uB905-\\uB91F\\uB921-\\uB93B\\uB93D-\\uB957\\uB959-\\uB973\\uB975-\\uB98F\\uB991-\\uB9AB\\uB9AD-\\uB9C7\\uB9C9-\\uB9E3\\uB9E5-\\uB9FF\\uBA01-\\uBA1B\\uBA1D-\\uBA37\\uBA39-\\uBA53\\uBA55-\\uBA6F\\uBA71-\\uBA8B\\uBA8D-\\uBAA7\\uBAA9-\\uBAC3\\uBAC5-\\uBADF\\uBAE1-\\uBAFB\\uBAFD-\\uBB17\\uBB19-\\uBB33\\uBB35-\\uBB4F\\uBB51-\\uBB6B\\uBB6D-\\uBB87\\uBB89-\\uBBA3\\uBBA5-\\uBBBF\\uBBC1-\\uBBDB\\uBBDD-\\uBBF7\\uBBF9-\\uBC13\\uBC15-\\uBC2F\\uBC31-\\uBC4B\\uBC4D-\\uBC67\\uBC69-\\uBC83\\uBC85-\\uBC9F\\uBCA1-\\uBCBB\\uBCBD-\\uBCD7\\uBCD9-\\uBCF3\\uBCF5-\\uBD0F\\uBD11-\\uBD2B\\uBD2D-\\uBD47\\uBD49-\\uBD63\\uBD65-\\uBD7F\\uBD81-\\uBD9B\\uBD9D-\\uBDB7\\uBDB9-\\uBDD3\\uBDD5-\\uBDEF\\uBDF1-\\uBE0B\\uBE0D-\\uBE27\\uBE29-\\uBE43\\uBE45-\\uBE5F\\uBE61-\\uBE7B\\uBE7D-\\uBE97\\uBE99-\\uBEB3\\uBEB5-\\uBECF\\uBED1-\\uBEEB\\uBEED-\\uBF07\\uBF09-\\uBF23\\uBF25-\\uBF3F\\uBF41-\\uBF5B\\uBF5D-\\uBF77\\uBF79-\\uBF93\\uBF95-\\uBFAF\\uBFB1-\\uBFCB\\uBFCD-\\uBFE7\\uBFE9-\\uC003\\uC005-\\uC01F\\uC021-\\uC03B\\uC03D-\\uC057\\uC059-\\uC073\\uC075-\\uC08F\\uC091-\\uC0AB\\uC0AD-\\uC0C7\\uC0C9-\\uC0E3\\uC0E5-\\uC0FF\\uC101-\\uC11B\\uC11D-\\uC137\\uC139-\\uC153\\uC155-\\uC16F\\uC171-\\uC18B\\uC18D-\\uC1A7\\uC1A9-\\uC1C3\\uC1C5-\\uC1DF\\uC1E1-\\uC1FB\\uC1FD-\\uC217\\uC219-\\uC233\\uC235-\\uC24F\\uC251-\\uC26B\\uC26D-\\uC287\\uC289-\\uC2A3\\uC2A5-\\uC2BF\\uC2C1-\\uC2DB\\uC2DD-\\uC2F7\\uC2F9-\\uC313\\uC315-\\uC32F\\uC331-\\uC34B\\uC34D-\\uC367\\uC369-\\uC383\\uC385-\\uC39F\\uC3A1-\\uC3BB\\uC3BD-\\uC3D7\\uC3D9-\\uC3F3\\uC3F5-\\uC40F\\uC411-\\uC42B\\uC42D-\\uC447\\uC449-\\uC463\\uC465-\\uC47F\\uC481-\\uC49B\\uC49D-\\uC4B7\\uC4B9-\\uC4D3\\uC4D5-\\uC4EF\\uC4F1-\\uC50B\\uC50D-\\uC527\\uC529-\\uC543\\uC545-\\uC55F\\uC561-\\uC57B\\uC57D-\\uC597\\uC599-\\uC5B3\\uC5B5-\\uC5CF\\uC5D1-\\uC5EB\\uC5ED-\\uC607\\uC609-\\uC623\\uC625-\\uC63F\\uC641-\\uC65B\\uC65D-\\uC677\\uC679-\\uC693\\uC695-\\uC6AF\\uC6B1-\\uC6CB\\uC6CD-\\uC6E7\\uC6E9-\\uC703\\uC705-\\uC71F\\uC721-\\uC73B\\uC73D-\\uC757\\uC759-\\uC773\\uC775-\\uC78F\\uC791-\\uC7AB\\uC7AD-\\uC7C7\\uC7C9-\\uC7E3\\uC7E5-\\uC7FF\\uC801-\\uC81B\\uC81D-\\uC837\\uC839-\\uC853\\uC855-\\uC86F\\uC871-\\uC88B\\uC88D-\\uC8A7\\uC8A9-\\uC8C3\\uC8C5-\\uC8DF\\uC8E1-\\uC8FB\\uC8FD-\\uC917\\uC919-\\uC933\\uC935-\\uC94F\\uC951-\\uC96B\\uC96D-\\uC987\\uC989-\\uC9A3\\uC9A5-\\uC9BF\\uC9C1-\\uC9DB\\uC9DD-\\uC9F7\\uC9F9-\\uCA13\\uCA15-\\uCA2F\\uCA31-\\uCA4B\\uCA4D-\\uCA67\\uCA69-\\uCA83\\uCA85-\\uCA9F\\uCAA1-\\uCABB\\uCABD-\\uCAD7\\uCAD9-\\uCAF3\\uCAF5-\\uCB0F\\uCB11-\\uCB2B\\uCB2D-\\uCB47\\uCB49-\\uCB63\\uCB65-\\uCB7F\\uCB81-\\uCB9B\\uCB9D-\\uCBB7\\uCBB9-\\uCBD3\\uCBD5-\\uCBEF\\uCBF1-\\uCC0B\\uCC0D-\\uCC27\\uCC29-\\uCC43\\uCC45-\\uCC5F\\uCC61-\\uCC7B\\uCC7D-\\uCC97\\uCC99-\\uCCB3\\uCCB5-\\uCCCF\\uCCD1-\\uCCEB\\uCCED-\\uCD07\\uCD09-\\uCD23\\uCD25-\\uCD3F\\uCD41-\\uCD5B\\uCD5D-\\uCD77\\uCD79-\\uCD93\\uCD95-\\uCDAF\\uCDB1-\\uCDCB\\uCDCD-\\uCDE7\\uCDE9-\\uCE03\\uCE05-\\uCE1F\\uCE21-\\uCE3B\\uCE3D-\\uCE57\\uCE59-\\uCE73\\uCE75-\\uCE8F\\uCE91-\\uCEAB\\uCEAD-\\uCEC7\\uCEC9-\\uCEE3\\uCEE5-\\uCEFF\\uCF01-\\uCF1B\\uCF1D-\\uCF37\\uCF39-\\uCF53\\uCF55-\\uCF6F\\uCF71-\\uCF8B\\uCF8D-\\uCFA7\\uCFA9-\\uCFC3\\uCFC5-\\uCFDF\\uCFE1-\\uCFFB\\uCFFD-\\uD017\\uD019-\\uD033\\uD035-\\uD04F\\uD051-\\uD06B\\uD06D-\\uD087\\uD089-\\uD0A3\\uD0A5-\\uD0BF\\uD0C1-\\uD0DB\\uD0DD-\\uD0F7\\uD0F9-\\uD113\\uD115-\\uD12F\\uD131-\\uD14B\\uD14D-\\uD167\\uD169-\\uD183\\uD185-\\uD19F\\uD1A1-\\uD1BB\\uD1BD-\\uD1D7\\uD1D9-\\uD1F3\\uD1F5-\\uD20F\\uD211-\\uD22B\\uD22D-\\uD247\\uD249-\\uD263\\uD265-\\uD27F\\uD281-\\uD29B\\uD29D-\\uD2B7\\uD2B9-\\uD2D3\\uD2D5-\\uD2EF\\uD2F1-\\uD30B\\uD30D-\\uD327\\uD329-\\uD343\\uD345-\\uD35F\\uD361-\\uD37B\\uD37D-\\uD397\\uD399-\\uD3B3\\uD3B5-\\uD3CF\\uD3D1-\\uD3EB\\uD3ED-\\uD407\\uD409-\\uD423\\uD425-\\uD43F\\uD441-\\uD45B\\uD45D-\\uD477\\uD479-\\uD493\\uD495-\\uD4AF\\uD4B1-\\uD4CB\\uD4CD-\\uD4E7\\uD4E9-\\uD503\\uD505-\\uD51F\\uD521-\\uD53B\\uD53D-\\uD557\\uD559-\\uD573\\uD575-\\uD58F\\uD591-\\uD5AB\\uD5AD-\\uD5C7\\uD5C9-\\uD5E3\\uD5E5-\\uD5FF\\uD601-\\uD61B\\uD61D-\\uD637\\uD639-\\uD653\\uD655-\\uD66F\\uD671-\\uD68B\\uD68D-\\uD6A7\\uD6A9-\\uD6C3\\uD6C5-\\uD6DF\\uD6E1-\\uD6FB\\uD6FD-\\uD717\\uD719-\\uD733\\uD735-\\uD74F\\uD751-\\uD76B\\uD76D-\\uD787\\uD789-\\uD7A3]$/;\nvar reExtPict = /^(?:[\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u2388\\u23CF\\u23E9-\\u23F3\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB-\\u25FE\\u2600-\\u2605\\u2607-\\u2612\\u2614-\\u2685\\u2690-\\u2705\\u2708-\\u2712\\u2714\\u2716\\u271D\\u2721\\u2728\\u2733\\u2734\\u2744\\u2747\\u274C\\u274E\\u2753-\\u2755\\u2757\\u2763-\\u2767\\u2795-\\u2797\\u27A1\\u27B0\\u27BF\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B50\\u2B55\\u3030\\u303D\\u3297\\u3299]|\\uD83C[\\uDC00-\\uDCFF\\uDD0D-\\uDD0F\\uDD2F\\uDD6C-\\uDD71\\uDD7E\\uDD7F\\uDD8E\\uDD91-\\uDD9A\\uDDAD-\\uDDE5\\uDE01-\\uDE0F\\uDE1A\\uDE2F\\uDE32-\\uDE3A\\uDE3C-\\uDE3F\\uDE49-\\uDFFA]|\\uD83D[\\uDC00-\\uDD3D\\uDD46-\\uDE4F\\uDE80-\\uDEFF\\uDF74-\\uDF7F\\uDFD5-\\uDFFF]|\\uD83E[\\uDC0C-\\uDC0F\\uDC48-\\uDC4F\\uDC5A-\\uDC5F\\uDC88-\\uDC8F\\uDCAE-\\uDCFF\\uDD0C-\\uDD3A\\uDD3C-\\uDD45\\uDD47-\\uDEFF]|\\uD83F[\\uDC00-\\uDFFD])$/;\n\nvar getCodepointType = (char, code) => {\n var type = CodepointType.Any;\n\n if (char.search(reExtend) !== -1) {\n type |= CodepointType.Extend;\n }\n\n if (code === 0x200d) {\n type |= CodepointType.ZWJ;\n }\n\n if (code >= 0x1f1e6 && code <= 0x1f1ff) {\n type |= CodepointType.RI;\n }\n\n if (char.search(rePrepend) !== -1) {\n type |= CodepointType.Prepend;\n }\n\n if (char.search(reSpacingMark) !== -1) {\n type |= CodepointType.SpacingMark;\n }\n\n if (char.search(reL) !== -1) {\n type |= CodepointType.L;\n }\n\n if (char.search(reV) !== -1) {\n type |= CodepointType.V;\n }\n\n if (char.search(reT) !== -1) {\n type |= CodepointType.T;\n }\n\n if (char.search(reLV) !== -1) {\n type |= CodepointType.LV;\n }\n\n if (char.search(reLVT) !== -1) {\n type |= CodepointType.LVT;\n }\n\n if (char.search(reExtPict) !== -1) {\n type |= CodepointType.ExtPict;\n }\n\n return type;\n};\n\nfunction intersects(x, y) {\n return (x & y) !== 0;\n}\n\nvar NonBoundaryPairs = [// GB6\n[CodepointType.L, CodepointType.L | CodepointType.V | CodepointType.LV | CodepointType.LVT], // GB7\n[CodepointType.LV | CodepointType.V, CodepointType.V | CodepointType.T], // GB8\n[CodepointType.LVT | CodepointType.T, CodepointType.T], // GB9\n[CodepointType.Any, CodepointType.Extend | CodepointType.ZWJ], // GB9a\n[CodepointType.Any, CodepointType.SpacingMark], // GB9b\n[CodepointType.Prepend, CodepointType.Any], // GB11\n[CodepointType.ZWJ, CodepointType.ExtPict], // GB12 and GB13\n[CodepointType.RI, CodepointType.RI]];\n\nfunction isBoundaryPair(left, right) {\n return NonBoundaryPairs.findIndex(r => intersects(left, r[0]) && intersects(right, r[1])) === -1;\n}\n\nvar endingEmojiZWJ = /(?:[\\xA9\\xAE\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA\\u231A\\u231B\\u2328\\u2388\\u23CF\\u23E9-\\u23F3\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB-\\u25FE\\u2600-\\u2605\\u2607-\\u2612\\u2614-\\u2685\\u2690-\\u2705\\u2708-\\u2712\\u2714\\u2716\\u271D\\u2721\\u2728\\u2733\\u2734\\u2744\\u2747\\u274C\\u274E\\u2753-\\u2755\\u2757\\u2763-\\u2767\\u2795-\\u2797\\u27A1\\u27B0\\u27BF\\u2934\\u2935\\u2B05-\\u2B07\\u2B1B\\u2B1C\\u2B50\\u2B55\\u3030\\u303D\\u3297\\u3299]|\\uD83C[\\uDC00-\\uDCFF\\uDD0D-\\uDD0F\\uDD2F\\uDD6C-\\uDD71\\uDD7E\\uDD7F\\uDD8E\\uDD91-\\uDD9A\\uDDAD-\\uDDE5\\uDE01-\\uDE0F\\uDE1A\\uDE2F\\uDE32-\\uDE3A\\uDE3C-\\uDE3F\\uDE49-\\uDFFA]|\\uD83D[\\uDC00-\\uDD3D\\uDD46-\\uDE4F\\uDE80-\\uDEFF\\uDF74-\\uDF7F\\uDFD5-\\uDFFF]|\\uD83E[\\uDC0C-\\uDC0F\\uDC48-\\uDC4F\\uDC5A-\\uDC5F\\uDC88-\\uDC8F\\uDCAE-\\uDCFF\\uDD0C-\\uDD3A\\uDD3C-\\uDD45\\uDD47-\\uDEFF]|\\uD83F[\\uDC00-\\uDFFD])(?:[\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0902\\u093A\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0957\\u0962\\u0963\\u0981\\u09BC\\u09BE\\u09C1-\\u09C4\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01\\u0B3C\\u0B3E\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE\\u0BC0\\u0BCD\\u0BD7\\u0C00\\u0C04\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81\\u0CBC\\u0CBF\\u0CC2\\u0CC6\\u0CCC\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0D00\\u0D01\\u0D3B\\u0D3C\\u0D3E\\u0D41-\\u0D44\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D81\\u0DCA\\u0DCF\\u0DD2-\\u0DD4\\u0DD6\\u0DDF\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4\\u17B5\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A1B\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1AB0-\\u1AC0\\u1B00-\\u1B03\\u1B34-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1BAB-\\u1BAD\\u1BE6\\u1BE8\\u1BE9\\u1BED\\u1BEF-\\u1BF1\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1CF4\\u1CF8\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u200C\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA82C\\uA8C4\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uA9BD\\uA9E5\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEC\\uAAED\\uAAF6\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDEAB\\uDEAC\\uDF46-\\uDF50]|\\uD804[\\uDC01\\uDC38-\\uDC46\\uDC7F-\\uDC81\\uDCB3-\\uDCB6\\uDCB9\\uDCBA\\uDD00-\\uDD02\\uDD27-\\uDD2B\\uDD2D-\\uDD34\\uDD73\\uDD80\\uDD81\\uDDB6-\\uDDBE\\uDDC9-\\uDDCC\\uDDCF\\uDE2F-\\uDE31\\uDE34\\uDE36\\uDE37\\uDE3E\\uDEDF\\uDEE3-\\uDEEA\\uDF00\\uDF01\\uDF3B\\uDF3C\\uDF3E\\uDF40\\uDF57\\uDF66-\\uDF6C\\uDF70-\\uDF74]|\\uD805[\\uDC38-\\uDC3F\\uDC42-\\uDC44\\uDC46\\uDC5E\\uDCB0\\uDCB3-\\uDCB8\\uDCBA\\uDCBD\\uDCBF\\uDCC0\\uDCC2\\uDCC3\\uDDAF\\uDDB2-\\uDDB5\\uDDBC\\uDDBD\\uDDBF\\uDDC0\\uDDDC\\uDDDD\\uDE33-\\uDE3A\\uDE3D\\uDE3F\\uDE40\\uDEAB\\uDEAD\\uDEB0-\\uDEB5\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF25\\uDF27-\\uDF2B]|\\uD806[\\uDC2F-\\uDC37\\uDC39\\uDC3A\\uDD30\\uDD3B\\uDD3C\\uDD3E\\uDD43\\uDDD4-\\uDDD7\\uDDDA\\uDDDB\\uDDE0\\uDE01-\\uDE0A\\uDE33-\\uDE38\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE56\\uDE59-\\uDE5B\\uDE8A-\\uDE96\\uDE98\\uDE99]|\\uD807[\\uDC30-\\uDC36\\uDC38-\\uDC3D\\uDC3F\\uDC92-\\uDCA7\\uDCAA-\\uDCB0\\uDCB2\\uDCB3\\uDCB5\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD45\\uDD47\\uDD90\\uDD91\\uDD95\\uDD97\\uDEF3\\uDEF4]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDF4F\\uDF8F-\\uDF92\\uDFE4]|\\uD82F[\\uDC9D\\uDC9E]|\\uD834[\\uDD65\\uDD67-\\uDD69\\uDD6E-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDD30-\\uDD36\\uDEEC-\\uDEEF]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF])*\\u200D$/;\n\nvar endsWithEmojiZWJ = str => {\n return str.search(endingEmojiZWJ) !== -1;\n};\n\nvar endingRIs = /(?:\\uD83C[\\uDDE6-\\uDDFF])+$/g;\n\nvar endsWithOddNumberOfRIs = str => {\n var match = str.match(endingRIs);\n\n if (match === null) {\n return false;\n } else {\n // A RI is represented by a surrogate pair.\n var numRIs = match[0].length / 2;\n return numRIs % 2 === 1;\n }\n};\n\n/**\r\n * Shared the function with isElementType utility\r\n */\n\nvar isElement = value => {\n return isPlainObject(value) && Node.isNodeList(value.children) && !Editor.isEditor(value);\n}; // eslint-disable-next-line no-redeclare\n\n\nvar Element = {\n /**\r\n * Check if a value implements the 'Ancestor' interface.\r\n */\n isAncestor(value) {\n return isPlainObject(value) && Node.isNodeList(value.children);\n },\n\n /**\r\n * Check if a value implements the `Element` interface.\r\n */\n isElement,\n\n /**\r\n * Check if a value is an array of `Element` objects.\r\n */\n isElementList(value) {\n return Array.isArray(value) && value.every(val => Element.isElement(val));\n },\n\n /**\r\n * Check if a set of props is a partial of Element.\r\n */\n isElementProps(props) {\n return props.children !== undefined;\n },\n\n /**\r\n * Check if a value implements the `Element` interface and has elementKey with selected value.\r\n * Default it check to `type` key value\r\n */\n isElementType: function isElementType(value, elementVal) {\n var elementKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'type';\n return isElement(value) && value[elementKey] === elementVal;\n },\n\n /**\r\n * Check if an element matches set of properties.\r\n *\r\n * Note: this checks custom properties, and it does not ensure that any\r\n * children are equivalent.\r\n */\n matches(element, props) {\n for (var key in props) {\n if (key === 'children') {\n continue;\n }\n\n if (element[key] !== props[key]) {\n return false;\n }\n }\n\n return true;\n }\n\n};\n\nvar _excluded$4 = [\"text\"],\n _excluded2$3 = [\"text\"];\n\nfunction ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\nvar IS_EDITOR_CACHE = new WeakMap(); // eslint-disable-next-line no-redeclare\n\nvar Editor = {\n /**\r\n * Get the ancestor above a location in the document.\r\n */\n above(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n voids = false,\n mode = 'lowest',\n at = editor.selection,\n match\n } = options;\n\n if (!at) {\n return;\n }\n\n var path = Editor.path(editor, at);\n var reverse = mode === 'lowest';\n\n for (var [n, p] of Editor.levels(editor, {\n at: path,\n voids,\n match,\n reverse\n })) {\n if (Text.isText(n)) continue;\n\n if (Range.isRange(at)) {\n if (Path.isAncestor(p, at.anchor.path) && Path.isAncestor(p, at.focus.path)) {\n return [n, p];\n }\n } else {\n if (!Path.equals(path, p)) {\n return [n, p];\n }\n }\n }\n },\n\n /**\r\n * Add a custom property to the leaf text nodes in the current selection.\r\n *\r\n * If the selection is currently collapsed, the marks will be added to the\r\n * `editor.marks` property instead, and applied when text is inserted next.\r\n */\n addMark(editor, key, value) {\n editor.addMark(key, value);\n },\n\n /**\r\n * Get the point after a location.\r\n */\n after(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var anchor = Editor.point(editor, at, {\n edge: 'end'\n });\n var focus = Editor.end(editor, []);\n var range = {\n anchor,\n focus\n };\n var {\n distance = 1\n } = options;\n var d = 0;\n var target;\n\n for (var p of Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {\n at: range\n }))) {\n if (d > distance) {\n break;\n }\n\n if (d !== 0) {\n target = p;\n }\n\n d++;\n }\n\n return target;\n },\n\n /**\r\n * Get the point before a location.\r\n */\n before(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var anchor = Editor.start(editor, []);\n var focus = Editor.point(editor, at, {\n edge: 'start'\n });\n var range = {\n anchor,\n focus\n };\n var {\n distance = 1\n } = options;\n var d = 0;\n var target;\n\n for (var p of Editor.positions(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {\n at: range,\n reverse: true\n }))) {\n if (d > distance) {\n break;\n }\n\n if (d !== 0) {\n target = p;\n }\n\n d++;\n }\n\n return target;\n },\n\n /**\r\n * Delete content in the editor backward from the current selection.\r\n */\n deleteBackward(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n unit = 'character'\n } = options;\n editor.deleteBackward(unit);\n },\n\n /**\r\n * Delete content in the editor forward from the current selection.\r\n */\n deleteForward(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n unit = 'character'\n } = options;\n editor.deleteForward(unit);\n },\n\n /**\r\n * Delete the content in the current selection.\r\n */\n deleteFragment(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n direction = 'forward'\n } = options;\n editor.deleteFragment(direction);\n },\n\n /**\r\n * Get the start and end points of a location.\r\n */\n edges(editor, at) {\n return [Editor.start(editor, at), Editor.end(editor, at)];\n },\n\n /**\r\n * Get the end point of a location.\r\n */\n end(editor, at) {\n return Editor.point(editor, at, {\n edge: 'end'\n });\n },\n\n /**\r\n * Get the first node at a location.\r\n */\n first(editor, at) {\n var path = Editor.path(editor, at, {\n edge: 'start'\n });\n return Editor.node(editor, path);\n },\n\n /**\r\n * Get the fragment at a location.\r\n */\n fragment(editor, at) {\n var range = Editor.range(editor, at);\n var fragment = Node.fragment(editor, range);\n return fragment;\n },\n\n /**\r\n * Check if a node has block children.\r\n */\n hasBlocks(editor, element) {\n return element.children.some(n => Element.isElement(n) && Editor.isBlock(editor, n));\n },\n\n /**\r\n * Check if a node has inline and text children.\r\n */\n hasInlines(editor, element) {\n return element.children.some(n => Text.isText(n) || Editor.isInline(editor, n));\n },\n\n /**\r\n * Check if a node has text children.\r\n */\n hasTexts(editor, element) {\n return element.children.every(n => Text.isText(n));\n },\n\n /**\r\n * Insert a block break at the current selection.\r\n *\r\n * If the selection is currently expanded, it will be deleted first.\r\n */\n insertBreak(editor) {\n editor.insertBreak();\n },\n\n /**\r\n * Insert a soft break at the current selection.\r\n *\r\n * If the selection is currently expanded, it will be deleted first.\r\n */\n insertSoftBreak(editor) {\n editor.insertSoftBreak();\n },\n\n /**\r\n * Insert a fragment at the current selection.\r\n *\r\n * If the selection is currently expanded, it will be deleted first.\r\n */\n insertFragment(editor, fragment) {\n editor.insertFragment(fragment);\n },\n\n /**\r\n * Insert a node at the current selection.\r\n *\r\n * If the selection is currently expanded, it will be deleted first.\r\n */\n insertNode(editor, node) {\n editor.insertNode(node);\n },\n\n /**\r\n * Insert text at the current selection.\r\n *\r\n * If the selection is currently expanded, it will be deleted first.\r\n */\n insertText(editor, text) {\n editor.insertText(text);\n },\n\n /**\r\n * Check if a value is a block `Element` object.\r\n */\n isBlock(editor, value) {\n return !editor.isInline(value);\n },\n\n /**\r\n * Check if a value is an `Editor` object.\r\n */\n isEditor(value) {\n var cachedIsEditor = IS_EDITOR_CACHE.get(value);\n\n if (cachedIsEditor !== undefined) {\n return cachedIsEditor;\n }\n\n if (!isPlainObject(value)) {\n return false;\n }\n\n var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === 'function' && typeof value.deleteFragment === 'function' && typeof value.insertBreak === 'function' && typeof value.insertSoftBreak === 'function' && typeof value.insertFragment === 'function' && typeof value.insertNode === 'function' && typeof value.insertText === 'function' && typeof value.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && typeof value.getDirtyPaths === 'function' && (value.marks === null || isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node.isNodeList(value.children) && Operation.isOperationList(value.operations);\n IS_EDITOR_CACHE.set(value, isEditor);\n return isEditor;\n },\n\n /**\r\n * Check if a point is the end point of a location.\r\n */\n isEnd(editor, point, at) {\n var end = Editor.end(editor, at);\n return Point.equals(point, end);\n },\n\n /**\r\n * Check if a point is an edge of a location.\r\n */\n isEdge(editor, point, at) {\n return Editor.isStart(editor, point, at) || Editor.isEnd(editor, point, at);\n },\n\n /**\r\n * Check if an element is empty, accounting for void nodes.\r\n */\n isEmpty(editor, element) {\n var {\n children\n } = element;\n var [first] = children;\n return children.length === 0 || children.length === 1 && Text.isText(first) && first.text === '' && !editor.isVoid(element);\n },\n\n /**\r\n * Check if a value is an inline `Element` object.\r\n */\n isInline(editor, value) {\n return editor.isInline(value);\n },\n\n /**\r\n * Check if the editor is currently normalizing after each operation.\r\n */\n isNormalizing(editor) {\n var isNormalizing = NORMALIZING.get(editor);\n return isNormalizing === undefined ? true : isNormalizing;\n },\n\n /**\r\n * Check if a point is the start point of a location.\r\n */\n isStart(editor, point, at) {\n // PERF: If the offset isn't `0` we know it's not the start.\n if (point.offset !== 0) {\n return false;\n }\n\n var start = Editor.start(editor, at);\n return Point.equals(point, start);\n },\n\n /**\r\n * Check if a value is a void `Element` object.\r\n */\n isVoid(editor, value) {\n return editor.isVoid(value);\n },\n\n /**\r\n * Get the last node at a location.\r\n */\n last(editor, at) {\n var path = Editor.path(editor, at, {\n edge: 'end'\n });\n return Editor.node(editor, path);\n },\n\n /**\r\n * Get the leaf text node at a location.\r\n */\n leaf(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var path = Editor.path(editor, at, options);\n var node = Node.leaf(editor, path);\n return [node, path];\n },\n\n /**\r\n * Iterate through all of the levels at a location.\r\n */\n *levels(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n at = editor.selection,\n reverse = false,\n voids = false\n } = options;\n var {\n match\n } = options;\n\n if (match == null) {\n match = () => true;\n }\n\n if (!at) {\n return;\n }\n\n var levels = [];\n var path = Editor.path(editor, at);\n\n for (var [n, p] of Node.levels(editor, path)) {\n if (!match(n, p)) {\n continue;\n }\n\n levels.push([n, p]);\n\n if (!voids && Element.isElement(n) && Editor.isVoid(editor, n)) {\n break;\n }\n }\n\n if (reverse) {\n levels.reverse();\n }\n\n yield* levels;\n },\n\n /**\r\n * Get the marks that would be added to text at the current selection.\r\n */\n marks(editor) {\n var {\n marks,\n selection\n } = editor;\n\n if (!selection) {\n return null;\n }\n\n if (marks) {\n return marks;\n }\n\n if (Range.isExpanded(selection)) {\n var [match] = Editor.nodes(editor, {\n match: Text.isText\n });\n\n if (match) {\n var [_node] = match;\n\n var _rest = _objectWithoutProperties(_node, _excluded$4);\n\n return _rest;\n } else {\n return {};\n }\n }\n\n var {\n anchor\n } = selection;\n var {\n path\n } = anchor;\n var [node] = Editor.leaf(editor, path);\n\n if (anchor.offset === 0) {\n var prev = Editor.previous(editor, {\n at: path,\n match: Text.isText\n });\n var markedVoid = Editor.above(editor, {\n match: n => Element.isElement(n) && Editor.isVoid(editor, n) && editor.markableVoid(n)\n });\n\n if (!markedVoid) {\n var block = Editor.above(editor, {\n match: n => Element.isElement(n) && Editor.isBlock(editor, n)\n });\n\n if (prev && block) {\n var [prevNode, prevPath] = prev;\n var [, blockPath] = block;\n\n if (Path.isAncestor(blockPath, prevPath)) {\n node = prevNode;\n }\n }\n }\n }\n\n var rest = _objectWithoutProperties(node, _excluded2$3);\n\n return rest;\n },\n\n /**\r\n * Get the matching node in the branch of the document after a location.\r\n */\n next(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match,\n at = editor.selection\n } = options;\n\n if (!at) {\n return;\n }\n\n var pointAfterLocation = Editor.after(editor, at, {\n voids\n });\n if (!pointAfterLocation) return;\n var [, to] = Editor.last(editor, []);\n var span = [pointAfterLocation.path, to];\n\n if (Path.isPath(at) && at.length === 0) {\n throw new Error(\"Cannot get the next node from the root node!\");\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n var [parent] = Editor.parent(editor, at);\n\n match = n => parent.children.includes(n);\n } else {\n match = () => true;\n }\n }\n\n var [next] = Editor.nodes(editor, {\n at: span,\n match,\n mode,\n voids\n });\n return next;\n },\n\n /**\r\n * Get the node at a location.\r\n */\n node(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var path = Editor.path(editor, at, options);\n var node = Node.get(editor, path);\n return [node, path];\n },\n\n /**\r\n * Iterate through all of the nodes in the Editor.\r\n */\n *nodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n at = editor.selection,\n mode = 'all',\n universal = false,\n reverse = false,\n voids = false\n } = options;\n var {\n match\n } = options;\n\n if (!match) {\n match = () => true;\n }\n\n if (!at) {\n return;\n }\n\n var from;\n var to;\n\n if (Span.isSpan(at)) {\n from = at[0];\n to = at[1];\n } else {\n var first = Editor.path(editor, at, {\n edge: 'start'\n });\n var last = Editor.path(editor, at, {\n edge: 'end'\n });\n from = reverse ? last : first;\n to = reverse ? first : last;\n }\n\n var nodeEntries = Node.nodes(editor, {\n reverse,\n from,\n to,\n pass: _ref => {\n var [n] = _ref;\n return voids ? false : Element.isElement(n) && Editor.isVoid(editor, n);\n }\n });\n var matches = [];\n var hit;\n\n for (var [node, path] of nodeEntries) {\n var isLower = hit && Path.compare(path, hit[1]) === 0; // In highest mode any node lower than the last hit is not a match.\n\n if (mode === 'highest' && isLower) {\n continue;\n }\n\n if (!match(node, path)) {\n // If we've arrived at a leaf text node that is not lower than the last\n // hit, then we've found a branch that doesn't include a match, which\n // means the match is not universal.\n if (universal && !isLower && Text.isText(node)) {\n return;\n } else {\n continue;\n }\n } // If there's a match and it's lower than the last, update the hit.\n\n\n if (mode === 'lowest' && isLower) {\n hit = [node, path];\n continue;\n } // In lowest mode we emit the last hit, once it's guaranteed lowest.\n\n\n var emit = mode === 'lowest' ? hit : [node, path];\n\n if (emit) {\n if (universal) {\n matches.push(emit);\n } else {\n yield emit;\n }\n }\n\n hit = [node, path];\n } // Since lowest is always emitting one behind, catch up at the end.\n\n\n if (mode === 'lowest' && hit) {\n if (universal) {\n matches.push(hit);\n } else {\n yield hit;\n }\n } // Universal defers to ensure that the match occurs in every branch, so we\n // yield all of the matches after iterating.\n\n\n if (universal) {\n yield* matches;\n }\n },\n\n /**\r\n * Normalize any dirty objects in the editor.\r\n */\n normalize(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n force = false,\n operation\n } = options;\n\n var getDirtyPaths = editor => {\n return DIRTY_PATHS.get(editor) || [];\n };\n\n var getDirtyPathKeys = editor => {\n return DIRTY_PATH_KEYS.get(editor) || new Set();\n };\n\n var popDirtyPath = editor => {\n var path = getDirtyPaths(editor).pop();\n var key = path.join(',');\n getDirtyPathKeys(editor).delete(key);\n return path;\n };\n\n if (!Editor.isNormalizing(editor)) {\n return;\n }\n\n if (force) {\n var allPaths = Array.from(Node.nodes(editor), _ref2 => {\n var [, p] = _ref2;\n return p;\n });\n var allPathKeys = new Set(allPaths.map(p => p.join(',')));\n DIRTY_PATHS.set(editor, allPaths);\n DIRTY_PATH_KEYS.set(editor, allPathKeys);\n }\n\n if (getDirtyPaths(editor).length === 0) {\n return;\n }\n\n Editor.withoutNormalizing(editor, () => {\n /*\r\n Fix dirty elements with no children.\r\n editor.normalizeNode() does fix this, but some normalization fixes also require it to work.\r\n Running an initial pass avoids the catch-22 race condition.\r\n */\n for (var dirtyPath of getDirtyPaths(editor)) {\n if (Node.has(editor, dirtyPath)) {\n var entry = Editor.node(editor, dirtyPath);\n var [node, _] = entry;\n /*\r\n The default normalizer inserts an empty text node in this scenario, but it can be customised.\r\n So there is some risk here.\r\n As long as the normalizer only inserts child nodes for this case it is safe to do in any order;\r\n by definition adding children to an empty node can't cause other paths to change.\r\n */\n\n if (Element.isElement(node) && node.children.length === 0) {\n editor.normalizeNode(entry, {\n operation\n });\n }\n }\n }\n\n var dirtyPaths = getDirtyPaths(editor);\n var initialDirtyPathsLength = dirtyPaths.length;\n var iteration = 0;\n\n while (dirtyPaths.length !== 0) {\n if (!editor.shouldNormalize({\n dirtyPaths,\n iteration,\n initialDirtyPathsLength,\n operation\n })) {\n return;\n }\n\n var _dirtyPath = popDirtyPath(editor); // If the node doesn't exist in the tree, it does not need to be normalized.\n\n\n if (Node.has(editor, _dirtyPath)) {\n var _entry = Editor.node(editor, _dirtyPath);\n\n editor.normalizeNode(_entry, {\n operation\n });\n }\n\n iteration++;\n dirtyPaths = getDirtyPaths(editor);\n }\n });\n },\n\n /**\r\n * Get the parent node of a location.\r\n */\n parent(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var path = Editor.path(editor, at, options);\n var parentPath = Path.parent(path);\n var entry = Editor.node(editor, parentPath);\n return entry;\n },\n\n /**\r\n * Get the path of a location.\r\n */\n path(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n depth,\n edge\n } = options;\n\n if (Path.isPath(at)) {\n if (edge === 'start') {\n var [, firstPath] = Node.first(editor, at);\n at = firstPath;\n } else if (edge === 'end') {\n var [, lastPath] = Node.last(editor, at);\n at = lastPath;\n }\n }\n\n if (Range.isRange(at)) {\n if (edge === 'start') {\n at = Range.start(at);\n } else if (edge === 'end') {\n at = Range.end(at);\n } else {\n at = Path.common(at.anchor.path, at.focus.path);\n }\n }\n\n if (Point.isPoint(at)) {\n at = at.path;\n }\n\n if (depth != null) {\n at = at.slice(0, depth);\n }\n\n return at;\n },\n\n hasPath(editor, path) {\n return Node.has(editor, path);\n },\n\n /**\r\n * Create a mutable ref for a `Path` object, which will stay in sync as new\r\n * operations are applied to the editor.\r\n */\n pathRef(editor, path) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n affinity = 'forward'\n } = options;\n var ref = {\n current: path,\n affinity,\n\n unref() {\n var {\n current\n } = ref;\n var pathRefs = Editor.pathRefs(editor);\n pathRefs.delete(ref);\n ref.current = null;\n return current;\n }\n\n };\n var refs = Editor.pathRefs(editor);\n refs.add(ref);\n return ref;\n },\n\n /**\r\n * Get the set of currently tracked path refs of the editor.\r\n */\n pathRefs(editor) {\n var refs = PATH_REFS.get(editor);\n\n if (!refs) {\n refs = new Set();\n PATH_REFS.set(editor, refs);\n }\n\n return refs;\n },\n\n /**\r\n * Get the start or end point of a location.\r\n */\n point(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n edge = 'start'\n } = options;\n\n if (Path.isPath(at)) {\n var path;\n\n if (edge === 'end') {\n var [, lastPath] = Node.last(editor, at);\n path = lastPath;\n } else {\n var [, firstPath] = Node.first(editor, at);\n path = firstPath;\n }\n\n var node = Node.get(editor, path);\n\n if (!Text.isText(node)) {\n throw new Error(\"Cannot get the \".concat(edge, \" point in the node at path [\").concat(at, \"] because it has no \").concat(edge, \" text node.\"));\n }\n\n return {\n path,\n offset: edge === 'end' ? node.text.length : 0\n };\n }\n\n if (Range.isRange(at)) {\n var [start, end] = Range.edges(at);\n return edge === 'start' ? start : end;\n }\n\n return at;\n },\n\n /**\r\n * Create a mutable ref for a `Point` object, which will stay in sync as new\r\n * operations are applied to the editor.\r\n */\n pointRef(editor, point) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n affinity = 'forward'\n } = options;\n var ref = {\n current: point,\n affinity,\n\n unref() {\n var {\n current\n } = ref;\n var pointRefs = Editor.pointRefs(editor);\n pointRefs.delete(ref);\n ref.current = null;\n return current;\n }\n\n };\n var refs = Editor.pointRefs(editor);\n refs.add(ref);\n return ref;\n },\n\n /**\r\n * Get the set of currently tracked point refs of the editor.\r\n */\n pointRefs(editor) {\n var refs = POINT_REFS.get(editor);\n\n if (!refs) {\n refs = new Set();\n POINT_REFS.set(editor, refs);\n }\n\n return refs;\n },\n\n /**\r\n * Return all the positions in `at` range where a `Point` can be placed.\r\n *\r\n * By default, moves forward by individual offsets at a time, but\r\n * the `unit` option can be used to to move by character, word, line, or block.\r\n *\r\n * The `reverse` option can be used to change iteration direction.\r\n *\r\n * Note: By default void nodes are treated as a single point and iteration\r\n * will not happen inside their content unless you pass in true for the\r\n * `voids` option, then iteration will occur.\r\n */\n *positions(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n at = editor.selection,\n unit = 'offset',\n reverse = false,\n voids = false\n } = options;\n\n if (!at) {\n return;\n }\n /**\r\n * Algorithm notes:\r\n *\r\n * Each step `distance` is dynamic depending on the underlying text\r\n * and the `unit` specified. Each step, e.g., a line or word, may\r\n * span multiple text nodes, so we iterate through the text both on\r\n * two levels in step-sync:\r\n *\r\n * `leafText` stores the text on a text leaf level, and is advanced\r\n * through using the counters `leafTextOffset` and `leafTextRemaining`.\r\n *\r\n * `blockText` stores the text on a block level, and is shortened\r\n * by `distance` every time it is advanced.\r\n *\r\n * We only maintain a window of one blockText and one leafText because\r\n * a block node always appears before all of its leaf nodes.\r\n */\n\n\n var range = Editor.range(editor, at);\n var [start, end] = Range.edges(range);\n var first = reverse ? end : start;\n var isNewBlock = false;\n var blockText = '';\n var distance = 0; // Distance for leafText to catch up to blockText.\n\n var leafTextRemaining = 0;\n var leafTextOffset = 0; // Iterate through all nodes in range, grabbing entire textual content\n // of block nodes in blockText, and text nodes in leafText.\n // Exploits the fact that nodes are sequenced in such a way that we first\n // encounter the block node, then all of its text nodes, so when iterating\n // through the blockText and leafText we just need to remember a window of\n // one block node and leaf node, respectively.\n\n for (var [node, path] of Editor.nodes(editor, {\n at,\n reverse,\n voids\n })) {\n /*\r\n * ELEMENT NODE - Yield position(s) for voids, collect blockText for blocks\r\n */\n if (Element.isElement(node)) {\n // Void nodes are a special case, so by default we will always\n // yield their first point. If the `voids` option is set to true,\n // then we will iterate over their content.\n if (!voids && editor.isVoid(node)) {\n yield Editor.start(editor, path);\n continue;\n } // Inline element nodes are ignored as they don't themselves\n // contribute to `blockText` or `leafText` - their parent and\n // children do.\n\n\n if (editor.isInline(node)) continue; // Block element node - set `blockText` to its text content.\n\n if (Editor.hasInlines(editor, node)) {\n // We always exhaust block nodes before encountering a new one:\n // console.assert(blockText === '',\n // `blockText='${blockText}' - `+\n // `not exhausted before new block node`, path)\n // Ensure range considered is capped to `range`, in the\n // start/end edge cases where block extends beyond range.\n // Equivalent to this, but presumably more performant:\n // blockRange = Editor.range(editor, ...Editor.edges(editor, path))\n // blockRange = Range.intersection(range, blockRange) // intersect\n // blockText = Editor.string(editor, blockRange, { voids })\n var e = Path.isAncestor(path, end.path) ? end : Editor.end(editor, path);\n var s = Path.isAncestor(path, start.path) ? start : Editor.start(editor, path);\n blockText = Editor.string(editor, {\n anchor: s,\n focus: e\n }, {\n voids\n });\n isNewBlock = true;\n }\n }\n /*\r\n * TEXT LEAF NODE - Iterate through text content, yielding\r\n * positions every `distance` offset according to `unit`.\r\n */\n\n\n if (Text.isText(node)) {\n var isFirst = Path.equals(path, first.path); // Proof that we always exhaust text nodes before encountering a new one:\n // console.assert(leafTextRemaining <= 0,\n // `leafTextRemaining=${leafTextRemaining} - `+\n // `not exhausted before new leaf text node`, path)\n // Reset `leafText` counters for new text node.\n\n if (isFirst) {\n leafTextRemaining = reverse ? first.offset : node.text.length - first.offset;\n leafTextOffset = first.offset; // Works for reverse too.\n } else {\n leafTextRemaining = node.text.length;\n leafTextOffset = reverse ? leafTextRemaining : 0;\n } // Yield position at the start of node (potentially).\n\n\n if (isFirst || isNewBlock || unit === 'offset') {\n yield {\n path,\n offset: leafTextOffset\n };\n isNewBlock = false;\n } // Yield positions every (dynamically calculated) `distance` offset.\n\n\n while (true) {\n // If `leafText` has caught up with `blockText` (distance=0),\n // and if blockText is exhausted, break to get another block node,\n // otherwise advance blockText forward by the new `distance`.\n if (distance === 0) {\n if (blockText === '') break;\n distance = calcDistance(blockText, unit, reverse); // Split the string at the previously found distance and use the\n // remaining string for the next iteration.\n\n blockText = splitByCharacterDistance(blockText, distance, reverse)[1];\n } // Advance `leafText` by the current `distance`.\n\n\n leafTextOffset = reverse ? leafTextOffset - distance : leafTextOffset + distance;\n leafTextRemaining = leafTextRemaining - distance; // If `leafText` is exhausted, break to get a new leaf node\n // and set distance to the overflow amount, so we'll (maybe)\n // catch up to blockText in the next leaf text node.\n\n if (leafTextRemaining < 0) {\n distance = -leafTextRemaining;\n break;\n } // Successfully walked `distance` offsets through `leafText`\n // to catch up with `blockText`, so we can reset `distance`\n // and yield this position in this node.\n\n\n distance = 0;\n yield {\n path,\n offset: leafTextOffset\n };\n }\n }\n } // Proof that upon completion, we've exahusted both leaf and block text:\n // console.assert(leafTextRemaining <= 0, \"leafText wasn't exhausted\")\n // console.assert(blockText === '', \"blockText wasn't exhausted\")\n // Helper:\n // Return the distance in offsets for a step of size `unit` on given string.\n\n\n function calcDistance(text, unit, reverse) {\n if (unit === 'character') {\n return getCharacterDistance(text, reverse);\n } else if (unit === 'word') {\n return getWordDistance(text, reverse);\n } else if (unit === 'line' || unit === 'block') {\n return text.length;\n }\n\n return 1;\n }\n },\n\n /**\r\n * Get the matching node in the branch of the document before a location.\r\n */\n previous(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match,\n at = editor.selection\n } = options;\n\n if (!at) {\n return;\n }\n\n var pointBeforeLocation = Editor.before(editor, at, {\n voids\n });\n\n if (!pointBeforeLocation) {\n return;\n }\n\n var [, to] = Editor.first(editor, []); // The search location is from the start of the document to the path of\n // the point before the location passed in\n\n var span = [pointBeforeLocation.path, to];\n\n if (Path.isPath(at) && at.length === 0) {\n throw new Error(\"Cannot get the previous node from the root node!\");\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n var [parent] = Editor.parent(editor, at);\n\n match = n => parent.children.includes(n);\n } else {\n match = () => true;\n }\n }\n\n var [previous] = Editor.nodes(editor, {\n reverse: true,\n at: span,\n match,\n mode,\n voids\n });\n return previous;\n },\n\n /**\r\n * Get a range of a location.\r\n */\n range(editor, at, to) {\n if (Range.isRange(at) && !to) {\n return at;\n }\n\n var start = Editor.start(editor, at);\n var end = Editor.end(editor, to || at);\n return {\n anchor: start,\n focus: end\n };\n },\n\n /**\r\n * Create a mutable ref for a `Range` object, which will stay in sync as new\r\n * operations are applied to the editor.\r\n */\n rangeRef(editor, range) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n affinity = 'forward'\n } = options;\n var ref = {\n current: range,\n affinity,\n\n unref() {\n var {\n current\n } = ref;\n var rangeRefs = Editor.rangeRefs(editor);\n rangeRefs.delete(ref);\n ref.current = null;\n return current;\n }\n\n };\n var refs = Editor.rangeRefs(editor);\n refs.add(ref);\n return ref;\n },\n\n /**\r\n * Get the set of currently tracked range refs of the editor.\r\n */\n rangeRefs(editor) {\n var refs = RANGE_REFS.get(editor);\n\n if (!refs) {\n refs = new Set();\n RANGE_REFS.set(editor, refs);\n }\n\n return refs;\n },\n\n /**\r\n * Remove a custom property from all of the leaf text nodes in the current\r\n * selection.\r\n *\r\n * If the selection is currently collapsed, the removal will be stored on\r\n * `editor.marks` and applied to the text inserted next.\r\n */\n removeMark(editor, key) {\n editor.removeMark(key);\n },\n\n /**\r\n * Manually set if the editor should currently be normalizing.\r\n *\r\n * Note: Using this incorrectly can leave the editor in an invalid state.\r\n *\r\n */\n setNormalizing(editor, isNormalizing) {\n NORMALIZING.set(editor, isNormalizing);\n },\n\n /**\r\n * Get the start point of a location.\r\n */\n start(editor, at) {\n return Editor.point(editor, at, {\n edge: 'start'\n });\n },\n\n /**\r\n * Get the text string content of a location.\r\n *\r\n * Note: by default the text of void nodes is considered to be an empty\r\n * string, regardless of content, unless you pass in true for the voids option\r\n */\n string(editor, at) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n voids = false\n } = options;\n var range = Editor.range(editor, at);\n var [start, end] = Range.edges(range);\n var text = '';\n\n for (var [node, path] of Editor.nodes(editor, {\n at: range,\n match: Text.isText,\n voids\n })) {\n var t = node.text;\n\n if (Path.equals(path, end.path)) {\n t = t.slice(0, end.offset);\n }\n\n if (Path.equals(path, start.path)) {\n t = t.slice(start.offset);\n }\n\n text += t;\n }\n\n return text;\n },\n\n /**\r\n * Convert a range into a non-hanging one.\r\n */\n unhangRange(editor, range) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n voids = false\n } = options;\n var [start, end] = Range.edges(range); // PERF: exit early if we can guarantee that the range isn't hanging.\n\n if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range) || Path.hasPrevious(end.path)) {\n return range;\n }\n\n var endBlock = Editor.above(editor, {\n at: end,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n voids\n });\n var blockPath = endBlock ? endBlock[1] : [];\n var first = Editor.start(editor, start);\n var before = {\n anchor: first,\n focus: end\n };\n var skip = true;\n\n for (var [node, path] of Editor.nodes(editor, {\n at: before,\n match: Text.isText,\n reverse: true,\n voids\n })) {\n if (skip) {\n skip = false;\n continue;\n }\n\n if (node.text !== '' || Path.isBefore(path, blockPath)) {\n end = {\n path,\n offset: node.text.length\n };\n break;\n }\n }\n\n return {\n anchor: start,\n focus: end\n };\n },\n\n /**\r\n * Match a void node in the current branch of the editor.\r\n */\n void(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return Editor.above(editor, _objectSpread$8(_objectSpread$8({}, options), {}, {\n match: n => Element.isElement(n) && Editor.isVoid(editor, n)\n }));\n },\n\n /**\r\n * Call a function, deferring normalization until after it completes.\r\n */\n withoutNormalizing(editor, fn) {\n var value = Editor.isNormalizing(editor);\n Editor.setNormalizing(editor, false);\n\n try {\n fn();\n } finally {\n Editor.setNormalizing(editor, value);\n }\n\n Editor.normalize(editor);\n }\n\n};\n\nvar Location = {\n /**\r\n * Check if a value implements the `Location` interface.\r\n */\n isLocation(value) {\n return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);\n }\n\n}; // eslint-disable-next-line no-redeclare\n\nvar Span = {\n /**\r\n * Check if a value implements the `Span` interface.\r\n */\n isSpan(value) {\n return Array.isArray(value) && value.length === 2 && value.every(Path.isPath);\n }\n\n};\n\nvar _excluded$3 = [\"children\"],\n _excluded2$2 = [\"text\"];\nvar IS_NODE_LIST_CACHE = new WeakMap(); // eslint-disable-next-line no-redeclare\n\nvar Node = {\n /**\r\n * Get the node at a specific path, asserting that it's an ancestor node.\r\n */\n ancestor(root, path) {\n var node = Node.get(root, path);\n\n if (Text.isText(node)) {\n throw new Error(\"Cannot get the ancestor node at path [\".concat(path, \"] because it refers to a text node instead: \").concat(Scrubber.stringify(node)));\n }\n\n return node;\n },\n\n /**\r\n * Return a generator of all the ancestor nodes above a specific path.\r\n *\r\n * By default the order is top-down, from highest to lowest ancestor in\r\n * the tree, but you can pass the `reverse: true` option to go bottom-up.\r\n */\n *ancestors(root, path) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n for (var p of Path.ancestors(path, options)) {\n var n = Node.ancestor(root, p);\n var entry = [n, p];\n yield entry;\n }\n },\n\n /**\r\n * Get the child of a node at a specific index.\r\n */\n child(root, index) {\n if (Text.isText(root)) {\n throw new Error(\"Cannot get the child of a text node: \".concat(Scrubber.stringify(root)));\n }\n\n var c = root.children[index];\n\n if (c == null) {\n throw new Error(\"Cannot get child at index `\".concat(index, \"` in node: \").concat(Scrubber.stringify(root)));\n }\n\n return c;\n },\n\n /**\r\n * Iterate over the children of a node at a specific path.\r\n */\n *children(root, path) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n reverse = false\n } = options;\n var ancestor = Node.ancestor(root, path);\n var {\n children\n } = ancestor;\n var index = reverse ? children.length - 1 : 0;\n\n while (reverse ? index >= 0 : index < children.length) {\n var child = Node.child(ancestor, index);\n var childPath = path.concat(index);\n yield [child, childPath];\n index = reverse ? index - 1 : index + 1;\n }\n },\n\n /**\r\n * Get an entry for the common ancesetor node of two paths.\r\n */\n common(root, path, another) {\n var p = Path.common(path, another);\n var n = Node.get(root, p);\n return [n, p];\n },\n\n /**\r\n * Get the node at a specific path, asserting that it's a descendant node.\r\n */\n descendant(root, path) {\n var node = Node.get(root, path);\n\n if (Editor.isEditor(node)) {\n throw new Error(\"Cannot get the descendant node at path [\".concat(path, \"] because it refers to the root editor node instead: \").concat(Scrubber.stringify(node)));\n }\n\n return node;\n },\n\n /**\r\n * Return a generator of all the descendant node entries inside a root node.\r\n */\n *descendants(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var [node, path] of Node.nodes(root, options)) {\n if (path.length !== 0) {\n // NOTE: we have to coerce here because checking the path's length does\n // guarantee that `node` is not a `Editor`, but TypeScript doesn't know.\n yield [node, path];\n }\n }\n },\n\n /**\r\n * Return a generator of all the element nodes inside a root node. Each iteration\r\n * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the\r\n * root node is an element it will be included in the iteration as well.\r\n */\n *elements(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var [node, path] of Node.nodes(root, options)) {\n if (Element.isElement(node)) {\n yield [node, path];\n }\n }\n },\n\n /**\r\n * Extract props from a Node.\r\n */\n extractProps(node) {\n if (Element.isAncestor(node)) {\n var properties = _objectWithoutProperties(node, _excluded$3);\n\n return properties;\n } else {\n var properties = _objectWithoutProperties(node, _excluded2$2);\n\n return properties;\n }\n },\n\n /**\r\n * Get the first node entry in a root node from a path.\r\n */\n first(root, path) {\n var p = path.slice();\n var n = Node.get(root, p);\n\n while (n) {\n if (Text.isText(n) || n.children.length === 0) {\n break;\n } else {\n n = n.children[0];\n p.push(0);\n }\n }\n\n return [n, p];\n },\n\n /**\r\n * Get the sliced fragment represented by a range inside a root node.\r\n */\n fragment(root, range) {\n if (Text.isText(root)) {\n throw new Error(\"Cannot get a fragment starting from a root text node: \".concat(Scrubber.stringify(root)));\n }\n\n var newRoot = produce({\n children: root.children\n }, r => {\n var [start, end] = Range.edges(range);\n var nodeEntries = Node.nodes(r, {\n reverse: true,\n pass: _ref => {\n var [, path] = _ref;\n return !Range.includes(range, path);\n }\n });\n\n for (var [, path] of nodeEntries) {\n if (!Range.includes(range, path)) {\n var parent = Node.parent(r, path);\n var index = path[path.length - 1];\n parent.children.splice(index, 1);\n }\n\n if (Path.equals(path, end.path)) {\n var leaf = Node.leaf(r, path);\n leaf.text = leaf.text.slice(0, end.offset);\n }\n\n if (Path.equals(path, start.path)) {\n var _leaf = Node.leaf(r, path);\n\n _leaf.text = _leaf.text.slice(start.offset);\n }\n }\n\n if (Editor.isEditor(r)) {\n r.selection = null;\n }\n });\n return newRoot.children;\n },\n\n /**\r\n * Get the descendant node referred to by a specific path. If the path is an\r\n * empty array, it refers to the root node itself.\r\n */\n get(root, path) {\n var node = root;\n\n for (var i = 0; i < path.length; i++) {\n var p = path[i];\n\n if (Text.isText(node) || !node.children[p]) {\n throw new Error(\"Cannot find a descendant at path [\".concat(path, \"] in node: \").concat(Scrubber.stringify(root)));\n }\n\n node = node.children[p];\n }\n\n return node;\n },\n\n /**\r\n * Check if a descendant node exists at a specific path.\r\n */\n has(root, path) {\n var node = root;\n\n for (var i = 0; i < path.length; i++) {\n var p = path[i];\n\n if (Text.isText(node) || !node.children[p]) {\n return false;\n }\n\n node = node.children[p];\n }\n\n return true;\n },\n\n /**\r\n * Check if a value implements the `Node` interface.\r\n */\n isNode(value) {\n return Text.isText(value) || Element.isElement(value) || Editor.isEditor(value);\n },\n\n /**\r\n * Check if a value is a list of `Node` objects.\r\n */\n isNodeList(value) {\n if (!Array.isArray(value)) {\n return false;\n }\n\n var cachedResult = IS_NODE_LIST_CACHE.get(value);\n\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n\n var isNodeList = value.every(val => Node.isNode(val));\n IS_NODE_LIST_CACHE.set(value, isNodeList);\n return isNodeList;\n },\n\n /**\r\n * Get the last node entry in a root node from a path.\r\n */\n last(root, path) {\n var p = path.slice();\n var n = Node.get(root, p);\n\n while (n) {\n if (Text.isText(n) || n.children.length === 0) {\n break;\n } else {\n var i = n.children.length - 1;\n n = n.children[i];\n p.push(i);\n }\n }\n\n return [n, p];\n },\n\n /**\r\n * Get the node at a specific path, ensuring it's a leaf text node.\r\n */\n leaf(root, path) {\n var node = Node.get(root, path);\n\n if (!Text.isText(node)) {\n throw new Error(\"Cannot get the leaf node at path [\".concat(path, \"] because it refers to a non-leaf node: \").concat(Scrubber.stringify(node)));\n }\n\n return node;\n },\n\n /**\r\n * Return a generator of the in a branch of the tree, from a specific path.\r\n *\r\n * By default the order is top-down, from highest to lowest node in the tree,\r\n * but you can pass the `reverse: true` option to go bottom-up.\r\n */\n *levels(root, path) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n for (var p of Path.levels(path, options)) {\n var n = Node.get(root, p);\n yield [n, p];\n }\n },\n\n /**\r\n * Check if a node matches a set of props.\r\n */\n matches(node, props) {\n return Element.isElement(node) && Element.isElementProps(props) && Element.matches(node, props) || Text.isText(node) && Text.isTextProps(props) && Text.matches(node, props);\n },\n\n /**\r\n * Return a generator of all the node entries of a root node. Each entry is\r\n * returned as a `[Node, Path]` tuple, with the path referring to the node's\r\n * position inside the root node.\r\n */\n *nodes(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n pass,\n reverse = false\n } = options;\n var {\n from = [],\n to\n } = options;\n var visited = new Set();\n var p = [];\n var n = root;\n\n while (true) {\n if (to && (reverse ? Path.isBefore(p, to) : Path.isAfter(p, to))) {\n break;\n }\n\n if (!visited.has(n)) {\n yield [n, p];\n } // If we're allowed to go downward and we haven't descended yet, do.\n\n\n if (!visited.has(n) && !Text.isText(n) && n.children.length !== 0 && (pass == null || pass([n, p]) === false)) {\n visited.add(n);\n var nextIndex = reverse ? n.children.length - 1 : 0;\n\n if (Path.isAncestor(p, from)) {\n nextIndex = from[p.length];\n }\n\n p = p.concat(nextIndex);\n n = Node.get(root, p);\n continue;\n } // If we're at the root and we can't go down, we're done.\n\n\n if (p.length === 0) {\n break;\n } // If we're going forward...\n\n\n if (!reverse) {\n var newPath = Path.next(p);\n\n if (Node.has(root, newPath)) {\n p = newPath;\n n = Node.get(root, p);\n continue;\n }\n } // If we're going backward...\n\n\n if (reverse && p[p.length - 1] !== 0) {\n var _newPath = Path.previous(p);\n\n p = _newPath;\n n = Node.get(root, p);\n continue;\n } // Otherwise we're going upward...\n\n\n p = Path.parent(p);\n n = Node.get(root, p);\n visited.add(n);\n }\n },\n\n /**\r\n * Get the parent of a node at a specific path.\r\n */\n parent(root, path) {\n var parentPath = Path.parent(path);\n var p = Node.get(root, parentPath);\n\n if (Text.isText(p)) {\n throw new Error(\"Cannot get the parent of path [\".concat(path, \"] because it does not exist in the root.\"));\n }\n\n return p;\n },\n\n /**\r\n * Get the concatenated text string of a node's content.\r\n *\r\n * Note that this will not include spaces or line breaks between block nodes.\r\n * It is not a user-facing string, but a string for performing offset-related\r\n * computations for a node.\r\n */\n string(node) {\n if (Text.isText(node)) {\n return node.text;\n } else {\n return node.children.map(Node.string).join('');\n }\n },\n\n /**\r\n * Return a generator of all leaf text nodes in a root node.\r\n */\n *texts(root) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var [node, path] of Node.nodes(root, options)) {\n if (Text.isText(node)) {\n yield [node, path];\n }\n }\n }\n\n};\n\nfunction ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar Operation = {\n /**\r\n * Check if a value is a `NodeOperation` object.\r\n */\n isNodeOperation(value) {\n return Operation.isOperation(value) && value.type.endsWith('_node');\n },\n\n /**\r\n * Check if a value is an `Operation` object.\r\n */\n isOperation(value) {\n if (!isPlainObject(value)) {\n return false;\n }\n\n switch (value.type) {\n case 'insert_node':\n return Path.isPath(value.path) && Node.isNode(value.node);\n\n case 'insert_text':\n return typeof value.offset === 'number' && typeof value.text === 'string' && Path.isPath(value.path);\n\n case 'merge_node':\n return typeof value.position === 'number' && Path.isPath(value.path) && isPlainObject(value.properties);\n\n case 'move_node':\n return Path.isPath(value.path) && Path.isPath(value.newPath);\n\n case 'remove_node':\n return Path.isPath(value.path) && Node.isNode(value.node);\n\n case 'remove_text':\n return typeof value.offset === 'number' && typeof value.text === 'string' && Path.isPath(value.path);\n\n case 'set_node':\n return Path.isPath(value.path) && isPlainObject(value.properties) && isPlainObject(value.newProperties);\n\n case 'set_selection':\n return value.properties === null && Range.isRange(value.newProperties) || value.newProperties === null && Range.isRange(value.properties) || isPlainObject(value.properties) && isPlainObject(value.newProperties);\n\n case 'split_node':\n return Path.isPath(value.path) && typeof value.position === 'number' && isPlainObject(value.properties);\n\n default:\n return false;\n }\n },\n\n /**\r\n * Check if a value is a list of `Operation` objects.\r\n */\n isOperationList(value) {\n return Array.isArray(value) && value.every(val => Operation.isOperation(val));\n },\n\n /**\r\n * Check if a value is a `SelectionOperation` object.\r\n */\n isSelectionOperation(value) {\n return Operation.isOperation(value) && value.type.endsWith('_selection');\n },\n\n /**\r\n * Check if a value is a `TextOperation` object.\r\n */\n isTextOperation(value) {\n return Operation.isOperation(value) && value.type.endsWith('_text');\n },\n\n /**\r\n * Invert an operation, returning a new operation that will exactly undo the\r\n * original when applied.\r\n */\n inverse(op) {\n switch (op.type) {\n case 'insert_node':\n {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n type: 'remove_node'\n });\n }\n\n case 'insert_text':\n {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n type: 'remove_text'\n });\n }\n\n case 'merge_node':\n {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n type: 'split_node',\n path: Path.previous(op.path)\n });\n }\n\n case 'move_node':\n {\n var {\n newPath,\n path\n } = op; // PERF: in this case the move operation is a no-op anyways.\n\n if (Path.equals(newPath, path)) {\n return op;\n } // If the move happens completely within a single parent the path and\n // newPath are stable with respect to each other.\n\n\n if (Path.isSibling(path, newPath)) {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n path: newPath,\n newPath: path\n });\n } // If the move does not happen within a single parent it is possible\n // for the move to impact the true path to the location where the node\n // was removed from and where it was inserted. We have to adjust for this\n // and find the original path. We can accomplish this (only in non-sibling)\n // moves by looking at the impact of the move operation on the node\n // after the original move path.\n\n\n var inversePath = Path.transform(path, op);\n var inverseNewPath = Path.transform(Path.next(path), op);\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n path: inversePath,\n newPath: inverseNewPath\n });\n }\n\n case 'remove_node':\n {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n type: 'insert_node'\n });\n }\n\n case 'remove_text':\n {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n type: 'insert_text'\n });\n }\n\n case 'set_node':\n {\n var {\n properties,\n newProperties\n } = op;\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n properties: newProperties,\n newProperties: properties\n });\n }\n\n case 'set_selection':\n {\n var {\n properties: _properties,\n newProperties: _newProperties\n } = op;\n\n if (_properties == null) {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n properties: _newProperties,\n newProperties: null\n });\n } else if (_newProperties == null) {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n properties: null,\n newProperties: _properties\n });\n } else {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n properties: _newProperties,\n newProperties: _properties\n });\n }\n }\n\n case 'split_node':\n {\n return _objectSpread$7(_objectSpread$7({}, op), {}, {\n type: 'merge_node',\n path: Path.next(op.path)\n });\n }\n }\n }\n\n};\n\n// eslint-disable-next-line no-redeclare\nvar Path = {\n /**\r\n * Get a list of ancestor paths for a given path.\r\n *\r\n * The paths are sorted from shallowest to deepest ancestor. However, if the\r\n * `reverse: true` option is passed, they are reversed.\r\n */\n ancestors(path) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n reverse = false\n } = options;\n var paths = Path.levels(path, options);\n\n if (reverse) {\n paths = paths.slice(1);\n } else {\n paths = paths.slice(0, -1);\n }\n\n return paths;\n },\n\n /**\r\n * Get the common ancestor path of two paths.\r\n */\n common(path, another) {\n var common = [];\n\n for (var i = 0; i < path.length && i < another.length; i++) {\n var av = path[i];\n var bv = another[i];\n\n if (av !== bv) {\n break;\n }\n\n common.push(av);\n }\n\n return common;\n },\n\n /**\r\n * Compare a path to another, returning an integer indicating whether the path\r\n * was before, at, or after the other.\r\n *\r\n * Note: Two paths of unequal length can still receive a `0` result if one is\r\n * directly above or below the other. If you want exact matching, use\r\n * [[Path.equals]] instead.\r\n */\n compare(path, another) {\n var min = Math.min(path.length, another.length);\n\n for (var i = 0; i < min; i++) {\n if (path[i] < another[i]) return -1;\n if (path[i] > another[i]) return 1;\n }\n\n return 0;\n },\n\n /**\r\n * Check if a path ends after one of the indexes in another.\r\n */\n endsAfter(path, another) {\n var i = path.length - 1;\n var as = path.slice(0, i);\n var bs = another.slice(0, i);\n var av = path[i];\n var bv = another[i];\n return Path.equals(as, bs) && av > bv;\n },\n\n /**\r\n * Check if a path ends at one of the indexes in another.\r\n */\n endsAt(path, another) {\n var i = path.length;\n var as = path.slice(0, i);\n var bs = another.slice(0, i);\n return Path.equals(as, bs);\n },\n\n /**\r\n * Check if a path ends before one of the indexes in another.\r\n */\n endsBefore(path, another) {\n var i = path.length - 1;\n var as = path.slice(0, i);\n var bs = another.slice(0, i);\n var av = path[i];\n var bv = another[i];\n return Path.equals(as, bs) && av < bv;\n },\n\n /**\r\n * Check if a path is exactly equal to another.\r\n */\n equals(path, another) {\n return path.length === another.length && path.every((n, i) => n === another[i]);\n },\n\n /**\r\n * Check if the path of previous sibling node exists\r\n */\n hasPrevious(path) {\n return path[path.length - 1] > 0;\n },\n\n /**\r\n * Check if a path is after another.\r\n */\n isAfter(path, another) {\n return Path.compare(path, another) === 1;\n },\n\n /**\r\n * Check if a path is an ancestor of another.\r\n */\n isAncestor(path, another) {\n return path.length < another.length && Path.compare(path, another) === 0;\n },\n\n /**\r\n * Check if a path is before another.\r\n */\n isBefore(path, another) {\n return Path.compare(path, another) === -1;\n },\n\n /**\r\n * Check if a path is a child of another.\r\n */\n isChild(path, another) {\n return path.length === another.length + 1 && Path.compare(path, another) === 0;\n },\n\n /**\r\n * Check if a path is equal to or an ancestor of another.\r\n */\n isCommon(path, another) {\n return path.length <= another.length && Path.compare(path, another) === 0;\n },\n\n /**\r\n * Check if a path is a descendant of another.\r\n */\n isDescendant(path, another) {\n return path.length > another.length && Path.compare(path, another) === 0;\n },\n\n /**\r\n * Check if a path is the parent of another.\r\n */\n isParent(path, another) {\n return path.length + 1 === another.length && Path.compare(path, another) === 0;\n },\n\n /**\r\n * Check is a value implements the `Path` interface.\r\n */\n isPath(value) {\n return Array.isArray(value) && (value.length === 0 || typeof value[0] === 'number');\n },\n\n /**\r\n * Check if a path is a sibling of another.\r\n */\n isSibling(path, another) {\n if (path.length !== another.length) {\n return false;\n }\n\n var as = path.slice(0, -1);\n var bs = another.slice(0, -1);\n var al = path[path.length - 1];\n var bl = another[another.length - 1];\n return al !== bl && Path.equals(as, bs);\n },\n\n /**\r\n * Get a list of paths at every level down to a path. Note: this is the same\r\n * as `Path.ancestors`, but including the path itself.\r\n *\r\n * The paths are sorted from shallowest to deepest. However, if the `reverse:\r\n * true` option is passed, they are reversed.\r\n */\n levels(path) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n reverse = false\n } = options;\n var list = [];\n\n for (var i = 0; i <= path.length; i++) {\n list.push(path.slice(0, i));\n }\n\n if (reverse) {\n list.reverse();\n }\n\n return list;\n },\n\n /**\r\n * Given a path, get the path to the next sibling node.\r\n */\n next(path) {\n if (path.length === 0) {\n throw new Error(\"Cannot get the next path of a root path [\".concat(path, \"], because it has no next index.\"));\n }\n\n var last = path[path.length - 1];\n return path.slice(0, -1).concat(last + 1);\n },\n\n /**\r\n * Returns whether this operation can affect paths or not. Used as an\r\n * optimization when updating dirty paths during normalization\r\n *\r\n * NOTE: This *must* be kept in sync with the implementation of 'transform'\r\n * below\r\n */\n operationCanTransformPath(operation) {\n switch (operation.type) {\n case 'insert_node':\n case 'remove_node':\n case 'merge_node':\n case 'split_node':\n case 'move_node':\n return true;\n\n default:\n return false;\n }\n },\n\n /**\r\n * Given a path, return a new path referring to the parent node above it.\r\n */\n parent(path) {\n if (path.length === 0) {\n throw new Error(\"Cannot get the parent path of the root path [\".concat(path, \"].\"));\n }\n\n return path.slice(0, -1);\n },\n\n /**\r\n * Given a path, get the path to the previous sibling node.\r\n */\n previous(path) {\n if (path.length === 0) {\n throw new Error(\"Cannot get the previous path of a root path [\".concat(path, \"], because it has no previous index.\"));\n }\n\n var last = path[path.length - 1];\n\n if (last <= 0) {\n throw new Error(\"Cannot get the previous path of a first child path [\".concat(path, \"] because it would result in a negative index.\"));\n }\n\n return path.slice(0, -1).concat(last - 1);\n },\n\n /**\r\n * Get a path relative to an ancestor.\r\n */\n relative(path, ancestor) {\n if (!Path.isAncestor(ancestor, path) && !Path.equals(path, ancestor)) {\n throw new Error(\"Cannot get the relative path of [\".concat(path, \"] inside ancestor [\").concat(ancestor, \"], because it is not above or equal to the path.\"));\n }\n\n return path.slice(ancestor.length);\n },\n\n /**\r\n * Transform a path by an operation.\r\n */\n transform(path, operation) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (!path) return null; // PERF: use destructing instead of immer\n\n var p = [...path];\n var {\n affinity = 'forward'\n } = options; // PERF: Exit early if the operation is guaranteed not to have an effect.\n\n if (path.length === 0) {\n return p;\n }\n\n switch (operation.type) {\n case 'insert_node':\n {\n var {\n path: op\n } = operation;\n\n if (Path.equals(op, p) || Path.endsBefore(op, p) || Path.isAncestor(op, p)) {\n p[op.length - 1] += 1;\n }\n\n break;\n }\n\n case 'remove_node':\n {\n var {\n path: _op\n } = operation;\n\n if (Path.equals(_op, p) || Path.isAncestor(_op, p)) {\n return null;\n } else if (Path.endsBefore(_op, p)) {\n p[_op.length - 1] -= 1;\n }\n\n break;\n }\n\n case 'merge_node':\n {\n var {\n path: _op2,\n position\n } = operation;\n\n if (Path.equals(_op2, p) || Path.endsBefore(_op2, p)) {\n p[_op2.length - 1] -= 1;\n } else if (Path.isAncestor(_op2, p)) {\n p[_op2.length - 1] -= 1;\n p[_op2.length] += position;\n }\n\n break;\n }\n\n case 'split_node':\n {\n var {\n path: _op3,\n position: _position\n } = operation;\n\n if (Path.equals(_op3, p)) {\n if (affinity === 'forward') {\n p[p.length - 1] += 1;\n } else if (affinity === 'backward') ; else {\n return null;\n }\n } else if (Path.endsBefore(_op3, p)) {\n p[_op3.length - 1] += 1;\n } else if (Path.isAncestor(_op3, p) && path[_op3.length] >= _position) {\n p[_op3.length - 1] += 1;\n p[_op3.length] -= _position;\n }\n\n break;\n }\n\n case 'move_node':\n {\n var {\n path: _op4,\n newPath: onp\n } = operation; // If the old and new path are the same, it's a no-op.\n\n if (Path.equals(_op4, onp)) {\n return p;\n }\n\n if (Path.isAncestor(_op4, p) || Path.equals(_op4, p)) {\n var copy = onp.slice();\n\n if (Path.endsBefore(_op4, onp) && _op4.length < onp.length) {\n copy[_op4.length - 1] -= 1;\n }\n\n return copy.concat(p.slice(_op4.length));\n } else if (Path.isSibling(_op4, onp) && (Path.isAncestor(onp, p) || Path.equals(onp, p))) {\n if (Path.endsBefore(_op4, p)) {\n p[_op4.length - 1] -= 1;\n } else {\n p[_op4.length - 1] += 1;\n }\n } else if (Path.endsBefore(onp, p) || Path.equals(onp, p) || Path.isAncestor(onp, p)) {\n if (Path.endsBefore(_op4, p)) {\n p[_op4.length - 1] -= 1;\n }\n\n p[onp.length - 1] += 1;\n } else if (Path.endsBefore(_op4, p)) {\n if (Path.equals(onp, p)) {\n p[onp.length - 1] += 1;\n }\n\n p[_op4.length - 1] -= 1;\n }\n\n break;\n }\n }\n\n return p;\n }\n\n};\n\nvar PathRef = {\n /**\r\n * Transform the path ref's current value by an operation.\r\n */\n transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var path = Path.transform(current, op, {\n affinity\n });\n ref.current = path;\n\n if (path == null) {\n ref.unref();\n }\n }\n\n};\n\nfunction ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar Point = {\n /**\r\n * Compare a point to another, returning an integer indicating whether the\r\n * point was before, at, or after the other.\r\n */\n compare(point, another) {\n var result = Path.compare(point.path, another.path);\n\n if (result === 0) {\n if (point.offset < another.offset) return -1;\n if (point.offset > another.offset) return 1;\n return 0;\n }\n\n return result;\n },\n\n /**\r\n * Check if a point is after another.\r\n */\n isAfter(point, another) {\n return Point.compare(point, another) === 1;\n },\n\n /**\r\n * Check if a point is before another.\r\n */\n isBefore(point, another) {\n return Point.compare(point, another) === -1;\n },\n\n /**\r\n * Check if a point is exactly equal to another.\r\n */\n equals(point, another) {\n // PERF: ensure the offsets are equal first since they are cheaper to check.\n return point.offset === another.offset && Path.equals(point.path, another.path);\n },\n\n /**\r\n * Check if a value implements the `Point` interface.\r\n */\n isPoint(value) {\n return isPlainObject(value) && typeof value.offset === 'number' && Path.isPath(value.path);\n },\n\n /**\r\n * Transform a point by an operation.\r\n */\n transform(point, op) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return produce(point, p => {\n if (p === null) {\n return null;\n }\n\n var {\n affinity = 'forward'\n } = options;\n var {\n path,\n offset\n } = p;\n\n switch (op.type) {\n case 'insert_node':\n case 'move_node':\n {\n p.path = Path.transform(path, op, options);\n break;\n }\n\n case 'insert_text':\n {\n if (Path.equals(op.path, path) && (op.offset < offset || op.offset === offset && affinity === 'forward')) {\n p.offset += op.text.length;\n }\n\n break;\n }\n\n case 'merge_node':\n {\n if (Path.equals(op.path, path)) {\n p.offset += op.position;\n }\n\n p.path = Path.transform(path, op, options);\n break;\n }\n\n case 'remove_text':\n {\n if (Path.equals(op.path, path) && op.offset <= offset) {\n p.offset -= Math.min(offset - op.offset, op.text.length);\n }\n\n break;\n }\n\n case 'remove_node':\n {\n if (Path.equals(op.path, path) || Path.isAncestor(op.path, path)) {\n return null;\n }\n\n p.path = Path.transform(path, op, options);\n break;\n }\n\n case 'split_node':\n {\n if (Path.equals(op.path, path)) {\n if (op.position === offset && affinity == null) {\n return null;\n } else if (op.position < offset || op.position === offset && affinity === 'forward') {\n p.offset -= op.position;\n p.path = Path.transform(path, op, _objectSpread$6(_objectSpread$6({}, options), {}, {\n affinity: 'forward'\n }));\n }\n } else {\n p.path = Path.transform(path, op, options);\n }\n\n break;\n }\n }\n });\n }\n\n};\n\nvar PointRef = {\n /**\r\n * Transform the point ref's current value by an operation.\r\n */\n transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var point = Point.transform(current, op, {\n affinity\n });\n ref.current = point;\n\n if (point == null) {\n ref.unref();\n }\n }\n\n};\n\nvar _excluded$2 = [\"anchor\", \"focus\"];\n\nfunction ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar Range = {\n /**\r\n * Get the start and end points of a range, in the order in which they appear\r\n * in the document.\r\n */\n edges(range) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n reverse = false\n } = options;\n var {\n anchor,\n focus\n } = range;\n return Range.isBackward(range) === reverse ? [anchor, focus] : [focus, anchor];\n },\n\n /**\r\n * Get the end point of a range.\r\n */\n end(range) {\n var [, end] = Range.edges(range);\n return end;\n },\n\n /**\r\n * Check if a range is exactly equal to another.\r\n */\n equals(range, another) {\n return Point.equals(range.anchor, another.anchor) && Point.equals(range.focus, another.focus);\n },\n\n /**\r\n * Check if a range includes a path, a point or part of another range.\r\n */\n includes(range, target) {\n if (Range.isRange(target)) {\n if (Range.includes(range, target.anchor) || Range.includes(range, target.focus)) {\n return true;\n }\n\n var [rs, re] = Range.edges(range);\n var [ts, te] = Range.edges(target);\n return Point.isBefore(rs, ts) && Point.isAfter(re, te);\n }\n\n var [start, end] = Range.edges(range);\n var isAfterStart = false;\n var isBeforeEnd = false;\n\n if (Point.isPoint(target)) {\n isAfterStart = Point.compare(target, start) >= 0;\n isBeforeEnd = Point.compare(target, end) <= 0;\n } else {\n isAfterStart = Path.compare(target, start.path) >= 0;\n isBeforeEnd = Path.compare(target, end.path) <= 0;\n }\n\n return isAfterStart && isBeforeEnd;\n },\n\n /**\r\n * Get the intersection of a range with another.\r\n */\n intersection(range, another) {\n var rest = _objectWithoutProperties(range, _excluded$2);\n\n var [s1, e1] = Range.edges(range);\n var [s2, e2] = Range.edges(another);\n var start = Point.isBefore(s1, s2) ? s2 : s1;\n var end = Point.isBefore(e1, e2) ? e1 : e2;\n\n if (Point.isBefore(end, start)) {\n return null;\n } else {\n return _objectSpread$5({\n anchor: start,\n focus: end\n }, rest);\n }\n },\n\n /**\r\n * Check if a range is backward, meaning that its anchor point appears in the\r\n * document _after_ its focus point.\r\n */\n isBackward(range) {\n var {\n anchor,\n focus\n } = range;\n return Point.isAfter(anchor, focus);\n },\n\n /**\r\n * Check if a range is collapsed, meaning that both its anchor and focus\r\n * points refer to the exact same position in the document.\r\n */\n isCollapsed(range) {\n var {\n anchor,\n focus\n } = range;\n return Point.equals(anchor, focus);\n },\n\n /**\r\n * Check if a range is expanded.\r\n *\r\n * This is the opposite of [[Range.isCollapsed]] and is provided for legibility.\r\n */\n isExpanded(range) {\n return !Range.isCollapsed(range);\n },\n\n /**\r\n * Check if a range is forward.\r\n *\r\n * This is the opposite of [[Range.isBackward]] and is provided for legibility.\r\n */\n isForward(range) {\n return !Range.isBackward(range);\n },\n\n /**\r\n * Check if a value implements the [[Range]] interface.\r\n */\n isRange(value) {\n return isPlainObject(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus);\n },\n\n /**\r\n * Iterate through all of the point entries in a range.\r\n */\n *points(range) {\n yield [range.anchor, 'anchor'];\n yield [range.focus, 'focus'];\n },\n\n /**\r\n * Get the start point of a range.\r\n */\n start(range) {\n var [start] = Range.edges(range);\n return start;\n },\n\n /**\r\n * Transform a range by an operation.\r\n */\n transform(range, op) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return produce(range, r => {\n if (r === null) {\n return null;\n }\n\n var {\n affinity = 'inward'\n } = options;\n var affinityAnchor;\n var affinityFocus;\n\n if (affinity === 'inward') {\n // If the range is collapsed, make sure to use the same affinity to\n // avoid the two points passing each other and expanding in the opposite\n // direction\n var isCollapsed = Range.isCollapsed(r);\n\n if (Range.isForward(r)) {\n affinityAnchor = 'forward';\n affinityFocus = isCollapsed ? affinityAnchor : 'backward';\n } else {\n affinityAnchor = 'backward';\n affinityFocus = isCollapsed ? affinityAnchor : 'forward';\n }\n } else if (affinity === 'outward') {\n if (Range.isForward(r)) {\n affinityAnchor = 'backward';\n affinityFocus = 'forward';\n } else {\n affinityAnchor = 'forward';\n affinityFocus = 'backward';\n }\n } else {\n affinityAnchor = affinity;\n affinityFocus = affinity;\n }\n\n var anchor = Point.transform(r.anchor, op, {\n affinity: affinityAnchor\n });\n var focus = Point.transform(r.focus, op, {\n affinity: affinityFocus\n });\n\n if (!anchor || !focus) {\n return null;\n }\n\n r.anchor = anchor;\n r.focus = focus;\n });\n }\n\n};\n\nvar RangeRef = {\n /**\r\n * Transform the range ref's current value by an operation.\r\n */\n transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var path = Range.transform(current, op, {\n affinity\n });\n ref.current = path;\n\n if (path == null) {\n ref.unref();\n }\n }\n\n};\n\nvar _scrubber = undefined;\n/**\r\n * This interface implements a stringify() function, which is used by Slate\r\n * internally when generating exceptions containing end user data. Developers\r\n * using Slate may call Scrubber.setScrubber() to alter the behavior of this\r\n * stringify() function.\r\n *\r\n * For example, to prevent the cleartext logging of 'text' fields within Nodes:\r\n *\r\n * import { Scrubber } from 'slate';\r\n * Scrubber.setScrubber((key, val) => {\r\n * if (key === 'text') return '...scrubbed...'\r\n * return val\r\n * });\r\n *\r\n */\n// eslint-disable-next-line no-redeclare\n\nvar Scrubber = {\n setScrubber(scrubber) {\n _scrubber = scrubber;\n },\n\n stringify(value) {\n return JSON.stringify(value, _scrubber);\n }\n\n};\n\n/*\r\n Custom deep equal comparison for Slate nodes.\r\n\n We don't need general purpose deep equality;\r\n Slate only supports plain values, Arrays, and nested objects.\r\n Complex values nested inside Arrays are not supported.\r\n\n Slate objects are designed to be serialised, so\r\n missing keys are deliberately normalised to undefined.\r\n */\n\nvar isDeepEqual = (node, another) => {\n for (var key in node) {\n var a = node[key];\n var b = another[key];\n\n if (isPlainObject(a) && isPlainObject(b)) {\n if (!isDeepEqual(a, b)) return false;\n } else if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n } else if (a !== b) {\n return false;\n }\n }\n /*\r\n Deep object equality is only necessary in one direction; in the reverse direction\r\n we are only looking for keys that are missing.\r\n As above, undefined keys are normalised to missing.\r\n */\n\n\n for (var _key in another) {\n if (node[_key] === undefined && another[_key] !== undefined) {\n return false;\n }\n }\n\n return true;\n};\n\nvar _excluded$1 = [\"text\"],\n _excluded2$1 = [\"anchor\", \"focus\"];\n\nfunction ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar Text = {\n /**\r\n * Check if two text nodes are equal.\r\n *\r\n * When loose is set, the text is not compared. This is\r\n * used to check whether sibling text nodes can be merged.\r\n */\n equals(text, another) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n loose = false\n } = options;\n\n function omitText(obj) {\n var rest = _objectWithoutProperties(obj, _excluded$1);\n\n return rest;\n }\n\n return isDeepEqual(loose ? omitText(text) : text, loose ? omitText(another) : another);\n },\n\n /**\r\n * Check if a value implements the `Text` interface.\r\n */\n isText(value) {\n return isPlainObject(value) && typeof value.text === 'string';\n },\n\n /**\r\n * Check if a value is a list of `Text` objects.\r\n */\n isTextList(value) {\n return Array.isArray(value) && value.every(val => Text.isText(val));\n },\n\n /**\r\n * Check if some props are a partial of Text.\r\n */\n isTextProps(props) {\n return props.text !== undefined;\n },\n\n /**\r\n * Check if an text matches set of properties.\r\n *\r\n * Note: this is for matching custom properties, and it does not ensure that\r\n * the `text` property are two nodes equal.\r\n */\n matches(text, props) {\n for (var key in props) {\n if (key === 'text') {\n continue;\n }\n\n if (!text.hasOwnProperty(key) || text[key] !== props[key]) {\n return false;\n }\n }\n\n return true;\n },\n\n /**\r\n * Get the leaves for a text node given decorations.\r\n */\n decorations(node, decorations) {\n var leaves = [_objectSpread$4({}, node)];\n\n for (var dec of decorations) {\n var rest = _objectWithoutProperties(dec, _excluded2$1);\n\n var [start, end] = Range.edges(dec);\n var next = [];\n var leafEnd = 0;\n var decorationStart = start.offset;\n var decorationEnd = end.offset;\n\n for (var leaf of leaves) {\n var {\n length\n } = leaf.text;\n var leafStart = leafEnd;\n leafEnd += length; // If the range encompasses the entire leaf, add the range.\n\n if (decorationStart <= leafStart && leafEnd <= decorationEnd) {\n Object.assign(leaf, rest);\n next.push(leaf);\n continue;\n } // If the range expanded and match the leaf, or starts after, or ends before it, continue.\n\n\n if (decorationStart !== decorationEnd && (decorationStart === leafEnd || decorationEnd === leafStart) || decorationStart > leafEnd || decorationEnd < leafStart || decorationEnd === leafStart && leafStart !== 0) {\n next.push(leaf);\n continue;\n } // Otherwise we need to split the leaf, at the start, end, or both,\n // and add the range to the middle intersecting section. Do the end\n // split first since we don't need to update the offset that way.\n\n\n var middle = leaf;\n var before = void 0;\n var after = void 0;\n\n if (decorationEnd < leafEnd) {\n var off = decorationEnd - leafStart;\n after = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(off)\n });\n middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(0, off)\n });\n }\n\n if (decorationStart > leafStart) {\n var _off = decorationStart - leafStart;\n\n before = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(0, _off)\n });\n middle = _objectSpread$4(_objectSpread$4({}, middle), {}, {\n text: middle.text.slice(_off)\n });\n }\n\n Object.assign(middle, rest);\n\n if (before) {\n next.push(before);\n }\n\n next.push(middle);\n\n if (after) {\n next.push(after);\n }\n }\n\n leaves = next;\n }\n\n return leaves;\n }\n\n};\n\nfunction ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar applyToDraft = (editor, selection, op) => {\n switch (op.type) {\n case 'insert_node':\n {\n var {\n path,\n node\n } = op;\n var parent = Node.parent(editor, path);\n var index = path[path.length - 1];\n\n if (index > parent.children.length) {\n throw new Error(\"Cannot apply an \\\"insert_node\\\" operation at path [\".concat(path, \"] because the destination is past the end of the node.\"));\n }\n\n parent.children.splice(index, 0, node);\n\n if (selection) {\n for (var [point, key] of Range.points(selection)) {\n selection[key] = Point.transform(point, op);\n }\n }\n\n break;\n }\n\n case 'insert_text':\n {\n var {\n path: _path,\n offset,\n text\n } = op;\n if (text.length === 0) break;\n\n var _node = Node.leaf(editor, _path);\n\n var before = _node.text.slice(0, offset);\n\n var after = _node.text.slice(offset);\n\n _node.text = before + text + after;\n\n if (selection) {\n for (var [_point, _key] of Range.points(selection)) {\n selection[_key] = Point.transform(_point, op);\n }\n }\n\n break;\n }\n\n case 'merge_node':\n {\n var {\n path: _path2\n } = op;\n\n var _node2 = Node.get(editor, _path2);\n\n var prevPath = Path.previous(_path2);\n var prev = Node.get(editor, prevPath);\n\n var _parent = Node.parent(editor, _path2);\n\n var _index = _path2[_path2.length - 1];\n\n if (Text.isText(_node2) && Text.isText(prev)) {\n prev.text += _node2.text;\n } else if (!Text.isText(_node2) && !Text.isText(prev)) {\n prev.children.push(..._node2.children);\n } else {\n throw new Error(\"Cannot apply a \\\"merge_node\\\" operation at path [\".concat(_path2, \"] to nodes of different interfaces: \").concat(Scrubber.stringify(_node2), \" \").concat(Scrubber.stringify(prev)));\n }\n\n _parent.children.splice(_index, 1);\n\n if (selection) {\n for (var [_point2, _key2] of Range.points(selection)) {\n selection[_key2] = Point.transform(_point2, op);\n }\n }\n\n break;\n }\n\n case 'move_node':\n {\n var {\n path: _path3,\n newPath\n } = op;\n\n if (Path.isAncestor(_path3, newPath)) {\n throw new Error(\"Cannot move a path [\".concat(_path3, \"] to new path [\").concat(newPath, \"] because the destination is inside itself.\"));\n }\n\n var _node3 = Node.get(editor, _path3);\n\n var _parent2 = Node.parent(editor, _path3);\n\n var _index2 = _path3[_path3.length - 1]; // This is tricky, but since the `path` and `newPath` both refer to\n // the same snapshot in time, there's a mismatch. After either\n // removing the original position, the second step's path can be out\n // of date. So instead of using the `op.newPath` directly, we\n // transform `op.path` to ascertain what the `newPath` would be after\n // the operation was applied.\n\n _parent2.children.splice(_index2, 1);\n\n var truePath = Path.transform(_path3, op);\n var newParent = Node.get(editor, Path.parent(truePath));\n var newIndex = truePath[truePath.length - 1];\n newParent.children.splice(newIndex, 0, _node3);\n\n if (selection) {\n for (var [_point3, _key3] of Range.points(selection)) {\n selection[_key3] = Point.transform(_point3, op);\n }\n }\n\n break;\n }\n\n case 'remove_node':\n {\n var {\n path: _path4\n } = op;\n var _index3 = _path4[_path4.length - 1];\n\n var _parent3 = Node.parent(editor, _path4);\n\n _parent3.children.splice(_index3, 1); // Transform all of the points in the value, but if the point was in the\n // node that was removed we need to update the range or remove it.\n\n\n if (selection) {\n for (var [_point4, _key4] of Range.points(selection)) {\n var result = Point.transform(_point4, op);\n\n if (selection != null && result != null) {\n selection[_key4] = result;\n } else {\n var _prev = void 0;\n\n var next = void 0;\n\n for (var [n, p] of Node.texts(editor)) {\n if (Path.compare(p, _path4) === -1) {\n _prev = [n, p];\n } else {\n next = [n, p];\n break;\n }\n }\n\n var preferNext = false;\n\n if (_prev && next) {\n if (Path.equals(next[1], _path4)) {\n preferNext = !Path.hasPrevious(next[1]);\n } else {\n preferNext = Path.common(_prev[1], _path4).length < Path.common(next[1], _path4).length;\n }\n }\n\n if (_prev && !preferNext) {\n _point4.path = _prev[1];\n _point4.offset = _prev[0].text.length;\n } else if (next) {\n _point4.path = next[1];\n _point4.offset = 0;\n } else {\n selection = null;\n }\n }\n }\n }\n\n break;\n }\n\n case 'remove_text':\n {\n var {\n path: _path5,\n offset: _offset,\n text: _text\n } = op;\n if (_text.length === 0) break;\n\n var _node4 = Node.leaf(editor, _path5);\n\n var _before = _node4.text.slice(0, _offset);\n\n var _after = _node4.text.slice(_offset + _text.length);\n\n _node4.text = _before + _after;\n\n if (selection) {\n for (var [_point5, _key5] of Range.points(selection)) {\n selection[_key5] = Point.transform(_point5, op);\n }\n }\n\n break;\n }\n\n case 'set_node':\n {\n var {\n path: _path6,\n properties,\n newProperties\n } = op;\n\n if (_path6.length === 0) {\n throw new Error(\"Cannot set properties on the root node!\");\n }\n\n var _node5 = Node.get(editor, _path6);\n\n for (var _key6 in newProperties) {\n if (_key6 === 'children' || _key6 === 'text') {\n throw new Error(\"Cannot set the \\\"\".concat(_key6, \"\\\" property of nodes!\"));\n }\n\n var value = newProperties[_key6];\n\n if (value == null) {\n delete _node5[_key6];\n } else {\n _node5[_key6] = value;\n }\n } // properties that were previously defined, but are now missing, must be deleted\n\n\n for (var _key7 in properties) {\n if (!newProperties.hasOwnProperty(_key7)) {\n delete _node5[_key7];\n }\n }\n\n break;\n }\n\n case 'set_selection':\n {\n var {\n newProperties: _newProperties\n } = op;\n\n if (_newProperties == null) {\n selection = _newProperties;\n } else {\n if (selection == null) {\n if (!Range.isRange(_newProperties)) {\n throw new Error(\"Cannot apply an incomplete \\\"set_selection\\\" operation properties \".concat(Scrubber.stringify(_newProperties), \" when there is no current selection.\"));\n }\n\n selection = _objectSpread$3({}, _newProperties);\n }\n\n for (var _key8 in _newProperties) {\n var _value = _newProperties[_key8];\n\n if (_value == null) {\n if (_key8 === 'anchor' || _key8 === 'focus') {\n throw new Error(\"Cannot remove the \\\"\".concat(_key8, \"\\\" selection property\"));\n }\n\n delete selection[_key8];\n } else {\n selection[_key8] = _value;\n }\n }\n }\n\n break;\n }\n\n case 'split_node':\n {\n var {\n path: _path7,\n position,\n properties: _properties\n } = op;\n\n if (_path7.length === 0) {\n throw new Error(\"Cannot apply a \\\"split_node\\\" operation at path [\".concat(_path7, \"] because the root node cannot be split.\"));\n }\n\n var _node6 = Node.get(editor, _path7);\n\n var _parent4 = Node.parent(editor, _path7);\n\n var _index4 = _path7[_path7.length - 1];\n var newNode;\n\n if (Text.isText(_node6)) {\n var _before2 = _node6.text.slice(0, position);\n\n var _after2 = _node6.text.slice(position);\n\n _node6.text = _before2;\n newNode = _objectSpread$3(_objectSpread$3({}, _properties), {}, {\n text: _after2\n });\n } else {\n var _before3 = _node6.children.slice(0, position);\n\n var _after3 = _node6.children.slice(position);\n\n _node6.children = _before3;\n newNode = _objectSpread$3(_objectSpread$3({}, _properties), {}, {\n children: _after3\n });\n }\n\n _parent4.children.splice(_index4 + 1, 0, newNode);\n\n if (selection) {\n for (var [_point6, _key9] of Range.points(selection)) {\n selection[_key9] = Point.transform(_point6, op);\n }\n }\n\n break;\n }\n }\n\n return selection;\n}; // eslint-disable-next-line no-redeclare\n\n\nvar GeneralTransforms = {\n /**\r\n * Transform the editor by an operation.\r\n */\n transform(editor, op) {\n editor.children = createDraft(editor.children);\n var selection = editor.selection && createDraft(editor.selection);\n\n try {\n selection = applyToDraft(editor, selection, op);\n } finally {\n editor.children = finishDraft(editor.children);\n\n if (selection) {\n editor.selection = isDraft(selection) ? finishDraft(selection) : selection;\n } else {\n editor.selection = null;\n }\n }\n }\n\n};\n\nvar _excluded = [\"text\"],\n _excluded2 = [\"children\"];\n\nfunction ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar NodeTransforms = {\n /**\r\n * Insert nodes at a specific location in the Editor.\r\n */\n insertNodes(editor, nodes) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n var {\n at,\n match,\n select\n } = options;\n\n if (Node.isNode(nodes)) {\n nodes = [nodes];\n }\n\n if (nodes.length === 0) {\n return;\n }\n\n var [node] = nodes; // By default, use the selection as the target location. But if there is\n // no selection, insert at the end of the document since that is such a\n // common use case when inserting from a non-selected state.\n\n if (!at) {\n if (editor.selection) {\n at = editor.selection;\n } else if (editor.children.length > 0) {\n at = Editor.end(editor, []);\n } else {\n at = [0];\n }\n\n select = true;\n }\n\n if (select == null) {\n select = false;\n }\n\n if (Range.isRange(at)) {\n if (!hanging) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n var [, end] = Range.edges(at);\n var pointRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at\n });\n at = pointRef.unref();\n }\n }\n\n if (Point.isPoint(at)) {\n if (match == null) {\n if (Text.isText(node)) {\n match = n => Text.isText(n);\n } else if (editor.isInline(node)) {\n match = n => Text.isText(n) || Editor.isInline(editor, n);\n } else {\n match = n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n }\n\n var [entry] = Editor.nodes(editor, {\n at: at.path,\n match,\n mode,\n voids\n });\n\n if (entry) {\n var [, _matchPath] = entry;\n var pathRef = Editor.pathRef(editor, _matchPath);\n var isAtEnd = Editor.isEnd(editor, at, _matchPath);\n Transforms.splitNodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var path = pathRef.unref();\n at = isAtEnd ? Path.next(path) : path;\n } else {\n return;\n }\n }\n\n var parentPath = Path.parent(at);\n var index = at[at.length - 1];\n\n if (!voids && Editor.void(editor, {\n at: parentPath\n })) {\n return;\n }\n\n for (var _node of nodes) {\n var _path = parentPath.concat(index);\n\n index++;\n editor.apply({\n type: 'insert_node',\n path: _path,\n node: _node\n });\n at = Path.next(at);\n }\n\n at = Path.previous(at);\n\n if (select) {\n var point = Editor.end(editor, at);\n\n if (point) {\n Transforms.select(editor, point);\n }\n }\n });\n },\n\n /**\r\n * Lift nodes at a specific location upwards in the document tree, splitting\r\n * their parent in two if necessary.\r\n */\n liftNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n at = editor.selection,\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match\n } = options;\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n\n if (!at) {\n return;\n }\n\n var matches = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var pathRefs = Array.from(matches, _ref => {\n var [, p] = _ref;\n return Editor.pathRef(editor, p);\n });\n\n for (var pathRef of pathRefs) {\n var path = pathRef.unref();\n\n if (path.length < 2) {\n throw new Error(\"Cannot lift node at a path [\".concat(path, \"] because it has a depth of less than `2`.\"));\n }\n\n var parentNodeEntry = Editor.node(editor, Path.parent(path));\n var [parent, parentPath] = parentNodeEntry;\n var index = path[path.length - 1];\n var {\n length\n } = parent.children;\n\n if (length === 1) {\n var toPath = Path.next(parentPath);\n Transforms.moveNodes(editor, {\n at: path,\n to: toPath,\n voids\n });\n Transforms.removeNodes(editor, {\n at: parentPath,\n voids\n });\n } else if (index === 0) {\n Transforms.moveNodes(editor, {\n at: path,\n to: parentPath,\n voids\n });\n } else if (index === length - 1) {\n var _toPath = Path.next(parentPath);\n\n Transforms.moveNodes(editor, {\n at: path,\n to: _toPath,\n voids\n });\n } else {\n var splitPath = Path.next(path);\n\n var _toPath2 = Path.next(parentPath);\n\n Transforms.splitNodes(editor, {\n at: splitPath,\n voids\n });\n Transforms.moveNodes(editor, {\n at: path,\n to: _toPath2,\n voids\n });\n }\n }\n });\n },\n\n /**\r\n * Merge a node at a location with the previous node of the same depth,\r\n * removing any empty containing nodes after the merge if necessary.\r\n */\n mergeNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n match,\n at = editor.selection\n } = options;\n var {\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n var [parent] = Editor.parent(editor, at);\n\n match = n => parent.children.includes(n);\n } else {\n match = n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n var [, end] = Range.edges(at);\n var pointRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at\n });\n at = pointRef.unref();\n\n if (options.at == null) {\n Transforms.select(editor, at);\n }\n }\n }\n\n var [current] = Editor.nodes(editor, {\n at,\n match,\n voids,\n mode\n });\n var prev = Editor.previous(editor, {\n at,\n match,\n voids,\n mode\n });\n\n if (!current || !prev) {\n return;\n }\n\n var [node, path] = current;\n var [prevNode, prevPath] = prev;\n\n if (path.length === 0 || prevPath.length === 0) {\n return;\n }\n\n var newPath = Path.next(prevPath);\n var commonPath = Path.common(path, prevPath);\n var isPreviousSibling = Path.isSibling(path, prevPath);\n var levels = Array.from(Editor.levels(editor, {\n at: path\n }), _ref2 => {\n var [n] = _ref2;\n return n;\n }).slice(commonPath.length).slice(0, -1); // Determine if the merge will leave an ancestor of the path empty as a\n // result, in which case we'll want to remove it after merging.\n\n var emptyAncestor = Editor.above(editor, {\n at: path,\n mode: 'highest',\n match: n => levels.includes(n) && hasSingleChildNest(editor, n)\n });\n var emptyRef = emptyAncestor && Editor.pathRef(editor, emptyAncestor[1]);\n var properties;\n var position; // Ensure that the nodes are equivalent, and figure out what the position\n // and extra properties of the merge will be.\n\n if (Text.isText(node) && Text.isText(prevNode)) {\n var rest = _objectWithoutProperties(node, _excluded);\n\n position = prevNode.text.length;\n properties = rest;\n } else if (Element.isElement(node) && Element.isElement(prevNode)) {\n var rest = _objectWithoutProperties(node, _excluded2);\n\n position = prevNode.children.length;\n properties = rest;\n } else {\n throw new Error(\"Cannot merge the node at path [\".concat(path, \"] with the previous sibling because it is not the same kind: \").concat(Scrubber.stringify(node), \" \").concat(Scrubber.stringify(prevNode)));\n } // If the node isn't already the next sibling of the previous node, move\n // it so that it is before merging.\n\n\n if (!isPreviousSibling) {\n Transforms.moveNodes(editor, {\n at: path,\n to: newPath,\n voids\n });\n } // If there was going to be an empty ancestor of the node that was merged,\n // we remove it from the tree.\n\n\n if (emptyRef) {\n Transforms.removeNodes(editor, {\n at: emptyRef.current,\n voids\n });\n } // If the target node that we're merging with is empty, remove it instead\n // of merging the two. This is a common rich text editor behavior to\n // prevent losing formatting when deleting entire nodes when you have a\n // hanging selection.\n // if prevNode is first child in parent,don't remove it.\n\n\n if (Element.isElement(prevNode) && Editor.isEmpty(editor, prevNode) || Text.isText(prevNode) && prevNode.text === '' && prevPath[prevPath.length - 1] !== 0) {\n Transforms.removeNodes(editor, {\n at: prevPath,\n voids\n });\n } else {\n editor.apply({\n type: 'merge_node',\n path: newPath,\n position,\n properties\n });\n }\n\n if (emptyRef) {\n emptyRef.unref();\n }\n });\n },\n\n /**\r\n * Move the nodes at a location to a new location.\r\n */\n moveNodes(editor, options) {\n Editor.withoutNormalizing(editor, () => {\n var {\n to,\n at = editor.selection,\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n\n var toRef = Editor.pathRef(editor, to);\n var targets = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var pathRefs = Array.from(targets, _ref3 => {\n var [, p] = _ref3;\n return Editor.pathRef(editor, p);\n });\n\n for (var pathRef of pathRefs) {\n var path = pathRef.unref();\n var newPath = toRef.current;\n\n if (path.length !== 0) {\n editor.apply({\n type: 'move_node',\n path,\n newPath\n });\n }\n\n if (toRef.current && Path.isSibling(newPath, path) && Path.isAfter(newPath, path)) {\n // When performing a sibling move to a later index, the path at the destination is shifted\n // to before the insertion point instead of after. To ensure our group of nodes are inserted\n // in the correct order we increment toRef to account for that\n toRef.current = Path.next(toRef.current);\n }\n }\n\n toRef.unref();\n });\n },\n\n /**\r\n * Remove the nodes at a specific location in the document.\r\n */\n removeNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n var {\n at = editor.selection,\n match\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n var depths = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var pathRefs = Array.from(depths, _ref4 => {\n var [, p] = _ref4;\n return Editor.pathRef(editor, p);\n });\n\n for (var pathRef of pathRefs) {\n var path = pathRef.unref();\n\n if (path) {\n var [node] = Editor.node(editor, path);\n editor.apply({\n type: 'remove_node',\n path,\n node\n });\n }\n }\n });\n },\n\n /**\r\n * Set new properties on the nodes at a location.\r\n */\n setNodes(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n match,\n at = editor.selection,\n compare,\n merge\n } = options;\n var {\n hanging = false,\n mode = 'lowest',\n split = false,\n voids = false\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n if (split && Range.isRange(at)) {\n if (Range.isCollapsed(at) && Editor.leaf(editor, at.anchor)[0].text.length > 0) {\n // If the range is collapsed in a non-empty node and 'split' is true, there's nothing to\n // set that won't get normalized away\n return;\n }\n\n var rangeRef = Editor.rangeRef(editor, at, {\n affinity: 'inward'\n });\n var [start, end] = Range.edges(at);\n var splitMode = mode === 'lowest' ? 'lowest' : 'highest';\n var endAtEndOfNode = Editor.isEnd(editor, end, end.path);\n Transforms.splitNodes(editor, {\n at: end,\n match,\n mode: splitMode,\n voids,\n always: !endAtEndOfNode\n });\n var startAtStartOfNode = Editor.isStart(editor, start, start.path);\n Transforms.splitNodes(editor, {\n at: start,\n match,\n mode: splitMode,\n voids,\n always: !startAtStartOfNode\n });\n at = rangeRef.unref();\n\n if (options.at == null) {\n Transforms.select(editor, at);\n }\n }\n\n if (!compare) {\n compare = (prop, nodeProp) => prop !== nodeProp;\n }\n\n for (var [node, path] of Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n })) {\n var properties = {};\n var newProperties = {}; // You can't set properties on the editor node.\n\n if (path.length === 0) {\n continue;\n }\n\n var hasChanges = false;\n\n for (var k in props) {\n if (k === 'children' || k === 'text') {\n continue;\n }\n\n if (compare(props[k], node[k])) {\n hasChanges = true; // Omit new properties from the old properties list\n\n if (node.hasOwnProperty(k)) properties[k] = node[k]; // Omit properties that have been removed from the new properties list\n\n if (merge) {\n if (props[k] != null) newProperties[k] = merge(node[k], props[k]);\n } else {\n if (props[k] != null) newProperties[k] = props[k];\n }\n }\n }\n\n if (hasChanges) {\n editor.apply({\n type: 'set_node',\n path,\n properties,\n newProperties\n });\n }\n }\n });\n },\n\n /**\r\n * Split the nodes at a specific location.\r\n */\n splitNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match,\n at = editor.selection,\n height = 0,\n always = false\n } = options;\n\n if (match == null) {\n match = n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n\n if (Range.isRange(at)) {\n at = deleteRange(editor, at);\n } // If the target is a path, the default height-skipping and position\n // counters need to account for us potentially splitting at a non-leaf.\n\n\n if (Path.isPath(at)) {\n var path = at;\n var point = Editor.point(editor, path);\n var [parent] = Editor.parent(editor, path);\n\n match = n => n === parent;\n\n height = point.path.length - path.length + 1;\n at = point;\n always = true;\n }\n\n if (!at) {\n return;\n }\n\n var beforeRef = Editor.pointRef(editor, at, {\n affinity: 'backward'\n });\n var afterRef;\n\n try {\n var [highest] = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n\n if (!highest) {\n return;\n }\n\n var voidMatch = Editor.void(editor, {\n at,\n mode: 'highest'\n });\n var nudge = 0;\n\n if (!voids && voidMatch) {\n var [voidNode, voidPath] = voidMatch;\n\n if (Element.isElement(voidNode) && editor.isInline(voidNode)) {\n var after = Editor.after(editor, voidPath);\n\n if (!after) {\n var text = {\n text: ''\n };\n var afterPath = Path.next(voidPath);\n Transforms.insertNodes(editor, text, {\n at: afterPath,\n voids\n });\n after = Editor.point(editor, afterPath);\n }\n\n at = after;\n always = true;\n }\n\n var siblingHeight = at.path.length - voidPath.length;\n height = siblingHeight + 1;\n always = true;\n }\n\n afterRef = Editor.pointRef(editor, at);\n var depth = at.path.length - height;\n var [, highestPath] = highest;\n var lowestPath = at.path.slice(0, depth);\n var position = height === 0 ? at.offset : at.path[depth] + nudge;\n\n for (var [node, _path2] of Editor.levels(editor, {\n at: lowestPath,\n reverse: true,\n voids\n })) {\n var split = false;\n\n if (_path2.length < highestPath.length || _path2.length === 0 || !voids && Element.isElement(node) && Editor.isVoid(editor, node)) {\n break;\n }\n\n var _point = beforeRef.current;\n var isEnd = Editor.isEnd(editor, _point, _path2);\n\n if (always || !beforeRef || !Editor.isEdge(editor, _point, _path2)) {\n split = true;\n var properties = Node.extractProps(node);\n editor.apply({\n type: 'split_node',\n path: _path2,\n position,\n properties\n });\n }\n\n position = _path2[_path2.length - 1] + (split || isEnd ? 1 : 0);\n }\n\n if (options.at == null) {\n var _point2 = afterRef.current || Editor.end(editor, []);\n\n Transforms.select(editor, _point2);\n }\n } finally {\n var _afterRef;\n\n beforeRef.unref();\n (_afterRef = afterRef) === null || _afterRef === void 0 ? void 0 : _afterRef.unref();\n }\n });\n },\n\n /**\r\n * Unset properties on the nodes at a location.\r\n */\n unsetNodes(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (!Array.isArray(props)) {\n props = [props];\n }\n\n var obj = {};\n\n for (var key of props) {\n obj[key] = null;\n }\n\n Transforms.setNodes(editor, obj, options);\n },\n\n /**\r\n * Unwrap the nodes at a location from a parent node, splitting the parent if\r\n * necessary to ensure that only the content in the range is unwrapped.\r\n */\n unwrapNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n mode = 'lowest',\n split = false,\n voids = false\n } = options;\n var {\n at = editor.selection,\n match\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at);\n }\n\n var rangeRef = Range.isRange(at) ? Editor.rangeRef(editor, at) : null;\n var matches = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var pathRefs = Array.from(matches, _ref5 => {\n var [, p] = _ref5;\n return Editor.pathRef(editor, p);\n } // unwrapNode will call liftNode which does not support splitting the node when nested.\n // If we do not reverse the order and call it from top to the bottom, it will remove all blocks\n // that wrap target node. So we reverse the order.\n ).reverse();\n\n var _loop = function _loop(pathRef) {\n var path = pathRef.unref();\n var [node] = Editor.node(editor, path);\n var range = Editor.range(editor, path);\n\n if (split && rangeRef) {\n range = Range.intersection(rangeRef.current, range);\n }\n\n Transforms.liftNodes(editor, {\n at: range,\n match: n => Element.isAncestor(node) && node.children.includes(n),\n voids\n });\n };\n\n for (var pathRef of pathRefs) {\n _loop(pathRef);\n }\n\n if (rangeRef) {\n rangeRef.unref();\n }\n });\n },\n\n /**\r\n * Wrap the nodes at a location in a new container node, splitting the edges\r\n * of the range first to ensure that only the content in the range is wrapped.\r\n */\n wrapNodes(editor, element) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n mode = 'lowest',\n split = false,\n voids = false\n } = options;\n var {\n match,\n at = editor.selection\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n match = matchPath(editor, at);\n } else if (editor.isInline(element)) {\n match = n => Element.isElement(n) && Editor.isInline(editor, n) || Text.isText(n);\n } else {\n match = n => Element.isElement(n) && Editor.isBlock(editor, n);\n }\n }\n\n if (split && Range.isRange(at)) {\n var [start, end] = Range.edges(at);\n var rangeRef = Editor.rangeRef(editor, at, {\n affinity: 'inward'\n });\n Transforms.splitNodes(editor, {\n at: end,\n match,\n voids\n });\n Transforms.splitNodes(editor, {\n at: start,\n match,\n voids\n });\n at = rangeRef.unref();\n\n if (options.at == null) {\n Transforms.select(editor, at);\n }\n }\n\n var roots = Array.from(Editor.nodes(editor, {\n at,\n match: editor.isInline(element) ? n => Element.isElement(n) && Editor.isBlock(editor, n) : n => Editor.isEditor(n),\n mode: 'lowest',\n voids\n }));\n\n for (var [, rootPath] of roots) {\n var a = Range.isRange(at) ? Range.intersection(at, Editor.range(editor, rootPath)) : at;\n\n if (!a) {\n continue;\n }\n\n var matches = Array.from(Editor.nodes(editor, {\n at: a,\n match,\n mode,\n voids\n }));\n\n if (matches.length > 0) {\n var _ret = function () {\n var [first] = matches;\n var last = matches[matches.length - 1];\n var [, firstPath] = first;\n var [, lastPath] = last;\n\n if (firstPath.length === 0 && lastPath.length === 0) {\n // if there's no matching parent - usually means the node is an editor - don't do anything\n return \"continue\";\n }\n\n var commonPath = Path.equals(firstPath, lastPath) ? Path.parent(firstPath) : Path.common(firstPath, lastPath);\n var range = Editor.range(editor, firstPath, lastPath);\n var commonNodeEntry = Editor.node(editor, commonPath);\n var [commonNode] = commonNodeEntry;\n var depth = commonPath.length + 1;\n var wrapperPath = Path.next(lastPath.slice(0, depth));\n\n var wrapper = _objectSpread$2(_objectSpread$2({}, element), {}, {\n children: []\n });\n\n Transforms.insertNodes(editor, wrapper, {\n at: wrapperPath,\n voids\n });\n Transforms.moveNodes(editor, {\n at: range,\n match: n => Element.isAncestor(commonNode) && commonNode.children.includes(n),\n to: wrapperPath.concat(0),\n voids\n });\n }();\n\n if (_ret === \"continue\") continue;\n }\n }\n });\n }\n\n};\n\nvar hasSingleChildNest = (editor, node) => {\n if (Element.isElement(node)) {\n var element = node;\n\n if (Editor.isVoid(editor, node)) {\n return true;\n } else if (element.children.length === 1) {\n return hasSingleChildNest(editor, element.children[0]);\n } else {\n return false;\n }\n } else if (Editor.isEditor(node)) {\n return false;\n } else {\n return true;\n }\n};\n/**\r\n * Convert a range into a point by deleting it's content.\r\n */\n\n\nvar deleteRange = (editor, range) => {\n if (Range.isCollapsed(range)) {\n return range.anchor;\n } else {\n var [, end] = Range.edges(range);\n var pointRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at: range\n });\n return pointRef.unref();\n }\n};\n\nvar matchPath = (editor, path) => {\n var [node] = Editor.node(editor, path);\n return n => n === node;\n};\n\nfunction ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar SelectionTransforms = {\n /**\r\n * Collapse the selection.\r\n */\n collapse(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n edge = 'anchor'\n } = options;\n var {\n selection\n } = editor;\n\n if (!selection) {\n return;\n } else if (edge === 'anchor') {\n Transforms.select(editor, selection.anchor);\n } else if (edge === 'focus') {\n Transforms.select(editor, selection.focus);\n } else if (edge === 'start') {\n var [start] = Range.edges(selection);\n Transforms.select(editor, start);\n } else if (edge === 'end') {\n var [, end] = Range.edges(selection);\n Transforms.select(editor, end);\n }\n },\n\n /**\r\n * Unset the selection.\r\n */\n deselect(editor) {\n var {\n selection\n } = editor;\n\n if (selection) {\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: null\n });\n }\n },\n\n /**\r\n * Move the selection's point forward or backward.\r\n */\n move(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n selection\n } = editor;\n var {\n distance = 1,\n unit = 'character',\n reverse = false\n } = options;\n var {\n edge = null\n } = options;\n\n if (!selection) {\n return;\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor';\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus';\n }\n\n var {\n anchor,\n focus\n } = selection;\n var opts = {\n distance,\n unit\n };\n var props = {};\n\n if (edge == null || edge === 'anchor') {\n var point = reverse ? Editor.before(editor, anchor, opts) : Editor.after(editor, anchor, opts);\n\n if (point) {\n props.anchor = point;\n }\n }\n\n if (edge == null || edge === 'focus') {\n var _point = reverse ? Editor.before(editor, focus, opts) : Editor.after(editor, focus, opts);\n\n if (_point) {\n props.focus = _point;\n }\n }\n\n Transforms.setSelection(editor, props);\n },\n\n /**\r\n * Set the selection to a new value.\r\n */\n select(editor, target) {\n var {\n selection\n } = editor;\n target = Editor.range(editor, target);\n\n if (selection) {\n Transforms.setSelection(editor, target);\n return;\n }\n\n if (!Range.isRange(target)) {\n throw new Error(\"When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: \".concat(Scrubber.stringify(target)));\n }\n\n editor.apply({\n type: 'set_selection',\n properties: selection,\n newProperties: target\n });\n },\n\n /**\r\n * Set new properties on one of the selection's points.\r\n */\n setPoint(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n selection\n } = editor;\n var {\n edge = 'both'\n } = options;\n\n if (!selection) {\n return;\n }\n\n if (edge === 'start') {\n edge = Range.isBackward(selection) ? 'focus' : 'anchor';\n }\n\n if (edge === 'end') {\n edge = Range.isBackward(selection) ? 'anchor' : 'focus';\n }\n\n var {\n anchor,\n focus\n } = selection;\n var point = edge === 'anchor' ? anchor : focus;\n Transforms.setSelection(editor, {\n [edge === 'anchor' ? 'anchor' : 'focus']: _objectSpread$1(_objectSpread$1({}, point), props)\n });\n },\n\n /**\r\n * Set new properties on the selection.\r\n */\n setSelection(editor, props) {\n var {\n selection\n } = editor;\n var oldProps = {};\n var newProps = {};\n\n if (!selection) {\n return;\n }\n\n for (var k in props) {\n if (k === 'anchor' && props.anchor != null && !Point.equals(props.anchor, selection.anchor) || k === 'focus' && props.focus != null && !Point.equals(props.focus, selection.focus) || k !== 'anchor' && k !== 'focus' && props[k] !== selection[k]) {\n oldProps[k] = selection[k];\n newProps[k] = props[k];\n }\n }\n\n if (Object.keys(oldProps).length > 0) {\n editor.apply({\n type: 'set_selection',\n properties: oldProps,\n newProperties: newProps\n });\n }\n }\n\n};\n\nvar TextTransforms = {\n /**\r\n * Delete content in the editor.\r\n */\n delete(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n reverse = false,\n unit = 'character',\n distance = 1,\n voids = false\n } = options;\n var {\n at = editor.selection,\n hanging = false\n } = options;\n\n if (!at) {\n return;\n }\n\n var isCollapsed = false;\n\n if (Range.isRange(at) && Range.isCollapsed(at)) {\n isCollapsed = true;\n at = at.anchor;\n }\n\n if (Point.isPoint(at)) {\n var furthestVoid = Editor.void(editor, {\n at,\n mode: 'highest'\n });\n\n if (!voids && furthestVoid) {\n var [, voidPath] = furthestVoid;\n at = voidPath;\n } else {\n var opts = {\n unit,\n distance\n };\n var target = reverse ? Editor.before(editor, at, opts) || Editor.start(editor, []) : Editor.after(editor, at, opts) || Editor.end(editor, []);\n at = {\n anchor: at,\n focus: target\n };\n hanging = true;\n }\n }\n\n if (Path.isPath(at)) {\n Transforms.removeNodes(editor, {\n at,\n voids\n });\n return;\n }\n\n if (Range.isCollapsed(at)) {\n return;\n }\n\n if (!hanging) {\n var [, _end] = Range.edges(at);\n var endOfDoc = Editor.end(editor, []);\n\n if (!Point.equals(_end, endOfDoc)) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n }\n\n var [start, end] = Range.edges(at);\n var startBlock = Editor.above(editor, {\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n at: start,\n voids\n });\n var endBlock = Editor.above(editor, {\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n at: end,\n voids\n });\n var isAcrossBlocks = startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1]);\n var isSingleText = Path.equals(start.path, end.path);\n var startVoid = voids ? null : Editor.void(editor, {\n at: start,\n mode: 'highest'\n });\n var endVoid = voids ? null : Editor.void(editor, {\n at: end,\n mode: 'highest'\n }); // If the start or end points are inside an inline void, nudge them out.\n\n if (startVoid) {\n var before = Editor.before(editor, start);\n\n if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) {\n start = before;\n }\n }\n\n if (endVoid) {\n var after = Editor.after(editor, end);\n\n if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {\n end = after;\n }\n } // Get the highest nodes that are completely inside the range, as well as\n // the start and end nodes.\n\n\n var matches = [];\n var lastPath;\n\n for (var entry of Editor.nodes(editor, {\n at,\n voids\n })) {\n var [node, path] = entry;\n\n if (lastPath && Path.compare(path, lastPath) === 0) {\n continue;\n }\n\n if (!voids && Element.isElement(node) && Editor.isVoid(editor, node) || !Path.isCommon(path, start.path) && !Path.isCommon(path, end.path)) {\n matches.push(entry);\n lastPath = path;\n }\n }\n\n var pathRefs = Array.from(matches, _ref => {\n var [, p] = _ref;\n return Editor.pathRef(editor, p);\n });\n var startRef = Editor.pointRef(editor, start);\n var endRef = Editor.pointRef(editor, end);\n var removedText = '';\n\n if (!isSingleText && !startVoid) {\n var _point = startRef.current;\n var [_node] = Editor.leaf(editor, _point);\n var {\n path: _path\n } = _point;\n var {\n offset\n } = start;\n\n var text = _node.text.slice(offset);\n\n if (text.length > 0) {\n editor.apply({\n type: 'remove_text',\n path: _path,\n offset,\n text\n });\n removedText = text;\n }\n }\n\n pathRefs.reverse().map(r => r.unref()).filter(r => r !== null).forEach(p => Transforms.removeNodes(editor, {\n at: p,\n voids\n }));\n\n if (!endVoid) {\n var _point2 = endRef.current;\n var [_node2] = Editor.leaf(editor, _point2);\n var {\n path: _path2\n } = _point2;\n\n var _offset = isSingleText ? start.offset : 0;\n\n var _text = _node2.text.slice(_offset, end.offset);\n\n if (_text.length > 0) {\n editor.apply({\n type: 'remove_text',\n path: _path2,\n offset: _offset,\n text: _text\n });\n removedText = _text;\n }\n }\n\n if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) {\n Transforms.mergeNodes(editor, {\n at: endRef.current,\n hanging: true,\n voids\n });\n } // For Thai script, deleting N character(s) backward should delete\n // N code point(s) instead of an entire grapheme cluster.\n // Therefore, the remaining code points should be inserted back.\n\n\n if (isCollapsed && reverse && unit === 'character' && removedText.length > 1 && removedText.match(/[\\u0E00-\\u0E7F]+/)) {\n Transforms.insertText(editor, removedText.slice(0, removedText.length - distance));\n }\n\n var startUnref = startRef.unref();\n var endUnref = endRef.unref();\n var point = reverse ? startUnref || endUnref : endUnref || startUnref;\n\n if (options.at == null && point) {\n Transforms.select(editor, point);\n }\n });\n },\n\n /**\r\n * Insert a fragment at a specific location in the editor.\r\n */\n insertFragment(editor, fragment) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n hanging = false,\n voids = false\n } = options;\n var {\n at = editor.selection\n } = options;\n\n if (!fragment.length) {\n return;\n }\n\n if (!at) {\n return;\n } else if (Range.isRange(at)) {\n if (!hanging) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n var [, end] = Range.edges(at);\n\n if (!voids && Editor.void(editor, {\n at: end\n })) {\n return;\n }\n\n var pointRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at\n });\n at = pointRef.unref();\n }\n } else if (Path.isPath(at)) {\n at = Editor.start(editor, at);\n }\n\n if (!voids && Editor.void(editor, {\n at\n })) {\n return;\n } // If the insert point is at the edge of an inline node, move it outside\n // instead since it will need to be split otherwise.\n\n\n var inlineElementMatch = Editor.above(editor, {\n at,\n match: n => Element.isElement(n) && Editor.isInline(editor, n),\n mode: 'highest',\n voids\n });\n\n if (inlineElementMatch) {\n var [, _inlinePath] = inlineElementMatch;\n\n if (Editor.isEnd(editor, at, _inlinePath)) {\n var after = Editor.after(editor, _inlinePath);\n at = after;\n } else if (Editor.isStart(editor, at, _inlinePath)) {\n var before = Editor.before(editor, _inlinePath);\n at = before;\n }\n }\n\n var blockMatch = Editor.above(editor, {\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n at,\n voids\n });\n var [, blockPath] = blockMatch;\n var isBlockStart = Editor.isStart(editor, at, blockPath);\n var isBlockEnd = Editor.isEnd(editor, at, blockPath);\n var isBlockEmpty = isBlockStart && isBlockEnd;\n var mergeStart = !isBlockStart || isBlockStart && isBlockEnd;\n var mergeEnd = !isBlockEnd;\n var [, firstPath] = Node.first({\n children: fragment\n }, []);\n var [, lastPath] = Node.last({\n children: fragment\n }, []);\n var matches = [];\n\n var matcher = _ref2 => {\n var [n, p] = _ref2;\n var isRoot = p.length === 0;\n\n if (isRoot) {\n return false;\n }\n\n if (isBlockEmpty) {\n return true;\n }\n\n if (mergeStart && Path.isAncestor(p, firstPath) && Element.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {\n return false;\n }\n\n if (mergeEnd && Path.isAncestor(p, lastPath) && Element.isElement(n) && !editor.isVoid(n) && !editor.isInline(n)) {\n return false;\n }\n\n return true;\n };\n\n for (var entry of Node.nodes({\n children: fragment\n }, {\n pass: matcher\n })) {\n if (matcher(entry)) {\n matches.push(entry);\n }\n }\n\n var starts = [];\n var middles = [];\n var ends = [];\n var starting = true;\n var hasBlocks = false;\n\n for (var [node] of matches) {\n if (Element.isElement(node) && !editor.isInline(node)) {\n starting = false;\n hasBlocks = true;\n middles.push(node);\n } else if (starting) {\n starts.push(node);\n } else {\n ends.push(node);\n }\n }\n\n var [inlineMatch] = Editor.nodes(editor, {\n at,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids\n });\n var [, inlinePath] = inlineMatch;\n var isInlineStart = Editor.isStart(editor, at, inlinePath);\n var isInlineEnd = Editor.isEnd(editor, at, inlinePath);\n var middleRef = Editor.pathRef(editor, isBlockEnd && !ends.length ? Path.next(blockPath) : blockPath);\n var endRef = Editor.pathRef(editor, isInlineEnd ? Path.next(inlinePath) : inlinePath);\n Transforms.splitNodes(editor, {\n at,\n match: n => hasBlocks ? Element.isElement(n) && Editor.isBlock(editor, n) : Text.isText(n) || Editor.isInline(editor, n),\n mode: hasBlocks ? 'lowest' : 'highest',\n always: hasBlocks && (!isBlockStart || starts.length > 0) && (!isBlockEnd || ends.length > 0),\n voids\n });\n var startRef = Editor.pathRef(editor, !isInlineStart || isInlineStart && isInlineEnd ? Path.next(inlinePath) : inlinePath);\n Transforms.insertNodes(editor, starts, {\n at: startRef.current,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids\n });\n\n if (isBlockEmpty && !starts.length && middles.length && !ends.length) {\n Transforms.delete(editor, {\n at: blockPath,\n voids\n });\n }\n\n Transforms.insertNodes(editor, middles, {\n at: middleRef.current,\n match: n => Element.isElement(n) && Editor.isBlock(editor, n),\n mode: 'lowest',\n voids\n });\n Transforms.insertNodes(editor, ends, {\n at: endRef.current,\n match: n => Text.isText(n) || Editor.isInline(editor, n),\n mode: 'highest',\n voids\n });\n\n if (!options.at) {\n var path;\n\n if (ends.length > 0 && endRef.current) {\n path = Path.previous(endRef.current);\n } else if (middles.length > 0 && middleRef.current) {\n path = Path.previous(middleRef.current);\n } else if (startRef.current) {\n path = Path.previous(startRef.current);\n }\n\n if (path) {\n var _end2 = Editor.end(editor, path);\n\n Transforms.select(editor, _end2);\n }\n }\n\n startRef.unref();\n middleRef.unref();\n endRef.unref();\n });\n },\n\n /**\r\n * Insert a string of text in the Editor.\r\n */\n insertText(editor, text) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n voids = false\n } = options;\n var {\n at = editor.selection\n } = options;\n\n if (!at) {\n return;\n }\n\n if (Path.isPath(at)) {\n at = Editor.range(editor, at);\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n var end = Range.end(at);\n\n if (!voids && Editor.void(editor, {\n at: end\n })) {\n return;\n }\n\n var start = Range.start(at);\n var startRef = Editor.pointRef(editor, start);\n var endRef = Editor.pointRef(editor, end);\n Transforms.delete(editor, {\n at,\n voids\n });\n var startPoint = startRef.unref();\n var endPoint = endRef.unref();\n at = startPoint || endPoint;\n Transforms.setSelection(editor, {\n anchor: at,\n focus: at\n });\n }\n }\n\n if (!voids && Editor.void(editor, {\n at\n })) {\n return;\n }\n\n var {\n path,\n offset\n } = at;\n if (text.length > 0) editor.apply({\n type: 'insert_text',\n path,\n offset,\n text\n });\n });\n }\n\n};\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\nvar Transforms = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, GeneralTransforms), NodeTransforms), SelectionTransforms), TextTransforms);\n\nexport { Editor, Element, Location, Node, Operation, Path, PathRef, Point, PointRef, Range, RangeRef, Scrubber, Span, Text, Transforms, createEditor };\n//# sourceMappingURL=index.es.js.map\n","'use strict'\n\nmodule.exports = direction\n\nvar RTL = '\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC'\nvar LTR =\n 'A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6' +\n '\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\\u200E\\u2C00-\\uFB1C' +\n '\\uFE00-\\uFE6F\\uFEFD-\\uFFFF'\n\nvar rtl = new RegExp('^[^' + LTR + ']*[' + RTL + ']')\nvar ltr = new RegExp('^[^' + RTL + ']*[' + LTR + ']')\n\nfunction direction(value) {\n value = String(value || '')\n\n if (rtl.test(value)) {\n return 'rtl'\n }\n\n if (ltr.test(value)) {\n return 'ltr'\n }\n\n return 'neutral'\n}\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","function t(t){return\"object\"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||\"hidden\"!==t)&&\"visible\"!==t&&\"clip\"!==t}function n(t,n){if(t.clientHeighte||o>t&&l=e&&d>=n?o-t-r:l>e&&dn?l-e+i:0}export default function(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c=\"function\"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError(\"Invalid target\");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x=\"start\"===d||\"nearest\"===d?y:\"end\"===d?M:y+b/2,I=\"center\"===u?V+H/2:\"end\"===u?E:V,C=[],T=0;T=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J=\"offsetWidth\"in k?k.offsetWidth-k.clientWidth-j-z:0,K=\"offsetHeight\"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F=\"start\"===d?x:\"end\"===d?x-g:\"nearest\"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G=\"start\"===u?I:\"center\"===u?I-m/2:\"end\"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F=\"start\"===d?x-R-q:\"end\"===d?x-Y+A+K:\"nearest\"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G=\"start\"===u?I-L-j:\"center\"===u?I-(L+O/2)+J/2:\"end\"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C}\n//# sourceMappingURL=index.module.js.map\n","import compute from 'compute-scroll-into-view';\n\nfunction isOptionsObject(options) {\n return options === Object(options) && Object.keys(options).length !== 0;\n}\n\nfunction defaultBehavior(actions, behavior) {\n if (behavior === void 0) {\n behavior = 'auto';\n }\n\n var canSmoothScroll = ('scrollBehavior' in document.body.style);\n actions.forEach(function (_ref) {\n var el = _ref.el,\n top = _ref.top,\n left = _ref.left;\n\n if (el.scroll && canSmoothScroll) {\n el.scroll({\n top: top,\n left: left,\n behavior: behavior\n });\n } else {\n el.scrollTop = top;\n el.scrollLeft = left;\n }\n });\n}\n\nfunction getOptions(options) {\n if (options === false) {\n return {\n block: 'end',\n inline: 'nearest'\n };\n }\n\n if (isOptionsObject(options)) {\n return options;\n }\n\n return {\n block: 'start',\n inline: 'nearest'\n };\n}\n\nfunction scrollIntoView(target, options) {\n var targetIsDetached = !target.ownerDocument.documentElement.contains(target);\n\n if (isOptionsObject(options) && typeof options.behavior === 'function') {\n return options.behavior(targetIsDetached ? [] : compute(target, options));\n }\n\n if (targetIsDetached) {\n return;\n }\n\n var computeOptions = getOptions(options);\n return defaultBehavior(compute(target, computeOptions), computeOptions.behavior);\n}\n\nexport default scrollIntoView;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n/**\n * Constants.\n */\n\nvar IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);\n\nvar MODIFIERS = {\n alt: 'altKey',\n control: 'ctrlKey',\n meta: 'metaKey',\n shift: 'shiftKey'\n};\n\nvar ALIASES = {\n add: '+',\n break: 'pause',\n cmd: 'meta',\n command: 'meta',\n ctl: 'control',\n ctrl: 'control',\n del: 'delete',\n down: 'arrowdown',\n esc: 'escape',\n ins: 'insert',\n left: 'arrowleft',\n mod: IS_MAC ? 'meta' : 'control',\n opt: 'alt',\n option: 'alt',\n return: 'enter',\n right: 'arrowright',\n space: ' ',\n spacebar: ' ',\n up: 'arrowup',\n win: 'meta',\n windows: 'meta'\n};\n\nvar CODES = {\n backspace: 8,\n tab: 9,\n enter: 13,\n shift: 16,\n control: 17,\n alt: 18,\n pause: 19,\n capslock: 20,\n escape: 27,\n ' ': 32,\n pageup: 33,\n pagedown: 34,\n end: 35,\n home: 36,\n arrowleft: 37,\n arrowup: 38,\n arrowright: 39,\n arrowdown: 40,\n insert: 45,\n delete: 46,\n meta: 91,\n numlock: 144,\n scrolllock: 145,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n '\\'': 222\n};\n\nfor (var f = 1; f < 20; f++) {\n CODES['f' + f] = 111 + f;\n}\n\n/**\n * Is hotkey?\n */\n\nfunction isHotkey(hotkey, options, event) {\n if (options && !('byKey' in options)) {\n event = options;\n options = null;\n }\n\n if (!Array.isArray(hotkey)) {\n hotkey = [hotkey];\n }\n\n var array = hotkey.map(function (string) {\n return parseHotkey(string, options);\n });\n var check = function check(e) {\n return array.some(function (object) {\n return compareHotkey(object, e);\n });\n };\n var ret = event == null ? check : check(event);\n return ret;\n}\n\nfunction isCodeHotkey(hotkey, event) {\n return isHotkey(hotkey, event);\n}\n\nfunction isKeyHotkey(hotkey, event) {\n return isHotkey(hotkey, { byKey: true }, event);\n}\n\n/**\n * Parse.\n */\n\nfunction parseHotkey(hotkey, options) {\n var byKey = options && options.byKey;\n var ret = {};\n\n // Special case to handle the `+` key since we use it as a separator.\n hotkey = hotkey.replace('++', '+add');\n var values = hotkey.split('+');\n var length = values.length;\n\n // Ensure that all the modifiers are set to false unless the hotkey has them.\n\n for (var k in MODIFIERS) {\n ret[MODIFIERS[k]] = false;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var value = _step.value;\n\n var optional = value.endsWith('?') && value.length > 1;\n\n if (optional) {\n value = value.slice(0, -1);\n }\n\n var name = toKeyName(value);\n var modifier = MODIFIERS[name];\n\n if (length === 1 || !modifier) {\n if (byKey) {\n ret.key = name;\n } else {\n ret.which = toKeyCode(value);\n }\n }\n\n if (modifier) {\n ret[modifier] = optional ? null : true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return ret;\n}\n\n/**\n * Compare.\n */\n\nfunction compareHotkey(object, event) {\n for (var key in object) {\n var expected = object[key];\n var actual = void 0;\n\n if (expected == null) {\n continue;\n }\n\n if (key === 'key' && event.key != null) {\n actual = event.key.toLowerCase();\n } else if (key === 'which') {\n actual = expected === 91 && event.which === 93 ? 91 : event.which;\n } else {\n actual = event[key];\n }\n\n if (actual == null && expected === false) {\n continue;\n }\n\n if (actual !== expected) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utils.\n */\n\nfunction toKeyCode(name) {\n name = toKeyName(name);\n var code = CODES[name] || name.toUpperCase().charCodeAt(0);\n return code;\n}\n\nfunction toKeyName(name) {\n name = name.toLowerCase();\n name = ALIASES[name] || name;\n return name;\n}\n\n/**\n * Export.\n */\n\nexports.default = isHotkey;\nexports.isHotkey = isHotkey;\nexports.isCodeHotkey = isCodeHotkey;\nexports.isKeyHotkey = isKeyHotkey;\nexports.parseHotkey = parseHotkey;\nexports.compareHotkey = compareHotkey;\nexports.toKeyCode = toKeyCode;\nexports.toKeyName = toKeyName;","import React, { useLayoutEffect, useEffect, useRef, useState, Fragment, useContext, createContext, useMemo, useCallback, useReducer } from 'react';\nimport { Path, Node, Editor, Text as Text$1, Range, Element as Element$1, Transforms, Scrubber } from 'slate';\nimport getDirection from 'direction';\nimport debounce from 'lodash/debounce';\nimport throttle from 'lodash/throttle';\nimport scrollIntoView from 'scroll-into-view-if-needed';\nimport { isKeyHotkey } from 'is-hotkey';\nimport ReactDOM from 'react-dom';\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = _objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nvar IS_REACT_VERSION_17_OR_ABOVE = parseInt(React.version.split('.')[0], 10) >= 17;\nvar IS_IOS = typeof navigator !== 'undefined' && typeof window !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\nvar IS_APPLE = typeof navigator !== 'undefined' && /Mac OS X/.test(navigator.userAgent);\nvar IS_ANDROID = typeof navigator !== 'undefined' && /Android/.test(navigator.userAgent);\nvar IS_FIREFOX = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);\nvar IS_SAFARI = typeof navigator !== 'undefined' && /Version\\/[\\d\\.]+.*Safari/.test(navigator.userAgent); // \"modern\" Edge was released at 79.x\n\nvar IS_EDGE_LEGACY = typeof navigator !== 'undefined' && /Edge?\\/(?:[0-6][0-9]|[0-7][0-8])(?:\\.)/i.test(navigator.userAgent);\nvar IS_CHROME = typeof navigator !== 'undefined' && /Chrome/i.test(navigator.userAgent); // Native `beforeInput` events don't work well with react on Chrome 75\n// and older, Chrome 76+ can use `beforeInput` though.\n\nvar IS_CHROME_LEGACY = typeof navigator !== 'undefined' && /Chrome?\\/(?:[0-7][0-5]|[0-6][0-9])(?:\\.)/i.test(navigator.userAgent); // Firefox did not support `beforeInput` until `v87`.\n\nvar IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\\/(?:[0-7][0-9]|[0-8][0-6])(?:\\.)).*/i.test(navigator.userAgent); // qq browser\n\nvar IS_QQBROWSER = typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent); // UC mobile browser\n\nvar IS_UC_MOBILE = typeof navigator !== 'undefined' && /.*UCBrowser/.test(navigator.userAgent); // Wechat browser\n\nvar IS_WECHATBROWSER = typeof navigator !== 'undefined' && /.*Wechat/.test(navigator.userAgent); // Check if DOM is available as React does internally.\n// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js\n\nvar CAN_USE_DOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); // COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event\n// Chrome Legacy doesn't support `beforeinput` correctly\n\nvar HAS_BEFORE_INPUT_SUPPORT = !IS_CHROME_LEGACY && !IS_EDGE_LEGACY && // globalThis is undefined in older browsers\ntypeof globalThis !== 'undefined' && globalThis.InputEvent && // @ts-ignore The `getTargetRanges` property isn't recognized.\ntypeof globalThis.InputEvent.prototype.getTargetRanges === 'function';\n\n/**\r\n * Prevent warning on SSR by falling back to useEffect when DOM isn't available\r\n */\n\nvar useIsomorphicLayoutEffect = CAN_USE_DOM ? useLayoutEffect : useEffect;\n\n/**\r\n * Leaf content strings.\r\n */\n\nvar String = props => {\n var {\n isLast,\n leaf,\n parent,\n text\n } = props;\n var editor = useSlateStatic();\n var path = ReactEditor.findPath(editor, text);\n var parentPath = Path.parent(path); // COMPAT: Render text inside void nodes with a zero-width space.\n // So the node can contain selection but the text is not visible.\n\n if (editor.isVoid(parent)) {\n return /*#__PURE__*/React.createElement(ZeroWidthString, {\n length: Node.string(parent).length\n });\n } // COMPAT: If this is the last text node in an empty block, render a zero-\n // width space that will convert into a line break when copying and pasting\n // to support expected plain text.\n\n\n if (leaf.text === '' && parent.children[parent.children.length - 1] === text && !editor.isInline(parent) && Editor.string(editor, parentPath) === '') {\n return /*#__PURE__*/React.createElement(ZeroWidthString, {\n isLineBreak: true\n });\n } // COMPAT: If the text is empty, it's because it's on the edge of an inline\n // node, so we render a zero-width space so that the selection can be\n // inserted next to it still.\n\n\n if (leaf.text === '') {\n return /*#__PURE__*/React.createElement(ZeroWidthString, null);\n } // COMPAT: Browsers will collapse trailing new lines at the end of blocks,\n // so we need to add an extra trailing new lines to prevent that.\n\n\n if (isLast && leaf.text.slice(-1) === '\\n') {\n return /*#__PURE__*/React.createElement(TextString, {\n isTrailing: true,\n text: leaf.text\n });\n }\n\n return /*#__PURE__*/React.createElement(TextString, {\n text: leaf.text\n });\n};\n/**\r\n * Leaf strings with text in them.\r\n */\n\n\nvar TextString = props => {\n var {\n text,\n isTrailing = false\n } = props;\n var ref = useRef(null);\n\n var getTextContent = () => {\n return \"\".concat(text !== null && text !== void 0 ? text : '').concat(isTrailing ? '\\n' : '');\n }; // This is the actual text rendering boundary where we interface with the DOM\n // The text is not rendered as part of the virtual DOM, as since we handle basic character insertions natively,\n // updating the DOM is not a one way dataflow anymore. What we need here is not reconciliation and diffing\n // with previous version of the virtual DOM, but rather diffing with the actual DOM element, and replace the DOM content\n // exactly if and only if its current content does not match our current virtual DOM.\n // Otherwise the DOM TextNode would always be replaced by React as the user types, which interferes with native text features,\n // eg makes native spellcheck opt out from checking the text node.\n // useLayoutEffect: updating our span before browser paint\n\n\n useIsomorphicLayoutEffect(() => {\n // null coalescing text to make sure we're not outputing \"null\" as a string in the extreme case it is nullish at runtime\n var textWithTrailing = getTextContent();\n\n if (ref.current && ref.current.textContent !== textWithTrailing) {\n ref.current.textContent = textWithTrailing;\n } // intentionally not specifying dependencies, so that this effect runs on every render\n // as this effectively replaces \"specifying the text in the virtual DOM under the below\" on each render\n\n }); // Render text content immediately if it's the first-time render\n // Ensure that text content is rendered on server-side rendering\n\n if (!ref.current) {\n return /*#__PURE__*/React.createElement(\"span\", {\n \"data-slate-string\": true,\n ref: ref\n }, getTextContent());\n } // the span is intentionally same on every render in virtual DOM, actual rendering happens in the layout effect above\n\n\n return /*#__PURE__*/React.createElement(\"span\", {\n \"data-slate-string\": true,\n ref: ref\n });\n};\n/**\r\n * Leaf strings without text, render as zero-width strings.\r\n */\n\n\nvar ZeroWidthString = props => {\n var {\n length = 0,\n isLineBreak = false\n } = props;\n return /*#__PURE__*/React.createElement(\"span\", {\n \"data-slate-zero-width\": isLineBreak ? 'n' : 'z',\n \"data-slate-length\": length\n }, '\\uFEFF', isLineBreak ? /*#__PURE__*/React.createElement(\"br\", null) : null);\n};\n\n/**\r\n * Two weak maps that allow us rebuild a path given a node. They are populated\r\n * at render time such that after a render occurs we can always backtrack.\r\n */\nvar NODE_TO_INDEX = new WeakMap();\nvar NODE_TO_PARENT = new WeakMap();\n/**\r\n * Weak maps that allow us to go between Slate nodes and DOM nodes. These\r\n * are used to resolve DOM event-related logic into Slate actions.\r\n */\n\nvar EDITOR_TO_WINDOW = new WeakMap();\nvar EDITOR_TO_ELEMENT = new WeakMap();\nvar ELEMENT_TO_NODE = new WeakMap();\nvar NODE_TO_ELEMENT = new WeakMap();\nvar NODE_TO_KEY = new WeakMap();\nvar EDITOR_TO_KEY_TO_ELEMENT = new WeakMap();\n/**\r\n * Weak maps for storing editor-related state.\r\n */\n\nvar IS_READ_ONLY = new WeakMap();\nvar IS_FOCUSED = new WeakMap();\nvar IS_COMPOSING = new WeakMap();\nvar IS_ON_COMPOSITION_END = new WeakMap();\nvar EDITOR_TO_USER_SELECTION = new WeakMap();\n/**\r\n * Weak maps for saving text on composition stage.\r\n */\n\nvar EDITOR_ON_COMPOSITION_TEXT = new WeakMap();\n/**\r\n * Weak map for associating the context `onChange` context with the plugin.\r\n */\n\nvar EDITOR_TO_ON_CHANGE = new WeakMap();\nvar NODE_TO_RESTORE_DOM = new WeakMap();\n/**\r\n * Symbols.\r\n */\n\nvar PLACEHOLDER_SYMBOL = Symbol('placeholder');\n\n/**\r\n * Individual leaves in a text node with unique formatting.\r\n */\n\nvar Leaf = props => {\n var {\n leaf,\n isLast,\n text,\n parent,\n renderPlaceholder,\n renderLeaf = props => /*#__PURE__*/React.createElement(DefaultLeaf, Object.assign({}, props))\n } = props;\n var placeholderRef = useRef(null);\n useEffect(() => {\n var placeholderEl = placeholderRef === null || placeholderRef === void 0 ? void 0 : placeholderRef.current;\n var editorEl = document.querySelector('[data-slate-editor=\"true\"]');\n\n if (!placeholderEl || !editorEl) {\n return;\n }\n\n editorEl.style.minHeight = \"\".concat(placeholderEl.clientHeight, \"px\");\n return () => {\n editorEl.style.minHeight = 'auto';\n };\n }, [placeholderRef, leaf]);\n var children = /*#__PURE__*/React.createElement(String, {\n isLast: isLast,\n leaf: leaf,\n parent: parent,\n text: text\n });\n\n if (leaf[PLACEHOLDER_SYMBOL]) {\n var placeholderProps = {\n children: leaf.placeholder,\n attributes: {\n 'data-slate-placeholder': true,\n style: {\n position: 'absolute',\n pointerEvents: 'none',\n width: '100%',\n maxWidth: '100%',\n display: 'block',\n opacity: '0.333',\n userSelect: 'none',\n textDecoration: 'none'\n },\n contentEditable: false,\n ref: placeholderRef\n }\n };\n children = /*#__PURE__*/React.createElement(React.Fragment, null, renderPlaceholder(placeholderProps), children);\n } // COMPAT: Having the `data-` attributes on these leaf elements ensures that\n // in certain misbehaving browsers they aren't weirdly cloned/destroyed by\n // contenteditable behaviors. (2019/05/08)\n\n\n var attributes = {\n 'data-slate-leaf': true\n };\n return renderLeaf({\n attributes,\n children,\n leaf,\n text\n });\n};\n\nvar MemoizedLeaf = /*#__PURE__*/React.memo(Leaf, (prev, next) => {\n return next.parent === prev.parent && next.isLast === prev.isLast && next.renderLeaf === prev.renderLeaf && next.renderPlaceholder === prev.renderPlaceholder && next.text === prev.text && Text$1.equals(next.leaf, prev.leaf) && next.leaf[PLACEHOLDER_SYMBOL] === prev.leaf[PLACEHOLDER_SYMBOL];\n});\nvar DefaultLeaf = props => {\n var {\n attributes,\n children\n } = props;\n return /*#__PURE__*/React.createElement(\"span\", Object.assign({}, attributes), children);\n};\n\nvar _excluded$3 = [\"anchor\", \"focus\"],\n _excluded2 = [\"anchor\", \"focus\"];\nvar shallowCompare = (obj1, obj2) => Object.keys(obj1).length === Object.keys(obj2).length && Object.keys(obj1).every(key => obj2.hasOwnProperty(key) && obj1[key] === obj2[key]);\n/**\r\n * Check if a list of decorator ranges are equal to another.\r\n *\r\n * PERF: this requires the two lists to also have the ranges inside them in the\r\n * same order, but this is an okay constraint for us since decorations are\r\n * kept in order, and the odd case where they aren't is okay to re-render for.\r\n */\n\nvar isDecoratorRangeListEqual = (list, another) => {\n if (list.length !== another.length) {\n return false;\n }\n\n for (var i = 0; i < list.length; i++) {\n var range = list[i];\n var other = another[i];\n\n var rangeOwnProps = _objectWithoutProperties(range, _excluded$3);\n\n var otherOwnProps = _objectWithoutProperties(other, _excluded2);\n\n if (!Range.equals(range, other) || range[PLACEHOLDER_SYMBOL] !== other[PLACEHOLDER_SYMBOL] || !shallowCompare(rangeOwnProps, otherOwnProps)) {\n return false;\n }\n }\n\n return true;\n};\n\nfunction useContentKey(node) {\n var contentKeyRef = useRef(0);\n var updateAnimationFrameRef = useRef(null);\n var [, setForceRerenderCounter] = useState(0);\n useEffect(() => {\n NODE_TO_RESTORE_DOM.set(node, () => {\n // Update is already queued and node hasn't re-render yet\n if (updateAnimationFrameRef.current) {\n return;\n }\n\n updateAnimationFrameRef.current = requestAnimationFrame(() => {\n setForceRerenderCounter(state => state + 1);\n updateAnimationFrameRef.current = null;\n });\n contentKeyRef.current++;\n });\n return () => {\n NODE_TO_RESTORE_DOM.delete(node);\n };\n }, [node]); // Node was restored => clear scheduled update\n\n if (updateAnimationFrameRef.current) {\n cancelAnimationFrame(updateAnimationFrameRef.current);\n updateAnimationFrameRef.current = null;\n }\n\n return contentKeyRef.current;\n}\n\n/**\r\n * Text.\r\n */\n\nvar Text = props => {\n var {\n decorations,\n isLast,\n parent,\n renderPlaceholder,\n renderLeaf,\n text\n } = props;\n var editor = useSlateStatic();\n var ref = useRef(null);\n var leaves = Text$1.decorations(text, decorations);\n var key = ReactEditor.findKey(editor, text);\n var children = [];\n\n for (var i = 0; i < leaves.length; i++) {\n var leaf = leaves[i];\n children.push( /*#__PURE__*/React.createElement(MemoizedLeaf, {\n isLast: isLast && i === leaves.length - 1,\n key: \"\".concat(key.id, \"-\").concat(i),\n renderPlaceholder: renderPlaceholder,\n leaf: leaf,\n text: text,\n parent: parent,\n renderLeaf: renderLeaf\n }));\n } // Update element-related weak maps with the DOM element ref.\n\n\n useIsomorphicLayoutEffect(() => {\n var KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);\n\n if (ref.current) {\n KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.set(key, ref.current);\n NODE_TO_ELEMENT.set(text, ref.current);\n ELEMENT_TO_NODE.set(ref.current, text);\n } else {\n KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.delete(key);\n NODE_TO_ELEMENT.delete(text);\n }\n });\n var contentKey = IS_ANDROID ? useContentKey(text) : undefined;\n return /*#__PURE__*/React.createElement(\"span\", {\n \"data-slate-node\": \"text\",\n ref: ref,\n key: contentKey\n }, children);\n};\n\nvar MemoizedText = /*#__PURE__*/React.memo(Text, (prev, next) => {\n return next.parent === prev.parent && next.isLast === prev.isLast && next.renderLeaf === prev.renderLeaf && next.text === prev.text && isDecoratorRangeListEqual(next.decorations, prev.decorations);\n});\n\n/**\r\n * Element.\r\n */\n\nvar Element = props => {\n var {\n decorations,\n element,\n renderElement = p => /*#__PURE__*/React.createElement(DefaultElement, Object.assign({}, p)),\n renderPlaceholder,\n renderLeaf,\n selection\n } = props;\n var ref = useRef(null);\n var editor = useSlateStatic();\n var readOnly = useReadOnly();\n var isInline = editor.isInline(element);\n var key = ReactEditor.findKey(editor, element);\n var children = useChildren({\n decorations,\n node: element,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection\n }); // Attributes that the developer must mix into the element in their\n // custom node renderer component.\n\n var attributes = {\n 'data-slate-node': 'element',\n ref\n };\n\n if (isInline) {\n attributes['data-slate-inline'] = true;\n } // If it's a block node with inline children, add the proper `dir` attribute\n // for text direction.\n\n\n if (!isInline && Editor.hasInlines(editor, element)) {\n var text = Node.string(element);\n var dir = getDirection(text);\n\n if (dir === 'rtl') {\n attributes.dir = dir;\n }\n } // If it's a void node, wrap the children in extra void-specific elements.\n\n\n if (Editor.isVoid(editor, element)) {\n attributes['data-slate-void'] = true;\n\n if (!readOnly && isInline) {\n attributes.contentEditable = false;\n }\n\n var Tag = isInline ? 'span' : 'div';\n var [[_text]] = Node.texts(element);\n children = /*#__PURE__*/React.createElement(Tag, {\n \"data-slate-spacer\": true,\n style: {\n height: '0',\n color: 'transparent',\n outline: 'none',\n position: 'absolute'\n }\n }, /*#__PURE__*/React.createElement(MemoizedText, {\n renderPlaceholder: renderPlaceholder,\n decorations: [],\n isLast: false,\n parent: element,\n text: _text\n }));\n NODE_TO_INDEX.set(_text, 0);\n NODE_TO_PARENT.set(_text, element);\n } // Update element-related weak maps with the DOM element ref.\n\n\n useIsomorphicLayoutEffect(() => {\n var KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);\n\n if (ref.current) {\n KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.set(key, ref.current);\n NODE_TO_ELEMENT.set(element, ref.current);\n ELEMENT_TO_NODE.set(ref.current, element);\n } else {\n KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.delete(key);\n NODE_TO_ELEMENT.delete(element);\n }\n });\n var content = renderElement({\n attributes,\n children,\n element\n });\n\n if (IS_ANDROID) {\n var contentKey = useContentKey(element);\n return /*#__PURE__*/React.createElement(Fragment, {\n key: contentKey\n }, content);\n }\n\n return content;\n};\n\nvar MemoizedElement = /*#__PURE__*/React.memo(Element, (prev, next) => {\n return prev.element === next.element && prev.renderElement === next.renderElement && prev.renderLeaf === next.renderLeaf && isDecoratorRangeListEqual(prev.decorations, next.decorations) && (prev.selection === next.selection || !!prev.selection && !!next.selection && Range.equals(prev.selection, next.selection));\n});\n/**\r\n * The default element renderer.\r\n */\n\nvar DefaultElement = props => {\n var {\n attributes,\n children,\n element\n } = props;\n var editor = useSlateStatic();\n var Tag = editor.isInline(element) ? 'span' : 'div';\n return /*#__PURE__*/React.createElement(Tag, Object.assign({}, attributes, {\n style: {\n position: 'relative'\n }\n }), children);\n};\n\n/**\r\n * A React context for sharing the editor object.\r\n */\n\nvar EditorContext = /*#__PURE__*/createContext(null);\n/**\r\n * Get the current editor object from the React context.\r\n */\n\nvar useSlateStatic = () => {\n var editor = useContext(EditorContext);\n\n if (!editor) {\n throw new Error(\"The `useSlateStatic` hook must be used inside the component's context.\");\n }\n\n return editor;\n};\n\n/**\r\n * A React context for sharing the `decorate` prop of the editable.\r\n */\n\nvar DecorateContext = /*#__PURE__*/createContext(() => []);\n/**\r\n * Get the current `decorate` prop of the editable.\r\n */\n\nvar useDecorate = () => {\n return useContext(DecorateContext);\n};\n\n/**\r\n * A React context for sharing the `selected` state of an element.\r\n */\n\nvar SelectedContext = /*#__PURE__*/createContext(false);\n/**\r\n * Get the current `selected` state of an element.\r\n */\n\nvar useSelected = () => {\n return useContext(SelectedContext);\n};\n\n/**\r\n * Children.\r\n */\n\nvar useChildren = props => {\n var {\n decorations,\n node,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection\n } = props;\n var decorate = useDecorate();\n var editor = useSlateStatic();\n var path = ReactEditor.findPath(editor, node);\n var children = [];\n var isLeafBlock = Element$1.isElement(node) && !editor.isInline(node) && Editor.hasInlines(editor, node);\n\n for (var i = 0; i < node.children.length; i++) {\n var p = path.concat(i);\n var n = node.children[i];\n var key = ReactEditor.findKey(editor, n);\n var range = Editor.range(editor, p);\n var sel = selection && Range.intersection(range, selection);\n var ds = decorate([n, p]);\n\n for (var dec of decorations) {\n var d = Range.intersection(dec, range);\n\n if (d) {\n ds.push(d);\n }\n }\n\n if (Element$1.isElement(n)) {\n children.push( /*#__PURE__*/React.createElement(SelectedContext.Provider, {\n key: \"provider-\".concat(key.id),\n value: !!sel\n }, /*#__PURE__*/React.createElement(MemoizedElement, {\n decorations: ds,\n element: n,\n key: key.id,\n renderElement: renderElement,\n renderPlaceholder: renderPlaceholder,\n renderLeaf: renderLeaf,\n selection: sel\n })));\n } else {\n children.push( /*#__PURE__*/React.createElement(MemoizedText, {\n decorations: ds,\n key: key.id,\n isLast: isLeafBlock && i === node.children.length - 1,\n parent: node,\n renderPlaceholder: renderPlaceholder,\n renderLeaf: renderLeaf,\n text: n\n }));\n }\n\n NODE_TO_INDEX.set(n, i);\n NODE_TO_PARENT.set(n, node);\n }\n\n return children;\n};\n\n/**\r\n * Hotkey mappings for each platform.\r\n */\n\nvar HOTKEYS = {\n bold: 'mod+b',\n compose: ['down', 'left', 'right', 'up', 'backspace', 'enter'],\n moveBackward: 'left',\n moveForward: 'right',\n moveWordBackward: 'ctrl+left',\n moveWordForward: 'ctrl+right',\n deleteBackward: 'shift?+backspace',\n deleteForward: 'shift?+delete',\n extendBackward: 'shift+left',\n extendForward: 'shift+right',\n italic: 'mod+i',\n insertSoftBreak: 'shift+enter',\n splitBlock: 'enter',\n undo: 'mod+z'\n};\nvar APPLE_HOTKEYS = {\n moveLineBackward: 'opt+up',\n moveLineForward: 'opt+down',\n moveWordBackward: 'opt+left',\n moveWordForward: 'opt+right',\n deleteBackward: ['ctrl+backspace', 'ctrl+h'],\n deleteForward: ['ctrl+delete', 'ctrl+d'],\n deleteLineBackward: 'cmd+shift?+backspace',\n deleteLineForward: ['cmd+shift?+delete', 'ctrl+k'],\n deleteWordBackward: 'opt+shift?+backspace',\n deleteWordForward: 'opt+shift?+delete',\n extendLineBackward: 'opt+shift+up',\n extendLineForward: 'opt+shift+down',\n redo: 'cmd+shift+z',\n transposeCharacter: 'ctrl+t'\n};\nvar WINDOWS_HOTKEYS = {\n deleteWordBackward: 'ctrl+shift?+backspace',\n deleteWordForward: 'ctrl+shift?+delete',\n redo: ['ctrl+y', 'ctrl+shift+z']\n};\n/**\r\n * Create a platform-aware hotkey checker.\r\n */\n\nvar create = key => {\n var generic = HOTKEYS[key];\n var apple = APPLE_HOTKEYS[key];\n var windows = WINDOWS_HOTKEYS[key];\n var isGeneric = generic && isKeyHotkey(generic);\n var isApple = apple && isKeyHotkey(apple);\n var isWindows = windows && isKeyHotkey(windows);\n return event => {\n if (isGeneric && isGeneric(event)) return true;\n if (IS_APPLE && isApple && isApple(event)) return true;\n if (!IS_APPLE && isWindows && isWindows(event)) return true;\n return false;\n };\n};\n/**\r\n * Hotkeys.\r\n */\n\n\nvar Hotkeys = {\n isBold: create('bold'),\n isCompose: create('compose'),\n isMoveBackward: create('moveBackward'),\n isMoveForward: create('moveForward'),\n isDeleteBackward: create('deleteBackward'),\n isDeleteForward: create('deleteForward'),\n isDeleteLineBackward: create('deleteLineBackward'),\n isDeleteLineForward: create('deleteLineForward'),\n isDeleteWordBackward: create('deleteWordBackward'),\n isDeleteWordForward: create('deleteWordForward'),\n isExtendBackward: create('extendBackward'),\n isExtendForward: create('extendForward'),\n isExtendLineBackward: create('extendLineBackward'),\n isExtendLineForward: create('extendLineForward'),\n isItalic: create('italic'),\n isMoveLineBackward: create('moveLineBackward'),\n isMoveLineForward: create('moveLineForward'),\n isMoveWordBackward: create('moveWordBackward'),\n isMoveWordForward: create('moveWordForward'),\n isRedo: create('redo'),\n isSoftBreak: create('insertSoftBreak'),\n isSplitBlock: create('splitBlock'),\n isTransposeCharacter: create('transposeCharacter'),\n isUndo: create('undo')\n};\n\n/**\r\n * A React context for sharing the `readOnly` state of the editor.\r\n */\n\nvar ReadOnlyContext = /*#__PURE__*/createContext(false);\n/**\r\n * Get the current `readOnly` state of the editor.\r\n */\n\nvar useReadOnly = () => {\n return useContext(ReadOnlyContext);\n};\n\n/**\r\n * A React context for sharing the editor object, in a way that re-renders the\r\n * context whenever changes occur.\r\n */\n\nvar SlateContext = /*#__PURE__*/createContext(null);\n/**\r\n * Get the current editor object from the React context.\r\n */\n\nvar useSlate = () => {\n var context = useContext(SlateContext);\n\n if (!context) {\n throw new Error(\"The `useSlate` hook must be used inside the component's context.\");\n }\n\n var [editor] = context;\n return editor;\n};\n\n/**\r\n * Types.\r\n */\n/**\r\n * Returns the host window of a DOM node\r\n */\n\nvar getDefaultView = value => {\n return value && value.ownerDocument && value.ownerDocument.defaultView || null;\n};\n/**\r\n * Check if a DOM node is a comment node.\r\n */\n\nvar isDOMComment = value => {\n return isDOMNode(value) && value.nodeType === 8;\n};\n/**\r\n * Check if a DOM node is an element node.\r\n */\n\nvar isDOMElement = value => {\n return isDOMNode(value) && value.nodeType === 1;\n};\n/**\r\n * Check if a value is a DOM node.\r\n */\n\nvar isDOMNode = value => {\n var window = getDefaultView(value);\n return !!window && value instanceof window.Node;\n};\n/**\r\n * Check if a value is a DOM selection.\r\n */\n\nvar isDOMSelection = value => {\n var window = value && value.anchorNode && getDefaultView(value.anchorNode);\n return !!window && value instanceof window.Selection;\n};\n/**\r\n * Check if a DOM node is an element node.\r\n */\n\nvar isDOMText = value => {\n return isDOMNode(value) && value.nodeType === 3;\n};\n/**\r\n * Checks whether a paste event is a plaintext-only event.\r\n */\n\nvar isPlainTextOnlyPaste = event => {\n return event.clipboardData && event.clipboardData.getData('text/plain') !== '' && event.clipboardData.types.length === 1;\n};\n/**\r\n * Normalize a DOM point so that it always refers to a text node.\r\n */\n\nvar normalizeDOMPoint = domPoint => {\n var [node, offset] = domPoint; // If it's an element node, its offset refers to the index of its children\n // including comment nodes, so try to find the right text child node.\n\n if (isDOMElement(node) && node.childNodes.length) {\n var isLast = offset === node.childNodes.length;\n var index = isLast ? offset - 1 : offset;\n [node, index] = getEditableChildAndIndex(node, index, isLast ? 'backward' : 'forward'); // If the editable child found is in front of input offset, we instead seek to its end\n\n isLast = index < offset; // If the node has children, traverse until we have a leaf node. Leaf nodes\n // can be either text nodes, or other void DOM nodes.\n\n while (isDOMElement(node) && node.childNodes.length) {\n var i = isLast ? node.childNodes.length - 1 : 0;\n node = getEditableChild(node, i, isLast ? 'backward' : 'forward');\n } // Determine the new offset inside the text node.\n\n\n offset = isLast && node.textContent != null ? node.textContent.length : 0;\n } // Return the node and offset.\n\n\n return [node, offset];\n};\n/**\r\n * Determines wether the active element is nested within a shadowRoot\r\n */\n\nvar hasShadowRoot = () => {\n return !!(window.document.activeElement && window.document.activeElement.shadowRoot);\n};\n/**\r\n * Get the nearest editable child and index at `index` in a `parent`, preferring\r\n * `direction`.\r\n */\n\nvar getEditableChildAndIndex = (parent, index, direction) => {\n var {\n childNodes\n } = parent;\n var child = childNodes[index];\n var i = index;\n var triedForward = false;\n var triedBackward = false; // While the child is a comment node, or an element node with no children,\n // keep iterating to find a sibling non-void, non-comment node.\n\n while (isDOMComment(child) || isDOMElement(child) && child.childNodes.length === 0 || isDOMElement(child) && child.getAttribute('contenteditable') === 'false') {\n if (triedForward && triedBackward) {\n break;\n }\n\n if (i >= childNodes.length) {\n triedForward = true;\n i = index - 1;\n direction = 'backward';\n continue;\n }\n\n if (i < 0) {\n triedBackward = true;\n i = index + 1;\n direction = 'forward';\n continue;\n }\n\n child = childNodes[i];\n index = i;\n i += direction === 'forward' ? 1 : -1;\n }\n\n return [child, index];\n};\n/**\r\n * Get the nearest editable child at `index` in a `parent`, preferring\r\n * `direction`.\r\n */\n\nvar getEditableChild = (parent, index, direction) => {\n var [child] = getEditableChildAndIndex(parent, index, direction);\n return child;\n};\n/**\r\n * Get a plaintext representation of the content of a node, accounting for block\r\n * elements which get a newline appended.\r\n *\r\n * The domNode must be attached to the DOM.\r\n */\n\nvar getPlainText = domNode => {\n var text = '';\n\n if (isDOMText(domNode) && domNode.nodeValue) {\n return domNode.nodeValue;\n }\n\n if (isDOMElement(domNode)) {\n for (var childNode of Array.from(domNode.childNodes)) {\n text += getPlainText(childNode);\n }\n\n var display = getComputedStyle(domNode).getPropertyValue('display');\n\n if (display === 'block' || display === 'list' || domNode.tagName === 'BR') {\n text += '\\n';\n }\n }\n\n return text;\n};\n/**\r\n * Get x-slate-fragment attribute from data-slate-fragment\r\n */\n\nvar catchSlateFragment = /data-slate-fragment=\"(.+?)\"/m;\nvar getSlateFragmentAttribute = dataTransfer => {\n var htmlData = dataTransfer.getData('text/html');\n var [, fragment] = htmlData.match(catchSlateFragment) || [];\n return fragment;\n};\n/**\r\n * Get the x-slate-fragment attribute that exist in text/html data\r\n * and append it to the DataTransfer object\r\n */\n\nvar getClipboardData = dataTransfer => {\n if (!dataTransfer.getData('application/x-slate-fragment')) {\n var fragment = getSlateFragmentAttribute(dataTransfer);\n\n if (fragment) {\n var clipboardData = new DataTransfer();\n dataTransfer.types.forEach(type => {\n clipboardData.setData(type, dataTransfer.getData(type));\n });\n clipboardData.setData('application/x-slate-fragment', fragment);\n return clipboardData;\n }\n }\n\n return dataTransfer;\n};\n\nvar TRIPLE_CLICK = 3;\n\nvar _excluded$2 = [\"autoFocus\", \"decorate\", \"onDOMBeforeInput\", \"placeholder\", \"readOnly\", \"renderElement\", \"renderLeaf\", \"renderPlaceholder\", \"scrollSelectionIntoView\", \"style\", \"as\"];\n\nfunction ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nvar Children = props => /*#__PURE__*/React.createElement(React.Fragment, null, useChildren(props));\n/**\r\n * Editable.\r\n */\n\n\nvar Editable$1 = props => {\n var {\n autoFocus,\n decorate = defaultDecorate,\n onDOMBeforeInput: propsOnDOMBeforeInput,\n placeholder,\n readOnly = false,\n renderElement,\n renderLeaf,\n renderPlaceholder = props => /*#__PURE__*/React.createElement(DefaultPlaceholder, Object.assign({}, props)),\n scrollSelectionIntoView = defaultScrollSelectionIntoView,\n style = {},\n as: Component = 'div'\n } = props,\n attributes = _objectWithoutProperties(props, _excluded$2);\n\n var editor = useSlate(); // Rerender editor when composition status changed\n\n var [isComposing, setIsComposing] = useState(false);\n var ref = useRef(null);\n var deferredOperations = useRef([]); // Update internal state on each render.\n\n IS_READ_ONLY.set(editor, readOnly); // Keep track of some state for the event handler logic.\n\n var state = useMemo(() => ({\n hasInsertPrefixInCompositon: false,\n isDraggingInternally: false,\n isUpdatingSelection: false,\n latestElement: null\n }), []); // Whenever the editor updates...\n\n useIsomorphicLayoutEffect(() => {\n // Update element-related weak maps with the DOM element ref.\n var window;\n\n if (ref.current && (window = getDefaultView(ref.current))) {\n EDITOR_TO_WINDOW.set(editor, window);\n EDITOR_TO_ELEMENT.set(editor, ref.current);\n NODE_TO_ELEMENT.set(editor, ref.current);\n ELEMENT_TO_NODE.set(ref.current, editor);\n } else {\n NODE_TO_ELEMENT.delete(editor);\n } // Make sure the DOM selection state is in sync.\n\n\n var {\n selection\n } = editor;\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n var domSelection = root.getSelection();\n\n if (ReactEditor.isComposing(editor) || !domSelection || !ReactEditor.isFocused(editor)) {\n return;\n }\n\n var hasDomSelection = domSelection.type !== 'None'; // If the DOM selection is properly unset, we're done.\n\n if (!selection && !hasDomSelection) {\n return;\n } // verify that the dom selection is in the editor\n\n\n var editorElement = EDITOR_TO_ELEMENT.get(editor);\n var hasDomSelectionInEditor = false;\n\n if (editorElement.contains(domSelection.anchorNode) && editorElement.contains(domSelection.focusNode)) {\n hasDomSelectionInEditor = true;\n } // If the DOM selection is in the editor and the editor selection is already correct, we're done.\n\n\n if (hasDomSelection && hasDomSelectionInEditor && selection) {\n var slateRange = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: true,\n // domSelection is not necessarily a valid Slate range\n // (e.g. when clicking on contentEditable:false element)\n suppressThrow: true\n });\n\n if (slateRange && Range.equals(slateRange, selection)) {\n return;\n }\n } // when is being controlled through external value\n // then its children might just change - DOM responds to it on its own\n // but Slate's value is not being updated through any operation\n // and thus it doesn't transform selection on its own\n\n\n if (selection && !ReactEditor.hasRange(editor, selection)) {\n editor.selection = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: false\n });\n return;\n } // Otherwise the DOM selection is out of sync, so update it.\n\n\n state.isUpdatingSelection = true;\n var newDomRange = selection && ReactEditor.toDOMRange(editor, selection);\n\n if (newDomRange) {\n if (Range.isBackward(selection)) {\n domSelection.setBaseAndExtent(newDomRange.endContainer, newDomRange.endOffset, newDomRange.startContainer, newDomRange.startOffset);\n } else {\n domSelection.setBaseAndExtent(newDomRange.startContainer, newDomRange.startOffset, newDomRange.endContainer, newDomRange.endOffset);\n }\n\n scrollSelectionIntoView(editor, newDomRange);\n } else {\n domSelection.removeAllRanges();\n }\n\n setTimeout(() => {\n // COMPAT: In Firefox, it's not enough to create a range, you also need\n // to focus the contenteditable element too. (2016/11/16)\n if (newDomRange && IS_FIREFOX) {\n var el = ReactEditor.toDOMNode(editor, editor);\n el.focus();\n }\n\n state.isUpdatingSelection = false;\n });\n }); // The autoFocus TextareaHTMLAttribute doesn't do anything on a div, so it\n // needs to be manually focused.\n\n useEffect(() => {\n if (ref.current && autoFocus) {\n ref.current.focus();\n }\n }, [autoFocus]); // Listen on the native `selectionchange` event to be able to update any time\n // the selection changes. This is required because React's `onSelect` is leaky\n // and non-standard so it doesn't fire until after a selection has been\n // released. This causes issues in situations where another change happens\n // while a selection is being dragged.\n\n var onDOMSelectionChange = useCallback(throttle(() => {\n if (!ReactEditor.isComposing(editor) && !state.isUpdatingSelection && !state.isDraggingInternally) {\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n var {\n activeElement\n } = root;\n var el = ReactEditor.toDOMNode(editor, editor);\n var domSelection = root.getSelection();\n\n if (activeElement === el) {\n state.latestElement = activeElement;\n IS_FOCUSED.set(editor, true);\n } else {\n IS_FOCUSED.delete(editor);\n }\n\n if (!domSelection) {\n return Transforms.deselect(editor);\n }\n\n var {\n anchorNode,\n focusNode\n } = domSelection;\n var anchorNodeSelectable = hasEditableTarget(editor, anchorNode) || isTargetInsideNonReadonlyVoid(editor, anchorNode);\n var focusNodeSelectable = hasEditableTarget(editor, focusNode) || isTargetInsideNonReadonlyVoid(editor, focusNode);\n\n if (anchorNodeSelectable && focusNodeSelectable) {\n var range = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: false\n });\n Transforms.select(editor, range);\n }\n }\n }, 100), [readOnly]);\n var scheduleOnDOMSelectionChange = useMemo(() => debounce(onDOMSelectionChange, 0), [onDOMSelectionChange]); // Listen on the native `beforeinput` event to get real \"Level 2\" events. This\n // is required because React's `beforeinput` is fake and never really attaches\n // to the real event sadly. (2019/11/01)\n // https://github.com/facebook/react/issues/11211\n\n var onDOMBeforeInput = useCallback(event => {\n if (!readOnly && hasEditableTarget(editor, event.target) && !isDOMEventHandled(event, propsOnDOMBeforeInput)) {\n var _EDITOR_TO_USER_SELEC;\n\n // Some IMEs/Chrome extensions like e.g. Grammarly set the selection immediately before\n // triggering a `beforeinput` expecting the change to be applied to the immediately before\n // set selection.\n scheduleOnDOMSelectionChange.flush();\n onDOMSelectionChange.flush();\n var {\n selection\n } = editor;\n var {\n inputType: type\n } = event;\n var data = event.dataTransfer || event.data || undefined; // These two types occur while a user is composing text and can't be\n // cancelled. Let them through and wait for the composition to end.\n\n if (type === 'insertCompositionText' || type === 'deleteCompositionText') {\n return;\n }\n\n var native = false;\n\n if (type === 'insertText' && selection && Range.isCollapsed(selection) && // Only use native character insertion for single characters a-z or space for now.\n // Long-press events (hold a + press 4 = ä) to choose a special character otherwise\n // causes duplicate inserts.\n event.data && event.data.length === 1 && /[a-z ]/i.test(event.data) && // Chrome has issues correctly editing the start of nodes: https://bugs.chromium.org/p/chromium/issues/detail?id=1249405\n // When there is an inline element, e.g. a link, and you select\n // right after it (the start of the next node).\n selection.anchor.offset !== 0) {\n var _node$parentElement;\n\n native = true; // Skip native if there are marks, as\n // `insertText` will insert a node, not just text.\n\n if (editor.marks) {\n native = false;\n } // Chrome also has issues correctly editing the end of anchor elements: https://bugs.chromium.org/p/chromium/issues/detail?id=1259100\n // Therefore we don't allow native events to insert text at the end of anchor nodes.\n\n\n var {\n anchor\n } = selection;\n var [node, offset] = ReactEditor.toDOMPoint(editor, anchor);\n var anchorNode = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.closest('a');\n\n if (anchorNode && ReactEditor.hasDOMNode(editor, anchorNode)) {\n var _lastText$textContent;\n\n var {\n document\n } = ReactEditor.getWindow(editor); // Find the last text node inside the anchor.\n\n var lastText = document.createTreeWalker(anchorNode, NodeFilter.SHOW_TEXT).lastChild();\n\n if (lastText === node && ((_lastText$textContent = lastText.textContent) === null || _lastText$textContent === void 0 ? void 0 : _lastText$textContent.length) === offset) {\n native = false;\n }\n }\n } // COMPAT: For the deleting forward/backward input types we don't want\n // to change the selection because it is the range that will be deleted,\n // and those commands determine that for themselves.\n\n\n if (!type.startsWith('delete') || type.startsWith('deleteBy')) {\n var [targetRange] = event.getTargetRanges();\n\n if (targetRange) {\n var range = ReactEditor.toSlateRange(editor, targetRange, {\n exactMatch: false,\n suppressThrow: false\n });\n\n if (!selection || !Range.equals(selection, range)) {\n native = false;\n var selectionRef = editor.selection && Editor.rangeRef(editor, editor.selection);\n Transforms.select(editor, range);\n\n if (selectionRef) {\n EDITOR_TO_USER_SELECTION.set(editor, selectionRef);\n }\n }\n }\n }\n\n if (!native) {\n event.preventDefault();\n } // COMPAT: If the selection is expanded, even if the command seems like\n // a delete forward/backward command it should delete the selection.\n\n\n if (selection && Range.isExpanded(selection) && type.startsWith('delete')) {\n var direction = type.endsWith('Backward') ? 'backward' : 'forward';\n Editor.deleteFragment(editor, {\n direction\n });\n return;\n }\n\n switch (type) {\n case 'deleteByComposition':\n case 'deleteByCut':\n case 'deleteByDrag':\n {\n Editor.deleteFragment(editor);\n break;\n }\n\n case 'deleteContent':\n case 'deleteContentForward':\n {\n Editor.deleteForward(editor);\n break;\n }\n\n case 'deleteContentBackward':\n {\n Editor.deleteBackward(editor);\n break;\n }\n\n case 'deleteEntireSoftLine':\n {\n Editor.deleteBackward(editor, {\n unit: 'line'\n });\n Editor.deleteForward(editor, {\n unit: 'line'\n });\n break;\n }\n\n case 'deleteHardLineBackward':\n {\n Editor.deleteBackward(editor, {\n unit: 'block'\n });\n break;\n }\n\n case 'deleteSoftLineBackward':\n {\n Editor.deleteBackward(editor, {\n unit: 'line'\n });\n break;\n }\n\n case 'deleteHardLineForward':\n {\n Editor.deleteForward(editor, {\n unit: 'block'\n });\n break;\n }\n\n case 'deleteSoftLineForward':\n {\n Editor.deleteForward(editor, {\n unit: 'line'\n });\n break;\n }\n\n case 'deleteWordBackward':\n {\n Editor.deleteBackward(editor, {\n unit: 'word'\n });\n break;\n }\n\n case 'deleteWordForward':\n {\n Editor.deleteForward(editor, {\n unit: 'word'\n });\n break;\n }\n\n case 'insertLineBreak':\n Editor.insertSoftBreak(editor);\n break;\n\n case 'insertParagraph':\n {\n Editor.insertBreak(editor);\n break;\n }\n\n case 'insertFromComposition':\n case 'insertFromDrop':\n case 'insertFromPaste':\n case 'insertFromYank':\n case 'insertReplacementText':\n case 'insertText':\n {\n var {\n selection: _selection\n } = editor;\n\n if (_selection) {\n if (Range.isExpanded(_selection)) {\n Editor.deleteFragment(editor);\n }\n }\n\n if (type === 'insertFromComposition') {\n // COMPAT: in Safari, `compositionend` is dispatched after the\n // `beforeinput` for \"insertFromComposition\". But if we wait for it\n // then we will abort because we're still composing and the selection\n // won't be updated properly.\n // https://www.w3.org/TR/input-events-2/\n if (ReactEditor.isComposing(editor)) {\n setIsComposing(false);\n IS_COMPOSING.set(editor, false);\n }\n } // use a weak comparison instead of 'instanceof' to allow\n // programmatic access of paste events coming from external windows\n // like cypress where cy.window does not work realibly\n\n\n if ((data === null || data === void 0 ? void 0 : data.constructor.name) === 'DataTransfer') {\n ReactEditor.insertData(editor, data);\n } else if (typeof data === 'string') {\n // Only insertText operations use the native functionality, for now.\n // Potentially expand to single character deletes, as well.\n if (native) {\n deferredOperations.current.push(() => Editor.insertText(editor, data));\n } else {\n Editor.insertText(editor, data);\n }\n }\n\n break;\n }\n } // Restore the actual user section if nothing manually set it.\n\n\n var toRestore = (_EDITOR_TO_USER_SELEC = EDITOR_TO_USER_SELECTION.get(editor)) === null || _EDITOR_TO_USER_SELEC === void 0 ? void 0 : _EDITOR_TO_USER_SELEC.unref();\n EDITOR_TO_USER_SELECTION.delete(editor);\n\n if (toRestore && (!editor.selection || !Range.equals(editor.selection, toRestore))) {\n Transforms.select(editor, toRestore);\n }\n }\n }, [readOnly, propsOnDOMBeforeInput]); // Attach a native DOM event handler for `beforeinput` events, because React's\n // built-in `onBeforeInput` is actually a leaky polyfill that doesn't expose\n // real `beforeinput` events sadly... (2019/11/04)\n // https://github.com/facebook/react/issues/11211\n\n useIsomorphicLayoutEffect(() => {\n if (ref.current && HAS_BEFORE_INPUT_SUPPORT) {\n // @ts-ignore The `beforeinput` event isn't recognized.\n ref.current.addEventListener('beforeinput', onDOMBeforeInput);\n }\n\n return () => {\n if (ref.current && HAS_BEFORE_INPUT_SUPPORT) {\n // @ts-ignore The `beforeinput` event isn't recognized.\n ref.current.removeEventListener('beforeinput', onDOMBeforeInput);\n }\n };\n }, [onDOMBeforeInput]); // Attach a native DOM event handler for `selectionchange`, because React's\n // built-in `onSelect` handler doesn't fire for all selection changes. It's a\n // leaky polyfill that only fires on keypresses or clicks. Instead, we want to\n // fire for any change to the selection inside the editor. (2019/11/04)\n // https://github.com/facebook/react/issues/5785\n\n useIsomorphicLayoutEffect(() => {\n var window = ReactEditor.getWindow(editor);\n window.document.addEventListener('selectionchange', scheduleOnDOMSelectionChange);\n return () => {\n window.document.removeEventListener('selectionchange', scheduleOnDOMSelectionChange);\n };\n }, [scheduleOnDOMSelectionChange]);\n var decorations = decorate([editor, []]);\n\n if (placeholder && editor.children.length === 1 && Array.from(Node.texts(editor)).length === 1 && Node.string(editor) === '' && !isComposing) {\n var start = Editor.start(editor, []);\n decorations.push({\n [PLACEHOLDER_SYMBOL]: true,\n placeholder,\n anchor: start,\n focus: start\n });\n }\n\n return /*#__PURE__*/React.createElement(ReadOnlyContext.Provider, {\n value: readOnly\n }, /*#__PURE__*/React.createElement(DecorateContext.Provider, {\n value: decorate\n }, /*#__PURE__*/React.createElement(Component, Object.assign({\n role: readOnly ? undefined : 'textbox'\n }, attributes, {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we'd\n // have to use hacks to make these replacement-based features work.\n // For SSR situations HAS_BEFORE_INPUT_SUPPORT is false and results in prop\n // mismatch warning app moves to browser. Pass-through consumer props when\n // not CAN_USE_DOM (SSR) and default to falsy value\n spellCheck: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.spellCheck : false,\n autoCorrect: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autoCorrect : 'false',\n autoCapitalize: HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autoCapitalize : 'false',\n \"data-slate-editor\": true,\n \"data-slate-node\": \"value\",\n // explicitly set this\n contentEditable: !readOnly,\n // in some cases, a decoration needs access to the range / selection to decorate a text node,\n // then you will select the whole text node when you select part the of text\n // this magic zIndex=\"-1\" will fix it\n zindex: -1,\n suppressContentEditableWarning: true,\n ref: ref,\n style: _objectSpread$1({\n // Allow positioning relative to the editable element.\n position: 'relative',\n // Prevent the default outline styles.\n outline: 'none',\n // Preserve adjacent whitespace and new lines.\n whiteSpace: 'pre-wrap',\n // Allow words to break if they are too long.\n wordWrap: 'break-word'\n }, style),\n onBeforeInput: useCallback(event => {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to React's leaky polyfill instead just for it. It\n // only works for the `insertText` input type.\n if (!HAS_BEFORE_INPUT_SUPPORT && !readOnly && !isEventHandled(event, attributes.onBeforeInput) && hasEditableTarget(editor, event.target)) {\n event.preventDefault();\n\n if (!ReactEditor.isComposing(editor)) {\n var text = event.data;\n Editor.insertText(editor, text);\n }\n }\n }, [readOnly]),\n onInput: useCallback(event => {\n // Flush native operations, as native events will have propogated\n // and we can correctly compare DOM text values in components\n // to stop rendering, so that browser functions like autocorrect\n // and spellcheck work as expected.\n for (var op of deferredOperations.current) {\n op();\n }\n\n deferredOperations.current = [];\n }, []),\n onBlur: useCallback(event => {\n if (readOnly || state.isUpdatingSelection || !hasEditableTarget(editor, event.target) || isEventHandled(event, attributes.onBlur)) {\n return;\n } // COMPAT: If the current `activeElement` is still the previous\n // one, this is due to the window being blurred when the tab\n // itself becomes unfocused, so we want to abort early to allow to\n // editor to stay focused when the tab becomes focused again.\n\n\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n\n if (state.latestElement === root.activeElement) {\n return;\n }\n\n var {\n relatedTarget\n } = event;\n var el = ReactEditor.toDOMNode(editor, editor); // COMPAT: The event should be ignored if the focus is returning\n // to the editor from an embedded editable element (eg. an \n // element inside a void node).\n\n if (relatedTarget === el) {\n return;\n } // COMPAT: The event should be ignored if the focus is moving from\n // the editor to inside a void node's spacer element.\n\n\n if (isDOMElement(relatedTarget) && relatedTarget.hasAttribute('data-slate-spacer')) {\n return;\n } // COMPAT: The event should be ignored if the focus is moving to a\n // non- editable section of an element that isn't a void node (eg.\n // a list item of the check list example).\n\n\n if (relatedTarget != null && isDOMNode(relatedTarget) && ReactEditor.hasDOMNode(editor, relatedTarget)) {\n var node = ReactEditor.toSlateNode(editor, relatedTarget);\n\n if (Element$1.isElement(node) && !editor.isVoid(node)) {\n return;\n }\n } // COMPAT: Safari doesn't always remove the selection even if the content-\n // editable element no longer has focus. Refer to:\n // https://stackoverflow.com/questions/12353247/force-contenteditable-div-to-stop-accepting-input-after-it-loses-focus-under-web\n\n\n if (IS_SAFARI) {\n var domSelection = root.getSelection();\n domSelection === null || domSelection === void 0 ? void 0 : domSelection.removeAllRanges();\n }\n\n IS_FOCUSED.delete(editor);\n }, [readOnly, attributes.onBlur]),\n onClick: useCallback(event => {\n if (hasTarget(editor, event.target) && !isEventHandled(event, attributes.onClick) && isDOMNode(event.target)) {\n var node = ReactEditor.toSlateNode(editor, event.target);\n var path = ReactEditor.findPath(editor, node); // At this time, the Slate document may be arbitrarily different,\n // because onClick handlers can change the document before we get here.\n // Therefore we must check that this path actually exists,\n // and that it still refers to the same node.\n\n if (!Editor.hasPath(editor, path) || Node.get(editor, path) !== node) {\n return;\n }\n\n if (event.detail === TRIPLE_CLICK && path.length >= 1) {\n var blockPath = path;\n\n if (!Editor.isBlock(editor, node)) {\n var _block$;\n\n var block = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: path\n });\n blockPath = (_block$ = block === null || block === void 0 ? void 0 : block[1]) !== null && _block$ !== void 0 ? _block$ : path.slice(0, 1);\n }\n\n var range = Editor.range(editor, blockPath);\n Transforms.select(editor, range);\n return;\n }\n\n if (readOnly) {\n return;\n }\n\n var _start = Editor.start(editor, path);\n\n var end = Editor.end(editor, path);\n var startVoid = Editor.void(editor, {\n at: _start\n });\n var endVoid = Editor.void(editor, {\n at: end\n });\n\n if (startVoid && endVoid && Path.equals(startVoid[1], endVoid[1])) {\n var _range = Editor.range(editor, _start);\n\n Transforms.select(editor, _range);\n }\n }\n }, [readOnly, attributes.onClick]),\n onCompositionEnd: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionEnd)) {\n if (ReactEditor.isComposing(editor)) {\n setIsComposing(false);\n IS_COMPOSING.set(editor, false);\n } // COMPAT: In Chrome, `beforeinput` events for compositions\n // aren't correct and never fire the \"insertFromComposition\"\n // type that we need. So instead, insert whenever a composition\n // ends since it will already have been committed to the DOM.\n\n\n if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && !IS_QQBROWSER && !IS_WECHATBROWSER && !IS_UC_MOBILE && event.data) {\n Editor.insertText(editor, event.data);\n }\n\n if (editor.selection && Range.isCollapsed(editor.selection)) {\n var leafPath = editor.selection.anchor.path;\n var currentTextNode = Node.leaf(editor, leafPath);\n\n if (state.hasInsertPrefixInCompositon) {\n state.hasInsertPrefixInCompositon = false;\n Editor.withoutNormalizing(editor, () => {\n // remove Unicode BOM prefix added in `onCompositionStart`\n var text = currentTextNode.text.replace(/^\\uFEFF/, '');\n Transforms.delete(editor, {\n distance: currentTextNode.text.length,\n reverse: true\n });\n Editor.insertText(editor, text);\n });\n }\n }\n }\n }, [attributes.onCompositionEnd]),\n onCompositionUpdate: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionUpdate)) {\n if (!ReactEditor.isComposing(editor)) {\n setIsComposing(true);\n IS_COMPOSING.set(editor, true);\n }\n }\n }, [attributes.onCompositionUpdate]),\n onCompositionStart: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionStart)) {\n var {\n selection,\n marks\n } = editor;\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Editor.deleteFragment(editor);\n return;\n }\n\n var inline = Editor.above(editor, {\n match: n => Editor.isInline(editor, n),\n mode: 'highest'\n });\n\n if (inline) {\n var [, inlinePath] = inline;\n\n if (Editor.isEnd(editor, selection.anchor, inlinePath)) {\n var point = Editor.after(editor, inlinePath);\n Transforms.setSelection(editor, {\n anchor: point,\n focus: point\n });\n }\n } // insert new node in advance to ensure composition text will insert\n // along with final input text\n // add Unicode BOM prefix to avoid normalize removing this node\n\n\n if (marks) {\n state.hasInsertPrefixInCompositon = true;\n Transforms.insertNodes(editor, _objectSpread$1({\n text: '\\uFEFF'\n }, marks), {\n select: true\n });\n }\n }\n }\n }, [attributes.onCompositionStart]),\n onCopy: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCopy)) {\n event.preventDefault();\n ReactEditor.setFragmentData(editor, event.clipboardData, 'copy');\n }\n }, [attributes.onCopy]),\n onCut: useCallback(event => {\n if (!readOnly && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCut)) {\n event.preventDefault();\n ReactEditor.setFragmentData(editor, event.clipboardData, 'cut');\n var {\n selection\n } = editor;\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Editor.deleteFragment(editor);\n } else {\n var node = Node.parent(editor, selection.anchor.path);\n\n if (Editor.isVoid(editor, node)) {\n Transforms.delete(editor);\n }\n }\n }\n }\n }, [readOnly, attributes.onCut]),\n onDragOver: useCallback(event => {\n if (hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragOver)) {\n // Only when the target is void, call `preventDefault` to signal\n // that drops are allowed. Editable content is droppable by\n // default, and calling `preventDefault` hides the cursor.\n var node = ReactEditor.toSlateNode(editor, event.target);\n\n if (Editor.isVoid(editor, node)) {\n event.preventDefault();\n }\n }\n }, [attributes.onDragOver]),\n onDragStart: useCallback(event => {\n if (!readOnly && hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDragStart)) {\n var node = ReactEditor.toSlateNode(editor, event.target);\n var path = ReactEditor.findPath(editor, node);\n var voidMatch = Editor.isVoid(editor, node) || Editor.void(editor, {\n at: path,\n voids: true\n }); // If starting a drag on a void node, make sure it is selected\n // so that it shows up in the selection's fragment.\n\n if (voidMatch) {\n var range = Editor.range(editor, path);\n Transforms.select(editor, range);\n }\n\n state.isDraggingInternally = true;\n ReactEditor.setFragmentData(editor, event.dataTransfer, 'drag');\n }\n }, [readOnly, attributes.onDragStart]),\n onDrop: useCallback(event => {\n if (!readOnly && hasTarget(editor, event.target) && !isEventHandled(event, attributes.onDrop)) {\n event.preventDefault(); // Keep a reference to the dragged range before updating selection\n\n var draggedRange = editor.selection; // Find the range where the drop happened\n\n var range = ReactEditor.findEventRange(editor, event);\n var data = event.dataTransfer;\n Transforms.select(editor, range);\n\n if (state.isDraggingInternally) {\n if (draggedRange && !Range.equals(draggedRange, range) && !Editor.void(editor, {\n at: range,\n voids: true\n })) {\n Transforms.delete(editor, {\n at: draggedRange\n });\n }\n }\n\n ReactEditor.insertData(editor, data); // When dragging from another source into the editor, it's possible\n // that the current editor does not have focus.\n\n if (!ReactEditor.isFocused(editor)) {\n ReactEditor.focus(editor);\n }\n }\n\n state.isDraggingInternally = false;\n }, [readOnly, attributes.onDrop]),\n onDragEnd: useCallback(event => {\n if (!readOnly && state.isDraggingInternally && attributes.onDragEnd && hasTarget(editor, event.target)) {\n attributes.onDragEnd(event);\n } // When dropping on a different droppable element than the current editor,\n // `onDrop` is not called. So we need to clean up in `onDragEnd` instead.\n // Note: `onDragEnd` is only called when `onDrop` is not called\n\n\n state.isDraggingInternally = false;\n }, [readOnly, attributes.onDragEnd]),\n onFocus: useCallback(event => {\n if (!readOnly && !state.isUpdatingSelection && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onFocus)) {\n var el = ReactEditor.toDOMNode(editor, editor);\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n state.latestElement = root.activeElement; // COMPAT: If the editor has nested editable elements, the focus\n // can go to them. In Firefox, this must be prevented because it\n // results in issues with keyboard navigation. (2017/03/30)\n\n if (IS_FIREFOX && event.target !== el) {\n el.focus();\n return;\n }\n\n IS_FOCUSED.set(editor, true);\n }\n }, [readOnly, attributes.onFocus]),\n onKeyDown: useCallback(event => {\n if (!readOnly && hasEditableTarget(editor, event.target)) {\n var {\n nativeEvent\n } = event; // COMPAT: The composition end event isn't fired reliably in all browsers,\n // so we sometimes might end up stuck in a composition state even though we\n // aren't composing any more.\n\n if (ReactEditor.isComposing(editor) && nativeEvent.isComposing === false) {\n IS_COMPOSING.set(editor, false);\n setIsComposing(false);\n }\n\n if (isEventHandled(event, attributes.onKeyDown) || ReactEditor.isComposing(editor)) {\n return;\n }\n\n var {\n selection\n } = editor;\n var element = editor.children[selection !== null ? selection.focus.path[0] : 0];\n var isRTL = getDirection(Node.string(element)) === 'rtl'; // COMPAT: Since we prevent the default behavior on\n // `beforeinput` events, the browser doesn't think there's ever\n // any history stack to undo or redo, so we have to manage these\n // hotkeys ourselves. (2019/11/06)\n\n if (Hotkeys.isRedo(nativeEvent)) {\n event.preventDefault();\n var maybeHistoryEditor = editor;\n\n if (typeof maybeHistoryEditor.redo === 'function') {\n maybeHistoryEditor.redo();\n }\n\n return;\n }\n\n if (Hotkeys.isUndo(nativeEvent)) {\n event.preventDefault();\n var _maybeHistoryEditor = editor;\n\n if (typeof _maybeHistoryEditor.undo === 'function') {\n _maybeHistoryEditor.undo();\n }\n\n return;\n } // COMPAT: Certain browsers don't handle the selection updates\n // properly. In Chrome, the selection isn't properly extended.\n // And in Firefox, the selection isn't properly collapsed.\n // (2017/10/17)\n\n\n if (Hotkeys.isMoveLineBackward(nativeEvent)) {\n event.preventDefault();\n Transforms.move(editor, {\n unit: 'line',\n reverse: true\n });\n return;\n }\n\n if (Hotkeys.isMoveLineForward(nativeEvent)) {\n event.preventDefault();\n Transforms.move(editor, {\n unit: 'line'\n });\n return;\n }\n\n if (Hotkeys.isExtendLineBackward(nativeEvent)) {\n event.preventDefault();\n Transforms.move(editor, {\n unit: 'line',\n edge: 'focus',\n reverse: true\n });\n return;\n }\n\n if (Hotkeys.isExtendLineForward(nativeEvent)) {\n event.preventDefault();\n Transforms.move(editor, {\n unit: 'line',\n edge: 'focus'\n });\n return;\n } // COMPAT: If a void node is selected, or a zero-width text node\n // adjacent to an inline is selected, we need to handle these\n // hotkeys manually because browsers won't be able to skip over\n // the void node with the zero-width space not being an empty\n // string.\n\n\n if (Hotkeys.isMoveBackward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.move(editor, {\n reverse: !isRTL\n });\n } else {\n Transforms.collapse(editor, {\n edge: 'start'\n });\n }\n\n return;\n }\n\n if (Hotkeys.isMoveForward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isCollapsed(selection)) {\n Transforms.move(editor, {\n reverse: isRTL\n });\n } else {\n Transforms.collapse(editor, {\n edge: 'end'\n });\n }\n\n return;\n }\n\n if (Hotkeys.isMoveWordBackward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.collapse(editor, {\n edge: 'focus'\n });\n }\n\n Transforms.move(editor, {\n unit: 'word',\n reverse: !isRTL\n });\n return;\n }\n\n if (Hotkeys.isMoveWordForward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Transforms.collapse(editor, {\n edge: 'focus'\n });\n }\n\n Transforms.move(editor, {\n unit: 'word',\n reverse: isRTL\n });\n return;\n } // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to guessing at the input intention for hotkeys.\n // COMPAT: In iOS, some of these hotkeys are handled in the\n\n\n if (!HAS_BEFORE_INPUT_SUPPORT) {\n // We don't have a core behavior for these, but they change the\n // DOM if we don't prevent them, so we have to.\n if (Hotkeys.isBold(nativeEvent) || Hotkeys.isItalic(nativeEvent) || Hotkeys.isTransposeCharacter(nativeEvent)) {\n event.preventDefault();\n return;\n }\n\n if (Hotkeys.isSoftBreak(nativeEvent)) {\n event.preventDefault();\n Editor.insertSoftBreak(editor);\n return;\n }\n\n if (Hotkeys.isSplitBlock(nativeEvent)) {\n event.preventDefault();\n Editor.insertBreak(editor);\n return;\n }\n\n if (Hotkeys.isDeleteBackward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward'\n });\n } else {\n Editor.deleteBackward(editor);\n }\n\n return;\n }\n\n if (Hotkeys.isDeleteForward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward'\n });\n } else {\n Editor.deleteForward(editor);\n }\n\n return;\n }\n\n if (Hotkeys.isDeleteLineBackward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward'\n });\n } else {\n Editor.deleteBackward(editor, {\n unit: 'line'\n });\n }\n\n return;\n }\n\n if (Hotkeys.isDeleteLineForward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward'\n });\n } else {\n Editor.deleteForward(editor, {\n unit: 'line'\n });\n }\n\n return;\n }\n\n if (Hotkeys.isDeleteWordBackward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'backward'\n });\n } else {\n Editor.deleteBackward(editor, {\n unit: 'word'\n });\n }\n\n return;\n }\n\n if (Hotkeys.isDeleteWordForward(nativeEvent)) {\n event.preventDefault();\n\n if (selection && Range.isExpanded(selection)) {\n Editor.deleteFragment(editor, {\n direction: 'forward'\n });\n } else {\n Editor.deleteForward(editor, {\n unit: 'word'\n });\n }\n\n return;\n }\n } else {\n if (IS_CHROME || IS_SAFARI) {\n // COMPAT: Chrome and Safari support `beforeinput` event but do not fire\n // an event when deleting backwards in a selected void inline node\n if (selection && (Hotkeys.isDeleteBackward(nativeEvent) || Hotkeys.isDeleteForward(nativeEvent)) && Range.isCollapsed(selection)) {\n var currentNode = Node.parent(editor, selection.anchor.path);\n\n if (Element$1.isElement(currentNode) && Editor.isVoid(editor, currentNode) && Editor.isInline(editor, currentNode)) {\n event.preventDefault();\n Editor.deleteBackward(editor, {\n unit: 'block'\n });\n return;\n }\n }\n }\n }\n }\n }, [readOnly, attributes.onKeyDown]),\n onPaste: useCallback(event => {\n if (!readOnly && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onPaste)) {\n // COMPAT: Certain browsers don't support the `beforeinput` event, so we\n // fall back to React's `onPaste` here instead.\n // COMPAT: Firefox, Chrome and Safari don't emit `beforeinput` events\n // when \"paste without formatting\" is used, so fallback. (2020/02/20)\n if (!HAS_BEFORE_INPUT_SUPPORT || isPlainTextOnlyPaste(event.nativeEvent)) {\n event.preventDefault();\n ReactEditor.insertData(editor, event.clipboardData);\n }\n }\n }, [readOnly, attributes.onPaste])\n }), /*#__PURE__*/React.createElement(Children, {\n decorations: decorations,\n node: editor,\n renderElement: renderElement,\n renderPlaceholder: renderPlaceholder,\n renderLeaf: renderLeaf,\n selection: editor.selection\n }))));\n};\n/**\r\n * The default placeholder element\r\n */\n\nvar DefaultPlaceholder = _ref => {\n var {\n attributes,\n children\n } = _ref;\n return /*#__PURE__*/React.createElement(\"span\", Object.assign({}, attributes), children);\n};\n/**\r\n * A default memoized decorate function.\r\n */\n\nvar defaultDecorate = () => [];\n/**\r\n * A default implement to scroll dom range into view.\r\n */\n\nvar defaultScrollSelectionIntoView = (editor, domRange) => {\n // This was affecting the selection of multiple blocks and dragging behavior,\n // so enabled only if the selection has been collapsed.\n if (!editor.selection || editor.selection && Range.isCollapsed(editor.selection)) {\n var leafEl = domRange.startContainer.parentElement;\n leafEl.getBoundingClientRect = domRange.getBoundingClientRect.bind(domRange);\n scrollIntoView(leafEl, {\n scrollMode: 'if-needed'\n });\n delete leafEl.getBoundingClientRect;\n }\n};\n/**\r\n * Check if the target is in the editor.\r\n */\n\n\nvar hasTarget = (editor, target) => {\n return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target);\n};\n/**\r\n * Check if the target is editable and in the editor.\r\n */\n\nvar hasEditableTarget = (editor, target) => {\n return isDOMNode(target) && ReactEditor.hasDOMNode(editor, target, {\n editable: true\n });\n};\n/**\r\n * Check if the target is inside void and in an non-readonly editor.\r\n */\n\nvar isTargetInsideNonReadonlyVoid = (editor, target) => {\n if (IS_READ_ONLY.get(editor)) return false;\n var slateNode = hasTarget(editor, target) && ReactEditor.toSlateNode(editor, target);\n return Editor.isVoid(editor, slateNode);\n};\n/**\r\n * Check if an event is overrided by a handler.\r\n */\n\nvar isEventHandled = (event, handler) => {\n if (!handler) {\n return false;\n } // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n\n\n var shouldTreatEventAsHandled = handler(event);\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled;\n }\n\n return event.isDefaultPrevented() || event.isPropagationStopped();\n};\n/**\r\n * Check if a DOM event is overrided by a handler.\r\n */\n\nvar isDOMEventHandled = (event, handler) => {\n if (!handler) {\n return false;\n } // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n\n\n var shouldTreatEventAsHandled = handler(event);\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled;\n }\n\n return event.defaultPrevented;\n};\n\n/**\r\n * Returns the number of characters that are the same at the beginning of the\r\n * String.\r\n *\r\n * @param prev the previous text\r\n * @param next the next text\r\n * @returns the offset of the start of the difference; null if there is no difference\r\n */\n\nfunction getDiffStart(prev, next) {\n var length = Math.min(prev.length, next.length);\n\n for (var i = 0; i < length; i++) {\n if (prev.charAt(i) !== next.charAt(i)) return i;\n }\n\n if (prev.length !== next.length) return length;\n return null;\n}\n/**\r\n * Returns the number of characters that are the same at the end of the String\r\n * up to `max`. Max prevents double-counting characters when there are\r\n * multiple duplicate characters around the diff area.\r\n *\r\n * @param prev the previous text\r\n * @param next the next text\r\n * @param max the max length to test.\r\n * @returns number of characters that are the same at the end of the string\r\n */\n\n\nfunction getDiffEnd(prev, next, max) {\n var prevLength = prev.length;\n var nextLength = next.length;\n var length = Math.min(prevLength, nextLength, max);\n\n for (var i = 0; i < length; i++) {\n var prevChar = prev.charAt(prevLength - i - 1);\n var nextChar = next.charAt(nextLength - i - 1);\n if (prevChar !== nextChar) return i;\n }\n\n if (prev.length !== next.length) return length;\n return null;\n}\n/**\r\n * Takes two strings and returns an object representing two offsets. The\r\n * first, `start` represents the number of characters that are the same at\r\n * the front of the String. The `end` represents the number of characters\r\n * that are the same at the end of the String.\r\n *\r\n * Returns null if they are identical.\r\n *\r\n * @param prev the previous text\r\n * @param next the next text\r\n * @returns the difference text range; null if there are no differences.\r\n */\n\n\nfunction getDiffOffsets(prev, next) {\n if (prev === next) return null;\n var start = getDiffStart(prev, next);\n if (start === null) return null;\n var maxEnd = Math.min(prev.length - start, next.length - start);\n var end = getDiffEnd(prev, next, maxEnd);\n if (end === null) return null;\n return {\n start,\n end\n };\n}\n/**\r\n * Takes a text string and returns a slice from the string at the given text range\r\n *\r\n * @param text the text\r\n * @param offsets the text range\r\n * @returns the text slice at text range\r\n */\n\n\nfunction sliceText(text, offsets) {\n return text.slice(offsets.start, text.length - offsets.end);\n}\n/**\r\n * Takes two strings and returns a smart diff that can be used to describe the\r\n * change in a way that can be used as operations like inserting, removing or\r\n * replacing text.\r\n *\r\n * @param prev the previous text\r\n * @param next the next text\r\n * @returns the text difference\r\n */\n\n\nfunction diffText(prev, next) {\n if (prev === undefined || next === undefined) return null;\n var offsets = getDiffOffsets(prev, next);\n if (offsets == null) return null;\n var insertText = sliceText(next, offsets);\n var removeText = sliceText(prev, offsets);\n return {\n start: offsets.start,\n end: prev.length - offsets.end,\n insertText,\n removeText\n };\n}\nfunction combineInsertedText(insertedText) {\n return insertedText.reduce((acc, _ref) => {\n var {\n text\n } = _ref;\n return \"\".concat(acc).concat(text.insertText);\n }, '');\n}\nfunction getTextInsertion(editor, domNode) {\n var node = ReactEditor.toSlateNode(editor, domNode);\n\n if (!Text$1.isText(node)) {\n return undefined;\n }\n\n var prevText = node.text;\n var nextText = domNode.textContent; // textContent will pad an extra \\n when the textContent ends with an \\n\n\n if (nextText.endsWith('\\n')) {\n nextText = nextText.slice(0, nextText.length - 1);\n } // If the text is no different, there is no diff.\n\n\n if (nextText !== prevText) {\n var textDiff = diffText(prevText, nextText);\n\n if (textDiff !== null) {\n var textPath = ReactEditor.findPath(editor, node);\n return {\n text: textDiff,\n path: textPath\n };\n }\n }\n\n return undefined;\n}\nfunction normalizeTextInsertionRange(editor, range, _ref2) {\n var {\n path,\n text\n } = _ref2;\n var insertionRange = {\n anchor: {\n path,\n offset: text.start\n },\n focus: {\n path,\n offset: text.end\n }\n };\n\n if (!range || !Range.isCollapsed(range)) {\n return insertionRange;\n }\n\n var {\n insertText,\n removeText\n } = text;\n var isSingleCharacterInsertion = insertText.length === 1 || removeText.length === 1;\n /**\r\n * This code handles edge cases that arise from text diffing when the\r\n * inserted or removed character is a single character, and the character\r\n * right before or after the anchor is the same as the one being inserted or\r\n * removed.\r\n *\r\n * Take this example: hello|o\r\n *\r\n * If another `o` is inserted at the selection's anchor in the example above,\r\n * it should be inserted at the anchor, but using text diffing, we actually\r\n * detect that the character was inserted after the second `o`:\r\n *\r\n * helloo[o]|\r\n *\r\n * Instead, in these very specific edge cases, we assume that the character\r\n * needs to be inserted after the anchor rather than where the diff was found:\r\n *\r\n * hello[o]|o\r\n */\n\n if (isSingleCharacterInsertion && Path.equals(range.anchor.path, path)) {\n var [_text] = Array.from(Editor.nodes(editor, {\n at: range,\n match: Text$1.isText\n }));\n\n if (_text) {\n var [node] = _text;\n var {\n anchor\n } = range;\n var characterBeforeAnchor = node.text[anchor.offset - 1];\n var characterAfterAnchor = node.text[anchor.offset];\n\n if (insertText.length === 1 && insertText === characterAfterAnchor) {\n // Assume text should be inserted at the anchor\n return range;\n }\n\n if (removeText.length === 1 && removeText === characterBeforeAnchor) {\n // Assume text should be removed right before the anchor\n return {\n anchor: {\n path,\n offset: anchor.offset - 1\n },\n focus: {\n path,\n offset: anchor.offset\n }\n };\n }\n }\n }\n\n return insertionRange;\n}\n\n/**\r\n * An auto-incrementing identifier for keys.\r\n */\nvar n = 0;\n/**\r\n * A class that keeps track of a key string. We use a full class here because we\r\n * want to be able to use them as keys in `WeakMap` objects.\r\n */\n\nclass Key {\n constructor() {\n this.id = \"\".concat(n++);\n }\n\n}\n\nvar ReactEditor = {\n /**\r\n * Check if the user is currently composing inside the editor.\r\n */\n isComposing(editor) {\n return !!IS_COMPOSING.get(editor);\n },\n\n /**\r\n * Return the host window of the current editor.\r\n */\n getWindow(editor) {\n var window = EDITOR_TO_WINDOW.get(editor);\n\n if (!window) {\n throw new Error('Unable to find a host window element for this editor');\n }\n\n return window;\n },\n\n /**\r\n * Find a key for a Slate node.\r\n */\n findKey(editor, node) {\n var key = NODE_TO_KEY.get(node);\n\n if (!key) {\n key = new Key();\n NODE_TO_KEY.set(node, key);\n }\n\n return key;\n },\n\n /**\r\n * Find the path of Slate node.\r\n */\n findPath(editor, node) {\n var path = [];\n var child = node;\n\n while (true) {\n var parent = NODE_TO_PARENT.get(child);\n\n if (parent == null) {\n if (Editor.isEditor(child)) {\n return path;\n } else {\n break;\n }\n }\n\n var i = NODE_TO_INDEX.get(child);\n\n if (i == null) {\n break;\n }\n\n path.unshift(i);\n child = parent;\n }\n\n throw new Error(\"Unable to find the path for Slate node: \".concat(Scrubber.stringify(node)));\n },\n\n /**\r\n * Find the DOM node that implements DocumentOrShadowRoot for the editor.\r\n */\n findDocumentOrShadowRoot(editor) {\n var el = ReactEditor.toDOMNode(editor, editor);\n var root = el.getRootNode();\n\n if ((root instanceof Document || root instanceof ShadowRoot) && root.getSelection != null) {\n return root;\n }\n\n return el.ownerDocument;\n },\n\n /**\r\n * Check if the editor is focused.\r\n */\n isFocused(editor) {\n return !!IS_FOCUSED.get(editor);\n },\n\n /**\r\n * Check if the editor is in read-only mode.\r\n */\n isReadOnly(editor) {\n return !!IS_READ_ONLY.get(editor);\n },\n\n /**\r\n * Blur the editor.\r\n */\n blur(editor) {\n var el = ReactEditor.toDOMNode(editor, editor);\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n IS_FOCUSED.set(editor, false);\n\n if (root.activeElement === el) {\n el.blur();\n }\n },\n\n /**\r\n * Focus the editor.\r\n */\n focus(editor) {\n var el = ReactEditor.toDOMNode(editor, editor);\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n IS_FOCUSED.set(editor, true);\n\n if (root.activeElement !== el) {\n el.focus({\n preventScroll: true\n });\n }\n },\n\n /**\r\n * Deselect the editor.\r\n */\n deselect(editor) {\n ReactEditor.toDOMNode(editor, editor);\n var {\n selection\n } = editor;\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n var domSelection = root.getSelection();\n\n if (domSelection && domSelection.rangeCount > 0) {\n domSelection.removeAllRanges();\n }\n\n if (selection) {\n Transforms.deselect(editor);\n }\n },\n\n /**\r\n * Check if a DOM node is within the editor.\r\n */\n hasDOMNode(editor, target) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var {\n editable = false\n } = options;\n var editorEl = ReactEditor.toDOMNode(editor, editor);\n var targetEl; // COMPAT: In Firefox, reading `target.nodeType` will throw an error if\n // target is originating from an internal \"restricted\" element (e.g. a\n // stepper arrow on a number input). (2018/05/04)\n // https://github.com/ianstormtaylor/slate/issues/1819\n\n try {\n targetEl = isDOMElement(target) ? target : target.parentElement;\n } catch (err) {\n if (!err.message.includes('Permission denied to access property \"nodeType\"')) {\n throw err;\n }\n }\n\n if (!targetEl) {\n return false;\n }\n\n return targetEl.closest(\"[data-slate-editor]\") === editorEl && (!editable || targetEl.isContentEditable ? true : typeof targetEl.isContentEditable === 'boolean' && // isContentEditable exists only on HTMLElement, and on other nodes it will be undefined\n // this is the core logic that lets you know you got the right editor.selection instead of null when editor is contenteditable=\"false\"(readOnly)\n targetEl.closest('[contenteditable=\"false\"]') === editorEl || !!targetEl.getAttribute('data-slate-zero-width'));\n },\n\n /**\r\n * Insert data from a `DataTransfer` into the editor.\r\n */\n insertData(editor, data) {\n editor.insertData(data);\n },\n\n /**\r\n * Insert fragment data from a `DataTransfer` into the editor.\r\n */\n insertFragmentData(editor, data) {\n return editor.insertFragmentData(data);\n },\n\n /**\r\n * Insert text data from a `DataTransfer` into the editor.\r\n */\n insertTextData(editor, data) {\n return editor.insertTextData(data);\n },\n\n /**\r\n * Sets data from the currently selected fragment on a `DataTransfer`.\r\n */\n setFragmentData(editor, data, originEvent) {\n editor.setFragmentData(data, originEvent);\n },\n\n /**\r\n * Find the native DOM element from a Slate node.\r\n */\n toDOMNode(editor, node) {\n var KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);\n var domNode = Editor.isEditor(node) ? EDITOR_TO_ELEMENT.get(editor) : KEY_TO_ELEMENT === null || KEY_TO_ELEMENT === void 0 ? void 0 : KEY_TO_ELEMENT.get(ReactEditor.findKey(editor, node));\n\n if (!domNode) {\n throw new Error(\"Cannot resolve a DOM node from Slate node: \".concat(Scrubber.stringify(node)));\n }\n\n return domNode;\n },\n\n /**\r\n * Find a native DOM selection point from a Slate point.\r\n */\n toDOMPoint(editor, point) {\n var [node] = Editor.node(editor, point.path);\n var el = ReactEditor.toDOMNode(editor, node);\n var domPoint; // If we're inside a void node, force the offset to 0, otherwise the zero\n // width spacing character will result in an incorrect offset of 1\n\n if (Editor.void(editor, {\n at: point\n })) {\n point = {\n path: point.path,\n offset: 0\n };\n } // For each leaf, we need to isolate its content, which means filtering\n // to its direct text and zero-width spans. (We have to filter out any\n // other siblings that may have been rendered alongside them.)\n\n\n var selector = \"[data-slate-string], [data-slate-zero-width]\";\n var texts = Array.from(el.querySelectorAll(selector));\n var start = 0;\n\n for (var text of texts) {\n var domNode = text.childNodes[0];\n\n if (domNode == null || domNode.textContent == null) {\n continue;\n }\n\n var {\n length\n } = domNode.textContent;\n var attr = text.getAttribute('data-slate-length');\n var trueLength = attr == null ? length : parseInt(attr, 10);\n var end = start + trueLength;\n\n if (point.offset <= end) {\n var offset = Math.min(length, Math.max(0, point.offset - start));\n domPoint = [domNode, offset];\n break;\n }\n\n start = end;\n }\n\n if (!domPoint) {\n throw new Error(\"Cannot resolve a DOM point from Slate point: \".concat(Scrubber.stringify(point)));\n }\n\n return domPoint;\n },\n\n /**\r\n * Find a native DOM range from a Slate `range`.\r\n *\r\n * Notice: the returned range will always be ordinal regardless of the direction of Slate `range` due to DOM API limit.\r\n *\r\n * there is no way to create a reverse DOM Range using Range.setStart/setEnd\r\n * according to https://dom.spec.whatwg.org/#concept-range-bp-set.\r\n */\n toDOMRange(editor, range) {\n var {\n anchor,\n focus\n } = range;\n var isBackward = Range.isBackward(range);\n var domAnchor = ReactEditor.toDOMPoint(editor, anchor);\n var domFocus = Range.isCollapsed(range) ? domAnchor : ReactEditor.toDOMPoint(editor, focus);\n var window = ReactEditor.getWindow(editor);\n var domRange = window.document.createRange();\n var [startNode, startOffset] = isBackward ? domFocus : domAnchor;\n var [endNode, endOffset] = isBackward ? domAnchor : domFocus; // A slate Point at zero-width Leaf always has an offset of 0 but a native DOM selection at\n // zero-width node has an offset of 1 so we have to check if we are in a zero-width node and\n // adjust the offset accordingly.\n\n var startEl = isDOMElement(startNode) ? startNode : startNode.parentElement;\n var isStartAtZeroWidth = !!startEl.getAttribute('data-slate-zero-width');\n var endEl = isDOMElement(endNode) ? endNode : endNode.parentElement;\n var isEndAtZeroWidth = !!endEl.getAttribute('data-slate-zero-width');\n domRange.setStart(startNode, isStartAtZeroWidth ? 1 : startOffset);\n domRange.setEnd(endNode, isEndAtZeroWidth ? 1 : endOffset);\n return domRange;\n },\n\n /**\r\n * Find a Slate node from a native DOM `element`.\r\n */\n toSlateNode(editor, domNode) {\n var domEl = isDOMElement(domNode) ? domNode : domNode.parentElement;\n\n if (domEl && !domEl.hasAttribute('data-slate-node')) {\n domEl = domEl.closest(\"[data-slate-node]\");\n }\n\n var node = domEl ? ELEMENT_TO_NODE.get(domEl) : null;\n\n if (!node) {\n throw new Error(\"Cannot resolve a Slate node from DOM node: \".concat(domEl));\n }\n\n return node;\n },\n\n /**\r\n * Get the target range from a DOM `event`.\r\n */\n findEventRange(editor, event) {\n if ('nativeEvent' in event) {\n event = event.nativeEvent;\n }\n\n var {\n clientX: x,\n clientY: y,\n target\n } = event;\n\n if (x == null || y == null) {\n throw new Error(\"Cannot resolve a Slate range from a DOM event: \".concat(event));\n }\n\n var node = ReactEditor.toSlateNode(editor, event.target);\n var path = ReactEditor.findPath(editor, node); // If the drop target is inside a void node, move it into either the\n // next or previous node, depending on which side the `x` and `y`\n // coordinates are closest to.\n\n if (Editor.isVoid(editor, node)) {\n var rect = target.getBoundingClientRect();\n var isPrev = editor.isInline(node) ? x - rect.left < rect.left + rect.width - x : y - rect.top < rect.top + rect.height - y;\n var edge = Editor.point(editor, path, {\n edge: isPrev ? 'start' : 'end'\n });\n var point = isPrev ? Editor.before(editor, edge) : Editor.after(editor, edge);\n\n if (point) {\n var _range = Editor.range(editor, point);\n\n return _range;\n }\n } // Else resolve a range from the caret position where the drop occured.\n\n\n var domRange;\n var {\n document\n } = ReactEditor.getWindow(editor); // COMPAT: In Firefox, `caretRangeFromPoint` doesn't exist. (2016/07/25)\n\n if (document.caretRangeFromPoint) {\n domRange = document.caretRangeFromPoint(x, y);\n } else {\n var position = document.caretPositionFromPoint(x, y);\n\n if (position) {\n domRange = document.createRange();\n domRange.setStart(position.offsetNode, position.offset);\n domRange.setEnd(position.offsetNode, position.offset);\n }\n }\n\n if (!domRange) {\n throw new Error(\"Cannot resolve a Slate range from a DOM event: \".concat(event));\n } // Resolve a Slate range from the DOM range.\n\n\n var range = ReactEditor.toSlateRange(editor, domRange, {\n exactMatch: false,\n suppressThrow: false\n });\n return range;\n },\n\n /**\r\n * Find a Slate point from a DOM selection's `domNode` and `domOffset`.\r\n */\n toSlatePoint(editor, domPoint, options) {\n var {\n exactMatch,\n suppressThrow\n } = options;\n var [nearestNode, nearestOffset] = exactMatch ? domPoint : normalizeDOMPoint(domPoint);\n var parentNode = nearestNode.parentNode;\n var textNode = null;\n var offset = 0;\n\n if (parentNode) {\n var _domNode$textContent;\n\n var editorEl = ReactEditor.toDOMNode(editor, editor);\n var potentialVoidNode = parentNode.closest('[data-slate-void=\"true\"]'); // Need to ensure that the closest void node is actually a void node\n // within this editor, and not a void node within some parent editor. This can happen\n // if this editor is within a void node of another editor (\"nested editors\", like in\n // the \"Editable Voids\" example on the docs site).\n\n var voidNode = potentialVoidNode && editorEl.contains(potentialVoidNode) ? potentialVoidNode : null;\n var leafNode = parentNode.closest('[data-slate-leaf]');\n var domNode = null; // Calculate how far into the text node the `nearestNode` is, so that we\n // can determine what the offset relative to the text node is.\n\n if (leafNode) {\n textNode = leafNode.closest('[data-slate-node=\"text\"]');\n\n if (textNode) {\n var window = ReactEditor.getWindow(editor);\n var range = window.document.createRange();\n range.setStart(textNode, 0);\n range.setEnd(nearestNode, nearestOffset);\n var contents = range.cloneContents();\n var removals = [...Array.prototype.slice.call(contents.querySelectorAll('[data-slate-zero-width]')), ...Array.prototype.slice.call(contents.querySelectorAll('[contenteditable=false]'))];\n removals.forEach(el => {\n el.parentNode.removeChild(el);\n }); // COMPAT: Edge has a bug where Range.prototype.toString() will\n // convert \\n into \\r\\n. The bug causes a loop when slate-react\n // attempts to reposition its cursor to match the native position. Use\n // textContent.length instead.\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10291116/\n\n offset = contents.textContent.length;\n domNode = textNode;\n }\n } else if (voidNode) {\n // For void nodes, the element with the offset key will be a cousin, not an\n // ancestor, so find it by going down from the nearest void parent.\n leafNode = voidNode.querySelector('[data-slate-leaf]'); // COMPAT: In read-only editors the leaf is not rendered.\n\n if (!leafNode) {\n offset = 1;\n } else {\n textNode = leafNode.closest('[data-slate-node=\"text\"]');\n domNode = leafNode;\n offset = domNode.textContent.length;\n domNode.querySelectorAll('[data-slate-zero-width]').forEach(el => {\n offset -= el.textContent.length;\n });\n }\n }\n\n if (domNode && offset === domNode.textContent.length && (parentNode.hasAttribute('data-slate-zero-width') || IS_FIREFOX && (_domNode$textContent = domNode.textContent) !== null && _domNode$textContent !== void 0 && _domNode$textContent.endsWith('\\n\\n'))) {\n offset--;\n }\n }\n\n if (!textNode) {\n if (suppressThrow) {\n return null;\n }\n\n throw new Error(\"Cannot resolve a Slate point from DOM point: \".concat(domPoint));\n } // COMPAT: If someone is clicking from one Slate editor into another,\n // the select event fires twice, once for the old editor's `element`\n // first, and then afterwards for the correct `element`. (2017/03/03)\n\n\n var slateNode = ReactEditor.toSlateNode(editor, textNode);\n var path = ReactEditor.findPath(editor, slateNode);\n return {\n path,\n offset\n };\n },\n\n /**\r\n * Find a Slate range from a DOM range or selection.\r\n */\n toSlateRange(editor, domRange, options) {\n var {\n exactMatch,\n suppressThrow\n } = options;\n var el = isDOMSelection(domRange) ? domRange.anchorNode : domRange.startContainer;\n var anchorNode;\n var anchorOffset;\n var focusNode;\n var focusOffset;\n var isCollapsed;\n\n if (el) {\n if (isDOMSelection(domRange)) {\n anchorNode = domRange.anchorNode;\n anchorOffset = domRange.anchorOffset;\n focusNode = domRange.focusNode;\n focusOffset = domRange.focusOffset; // COMPAT: There's a bug in chrome that always returns `true` for\n // `isCollapsed` for a Selection that comes from a ShadowRoot.\n // (2020/08/08)\n // https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n\n if (IS_CHROME && hasShadowRoot()) {\n isCollapsed = domRange.anchorNode === domRange.focusNode && domRange.anchorOffset === domRange.focusOffset;\n } else {\n isCollapsed = domRange.isCollapsed;\n }\n } else {\n anchorNode = domRange.startContainer;\n anchorOffset = domRange.startOffset;\n focusNode = domRange.endContainer;\n focusOffset = domRange.endOffset;\n isCollapsed = domRange.collapsed;\n }\n }\n\n if (anchorNode == null || focusNode == null || anchorOffset == null || focusOffset == null) {\n throw new Error(\"Cannot resolve a Slate range from DOM range: \".concat(domRange));\n }\n\n var anchor = ReactEditor.toSlatePoint(editor, [anchorNode, anchorOffset], {\n exactMatch,\n suppressThrow\n });\n\n if (!anchor) {\n return null;\n }\n\n var focus = isCollapsed ? anchor : ReactEditor.toSlatePoint(editor, [focusNode, focusOffset], {\n exactMatch,\n suppressThrow\n });\n\n if (!focus) {\n return null;\n }\n\n var range = {\n anchor: anchor,\n focus: focus\n }; // if the selection is a hanging range that ends in a void\n // and the DOM focus is an Element\n // (meaning that the selection ends before the element)\n // unhang the range to avoid mistakenly including the void\n\n if (Range.isExpanded(range) && Range.isForward(range) && isDOMElement(focusNode) && Editor.void(editor, {\n at: range.focus,\n mode: 'highest'\n })) {\n range = Editor.unhangRange(editor, range, {\n voids: true\n });\n }\n\n return range;\n },\n\n hasRange(editor, range) {\n var {\n anchor,\n focus\n } = range;\n return Editor.hasPath(editor, anchor.path) && Editor.hasPath(editor, focus.path);\n }\n\n};\n\nfunction gatherMutationData(editor, mutations) {\n var addedNodes = [];\n var removedNodes = [];\n var insertedText = [];\n var characterDataMutations = [];\n mutations.forEach(mutation => {\n switch (mutation.type) {\n case 'childList':\n {\n if (mutation.addedNodes.length) {\n mutation.addedNodes.forEach(addedNode => {\n addedNodes.push(addedNode);\n });\n }\n\n mutation.removedNodes.forEach(removedNode => {\n removedNodes.push(removedNode);\n });\n break;\n }\n\n case 'characterData':\n {\n characterDataMutations.push(mutation); // Changes to text nodes should consider the parent element\n\n var {\n parentNode\n } = mutation.target;\n\n if (!parentNode) {\n return;\n }\n\n var textInsertion = getTextInsertion(editor, parentNode);\n\n if (!textInsertion) {\n return;\n } // If we've already detected a diff at that path, we can return early\n\n\n if (insertedText.some(_ref => {\n var {\n path\n } = _ref;\n return Path.equals(path, textInsertion.path);\n })) {\n return;\n } // Add the text diff to the array of detected text insertions that need to be reconciled\n\n\n insertedText.push(textInsertion);\n }\n }\n });\n return {\n addedNodes,\n removedNodes,\n insertedText,\n characterDataMutations\n };\n}\n/**\r\n * In general, when a line break occurs, there will be more `addedNodes` than `removedNodes`.\r\n *\r\n * This isn't always the case however. In some cases, there will be more `removedNodes` than\r\n * `addedNodes`.\r\n *\r\n * To account for these edge cases, the most reliable strategy to detect line break mutations\r\n * is to check whether a new block was inserted of the same type as the current block.\r\n */\n\nvar isLineBreak = (editor, _ref2) => {\n var {\n addedNodes\n } = _ref2;\n var {\n selection\n } = editor;\n var parentNode = selection ? Node.parent(editor, selection.anchor.path) : null;\n var parentDOMNode = parentNode ? ReactEditor.toDOMNode(editor, parentNode) : null;\n\n if (!parentDOMNode) {\n return false;\n }\n\n return addedNodes.some(addedNode => addedNode instanceof HTMLElement && addedNode.tagName === (parentDOMNode === null || parentDOMNode === void 0 ? void 0 : parentDOMNode.tagName));\n};\n/**\r\n * So long as we check for line break mutations before deletion mutations,\r\n * we can safely assume that a set of mutations was a deletion if there are\r\n * removed nodes.\r\n */\n\nvar isDeletion = (_, _ref3) => {\n var {\n removedNodes\n } = _ref3;\n return removedNodes.length > 0;\n};\n/**\r\n * If the selection was expanded and there are removed nodes,\r\n * the contents of the selection need to be replaced with the diff\r\n */\n\nvar isReplaceExpandedSelection = (_ref4, _ref5) => {\n var {\n selection\n } = _ref4;\n var {\n removedNodes\n } = _ref5;\n return selection ? Range.isExpanded(selection) && removedNodes.length > 0 : false;\n};\n/**\r\n * Plain text insertion\r\n */\n\nvar isTextInsertion = (_, _ref6) => {\n var {\n insertedText\n } = _ref6;\n return insertedText.length > 0;\n};\n/**\r\n * Edge case. Detect mutations that remove leaf nodes and also update character data\r\n */\n\nvar isRemoveLeafNodes = (_, _ref7) => {\n var {\n addedNodes,\n characterDataMutations,\n removedNodes\n } = _ref7;\n return removedNodes.length > 0 && addedNodes.length === 0 && characterDataMutations.length > 0;\n};\n\n/**\r\n * Based loosely on:\r\n *\r\n * https://github.com/facebook/draft-js/blob/master/src/component/handlers/composition/DOMObserver.js\r\n * https://github.com/ProseMirror/prosemirror-view/blob/master/src/domobserver.js\r\n *\r\n * The input manager attempts to map observed mutations on the document to a\r\n * set of operations in order to reconcile Slate's internal value with the DOM.\r\n *\r\n * Mutations are processed synchronously as they come in. Only mutations that occur\r\n * during a user input loop are processed, as other mutations can occur within the\r\n * document that were not initiated by user input.\r\n *\r\n * The mutation reconciliation process attempts to match mutations to the following\r\n * patterns:\r\n *\r\n * - Text updates\r\n * - Deletions\r\n * - Line breaks\r\n *\r\n * @param editor\r\n * @param restoreDOM\r\n */\n\n\nclass AndroidInputManager {\n constructor(editor, restoreDOM) {\n this.editor = editor;\n this.restoreDOM = restoreDOM;\n /**\r\n * Handle MutationObserver flush\r\n *\r\n * @param mutations\r\n */\n\n this.flush = mutations => {\n\n try {\n this.reconcileMutations(mutations);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err); // Failed to reconcile mutations, restore DOM to its previous state\n\n this.restoreDOM();\n }\n };\n /**\r\n * Reconcile a batch of mutations\r\n *\r\n * @param mutations\r\n */\n\n\n this.reconcileMutations = mutations => {\n var mutationData = gatherMutationData(this.editor, mutations);\n var {\n insertedText,\n removedNodes\n } = mutationData;\n\n if (isReplaceExpandedSelection(this.editor, mutationData)) {\n var text = combineInsertedText(insertedText);\n this.replaceExpandedSelection(text);\n } else if (isLineBreak(this.editor, mutationData)) {\n this.insertBreak();\n } else if (isRemoveLeafNodes(this.editor, mutationData)) {\n this.removeLeafNodes(removedNodes);\n } else if (isDeletion(this.editor, mutationData)) {\n this.deleteBackward();\n } else if (isTextInsertion(this.editor, mutationData)) {\n this.insertText(insertedText);\n }\n };\n /**\r\n * Apply text diff\r\n */\n\n\n this.insertText = insertedText => {\n var {\n selection\n } = this.editor; // If it is in composing or after `onCompositionend`, set `EDITOR_ON_COMPOSITION_TEXT` and return.\n // Text will be inserted on compositionend event.\n\n if (ReactEditor.isComposing(this.editor) || IS_ON_COMPOSITION_END.get(this.editor)) {\n EDITOR_ON_COMPOSITION_TEXT.set(this.editor, insertedText);\n IS_ON_COMPOSITION_END.set(this.editor, false);\n return;\n } // Insert the batched text diffs\n\n\n insertedText.forEach(insertion => {\n var text = insertion.text.insertText;\n var at = normalizeTextInsertionRange(this.editor, selection, insertion);\n Transforms.setSelection(this.editor, at);\n Editor.insertText(this.editor, text);\n });\n };\n /**\r\n * Handle line breaks\r\n */\n\n\n this.insertBreak = () => {\n var {\n selection\n } = this.editor;\n Editor.insertBreak(this.editor);\n this.restoreDOM();\n\n if (selection) {\n // Compat: Move selection to the newly inserted block if it has not moved\n setTimeout(() => {\n if (this.editor.selection && Range.equals(selection, this.editor.selection)) {\n Transforms.move(this.editor);\n }\n }, 100);\n }\n };\n /**\r\n * Handle expanded selection being deleted or replaced by text\r\n */\n\n\n this.replaceExpandedSelection = text => {\n\n Editor.deleteFragment(this.editor);\n\n if (text.length) {\n // Selection was replaced by text, insert the entire text diff\n Editor.insertText(this.editor, text);\n }\n\n this.restoreDOM();\n };\n /**\r\n * Handle `backspace` that merges blocks\r\n */\n\n\n this.deleteBackward = () => {\n Editor.deleteBackward(this.editor);\n ReactEditor.focus(this.editor);\n this.restoreDOM();\n };\n /**\r\n * Handle mutations that remove specific leaves\r\n */\n\n\n this.removeLeafNodes = nodes => {\n for (var node of nodes) {\n var slateNode = ReactEditor.toSlateNode(this.editor, node);\n\n if (slateNode) {\n var path = ReactEditor.findPath(this.editor, slateNode);\n Transforms.delete(this.editor, {\n at: path\n });\n this.restoreDOM();\n }\n }\n };\n\n this.editor = editor;\n this.restoreDOM = restoreDOM;\n }\n\n}\n\nfunction useMutationObserver(node, callback, options) {\n var [mutationObserver] = useState(() => new MutationObserver(callback));\n useIsomorphicLayoutEffect(() => {\n // Disconnect mutation observer during render phase\n mutationObserver.disconnect();\n });\n useEffect(() => {\n if (!node.current) {\n throw new Error('Failed to attach MutationObserver, `node` is undefined');\n } // Attach mutation observer after render phase has finished\n\n\n mutationObserver.observe(node.current, options); // Clean up after effect\n\n return mutationObserver.disconnect.bind(mutationObserver);\n });\n}\n\nvar MUTATION_OBSERVER_CONFIG$1 = {\n childList: true,\n characterData: true,\n subtree: true\n};\n\nfunction findClosestKnowSlateNode(domNode) {\n var _domEl;\n\n var domEl = isDOMElement(domNode) ? domNode : domNode.parentElement;\n\n if (domEl && !domEl.hasAttribute('data-slate-node')) {\n domEl = domEl.closest(\"[data-slate-node]\");\n }\n\n var slateNode = domEl && ELEMENT_TO_NODE.get(domEl);\n\n if (slateNode) {\n return slateNode;\n } // Unknown dom element with a slate-slate-node attribute => the IME\n // most likely duplicated the node so we have to restore the parent\n\n\n return (_domEl = domEl) !== null && _domEl !== void 0 && _domEl.parentElement ? findClosestKnowSlateNode(domEl.parentElement) : null;\n}\n\nfunction useRestoreDom(node, receivedUserInput) {\n var editor = useSlateStatic();\n var mutatedNodes = useRef(new Set());\n var handleDOMMutation = useCallback(mutations => {\n if (!receivedUserInput.current) {\n return;\n }\n\n mutations.forEach(_ref => {\n var {\n target\n } = _ref;\n var slateNode = findClosestKnowSlateNode(target);\n\n if (!slateNode) {\n return;\n }\n\n return mutatedNodes.current.add(slateNode);\n });\n }, []);\n useMutationObserver(node, handleDOMMutation, MUTATION_OBSERVER_CONFIG$1); // Clear mutated nodes on every render\n\n mutatedNodes.current.clear();\n var restore = useCallback(() => {\n var mutated = Array.from(mutatedNodes.current.values()); // Filter out child nodes of nodes that will be restored anyway\n\n var nodesToRestore = mutated.filter(n => !mutated.some(m => Path.isParent(ReactEditor.findPath(editor, m), ReactEditor.findPath(editor, n))));\n nodesToRestore.forEach(n => {\n var _NODE_TO_RESTORE_DOM$;\n\n (_NODE_TO_RESTORE_DOM$ = NODE_TO_RESTORE_DOM.get(n)) === null || _NODE_TO_RESTORE_DOM$ === void 0 ? void 0 : _NODE_TO_RESTORE_DOM$();\n });\n mutatedNodes.current.clear();\n }, []);\n return restore;\n}\n\nfunction useTrackUserInput() {\n var editor = useSlateStatic();\n var receivedUserInput = useRef(false);\n var animationFrameRef = useRef(null);\n var onUserInput = useCallback(() => {\n if (receivedUserInput.current === false) {\n var window = ReactEditor.getWindow(editor);\n receivedUserInput.current = true;\n\n if (animationFrameRef.current) {\n window.cancelAnimationFrame(animationFrameRef.current);\n }\n\n animationFrameRef.current = window.requestAnimationFrame(() => {\n receivedUserInput.current = false;\n animationFrameRef.current = null;\n });\n }\n }, []);\n useEffect(() => {\n // Reset user input tracking on every render\n if (receivedUserInput.current) {\n receivedUserInput.current = false;\n }\n });\n return {\n receivedUserInput,\n onUserInput\n };\n}\n\nvar MUTATION_OBSERVER_CONFIG = {\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n subtree: true\n};\nfunction useAndroidInputManager(node) {\n var editor = useSlateStatic();\n var {\n receivedUserInput,\n onUserInput\n } = useTrackUserInput();\n var restoreDom = useRestoreDom(node, receivedUserInput);\n var inputManager = useMemo(() => new AndroidInputManager(editor, restoreDom), [restoreDom, editor]);\n var timeoutId = useRef(null);\n var isReconciling = useRef(false);\n var flush = useCallback(mutations => {\n if (!receivedUserInput.current) {\n return;\n }\n\n isReconciling.current = true;\n inputManager.flush(mutations);\n\n if (timeoutId.current) {\n clearTimeout(timeoutId.current);\n }\n\n timeoutId.current = setTimeout(() => {\n isReconciling.current = false;\n timeoutId.current = null;\n }, 250);\n }, []);\n useMutationObserver(node, flush, MUTATION_OBSERVER_CONFIG);\n return {\n isReconciling,\n onUserInput\n };\n}\n\nvar _excluded$1 = [\"autoFocus\", \"decorate\", \"onDOMBeforeInput\", \"placeholder\", \"readOnly\", \"renderElement\", \"renderLeaf\", \"renderPlaceholder\", \"style\", \"as\"];\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n/**\r\n * Editable.\r\n */\n// https://github.com/facebook/draft-js/blob/main/src/component/handlers/composition/DraftEditorCompositionHandler.js#L41\n// When using keyboard English association function, conpositionEnd triggered too fast, resulting in after `insertText` still maintain association state.\n\nvar RESOLVE_DELAY = 20;\nvar AndroidEditable = props => {\n var {\n autoFocus,\n decorate = defaultDecorate,\n onDOMBeforeInput: propsOnDOMBeforeInput,\n placeholder,\n readOnly = false,\n renderElement,\n renderLeaf,\n renderPlaceholder = props => /*#__PURE__*/React.createElement(DefaultPlaceholder, Object.assign({}, props)),\n style = {},\n as: Component = 'div'\n } = props,\n attributes = _objectWithoutProperties(props, _excluded$1);\n\n var editor = useSlate(); // Rerender editor when composition status changed\n\n var [isComposing, setIsComposing] = useState(false);\n var ref = useRef(null);\n var inputManager = useAndroidInputManager(ref); // Update internal state on each render.\n\n IS_READ_ONLY.set(editor, readOnly); // Keep track of some state for the event handler logic.\n\n var state = useMemo(() => ({\n isComposing: false,\n isUpdatingSelection: false,\n latestElement: null\n }), []);\n var contentKey = useContentKey(editor); // Whenever the editor updates...\n\n useIsomorphicLayoutEffect(() => {\n // Update element-related weak maps with the DOM element ref.\n var window;\n\n if (ref.current && (window = getDefaultView(ref.current))) {\n EDITOR_TO_WINDOW.set(editor, window);\n EDITOR_TO_ELEMENT.set(editor, ref.current);\n NODE_TO_ELEMENT.set(editor, ref.current);\n ELEMENT_TO_NODE.set(ref.current, editor);\n } else {\n NODE_TO_ELEMENT.delete(editor);\n }\n\n try {\n // Make sure the DOM selection state is in sync.\n var {\n selection\n } = editor;\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n var domSelection = root.getSelection();\n\n if (state.isComposing || !domSelection || !ReactEditor.isFocused(editor)) {\n return;\n }\n\n var hasDomSelection = domSelection.type !== 'None'; // If the DOM selection is properly unset, we're done.\n\n if (!selection && !hasDomSelection) {\n return;\n } // verify that the dom selection is in the editor\n\n\n var editorElement = EDITOR_TO_ELEMENT.get(editor);\n var hasDomSelectionInEditor = false;\n\n if (editorElement.contains(domSelection.anchorNode) && editorElement.contains(domSelection.focusNode)) {\n hasDomSelectionInEditor = true;\n } // If the DOM selection is in the editor and the editor selection is already correct, we're done.\n\n\n if (hasDomSelection && hasDomSelectionInEditor && selection) {\n var slateRange = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: true,\n suppressThrow: true\n });\n\n if (slateRange && Range.equals(slateRange, selection)) {\n return;\n }\n } // when is being controlled through external value\n // then its children might just change - DOM responds to it on its own\n // but Slate's value is not being updated through any operation\n // and thus it doesn't transform selection on its own\n\n\n if (selection && !ReactEditor.hasRange(editor, selection)) {\n editor.selection = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: false\n });\n return;\n } // Otherwise the DOM selection is out of sync, so update it.\n\n\n var el = ReactEditor.toDOMNode(editor, editor);\n state.isUpdatingSelection = true;\n var newDomRange = selection && ReactEditor.toDOMRange(editor, selection);\n\n if (newDomRange) {\n if (Range.isBackward(selection)) {\n domSelection.setBaseAndExtent(newDomRange.endContainer, newDomRange.endOffset, newDomRange.startContainer, newDomRange.startOffset);\n } else {\n domSelection.setBaseAndExtent(newDomRange.startContainer, newDomRange.startOffset, newDomRange.endContainer, newDomRange.endOffset);\n }\n\n var leafEl = newDomRange.startContainer.parentElement;\n leafEl.getBoundingClientRect = newDomRange.getBoundingClientRect.bind(newDomRange);\n scrollIntoView(leafEl, {\n scrollMode: 'if-needed',\n boundary: el\n }); // @ts-ignore\n\n delete leafEl.getBoundingClientRect;\n } else {\n domSelection.removeAllRanges();\n }\n\n setTimeout(() => {\n state.isUpdatingSelection = false;\n });\n } catch (_unused) {\n // Failed to update selection, likely due to reconciliation error\n state.isUpdatingSelection = false;\n }\n }); // The autoFocus TextareaHTMLAttribute doesn't do anything on a div, so it\n // needs to be manually focused.\n\n useEffect(() => {\n if (ref.current && autoFocus) {\n ref.current.focus();\n }\n }, [autoFocus]); // Listen on the native `selectionchange` event to be able to update any time\n // the selection changes. This is required because React's `onSelect` is leaky\n // and non-standard so it doesn't fire until after a selection has been\n // released. This causes issues in situations where another change happens\n // while a selection is being dragged.\n\n var onDOMSelectionChange = useCallback(throttle(() => {\n try {\n if (!state.isComposing && !state.isUpdatingSelection && !inputManager.isReconciling.current) {\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n var {\n activeElement\n } = root;\n var el = ReactEditor.toDOMNode(editor, editor);\n var domSelection = root.getSelection();\n\n if (activeElement === el) {\n state.latestElement = activeElement;\n IS_FOCUSED.set(editor, true);\n } else {\n IS_FOCUSED.delete(editor);\n }\n\n if (!domSelection) {\n return Transforms.deselect(editor);\n }\n\n var {\n anchorNode,\n focusNode\n } = domSelection;\n var anchorNodeSelectable = hasEditableTarget(editor, anchorNode) || isTargetInsideNonReadonlyVoid(editor, anchorNode);\n var focusNodeSelectable = hasEditableTarget(editor, focusNode) || isTargetInsideNonReadonlyVoid(editor, focusNode);\n\n if (anchorNodeSelectable && focusNodeSelectable) {\n var range = ReactEditor.toSlateRange(editor, domSelection, {\n exactMatch: false,\n suppressThrow: false\n });\n Transforms.select(editor, range);\n } else {\n Transforms.deselect(editor);\n }\n }\n } catch (_unused2) {// Failed to update selection, likely due to reconciliation error\n }\n }, 100), [readOnly]);\n var scheduleOnDOMSelectionChange = useMemo(() => debounce(onDOMSelectionChange, 0), [onDOMSelectionChange]); // Listen on the native `beforeinput` event to get real \"Level 2\" events. This\n // is required because React's `beforeinput` is fake and never really attaches\n // to the real event sadly. (2019/11/01)\n // https://github.com/facebook/react/issues/11211\n\n var onDOMBeforeInput = useCallback(event => {\n if (!readOnly && hasEditableTarget(editor, event.target) && !isDOMEventHandled(event, propsOnDOMBeforeInput)) {\n // Some IMEs/Chrome extensions like e.g. Grammarly set the selection immediately before\n // triggering a `beforeinput` expecting the change to be applied to the immediately before\n // set selection.\n scheduleOnDOMSelectionChange.flush();\n inputManager.onUserInput();\n }\n }, [readOnly, propsOnDOMBeforeInput]); // Attach a native DOM event handler for `beforeinput` events, because React's\n // built-in `onBeforeInput` is actually a leaky polyfill that doesn't expose\n // real `beforeinput` events sadly... (2019/11/04)\n\n useIsomorphicLayoutEffect(() => {\n var node = ref.current; // @ts-ignore The `beforeinput` event isn't recognized.\n\n node === null || node === void 0 ? void 0 : node.addEventListener('beforeinput', onDOMBeforeInput); // @ts-ignore The `beforeinput` event isn't recognized.\n\n return () => node === null || node === void 0 ? void 0 : node.removeEventListener('beforeinput', onDOMBeforeInput);\n }, [contentKey, propsOnDOMBeforeInput]); // Attach a native DOM event handler for `selectionchange`, because React's\n // built-in `onSelect` handler doesn't fire for all selection changes. It's a\n // leaky polyfill that only fires on keypresses or clicks. Instead, we want to\n // fire for any change to the selection inside the editor. (2019/11/04)\n // https://github.com/facebook/react/issues/5785\n\n useIsomorphicLayoutEffect(() => {\n var window = ReactEditor.getWindow(editor);\n window.document.addEventListener('selectionchange', scheduleOnDOMSelectionChange);\n return () => {\n window.document.removeEventListener('selectionchange', scheduleOnDOMSelectionChange);\n };\n }, [scheduleOnDOMSelectionChange]);\n var decorations = decorate([editor, []]);\n\n if (placeholder && editor.children.length === 1 && Array.from(Node.texts(editor)).length === 1 && Node.string(editor) === '' && !isComposing) {\n var start = Editor.start(editor, []);\n decorations.push({\n [PLACEHOLDER_SYMBOL]: true,\n placeholder,\n anchor: start,\n focus: start\n });\n }\n\n return /*#__PURE__*/React.createElement(ReadOnlyContext.Provider, {\n value: readOnly\n }, /*#__PURE__*/React.createElement(DecorateContext.Provider, {\n value: decorate\n }, /*#__PURE__*/React.createElement(Component, Object.assign({\n key: contentKey,\n role: readOnly ? undefined : 'textbox'\n }, attributes, {\n spellCheck: attributes.spellCheck,\n autoCorrect: attributes.autoCorrect,\n autoCapitalize: attributes.autoCapitalize,\n \"data-slate-editor\": true,\n \"data-slate-node\": \"value\",\n contentEditable: readOnly ? undefined : true,\n suppressContentEditableWarning: true,\n ref: ref,\n style: _objectSpread({\n // Allow positioning relative to the editable element.\n position: 'relative',\n // Prevent the default outline styles.\n outline: 'none',\n // Preserve adjacent whitespace and new lines.\n whiteSpace: 'pre-wrap',\n // Allow words to break if they are too long.\n wordWrap: 'break-word'\n }, style),\n onCopy: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCopy)) {\n event.preventDefault();\n ReactEditor.setFragmentData(editor, event.clipboardData, 'copy');\n }\n }, [attributes.onCopy]),\n onCut: useCallback(event => {\n if (!readOnly && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCut)) {\n event.preventDefault();\n ReactEditor.setFragmentData(editor, event.clipboardData, 'cut');\n var {\n selection\n } = editor;\n\n if (selection) {\n if (Range.isExpanded(selection)) {\n Editor.deleteFragment(editor);\n } else {\n var node = Node.parent(editor, selection.anchor.path);\n\n if (Editor.isVoid(editor, node)) {\n Transforms.delete(editor);\n }\n }\n }\n }\n }, [readOnly, attributes.onCut]),\n onFocus: useCallback(event => {\n if (!readOnly && !state.isUpdatingSelection && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onFocus)) {\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n state.latestElement = root.activeElement;\n IS_FOCUSED.set(editor, true);\n }\n }, [readOnly, attributes.onFocus]),\n onBlur: useCallback(event => {\n if (readOnly || state.isUpdatingSelection || !hasEditableTarget(editor, event.target) || isEventHandled(event, attributes.onBlur)) {\n return;\n } // COMPAT: If the current `activeElement` is still the previous\n // one, this is due to the window being blurred when the tab\n // itself becomes unfocused, so we want to abort early to allow to\n // editor to stay focused when the tab becomes focused again.\n\n\n var root = ReactEditor.findDocumentOrShadowRoot(editor);\n\n if (state.latestElement === root.activeElement) {\n return;\n }\n\n var {\n relatedTarget\n } = event;\n var el = ReactEditor.toDOMNode(editor, editor); // COMPAT: The event should be ignored if the focus is returning\n // to the editor from an embedded editable element (eg. an \n // element inside a void node).\n\n if (relatedTarget === el) {\n return;\n } // COMPAT: The event should be ignored if the focus is moving from\n // the editor to inside a void node's spacer element.\n\n\n if (isDOMElement(relatedTarget) && relatedTarget.hasAttribute('data-slate-spacer')) {\n return;\n } // COMPAT: The event should be ignored if the focus is moving to a\n // non- editable section of an element that isn't a void node (eg.\n // a list item of the check list example).\n\n\n if (relatedTarget != null && isDOMNode(relatedTarget) && ReactEditor.hasDOMNode(editor, relatedTarget)) {\n var node = ReactEditor.toSlateNode(editor, relatedTarget);\n\n if (Element$1.isElement(node) && !editor.isVoid(node)) {\n return;\n }\n }\n\n IS_FOCUSED.delete(editor);\n }, [readOnly, attributes.onBlur]),\n onClick: useCallback(event => {\n if (!readOnly && hasTarget(editor, event.target) && !isEventHandled(event, attributes.onClick) && isDOMNode(event.target)) {\n var node = ReactEditor.toSlateNode(editor, event.target);\n var path = ReactEditor.findPath(editor, node); // At this time, the Slate document may be arbitrarily different,\n // because onClick handlers can change the document before we get here.\n // Therefore we must check that this path actually exists,\n // and that it still refers to the same node.\n\n if (Editor.hasPath(editor, path)) {\n var lookupNode = Node.get(editor, path);\n\n if (lookupNode === node) {\n var _start = Editor.start(editor, path);\n\n var end = Editor.end(editor, path);\n var startVoid = Editor.void(editor, {\n at: _start\n });\n var endVoid = Editor.void(editor, {\n at: end\n });\n\n if (startVoid && endVoid && Path.equals(startVoid[1], endVoid[1])) {\n var range = Editor.range(editor, _start);\n Transforms.select(editor, range);\n }\n }\n }\n }\n }, [readOnly, attributes.onClick]),\n onCompositionEnd: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionEnd)) {\n scheduleOnDOMSelectionChange.flush();\n setTimeout(() => {\n state.isComposing && setIsComposing(false);\n state.isComposing = false;\n IS_COMPOSING.set(editor, false);\n IS_ON_COMPOSITION_END.set(editor, true);\n var insertedText = EDITOR_ON_COMPOSITION_TEXT.get(editor) || []; // `insertedText` is set in `MutationObserver` constructor.\n // If open phone keyboard association function, `CompositionEvent` will be triggered.\n\n if (!insertedText.length) {\n return;\n }\n\n EDITOR_ON_COMPOSITION_TEXT.set(editor, []);\n var {\n selection\n } = editor;\n insertedText.forEach(insertion => {\n var text = insertion.text.insertText;\n var at = normalizeTextInsertionRange(editor, selection, insertion);\n Transforms.setSelection(editor, at);\n Editor.insertText(editor, text);\n });\n }, RESOLVE_DELAY);\n }\n }, [attributes.onCompositionEnd]),\n onCompositionUpdate: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionUpdate)) {\n !state.isComposing && setIsComposing(true);\n state.isComposing = true;\n IS_COMPOSING.set(editor, true);\n }\n }, [attributes.onCompositionUpdate]),\n onCompositionStart: useCallback(event => {\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionStart)) {\n !state.isComposing && setIsComposing(true);\n state.isComposing = true;\n IS_COMPOSING.set(editor, true);\n }\n }, [attributes.onCompositionStart]),\n onPaste: useCallback(event => {\n // this will make application/x-slate-fragment exist when onPaste attributes is passed\n event.clipboardData = getClipboardData(event.clipboardData); // This unfortunately needs to be handled with paste events instead.\n\n if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onPaste) && !readOnly) {\n event.preventDefault();\n ReactEditor.insertData(editor, event.clipboardData);\n }\n }, [readOnly, attributes.onPaste])\n }), useChildren({\n decorations,\n node: editor,\n renderElement,\n renderPlaceholder,\n renderLeaf,\n selection: editor.selection\n }))));\n};\n\n/**\r\n * A React context for sharing the `focused` state of the editor.\r\n */\n\nvar FocusedContext = /*#__PURE__*/createContext(false);\n/**\r\n * Get the current `focused` state of the editor.\r\n */\n\nvar useFocused = () => {\n return useContext(FocusedContext);\n};\n\nfunction isError(error) {\n return error instanceof Error;\n}\n/**\r\n * A React context for sharing the editor selector context in a way to control rerenders\r\n */\n\n\nvar SlateSelectorContext = /*#__PURE__*/createContext({});\n\nvar refEquality = (a, b) => a === b;\n/**\r\n * use redux style selectors to prevent rerendering on every keystroke.\r\n * Bear in mind rerendering can only prevented if the returned value is a value type or for reference types (e.g. objects and arrays) add a custom equality function.\r\n *\r\n * Example:\r\n * ```\r\n * const isSelectionActive = useSlateSelector(editor => Boolean(editor.selection));\r\n * ```\r\n */\n\n\nfunction useSlateSelector(selector) {\n var equalityFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : refEquality;\n var [, forceRender] = useReducer(s => s + 1, 0);\n var context = useContext(SlateSelectorContext);\n\n if (!context) {\n throw new Error(\"The `useSlateSelector` hook must be used inside the component's context.\");\n }\n\n var {\n getSlate,\n addEventListener\n } = context;\n var latestSubscriptionCallbackError = useRef();\n var latestSelector = useRef(() => null);\n var latestSelectedState = useRef(null);\n var selectedState;\n\n try {\n if (selector !== latestSelector.current || latestSubscriptionCallbackError.current) {\n selectedState = selector(getSlate());\n } else {\n selectedState = latestSelectedState.current;\n }\n } catch (err) {\n if (latestSubscriptionCallbackError.current && isError(err)) {\n err.message += \"\\nThe error may be correlated with this previous error:\\n\".concat(latestSubscriptionCallbackError.current.stack, \"\\n\\n\");\n }\n\n throw err;\n }\n\n useIsomorphicLayoutEffect(() => {\n latestSelector.current = selector;\n latestSelectedState.current = selectedState;\n latestSubscriptionCallbackError.current = undefined;\n });\n useIsomorphicLayoutEffect(() => {\n function checkForUpdates() {\n try {\n var newSelectedState = latestSelector.current(getSlate());\n\n if (equalityFn(newSelectedState, latestSelectedState.current)) {\n return;\n }\n\n latestSelectedState.current = newSelectedState;\n } catch (err) {\n // we ignore all errors here, since when the component\n // is re-rendered, the selectors are called again, and\n // will throw again, if neither props nor store state\n // changed\n latestSubscriptionCallbackError.current = err;\n }\n\n forceRender();\n }\n\n var unsubscribe = addEventListener(checkForUpdates);\n checkForUpdates();\n return () => unsubscribe();\n }, // don't rerender on equalityFn change since we want to be able to define it inline\n [addEventListener, getSlate]);\n return selectedState;\n}\n/**\r\n * Create selector context with editor updating on every editor change\r\n */\n\nfunction getSelectorContext(editor) {\n var eventListeners = useRef([]).current;\n var slateRef = useRef({\n editor\n }).current;\n var onChange = useCallback(editor => {\n slateRef.editor = editor;\n eventListeners.forEach(listener => listener(editor));\n }, []);\n var selectorContext = useMemo(() => {\n return {\n getSlate: () => slateRef.editor,\n addEventListener: callback => {\n eventListeners.push(callback);\n return () => {\n eventListeners.splice(eventListeners.indexOf(callback), 1);\n };\n }\n };\n }, [eventListeners, slateRef]);\n return {\n selectorContext,\n onChange\n };\n}\n\nvar _excluded = [\"editor\", \"children\", \"onChange\", \"value\"];\n/**\r\n * A wrapper around the provider to handle `onChange` events, because the editor\r\n * is a mutable singleton so it won't ever register as \"changed\" otherwise.\r\n */\n\nvar Slate = props => {\n var {\n editor,\n children,\n onChange,\n value\n } = props,\n rest = _objectWithoutProperties(props, _excluded);\n\n var unmountRef = useRef(false);\n var [context, setContext] = React.useState(() => {\n if (!Node.isNodeList(value)) {\n throw new Error(\"[Slate] value is invalid! Expected a list of elements\" + \"but got: \".concat(Scrubber.stringify(value)));\n }\n\n if (!Editor.isEditor(editor)) {\n throw new Error(\"[Slate] editor is invalid! you passed:\" + \"\".concat(Scrubber.stringify(editor)));\n }\n\n editor.children = value;\n Object.assign(editor, rest);\n return [editor];\n });\n var {\n selectorContext,\n onChange: handleSelectorChange\n } = getSelectorContext(editor);\n var onContextChange = useCallback(() => {\n if (onChange) {\n onChange(editor.children);\n }\n\n setContext([editor]);\n handleSelectorChange(editor);\n }, [onChange]);\n EDITOR_TO_ON_CHANGE.set(editor, onContextChange);\n useEffect(() => {\n return () => {\n EDITOR_TO_ON_CHANGE.set(editor, () => {});\n unmountRef.current = true;\n };\n }, []);\n var [isFocused, setIsFocused] = useState(ReactEditor.isFocused(editor));\n useEffect(() => {\n setIsFocused(ReactEditor.isFocused(editor));\n });\n useIsomorphicLayoutEffect(() => {\n var fn = () => setIsFocused(ReactEditor.isFocused(editor));\n\n if (IS_REACT_VERSION_17_OR_ABOVE) {\n // In React >= 17 onFocus and onBlur listen to the focusin and focusout events during the bubbling phase.\n // Therefore in order for 's handlers to run first, which is necessary for ReactEditor.isFocused(editor)\n // to return the correct value, we have to listen to the focusin and focusout events without useCapture here.\n document.addEventListener('focusin', fn);\n document.addEventListener('focusout', fn);\n return () => {\n document.removeEventListener('focusin', fn);\n document.removeEventListener('focusout', fn);\n };\n } else {\n document.addEventListener('focus', fn, true);\n document.addEventListener('blur', fn, true);\n return () => {\n document.removeEventListener('focus', fn, true);\n document.removeEventListener('blur', fn, true);\n };\n }\n }, []);\n return /*#__PURE__*/React.createElement(SlateSelectorContext.Provider, {\n value: selectorContext\n }, /*#__PURE__*/React.createElement(SlateContext.Provider, {\n value: context\n }, /*#__PURE__*/React.createElement(EditorContext.Provider, {\n value: editor\n }, /*#__PURE__*/React.createElement(FocusedContext.Provider, {\n value: isFocused\n }, children))));\n};\n\n/**\r\n * Get the current editor object from the React context.\r\n * @deprecated Use useSlateStatic instead.\r\n */\n\nvar useEditor = () => {\n var editor = useContext(EditorContext);\n\n if (!editor) {\n throw new Error(\"The `useEditor` hook must be used inside the component's context.\");\n }\n\n return editor;\n};\n\n/**\r\n * Utilities for single-line deletion\r\n */\n\nvar doRectsIntersect = (rect, compareRect) => {\n var middle = (compareRect.top + compareRect.bottom) / 2;\n return rect.top <= middle && rect.bottom >= middle;\n};\n\nvar areRangesSameLine = (editor, range1, range2) => {\n var rect1 = ReactEditor.toDOMRange(editor, range1).getBoundingClientRect();\n var rect2 = ReactEditor.toDOMRange(editor, range2).getBoundingClientRect();\n return doRectsIntersect(rect1, rect2) && doRectsIntersect(rect2, rect1);\n};\n/**\r\n * A helper utility that returns the end portion of a `Range`\r\n * which is located on a single line.\r\n *\r\n * @param {Editor} editor The editor object to compare against\r\n * @param {Range} parentRange The parent range to compare against\r\n * @returns {Range} A valid portion of the parentRange which is one a single line\r\n */\n\n\nvar findCurrentLineRange = (editor, parentRange) => {\n var parentRangeBoundary = Editor.range(editor, Range.end(parentRange));\n var positions = Array.from(Editor.positions(editor, {\n at: parentRange\n }));\n var left = 0;\n var right = positions.length;\n var middle = Math.floor(right / 2);\n\n if (areRangesSameLine(editor, Editor.range(editor, positions[left]), parentRangeBoundary)) {\n return Editor.range(editor, positions[left], parentRangeBoundary);\n }\n\n if (positions.length < 2) {\n return Editor.range(editor, positions[positions.length - 1], parentRangeBoundary);\n }\n\n while (middle !== positions.length && middle !== left) {\n if (areRangesSameLine(editor, Editor.range(editor, positions[middle]), parentRangeBoundary)) {\n right = middle;\n } else {\n left = middle;\n }\n\n middle = Math.floor((left + right) / 2);\n }\n\n return Editor.range(editor, positions[right], parentRangeBoundary);\n};\n\n/**\r\n * `withReact` adds React and DOM specific behaviors to the editor.\r\n *\r\n * If you are using TypeScript, you must extend Slate's CustomTypes to use\r\n * this plugin.\r\n *\r\n * See https://docs.slatejs.org/concepts/11-typescript to learn how.\r\n */\n\nvar withReact = editor => {\n var e = editor;\n var {\n apply,\n onChange,\n deleteBackward\n } = e; // The WeakMap which maps a key to a specific HTMLElement must be scoped to the editor instance to\n // avoid collisions between editors in the DOM that share the same value.\n\n EDITOR_TO_KEY_TO_ELEMENT.set(e, new WeakMap());\n\n e.deleteBackward = unit => {\n if (unit !== 'line') {\n return deleteBackward(unit);\n }\n\n if (editor.selection && Range.isCollapsed(editor.selection)) {\n var parentBlockEntry = Editor.above(editor, {\n match: n => Editor.isBlock(editor, n),\n at: editor.selection\n });\n\n if (parentBlockEntry) {\n var [, parentBlockPath] = parentBlockEntry;\n var parentElementRange = Editor.range(editor, parentBlockPath, editor.selection.anchor);\n var currentLineRange = findCurrentLineRange(e, parentElementRange);\n\n if (!Range.isCollapsed(currentLineRange)) {\n Transforms.delete(editor, {\n at: currentLineRange\n });\n }\n }\n }\n }; // This attempts to reset the NODE_TO_KEY entry to the correct value\n // as apply() changes the object reference and hence invalidates the NODE_TO_KEY entry\n\n\n e.apply = op => {\n var matches = [];\n\n switch (op.type) {\n case 'insert_text':\n case 'remove_text':\n case 'set_node':\n case 'split_node':\n {\n matches.push(...getMatches(e, op.path));\n break;\n }\n\n case 'set_selection':\n {\n var _EDITOR_TO_USER_SELEC;\n\n // Selection was manually set, don't restore the user selection after the change.\n (_EDITOR_TO_USER_SELEC = EDITOR_TO_USER_SELECTION.get(editor)) === null || _EDITOR_TO_USER_SELEC === void 0 ? void 0 : _EDITOR_TO_USER_SELEC.unref();\n EDITOR_TO_USER_SELECTION.delete(editor);\n break;\n }\n\n case 'insert_node':\n case 'remove_node':\n {\n matches.push(...getMatches(e, Path.parent(op.path)));\n break;\n }\n\n case 'merge_node':\n {\n var prevPath = Path.previous(op.path);\n matches.push(...getMatches(e, prevPath));\n break;\n }\n\n case 'move_node':\n {\n var commonPath = Path.common(Path.parent(op.path), Path.parent(op.newPath));\n matches.push(...getMatches(e, commonPath));\n break;\n }\n }\n\n apply(op);\n\n for (var [path, key] of matches) {\n var [node] = Editor.node(e, path);\n NODE_TO_KEY.set(node, key);\n }\n };\n\n e.setFragmentData = data => {\n var {\n selection\n } = e;\n\n if (!selection) {\n return;\n }\n\n var [start, end] = Range.edges(selection);\n var startVoid = Editor.void(e, {\n at: start.path\n });\n var endVoid = Editor.void(e, {\n at: end.path\n });\n\n if (Range.isCollapsed(selection) && !startVoid) {\n return;\n } // Create a fake selection so that we can add a Base64-encoded copy of the\n // fragment to the HTML, to decode on future pastes.\n\n\n var domRange = ReactEditor.toDOMRange(e, selection);\n var contents = domRange.cloneContents();\n var attach = contents.childNodes[0]; // Make sure attach is non-empty, since empty nodes will not get copied.\n\n contents.childNodes.forEach(node => {\n if (node.textContent && node.textContent.trim() !== '') {\n attach = node;\n }\n }); // COMPAT: If the end node is a void node, we need to move the end of the\n // range from the void node's spacer span, to the end of the void node's\n // content, since the spacer is before void's content in the DOM.\n\n if (endVoid) {\n var [voidNode] = endVoid;\n var r = domRange.cloneRange();\n var domNode = ReactEditor.toDOMNode(e, voidNode);\n r.setEndAfter(domNode);\n contents = r.cloneContents();\n } // COMPAT: If the start node is a void node, we need to attach the encoded\n // fragment to the void node's content node instead of the spacer, because\n // attaching it to empty `\n )}\n \n );\n}\n\nexport default RichTextEditor;\n","import React, { Fragment, useEffect, useRef, useState } from \"react\";\nimport { Dialog, Transition, Switch } from \"@headlessui/react\";\nimport { Formik, Form } from \"formik\";\nimport { saveResource } from \"@/utils/api\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport * as Yup from \"yup\";\nimport clsx from \"clsx\";\nimport Checkbox from \"@/components/shared/Checkbox\";\nimport Select from \"@/components/shared/Select\";\nimport RichTextEditor from \"@/components/shared/RichTextEditor/RichTextEditor\";\n\nconst CommentSchema = Yup.object().shape({\n comment: Yup.string()\n .trim()\n .max(1500, \"You have reached the character limit\"),\n});\n\nconst SidewideBannerActions = ({\n isValid,\n isSubmitting,\n cancelButtonRef,\n setOpen,\n}) => {\n return (\n
\n \n Update Banner\n \n setOpen(false)}\n ref={cancelButtonRef}\n >\n No, Cancel\n \n
\n );\n};\n\nconst SidewideBannerToggle = ({ enabled, setFieldValue }) => {\n return (\n setFieldValue(\"active\", !enabled)}\n className={clsx(\n enabled ? \"bg-indigo-600\" : \"bg-gray-200\",\n \"relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500\",\n )}\n >\n Use setting\n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\nfunction SitewideBanner({ open, setOpen, banner }) {\n const cancelButtonRef = useRef(null);\n\n const queryClient = useQueryClient();\n const { mutateAsync } = useMutation((mutationFn: any) => mutationFn, {\n onSuccess: () => {\n // Query Invalidations\n queryClient.invalidateQueries([\"banner\"]);\n },\n });\n\n const onSubmit = (values, { setSubmitting }) => {\n const request = {\n data: {\n id: \"1\",\n type: \"banners\",\n attributes: {\n ...values,\n },\n },\n };\n mutateAsync(saveResource(\"banners\", request)).then(() => {\n setSubmitting(false);\n setOpen(false);\n });\n };\n\n return (\n \n \n
\n \n \n \n\n {/* This element is to trick the browser into centering the modal contents. */}\n \n ​\n \n \n
\n
\n
\n
\n \n Sitewide Banner\n \n
\n

\n Staff members may create sitewide banners to be seen by\n PICI members. These banner messages can be turned on for\n a specific period of time or indefinitely.\n

\n
\n
\n
\n
\n \n {({ isValid, isSubmitting, setFieldValue, values }) => (\n
\n
\n \n setFieldValue(\"content\", value)}\n placeholder=\"Type here...\"\n />\n
\n
\n {\n setFieldValue(\"isRepetitive\", !values.isRepetitive);\n }}\n >\n Is repetitive?\n \n {values.isRepetitive && (\n {\n setFieldValue(\"repetitionType\", value);\n }}\n options={[\n { id: \"daily\", name: \"Daily\" },\n { id: \"7_days\", name: \"Weekly\" },\n { id: \"monthly\", name: \"Monthly\" },\n ]}\n className=\"font-meta-bold h-auto py-0.25\"\n classNameContainer={clsx(\n \"h-full flex flex-col justify-center\",\n )}\n />\n )}\n
\n \n \n )}\n \n
\n \n
\n \n
\n );\n}\n\nexport default SitewideBanner;\n","export default \"__VITE_ASSET__bde5220f__\"","import * as React from \"react\";\nimport { useState, Fragment } from \"react\";\nimport { NavLink, Outlet, Link } from \"react-router-dom\";\nimport clsx from \"clsx\";\nimport { ToastContainer, toast } from \"react-toastify\";\nimport { Disclosure, Menu, Transition } from \"@headlessui/react\";\nimport { PencilAltIcon } from \"@heroicons/react/outline\";\nimport useCurrentUser from \"@/hooks/useCurrentUser\";\nimport useBanner from \"@/hooks/useBanner\";\nimport SitewideBanner from \"./SitewideBanner\";\nimport piciLogoAC from \"@/images/logo-ac@2x.png\";\n\nconst NAVIGATION = [\n {\n name: \"Dashboard\",\n href: \"/admin\",\n end: true,\n },\n {\n name: \"NETWORK\",\n children: [\n { name: \"People\", href: \"/admin/people\" },\n { name: \"Centers\", href: \"/admin/centers\", spa: true },\n { name: \"Focus Areas\", href: \"/admin/focus_areas\", spa: true },\n ],\n },\n {\n name: \"PROJECTS\",\n current: true,\n children: [\n { name: \"Clinical Trials\", href: \"/admin/clinical_trials\", spa: true },\n {\n name: \"Research Studies\",\n href: \"/admin/research_studies?sort=-createdAt\",\n spa: true,\n },\n {\n name: \"Initiatives\",\n href: \"/admin/initiatives?order=Date%7Cdesc&tab=all\",\n spa: true,\n },\n ],\n },\n {\n name: \"INTELLECTUAL PROPERTY\",\n children: [{ name: \"Inventions\", href: \"/admin/inventions\", spa: true }],\n },\n {\n name: \"NETWORK RESOURCES\",\n children: [\n { name: \"Resources\", href: \"/admin/media_resources\", spa: true },\n { name: \"Research\", href: \"/admin/research_documents\", spa: true },\n ],\n },\n {\n name: \"COMMUNICATIONS\",\n children: [\n { name: \"Daily News Feed\", href: \"/admin/daily-news\", spa: true },\n { name: \"Announcements\", href: \"/admin/announcements\", spa: true },\n { name: \"Upcoming Events\", href: \"/admin/events\", spa: true },\n { name: \"Sitewide Banner\", href: \"#\" },\n ],\n },\n {\n name: \"RETREATS\",\n children: [\n { name: \"Retreats\", href: \"/admin/retreats\", spa: true },\n { name: \"Articles\", href: \"/admin/articles\", spa: true },\n ],\n },\n {\n name: \"LEGAL\",\n children: [{ name: \"Compliance\", href: \"/admin/compliance\" }],\n },\n // TODO: Example to pages from the SPA (include: {spa: true})\n // {\n // name: \"TEST\",\n // children: [{ name: \"Test Page\", href: \"/admin/test\", spa: true }],\n // },\n];\n\nconst ISLEGAL_NAVIGATION = [\n {\n name: \"Dashboard\",\n href: \"/admin\",\n end: true,\n },\n {\n name: \"NETWORK\",\n children: [\n { name: \"People\", href: \"/admin/people\", spa: true },\n { name: \"Centers\", href: \"/admin/centers\", spa: true },\n { name: \"Focus Areas\", href: \"/admin/focus_areas\", spa: true },\n ],\n },\n {\n name: \"PROJECTS\",\n current: true,\n children: [\n { name: \"Clinical Trials\", href: \"/admin/clinical_trials\", spa: true },\n {\n name: \"Research Studies\",\n href: \"/admin/research_studies?sort=-createdAt\",\n spa: true,\n },\n {\n name: \"Initiatives\",\n href: \"/admin/initiatives?order=Date%7Cdesc&tab=all\",\n spa: true,\n },\n ],\n },\n {\n name: \"INTELLECTUAL PROPERTY\",\n children: [\n { name: \"Inventions\", href: \"/admin/inventions\", spa: true },\n {\n name: \"Patent Deadlines\",\n href: \"/admin/patent_deadlines?tab=pctPatentPending\",\n spa: true,\n },\n {\n name: \"Top Inventors\",\n href: \"/admin/top_inventors\",\n spa: true,\n },\n ],\n },\n {\n name: \"NETWORK RESOURCES\",\n children: [\n { name: \"Resources\", href: \"/admin/media_resources\", spa: true },\n { name: \"Research\", href: \"/admin/research_documents\", spa: true },\n ],\n },\n {\n name: \"COMMUNICATIONS\",\n children: [\n { name: \"Daily News Feed\", href: \"/admin/daily-news\", spa: true },\n { name: \"Announcements\", href: \"/admin/announcements\", spa: true },\n { name: \"Upcoming Events\", href: \"/admin/events\", spa: true },\n { name: \"Sitewide Banner\", href: \"#\" },\n ],\n },\n {\n name: \"RETREATS\",\n children: [\n { name: \"Retreats\", href: \"/admin/retreats\", spa: true },\n { name: \"Articles\", href: \"/admin/articles\", spa: true },\n ],\n },\n {\n name: \"LEGAL\",\n children: [{ name: \"Compliance\", href: \"/admin/compliance\" }],\n },\n];\n\nconst ProfileSection = ({ user }) => {\n const { fullName, role } = user.attributes;\n const { avatar, show } = user.links;\n return (\n <>\n
\n
\n \"Workflow\"\n
\n {/* Profile dropdown */}\n \n {({ open }) => (\n <>\n
\n \n Open user menu\n \"\"\n \n
\n \n \n \n {({}) => (\n
\n

\n {fullName}\n

\n

{role}

\n
\n )}\n
\n \n {({ active }) => (\n \n Profile\n \n )}\n \n \n {({ active }) => (\n \n Account\n \n )}\n \n \n {({ active }) => (\n \n Help\n \n )}\n \n \n {({ active }) => (\n \n Log out\n \n )}\n \n \n \n \n )}\n
\n
\n
\n \n Go to Member Center\n \n
\n \n );\n};\n\nfunction AdminCenterNavigation() {\n const currentUser = useCurrentUser();\n const banner = useBanner();\n const [openSidewideBanner, setOpenSidewideBanner] = useState(false);\n const { isLegal, isStaff } = currentUser.attributes;\n const isStaffAndLegal = isLegal && isStaff;\n\n const navigation = isStaffAndLegal ? ISLEGAL_NAVIGATION : NAVIGATION;\n\n return (\n <>\n
\n \n
\n \n {navigation.map(item =>\n !item.children ? (\n
\n \n clsx(\n \"group w-full flex items-center pl-4 pr-2 py-1 text-sm font-medium rounded-md sidebarItem hover:text-white\",\n isActive && \"sidebarItemActive text-white\",\n )\n }\n end={true}\n >\n {item.name}\n \n
\n ) : (\n \n <>\n \n \n {item.name}\n \n \n \n {item.children.map(subItem => (\n
\n {subItem.name === \"Sitewide Banner\" && (\n setOpenSidewideBanner(true)}\n className=\"group w-full flex justify-between items-center pl-4 pr-2 py-1 text-sm font-medium rounded-md hover:bg-gray-900 hover:text-white\"\n >\n {subItem.name}\n <>\n {banner?.attributes?.active && (\n \n ON\n \n )}\n \n \n \n )}\n {subItem.name != \"Sitewide Banner\" && subItem.spa && (\n \n clsx(\n \"group w-full flex justify-between items-center pl-4 pr-2 py-1 text-sm font-medium rounded-md\",\n isActive\n ? \"sidebarItemActive text-white\"\n : \"sidebarItem hover:text-white\",\n )\n }\n end={false}\n >\n {subItem.name}\n \n )}\n {subItem.name != \"Sitewide Banner\" && !subItem.spa && (\n \n {subItem.name}\n \n )}\n
\n ))}\n \n \n \n ),\n )}\n \n
\n
\n {banner && (\n \n )}\n \n \n \n \n \n );\n}\n\nexport default AdminCenterNavigation;\n","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAA7CAMAAADl2ZJIAAACTFBMVEUAAAAA//////////////////8As4D///8AsXb///////////////////////////////////////////////////8Aqmj///////////8Ar2j///8Aqmz///////////////8ArGf///////////8Armr///////////8Armj///////////////8Aqmr///////////8AqmgArGv///////////////////////////////////////////////////8Aq2n///8ArGr///////////8Aq2r///8ArGj///////////////////////////////////////////////////8Aq2n///////////8Aqmj///8Aqmj///////8AqWj///8AqWj///////////8Aqmn///////////////////////////////////////////8AqWgAqWf///////8Aq2cAqWj///////8Aqmj///8Aqmj///////////////////8Aqmf///////8AqmcAqmj///////8AqWcAqmf///////////8AqmcAqmf///////8AqWj///////////////////////////////////////////////////////////////////8Aqmj///////8Aqmj///////////////////////////////////////////////////////////////////////////////////////////////8Aqmf///8AqWf///8tfCRFAAAAwnRSTlMAAQEFBwkKCw0NDg8QEhMUFRYXGBkaGxsdHyAgISEiIyQlJSYoKSkqKywsLS4vMDA0NTY3ODo9PkBBQkNERUZHSElKTU1OUFJSU1NVVldYWVpbXF1eX2JkZWZoaWpsbG1ub3Fxc3R1dnp7fYKEhoeIiYuMj5CRlJibnKWnqq2vtLa4ubm6vL2+v8HDw8TFxsjIycrKzM7P0dLT1dbX2drb3N3e3+Dh4uTk5efo6err7O3u7/Dx8/T19vf4+fr7/P3+/pPxpS0AAAJdSURBVEjHzdbnUxNBAAXwJ5pEsWEFFcSOYu/YULBhLIhi73gqikpsiBVRxF6wRiwoIGqk2DCFFML7x/yQy+VuzCULjgzv072d/c3c7n7YBeaeuxItl472QyhmisQ2ISSsrLKcjJwakl9TFOHlZkRJGa1O1k8MVnJddFGc7mR9qlz9QgKLHWxIFRY3WAwscrBxcrsEFtrZOCUg1kcXFwBggZ1NU9slkGZnU7KQKGWFJEmSJF0lSwBfdFGiOvzfQmLle5ucH2QMfNwA4WR1THgV0W3StFASRcTlNnV2CYiLatC6LYLIDvbR40MZChEhvPL2Ck+nij21n3RSu18rNsr1bptuHoYXw/MO6yQvUS3cihBdR+eInA6LWUXndVI0Wy1aFPFIf3efhBery+/opHxNeCG6jhZu6oLCpQhjxnKdZBjDi+v6u3szvDjdqgdaz2iFcnMae+rECB0huHJnFxW5/104/lHEnViqnTPfEh9RDKqkb6samN2sHvGXOKQMxL8l6d8ZmpHtIVk3Siue0p0l92Ef6JMqyQPBCVt8rN7n5pdxcu9xja4YjKmjJ3CvjfxIbw7iXpJHAhN2+PkuAStcwaeVoYwsBJBUQ28ugLGf6VkLoO8z8hgA7PXz9WAAy5xsnA7AdJs8CwBIqKJvO1JsbFkFAOj9mDwOSKR1ABB4J32fidj7pEX+vSFv6C9soDNT7r3ukafyyefBN+u8Zv7KrCALlC0Y+IqkY4nSTbdIsqKPMjDnJ0nmq7a9/ws2p6m6oZR8EKsamPGNlDRHazInaXr33QcNmoHkgnT56w8BPzFlNBoSjQAAAABJRU5ErkJggg==\"","import * as React from \"react\";\nimport { Link } from \"react-router-dom\";\nimport notFoundImage from \"@/images/404.png\";\nimport clsx from \"clsx\";\n\nfunction NotFoundPage() {\n return (\n
\n
\n \n

404 - Page Not Found

\n
\n\n
\n

\n The page you're looking for cannot be found\n

\n

\n Check the web address and confirm that it appears correct\n

\n \n Return to Dashboard\n \n
\n
\n );\n}\n\nexport default NotFoundPage;\n","// If an empty value is passed then an '&option=' wouldn't be created\nconst simpleValue = (option, value) => {\n if (option == \"filter[archived]\") {\n return `${option}=${value}`;\n } else {\n return !!value ? `${option}=${value}` : \"\";\n }\n};\n\nconst simpleArray = (option, array) =>\n array.length > 0 ? `${option}=${array.join(\",\")}` : \"\";\n\n// keyBasedArray supports passing an array of values or a single value in each key\n// For example: paramBuilder({ filter: { status: [1,2], name: \"A text\" } })\n// And it also supports passing an empty array or an empty string\n// without the need of worrying about it, because it won't create\n// an empty parameter: '&optionA=&optionB...'\nconst keyBasedArray = (option, object) =>\n Object.keys(object)\n .map(key => {\n return Array.isArray(object[key])\n ? simpleArray(`${option}[${key}]`, object[key])\n : simpleValue(`${option}[${key}]`, object[key]);\n })\n .filter(param => param !== \"\")\n .join(\"&\");\n\nconst actionsMap = {\n include: simpleArray,\n sort: simpleArray,\n filter: keyBasedArray,\n fields: keyBasedArray,\n page: keyBasedArray,\n override_records: simpleValue,\n preload: simpleArray,\n exclude_links: simpleValue,\n};\n\n// ParamBuilder also receives arbitrary keys e.g.\n// const input = { category: [\"users\", \"research\"] }\n// paramBuilder(input) -> \"category=users,research\"\nconst paramBuilder = options => {\n return Object.keys(options)\n .map(key => {\n const generator = actionsMap[key] || simpleArray;\n return generator(key, options[key]);\n })\n .filter(param => param.length > 0)\n .join(\"&\");\n};\n\nexport default paramBuilder;\n","import * as R from \"ramda\";\n\nconst compare = (x, y) => x.id === y.id && x.type === y.type;\n\nfunction diff(included, newData) {\n return R.differenceWith(compare, newData, included);\n}\n\nfunction useInfiniteQueryResult(response) {\n let data: any[] = [];\n let included: any[] = [];\n let meta: { [_: string]: any } = {};\n if (response) {\n response.map(group => {\n if (group.data.length > 0) {\n data = data.concat(group.data);\n if (group.included) {\n included = included.concat(diff(included, group.included));\n }\n meta = group.meta;\n }\n });\n }\n\n return { data, included, meta };\n}\n\nconst apiCanFetch = (lastPage, pages) => {\n return lastPage.links?.next === undefined ? false : pages.length;\n};\n\nexport { useInfiniteQueryResult, apiCanFetch };\n","import { useState, useLayoutEffect } from \"react\";\n\n// this window check is required because js-dom doesn't have support for\n// browser scroll functions yet\nconst getElement = elementId =>\n document.querySelector(`#${elementId}`) || document.body;\n\nconst getElementScroll = elementId => getElement(elementId).scrollTop;\n\nconst getElementHeight = elementId => getElement(elementId).scrollHeight;\n\nconst isScrolledToBottom = (elementId, bottomGap) => {\n const totalHeight = getElementHeight(elementId);\n const scrolledHeight = getElementScroll(elementId);\n const visibleHeight = window.innerHeight;\n return scrolledHeight + visibleHeight >= totalHeight - bottomGap;\n};\n\nfunction useScrollPosition(elementId = \"root\", bottomGap = 100) {\n const [isAtBottom, setIsAtBottom] = useState(false);\n\n const handleScroll = () => {\n setIsAtBottom(isScrolledToBottom(elementId, bottomGap));\n };\n\n useLayoutEffect(() => {\n const element = getElement(elementId);\n element.addEventListener(\"scroll\", handleScroll);\n return () => element.removeEventListener(\"scroll\", handleScroll);\n }, [setIsAtBottom]);\n\n return { isAtBottom };\n}\n\nexport { useScrollPosition };\n","import * as React from \"react\";\nimport { useEffect } from \"react\";\nimport clsx from \"clsx\";\nimport { useNavigate, useLocation } from \"react-router-dom\";\nimport { FilterOption } from \"@/types\";\n\nconst palettes = {\n primary: {\n navBorder: \"\",\n selectedTab: \"border-primary text-dark-100\",\n unselectedTab: \"border-transparent text-dark-50 hover:text-dark-100\",\n },\n};\n\nfunction Tabs({\n tabs,\n selectedTab,\n setSelectedTab,\n palette = \"primary\",\n className = \"\",\n}: {\n tabs: FilterOption[];\n selectedTab: FilterOption;\n setSelectedTab: (_: FilterOption) => any;\n palette?: \"primary\" | \"dark\";\n className?: string;\n}) {\n const navigate = useNavigate();\n const { pathname: path } = useLocation();\n\n useEffect(() => {\n if (!selectedTab) setSelectedTab(tabs[0]);\n }, [selectedTab, setSelectedTab, tabs]);\n\n const changeTab = tab => {\n setSelectedTab(tab);\n navigate(`${path}#${tab.id}`);\n };\n\n return (\n
\n
\n
\n \n
\n
\n
\n );\n}\n\nexport default Tabs;\n","const ActivityTitles = {\n \"USER.CREATED\": \"Account created\",\n \"USER.LOGGED_IN\": \"Logged in\",\n \"USER.PASSWORD_RESET\": \"Password reset\",\n \"USER.REACTIVATED\": \"Account reactivated\",\n \"USER.SUSPENDED\": \"Account suspended\",\n \"USER.UPDATED\": \"Account updated\",\n \"POST.CREATED\": \"Project Post posted by\",\n \"POST.DOWNLOAD\": \"Project Post downloaded by\",\n \"POST.READ\": \"Project Post viewed by\",\n \"ANNOUNCEMENT.CREATED\": \"Announcement posted by\",\n \"ANNOUNCEMENT.DOWNLOAD\": \"Announcement downloaded by\",\n \"ANNOUNCEMENT.READ\": \"Announcement read by\",\n \"RESEARCH_DOCUMENT.CREATED\": \"New Research created by\",\n \"RESEARCH_DOCUMENT.DOWNLOAD\": \"Research downloaded by\",\n \"RESEARCH_DOCUMENT.VIEW\": \"Research viewed by\",\n \"RESEARCH_DOCUMENT.UPDATED\": \"Research updated by\",\n};\n\nexport default ActivityTitles;\n","const pluralize = (count, string) => {\n return count === 1 ? string : `${string}s`;\n};\n\nconst humanize = string => {\n return string\n .replace(/^[\\s_]+|[\\s_]+$/g, \"\")\n .replace(/[\\s_]+/g, \" \")\n .replace(/^[a-z]/, function(m) {\n return m.toUpperCase();\n });\n};\n\nconst camelCaseToDash = string =>\n string.replace(/[A-Z]/g, m => \"_\" + m.toLowerCase());\n\nexport { pluralize, humanize, camelCaseToDash };\n","import clsx from \"clsx\";\nimport * as React from \"react\";\nimport { Link } from \"react-router-dom\";\nimport ActivityTitles from \"../ActivityTitles\";\nimport { camelCaseToDash, humanize } from \"@/utils/string\";\n\nconst UserCard = ({ ownerData, action }) => {\n return (\n
\n

\n {ActivityTitles[action.toUpperCase()]}\n

\n \n {ownerData.name}\n \n
\n );\n};\n\nconst EngagementCard = ({ ownerData, trackableData, action }) => {\n return (\n
\n

\n {ActivityTitles[action.toUpperCase()]}{\" \"}\n \n {ownerData.name}\n \n

\n \n {trackableData.subject}\n \n
\n );\n};\n\nconst ProjectCard = ({ ownerData, trackableData, action }) => {\n const trackableType = humanize(camelCaseToDash(trackableData.type));\n const ownerType = humanize(camelCaseToDash(ownerData.role));\n\n return (\n
\n {\n {\n \"project.created\": (\n <>\n

\n New {trackableType} added by{\" \"}\n \n {ownerData.name}\n \n

\n \n {trackableData.name}\n \n \n ),\n \"project.joined\": (\n <>\n

\n New {ownerType} joined a Project\n

\n \n {ownerData.name}\n \n

\n {ownerData.organization}\n

\n \n {trackableData.name}\n \n \n ),\n \"project.left\": (\n <>\n

\n {ownerType} left a Project\n \n {ownerData.name}\n \n

{ownerData.organization}

\n \n {trackableData.name}\n \n

\n \n ),\n }[action]\n }\n
\n );\n};\n\nconst ResearchCard = ({ ownerData, trackableData, action }) => {\n return (\n
\n

\n {ActivityTitles[action.toUpperCase()]}{\" \"}\n \n {ownerData.name}\n \n

\n

\n {trackableData.title}\n

\n
\n );\n};\nconst ResourceCard = ({ ownerData, trackableData }) => {\n const trackableType = humanize(camelCaseToDash(trackableData.type));\n return (\n
\n

\n New {trackableType} added by{\" \"}\n \n {ownerData.name}\n \n

\n

\n {trackableData.title}\n

\n
\n );\n};\n\nconst ActivityCard = ({ activity }) => {\n const {\n creationDay,\n creationTime,\n key,\n ownerData,\n trackableData,\n } = activity.attributes;\n const activityResource = key.split(\".\")[0];\n\n return (\n
\n \n
{creationDay}
\n
{creationTime}
\n
\n
\n
\n
/` nodes will end up having it erased by\n // most browsers. (2018/04/27)\n\n\n if (startVoid) {\n attach = contents.querySelector('[data-slate-spacer]');\n } // Remove any zero-width space spans from the cloned DOM so that they don't\n // show up elsewhere when pasted.\n\n\n Array.from(contents.querySelectorAll('[data-slate-zero-width]')).forEach(zw => {\n var isNewline = zw.getAttribute('data-slate-zero-width') === 'n';\n zw.textContent = isNewline ? '\\n' : '';\n }); // Set a `data-slate-fragment` attribute on a non-empty node, so it shows up\n // in the HTML, and can be used for intra-Slate pasting. If it's a text\n // node, wrap it in a `` so we have something to set an attribute on.\n\n if (isDOMText(attach)) {\n var span = attach.ownerDocument.createElement('span'); // COMPAT: In Chrome and Safari, if we don't add the `white-space` style\n // then leading and trailing spaces will be ignored. (2017/09/21)\n\n span.style.whiteSpace = 'pre';\n span.appendChild(attach);\n contents.appendChild(span);\n attach = span;\n }\n\n var fragment = e.getFragment();\n var string = JSON.stringify(fragment);\n var encoded = window.btoa(encodeURIComponent(string));\n attach.setAttribute('data-slate-fragment', encoded);\n data.setData('application/x-slate-fragment', encoded); // Add the content to a
so that we can get its inner HTML.\n\n var div = contents.ownerDocument.createElement('div');\n div.appendChild(contents);\n div.setAttribute('hidden', 'true');\n contents.ownerDocument.body.appendChild(div);\n data.setData('text/html', div.innerHTML);\n data.setData('text/plain', getPlainText(div));\n contents.ownerDocument.body.removeChild(div);\n return data;\n };\n\n e.insertData = data => {\n if (!e.insertFragmentData(data)) {\n e.insertTextData(data);\n }\n };\n\n e.insertFragmentData = data => {\n /**\r\n * Checking copied fragment from application/x-slate-fragment or data-slate-fragment\r\n */\n var fragment = data.getData('application/x-slate-fragment') || getSlateFragmentAttribute(data);\n\n if (fragment) {\n var decoded = decodeURIComponent(window.atob(fragment));\n var parsed = JSON.parse(decoded);\n e.insertFragment(parsed);\n return true;\n }\n\n return false;\n };\n\n e.insertTextData = data => {\n var text = data.getData('text/plain');\n\n if (text) {\n var lines = text.split(/\\r\\n|\\r|\\n/);\n var split = false;\n\n for (var line of lines) {\n if (split) {\n Transforms.splitNodes(e, {\n always: true\n });\n }\n\n e.insertText(line);\n split = true;\n }\n\n return true;\n }\n\n return false;\n };\n\n e.onChange = () => {\n // COMPAT: React doesn't batch `setState` hook calls, which means that the\n // children and selection can get out of sync for one render pass. So we\n // have to use this unstable API to ensure it batches them. (2019/12/03)\n // https://github.com/facebook/react/issues/14259#issuecomment-439702367\n ReactDOM.unstable_batchedUpdates(() => {\n var onContextChange = EDITOR_TO_ON_CHANGE.get(e);\n\n if (onContextChange) {\n onContextChange();\n }\n\n onChange();\n });\n };\n\n return e;\n};\n\nvar getMatches = (e, path) => {\n var matches = [];\n\n for (var [n, p] of Editor.levels(e, {\n at: path\n })) {\n var key = ReactEditor.findKey(e, n);\n matches.push([p, key]);\n }\n\n return matches;\n};\n\n// Components\nvar Editable = IS_ANDROID ? AndroidEditable : Editable$1;\n\nexport { AndroidEditable, Editable$1 as DefaultEditable, DefaultElement, DefaultLeaf, DefaultPlaceholder, Editable, ReactEditor, Slate, useEditor, useFocused, useReadOnly, useSelected, useSlate, useSlateSelector, useSlateStatic, withReact };\n//# sourceMappingURL=index.es.js.map\n","/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexport { isPlainObject };\n","import { isPlainObject } from 'is-plain-object';\nimport { Operation, Editor, Path } from 'slate';\n\nvar History = {\n /**\r\n * Check if a value is a `History` object.\r\n */\n isHistory(value) {\n return isPlainObject(value) && Array.isArray(value.redos) && Array.isArray(value.undos) && (value.redos.length === 0 || Operation.isOperationList(value.redos[0])) && (value.undos.length === 0 || Operation.isOperationList(value.undos[0]));\n }\n\n};\n\n/**\r\n * Weakmaps for attaching state to the editor.\r\n */\n\nvar HISTORY = new WeakMap();\nvar SAVING = new WeakMap();\nvar MERGING = new WeakMap();\nvar HistoryEditor = {\n /**\r\n * Check if a value is a `HistoryEditor` object.\r\n */\n isHistoryEditor(value) {\n return History.isHistory(value.history) && Editor.isEditor(value);\n },\n\n /**\r\n * Get the merge flag's current value.\r\n */\n isMerging(editor) {\n return MERGING.get(editor);\n },\n\n /**\r\n * Get the saving flag's current value.\r\n */\n isSaving(editor) {\n return SAVING.get(editor);\n },\n\n /**\r\n * Redo to the previous saved state.\r\n */\n redo(editor) {\n editor.redo();\n },\n\n /**\r\n * Undo to the previous saved state.\r\n */\n undo(editor) {\n editor.undo();\n },\n\n /**\r\n * Apply a series of changes inside a synchronous `fn`, without merging any of\r\n * the new operations into previous save point in the history.\r\n */\n withoutMerging(editor, fn) {\n var prev = HistoryEditor.isMerging(editor);\n MERGING.set(editor, false);\n fn();\n MERGING.set(editor, prev);\n },\n\n /**\r\n * Apply a series of changes inside a synchronous `fn`, without saving any of\r\n * their operations into the history.\r\n */\n withoutSaving(editor, fn) {\n var prev = HistoryEditor.isSaving(editor);\n SAVING.set(editor, false);\n fn();\n SAVING.set(editor, prev);\n }\n\n};\n\n/**\r\n * The `withHistory` plugin keeps track of the operation history of a Slate\r\n * editor as operations are applied to it, using undo and redo stacks.\r\n *\r\n * If you are using TypeScript, you must extend Slate's CustomTypes to use\r\n * this plugin.\r\n *\r\n * See https://docs.slatejs.org/concepts/11-typescript to learn how.\r\n */\n\nvar withHistory = editor => {\n var e = editor;\n var {\n apply\n } = e;\n e.history = {\n undos: [],\n redos: []\n };\n\n e.redo = () => {\n var {\n history\n } = e;\n var {\n redos\n } = history;\n\n if (redos.length > 0) {\n var batch = redos[redos.length - 1];\n HistoryEditor.withoutSaving(e, () => {\n Editor.withoutNormalizing(e, () => {\n for (var op of batch) {\n e.apply(op);\n }\n });\n });\n history.redos.pop();\n history.undos.push(batch);\n }\n };\n\n e.undo = () => {\n var {\n history\n } = e;\n var {\n undos\n } = history;\n\n if (undos.length > 0) {\n var batch = undos[undos.length - 1];\n HistoryEditor.withoutSaving(e, () => {\n Editor.withoutNormalizing(e, () => {\n var inverseOps = batch.map(Operation.inverse).reverse();\n\n for (var op of inverseOps) {\n e.apply(op);\n }\n });\n });\n history.redos.push(batch);\n history.undos.pop();\n }\n };\n\n e.apply = op => {\n var {\n operations,\n history\n } = e;\n var {\n undos\n } = history;\n var lastBatch = undos[undos.length - 1];\n var lastOp = lastBatch && lastBatch[lastBatch.length - 1];\n var overwrite = shouldOverwrite(op, lastOp);\n var save = HistoryEditor.isSaving(e);\n var merge = HistoryEditor.isMerging(e);\n\n if (save == null) {\n save = shouldSave(op);\n }\n\n if (save) {\n if (merge == null) {\n if (lastBatch == null) {\n merge = false;\n } else if (operations.length !== 0) {\n merge = true;\n } else {\n merge = shouldMerge(op, lastOp) || overwrite;\n }\n }\n\n if (lastBatch && merge) {\n if (overwrite) {\n lastBatch.pop();\n }\n\n lastBatch.push(op);\n } else {\n var batch = [op];\n undos.push(batch);\n }\n\n while (undos.length > 100) {\n undos.shift();\n }\n\n if (shouldClear(op)) {\n history.redos = [];\n }\n }\n\n apply(op);\n };\n\n return e;\n};\n/**\r\n * Check whether to merge an operation into the previous operation.\r\n */\n\nvar shouldMerge = (op, prev) => {\n if (op.type === 'set_selection') {\n return true;\n }\n\n if (prev && op.type === 'insert_text' && prev.type === 'insert_text' && op.offset === prev.offset + prev.text.length && Path.equals(op.path, prev.path)) {\n return true;\n }\n\n if (prev && op.type === 'remove_text' && prev.type === 'remove_text' && op.offset + op.text.length === prev.offset && Path.equals(op.path, prev.path)) {\n return true;\n }\n\n return false;\n};\n/**\r\n * Check whether an operation needs to be saved to the history.\r\n */\n\n\nvar shouldSave = (op, prev) => {\n if (op.type === 'set_selection' && (op.properties == null || op.newProperties == null)) {\n return false;\n }\n\n return true;\n};\n/**\r\n * Check whether an operation should overwrite the previous one.\r\n */\n\n\nvar shouldOverwrite = (op, prev) => {\n if (prev && op.type === 'set_selection' && prev.type === 'set_selection') {\n return true;\n }\n\n return false;\n};\n/**\r\n * Check whether an operation should clear the redos stack.\r\n */\n\n\nvar shouldClear = op => {\n if (op.type === 'set_selection') {\n return false;\n }\n\n return true;\n};\n\nexport { HISTORY, History, HistoryEditor, MERGING, SAVING, withHistory };\n//# sourceMappingURL=index.es.js.map\n","import * as React from \"react\";\n\nfunction BoldIcon(props) {\n return (\n \n \n \n );\n}\n\nfunction ItalicIcon(props) {\n return (\n \n \n \n );\n}\n\nfunction UnderlinedIcon(props) {\n return (\n \n \n \n );\n}\n\nfunction ListIcon(props) {\n return (\n \n \n \n );\n}\n\nfunction OrderListIcon(props) {\n return (\n \n \n \n );\n}\n\nfunction LinkIcon(props) {\n return (\n \n \n \n );\n}\n\nexport {\n BoldIcon,\n ItalicIcon,\n UnderlinedIcon,\n ListIcon,\n OrderListIcon,\n LinkIcon,\n};\n","import * as React from \"react\";\nimport { useSlate } from \"slate-react\";\nimport { Editor, Transforms, Element as SlateElement } from \"slate\";\nimport {\n BoldIcon,\n UnderlinedIcon,\n ItalicIcon,\n ListIcon,\n OrderListIcon,\n} from \"@/components/shared/RichTextEditor/icons\";\n\nconst LIST_TYPES = [\"numbered-list\", \"bulleted-list\", \"list-number\"];\n\nconst renderElement = ({ attributes, children, element }) => {\n switch (element.type) {\n case \"bulleted-list\":\n return (\n
    \n {children}\n
\n );\n case \"list-item\":\n return (\n
  • \n {children}\n
  • \n );\n case \"list-number\":\n return (\n
      \n {children}\n
    \n );\n default:\n return null;\n }\n};\n\nconst isBlockActive = (editor, format) => {\n const [match] = Editor.nodes(editor, {\n match: n =>\n !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format,\n });\n\n return !!match;\n};\n\nconst isMarkActive = (editor, format) => {\n const marks = Editor.marks(editor);\n return marks ? marks[format] === true : false;\n};\n\nconst toggleBlock = (editor, format) => {\n const isActive = isBlockActive(editor, format);\n const isList = LIST_TYPES.includes(format);\n\n Transforms.unwrapNodes(editor, {\n match: n =>\n LIST_TYPES.includes(\n !Editor.isEditor(n) && SlateElement.isElement(n) && n.type,\n ),\n split: true,\n });\n\n let newType = isList ? \"list-item\" : format;\n newType = isActive ? \"paragraph\" : newType;\n\n const newProperties = { type: newType };\n Transforms.setNodes(editor, newProperties);\n\n if (!isActive && isList) {\n const block = { type: format, children: [] };\n Transforms.wrapNodes(editor, block);\n }\n};\n\nconst toggleMark = (editor, format) => {\n const isActive = isMarkActive(editor, format);\n\n if (isActive) {\n Editor.removeMark(editor, format);\n } else {\n Editor.addMark(editor, format, true);\n }\n};\n\nfunction BlockButton({ format, children, ...props }) {\n const editor = useSlate();\n\n return (\n toggleBlock(editor, format)}\n {...props}\n >\n {children}\n \n );\n}\n\nfunction MarkButton({ format, children, ...props }) {\n const editor = useSlate();\n\n return (\n toggleMark(editor, format)}\n {...props}\n >\n {children}\n \n );\n}\n\nfunction BoldButton({ ...props }) {\n return (\n \n \n \n );\n}\n\nfunction ItalicButton({ ...props }) {\n return (\n \n \n \n );\n}\n\nfunction UnderlinedButton({ ...props }) {\n return (\n \n \n \n );\n}\n\nfunction BulletedListButton({ ...props }) {\n return (\n \n \n \n );\n}\n\nfunction NumberListButton({ ...props }) {\n return (\n \n \n \n );\n}\n\nconst Formattable = {\n actions: [\n {\n name: \"Bold\",\n Button: props => ,\n hotkey: { \"mod+b\": editor => toggleMark(editor, \"bold\") },\n isActive: editor => isMarkActive(editor, \"bold\"),\n },\n {\n name: \"Italic\",\n Button: props => ,\n hotkey: { \"mod+i\": editor => toggleMark(editor, \"italic\") },\n isActive: editor => isMarkActive(editor, \"italic\"),\n },\n {\n name: \"Underline\",\n Button: props => ,\n hotkey: { \"mod+u\": editor => toggleMark(editor, \"underline\") },\n isActive: editor => isMarkActive(editor, \"underline\"),\n },\n {\n name: \"List\",\n Button: props => ,\n isActive: editor => isBlockActive(editor, \"underline\"),\n },\n {\n name: \"Order List\",\n Button: props => ,\n isActive: editor => isBlockActive(editor, \"underline\"),\n },\n ],\n renderElement,\n};\n\nexport default Formattable;\n","\n/**\n * Expose `isUrl`.\n */\n\nmodule.exports = isUrl;\n\n/**\n * RegExps.\n * A URL must match #1 and then at least one of #2/#3.\n * Use two levels of REs to avoid REDOS.\n */\n\nvar protocolAndDomainRE = /^(?:\\w+:)?\\/\\/(\\S+)$/;\n\nvar localhostDomainRE = /^localhost[\\:?\\d]*(?:[^\\:?\\d]\\S*)?$/\nvar nonLocalhostDomainRE = /^[^\\s\\.]+\\.\\S{2,}$/;\n\n/**\n * Loosely validate a URL `string`.\n *\n * @param {String} string\n * @return {Boolean}\n */\n\nfunction isUrl(string){\n if (typeof string !== 'string') {\n return false;\n }\n\n var match = string.match(protocolAndDomainRE);\n if (!match) {\n return false;\n }\n\n var everythingAfterProtocol = match[1];\n if (!everythingAfterProtocol) {\n return false;\n }\n\n if (localhostDomainRE.test(everythingAfterProtocol) ||\n nonLocalhostDomainRE.test(everythingAfterProtocol)) {\n return true;\n }\n\n return false;\n}\n","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","\"use strict\";\n\nfunction noop() {\n return null;\n}\n\nnoop.isRequired = noop;\n\nfunction noopThunk() {\n return noop;\n}\n\nmodule.exports = {\n and: noopThunk,\n between: noopThunk,\n booleanSome: noopThunk,\n childrenHavePropXorChildren: noopThunk,\n childrenOf: noopThunk,\n childrenOfType: noopThunk,\n childrenSequenceOf: noopThunk,\n componentWithName: noopThunk,\n disallowedIf: noopThunk,\n elementType: noopThunk,\n empty: noopThunk,\n explicitNull: noopThunk,\n forbidExtraProps: Object,\n integer: noopThunk,\n keysOf: noopThunk,\n mutuallyExclusiveProps: noopThunk,\n mutuallyExclusiveTrueProps: noopThunk,\n nChildren: noopThunk,\n nonNegativeInteger: noop,\n nonNegativeNumber: noopThunk,\n numericString: noopThunk,\n object: noopThunk,\n or: noopThunk,\n predicate: noopThunk,\n range: noopThunk,\n ref: noopThunk,\n requiredBy: noopThunk,\n restrictedProp: noopThunk,\n sequenceOf: noopThunk,\n shape: noopThunk,\n stringEndsWith: noopThunk,\n stringStartsWith: noopThunk,\n uniqueArray: noopThunk,\n uniqueArrayOf: noopThunk,\n valuesOf: noopThunk,\n withShape: noopThunk\n};\n//# sourceMappingURL=index.js.map","module.exports = process.env.NODE_ENV === 'production' ? require('./build/mocks') : require('./build');\n\n//# sourceMappingURL=index.js.map","var CAN_USE_DOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n\n// Adapted from Modernizr\n// https://github.com/Modernizr/Modernizr/blob/acb3f0d9/feature-detects/dom/passiveeventlisteners.js#L26-L37\nfunction testPassiveEventListeners() {\n if (!CAN_USE_DOM) {\n return false;\n }\n\n if (!window.addEventListener || !window.removeEventListener || !Object.defineProperty) {\n return false;\n }\n\n var supportsPassiveOption = false;\n try {\n var opts = Object.defineProperty({}, 'passive', {\n // eslint-disable-next-line getter-return\n get: function () {\n function get() {\n supportsPassiveOption = true;\n }\n\n return get;\n }()\n });\n var noop = function noop() {};\n window.addEventListener('testPassiveEventSupport', noop, opts);\n window.removeEventListener('testPassiveEventSupport', noop, opts);\n } catch (e) {\n // do nothing\n }\n\n return supportsPassiveOption;\n}\n\nvar memoized = void 0;\n\nfunction canUsePassiveEventListeners() {\n if (memoized === undefined) {\n memoized = testPassiveEventListeners();\n }\n return memoized;\n}\n\nfunction normalizeEventOptions(eventOptions) {\n if (!eventOptions) {\n return undefined;\n }\n\n if (!canUsePassiveEventListeners()) {\n // If the browser does not support the passive option, then it is expecting\n // a boolean for the options argument to specify whether it should use\n // capture or not. In more modern browsers, this is passed via the `capture`\n // option, so let's just hoist that value up.\n return !!eventOptions.capture;\n }\n\n return eventOptions;\n}\n\n/* eslint-disable no-bitwise */\n\n/**\n * Generate a unique key for any set of event options\n */\nfunction eventOptionsKey(normalizedEventOptions) {\n if (!normalizedEventOptions) {\n return 0;\n }\n\n // If the browser does not support passive event listeners, the normalized\n // event options will be a boolean.\n if (normalizedEventOptions === true) {\n return 100;\n }\n\n // At this point, the browser supports passive event listeners, so we expect\n // the event options to be an object with possible properties of capture,\n // passive, and once.\n //\n // We want to consistently return the same value, regardless of the order of\n // these properties, so let's use binary maths to assign each property to a\n // bit, and then add those together (with an offset to account for the\n // booleans at the beginning of this function).\n var capture = normalizedEventOptions.capture << 0;\n var passive = normalizedEventOptions.passive << 1;\n var once = normalizedEventOptions.once << 2;\n return capture + passive + once;\n}\n\nfunction ensureCanMutateNextEventHandlers(eventHandlers) {\n if (eventHandlers.handlers === eventHandlers.nextHandlers) {\n // eslint-disable-next-line no-param-reassign\n eventHandlers.nextHandlers = eventHandlers.handlers.slice();\n }\n}\n\nfunction TargetEventHandlers(target) {\n this.target = target;\n this.events = {};\n}\n\nTargetEventHandlers.prototype.getEventHandlers = function () {\n function getEventHandlers(eventName, options) {\n var key = String(eventName) + ' ' + String(eventOptionsKey(options));\n\n if (!this.events[key]) {\n this.events[key] = {\n handlers: [],\n handleEvent: undefined\n };\n this.events[key].nextHandlers = this.events[key].handlers;\n }\n\n return this.events[key];\n }\n\n return getEventHandlers;\n}();\n\nTargetEventHandlers.prototype.handleEvent = function () {\n function handleEvent(eventName, options, event) {\n var eventHandlers = this.getEventHandlers(eventName, options);\n eventHandlers.handlers = eventHandlers.nextHandlers;\n eventHandlers.handlers.forEach(function (handler) {\n if (handler) {\n // We need to check for presence here because a handler function may\n // cause later handlers to get removed. This can happen if you for\n // instance have a waypoint that unmounts another waypoint as part of an\n // onEnter/onLeave handler.\n handler(event);\n }\n });\n }\n\n return handleEvent;\n}();\n\nTargetEventHandlers.prototype.add = function () {\n function add(eventName, listener, options) {\n var _this = this;\n\n // options has already been normalized at this point.\n var eventHandlers = this.getEventHandlers(eventName, options);\n\n ensureCanMutateNextEventHandlers(eventHandlers);\n\n if (eventHandlers.nextHandlers.length === 0) {\n eventHandlers.handleEvent = this.handleEvent.bind(this, eventName, options);\n\n this.target.addEventListener(eventName, eventHandlers.handleEvent, options);\n }\n\n eventHandlers.nextHandlers.push(listener);\n\n var isSubscribed = true;\n var unsubscribe = function () {\n function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n isSubscribed = false;\n\n ensureCanMutateNextEventHandlers(eventHandlers);\n var index = eventHandlers.nextHandlers.indexOf(listener);\n eventHandlers.nextHandlers.splice(index, 1);\n\n if (eventHandlers.nextHandlers.length === 0) {\n // All event handlers have been removed, so we want to remove the event\n // listener from the target node.\n\n if (_this.target) {\n // There can be a race condition where the target may no longer exist\n // when this function is called, e.g. when a React component is\n // unmounting. Guarding against this prevents the following error:\n //\n // Cannot read property 'removeEventListener' of undefined\n _this.target.removeEventListener(eventName, eventHandlers.handleEvent, options);\n }\n\n eventHandlers.handleEvent = undefined;\n }\n }\n\n return unsubscribe;\n }();\n return unsubscribe;\n }\n\n return add;\n}();\n\nvar EVENT_HANDLERS_KEY = '__consolidated_events_handlers__';\n\n// eslint-disable-next-line import/prefer-default-export\nfunction addEventListener(target, eventName, listener, options) {\n if (!target[EVENT_HANDLERS_KEY]) {\n // eslint-disable-next-line no-param-reassign\n target[EVENT_HANDLERS_KEY] = new TargetEventHandlers(target);\n }\n var normalizedEventOptions = normalizeEventOptions(options);\n return target[EVENT_HANDLERS_KEY].add(eventName, listener, normalizedEventOptions);\n}\n\nexport { addEventListener };\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar arePropertyDescriptorsSupported = function () {\n\tvar obj = {};\n\ttry {\n\t\torigDefineProperty(obj, 'x', { enumerable: false, value: obj });\n\t\t// eslint-disable-next-line no-unused-vars, no-restricted-syntax\n\t\tfor (var _ in obj) { // jscs:ignore disallowUnusedVariables\n\t\t\treturn false;\n\t\t}\n\t\treturn obj.x === obj;\n\t} catch (e) { /* this is IE 8. */\n\t\treturn false;\n\t}\n};\nvar supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value;\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\nvar $exec = bind.call(Function.call, RegExp.prototype.exec);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tif ($exec(/^%?[^%]*%?$/, name) === null) {\n\t\tthrow new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');\n\t}\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $TypeError = GetIntrinsic('%TypeError%');\n\n// http://262.ecma-international.org/5.1/#sec-9.10\n\nmodule.exports = function CheckObjectCoercible(value, optMessage) {\n\tif (value == null) {\n\t\tthrow new $TypeError(optMessage || ('Cannot call method on ' + value));\n\t}\n\treturn value;\n};\n","'use strict';\n\nmodule.exports = require('../5/CheckObjectCoercible');\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar RequireObjectCoercible = require('es-abstract/2021/RequireObjectCoercible');\nvar callBound = require('call-bind/callBound');\n\nvar $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');\nvar $push = callBound('Array.prototype.push');\n\nmodule.exports = function values(O) {\n\tvar obj = RequireObjectCoercible(O);\n\tvar vals = [];\n\tfor (var key in obj) {\n\t\tif ($isEnumerable(obj, key)) { // checks own-ness as well\n\t\t\t$push(vals, obj[key]);\n\t\t}\n\t}\n\treturn vals;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.values === 'function' ? Object.values : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimValues() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { values: polyfill }, {\n\t\tvalues: function testValues() {\n\t\t\treturn Object.values !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nmodule.exports = function contains(other) {\n\tif (arguments.length < 1) {\n\t\tthrow new TypeError('1 argument is required');\n\t}\n\tif (typeof other !== 'object') {\n\t\tthrow new TypeError('Argument 1 (”other“) to Node.contains must be an instance of Node');\n\t}\n\n\tvar node = other;\n\tdo {\n\t\tif (this === node) {\n\t\t\treturn true;\n\t\t}\n\t\tif (node) {\n\t\t\tnode = node.parentNode;\n\t\t}\n\t} while (node);\n\n\treturn false;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\tif (typeof document !== 'undefined') {\n\t\tif (document.contains) {\n\t\t\treturn document.contains;\n\t\t}\n\t\tif (document.body && document.body.contains) {\n\t\t\ttry {\n\t\t\t\tif (typeof document.body.contains.call(document, '') === 'boolean') {\n\t\t\t\t\treturn document.body.contains;\n\t\t\t\t}\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\nmodule.exports = function shimContains() {\n\tvar polyfill = getPolyfill();\n\tif (typeof document !== 'undefined') {\n\t\tdefine(\n\t\t\tdocument,\n\t\t\t{ contains: polyfill },\n\t\t\t{ contains: function () { return document.contains !== polyfill; } }\n\t\t);\n\t\tif (typeof Element !== 'undefined') {\n\t\t\tdefine(\n\t\t\t\tElement.prototype,\n\t\t\t\t{ contains: polyfill },\n\t\t\t\t{ contains: function () { return Element.prototype.contains !== polyfill; } }\n\t\t\t);\n\t\t}\n\t}\n\treturn polyfill;\n};\n","'use strict';\n\nvar define = require('define-properties');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar polyfill = getPolyfill();\nvar shim = require('./shim');\n\nvar boundContains = function contains(node, other) {\n\treturn polyfill.apply(node, [other]);\n};\n\ndefine(boundContains, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = boundContains;\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _airbnbPropTypes = require('airbnb-prop-types');\n\nvar _consolidatedEvents = require('consolidated-events');\n\nvar _object = require('object.values');\n\nvar _object2 = _interopRequireDefault(_object);\n\nvar _document = require('document.contains');\n\nvar _document2 = _interopRequireDefault(_document);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar DISPLAY = {\n BLOCK: 'block',\n FLEX: 'flex',\n INLINE: 'inline',\n INLINE_BLOCK: 'inline-block',\n CONTENTS: 'contents'\n};\n\nvar propTypes = (0, _airbnbPropTypes.forbidExtraProps)({\n children: _propTypes2['default'].node.isRequired,\n onOutsideClick: _propTypes2['default'].func.isRequired,\n disabled: _propTypes2['default'].bool,\n useCapture: _propTypes2['default'].bool,\n display: _propTypes2['default'].oneOf((0, _object2['default'])(DISPLAY))\n});\n\nvar defaultProps = {\n disabled: false,\n\n // `useCapture` is set to true by default so that a `stopPropagation` in the\n // children will not prevent all outside click handlers from firing - maja\n useCapture: true,\n display: DISPLAY.BLOCK\n};\n\nvar OutsideClickHandler = function (_React$Component) {\n _inherits(OutsideClickHandler, _React$Component);\n\n function OutsideClickHandler() {\n var _ref;\n\n _classCallCheck(this, OutsideClickHandler);\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _this = _possibleConstructorReturn(this, (_ref = OutsideClickHandler.__proto__ || Object.getPrototypeOf(OutsideClickHandler)).call.apply(_ref, [this].concat(args)));\n\n _this.onMouseDown = _this.onMouseDown.bind(_this);\n _this.onMouseUp = _this.onMouseUp.bind(_this);\n _this.setChildNodeRef = _this.setChildNodeRef.bind(_this);\n return _this;\n }\n\n _createClass(OutsideClickHandler, [{\n key: 'componentDidMount',\n value: function () {\n function componentDidMount() {\n var _props = this.props,\n disabled = _props.disabled,\n useCapture = _props.useCapture;\n\n\n if (!disabled) this.addMouseDownEventListener(useCapture);\n }\n\n return componentDidMount;\n }()\n }, {\n key: 'componentDidUpdate',\n value: function () {\n function componentDidUpdate(_ref2) {\n var prevDisabled = _ref2.disabled;\n var _props2 = this.props,\n disabled = _props2.disabled,\n useCapture = _props2.useCapture;\n\n if (prevDisabled !== disabled) {\n if (disabled) {\n this.removeEventListeners();\n } else {\n this.addMouseDownEventListener(useCapture);\n }\n }\n }\n\n return componentDidUpdate;\n }()\n }, {\n key: 'componentWillUnmount',\n value: function () {\n function componentWillUnmount() {\n this.removeEventListeners();\n }\n\n return componentWillUnmount;\n }()\n\n // Use mousedown/mouseup to enforce that clicks remain outside the root's\n // descendant tree, even when dragged. This should also get triggered on\n // touch devices.\n\n }, {\n key: 'onMouseDown',\n value: function () {\n function onMouseDown(e) {\n var useCapture = this.props.useCapture;\n\n\n var isDescendantOfRoot = this.childNode && (0, _document2['default'])(this.childNode, e.target);\n if (!isDescendantOfRoot) {\n if (this.removeMouseUp) {\n this.removeMouseUp();\n this.removeMouseUp = null;\n }\n this.removeMouseUp = (0, _consolidatedEvents.addEventListener)(document, 'mouseup', this.onMouseUp, { capture: useCapture });\n }\n }\n\n return onMouseDown;\n }()\n\n // Use mousedown/mouseup to enforce that clicks remain outside the root's\n // descendant tree, even when dragged. This should also get triggered on\n // touch devices.\n\n }, {\n key: 'onMouseUp',\n value: function () {\n function onMouseUp(e) {\n var onOutsideClick = this.props.onOutsideClick;\n\n\n var isDescendantOfRoot = this.childNode && (0, _document2['default'])(this.childNode, e.target);\n if (this.removeMouseUp) {\n this.removeMouseUp();\n this.removeMouseUp = null;\n }\n\n if (!isDescendantOfRoot) {\n onOutsideClick(e);\n }\n }\n\n return onMouseUp;\n }()\n }, {\n key: 'setChildNodeRef',\n value: function () {\n function setChildNodeRef(ref) {\n this.childNode = ref;\n }\n\n return setChildNodeRef;\n }()\n }, {\n key: 'addMouseDownEventListener',\n value: function () {\n function addMouseDownEventListener(useCapture) {\n this.removeMouseDown = (0, _consolidatedEvents.addEventListener)(document, 'mousedown', this.onMouseDown, { capture: useCapture });\n }\n\n return addMouseDownEventListener;\n }()\n }, {\n key: 'removeEventListeners',\n value: function () {\n function removeEventListeners() {\n if (this.removeMouseDown) this.removeMouseDown();\n if (this.removeMouseUp) this.removeMouseUp();\n }\n\n return removeEventListeners;\n }()\n }, {\n key: 'render',\n value: function () {\n function render() {\n var _props3 = this.props,\n children = _props3.children,\n display = _props3.display;\n\n\n return _react2['default'].createElement(\n 'div',\n {\n ref: this.setChildNodeRef,\n style: display !== DISPLAY.BLOCK && (0, _object2['default'])(DISPLAY).includes(display) ? { display: display } : undefined\n },\n children\n );\n }\n\n return render;\n }()\n }]);\n\n return OutsideClickHandler;\n}(_react2['default'].Component);\n\nexports['default'] = OutsideClickHandler;\n\n\nOutsideClickHandler.propTypes = propTypes;\nOutsideClickHandler.defaultProps = defaultProps;","// eslint-disable-next-line import/no-unresolved\nmodule.exports = require('./build/OutsideClickHandler');\n","// https://github.com/vitejs/vite/issues/2139#issuecomment-802981228\n// This workaround handles the rollup problem with CommonJS exports\n\nimport original from \"react-outside-click-handler\";\n\nconst OutsideClickHandler = original.default ? original.default : original;\nexport default OutsideClickHandler;\n","import * as React from \"react\";\nimport { useState, useEffect } from \"react\";\nimport isUrl from \"is-url\";\nimport escapeHtml from \"escape-html\";\nimport clsx from \"clsx\";\nimport { useSlate } from \"slate-react\";\nimport { Editor, Transforms, Range } from \"slate\";\nimport OutsideClickHandler from \"@/utils/deps/react-outside-click-handler\";\nimport { LinkIcon } from \"@/components/shared/RichTextEditor/icons\";\n\nconst editorExtension = editor => {\n const { insertData, insertText, isInline } = editor;\n\n editor.insertData = data => {\n const text = data.getData(\"text/plain\");\n\n if (text && isUrl(text)) {\n wrapLink(editor, text);\n } else {\n insertData(data);\n }\n };\n\n editor.insertText = text => {\n if (text && isUrl(text)) {\n wrapLink(editor, text);\n } else {\n insertText(text);\n }\n };\n\n editor.isInline = element => {\n return element.type === \"link\" || isInline(element);\n };\n\n return editor;\n};\n\nconst renderElement = ({ attributes, children, element }) => {\n switch (element.type) {\n case \"link\": {\n return (\n
    \n {children}\n \n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst normalizeUrl = url => {\n if (isUrl(url)) return url;\n\n const withHttps = `https://${url}`;\n if (isUrl(withHttps)) return withHttps;\n\n return \"\";\n};\n\nconst isLinkActive = editor => {\n const [link] = Editor.nodes(editor, { match: n => n.type === \"link\" });\n return !!link;\n};\n\nconst unwrapLink = editor => {\n Transforms.unwrapNodes(editor, { match: n => n.type === \"link\" });\n};\n\nconst wrapLink = (editor, url) => {\n if (isLinkActive(editor)) {\n unwrapLink(editor);\n }\n\n const { selection } = editor;\n const isCollapsed = selection && Range.isCollapsed(selection);\n const link = {\n type: \"link\",\n url,\n children: isCollapsed ? [{ text: url }] : [],\n };\n\n if (isCollapsed) {\n Transforms.insertNodes(editor, link);\n } else {\n Transforms.wrapNodes(editor, link, { split: true });\n Transforms.collapse(editor, { edge: \"end\" });\n }\n};\n\nconst insertLink = (editor, url) => {\n if (editor.selection) {\n wrapLink(editor, url);\n }\n};\n\nconst getLinkData = editor => {\n const [link] = Editor.nodes(editor, {\n match: node => node.type === \"link\",\n });\n\n return link ? link[0] : null;\n};\n\nfunction LinkForm({ setIsOpen }) {\n const editor = useSlate();\n const [selectedText, setSelectedText] = useState(editor.selection);\n\n const [url, setUrl] = useState(\"\");\n const [isErrored, setIsErrored] = useState(false);\n\n const close = () => {\n if (selectedText) {\n Transforms.select(editor, selectedText);\n setSelectedText(null);\n }\n setUrl(\"\");\n setIsOpen(false);\n };\n\n const onChange = event => {\n const url = event.target.value;\n setUrl(url);\n setIsErrored(false);\n };\n\n const onLink = () => {\n const normalizedUrl = normalizeUrl(url);\n\n if (isUrl(normalizedUrl)) {\n close();\n insertLink(editor, escapeHtml(url));\n } else if (normalizedUrl === \"\") {\n close();\n } else {\n setIsErrored(true);\n }\n };\n\n const onUnlink = () => {\n close();\n unwrapLink(editor);\n };\n\n useEffect(() => {\n setUrl(getLinkData(editor)?.url || \"\");\n }, [editor, setUrl]);\n\n return (\n \n \n \n\n \n Unlink\n \n \n Link\n \n
    \n \n );\n}\n\nfunction LinkButton({ ...props }) {\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n
    \n \n {isOpen && }\n
    \n );\n}\n\nconst Linkable = {\n actions: [\n {\n name: \"Insert Link\",\n Button: props => ,\n isActive: editor => isLinkActive(editor),\n },\n ],\n editorExtension,\n renderElement,\n};\n\nexport default Linkable;\n","import React, { useCallback, useMemo, useState } from \"react\";\nimport clsx from \"clsx\";\nimport { Editable, withReact, Slate } from \"slate-react\";\nimport { createEditor, Text } from \"slate\";\nimport { withHistory } from \"slate-history\";\nimport isHotkey from \"is-hotkey\";\nimport Formattable from \"./plugins/formattable\";\nimport Linkable from \"./plugins/linkable\";\n\ntype ActionType = {\n name: string;\n Button: (props: any) => any;\n hotkey?: { [command: string]: any };\n isActive: (editor: any) => boolean;\n};\n\ntype PluginType = {\n actions: ActionType[];\n renderElement: any;\n editorExtension?: any;\n};\n\nconst Plugables: PluginType[] = [Formattable, Linkable];\n\nconst isEditorEmpty = value => {\n if (value.length > 1 || value[0].children.length > 1) return false;\n const node = value[0].children[0];\n return Text.isText(node) && node.text === \"\";\n};\n\nconst withPlugins = editor => {\n for (const plugable of Plugables) {\n if (plugable.editorExtension) {\n editor = plugable.editorExtension(editor);\n }\n }\n return editor;\n};\n\nconst Element = props => {\n for (const plugable of Plugables) {\n if (plugable.renderElement) {\n const plugableElement = plugable.renderElement(props);\n if (plugableElement) return plugableElement;\n }\n }\n\n return (\n

    \n {props.children}\n

    \n );\n};\n\nconst Leaf = ({ attributes, children, leaf }) => {\n if (leaf.bold) {\n children = {children};\n }\n if (leaf.italic) {\n children = {children};\n }\n if (leaf.underline) {\n children = {children};\n }\n return {children};\n};\n\nconst checkHotKeys = (editor, event) => {\n let hotkeys = {};\n for (const plugable of Plugables) {\n for (const action of plugable.actions) {\n if (action.hotkey) hotkeys = { ...hotkeys, ...action.hotkey };\n }\n }\n for (const hotkey in hotkeys) {\n if (isHotkey(hotkey, event)) {\n event.preventDefault();\n const toggle = hotkeys[hotkey];\n toggle(editor);\n }\n }\n};\n\nfunction Toolbar({ actions, editor }) {\n return (\n
    \n {actions.map(action => (\n
    \n \n
    \n ))}\n
    \n );\n}\n\nfunction RichTextEditor({\n value,\n onChange,\n placeholder = \"\",\n className = \"\",\n dataTestId = \"\",\n}) {\n const [isFocus, setIsFocus] = useState(false);\n // Difference between elements and leafs: https://docs.slatejs.org/concepts/09-rendering\n const renderElement = useCallback(props => , []);\n const renderLeaf = useCallback(props => , []);\n const editor = useMemo(\n () => withPlugins(withHistory(withReact(createEditor()))),\n [],\n );\n\n const deserializedValue =\n typeof value === \"string\" || value === null\n ? [{ type: \"paragraph\", children: [{ text: value || \"\" }] }]\n : value;\n\n return (\n <>\n {deserializedValue && (\n \n {\n if (isEditorEmpty(value)) {\n onChange(\"\");\n } else {\n onChange(value);\n }\n }}\n >\n checkHotKeys(editor, event)}\n onFocus={() => setIsFocus(true)}\n onBlur={() => setIsFocus(false)}\n className=\"px-4 pt-4 pb-1 min-h-75px\"\n data-testid={dataTestId}\n />\n \n \n
    \n
    \n
    \n \n \n \n {\n {\n user: ,\n announcement: (\n \n ),\n project: (\n \n ),\n research_document: (\n \n ),\n resource: (\n \n ),\n }[activityResource]\n }\n
    \n
    \n \n );\n};\n\nfunction ActivityList({ activities }) {\n return (\n
    \n {activities.map((activity, index) => (\n \n ))}\n
    \n );\n}\n\nexport default ActivityList;\n","import * as React from \"react\";\nimport { useLocation } from \"react-router-dom\";\nimport { useState, useEffect } from \"react\";\nimport { fetcher } from \"@/utils/api\";\nimport paramBuilder from \"@/utils/network/paramBuilder\";\nimport { useInfiniteQuery, useQuery } from \"@tanstack/react-query\";\nimport {\n useInfiniteQueryResult,\n apiCanFetch,\n} from \"@/hooks/useInfiniteQueryResult\";\nimport { useScrollPosition } from \"@/hooks/useScrollPosition\";\nimport Tabs from \"./Tabs\";\nimport ActivityList from \"./ActivityList\";\nimport clsx from \"clsx\";\n\nconst tabs = [\n { id: \"all\", name: \"All\" },\n { id: \"account\", name: \"Account\" },\n { id: \"engagement\", name: \"Engagement\" },\n { id: \"project\", name: \"Project\" },\n { id: \"research\", name: \"Research\" },\n];\n\nconst fetchActivities = ({ pageParam = 0, queryKey }) => {\n const [key, hash] = queryKey;\n const visibility = hash.slice(1) || \"all\";\n\n const baseUrl = `api/${key}`;\n const params = paramBuilder({\n filter: {\n visibility: [visibility],\n },\n });\n const url = `${baseUrl}?page[size]=10&page[number]=${pageParam +\n 1}&${params}`;\n return fetcher(url);\n};\n\nconst SummaryActivity = ({ stats }) => {\n return (\n
    \n
    \n {stats?.map((item, index) => (\n \n \n

    {item.count}

    \n \n {item.title}\n \n
    \n
    \n ))}\n
    \n \n );\n};\n\nconst DashboardHeader = ({ tabs, selectedTab, setSelectedTab }) => {\n const { isLoading: isLoadingStats, data: stats } = useQuery(\n [\"dashboard-stats\"],\n () => fetcher(\"admin/dashboard_stats\"),\n );\n return (\n
    \n
    \n

    Dashboard

    \n

    PICI Community Activity.

    \n
    \n {!isLoadingStats && }\n \n
    \n );\n};\n\nfunction AdminDashboardPage() {\n const { hash } = useLocation();\n const [selectedTab, setSelectedTab] = useState(\n tabs.find(tab => tab.id == hash.slice(1)),\n );\n const {\n data,\n isLoading,\n isFetching,\n fetchNextPage,\n hasNextPage,\n } = useInfiniteQuery([\"activities\", hash], fetchActivities, {\n getNextPageParam: apiCanFetch,\n });\n\n const { data: activities } = useInfiniteQueryResult(data?.pages);\n const { isAtBottom } = useScrollPosition(\"article-container\");\n\n useEffect(() => {\n if (isFetching) return;\n if (isAtBottom && hasNextPage) fetchNextPage();\n }, [isAtBottom, isFetching, fetchNextPage, hasNextPage]);\n\n return (\n
    \n \n
    \n
    \n {!isLoading && }\n
    \n
    \n
    \n );\n}\n\nexport default AdminDashboardPage;\n","import { useEffect, useState } from \"react\";\n\nfunction getWindowDimensions() {\n const { innerWidth: width, innerHeight: height } = window;\n return {\n width,\n height,\n };\n}\n\nexport default function useWindowDimensions() {\n const [windowDimensions, setWindowDimensions] = useState(\n getWindowDimensions(),\n );\n const handleResize = () => setWindowDimensions(getWindowDimensions());\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleResize);\n return () => window.removeEventListener(\"resize\", handleResize);\n }, []);\n\n return windowDimensions;\n}\n","import * as React from \"react\";\nimport clsx from \"clsx\";\nimport { useNavigate, useLocation } from \"react-router-dom\";\nimport { FilterOption } from \"@/types\";\nimport useWindowDimensions from \"@/hooks/useWindowDimensions\";\nimport Select from \"@/components/shared/Select\";\n\nconst palettes = {\n primary: {\n navBorder: \"\",\n selectedTab: \"border-primary text-dark-100\",\n unselectedTab: \"border-transparent text-dark-50 hover:text-dark-100\",\n },\n};\nconst LARGE_WINDOW_SIZE = 1600;\nconst NORMAL_WINDOW_SIZE = 1460;\nconst TABLET_WINDOW_SIZE = 1240;\n\nfunction Tabs({\n defaultTabLabel = \"All\",\n tabs,\n selectedTab,\n setSelectedTab,\n palette = \"primary\",\n className = \"\",\n}: {\n defaultTabLabel?: String;\n tabs: Array;\n selectedTab: FilterOption | undefined;\n setSelectedTab: (_: FilterOption | undefined) => any;\n palette?: \"primary\" | \"dark\";\n className?: string;\n}) {\n const navigate = useNavigate();\n const { pathname: path } = useLocation();\n const { width: windowWidth } = useWindowDimensions();\n let partialTabs = tabs;\n let groupTabs: any[] = [];\n\n if (windowWidth < TABLET_WINDOW_SIZE) {\n partialTabs = tabs.slice(0, -6);\n groupTabs = tabs.slice(-6);\n } else if (\n windowWidth >= TABLET_WINDOW_SIZE &&\n windowWidth < NORMAL_WINDOW_SIZE\n ) {\n partialTabs = tabs.slice(0, -4);\n groupTabs = tabs.slice(-4);\n } else if (\n windowWidth >= NORMAL_WINDOW_SIZE &&\n windowWidth < LARGE_WINDOW_SIZE &&\n tabs.length > 4\n ) {\n partialTabs = tabs.slice(0, -2);\n groupTabs = tabs.slice(-2);\n } else {\n partialTabs = tabs;\n groupTabs = [];\n }\n\n const changeTab = tab => {\n setSelectedTab(tab);\n navigate(`${path}#${tab.slug}`);\n };\n return (\n
    \n
    \n
    \n \n
    \n
    \n
    \n );\n}\n\nexport default Tabs;\n","import * as React from \"react\";\nimport clsx from \"clsx\";\n\nfunction Table({\n children,\n className = \"\",\n tableClassName = \"\",\n fixed = false,\n isOverflowY = false,\n}) {\n return (\n \n
    \n
    \n \n {children}\n \n
    \n
    \n \n );\n}\n\nTable.Header = ({ children, className = \"\" }) => {\n return (\n \n {children}\n \n );\n};\n\nTable.Body = ({ children, className = \"\" }) => {\n return (\n \n {children}\n \n );\n};\n\nTable.Row = ({ children, className = \"\", ...props }) => {\n return (\n \n {children}\n \n );\n};\n\nTable.HeaderCell = ({ children, className = \"\", width = \"\", ...props }) => {\n return (\n \n {children}\n \n );\n};\n\nTable.Cell = ({ children, expand = true, className = \"\", ...props }) => {\n return (\n \n {children}\n \n );\n};\n\nexport default Table;\n","\nmodule.exports = function () {\n var selection = document.getSelection();\n if (!selection.rangeCount) {\n return function () {};\n }\n var active = document.activeElement;\n\n var ranges = [];\n for (var i = 0; i < selection.rangeCount; i++) {\n ranges.push(selection.getRangeAt(i));\n }\n\n switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML\n case 'INPUT':\n case 'TEXTAREA':\n active.blur();\n break;\n\n default:\n active = null;\n break;\n }\n\n selection.removeAllRanges();\n return function () {\n selection.type === 'Caret' &&\n selection.removeAllRanges();\n\n if (!selection.rangeCount) {\n ranges.forEach(function(range) {\n selection.addRange(range);\n });\n }\n\n active &&\n active.focus();\n };\n};\n","\"use strict\";\n\nvar deselectCurrent = require(\"toggle-selection\");\n\nvar clipboardToIE11Formatting = {\n \"text/plain\": \"Text\",\n \"text/html\": \"Url\",\n \"default\": \"Text\"\n}\n\nvar defaultMessage = \"Copy to clipboard: #{key}, Enter\";\n\nfunction format(message) {\n var copyKey = (/mac os x/i.test(navigator.userAgent) ? \"⌘\" : \"Ctrl\") + \"+C\";\n return message.replace(/#{\\s*key\\s*}/g, copyKey);\n}\n\nfunction copy(text, options) {\n var debug,\n message,\n reselectPrevious,\n range,\n selection,\n mark,\n success = false;\n if (!options) {\n options = {};\n }\n debug = options.debug || false;\n try {\n reselectPrevious = deselectCurrent();\n\n range = document.createRange();\n selection = document.getSelection();\n\n mark = document.createElement(\"span\");\n mark.textContent = text;\n // reset user styles for span element\n mark.style.all = \"unset\";\n // prevents scrolling to the end of the page\n mark.style.position = \"fixed\";\n mark.style.top = 0;\n mark.style.clip = \"rect(0, 0, 0, 0)\";\n // used to preserve spaces and line breaks\n mark.style.whiteSpace = \"pre\";\n // do not inherit user-select (it may be `none`)\n mark.style.webkitUserSelect = \"text\";\n mark.style.MozUserSelect = \"text\";\n mark.style.msUserSelect = \"text\";\n mark.style.userSelect = \"text\";\n mark.addEventListener(\"copy\", function(e) {\n e.stopPropagation();\n if (options.format) {\n e.preventDefault();\n if (typeof e.clipboardData === \"undefined\") { // IE 11\n debug && console.warn(\"unable to use e.clipboardData\");\n debug && console.warn(\"trying IE specific stuff\");\n window.clipboardData.clearData();\n var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting[\"default\"]\n window.clipboardData.setData(format, text);\n } else { // all other browsers\n e.clipboardData.clearData();\n e.clipboardData.setData(options.format, text);\n }\n }\n if (options.onCopy) {\n e.preventDefault();\n options.onCopy(e.clipboardData);\n }\n });\n\n document.body.appendChild(mark);\n\n range.selectNodeContents(mark);\n selection.addRange(range);\n\n var successful = document.execCommand(\"copy\");\n if (!successful) {\n throw new Error(\"copy command was unsuccessful\");\n }\n success = true;\n } catch (err) {\n debug && console.error(\"unable to copy using execCommand: \", err);\n debug && console.warn(\"trying IE specific stuff\");\n try {\n window.clipboardData.setData(options.format || \"text\", text);\n options.onCopy && options.onCopy(window.clipboardData);\n success = true;\n } catch (err) {\n debug && console.error(\"unable to copy using clipboardData: \", err);\n debug && console.error(\"falling back to prompt\");\n message = format(\"message\" in options ? options.message : defaultMessage);\n window.prompt(message, text);\n }\n } finally {\n if (selection) {\n if (typeof selection.removeRange == \"function\") {\n selection.removeRange(range);\n } else {\n selection.removeAllRanges();\n }\n }\n\n if (mark) {\n document.body.removeChild(mark);\n }\n reselectPrevious();\n }\n\n return success;\n}\n\nmodule.exports = copy;\n","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.CopyToClipboard = void 0;\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _copyToClipboard = _interopRequireDefault(require(\"copy-to-clipboard\"));\n\nvar _excluded = [\"text\", \"onCopy\", \"options\", \"children\"];\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar CopyToClipboard = /*#__PURE__*/function (_React$PureComponent) {\n _inherits(CopyToClipboard, _React$PureComponent);\n\n var _super = _createSuper(CopyToClipboard);\n\n function CopyToClipboard() {\n var _this;\n\n _classCallCheck(this, CopyToClipboard);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _super.call.apply(_super, [this].concat(args));\n\n _defineProperty(_assertThisInitialized(_this), \"onClick\", function (event) {\n var _this$props = _this.props,\n text = _this$props.text,\n onCopy = _this$props.onCopy,\n children = _this$props.children,\n options = _this$props.options;\n\n var elem = _react[\"default\"].Children.only(children);\n\n var result = (0, _copyToClipboard[\"default\"])(text, options);\n\n if (onCopy) {\n onCopy(text, result);\n } // Bypass onClick if it was present\n\n\n if (elem && elem.props && typeof elem.props.onClick === 'function') {\n elem.props.onClick(event);\n }\n });\n\n return _this;\n }\n\n _createClass(CopyToClipboard, [{\n key: \"render\",\n value: function render() {\n var _this$props2 = this.props,\n _text = _this$props2.text,\n _onCopy = _this$props2.onCopy,\n _options = _this$props2.options,\n children = _this$props2.children,\n props = _objectWithoutProperties(_this$props2, _excluded);\n\n var elem = _react[\"default\"].Children.only(children);\n\n return /*#__PURE__*/_react[\"default\"].cloneElement(elem, _objectSpread(_objectSpread({}, props), {}, {\n onClick: this.onClick\n }));\n }\n }]);\n\n return CopyToClipboard;\n}(_react[\"default\"].PureComponent);\n\nexports.CopyToClipboard = CopyToClipboard;\n\n_defineProperty(CopyToClipboard, \"defaultProps\", {\n onCopy: undefined,\n options: undefined\n});","\"use strict\";\n\nvar _require = require('./Component'),\n CopyToClipboard = _require.CopyToClipboard;\n\nCopyToClipboard.CopyToClipboard = CopyToClipboard;\nmodule.exports = CopyToClipboard;","import * as React from \"react\";\nimport { CopyToClipboard } from \"react-copy-to-clipboard\";\n\nfunction CopyLink({\n valueToCopy = \"\",\n close = () => {},\n layerProps,\n onCopy,\n}: {\n valueToCopy: string;\n layerProps: any;\n close: () => any;\n onCopy: (text: string, result: boolean) => any;\n}) {\n return (\n \n
    \n

    \n Copy Link to Share\n

    \n close()}\n />\n
    \n
    \n \n \n \n \n
    \n \n );\n}\n\nexport default CopyLink;\n","import * as React from \"react\";\nimport { useLayer } from \"react-laag\";\nimport CopyLink from \"@/components/shared/CopyLink\";\n\nfunction PopoverMenu({ resource, showToast, children }) {\n const [isOpen, setOpen] = React.useState(false);\n const titleUrl = resource.attributes.titleUrl;\n\n // helper function to close the menu\n const close = () => setOpen(false);\n\n const { renderLayer, triggerProps, layerProps } = useLayer({\n isOpen,\n onOutsideClick: close, // close the menu when the user clicks outside\n onDisappear: close, // close the menu when the menu gets scrolled out of sight\n overflowContainer: true, // keep the menu positioned inside the container\n auto: true, // automatically find the best placement\n placement: \"top-end\", // we prefer to place the menu \"top-end\"\n triggerOffset: 12, // keep some distance to the trigger\n containerOffset: 16, // give the menu some room to breath relative to the container\n arrowOffset: 16, // let the arrow have some room to breath also\n });\n let newChildren = React.cloneElement(children, {\n ...triggerProps,\n onClick: () => setOpen(true),\n });\n\n return (\n <>\n {newChildren}\n {isOpen &&\n renderLayer(\n {\n close();\n showToast(result);\n }}\n />,\n )}\n \n );\n}\nexport default PopoverMenu;\n","import * as React from \"react\";\nimport clsx from \"clsx\";\n\nfunction NoResults({\n entityName,\n icon,\n fullText,\n className,\n}: {\n entityName?: string;\n icon: string;\n fullText?: string;\n className?: string;\n}) {\n return (\n \n \n No Results\n

    \n {fullText\n ? fullText\n : `We couldn't find any ${entityName} matching your criteria`}\n

    \n \n );\n}\n\nexport default NoResults;\n","import * as React from \"react\";\nimport { toast, Slide } from \"react-toastify\";\n\nconst renderToast = (iconClassName, text) => {\n function Toast() {\n return (\n
    \n \n

    {text}

    \n
    \n );\n }\n\n return () => ;\n};\n\nfunction useToast({\n successText,\n errorText = \"An error has ocurred.\",\n autoClose = 4000,\n}: {\n successText: string | React.ReactElement;\n errorText?: string | React.ReactElement;\n autoClose?: number;\n}) {\n const showSuccessToast = () =>\n toast.success(renderToast(\"ri-check-line\", successText), {\n transition: Slide,\n closeButton: false,\n className: \"bg-secondary\",\n progressClassName: \"bg-secondary-dark\",\n autoClose: autoClose,\n });\n\n const showErrorToast = () =>\n toast.error(renderToast(\"ri-error-warning-line\", errorText), {\n transition: Slide,\n closeButton: false,\n className: \"bg-error\",\n progressClassName: \"bg-error-dark\",\n autoClose: autoClose,\n });\n\n const showToast = (success: boolean = true) => {\n return success ? showSuccessToast() : showErrorToast();\n };\n\n return showToast;\n}\n\nexport default useToast;\n","import * as React from \"react\";\nimport Table from \"@/components/shared/Table\";\nimport PopoverMenu from \"@/components/shared/PopoverMenu\";\nimport NoResults from \"@/components/shared/NoResults\";\nimport useToast from \"@/hooks/useToast\";\n\nfunction itemValue(item, column) {\n if (column.accessor) {\n return column.accessor(item, column.name);\n } else {\n return item.attributes[column.name];\n }\n}\n\nfunction render(value, column, item) {\n if (column.render) {\n return column.render(value, item);\n } else {\n return value;\n }\n}\nconst ResourceRowSkeleton = ({ columns }) => {\n return (\n \n {columns.map((column, j) =>\n column.name != \"actions\" ? (\n \n
    \n \n ) : (\n \n
    \n
    \n
    \n
    \n \n ),\n )}\n \n );\n};\nfunction ResourcesTable({\n resources,\n tabs,\n isFetching,\n isFetchingNextPage,\n openForm,\n}) {\n const showToast = useToast({\n successText: (\n <>\n A link to the resource has been copied to your clipboard.
    \n Click ⌘ + v or Ctrl + v to paste.\n \n ),\n errorText: \"Could not copy the resource link to your clipboard.\",\n });\n const columns = [\n {\n label: \"Resource Title\",\n name: \"title\",\n th: { className: \"pt-1 pl-4 text-11\" },\n td: {\n className:\n \"max-w-[300px] pt-[10px] pb-[10px] pl-4 whitespace-nowrap overflow-ellipsis overflow-hidden font-bold text-dark-75\",\n },\n },\n {\n label: \"Category\",\n name: \"categoryId\",\n th: { width: \"20%\", className: \"pt-1 pl-4 text-11\" },\n td: {\n className:\n \"pt-[10px] pb-[10px] pl-4 whitespace-nowrap overflow-ellipsis overflow-hidden\",\n },\n render: categoryId => (\n <>{tabs.find(category => category.id === categoryId).name}\n ),\n },\n {\n label: \"Type\",\n name: \"shortType\",\n th: { className: \"pt-1 pl-4 text-11\" },\n td: {\n className:\n \"pt-[10px] pb-[10px] pl-4 whitespace-nowrap overflow-ellipsis overflow-hidden\",\n },\n },\n {\n label: \"Details\",\n name: \"link\",\n th: { className: \"pt-1 pl-4 text-11\" },\n td: {\n className:\n \"pt-[10px] pb-[10px] pl-4 whitespace-nowrap overflow-ellipsis overflow-hidden max-w-[250px]\",\n },\n },\n {\n label: \"File Size\",\n name: \"fileSize\",\n th: { className: \"pt-1 pl-4 pr-2 text-11 w-[90px]\" },\n td: {\n className:\n \"pt-[10px] pb-[10px] pl-4 pr-4 whitespace-nowrap overflow-ellipsis overflow-hidden\",\n },\n },\n {\n label: \"Actions\",\n name: \"actions\",\n th: { className: \"text-left pt-1 pl-4 text-11 w-[110px]\" },\n td: {\n className:\n \"pt-[10px] pb-[10px] pl-4 pr-4 whitespace-nowrap text-center\",\n },\n render: (_, item) => (\n
    \n openForm(item)}\n data-testid={item.attributes.name}\n >\n Edit\n \n \n \n \n \n \n {item.attributes.fileUrl && (\n \n {\" \"}\n View\n \n )}\n
    \n ),\n },\n ];\n return (\n <>\n {!isFetching && resources.length === 0 ? (\n \n ) : (\n \n \n {columns.map((column, i) => (\n \n {column.label}\n \n ))}\n \n \n {resources.length > 0 &&\n resources.map((item, i) => (\n \n {columns.map((column, j) => (\n \n {render(itemValue(item, column), column, item)}\n \n ))}\n \n ))}\n {(isFetching || isFetchingNextPage) &&\n [1, 2, 3, 4, 5, 6].map(x => (\n \n ))}\n \n
    \n )}\n \n );\n}\n\nexport default ResourcesTable;\n","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n","import { Children, createContext, useContext, useRef, useEffect, useReducer, useCallback, useMemo, useImperativeHandle, createElement, useLayoutEffect, forwardRef, Component } from 'react';\nimport isEqual from 'react-fast-compare';\nimport deepmerge from 'deepmerge';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport clone from 'lodash-es/clone';\nimport toPath from 'lodash-es/toPath';\nimport invariant from 'tiny-warning';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport cloneDeep from 'lodash-es/cloneDeep';\n\nfunction _extends() {\n _extends = Object.assign || 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\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/** @private is the value an empty array? */\n\nvar isEmptyArray = function isEmptyArray(value) {\n return Array.isArray(value) && value.length === 0;\n};\n/** @private is the given object a Function? */\n\nvar isFunction = function isFunction(obj) {\n return typeof obj === 'function';\n};\n/** @private is the given object an Object? */\n\nvar isObject = function isObject(obj) {\n return obj !== null && typeof obj === 'object';\n};\n/** @private is the given object an integer? */\n\nvar isInteger = function isInteger(obj) {\n return String(Math.floor(Number(obj))) === obj;\n};\n/** @private is the given object a string? */\n\nvar isString = function isString(obj) {\n return Object.prototype.toString.call(obj) === '[object String]';\n};\n/** @private is the given object a NaN? */\n// eslint-disable-next-line no-self-compare\n\nvar isNaN$1 = function isNaN(obj) {\n return obj !== obj;\n};\n/** @private Does a React component have exactly 0 children? */\n\nvar isEmptyChildren = function isEmptyChildren(children) {\n return Children.count(children) === 0;\n};\n/** @private is the given object/value a promise? */\n\nvar isPromise = function isPromise(value) {\n return isObject(value) && isFunction(value.then);\n};\n/** @private is the given object/value a type of synthetic event? */\n\nvar isInputEvent = function isInputEvent(value) {\n return value && isObject(value) && isObject(value.target);\n};\n/**\r\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\r\n * not safe to call document.activeElement if there is nothing focused.\r\n *\r\n * The activeElement will be null only if the document or document body is not\r\n * yet defined.\r\n *\r\n * @param {?Document} doc Defaults to current document.\r\n * @return {Element | null}\r\n * @see https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/dom/getActiveElement.js\r\n */\n\nfunction getActiveElement(doc) {\n doc = doc || (typeof document !== 'undefined' ? document : undefined);\n\n if (typeof doc === 'undefined') {\n return null;\n }\n\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n}\n/**\r\n * Deeply get a value from an object via its path.\r\n */\n\nfunction getIn(obj, key, def, p) {\n if (p === void 0) {\n p = 0;\n }\n\n var path = toPath(key);\n\n while (obj && p < path.length) {\n obj = obj[path[p++]];\n }\n\n return obj === undefined ? def : obj;\n}\n/**\r\n * Deeply set a value from in object via it's path. If the value at `path`\r\n * has changed, return a shallow copy of obj with `value` set at `path`.\r\n * If `value` has not changed, return the original `obj`.\r\n *\r\n * Existing objects / arrays along `path` are also shallow copied. Sibling\r\n * objects along path retain the same internal js reference. Since new\r\n * objects / arrays are only created along `path`, we can test if anything\r\n * changed in a nested structure by comparing the object's reference in\r\n * the old and new object, similar to how russian doll cache invalidation\r\n * works.\r\n *\r\n * In earlier versions of this function, which used cloneDeep, there were\r\n * issues whereby settings a nested value would mutate the parent\r\n * instead of creating a new object. `clone` avoids that bug making a\r\n * shallow copy of the objects along the update path\r\n * so no object is mutated in place.\r\n *\r\n * Before changing this function, please read through the following\r\n * discussions.\r\n *\r\n * @see https://github.com/developit/linkstate\r\n * @see https://github.com/jaredpalmer/formik/pull/123\r\n */\n\nfunction setIn(obj, path, value) {\n var res = clone(obj); // this keeps inheritance when obj is a class\n\n var resVal = res;\n var i = 0;\n var pathArray = toPath(path);\n\n for (; i < pathArray.length - 1; i++) {\n var currentPath = pathArray[i];\n var currentObj = getIn(obj, pathArray.slice(0, i + 1));\n\n if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {\n resVal = resVal[currentPath] = clone(currentObj);\n } else {\n var nextPath = pathArray[i + 1];\n resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};\n }\n } // Return original object if new value is the same as current\n\n\n if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {\n return obj;\n }\n\n if (value === undefined) {\n delete resVal[pathArray[i]];\n } else {\n resVal[pathArray[i]] = value;\n } // If the path array has a single element, the loop did not run.\n // Deleting on `resVal` had no effect in this scenario, so we delete on the result instead.\n\n\n if (i === 0 && value === undefined) {\n delete res[pathArray[i]];\n }\n\n return res;\n}\n/**\r\n * Recursively a set the same value for all keys and arrays nested object, cloning\r\n * @param object\r\n * @param value\r\n * @param visited\r\n * @param response\r\n */\n\nfunction setNestedObjectValues(object, value, visited, response) {\n if (visited === void 0) {\n visited = new WeakMap();\n }\n\n if (response === void 0) {\n response = {};\n }\n\n for (var _i = 0, _Object$keys = Object.keys(object); _i < _Object$keys.length; _i++) {\n var k = _Object$keys[_i];\n var val = object[k];\n\n if (isObject(val)) {\n if (!visited.get(val)) {\n visited.set(val, true); // In order to keep array values consistent for both dot path and\n // bracket syntax, we need to check if this is an array so that\n // this will output { friends: [true] } and not { friends: { \"0\": true } }\n\n response[k] = Array.isArray(val) ? [] : {};\n setNestedObjectValues(val, value, visited, response[k]);\n }\n } else {\n response[k] = value;\n }\n }\n\n return response;\n}\n\nvar FormikContext = /*#__PURE__*/createContext(undefined);\nFormikContext.displayName = 'FormikContext';\nvar FormikProvider = FormikContext.Provider;\nvar FormikConsumer = FormikContext.Consumer;\nfunction useFormikContext() {\n var formik = useContext(FormikContext);\n !!!formik ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"Formik context is undefined, please verify you are calling useFormikContext() as child of a component.\") : invariant(false) : void 0;\n return formik;\n}\n\nfunction formikReducer(state, msg) {\n switch (msg.type) {\n case 'SET_VALUES':\n return _extends({}, state, {\n values: msg.payload\n });\n\n case 'SET_TOUCHED':\n return _extends({}, state, {\n touched: msg.payload\n });\n\n case 'SET_ERRORS':\n if (isEqual(state.errors, msg.payload)) {\n return state;\n }\n\n return _extends({}, state, {\n errors: msg.payload\n });\n\n case 'SET_STATUS':\n return _extends({}, state, {\n status: msg.payload\n });\n\n case 'SET_ISSUBMITTING':\n return _extends({}, state, {\n isSubmitting: msg.payload\n });\n\n case 'SET_ISVALIDATING':\n return _extends({}, state, {\n isValidating: msg.payload\n });\n\n case 'SET_FIELD_VALUE':\n return _extends({}, state, {\n values: setIn(state.values, msg.payload.field, msg.payload.value)\n });\n\n case 'SET_FIELD_TOUCHED':\n return _extends({}, state, {\n touched: setIn(state.touched, msg.payload.field, msg.payload.value)\n });\n\n case 'SET_FIELD_ERROR':\n return _extends({}, state, {\n errors: setIn(state.errors, msg.payload.field, msg.payload.value)\n });\n\n case 'RESET_FORM':\n return _extends({}, state, msg.payload);\n\n case 'SET_FORMIK_STATE':\n return msg.payload(state);\n\n case 'SUBMIT_ATTEMPT':\n return _extends({}, state, {\n touched: setNestedObjectValues(state.values, true),\n isSubmitting: true,\n submitCount: state.submitCount + 1\n });\n\n case 'SUBMIT_FAILURE':\n return _extends({}, state, {\n isSubmitting: false\n });\n\n case 'SUBMIT_SUCCESS':\n return _extends({}, state, {\n isSubmitting: false\n });\n\n default:\n return state;\n }\n} // Initial empty states // objects\n\n\nvar emptyErrors = {};\nvar emptyTouched = {};\nfunction useFormik(_ref) {\n var _ref$validateOnChange = _ref.validateOnChange,\n validateOnChange = _ref$validateOnChange === void 0 ? true : _ref$validateOnChange,\n _ref$validateOnBlur = _ref.validateOnBlur,\n validateOnBlur = _ref$validateOnBlur === void 0 ? true : _ref$validateOnBlur,\n _ref$validateOnMount = _ref.validateOnMount,\n validateOnMount = _ref$validateOnMount === void 0 ? false : _ref$validateOnMount,\n isInitialValid = _ref.isInitialValid,\n _ref$enableReinitiali = _ref.enableReinitialize,\n enableReinitialize = _ref$enableReinitiali === void 0 ? false : _ref$enableReinitiali,\n onSubmit = _ref.onSubmit,\n rest = _objectWithoutPropertiesLoose(_ref, [\"validateOnChange\", \"validateOnBlur\", \"validateOnMount\", \"isInitialValid\", \"enableReinitialize\", \"onSubmit\"]);\n\n var props = _extends({\n validateOnChange: validateOnChange,\n validateOnBlur: validateOnBlur,\n validateOnMount: validateOnMount,\n onSubmit: onSubmit\n }, rest);\n\n var initialValues = useRef(props.initialValues);\n var initialErrors = useRef(props.initialErrors || emptyErrors);\n var initialTouched = useRef(props.initialTouched || emptyTouched);\n var initialStatus = useRef(props.initialStatus);\n var isMounted = useRef(false);\n var fieldRegistry = useRef({});\n\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(function () {\n !(typeof isInitialValid === 'undefined') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.') : invariant(false) : void 0; // eslint-disable-next-line\n }, []);\n }\n\n useEffect(function () {\n isMounted.current = true;\n return function () {\n isMounted.current = false;\n };\n }, []);\n\n var _React$useReducer = useReducer(formikReducer, {\n values: props.initialValues,\n errors: props.initialErrors || emptyErrors,\n touched: props.initialTouched || emptyTouched,\n status: props.initialStatus,\n isSubmitting: false,\n isValidating: false,\n submitCount: 0\n }),\n state = _React$useReducer[0],\n dispatch = _React$useReducer[1];\n\n var runValidateHandler = useCallback(function (values, field) {\n return new Promise(function (resolve, reject) {\n var maybePromisedErrors = props.validate(values, field);\n\n if (maybePromisedErrors == null) {\n // use loose null check here on purpose\n resolve(emptyErrors);\n } else if (isPromise(maybePromisedErrors)) {\n maybePromisedErrors.then(function (errors) {\n resolve(errors || emptyErrors);\n }, function (actualException) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Warning: An unhandled error was caught during validation in \", actualException);\n }\n\n reject(actualException);\n });\n } else {\n resolve(maybePromisedErrors);\n }\n });\n }, [props.validate]);\n /**\r\n * Run validation against a Yup schema and optionally run a function if successful\r\n */\n\n var runValidationSchema = useCallback(function (values, field) {\n var validationSchema = props.validationSchema;\n var schema = isFunction(validationSchema) ? validationSchema(field) : validationSchema;\n var promise = field && schema.validateAt ? schema.validateAt(field, values) : validateYupSchema(values, schema);\n return new Promise(function (resolve, reject) {\n promise.then(function () {\n resolve(emptyErrors);\n }, function (err) {\n // Yup will throw a validation error if validation fails. We catch those and\n // resolve them into Formik errors. We can sniff if something is a Yup error\n // by checking error.name.\n // @see https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string\n if (err.name === 'ValidationError') {\n resolve(yupToFormErrors(err));\n } else {\n // We throw any other errors\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\"Warning: An unhandled error was caught during validation in \", err);\n }\n\n reject(err);\n }\n });\n });\n }, [props.validationSchema]);\n var runSingleFieldLevelValidation = useCallback(function (field, value) {\n return new Promise(function (resolve) {\n return resolve(fieldRegistry.current[field].validate(value));\n });\n }, []);\n var runFieldLevelValidations = useCallback(function (values) {\n var fieldKeysWithValidation = Object.keys(fieldRegistry.current).filter(function (f) {\n return isFunction(fieldRegistry.current[f].validate);\n }); // Construct an array with all of the field validation functions\n\n var fieldValidations = fieldKeysWithValidation.length > 0 ? fieldKeysWithValidation.map(function (f) {\n return runSingleFieldLevelValidation(f, getIn(values, f));\n }) : [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')]; // use special case ;)\n\n return Promise.all(fieldValidations).then(function (fieldErrorsList) {\n return fieldErrorsList.reduce(function (prev, curr, index) {\n if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {\n return prev;\n }\n\n if (curr) {\n prev = setIn(prev, fieldKeysWithValidation[index], curr);\n }\n\n return prev;\n }, {});\n });\n }, [runSingleFieldLevelValidation]); // Run all validations and return the result\n\n var runAllValidations = useCallback(function (values) {\n return Promise.all([runFieldLevelValidations(values), props.validationSchema ? runValidationSchema(values) : {}, props.validate ? runValidateHandler(values) : {}]).then(function (_ref2) {\n var fieldErrors = _ref2[0],\n schemaErrors = _ref2[1],\n validateErrors = _ref2[2];\n var combinedErrors = deepmerge.all([fieldErrors, schemaErrors, validateErrors], {\n arrayMerge: arrayMerge\n });\n return combinedErrors;\n });\n }, [props.validate, props.validationSchema, runFieldLevelValidations, runValidateHandler, runValidationSchema]); // Run all validations methods and update state accordingly\n\n var validateFormWithHighPriority = useEventCallback(function (values) {\n if (values === void 0) {\n values = state.values;\n }\n\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: true\n });\n return runAllValidations(values).then(function (combinedErrors) {\n if (!!isMounted.current) {\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: false\n });\n dispatch({\n type: 'SET_ERRORS',\n payload: combinedErrors\n });\n }\n\n return combinedErrors;\n });\n });\n useEffect(function () {\n if (validateOnMount && isMounted.current === true && isEqual(initialValues.current, props.initialValues)) {\n validateFormWithHighPriority(initialValues.current);\n }\n }, [validateOnMount, validateFormWithHighPriority]);\n var resetForm = useCallback(function (nextState) {\n var values = nextState && nextState.values ? nextState.values : initialValues.current;\n var errors = nextState && nextState.errors ? nextState.errors : initialErrors.current ? initialErrors.current : props.initialErrors || {};\n var touched = nextState && nextState.touched ? nextState.touched : initialTouched.current ? initialTouched.current : props.initialTouched || {};\n var status = nextState && nextState.status ? nextState.status : initialStatus.current ? initialStatus.current : props.initialStatus;\n initialValues.current = values;\n initialErrors.current = errors;\n initialTouched.current = touched;\n initialStatus.current = status;\n\n var dispatchFn = function dispatchFn() {\n dispatch({\n type: 'RESET_FORM',\n payload: {\n isSubmitting: !!nextState && !!nextState.isSubmitting,\n errors: errors,\n touched: touched,\n status: status,\n values: values,\n isValidating: !!nextState && !!nextState.isValidating,\n submitCount: !!nextState && !!nextState.submitCount && typeof nextState.submitCount === 'number' ? nextState.submitCount : 0\n }\n });\n };\n\n if (props.onReset) {\n var maybePromisedOnReset = props.onReset(state.values, imperativeMethods);\n\n if (isPromise(maybePromisedOnReset)) {\n maybePromisedOnReset.then(dispatchFn);\n } else {\n dispatchFn();\n }\n } else {\n dispatchFn();\n }\n }, [props.initialErrors, props.initialStatus, props.initialTouched]);\n useEffect(function () {\n if (isMounted.current === true && !isEqual(initialValues.current, props.initialValues)) {\n if (enableReinitialize) {\n initialValues.current = props.initialValues;\n resetForm();\n }\n\n if (validateOnMount) {\n validateFormWithHighPriority(initialValues.current);\n }\n }\n }, [enableReinitialize, props.initialValues, resetForm, validateOnMount, validateFormWithHighPriority]);\n useEffect(function () {\n if (enableReinitialize && isMounted.current === true && !isEqual(initialErrors.current, props.initialErrors)) {\n initialErrors.current = props.initialErrors || emptyErrors;\n dispatch({\n type: 'SET_ERRORS',\n payload: props.initialErrors || emptyErrors\n });\n }\n }, [enableReinitialize, props.initialErrors]);\n useEffect(function () {\n if (enableReinitialize && isMounted.current === true && !isEqual(initialTouched.current, props.initialTouched)) {\n initialTouched.current = props.initialTouched || emptyTouched;\n dispatch({\n type: 'SET_TOUCHED',\n payload: props.initialTouched || emptyTouched\n });\n }\n }, [enableReinitialize, props.initialTouched]);\n useEffect(function () {\n if (enableReinitialize && isMounted.current === true && !isEqual(initialStatus.current, props.initialStatus)) {\n initialStatus.current = props.initialStatus;\n dispatch({\n type: 'SET_STATUS',\n payload: props.initialStatus\n });\n }\n }, [enableReinitialize, props.initialStatus, props.initialTouched]);\n var validateField = useEventCallback(function (name) {\n // This will efficiently validate a single field by avoiding state\n // changes if the validation function is synchronous. It's different from\n // what is called when using validateForm.\n if (fieldRegistry.current[name] && isFunction(fieldRegistry.current[name].validate)) {\n var value = getIn(state.values, name);\n var maybePromise = fieldRegistry.current[name].validate(value);\n\n if (isPromise(maybePromise)) {\n // Only flip isValidating if the function is async.\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: true\n });\n return maybePromise.then(function (x) {\n return x;\n }).then(function (error) {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: error\n }\n });\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: false\n });\n });\n } else {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: maybePromise\n }\n });\n return Promise.resolve(maybePromise);\n }\n } else if (props.validationSchema) {\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: true\n });\n return runValidationSchema(state.values, name).then(function (x) {\n return x;\n }).then(function (error) {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: name,\n value: error[name]\n }\n });\n dispatch({\n type: 'SET_ISVALIDATING',\n payload: false\n });\n });\n }\n\n return Promise.resolve();\n });\n var registerField = useCallback(function (name, _ref3) {\n var validate = _ref3.validate;\n fieldRegistry.current[name] = {\n validate: validate\n };\n }, []);\n var unregisterField = useCallback(function (name) {\n delete fieldRegistry.current[name];\n }, []);\n var setTouched = useEventCallback(function (touched, shouldValidate) {\n dispatch({\n type: 'SET_TOUCHED',\n payload: touched\n });\n var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;\n return willValidate ? validateFormWithHighPriority(state.values) : Promise.resolve();\n });\n var setErrors = useCallback(function (errors) {\n dispatch({\n type: 'SET_ERRORS',\n payload: errors\n });\n }, []);\n var setValues = useEventCallback(function (values, shouldValidate) {\n var resolvedValues = isFunction(values) ? values(state.values) : values;\n dispatch({\n type: 'SET_VALUES',\n payload: resolvedValues\n });\n var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;\n return willValidate ? validateFormWithHighPriority(resolvedValues) : Promise.resolve();\n });\n var setFieldError = useCallback(function (field, value) {\n dispatch({\n type: 'SET_FIELD_ERROR',\n payload: {\n field: field,\n value: value\n }\n });\n }, []);\n var setFieldValue = useEventCallback(function (field, value, shouldValidate) {\n dispatch({\n type: 'SET_FIELD_VALUE',\n payload: {\n field: field,\n value: value\n }\n });\n var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;\n return willValidate ? validateFormWithHighPriority(setIn(state.values, field, value)) : Promise.resolve();\n });\n var executeChange = useCallback(function (eventOrTextValue, maybePath) {\n // By default, assume that the first argument is a string. This allows us to use\n // handleChange with React Native and React Native Web's onChangeText prop which\n // provides just the value of the input.\n var field = maybePath;\n var val = eventOrTextValue;\n var parsed; // If the first argument is not a string though, it has to be a synthetic React Event (or a fake one),\n // so we handle like we would a normal HTML change event.\n\n if (!isString(eventOrTextValue)) {\n // If we can, persist the event\n // @see https://reactjs.org/docs/events.html#event-pooling\n if (eventOrTextValue.persist) {\n eventOrTextValue.persist();\n }\n\n var target = eventOrTextValue.target ? eventOrTextValue.target : eventOrTextValue.currentTarget;\n var type = target.type,\n name = target.name,\n id = target.id,\n value = target.value,\n checked = target.checked,\n outerHTML = target.outerHTML,\n options = target.options,\n multiple = target.multiple;\n field = maybePath ? maybePath : name ? name : id;\n\n if (!field && process.env.NODE_ENV !== \"production\") {\n warnAboutMissingIdentifier({\n htmlContent: outerHTML,\n documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',\n handlerName: 'handleChange'\n });\n }\n\n val = /number|range/.test(type) ? (parsed = parseFloat(value), isNaN(parsed) ? '' : parsed) : /checkbox/.test(type) // checkboxes\n ? getValueForCheckbox(getIn(state.values, field), checked, value) : options && multiple //