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A,EAAAA,cAAA,SACS7wB,GAAA,OAAA+H,QAAAsY,QAAA,MAEzBhhB,OAAA,EAAAA,EAAgBW,IAAAgI,MAAA,WAEH,SAAfhI,EAAMjC,MAERo+D,qBAAqB37D,EAAS9B,QAAA,MAGlC,CAACW,IAGGy8B,GAAkBjL,EAAAA,EAAAA,cAAA,SACS7wB,GAAA,OAAA+H,QAAAsY,QAAA,MAEvBozC,OAAA,EAAAA,EAAczzD,IAAAgI,MAAA,WAED,UAAfhI,EAAMjC,OAERyC,EAAS9B,QAAUupB,uBAAsB,kBAAMhF,GAAA,EAAW,UAG9D,CAACwwC,IAIH,OAAKjuC,EAKHlmB,EAAAA,cAACU,EAAA,CAAO,uBACNV,EAAAA,cAACw3D,GAAApzB,GAAA,GACKpiC,EAAA,CACJ61D,YAAa13D,EACbT,IAAKqB,EACL6W,aAAcgrC,EAAgBxjD,QAC9B25D,cAAex8B,EACf48B,YAAa38B,MAAA,kBCnErB,IAEIuiC,EAAU,WAAY,EA2C1BC,EAAOC,QAAUF","sources":["../../../node_modules/@reach/utils/dist/reach-utils.esm.js","../../../node_modules/@reach/portal/dist/reach-portal.esm.js","../../../node_modules/xstate/es/_virtual/_tslib.js","../../../node_modules/xstate/es/constants.js","../../../node_modules/xstate/es/types.js","../../../node_modules/xstate/es/actionTypes.js","../../../node_modules/xstate/es/utils.js","../../../node_modules/xstate/es/environment.js","../../../node_modules/xstate/es/stateUtils.js","../../../node_modules/xstate/es/actions.js","../../../node_modules/xstate/es/State.js","../../../node_modules/xstate/es/scheduler.js","../../../node_modules/xstate/es/serviceScope.js","../../../node_modules/xstate/es/Actor.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/react/es/types.js","../../../node_modules/@xstate/react/es/useConstant.js","../../../node_modules/@xstate/react/es/utils.js","../../../node_modules/@xstate/react/es/useReactEffectActions.js","../../../node_modules/@xstate/react/es/useInterpret.js","../../../node_modules/@xstate/react/es/useMachine.js","../../../node_modules/react-spring-bottom-sheet/node_modules/react-spring/web.js","../../../node_modules/react-use-gesture/src/utils/math.ts","../../../node_modules/react-use-gesture/src/utils/rubberband.ts","../../../node_modules/react-use-gesture/src/utils/utils.ts","../../../node_modules/react-use-gesture/src/utils/resolveOptionsWith.ts","../../../node_modules/react-use-gesture/src/utils/config.ts","../../../node_modules/react-use-gesture/src/hooks/buildConfig.ts","../../../node_modules/react-use-gesture/src/utils/state.ts","../../../node_modules/react-use-gesture/src/recognizers/Recognizer.ts","../../../node_modules/react-use-gesture/src/Controller.ts","../../../node_modules/react-use-gesture/src/hooks/useRecognizers.ts","../../../node_modules/react-use-gesture/src/recognizers/CoordinatesRecognizer.ts","../../../node_modules/react-use-gesture/src/utils/event.ts","../../../node_modules/react-use-gesture/src/recognizers/DragRecognizer.ts","../../../node_modules/react-use-gesture/src/utils/memoize-one.ts","../../../node_modules/react-use-gesture/src/utils/react-fast-compare.ts","../../../node_modules/tabbable/src/index.js","../../../node_modules/focus-trap/index.js","../../../node_modules/body-scroll-lock/lib/bodyScrollLock.esm.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObserverBoxOptions.js","../../../node_modules/@juggle/resize-observer/lib/utils/resizeObservers.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/deliverResizeLoopError.js","../../../node_modules/@juggle/resize-observer/lib/utils/freeze.js","../../../node_modules/@juggle/resize-observer/lib/utils/queueMicroTask.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObserverSize.js","../../../node_modules/@juggle/resize-observer/lib/DOMRectReadOnly.js","../../../node_modules/@juggle/resize-observer/lib/utils/element.js","../../../node_modules/@juggle/resize-observer/lib/utils/global.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/calculateBoxSize.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObserverEntry.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/calculateDepthForNode.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/broadcastActiveObservations.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/gatherActiveObservationsAtDepth.js","../../../node_modules/@juggle/resize-observer/lib/utils/process.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/hasActiveObservations.js","../../../node_modules/@juggle/resize-observer/lib/algorithms/hasSkippedObservations.js","../../../node_modules/@juggle/resize-observer/lib/utils/scheduler.js","../../../node_modules/@juggle/resize-observer/lib/utils/queueResizeObserver.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObservation.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObserverDetail.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObserverController.js","../../../node_modules/@juggle/resize-observer/lib/ResizeObserver.js","../../../node_modules/xstate/es/invokeUtils.js","../../../node_modules/xstate/es/StateNode.js","../../../node_modules/xstate/es/index.js","../../../node_modules/react-spring-bottom-sheet/src/hooks/useLayoutEffect.tsx","../../../node_modules/react-spring-bottom-sheet/src/utils.ts","../../../node_modules/react-spring-bottom-sheet/src/hooks/useSnapPoints.tsx","../../../node_modules/react-spring-bottom-sheet/src/machines/overlay.ts","../../../node_modules/xstate/es/Machine.js","../../../node_modules/react-spring-bottom-sheet/src/BottomSheet.tsx","../../../node_modules/react-spring-bottom-sheet/src/hooks/useReady.tsx","../../../node_modules/react-spring-bottom-sheet/src/hooks/useReducedMotion.tsx","../../../node_modules/react-spring-bottom-sheet/src/hooks/useSpring.tsx","../../../node_modules/react-spring-bottom-sheet/src/hooks/useScrollLock.tsx","../../../node_modules/react-spring-bottom-sheet/src/hooks/useAriaHider.tsx","../../../node_modules/react-spring-bottom-sheet/src/hooks/useFocusTrap.tsx","../../../node_modules/react-use-gesture/src/hooks/useDrag.ts","../../../node_modules/react-spring-bottom-sheet/src/hooks/useSpringInterpolations.tsx","../../../node_modules/react-spring-bottom-sheet/src/index.tsx","../../../node_modules/warning/warning.js"],"sourcesContent":["import * as React from 'react';\nimport { useLayoutEffect, useEffect, isValidElement, cloneElement, createContext, forwardRef, memo, useRef, useState, useCallback, useMemo } from 'react';\nimport fbWarning from 'warning';\n\n/* eslint-disable no-restricted-globals, eqeqeq */\n\n/**\n * React currently throws a warning when using useLayoutEffect on the server.\n * To get around it, we can conditionally useEffect on the server (no-op) and\n * useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also\n * need affected components to render on the server. One example is when setting\n * a component's descendants to retrieve their index values.\n *\n * Important to note that using this hook as an escape hatch will break the\n * eslint dependency warnings unless you rename the import to `useLayoutEffect`.\n * Use sparingly only when the effect won't effect the rendered HTML to avoid\n * any server/client mismatch.\n *\n * If a useLayoutEffect is needed and the result would create a mismatch, it's\n * likely that the component in question shouldn't be rendered on the server at\n * all, so a better approach would be to lazily render those in a parent\n * component after client-side hydration.\n *\n * TODO: We are calling useLayoutEffect in a couple of places that will likely\n * cause some issues for SSR users, whether the warning shows or not. Audit and\n * fix these.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n *\n * @param effect\n * @param deps\n */\nvar useIsomorphicLayoutEffect = /*#__PURE__*/canUseDOM() ? useLayoutEffect : useEffect;\nvar checkedPkgs = {};\n/**\n * Copy of Facebook's warning package.\n *\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical paths.\n * Removing the logging code for production environments will keep the same\n * logic and follow the same code paths.\n *\n * @see https://github.com/BerkeleyTrue/warning/blob/master/warning.js\n */\n\nvar warning = fbWarning;\n/**\n * When in dev mode, checks that styles for a given @reach package are loaded.\n *\n * @param packageName Name of the package to check.\n * @example checkStyles(\"dialog\") will check for styles for @reach/dialog\n */\n\nvar checkStyles = noop;\n\nif (process.env.NODE_ENV !== \"production\") {\n // In CJS files, process.env.NODE_ENV is stripped from our build, but we need\n // it to prevent style checks from clogging up user logs while testing.\n // This is a workaround until we can tweak the build a bit to accommodate.\n var _ref = typeof process !== \"undefined\" ? process : {\n env: {\n NODE_ENV: \"development\"\n }\n },\n env = _ref.env;\n\n checkStyles = function checkStyles(packageName) {\n // only check once per package\n if (checkedPkgs[packageName]) return;\n checkedPkgs[packageName] = true;\n\n if (env.NODE_ENV !== \"test\" && parseInt(window.getComputedStyle(document.body).getPropertyValue(\"--reach-\" + packageName), 10) !== 1) {\n console.warn(\"@reach/\" + packageName + \" styles not found. If you are using a bundler like webpack or parcel include this in the entry file of your app before any of your own styles:\\n\\n import \\\"@reach/\" + packageName + \"/styles.css\\\";\\n\\n Otherwise you'll need to include them some other way:\\n\\n <link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"node_modules/@reach/\" + packageName + \"/styles.css\\\" />\\n\\n For more information visit https://ui.reach.tech/styling.\\n \");\n }\n };\n}\n/**\n * Ponyfill for the global object in some environments.\n *\n * @link https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\n */\n\nvar ponyfillGlobal = typeof window != \"undefined\" && window.Math == Math ? window : typeof self != \"undefined\" && self.Math == Math ? self :\n/*#__PURE__*/\n// eslint-disable-next-line no-new-func\nFunction(\"return this\")();\n/**\n * Passes or assigns an arbitrary value to a ref function or object.\n *\n * @param ref\n * @param value\n */\n\nfunction assignRef(ref, value) {\n if (ref == null) return;\n\n if (isFunction(ref)) {\n ref(value);\n } else {\n try {\n ref.current = value;\n } catch (error) {\n throw new Error(\"Cannot assign value \\\"\" + value + \"\\\" to ref \\\"\" + ref + \"\\\"\");\n }\n }\n}\n/**\n * Checks true|\"true\" vs false|\"false\"\n *\n * @param value\n */\n\nfunction boolOrBoolString(value) {\n return value === \"true\" ? true : isBoolean(value) ? value : false;\n}\nfunction canUseDOM() {\n return !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\n}\n/**\n * Type-safe clone element\n *\n * @param element\n * @param props\n * @param children\n */\n\nfunction cloneValidElement(element, props) {\n for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n children[_key - 2] = arguments[_key];\n }\n\n return /*#__PURE__*/isValidElement(element) ? cloneElement.apply(React, [element, props].concat(children)) : element;\n}\nfunction createNamedContext(name, defaultValue) {\n var Ctx = /*#__PURE__*/createContext(defaultValue);\n Ctx.displayName = name;\n return Ctx;\n}\n/**\n * This is a hack for sure. The thing is, getting a component to intelligently\n * infer props based on a component or JSX string passed into an `as` prop is\n * kind of a huge pain. Getting it to work and satisfy the constraints of\n * `forwardRef` seems dang near impossible. To avoid needing to do this awkward\n * type song-and-dance every time we want to forward a ref into a component\n * that accepts an `as` prop, we abstract all of that mess to this function for\n * the time time being.\n */\n\nfunction forwardRefWithAs(render) {\n return /*#__PURE__*/forwardRef(render);\n}\nfunction memoWithAs(Component, propsAreEqual) {\n return /*#__PURE__*/memo(Component, propsAreEqual);\n}\n/**\n * Get the size of the working document minus the scrollbar offset.\n *\n * @param element\n */\n\nfunction getDocumentDimensions(element) {\n var _ownerDocument$docume, _ownerDocument$docume2;\n\n var ownerDocument = getOwnerDocument(element);\n var ownerWindow = ownerDocument.defaultView || window;\n\n if (!ownerDocument) {\n return {\n width: 0,\n height: 0\n };\n }\n\n return {\n width: (_ownerDocument$docume = ownerDocument.documentElement.clientWidth) != null ? _ownerDocument$docume : ownerWindow.innerWidth,\n height: (_ownerDocument$docume2 = ownerDocument.documentElement.clientHeight) != null ? _ownerDocument$docume2 : ownerWindow.innerHeight\n };\n}\n/**\n * Get the scoll position of the global window object relative to a given node.\n *\n * @param element\n */\n\nfunction getScrollPosition(element) {\n var ownerDocument = getOwnerDocument(element);\n var ownerWindow = ownerDocument.defaultView || window;\n\n if (!ownerDocument) {\n return {\n scrollX: 0,\n scrollY: 0\n };\n }\n\n return {\n scrollX: ownerWindow.scrollX,\n scrollY: ownerWindow.scrollY\n };\n}\n/**\n * Get a computed style value by property.\n *\n * @param element\n * @param styleProp\n */\n\nfunction getElementComputedStyle(element, styleProp) {\n var ownerDocument = getOwnerDocument(element);\n var ownerWindow = (ownerDocument == null ? void 0 : ownerDocument.defaultView) || window;\n\n if (ownerWindow) {\n return ownerWindow.getComputedStyle(element, null).getPropertyValue(styleProp);\n }\n\n return null;\n}\n/**\n * Get an element's owner document. Useful when components are used in iframes\n * or other environments like dev tools.\n *\n * @param element\n */\n\nfunction getOwnerDocument(element) {\n return canUseDOM() ? element ? element.ownerDocument : document : null;\n}\n/**\n * TODO: Remove in 1.0\n */\n\nfunction getOwnerWindow(element) {\n var ownerDocument = getOwnerDocument(element);\n return ownerDocument ? ownerDocument.defaultView || window : null;\n}\n/**\n * Get the scrollbar offset distance.\n *\n * TODO: Remove in 1.0 (we used this in public examples)\n */\n\nfunction getScrollbarOffset() {\n try {\n if (window.innerWidth > document.documentElement.clientWidth) {\n return window.innerWidth - document.documentElement.clientWidth;\n }\n } catch (err) {}\n\n return 0;\n}\n/**\n * Checks whether or not a value is a boolean.\n *\n * @param value\n */\n\nfunction isBoolean(value) {\n return typeof value === \"boolean\";\n}\n/**\n * Checks whether or not a value is a function.\n *\n * @param value\n */\n\nfunction isFunction(value) {\n return !!(value && {}.toString.call(value) == \"[object Function]\");\n}\n/**\n * Checks whether or not a value is a number.\n *\n * @param value\n */\n\nfunction isNumber(value) {\n return typeof value === \"number\" && !isNaN(value);\n}\n/**\n * Detects right clicks\n *\n * @param nativeEvent\n */\n\nfunction isRightClick(nativeEvent) {\n return \"which\" in nativeEvent ? nativeEvent.which === 3 : \"button\" in nativeEvent ? nativeEvent.button === 2 : false;\n}\n/**\n * Checks whether or not a value is a string.\n *\n * @param value\n */\n\nfunction isString(value) {\n return typeof value === \"string\";\n}\n/**\n * Joins strings to format IDs for compound components.\n *\n * @param args\n */\n\nfunction makeId() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return args.filter(function (val) {\n return val != null;\n }).join(\"--\");\n}\n/**\n * No-op function.\n */\n\nfunction noop() {}\n/**\n * Convert our state strings for HTML data attributes.\n * No need for a fancy kebab-caser here, we know what our state strings are!\n *\n * @param state\n */\n\nfunction stateToAttributeString(state) {\n return String(state).replace(/([\\s_]+)/g, \"-\").toLowerCase();\n}\n/**\n * Check if a component is controlled or uncontrolled and return the correct\n * state value and setter accordingly. If the component state is controlled by\n * the app, the setter is a noop.\n *\n * @param controlledValue\n * @param defaultValue\n */\n\nfunction useControlledState(controlledValue, defaultValue) {\n var controlledRef = useRef(controlledValue != null);\n\n var _React$useState = useState(defaultValue),\n valueState = _React$useState[0],\n setValue = _React$useState[1];\n\n var set = useCallback(function (n) {\n if (!controlledRef.current) {\n setValue(n);\n }\n }, []);\n return [controlledRef.current ? controlledValue : valueState, set];\n}\n/**\n * Logs a warning in dev mode when a component switches from controlled to\n * uncontrolled, or vice versa\n *\n * A single prop should typically be used to determine whether or not a\n * component is controlled or not.\n *\n * @param controlledValue\n * @param controlledPropName\n * @param componentName\n */\n\nvar useControlledSwitchWarning = noop;\n\nif (process.env.NODE_ENV !== \"production\") {\n useControlledSwitchWarning = function useControlledSwitchWarning(controlledValue, controlledPropName, componentName) {\n var controlledRef = useRef(controlledValue != null);\n var nameCache = useRef({\n componentName: componentName,\n controlledPropName: controlledPropName\n });\n useEffect(function () {\n nameCache.current = {\n componentName: componentName,\n controlledPropName: controlledPropName\n };\n }, [componentName, controlledPropName]);\n useEffect(function () {\n var wasControlled = controlledRef.current;\n var _nameCache$current = nameCache.current,\n componentName = _nameCache$current.componentName,\n controlledPropName = _nameCache$current.controlledPropName;\n var isControlled = controlledValue != null;\n\n if (wasControlled !== isControlled) {\n console.error(\"A component is changing an \" + (wasControlled ? \"\" : \"un\") + \"controlled `\" + controlledPropName + \"` state of \" + componentName + \" to be \" + (wasControlled ? \"un\" : \"\") + \"controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled \" + componentName + \" element for the lifetime of the component.\\nMore info: https://fb.me/react-controlled-components\");\n }\n }, [controlledValue]);\n };\n}\nvar useCheckStyles = noop;\n\nif (process.env.NODE_ENV !== \"production\") {\n useCheckStyles = function useCheckStyles(pkg) {\n var name = useRef(pkg);\n useEffect(function () {\n return void (name.current = pkg);\n }, [pkg]);\n useEffect(function () {\n return checkStyles(name.current);\n }, []);\n };\n}\n/**\n * React hook for creating a value exactly once.\n * @see https://github.com/Andarist/use-constant\n */\n\nfunction useConstant(fn) {\n var ref = useRef();\n\n if (!ref.current) {\n ref.current = {\n v: fn()\n };\n }\n\n return ref.current.v;\n}\n/**\n * @param callback\n */\n\nfunction useEventCallback(callback) {\n var ref = useRef(callback);\n useIsomorphicLayoutEffect(function () {\n ref.current = callback;\n });\n return useCallback(function (event) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n\n return ref.current.apply(ref, [event].concat(args));\n }, []);\n}\nfunction useLazyRef(fn) {\n var ref = useRef({\n __internalSet: true\n });\n\n if (ref.current && ref.current.__internalSet === true) {\n ref.current = fn();\n }\n\n return ref;\n}\n/**\n * TODO: Remove in 1.0\n * @alias useStableCallback\n * @param callback\n */\n\nvar useCallbackProp = useStableCallback;\n/**\n * Adds a DOM event listener\n *\n * @param eventName\n * @param listener\n * @param element\n */\n\nfunction useEventListener(eventName, listener, element) {\n if (element === void 0) {\n element = window;\n }\n\n var savedHandler = useRef(listener);\n useEffect(function () {\n savedHandler.current = listener;\n }, [listener]);\n useEffect(function () {\n var isSupported = element && element.addEventListener;\n\n if (!isSupported) {\n if (process.env.NODE_ENV !== \"production\") {\n console.warn(\"Event listener not supported on the element provided\");\n }\n\n return;\n }\n\n function eventListener(event) {\n savedHandler.current(event);\n }\n\n element.addEventListener(eventName, eventListener);\n return function () {\n element.removeEventListener(eventName, eventListener);\n };\n }, [eventName, element]);\n}\n/**\n * Detect when focus changes in our document.\n *\n * @param handleChange\n * @param when\n * @param ownerDocument\n */\n\nfunction useFocusChange(handleChange, when, ownerDocument) {\n if (handleChange === void 0) {\n handleChange = console.log;\n }\n\n if (when === void 0) {\n when = \"focus\";\n }\n\n if (ownerDocument === void 0) {\n ownerDocument = document;\n }\n\n var lastActiveElement = useRef(ownerDocument.activeElement);\n useEffect(function () {\n lastActiveElement.current = ownerDocument.activeElement;\n\n function onChange(event) {\n if (lastActiveElement.current !== ownerDocument.activeElement) {\n handleChange(ownerDocument.activeElement, lastActiveElement.current, event);\n lastActiveElement.current = ownerDocument.activeElement;\n }\n }\n\n ownerDocument.addEventListener(when, onChange, true);\n return function () {\n ownerDocument.removeEventListener(when, onChange);\n };\n }, [when, handleChange, ownerDocument]);\n}\n/**\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\n\nfunction useForceUpdate() {\n var _React$useState2 = useState(Object.create(null)),\n dispatch = _React$useState2[1];\n\n return useCallback(function () {\n dispatch(Object.create(null));\n }, []);\n}\n/**\n * Passes or assigns a value to multiple refs (typically a DOM node). Useful for\n * dealing with components that need an explicit ref for DOM calculations but\n * also forwards refs assigned by an app.\n *\n * @param refs Refs to fork\n */\n\nfunction useForkedRef() {\n for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n refs[_key4] = arguments[_key4];\n }\n\n return useMemo(function () {\n if (refs.every(function (ref) {\n return ref == null;\n })) {\n return null;\n }\n\n return function (node) {\n refs.forEach(function (ref) {\n assignRef(ref, node);\n });\n }; // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [].concat(refs));\n}\n/**\n * Returns the previous value of a reference after a component update.\n *\n * @param value\n */\n\nfunction usePrevious(value) {\n var ref = useRef(null);\n useEffect(function () {\n ref.current = value;\n }, [value]);\n return ref.current;\n}\n/**\n * Converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop and exposed as a stable function to avoid executing effects when\n * passed as a dependency.\n */\n\nfunction useStableCallback(callback) {\n var callbackRef = useRef(callback);\n useEffect(function () {\n callbackRef.current = callback;\n }); // eslint-disable-next-line react-hooks/exhaustive-deps\n\n return useCallback(function () {\n callbackRef.current && callbackRef.current.apply(callbackRef, arguments);\n }, []);\n}\n/**\n * Call an effect after a component update, skipping the initial mount.\n *\n * @param effect Effect to call\n * @param deps Effect dependency list\n */\n\nfunction useUpdateEffect(effect, deps) {\n var mounted = useRef(false);\n useEffect(function () {\n if (mounted.current) {\n effect();\n } else {\n mounted.current = true;\n } // eslint-disable-next-line react-hooks/exhaustive-deps\n\n }, deps);\n}\n/**\n * Just a lil state logger\n *\n * @param state\n * @param DEBUG\n */\n\nvar useStateLogger = noop;\n\nif (process.env.NODE_ENV !== \"production\") {\n useStateLogger = function useStateLogger(state, DEBUG) {\n if (DEBUG === void 0) {\n DEBUG = false;\n }\n\n var debugRef = useRef(DEBUG);\n useEffect(function () {\n debugRef.current = DEBUG;\n }, [DEBUG]);\n useEffect(function () {\n if (debugRef.current) {\n console.group(\"State Updated\");\n console.log(\"%c\" + state, \"font-weight: normal; font-size: 120%; font-style: italic;\");\n console.groupEnd();\n }\n }, [state]);\n };\n}\n/**\n * Wraps a lib-defined event handler and a user-defined event handler, returning\n * a single handler that allows a user to prevent lib-defined handlers from\n * firing.\n *\n * @param theirHandler User-supplied event handler\n * @param ourHandler Library-supplied event handler\n */\n\nfunction wrapEvent(theirHandler, ourHandler) {\n return function (event) {\n theirHandler && theirHandler(event);\n\n if (!event.defaultPrevented) {\n return ourHandler(event);\n }\n };\n} // Export types\n\nexport { assignRef, boolOrBoolString, canUseDOM, checkStyles, cloneValidElement, createNamedContext, forwardRefWithAs, getDocumentDimensions, getElementComputedStyle, getOwnerDocument, getOwnerWindow, getScrollPosition, getScrollbarOffset, isBoolean, isFunction, isNumber, isRightClick, isString, makeId, memoWithAs, noop, ponyfillGlobal, stateToAttributeString, useCallbackProp, useCheckStyles, useConstant, useControlledState, useControlledSwitchWarning, useEventCallback, useEventListener, useFocusChange, useForceUpdate, useForkedRef, useIsomorphicLayoutEffect, useLazyRef, usePrevious, useStableCallback, useStateLogger, useUpdateEffect, warning, wrapEvent };\n","import { useRef, createElement } from 'react';\nimport { useForceUpdate, useIsomorphicLayoutEffect } from '@reach/utils';\nimport { createPortal } from 'react-dom';\n\n/**\n * Welcome to @reach/portal!\n *\n * Creates and appends a DOM node to the end of `document.body` and renders a\n * React tree into it. Useful for rendering a natural React element hierarchy\n * with a different DOM hierarchy to prevent parent styles from clipping or\n * hiding content (for popovers, dropdowns, and modals).\n *\n * @see Docs https://reach.tech/portal\n * @see Source https://github.com/reach/reach-ui/tree/main/packages/portal\n * @see React https://reactjs.org/docs/portals.html\n */\n/**\n * Portal\n *\n * @see Docs https://reach.tech/portal#portal\n */\n\nvar Portal = function Portal(_ref) {\n var children = _ref.children,\n _ref$type = _ref.type,\n type = _ref$type === void 0 ? \"reach-portal\" : _ref$type;\n var mountNode = useRef(null);\n var portalNode = useRef(null);\n var forceUpdate = useForceUpdate();\n useIsomorphicLayoutEffect(function () {\n // This ref may be null when a hot-loader replaces components on the page\n if (!mountNode.current) return; // It's possible that the content of the portal has, itself, been portaled.\n // In that case, it's important to append to the correct document element.\n\n var ownerDocument = mountNode.current.ownerDocument;\n portalNode.current = ownerDocument == null ? void 0 : ownerDocument.createElement(type);\n ownerDocument.body.appendChild(portalNode.current);\n forceUpdate();\n return function () {\n if (portalNode.current && portalNode.current.ownerDocument) {\n portalNode.current.ownerDocument.body.removeChild(portalNode.current);\n }\n };\n }, [type, forceUpdate]);\n return portalNode.current ? /*#__PURE__*/createPortal(children, portalNode.current) : /*#__PURE__*/createElement(\"span\", {\n ref: mountNode\n });\n};\n/**\n * @see Docs https://reach.tech/portal#portal-props\n */\n\n\nif (process.env.NODE_ENV !== \"production\") {\n Portal.displayName = \"Portal\";\n} ////////////////////////////////////////////////////////////////////////////////\n\nexport default Portal;\nexport { Portal };\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\n\nexport { __assign, __read, __rest, __spreadArray, __values };\n","var STATE_DELIMITER = '.';\nvar EMPTY_ACTIVITY_MAP = {};\nvar DEFAULT_GUARD_TYPE = 'xstate.guard';\nvar TARGETLESS_KEY = '';\n\nexport { DEFAULT_GUARD_TYPE, EMPTY_ACTIVITY_MAP, STATE_DELIMITER, TARGETLESS_KEY };\n","var ActionTypes;\n\n(function (ActionTypes) {\n ActionTypes[\"Start\"] = \"xstate.start\";\n ActionTypes[\"Stop\"] = \"xstate.stop\";\n ActionTypes[\"Raise\"] = \"xstate.raise\";\n ActionTypes[\"Send\"] = \"xstate.send\";\n ActionTypes[\"Cancel\"] = \"xstate.cancel\";\n ActionTypes[\"NullEvent\"] = \"\";\n ActionTypes[\"Assign\"] = \"xstate.assign\";\n ActionTypes[\"After\"] = \"xstate.after\";\n ActionTypes[\"DoneState\"] = \"done.state\";\n ActionTypes[\"DoneInvoke\"] = \"done.invoke\";\n ActionTypes[\"Log\"] = \"xstate.log\";\n ActionTypes[\"Init\"] = \"xstate.init\";\n ActionTypes[\"Invoke\"] = \"xstate.invoke\";\n ActionTypes[\"ErrorExecution\"] = \"error.execution\";\n ActionTypes[\"ErrorCommunication\"] = \"error.communication\";\n ActionTypes[\"ErrorPlatform\"] = \"error.platform\";\n ActionTypes[\"ErrorCustom\"] = \"xstate.error\";\n ActionTypes[\"Update\"] = \"xstate.update\";\n ActionTypes[\"Pure\"] = \"xstate.pure\";\n ActionTypes[\"Choose\"] = \"xstate.choose\";\n})(ActionTypes || (ActionTypes = {}));\n\nvar SpecialTargets;\n\n(function (SpecialTargets) {\n SpecialTargets[\"Parent\"] = \"#_parent\";\n SpecialTargets[\"Internal\"] = \"#_internal\";\n})(SpecialTargets || (SpecialTargets = {}));\n\nexport { ActionTypes, SpecialTargets };\n","import { ActionTypes } from './types.js';\n\nvar start = ActionTypes.Start;\nvar stop = ActionTypes.Stop;\nvar raise = ActionTypes.Raise;\nvar send = ActionTypes.Send;\nvar cancel = ActionTypes.Cancel;\nvar nullEvent = ActionTypes.NullEvent;\nvar assign = ActionTypes.Assign;\nvar after = ActionTypes.After;\nvar doneState = ActionTypes.DoneState;\nvar log = ActionTypes.Log;\nvar init = ActionTypes.Init;\nvar invoke = ActionTypes.Invoke;\nvar errorExecution = ActionTypes.ErrorExecution;\nvar errorPlatform = ActionTypes.ErrorPlatform;\nvar error = ActionTypes.ErrorCustom;\nvar update = ActionTypes.Update;\nvar choose = ActionTypes.Choose;\nvar pure = ActionTypes.Pure;\n\nexport { after, assign, cancel, choose, doneState, error, errorExecution, errorPlatform, init, invoke, log, nullEvent, pure, raise, send, start, stop, update };\n","import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';\nimport { SpecialTargets } from './types.js';\nimport { raise, send } from './actionTypes.js';\nimport { DEFAULT_GUARD_TYPE, TARGETLESS_KEY, STATE_DELIMITER } from './constants.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar _a;\nfunction keys(value) {\n return Object.keys(value);\n}\nfunction matchesState(parentStateId, childStateId, delimiter) {\n if (delimiter === void 0) {\n delimiter = STATE_DELIMITER;\n }\n\n var parentStateValue = toStateValue(parentStateId, delimiter);\n var childStateValue = toStateValue(childStateId, delimiter);\n\n if (isString(childStateValue)) {\n if (isString(parentStateValue)) {\n return childStateValue === parentStateValue;\n } // Parent more specific than child\n\n\n return false;\n }\n\n if (isString(parentStateValue)) {\n return parentStateValue in childStateValue;\n }\n\n return Object.keys(parentStateValue).every(function (key) {\n if (!(key in childStateValue)) {\n return false;\n }\n\n return matchesState(parentStateValue[key], childStateValue[key]);\n });\n}\nfunction getEventType(event) {\n try {\n return isString(event) || typeof event === 'number' ? \"\".concat(event) : event.type;\n } catch (e) {\n throw new Error('Events must be strings or objects with a string event.type property.');\n }\n}\nfunction getActionType(action) {\n try {\n return isString(action) || typeof action === 'number' ? \"\".concat(action) : isFunction(action) ? action.name : action.type;\n } catch (e) {\n throw new Error('Actions must be strings or objects with a string action.type property.');\n }\n}\nfunction toStatePath(stateId, delimiter) {\n try {\n if (isArray(stateId)) {\n return stateId;\n }\n\n return stateId.toString().split(delimiter);\n } catch (e) {\n throw new Error(\"'\".concat(stateId, \"' is not a valid state path.\"));\n }\n}\nfunction isStateLike(state) {\n return typeof state === 'object' && 'value' in state && 'context' in state && 'event' in state && '_event' in state;\n}\nfunction toStateValue(stateValue, delimiter) {\n if (isStateLike(stateValue)) {\n return stateValue.value;\n }\n\n if (isArray(stateValue)) {\n return pathToStateValue(stateValue);\n }\n\n if (typeof stateValue !== 'string') {\n return stateValue;\n }\n\n var statePath = toStatePath(stateValue, delimiter);\n return pathToStateValue(statePath);\n}\nfunction pathToStateValue(statePath) {\n if (statePath.length === 1) {\n return statePath[0];\n }\n\n var value = {};\n var marker = value;\n\n for (var i = 0; i < statePath.length - 1; i++) {\n if (i === statePath.length - 2) {\n marker[statePath[i]] = statePath[i + 1];\n } else {\n marker[statePath[i]] = {};\n marker = marker[statePath[i]];\n }\n }\n\n return value;\n}\nfunction mapValues(collection, iteratee) {\n var result = {};\n var collectionKeys = Object.keys(collection);\n\n for (var i = 0; i < collectionKeys.length; i++) {\n var key = collectionKeys[i];\n result[key] = iteratee(collection[key], key, collection, i);\n }\n\n return result;\n}\nfunction mapFilterValues(collection, iteratee, predicate) {\n var e_1, _a;\n\n var result = {};\n\n try {\n for (var _b = __values(Object.keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var item = collection[key];\n\n if (!predicate(item)) {\n continue;\n }\n\n result[key] = iteratee(item, key, collection);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return result;\n}\n/**\r\n * Retrieves a value at the given path.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\nvar path = function (props) {\n return function (object) {\n var e_2, _a;\n\n var result = object;\n\n try {\n for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {\n var prop = props_1_1.value;\n result = result[prop];\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n return result;\n };\n};\n/**\r\n * Retrieves a value at the given path via the nested accessor prop.\r\n * @param props The deep path to the prop of the desired value\r\n */\n\nfunction nestedPath(props, accessorProp) {\n return function (object) {\n var e_3, _a;\n\n var result = object;\n\n try {\n for (var props_2 = __values(props), props_2_1 = props_2.next(); !props_2_1.done; props_2_1 = props_2.next()) {\n var prop = props_2_1.value;\n result = result[accessorProp][prop];\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (props_2_1 && !props_2_1.done && (_a = props_2.return)) _a.call(props_2);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n return result;\n };\n}\nfunction toStatePaths(stateValue) {\n if (!stateValue) {\n return [[]];\n }\n\n if (isString(stateValue)) {\n return [[stateValue]];\n }\n\n var result = flatten(Object.keys(stateValue).map(function (key) {\n var subStateValue = stateValue[key];\n\n if (typeof subStateValue !== 'string' && (!subStateValue || !Object.keys(subStateValue).length)) {\n return [[key]];\n }\n\n return toStatePaths(stateValue[key]).map(function (subPath) {\n return [key].concat(subPath);\n });\n }));\n return result;\n}\nfunction pathsToStateValue(paths) {\n var e_4, _a;\n\n var result = {};\n\n if (paths && paths.length === 1 && paths[0].length === 1) {\n return paths[0][0];\n }\n\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var currentPath = paths_1_1.value;\n var marker = result; // tslint:disable-next-line:prefer-for-of\n\n for (var i = 0; i < currentPath.length; i++) {\n var subPath = currentPath[i];\n\n if (i === currentPath.length - 2) {\n marker[subPath] = currentPath[i + 1];\n break;\n }\n\n marker[subPath] = marker[subPath] || {};\n marker = marker[subPath];\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n return result;\n}\nfunction flatten(array) {\n var _a;\n\n return (_a = []).concat.apply(_a, __spreadArray([], __read(array), false));\n}\nfunction toArrayStrict(value) {\n if (isArray(value)) {\n return value;\n }\n\n return [value];\n}\nfunction toArray(value) {\n if (value === undefined) {\n return [];\n }\n\n return toArrayStrict(value);\n}\nfunction mapContext(mapper, context, _event) {\n var e_5, _a;\n\n if (isFunction(mapper)) {\n return mapper(context, _event.data);\n }\n\n var result = {};\n\n try {\n for (var _b = __values(Object.keys(mapper)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var subMapper = mapper[key];\n\n if (isFunction(subMapper)) {\n result[key] = subMapper(context, _event.data);\n } else {\n result[key] = subMapper;\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return result;\n}\nfunction isBuiltInEvent(eventType) {\n return /^(done|error)\\./.test(eventType);\n}\nfunction isPromiseLike(value) {\n if (value instanceof Promise) {\n return true;\n } // Check if shape matches the Promise/A+ specification for a \"thenable\".\n\n\n if (value !== null && (isFunction(value) || typeof value === 'object') && isFunction(value.then)) {\n return true;\n }\n\n return false;\n}\nfunction isBehavior(value) {\n return value !== null && typeof value === 'object' && 'transition' in value && typeof value.transition === 'function';\n}\nfunction partition(items, predicate) {\n var e_6, _a;\n\n var _b = __read([[], []], 2),\n truthy = _b[0],\n falsy = _b[1];\n\n try {\n for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n\n if (predicate(item)) {\n truthy.push(item);\n } else {\n falsy.push(item);\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n return [truthy, falsy];\n}\nfunction updateHistoryStates(hist, stateValue) {\n return mapValues(hist.states, function (subHist, key) {\n if (!subHist) {\n return undefined;\n }\n\n var subStateValue = (isString(stateValue) ? undefined : stateValue[key]) || (subHist ? subHist.current : undefined);\n\n if (!subStateValue) {\n return undefined;\n }\n\n return {\n current: subStateValue,\n states: updateHistoryStates(subHist, subStateValue)\n };\n });\n}\nfunction updateHistoryValue(hist, stateValue) {\n return {\n current: stateValue,\n states: updateHistoryStates(hist, stateValue)\n };\n}\nfunction updateContext(context, _event, assignActions, state) {\n if (!IS_PRODUCTION) {\n warn(!!context, 'Attempting to update undefined context');\n }\n\n var updatedContext = context ? assignActions.reduce(function (acc, assignAction) {\n var e_7, _a;\n\n var assignment = assignAction.assignment;\n var meta = {\n state: state,\n action: assignAction,\n _event: _event\n };\n var partialUpdate = {};\n\n if (isFunction(assignment)) {\n partialUpdate = assignment(acc, _event.data, meta);\n } else {\n try {\n for (var _b = __values(Object.keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var propAssignment = assignment[key];\n partialUpdate[key] = isFunction(propAssignment) ? propAssignment(acc, _event.data, meta) : propAssignment;\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n\n return Object.assign({}, acc, partialUpdate);\n }, context) : context;\n return updatedContext;\n} // tslint:disable-next-line:no-empty\n\nvar warn = function () {};\n\nif (!IS_PRODUCTION) {\n warn = function (condition, message) {\n var error = condition instanceof Error ? condition : undefined;\n\n if (!error && condition) {\n return;\n }\n\n if (console !== undefined) {\n var args = [\"Warning: \".concat(message)];\n\n if (error) {\n args.push(error);\n } // tslint:disable-next-line:no-console\n\n\n console.warn.apply(console, args);\n }\n };\n}\nfunction isArray(value) {\n return Array.isArray(value);\n} // tslint:disable-next-line:ban-types\n\nfunction isFunction(value) {\n return typeof value === 'function';\n}\nfunction isString(value) {\n return typeof value === 'string';\n}\nfunction toGuard(condition, guardMap) {\n if (!condition) {\n return undefined;\n }\n\n if (isString(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition,\n predicate: guardMap ? guardMap[condition] : undefined\n };\n }\n\n if (isFunction(condition)) {\n return {\n type: DEFAULT_GUARD_TYPE,\n name: condition.name,\n predicate: condition\n };\n }\n\n return condition;\n}\nfunction isObservable(value) {\n try {\n return 'subscribe' in value && isFunction(value.subscribe);\n } catch (e) {\n return false;\n }\n}\nvar symbolObservable = /*#__PURE__*/function () {\n return typeof Symbol === 'function' && Symbol.observable || '@@observable';\n}(); // TODO: to be removed in v5, left it out just to minimize the scope of the change and maintain compatibility with older versions of integration paackages\n\nvar interopSymbols = (_a = {}, _a[symbolObservable] = function () {\n return this;\n}, _a[Symbol.observable] = function () {\n return this;\n}, _a);\nfunction isMachine(value) {\n return !!value && '__xstatenode' in value;\n}\nfunction isActor(value) {\n return !!value && typeof value.send === 'function';\n}\nvar uniqueId = /*#__PURE__*/function () {\n var currentId = 0;\n return function () {\n currentId++;\n return currentId.toString(16);\n };\n}();\nfunction toEventObject(event, payload // id?: TEvent['type']\n) {\n if (isString(event) || typeof event === 'number') {\n return __assign({\n type: event\n }, payload);\n }\n\n return event;\n}\nfunction toSCXMLEvent(event, scxmlEvent) {\n if (!isString(event) && '$$type' in event && event.$$type === 'scxml') {\n return event;\n }\n\n var eventObject = toEventObject(event);\n return __assign({\n name: eventObject.type,\n data: eventObject,\n $$type: 'scxml',\n type: 'external'\n }, scxmlEvent);\n}\nfunction toTransitionConfigArray(event, configLike) {\n var transitions = toArrayStrict(configLike).map(function (transitionLike) {\n if (typeof transitionLike === 'undefined' || typeof transitionLike === 'string' || isMachine(transitionLike)) {\n return {\n target: transitionLike,\n event: event\n };\n }\n\n return __assign(__assign({}, transitionLike), {\n event: event\n });\n });\n return transitions;\n}\nfunction normalizeTarget(target) {\n if (target === undefined || target === TARGETLESS_KEY) {\n return undefined;\n }\n\n return toArray(target);\n}\nfunction reportUnhandledExceptionOnInvocation(originalError, currentError, id) {\n if (!IS_PRODUCTION) {\n var originalStackTrace = originalError.stack ? \" Stacktrace was '\".concat(originalError.stack, \"'\") : '';\n\n if (originalError === currentError) {\n // tslint:disable-next-line:no-console\n console.error(\"Missing onError handler for invocation '\".concat(id, \"', error was '\").concat(originalError, \"'.\").concat(originalStackTrace));\n } else {\n var stackTrace = currentError.stack ? \" Stacktrace was '\".concat(currentError.stack, \"'\") : ''; // tslint:disable-next-line:no-console\n\n console.error(\"Missing onError handler and/or unhandled exception/promise rejection for invocation '\".concat(id, \"'. \") + \"Original error: '\".concat(originalError, \"'. \").concat(originalStackTrace, \" Current error is '\").concat(currentError, \"'.\").concat(stackTrace));\n }\n }\n}\nfunction evaluateGuard(machine, guard, context, _event, state) {\n var guards = machine.options.guards;\n var guardMeta = {\n state: state,\n cond: guard,\n _event: _event\n }; // TODO: do not hardcode!\n\n if (guard.type === DEFAULT_GUARD_TYPE) {\n return ((guards === null || guards === void 0 ? void 0 : guards[guard.name]) || guard.predicate)(context, _event.data, guardMeta);\n }\n\n var condFn = guards === null || guards === void 0 ? void 0 : guards[guard.type];\n\n if (!condFn) {\n throw new Error(\"Guard '\".concat(guard.type, \"' is not implemented on machine '\").concat(machine.id, \"'.\"));\n }\n\n return condFn(context, _event.data, guardMeta);\n}\nfunction toInvokeSource(src) {\n if (typeof src === 'string') {\n return {\n type: src\n };\n }\n\n return src;\n}\nfunction toObserver(nextHandler, errorHandler, completionHandler) {\n var noop = function () {};\n\n var isObserver = typeof nextHandler === 'object';\n var self = isObserver ? nextHandler : null;\n return {\n next: ((isObserver ? nextHandler.next : nextHandler) || noop).bind(self),\n error: ((isObserver ? nextHandler.error : errorHandler) || noop).bind(self),\n complete: ((isObserver ? nextHandler.complete : completionHandler) || noop).bind(self)\n };\n}\nfunction createInvokeId(stateNodeId, index) {\n return \"\".concat(stateNodeId, \":invocation[\").concat(index, \"]\");\n}\nfunction isRaisableAction(action) {\n return (action.type === raise || action.type === send && action.to === SpecialTargets.Internal) && typeof action.delay !== 'number';\n}\n\nexport { createInvokeId, evaluateGuard, flatten, getActionType, getEventType, interopSymbols, isActor, isArray, isBehavior, isBuiltInEvent, isFunction, isMachine, isObservable, isPromiseLike, isRaisableAction, isStateLike, isString, keys, mapContext, mapFilterValues, mapValues, matchesState, nestedPath, normalizeTarget, partition, path, pathToStateValue, pathsToStateValue, reportUnhandledExceptionOnInvocation, symbolObservable, toArray, toArrayStrict, toEventObject, toGuard, toInvokeSource, toObserver, toSCXMLEvent, toStatePath, toStatePaths, toStateValue, toTransitionConfigArray, uniqueId, updateContext, updateHistoryStates, updateHistoryValue, warn };\n","var IS_PRODUCTION = process.env.NODE_ENV === 'production';\n\nexport { IS_PRODUCTION };\n","import { __values, __spreadArray, __read } from './_virtual/_tslib.js';\nimport { flatten } from './utils.js';\n\nvar isLeafNode = function (stateNode) {\n return stateNode.type === 'atomic' || stateNode.type === 'final';\n};\nfunction getAllChildren(stateNode) {\n return Object.keys(stateNode.states).map(function (key) {\n return stateNode.states[key];\n });\n}\nfunction getChildren(stateNode) {\n return getAllChildren(stateNode).filter(function (sn) {\n return sn.type !== 'history';\n });\n}\nfunction getAllStateNodes(stateNode) {\n var stateNodes = [stateNode];\n\n if (isLeafNode(stateNode)) {\n return stateNodes;\n }\n\n return stateNodes.concat(flatten(getChildren(stateNode).map(getAllStateNodes)));\n}\nfunction getConfiguration(prevStateNodes, stateNodes) {\n var e_1, _a, e_2, _b, e_3, _c, e_4, _d;\n\n var prevConfiguration = new Set(prevStateNodes);\n var prevAdjList = getAdjList(prevConfiguration);\n var configuration = new Set(stateNodes);\n\n try {\n // add all ancestors\n for (var configuration_1 = __values(configuration), configuration_1_1 = configuration_1.next(); !configuration_1_1.done; configuration_1_1 = configuration_1.next()) {\n var s = configuration_1_1.value;\n var m = s.parent;\n\n while (m && !configuration.has(m)) {\n configuration.add(m);\n m = m.parent;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (configuration_1_1 && !configuration_1_1.done && (_a = configuration_1.return)) _a.call(configuration_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n var adjList = getAdjList(configuration);\n\n try {\n // add descendants\n for (var configuration_2 = __values(configuration), configuration_2_1 = configuration_2.next(); !configuration_2_1.done; configuration_2_1 = configuration_2.next()) {\n var s = configuration_2_1.value; // if previously active, add existing child nodes\n\n if (s.type === 'compound' && (!adjList.get(s) || !adjList.get(s).length)) {\n if (prevAdjList.get(s)) {\n prevAdjList.get(s).forEach(function (sn) {\n return configuration.add(sn);\n });\n } else {\n s.initialStateNodes.forEach(function (sn) {\n return configuration.add(sn);\n });\n }\n } else {\n if (s.type === 'parallel') {\n try {\n for (var _e = (e_3 = void 0, __values(getChildren(s))), _f = _e.next(); !_f.done; _f = _e.next()) {\n var child = _f.value;\n\n if (!configuration.has(child)) {\n configuration.add(child);\n\n if (prevAdjList.get(child)) {\n prevAdjList.get(child).forEach(function (sn) {\n return configuration.add(sn);\n });\n } else {\n child.initialStateNodes.forEach(function (sn) {\n return configuration.add(sn);\n });\n }\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_c = _e.return)) _c.call(_e);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n }\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (configuration_2_1 && !configuration_2_1.done && (_b = configuration_2.return)) _b.call(configuration_2);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n try {\n // add all ancestors\n for (var configuration_3 = __values(configuration), configuration_3_1 = configuration_3.next(); !configuration_3_1.done; configuration_3_1 = configuration_3.next()) {\n var s = configuration_3_1.value;\n var m = s.parent;\n\n while (m && !configuration.has(m)) {\n configuration.add(m);\n m = m.parent;\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (configuration_3_1 && !configuration_3_1.done && (_d = configuration_3.return)) _d.call(configuration_3);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n return configuration;\n}\n\nfunction getValueFromAdj(baseNode, adjList) {\n var childStateNodes = adjList.get(baseNode);\n\n if (!childStateNodes) {\n return {}; // todo: fix?\n }\n\n if (baseNode.type === 'compound') {\n var childStateNode = childStateNodes[0];\n\n if (childStateNode) {\n if (isLeafNode(childStateNode)) {\n return childStateNode.key;\n }\n } else {\n return {};\n }\n }\n\n var stateValue = {};\n childStateNodes.forEach(function (csn) {\n stateValue[csn.key] = getValueFromAdj(csn, adjList);\n });\n return stateValue;\n}\n\nfunction getAdjList(configuration) {\n var e_5, _a;\n\n var adjList = new Map();\n\n try {\n for (var configuration_4 = __values(configuration), configuration_4_1 = configuration_4.next(); !configuration_4_1.done; configuration_4_1 = configuration_4.next()) {\n var s = configuration_4_1.value;\n\n if (!adjList.has(s)) {\n adjList.set(s, []);\n }\n\n if (s.parent) {\n if (!adjList.has(s.parent)) {\n adjList.set(s.parent, []);\n }\n\n adjList.get(s.parent).push(s);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (configuration_4_1 && !configuration_4_1.done && (_a = configuration_4.return)) _a.call(configuration_4);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n return adjList;\n}\nfunction getValue(rootNode, configuration) {\n var config = getConfiguration([rootNode], configuration);\n return getValueFromAdj(rootNode, getAdjList(config));\n}\nfunction has(iterable, item) {\n if (Array.isArray(iterable)) {\n return iterable.some(function (member) {\n return member === item;\n });\n }\n\n if (iterable instanceof Set) {\n return iterable.has(item);\n }\n\n return false; // TODO: fix\n}\nfunction nextEvents(configuration) {\n return __spreadArray([], __read(new Set(flatten(__spreadArray([], __read(configuration.map(function (sn) {\n return sn.ownEvents;\n })), false)))), false);\n}\nfunction isInFinalState(configuration, stateNode) {\n if (stateNode.type === 'compound') {\n return getChildren(stateNode).some(function (s) {\n return s.type === 'final' && has(configuration, s);\n });\n }\n\n if (stateNode.type === 'parallel') {\n return getChildren(stateNode).every(function (sn) {\n return isInFinalState(configuration, sn);\n });\n }\n\n return false;\n}\nfunction getMeta(configuration) {\n if (configuration === void 0) {\n configuration = [];\n }\n\n return configuration.reduce(function (acc, stateNode) {\n if (stateNode.meta !== undefined) {\n acc[stateNode.id] = stateNode.meta;\n }\n\n return acc;\n }, {});\n}\nfunction getTagsFromConfiguration(configuration) {\n return new Set(flatten(configuration.map(function (sn) {\n return sn.tags;\n })));\n}\n\nexport { getAdjList, getAllChildren, getAllStateNodes, getChildren, getConfiguration, getMeta, getTagsFromConfiguration, getValue, has, isInFinalState, isLeafNode, nextEvents };\n","import { __assign, __spreadArray, __read, __values } from './_virtual/_tslib.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { init, raise as raise$1, send as send$1, update, log as log$1, cancel as cancel$1, assign as assign$1, error as error$1, stop as stop$1, pure as pure$1, choose as choose$1 } from './actionTypes.js';\nimport * as actionTypes from './actionTypes.js';\nexport { actionTypes };\nimport { toSCXMLEvent, isString, isFunction, toEventObject, getEventType, updateContext, flatten, isArray, toArray, toGuard, evaluateGuard, warn } from './utils.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar initEvent = /*#__PURE__*/toSCXMLEvent({\n type: init\n});\nfunction getActionFunction(actionType, actionFunctionMap) {\n return actionFunctionMap ? actionFunctionMap[actionType] || undefined : undefined;\n}\nfunction toActionObject(action, actionFunctionMap) {\n var actionObject;\n\n if (isString(action) || typeof action === 'number') {\n var exec = getActionFunction(action, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = {\n type: action,\n exec: exec\n };\n } else if (exec) {\n actionObject = exec;\n } else {\n actionObject = {\n type: action,\n exec: undefined\n };\n }\n } else if (isFunction(action)) {\n actionObject = {\n // Convert action to string if unnamed\n type: action.name || action.toString(),\n exec: action\n };\n } else {\n var exec = getActionFunction(action.type, actionFunctionMap);\n\n if (isFunction(exec)) {\n actionObject = __assign(__assign({}, action), {\n exec: exec\n });\n } else if (exec) {\n var actionType = exec.type || action.type;\n actionObject = __assign(__assign(__assign({}, exec), action), {\n type: actionType\n });\n } else {\n actionObject = action;\n }\n }\n\n return actionObject;\n}\nvar toActionObjects = function (action, actionFunctionMap) {\n if (!action) {\n return [];\n }\n\n var actions = isArray(action) ? action : [action];\n return actions.map(function (subAction) {\n return toActionObject(subAction, actionFunctionMap);\n });\n};\nfunction toActivityDefinition(action) {\n var actionObject = toActionObject(action);\n return __assign(__assign({\n id: isString(action) ? action : actionObject.id\n }, actionObject), {\n type: actionObject.type\n });\n}\n/**\r\n * Raises an event. This places the event in the internal event queue, so that\r\n * the event is immediately consumed by the machine in the current step.\r\n *\r\n * @param eventType The event to raise.\r\n */\n\nfunction raise(event, options) {\n return {\n type: raise$1,\n event: typeof event === 'function' ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n id: options === null || options === void 0 ? void 0 : options.id\n };\n}\nfunction resolveRaise(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n };\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n return __assign(__assign({}, action), {\n type: raise$1,\n _event: resolvedEvent,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event. This returns an action that will be read by an interpreter to\r\n * send the event in the next step, after the current step is finished executing.\r\n *\r\n * @deprecated Use the `sendTo(...)` action creator instead.\r\n *\r\n * @param event The event to send.\r\n * @param options Options to pass into the send event:\r\n * - `id` - The unique send event identifier (used with `cancel()`).\r\n * - `delay` - The number of milliseconds to delay the sending of the event.\r\n * - `to` - The target of this event (by default, the machine the event was sent from).\r\n */\n\nfunction send(event, options) {\n return {\n to: options ? options.to : undefined,\n type: send$1,\n event: isFunction(event) ? event : toEventObject(event),\n delay: options ? options.delay : undefined,\n // TODO: don't auto-generate IDs here like that\n // there is too big chance of the ID collision\n id: options && options.id !== undefined ? options.id : isFunction(event) ? event.name : getEventType(event)\n };\n}\nfunction resolveSend(action, ctx, _event, delaysMap) {\n var meta = {\n _event: _event\n }; // TODO: helper function for resolving Expr\n\n var resolvedEvent = toSCXMLEvent(isFunction(action.event) ? action.event(ctx, _event.data, meta) : action.event);\n var resolvedDelay;\n\n if (isString(action.delay)) {\n var configDelay = delaysMap && delaysMap[action.delay];\n resolvedDelay = isFunction(configDelay) ? configDelay(ctx, _event.data, meta) : configDelay;\n } else {\n resolvedDelay = isFunction(action.delay) ? action.delay(ctx, _event.data, meta) : action.delay;\n }\n\n var resolvedTarget = isFunction(action.to) ? action.to(ctx, _event.data, meta) : action.to;\n return __assign(__assign({}, action), {\n to: resolvedTarget,\n _event: resolvedEvent,\n event: resolvedEvent.data,\n delay: resolvedDelay\n });\n}\n/**\r\n * Sends an event to this machine's parent.\r\n *\r\n * @param event The event to send to the parent machine.\r\n * @param options Options to pass into the send event.\r\n */\n\nfunction sendParent(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\n/**\r\n * Sends an event to an actor.\r\n *\r\n * @param actor The `ActorRef` to send the event to.\r\n * @param event The event to send, or an expression that evaluates to the event to send\r\n * @param options Send action options\r\n * @returns An XState send action object\r\n */\n\nfunction sendTo(actor, event, options) {\n return send(event, __assign(__assign({}, options), {\n to: actor\n }));\n}\n/**\r\n * Sends an update event to this machine's parent.\r\n */\n\nfunction sendUpdate() {\n return sendParent(update);\n}\n/**\r\n * Sends an event back to the sender of the original event.\r\n *\r\n * @param event The event to send back to the sender\r\n * @param options Options to pass into the send event\r\n */\n\nfunction respond(event, options) {\n return send(event, __assign(__assign({}, options), {\n to: function (_, __, _a) {\n var _event = _a._event;\n return _event.origin; // TODO: handle when _event.origin is undefined\n }\n }));\n}\n\nvar defaultLogExpr = function (context, event) {\n return {\n context: context,\n event: event\n };\n};\n/**\r\n *\r\n * @param expr The expression function to evaluate which will be logged.\r\n * Takes in 2 arguments:\r\n * - `ctx` - the current state context\r\n * - `event` - the event that caused this action to be executed.\r\n * @param label The label to give to the logged expression.\r\n */\n\n\nfunction log(expr, label) {\n if (expr === void 0) {\n expr = defaultLogExpr;\n }\n\n return {\n type: log$1,\n label: label,\n expr: expr\n };\n}\nvar resolveLog = function (action, ctx, _event) {\n return __assign(__assign({}, action), {\n value: isString(action.expr) ? action.expr : action.expr(ctx, _event.data, {\n _event: _event\n })\n });\n};\n/**\r\n * Cancels an in-flight `send(...)` action. A canceled sent action will not\r\n * be executed, nor will its event be sent, unless it has already been sent\r\n * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`).\r\n *\r\n * @param sendId The `id` of the `send(...)` action to cancel.\r\n */\n\nvar cancel = function (sendId) {\n return {\n type: cancel$1,\n sendId: sendId\n };\n};\n/**\r\n * Starts an activity.\r\n *\r\n * @param activity The activity to start.\r\n */\n\nfunction start(activity) {\n var activityDef = toActivityDefinition(activity);\n return {\n type: ActionTypes.Start,\n activity: activityDef,\n exec: undefined\n };\n}\n/**\r\n * Stops an activity.\r\n *\r\n * @param actorRef The activity to stop.\r\n */\n\nfunction stop(actorRef) {\n var activity = isFunction(actorRef) ? actorRef : toActivityDefinition(actorRef);\n return {\n type: ActionTypes.Stop,\n activity: activity,\n exec: undefined\n };\n}\nfunction resolveStop(action, context, _event) {\n var actorRefOrString = isFunction(action.activity) ? action.activity(context, _event.data) : action.activity;\n var resolvedActorRef = typeof actorRefOrString === 'string' ? {\n id: actorRefOrString\n } : actorRefOrString;\n var actionObject = {\n type: ActionTypes.Stop,\n activity: resolvedActorRef\n };\n return actionObject;\n}\n/**\r\n * Updates the current context of the machine.\r\n *\r\n * @param assignment An object that represents the partial context to update.\r\n */\n\nvar assign = function (assignment) {\n return {\n type: assign$1,\n assignment: assignment\n };\n};\nfunction isActionObject(action) {\n return typeof action === 'object' && 'type' in action;\n}\n/**\r\n * Returns an event type that represents an implicit event that\r\n * is sent after the specified `delay`.\r\n *\r\n * @param delayRef The delay in milliseconds\r\n * @param id The state node ID where this event is handled\r\n */\n\nfunction after(delayRef, id) {\n var idSuffix = id ? \"#\".concat(id) : '';\n return \"\".concat(ActionTypes.After, \"(\").concat(delayRef, \")\").concat(idSuffix);\n}\n/**\r\n * Returns an event that represents that a final state node\r\n * has been reached in the parent state node.\r\n *\r\n * @param id The final state node's parent state node `id`\r\n * @param data The data to pass into the event\r\n */\n\nfunction done(id, data) {\n var type = \"\".concat(ActionTypes.DoneState, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\n/**\r\n * Returns an event that represents that an invoked service has terminated.\r\n *\r\n * An invoked service is terminated when it has reached a top-level final state node,\r\n * but not when it is canceled.\r\n *\r\n * @param id The final state node ID\r\n * @param data The data to pass into the event\r\n */\n\nfunction doneInvoke(id, data) {\n var type = \"\".concat(ActionTypes.DoneInvoke, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\nfunction error(id, data) {\n var type = \"\".concat(ActionTypes.ErrorPlatform, \".\").concat(id);\n var eventObject = {\n type: type,\n data: data\n };\n\n eventObject.toString = function () {\n return type;\n };\n\n return eventObject;\n}\nfunction pure(getActions) {\n return {\n type: ActionTypes.Pure,\n get: getActions\n };\n}\n/**\r\n * Forwards (sends) an event to a specified service.\r\n *\r\n * @param target The target service to forward the event to.\r\n * @param options Options to pass into the send action creator.\r\n */\n\nfunction forwardTo(target, options) {\n if (!IS_PRODUCTION && (!target || typeof target === 'function')) {\n var originalTarget_1 = target;\n\n target = function () {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n var resolvedTarget = typeof originalTarget_1 === 'function' ? originalTarget_1.apply(void 0, __spreadArray([], __read(args), false)) : originalTarget_1;\n\n if (!resolvedTarget) {\n throw new Error(\"Attempted to forward event to undefined actor. This risks an infinite loop in the sender.\");\n }\n\n return resolvedTarget;\n };\n }\n\n return send(function (_, event) {\n return event;\n }, __assign(__assign({}, options), {\n to: target\n }));\n}\n/**\r\n * Escalates an error by sending it as an event to this machine's parent.\r\n *\r\n * @param errorData The error data to send, or the expression function that\r\n * takes in the `context`, `event`, and `meta`, and returns the error data to send.\r\n * @param options Options to pass into the send action creator.\r\n */\n\nfunction escalate(errorData, options) {\n return sendParent(function (context, event, meta) {\n return {\n type: error$1,\n data: isFunction(errorData) ? errorData(context, event, meta) : errorData\n };\n }, __assign(__assign({}, options), {\n to: SpecialTargets.Parent\n }));\n}\nfunction choose(conds) {\n return {\n type: ActionTypes.Choose,\n conds: conds\n };\n}\n\nvar pluckAssigns = function (actionBlocks) {\n var e_1, _a;\n\n var assignActions = [];\n\n try {\n for (var actionBlocks_1 = __values(actionBlocks), actionBlocks_1_1 = actionBlocks_1.next(); !actionBlocks_1_1.done; actionBlocks_1_1 = actionBlocks_1.next()) {\n var block = actionBlocks_1_1.value;\n var i = 0;\n\n while (i < block.actions.length) {\n if (block.actions[i].type === assign$1) {\n assignActions.push(block.actions[i]);\n block.actions.splice(i, 1);\n continue;\n }\n\n i++;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (actionBlocks_1_1 && !actionBlocks_1_1.done && (_a = actionBlocks_1.return)) _a.call(actionBlocks_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return assignActions;\n};\n\nfunction resolveActions(machine, currentState, currentContext, _event, actionBlocks, predictableExec, preserveActionOrder) {\n if (preserveActionOrder === void 0) {\n preserveActionOrder = false;\n }\n\n var assignActions = preserveActionOrder ? [] : pluckAssigns(actionBlocks);\n var updatedContext = assignActions.length ? updateContext(currentContext, _event, assignActions, currentState) : currentContext;\n var preservedContexts = preserveActionOrder ? [currentContext] : undefined;\n var deferredToBlockEnd = [];\n\n function handleAction(blockType, actionObject) {\n var _a;\n\n switch (actionObject.type) {\n case raise$1:\n {\n var raisedAction = resolveRaise(actionObject, updatedContext, _event, machine.options.delays);\n\n if (predictableExec && typeof raisedAction.delay === 'number') {\n predictableExec(raisedAction, updatedContext, _event);\n }\n\n return raisedAction;\n }\n\n case send$1:\n var sendAction = resolveSend(actionObject, updatedContext, _event, machine.options.delays); // TODO: fix ActionTypes.Init\n\n if (!IS_PRODUCTION) {\n var configuredDelay = actionObject.delay; // warn after resolving as we can create better contextual message here\n\n warn(!isString(configuredDelay) || typeof sendAction.delay === 'number', // tslint:disable-next-line:max-line-length\n \"No delay reference for delay expression '\".concat(configuredDelay, \"' was found on machine '\").concat(machine.id, \"'\"));\n }\n\n if (predictableExec && sendAction.to !== SpecialTargets.Internal) {\n if (blockType === 'entry') {\n deferredToBlockEnd.push(sendAction);\n } else {\n predictableExec(sendAction, updatedContext, _event);\n }\n }\n\n return sendAction;\n\n case log$1:\n {\n var resolved = resolveLog(actionObject, updatedContext, _event);\n predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(resolved, updatedContext, _event);\n return resolved;\n }\n\n case choose$1:\n {\n var chooseAction = actionObject;\n var matchedActions = (_a = chooseAction.conds.find(function (condition) {\n var guard = toGuard(condition.cond, machine.options.guards);\n return !guard || evaluateGuard(machine, guard, updatedContext, _event, !predictableExec ? currentState : undefined);\n })) === null || _a === void 0 ? void 0 : _a.actions;\n\n if (!matchedActions) {\n return [];\n }\n\n var _b = __read(resolveActions(machine, currentState, updatedContext, _event, [{\n type: blockType,\n actions: toActionObjects(toArray(matchedActions), machine.options.actions)\n }], predictableExec, preserveActionOrder), 2),\n resolvedActionsFromChoose = _b[0],\n resolvedContextFromChoose = _b[1];\n\n updatedContext = resolvedContextFromChoose;\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n return resolvedActionsFromChoose;\n }\n\n case pure$1:\n {\n var matchedActions = actionObject.get(updatedContext, _event.data);\n\n if (!matchedActions) {\n return [];\n }\n\n var _c = __read(resolveActions(machine, currentState, updatedContext, _event, [{\n type: blockType,\n actions: toActionObjects(toArray(matchedActions), machine.options.actions)\n }], predictableExec, preserveActionOrder), 2),\n resolvedActionsFromPure = _c[0],\n resolvedContext = _c[1];\n\n updatedContext = resolvedContext;\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n return resolvedActionsFromPure;\n }\n\n case stop$1:\n {\n var resolved = resolveStop(actionObject, updatedContext, _event);\n predictableExec === null || predictableExec === void 0 ? void 0 : predictableExec(resolved, currentContext, _event);\n return resolved;\n }\n\n case assign$1:\n {\n updatedContext = updateContext(updatedContext, _event, [actionObject], !predictableExec ? currentState : undefined);\n preservedContexts === null || preservedContexts === void 0 ? void 0 : preservedContexts.push(updatedContext);\n break;\n }\n\n default:\n var resolvedActionObject = toActionObject(actionObject, machine.options.actions);\n var exec_1 = resolvedActionObject.exec;\n\n if (predictableExec) {\n predictableExec(resolvedActionObject, updatedContext, _event);\n } else if (exec_1 && preservedContexts) {\n var contextIndex_1 = preservedContexts.length - 1;\n\n var wrapped = __assign(__assign({}, resolvedActionObject), {\n exec: function (_ctx) {\n var args = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n\n exec_1.apply(void 0, __spreadArray([preservedContexts[contextIndex_1]], __read(args), false));\n }\n });\n\n resolvedActionObject = wrapped;\n }\n\n return resolvedActionObject;\n }\n }\n\n function processBlock(block) {\n var e_2, _a;\n\n var resolvedActions = [];\n\n try {\n for (var _b = __values(block.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n var resolved = handleAction(block.type, action);\n\n if (resolved) {\n resolvedActions = resolvedActions.concat(resolved);\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n deferredToBlockEnd.forEach(function (action) {\n predictableExec(action, updatedContext, _event);\n });\n deferredToBlockEnd.length = 0;\n return resolvedActions;\n }\n\n var resolvedActions = flatten(actionBlocks.map(processBlock));\n return [resolvedActions, updatedContext];\n}\n\nexport { after, assign, cancel, choose, done, doneInvoke, error, escalate, forwardTo, getActionFunction, initEvent, isActionObject, log, pure, raise, resolveActions, resolveLog, resolveRaise, resolveSend, resolveStop, respond, send, sendParent, sendTo, sendUpdate, start, stop, toActionObject, toActionObjects, toActivityDefinition };\n","import { __assign, __spreadArray, __read, __rest } from './_virtual/_tslib.js';\nimport { EMPTY_ACTIVITY_MAP } from './constants.js';\nimport { isString, matchesState, warn } from './utils.js';\nimport { getMeta, nextEvents } from './stateUtils.js';\nimport { initEvent } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nfunction stateValuesEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (a === undefined || b === undefined) {\n return false;\n }\n\n if (isString(a) || isString(b)) {\n return a === b;\n }\n\n var aKeys = Object.keys(a);\n var bKeys = Object.keys(b);\n return aKeys.length === bKeys.length && aKeys.every(function (key) {\n return stateValuesEqual(a[key], b[key]);\n });\n}\nfunction isStateConfig(state) {\n if (typeof state !== 'object' || state === null) {\n return false;\n }\n\n return 'value' in state && '_event' in state;\n}\n/**\r\n * @deprecated Use `isStateConfig(object)` or `state instanceof State` instead.\r\n */\n\nvar isState = isStateConfig;\nfunction bindActionToState(action, state) {\n var exec = action.exec;\n\n var boundAction = __assign(__assign({}, action), {\n exec: exec !== undefined ? function () {\n return exec(state.context, state.event, {\n action: action,\n state: state,\n _event: state._event\n });\n } : undefined\n });\n\n return boundAction;\n}\n\nvar State =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new State instance.\r\n * @param value The state value\r\n * @param context The extended state\r\n * @param historyValue The tree representing historical values of the state nodes\r\n * @param history The previous state\r\n * @param actions An array of action objects to execute as side-effects\r\n * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).\r\n * @param meta\r\n * @param events Internal event queue. Should be empty with run-to-completion semantics.\r\n * @param configuration\r\n */\n function State(config) {\n var _this = this;\n\n var _a;\n\n this.actions = [];\n this.activities = EMPTY_ACTIVITY_MAP;\n this.meta = {};\n this.events = [];\n this.value = config.value;\n this.context = config.context;\n this._event = config._event;\n this._sessionid = config._sessionid;\n this.event = this._event.data;\n this.historyValue = config.historyValue;\n this.history = config.history;\n this.actions = config.actions || [];\n this.activities = config.activities || EMPTY_ACTIVITY_MAP;\n this.meta = getMeta(config.configuration);\n this.events = config.events || [];\n this.matches = this.matches.bind(this);\n this.toStrings = this.toStrings.bind(this);\n this.configuration = config.configuration;\n this.transitions = config.transitions;\n this.children = config.children;\n this.done = !!config.done;\n this.tags = (_a = Array.isArray(config.tags) ? new Set(config.tags) : config.tags) !== null && _a !== void 0 ? _a : new Set();\n this.machine = config.machine;\n Object.defineProperty(this, 'nextEvents', {\n get: function () {\n return nextEvents(_this.configuration);\n }\n });\n }\n /**\r\n * Creates a new State instance for the given `stateValue` and `context`.\r\n * @param stateValue\r\n * @param context\r\n */\n\n\n State.from = function (stateValue, context) {\n if (stateValue instanceof State) {\n if (stateValue.context !== context) {\n return new State({\n value: stateValue.value,\n context: context,\n _event: stateValue._event,\n _sessionid: null,\n historyValue: stateValue.historyValue,\n history: stateValue.history,\n actions: [],\n activities: stateValue.activities,\n meta: {},\n events: [],\n configuration: [],\n transitions: [],\n children: {}\n });\n }\n\n return stateValue;\n }\n\n var _event = initEvent;\n return new State({\n value: stateValue,\n context: context,\n _event: _event,\n _sessionid: null,\n historyValue: undefined,\n history: undefined,\n actions: [],\n activities: undefined,\n meta: undefined,\n events: [],\n configuration: [],\n transitions: [],\n children: {}\n });\n };\n /**\r\n * Creates a new State instance for the given `config`.\r\n * @param config The state config\r\n */\n\n\n State.create = function (config) {\n return new State(config);\n };\n /**\r\n * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).\r\n * @param stateValue\r\n * @param context\r\n */\n\n\n State.inert = function (stateValue, context) {\n if (stateValue instanceof State) {\n if (!stateValue.actions.length) {\n return stateValue;\n }\n\n var _event = initEvent;\n return new State({\n value: stateValue.value,\n context: context,\n _event: _event,\n _sessionid: null,\n historyValue: stateValue.historyValue,\n history: stateValue.history,\n activities: stateValue.activities,\n configuration: stateValue.configuration,\n transitions: [],\n children: {}\n });\n }\n\n return State.from(stateValue, context);\n };\n /**\r\n * Returns an array of all the string leaf state node paths.\r\n * @param stateValue\r\n * @param delimiter The character(s) that separate each subpath in the string state node path.\r\n */\n\n\n State.prototype.toStrings = function (stateValue, delimiter) {\n var _this = this;\n\n if (stateValue === void 0) {\n stateValue = this.value;\n }\n\n if (delimiter === void 0) {\n delimiter = '.';\n }\n\n if (isString(stateValue)) {\n return [stateValue];\n }\n\n var valueKeys = Object.keys(stateValue);\n return valueKeys.concat.apply(valueKeys, __spreadArray([], __read(valueKeys.map(function (key) {\n return _this.toStrings(stateValue[key], delimiter).map(function (s) {\n return key + delimiter + s;\n });\n })), false));\n };\n\n State.prototype.toJSON = function () {\n var _a = this;\n _a.configuration;\n _a.transitions;\n var tags = _a.tags;\n _a.machine;\n var jsonValues = __rest(_a, [\"configuration\", \"transitions\", \"tags\", \"machine\"]);\n\n return __assign(__assign({}, jsonValues), {\n tags: Array.from(tags)\n });\n };\n\n State.prototype.matches = function (parentStateValue) {\n return matchesState(parentStateValue, this.value);\n };\n /**\r\n * Whether the current state configuration has a state node with the specified `tag`.\r\n * @param tag\r\n */\n\n\n State.prototype.hasTag = function (tag) {\n return this.tags.has(tag);\n };\n /**\r\n * Determines whether sending the `event` will cause a non-forbidden transition\r\n * to be selected, even if the transitions have no actions nor\r\n * change the state value.\r\n *\r\n * @param event The event to test\r\n * @returns Whether the event will cause a transition\r\n */\n\n\n State.prototype.can = function (event) {\n var _a;\n\n if (IS_PRODUCTION) {\n warn(!!this.machine, \"state.can(...) used outside of a machine-created State object; this will always return false.\");\n }\n\n var transitionData = (_a = this.machine) === null || _a === void 0 ? void 0 : _a.getTransitionData(this, event);\n return !!(transitionData === null || transitionData === void 0 ? void 0 : transitionData.transitions.length) && // Check that at least one transition is not forbidden\n transitionData.transitions.some(function (t) {\n return t.target !== undefined || t.actions.length;\n });\n };\n\n return State;\n}();\n\nexport { State, bindActionToState, isState, isStateConfig, stateValuesEqual };\n","import { __assign } from './_virtual/_tslib.js';\n\nvar defaultOptions = {\n deferEvents: false\n};\n\nvar Scheduler =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function Scheduler(options) {\n this.processingEvent = false;\n this.queue = [];\n this.initialized = false;\n this.options = __assign(__assign({}, defaultOptions), options);\n }\n\n Scheduler.prototype.initialize = function (callback) {\n this.initialized = true;\n\n if (callback) {\n if (!this.options.deferEvents) {\n this.schedule(callback);\n return;\n }\n\n this.process(callback);\n }\n\n this.flushEvents();\n };\n\n Scheduler.prototype.schedule = function (task) {\n if (!this.initialized || this.processingEvent) {\n this.queue.push(task);\n return;\n }\n\n if (this.queue.length !== 0) {\n throw new Error('Event queue should be empty when it is not processing events');\n }\n\n this.process(task);\n this.flushEvents();\n };\n\n Scheduler.prototype.clear = function () {\n this.queue = [];\n };\n\n Scheduler.prototype.flushEvents = function () {\n var nextCallback = this.queue.shift();\n\n while (nextCallback) {\n this.process(nextCallback);\n nextCallback = this.queue.shift();\n }\n };\n\n Scheduler.prototype.process = function (callback) {\n this.processingEvent = true;\n\n try {\n callback();\n } catch (e) {\n // there is no use to keep the future events\n // as the situation is not anymore the same\n this.clear();\n throw e;\n } finally {\n this.processingEvent = false;\n }\n };\n\n return Scheduler;\n}();\n\nexport { Scheduler };\n","/**\r\n * Maintains a stack of the current service in scope.\r\n * This is used to provide the correct service to spawn().\r\n */\nvar serviceStack = [];\nvar provide = function (service, fn) {\n serviceStack.push(service);\n var result = fn(service);\n serviceStack.pop();\n return result;\n};\nvar consume = function (fn) {\n return fn(serviceStack[serviceStack.length - 1]);\n};\n\nexport { consume, provide };\n","import { __assign } from './_virtual/_tslib.js';\nimport { symbolObservable, toInvokeSource, mapContext, isMachine } from './utils.js';\nimport { provide } from './serviceScope.js';\n\nfunction createNullActor(id) {\n var _a;\n\n return _a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n getSnapshot: function () {\n return undefined;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a;\n}\n/**\r\n * Creates a deferred actor that is able to be invoked given the provided\r\n * invocation information in its `.meta` value.\r\n *\r\n * @param invokeDefinition The meta information needed to invoke the actor.\r\n */\n\nfunction createInvocableActor(invokeDefinition, machine, context, _event) {\n var _a;\n\n var invokeSrc = toInvokeSource(invokeDefinition.src);\n var serviceCreator = (_a = machine === null || machine === void 0 ? void 0 : machine.options.services) === null || _a === void 0 ? void 0 : _a[invokeSrc.type];\n var resolvedData = invokeDefinition.data ? mapContext(invokeDefinition.data, context, _event) : undefined;\n var tempActor = serviceCreator ? createDeferredActor(serviceCreator, invokeDefinition.id, resolvedData) : createNullActor(invokeDefinition.id); // @ts-ignore\n\n tempActor.meta = invokeDefinition;\n return tempActor;\n}\nfunction createDeferredActor(entity, id, data) {\n var tempActor = createNullActor(id); // @ts-ignore\n\n tempActor.deferred = true;\n\n if (isMachine(entity)) {\n // \"mute\" the existing service scope so potential spawned actors within the `.initialState` stay deferred here\n var initialState_1 = tempActor.state = provide(undefined, function () {\n return (data ? entity.withContext(data) : entity).initialState;\n });\n\n tempActor.getSnapshot = function () {\n return initialState_1;\n };\n }\n\n return tempActor;\n}\nfunction isActor(item) {\n try {\n return typeof item.send === 'function';\n } catch (e) {\n return false;\n }\n}\nfunction isSpawnedActor(item) {\n return isActor(item) && 'id' in item;\n} // TODO: refactor the return type, this could be written in a better way but it's best to avoid unneccessary breaking changes now\n\nfunction toActorRef(actorRefLike) {\n var _a;\n\n return __assign((_a = {\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n id: 'anonymous',\n getSnapshot: function () {\n return undefined;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a), actorRefLike);\n}\n\nexport { createDeferredActor, createInvocableActor, createNullActor, isActor, isSpawnedActor, toActorRef };\n","var children = /*#__PURE__*/new Map();\nvar sessionIdIndex = 0;\nvar registry = {\n bookId: function () {\n return \"x:\".concat(sessionIdIndex++);\n },\n register: function (id, actor) {\n children.set(id, actor);\n return id;\n },\n get: function (id) {\n return children.get(id);\n },\n free: function (id) {\n children.delete(id);\n }\n};\n\nexport { registry };\n","import { IS_PRODUCTION } from './environment.js';\n\nfunction getGlobal() {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof window !== 'undefined') {\n return window;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n }\n\n if (!IS_PRODUCTION) {\n console.warn('XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues');\n }\n}\n\nfunction getDevTools() {\n var global = getGlobal();\n\n if (global && '__xstate__' in global) {\n return global.__xstate__;\n }\n\n return undefined;\n}\n\nfunction registerService(service) {\n if (!getGlobal()) {\n return;\n }\n\n var devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n}\n\nexport { getGlobal, registerService };\n","import { error, doneInvoke } from './actions.js';\nimport { toActorRef } from './Actor.js';\nimport { toObserver } from './utils.js';\n\n/**\r\n * Returns an actor behavior from a reducer and its initial state.\r\n *\r\n * @param transition The pure reducer that returns the next state given the current state and event.\r\n * @param initialState The initial state of the reducer.\r\n * @returns An actor behavior\r\n */\n\nfunction fromReducer(transition, initialState) {\n return {\n transition: transition,\n initialState: initialState\n };\n}\nfunction fromPromise(promiseFn) {\n var initialState = {\n error: undefined,\n data: undefined,\n status: 'pending'\n };\n return {\n transition: function (state, event, _a) {\n var parent = _a.parent,\n id = _a.id,\n observers = _a.observers;\n\n switch (event.type) {\n case 'fulfill':\n parent === null || parent === void 0 ? void 0 : parent.send(doneInvoke(id, event.data));\n return {\n error: undefined,\n data: event.data,\n status: 'fulfilled'\n };\n\n case 'reject':\n parent === null || parent === void 0 ? void 0 : parent.send(error(id, event.error));\n observers.forEach(function (observer) {\n observer.error(event.error);\n });\n return {\n error: event.error,\n data: undefined,\n status: 'rejected'\n };\n\n default:\n return state;\n }\n },\n initialState: initialState,\n start: function (_a) {\n var self = _a.self;\n promiseFn().then(function (data) {\n self.send({\n type: 'fulfill',\n data: data\n });\n }, function (reason) {\n self.send({\n type: 'reject',\n error: reason\n });\n });\n return initialState;\n }\n };\n}\nfunction spawnBehavior(behavior, options) {\n if (options === void 0) {\n options = {};\n }\n\n var state = behavior.initialState;\n var observers = new Set();\n var mailbox = [];\n var flushing = false;\n\n var flush = function () {\n if (flushing) {\n return;\n }\n\n flushing = true;\n\n while (mailbox.length > 0) {\n var event_1 = mailbox.shift();\n state = behavior.transition(state, event_1, actorCtx);\n observers.forEach(function (observer) {\n return observer.next(state);\n });\n }\n\n flushing = false;\n };\n\n var actor = toActorRef({\n id: options.id,\n send: function (event) {\n mailbox.push(event);\n flush();\n },\n getSnapshot: function () {\n return state;\n },\n subscribe: function (next, handleError, complete) {\n var observer = toObserver(next, handleError, complete);\n observers.add(observer);\n observer.next(state);\n return {\n unsubscribe: function () {\n observers.delete(observer);\n }\n };\n }\n });\n var actorCtx = {\n parent: options.parent,\n self: actor,\n id: options.id || 'anonymous',\n observers: observers\n };\n state = behavior.start ? behavior.start(actorCtx) : state;\n return actor;\n}\n\nexport { fromPromise, fromReducer, spawnBehavior };\n","import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';\nimport { SpecialTargets, ActionTypes } from './types.js';\nimport { isStateConfig, State, bindActionToState } from './State.js';\nimport { errorPlatform, update, error as error$1, log, stop, start, cancel, send, raise } from './actionTypes.js';\nimport { initEvent, doneInvoke, toActionObjects, resolveActions, error, getActionFunction } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { warn, mapContext, toObserver, isFunction, toSCXMLEvent, flatten, isRaisableAction, isPromiseLike, isObservable, isMachine, isBehavior, reportUnhandledExceptionOnInvocation, symbolObservable, isArray, toEventObject, isString, isActor, toInvokeSource, uniqueId } from './utils.js';\nimport { Scheduler } from './scheduler.js';\nimport { createDeferredActor, isSpawnedActor } from './Actor.js';\nimport { registry } from './registry.js';\nimport { getGlobal, registerService } from './devTools.js';\nimport { provide, consume } from './serviceScope.js';\nimport { spawnBehavior } from './behaviors.js';\n\nvar DEFAULT_SPAWN_OPTIONS = {\n sync: false,\n autoForward: false\n};\nvar InterpreterStatus;\n\n(function (InterpreterStatus) {\n InterpreterStatus[InterpreterStatus[\"NotStarted\"] = 0] = \"NotStarted\";\n InterpreterStatus[InterpreterStatus[\"Running\"] = 1] = \"Running\";\n InterpreterStatus[InterpreterStatus[\"Stopped\"] = 2] = \"Stopped\";\n})(InterpreterStatus || (InterpreterStatus = {}));\n\nvar Interpreter =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n /**\r\n * Creates a new Interpreter instance (i.e., service) for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to be interpreted\r\n * @param options Interpreter options\r\n */\n function Interpreter(machine, options) {\n if (options === void 0) {\n options = Interpreter.defaultOptions;\n }\n\n var _this = this;\n\n this.machine = machine;\n this.delayedEventsMap = {};\n this.listeners = new Set();\n this.contextListeners = new Set();\n this.stopListeners = new Set();\n this.doneListeners = new Set();\n this.eventListeners = new Set();\n this.sendListeners = new Set();\n /**\r\n * Whether the service is started.\r\n */\n\n this.initialized = false;\n this.status = InterpreterStatus.NotStarted;\n this.children = new Map();\n this.forwardTo = new Set();\n this._outgoingQueue = [];\n /**\r\n * Alias for Interpreter.prototype.start\r\n */\n\n this.init = this.start;\n /**\r\n * Sends an event to the running interpreter to trigger a transition.\r\n *\r\n * An array of events (batched) can be sent as well, which will send all\r\n * batched events to the running interpreter. The listeners will be\r\n * notified only **once** when all events are processed.\r\n *\r\n * @param event The event(s) to send\r\n */\n\n this.send = function (event, payload) {\n if (isArray(event)) {\n _this.batch(event);\n\n return _this.state;\n }\n\n var _event = toSCXMLEvent(toEventObject(event, payload));\n\n if (_this.status === InterpreterStatus.Stopped) {\n // do nothing\n if (!IS_PRODUCTION) {\n warn(false, \"Event \\\"\".concat(_event.name, \"\\\" was sent to stopped service \\\"\").concat(_this.machine.id, \"\\\". This service has already reached its final state, and will not transition.\\nEvent: \").concat(JSON.stringify(_event.data)));\n }\n\n return _this.state;\n }\n\n if (_this.status !== InterpreterStatus.Running && !_this.options.deferEvents) {\n throw new Error(\"Event \\\"\".concat(_event.name, \"\\\" was sent to uninitialized service \\\"\").concat(_this.machine.id // tslint:disable-next-line:max-line-length\n , \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\\nEvent: \").concat(JSON.stringify(_event.data)));\n }\n\n _this.scheduler.schedule(function () {\n // Forward copy of event to child actors\n _this.forward(_event);\n\n var nextState = _this._nextState(_event);\n\n _this.update(nextState, _event);\n });\n\n return _this._state; // TODO: deprecate (should return void)\n // tslint:disable-next-line:semicolon\n };\n\n this.sendTo = function (event, to, immediate) {\n var isParent = _this.parent && (to === SpecialTargets.Parent || _this.parent.id === to);\n var target = isParent ? _this.parent : isString(to) ? to === SpecialTargets.Internal ? _this : _this.children.get(to) || registry.get(to) : isActor(to) ? to : undefined;\n\n if (!target) {\n if (!isParent) {\n throw new Error(\"Unable to send event to child '\".concat(to, \"' from service '\").concat(_this.id, \"'.\"));\n } // tslint:disable-next-line:no-console\n\n\n if (!IS_PRODUCTION) {\n warn(false, \"Service '\".concat(_this.id, \"' has no parent: unable to send event \").concat(event.type));\n }\n\n return;\n }\n\n if ('machine' in target) {\n // perhaps those events should be rejected in the parent\n // but atm it doesn't have easy access to all of the information that is required to do it reliably\n if (_this.status !== InterpreterStatus.Stopped || _this.parent !== target || // we need to send events to the parent from exit handlers of a machine that reached its final state\n _this.state.done) {\n // Send SCXML events to machines\n var scxmlEvent = __assign(__assign({}, event), {\n name: event.name === error$1 ? \"\".concat(error(_this.id)) : event.name,\n origin: _this.sessionId\n });\n\n if (!immediate && _this.machine.config.predictableActionArguments) {\n _this._outgoingQueue.push([target, scxmlEvent]);\n } else {\n target.send(scxmlEvent);\n }\n }\n } else {\n // Send normal events to other targets\n if (!immediate && _this.machine.config.predictableActionArguments) {\n _this._outgoingQueue.push([target, event.data]);\n } else {\n target.send(event.data);\n }\n }\n };\n\n this._exec = function (action, context, _event, actionFunctionMap) {\n if (actionFunctionMap === void 0) {\n actionFunctionMap = _this.machine.options.actions;\n }\n\n var actionOrExec = action.exec || getActionFunction(action.type, actionFunctionMap);\n var exec = isFunction(actionOrExec) ? actionOrExec : actionOrExec ? actionOrExec.exec : action.exec;\n\n if (exec) {\n try {\n return exec(context, _event.data, !_this.machine.config.predictableActionArguments ? {\n action: action,\n state: _this.state,\n _event: _event\n } : {\n action: action,\n _event: _event\n });\n } catch (err) {\n if (_this.parent) {\n _this.parent.send({\n type: 'xstate.error',\n data: err\n });\n }\n\n throw err;\n }\n }\n\n switch (action.type) {\n case raise:\n {\n // if raise action reached the interpreter then it's a delayed one\n var sendAction_1 = action;\n\n _this.defer(sendAction_1);\n\n break;\n }\n\n case send:\n var sendAction = action;\n\n if (typeof sendAction.delay === 'number') {\n _this.defer(sendAction);\n\n return;\n } else {\n if (sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to, _event === initEvent);\n } else {\n _this.send(sendAction._event);\n }\n }\n\n break;\n\n case cancel:\n _this.cancel(action.sendId);\n\n break;\n\n case start:\n {\n if (_this.status !== InterpreterStatus.Running) {\n return;\n }\n\n var activity = action.activity; // If the activity will be stopped right after it's started\n // (such as in transient states)\n // don't bother starting the activity.\n\n if ( // in v4 with `predictableActionArguments` invokes are called eagerly when the `this.state` still points to the previous state\n !_this.machine.config.predictableActionArguments && !_this.state.activities[activity.id || activity.type]) {\n break;\n } // Invoked services\n\n\n if (activity.type === ActionTypes.Invoke) {\n var invokeSource = toInvokeSource(activity.src);\n var serviceCreator = _this.machine.options.services ? _this.machine.options.services[invokeSource.type] : undefined;\n var id = activity.id,\n data = activity.data;\n\n if (!IS_PRODUCTION) {\n warn(!('forward' in activity), // tslint:disable-next-line:max-line-length\n \"`forward` property is deprecated (found in invocation of '\".concat(activity.src, \"' in in machine '\").concat(_this.machine.id, \"'). \") + \"Please use `autoForward` instead.\");\n }\n\n var autoForward = 'autoForward' in activity ? activity.autoForward : !!activity.forward;\n\n if (!serviceCreator) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"No service found for invocation '\".concat(activity.src, \"' in machine '\").concat(_this.machine.id, \"'.\"));\n }\n\n return;\n }\n\n var resolvedData = data ? mapContext(data, context, _event) : undefined;\n\n if (typeof serviceCreator === 'string') {\n // TODO: warn\n return;\n }\n\n var source = isFunction(serviceCreator) ? serviceCreator(context, _event.data, {\n data: resolvedData,\n src: invokeSource,\n meta: activity.meta\n }) : serviceCreator;\n\n if (!source) {\n // TODO: warn?\n return;\n }\n\n var options = void 0;\n\n if (isMachine(source)) {\n source = resolvedData ? source.withContext(resolvedData) : source;\n options = {\n autoForward: autoForward\n };\n }\n\n _this.spawn(source, id, options);\n } else {\n _this.spawnActivity(activity);\n }\n\n break;\n }\n\n case stop:\n {\n _this.stopChild(action.activity.id);\n\n break;\n }\n\n case log:\n var _a = action,\n label = _a.label,\n value = _a.value;\n\n if (label) {\n _this.logger(label, value);\n } else {\n _this.logger(value);\n }\n\n break;\n\n default:\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for action type '\".concat(action.type, \"'\"));\n }\n\n break;\n }\n };\n\n var resolvedOptions = __assign(__assign({}, Interpreter.defaultOptions), options);\n\n var clock = resolvedOptions.clock,\n logger = resolvedOptions.logger,\n parent = resolvedOptions.parent,\n id = resolvedOptions.id;\n var resolvedId = id !== undefined ? id : machine.id;\n this.id = resolvedId;\n this.logger = logger;\n this.clock = clock;\n this.parent = parent;\n this.options = resolvedOptions;\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n this.sessionId = registry.bookId();\n }\n\n Object.defineProperty(Interpreter.prototype, \"initialState\", {\n get: function () {\n var _this = this;\n\n if (this._initialState) {\n return this._initialState;\n }\n\n return provide(this, function () {\n _this._initialState = _this.machine.initialState;\n return _this._initialState;\n });\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Interpreter.prototype, \"state\", {\n /**\r\n * @deprecated Use `.getSnapshot()` instead.\r\n */\n get: function () {\n if (!IS_PRODUCTION) {\n warn(this.status !== InterpreterStatus.NotStarted, \"Attempted to read state from uninitialized service '\".concat(this.id, \"'. Make sure the service is started first.\"));\n }\n\n return this._state;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Executes the actions of the given state, with that state's `context` and `event`.\r\n *\r\n * @param state The state whose actions will be executed\r\n * @param actionsConfig The action implementations to use\r\n */\n\n Interpreter.prototype.execute = function (state, actionsConfig) {\n var e_1, _a;\n\n try {\n for (var _b = __values(state.actions), _c = _b.next(); !_c.done; _c = _b.next()) {\n var action = _c.value;\n this.exec(action, state, actionsConfig);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n };\n\n Interpreter.prototype.update = function (state, _event) {\n var e_2, _a, e_3, _b, e_4, _c, e_5, _d;\n\n var _this = this; // Attach session ID to state\n\n\n state._sessionid = this.sessionId; // Update state\n\n this._state = state; // Execute actions\n\n if ((!this.machine.config.predictableActionArguments || // this is currently required to execute initial actions as the `initialState` gets cached\n // we can't just recompute it (and execute actions while doing so) because we try to preserve identity of actors created within initial assigns\n _event === initEvent) && this.options.execute) {\n this.execute(this.state);\n } else {\n var item = void 0;\n\n while (item = this._outgoingQueue.shift()) {\n item[0].send(item[1]);\n }\n } // Update children\n\n\n this.children.forEach(function (child) {\n _this.state.children[child.id] = child;\n }); // Dev tools\n\n if (this.devTools) {\n this.devTools.send(_event.data, state);\n } // Execute listeners\n\n\n if (state.event) {\n try {\n for (var _e = __values(this.eventListeners), _f = _e.next(); !_f.done; _f = _e.next()) {\n var listener = _f.value;\n listener(state.event);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_a = _e.return)) _a.call(_e);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n }\n\n try {\n for (var _g = __values(this.listeners), _h = _g.next(); !_h.done; _h = _g.next()) {\n var listener = _h.value;\n listener(state, state.event);\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n try {\n for (var _j = __values(this.contextListeners), _k = _j.next(); !_k.done; _k = _j.next()) {\n var contextListener = _k.value;\n contextListener(this.state.context, this.state.history ? this.state.history.context : undefined);\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_k && !_k.done && (_c = _j.return)) _c.call(_j);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n if (this.state.done) {\n // get final child state node\n var finalChildStateNode = state.configuration.find(function (sn) {\n return sn.type === 'final' && sn.parent === _this.machine;\n });\n var doneData = finalChildStateNode && finalChildStateNode.doneData ? mapContext(finalChildStateNode.doneData, state.context, _event) : undefined;\n this._doneEvent = doneInvoke(this.id, doneData);\n\n try {\n for (var _l = __values(this.doneListeners), _m = _l.next(); !_m.done; _m = _l.next()) {\n var listener = _m.value;\n listener(this._doneEvent);\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (_m && !_m.done && (_d = _l.return)) _d.call(_l);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n this._stop();\n\n this._stopChildren();\n\n registry.free(this.sessionId);\n }\n };\n /*\r\n * Adds a listener that is notified whenever a state transition happens. The listener is called with\r\n * the next state and the event object that caused the state transition.\r\n *\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onTransition = function (listener) {\n this.listeners.add(listener); // Send current state to listener\n\n if (this.status === InterpreterStatus.Running) {\n listener(this.state, this.state.event);\n }\n\n return this;\n };\n\n Interpreter.prototype.subscribe = function (nextListenerOrObserver, _, // TODO: error listener\n completeListener) {\n var _this = this;\n\n var observer = toObserver(nextListenerOrObserver, _, completeListener);\n this.listeners.add(observer.next); // Send current state to listener\n\n if (this.status !== InterpreterStatus.NotStarted) {\n observer.next(this.state);\n }\n\n var completeOnce = function () {\n _this.doneListeners.delete(completeOnce);\n\n _this.stopListeners.delete(completeOnce);\n\n observer.complete();\n };\n\n if (this.status === InterpreterStatus.Stopped) {\n observer.complete();\n } else {\n this.onDone(completeOnce);\n this.onStop(completeOnce);\n }\n\n return {\n unsubscribe: function () {\n _this.listeners.delete(observer.next);\n\n _this.doneListeners.delete(completeOnce);\n\n _this.stopListeners.delete(completeOnce);\n }\n };\n };\n /**\r\n * Adds an event listener that is notified whenever an event is sent to the running interpreter.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onEvent = function (listener) {\n this.eventListeners.add(listener);\n return this;\n };\n /**\r\n * Adds an event listener that is notified whenever a `send` event occurs.\r\n * @param listener The event listener\r\n */\n\n\n Interpreter.prototype.onSend = function (listener) {\n this.sendListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a context listener that is notified whenever the state context changes.\r\n * @param listener The context listener\r\n */\n\n\n Interpreter.prototype.onChange = function (listener) {\n this.contextListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a listener that is notified when the machine is stopped.\r\n * @param listener The listener\r\n */\n\n\n Interpreter.prototype.onStop = function (listener) {\n this.stopListeners.add(listener);\n return this;\n };\n /**\r\n * Adds a state listener that is notified when the statechart has reached its final state.\r\n * @param listener The state listener\r\n */\n\n\n Interpreter.prototype.onDone = function (listener) {\n if (this.status === InterpreterStatus.Stopped && this._doneEvent) {\n listener(this._doneEvent);\n } else {\n this.doneListeners.add(listener);\n }\n\n return this;\n };\n /**\r\n * Removes a listener.\r\n * @param listener The listener to remove\r\n */\n\n\n Interpreter.prototype.off = function (listener) {\n this.listeners.delete(listener);\n this.eventListeners.delete(listener);\n this.sendListeners.delete(listener);\n this.stopListeners.delete(listener);\n this.doneListeners.delete(listener);\n this.contextListeners.delete(listener);\n return this;\n };\n /**\r\n * Starts the interpreter from the given state, or the initial state.\r\n * @param initialState The state to start the statechart from\r\n */\n\n\n Interpreter.prototype.start = function (initialState) {\n var _this = this;\n\n if (this.status === InterpreterStatus.Running) {\n // Do not restart the service if it is already started\n return this;\n } // yes, it's a hack but we need the related cache to be populated for some things to work (like delayed transitions)\n // this is usually called by `machine.getInitialState` but if we rehydrate from a state we might bypass this call\n // we also don't want to call this method here as it resolves the full initial state which might involve calling assign actions\n // and that could potentially lead to some unwanted side-effects (even such as creating some rogue actors)\n\n\n this.machine._init();\n\n registry.register(this.sessionId, this);\n this.initialized = true;\n this.status = InterpreterStatus.Running;\n var resolvedState = initialState === undefined ? this.initialState : provide(this, function () {\n return isStateConfig(initialState) ? _this.machine.resolveState(initialState) : _this.machine.resolveState(State.from(initialState, _this.machine.context));\n });\n\n if (this.options.devTools) {\n this.attachDev();\n }\n\n this.scheduler.initialize(function () {\n _this.update(resolvedState, initEvent);\n });\n return this;\n };\n\n Interpreter.prototype._stopChildren = function () {\n // TODO: think about converting those to actions\n this.children.forEach(function (child) {\n if (isFunction(child.stop)) {\n child.stop();\n }\n });\n this.children.clear();\n };\n\n Interpreter.prototype._stop = function () {\n var e_6, _a, e_7, _b, e_8, _c, e_9, _d, e_10, _e;\n\n try {\n for (var _f = __values(this.listeners), _g = _f.next(); !_g.done; _g = _f.next()) {\n var listener = _g.value;\n this.listeners.delete(listener);\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (_g && !_g.done && (_a = _f.return)) _a.call(_f);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n try {\n for (var _h = __values(this.stopListeners), _j = _h.next(); !_j.done; _j = _h.next()) {\n var listener = _j.value; // call listener, then remove\n\n listener();\n this.stopListeners.delete(listener);\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_j && !_j.done && (_b = _h.return)) _b.call(_h);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n\n try {\n for (var _k = __values(this.contextListeners), _l = _k.next(); !_l.done; _l = _k.next()) {\n var listener = _l.value;\n this.contextListeners.delete(listener);\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n\n try {\n for (var _m = __values(this.doneListeners), _o = _m.next(); !_o.done; _o = _m.next()) {\n var listener = _o.value;\n this.doneListeners.delete(listener);\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_o && !_o.done && (_d = _m.return)) _d.call(_m);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n\n if (!this.initialized) {\n // Interpreter already stopped; do nothing\n return this;\n }\n\n this.initialized = false;\n this.status = InterpreterStatus.Stopped;\n this._initialState = undefined;\n\n try {\n // we are going to stop within the current sync frame\n // so we can safely just cancel this here as nothing async should be fired anyway\n for (var _p = __values(Object.keys(this.delayedEventsMap)), _q = _p.next(); !_q.done; _q = _p.next()) {\n var key = _q.value;\n this.clock.clearTimeout(this.delayedEventsMap[key]);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (_q && !_q.done && (_e = _p.return)) _e.call(_p);\n } finally {\n if (e_10) throw e_10.error;\n }\n } // clear everything that might be enqueued\n\n\n this.scheduler.clear();\n this.scheduler = new Scheduler({\n deferEvents: this.options.deferEvents\n });\n };\n /**\r\n * Stops the interpreter and unsubscribe all listeners.\r\n *\r\n * This will also notify the `onStop` listeners.\r\n */\n\n\n Interpreter.prototype.stop = function () {\n // TODO: add warning for stopping non-root interpreters\n var _this = this; // grab the current scheduler as it will be replaced in _stop\n\n\n var scheduler = this.scheduler;\n\n this._stop(); // let what is currently processed to be finished\n\n\n scheduler.schedule(function () {\n var _a;\n\n if ((_a = _this._state) === null || _a === void 0 ? void 0 : _a.done) {\n return;\n } // it feels weird to handle this here but we need to handle this even slightly \"out of band\"\n\n\n var _event = toSCXMLEvent({\n type: 'xstate.stop'\n });\n\n var nextState = provide(_this, function () {\n var exitActions = flatten(__spreadArray([], __read(_this.state.configuration), false).sort(function (a, b) {\n return b.order - a.order;\n }).map(function (stateNode) {\n return toActionObjects(stateNode.onExit, _this.machine.options.actions);\n }));\n\n var _a = __read(resolveActions(_this.machine, _this.state, _this.state.context, _event, [{\n type: 'exit',\n actions: exitActions\n }], _this.machine.config.predictableActionArguments ? _this._exec : undefined, _this.machine.config.predictableActionArguments || _this.machine.config.preserveActionOrder), 2),\n resolvedActions = _a[0],\n updatedContext = _a[1];\n\n var newState = new State({\n value: _this.state.value,\n context: updatedContext,\n _event: _event,\n _sessionid: _this.sessionId,\n historyValue: undefined,\n history: _this.state,\n actions: resolvedActions.filter(function (action) {\n return !isRaisableAction(action);\n }),\n activities: {},\n events: [],\n configuration: [],\n transitions: [],\n children: {},\n done: _this.state.done,\n tags: _this.state.tags,\n machine: _this.machine\n });\n newState.changed = true;\n return newState;\n });\n\n _this.update(nextState, _event);\n\n _this._stopChildren();\n\n registry.free(_this.sessionId);\n });\n return this;\n };\n\n Interpreter.prototype.batch = function (events) {\n var _this = this;\n\n if (this.status === InterpreterStatus.NotStarted && this.options.deferEvents) {\n // tslint:disable-next-line:no-console\n if (!IS_PRODUCTION) {\n warn(false, \"\".concat(events.length, \" event(s) were sent to uninitialized service \\\"\").concat(this.machine.id, \"\\\" and are deferred. Make sure .start() is called for this service.\\nEvent: \").concat(JSON.stringify(event)));\n }\n } else if (this.status !== InterpreterStatus.Running) {\n throw new Error( // tslint:disable-next-line:max-line-length\n \"\".concat(events.length, \" event(s) were sent to uninitialized service \\\"\").concat(this.machine.id, \"\\\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\"));\n }\n\n if (!events.length) {\n return;\n }\n\n var exec = !!this.machine.config.predictableActionArguments && this._exec;\n this.scheduler.schedule(function () {\n var e_11, _a;\n\n var nextState = _this.state;\n var batchChanged = false;\n var batchedActions = [];\n\n var _loop_1 = function (event_1) {\n var _event = toSCXMLEvent(event_1);\n\n _this.forward(_event);\n\n nextState = provide(_this, function () {\n return _this.machine.transition(nextState, _event, undefined, exec || undefined);\n });\n batchedActions.push.apply(batchedActions, __spreadArray([], __read(_this.machine.config.predictableActionArguments ? nextState.actions : nextState.actions.map(function (a) {\n return bindActionToState(a, nextState);\n })), false));\n batchChanged = batchChanged || !!nextState.changed;\n };\n\n try {\n for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {\n var event_1 = events_1_1.value;\n\n _loop_1(event_1);\n }\n } catch (e_11_1) {\n e_11 = {\n error: e_11_1\n };\n } finally {\n try {\n if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);\n } finally {\n if (e_11) throw e_11.error;\n }\n }\n\n nextState.changed = batchChanged;\n nextState.actions = batchedActions;\n\n _this.update(nextState, toSCXMLEvent(events[events.length - 1]));\n });\n };\n /**\r\n * Returns a send function bound to this interpreter instance.\r\n *\r\n * @param event The event to be sent by the sender.\r\n */\n\n\n Interpreter.prototype.sender = function (event) {\n return this.send.bind(this, event);\n };\n\n Interpreter.prototype._nextState = function (event, exec) {\n var _this = this;\n\n if (exec === void 0) {\n exec = !!this.machine.config.predictableActionArguments && this._exec;\n }\n\n var _event = toSCXMLEvent(event);\n\n if (_event.name.indexOf(errorPlatform) === 0 && !this.state.nextEvents.some(function (nextEvent) {\n return nextEvent.indexOf(errorPlatform) === 0;\n })) {\n throw _event.data.data;\n }\n\n var nextState = provide(this, function () {\n return _this.machine.transition(_this.state, _event, undefined, exec || undefined);\n });\n return nextState;\n };\n /**\r\n * Returns the next state given the interpreter's current state and the event.\r\n *\r\n * This is a pure method that does _not_ update the interpreter's state.\r\n *\r\n * @param event The event to determine the next state\r\n */\n\n\n Interpreter.prototype.nextState = function (event) {\n return this._nextState(event, false);\n };\n\n Interpreter.prototype.forward = function (event) {\n var e_12, _a;\n\n try {\n for (var _b = __values(this.forwardTo), _c = _b.next(); !_c.done; _c = _b.next()) {\n var id = _c.value;\n var child = this.children.get(id);\n\n if (!child) {\n throw new Error(\"Unable to forward event '\".concat(event, \"' from interpreter '\").concat(this.id, \"' to nonexistant child '\").concat(id, \"'.\"));\n }\n\n child.send(event);\n }\n } catch (e_12_1) {\n e_12 = {\n error: e_12_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_12) throw e_12.error;\n }\n }\n };\n\n Interpreter.prototype.defer = function (sendAction) {\n var _this = this;\n\n var timerId = this.clock.setTimeout(function () {\n if ('to' in sendAction && sendAction.to) {\n _this.sendTo(sendAction._event, sendAction.to, true);\n } else {\n _this.send(sendAction._event);\n }\n }, sendAction.delay);\n\n if (sendAction.id) {\n this.delayedEventsMap[sendAction.id] = timerId;\n }\n };\n\n Interpreter.prototype.cancel = function (sendId) {\n this.clock.clearTimeout(this.delayedEventsMap[sendId]);\n delete this.delayedEventsMap[sendId];\n };\n\n Interpreter.prototype.exec = function (action, state, actionFunctionMap) {\n if (actionFunctionMap === void 0) {\n actionFunctionMap = this.machine.options.actions;\n }\n\n this._exec(action, state.context, state._event, actionFunctionMap);\n };\n\n Interpreter.prototype.removeChild = function (childId) {\n var _a;\n\n this.children.delete(childId);\n this.forwardTo.delete(childId); // this.state might not exist at the time this is called,\n // such as when a child is added then removed while initializing the state\n\n (_a = this.state) === null || _a === void 0 ? true : delete _a.children[childId];\n };\n\n Interpreter.prototype.stopChild = function (childId) {\n var child = this.children.get(childId);\n\n if (!child) {\n return;\n }\n\n this.removeChild(childId);\n\n if (isFunction(child.stop)) {\n child.stop();\n }\n };\n\n Interpreter.prototype.spawn = function (entity, name, options) {\n if (this.status !== InterpreterStatus.Running) {\n return createDeferredActor(entity, name);\n }\n\n if (isPromiseLike(entity)) {\n return this.spawnPromise(Promise.resolve(entity), name);\n } else if (isFunction(entity)) {\n return this.spawnCallback(entity, name);\n } else if (isSpawnedActor(entity)) {\n return this.spawnActor(entity, name);\n } else if (isObservable(entity)) {\n return this.spawnObservable(entity, name);\n } else if (isMachine(entity)) {\n return this.spawnMachine(entity, __assign(__assign({}, options), {\n id: name\n }));\n } else if (isBehavior(entity)) {\n return this.spawnBehavior(entity, name);\n } else {\n throw new Error(\"Unable to spawn entity \\\"\".concat(name, \"\\\" of type \\\"\").concat(typeof entity, \"\\\".\"));\n }\n };\n\n Interpreter.prototype.spawnMachine = function (machine, options) {\n var _this = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var childService = new Interpreter(machine, __assign(__assign({}, this.options), {\n parent: this,\n id: options.id || machine.id\n }));\n\n var resolvedOptions = __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), options);\n\n if (resolvedOptions.sync) {\n childService.onTransition(function (state) {\n _this.send(update, {\n state: state,\n id: childService.id\n });\n });\n }\n\n var actor = childService;\n this.children.set(childService.id, actor);\n\n if (resolvedOptions.autoForward) {\n this.forwardTo.add(childService.id);\n }\n\n childService.onDone(function (doneEvent) {\n _this.removeChild(childService.id);\n\n _this.send(toSCXMLEvent(doneEvent, {\n origin: childService.id\n }));\n }).start();\n return actor;\n };\n\n Interpreter.prototype.spawnBehavior = function (behavior, id) {\n var actorRef = spawnBehavior(behavior, {\n id: id,\n parent: this\n });\n this.children.set(id, actorRef);\n return actorRef;\n };\n\n Interpreter.prototype.spawnPromise = function (promise, id) {\n var _a;\n\n var _this = this;\n\n var canceled = false;\n var resolvedData;\n promise.then(function (response) {\n if (!canceled) {\n resolvedData = response;\n\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(doneInvoke(id, response), {\n origin: id\n }));\n }\n }, function (errorData) {\n if (!canceled) {\n _this.removeChild(id);\n\n var errorEvent = error(id, errorData);\n\n try {\n // Send \"error.platform.id\" to this (parent).\n _this.send(toSCXMLEvent(errorEvent, {\n origin: id\n }));\n } catch (error) {\n reportUnhandledExceptionOnInvocation(errorData, error, id);\n\n if (_this.devTools) {\n _this.devTools.send(errorEvent, _this.state);\n }\n\n if (_this.machine.strict) {\n // it would be better to always stop the state machine if unhandled\n // exception/promise rejection happens but because we don't want to\n // break existing code so enforce it on strict mode only especially so\n // because documentation says that onError is optional\n _this.stop();\n }\n }\n }\n });\n var actor = (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function (next, handleError, complete) {\n var observer = toObserver(next, handleError, complete);\n var unsubscribed = false;\n promise.then(function (response) {\n if (unsubscribed) {\n return;\n }\n\n observer.next(response);\n\n if (unsubscribed) {\n return;\n }\n\n observer.complete();\n }, function (err) {\n if (unsubscribed) {\n return;\n }\n\n observer.error(err);\n });\n return {\n unsubscribe: function () {\n return unsubscribed = true;\n }\n };\n },\n stop: function () {\n canceled = true;\n },\n toJSON: function () {\n return {\n id: id\n };\n },\n getSnapshot: function () {\n return resolvedData;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnCallback = function (callback, id) {\n var _a;\n\n var _this = this;\n\n var canceled = false;\n var receivers = new Set();\n var listeners = new Set();\n var emitted;\n\n var receive = function (e) {\n emitted = e;\n listeners.forEach(function (listener) {\n return listener(e);\n });\n\n if (canceled) {\n return;\n }\n\n _this.send(toSCXMLEvent(e, {\n origin: id\n }));\n };\n\n var callbackStop;\n\n try {\n callbackStop = callback(receive, function (newListener) {\n receivers.add(newListener);\n });\n } catch (err) {\n this.send(error(id, err));\n }\n\n if (isPromiseLike(callbackStop)) {\n // it turned out to be an async function, can't reliably check this before calling `callback`\n // because transpiled async functions are not recognizable\n return this.spawnPromise(callbackStop, id);\n }\n\n var actor = (_a = {\n id: id,\n send: function (event) {\n return receivers.forEach(function (receiver) {\n return receiver(event);\n });\n },\n subscribe: function (next) {\n var observer = toObserver(next);\n listeners.add(observer.next);\n return {\n unsubscribe: function () {\n listeners.delete(observer.next);\n }\n };\n },\n stop: function () {\n canceled = true;\n\n if (isFunction(callbackStop)) {\n callbackStop();\n }\n },\n toJSON: function () {\n return {\n id: id\n };\n },\n getSnapshot: function () {\n return emitted;\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnObservable = function (source, id) {\n var _a;\n\n var _this = this;\n\n var emitted;\n var subscription = source.subscribe(function (value) {\n emitted = value;\n\n _this.send(toSCXMLEvent(value, {\n origin: id\n }));\n }, function (err) {\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(error(id, err), {\n origin: id\n }));\n }, function () {\n _this.removeChild(id);\n\n _this.send(toSCXMLEvent(doneInvoke(id), {\n origin: id\n }));\n });\n var actor = (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function (next, handleError, complete) {\n return source.subscribe(next, handleError, complete);\n },\n stop: function () {\n return subscription.unsubscribe();\n },\n getSnapshot: function () {\n return emitted;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a);\n this.children.set(id, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActor = function (actor, name) {\n this.children.set(name, actor);\n return actor;\n };\n\n Interpreter.prototype.spawnActivity = function (activity) {\n var implementation = this.machine.options && this.machine.options.activities ? this.machine.options.activities[activity.type] : undefined;\n\n if (!implementation) {\n if (!IS_PRODUCTION) {\n warn(false, \"No implementation found for activity '\".concat(activity.type, \"'\"));\n } // tslint:disable-next-line:no-console\n\n\n return;\n } // Start implementation\n\n\n var dispose = implementation(this.state.context, activity);\n this.spawnEffect(activity.id, dispose);\n };\n\n Interpreter.prototype.spawnEffect = function (id, dispose) {\n var _a;\n\n this.children.set(id, (_a = {\n id: id,\n send: function () {\n return void 0;\n },\n subscribe: function () {\n return {\n unsubscribe: function () {\n return void 0;\n }\n };\n },\n stop: dispose || undefined,\n getSnapshot: function () {\n return undefined;\n },\n toJSON: function () {\n return {\n id: id\n };\n }\n }, _a[symbolObservable] = function () {\n return this;\n }, _a));\n };\n\n Interpreter.prototype.attachDev = function () {\n var global = getGlobal();\n\n if (this.options.devTools && global) {\n if (global.__REDUX_DEVTOOLS_EXTENSION__) {\n var devToolsOptions = typeof this.options.devTools === 'object' ? this.options.devTools : undefined;\n this.devTools = global.__REDUX_DEVTOOLS_EXTENSION__.connect(__assign(__assign({\n name: this.id,\n autoPause: true,\n stateSanitizer: function (state) {\n return {\n value: state.value,\n context: state.context,\n actions: state.actions\n };\n }\n }, devToolsOptions), {\n features: __assign({\n jump: false,\n skip: false\n }, devToolsOptions ? devToolsOptions.features : undefined)\n }), this.machine);\n this.devTools.init(this.state);\n } // add XState-specific dev tooling hook\n\n\n registerService(this);\n }\n };\n\n Interpreter.prototype.toJSON = function () {\n return {\n id: this.id\n };\n };\n\n Interpreter.prototype[symbolObservable] = function () {\n return this;\n };\n\n Interpreter.prototype.getSnapshot = function () {\n if (this.status === InterpreterStatus.NotStarted) {\n return this.initialState;\n }\n\n return this._state;\n };\n /**\r\n * The default interpreter options:\r\n *\r\n * - `clock` uses the global `setTimeout` and `clearTimeout` functions\r\n * - `logger` uses the global `console.log()` method\r\n */\n\n\n Interpreter.defaultOptions = {\n execute: true,\n deferEvents: true,\n clock: {\n setTimeout: function (fn, ms) {\n return setTimeout(fn, ms);\n },\n clearTimeout: function (id) {\n return clearTimeout(id);\n }\n },\n logger: /*#__PURE__*/console.log.bind(console),\n devTools: false\n };\n Interpreter.interpret = interpret;\n return Interpreter;\n}();\n\nvar resolveSpawnOptions = function (nameOrOptions) {\n if (isString(nameOrOptions)) {\n return __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: nameOrOptions\n });\n }\n\n return __assign(__assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {\n name: uniqueId()\n }), nameOrOptions);\n};\n\nfunction spawn(entity, nameOrOptions) {\n var resolvedOptions = resolveSpawnOptions(nameOrOptions);\n return consume(function (service) {\n if (!IS_PRODUCTION) {\n var isLazyEntity = isMachine(entity) || isFunction(entity);\n warn(!!service || isLazyEntity, \"Attempted to spawn an Actor (ID: \\\"\".concat(isMachine(entity) ? entity.id : 'undefined', \"\\\") outside of a service. This will have no effect.\"));\n }\n\n if (service) {\n return service.spawn(entity, resolvedOptions.name, resolvedOptions);\n } else {\n return createDeferredActor(entity, resolvedOptions.name);\n }\n });\n}\n/**\r\n * Creates a new Interpreter instance for the given machine with the provided options, if any.\r\n *\r\n * @param machine The machine to interpret\r\n * @param options Interpreter options\r\n */\n\nfunction interpret(machine, options) {\n var interpreter = new Interpreter(machine, options);\n return interpreter;\n}\n\nexport { Interpreter, InterpreterStatus, interpret, spawn };\n","export var ReactEffectType;\n(function (ReactEffectType) {\n ReactEffectType[ReactEffectType[\"Effect\"] = 1] = \"Effect\";\n ReactEffectType[ReactEffectType[\"LayoutEffect\"] = 2] = \"LayoutEffect\";\n})(ReactEffectType || (ReactEffectType = {}));\n","import * as React from 'react';\nexport default function useConstant(fn) {\n var ref = React.useRef();\n if (!ref.current) {\n ref.current = { v: fn() };\n }\n return ref.current.v;\n}\n","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nexport function partition(items, predicate) {\n var e_1, _a;\n var _b = __read([[], []], 2), truthy = _b[0], falsy = _b[1];\n try {\n for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {\n var item = items_1_1.value;\n if (predicate(item)) {\n truthy.push(item);\n }\n else {\n falsy.push(item);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return [truthy, falsy];\n}\n","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { useEffect, useRef } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { ReactEffectType } from './types';\nimport { partition } from './utils';\nfunction executeEffect(action, state) {\n var exec = action.exec;\n var originalExec = exec(state.context, state._event.data, {\n action: action,\n state: state,\n _event: state._event\n });\n originalExec();\n}\nexport function useReactEffectActions(service) {\n var effectActionsRef = useRef([]);\n var layoutEffectActionsRef = useRef([]);\n useIsomorphicLayoutEffect(function () {\n var sub = service.subscribe(function (currentState) {\n var _a, _b;\n if (currentState.actions.length) {\n var reactEffectActions = currentState.actions.filter(function (action) {\n return (typeof action.exec === 'function' &&\n '__effect' in action.exec);\n });\n var _c = __read(partition(reactEffectActions, function (action) {\n return action.exec.__effect === ReactEffectType.Effect;\n }), 2), effectActions = _c[0], layoutEffectActions = _c[1];\n (_a = effectActionsRef.current).push.apply(_a, __spreadArray([], __read(effectActions.map(function (effectAction) { return [effectAction, currentState]; })), false));\n (_b = layoutEffectActionsRef.current).push.apply(_b, __spreadArray([], __read(layoutEffectActions.map(function (layoutEffectAction) { return [layoutEffectAction, currentState]; })), false));\n }\n });\n return function () {\n sub.unsubscribe();\n };\n }, []);\n // this is somewhat weird - this should always be flushed within useLayoutEffect\n // but we don't want to receive warnings about useLayoutEffect being used on the server\n // so we have to use `useIsomorphicLayoutEffect` to silence those warnings\n useIsomorphicLayoutEffect(function () {\n while (layoutEffectActionsRef.current.length) {\n var _a = __read(layoutEffectActionsRef.current.shift(), 2), layoutEffectAction = _a[0], effectState = _a[1];\n executeEffect(layoutEffectAction, effectState);\n }\n }); // https://github.com/davidkpiano/xstate/pull/1202#discussion_r429677773\n useEffect(function () {\n while (effectActionsRef.current.length) {\n var _a = __read(effectActionsRef.current.shift(), 2), effectAction = _a[0], effectState = _a[1];\n executeEffect(effectAction, effectState);\n }\n });\n}\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { useState } from 'react';\nimport useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';\nimport { interpret, State } from 'xstate';\nimport useConstant from './useConstant';\nimport { useReactEffectActions } from './useReactEffectActions';\n// copied from core/src/utils.ts\n// it avoids a breaking change between this package and XState which is its peer dep\nfunction toObserver(nextHandler, errorHandler, completionHandler) {\n if (typeof nextHandler === 'object') {\n return nextHandler;\n }\n var noop = function () { return void 0; };\n return {\n next: nextHandler,\n error: errorHandler || noop,\n complete: completionHandler || noop\n };\n}\nexport function useInterpret(getMachine, options, observerOrListener) {\n if (options === void 0) { options = {}; }\n var machine = useConstant(function () {\n return typeof getMachine === 'function' ? getMachine() : getMachine;\n });\n if (process.env.NODE_ENV !== 'production' &&\n typeof getMachine !== 'function') {\n var _a = __read(useState(machine), 1), initialMachine = _a[0];\n if (getMachine !== initialMachine) {\n console.warn('Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\\n' +\n 'Please make sure that you pass the same Machine as argument each time.');\n }\n }\n var context = options.context, guards = options.guards, actions = options.actions, activities = options.activities, services = options.services, delays = options.delays, rehydratedState = options.state, interpreterOptions = __rest(options, [\"context\", \"guards\", \"actions\", \"activities\", \"services\", \"delays\", \"state\"]);\n var service = useConstant(function () {\n var machineConfig = {\n context: context,\n guards: guards,\n actions: actions,\n activities: activities,\n services: services,\n delays: delays\n };\n var machineWithConfig = machine.withConfig(machineConfig, function () { return (__assign(__assign({}, machine.context), context)); });\n return interpret(machineWithConfig, __assign({ deferEvents: true }, interpreterOptions));\n });\n useIsomorphicLayoutEffect(function () {\n var sub;\n if (observerOrListener) {\n sub = service.subscribe(toObserver(observerOrListener));\n }\n return function () {\n sub === null || sub === void 0 ? void 0 : sub.unsubscribe();\n };\n }, [observerOrListener]);\n useIsomorphicLayoutEffect(function () {\n service.start(rehydratedState ? State.create(rehydratedState) : undefined);\n return function () {\n service.stop();\n };\n }, []);\n // Make sure options are kept updated when they change.\n // This mutation assignment is safe because the service instance is only used\n // in one place -- this hook's caller.\n useIsomorphicLayoutEffect(function () {\n Object.assign(service.machine.options.actions, actions);\n Object.assign(service.machine.options.guards, guards);\n Object.assign(service.machine.options.activities, activities);\n Object.assign(service.machine.options.services, services);\n Object.assign(service.machine.options.delays, delays);\n }, [actions, guards, activities, services, delays]);\n useReactEffectActions(service);\n return service;\n}\n","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { useCallback, useState } from 'react';\nimport { State } from 'xstate';\nimport { ReactEffectType } from './types';\nimport { useInterpret } from './useInterpret';\nfunction createReactActionFunction(exec, tag) {\n var effectExec = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // don't execute; just return\n return function () {\n return exec.apply(void 0, __spreadArray([], __read(args), false));\n };\n };\n Object.defineProperties(effectExec, {\n name: { value: \"effect:\".concat(exec.name) },\n __effect: { value: tag }\n });\n return effectExec;\n}\nexport function asEffect(exec) {\n return createReactActionFunction(exec, ReactEffectType.Effect);\n}\nexport function asLayoutEffect(exec) {\n return createReactActionFunction(exec, ReactEffectType.LayoutEffect);\n}\nexport function useMachine(getMachine, options) {\n if (options === void 0) { options = {}; }\n var listener = useCallback(function (nextState) {\n // Only change the current state if:\n // - the incoming state is the \"live\" initial state (since it might have new actors)\n // - OR the incoming state actually changed.\n //\n // The \"live\" initial state will have .changed === undefined.\n var initialStateChanged = nextState.changed === undefined &&\n Object.keys(nextState.children).length;\n if (nextState.changed || initialStateChanged) {\n setState(nextState);\n }\n }, []);\n var service = useInterpret(getMachine, options, listener);\n var _a = __read(useState(function () {\n var initialState = service.machine.initialState;\n return (options.state\n ? State.create(options.state)\n : initialState);\n }), 2), state = _a[0], setState = _a[1];\n return [state, service.send, service];\n}\n","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport React, { useState, useCallback, forwardRef, useRef, useEffect, useImperativeHandle, useMemo } from 'react';\n\nconst is = {\n arr: Array.isArray,\n obj: a => Object.prototype.toString.call(a) === '[object Object]',\n fun: a => typeof a === 'function',\n str: a => typeof a === 'string',\n num: a => typeof a === 'number',\n und: a => a === void 0,\n nul: a => a === null,\n set: a => a instanceof Set,\n map: a => a instanceof Map,\n\n equ(a, b) {\n if (typeof a !== typeof b) return false;\n if (is.str(a) || is.num(a)) return a === b;\n if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true;\n let i;\n\n for (i in a) if (!(i in b)) return false;\n\n for (i in b) if (a[i] !== b[i]) return false;\n\n return is.und(i) ? a === b : true;\n }\n\n};\nfunction merge(target, lowercase) {\n if (lowercase === void 0) {\n lowercase = true;\n }\n\n return object => (is.arr(object) ? object : Object.keys(object)).reduce((acc, element) => {\n const key = lowercase ? element[0].toLowerCase() + element.substring(1) : element;\n acc[key] = target(key);\n return acc;\n }, target);\n}\nfunction useForceUpdate() {\n const _useState = useState(false),\n f = _useState[1];\n\n const forceUpdate = useCallback(() => f(v => !v), []);\n return forceUpdate;\n}\nfunction withDefault(value, defaultValue) {\n return is.und(value) || is.nul(value) ? defaultValue : value;\n}\nfunction toArray(a) {\n return !is.und(a) ? is.arr(a) ? a : [a] : [];\n}\nfunction callProp(obj) {\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 return is.fun(obj) ? obj(...args) : obj;\n}\n\nfunction getForwardProps(props) {\n const to = props.to,\n from = props.from,\n config = props.config,\n onStart = props.onStart,\n onRest = props.onRest,\n onFrame = props.onFrame,\n children = props.children,\n reset = props.reset,\n reverse = props.reverse,\n force = props.force,\n immediate = props.immediate,\n delay = props.delay,\n attach = props.attach,\n destroyed = props.destroyed,\n interpolateTo = props.interpolateTo,\n ref = props.ref,\n lazy = props.lazy,\n forward = _objectWithoutPropertiesLoose(props, [\"to\", \"from\", \"config\", \"onStart\", \"onRest\", \"onFrame\", \"children\", \"reset\", \"reverse\", \"force\", \"immediate\", \"delay\", \"attach\", \"destroyed\", \"interpolateTo\", \"ref\", \"lazy\"]);\n\n return forward;\n}\n\nfunction interpolateTo(props) {\n const forward = getForwardProps(props);\n if (is.und(forward)) return _extends({\n to: forward\n }, props);\n const rest = Object.keys(props).reduce((a, k) => !is.und(forward[k]) ? a : _extends({}, a, {\n [k]: props[k]\n }), {});\n return _extends({\n to: forward\n }, rest);\n}\nfunction handleRef(ref, forward) {\n if (forward) {\n // If it's a function, assume it's a ref callback\n if (is.fun(forward)) forward(ref);else if (is.obj(forward)) {\n forward.current = ref;\n }\n }\n\n return ref;\n}\n\nclass Animated {\n constructor() {\n this.payload = void 0;\n this.children = [];\n }\n\n getAnimatedValue() {\n return this.getValue();\n }\n\n getPayload() {\n return this.payload || this;\n }\n\n attach() {}\n\n detach() {}\n\n getChildren() {\n return this.children;\n }\n\n addChild(child) {\n if (this.children.length === 0) this.attach();\n this.children.push(child);\n }\n\n removeChild(child) {\n const index = this.children.indexOf(child);\n this.children.splice(index, 1);\n if (this.children.length === 0) this.detach();\n }\n\n}\nclass AnimatedArray extends Animated {\n constructor() {\n super(...arguments);\n this.payload = [];\n\n this.attach = () => this.payload.forEach(p => p instanceof Animated && p.addChild(this));\n\n this.detach = () => this.payload.forEach(p => p instanceof Animated && p.removeChild(this));\n }\n\n}\nclass AnimatedObject extends Animated {\n constructor() {\n super(...arguments);\n this.payload = {};\n\n this.attach = () => Object.values(this.payload).forEach(s => s instanceof Animated && s.addChild(this));\n\n this.detach = () => Object.values(this.payload).forEach(s => s instanceof Animated && s.removeChild(this));\n }\n\n getValue(animated) {\n if (animated === void 0) {\n animated = false;\n }\n\n const payload = {};\n\n for (const key in this.payload) {\n const value = this.payload[key];\n if (animated && !(value instanceof Animated)) continue;\n payload[key] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value;\n }\n\n return payload;\n }\n\n getAnimatedValue() {\n return this.getValue(true);\n }\n\n}\n\nlet applyAnimatedValues;\nfunction injectApplyAnimatedValues(fn, transform) {\n applyAnimatedValues = {\n fn,\n transform\n };\n}\nlet colorNames;\nfunction injectColorNames(names) {\n colorNames = names;\n}\nlet requestFrame = cb => typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1;\nlet cancelFrame = id => {\n typeof window !== 'undefined' && window.cancelAnimationFrame(id);\n};\nfunction injectFrame(raf, caf) {\n requestFrame = raf;\n cancelFrame = caf;\n}\nlet interpolation;\nfunction injectStringInterpolator(fn) {\n interpolation = fn;\n}\nlet now = () => Date.now();\nfunction injectNow(nowFn) {\n now = nowFn;\n}\nlet defaultElement;\nfunction injectDefaultElement(el) {\n defaultElement = el;\n}\nlet animatedApi = node => node.current;\nfunction injectAnimatedApi(fn) {\n animatedApi = fn;\n}\nlet createAnimatedStyle;\nfunction injectCreateAnimatedStyle(factory) {\n createAnimatedStyle = factory;\n}\nlet manualFrameloop;\nfunction injectManualFrameloop(callback) {\n manualFrameloop = callback;\n}\n\nvar Globals = /*#__PURE__*/Object.freeze({\n get applyAnimatedValues () { return applyAnimatedValues; },\n injectApplyAnimatedValues: injectApplyAnimatedValues,\n get colorNames () { return colorNames; },\n injectColorNames: injectColorNames,\n get requestFrame () { return requestFrame; },\n get cancelFrame () { return cancelFrame; },\n injectFrame: injectFrame,\n get interpolation () { return interpolation; },\n injectStringInterpolator: injectStringInterpolator,\n get now () { return now; },\n injectNow: injectNow,\n get defaultElement () { return defaultElement; },\n injectDefaultElement: injectDefaultElement,\n get animatedApi () { return animatedApi; },\n injectAnimatedApi: injectAnimatedApi,\n get createAnimatedStyle () { return createAnimatedStyle; },\n injectCreateAnimatedStyle: injectCreateAnimatedStyle,\n get manualFrameloop () { return manualFrameloop; },\n injectManualFrameloop: injectManualFrameloop\n});\n\n/**\n * Wraps the `style` property with `AnimatedStyle`.\n */\n\nclass AnimatedProps extends AnimatedObject {\n constructor(props, callback) {\n super();\n this.update = void 0;\n this.payload = !props.style ? props : _extends({}, props, {\n style: createAnimatedStyle(props.style)\n });\n this.update = callback;\n this.attach();\n }\n\n}\n\nconst isFunctionComponent = val => is.fun(val) && !(val.prototype instanceof React.Component);\n\nconst createAnimatedComponent = Component => {\n const AnimatedComponent = forwardRef((props, ref) => {\n const forceUpdate = useForceUpdate();\n const mounted = useRef(true);\n const propsAnimated = useRef(null);\n const node = useRef(null);\n const attachProps = useCallback(props => {\n const oldPropsAnimated = propsAnimated.current;\n\n const callback = () => {\n let didUpdate = false;\n\n if (node.current) {\n didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue());\n }\n\n if (!node.current || didUpdate === false) {\n // If no referenced node has been found, or the update target didn't have a\n // native-responder, then forceUpdate the animation ...\n forceUpdate();\n }\n };\n\n propsAnimated.current = new AnimatedProps(props, callback);\n oldPropsAnimated && oldPropsAnimated.detach();\n }, []);\n useEffect(() => () => {\n mounted.current = false;\n propsAnimated.current && propsAnimated.current.detach();\n }, []);\n useImperativeHandle(ref, () => animatedApi(node, mounted, forceUpdate));\n attachProps(props);\n\n const _getValue = propsAnimated.current.getValue(),\n scrollTop = _getValue.scrollTop,\n scrollLeft = _getValue.scrollLeft,\n animatedProps = _objectWithoutPropertiesLoose(_getValue, [\"scrollTop\", \"scrollLeft\"]); // Functions cannot have refs, see:\n // See: https://github.com/react-spring/react-spring/issues/569\n\n\n const refFn = isFunctionComponent(Component) ? undefined : childRef => node.current = handleRef(childRef, ref);\n return React.createElement(Component, _extends({}, animatedProps, {\n ref: refFn\n }));\n });\n return AnimatedComponent;\n};\n\nlet active = false;\nconst controllers = new Set();\n\nconst update = () => {\n if (!active) return false;\n let time = now();\n\n for (let controller of controllers) {\n let isActive = false;\n\n for (let configIdx = 0; configIdx < controller.configs.length; configIdx++) {\n let config = controller.configs[configIdx];\n let endOfAnimation, lastTime;\n\n for (let valIdx = 0; valIdx < config.animatedValues.length; valIdx++) {\n let animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude\n\n if (animation.done) continue;\n let from = config.fromValues[valIdx];\n let to = config.toValues[valIdx];\n let position = animation.lastPosition;\n let isAnimated = to instanceof Animated;\n let velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity;\n if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state\n\n if (config.immediate) {\n animation.setValue(to);\n animation.done = true;\n continue;\n } // Break animation when string values are involved\n\n\n if (typeof from === 'string' || typeof to === 'string') {\n animation.setValue(to);\n animation.done = true;\n continue;\n }\n\n if (config.duration !== void 0) {\n /** Duration easing */\n position = from + config.easing((time - animation.startTime) / config.duration) * (to - from);\n endOfAnimation = time >= animation.startTime + config.duration;\n } else if (config.decay) {\n /** Decay easing */\n position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime)));\n endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1;\n if (endOfAnimation) to = position;\n } else {\n /** Spring easing */\n lastTime = animation.lastTime !== void 0 ? animation.lastTime : time;\n velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end.\n\n if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/\n\n let numSteps = Math.floor(time - lastTime);\n\n for (let i = 0; i < numSteps; ++i) {\n let force = -config.tension * (position - to);\n let damping = -config.friction * velocity;\n let acceleration = (force + damping) / config.mass;\n velocity = velocity + acceleration * 1 / 1000;\n position = position + velocity * 1 / 1000;\n } // Conditions for stopping the spring animation\n\n\n let isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false;\n let isVelocity = Math.abs(velocity) <= config.precision;\n let isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true;\n endOfAnimation = isOvershooting || isVelocity && isDisplacement;\n animation.lastVelocity = velocity;\n animation.lastTime = time;\n } // Trails aren't done until their parents conclude\n\n\n if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false;\n\n if (endOfAnimation) {\n // Ensure that we end up with a round value\n if (animation.value !== to) position = to;\n animation.done = true;\n } else isActive = true;\n\n animation.setValue(position);\n animation.lastPosition = position;\n } // Keep track of updated values only when necessary\n\n\n if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue();\n } // Update callbacks in the end of the frame\n\n\n if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame\n\n if (!isActive) {\n controllers.delete(controller);\n controller.stop(true);\n }\n } // Loop over as long as there are controllers ...\n\n\n if (controllers.size) {\n if (manualFrameloop) manualFrameloop();else requestFrame(update);\n } else {\n active = false;\n }\n\n return active;\n};\n\nconst start = controller => {\n if (!controllers.has(controller)) controllers.add(controller);\n\n if (!active) {\n active = true;\n if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update);\n }\n};\n\nconst stop = controller => {\n if (controllers.has(controller)) controllers.delete(controller);\n};\n\nfunction createInterpolator(range, output, extrapolate) {\n if (typeof range === 'function') {\n return range;\n }\n\n if (Array.isArray(range)) {\n return createInterpolator({\n range,\n output: output,\n extrapolate\n });\n }\n\n if (interpolation && typeof range.output[0] === 'string') {\n return interpolation(range);\n }\n\n const config = range;\n const outputRange = config.output;\n const inputRange = config.range || [0, 1];\n const extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';\n const extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';\n\n const easing = config.easing || (t => t);\n\n return input => {\n const range = findRange(input, inputRange);\n return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);\n };\n}\n\nfunction interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {\n let result = map ? map(input) : input; // Extrapolate\n\n if (result < inputMin) {\n if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin;\n }\n\n if (result > inputMax) {\n if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax;\n }\n\n if (outputMin === outputMax) return outputMin;\n if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range\n\n if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing\n\n result = easing(result); // Output Range\n\n if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin;\n return result;\n}\n\nfunction findRange(input, inputRange) {\n for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break;\n\n return i - 1;\n}\n\nclass AnimatedInterpolation extends AnimatedArray {\n constructor(parents, range, output, extrapolate) {\n super();\n this.calc = void 0;\n this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents];\n this.calc = createInterpolator(range, output, extrapolate);\n }\n\n getValue() {\n return this.calc(...this.payload.map(value => value.getValue()));\n }\n\n updateConfig(range, output, extrapolate) {\n this.calc = createInterpolator(range, output, extrapolate);\n }\n\n interpolate(range, output, extrapolate) {\n return new AnimatedInterpolation(this, range, output, extrapolate);\n }\n\n}\n\nconst interpolate$1 = (parents, range, output) => parents && new AnimatedInterpolation(parents, range, output);\n\nconst config = {\n default: {\n tension: 170,\n friction: 26\n },\n gentle: {\n tension: 120,\n friction: 14\n },\n wobbly: {\n tension: 180,\n friction: 12\n },\n stiff: {\n tension: 210,\n friction: 20\n },\n slow: {\n tension: 280,\n friction: 60\n },\n molasses: {\n tension: 280,\n friction: 120\n }\n};\n\n/** API\n * useChain(references, timeSteps, timeFrame)\n */\n\nfunction useChain(refs, timeSteps, timeFrame) {\n if (timeFrame === void 0) {\n timeFrame = 1000;\n }\n\n const previous = useRef();\n useEffect(() => {\n if (is.equ(refs, previous.current)) refs.forEach((_ref) => {\n let current = _ref.current;\n return current && current.start();\n });else if (timeSteps) {\n refs.forEach((_ref2, index) => {\n let current = _ref2.current;\n\n if (current) {\n const ctrls = current.controllers;\n\n if (ctrls.length) {\n const t = timeFrame * timeSteps[index];\n ctrls.forEach(ctrl => {\n ctrl.queue = ctrl.queue.map(e => _extends({}, e, {\n delay: e.delay + t\n }));\n ctrl.start();\n });\n }\n }\n });\n } else refs.reduce((q, _ref3, rI) => {\n let current = _ref3.current;\n return q = q.then(() => current.start());\n }, Promise.resolve());\n previous.current = refs;\n });\n}\n\n/**\n * Animated works by building a directed acyclic graph of dependencies\n * transparently when you render your Animated components.\n *\n * new Animated.Value(0)\n * .interpolate() .interpolate() new Animated.Value(1)\n * opacity translateY scale\n * style transform\n * View#234 style\n * View#123\n *\n * A) Top Down phase\n * When an AnimatedValue is updated, we recursively go down through this\n * graph in order to find leaf nodes: the views that we flag as needing\n * an update.\n *\n * B) Bottom Up phase\n * When a view is flagged as needing an update, we recursively go back up\n * in order to build the new value that it needs. The reason why we need\n * this two-phases process is to deal with composite props such as\n * transform which can receive values from multiple parents.\n */\nfunction addAnimatedStyles(node, styles) {\n if ('update' in node) {\n styles.add(node);\n } else {\n node.getChildren().forEach(child => addAnimatedStyles(child, styles));\n }\n}\n\nclass AnimatedValue extends Animated {\n constructor(_value) {\n var _this;\n\n super();\n _this = this;\n this.animatedStyles = new Set();\n this.value = void 0;\n this.startPosition = void 0;\n this.lastPosition = void 0;\n this.lastVelocity = void 0;\n this.startTime = void 0;\n this.lastTime = void 0;\n this.done = false;\n\n this.setValue = function (value, flush) {\n if (flush === void 0) {\n flush = true;\n }\n\n _this.value = value;\n if (flush) _this.flush();\n };\n\n this.value = _value;\n this.startPosition = _value;\n this.lastPosition = _value;\n }\n\n flush() {\n if (this.animatedStyles.size === 0) {\n addAnimatedStyles(this, this.animatedStyles);\n }\n\n this.animatedStyles.forEach(animatedStyle => animatedStyle.update());\n }\n\n clearStyles() {\n this.animatedStyles.clear();\n }\n\n getValue() {\n return this.value;\n }\n\n interpolate(range, output, extrapolate) {\n return new AnimatedInterpolation(this, range, output, extrapolate);\n }\n\n}\n\nclass AnimatedValueArray extends AnimatedArray {\n constructor(values) {\n super();\n this.payload = values.map(n => new AnimatedValue(n));\n }\n\n setValue(value, flush) {\n if (flush === void 0) {\n flush = true;\n }\n\n if (Array.isArray(value)) {\n if (value.length === this.payload.length) {\n value.forEach((v, i) => this.payload[i].setValue(v, flush));\n }\n } else {\n this.payload.forEach(p => p.setValue(value, flush));\n }\n }\n\n getValue() {\n return this.payload.map(v => v.getValue());\n }\n\n interpolate(range, output) {\n return new AnimatedInterpolation(this, range, output);\n }\n\n}\n\nlet G = 0;\n\nclass Controller {\n constructor() {\n this.id = void 0;\n this.idle = true;\n this.hasChanged = false;\n this.guid = 0;\n this.local = 0;\n this.props = {};\n this.merged = {};\n this.animations = {};\n this.interpolations = {};\n this.values = {};\n this.configs = [];\n this.listeners = [];\n this.queue = [];\n this.localQueue = void 0;\n\n this.getValues = () => this.interpolations;\n\n this.id = G++;\n }\n /** update(props)\n * This function filters input props and creates an array of tasks which are executed in .start()\n * Each task is allowed to carry a delay, which means it can execute asnychroneously */\n\n\n update(args) {\n //this._id = n + this.id\n if (!args) return this; // Extract delay and the to-prop from props\n\n const _ref = interpolateTo(args),\n _ref$delay = _ref.delay,\n delay = _ref$delay === void 0 ? 0 : _ref$delay,\n to = _ref.to,\n props = _objectWithoutPropertiesLoose(_ref, [\"delay\", \"to\"]);\n\n if (is.arr(to) || is.fun(to)) {\n // If config is either a function or an array queue it up as is\n this.queue.push(_extends({}, props, {\n delay,\n to\n }));\n } else if (to) {\n // Otherwise go through each key since it could be delayed individually\n let ops = {};\n Object.entries(to).forEach((_ref2) => {\n let k = _ref2[0],\n v = _ref2[1];\n\n // Fetch delay and create an entry, consisting of the to-props, the delay, and basic props\n const entry = _extends({\n to: {\n [k]: v\n },\n delay: callProp(delay, k)\n }, props);\n\n const previous = ops[entry.delay] && ops[entry.delay].to;\n ops[entry.delay] = _extends({}, ops[entry.delay], entry, {\n to: _extends({}, previous, entry.to)\n });\n });\n this.queue = Object.values(ops);\n } // Sort queue, so that async calls go last\n\n\n this.queue = this.queue.sort((a, b) => a.delay - b.delay); // Diff the reduced props immediately (they'll contain the from-prop and some config)\n\n this.diff(props);\n return this;\n }\n /** start(onEnd)\n * This function either executes a queue, if present, or starts the frameloop, which animates */\n\n\n start(onEnd) {\n // If a queue is present we must excecute it\n if (this.queue.length) {\n this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values\n\n if (this.localQueue) {\n this.localQueue.forEach((_ref3) => {\n let _ref3$from = _ref3.from,\n from = _ref3$from === void 0 ? {} : _ref3$from,\n _ref3$to = _ref3.to,\n to = _ref3$to === void 0 ? {} : _ref3$to;\n if (is.obj(from)) this.merged = _extends({}, from, this.merged);\n if (is.obj(to)) this.merged = _extends({}, this.merged, to);\n });\n } // The guid helps us tracking frames, a new queue over an old one means an override\n // We discard async calls in that caseÃ\n\n\n const local = this.local = ++this.guid;\n const queue = this.localQueue = this.queue;\n this.queue = []; // Go through each entry and execute it\n\n queue.forEach((_ref4, index) => {\n let delay = _ref4.delay,\n props = _objectWithoutPropertiesLoose(_ref4, [\"delay\"]);\n\n const cb = finished => {\n if (index === queue.length - 1 && local === this.guid && finished) {\n this.idle = true;\n if (this.props.onRest) this.props.onRest(this.merged);\n }\n\n if (onEnd) onEnd();\n }; // Entries can be delayed, ansyc or immediate\n\n\n let async = is.arr(props.to) || is.fun(props.to);\n\n if (delay) {\n setTimeout(() => {\n if (local === this.guid) {\n if (async) this.runAsync(props, cb);else this.diff(props).start(cb);\n }\n }, delay);\n } else if (async) this.runAsync(props, cb);else this.diff(props).start(cb);\n });\n } // Otherwise we kick of the frameloop\n else {\n if (is.fun(onEnd)) this.listeners.push(onEnd);\n if (this.props.onStart) this.props.onStart();\n start(this);\n }\n\n return this;\n }\n\n stop(finished) {\n this.listeners.forEach(onEnd => onEnd(finished));\n this.listeners = [];\n return this;\n }\n /** Pause sets onEnd listeners free, but also removes the controller from the frameloop */\n\n\n pause(finished) {\n this.stop(true);\n if (finished) stop(this);\n return this;\n }\n\n runAsync(_ref5, onEnd) {\n var _this = this;\n\n let delay = _ref5.delay,\n props = _objectWithoutPropertiesLoose(_ref5, [\"delay\"]);\n\n const local = this.local; // If \"to\" is either a function or an array it will be processed async, therefor \"to\" should be empty right now\n // If the view relies on certain values \"from\" has to be present\n\n let queue = Promise.resolve(undefined);\n\n if (is.arr(props.to)) {\n for (let i = 0; i < props.to.length; i++) {\n const index = i;\n\n const fresh = _extends({}, props, interpolateTo(props.to[index]));\n\n if (is.arr(fresh.config)) fresh.config = fresh.config[index];\n queue = queue.then(() => {\n //this.stop()\n if (local === this.guid) return new Promise(r => this.diff(fresh).start(r));\n });\n }\n } else if (is.fun(props.to)) {\n let index = 0;\n let last;\n queue = queue.then(() => props.to( // next(props)\n p => {\n const fresh = _extends({}, props, interpolateTo(p));\n\n if (is.arr(fresh.config)) fresh.config = fresh.config[index];\n index++; //this.stop()\n\n if (local === this.guid) return last = new Promise(r => this.diff(fresh).start(r));\n return;\n }, // cancel()\n function (finished) {\n if (finished === void 0) {\n finished = true;\n }\n\n return _this.stop(finished);\n }).then(() => last));\n }\n\n queue.then(onEnd);\n }\n\n diff(props) {\n this.props = _extends({}, this.props, props);\n let _this$props = this.props,\n _this$props$from = _this$props.from,\n from = _this$props$from === void 0 ? {} : _this$props$from,\n _this$props$to = _this$props.to,\n to = _this$props$to === void 0 ? {} : _this$props$to,\n _this$props$config = _this$props.config,\n config = _this$props$config === void 0 ? {} : _this$props$config,\n reverse = _this$props.reverse,\n attach = _this$props.attach,\n reset = _this$props.reset,\n immediate = _this$props.immediate; // Reverse values when requested\n\n if (reverse) {\n var _ref6 = [to, from];\n from = _ref6[0];\n to = _ref6[1];\n } // This will collect all props that were ever set, reset merged props when necessary\n\n\n this.merged = _extends({}, from, this.merged, to);\n this.hasChanged = false; // Attachment handling, trailed springs can \"attach\" themselves to a previous spring\n\n let target = attach && attach(this); // Reduces input { name: value } pairs into animated values\n\n this.animations = Object.entries(this.merged).reduce((acc, _ref7) => {\n let name = _ref7[0],\n value = _ref7[1];\n // Issue cached entries, except on reset\n let entry = acc[name] || {}; // Figure out what the value is supposed to be\n\n const isNumber = is.num(value);\n const isString = is.str(value) && !value.startsWith('#') && !/\\d/.test(value) && !colorNames[value];\n const isArray = is.arr(value);\n const isInterpolation = !isNumber && !isArray && !isString;\n let fromValue = !is.und(from[name]) ? from[name] : value;\n let toValue = isNumber || isArray ? value : isString ? value : 1;\n let toConfig = callProp(config, name);\n if (target) toValue = target.animations[name].parent;\n let parent = entry.parent,\n interpolation$$1 = entry.interpolation,\n toValues = toArray(target ? toValue.getPayload() : toValue),\n animatedValues;\n let newValue = value;\n if (isInterpolation) newValue = interpolation({\n range: [0, 1],\n output: [value, value]\n })(1);\n let currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags\n\n const isFirst = is.und(parent);\n const isActive = !isFirst && entry.animatedValues.some(v => !v.done);\n const currentValueDiffersFromGoal = !is.equ(newValue, currentValue);\n const hasNewGoal = !is.equ(newValue, entry.previous);\n const hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one)\n // and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?)\n\n if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) {\n // Convert regular values into animated values, ALWAYS re-use if possible\n if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) {\n let prev = entry.interpolation && entry.interpolation.calc(entry.parent.value);\n prev = prev !== void 0 && !reset ? prev : fromValue;\n\n if (entry.parent) {\n parent = entry.parent;\n parent.setValue(0, false);\n } else parent = new AnimatedValue(0);\n\n const range = {\n output: [prev, value]\n };\n\n if (entry.interpolation) {\n interpolation$$1 = entry.interpolation;\n entry.interpolation.updateConfig(range);\n } else interpolation$$1 = parent.interpolate(range);\n }\n toValues = toArray(target ? toValue.getPayload() : toValue);\n animatedValues = toArray(parent.getPayload());\n if (reset && !isInterpolation) parent.setValue(fromValue, false);\n this.hasChanged = true; // Reset animated values\n\n animatedValues.forEach(value => {\n value.startPosition = value.value;\n value.lastPosition = value.value;\n value.lastVelocity = isActive ? value.lastVelocity : undefined;\n value.lastTime = isActive ? value.lastTime : undefined;\n value.startTime = now();\n value.done = false;\n value.animatedStyles.clear();\n }); // Set immediate values\n\n if (callProp(immediate, name)) {\n parent.setValue(isInterpolation ? toValue : value, false);\n }\n\n return _extends({}, acc, {\n [name]: _extends({}, entry, {\n name,\n parent,\n interpolation: interpolation$$1,\n animatedValues,\n toValues,\n previous: newValue,\n config: toConfig,\n fromValues: toArray(parent.getValue()),\n immediate: callProp(immediate, name),\n initialVelocity: withDefault(toConfig.velocity, 0),\n clamp: withDefault(toConfig.clamp, false),\n precision: withDefault(toConfig.precision, 0.01),\n tension: withDefault(toConfig.tension, 170),\n friction: withDefault(toConfig.friction, 26),\n mass: withDefault(toConfig.mass, 1),\n duration: toConfig.duration,\n easing: withDefault(toConfig.easing, t => t),\n decay: toConfig.decay\n })\n });\n } else {\n if (!currentValueDiffersFromGoal) {\n // So ... the current target value (newValue) appears to be different from the previous value,\n // which normally constitutes an update, but the actual value (currentValue) matches the target!\n // In order to resolve this without causing an animation update we silently flag the animation as done,\n // which it technically is. Interpolations also needs a config update with their target set to 1.\n if (isInterpolation) {\n parent.setValue(1, false);\n interpolation$$1.updateConfig({\n output: [newValue, newValue]\n });\n }\n\n parent.done = true;\n this.hasChanged = true;\n return _extends({}, acc, {\n [name]: _extends({}, acc[name], {\n previous: newValue\n })\n });\n }\n\n return acc;\n }\n }, this.animations);\n\n if (this.hasChanged) {\n // Make animations available to frameloop\n this.configs = Object.values(this.animations);\n this.values = {};\n this.interpolations = {};\n\n for (let key in this.animations) {\n this.interpolations[key] = this.animations[key].interpolation;\n this.values[key] = this.animations[key].interpolation.getValue();\n }\n }\n\n return this;\n }\n\n destroy() {\n this.stop();\n this.props = {};\n this.merged = {};\n this.animations = {};\n this.interpolations = {};\n this.values = {};\n this.configs = [];\n this.local = 0;\n }\n\n}\n\n/** API\n * const props = useSprings(number, [{ ... }, { ... }, ...])\n * const [props, set] = useSprings(number, (i, controller) => ({ ... }))\n */\n\nconst useSprings = (length, props) => {\n const mounted = useRef(false);\n const ctrl = useRef();\n const isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations\n\n const _useMemo = useMemo(() => {\n // Remove old controllers\n if (ctrl.current) {\n ctrl.current.map(c => c.destroy());\n ctrl.current = undefined;\n }\n\n let ref;\n return [new Array(length).fill().map((_, i) => {\n const ctrl = new Controller();\n const newProps = isFn ? callProp(props, i, ctrl) : props[i];\n if (i === 0) ref = newProps.ref;\n ctrl.update(newProps);\n if (!ref) ctrl.start();\n return ctrl;\n }), ref];\n }, [length]),\n controllers = _useMemo[0],\n ref = _useMemo[1];\n\n ctrl.current = controllers; // The hooks reference api gets defined here ...\n\n const api = useImperativeHandle(ref, () => ({\n start: () => Promise.all(ctrl.current.map(c => new Promise(r => c.start(r)))),\n stop: finished => ctrl.current.forEach(c => c.stop(finished)),\n\n get controllers() {\n return ctrl.current;\n }\n\n })); // This function updates the controllers\n\n const updateCtrl = useMemo(() => updateProps => ctrl.current.map((c, i) => {\n c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]);\n if (!ref) c.start();\n }), [length]); // Update controller if props aren't functional\n\n useEffect(() => {\n if (mounted.current) {\n if (!isFn) updateCtrl(props);\n } else if (!ref) ctrl.current.forEach(c => c.start());\n }); // Update mounted flag and destroy controller on unmount\n\n useEffect(() => (mounted.current = true, () => ctrl.current.forEach(c => c.destroy())), []); // Return animated props, or, anim-props + the update-setter above\n\n const propValues = ctrl.current.map(c => c.getValues());\n return isFn ? [propValues, updateCtrl, finished => ctrl.current.forEach(c => c.pause(finished))] : propValues;\n};\n\n/** API\n * const props = useSpring({ ... })\n * const [props, set] = useSpring(() => ({ ... }))\n */\n\nconst useSpring = props => {\n const isFn = is.fun(props);\n\n const _useSprings = useSprings(1, isFn ? props : [props]),\n result = _useSprings[0],\n set = _useSprings[1],\n pause = _useSprings[2];\n\n return isFn ? [result[0], set, pause] : result;\n};\n\n/** API\n * const trails = useTrail(number, { ... })\n * const [trails, set] = useTrail(number, () => ({ ... }))\n */\n\nconst useTrail = (length, props) => {\n const mounted = useRef(false);\n const isFn = is.fun(props);\n const updateProps = callProp(props);\n const instances = useRef();\n\n const _useSprings = useSprings(length, (i, ctrl) => {\n if (i === 0) instances.current = [];\n instances.current.push(ctrl);\n return _extends({}, updateProps, {\n config: callProp(updateProps.config, i),\n attach: i > 0 && (() => instances.current[i - 1])\n });\n }),\n result = _useSprings[0],\n set = _useSprings[1],\n pause = _useSprings[2]; // Set up function to update controller\n\n\n const updateCtrl = useMemo(() => props => set((i, ctrl) => {\n const last = props.reverse ? i === 0 : length - 1 === i;\n const attachIdx = props.reverse ? i + 1 : i - 1;\n const attachController = instances.current[attachIdx];\n return _extends({}, props, {\n config: callProp(props.config || updateProps.config, i),\n attach: attachController && (() => attachController)\n });\n }), [length, updateProps.reverse]); // Update controller if props aren't functional\n\n useEffect(() => void (mounted.current && !isFn && updateCtrl(props))); // Update mounted flag and destroy controller on unmount\n\n useEffect(() => void (mounted.current = true), []);\n return isFn ? [result, updateCtrl, pause] : result;\n};\n\n/** API\n * const transitions = useTransition(items, itemKeys, { ... })\n * const [transitions, update] = useTransition(items, itemKeys, () => ({ ... }))\n */\n\nlet guid = 0;\nconst ENTER = 'enter';\nconst LEAVE = 'leave';\nconst UPDATE = 'update';\n\nconst mapKeys = (items, keys) => (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String);\n\nconst get = props => {\n let items = props.items,\n _props$keys = props.keys,\n keys = _props$keys === void 0 ? item => item : _props$keys,\n rest = _objectWithoutPropertiesLoose(props, [\"items\", \"keys\"]);\n\n items = toArray(items !== void 0 ? items : null);\n return _extends({\n items,\n keys: mapKeys(items, keys)\n }, rest);\n};\n\nfunction useTransition(input, keyTransform, config) {\n const props = _extends({\n items: input,\n keys: keyTransform || (i => i)\n }, config);\n\n const _get = get(props),\n _get$lazy = _get.lazy,\n lazy = _get$lazy === void 0 ? false : _get$lazy,\n _get$unique = _get.unique,\n _get$reset = _get.reset,\n reset = _get$reset === void 0 ? false : _get$reset,\n enter = _get.enter,\n leave = _get.leave,\n update = _get.update,\n onDestroyed = _get.onDestroyed,\n keys = _get.keys,\n items = _get.items,\n onFrame = _get.onFrame,\n _onRest = _get.onRest,\n onStart = _get.onStart,\n ref = _get.ref,\n extra = _objectWithoutPropertiesLoose(_get, [\"lazy\", \"unique\", \"reset\", \"enter\", \"leave\", \"update\", \"onDestroyed\", \"keys\", \"items\", \"onFrame\", \"onRest\", \"onStart\", \"ref\"]);\n\n const forceUpdate = useForceUpdate();\n const mounted = useRef(false);\n const state = useRef({\n mounted: false,\n first: true,\n deleted: [],\n current: {},\n transitions: [],\n prevProps: {},\n paused: !!props.ref,\n instances: !mounted.current && new Map(),\n forceUpdate\n });\n useImperativeHandle(props.ref, () => ({\n start: () => Promise.all(Array.from(state.current.instances).map((_ref) => {\n let c = _ref[1];\n return new Promise(r => c.start(r));\n })),\n stop: finished => Array.from(state.current.instances).forEach((_ref2) => {\n let c = _ref2[1];\n return c.stop(finished);\n }),\n\n get controllers() {\n return Array.from(state.current.instances).map((_ref3) => {\n let c = _ref3[1];\n return c;\n });\n }\n\n })); // Update state\n\n state.current = diffItems(state.current, props);\n\n if (state.current.changed) {\n // Update state\n state.current.transitions.forEach(transition => {\n const slot = transition.slot,\n from = transition.from,\n to = transition.to,\n config = transition.config,\n trail = transition.trail,\n key = transition.key,\n item = transition.item;\n if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object\n\n const ctrl = state.current.instances.get(key);\n\n const newProps = _extends({}, extra, {\n to,\n from,\n config,\n ref,\n onRest: values => {\n if (state.current.mounted) {\n if (transition.destroyed) {\n // If no ref is given delete destroyed items immediately\n if (!ref && !lazy) cleanUp(state, key);\n if (onDestroyed) onDestroyed(item);\n } // A transition comes to rest once all its springs conclude\n\n\n const curInstances = Array.from(state.current.instances);\n const active = curInstances.some((_ref4) => {\n let c = _ref4[1];\n return !c.idle;\n });\n if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state);\n if (_onRest) _onRest(item, slot, values);\n }\n },\n onStart: onStart && (() => onStart(item, slot)),\n onFrame: onFrame && (values => onFrame(item, slot, values)),\n delay: trail,\n reset: reset && slot === ENTER // Update controller\n\n });\n\n ctrl.update(newProps);\n if (!state.current.paused) ctrl.start();\n });\n }\n\n useEffect(() => {\n state.current.mounted = mounted.current = true;\n return () => {\n state.current.mounted = mounted.current = false;\n Array.from(state.current.instances).map((_ref5) => {\n let c = _ref5[1];\n return c.destroy();\n });\n state.current.instances.clear();\n };\n }, []);\n return state.current.transitions.map((_ref6) => {\n let item = _ref6.item,\n slot = _ref6.slot,\n key = _ref6.key;\n return {\n item,\n key,\n state: slot,\n props: state.current.instances.get(key).getValues()\n };\n });\n}\n\nfunction cleanUp(state, filterKey) {\n const deleted = state.current.deleted;\n\n for (let _ref7 of deleted) {\n let key = _ref7.key;\n\n const filter = t => t.key !== key;\n\n if (is.und(filterKey) || filterKey === key) {\n state.current.instances.delete(key);\n state.current.transitions = state.current.transitions.filter(filter);\n state.current.deleted = state.current.deleted.filter(filter);\n }\n }\n\n state.current.forceUpdate();\n}\n\nfunction diffItems(_ref8, props) {\n let first = _ref8.first,\n prevProps = _ref8.prevProps,\n state = _objectWithoutPropertiesLoose(_ref8, [\"first\", \"prevProps\"]);\n\n let _get2 = get(props),\n items = _get2.items,\n keys = _get2.keys,\n initial = _get2.initial,\n from = _get2.from,\n enter = _get2.enter,\n leave = _get2.leave,\n update = _get2.update,\n _get2$trail = _get2.trail,\n trail = _get2$trail === void 0 ? 0 : _get2$trail,\n unique = _get2.unique,\n config = _get2.config,\n _get2$order = _get2.order,\n order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order;\n\n let _get3 = get(prevProps),\n _keys = _get3.keys,\n _items = _get3.items;\n\n let current = _extends({}, state.current);\n\n let deleted = [...state.deleted]; // Compare next keys with current keys\n\n let currentKeys = Object.keys(current);\n let currentSet = new Set(currentKeys);\n let nextSet = new Set(keys);\n let added = keys.filter(item => !currentSet.has(item));\n let removed = state.transitions.filter(item => !item.destroyed && !nextSet.has(item.originalKey)).map(i => i.originalKey);\n let updated = keys.filter(item => currentSet.has(item));\n let delay = -trail;\n\n while (order.length) {\n const changeType = order.shift();\n\n switch (changeType) {\n case ENTER:\n {\n added.forEach((key, index) => {\n // In unique mode, remove fading out transitions if their key comes in again\n if (unique && deleted.find(d => d.originalKey === key)) deleted = deleted.filter(t => t.originalKey !== key);\n const keyIndex = keys.indexOf(key);\n const item = items[keyIndex];\n const slot = first && initial !== void 0 ? 'initial' : ENTER;\n current[key] = {\n slot,\n originalKey: key,\n key: unique ? String(key) : guid++,\n item,\n trail: delay = delay + trail,\n config: callProp(config, item, slot),\n from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item),\n to: callProp(enter, item)\n };\n });\n break;\n }\n\n case LEAVE:\n {\n removed.forEach(key => {\n const keyIndex = _keys.indexOf(key);\n\n const item = _items[keyIndex];\n const slot = LEAVE;\n deleted.unshift(_extends({}, current[key], {\n slot,\n destroyed: true,\n left: _keys[Math.max(0, keyIndex - 1)],\n right: _keys[Math.min(_keys.length, keyIndex + 1)],\n trail: delay = delay + trail,\n config: callProp(config, item, slot),\n to: callProp(leave, item)\n }));\n delete current[key];\n });\n break;\n }\n\n case UPDATE:\n {\n updated.forEach(key => {\n const keyIndex = keys.indexOf(key);\n const item = items[keyIndex];\n const slot = UPDATE;\n current[key] = _extends({}, current[key], {\n item,\n slot,\n trail: delay = delay + trail,\n config: callProp(config, item, slot),\n to: callProp(update, item)\n });\n });\n break;\n }\n }\n }\n\n let out = keys.map(key => current[key]); // This tries to restore order for deleted items by finding their last known siblings\n // only using the left sibling to keep order placement consistent for all deleted items\n\n deleted.forEach((_ref9) => {\n let left = _ref9.left,\n right = _ref9.right,\n item = _objectWithoutPropertiesLoose(_ref9, [\"left\", \"right\"]);\n\n let pos; // Was it the element on the left, if yes, move there ...\n\n if ((pos = out.findIndex(t => t.originalKey === left)) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\\_(ツ)_/¯\n\n pos = Math.max(0, pos);\n out = [...out.slice(0, pos), item, ...out.slice(pos)];\n });\n return _extends({}, state, {\n changed: added.length || removed.length || updated.length,\n first: first && added.length === 0,\n transitions: out,\n current,\n deleted,\n prevProps: props\n });\n}\n\nclass AnimatedStyle extends AnimatedObject {\n constructor(style) {\n if (style === void 0) {\n style = {};\n }\n\n super();\n\n if (style.transform && !(style.transform instanceof Animated)) {\n style = applyAnimatedValues.transform(style);\n }\n\n this.payload = style;\n }\n\n}\n\n// http://www.w3.org/TR/css3-color/#svg-color\nconst colors = {\n transparent: 0x00000000,\n aliceblue: 0xf0f8ffff,\n antiquewhite: 0xfaebd7ff,\n aqua: 0x00ffffff,\n aquamarine: 0x7fffd4ff,\n azure: 0xf0ffffff,\n beige: 0xf5f5dcff,\n bisque: 0xffe4c4ff,\n black: 0x000000ff,\n blanchedalmond: 0xffebcdff,\n blue: 0x0000ffff,\n blueviolet: 0x8a2be2ff,\n brown: 0xa52a2aff,\n burlywood: 0xdeb887ff,\n burntsienna: 0xea7e5dff,\n cadetblue: 0x5f9ea0ff,\n chartreuse: 0x7fff00ff,\n chocolate: 0xd2691eff,\n coral: 0xff7f50ff,\n cornflowerblue: 0x6495edff,\n cornsilk: 0xfff8dcff,\n crimson: 0xdc143cff,\n cyan: 0x00ffffff,\n darkblue: 0x00008bff,\n darkcyan: 0x008b8bff,\n darkgoldenrod: 0xb8860bff,\n darkgray: 0xa9a9a9ff,\n darkgreen: 0x006400ff,\n darkgrey: 0xa9a9a9ff,\n darkkhaki: 0xbdb76bff,\n darkmagenta: 0x8b008bff,\n darkolivegreen: 0x556b2fff,\n darkorange: 0xff8c00ff,\n darkorchid: 0x9932ccff,\n darkred: 0x8b0000ff,\n darksalmon: 0xe9967aff,\n darkseagreen: 0x8fbc8fff,\n darkslateblue: 0x483d8bff,\n darkslategray: 0x2f4f4fff,\n darkslategrey: 0x2f4f4fff,\n darkturquoise: 0x00ced1ff,\n darkviolet: 0x9400d3ff,\n deeppink: 0xff1493ff,\n deepskyblue: 0x00bfffff,\n dimgray: 0x696969ff,\n dimgrey: 0x696969ff,\n dodgerblue: 0x1e90ffff,\n firebrick: 0xb22222ff,\n floralwhite: 0xfffaf0ff,\n forestgreen: 0x228b22ff,\n fuchsia: 0xff00ffff,\n gainsboro: 0xdcdcdcff,\n ghostwhite: 0xf8f8ffff,\n gold: 0xffd700ff,\n goldenrod: 0xdaa520ff,\n gray: 0x808080ff,\n green: 0x008000ff,\n greenyellow: 0xadff2fff,\n grey: 0x808080ff,\n honeydew: 0xf0fff0ff,\n hotpink: 0xff69b4ff,\n indianred: 0xcd5c5cff,\n indigo: 0x4b0082ff,\n ivory: 0xfffff0ff,\n khaki: 0xf0e68cff,\n lavender: 0xe6e6faff,\n lavenderblush: 0xfff0f5ff,\n lawngreen: 0x7cfc00ff,\n lemonchiffon: 0xfffacdff,\n lightblue: 0xadd8e6ff,\n lightcoral: 0xf08080ff,\n lightcyan: 0xe0ffffff,\n lightgoldenrodyellow: 0xfafad2ff,\n lightgray: 0xd3d3d3ff,\n lightgreen: 0x90ee90ff,\n lightgrey: 0xd3d3d3ff,\n lightpink: 0xffb6c1ff,\n lightsalmon: 0xffa07aff,\n lightseagreen: 0x20b2aaff,\n lightskyblue: 0x87cefaff,\n lightslategray: 0x778899ff,\n lightslategrey: 0x778899ff,\n lightsteelblue: 0xb0c4deff,\n lightyellow: 0xffffe0ff,\n lime: 0x00ff00ff,\n limegreen: 0x32cd32ff,\n linen: 0xfaf0e6ff,\n magenta: 0xff00ffff,\n maroon: 0x800000ff,\n mediumaquamarine: 0x66cdaaff,\n mediumblue: 0x0000cdff,\n mediumorchid: 0xba55d3ff,\n mediumpurple: 0x9370dbff,\n mediumseagreen: 0x3cb371ff,\n mediumslateblue: 0x7b68eeff,\n mediumspringgreen: 0x00fa9aff,\n mediumturquoise: 0x48d1ccff,\n mediumvioletred: 0xc71585ff,\n midnightblue: 0x191970ff,\n mintcream: 0xf5fffaff,\n mistyrose: 0xffe4e1ff,\n moccasin: 0xffe4b5ff,\n navajowhite: 0xffdeadff,\n navy: 0x000080ff,\n oldlace: 0xfdf5e6ff,\n olive: 0x808000ff,\n olivedrab: 0x6b8e23ff,\n orange: 0xffa500ff,\n orangered: 0xff4500ff,\n orchid: 0xda70d6ff,\n palegoldenrod: 0xeee8aaff,\n palegreen: 0x98fb98ff,\n paleturquoise: 0xafeeeeff,\n palevioletred: 0xdb7093ff,\n papayawhip: 0xffefd5ff,\n peachpuff: 0xffdab9ff,\n peru: 0xcd853fff,\n pink: 0xffc0cbff,\n plum: 0xdda0ddff,\n powderblue: 0xb0e0e6ff,\n purple: 0x800080ff,\n rebeccapurple: 0x663399ff,\n red: 0xff0000ff,\n rosybrown: 0xbc8f8fff,\n royalblue: 0x4169e1ff,\n saddlebrown: 0x8b4513ff,\n salmon: 0xfa8072ff,\n sandybrown: 0xf4a460ff,\n seagreen: 0x2e8b57ff,\n seashell: 0xfff5eeff,\n sienna: 0xa0522dff,\n silver: 0xc0c0c0ff,\n skyblue: 0x87ceebff,\n slateblue: 0x6a5acdff,\n slategray: 0x708090ff,\n slategrey: 0x708090ff,\n snow: 0xfffafaff,\n springgreen: 0x00ff7fff,\n steelblue: 0x4682b4ff,\n tan: 0xd2b48cff,\n teal: 0x008080ff,\n thistle: 0xd8bfd8ff,\n tomato: 0xff6347ff,\n turquoise: 0x40e0d0ff,\n violet: 0xee82eeff,\n wheat: 0xf5deb3ff,\n white: 0xffffffff,\n whitesmoke: 0xf5f5f5ff,\n yellow: 0xffff00ff,\n yellowgreen: 0x9acd32ff\n};\n\n// const INTEGER = '[-+]?\\\\d+';\nconst NUMBER = '[-+]?\\\\d*\\\\.?\\\\d+';\nconst PERCENTAGE = NUMBER + '%';\n\nfunction call() {\n for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {\n parts[_key] = arguments[_key];\n }\n\n return '\\\\(\\\\s*(' + parts.join(')\\\\s*,\\\\s*(') + ')\\\\s*\\\\)';\n}\n\nconst rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));\nconst rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));\nconst hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));\nconst hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));\nconst hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;\nconst hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;\nconst hex6 = /^#([0-9a-fA-F]{6})$/;\nconst hex8 = /^#([0-9a-fA-F]{8})$/;\n\n/*\nhttps://github.com/react-community/normalize-css-color\n\nBSD 3-Clause License\n\nCopyright (c) 2016, React Community\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\nfunction normalizeColor(color) {\n let match;\n\n if (typeof color === 'number') {\n return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null;\n } // Ordered based on occurrences on Facebook codebase\n\n\n if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0;\n if (colors.hasOwnProperty(color)) return colors[color];\n\n if (match = rgb.exec(color)) {\n return (parse255(match[1]) << 24 | // r\n parse255(match[2]) << 16 | // g\n parse255(match[3]) << 8 | // b\n 0x000000ff) >>> // a\n 0;\n }\n\n if (match = rgba.exec(color)) {\n return (parse255(match[1]) << 24 | // r\n parse255(match[2]) << 16 | // g\n parse255(match[3]) << 8 | // b\n parse1(match[4])) >>> // a\n 0;\n }\n\n if (match = hex3.exec(color)) {\n return parseInt(match[1] + match[1] + // r\n match[2] + match[2] + // g\n match[3] + match[3] + // b\n 'ff', // a\n 16) >>> 0;\n } // https://drafts.csswg.org/css-color-4/#hex-notation\n\n\n if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0;\n\n if (match = hex4.exec(color)) {\n return parseInt(match[1] + match[1] + // r\n match[2] + match[2] + // g\n match[3] + match[3] + // b\n match[4] + match[4], // a\n 16) >>> 0;\n }\n\n if (match = hsl.exec(color)) {\n return (hslToRgb(parse360(match[1]), // h\n parsePercentage(match[2]), // s\n parsePercentage(match[3]) // l\n ) | 0x000000ff) >>> // a\n 0;\n }\n\n if (match = hsla.exec(color)) {\n return (hslToRgb(parse360(match[1]), // h\n parsePercentage(match[2]), // s\n parsePercentage(match[3]) // l\n ) | parse1(match[4])) >>> // a\n 0;\n }\n\n return null;\n}\n\nfunction hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\n\nfunction hslToRgb(h, s, l) {\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n const r = hue2rgb(p, q, h + 1 / 3);\n const g = hue2rgb(p, q, h);\n const b = hue2rgb(p, q, h - 1 / 3);\n return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;\n}\n\nfunction parse255(str) {\n const int = parseInt(str, 10);\n if (int < 0) return 0;\n if (int > 255) return 255;\n return int;\n}\n\nfunction parse360(str) {\n const int = parseFloat(str);\n return (int % 360 + 360) % 360 / 360;\n}\n\nfunction parse1(str) {\n const num = parseFloat(str);\n if (num < 0) return 0;\n if (num > 1) return 255;\n return Math.round(num * 255);\n}\n\nfunction parsePercentage(str) {\n // parseFloat conveniently ignores the final %\n const int = parseFloat(str);\n if (int < 0) return 0;\n if (int > 100) return 1;\n return int / 100;\n}\n\nfunction colorToRgba(input) {\n let int32Color = normalizeColor(input);\n if (int32Color === null) return input;\n int32Color = int32Color || 0;\n let r = (int32Color & 0xff000000) >>> 24;\n let g = (int32Color & 0x00ff0000) >>> 16;\n let b = (int32Color & 0x0000ff00) >>> 8;\n let a = (int32Color & 0x000000ff) / 255;\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n} // Problem: https://github.com/animatedjs/animated/pull/102\n// Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662\n\n\nconst stringShapeRegex = /[+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g; // Covers rgb, rgba, hsl, hsla\n// Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e\n\nconst colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?\\d+%?[,\\s]+){2,3}\\s*[\\d\\.]+%?\\))/gi; // Covers color names (transparent, blue, etc.)\n\nconst colorNamesRegex = new RegExp(`(${Object.keys(colors).join('|')})`, 'g');\n/**\n * Supports string shapes by extracting numbers so new values can be computed,\n * and recombines those values into new strings of the same shape. Supports\n * things like:\n *\n * rgba(123, 42, 99, 0.36) // colors\n * -45deg // values with units\n * 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows\n */\n\nconst createStringInterpolator = config => {\n // Replace colors with rgba\n const outputRange = config.output.map(rangeValue => rangeValue.replace(colorRegex, colorToRgba)).map(rangeValue => rangeValue.replace(colorNamesRegex, colorToRgba));\n const outputRanges = outputRange[0].match(stringShapeRegex).map(() => []);\n outputRange.forEach(value => {\n value.match(stringShapeRegex).forEach((number, i) => outputRanges[i].push(+number));\n });\n const interpolations = outputRange[0].match(stringShapeRegex).map((_value, i) => createInterpolator(_extends({}, config, {\n output: outputRanges[i]\n })));\n return input => {\n let i = 0;\n return outputRange[0] // 'rgba(0, 100, 200, 0)'\n // ->\n // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...'\n .replace(stringShapeRegex, () => interpolations[i++](input)) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to\n // round the opacity (4th column).\n .replace(/rgba\\(([0-9\\.-]+), ([0-9\\.-]+), ([0-9\\.-]+), ([0-9\\.-]+)\\)/gi, (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`);\n };\n};\n\nlet isUnitlessNumber = {\n animationIterationCount: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFlexGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n columns: true,\n flex: true,\n flexGrow: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n flexOrder: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowSpan: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnSpan: true,\n gridColumnStart: true,\n fontWeight: true,\n lineClamp: true,\n lineHeight: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n // SVG-related properties\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true\n};\n\nconst prefixKey = (prefix, key) => prefix + key.charAt(0).toUpperCase() + key.substring(1);\n\nconst prefixes = ['Webkit', 'Ms', 'Moz', 'O'];\nisUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {\n prefixes.forEach(prefix => acc[prefixKey(prefix, prop)] = acc[prop]);\n return acc;\n}, isUnitlessNumber);\n\nfunction dangerousStyleValue(name, value, isCustomProperty) {\n if (value == null || typeof value === 'boolean' || value === '') return '';\n if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers\n\n return ('' + value).trim();\n}\n\nconst attributeCache = {};\ninjectCreateAnimatedStyle(style => new AnimatedStyle(style));\ninjectDefaultElement('div');\ninjectStringInterpolator(createStringInterpolator);\ninjectColorNames(colors);\ninjectApplyAnimatedValues((instance, props) => {\n if (instance.nodeType && instance.setAttribute !== undefined) {\n const style = props.style,\n children = props.children,\n scrollTop = props.scrollTop,\n scrollLeft = props.scrollLeft,\n attributes = _objectWithoutPropertiesLoose(props, [\"style\", \"children\", \"scrollTop\", \"scrollLeft\"]);\n\n const filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter';\n if (scrollTop !== void 0) instance.scrollTop = scrollTop;\n if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value\n\n if (children !== void 0) instance.textContent = children; // Set styles ...\n\n for (let styleName in style) {\n if (!style.hasOwnProperty(styleName)) continue;\n var isCustomProperty = styleName.indexOf('--') === 0;\n var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty);\n if (styleName === 'float') styleName = 'cssFloat';\n if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue;\n } // Set attributes ...\n\n\n for (let name in attributes) {\n // Attributes are written in dash case\n const dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, n => '-' + n.toLowerCase()));\n if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]);\n }\n\n return;\n } else return false;\n}, style => style);\n\nconst domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG\n'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];\n// Extend animated with all the available THREE elements\nconst apply = merge(createAnimatedComponent, false);\nconst extendedAnimated = apply(domElements);\n\nexport { apply, config, update, extendedAnimated as animated, extendedAnimated as a, interpolate$1 as interpolate, Globals, useSpring, useTrail, useTransition, useChain, useSprings };\n","// vector add\nexport function addV<T extends number[]>(v1: T, v2: T): T {\n return v1.map((v, i) => v + v2[i]) as T\n}\n\n// vector substract\nexport function subV<T extends number[]>(v1: T, v2: T): T {\n return v1.map((v, i) => v - v2[i]) as T\n}\n\n/**\n * Calculates distance\n * @param movement the difference between current and initial vectors\n * @returns distance\n */\nexport function calculateDistance(movement: number[]): number {\n return Math.hypot(...movement)\n}\n\ninterface Kinematics {\n velocities: number[]\n velocity: number\n distance: number\n direction: number[]\n}\n\nexport function calculateAllGeometry<T extends number[]>(movement: T, delta: T = movement) {\n const dl = calculateDistance(delta)\n\n const alpha = dl === 0 ? 0 : 1 / dl\n\n const direction = delta.map(v => alpha * v) as T\n const distance = calculateDistance(movement)\n\n return { distance, direction }\n}\n\n/**\n * Calculates all kinematics\n * @template T the expected vector type\n * @param movement the difference between current and initial vectors\n * @param delta the difference between current and previous vectors\n * @param delta_t the time difference between current and previous timestamps\n * @returns all kinematics\n */\nexport function calculateAllKinematics<T extends number[]>(movement: T, delta: T, dt: number): Kinematics {\n const dl = calculateDistance(delta)\n\n const alpha = dl === 0 ? 0 : 1 / dl\n const beta = dt === 0 ? 0 : 1 / dt\n\n const velocity = beta * dl\n const velocities = delta.map(v => beta * v)\n const direction = delta.map(v => alpha * v)\n const distance = calculateDistance(movement)\n\n return { velocities, velocity, distance, direction }\n}\n\n/**\n * Because IE doesn't support `Math.sign` function, so we use the polyfill version of the function.\n * This polyfill function is suggested by Mozilla:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill\n * @param x target number\n */\nexport function sign(x: number) {\n if (Math.sign) return Math.sign(x)\n return Number(x > 0) - Number(x < 0) || +x\n}\n","function minMax(value: number, min: number, max: number) {\n return Math.max(min, Math.min(value, max))\n}\n\n// Based on @aholachek ;)\n// https://twitter.com/chpwn/status/285540192096497664\n// iOS constant = 0.55\n\n// https://medium.com/@nathangitter/building-fluid-interfaces-ios-swift-9732bb934bf5\nfunction rubberband2(distance: number, constant: number) {\n // default constant from the article is 0.7\n return Math.pow(distance, constant * 5)\n}\n\nfunction rubberband(distance: number, dimension: number, constant: number) {\n if (dimension === 0 || Math.abs(dimension) === Infinity) return rubberband2(distance, constant)\n return (distance * dimension * constant) / (dimension + constant * distance)\n}\n\nexport function rubberbandIfOutOfBounds(position: number, min: number, max: number, constant = 0.15) {\n if (constant === 0) return minMax(position, min, max)\n if (position < min) return -rubberband(min - position, max - min, constant) + min\n if (position > max) return +rubberband(position - max, max - min, constant) + max\n return position\n}\n","export function noop() {}\n\n/**\n * TODO Beware that only optimized cases are covered in tests =)\n * TODO Need to cover general case as well\n *\n * @param fns\n */\nexport function chainFns(...fns: Function[]): Function {\n if (fns.length === 0) return noop\n if (fns.length === 1) return fns[0]\n\n return function (this: any) {\n var result\n for (let fn of fns) {\n result = fn.apply(this, arguments) || result\n }\n return result\n }\n}\n\n/**\n * Expects a simple value or 2D vector (an array with 2 elements) and\n * always returns 2D vector. If simple value is passed, returns a\n * vector with this value as both coordinates.\n *\n * @param value\n */\nexport function ensureVector<T>(value: T | [T, T] | undefined, fallback?: T | [T, T]): [T, T] {\n if (value === undefined) {\n if (fallback === undefined) {\n throw new Error('Must define fallback value if undefined is expected')\n }\n value = fallback\n }\n\n if (Array.isArray(value)) return value\n return [value, value]\n}\n\n/**\n * Helper for defining a default value\n *\n * @param value\n * @param fallback\n */\nexport function assignDefault<T extends Object>(value: Partial<T> | undefined, fallback: T): T {\n return Object.assign({}, fallback, value || {})\n}\n\n/**\n * Resolves getters (functions) by calling them\n * If simple value is given it just passes through\n *\n * @param v\n */\nexport function valueFn<T>(v: T | ((...args: any[]) => T), ...args: any[]): T {\n if (typeof v === 'function') {\n // @ts-ignore\n return v(...args)\n } else {\n return v\n }\n}\n","export type Resolver = (x: any, key: string, obj: object) => any\nexport type ResolverMap = { [k: string]: Resolver | ResolverMap | boolean }\n\nexport function resolveWith<T extends { [k: string]: any }, V extends { [k: string]: any }>(\n config: Partial<T> = {},\n resolvers: ResolverMap\n): V {\n const result: any = {}\n\n for (const [key, resolver] of Object.entries(resolvers))\n switch (typeof resolver) {\n case 'function':\n result[key] = resolver.call(result, config[key], key, config)\n break\n case 'object':\n result[key] = resolveWith(config[key], resolver)\n break\n case 'boolean':\n if (resolver) result[key] = config[key]\n break\n }\n\n return result\n}\n","import { ensureVector, assignDefault, valueFn } from './utils'\nimport { resolveWith } from './resolveOptionsWith'\n\nimport {\n GenericOptions,\n InternalGenericOptions,\n DragConfig,\n GestureOptions,\n InternalDragOptions,\n InternalGestureOptions,\n CoordinatesConfig,\n InternalCoordinatesOptions,\n DistanceAngleConfig,\n InternalDistanceAngleOptions,\n Vector2,\n Bounds,\n StateKey,\n State,\n CoordinatesKey,\n DistanceAngleKey,\n} from '../types'\n\nexport const DEFAULT_DRAG_DELAY = 180\nexport const DEFAULT_RUBBERBAND = 0.15\nexport const DEFAULT_SWIPE_VELOCITY = 0.5\nexport const DEFAULT_SWIPE_DISTANCE = 60\n\nconst InternalGestureOptionsNormalizers = {\n threshold(value: number | Vector2 = 0) {\n return ensureVector(value)\n },\n\n rubberband(value: number | boolean | Vector2 = 0): Vector2 {\n switch (value) {\n case true:\n return ensureVector(DEFAULT_RUBBERBAND)\n case false:\n return ensureVector(0)\n default:\n return ensureVector(value)\n }\n },\n\n enabled(value = true) {\n return value\n },\n\n triggerAllEvents(value = false) {\n return value\n },\n\n initial(value = 0) {\n if (typeof value === 'function') return value\n return ensureVector(value)\n },\n}\n\nconst InternalCoordinatesOptionsNormalizers = {\n ...InternalGestureOptionsNormalizers,\n axis: true,\n lockDirection(value = false) {\n return value\n },\n bounds(value: Bounds | ((state?: State) => Bounds) = {}) {\n if (typeof value === 'function')\n return (state?: State) => InternalCoordinatesOptionsNormalizers.bounds(value(state))\n\n const { left = -Infinity, right = Infinity, top = -Infinity, bottom = Infinity } = value\n\n return [\n [left, right],\n [top, bottom],\n ]\n },\n}\n\nconst isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement\n\nconst InternalGenericOptionsNormalizers = {\n enabled(value = true) {\n return value\n },\n domTarget: true,\n window(value = isBrowser ? window : undefined) {\n return value\n },\n eventOptions({ passive = true, capture = false } = {}) {\n return { passive, capture }\n },\n}\n\nconst InternalDistanceAngleOptionsNormalizers = {\n ...InternalGestureOptionsNormalizers,\n\n bounds(_value: undefined, _key: string, { distanceBounds = {}, angleBounds = {} }: any) {\n const _distanceBounds = (state?: State) => {\n const D = assignDefault(valueFn(distanceBounds, state), { min: -Infinity, max: Infinity })\n return [D.min, D.max]\n }\n\n const _angleBounds = (state?: State) => {\n const A = assignDefault(valueFn(angleBounds, state), { min: -Infinity, max: Infinity })\n return [A.min, A.max]\n }\n\n if (typeof distanceBounds !== 'function' && typeof angleBounds !== 'function')\n return [_distanceBounds(), _angleBounds()]\n\n return (state?: State) => [_distanceBounds(state), _angleBounds(state)]\n },\n}\n\nconst InternalDragOptionsNormalizers = {\n ...InternalCoordinatesOptionsNormalizers,\n\n threshold(\n this: any,\n v: number | Vector2 | undefined,\n _k: string,\n { filterTaps = false, lockDirection = false, axis = undefined }: any\n ) {\n const A = ensureVector(v, filterTaps ? 3 : lockDirection ? 1 : axis ? 1 : 0) as Vector2\n this.filterTaps = filterTaps || A[0] + A[1] > 0\n return A\n },\n\n swipeVelocity(v: number | Vector2 = DEFAULT_SWIPE_VELOCITY) {\n return ensureVector(v)\n },\n swipeDistance(v: number | Vector2 = DEFAULT_SWIPE_DISTANCE) {\n return ensureVector(v)\n },\n\n delay(value: number | boolean = 0) {\n switch (value) {\n case true:\n return DEFAULT_DRAG_DELAY\n case false:\n return 0\n default:\n return value\n }\n },\n}\n\nexport function getInternalGenericOptions(config: GenericOptions = {}): InternalGenericOptions {\n // TODO warn when passive is set to true and domTarget is undefined\n return resolveWith<GenericOptions, InternalGenericOptions>(config, InternalGenericOptionsNormalizers)\n}\n\nexport function getInternalGestureOptions<T extends StateKey>(\n config: GestureOptions<T> = {}\n): InternalGestureOptions<T> {\n return resolveWith<GestureOptions<T>, InternalGestureOptions<T>>(config, InternalGestureOptionsNormalizers)\n}\n\nexport function getInternalCoordinatesOptions<T extends CoordinatesKey>(\n config: CoordinatesConfig<T> = {}\n): InternalCoordinatesOptions<T> {\n return resolveWith<CoordinatesConfig<T>, InternalCoordinatesOptions<T>>(config, InternalCoordinatesOptionsNormalizers)\n}\n\nexport function getInternalDistanceAngleOptions<T extends DistanceAngleKey>(\n config: DistanceAngleConfig<T> = {}\n): InternalDistanceAngleOptions<T> {\n return resolveWith<DistanceAngleConfig<T>, InternalDistanceAngleOptions<T>>(\n config,\n InternalDistanceAngleOptionsNormalizers\n )\n}\n\nexport function getInternalDragOptions(config: DragConfig = {}): InternalDragOptions {\n return resolveWith<DragConfig, InternalDragOptions>(config, InternalDragOptionsNormalizers)\n}\n","import {\n InternalConfig,\n UseMoveConfig,\n UseHoverConfig,\n UseDragConfig,\n UsePinchConfig,\n UseScrollConfig,\n UseWheelConfig,\n} from '../types'\n\nimport {\n getInternalGenericOptions,\n getInternalCoordinatesOptions,\n getInternalDragOptions,\n getInternalDistanceAngleOptions,\n} from '../utils/config'\n\nimport { UseGestureConfig } from '../types'\n\nexport function _buildMoveConfig({ domTarget, eventOptions, window, enabled, ...rest }: UseMoveConfig) {\n const opts: InternalConfig = getInternalGenericOptions({ domTarget, eventOptions, window, enabled })\n opts.move = getInternalCoordinatesOptions(rest)\n return opts\n}\n\nexport function _buildHoverConfig({ domTarget, eventOptions, window, enabled, ...rest }: UseHoverConfig) {\n const opts: InternalConfig = getInternalGenericOptions({ domTarget, eventOptions, window, enabled })\n opts.hover = { enabled: true, ...rest }\n return opts\n}\n\nexport function _buildDragConfig({ domTarget, eventOptions, window, enabled, ...rest }: UseDragConfig) {\n const opts: InternalConfig = getInternalGenericOptions({ domTarget, eventOptions, window, enabled })\n opts.drag = getInternalDragOptions(rest)\n return opts\n}\n\nexport function _buildPinchConfig({ domTarget, eventOptions, window, enabled, ...rest }: UsePinchConfig) {\n const opts: InternalConfig = getInternalGenericOptions({ domTarget, eventOptions, window, enabled })\n opts.pinch = getInternalDistanceAngleOptions(rest)\n return opts\n}\n\nexport function _buildScrollConfig({ domTarget, eventOptions, window, enabled, ...rest }: UseScrollConfig) {\n const opts: InternalConfig = getInternalGenericOptions({ domTarget, eventOptions, window, enabled })\n opts.scroll = getInternalCoordinatesOptions(rest)\n return opts\n}\n\nexport function _buildWheelConfig({ domTarget, eventOptions, window, enabled, ...rest }: UseWheelConfig) {\n const opts: InternalConfig = getInternalGenericOptions({ domTarget, eventOptions, window, enabled })\n opts.wheel = getInternalCoordinatesOptions(rest)\n return opts\n}\n\nexport function buildComplexConfig(config: UseGestureConfig = {}, actions: Set<string> = new Set()) {\n const { drag, wheel, move, scroll, pinch, hover, eventOptions, window, domTarget, enabled } = config\n\n const mergedConfig: InternalConfig = getInternalGenericOptions({ eventOptions, window, domTarget, enabled })\n\n if (actions.has('onDrag')) mergedConfig.drag = getInternalDragOptions(drag)\n if (actions.has('onWheel')) mergedConfig.wheel = getInternalCoordinatesOptions(wheel)\n if (actions.has('onScroll')) mergedConfig.scroll = getInternalCoordinatesOptions(scroll)\n if (actions.has('onMove')) mergedConfig.move = getInternalCoordinatesOptions(move)\n if (actions.has('onPinch')) mergedConfig.pinch = getInternalDistanceAngleOptions(pinch)\n if (actions.has('onHover')) mergedConfig.hover = { enabled: true, ...hover }\n\n return mergedConfig\n}\n","import { noop } from './utils'\nimport { CommonGestureState, Coordinates, State, DistanceAngle, Vector2, DragState } from '../types'\n\nfunction getInitial<T>(mixed: T): T & CommonGestureState {\n return {\n _active: false,\n _blocked: false,\n _intentional: [false, false],\n _movement: [0, 0],\n _initial: [0, 0],\n _bounds: [\n [-Infinity, Infinity],\n [-Infinity, Infinity],\n ],\n _lastEventType: undefined,\n event: undefined,\n // currentTarget: undefined,\n // pointerId: undefined,\n intentional: false,\n values: [0, 0],\n velocities: [0, 0],\n delta: [0, 0],\n movement: [0, 0],\n offset: [0, 0],\n lastOffset: [0, 0],\n direction: [0, 0],\n initial: [0, 0],\n previous: [0, 0],\n first: false,\n last: false,\n active: false,\n timeStamp: 0,\n startTime: 0,\n elapsedTime: 0,\n cancel: noop,\n canceled: false,\n memo: undefined,\n args: undefined,\n ...mixed,\n }\n}\n\nexport function getInitialState(): State {\n const shared = {\n hovering: false,\n scrolling: false,\n wheeling: false,\n dragging: false,\n moving: false,\n pinching: false,\n touches: 0,\n buttons: 0,\n down: false,\n shiftKey: false,\n altKey: false,\n metaKey: false,\n ctrlKey: false,\n }\n\n const drag = getInitial<DragState & Coordinates>({\n axis: undefined,\n xy: [0, 0] as Vector2,\n vxvy: [0, 0] as Vector2,\n velocity: 0,\n distance: 0,\n _isTap: true,\n _delayedEvent: false,\n _pointerId: undefined,\n tap: false,\n swipe: [0, 0],\n })\n\n const pinch = getInitial<DistanceAngle>({\n da: [0, 0] as Vector2,\n vdva: [0, 0] as Vector2,\n // @ts-ignore origin can never be passed as undefined in userland\n origin: undefined,\n turns: 0,\n })\n\n const wheel = getInitial<Coordinates>({\n axis: undefined,\n xy: [0, 0] as Vector2,\n vxvy: [0, 0] as Vector2,\n velocity: 0,\n distance: 0,\n })\n\n const move = getInitial<Coordinates>({\n axis: undefined,\n xy: [0, 0] as Vector2,\n vxvy: [0, 0] as Vector2,\n velocity: 0,\n distance: 0,\n })\n\n const scroll = getInitial<Coordinates>({\n axis: undefined,\n xy: [0, 0] as Vector2,\n vxvy: [0, 0] as Vector2,\n velocity: 0,\n distance: 0,\n })\n\n return { shared, drag, pinch, wheel, move, scroll }\n}\n","import Controller from '../Controller'\nimport {\n StateKey,\n SharedGestureState,\n IngKey,\n InternalConfig,\n GestureKey,\n GestureState,\n EventTypes,\n PartialGestureState,\n Vector2,\n FullGestureState,\n RecognizerClass,\n} from '../types'\nimport { getInitialState } from '../utils/state'\nimport { rubberbandIfOutOfBounds } from '../utils/rubberband'\nimport { subV, addV, sign } from '../utils/math'\nimport { valueFn } from '../utils/utils'\n\nexport const RecognizersMap = new Map<GestureKey, RecognizerClass>()\n\n/**\n * @private\n * Recognizer abstract class.\n */\nexport default abstract class Recognizer<T extends StateKey = StateKey> {\n abstract readonly ingKey: IngKey // dragging, scrolling, etc.\n protected debounced: Boolean = true\n abstract readonly stateKey: T\n\n /**\n * Creates an instance of a gesture recognizer.\n * @param stateKey drag, move, pinch, etc.\n * @param controller the controller attached to the gesture\n * @param [args] the args that should be passed to the gesture handler\n */\n constructor(readonly controller: Controller, readonly args: any[] = []) {}\n\n // Returns the gesture config\n get config(): NonNullable<InternalConfig[T]> {\n return this.controller.config[this.stateKey]!\n }\n\n // Is the gesture enabled\n get enabled(): boolean {\n return this.controller.config.enabled && this.config.enabled\n }\n\n // Returns the controller state for a given gesture\n get state(): GestureState<T> {\n return this.controller.state[this.stateKey]\n }\n\n // Returns the gesture handler\n get handler() {\n return this.controller.handlers[this.stateKey]!\n }\n\n // Convenience method to update the shared state\n protected updateSharedState(sharedState: Partial<SharedGestureState> | null) {\n Object.assign(this.controller.state.shared, sharedState)\n }\n\n // Convenience method to update the gesture state\n protected updateGestureState(gestureState: PartialGestureState<T> | null) {\n Object.assign(this.state, gestureState)\n }\n\n // Convenience method to set a timeout for a given gesture\n protected setTimeout = (callback: (...args: any[]) => void, ms: number = 140, ...args: any[]): void => {\n clearTimeout(this.controller.timeouts[this.stateKey])\n this.controller.timeouts[this.stateKey] = window.setTimeout(callback, ms, ...args)\n }\n\n // Convenience method to clear a timeout for a given gesture\n protected clearTimeout = () => {\n clearTimeout(this.controller.timeouts[this.stateKey])\n }\n\n protected abstract getKinematics(values: Vector2, event: React.UIEvent | UIEvent): PartialGestureState<T>\n protected abstract getInternalMovement(values: Vector2, state: GestureState<T>): Vector2\n protected abstract mapStateValues(state: GestureState<T>): Omit<PartialGestureState<T>, 'event'>\n\n public abstract addBindings(bindings: any): void\n\n /**\n * Returns state properties depending on the movement and state.\n *\n * Should be overriden for custom behavior, doesn't do anything in the implementation\n * below.\n */\n protected checkIntentionality(\n _intentional: [false | number, false | number],\n _movement: Vector2\n ): PartialGestureState<T> {\n return { _intentional, _blocked: false } as PartialGestureState<T>\n }\n\n /**\n * Returns basic movement properties for the gesture based on the next values and current state.\n */\n protected getMovement(values: Vector2): PartialGestureState<T> {\n const { initial, bounds, rubberband, threshold: T } = this.config\n\n const { _bounds, _initial, _active, _intentional: wasIntentional, lastOffset, movement: prevMovement } = this.state\n const M = this.getInternalMovement(values, this.state)\n\n const i0 = wasIntentional[0] === false ? getIntentionalDisplacement(M[0], T[0]) : wasIntentional[0]\n const i1 = wasIntentional[1] === false ? getIntentionalDisplacement(M[1], T[1]) : wasIntentional[1]\n\n // Get gesture specific state properties based on intentionality and movement.\n const intentionalityCheck = this.checkIntentionality([i0, i1], M)\n if (intentionalityCheck._blocked) {\n return { ...intentionalityCheck, _movement: M, delta: [0, 0] }\n }\n\n const _intentional = intentionalityCheck._intentional!\n const _movement = M\n\n let __cachedBounds\n let __cachedInitial\n\n if (_intentional[0] !== false && wasIntentional[0] === false) {\n __cachedInitial = valueFn(initial, this.state)\n __cachedBounds = valueFn(bounds, this.state)\n _initial[0] = __cachedInitial[0]\n _bounds[0] = __cachedBounds[0]\n }\n if (_intentional[1] !== false && wasIntentional[1] === false) {\n __cachedInitial = __cachedInitial ?? valueFn(initial, this.state)\n __cachedBounds = __cachedBounds ?? valueFn(bounds, this.state)\n _initial[1] = __cachedInitial[1]\n _bounds[1] = __cachedBounds[1]\n }\n\n /**\n * The movement sent to the handler has 0 in its dimensions when intentionality is false.\n * It is calculated from the actual movement minus the threshold.\n */\n let movement: Vector2 = [\n _intentional[0] !== false ? M[0] - _intentional[0] : _initial[0],\n _intentional[1] !== false ? M[1] - _intentional[1] : _initial[1],\n ]\n\n const offset = addV(movement, lastOffset)\n\n /**\n * Rubberband should be 0 when the gesture is no longer active, so that movement\n * and offset can return within their bounds.\n */\n const _rubberband: Vector2 = _active ? rubberband : [0, 0]\n movement = computeRubberband(_bounds, addV(movement, _initial), _rubberband)\n\n return {\n ...intentionalityCheck,\n intentional: _intentional[0] !== false || _intentional[1] !== false,\n _initial,\n _movement,\n movement,\n values,\n offset: computeRubberband(_bounds, offset, _rubberband),\n delta: subV(movement, prevMovement),\n } as PartialGestureState<T>\n }\n\n // Cleans the gesture. Can be overriden by gestures.\n protected clean() {\n this.clearTimeout()\n }\n\n /**\n * Fires the gesture handler\n */\n protected fireGestureHandler = (forceFlag: boolean = false): FullGestureState<T> | null => {\n /**\n * If the gesture has been blocked (this can happen when the gesture has started in an unwanted direction),\n * clean everything and don't do anything.\n */\n if (this.state._blocked) {\n // we need debounced gestures to end by themselves\n if (!this.debounced) {\n this.state._active = false\n this.clean()\n }\n return null\n }\n\n // If the gesture has no intentional dimension, don't fire the handler.\n if (!forceFlag && !this.state.intentional && !this.config.triggerAllEvents) return null\n\n if (this.state.intentional) {\n const prev_active = this.state.active\n const next_active = this.state._active\n\n this.state.active = next_active\n this.state.first = next_active && !prev_active\n this.state.last = prev_active && !next_active\n\n this.controller.state.shared[this.ingKey] = next_active // Sets dragging, pinching, etc. to the gesture active state\n }\n const state = {\n ...this.controller.state.shared,\n ...this.state,\n ...this.mapStateValues(this.state), // Sets xy or da to the gesture state values\n } as FullGestureState<T>\n\n // @ts-ignore\n const newMemo = this.handler(state)\n\n // Sets memo to the returned value of the handler (unless it's not undefined)\n this.state.memo = newMemo !== void 0 ? newMemo : this.state.memo\n\n // Cleans the gesture when the gesture is no longer active.\n if (!this.state._active) this.clean()\n\n return state\n }\n}\n\n//--------------------------------------------\n\nfunction getIntentionalDisplacement(movement: number, threshold: number): number | false {\n if (Math.abs(movement) >= threshold) {\n return sign(movement) * threshold\n } else {\n return false\n }\n}\n\nfunction computeRubberband(bounds: [Vector2, Vector2], [Vx, Vy]: Vector2, [Rx, Ry]: Vector2): Vector2 {\n const [[X1, X2], [Y1, Y2]] = bounds\n\n return [rubberbandIfOutOfBounds(Vx, X1, X2, Rx), rubberbandIfOutOfBounds(Vy, Y1, Y2, Ry)]\n}\n\n/**\n * Returns a generic, common payload for all gestures from an event.\n */\nexport function getGenericPayload<T extends StateKey>(\n { state, args }: Recognizer<T>,\n event: EventTypes[T],\n isStartEvent?: boolean\n) {\n const { timeStamp, type: _lastEventType } = event\n const previous = state.values\n const elapsedTime = isStartEvent ? 0 : timeStamp - state.startTime!\n return { _lastEventType, event, timeStamp, elapsedTime, args, previous }\n}\n\n/**\n * Returns the reinitialized start state for the gesture.\n * Should be common to all gestures.\n */\nexport function getStartGestureState<T extends StateKey>(\n recognizer: Recognizer<T>,\n values: Vector2,\n event: EventTypes[T]\n) {\n const offset = recognizer.state.offset\n const startTime = event.timeStamp\n\n return {\n ...getInitialState()[recognizer.stateKey],\n _active: true,\n values,\n initial: values,\n offset,\n lastOffset: offset,\n startTime,\n }\n}\n","import {\n StateKey,\n State,\n Fn,\n ReactEventHandlerKey,\n ReactEventHandlers,\n InternalConfig,\n InternalHandlers,\n RecognizerClass,\n} from './types'\nimport { getInitialState } from './utils/state'\nimport { chainFns } from './utils/utils'\n\nfunction partial(func: Fn, state: any) {\n return function (event: any, ...args: any) {\n // @ts-ignore\n return func.call(this, { ...state, event }, ...args)\n }\n}\n\n/**\n * The controller will keep track of the state for all gestures and also keep\n * track of timeouts, and window listeners.\n */\nexport default class Controller {\n public nativeRefs!: any\n public config!: InternalConfig\n public handlers!: InternalHandlers\n public state: State // state for all gestures\n public timeouts: { [stateKey in StateKey]?: number } // tracks timeouts of debounced gestures\n public domListeners: [string, Fn][] // when config.domTarget is set, we attach events directly to the dom\n public windowListeners: { [stateKey in StateKey]?: [string, Function][] } // keeps track of window listeners added by gestures (drag only at the moment)\n\n constructor(private classes: Set<RecognizerClass>) {\n this.state = getInitialState()\n this.timeouts = {}\n this.domListeners = []\n this.windowListeners = {}\n }\n\n public bind = (...args: any[]) => {\n const bindings: { [key: string]: Function[] } = {}\n\n for (let RecognizerClass of this.classes) new RecognizerClass(this, args).addBindings(bindings)\n\n // we also add event bindings for native handlers\n for (let [event, handler] of Object.entries(this.nativeRefs))\n addBindings(bindings, event, partial(handler, { ...this.state.shared, args }))\n\n if (this.config.domTarget) {\n // If config.domTarget is set we add event listeners to it and return the clean function.\n return updateDomListeners(this, bindings)\n } else {\n // If not, we return an object that contains gesture handlers mapped to react handler event keys.\n return getPropsListener(this, bindings)\n }\n }\n\n public effect = () => {\n if (this.config.domTarget) this.bind()\n return this.clean\n }\n\n /**\n * Function ran on component unmount: cleans timeouts and removes dom listeners set by the bind function.\n */\n public clean = (): void => {\n const domTarget = getDomTargetFromConfig(this.config)\n const { eventOptions } = this.config\n if (domTarget) removeListeners(domTarget, takeAll(this.domListeners), eventOptions)\n Object.values(this.timeouts).forEach(clearTimeout)\n clearAllWindowListeners(this)\n }\n}\n\nexport function clearAllWindowListeners(controller: Controller) {\n const {\n config: { window: el, eventOptions },\n windowListeners,\n } = controller\n if (!el) return\n\n for (let stateKey in windowListeners) {\n const handlers = windowListeners[stateKey as StateKey]\n removeListeners(el, handlers, eventOptions)\n }\n\n controller.windowListeners = {}\n}\n\nexport function clearWindowListeners({ config, windowListeners }: Controller, stateKey: StateKey) {\n if (!config.window) return\n removeListeners(config.window, windowListeners[stateKey], config.eventOptions)\n delete windowListeners[stateKey]\n}\n\nexport function updateWindowListeners(\n { config, windowListeners }: Controller,\n stateKey: StateKey,\n listeners: [string, Fn][] = []\n) {\n if (!config.window) return\n removeListeners(config.window, windowListeners[stateKey], config.eventOptions)\n addListeners(config.window, (windowListeners[stateKey] = listeners), config.eventOptions)\n}\n\nfunction updateDomListeners({ config, domListeners }: Controller, bindings: { [key: string]: Function[] }) {\n const domTarget = getDomTargetFromConfig(config)\n if (!domTarget) throw new Error('domTarget must be defined')\n const { eventOptions } = config\n\n removeListeners(domTarget, takeAll(domListeners), eventOptions)\n\n for (let [key, fns] of Object.entries(bindings)) {\n const name = key.slice(2).toLowerCase()\n domListeners.push([name, chainFns(...fns)])\n }\n\n addListeners(domTarget, domListeners, eventOptions)\n}\n\nfunction getPropsListener({ config }: Controller, bindings: { [key: string]: Function[] }) {\n const props: ReactEventHandlers = {}\n const captureString = config.eventOptions.capture ? 'Capture' : ''\n for (let [event, fns] of Object.entries(bindings)) {\n const fnsArray = Array.isArray(fns) ? fns : [fns]\n const key = (event + captureString) as ReactEventHandlerKey\n props[key] = chainFns(...(fnsArray as Fn[]))\n }\n return props\n}\n\nfunction takeAll<T>(array: Array<T> = []) {\n return array.splice(0, array.length)\n}\n\nfunction getDomTargetFromConfig({ domTarget }: InternalConfig) {\n return domTarget && 'current' in domTarget ? domTarget.current : domTarget\n}\n\n/**\n * bindings is an object which keys match ReactEventHandlerKeys.\n * Since a recognizer might want to bind a handler function to an event key already used by a previously\n * added recognizer, we need to make sure that each event key is an array of all the functions mapped for\n * that key.\n */\nexport function addBindings(bindings: any, name: string, fn: Fn): void {\n if (!bindings[name]) bindings[name] = []\n bindings[name]!.push(fn)\n}\n\nfunction addListeners(el: EventTarget, listeners: Array<[string, Fn]> = [], options = {}) {\n for (let [eventName, eventHandler] of listeners) {\n el.addEventListener(eventName, eventHandler, options)\n }\n}\n\nfunction removeListeners(el: EventTarget, listeners: Array<[string, Fn]> = [], options = {}) {\n for (let [eventName, eventHandler] of listeners) {\n el.removeEventListener(eventName, eventHandler, options)\n }\n}\n","/* eslint-disable react-hooks/exhaustive-deps */\n\nimport React from 'react'\nimport { RecognizersMap } from '../recognizers/Recognizer'\nimport Controller from '../Controller'\nimport {\n InternalConfig,\n HookReturnType,\n InternalHandlers,\n GenericOptions,\n RecognizerClass,\n NativeHandlers,\n} from '../types'\n\n/**\n * Utility hook called by all gesture hooks and that will be responsible for the internals.\n *\n * @param handlers\n * @param classes\n * @param config\n * @param nativeHandlers - native handlers such as onClick, onMouseDown, etc.\n */\nexport default function useRecognizers<Config extends Partial<GenericOptions>>(\n handlers: Partial<InternalHandlers>,\n config: InternalConfig,\n nativeHandlers: Partial<NativeHandlers> = {}\n): (...args: any[]) => HookReturnType<Config> {\n const classes = resolveClasses(handlers)\n\n const controller = React.useMemo(() => new Controller(classes), [])\n controller!.config = config\n controller!.handlers = handlers\n controller!.nativeRefs = nativeHandlers\n\n React.useEffect(controller.effect, [])\n\n // @ts-ignore\n if (controller.config.domTarget) return deprecationNoticeForDomTarget\n // @ts-ignore\n return controller.bind\n}\n\nfunction deprecationNoticeForDomTarget() {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `Deprecation notice: When the \\`domTarget\\` option is specified, you don't need to write \\`useEffect(bind, [bind])\\` anymore: event binding is now made handled internally to this lib.\\n\\nNext version won't return anything when \\`domTarget\\` is provided, therefore your code will break if you try to call \\`useEffect\\`.`\n )\n }\n}\n\nfunction resolveClasses(internalHandlers: Partial<InternalHandlers>) {\n const classes = new Set<RecognizerClass>()\n\n if (internalHandlers.drag) classes.add(RecognizersMap.get('drag')!)\n if (internalHandlers.wheel) classes.add(RecognizersMap.get('wheel')!)\n if (internalHandlers.scroll) classes.add(RecognizersMap.get('scroll')!)\n if (internalHandlers.move) classes.add(RecognizersMap.get('move')!)\n if (internalHandlers.pinch) classes.add(RecognizersMap.get('pinch')!)\n if (internalHandlers.hover) classes.add(RecognizersMap.get('hover')!)\n\n return classes\n}\n","import Recognizer from './Recognizer'\nimport { calculateAllKinematics, subV } from '../utils/math'\nimport { Vector2, PartialGestureState, GestureState, CoordinatesKey } from '../types'\n\n/**\n * @private\n * Abstract class for coordinates-based gesture recongizers\n */\nexport default abstract class CoordinatesRecognizer<T extends CoordinatesKey> extends Recognizer<T> {\n /**\n * Returns the real movement (without taking intentionality into acount)\n */\n protected getInternalMovement(values: Vector2, state: GestureState<T>): Vector2 {\n return subV(values, state.initial)\n }\n\n /**\n * In coordinates-based gesture, this function will detect the first intentional axis,\n * lock the gesture axis if lockDirection is specified in the config, block the gesture\n * if the first intentional axis doesn't match the specified axis in config.\n */\n protected checkIntentionality(\n _intentional: [false | number, false | number],\n _movement: Vector2\n ): PartialGestureState<T> {\n if (_intentional[0] === false && _intentional[1] === false) {\n return { _intentional, axis: this.state.axis } as PartialGestureState<T>\n }\n const [absX, absY] = _movement.map(Math.abs)\n const axis = this.state.axis || (absX > absY ? 'x' : absX < absY ? 'y' : undefined)\n if (!this.config.axis && !this.config.lockDirection) return { _intentional, _blocked: false, axis } as any\n if (!axis) return { _intentional: [false, false], _blocked: false, axis } as any\n if (!!this.config.axis && axis !== this.config.axis) return { _intentional, _blocked: true, axis } as any\n _intentional![axis === 'x' ? 1 : 0] = false\n return { _intentional, _blocked: false, axis } as any\n }\n\n getKinematics(values: Vector2, event: React.UIEvent | UIEvent): PartialGestureState<T> {\n const state = this.getMovement(values)\n if (!state._blocked) {\n const dt = event.timeStamp - this.state.timeStamp!\n Object.assign(state, calculateAllKinematics(state.movement!, state.delta!, dt))\n }\n return state\n }\n\n protected mapStateValues(state: GestureState<T>): Omit<PartialGestureState<T>, 'event'> {\n return { xy: state.values, vxvy: state.velocities } as Omit<PartialGestureState<T>, 'event'>\n }\n}\n","import { Vector2, WebKitGestureEvent, DomEvents } from '../types'\n\nconst WEBKIT_DISTANCE_SCALE_FACTOR = 260\n\n/**\n * Whether the browser supports GestureEvent (ie Safari)\n * @returns true if the browser supports gesture event\n */\nexport function supportsGestureEvents(): boolean {\n try {\n // TODO [TS] possibly find GestureEvent definitions?\n // @ts-ignore: no type definitions for webkit GestureEvents\n return 'constructor' in GestureEvent\n } catch (e) {\n return false\n }\n}\n\nexport function supportsTouchEvents(): boolean {\n return typeof window !== 'undefined' && window.ontouchstart === null\n}\n\nfunction getTouchEvents(event: DomEvents) {\n if ('touches' in event) {\n const { targetTouches, changedTouches } = event\n return targetTouches.length > 0 ? targetTouches : changedTouches\n }\n return null\n}\n\nexport function getGenericEventData(event: DomEvents) {\n const buttons = 'buttons' in event ? event.buttons : 0\n const touchEvents = getTouchEvents(event)\n const touches = (touchEvents && touchEvents.length) || 0\n const down = touches > 0 || buttons > 0\n\n const { shiftKey, altKey, metaKey, ctrlKey } = event as any // TODO check if this might create some overrides?\n return { touches, down, buttons, shiftKey, altKey, metaKey, ctrlKey }\n}\n\n/**\n * Gets pointer event values.\n * @param event\n * @returns pointer event values\n */\nexport function getPointerEventValues(\n event: TouchEvent | React.TouchEvent | React.PointerEvent | PointerEvent\n): Vector2 {\n const touchEvents = getTouchEvents(event)\n const { clientX, clientY } = touchEvents ? touchEvents[0] : (event as React.PointerEvent)\n return [clientX, clientY]\n}\n\n/**\n * Gets scroll event values\n * @param event\n * @returns scroll event values\n */\nexport function getScrollEventValues(event: React.UIEvent | UIEvent): Vector2 {\n // If the currentTarget is the window then we return the scrollX/Y position.\n // If not (ie the currentTarget is a DOM element), then we return scrollLeft/Top\n const { scrollX, scrollY, scrollLeft, scrollTop } = event.currentTarget as Element & Window\n return [scrollX || scrollLeft || 0, scrollY || scrollTop || 0]\n}\n\n/**\n * Gets wheel event values.\n * @param event\n * @returns wheel event values\n */\nexport function getWheelEventValues(event: React.WheelEvent | WheelEvent): Vector2 {\n const { deltaX, deltaY } = event\n //TODO implement polyfill ?\n // https://developer.mozilla.org/en-US/docs/Web/Events/wheel#Polyfill\n return [deltaX, deltaY]\n}\n\n/**\n * Gets webkit gesture event values.\n * @param event\n * @returns webkit gesture event values\n */\nexport function getWebkitGestureEventValues(event: WebKitGestureEvent): Vector2 {\n return [event.scale * WEBKIT_DISTANCE_SCALE_FACTOR, event.rotation]\n}\n\n/**\n * Gets two touches event data\n * @param event\n * @returns two touches event data\n */\nexport function getTwoTouchesEventData(event: React.TouchEvent | TouchEvent) {\n const { targetTouches } = event\n const A = targetTouches[0],\n B = targetTouches[1]\n\n const dx = B.clientX - A.clientX\n const dy = B.clientY - A.clientY\n const cx = (B.clientX + A.clientX) / 2\n const cy = (B.clientY + A.clientY) / 2\n\n const e: any = 'nativeEvent' in event ? event.nativeEvent : event\n\n const distance = Math.hypot(dx, dy)\n const angle = (e.rotation as number) ?? -(Math.atan2(dx, dy) * 180) / Math.PI\n\n const values: Vector2 = [distance, angle]\n const origin: Vector2 = [cx, cy]\n\n return { values, origin }\n}\n","import CoordinatesRecognizer from './CoordinatesRecognizer'\nimport { getPointerEventValues, getGenericEventData } from '../utils/event'\nimport { calculateDistance, sign } from '../utils/math'\nimport { getStartGestureState, getGenericPayload } from './Recognizer'\nimport { addBindings, updateWindowListeners, clearWindowListeners } from '../Controller'\n\nexport const TAP_DISTANCE_THRESHOLD = 3\nexport const SWIPE_MAX_ELAPSED_TIME = 220\n\nexport class DragRecognizer extends CoordinatesRecognizer<'drag'> {\n readonly ingKey = 'dragging'\n readonly stateKey = 'drag'\n\n /**\n * TODO add back when setPointerCapture is widely wupported\n * https://caniuse.com/#search=setPointerCapture\n * private setPointers = (event: UseGestureEvent<PointerEvent>) => {\n * const { currentTarget, pointerId } = event\n * if (currentTarget) currentTarget.setPointerCapture(pointerId)\n * this.updateGestureState({ currentTarget, pointerId })\n * }\n\n * private removePointers = () => {\n * const { currentTarget, pointerId } = this.state\n * if (currentTarget && pointerId) currentTarget.releasePointerCapture(pointerId)\n * }\n */\n\n onDragStart = (event: React.PointerEvent | PointerEvent): void => {\n if (!this.enabled || this.state._active) return\n\n /**\n * TODO add back when setPointerCapture is widely supported\n * this.setPointers(event as PointerEvent)\n */\n\n updateWindowListeners(this.controller, this.stateKey, [\n ['pointermove', this.onDragChange],\n ['pointerup', this.onDragEnd],\n ['pointercancel', this.onDragEnd],\n ])\n\n // We set the state pointerId to the event.pointerId so we can make sure\n // that we lock the drag to the event initiating the gesture\n this.updateGestureState({ _pointerId: event.pointerId })\n\n if (this.config.delay > 0) {\n this.state._delayedEvent = true\n // If it's a React SyntheticEvent we need to persist it so that we can use it async\n if ('persist' in event && typeof event.persist === 'function') event.persist()\n this.setTimeout(this.startDrag.bind(this), this.config.delay, event)\n } else {\n this.startDrag(event)\n }\n }\n\n startDrag(event: React.PointerEvent | PointerEvent) {\n const values = getPointerEventValues(event)\n this.updateSharedState(getGenericEventData(event))\n\n this.updateGestureState({\n ...getStartGestureState(this, values, event),\n ...getGenericPayload(this, event, true),\n _pointerId: event.pointerId,\n cancel: this.onCancel,\n })\n\n this.updateGestureState(this.getMovement(values))\n this.fireGestureHandler()\n }\n\n onDragChange = (event: PointerEvent): void => {\n // If the gesture was canceled don't respond to the event.\n if (this.state.canceled) return\n\n // If the event pointerId doesn't match the initiating pointerId\n // don't respond to the event.\n if (event.pointerId !== this.state._pointerId) return\n\n // If the gesture isn't active then respond to the event only if\n // it's been delayed via the `delay` option, in which case start\n // the gesture immediately.\n if (!this.state._active) {\n if (this.state._delayedEvent) {\n this.clearTimeout()\n this.startDrag(event)\n }\n return\n }\n\n const genericEventData = getGenericEventData(event)\n\n // If the event doesn't have any button / touches left we should cancel\n // the gesture. This may happen if the drag release happens outside the browser\n // window.\n if (!genericEventData.down) {\n this.onDragEnd(event)\n return\n }\n\n this.updateSharedState(genericEventData)\n const values = getPointerEventValues(event)\n\n const kinematics = this.getKinematics(values, event)\n const genericPayload = getGenericPayload(this, event)\n\n // This verifies if the drag can be assimilated to a tap by checking\n // if the real distance of the drag (ie not accounting for the threshold) is\n // greater than the TAP_DISTANCE_THRESHOLD.\n let { _isTap } = this.state\n const realDistance = calculateDistance(kinematics._movement!)\n if (_isTap && realDistance >= TAP_DISTANCE_THRESHOLD) _isTap = false\n\n this.updateGestureState({ ...genericPayload, ...kinematics, _isTap })\n\n this.fireGestureHandler()\n }\n\n onDragEnd = (event: PointerEvent): void => {\n // If the event pointerId doesn't match the initiating pointerId\n // don't respond to the event.\n if (event.pointerId !== this.state._pointerId) return\n\n this.state._active = false\n this.updateSharedState({ down: false, buttons: 0, touches: 0 })\n\n const tap = this.state._isTap\n const [vx, vy] = this.state.velocities\n const [mx, my] = this.state.movement\n const [ix, iy] = this.state._intentional\n const [svx, svy] = this.config.swipeVelocity\n const [sx, sy] = this.config.swipeDistance\n\n const endState = {\n ...getGenericPayload(this, event),\n ...this.getMovement(this.state.values),\n }\n\n const swipe: [number, number] = [0, 0]\n\n if (endState.elapsedTime < SWIPE_MAX_ELAPSED_TIME) {\n if (ix !== false && Math.abs(vx) > svx && Math.abs(mx) > sx) swipe[0] = sign(vx)\n if (iy !== false && Math.abs(vy) > svy && Math.abs(my) > sy) swipe[1] = sign(vy)\n }\n\n this.updateGestureState({ ...endState, tap, swipe })\n this.fireGestureHandler(tap === true)\n }\n\n clean = (): void => {\n super.clean()\n this.state._delayedEvent = false // can't remember if this is useful?\n clearWindowListeners(this.controller, this.stateKey)\n // TODO add back when setPointerCapture is widely wupported\n // this.removePointers()\n }\n\n onCancel = (): void => {\n if (this.state.canceled) return\n this.updateGestureState({ canceled: true })\n this.state._active = false\n this.updateSharedState({ down: false, buttons: 0, touches: 0 })\n requestAnimationFrame(() => this.fireGestureHandler())\n }\n\n onClick = (event: React.UIEvent | UIEvent): void => {\n if (!this.state._isTap) event.stopPropagation()\n }\n\n addBindings(bindings: any): void {\n addBindings(bindings, 'onPointerDown', this.onDragStart)\n if (this.config.filterTaps) {\n const handler = this.controller.config.eventOptions.capture ? 'onClick' : 'onClickCapture'\n addBindings(bindings, handler, this.onClick)\n }\n\n // TODO add back when setPointerCapture is widely wupported\n // addBindings(bindings, 'onPointerMove', this.onDragChange)\n // addBindings(bindings, 'onPointerUp', this.onDragEnd)\n // addBindings(bindings, 'onPointerCancel', this.onDragEnd)\n }\n}\n","/**\n * Inlined from https://github.com/alexreardon/memoize-one\n */\n\nexport type EqualityFn = (newArgs: any[], lastArgs: any[]) => boolean\n\nexport default function memoizeOne<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(\n resultFn: ResultFn,\n isEqual: EqualityFn\n): ResultFn {\n let lastThis: unknown\n let lastArgs: unknown[] = []\n let lastResult: ReturnType<ResultFn>\n let calledOnce: boolean = false\n\n function memoized(this: unknown, ...newArgs: unknown[]): ReturnType<ResultFn> {\n if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {\n return lastResult\n }\n\n lastResult = resultFn.apply(this, newArgs)\n calledOnce = true\n lastThis = this\n lastArgs = newArgs\n return lastResult\n }\n\n return memoized as ResultFn\n}\n","/**\n * Taken from https://github.com/FormidableLabs/react-fast-compare\n *\n * Dropped comments and ArrayBuffer handling\n */\n\nfunction equal(a: any, b: any): boolean {\n if (a === b) return true\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false\n\n let length, i, keys\n if (Array.isArray(a)) {\n length = a.length\n if (length !== b.length) return false\n for (i = length; i-- !== 0; ) if (!equal(a[i], b[i])) return false\n return true\n }\n\n let it\n if (typeof Map === 'function' && a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false\n it = a.entries()\n while (!(i = it.next()).done) if (!b.has(i.value[0])) return false\n it = a.entries()\n while (!(i = it.next()).done) if (!equal(i.value[1], b.get(i.value[0]))) return false\n return true\n }\n\n if (typeof Set === 'function' && a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false\n it = a.entries()\n while (!(i = it.next()).done) if (!b.has(i.value[0])) return false\n return true\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf()\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString()\n\n keys = Object.keys(a)\n length = keys.length\n if (length !== Object.keys(b).length) return false\n\n for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false\n\n if (typeof Element !== 'undefined' && a instanceof Element) return false\n\n for (i = length; i-- !== 0; ) {\n if (keys[i] === '_owner' && a.$$typeof) continue\n if (!equal(a[keys[i]], b[keys[i]])) return false\n }\n return true\n }\n\n // true if both NaN, false otherwise — NaN !== NaN → true\n // eslint-disable-next-line no-self-compare\n return a !== a && b !== b\n}\n\nexport default function isEqual(a: any, b: any) {\n try {\n return equal(a, b)\n } catch (error) {\n if ((error.message || '').match(/stack|recursion/i)) {\n console.warn('react-fast-compare cannot handle circular refs')\n return false\n }\n throw error\n }\n}\n","const candidateSelectors = [\n 'input',\n 'select',\n 'textarea',\n 'a[href]',\n 'button',\n '[tabindex]:not(slot)',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'details>summary:first-of-type',\n 'details',\n];\nconst candidateSelector = /* #__PURE__ */ candidateSelectors.join(',');\n\nconst NoElement = typeof Element === 'undefined';\n\nconst matches = NoElement\n ? function () {}\n : Element.prototype.matches ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.webkitMatchesSelector;\n\nconst getRootNode =\n !NoElement && Element.prototype.getRootNode\n ? (element) => element.getRootNode()\n : (element) => element.ownerDocument;\n\n/**\n * @param {Element} el container to check in\n * @param {boolean} includeContainer add container to check\n * @param {(node: Element) => boolean} filter filter candidates\n * @returns {Element[]}\n */\nconst getCandidates = function (el, includeContainer, filter) {\n let candidates = Array.prototype.slice.apply(\n el.querySelectorAll(candidateSelector)\n );\n if (includeContainer && matches.call(el, candidateSelector)) {\n candidates.unshift(el);\n }\n candidates = candidates.filter(filter);\n return candidates;\n};\n\n/**\n * @callback GetShadowRoot\n * @param {Element} element to check for shadow root\n * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.\n */\n\n/**\n * @callback ShadowRootFilter\n * @param {Element} shadowHostNode the element which contains shadow content\n * @returns {boolean} true if a shadow root could potentially contain valid candidates.\n */\n\n/**\n * @typedef {Object} CandidatesScope\n * @property {Element} scope contains inner candidates\n * @property {Element[]} candidates\n */\n\n/**\n * @typedef {Object} IterativeOptions\n * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;\n * if a function, implies shadow support is enabled and either returns the shadow root of an element\n * or a boolean stating if it has an undisclosed shadow root\n * @property {(node: Element) => boolean} filter filter candidates\n * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list\n * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;\n */\n\n/**\n * @param {Element[]} elements list of element containers to match candidates from\n * @param {boolean} includeContainer add container list to check\n * @param {IterativeOptions} options\n * @returns {Array.<Element|CandidatesScope>}\n */\nconst getCandidatesIteratively = function (\n elements,\n includeContainer,\n options\n) {\n const candidates = [];\n const elementsToCheck = Array.from(elements);\n while (elementsToCheck.length) {\n const element = elementsToCheck.shift();\n if (element.tagName === 'SLOT') {\n // add shadow dom slot scope (slot itself cannot be focusable)\n const assigned = element.assignedElements();\n const content = assigned.length ? assigned : element.children;\n const nestedCandidates = getCandidatesIteratively(content, true, options);\n if (options.flatten) {\n candidates.push(...nestedCandidates);\n } else {\n candidates.push({\n scope: element,\n candidates: nestedCandidates,\n });\n }\n } else {\n // check candidate element\n const validCandidate = matches.call(element, candidateSelector);\n if (\n validCandidate &&\n options.filter(element) &&\n (includeContainer || !elements.includes(element))\n ) {\n candidates.push(element);\n }\n\n // iterate over shadow content if possible\n const shadowRoot =\n element.shadowRoot ||\n // check for an undisclosed shadow\n (typeof options.getShadowRoot === 'function' &&\n options.getShadowRoot(element));\n\n const validShadowRoot =\n !options.shadowRootFilter || options.shadowRootFilter(element);\n\n if (shadowRoot && validShadowRoot) {\n // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed\n // shadow exists, so look at light dom children as fallback BUT create a scope for any\n // child candidates found because they're likely slotted elements (elements that are\n // children of the web component element (which has the shadow), in the light dom, but\n // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,\n // _after_ we return from this recursive call\n const nestedCandidates = getCandidatesIteratively(\n shadowRoot === true ? element.children : shadowRoot.children,\n true,\n options\n );\n\n if (options.flatten) {\n candidates.push(...nestedCandidates);\n } else {\n candidates.push({\n scope: element,\n candidates: nestedCandidates,\n });\n }\n } else {\n // there's not shadow so just dig into the element's (light dom) children\n // __without__ giving the element special scope treatment\n elementsToCheck.unshift(...element.children);\n }\n }\n }\n return candidates;\n};\n\nconst getTabindex = function (node, isScope) {\n if (node.tabIndex < 0) {\n // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default\n // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,\n // yet they are still part of the regular tab order; in FF, they get a default\n // `tabIndex` of 0; since Chrome still puts those elements in the regular tab\n // order, consider their tab index to be 0.\n // Also browsers do not return `tabIndex` correctly for contentEditable nodes;\n // so if they don't have a tabindex attribute specifically set, assume it's 0.\n //\n // isScope is positive for custom element with shadow root or slot that by default\n // have tabIndex -1, but need to be sorted by document order in order for their\n // content to be inserted in the correct position\n if (\n (isScope ||\n /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) ||\n node.isContentEditable) &&\n isNaN(parseInt(node.getAttribute('tabindex'), 10))\n ) {\n return 0;\n }\n }\n\n return node.tabIndex;\n};\n\nconst sortOrderedTabbables = function (a, b) {\n return a.tabIndex === b.tabIndex\n ? a.documentOrder - b.documentOrder\n : a.tabIndex - b.tabIndex;\n};\n\nconst isInput = function (node) {\n return node.tagName === 'INPUT';\n};\n\nconst isHiddenInput = function (node) {\n return isInput(node) && node.type === 'hidden';\n};\n\nconst isDetailsWithSummary = function (node) {\n const r =\n node.tagName === 'DETAILS' &&\n Array.prototype.slice\n .apply(node.children)\n .some((child) => child.tagName === 'SUMMARY');\n return r;\n};\n\nconst getCheckedRadio = function (nodes, form) {\n for (let i = 0; i < nodes.length; i++) {\n if (nodes[i].checked && nodes[i].form === form) {\n return nodes[i];\n }\n }\n};\n\nconst isTabbableRadio = function (node) {\n if (!node.name) {\n return true;\n }\n const radioScope = node.form || getRootNode(node);\n const queryRadios = function (name) {\n return radioScope.querySelectorAll(\n 'input[type=\"radio\"][name=\"' + name + '\"]'\n );\n };\n\n let radioSet;\n if (\n typeof window !== 'undefined' &&\n typeof window.CSS !== 'undefined' &&\n typeof window.CSS.escape === 'function'\n ) {\n radioSet = queryRadios(window.CSS.escape(node.name));\n } else {\n try {\n radioSet = queryRadios(node.name);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(\n 'Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s',\n err.message\n );\n return false;\n }\n }\n\n const checked = getCheckedRadio(radioSet, node.form);\n return !checked || checked === node;\n};\n\nconst isRadio = function (node) {\n return isInput(node) && node.type === 'radio';\n};\n\nconst isNonTabbableRadio = function (node) {\n return isRadio(node) && !isTabbableRadio(node);\n};\n\nconst isZeroArea = function (node) {\n const { width, height } = node.getBoundingClientRect();\n return width === 0 && height === 0;\n};\nconst isHidden = function (node, { displayCheck, getShadowRoot }) {\n // NOTE: visibility will be `undefined` if node is detached from the document\n // (see notes about this further down), which means we will consider it visible\n // (this is legacy behavior from a very long way back)\n // NOTE: we check this regardless of `displayCheck=\"none\"` because this is a\n // _visibility_ check, not a _display_ check\n if (getComputedStyle(node).visibility === 'hidden') {\n return true;\n }\n\n const isDirectSummary = matches.call(node, 'details>summary:first-of-type');\n const nodeUnderDetails = isDirectSummary ? node.parentElement : node;\n if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {\n return true;\n }\n\n // The root node is the shadow root if the node is in a shadow DOM; some document otherwise\n // (but NOT _the_ document; see second 'If' comment below for more).\n // If rootNode is shadow root, it'll have a host, which is the element to which the shadow\n // is attached, and the one we need to check if it's in the document or not (because the\n // shadow, and all nodes it contains, is never considered in the document since shadows\n // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,\n // is hidden, or is not in the document itself but is detached, it will affect the shadow's\n // visibility, including all the nodes it contains). The host could be any normal node,\n // or a custom element (i.e. web component). Either way, that's the one that is considered\n // part of the document, not the shadow root, nor any of its children (i.e. the node being\n // tested).\n // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the\n // document (per the docs) and while it's a Document-type object, that document does not\n // appear to be the same as the node's `ownerDocument` for some reason, so it's safer\n // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,\n // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when\n // node is actually detached.\n const nodeRootHost = getRootNode(node).host;\n const nodeIsAttached =\n nodeRootHost?.ownerDocument.contains(nodeRootHost) ||\n node.ownerDocument.contains(node);\n\n if (!displayCheck || displayCheck === 'full') {\n if (typeof getShadowRoot === 'function') {\n // figure out if we should consider the node to be in an undisclosed shadow and use the\n // 'non-zero-area' fallback\n const originalNode = node;\n while (node) {\n const parentElement = node.parentElement;\n const rootNode = getRootNode(node);\n if (\n parentElement &&\n !parentElement.shadowRoot &&\n getShadowRoot(parentElement) === true // check if there's an undisclosed shadow\n ) {\n // node has an undisclosed shadow which means we can only treat it as a black box, so we\n // fall back to a non-zero-area test\n return isZeroArea(node);\n } else if (node.assignedSlot) {\n // iterate up slot\n node = node.assignedSlot;\n } else if (!parentElement && rootNode !== node.ownerDocument) {\n // cross shadow boundary\n node = rootNode.host;\n } else {\n // iterate up normal dom\n node = parentElement;\n }\n }\n\n node = originalNode;\n }\n // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support\n // (i.e. it does not also presume that all nodes might have undisclosed shadows); or\n // it might be a falsy value, which means shadow DOM support is disabled\n\n // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)\n // now we can just test to see if it would normally be visible or not, provided it's\n // attached to the main document.\n // NOTE: We must consider case where node is inside a shadow DOM and given directly to\n // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.\n\n if (nodeIsAttached) {\n // this works wherever the node is: if there's at least one client rect, it's\n // somehow displayed; it also covers the CSS 'display: contents' case where the\n // node itself is hidden in place of its contents; and there's no need to search\n // up the hierarchy either\n return !node.getClientRects().length;\n }\n\n // Else, the node isn't attached to the document, which means the `getClientRects()`\n // API will __always__ return zero rects (this can happen, for example, if React\n // is used to render nodes onto a detached tree, as confirmed in this thread:\n // https://github.com/facebook/react/issues/9117#issuecomment-284228870)\n //\n // It also means that even window.getComputedStyle(node).display will return `undefined`\n // because styles are only computed for nodes that are in the document.\n //\n // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable\n // somehow. Though it was never stated officially, anyone who has ever used tabbable\n // APIs on nodes in detached containers has actually implicitly used tabbable in what\n // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck=\"none\"` mode -- essentially\n // considering __everything__ to be visible because of the innability to determine styles.\n } else if (displayCheck === 'non-zero-area') {\n // NOTE: Even though this tests that the node's client rect is non-zero to determine\n // whether it's displayed, and that a detached node will __always__ have a zero-area\n // client rect, we don't special-case for whether the node is attached or not. In\n // this mode, we do want to consider nodes that have a zero area to be hidden at all\n // times, and that includes attached or not.\n return isZeroArea(node);\n }\n\n // visible, as far as we can tell, or per current `displayCheck` mode\n return false;\n};\n\n// form fields (nested) inside a disabled fieldset are not focusable/tabbable\n// unless they are in the _first_ <legend> element of the top-most disabled\n// fieldset\nconst isDisabledFromFieldset = function (node) {\n if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {\n let parentNode = node.parentElement;\n // check if `node` is contained in a disabled <fieldset>\n while (parentNode) {\n if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {\n // look for the first <legend> among the children of the disabled <fieldset>\n for (let i = 0; i < parentNode.children.length; i++) {\n const child = parentNode.children.item(i);\n // when the first <legend> (in document order) is found\n if (child.tagName === 'LEGEND') {\n // if its parent <fieldset> is not nested in another disabled <fieldset>,\n // return whether `node` is a descendant of its first <legend>\n return matches.call(parentNode, 'fieldset[disabled] *')\n ? true\n : !child.contains(node);\n }\n }\n // the disabled <fieldset> containing `node` has no <legend>\n return true;\n }\n parentNode = parentNode.parentElement;\n }\n }\n\n // else, node's tabbable/focusable state should not be affected by a fieldset's\n // enabled/disabled state\n return false;\n};\n\nconst isNodeMatchingSelectorFocusable = function (options, node) {\n if (\n node.disabled ||\n isHiddenInput(node) ||\n isHidden(node, options) ||\n // For a details element with a summary, the summary element gets the focus\n isDetailsWithSummary(node) ||\n isDisabledFromFieldset(node)\n ) {\n return false;\n }\n return true;\n};\n\nconst isNodeMatchingSelectorTabbable = function (options, node) {\n if (\n isNonTabbableRadio(node) ||\n getTabindex(node) < 0 ||\n !isNodeMatchingSelectorFocusable(options, node)\n ) {\n return false;\n }\n return true;\n};\n\nconst isValidShadowRootTabbable = function (shadowHostNode) {\n const tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);\n if (isNaN(tabIndex) || tabIndex >= 0) {\n return true;\n }\n // If a custom element has an explicit negative tabindex,\n // browsers will not allow tab targeting said element's children.\n return false;\n};\n\n/**\n * @param {Array.<Element|CandidatesScope>} candidates\n * @returns Element[]\n */\nconst sortByOrder = function (candidates) {\n const regularTabbables = [];\n const orderedTabbables = [];\n candidates.forEach(function (item, i) {\n const isScope = !!item.scope;\n const element = isScope ? item.scope : item;\n const candidateTabindex = getTabindex(element, isScope);\n const elements = isScope ? sortByOrder(item.candidates) : element;\n if (candidateTabindex === 0) {\n isScope\n ? regularTabbables.push(...elements)\n : regularTabbables.push(element);\n } else {\n orderedTabbables.push({\n documentOrder: i,\n tabIndex: candidateTabindex,\n item: item,\n isScope: isScope,\n content: elements,\n });\n }\n });\n\n return orderedTabbables\n .sort(sortOrderedTabbables)\n .reduce((acc, sortable) => {\n sortable.isScope\n ? acc.push(...sortable.content)\n : acc.push(sortable.content);\n return acc;\n }, [])\n .concat(regularTabbables);\n};\n\nconst tabbable = function (el, options) {\n options = options || {};\n\n let candidates;\n if (options.getShadowRoot) {\n candidates = getCandidatesIteratively([el], options.includeContainer, {\n filter: isNodeMatchingSelectorTabbable.bind(null, options),\n flatten: false,\n getShadowRoot: options.getShadowRoot,\n shadowRootFilter: isValidShadowRootTabbable,\n });\n } else {\n candidates = getCandidates(\n el,\n options.includeContainer,\n isNodeMatchingSelectorTabbable.bind(null, options)\n );\n }\n return sortByOrder(candidates);\n};\n\nconst focusable = function (el, options) {\n options = options || {};\n\n let candidates;\n if (options.getShadowRoot) {\n candidates = getCandidatesIteratively([el], options.includeContainer, {\n filter: isNodeMatchingSelectorFocusable.bind(null, options),\n flatten: true,\n getShadowRoot: options.getShadowRoot,\n });\n } else {\n candidates = getCandidates(\n el,\n options.includeContainer,\n isNodeMatchingSelectorFocusable.bind(null, options)\n );\n }\n\n return candidates;\n};\n\nconst isTabbable = function (node, options) {\n options = options || {};\n if (!node) {\n throw new Error('No node provided');\n }\n if (matches.call(node, candidateSelector) === false) {\n return false;\n }\n return isNodeMatchingSelectorTabbable(options, node);\n};\n\nconst focusableCandidateSelector = /* #__PURE__ */ candidateSelectors\n .concat('iframe')\n .join(',');\n\nconst isFocusable = function (node, options) {\n options = options || {};\n if (!node) {\n throw new Error('No node provided');\n }\n if (matches.call(node, focusableCandidateSelector) === false) {\n return false;\n }\n return isNodeMatchingSelectorFocusable(options, node);\n};\n\nexport { tabbable, focusable, isTabbable, isFocusable };\n","import { tabbable, focusable, isFocusable, isTabbable } from 'tabbable';\n\nconst activeFocusTraps = (function () {\n const trapQueue = [];\n return {\n activateTrap(trap) {\n if (trapQueue.length > 0) {\n const activeTrap = trapQueue[trapQueue.length - 1];\n if (activeTrap !== trap) {\n activeTrap.pause();\n }\n }\n\n const trapIndex = trapQueue.indexOf(trap);\n if (trapIndex === -1) {\n trapQueue.push(trap);\n } else {\n // move this existing trap to the front of the queue\n trapQueue.splice(trapIndex, 1);\n trapQueue.push(trap);\n }\n },\n\n deactivateTrap(trap) {\n const trapIndex = trapQueue.indexOf(trap);\n if (trapIndex !== -1) {\n trapQueue.splice(trapIndex, 1);\n }\n\n if (trapQueue.length > 0) {\n trapQueue[trapQueue.length - 1].unpause();\n }\n },\n };\n})();\n\nconst isSelectableInput = function (node) {\n return (\n node.tagName &&\n node.tagName.toLowerCase() === 'input' &&\n typeof node.select === 'function'\n );\n};\n\nconst isEscapeEvent = function (e) {\n return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;\n};\n\nconst isTabEvent = function (e) {\n return e.key === 'Tab' || e.keyCode === 9;\n};\n\nconst delay = function (fn) {\n return setTimeout(fn, 0);\n};\n\n// Array.find/findIndex() are not supported on IE; this replicates enough\n// of Array.findIndex() for our needs\nconst findIndex = function (arr, fn) {\n let idx = -1;\n\n arr.every(function (value, i) {\n if (fn(value)) {\n idx = i;\n return false; // break\n }\n\n return true; // next\n });\n\n return idx;\n};\n\n/**\n * Get an option's value when it could be a plain value, or a handler that provides\n * the value.\n * @param {*} value Option's value to check.\n * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.\n * @returns {*} The `value`, or the handler's returned value.\n */\nconst valueOrHandler = function (value, ...params) {\n return typeof value === 'function' ? value(...params) : value;\n};\n\nconst getActualTarget = function (event) {\n // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the\n // shadow host. However, event.target.composedPath() will be an array of\n // nodes \"clicked\" from inner-most (the actual element inside the shadow) to\n // outer-most (the host HTML document). If we have access to composedPath(),\n // then use its first element; otherwise, fall back to event.target (and\n // this only works for an _open_ shadow DOM; otherwise,\n // composedPath()[0] === event.target always).\n return event.target.shadowRoot && typeof event.composedPath === 'function'\n ? event.composedPath()[0]\n : event.target;\n};\n\nconst createFocusTrap = function (elements, userOptions) {\n // SSR: a live trap shouldn't be created in this type of environment so this\n // should be safe code to execute if the `document` option isn't specified\n const doc = userOptions?.document || document;\n\n const config = {\n returnFocusOnDeactivate: true,\n escapeDeactivates: true,\n delayInitialFocus: true,\n ...userOptions,\n };\n\n const state = {\n // containers given to createFocusTrap()\n // @type {Array<HTMLElement>}\n containers: [],\n\n // list of objects identifying tabbable nodes in `containers` in the trap\n // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap\n // is active, but the trap should never get to a state where there isn't at least one group\n // with at least one tabbable node in it (that would lead to an error condition that would\n // result in an error being thrown)\n // @type {Array<{\n // container: HTMLElement,\n // tabbableNodes: Array<HTMLElement>, // empty if none\n // focusableNodes: Array<HTMLElement>, // empty if none\n // firstTabbableNode: HTMLElement|null,\n // lastTabbableNode: HTMLElement|null,\n // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined\n // }>}\n containerGroups: [], // same order/length as `containers` list\n\n // references to objects in `containerGroups`, but only those that actually have\n // tabbable nodes in them\n // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__\n // the same length\n tabbableGroups: [],\n\n nodeFocusedBeforeActivation: null,\n mostRecentlyFocusedNode: null,\n active: false,\n paused: false,\n\n // timer ID for when delayInitialFocus is true and initial focus in this trap\n // has been delayed during activation\n delayInitialFocusTimer: undefined,\n };\n\n let trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later\n\n /**\n * Gets a configuration option value.\n * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,\n * value will be taken from this object. Otherwise, value will be taken from base configuration.\n * @param {string} optionName Name of the option whose value is sought.\n * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`\n * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.\n */\n const getOption = (configOverrideOptions, optionName, configOptionName) => {\n return configOverrideOptions &&\n configOverrideOptions[optionName] !== undefined\n ? configOverrideOptions[optionName]\n : config[configOptionName || optionName];\n };\n\n /**\n * Finds the index of the container that contains the element.\n * @param {HTMLElement} element\n * @returns {number} Index of the container in either `state.containers` or\n * `state.containerGroups` (the order/length of these lists are the same); -1\n * if the element isn't found.\n */\n const findContainerIndex = function (element) {\n // NOTE: search `containerGroups` because it's possible a group contains no tabbable\n // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)\n // and we still need to find the element in there\n return state.containerGroups.findIndex(\n ({ container, tabbableNodes }) =>\n container.contains(element) ||\n // fall back to explicit tabbable search which will take into consideration any\n // web components if the `tabbableOptions.getShadowRoot` option was used for\n // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't\n // look inside web components even if open)\n tabbableNodes.find((node) => node === element)\n );\n };\n\n /**\n * Gets the node for the given option, which is expected to be an option that\n * can be either a DOM node, a string that is a selector to get a node, `false`\n * (if a node is explicitly NOT given), or a function that returns any of these\n * values.\n * @param {string} optionName\n * @returns {undefined | false | HTMLElement | SVGElement} Returns\n * `undefined` if the option is not specified; `false` if the option\n * resolved to `false` (node explicitly not given); otherwise, the resolved\n * DOM node.\n * @throws {Error} If the option is set, not `false`, and is not, or does not\n * resolve to a node.\n */\n const getNodeForOption = function (optionName, ...params) {\n let optionValue = config[optionName];\n\n if (typeof optionValue === 'function') {\n optionValue = optionValue(...params);\n }\n\n if (optionValue === true) {\n optionValue = undefined; // use default value\n }\n\n if (!optionValue) {\n if (optionValue === undefined || optionValue === false) {\n return optionValue;\n }\n // else, empty string (invalid), null (invalid), 0 (invalid)\n\n throw new Error(\n `\\`${optionName}\\` was specified but was not a node, or did not return a node`\n );\n }\n\n let node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point\n\n if (typeof optionValue === 'string') {\n node = doc.querySelector(optionValue); // resolve to node, or null if fails\n if (!node) {\n throw new Error(\n `\\`${optionName}\\` as selector refers to no known node`\n );\n }\n }\n\n return node;\n };\n\n const getInitialFocusNode = function () {\n let node = getNodeForOption('initialFocus');\n\n // false explicitly indicates we want no initialFocus at all\n if (node === false) {\n return false;\n }\n\n if (node === undefined) {\n // option not specified: use fallback options\n if (findContainerIndex(doc.activeElement) >= 0) {\n node = doc.activeElement;\n } else {\n const firstTabbableGroup = state.tabbableGroups[0];\n const firstTabbableNode =\n firstTabbableGroup && firstTabbableGroup.firstTabbableNode;\n\n // NOTE: `fallbackFocus` option function cannot return `false` (not supported)\n node = firstTabbableNode || getNodeForOption('fallbackFocus');\n }\n }\n\n if (!node) {\n throw new Error(\n 'Your focus-trap needs to have at least one focusable element'\n );\n }\n\n return node;\n };\n\n const updateTabbableNodes = function () {\n state.containerGroups = state.containers.map((container) => {\n const tabbableNodes = tabbable(container, config.tabbableOptions);\n\n // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes\n // are a superset of tabbable nodes\n const focusableNodes = focusable(container, config.tabbableOptions);\n\n return {\n container,\n tabbableNodes,\n focusableNodes,\n firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,\n lastTabbableNode:\n tabbableNodes.length > 0\n ? tabbableNodes[tabbableNodes.length - 1]\n : null,\n\n /**\n * Finds the __tabbable__ node that follows the given node in the specified direction,\n * in this container, if any.\n * @param {HTMLElement} node\n * @param {boolean} [forward] True if going in forward tab order; false if going\n * in reverse.\n * @returns {HTMLElement|undefined} The next tabbable node, if any.\n */\n nextTabbableNode(node, forward = true) {\n // NOTE: If tabindex is positive (in order to manipulate the tab order separate\n // from the DOM order), this __will not work__ because the list of focusableNodes,\n // while it contains tabbable nodes, does not sort its nodes in any order other\n // than DOM order, because it can't: Where would you place focusable (but not\n // tabbable) nodes in that order? They have no order, because they aren't tabbale...\n // Support for positive tabindex is already broken and hard to manage (possibly\n // not supportable, TBD), so this isn't going to make things worse than they\n // already are, and at least makes things better for the majority of cases where\n // tabindex is either 0/unset or negative.\n // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375\n const nodeIdx = focusableNodes.findIndex((n) => n === node);\n if (nodeIdx < 0) {\n return undefined;\n }\n\n if (forward) {\n return focusableNodes\n .slice(nodeIdx + 1)\n .find((n) => isTabbable(n, config.tabbableOptions));\n }\n\n return focusableNodes\n .slice(0, nodeIdx)\n .reverse()\n .find((n) => isTabbable(n, config.tabbableOptions));\n },\n };\n });\n\n state.tabbableGroups = state.containerGroups.filter(\n (group) => group.tabbableNodes.length > 0\n );\n\n // throw if no groups have tabbable nodes and we don't have a fallback focus node either\n if (\n state.tabbableGroups.length <= 0 &&\n !getNodeForOption('fallbackFocus') // returning false not supported for this option\n ) {\n throw new Error(\n 'Your focus-trap must have at least one container with at least one tabbable node in it at all times'\n );\n }\n };\n\n const tryFocus = function (node) {\n if (node === false) {\n return;\n }\n\n if (node === doc.activeElement) {\n return;\n }\n\n if (!node || !node.focus) {\n tryFocus(getInitialFocusNode());\n return;\n }\n\n node.focus({ preventScroll: !!config.preventScroll });\n state.mostRecentlyFocusedNode = node;\n\n if (isSelectableInput(node)) {\n node.select();\n }\n };\n\n const getReturnFocusNode = function (previousActiveElement) {\n const node = getNodeForOption('setReturnFocus', previousActiveElement);\n return node ? node : node === false ? false : previousActiveElement;\n };\n\n // This needs to be done on mousedown and touchstart instead of click\n // so that it precedes the focus event.\n const checkPointerDown = function (e) {\n const target = getActualTarget(e);\n\n if (findContainerIndex(target) >= 0) {\n // allow the click since it ocurred inside the trap\n return;\n }\n\n if (valueOrHandler(config.clickOutsideDeactivates, e)) {\n // immediately deactivate the trap\n trap.deactivate({\n // if, on deactivation, we should return focus to the node originally-focused\n // when the trap was activated (or the configured `setReturnFocus` node),\n // then assume it's also OK to return focus to the outside node that was\n // just clicked, causing deactivation, as long as that node is focusable;\n // if it isn't focusable, then return focus to the original node focused\n // on activation (or the configured `setReturnFocus` node)\n // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,\n // which will result in the outside click setting focus to the node\n // that was clicked, whether it's focusable or not; by setting\n // `returnFocus: true`, we'll attempt to re-focus the node originally-focused\n // on activation (or the configured `setReturnFocus` node)\n returnFocus:\n config.returnFocusOnDeactivate &&\n !isFocusable(target, config.tabbableOptions),\n });\n return;\n }\n\n // This is needed for mobile devices.\n // (If we'll only let `click` events through,\n // then on mobile they will be blocked anyways if `touchstart` is blocked.)\n if (valueOrHandler(config.allowOutsideClick, e)) {\n // allow the click outside the trap to take place\n return;\n }\n\n // otherwise, prevent the click\n e.preventDefault();\n };\n\n // In case focus escapes the trap for some strange reason, pull it back in.\n const checkFocusIn = function (e) {\n const target = getActualTarget(e);\n const targetContained = findContainerIndex(target) >= 0;\n\n // In Firefox when you Tab out of an iframe the Document is briefly focused.\n if (targetContained || target instanceof Document) {\n if (targetContained) {\n state.mostRecentlyFocusedNode = target;\n }\n } else {\n // escaped! pull it back in to where it just left\n e.stopImmediatePropagation();\n tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());\n }\n };\n\n // Hijack Tab events on the first and last focusable nodes of the trap,\n // in order to prevent focus from escaping. If it escapes for even a\n // moment it can end up scrolling the page and causing confusion so we\n // kind of need to capture the action at the keydown phase.\n const checkTab = function (e) {\n const target = getActualTarget(e);\n updateTabbableNodes();\n\n let destinationNode = null;\n\n if (state.tabbableGroups.length > 0) {\n // make sure the target is actually contained in a group\n // NOTE: the target may also be the container itself if it's focusable\n // with tabIndex='-1' and was given initial focus\n const containerIndex = findContainerIndex(target);\n const containerGroup =\n containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;\n\n if (containerIndex < 0) {\n // target not found in any group: quite possible focus has escaped the trap,\n // so bring it back in to...\n if (e.shiftKey) {\n // ...the last node in the last group\n destinationNode =\n state.tabbableGroups[state.tabbableGroups.length - 1]\n .lastTabbableNode;\n } else {\n // ...the first node in the first group\n destinationNode = state.tabbableGroups[0].firstTabbableNode;\n }\n } else if (e.shiftKey) {\n // REVERSE\n\n // is the target the first tabbable node in a group?\n let startOfGroupIndex = findIndex(\n state.tabbableGroups,\n ({ firstTabbableNode }) => target === firstTabbableNode\n );\n\n if (\n startOfGroupIndex < 0 &&\n (containerGroup.container === target ||\n (isFocusable(target, config.tabbableOptions) &&\n !isTabbable(target, config.tabbableOptions) &&\n !containerGroup.nextTabbableNode(target, false)))\n ) {\n // an exception case where the target is either the container itself, or\n // a non-tabbable node that was given focus (i.e. tabindex is negative\n // and user clicked on it or node was programmatically given focus)\n // and is not followed by any other tabbable node, in which\n // case, we should handle shift+tab as if focus were on the container's\n // first tabbable node, and go to the last tabbable node of the LAST group\n startOfGroupIndex = containerIndex;\n }\n\n if (startOfGroupIndex >= 0) {\n // YES: then shift+tab should go to the last tabbable node in the\n // previous group (and wrap around to the last tabbable node of\n // the LAST group if it's the first tabbable node of the FIRST group)\n const destinationGroupIndex =\n startOfGroupIndex === 0\n ? state.tabbableGroups.length - 1\n : startOfGroupIndex - 1;\n\n const destinationGroup = state.tabbableGroups[destinationGroupIndex];\n destinationNode = destinationGroup.lastTabbableNode;\n }\n } else {\n // FORWARD\n\n // is the target the last tabbable node in a group?\n let lastOfGroupIndex = findIndex(\n state.tabbableGroups,\n ({ lastTabbableNode }) => target === lastTabbableNode\n );\n\n if (\n lastOfGroupIndex < 0 &&\n (containerGroup.container === target ||\n (isFocusable(target, config.tabbableOptions) &&\n !isTabbable(target, config.tabbableOptions) &&\n !containerGroup.nextTabbableNode(target)))\n ) {\n // an exception case where the target is the container itself, or\n // a non-tabbable node that was given focus (i.e. tabindex is negative\n // and user clicked on it or node was programmatically given focus)\n // and is not followed by any other tabbable node, in which\n // case, we should handle tab as if focus were on the container's\n // last tabbable node, and go to the first tabbable node of the FIRST group\n lastOfGroupIndex = containerIndex;\n }\n\n if (lastOfGroupIndex >= 0) {\n // YES: then tab should go to the first tabbable node in the next\n // group (and wrap around to the first tabbable node of the FIRST\n // group if it's the last tabbable node of the LAST group)\n const destinationGroupIndex =\n lastOfGroupIndex === state.tabbableGroups.length - 1\n ? 0\n : lastOfGroupIndex + 1;\n\n const destinationGroup = state.tabbableGroups[destinationGroupIndex];\n destinationNode = destinationGroup.firstTabbableNode;\n }\n }\n } else {\n // NOTE: the fallbackFocus option does not support returning false to opt-out\n destinationNode = getNodeForOption('fallbackFocus');\n }\n\n if (destinationNode) {\n e.preventDefault();\n tryFocus(destinationNode);\n }\n // else, let the browser take care of [shift+]tab and move the focus\n };\n\n const checkKey = function (e) {\n if (\n isEscapeEvent(e) &&\n valueOrHandler(config.escapeDeactivates, e) !== false\n ) {\n e.preventDefault();\n trap.deactivate();\n return;\n }\n\n if (isTabEvent(e)) {\n checkTab(e);\n return;\n }\n };\n\n const checkClick = function (e) {\n const target = getActualTarget(e);\n\n if (findContainerIndex(target) >= 0) {\n return;\n }\n\n if (valueOrHandler(config.clickOutsideDeactivates, e)) {\n return;\n }\n\n if (valueOrHandler(config.allowOutsideClick, e)) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n\n //\n // EVENT LISTENERS\n //\n\n const addListeners = function () {\n if (!state.active) {\n return;\n }\n\n // There can be only one listening focus trap at a time\n activeFocusTraps.activateTrap(trap);\n\n // Delay ensures that the focused element doesn't capture the event\n // that caused the focus trap activation.\n state.delayInitialFocusTimer = config.delayInitialFocus\n ? delay(function () {\n tryFocus(getInitialFocusNode());\n })\n : tryFocus(getInitialFocusNode());\n\n doc.addEventListener('focusin', checkFocusIn, true);\n doc.addEventListener('mousedown', checkPointerDown, {\n capture: true,\n passive: false,\n });\n doc.addEventListener('touchstart', checkPointerDown, {\n capture: true,\n passive: false,\n });\n doc.addEventListener('click', checkClick, {\n capture: true,\n passive: false,\n });\n doc.addEventListener('keydown', checkKey, {\n capture: true,\n passive: false,\n });\n\n return trap;\n };\n\n const removeListeners = function () {\n if (!state.active) {\n return;\n }\n\n doc.removeEventListener('focusin', checkFocusIn, true);\n doc.removeEventListener('mousedown', checkPointerDown, true);\n doc.removeEventListener('touchstart', checkPointerDown, true);\n doc.removeEventListener('click', checkClick, true);\n doc.removeEventListener('keydown', checkKey, true);\n\n return trap;\n };\n\n //\n // TRAP DEFINITION\n //\n\n trap = {\n get active() {\n return state.active;\n },\n\n get paused() {\n return state.paused;\n },\n\n activate(activateOptions) {\n if (state.active) {\n return this;\n }\n\n const onActivate = getOption(activateOptions, 'onActivate');\n const onPostActivate = getOption(activateOptions, 'onPostActivate');\n const checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');\n\n if (!checkCanFocusTrap) {\n updateTabbableNodes();\n }\n\n state.active = true;\n state.paused = false;\n state.nodeFocusedBeforeActivation = doc.activeElement;\n\n if (onActivate) {\n onActivate();\n }\n\n const finishActivation = () => {\n if (checkCanFocusTrap) {\n updateTabbableNodes();\n }\n addListeners();\n if (onPostActivate) {\n onPostActivate();\n }\n };\n\n if (checkCanFocusTrap) {\n checkCanFocusTrap(state.containers.concat()).then(\n finishActivation,\n finishActivation\n );\n return this;\n }\n\n finishActivation();\n return this;\n },\n\n deactivate(deactivateOptions) {\n if (!state.active) {\n return this;\n }\n\n const options = {\n onDeactivate: config.onDeactivate,\n onPostDeactivate: config.onPostDeactivate,\n checkCanReturnFocus: config.checkCanReturnFocus,\n ...deactivateOptions,\n };\n\n clearTimeout(state.delayInitialFocusTimer); // noop if undefined\n state.delayInitialFocusTimer = undefined;\n\n removeListeners();\n state.active = false;\n state.paused = false;\n\n activeFocusTraps.deactivateTrap(trap);\n\n const onDeactivate = getOption(options, 'onDeactivate');\n const onPostDeactivate = getOption(options, 'onPostDeactivate');\n const checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');\n const returnFocus = getOption(\n options,\n 'returnFocus',\n 'returnFocusOnDeactivate'\n );\n\n if (onDeactivate) {\n onDeactivate();\n }\n\n const finishDeactivation = () => {\n delay(() => {\n if (returnFocus) {\n tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));\n }\n if (onPostDeactivate) {\n onPostDeactivate();\n }\n });\n };\n\n if (returnFocus && checkCanReturnFocus) {\n checkCanReturnFocus(\n getReturnFocusNode(state.nodeFocusedBeforeActivation)\n ).then(finishDeactivation, finishDeactivation);\n return this;\n }\n\n finishDeactivation();\n return this;\n },\n\n pause() {\n if (state.paused || !state.active) {\n return this;\n }\n\n state.paused = true;\n removeListeners();\n\n return this;\n },\n\n unpause() {\n if (!state.paused || !state.active) {\n return this;\n }\n\n state.paused = false;\n updateTabbableNodes();\n addListeners();\n\n return this;\n },\n\n updateContainerElements(containerElements) {\n const elementsAsArray = [].concat(containerElements).filter(Boolean);\n\n state.containers = elementsAsArray.map((element) =>\n typeof element === 'string' ? doc.querySelector(element) : element\n );\n\n if (state.active) {\n updateTabbableNodes();\n }\n\n return this;\n },\n };\n\n // initialize container elements\n trap.updateContainerElements(elements);\n\n return trap;\n};\n\nexport { createFocusTrap };\n","function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\n// Older browsers don't support event options, feature detect it.\n\n// Adopted and modified solution from Bohdan Didukh (2017)\n// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi\n\nvar hasPassiveEvents = false;\nif (typeof window !== 'undefined') {\n var passiveTestOptions = {\n get passive() {\n hasPassiveEvents = true;\n return undefined;\n }\n };\n window.addEventListener('testPassive', null, passiveTestOptions);\n window.removeEventListener('testPassive', null, passiveTestOptions);\n}\n\nvar isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);\n\n\nvar locks = [];\nvar documentListenerAdded = false;\nvar initialClientY = -1;\nvar previousBodyOverflowSetting = void 0;\nvar previousBodyPaddingRight = void 0;\n\n// returns true if `el` should be allowed to receive touchmove events.\nvar allowTouchMove = function allowTouchMove(el) {\n return locks.some(function (lock) {\n if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {\n return true;\n }\n\n return false;\n });\n};\n\nvar preventDefault = function preventDefault(rawEvent) {\n var e = rawEvent || window.event;\n\n // For the case whereby consumers adds a touchmove event listener to document.\n // Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })\n // in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then\n // the touchmove event on document will break.\n if (allowTouchMove(e.target)) {\n return true;\n }\n\n // Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).\n if (e.touches.length > 1) return true;\n\n if (e.preventDefault) e.preventDefault();\n\n return false;\n};\n\nvar setOverflowHidden = function setOverflowHidden(options) {\n // If previousBodyPaddingRight is already set, don't set it again.\n if (previousBodyPaddingRight === undefined) {\n var _reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;\n var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;\n\n if (_reserveScrollBarGap && scrollBarGap > 0) {\n previousBodyPaddingRight = document.body.style.paddingRight;\n document.body.style.paddingRight = scrollBarGap + 'px';\n }\n }\n\n // If previousBodyOverflowSetting is already set, don't set it again.\n if (previousBodyOverflowSetting === undefined) {\n previousBodyOverflowSetting = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n};\n\nvar restoreOverflowSetting = function restoreOverflowSetting() {\n if (previousBodyPaddingRight !== undefined) {\n document.body.style.paddingRight = previousBodyPaddingRight;\n\n // Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it\n // can be set again.\n previousBodyPaddingRight = undefined;\n }\n\n if (previousBodyOverflowSetting !== undefined) {\n document.body.style.overflow = previousBodyOverflowSetting;\n\n // Restore previousBodyOverflowSetting to undefined\n // so setOverflowHidden knows it can be set again.\n previousBodyOverflowSetting = undefined;\n }\n};\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions\nvar isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {\n return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;\n};\n\nvar handleScroll = function handleScroll(event, targetElement) {\n var clientY = event.targetTouches[0].clientY - initialClientY;\n\n if (allowTouchMove(event.target)) {\n return false;\n }\n\n if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {\n // element is at the top of its scroll.\n return preventDefault(event);\n }\n\n if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {\n // element is at the bottom of its scroll.\n return preventDefault(event);\n }\n\n event.stopPropagation();\n return true;\n};\n\nexport var disableBodyScroll = function disableBodyScroll(targetElement, options) {\n // targetElement must be provided\n if (!targetElement) {\n // eslint-disable-next-line no-console\n console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');\n return;\n }\n\n // disableBodyScroll must not have been called on this targetElement before\n if (locks.some(function (lock) {\n return lock.targetElement === targetElement;\n })) {\n return;\n }\n\n var lock = {\n targetElement: targetElement,\n options: options || {}\n };\n\n locks = [].concat(_toConsumableArray(locks), [lock]);\n\n if (isIosDevice) {\n targetElement.ontouchstart = function (event) {\n if (event.targetTouches.length === 1) {\n // detect single touch.\n initialClientY = event.targetTouches[0].clientY;\n }\n };\n targetElement.ontouchmove = function (event) {\n if (event.targetTouches.length === 1) {\n // detect single touch.\n handleScroll(event, targetElement);\n }\n };\n\n if (!documentListenerAdded) {\n document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);\n documentListenerAdded = true;\n }\n } else {\n setOverflowHidden(options);\n }\n};\n\nexport var clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {\n if (isIosDevice) {\n // Clear all locks ontouchstart/ontouchmove handlers, and the references.\n locks.forEach(function (lock) {\n lock.targetElement.ontouchstart = null;\n lock.targetElement.ontouchmove = null;\n });\n\n if (documentListenerAdded) {\n document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);\n documentListenerAdded = false;\n }\n\n // Reset initial clientY.\n initialClientY = -1;\n } else {\n restoreOverflowSetting();\n }\n\n locks = [];\n};\n\nexport var enableBodyScroll = function enableBodyScroll(targetElement) {\n if (!targetElement) {\n // eslint-disable-next-line no-console\n console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');\n return;\n }\n\n locks = locks.filter(function (lock) {\n return lock.targetElement !== targetElement;\n });\n\n if (isIosDevice) {\n targetElement.ontouchstart = null;\n targetElement.ontouchmove = null;\n\n if (documentListenerAdded && locks.length === 0) {\n document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);\n documentListenerAdded = false;\n }\n } else if (!locks.length) {\n restoreOverflowSetting();\n }\n};\n\n","var ResizeObserverBoxOptions;\n(function (ResizeObserverBoxOptions) {\n ResizeObserverBoxOptions[\"BORDER_BOX\"] = \"border-box\";\n ResizeObserverBoxOptions[\"CONTENT_BOX\"] = \"content-box\";\n ResizeObserverBoxOptions[\"DEVICE_PIXEL_CONTENT_BOX\"] = \"device-pixel-content-box\";\n})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));\nexport { ResizeObserverBoxOptions };\n","var resizeObservers = [];\nexport { resizeObservers };\n","var msg = 'ResizeObserver loop completed with undelivered notifications.';\nvar deliverResizeLoopError = function () {\n var event;\n if (typeof ErrorEvent === 'function') {\n event = new ErrorEvent('error', {\n message: msg\n });\n }\n else {\n event = document.createEvent('Event');\n event.initEvent('error', false, false);\n event.message = msg;\n }\n window.dispatchEvent(event);\n};\nexport { deliverResizeLoopError };\n","export var freeze = function (obj) { return Object.freeze(obj); };\n","var trigger;\nvar callbacks = [];\nvar notify = function () { return callbacks.splice(0).forEach(function (cb) { return cb(); }); };\nvar queueMicroTask = function (callback) {\n if (!trigger) {\n var toggle_1 = 0;\n var el_1 = document.createTextNode('');\n var config = { characterData: true };\n new MutationObserver(function () { return notify(); }).observe(el_1, config);\n trigger = function () { el_1.textContent = \"\".concat(toggle_1 ? toggle_1-- : toggle_1++); };\n }\n callbacks.push(callback);\n trigger();\n};\nexport { queueMicroTask };\n","import { freeze } from './utils/freeze';\nvar ResizeObserverSize = (function () {\n function ResizeObserverSize(inlineSize, blockSize) {\n this.inlineSize = inlineSize;\n this.blockSize = blockSize;\n freeze(this);\n }\n return ResizeObserverSize;\n}());\nexport { ResizeObserverSize };\n","import { freeze } from './utils/freeze';\nvar DOMRectReadOnly = (function () {\n function DOMRectReadOnly(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.top = this.y;\n this.left = this.x;\n this.bottom = this.top + this.height;\n this.right = this.left + this.width;\n return freeze(this);\n }\n DOMRectReadOnly.prototype.toJSON = function () {\n var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, width = _a.width, height = _a.height;\n return { x: x, y: y, top: top, right: right, bottom: bottom, left: left, width: width, height: height };\n };\n DOMRectReadOnly.fromRect = function (rectangle) {\n return new DOMRectReadOnly(rectangle.x, rectangle.y, rectangle.width, rectangle.height);\n };\n return DOMRectReadOnly;\n}());\nexport { DOMRectReadOnly };\n","var isSVG = function (target) { return target instanceof SVGElement && 'getBBox' in target; };\nvar isHidden = function (target) {\n if (isSVG(target)) {\n var _a = target.getBBox(), width = _a.width, height = _a.height;\n return !width && !height;\n }\n var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;\n return !(offsetWidth || offsetHeight || target.getClientRects().length);\n};\nvar isElement = function (obj) {\n var _a;\n if (obj instanceof Element) {\n return true;\n }\n var scope = (_a = obj === null || obj === void 0 ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;\n return !!(scope && obj instanceof scope.Element);\n};\nvar isReplacedElement = function (target) {\n switch (target.tagName) {\n case 'INPUT':\n if (target.type !== 'image') {\n break;\n }\n case 'VIDEO':\n case 'AUDIO':\n case 'EMBED':\n case 'OBJECT':\n case 'CANVAS':\n case 'IFRAME':\n case 'IMG':\n return true;\n }\n return false;\n};\nexport { isSVG, isHidden, isElement, isReplacedElement };\n","export var global = typeof window !== 'undefined' ? window : {};\n","import { ResizeObserverBoxOptions } from '../ResizeObserverBoxOptions';\nimport { ResizeObserverSize } from '../ResizeObserverSize';\nimport { DOMRectReadOnly } from '../DOMRectReadOnly';\nimport { isSVG, isHidden } from '../utils/element';\nimport { freeze } from '../utils/freeze';\nimport { global } from '../utils/global';\nvar cache = new WeakMap();\nvar scrollRegexp = /auto|scroll/;\nvar verticalRegexp = /^tb|vertical/;\nvar IE = (/msie|trident/i).test(global.navigator && global.navigator.userAgent);\nvar parseDimension = function (pixel) { return parseFloat(pixel || '0'); };\nvar size = function (inlineSize, blockSize, switchSizes) {\n if (inlineSize === void 0) { inlineSize = 0; }\n if (blockSize === void 0) { blockSize = 0; }\n if (switchSizes === void 0) { switchSizes = false; }\n return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);\n};\nvar zeroBoxes = freeze({\n devicePixelContentBoxSize: size(),\n borderBoxSize: size(),\n contentBoxSize: size(),\n contentRect: new DOMRectReadOnly(0, 0, 0, 0)\n});\nvar calculateBoxSizes = function (target, forceRecalculation) {\n if (forceRecalculation === void 0) { forceRecalculation = false; }\n if (cache.has(target) && !forceRecalculation) {\n return cache.get(target);\n }\n if (isHidden(target)) {\n cache.set(target, zeroBoxes);\n return zeroBoxes;\n }\n var cs = getComputedStyle(target);\n var svg = isSVG(target) && target.ownerSVGElement && target.getBBox();\n var removePadding = !IE && cs.boxSizing === 'border-box';\n var switchSizes = verticalRegexp.test(cs.writingMode || '');\n var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || '');\n var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || '');\n var paddingTop = svg ? 0 : parseDimension(cs.paddingTop);\n var paddingRight = svg ? 0 : parseDimension(cs.paddingRight);\n var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom);\n var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft);\n var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth);\n var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth);\n var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth);\n var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth);\n var horizontalPadding = paddingLeft + paddingRight;\n var verticalPadding = paddingTop + paddingBottom;\n var horizontalBorderArea = borderLeft + borderRight;\n var verticalBorderArea = borderTop + borderBottom;\n var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight;\n var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth;\n var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0;\n var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0;\n var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness;\n var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness;\n var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;\n var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;\n var boxes = freeze({\n devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),\n borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),\n contentBoxSize: size(contentWidth, contentHeight, switchSizes),\n contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)\n });\n cache.set(target, boxes);\n return boxes;\n};\nvar calculateBoxSize = function (target, observedBox, forceRecalculation) {\n var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;\n switch (observedBox) {\n case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:\n return devicePixelContentBoxSize;\n case ResizeObserverBoxOptions.BORDER_BOX:\n return borderBoxSize;\n default:\n return contentBoxSize;\n }\n};\nexport { calculateBoxSize, calculateBoxSizes };\n","import { calculateBoxSizes } from './algorithms/calculateBoxSize';\nimport { freeze } from './utils/freeze';\nvar ResizeObserverEntry = (function () {\n function ResizeObserverEntry(target) {\n var boxes = calculateBoxSizes(target);\n this.target = target;\n this.contentRect = boxes.contentRect;\n this.borderBoxSize = freeze([boxes.borderBoxSize]);\n this.contentBoxSize = freeze([boxes.contentBoxSize]);\n this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);\n }\n return ResizeObserverEntry;\n}());\nexport { ResizeObserverEntry };\n","import { isHidden } from '../utils/element';\nvar calculateDepthForNode = function (node) {\n if (isHidden(node)) {\n return Infinity;\n }\n var depth = 0;\n var parent = node.parentNode;\n while (parent) {\n depth += 1;\n parent = parent.parentNode;\n }\n return depth;\n};\nexport { calculateDepthForNode };\n","import { resizeObservers } from '../utils/resizeObservers';\nimport { ResizeObserverEntry } from '../ResizeObserverEntry';\nimport { calculateDepthForNode } from './calculateDepthForNode';\nimport { calculateBoxSize } from './calculateBoxSize';\nvar broadcastActiveObservations = function () {\n var shallowestDepth = Infinity;\n var callbacks = [];\n resizeObservers.forEach(function processObserver(ro) {\n if (ro.activeTargets.length === 0) {\n return;\n }\n var entries = [];\n ro.activeTargets.forEach(function processTarget(ot) {\n var entry = new ResizeObserverEntry(ot.target);\n var targetDepth = calculateDepthForNode(ot.target);\n entries.push(entry);\n ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox);\n if (targetDepth < shallowestDepth) {\n shallowestDepth = targetDepth;\n }\n });\n callbacks.push(function resizeObserverCallback() {\n ro.callback.call(ro.observer, entries, ro.observer);\n });\n ro.activeTargets.splice(0, ro.activeTargets.length);\n });\n for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {\n var callback = callbacks_1[_i];\n callback();\n }\n return shallowestDepth;\n};\nexport { broadcastActiveObservations };\n","import { resizeObservers } from '../utils/resizeObservers';\nimport { calculateDepthForNode } from './calculateDepthForNode';\nvar gatherActiveObservationsAtDepth = function (depth) {\n resizeObservers.forEach(function processObserver(ro) {\n ro.activeTargets.splice(0, ro.activeTargets.length);\n ro.skippedTargets.splice(0, ro.skippedTargets.length);\n ro.observationTargets.forEach(function processTarget(ot) {\n if (ot.isActive()) {\n if (calculateDepthForNode(ot.target) > depth) {\n ro.activeTargets.push(ot);\n }\n else {\n ro.skippedTargets.push(ot);\n }\n }\n });\n });\n};\nexport { gatherActiveObservationsAtDepth };\n","import { hasActiveObservations } from '../algorithms/hasActiveObservations';\nimport { hasSkippedObservations } from '../algorithms/hasSkippedObservations';\nimport { deliverResizeLoopError } from '../algorithms/deliverResizeLoopError';\nimport { broadcastActiveObservations } from '../algorithms/broadcastActiveObservations';\nimport { gatherActiveObservationsAtDepth } from '../algorithms/gatherActiveObservationsAtDepth';\nvar process = function () {\n var depth = 0;\n gatherActiveObservationsAtDepth(depth);\n while (hasActiveObservations()) {\n depth = broadcastActiveObservations();\n gatherActiveObservationsAtDepth(depth);\n }\n if (hasSkippedObservations()) {\n deliverResizeLoopError();\n }\n return depth > 0;\n};\nexport { process };\n","import { resizeObservers } from '../utils/resizeObservers';\nvar hasActiveObservations = function () {\n return resizeObservers.some(function (ro) { return ro.activeTargets.length > 0; });\n};\nexport { hasActiveObservations };\n","import { resizeObservers } from '../utils/resizeObservers';\nvar hasSkippedObservations = function () {\n return resizeObservers.some(function (ro) { return ro.skippedTargets.length > 0; });\n};\nexport { hasSkippedObservations };\n","import { process } from './process';\nimport { global } from './global';\nimport { queueResizeObserver } from './queueResizeObserver';\nvar watching = 0;\nvar isWatching = function () { return !!watching; };\nvar CATCH_PERIOD = 250;\nvar observerConfig = { attributes: true, characterData: true, childList: true, subtree: true };\nvar events = [\n 'resize',\n 'load',\n 'transitionend',\n 'animationend',\n 'animationstart',\n 'animationiteration',\n 'keyup',\n 'keydown',\n 'mouseup',\n 'mousedown',\n 'mouseover',\n 'mouseout',\n 'blur',\n 'focus'\n];\nvar time = function (timeout) {\n if (timeout === void 0) { timeout = 0; }\n return Date.now() + timeout;\n};\nvar scheduled = false;\nvar Scheduler = (function () {\n function Scheduler() {\n var _this = this;\n this.stopped = true;\n this.listener = function () { return _this.schedule(); };\n }\n Scheduler.prototype.run = function (timeout) {\n var _this = this;\n if (timeout === void 0) { timeout = CATCH_PERIOD; }\n if (scheduled) {\n return;\n }\n scheduled = true;\n var until = time(timeout);\n queueResizeObserver(function () {\n var elementsHaveResized = false;\n try {\n elementsHaveResized = process();\n }\n finally {\n scheduled = false;\n timeout = until - time();\n if (!isWatching()) {\n return;\n }\n if (elementsHaveResized) {\n _this.run(1000);\n }\n else if (timeout > 0) {\n _this.run(timeout);\n }\n else {\n _this.start();\n }\n }\n });\n };\n Scheduler.prototype.schedule = function () {\n this.stop();\n this.run();\n };\n Scheduler.prototype.observe = function () {\n var _this = this;\n var cb = function () { return _this.observer && _this.observer.observe(document.body, observerConfig); };\n document.body ? cb() : global.addEventListener('DOMContentLoaded', cb);\n };\n Scheduler.prototype.start = function () {\n var _this = this;\n if (this.stopped) {\n this.stopped = false;\n this.observer = new MutationObserver(this.listener);\n this.observe();\n events.forEach(function (name) { return global.addEventListener(name, _this.listener, true); });\n }\n };\n Scheduler.prototype.stop = function () {\n var _this = this;\n if (!this.stopped) {\n this.observer && this.observer.disconnect();\n events.forEach(function (name) { return global.removeEventListener(name, _this.listener, true); });\n this.stopped = true;\n }\n };\n return Scheduler;\n}());\nvar scheduler = new Scheduler();\nvar updateCount = function (n) {\n !watching && n > 0 && scheduler.start();\n watching += n;\n !watching && scheduler.stop();\n};\nexport { scheduler, updateCount };\n","import { queueMicroTask } from './queueMicroTask';\nvar queueResizeObserver = function (cb) {\n queueMicroTask(function ResizeObserver() {\n requestAnimationFrame(cb);\n });\n};\nexport { queueResizeObserver };\n","import { ResizeObserverBoxOptions } from './ResizeObserverBoxOptions';\nimport { calculateBoxSize } from './algorithms/calculateBoxSize';\nimport { isSVG, isReplacedElement } from './utils/element';\nvar skipNotifyOnElement = function (target) {\n return !isSVG(target)\n && !isReplacedElement(target)\n && getComputedStyle(target).display === 'inline';\n};\nvar ResizeObservation = (function () {\n function ResizeObservation(target, observedBox) {\n this.target = target;\n this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX;\n this.lastReportedSize = {\n inlineSize: 0,\n blockSize: 0\n };\n }\n ResizeObservation.prototype.isActive = function () {\n var size = calculateBoxSize(this.target, this.observedBox, true);\n if (skipNotifyOnElement(this.target)) {\n this.lastReportedSize = size;\n }\n if (this.lastReportedSize.inlineSize !== size.inlineSize\n || this.lastReportedSize.blockSize !== size.blockSize) {\n return true;\n }\n return false;\n };\n return ResizeObservation;\n}());\nexport { ResizeObservation };\n","var ResizeObserverDetail = (function () {\n function ResizeObserverDetail(resizeObserver, callback) {\n this.activeTargets = [];\n this.skippedTargets = [];\n this.observationTargets = [];\n this.observer = resizeObserver;\n this.callback = callback;\n }\n return ResizeObserverDetail;\n}());\nexport { ResizeObserverDetail };\n","import { scheduler, updateCount } from './utils/scheduler';\nimport { ResizeObservation } from './ResizeObservation';\nimport { ResizeObserverDetail } from './ResizeObserverDetail';\nimport { resizeObservers } from './utils/resizeObservers';\nvar observerMap = new WeakMap();\nvar getObservationIndex = function (observationTargets, target) {\n for (var i = 0; i < observationTargets.length; i += 1) {\n if (observationTargets[i].target === target) {\n return i;\n }\n }\n return -1;\n};\nvar ResizeObserverController = (function () {\n function ResizeObserverController() {\n }\n ResizeObserverController.connect = function (resizeObserver, callback) {\n var detail = new ResizeObserverDetail(resizeObserver, callback);\n observerMap.set(resizeObserver, detail);\n };\n ResizeObserverController.observe = function (resizeObserver, target, options) {\n var detail = observerMap.get(resizeObserver);\n var firstObservation = detail.observationTargets.length === 0;\n if (getObservationIndex(detail.observationTargets, target) < 0) {\n firstObservation && resizeObservers.push(detail);\n detail.observationTargets.push(new ResizeObservation(target, options && options.box));\n updateCount(1);\n scheduler.schedule();\n }\n };\n ResizeObserverController.unobserve = function (resizeObserver, target) {\n var detail = observerMap.get(resizeObserver);\n var index = getObservationIndex(detail.observationTargets, target);\n var lastObservation = detail.observationTargets.length === 1;\n if (index >= 0) {\n lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1);\n detail.observationTargets.splice(index, 1);\n updateCount(-1);\n }\n };\n ResizeObserverController.disconnect = function (resizeObserver) {\n var _this = this;\n var detail = observerMap.get(resizeObserver);\n detail.observationTargets.slice().forEach(function (ot) { return _this.unobserve(resizeObserver, ot.target); });\n detail.activeTargets.splice(0, detail.activeTargets.length);\n };\n return ResizeObserverController;\n}());\nexport { ResizeObserverController };\n","import { ResizeObserverController } from './ResizeObserverController';\nimport { isElement } from './utils/element';\nvar ResizeObserver = (function () {\n function ResizeObserver(callback) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (typeof callback !== 'function') {\n throw new TypeError(\"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.\");\n }\n ResizeObserverController.connect(this, callback);\n }\n ResizeObserver.prototype.observe = function (target, options) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (!isElement(target)) {\n throw new TypeError(\"Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element\");\n }\n ResizeObserverController.observe(this, target, options);\n };\n ResizeObserver.prototype.unobserve = function (target) {\n if (arguments.length === 0) {\n throw new TypeError(\"Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.\");\n }\n if (!isElement(target)) {\n throw new TypeError(\"Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element\");\n }\n ResizeObserverController.unobserve(this, target);\n };\n ResizeObserver.prototype.disconnect = function () {\n ResizeObserverController.disconnect(this);\n };\n ResizeObserver.toString = function () {\n return 'function ResizeObserver () { [polyfill code] }';\n };\n return ResizeObserver;\n}());\nexport { ResizeObserver };\n","import { __assign, __rest } from './_virtual/_tslib.js';\nimport './types.js';\nimport { invoke } from './actionTypes.js';\nimport './utils.js';\nimport './environment.js';\n\nfunction toInvokeSource(src) {\n if (typeof src === 'string') {\n var simpleSrc = {\n type: src\n };\n\n simpleSrc.toString = function () {\n return src;\n }; // v4 compat - TODO: remove in v5\n\n\n return simpleSrc;\n }\n\n return src;\n}\nfunction toInvokeDefinition(invokeConfig) {\n return __assign(__assign({\n type: invoke\n }, invokeConfig), {\n toJSON: function () {\n invokeConfig.onDone;\n invokeConfig.onError;\n var invokeDef = __rest(invokeConfig, [\"onDone\", \"onError\"]);\n\n return __assign(__assign({}, invokeDef), {\n type: invoke,\n src: toInvokeSource(invokeConfig.src)\n });\n }\n });\n}\n\nexport { toInvokeDefinition, toInvokeSource };\n","import { __assign, __spreadArray, __read, __values, __rest } from './_virtual/_tslib.js';\nimport { isFunction, mapValues, isArray, flatten, toArray, toStateValue, isString, getEventType, toSCXMLEvent, matchesState, path, evaluateGuard, mapContext, isRaisableAction, pathToStateValue, isBuiltInEvent, partition, updateHistoryValue, toStatePath, mapFilterValues, warn, toStatePaths, nestedPath, normalizeTarget, toGuard, toTransitionConfigArray, isMachine, createInvokeId } from './utils.js';\nimport { State, stateValuesEqual } from './State.js';\nimport { start as start$1, stop as stop$1, invoke, update, nullEvent } from './actionTypes.js';\nimport { done, start, toActionObjects, raise, stop, resolveActions, doneInvoke, error, toActionObject, toActivityDefinition, after, send, cancel, initEvent } from './actions.js';\nimport { IS_PRODUCTION } from './environment.js';\nimport { STATE_DELIMITER } from './constants.js';\nimport { getAllStateNodes, getConfiguration, isInFinalState, getTagsFromConfiguration, has, getChildren, getValue, isLeafNode, getAllChildren } from './stateUtils.js';\nimport { createInvocableActor } from './Actor.js';\nimport { toInvokeDefinition } from './invokeUtils.js';\n\nvar NULL_EVENT = '';\nvar STATE_IDENTIFIER = '#';\nvar WILDCARD = '*';\nvar EMPTY_OBJECT = {};\n\nvar isStateId = function (str) {\n return str[0] === STATE_IDENTIFIER;\n};\n\nvar createDefaultOptions = function () {\n return {\n actions: {},\n guards: {},\n services: {},\n activities: {},\n delays: {}\n };\n};\n\nvar validateArrayifiedTransitions = function (stateNode, event, transitions) {\n var hasNonLastUnguardedTarget = transitions.slice(0, -1).some(function (transition) {\n return !('cond' in transition) && !('in' in transition) && (isString(transition.target) || isMachine(transition.target));\n });\n var eventText = event === NULL_EVENT ? 'the transient event' : \"event '\".concat(event, \"'\");\n warn(!hasNonLastUnguardedTarget, \"One or more transitions for \".concat(eventText, \" on state '\").concat(stateNode.id, \"' are unreachable. \") + \"Make sure that the default transition is the last one defined.\");\n};\n\nvar StateNode =\n/*#__PURE__*/\n\n/** @class */\nfunction () {\n function StateNode(\n /**\r\n * The raw config used to create the machine.\r\n */\n config, options,\n /**\r\n * The initial extended state\r\n */\n _context, // TODO: this is unsafe, but we're removing it in v5 anyway\n _stateInfo) {\n if (_context === void 0) {\n _context = 'context' in config ? config.context : undefined;\n }\n\n var _this = this;\n\n var _a;\n\n this.config = config;\n this._context = _context;\n /**\r\n * The order this state node appears. Corresponds to the implicit SCXML document order.\r\n */\n\n this.order = -1;\n this.__xstatenode = true;\n this.__cache = {\n events: undefined,\n relativeValue: new Map(),\n initialStateValue: undefined,\n initialState: undefined,\n on: undefined,\n transitions: undefined,\n candidates: {},\n delayedTransitions: undefined\n };\n this.idMap = {};\n this.tags = [];\n this.options = Object.assign(createDefaultOptions(), options);\n this.parent = _stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.parent;\n this.key = this.config.key || (_stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.key) || this.config.id || '(machine)';\n this.machine = this.parent ? this.parent.machine : this;\n this.path = this.parent ? this.parent.path.concat(this.key) : [];\n this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : STATE_DELIMITER);\n this.id = this.config.id || __spreadArray([this.machine.key], __read(this.path), false).join(this.delimiter);\n this.version = this.parent ? this.parent.version : this.config.version;\n this.type = this.config.type || (this.config.parallel ? 'parallel' : this.config.states && Object.keys(this.config.states).length ? 'compound' : this.config.history ? 'history' : 'atomic');\n this.schema = this.parent ? this.machine.schema : (_a = this.config.schema) !== null && _a !== void 0 ? _a : {};\n this.description = this.config.description;\n\n if (!IS_PRODUCTION) {\n warn(!('parallel' in this.config), \"The \\\"parallel\\\" property is deprecated and will be removed in version 4.1. \".concat(this.config.parallel ? \"Replace with `type: 'parallel'`\" : \"Use `type: '\".concat(this.type, \"'`\"), \" in the config for state node '\").concat(this.id, \"' instead.\"));\n }\n\n this.initial = this.config.initial;\n this.states = this.config.states ? mapValues(this.config.states, function (stateConfig, key) {\n var _a;\n\n var stateNode = new StateNode(stateConfig, {}, undefined, {\n parent: _this,\n key: key\n });\n Object.assign(_this.idMap, __assign((_a = {}, _a[stateNode.id] = stateNode, _a), stateNode.idMap));\n return stateNode;\n }) : EMPTY_OBJECT; // Document order\n\n var order = 0;\n\n function dfs(stateNode) {\n var e_1, _a;\n\n stateNode.order = order++;\n\n try {\n for (var _b = __values(getAllChildren(stateNode)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var child = _c.value;\n dfs(child);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n }\n\n dfs(this); // History config\n\n this.history = this.config.history === true ? 'shallow' : this.config.history || false;\n this._transient = !!this.config.always || (!this.config.on ? false : Array.isArray(this.config.on) ? this.config.on.some(function (_a) {\n var event = _a.event;\n return event === NULL_EVENT;\n }) : NULL_EVENT in this.config.on);\n this.strict = !!this.config.strict; // TODO: deprecate (entry)\n\n this.onEntry = toArray(this.config.entry || this.config.onEntry).map(function (action) {\n return toActionObject(action);\n }); // TODO: deprecate (exit)\n\n this.onExit = toArray(this.config.exit || this.config.onExit).map(function (action) {\n return toActionObject(action);\n });\n this.meta = this.config.meta;\n this.doneData = this.type === 'final' ? this.config.data : undefined;\n this.invoke = toArray(this.config.invoke).map(function (invokeConfig, i) {\n var _a, _b;\n\n if (isMachine(invokeConfig)) {\n var invokeId = createInvokeId(_this.id, i);\n _this.machine.options.services = __assign((_a = {}, _a[invokeId] = invokeConfig, _a), _this.machine.options.services);\n return toInvokeDefinition({\n src: invokeId,\n id: invokeId\n });\n } else if (isString(invokeConfig.src)) {\n var invokeId = invokeConfig.id || createInvokeId(_this.id, i);\n return toInvokeDefinition(__assign(__assign({}, invokeConfig), {\n id: invokeId,\n src: invokeConfig.src\n }));\n } else if (isMachine(invokeConfig.src) || isFunction(invokeConfig.src)) {\n var invokeId = invokeConfig.id || createInvokeId(_this.id, i);\n _this.machine.options.services = __assign((_b = {}, _b[invokeId] = invokeConfig.src, _b), _this.machine.options.services);\n return toInvokeDefinition(__assign(__assign({\n id: invokeId\n }, invokeConfig), {\n src: invokeId\n }));\n } else {\n var invokeSource = invokeConfig.src;\n return toInvokeDefinition(__assign(__assign({\n id: createInvokeId(_this.id, i)\n }, invokeConfig), {\n src: invokeSource\n }));\n }\n });\n this.activities = toArray(this.config.activities).concat(this.invoke).map(function (activity) {\n return toActivityDefinition(activity);\n });\n this.transition = this.transition.bind(this);\n this.tags = toArray(this.config.tags); // TODO: this is the real fix for initialization once\n // state node getters are deprecated\n // if (!this.parent) {\n // this._init();\n // }\n }\n\n StateNode.prototype._init = function () {\n if (this.__cache.transitions) {\n return;\n }\n\n getAllStateNodes(this).forEach(function (stateNode) {\n return stateNode.on;\n });\n };\n /**\r\n * Clones this state machine with custom options and context.\r\n *\r\n * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.\r\n * @param context Custom context (will override predefined context)\r\n */\n\n\n StateNode.prototype.withConfig = function (options, context) {\n var _a = this.options,\n actions = _a.actions,\n activities = _a.activities,\n guards = _a.guards,\n services = _a.services,\n delays = _a.delays;\n return new StateNode(this.config, {\n actions: __assign(__assign({}, actions), options.actions),\n activities: __assign(__assign({}, activities), options.activities),\n guards: __assign(__assign({}, guards), options.guards),\n services: __assign(__assign({}, services), options.services),\n delays: __assign(__assign({}, delays), options.delays)\n }, context !== null && context !== void 0 ? context : this.context);\n };\n /**\r\n * Clones this state machine with custom context.\r\n *\r\n * @param context Custom context (will override predefined context, not recursive)\r\n */\n\n\n StateNode.prototype.withContext = function (context) {\n return new StateNode(this.config, this.options, context);\n };\n\n Object.defineProperty(StateNode.prototype, \"context\", {\n get: function () {\n return isFunction(this._context) ? this._context() : this._context;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"definition\", {\n /**\r\n * The well-structured state node definition.\r\n */\n get: function () {\n return {\n id: this.id,\n key: this.key,\n version: this.version,\n context: this.context,\n type: this.type,\n initial: this.initial,\n history: this.history,\n states: mapValues(this.states, function (state) {\n return state.definition;\n }),\n on: this.on,\n transitions: this.transitions,\n entry: this.onEntry,\n exit: this.onExit,\n activities: this.activities || [],\n meta: this.meta,\n order: this.order || -1,\n data: this.doneData,\n invoke: this.invoke,\n description: this.description,\n tags: this.tags\n };\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.toJSON = function () {\n return this.definition;\n };\n\n Object.defineProperty(StateNode.prototype, \"on\", {\n /**\r\n * The mapping of events to transitions.\r\n */\n get: function () {\n if (this.__cache.on) {\n return this.__cache.on;\n }\n\n var transitions = this.transitions;\n return this.__cache.on = transitions.reduce(function (map, transition) {\n map[transition.eventType] = map[transition.eventType] || [];\n map[transition.eventType].push(transition);\n return map;\n }, {});\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"after\", {\n get: function () {\n return this.__cache.delayedTransitions || (this.__cache.delayedTransitions = this.getDelayedTransitions(), this.__cache.delayedTransitions);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"transitions\", {\n /**\r\n * All the transitions that can be taken from this state node.\r\n */\n get: function () {\n return this.__cache.transitions || (this.__cache.transitions = this.formatTransitions(), this.__cache.transitions);\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.getCandidates = function (eventName) {\n if (this.__cache.candidates[eventName]) {\n return this.__cache.candidates[eventName];\n }\n\n var transient = eventName === NULL_EVENT;\n var candidates = this.transitions.filter(function (transition) {\n var sameEventType = transition.eventType === eventName; // null events should only match against eventless transitions\n\n return transient ? sameEventType : sameEventType || transition.eventType === WILDCARD;\n });\n this.__cache.candidates[eventName] = candidates;\n return candidates;\n };\n /**\r\n * All delayed transitions from the config.\r\n */\n\n\n StateNode.prototype.getDelayedTransitions = function () {\n var _this = this;\n\n var afterConfig = this.config.after;\n\n if (!afterConfig) {\n return [];\n }\n\n var mutateEntryExit = function (delay, i) {\n var delayRef = isFunction(delay) ? \"\".concat(_this.id, \":delay[\").concat(i, \"]\") : delay;\n var eventType = after(delayRef, _this.id);\n\n _this.onEntry.push(send(eventType, {\n delay: delay\n }));\n\n _this.onExit.push(cancel(eventType));\n\n return eventType;\n };\n\n var delayedTransitions = isArray(afterConfig) ? afterConfig.map(function (transition, i) {\n var eventType = mutateEntryExit(transition.delay, i);\n return __assign(__assign({}, transition), {\n event: eventType\n });\n }) : flatten(Object.keys(afterConfig).map(function (delay, i) {\n var configTransition = afterConfig[delay];\n var resolvedTransition = isString(configTransition) ? {\n target: configTransition\n } : configTransition;\n var resolvedDelay = !isNaN(+delay) ? +delay : delay;\n var eventType = mutateEntryExit(resolvedDelay, i);\n return toArray(resolvedTransition).map(function (transition) {\n return __assign(__assign({}, transition), {\n event: eventType,\n delay: resolvedDelay\n });\n });\n }));\n return delayedTransitions.map(function (delayedTransition) {\n var delay = delayedTransition.delay;\n return __assign(__assign({}, _this.formatTransition(delayedTransition)), {\n delay: delay\n });\n });\n };\n /**\r\n * Returns the state nodes represented by the current state value.\r\n *\r\n * @param state The state value or State instance\r\n */\n\n\n StateNode.prototype.getStateNodes = function (state) {\n var _a;\n\n var _this = this;\n\n if (!state) {\n return [];\n }\n\n var stateValue = state instanceof State ? state.value : toStateValue(state, this.delimiter);\n\n if (isString(stateValue)) {\n var initialStateValue = this.getStateNode(stateValue).initial;\n return initialStateValue !== undefined ? this.getStateNodes((_a = {}, _a[stateValue] = initialStateValue, _a)) : [this, this.states[stateValue]];\n }\n\n var subStateKeys = Object.keys(stateValue);\n var subStateNodes = [this];\n subStateNodes.push.apply(subStateNodes, __spreadArray([], __read(flatten(subStateKeys.map(function (subStateKey) {\n return _this.getStateNode(subStateKey).getStateNodes(stateValue[subStateKey]);\n }))), false));\n return subStateNodes;\n };\n /**\r\n * Returns `true` if this state node explicitly handles the given event.\r\n *\r\n * @param event The event in question\r\n */\n\n\n StateNode.prototype.handles = function (event) {\n var eventType = getEventType(event);\n return this.events.includes(eventType);\n };\n /**\r\n * Resolves the given `state` to a new `State` instance relative to this machine.\r\n *\r\n * This ensures that `.events` and `.nextEvents` represent the correct values.\r\n *\r\n * @param state The state to resolve\r\n */\n\n\n StateNode.prototype.resolveState = function (state) {\n var stateFromConfig = state instanceof State ? state : State.create(state);\n var configuration = Array.from(getConfiguration([], this.getStateNodes(stateFromConfig.value)));\n return new State(__assign(__assign({}, stateFromConfig), {\n value: this.resolve(stateFromConfig.value),\n configuration: configuration,\n done: isInFinalState(configuration, this),\n tags: getTagsFromConfiguration(configuration),\n machine: this.machine\n }));\n };\n\n StateNode.prototype.transitionLeafNode = function (stateValue, state, _event) {\n var stateNode = this.getStateNode(stateValue);\n var next = stateNode.next(state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionCompoundNode = function (stateValue, state, _event) {\n var subStateKeys = Object.keys(stateValue);\n var stateNode = this.getStateNode(subStateKeys[0]);\n\n var next = stateNode._transition(stateValue[subStateKeys[0]], state, _event);\n\n if (!next || !next.transitions.length) {\n return this.next(state, _event);\n }\n\n return next;\n };\n\n StateNode.prototype.transitionParallelNode = function (stateValue, state, _event) {\n var e_2, _a;\n\n var transitionMap = {};\n\n try {\n for (var _b = __values(Object.keys(stateValue)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var subStateKey = _c.value;\n var subStateValue = stateValue[subStateKey];\n\n if (!subStateValue) {\n continue;\n }\n\n var subStateNode = this.getStateNode(subStateKey);\n\n var next = subStateNode._transition(subStateValue, state, _event);\n\n if (next) {\n transitionMap[subStateKey] = next;\n }\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n\n var stateTransitions = Object.keys(transitionMap).map(function (key) {\n return transitionMap[key];\n });\n var enabledTransitions = flatten(stateTransitions.map(function (st) {\n return st.transitions;\n }));\n var willTransition = stateTransitions.some(function (st) {\n return st.transitions.length > 0;\n });\n\n if (!willTransition) {\n return this.next(state, _event);\n }\n\n var configuration = flatten(Object.keys(transitionMap).map(function (key) {\n return transitionMap[key].configuration;\n }));\n return {\n transitions: enabledTransitions,\n exitSet: flatten(stateTransitions.map(function (t) {\n return t.exitSet;\n })),\n configuration: configuration,\n source: state,\n actions: flatten(Object.keys(transitionMap).map(function (key) {\n return transitionMap[key].actions;\n }))\n };\n };\n\n StateNode.prototype._transition = function (stateValue, state, _event) {\n // leaf node\n if (isString(stateValue)) {\n return this.transitionLeafNode(stateValue, state, _event);\n } // hierarchical node\n\n\n if (Object.keys(stateValue).length === 1) {\n return this.transitionCompoundNode(stateValue, state, _event);\n } // orthogonal node\n\n\n return this.transitionParallelNode(stateValue, state, _event);\n };\n\n StateNode.prototype.getTransitionData = function (state, event) {\n return this._transition(state.value, state, toSCXMLEvent(event));\n };\n\n StateNode.prototype.next = function (state, _event) {\n var e_3, _a;\n\n var _this = this;\n\n var eventName = _event.name;\n var actions = [];\n var nextStateNodes = [];\n var selectedTransition;\n\n try {\n for (var _b = __values(this.getCandidates(eventName)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var candidate = _c.value;\n var cond = candidate.cond,\n stateIn = candidate.in;\n var resolvedContext = state.context;\n var isInState = stateIn ? isString(stateIn) && isStateId(stateIn) ? // Check if in state by ID\n state.matches(toStateValue(this.getStateNodeById(stateIn).path, this.delimiter)) : // Check if in state by relative grandparent\n matchesState(toStateValue(stateIn, this.delimiter), path(this.path.slice(0, -2))(state.value)) : true;\n var guardPassed = false;\n\n try {\n guardPassed = !cond || evaluateGuard(this.machine, cond, resolvedContext, _event, state);\n } catch (err) {\n throw new Error(\"Unable to evaluate guard '\".concat(cond.name || cond.type, \"' in transition for event '\").concat(eventName, \"' in state node '\").concat(this.id, \"':\\n\").concat(err.message));\n }\n\n if (guardPassed && isInState) {\n if (candidate.target !== undefined) {\n nextStateNodes = candidate.target;\n }\n\n actions.push.apply(actions, __spreadArray([], __read(candidate.actions), false));\n selectedTransition = candidate;\n break;\n }\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n if (!selectedTransition) {\n return undefined;\n }\n\n if (!nextStateNodes.length) {\n return {\n transitions: [selectedTransition],\n exitSet: [],\n configuration: state.value ? [this] : [],\n source: state,\n actions: actions\n };\n }\n\n var allNextStateNodes = flatten(nextStateNodes.map(function (stateNode) {\n return _this.getRelativeStateNodes(stateNode, state.historyValue);\n }));\n var isInternal = !!selectedTransition.internal;\n return {\n transitions: [selectedTransition],\n exitSet: isInternal ? [] : flatten(nextStateNodes.map(function (targetNode) {\n return _this.getPotentiallyReenteringNodes(targetNode);\n })),\n configuration: allNextStateNodes,\n source: state,\n actions: actions\n };\n }; // even though the name of this function mentions reentry nodes\n // we are pushing its result into `exitSet`\n // that's because what we exit might be reentered (it's an invariant of reentrancy)\n\n\n StateNode.prototype.getPotentiallyReenteringNodes = function (targetNode) {\n if (this.order < targetNode.order) {\n return [this];\n }\n\n var nodes = [];\n var marker = this;\n var possibleAncestor = targetNode;\n\n while (marker && marker !== possibleAncestor) {\n nodes.push(marker);\n marker = marker.parent;\n }\n\n if (marker !== possibleAncestor) {\n // we never got to `possibleAncestor`, therefore the initial `marker` \"escapes\" it\n // it's in a different part of the tree so no states will be reentered for such an external transition\n return [];\n }\n\n nodes.push(possibleAncestor);\n return nodes;\n };\n\n StateNode.prototype.getActions = function (resolvedConfig, isDone, transition, currentContext, _event, prevState, predictableExec) {\n var e_4, _a, e_5, _b;\n\n var _this = this;\n\n var prevConfig = prevState ? getConfiguration([], this.getStateNodes(prevState.value)) : [];\n var entrySet = new Set();\n\n try {\n for (var _c = __values(Array.from(resolvedConfig).sort(function (a, b) {\n return a.order - b.order;\n })), _d = _c.next(); !_d.done; _d = _c.next()) {\n var sn = _d.value;\n\n if (!has(prevConfig, sn) || has(transition.exitSet, sn) || sn.parent && entrySet.has(sn.parent)) {\n entrySet.add(sn);\n }\n }\n } catch (e_4_1) {\n e_4 = {\n error: e_4_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n } finally {\n if (e_4) throw e_4.error;\n }\n }\n\n try {\n for (var prevConfig_1 = __values(prevConfig), prevConfig_1_1 = prevConfig_1.next(); !prevConfig_1_1.done; prevConfig_1_1 = prevConfig_1.next()) {\n var sn = prevConfig_1_1.value;\n\n if (!has(resolvedConfig, sn) || has(transition.exitSet, sn.parent)) {\n transition.exitSet.push(sn);\n }\n }\n } catch (e_5_1) {\n e_5 = {\n error: e_5_1\n };\n } finally {\n try {\n if (prevConfig_1_1 && !prevConfig_1_1.done && (_b = prevConfig_1.return)) _b.call(prevConfig_1);\n } finally {\n if (e_5) throw e_5.error;\n }\n }\n\n transition.exitSet.sort(function (a, b) {\n return b.order - a.order;\n });\n var entryStates = Array.from(entrySet).sort(function (a, b) {\n return a.order - b.order;\n });\n var exitStates = new Set(transition.exitSet);\n var doneEvents = flatten(entryStates.map(function (sn) {\n var events = [];\n\n if (sn.type !== 'final') {\n return events;\n }\n\n var parent = sn.parent;\n\n if (!parent.parent) {\n return events;\n }\n\n events.push(done(sn.id, sn.doneData), // TODO: deprecate - final states should not emit done events for their own state.\n done(parent.id, sn.doneData ? mapContext(sn.doneData, currentContext, _event) : undefined));\n var grandparent = parent.parent;\n\n if (grandparent.type === 'parallel') {\n if (getChildren(grandparent).every(function (parentNode) {\n return isInFinalState(transition.configuration, parentNode);\n })) {\n events.push(done(grandparent.id));\n }\n }\n\n return events;\n }));\n var entryActions = entryStates.map(function (stateNode) {\n var entryActions = stateNode.onEntry;\n var invokeActions = stateNode.activities.map(function (activity) {\n return start(activity);\n });\n return {\n type: 'entry',\n actions: toActionObjects(predictableExec ? __spreadArray(__spreadArray([], __read(entryActions), false), __read(invokeActions), false) : __spreadArray(__spreadArray([], __read(invokeActions), false), __read(entryActions), false), _this.machine.options.actions)\n };\n }).concat({\n type: 'state_done',\n actions: doneEvents.map(function (event) {\n return raise(event);\n })\n });\n var exitActions = Array.from(exitStates).map(function (stateNode) {\n return {\n type: 'exit',\n actions: toActionObjects(__spreadArray(__spreadArray([], __read(stateNode.onExit), false), __read(stateNode.activities.map(function (activity) {\n return stop(activity);\n })), false), _this.machine.options.actions)\n };\n });\n var actions = exitActions.concat({\n type: 'transition',\n actions: toActionObjects(transition.actions, this.machine.options.actions)\n }).concat(entryActions);\n\n if (isDone) {\n var stopActions = toActionObjects(flatten(__spreadArray([], __read(resolvedConfig), false).sort(function (a, b) {\n return b.order - a.order;\n }).map(function (stateNode) {\n return stateNode.onExit;\n })), this.machine.options.actions).filter(function (action) {\n return !isRaisableAction(action);\n });\n return actions.concat({\n type: 'stop',\n actions: stopActions\n });\n }\n\n return actions;\n };\n /**\r\n * Determines the next state given the current `state` and sent `event`.\r\n *\r\n * @param state The current State instance or state value\r\n * @param event The event that was sent at the current state\r\n * @param context The current context (extended state) of the current state\r\n */\n\n\n StateNode.prototype.transition = function (state, event, context, exec) {\n if (state === void 0) {\n state = this.initialState;\n }\n\n var _event = toSCXMLEvent(event);\n\n var currentState;\n\n if (state instanceof State) {\n currentState = context === undefined ? state : this.resolveState(State.from(state, context));\n } else {\n var resolvedStateValue = isString(state) ? this.resolve(pathToStateValue(this.getResolvedPath(state))) : this.resolve(state);\n var resolvedContext = context !== null && context !== void 0 ? context : this.machine.context;\n currentState = this.resolveState(State.from(resolvedStateValue, resolvedContext));\n }\n\n if (!IS_PRODUCTION && _event.name === WILDCARD) {\n throw new Error(\"An event cannot have the wildcard type ('\".concat(WILDCARD, \"')\"));\n }\n\n if (this.strict) {\n if (!this.events.includes(_event.name) && !isBuiltInEvent(_event.name)) {\n throw new Error(\"Machine '\".concat(this.id, \"' does not accept event '\").concat(_event.name, \"'\"));\n }\n }\n\n var stateTransition = this._transition(currentState.value, currentState, _event) || {\n transitions: [],\n configuration: [],\n exitSet: [],\n source: currentState,\n actions: []\n };\n var prevConfig = getConfiguration([], this.getStateNodes(currentState.value));\n var resolvedConfig = stateTransition.configuration.length ? getConfiguration(prevConfig, stateTransition.configuration) : prevConfig;\n stateTransition.configuration = __spreadArray([], __read(resolvedConfig), false);\n return this.resolveTransition(stateTransition, currentState, currentState.context, exec, _event);\n };\n\n StateNode.prototype.resolveRaisedTransition = function (state, _event, originalEvent, predictableExec) {\n var _a;\n\n var currentActions = state.actions;\n state = this.transition(state, _event, undefined, predictableExec); // Save original event to state\n // TODO: this should be the raised event! Delete in V5 (breaking)\n\n state._event = originalEvent;\n state.event = originalEvent.data;\n\n (_a = state.actions).unshift.apply(_a, __spreadArray([], __read(currentActions), false));\n\n return state;\n };\n\n StateNode.prototype.resolveTransition = function (stateTransition, currentState, context, predictableExec, _event) {\n var e_6, _a, e_7, _b;\n\n var _this = this;\n\n if (_event === void 0) {\n _event = initEvent;\n }\n\n var configuration = stateTransition.configuration; // Transition will \"apply\" if:\n // - this is the initial state (there is no current state)\n // - OR there are transitions\n\n var willTransition = !currentState || stateTransition.transitions.length > 0;\n var resolvedConfiguration = willTransition ? stateTransition.configuration : currentState ? currentState.configuration : [];\n var isDone = isInFinalState(resolvedConfiguration, this);\n var resolvedStateValue = willTransition ? getValue(this.machine, configuration) : undefined;\n var historyValue = currentState ? currentState.historyValue ? currentState.historyValue : stateTransition.source ? this.machine.historyValue(currentState.value) : undefined : undefined;\n var actionBlocks = this.getActions(new Set(resolvedConfiguration), isDone, stateTransition, context, _event, currentState, predictableExec);\n var activities = currentState ? __assign({}, currentState.activities) : {};\n\n try {\n for (var actionBlocks_1 = __values(actionBlocks), actionBlocks_1_1 = actionBlocks_1.next(); !actionBlocks_1_1.done; actionBlocks_1_1 = actionBlocks_1.next()) {\n var block = actionBlocks_1_1.value;\n\n try {\n for (var _c = (e_7 = void 0, __values(block.actions)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var action = _d.value;\n\n if (action.type === start$1) {\n activities[action.activity.id || action.activity.type] = action;\n } else if (action.type === stop$1) {\n activities[action.activity.id || action.activity.type] = false;\n }\n }\n } catch (e_7_1) {\n e_7 = {\n error: e_7_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_b = _c.return)) _b.call(_c);\n } finally {\n if (e_7) throw e_7.error;\n }\n }\n }\n } catch (e_6_1) {\n e_6 = {\n error: e_6_1\n };\n } finally {\n try {\n if (actionBlocks_1_1 && !actionBlocks_1_1.done && (_a = actionBlocks_1.return)) _a.call(actionBlocks_1);\n } finally {\n if (e_6) throw e_6.error;\n }\n }\n\n var _e = __read(resolveActions(this, currentState, context, _event, actionBlocks, predictableExec, this.machine.config.predictableActionArguments || this.machine.config.preserveActionOrder), 2),\n resolvedActions = _e[0],\n updatedContext = _e[1];\n\n var _f = __read(partition(resolvedActions, isRaisableAction), 2),\n raisedEvents = _f[0],\n nonRaisedActions = _f[1];\n\n var invokeActions = resolvedActions.filter(function (action) {\n var _a;\n\n return action.type === start$1 && ((_a = action.activity) === null || _a === void 0 ? void 0 : _a.type) === invoke;\n });\n var children = invokeActions.reduce(function (acc, action) {\n acc[action.activity.id] = createInvocableActor(action.activity, _this.machine, updatedContext, _event);\n return acc;\n }, currentState ? __assign({}, currentState.children) : {});\n var nextState = new State({\n value: resolvedStateValue || currentState.value,\n context: updatedContext,\n _event: _event,\n // Persist _sessionid between states\n _sessionid: currentState ? currentState._sessionid : null,\n historyValue: resolvedStateValue ? historyValue ? updateHistoryValue(historyValue, resolvedStateValue) : undefined : currentState ? currentState.historyValue : undefined,\n history: !resolvedStateValue || stateTransition.source ? currentState : undefined,\n actions: resolvedStateValue ? nonRaisedActions : [],\n activities: resolvedStateValue ? activities : currentState ? currentState.activities : {},\n events: [],\n configuration: resolvedConfiguration,\n transitions: stateTransition.transitions,\n children: children,\n done: isDone,\n tags: getTagsFromConfiguration(resolvedConfiguration),\n machine: this\n });\n var didUpdateContext = context !== updatedContext;\n nextState.changed = _event.name === update || didUpdateContext; // Dispose of penultimate histories to prevent memory leaks\n\n var history = nextState.history;\n\n if (history) {\n delete history.history;\n } // There are transient transitions if the machine is not in a final state\n // and if some of the state nodes have transient (\"always\") transitions.\n\n\n var hasAlwaysTransitions = !isDone && (this._transient || configuration.some(function (stateNode) {\n return stateNode._transient;\n })); // If there are no enabled transitions, check if there are transient transitions.\n // If there are transient transitions, continue checking for more transitions\n // because an transient transition should be triggered even if there are no\n // enabled transitions.\n //\n // If we're already working on an transient transition then stop to prevent an infinite loop.\n //\n // Otherwise, if there are no enabled nor transient transitions, we are done.\n\n if (!willTransition && (!hasAlwaysTransitions || _event.name === NULL_EVENT)) {\n return nextState;\n }\n\n var maybeNextState = nextState;\n\n if (!isDone) {\n if (hasAlwaysTransitions) {\n maybeNextState = this.resolveRaisedTransition(maybeNextState, {\n type: nullEvent\n }, _event, predictableExec);\n }\n\n while (raisedEvents.length) {\n var raisedEvent = raisedEvents.shift();\n maybeNextState = this.resolveRaisedTransition(maybeNextState, raisedEvent._event, _event, predictableExec);\n }\n } // Detect if state changed\n\n\n var changed = maybeNextState.changed || (history ? !!maybeNextState.actions.length || didUpdateContext || typeof history.value !== typeof maybeNextState.value || !stateValuesEqual(maybeNextState.value, history.value) : undefined);\n maybeNextState.changed = changed; // Preserve original history after raised events\n\n maybeNextState.history = history;\n return maybeNextState;\n };\n /**\r\n * Returns the child state node from its relative `stateKey`, or throws.\r\n */\n\n\n StateNode.prototype.getStateNode = function (stateKey) {\n if (isStateId(stateKey)) {\n return this.machine.getStateNodeById(stateKey);\n }\n\n if (!this.states) {\n throw new Error(\"Unable to retrieve child state '\".concat(stateKey, \"' from '\").concat(this.id, \"'; no child states exist.\"));\n }\n\n var result = this.states[stateKey];\n\n if (!result) {\n throw new Error(\"Child state '\".concat(stateKey, \"' does not exist on '\").concat(this.id, \"'\"));\n }\n\n return result;\n };\n /**\r\n * Returns the state node with the given `stateId`, or throws.\r\n *\r\n * @param stateId The state ID. The prefix \"#\" is removed.\r\n */\n\n\n StateNode.prototype.getStateNodeById = function (stateId) {\n var resolvedStateId = isStateId(stateId) ? stateId.slice(STATE_IDENTIFIER.length) : stateId;\n\n if (resolvedStateId === this.id) {\n return this;\n }\n\n var stateNode = this.machine.idMap[resolvedStateId];\n\n if (!stateNode) {\n throw new Error(\"Child state node '#\".concat(resolvedStateId, \"' does not exist on machine '\").concat(this.id, \"'\"));\n }\n\n return stateNode;\n };\n /**\r\n * Returns the relative state node from the given `statePath`, or throws.\r\n *\r\n * @param statePath The string or string array relative path to the state node.\r\n */\n\n\n StateNode.prototype.getStateNodeByPath = function (statePath) {\n if (typeof statePath === 'string' && isStateId(statePath)) {\n try {\n return this.getStateNodeById(statePath.slice(1));\n } catch (e) {// try individual paths\n // throw e;\n }\n }\n\n var arrayStatePath = toStatePath(statePath, this.delimiter).slice();\n var currentStateNode = this;\n\n while (arrayStatePath.length) {\n var key = arrayStatePath.shift();\n\n if (!key.length) {\n break;\n }\n\n currentStateNode = currentStateNode.getStateNode(key);\n }\n\n return currentStateNode;\n };\n /**\r\n * Resolves a partial state value with its full representation in this machine.\r\n *\r\n * @param stateValue The partial state value to resolve.\r\n */\n\n\n StateNode.prototype.resolve = function (stateValue) {\n var _a;\n\n var _this = this;\n\n if (!stateValue) {\n return this.initialStateValue || EMPTY_OBJECT; // TODO: type-specific properties\n }\n\n switch (this.type) {\n case 'parallel':\n return mapValues(this.initialStateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(stateValue[subStateKey] || subStateValue) : EMPTY_OBJECT;\n });\n\n case 'compound':\n if (isString(stateValue)) {\n var subStateNode = this.getStateNode(stateValue);\n\n if (subStateNode.type === 'parallel' || subStateNode.type === 'compound') {\n return _a = {}, _a[stateValue] = subStateNode.initialStateValue, _a;\n }\n\n return stateValue;\n }\n\n if (!Object.keys(stateValue).length) {\n return this.initialStateValue || {};\n }\n\n return mapValues(stateValue, function (subStateValue, subStateKey) {\n return subStateValue ? _this.getStateNode(subStateKey).resolve(subStateValue) : EMPTY_OBJECT;\n });\n\n default:\n return stateValue || EMPTY_OBJECT;\n }\n };\n\n StateNode.prototype.getResolvedPath = function (stateIdentifier) {\n if (isStateId(stateIdentifier)) {\n var stateNode = this.machine.idMap[stateIdentifier.slice(STATE_IDENTIFIER.length)];\n\n if (!stateNode) {\n throw new Error(\"Unable to find state node '\".concat(stateIdentifier, \"'\"));\n }\n\n return stateNode.path;\n }\n\n return toStatePath(stateIdentifier, this.delimiter);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateValue\", {\n get: function () {\n var _a;\n\n if (this.__cache.initialStateValue) {\n return this.__cache.initialStateValue;\n }\n\n var initialStateValue;\n\n if (this.type === 'parallel') {\n initialStateValue = mapFilterValues(this.states, function (state) {\n return state.initialStateValue || EMPTY_OBJECT;\n }, function (stateNode) {\n return !(stateNode.type === 'history');\n });\n } else if (this.initial !== undefined) {\n if (!this.states[this.initial]) {\n throw new Error(\"Initial state '\".concat(this.initial, \"' not found on '\").concat(this.key, \"'\"));\n }\n\n initialStateValue = isLeafNode(this.states[this.initial]) ? this.initial : (_a = {}, _a[this.initial] = this.states[this.initial].initialStateValue, _a);\n } else {\n // The finite state value of a machine without child states is just an empty object\n initialStateValue = {};\n }\n\n this.__cache.initialStateValue = initialStateValue;\n return this.__cache.initialStateValue;\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.getInitialState = function (stateValue, context) {\n this._init(); // TODO: this should be in the constructor (see note in constructor)\n\n\n var configuration = this.getStateNodes(stateValue);\n return this.resolveTransition({\n configuration: configuration,\n exitSet: [],\n transitions: [],\n source: undefined,\n actions: []\n }, undefined, context !== null && context !== void 0 ? context : this.machine.context, undefined);\n };\n\n Object.defineProperty(StateNode.prototype, \"initialState\", {\n /**\r\n * The initial State instance, which includes all actions to be executed from\r\n * entering the initial state.\r\n */\n get: function () {\n var initialStateValue = this.initialStateValue;\n\n if (!initialStateValue) {\n throw new Error(\"Cannot retrieve initial state from simple state '\".concat(this.id, \"'.\"));\n }\n\n return this.getInitialState(initialStateValue);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"target\", {\n /**\r\n * The target state value of the history state node, if it exists. This represents the\r\n * default state value to transition to if no history value exists yet.\r\n */\n get: function () {\n var target;\n\n if (this.type === 'history') {\n var historyConfig = this.config;\n\n if (isString(historyConfig.target)) {\n target = isStateId(historyConfig.target) ? pathToStateValue(this.machine.getStateNodeById(historyConfig.target).path.slice(this.path.length - 1)) : historyConfig.target;\n } else {\n target = historyConfig.target;\n }\n }\n\n return target;\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Returns the leaf nodes from a state path relative to this state node.\r\n *\r\n * @param relativeStateId The relative state path to retrieve the state nodes\r\n * @param history The previous state to retrieve history\r\n * @param resolve Whether state nodes should resolve to initial child state nodes\r\n */\n\n StateNode.prototype.getRelativeStateNodes = function (relativeStateId, historyValue, resolve) {\n if (resolve === void 0) {\n resolve = true;\n }\n\n return resolve ? relativeStateId.type === 'history' ? relativeStateId.resolveHistory(historyValue) : relativeStateId.initialStateNodes : [relativeStateId];\n };\n\n Object.defineProperty(StateNode.prototype, \"initialStateNodes\", {\n get: function () {\n var _this = this;\n\n if (isLeafNode(this)) {\n return [this];\n } // Case when state node is compound but no initial state is defined\n\n\n if (this.type === 'compound' && !this.initial) {\n if (!IS_PRODUCTION) {\n warn(false, \"Compound state node '\".concat(this.id, \"' has no initial state.\"));\n }\n\n return [this];\n }\n\n var initialStateNodePaths = toStatePaths(this.initialStateValue);\n return flatten(initialStateNodePaths.map(function (initialPath) {\n return _this.getFromRelativePath(initialPath);\n }));\n },\n enumerable: false,\n configurable: true\n });\n /**\r\n * Retrieves state nodes from a relative path to this state node.\r\n *\r\n * @param relativePath The relative path from this state node\r\n * @param historyValue\r\n */\n\n StateNode.prototype.getFromRelativePath = function (relativePath) {\n if (!relativePath.length) {\n return [this];\n }\n\n var _a = __read(relativePath),\n stateKey = _a[0],\n childStatePath = _a.slice(1);\n\n if (!this.states) {\n throw new Error(\"Cannot retrieve subPath '\".concat(stateKey, \"' from node with no states\"));\n }\n\n var childStateNode = this.getStateNode(stateKey);\n\n if (childStateNode.type === 'history') {\n return childStateNode.resolveHistory();\n }\n\n if (!this.states[stateKey]) {\n throw new Error(\"Child state '\".concat(stateKey, \"' does not exist on '\").concat(this.id, \"'\"));\n }\n\n return this.states[stateKey].getFromRelativePath(childStatePath);\n };\n\n StateNode.prototype.historyValue = function (relativeStateValue) {\n if (!Object.keys(this.states).length) {\n return undefined;\n }\n\n return {\n current: relativeStateValue || this.initialStateValue,\n states: mapFilterValues(this.states, function (stateNode, key) {\n if (!relativeStateValue) {\n return stateNode.historyValue();\n }\n\n var subStateValue = isString(relativeStateValue) ? undefined : relativeStateValue[key];\n return stateNode.historyValue(subStateValue || stateNode.initialStateValue);\n }, function (stateNode) {\n return !stateNode.history;\n })\n };\n };\n /**\r\n * Resolves to the historical value(s) of the parent state node,\r\n * represented by state nodes.\r\n *\r\n * @param historyValue\r\n */\n\n\n StateNode.prototype.resolveHistory = function (historyValue) {\n var _this = this;\n\n if (this.type !== 'history') {\n return [this];\n }\n\n var parent = this.parent;\n\n if (!historyValue) {\n var historyTarget = this.target;\n return historyTarget ? flatten(toStatePaths(historyTarget).map(function (relativeChildPath) {\n return parent.getFromRelativePath(relativeChildPath);\n })) : parent.initialStateNodes;\n }\n\n var subHistoryValue = nestedPath(parent.path, 'states')(historyValue).current;\n\n if (isString(subHistoryValue)) {\n return [parent.getStateNode(subHistoryValue)];\n }\n\n return flatten(toStatePaths(subHistoryValue).map(function (subStatePath) {\n return _this.history === 'deep' ? parent.getFromRelativePath(subStatePath) : [parent.states[subStatePath[0]]];\n }));\n };\n\n Object.defineProperty(StateNode.prototype, \"stateIds\", {\n /**\r\n * All the state node IDs of this state node and its descendant state nodes.\r\n */\n get: function () {\n var _this = this;\n\n var childStateIds = flatten(Object.keys(this.states).map(function (stateKey) {\n return _this.states[stateKey].stateIds;\n }));\n return [this.id].concat(childStateIds);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"events\", {\n /**\r\n * All the event types accepted by this state node and its descendants.\r\n */\n get: function () {\n var e_8, _a, e_9, _b;\n\n if (this.__cache.events) {\n return this.__cache.events;\n }\n\n var states = this.states;\n var events = new Set(this.ownEvents);\n\n if (states) {\n try {\n for (var _c = __values(Object.keys(states)), _d = _c.next(); !_d.done; _d = _c.next()) {\n var stateId = _d.value;\n var state = states[stateId];\n\n if (state.states) {\n try {\n for (var _e = (e_9 = void 0, __values(state.events)), _f = _e.next(); !_f.done; _f = _e.next()) {\n var event_1 = _f.value;\n events.add(\"\".concat(event_1));\n }\n } catch (e_9_1) {\n e_9 = {\n error: e_9_1\n };\n } finally {\n try {\n if (_f && !_f.done && (_b = _e.return)) _b.call(_e);\n } finally {\n if (e_9) throw e_9.error;\n }\n }\n }\n }\n } catch (e_8_1) {\n e_8 = {\n error: e_8_1\n };\n } finally {\n try {\n if (_d && !_d.done && (_a = _c.return)) _a.call(_c);\n } finally {\n if (e_8) throw e_8.error;\n }\n }\n }\n\n return this.__cache.events = Array.from(events);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(StateNode.prototype, \"ownEvents\", {\n /**\r\n * All the events that have transitions directly from this state node.\r\n *\r\n * Excludes any inert events.\r\n */\n get: function () {\n var events = new Set(this.transitions.filter(function (transition) {\n return !(!transition.target && !transition.actions.length && transition.internal);\n }).map(function (transition) {\n return transition.eventType;\n }));\n return Array.from(events);\n },\n enumerable: false,\n configurable: true\n });\n\n StateNode.prototype.resolveTarget = function (_target) {\n var _this = this;\n\n if (_target === undefined) {\n // an undefined target signals that the state node should not transition from that state when receiving that event\n return undefined;\n }\n\n return _target.map(function (target) {\n if (!isString(target)) {\n return target;\n }\n\n var isInternalTarget = target[0] === _this.delimiter; // If internal target is defined on machine,\n // do not include machine key on target\n\n if (isInternalTarget && !_this.parent) {\n return _this.getStateNodeByPath(target.slice(1));\n }\n\n var resolvedTarget = isInternalTarget ? _this.key + target : target;\n\n if (_this.parent) {\n try {\n var targetStateNode = _this.parent.getStateNodeByPath(resolvedTarget);\n\n return targetStateNode;\n } catch (err) {\n throw new Error(\"Invalid transition definition for state node '\".concat(_this.id, \"':\\n\").concat(err.message));\n }\n } else {\n return _this.getStateNodeByPath(resolvedTarget);\n }\n });\n };\n\n StateNode.prototype.formatTransition = function (transitionConfig) {\n var _this = this;\n\n var normalizedTarget = normalizeTarget(transitionConfig.target);\n var internal = 'internal' in transitionConfig ? transitionConfig.internal : normalizedTarget ? normalizedTarget.some(function (_target) {\n return isString(_target) && _target[0] === _this.delimiter;\n }) : true;\n var guards = this.machine.options.guards;\n var target = this.resolveTarget(normalizedTarget);\n\n var transition = __assign(__assign({}, transitionConfig), {\n actions: toActionObjects(toArray(transitionConfig.actions)),\n cond: toGuard(transitionConfig.cond, guards),\n target: target,\n source: this,\n internal: internal,\n eventType: transitionConfig.event,\n toJSON: function () {\n return __assign(__assign({}, transition), {\n target: transition.target ? transition.target.map(function (t) {\n return \"#\".concat(t.id);\n }) : undefined,\n source: \"#\".concat(_this.id)\n });\n }\n });\n\n return transition;\n };\n\n StateNode.prototype.formatTransitions = function () {\n var e_10, _a;\n\n var _this = this;\n\n var onConfig;\n\n if (!this.config.on) {\n onConfig = [];\n } else if (Array.isArray(this.config.on)) {\n onConfig = this.config.on;\n } else {\n var _b = this.config.on,\n _c = WILDCARD,\n _d = _b[_c],\n wildcardConfigs = _d === void 0 ? [] : _d,\n strictTransitionConfigs_1 = __rest(_b, [typeof _c === \"symbol\" ? _c : _c + \"\"]);\n\n onConfig = flatten(Object.keys(strictTransitionConfigs_1).map(function (key) {\n if (!IS_PRODUCTION && key === NULL_EVENT) {\n warn(false, \"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. \" + \"Please check the `on` configuration for \\\"#\".concat(_this.id, \"\\\".\"));\n }\n\n var transitionConfigArray = toTransitionConfigArray(key, strictTransitionConfigs_1[key]);\n\n if (!IS_PRODUCTION) {\n validateArrayifiedTransitions(_this, key, transitionConfigArray);\n }\n\n return transitionConfigArray;\n }).concat(toTransitionConfigArray(WILDCARD, wildcardConfigs)));\n }\n\n var eventlessConfig = this.config.always ? toTransitionConfigArray('', this.config.always) : [];\n var doneConfig = this.config.onDone ? toTransitionConfigArray(String(done(this.id)), this.config.onDone) : [];\n\n if (!IS_PRODUCTION) {\n warn(!(this.config.onDone && !this.parent), \"Root nodes cannot have an \\\".onDone\\\" transition. Please check the config of \\\"\".concat(this.id, \"\\\".\"));\n }\n\n var invokeConfig = flatten(this.invoke.map(function (invokeDef) {\n var settleTransitions = [];\n\n if (invokeDef.onDone) {\n settleTransitions.push.apply(settleTransitions, __spreadArray([], __read(toTransitionConfigArray(String(doneInvoke(invokeDef.id)), invokeDef.onDone)), false));\n }\n\n if (invokeDef.onError) {\n settleTransitions.push.apply(settleTransitions, __spreadArray([], __read(toTransitionConfigArray(String(error(invokeDef.id)), invokeDef.onError)), false));\n }\n\n return settleTransitions;\n }));\n var delayedTransitions = this.after;\n var formattedTransitions = flatten(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(doneConfig), false), __read(invokeConfig), false), __read(onConfig), false), __read(eventlessConfig), false).map(function (transitionConfig) {\n return toArray(transitionConfig).map(function (transition) {\n return _this.formatTransition(transition);\n });\n }));\n\n try {\n for (var delayedTransitions_1 = __values(delayedTransitions), delayedTransitions_1_1 = delayedTransitions_1.next(); !delayedTransitions_1_1.done; delayedTransitions_1_1 = delayedTransitions_1.next()) {\n var delayedTransition = delayedTransitions_1_1.value;\n formattedTransitions.push(delayedTransition);\n }\n } catch (e_10_1) {\n e_10 = {\n error: e_10_1\n };\n } finally {\n try {\n if (delayedTransitions_1_1 && !delayedTransitions_1_1.done && (_a = delayedTransitions_1.return)) _a.call(delayedTransitions_1);\n } finally {\n if (e_10) throw e_10.error;\n }\n }\n\n return formattedTransitions;\n };\n\n return StateNode;\n}();\n\nexport { StateNode };\n","import { assign as assign$1, cancel as cancel$1, send as send$1, sendTo as sendTo$1, sendParent as sendParent$1, sendUpdate as sendUpdate$1, forwardTo as forwardTo$1, doneInvoke as doneInvoke$1, raise as raise$1, log as log$1, pure as pure$1, choose as choose$1, stop as stop$1 } from './actions.js';\nimport * as actions from './actions.js';\nexport { actions };\nexport { toActorRef } from './Actor.js';\nexport { Interpreter, InterpreterStatus, interpret, spawn } from './interpreter.js';\nexport { Machine, createMachine } from './Machine.js';\nexport { mapState } from './mapState.js';\nexport { matchState } from './match.js';\nexport { createSchema, t } from './schema.js';\nexport { State } from './State.js';\nexport { StateNode } from './StateNode.js';\nexport { spawnBehavior } from './behaviors.js';\nexport { ActionTypes, SpecialTargets } from './types.js';\nexport { matchesState, toEventObject, toObserver, toSCXMLEvent } from './utils.js';\n\nvar assign = assign$1,\n cancel = cancel$1,\n send = send$1,\n sendTo = sendTo$1,\n sendParent = sendParent$1,\n sendUpdate = sendUpdate$1,\n forwardTo = forwardTo$1,\n doneInvoke = doneInvoke$1,\n raise = raise$1,\n log = log$1,\n pure = pure$1,\n choose = choose$1,\n stop = stop$1;\n\nexport { assign, cancel, choose, doneInvoke, forwardTo, log, pure, raise, send, sendParent, sendTo, sendUpdate, stop };\n","import { useEffect, useLayoutEffect as useLayoutEffectSafely } from 'react'\n\n// Ensure the name used in components is useLayoutEffect so the eslint react hooks plugin works\nexport const useLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffectSafely : useEffect\n","/* eslint-disable no-self-compare */\n\n// stolen from lodash\nexport function clamp(number: number, lower: number, upper: number) {\n number = +number\n lower = +lower\n upper = +upper\n lower = lower === lower ? lower : 0\n upper = upper === upper ? upper : 0\n if (number === number) {\n number = number <= upper ? number : upper\n number = number >= lower ? number : lower\n }\n return number\n}\n\n// Mwahaha easiest way to filter out NaN I ever saw! >:3\nexport function deleteNaN(arr) {\n const set = new Set(arr)\n set.delete(NaN)\n return [...set]\n}\n\nexport function roundAndCheckForNaN(unrounded) {\n const rounded = Math.round(unrounded)\n if (Number.isNaN(unrounded)) {\n throw new TypeError(\n 'Found a NaN! Check your snapPoints / defaultSnap / snapTo '\n )\n }\n\n return rounded\n}\n\n// Validate, sanitize, round and dedupe snap points, as well as extracting the minSnap and maxSnap points\nexport function processSnapPoints(unsafeSnaps: number | number[], maxHeight) {\n const safeSnaps = [].concat(unsafeSnaps).map(roundAndCheckForNaN)\n\n const snapPointsDedupedSet = safeSnaps.reduce((acc, snapPoint) => {\n acc.add(clamp(snapPoint, 0, maxHeight))\n return acc\n }, new Set<number>())\n\n const snapPoints = Array.from(snapPointsDedupedSet)\n\n const minSnap = Math.min(...snapPoints)\n if (Number.isNaN(minSnap)) {\n throw new TypeError('minSnap is NaN')\n }\n const maxSnap = Math.max(...snapPoints)\n if (Number.isNaN(maxSnap)) {\n throw new TypeError('maxSnap is NaN')\n }\n\n return {\n snapPoints,\n minSnap,\n maxSnap,\n }\n}\n\nexport const debugging =\n process.env.NODE_ENV === 'development' && typeof window !== 'undefined'\n ? window.location.search === '?debug'\n : false\n","import React, {\n useCallback,\n useDebugValue,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { ResizeObserver, ResizeObserverEntry } from '@juggle/resize-observer'\nimport type { defaultSnapProps, ResizeSource, snapPoints } from '../types'\nimport { processSnapPoints, roundAndCheckForNaN } from '../utils'\nimport { useReady } from './useReady'\nimport { ResizeObserverOptions } from '@juggle/resize-observer/lib/ResizeObserverOptions'\nimport { useLayoutEffect } from './useLayoutEffect'\n\nexport function useSnapPoints({\n contentRef,\n controlledMaxHeight,\n footerEnabled,\n footerRef,\n getSnapPoints,\n headerEnabled,\n headerRef,\n heightRef,\n lastSnapRef,\n ready,\n registerReady,\n resizeSourceRef,\n}: {\n contentRef: React.RefObject<Element>\n controlledMaxHeight?: number\n footerEnabled: boolean\n footerRef: React.RefObject<Element>\n getSnapPoints: snapPoints\n headerEnabled: boolean\n headerRef: React.RefObject<Element>\n heightRef: React.RefObject<number>\n lastSnapRef: React.RefObject<number>\n ready: boolean\n registerReady: ReturnType<typeof useReady>['registerReady']\n resizeSourceRef: React.MutableRefObject<ResizeSource>\n}) {\n const { maxHeight, minHeight, headerHeight, footerHeight } = useDimensions({\n contentRef: contentRef,\n controlledMaxHeight,\n footerEnabled,\n footerRef,\n headerEnabled,\n headerRef,\n registerReady,\n resizeSourceRef,\n })\n\n const { snapPoints, minSnap, maxSnap } = processSnapPoints(\n ready\n ? getSnapPoints({\n height: heightRef.current,\n footerHeight,\n headerHeight,\n minHeight,\n maxHeight,\n })\n : [0],\n maxHeight\n )\n //console.log({ snapPoints, minSnap, maxSnap })\n\n // @TODO investigate the gains from memoizing this\n function findSnap(\n numberOrCallback: number | ((state: defaultSnapProps) => number)\n ) {\n let unsafeSearch: number\n if (typeof numberOrCallback === 'function') {\n unsafeSearch = numberOrCallback({\n footerHeight,\n headerHeight,\n height: heightRef.current,\n minHeight,\n maxHeight,\n snapPoints,\n lastSnap: lastSnapRef.current,\n })\n } else {\n unsafeSearch = numberOrCallback\n }\n const querySnap = roundAndCheckForNaN(unsafeSearch)\n return snapPoints.reduce(\n (prev, curr) =>\n Math.abs(curr - querySnap) < Math.abs(prev - querySnap) ? curr : prev,\n minSnap\n )\n }\n\n useDebugValue(`minSnap: ${minSnap}, maxSnap:${maxSnap}`)\n\n return { minSnap, maxSnap, findSnap, maxHeight }\n}\n\nfunction useDimensions({\n contentRef,\n controlledMaxHeight,\n footerEnabled,\n footerRef,\n headerEnabled,\n headerRef,\n registerReady,\n resizeSourceRef,\n}: {\n contentRef: React.RefObject<Element>\n controlledMaxHeight?: number\n footerEnabled: boolean\n footerRef: React.RefObject<Element>\n headerEnabled: boolean\n headerRef: React.RefObject<Element>\n registerReady: ReturnType<typeof useReady>['registerReady']\n resizeSourceRef: React.MutableRefObject<ResizeSource>\n}) {\n const setReady = useMemo(() => registerReady('contentHeight'), [\n registerReady,\n ])\n const maxHeight = useMaxHeight(\n controlledMaxHeight,\n registerReady,\n resizeSourceRef\n )\n\n // @TODO probably better to forward props instead of checking refs to decide if it's enabled\n const headerHeight = useElementSizeObserver(headerRef, {\n label: 'headerHeight',\n enabled: headerEnabled,\n resizeSourceRef,\n })\n const contentHeight = useElementSizeObserver(contentRef, {\n label: 'contentHeight',\n enabled: true,\n resizeSourceRef,\n })\n const footerHeight = useElementSizeObserver(footerRef, {\n label: 'footerHeight',\n enabled: footerEnabled,\n resizeSourceRef,\n })\n const minHeight =\n Math.min(maxHeight - headerHeight - footerHeight, contentHeight) +\n headerHeight +\n footerHeight\n\n useDebugValue(`minHeight: ${minHeight}`)\n\n const ready = contentHeight > 0\n useEffect(() => {\n if (ready) {\n setReady()\n }\n }, [ready, setReady])\n\n return {\n maxHeight,\n minHeight,\n headerHeight,\n footerHeight,\n }\n}\n\nconst observerOptions: ResizeObserverOptions = {\n // Respond to changes to padding, happens often on iOS when using env(safe-area-inset-bottom)\n // And the user hides or shows the Safari browser toolbar\n box: 'border-box',\n}\n/**\n * Hook for determining the size of an element using the Resize Observer API.\n *\n * @param ref - A React ref to an element\n */\nfunction useElementSizeObserver(\n ref: React.RefObject<Element>,\n {\n label,\n enabled,\n resizeSourceRef,\n }: {\n label: string\n enabled: boolean\n resizeSourceRef: React.MutableRefObject<ResizeSource>\n }\n): number {\n let [size, setSize] = useState(0)\n\n useDebugValue(`${label}: ${size}`)\n\n const handleResize = useCallback(\n (entries: ResizeObserverEntry[]) => {\n // we only observe one element, so accessing the first entry here is fine\n setSize(entries[0].borderBoxSize[0].blockSize)\n resizeSourceRef.current = 'element'\n },\n [resizeSourceRef]\n )\n\n useLayoutEffect(() => {\n if (!ref.current || !enabled) {\n return\n }\n\n const resizeObserver = new ResizeObserver(handleResize)\n resizeObserver.observe(ref.current, observerOptions)\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [ref, handleResize, enabled])\n\n return enabled ? size : 0\n}\n\n// Blazingly keep track of the current viewport height without blocking the thread, keeping that sweet 60fps on smartphones\nfunction useMaxHeight(\n controlledMaxHeight,\n registerReady: ReturnType<typeof useReady>['registerReady'],\n resizeSourceRef: React.MutableRefObject<ResizeSource>\n) {\n const setReady = useMemo(() => registerReady('maxHeight'), [registerReady])\n const [maxHeight, setMaxHeight] = useState(() =>\n roundAndCheckForNaN(controlledMaxHeight) || typeof window !== 'undefined'\n ? window.innerHeight\n : 0\n )\n const ready = maxHeight > 0\n const raf = useRef(0)\n\n useDebugValue(controlledMaxHeight ? 'controlled' : 'auto')\n\n useEffect(() => {\n if (ready) {\n setReady()\n }\n }, [ready, setReady])\n\n useLayoutEffect(() => {\n // Bail if the max height is a controlled prop\n if (controlledMaxHeight) {\n setMaxHeight(roundAndCheckForNaN(controlledMaxHeight))\n resizeSourceRef.current = 'maxheightprop'\n\n return\n }\n\n const handleResize = () => {\n if (raf.current) {\n // bail to throttle the amount of resize changes\n return\n }\n\n // throttle state changes using rAF\n raf.current = requestAnimationFrame(() => {\n setMaxHeight(window.innerHeight)\n resizeSourceRef.current = 'window'\n\n raf.current = 0\n })\n }\n window.addEventListener('resize', handleResize)\n setMaxHeight(window.innerHeight)\n resizeSourceRef.current = 'window'\n setReady()\n\n return () => {\n window.removeEventListener('resize', handleResize)\n cancelAnimationFrame(raf.current)\n }\n }, [controlledMaxHeight, setReady, resizeSourceRef])\n\n return maxHeight\n}\n","import { Machine, assign } from 'xstate'\n\n// This is the root machine, composing all the other machines and is the brain of the bottom sheet\n\ninterface OverlayStateSchema {\n states: {\n // the overlay usually starts in the closed position\n closed: {}\n opening: {\n states: {\n // Used to fire off the springStart event\n start: {}\n // Decide how to transition to the open state based on what the initialState is\n transition: {}\n // Fast enter animation, sheet is open by default\n immediately: {\n states: {\n open: {}\n activating: {}\n }\n }\n smoothly: {\n states: {\n // This state only happens when the overlay should start in an open state, instead of animating from the bottom\n // openImmediately: {}\n // visuallyHidden will render the overlay in the open state, but with opacity 0\n // doing this solves two problems:\n // on Android focusing an input element will trigger the softkeyboard to show up, which will change the viewport height\n // on iOS the focus event will break the view by triggering a scrollIntoView event if focus happens while the overlay is below the viewport and body got overflow:hidden\n // by rendering things with opacity 0 we ensure keyboards and scrollIntoView all happen in a way that match up with what the sheet will look like.\n // we can then move it to the opening position below the viewport, and animate it into view without worrying about height changes or scrolling overflow:hidden events\n visuallyHidden: {}\n // In this state we're activating focus traps, scroll locks and more, this will sometimes trigger soft keyboards and scrollIntoView\n // @TODO we might want to add a delay here before proceeding to open, to give android and iOS enough time to adjust the viewport when focusing an interactive element\n activating: {}\n // Animates from the bottom\n open: {}\n }\n }\n // Used to fire off the springEnd event\n end: {}\n // And finally we're ready to transition to open\n done: {}\n }\n }\n open: {}\n // dragging responds to user gestures, which may interrupt the opening state, closing state or snapping\n // when interrupting an opening event, it fires onSpringEnd(OPEN) before onSpringStart(DRAG)\n // when interrupting a closing event, it fires onSpringCancel(CLOSE) before onSpringStart(DRAG)\n // when interrupting a dragging event, it fires onSpringCancel(SNAP) before onSpringStart(DRAG)\n dragging: {}\n // snapping happens whenever transitioning to a new snap point, often after dragging\n snapping: {\n states: {\n start: {}\n snappingSmoothly: {}\n end: {}\n done: {}\n }\n }\n resizing: {\n states: {\n start: {}\n resizingSmoothly: {}\n end: {}\n done: {}\n }\n }\n closing: {\n states: {\n start: {}\n deactivating: {}\n closingSmoothly: {}\n end: {}\n done: {}\n }\n }\n }\n}\n\ntype OverlayEvent =\n | { type: 'OPEN' }\n | {\n type: 'SNAP'\n payload: {\n y: number\n velocity: number\n source: 'dragging' | 'custom' | string\n }\n }\n | { type: 'CLOSE' }\n | { type: 'DRAG' }\n | { type: 'RESIZE' }\n\n// The context (extended state) of the machine\ninterface OverlayContext {\n initialState: 'OPEN' | 'CLOSED'\n}\nfunction sleep(ms = 1000) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nconst cancelOpen = {\n CLOSE: { target: '#overlay.closing', actions: 'onOpenCancel' },\n}\nconst openToDrag = {\n DRAG: { target: '#overlay.dragging', actions: 'onOpenEnd' },\n}\nconst openToResize = {\n RESIZE: { target: '#overlay.resizing', actions: 'onOpenEnd' },\n}\n\nconst initiallyOpen = ({ initialState }) => initialState === 'OPEN'\nconst initiallyClosed = ({ initialState }) => initialState === 'CLOSED'\n\n// Copy paste the machine into https://xstate.js.org/viz/ to make sense of what's going on in here ;)\n\nexport const overlayMachine = Machine<\n OverlayContext,\n OverlayStateSchema,\n OverlayEvent\n>(\n {\n id: 'overlay',\n initial: 'closed',\n context: { initialState: 'CLOSED' },\n states: {\n closed: { on: { OPEN: 'opening', CLOSE: undefined } },\n opening: {\n initial: 'start',\n states: {\n start: {\n invoke: {\n src: 'onOpenStart',\n onDone: 'transition',\n },\n },\n transition: {\n always: [\n { target: 'immediately', cond: 'initiallyOpen' },\n { target: 'smoothly', cond: 'initiallyClosed' },\n ],\n },\n immediately: {\n initial: 'open',\n states: {\n open: {\n invoke: { src: 'openImmediately', onDone: 'activating' },\n },\n activating: {\n invoke: { src: 'activate', onDone: '#overlay.opening.end' },\n on: { ...openToDrag, ...openToResize },\n },\n },\n },\n smoothly: {\n initial: 'visuallyHidden',\n states: {\n visuallyHidden: {\n invoke: { src: 'renderVisuallyHidden', onDone: 'activating' },\n },\n activating: {\n invoke: { src: 'activate', onDone: 'open' },\n },\n open: {\n invoke: { src: 'openSmoothly', onDone: '#overlay.opening.end' },\n on: { ...openToDrag, ...openToResize },\n },\n },\n },\n end: {\n invoke: { src: 'onOpenEnd', onDone: 'done' },\n on: { CLOSE: '#overlay.closing', DRAG: '#overlay.dragging' },\n },\n done: {\n type: 'final',\n },\n },\n on: { ...cancelOpen },\n onDone: 'open',\n },\n open: {\n on: { DRAG: '#overlay.dragging', SNAP: 'snapping', RESIZE: 'resizing' },\n },\n dragging: {\n on: { SNAP: 'snapping' },\n },\n snapping: {\n initial: 'start',\n states: {\n start: {\n invoke: {\n src: 'onSnapStart',\n onDone: 'snappingSmoothly',\n },\n entry: [\n assign({\n // @ts-expect-error\n y: (_, { payload: { y } }) => y,\n velocity: (_, { payload: { velocity } }) => velocity,\n snapSource: (_, { payload: { source = 'custom' } }) => source,\n }),\n ],\n },\n snappingSmoothly: {\n invoke: { src: 'snapSmoothly', onDone: 'end' },\n },\n end: {\n invoke: { src: 'onSnapEnd', onDone: 'done' },\n on: {\n RESIZE: '#overlay.resizing',\n SNAP: '#overlay.snapping',\n CLOSE: '#overlay.closing',\n DRAG: '#overlay.dragging',\n },\n },\n done: { type: 'final' },\n },\n on: {\n SNAP: { target: 'snapping', actions: 'onSnapEnd' },\n RESIZE: { target: '#overlay.resizing', actions: 'onSnapCancel' },\n DRAG: { target: '#overlay.dragging', actions: 'onSnapCancel' },\n CLOSE: { target: '#overlay.closing', actions: 'onSnapCancel' },\n },\n onDone: 'open',\n },\n resizing: {\n initial: 'start',\n states: {\n start: {\n invoke: {\n src: 'onResizeStart',\n onDone: 'resizingSmoothly',\n },\n },\n resizingSmoothly: {\n invoke: { src: 'resizeSmoothly', onDone: 'end' },\n },\n end: {\n invoke: { src: 'onResizeEnd', onDone: 'done' },\n on: {\n SNAP: '#overlay.snapping',\n CLOSE: '#overlay.closing',\n DRAG: '#overlay.dragging',\n },\n },\n done: { type: 'final' },\n },\n on: {\n RESIZE: { target: 'resizing', actions: 'onResizeEnd' },\n SNAP: { target: 'snapping', actions: 'onResizeCancel' },\n DRAG: { target: '#overlay.dragging', actions: 'onResizeCancel' },\n CLOSE: { target: '#overlay.closing', actions: 'onResizeCancel' },\n },\n onDone: 'open',\n },\n closing: {\n initial: 'start',\n states: {\n start: {\n invoke: {\n src: 'onCloseStart',\n onDone: 'deactivating',\n },\n on: { OPEN: { target: '#overlay.open', actions: 'onCloseCancel' } },\n },\n deactivating: {\n invoke: { src: 'deactivate', onDone: 'closingSmoothly' },\n },\n closingSmoothly: {\n invoke: { src: 'closeSmoothly', onDone: 'end' },\n },\n end: {\n invoke: { src: 'onCloseEnd', onDone: 'done' },\n on: {\n OPEN: { target: '#overlay.opening', actions: 'onCloseCancel' },\n },\n },\n done: { type: 'final' },\n },\n on: {\n CLOSE: undefined,\n OPEN: { target: '#overlay.opening', actions: 'onCloseCancel' },\n },\n onDone: 'closed',\n },\n },\n on: {\n CLOSE: 'closing',\n },\n },\n {\n actions: {\n onOpenCancel: (context, event) => {\n console.log('onOpenCancel', { context, event })\n },\n onSnapCancel: (context, event) => {\n console.log('onSnapCancel', { context, event })\n },\n onResizeCancel: (context, event) => {\n console.log('onResizeCancel', { context, event })\n },\n onCloseCancel: (context, event) => {\n console.log('onCloseCancel', { context, event })\n },\n onOpenEnd: (context, event) => {\n console.log('onOpenCancel', { context, event })\n },\n onSnapEnd: (context, event) => {\n console.log('onSnapEnd', { context, event })\n },\n onRezizeEnd: (context, event) => {\n console.log('onRezizeEnd', { context, event })\n },\n },\n services: {\n onSnapStart: async () => {\n await sleep()\n },\n onOpenStart: async () => {\n await sleep()\n },\n onCloseStart: async () => {\n await sleep()\n },\n onResizeStart: async () => {\n await sleep()\n },\n onSnapEnd: async () => {\n await sleep()\n },\n onOpenEnd: async () => {\n await sleep()\n },\n onCloseEnd: async () => {\n await sleep()\n },\n onResizeEnd: async () => {\n await sleep()\n },\n renderVisuallyHidden: async (context, event) => {\n console.group('renderVisuallyHidden')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n activate: async (context, event) => {\n console.group('activate')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n deactivate: async (context, event) => {\n console.group('deactivate')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n openSmoothly: async (context, event) => {\n console.group('openSmoothly')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n openImmediately: async (context, event) => {\n console.group('openImmediately')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n snapSmoothly: async (context, event) => {\n console.group('snapSmoothly')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n resizeSmoothly: async (context, event) => {\n console.group('resizeSmoothly')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n closeSmoothly: async (context, event) => {\n console.group('closeSmoothly')\n console.log({ context, event })\n await sleep()\n console.groupEnd()\n },\n },\n guards: { initiallyClosed, initiallyOpen },\n }\n)\n","import { StateNode } from './StateNode.js';\nimport { IS_PRODUCTION } from './environment.js';\n\nvar warned = false;\nfunction Machine(config, options, initialContext) {\n if (initialContext === void 0) {\n initialContext = config.context;\n }\n\n return new StateNode(config, options, initialContext);\n}\nfunction createMachine(config, options) {\n if (!IS_PRODUCTION && !('predictableActionArguments' in config) && !warned) {\n warned = true;\n console.warn('It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html');\n }\n\n return new StateNode(config, options);\n}\n\nexport { Machine, createMachine };\n","//\n// In order to greatly reduce complexity this component is designed to always transition to open on mount, and then\n// transition to a closed state later. This ensures that all memory used to keep track of animation and gesture state\n// can be reclaimed after the sheet is closed and then unmounted.\n// It also ensures that when transitioning to open on mount the state is always clean, not affected by previous states that could\n// cause race conditions.\n\nimport { useMachine } from '@xstate/react'\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\nimport { animated, config } from 'react-spring'\nimport { rubberbandIfOutOfBounds, useDrag } from 'react-use-gesture'\nimport {\n useAriaHider,\n useFocusTrap,\n useLayoutEffect,\n useReady,\n useReducedMotion,\n useScrollLock,\n useSnapPoints,\n useSpring,\n useSpringInterpolations,\n} from './hooks'\nimport { overlayMachine } from './machines/overlay'\nimport type {\n defaultSnapProps,\n Props,\n RefHandles,\n ResizeSource,\n SnapPointProps,\n} from './types'\nimport { debugging } from './utils'\n\nconst { tension, friction } = config.default\n\n// @TODO implement AbortController to deal with race conditions\n\n// @TODO rename to SpringBottomSheet and allow userland to import it directly, for those who want maximum control and minimal bundlesize\nexport const BottomSheet = React.forwardRef<\n RefHandles,\n {\n initialState: 'OPEN' | 'CLOSED'\n lastSnapRef: React.MutableRefObject<number | null>\n } & Props\n>(function BottomSheetInternal(\n {\n children,\n sibling,\n className,\n footer,\n header,\n open: _open,\n initialState,\n lastSnapRef,\n initialFocusRef,\n onDismiss,\n maxHeight: controlledMaxHeight,\n defaultSnap: getDefaultSnap = _defaultSnap,\n snapPoints: getSnapPoints = _snapPoints,\n blocking = true,\n scrollLocking = true,\n style,\n onSpringStart,\n onSpringCancel,\n onSpringEnd,\n reserveScrollBarGap = blocking,\n expandOnContentDrag = false,\n ...props\n },\n forwardRef\n) {\n // Before any animations can start we need to measure a few things, like the viewport and the dimensions of content, and header + footer if they exist\n // @TODO make ready its own state perhaps, before open or closed\n const { ready, registerReady } = useReady()\n\n // Controls the drag handler, used by spring operations that happen outside the render loop in React\n const canDragRef = useRef(false)\n\n // This way apps don't have to remember to wrap their callbacks in useCallback to avoid breaking the sheet\n const onSpringStartRef = useRef(onSpringStart)\n const onSpringCancelRef = useRef(onSpringCancel)\n const onSpringEndRef = useRef(onSpringEnd)\n useEffect(() => {\n onSpringStartRef.current = onSpringStart\n onSpringCancelRef.current = onSpringCancel\n onSpringEndRef.current = onSpringEnd\n }, [onSpringCancel, onSpringStart, onSpringEnd])\n\n // Behold, the engine of it all!\n const [spring, set] = useSpring()\n\n const containerRef = useRef<HTMLDivElement>(null)\n const scrollRef = useRef<HTMLDivElement>(null)\n const contentRef = useRef<HTMLDivElement>(null)\n const headerRef = useRef<HTMLDivElement>(null)\n const footerRef = useRef<HTMLDivElement>(null)\n const overlayRef = useRef<HTMLDivElement | null>(null)\n\n // Keeps track of the current height, or the height transitioning to\n const heightRef = useRef(0)\n const resizeSourceRef = useRef<ResizeSource>()\n const preventScrollingRef = useRef(false)\n\n const prefersReducedMotion = useReducedMotion()\n\n // \"Plugins\" huhuhu\n const scrollLockRef = useScrollLock({\n targetRef: scrollRef,\n enabled: ready && scrollLocking,\n reserveScrollBarGap,\n })\n const ariaHiderRef = useAriaHider({\n targetRef: containerRef,\n enabled: ready && blocking,\n })\n const focusTrapRef = useFocusTrap({\n targetRef: containerRef,\n fallbackRef: overlayRef,\n initialFocusRef: initialFocusRef || undefined,\n enabled: ready && blocking && initialFocusRef !== false,\n })\n\n const { minSnap, maxSnap, maxHeight, findSnap } = useSnapPoints({\n contentRef,\n controlledMaxHeight,\n footerEnabled: !!footer,\n footerRef,\n getSnapPoints,\n headerEnabled: header !== false,\n headerRef,\n heightRef,\n lastSnapRef,\n ready,\n registerReady,\n resizeSourceRef,\n })\n\n // Setup refs that are used in cases where full control is needed over when a side effect is executed\n const maxHeightRef = useRef(maxHeight)\n const minSnapRef = useRef(minSnap)\n const maxSnapRef = useRef(maxSnap)\n const findSnapRef = useRef(findSnap)\n const defaultSnapRef = useRef(0)\n // Sync the refs with current state, giving the spring full control over when to respond to changes\n useLayoutEffect(() => {\n maxHeightRef.current = maxHeight\n maxSnapRef.current = maxSnap\n minSnapRef.current = minSnap\n findSnapRef.current = findSnap\n defaultSnapRef.current = findSnap(getDefaultSnap)\n }, [findSnap, getDefaultSnap, maxHeight, maxSnap, minSnap])\n\n // New utility for using events safely\n const asyncSet = useCallback<typeof set>(\n // @ts-expect-error\n ({ onRest, config: { velocity = 1, ...config } = {}, ...opts }) =>\n new Promise((resolve) =>\n set({\n ...opts,\n config: {\n velocity,\n ...config,\n // @see https://springs.pomb.us\n mass: 1,\n // \"stiffness\"\n tension,\n // \"damping\"\n friction: Math.max(\n friction,\n friction + (friction - friction * velocity)\n ),\n },\n onRest: (...args) => {\n resolve(...args)\n onRest?.(...args)\n },\n })\n ),\n [set]\n )\n const [current, send] = useMachine(overlayMachine, {\n devTools: debugging,\n actions: {\n onOpenCancel: useCallback(\n () => onSpringCancelRef.current?.({ type: 'OPEN' }),\n []\n ),\n onSnapCancel: useCallback(\n (context) =>\n onSpringCancelRef.current?.({\n type: 'SNAP',\n source: context.snapSource,\n }),\n []\n ),\n onCloseCancel: useCallback(\n () => onSpringCancelRef.current?.({ type: 'CLOSE' }),\n []\n ),\n onResizeCancel: useCallback(\n () =>\n onSpringCancelRef.current?.({\n type: 'RESIZE',\n source: resizeSourceRef.current,\n }),\n []\n ),\n onOpenEnd: useCallback(\n () => onSpringEndRef.current?.({ type: 'OPEN' }),\n []\n ),\n onSnapEnd: useCallback(\n (context, event) =>\n onSpringEndRef.current?.({\n type: 'SNAP',\n source: context.snapSource,\n }),\n []\n ),\n onResizeEnd: useCallback(\n () =>\n onSpringEndRef.current?.({\n type: 'RESIZE',\n source: resizeSourceRef.current,\n }),\n []\n ),\n },\n context: { initialState },\n services: {\n onSnapStart: useCallback(\n async (context, event) =>\n onSpringStartRef.current?.({\n type: 'SNAP',\n source: event.payload.source || 'custom',\n }),\n []\n ),\n onOpenStart: useCallback(\n async () => onSpringStartRef.current?.({ type: 'OPEN' }),\n []\n ),\n onCloseStart: useCallback(\n async () => onSpringStartRef.current?.({ type: 'CLOSE' }),\n []\n ),\n onResizeStart: useCallback(\n async () =>\n onSpringStartRef.current?.({\n type: 'RESIZE',\n source: resizeSourceRef.current,\n }),\n []\n ),\n onSnapEnd: useCallback(\n async (context, event) =>\n onSpringEndRef.current?.({\n type: 'SNAP',\n source: context.snapSource,\n }),\n []\n ),\n onOpenEnd: useCallback(\n async () => onSpringEndRef.current?.({ type: 'OPEN' }),\n []\n ),\n onCloseEnd: useCallback(\n async () => onSpringEndRef.current?.({ type: 'CLOSE' }),\n []\n ),\n onResizeEnd: useCallback(\n async () =>\n onSpringEndRef.current?.({\n type: 'RESIZE',\n source: resizeSourceRef.current,\n }),\n []\n ),\n renderVisuallyHidden: useCallback(\n async (context, event) => {\n await asyncSet({\n y: defaultSnapRef.current,\n ready: 0,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n // Using defaultSnapRef instead of minSnapRef to avoid animating `height` on open\n minSnap: defaultSnapRef.current,\n immediate: true,\n })\n },\n [asyncSet]\n ),\n activate: useCallback(\n async (context, event) => {\n canDragRef.current = true\n await Promise.all([\n scrollLockRef.current.activate(),\n focusTrapRef.current.activate(),\n ariaHiderRef.current.activate(),\n ])\n },\n [ariaHiderRef, focusTrapRef, scrollLockRef]\n ),\n deactivate: useCallback(async () => {\n scrollLockRef.current.deactivate()\n focusTrapRef.current.deactivate()\n ariaHiderRef.current.deactivate()\n canDragRef.current = false\n }, [ariaHiderRef, focusTrapRef, scrollLockRef]),\n openImmediately: useCallback(async () => {\n heightRef.current = defaultSnapRef.current\n await asyncSet({\n y: defaultSnapRef.current,\n ready: 1,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n // Using defaultSnapRef instead of minSnapRef to avoid animating `height` on open\n minSnap: defaultSnapRef.current,\n immediate: true,\n })\n }, [asyncSet]),\n openSmoothly: useCallback(async () => {\n await asyncSet({\n y: 0,\n ready: 1,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n // Using defaultSnapRef instead of minSnapRef to avoid animating `height` on open\n minSnap: defaultSnapRef.current,\n immediate: true,\n })\n\n heightRef.current = defaultSnapRef.current\n\n await asyncSet({\n y: defaultSnapRef.current,\n ready: 1,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n // Using defaultSnapRef instead of minSnapRef to avoid animating `height` on open\n minSnap: defaultSnapRef.current,\n immediate: prefersReducedMotion.current,\n })\n }, [asyncSet, prefersReducedMotion]),\n snapSmoothly: useCallback(\n async (context, event) => {\n const snap = findSnapRef.current(context.y)\n heightRef.current = snap\n lastSnapRef.current = snap\n await asyncSet({\n y: snap,\n ready: 1,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n minSnap: minSnapRef.current,\n immediate: prefersReducedMotion.current,\n config: { velocity: context.velocity },\n })\n },\n [asyncSet, lastSnapRef, prefersReducedMotion]\n ),\n resizeSmoothly: useCallback(async () => {\n const snap = findSnapRef.current(heightRef.current)\n heightRef.current = snap\n lastSnapRef.current = snap\n await asyncSet({\n y: snap,\n ready: 1,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n minSnap: minSnapRef.current,\n immediate:\n resizeSourceRef.current === 'element'\n ? prefersReducedMotion.current\n : true,\n })\n }, [asyncSet, lastSnapRef, prefersReducedMotion]),\n closeSmoothly: useCallback(\n async (context, event) => {\n // Avoid animating the height property on close and stay within FLIP bounds by upping the minSnap\n asyncSet({\n minSnap: heightRef.current,\n immediate: true,\n })\n\n heightRef.current = 0\n\n await asyncSet({\n y: 0,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n immediate: prefersReducedMotion.current,\n })\n\n await asyncSet({ ready: 0, immediate: true })\n },\n [asyncSet, prefersReducedMotion]\n ),\n },\n })\n\n useEffect(() => {\n if (!ready) return\n\n if (_open) {\n send('OPEN')\n } else {\n send('CLOSE')\n }\n }, [_open, send, ready])\n useLayoutEffect(() => {\n // Adjust the height whenever the snap points are changed due to resize events\n if (maxHeight || maxSnap || minSnap) {\n send('RESIZE')\n }\n }, [maxHeight, maxSnap, minSnap, send])\n useEffect(\n () => () => {\n // Ensure effects are cleaned up on unmount, in case they're not cleaned up otherwise\n scrollLockRef.current.deactivate()\n focusTrapRef.current.deactivate()\n ariaHiderRef.current.deactivate()\n },\n [ariaHiderRef, focusTrapRef, scrollLockRef]\n )\n\n useImperativeHandle(\n forwardRef,\n () => ({\n snapTo: (numberOrCallback, { velocity = 1, source = 'custom' } = {}) => {\n send('SNAP', {\n payload: {\n y: findSnapRef.current(numberOrCallback),\n velocity,\n source,\n },\n })\n },\n get height() {\n return heightRef.current\n },\n }),\n [send]\n )\n\n useEffect(() => {\n const elem = scrollRef.current\n\n const preventScrolling = e => {\n if (preventScrollingRef.current) {\n e.preventDefault()\n }\n }\n\n const preventSafariOverscroll = e => {\n if (elem.scrollTop < 0) {\n requestAnimationFrame(() => {\n elem.style.overflow = 'hidden'\n elem.scrollTop = 0\n elem.style.removeProperty('overflow')\n })\n e.preventDefault()\n }\n }\n\n if (expandOnContentDrag) {\n elem.addEventListener('scroll', preventScrolling)\n elem.addEventListener('touchmove', preventScrolling)\n elem.addEventListener('touchstart', preventSafariOverscroll)\n }\n return () => {\n elem.removeEventListener('scroll', preventScrolling)\n elem.removeEventListener('touchmove', preventScrolling)\n elem.removeEventListener('touchstart', preventSafariOverscroll)\n }\n }, [expandOnContentDrag, scrollRef])\n\n const handleDrag = ({\n args: [{ closeOnTap = false, isContentDragging = false } = {}] = [],\n cancel,\n direction: [, direction],\n down,\n first,\n last,\n memo = spring.y.getValue() as number,\n movement: [, _my],\n tap,\n velocity,\n }) => {\n const my = _my * -1\n\n // Cancel the drag operation if the canDrag state changed\n if (!canDragRef.current) {\n console.log('handleDrag cancelled dragging because canDragRef is false')\n cancel()\n return memo\n }\n\n if (onDismiss && closeOnTap && tap) {\n cancel()\n // Runs onDismiss in a timeout to avoid tap events on the backdrop from triggering click events on elements underneath\n setTimeout(() => onDismiss(), 0)\n return memo\n }\n\n // Filter out taps\n if (tap) {\n return memo\n }\n\n const rawY = memo + my\n const predictedDistance = my * velocity\n const predictedY = Math.max(\n minSnapRef.current,\n Math.min(maxSnapRef.current, rawY + predictedDistance * 2)\n )\n\n if (\n !down &&\n onDismiss &&\n direction > 0 &&\n rawY + predictedDistance < minSnapRef.current / 2\n ) {\n cancel()\n onDismiss()\n return memo\n }\n\n let newY = down\n ? // @TODO figure out a better way to deal with rubberband overshooting if min and max have the same value\n !onDismiss && minSnapRef.current === maxSnapRef.current\n ? rawY < minSnapRef.current\n ? rubberbandIfOutOfBounds(\n rawY,\n minSnapRef.current,\n maxSnapRef.current * 2,\n 0.55\n )\n : rubberbandIfOutOfBounds(\n rawY,\n minSnapRef.current / 2,\n maxSnapRef.current,\n 0.55\n )\n : rubberbandIfOutOfBounds(\n rawY,\n onDismiss ? 0 : minSnapRef.current,\n maxSnapRef.current,\n 0.55\n )\n : predictedY\n\n if (expandOnContentDrag && isContentDragging) {\n if (newY >= maxSnapRef.current) {\n newY = maxSnapRef.current\n }\n\n if (memo === maxSnapRef.current && scrollRef.current.scrollTop > 0) {\n newY = maxSnapRef.current\n }\n\n preventScrollingRef.current = newY < maxSnapRef.current;\n } else {\n preventScrollingRef.current = false\n }\n\n if (first) {\n send('DRAG')\n }\n\n if (last) {\n send('SNAP', {\n payload: {\n y: newY,\n velocity: velocity > 0.05 ? velocity : 1,\n source: 'dragging',\n },\n })\n\n return memo\n }\n\n // @TODO too many rerenders\n //send('DRAG', { y: newY, velocity })\n //*\n set({\n y: newY,\n ready: 1,\n maxHeight: maxHeightRef.current,\n maxSnap: maxSnapRef.current,\n minSnap: minSnapRef.current,\n immediate: true,\n config: { velocity },\n })\n // */\n\n return memo\n }\n\n const bind = useDrag(handleDrag, {\n filterTaps: true,\n })\n\n if (Number.isNaN(maxSnapRef.current)) {\n throw new TypeError('maxSnapRef is NaN!!')\n }\n if (Number.isNaN(minSnapRef.current)) {\n throw new TypeError('minSnapRef is NaN!!')\n }\n\n const interpolations = useSpringInterpolations({ spring })\n\n return (\n <animated.div\n {...props}\n data-rsbs-root\n data-rsbs-state={publicStates.find(current.matches)}\n data-rsbs-is-blocking={blocking}\n data-rsbs-is-dismissable={!!onDismiss}\n data-rsbs-has-header={!!header}\n data-rsbs-has-footer={!!footer}\n className={className}\n ref={containerRef}\n style={{\n // spread in the interpolations yeees\n ...interpolations,\n // but allow overriding them/disabling them\n ...style,\n // Not overridable as the \"focus lock with opacity 0\" trick rely on it\n // @TODO the line below only fails on TS <4\n // @ts-ignore\n opacity: spring.ready,\n }}\n >\n {sibling}\n {blocking && (\n <div\n // This component needs to be placed outside bottom-sheet, as bottom-sheet uses transform and thus creates a new context\n // that clips this element to the container, not allowing it to cover the full page.\n key=\"backdrop\"\n data-rsbs-backdrop\n {...bind({ closeOnTap: true })}\n />\n )}\n <div\n key=\"overlay\"\n aria-modal=\"true\"\n role=\"dialog\"\n data-rsbs-overlay\n tabIndex={-1}\n ref={overlayRef}\n onKeyDown={(event) => {\n if (event.key === 'Escape') {\n // Always stop propagation, to avoid weirdness for bottom sheets inside other bottom sheets\n event.stopPropagation()\n if (onDismiss) onDismiss()\n }\n }}\n >\n {header !== false && (\n <div key=\"header\" data-rsbs-header ref={headerRef} {...bind()}>\n {header}\n </div>\n )}\n <div key=\"scroll\" data-rsbs-scroll ref={scrollRef} {...(expandOnContentDrag ? bind({ isContentDragging: true }) : {})}>\n <div data-rsbs-content ref={contentRef}>\n {children}\n </div>\n </div>\n {footer && (\n <div key=\"footer\" ref={footerRef} data-rsbs-footer {...bind()}>\n {footer}\n </div>\n )}\n </div>\n </animated.div>\n )\n})\n\n// Used for the data attribute, list over states available to CSS selectors\nconst publicStates = [\n 'closed',\n 'opening',\n 'open',\n 'closing',\n 'dragging',\n 'snapping',\n 'resizing',\n]\n\n// Default prop values that are callbacks, and it's nice to save some memory and reuse their instances since they're pure\nfunction _defaultSnap({ snapPoints, lastSnap }: defaultSnapProps) {\n return lastSnap ?? Math.min(...snapPoints)\n}\nfunction _snapPoints({ minHeight }: SnapPointProps) {\n return minHeight\n}\n","// Keeps track of wether everything is good to go or not, in the most efficient way possible\n\nimport { useCallback, useEffect, useState } from 'react'\n\nexport function useReady() {\n const [ready, setReady] = useState(false)\n const [readyMap, updateReadyMap] = useState<{ [key: string]: boolean }>({})\n\n const registerReady = useCallback((key: string) => {\n console.count(`registerReady:${key}`)\n // Register the check we're gonna wait for until it's ready\n updateReadyMap((ready) => ({ ...ready, [key]: false }))\n\n return () => {\n console.count(`setReady:${key}`)\n // Set it to ready\n updateReadyMap((ready) => ({ ...ready, [key]: true }))\n }\n }, [])\n\n useEffect(() => {\n const states = Object.values(readyMap)\n\n if (states.length === 0) {\n console.log('nope nothing registered yet')\n return\n }\n\n const isReady = states.every(Boolean)\n console.log('check if we are rready', readyMap, isReady)\n if (isReady) {\n console.warn('ready!')\n setReady(true)\n }\n }, [readyMap])\n\n return { ready, registerReady }\n}\n","import { useDebugValue, useEffect, useMemo, useRef } from 'react'\n\n// @TODO refactor to addEventListener\nexport function useReducedMotion() {\n const mql = useMemo(\n () =>\n typeof window !== 'undefined'\n ? window.matchMedia('(prefers-reduced-motion: reduce)')\n : null,\n []\n )\n const ref = useRef(mql?.matches)\n\n useDebugValue(ref.current ? 'reduce' : 'no-preference')\n\n useEffect(() => {\n const handler = (event) => {\n ref.current = event.matches\n }\n mql?.addListener(handler)\n\n return () => mql?.removeListener(handler)\n }, [mql])\n\n return ref\n}\n","import { useSpring as useReactSpring } from 'react-spring'\n\n// Behold, the engine of it all!\n// Put in this file befause it makes it easier to type and I'm lazy! :D\n\nexport function useSpring() {\n return useReactSpring(() => ({\n y: 0,\n ready: 0,\n maxHeight: 0,\n minSnap: 0,\n maxSnap: 0,\n }))\n}\n\nexport type Spring = ReturnType<typeof useSpring>[0]\nexport type SpringSet = ReturnType<typeof useSpring>[1]\n","import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'\nimport { useDebugValue, useEffect, useRef } from 'react'\n\n/**\n * Handle scroll locking to ensure a good dragging experience on Android and iOS.\n *\n * On iOS the following may happen if scroll isn't locked:\n * - When dragging the sheet the background gets dragged at the same time.\n * - When dragging the page scroll is also affected, causing the drag to feel buggy and \"slow\".\n *\n * On Android it causes the chrome toolbar to pop down as you drag down, and hide as you drag up.\n * When it's in between two toolbar states it causes the framerate to drop way below 60fps on\n * the bottom sheet drag interaction.\n */\nexport function useScrollLock({\n targetRef,\n enabled,\n reserveScrollBarGap,\n}: {\n targetRef: React.RefObject<Element>\n enabled: boolean\n reserveScrollBarGap: boolean\n}) {\n const ref = useRef<{ activate: () => void; deactivate: () => void }>({\n activate: () => {\n throw new TypeError('Tried to activate scroll lock too early')\n },\n deactivate: () => {},\n })\n\n useDebugValue(enabled ? 'Enabled' : 'Disabled')\n\n useEffect(() => {\n if (!enabled) {\n ref.current.deactivate()\n ref.current = { activate: () => {}, deactivate: () => {} }\n return\n }\n\n const target = targetRef.current\n let active = false\n\n ref.current = {\n activate: () => {\n if (active) return\n active = true\n disableBodyScroll(target, {\n allowTouchMove: (el) => el.closest('[data-body-scroll-lock-ignore]'),\n reserveScrollBarGap,\n })\n },\n deactivate: () => {\n if (!active) return\n active = false\n enableBodyScroll(target)\n },\n }\n }, [enabled, targetRef, reserveScrollBarGap])\n\n return ref\n}\n","import React, { useDebugValue, useEffect, useRef } from 'react'\n\n// Handle hiding and restoring aria-hidden attributes\nexport function useAriaHider({\n targetRef,\n enabled,\n}: {\n targetRef: React.RefObject<Element>\n enabled: boolean\n}) {\n const ref = useRef<{ activate: () => void; deactivate: () => void }>({\n activate: () => {\n throw new TypeError('Tried to activate aria hider too early')\n },\n deactivate: () => {},\n })\n\n useDebugValue(enabled ? 'Enabled' : 'Disabled')\n\n useEffect(() => {\n if (!enabled) {\n ref.current.deactivate()\n ref.current = { activate: () => {}, deactivate: () => {} }\n return\n }\n\n const target = targetRef.current\n let active = false\n let originalValues: (null | string)[] = []\n let rootNodes: Element[] = []\n\n ref.current = {\n activate: () => {\n if (active) return\n active = true\n\n const parentNode = target.parentNode\n\n document.querySelectorAll('body > *').forEach((node) => {\n if (node === parentNode) {\n return\n }\n let attr = node.getAttribute('aria-hidden')\n let alreadyHidden = attr !== null && attr !== 'false'\n if (alreadyHidden) {\n return\n }\n originalValues.push(attr)\n rootNodes.push(node)\n node.setAttribute('aria-hidden', 'true')\n })\n },\n deactivate: () => {\n if (!active) return\n active = false\n\n rootNodes.forEach((node, index) => {\n let originalValue = originalValues[index]\n if (originalValue === null) {\n node.removeAttribute('aria-hidden')\n } else {\n node.setAttribute('aria-hidden', originalValue)\n }\n })\n originalValues = []\n rootNodes = []\n },\n }\n }, [targetRef, enabled])\n\n return ref\n}\n","import { createFocusTrap } from 'focus-trap'\nimport { useDebugValue, useEffect, useRef } from 'react'\n\nexport function useFocusTrap({\n targetRef,\n fallbackRef,\n initialFocusRef,\n enabled,\n}: {\n targetRef: React.RefObject<HTMLElement>\n fallbackRef: React.RefObject<HTMLElement>\n initialFocusRef?: React.RefObject<HTMLElement>\n enabled: boolean\n}) {\n const ref = useRef<{ activate: () => void; deactivate: () => void }>({\n activate: () => {\n throw new TypeError('Tried to activate focus trap too early')\n },\n deactivate: () => {},\n })\n\n useDebugValue(enabled ? 'Enabled' : 'Disabled')\n\n useEffect(() => {\n if (!enabled) {\n ref.current.deactivate()\n ref.current = { activate: () => {}, deactivate: () => {} }\n return\n }\n\n const fallback = fallbackRef.current\n const trap = createFocusTrap(targetRef.current, {\n onActivate:\n process.env.NODE_ENV !== 'production'\n ? () => {\n console.log('focus activate')\n }\n : undefined,\n // If initialFocusRef is manually specified we don't want the first tabbable element to receive focus if initialFocusRef can't be found\n initialFocus: initialFocusRef\n ? () => initialFocusRef?.current || fallback\n : undefined,\n fallbackFocus: fallback,\n escapeDeactivates: false,\n clickOutsideDeactivates: false,\n })\n let active = false\n\n ref.current = {\n activate: async () => {\n if (active) return\n active = true\n\n await trap.activate()\n // it's difficult to know exactly when focus is udpated https://github.com/focus-trap/focus-trap/blob/036a72ec48b85414dda00ec0c40d631c8f0ae5ce/index.js#L369-L371\n // This timeout is attempting to compromise between a reasonable guess, as well as not delaying the open transition more than necessary\n await new Promise((resolve) => setTimeout(() => resolve(void 1), 0))\n },\n deactivate: () => {\n if (!active) return\n active = false\n\n trap.deactivate()\n },\n }\n }, [enabled, fallbackRef, initialFocusRef, targetRef])\n\n return ref\n}\n","import { UseDragConfig, Handler, EventTypes } from '../types'\nimport { _buildDragConfig } from './buildConfig'\nimport useRecognizers from './useRecognizers'\nimport { RecognizersMap } from '../recognizers/Recognizer'\nimport { DragRecognizer } from '../recognizers/DragRecognizer'\nimport memoize from '../utils/memoize-one'\nimport isEqual from '../utils/react-fast-compare'\nimport { useRef } from 'react'\n\n/**\n * Drag hook.\n *\n * @param handler - the function fired every time the drag gesture updates\n * @param [config={}] - the config object including generic options and drag options\n */\nexport function useDrag<K = EventTypes['drag']>(handler: Handler<'drag', K>, config: UseDragConfig | {} = {}) {\n RecognizersMap.set('drag', DragRecognizer)\n const buildDragConfig = useRef<any>()\n if (!buildDragConfig.current) {\n buildDragConfig.current = memoize(_buildDragConfig, isEqual)\n }\n return useRecognizers<UseDragConfig>({ drag: handler }, buildDragConfig.current(config))\n}\n","import { interpolate } from 'react-spring'\nimport type { Spring } from './useSpring'\nimport { clamp } from '../utils'\n\n// It's a bit easier to ensure interpolations don't accidentally use the wrong variables by\n// putting them here, in their own closure with explicitly defined variables used\n\n// Note that the callbacks in the interpolation functions close over their scope every time react renders\n// so it's important that if anything can change outside of render that needs to be available\n// in the interpolation then a ref must be used\n\nexport function useSpringInterpolations({\n spring,\n}: {\n spring: Spring\n}): React.CSSProperties {\n // This effect is for removing rounded corners on phones when the sheet touches the top of the browser chrome\n // as it's really ugly with the gaps border radius creates. This ensures it looks sleek.\n // @TODO the ts-ignore comments are because the `extrapolate` param isn't in the TS defs for some reason\n const interpolateBorderRadius = interpolate(\n // @ts-expect-error\n [spring.y, spring.maxHeight],\n (y, maxHeight) => {\n return `${Math.round(clamp(maxHeight - y, 0, 16))}px`\n }\n )\n\n /*\n * Only animate the height when absolute necessary\n * @TODO currently it's only able to opt out of changing the height if there's just a single snapshot\n * but it should be possible to do it in other scenarios too, like on window resize,\n * or maybe even while dragging, but probably requires a more restrictive CSS.\n * As in now the sticky footer isn't overlapping the content, allowing `backdrop-filter: blur(8px)` effects.\n * A FLIP resize flow for content height would likely require the sticky elements to overlap the content area.\n * Could be done as a separat mode though, or a separate example CSS for max performance.\n */\n const interpolateHeight = interpolate(\n // @ts-ignore\n [spring.y, spring.minSnap, spring.maxSnap],\n (y, minSnap, maxSnap) => `${clamp(y, minSnap, maxSnap)}px`\n )\n\n const interpolateY = interpolate(\n // @ts-ignore\n [spring.y, spring.minSnap, spring.maxSnap],\n (y, minSnap, maxSnap) => {\n if (y < minSnap) {\n return `${minSnap - y}px`\n }\n if (y > maxSnap) {\n return `${maxSnap - y}px`\n }\n return '0px'\n }\n )\n\n const interpolateFiller = interpolate(\n // @ts-ignore\n [spring.y, spring.maxSnap],\n (y, maxSnap) => {\n if (y >= maxSnap) {\n return Math.ceil(y - maxSnap)\n }\n return 0\n }\n )\n\n const interpolateContentOpacity = interpolate(\n // @ts-ignore\n [spring.y, spring.minSnap],\n (y, minSnap) => {\n if (!minSnap) {\n return 0\n }\n const minX = Math.max(minSnap / 2 - 45, 0)\n const maxX = Math.min(minSnap / 2 + 45, minSnap)\n const minY = 0\n const maxY = 1\n\n const slope = (maxY - minY) / (maxX - minX)\n const res = (y - minX) * (slope + minY)\n return clamp(res, 0, 1)\n }\n )\n\n const interpolateBackdrop = interpolate(\n // @ts-ignore\n [spring.y, spring.minSnap],\n (y, minSnap) => (minSnap ? clamp(y / minSnap, 0, 1) : 0)\n )\n\n return {\n // Fancy content fade-in effect\n ['--rsbs-content-opacity' as any]: interpolateContentOpacity,\n // Fading in the backdrop\n ['--rsbs-backdrop-opacity' as any]: interpolateBackdrop,\n // Scaling the antigap in the bottom\n ['--rsbs-antigap-scale-y' as any]: interpolateFiller,\n // Shifts the position of the bottom sheet, used on open and close primarily as snap point changes usually only interpolate the height\n ['--rsbs-overlay-translate-y' as any]: interpolateY,\n // Remove rounded borders when full height, it looks much better this way\n ['--rsbs-overlay-rounded' as any]: interpolateBorderRadius,\n // Animates the height state, not the most performant way but it's the safest with regards to mobile browser and focus/scrolling that could happen while animating\n ['--rsbs-overlay-h' as any]: interpolateHeight,\n }\n}\n","/* eslint-disable react/jsx-pascal-case */\nimport Portal from '@reach/portal'\nimport React, { forwardRef, useRef, useState, useCallback } from 'react'\nimport { BottomSheet as _BottomSheet } from './BottomSheet'\nimport type { Props, RefHandles, SpringEvent } from './types'\nimport { useLayoutEffect } from './hooks'\n\nexport type {\n RefHandles as BottomSheetRef,\n Props as BottomSheetProps,\n} from './types'\n\n// Because SSR is annoying to deal with, and all the million complaints about window, navigator and dom elenents!\nexport const BottomSheet = forwardRef<RefHandles, Props>(function BottomSheet(\n { onSpringStart, onSpringEnd, skipInitialTransition, ...props },\n ref\n) {\n // Mounted state, helps SSR but also ensures you can't tab into the sheet while it's closed, or nav there in a screen reader\n const [mounted, setMounted] = useState(false)\n const timerRef = useRef<ReturnType<typeof requestAnimationFrame>>()\n // The last point that the user snapped to, useful for open/closed toggling and the user defined height is remembered\n const lastSnapRef = useRef(null)\n // @TODO refactor to an initialState: OPEN | CLOSED property as it's much easier to understand\n // And informs what we should animate from. If the sheet is mounted with open = true, then initialState = OPEN.\n // When initialState = CLOSED, then internal sheet must first render with open={false} before setting open={props.open}\n // It's only when initialState and props.open is mismatching that a intial transition should happen\n // If they match then transitions will only happen when a user interaction or resize event happen.\n const initialStateRef = useRef<'OPEN' | 'CLOSED'>(\n skipInitialTransition && props.open ? 'OPEN' : 'CLOSED'\n )\n\n // Using layout effect to support cases where the bottom sheet have to appear already open, no transition\n useLayoutEffect(() => {\n if (props.open) {\n cancelAnimationFrame(timerRef.current)\n setMounted(true)\n\n // Cleanup defaultOpen state on close\n return () => {\n initialStateRef.current = 'CLOSED'\n }\n }\n }, [props.open])\n\n const handleSpringStart = useCallback(\n async function handleSpringStart(event: SpringEvent) {\n // Forward the event\n await onSpringStart?.(event)\n\n if (event.type === 'OPEN') {\n // Ensures that when it's opening we abort any pending unmount action\n cancelAnimationFrame(timerRef.current)\n }\n },\n [onSpringStart]\n )\n\n const handleSpringEnd = useCallback(\n async function handleSpringEnd(event: SpringEvent) {\n // Forward the event\n await onSpringEnd?.(event)\n\n if (event.type === 'CLOSE') {\n // Unmount from the dom to avoid contents being tabbable or visible to screen readers while closed\n timerRef.current = requestAnimationFrame(() => setMounted(false))\n }\n },\n [onSpringEnd]\n )\n\n // This isn't just a performance optimization, it's also to avoid issues when running a non-browser env like SSR\n if (!mounted) {\n return null\n }\n\n return (\n <Portal data-rsbs-portal>\n <_BottomSheet\n {...props}\n lastSnapRef={lastSnapRef}\n ref={ref}\n initialState={initialStateRef.current}\n onSpringStart={handleSpringStart}\n onSpringEnd={handleSpringEnd}\n />\n </Portal>\n )\n})\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\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'use strict';\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar __DEV__ = process.env.NODE_ENV !== 'production';\n\nvar warning = function() {};\n\nif (__DEV__) {\n var printWarning = function printWarning(format, args) {\n var len = arguments.length;\n args = new Array(len > 1 ? len - 1 : 0);\n for (var key = 1; key < len; key++) {\n args[key - 1] = arguments[key];\n }\n var argIndex = 0;\n var message = 'Warning: ' +\n format.replace(/%s/g, function() {\n return args[argIndex++];\n });\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n }\n\n warning = function(condition, format, args) {\n var len = arguments.length;\n args = new Array(len > 2 ? len - 2 : 0);\n for (var key = 2; key < len; key++) {\n args[key - 2] = arguments[key];\n }\n if (format === undefined) {\n throw new Error(\n '`warning(condition, format, ...args)` requires a warning ' +\n 'message argument'\n );\n }\n if (!condition) {\n printWarning.apply(null, [format].concat(args));\n }\n };\n}\n\nmodule.exports = warning;\n"],"names":["useIsomorphicLayoutEffect","canUseDOM","useLayoutEffect","useEffect","window","Math","self","document","createElement","_ref","children","_ref$type","type","mountNode","useRef","portalNode","forceUpdate","dispatch","useState","Object","create","useCallback","useForceUpdate","current","ownerDocument","body","appendChild","removeChild","createPortal","ref","__assign","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","__values","o","Symbol","iterator","m","next","value","done","TypeError","__read","r","ar","push","error","__spreadArray","to","from","pack","l","Array","slice","concat","ActionTypes","SpecialTargets","EMPTY_ACTIVITY_MAP","DEFAULT_GUARD_TYPE","_a","start","Start","stop","Stop","raise","Raise","send","Send","cancel","Cancel","nullEvent","NullEvent","Assign","log","After","DoneState","Log","init","Init","invoke","Invoke","errorPlatform","ErrorExecution","ErrorPlatform","ErrorCustom","update","Update","choose","Choose","pure","Pure","IS_PRODUCTION","process","matchesState","parentStateId","childStateId","delimiter","parentStateValue","toStateValue","childStateValue","isString","keys","every","key","getEventType","event","Error","toStatePath","stateId","isArray","toString","split","stateValue","state","pathToStateValue","statePath","marker","mapValues","collection","iteratee","result","collectionKeys","mapFilterValues","predicate","e_1","_b","_c","item","e_1_1","return","path","props","object","e_2","props_1","props_1_1","e_2_1","toStatePaths","flatten","map","subStateValue","subPath","array","toArrayStrict","toArray","undefined","mapContext","mapper","context","_event","e_5","isFunction","data","subMapper","e_5_1","isPromiseLike","Promise","then","updateHistoryStates","hist","states","subHist","updateContext","assignActions","warn","updatedContext","reduce","acc","assignAction","e_7","assignment","meta","action","partialUpdate","propAssignment","e_7_1","toGuard","condition","guardMap","name","message","console","args","symbolObservable","observable","isMachine","toEventObject","payload","toSCXMLEvent","scxmlEvent","$$type","eventObject","toTransitionConfigArray","configLike","transitionLike","target","evaluateGuard","machine","guard","guards","options","guardMeta","cond","condFn","id","toInvokeSource","src","toObserver","nextHandler","errorHandler","completionHandler","noop","isObserver","bind","complete","createInvokeId","stateNodeId","index","isRaisableAction","Internal","delay","isLeafNode","stateNode","getAllChildren","getChildren","filter","sn","getAllStateNodes","stateNodes","getConfiguration","prevStateNodes","e_3","e_4","_d","prevAdjList","getAdjList","Set","configuration","configuration_1","configuration_1_1","parent","has","add","adjList","configuration_2","configuration_2_1","get","_e","_f","child","forEach","initialStateNodes","e_3_1","configuration_3","configuration_3_1","e_4_1","getValueFromAdj","baseNode","childStateNodes","childStateNode","csn","Map","configuration_4","configuration_4_1","set","getValue","rootNode","iterable","some","member","isInFinalState","getTagsFromConfiguration","tags","initEvent","getActionFunction","actionType","actionFunctionMap","toActionObject","actionObject","exec","toActionObjects","subAction","toActivityDefinition","send$1","doneInvoke","DoneInvoke","resolveActions","currentState","currentContext","actionBlocks","predictableExec","preserveActionOrder","actionBlocks_1","actionBlocks_1_1","block","actions","assign$1","splice","pluckAssigns","preservedContexts","deferredToBlockEnd","handleAction","blockType","raise$1","raisedAction","ctx","delaysMap","resolvedDelay","resolvedEvent","configDelay","resolveRaise","delays","sendAction","resolvedTarget","resolveSend","configuredDelay","log$1","resolved","expr","resolveLog","choose$1","matchedActions","conds","find","resolvedActionsFromChoose","resolvedContextFromChoose","pure$1","resolvedActionsFromPure","resolvedContext","stop$1","actorRefOrString","activity","resolvedActorRef","resolveStop","resolvedActionObject","exec_1","contextIndex_1","wrapped","_ctx","_i","resolvedActions","stateValuesEqual","a","b","aKeys","bKeys","isStateConfig","State","config","_this","activities","events","_sessionid","historyValue","history","matches","toStrings","transitions","defineProperty","ownEvents","nextEvents","inert","valueKeys","toJSON","jsonValues","hasTag","tag","can","transitionData","getTransitionData","defaultOptions","deferEvents","Scheduler","processingEvent","queue","initialized","initialize","callback","schedule","flushEvents","task","clear","nextCallback","shift","serviceStack","provide","service","fn","pop","createNullActor","subscribe","unsubscribe","getSnapshot","createDeferredActor","entity","tempActor","deferred","initialState_1","withContext","initialState","sessionIdIndex","registry","actor","delete","getGlobal","globalThis","global","registerService","devTools","__xstate__","getDevTools","register","spawnBehavior","behavior","observers","mailbox","flushing","actorRefLike","toActorRef","event_1","transition","actorCtx","observer","flush","handleError","InterpreterStatus","DEFAULT_SPAWN_OPTIONS","sync","autoForward","ReactEffectType","Interpreter","delayedEventsMap","listeners","contextListeners","stopListeners","doneListeners","eventListeners","sendListeners","status","NotStarted","forwardTo","_outgoingQueue","batch","Stopped","JSON","stringify","Running","scheduler","forward","nextState","_nextState","_state","sendTo","immediate","isParent","Parent","error$1","origin","sessionId","predictableActionArguments","_exec","actionOrExec","err","sendAction_1","defer","sendId","invokeSource","serviceCreator","services","resolvedData","source","spawn","spawnActivity","stopChild","label","logger","resolvedOptions","clock","resolvedId","_initialState","enumerable","configurable","execute","actionsConfig","listener","_g","_h","_j","_k","contextListener","finalChildStateNode","doneData","_doneEvent","_l","_m","_stop","_stopChildren","onTransition","nextListenerOrObserver","_","completeListener","completeOnce","onDone","onStop","onEvent","onSend","onChange","off","_init","resolvedState","resolveState","attachDev","e_6","e_8","e_9","e_10","e_6_1","e_8_1","_o","e_9_1","_p","_q","clearTimeout","e_10_1","exitActions","sort","order","onExit","newState","changed","e_11","batchChanged","batchedActions","_loop_1","bindActionToState","events_1","events_1_1","e_11_1","sender","nextEvent","e_12","e_12_1","timerId","setTimeout","childId","spawnPromise","resolve","spawnCallback","isActor","spawnActor","isObservable","spawnObservable","spawnMachine","childService","doneEvent","actorRef","promise","canceled","response","errorData","errorEvent","originalError","currentError","originalStackTrace","stack","stackTrace","reportUnhandledExceptionOnInvocation","strict","unsubscribed","emitted","callbackStop","receivers","newListener","receiver","subscription","implementation","dispose","spawnEffect","__REDUX_DEVTOOLS_EXTENSION__","devToolsOptions","connect","autoPause","stateSanitizer","features","jump","skip","ms","interpret","useConstant","React","v","executeEffect","originalExec","useReactEffectActions","effectActionsRef","layoutEffectActionsRef","sub","reactEffectActions","items","truthy","falsy","items_1","items_1_1","partition","__effect","Effect","effectActions","layoutEffectActions","effectAction","layoutEffectAction","useMachine","getMachine","initialStateChanged","setState","observerOrListener","rehydratedState","interpreterOptions","machineConfig","withConfig","useInterpret","is","arr","obj","fun","str","num","und","nul","equ","f","withDefault","defaultValue","callProp","_len","_key","interpolateTo","onStart","onRest","onFrame","reset","reverse","force","attach","destroyed","lazy","_objectWithoutPropertiesLoose","getForwardProps","_extends","rest","k","Animated","constructor","getAnimatedValue","getPayload","detach","addChild","AnimatedArray","super","AnimatedObject","values","animated","applyAnimatedValues","colorNames","injectApplyAnimatedValues","transform","injectColorNames","names","interpolation","requestFrame","cb","requestAnimationFrame","injectStringInterpolator","defaultElement","now","Date","injectDefaultElement","el","createAnimatedStyle","manualFrameloop","animatedApi","node","injectCreateAnimatedStyle","factory","AnimatedProps","style","active","controllers","time","controller","isActive","configIdx","configs","endOfAnimation","lastTime","valIdx","animatedValues","animation","fromValues","toValues","position","lastPosition","isAnimated","velocity","initialVelocity","setValue","duration","easing","startTime","decay","exp","abs","lastVelocity","numSteps","floor","tension","friction","mass","isOvershooting","clamp","isVelocity","precision","isDisplacement","size","createInterpolator","range","output","extrapolate","outputRange","inputRange","extrapolateLeft","extrapolateRight","input","findRange","inputMin","inputMax","outputMin","outputMax","Infinity","interpolate","AnimatedInterpolation","parents","calc","updateConfig","interpolate$1","addAnimatedStyles","styles","AnimatedValue","_value","animatedStyles","startPosition","animatedStyle","clearStyles","AnimatedValueArray","G","Controller","idle","hasChanged","guid","local","merged","animations","interpolations","localQueue","getValues","_ref$delay","ops","entries","_ref2","entry","previous","diff","onEnd","_ref3","_ref3$from","_ref3$to","_ref4","finished","async","runAsync","pause","_ref5","fresh","last","_this$props","_this$props$from","_this$props$to","_this$props$config","_ref6","_ref7","isNumber","startsWith","test","isInterpolation","fromValue","toValue","toConfig","interpolation$$1","newValue","currentValue","currentValueDiffersFromGoal","hasNewGoal","hasNewConfig","prev","destroy","useSprings","mounted","ctrl","isFn","_useMemo","useMemo","c","fill","newProps","useImperativeHandle","all","updateCtrl","updateProps","propValues","AnimatedStyle","colors","transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","burntsienna","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","NUMBER","PERCENTAGE","parts","join","rgb","RegExp","rgba","hsl","hsla","hex3","hex4","hex6","hex8","hue2rgb","q","hslToRgb","h","g","round","parse255","int","parseInt","parse360","parseFloat","parse1","parsePercentage","colorToRgba","int32Color","color","match","normalizeColor","stringShapeRegex","colorRegex","colorNamesRegex","isUnitlessNumber","animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","prefixes","dangerousStyleValue","isCustomProperty","trim","prop","prefix","prefixKey","charAt","toUpperCase","substring","attributeCache","rangeValue","replace","outputRanges","number","p1","p2","p3","p4","instance","nodeType","setAttribute","scrollTop","scrollLeft","attributes","nodeName","parentNode","textContent","styleName","styleValue","setProperty","dashCase","toLowerCase","getAttribute","lowercase","extendedAnimated","Component","forwardRef","propsAnimated","attachProps","oldPropsAnimated","didUpdate","_getValue","animatedProps","refFn","val","childRef","handleRef","element","addV","v1","v2","subV","calculateDistance","movement","hypot","calculateAllKinematics","delta","dt","dl","alpha","beta","velocities","direction","distance","sign","x","Number","rubberband","dimension","constant","pow","rubberband2","rubberbandIfOutOfBounds","min","max","minMax","chainFns","fns","_step","_iterator","_createForOfIteratorHelperLoose","ensureVector","fallback","valueFn","_len2","_key2","resolveWith","resolvers","_Object$entries","_Object$entries$_i","resolver","InternalGestureOptionsNormalizers","threshold","enabled","triggerAllEvents","initial","InternalCoordinatesOptionsNormalizers","axis","lockDirection","bounds","left","_value2$left","right","_value2$right","top","_value2$top","bottom","_value2$bottom","isBrowser","InternalGenericOptionsNormalizers","domTarget","_window","_x","eventOptions","_temp","passive","_ref$passive","capture","_ref$capture","InternalDragOptionsNormalizers","filterTaps","_ref3$filterTaps","_ref3$lockDirection","A","_ref3$axis","swipeVelocity","swipeDistance","getInternalGenericOptions","getInternalDragOptions","_buildDragConfig","opts","drag","getInitial","mixed","_active","_blocked","_intentional","_movement","_initial","_bounds","_lastEventType","intentional","offset","lastOffset","first","timeStamp","elapsedTime","memo","getInitialState","shared","hovering","scrolling","wheeling","dragging","moving","pinching","touches","buttons","down","shiftKey","altKey","metaKey","ctrlKey","xy","vxvy","_isTap","_delayedEvent","_pointerId","tap","swipe","pinch","da","vdva","turns","wheel","move","scroll","RecognizersMap","Recognizer","debounced","timeouts","stateKey","fireGestureHandler","forceFlag","clean","prev_active","next_active","ingKey","mapStateValues","newMemo","handler","updateSharedState","sharedState","updateGestureState","gestureState","checkIntentionality","getMovement","_this$config","T","_this$state","wasIntentional","prevMovement","M","getInternalMovement","i0","getIntentionalDisplacement","i1","intentionalityCheck","__cachedBounds","__cachedInitial","_cachedInitial","_cachedBounds","_rubberband","computeRubberband","handlers","Vx","Vy","Rx","Ry","X1","_bounds$","X2","Y1","_bounds$2","Y2","getGenericPayload","isStartEvent","getStartGestureState","recognizer","partial","func","classes","bindings","RecognizerClass","addBindings","nativeRefs","domListeners","getDomTargetFromConfig","removeListeners","takeAll","_i2","_Object$entries2","_Object$entries2$_i","addListeners","updateDomListeners","captureString","_i3","_Object$entries3","_Object$entries3$_i","fnsArray","getPropsListener","effect","_controller$config","windowListeners","clearAllWindowListeners","_step2","_iterator2","_step2$value","eventName","eventHandler","addEventListener","_step3","_iterator3","_step3$value","removeEventListener","useRecognizers","nativeHandlers","internalHandlers","hover","resolveClasses","deprecationNoticeForDomTarget","CoordinatesRecognizer","_Recognizer","absX","_movement$map","absY","getKinematics","getTouchEvents","targetTouches","changedTouches","getGenericEventData","touchEvents","getPointerEventValues","clientX","clientY","DragRecognizer","_CoordinatesRecognize","onDragStart","updateWindowListeners","onDragChange","onDragEnd","pointerId","persist","startDrag","_assertThisInitialized","genericEventData","kinematics","genericPayload","realDistance","vx","_this$state$velocitie","vy","mx","_this$state$movement","my","ix","_this$state$_intentio","iy","svx","_this$config$swipeVel","svy","sx","_this$config$swipeDis","sy","endState","clearWindowListeners","onCancel","onClick","stopPropagation","_inheritsLoose","_proto","memoizeOne","resultFn","isEqual","lastThis","lastResult","lastArgs","calledOnce","newArgs","equal","it","flags","valueOf","Element","$$typeof","candidateSelectors","candidateSelector","NoElement","msMatchesSelector","webkitMatchesSelector","getRootNode","getCandidates","includeContainer","candidates","querySelectorAll","unshift","getCandidatesIteratively","elements","elementsToCheck","tagName","assigned","assignedElements","nestedCandidates","scope","includes","shadowRoot","getShadowRoot","validShadowRoot","shadowRootFilter","_nestedCandidates","getTabindex","isScope","tabIndex","isContentEditable","isNaN","sortOrderedTabbables","documentOrder","isInput","isNonTabbableRadio","isRadio","radioSet","radioScope","form","queryRadios","CSS","escape","checked","nodes","getCheckedRadio","isTabbableRadio","isZeroArea","_node$getBoundingClie","getBoundingClientRect","width","height","isNodeMatchingSelectorFocusable","disabled","isHiddenInput","displayCheck","getComputedStyle","visibility","nodeUnderDetails","parentElement","nodeRootHost","host","nodeIsAttached","contains","originalNode","assignedSlot","getClientRects","isHidden","isDetailsWithSummary","isDisabledFromFieldset","isNodeMatchingSelectorTabbable","isValidShadowRootTabbable","shadowHostNode","sortByOrder","regularTabbables","orderedTabbables","candidateTabindex","content","sortable","tabbable","isTabbable","focusableCandidateSelector","isFocusable","activeFocusTraps","trapQueue","activateTrap","trap","activeTrap","trapIndex","deactivateTrap","unpause","findIndex","idx","valueOrHandler","params","getActualTarget","composedPath","createFocusTrap","userOptions","doc","_objectSpread2","returnFocusOnDeactivate","escapeDeactivates","delayInitialFocus","containers","containerGroups","tabbableGroups","nodeFocusedBeforeActivation","mostRecentlyFocusedNode","paused","delayInitialFocusTimer","getOption","configOverrideOptions","optionName","configOptionName","findContainerIndex","container","tabbableNodes","getNodeForOption","optionValue","querySelector","getInitialFocusNode","activeElement","firstTabbableGroup","firstTabbableNode","updateTabbableNodes","tabbableOptions","focusableNodes","lastTabbableNode","nextTabbableNode","nodeIdx","group","tryFocus","focus","preventScroll","select","isSelectableInput","getReturnFocusNode","previousActiveElement","checkPointerDown","clickOutsideDeactivates","deactivate","returnFocus","allowOutsideClick","preventDefault","checkFocusIn","targetContained","Document","stopImmediatePropagation","checkKey","keyCode","isEscapeEvent","isTabEvent","destinationNode","containerIndex","containerGroup","startOfGroupIndex","destinationGroupIndex","lastOfGroupIndex","_destinationGroupIndex","checkTab","checkClick","activate","activateOptions","onActivate","onPostActivate","checkCanFocusTrap","finishActivation","deactivateOptions","onDeactivate","onPostDeactivate","checkCanReturnFocus","finishDeactivation","updateContainerElements","containerElements","elementsAsArray","Boolean","hasPassiveEvents","passiveTestOptions","ResizeObserverBoxOptions","isIosDevice","navigator","platform","maxTouchPoints","locks","documentListenerAdded","initialClientY","previousBodyOverflowSetting","previousBodyPaddingRight","allowTouchMove","lock","rawEvent","restoreOverflowSetting","paddingRight","overflow","disableBodyScroll","targetElement","arr2","_toConsumableArray","ontouchstart","ontouchmove","scrollHeight","clientHeight","isTargetElementTotallyScrolled","handleScroll","_reserveScrollBarGap","reserveScrollBarGap","scrollBarGap","innerWidth","documentElement","clientWidth","setOverflowHidden","resizeObservers","msg","trigger","freeze","ResizeObserverSize","inlineSize","blockSize","DOMRectReadOnly","y","fromRect","rectangle","isSVG","SVGElement","getBBox","offsetWidth","offsetHeight","isElement","defaultView","cache","WeakMap","scrollRegexp","verticalRegexp","IE","userAgent","parseDimension","pixel","switchSizes","zeroBoxes","devicePixelContentBoxSize","borderBoxSize","contentBoxSize","contentRect","calculateBoxSizes","forceRecalculation","cs","svg","ownerSVGElement","removePadding","boxSizing","writingMode","canScrollVertically","overflowY","canScrollHorizontally","overflowX","paddingTop","paddingBottom","paddingLeft","borderTop","borderTopWidth","borderRight","borderRightWidth","borderBottom","borderBottomWidth","horizontalPadding","verticalPadding","horizontalBorderArea","borderLeftWidth","verticalBorderArea","horizontalScrollbarThickness","verticalScrollbarThickness","widthReduction","heightReduction","contentWidth","contentHeight","borderBoxWidth","borderBoxHeight","boxes","devicePixelRatio","calculateBoxSize","observedBox","DEVICE_PIXEL_CONTENT_BOX","BORDER_BOX","ResizeObserverEntry","calculateDepthForNode","depth","broadcastActiveObservations","shallowestDepth","callbacks","ro","activeTargets","ot","targetDepth","lastReportedSize","callbacks_1","gatherActiveObservationsAtDepth","skippedTargets","observationTargets","ErrorEvent","createEvent","dispatchEvent","deliverResizeLoopError","queueMicroTask","toggle_1","el_1","createTextNode","MutationObserver","observe","characterData","watching","observerConfig","childList","subtree","timeout","scheduled","stopped","run","until","elementsHaveResized","disconnect","updateCount","ResizeObservation","CONTENT_BOX","isReplacedElement","display","skipNotifyOnElement","ResizeObserverDetail","resizeObserver","observerMap","getObservationIndex","ResizeObserverController","detail","firstObservation","box","unobserve","lastObservation","ResizeObserver","simpleSrc","toInvokeDefinition","invokeConfig","onError","invokeDef","NULL_EVENT","WILDCARD","EMPTY_OBJECT","isStateId","StateNode","_context","_stateInfo","__xstatenode","__cache","relativeValue","initialStateValue","on","delayedTransitions","idMap","version","parallel","schema","description","stateConfig","dfs","_transient","always","onEntry","exit","invokeId","definition","eventType","getDelayedTransitions","formatTransitions","transient","sameEventType","afterConfig","after","mutateEntryExit","delayRef","idSuffix","cancel$1","configTransition","resolvedTransition","delayedTransition","formatTransition","getStateNodes","getStateNode","subStateKeys","subStateNodes","subStateKey","handles","stateFromConfig","transitionLeafNode","transitionCompoundNode","_transition","transitionParallelNode","transitionMap","stateTransitions","enabledTransitions","st","exitSet","selectedTransition","nextStateNodes","candidate","stateIn","in","isInState","getStateNodeById","guardPassed","allNextStateNodes","getRelativeStateNodes","internal","targetNode","getPotentiallyReenteringNodes","possibleAncestor","getActions","resolvedConfig","isDone","prevState","prevConfig","entrySet","prevConfig_1","prevConfig_1_1","entryStates","exitStates","doneEvents","grandparent","entryActions","invokeActions","activityDef","stopActions","resolvedStateValue","getResolvedPath","stateTransition","resolveTransition","resolveRaisedTransition","originalEvent","currentActions","willTransition","resolvedConfiguration","start$1","raisedEvents","nonRaisedActions","invokeDefinition","invokeSrc","createInvocableActor","didUpdateContext","hasAlwaysTransitions","maybeNextState","raisedEvent","resolvedStateId","STATE_IDENTIFIER","getStateNodeByPath","arrayStatePath","currentStateNode","subStateNode","stateIdentifier","historyConfig","relativeStateId","resolveHistory","initialPath","getFromRelativePath","relativePath","childStatePath","relativeStateValue","historyTarget","relativeChildPath","accessorProp","subHistoryValue","props_2","props_2_1","subStatePath","childStateIds","stateIds","resolveTarget","_target","isInternalTarget","transitionConfig","normalizedTarget","normalizeTarget","onConfig","wildcardConfigs","strictTransitionConfigs_1","transitionConfigArray","hasNonLastUnguardedTarget","eventText","validateArrayifiedTransitions","eventlessConfig","doneConfig","String","settleTransitions","formattedTransitions","delayedTransitions_1","delayedTransitions_1_1","O","N","w","H","D","resizeSourceRef","u","d","P","z","DRAG","j","RESIZE","initialContext","closed","OPEN","CLOSE","opening","immediately","open","activating","smoothly","visuallyHidden","end","SNAP","snapping","R","snapSource","snappingSmoothly","resizing","resizingSmoothly","closing","deactivating","closingSmoothly","onOpenCancel","onSnapCancel","onResizeCancel","onCloseCancel","onOpenEnd","onSnapEnd","onRezizeEnd","onSnapStart","reject","onOpenStart","onCloseStart","onResizeStart","onCloseEnd","onResizeEnd","renderVisuallyHidden","openSmoothly","openImmediately","snapSmoothly","resizeSmoothly","closeSmoothly","initiallyClosed","initiallyOpen","L","I","F","Z","sibling","className","footer","header","lastSnapRef","initialFocusRef","onDismiss","maxHeight","K","defaultSnap","J","Q","snapPoints","U","V","W","blocking","X","Y","scrollLocking","$","ee","onSpringStart","ne","onSpringCancel","re","onSpringEnd","te","oe","ie","expandOnContentDrag","ae","ce","C","ue","ready","registerReady","se","le","de","fe","ve","me","pe","ye","he","_useSprings","minSnap","maxSnap","ge","Se","Ee","Pe","be","Re","xe","Ce","Oe","Ne","we","He","matchMedia","addListener","removeListener","De","targetRef","S","closest","ke","removeAttribute","ze","fallbackRef","initialFocus","fallbackFocus","je","getSnapPoints","heightRef","contentRef","controlledMaxHeight","footerEnabled","footerRef","headerEnabled","headerRef","innerHeight","cancelAnimationFrame","E","minHeight","headerHeight","footerHeight","findSnap","lastSnap","Ae","Le","Te","Me","Ie","Fe","Ge","Ze","Be","qe","Ve","Ke","Je","snapTo","removeProperty","Qe","buildDragConfig","closeOnTap","isContentDragging","Ue","spring","ceil","div","B","role","onKeyDown","skipInitialTransition","warning","module","exports"],"sourceRoot":""}