g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import React from 'react';\nexport var ReactReduxContext = /*#__PURE__*/React.createContext(null);\n\nif (process.env.NODE_ENV !== 'production') {\n ReactReduxContext.displayName = 'ReactRedux';\n}\n\nexport default ReactReduxContext;","// Default to a dummy \"batch\" implementation that just runs the callback\nfunction defaultNoopBatch(callback) {\n callback();\n}\n\nvar batch = defaultNoopBatch; // Allow injecting another batching function later\n\nexport var setBatch = function setBatch(newBatch) {\n return batch = newBatch;\n}; // Supply a getter just to skip dealing with ESM bindings\n\nexport var getBatch = function getBatch() {\n return batch;\n};","import { getBatch } from './batch'; // encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\nfunction createListenerCollection() {\n var batch = getBatch();\n var first = null;\n var last = null;\n return {\n clear: function clear() {\n first = null;\n last = null;\n },\n notify: function notify() {\n batch(function () {\n var listener = first;\n\n while (listener) {\n listener.callback();\n listener = listener.next;\n }\n });\n },\n get: function get() {\n var listeners = [];\n var listener = first;\n\n while (listener) {\n listeners.push(listener);\n listener = listener.next;\n }\n\n return listeners;\n },\n subscribe: function subscribe(callback) {\n var isSubscribed = true;\n var listener = last = {\n callback: callback,\n next: null,\n prev: last\n };\n\n if (listener.prev) {\n listener.prev.next = listener;\n } else {\n first = listener;\n }\n\n return function unsubscribe() {\n if (!isSubscribed || first === null) return;\n isSubscribed = false;\n\n if (listener.next) {\n listener.next.prev = listener.prev;\n } else {\n last = listener.prev;\n }\n\n if (listener.prev) {\n listener.prev.next = listener.next;\n } else {\n first = listener.next;\n }\n };\n }\n };\n}\n\nvar nullListeners = {\n notify: function notify() {},\n get: function get() {\n return [];\n }\n};\nexport function createSubscription(store, parentSub) {\n var unsubscribe;\n var listeners = nullListeners;\n\n function addNestedSub(listener) {\n trySubscribe();\n return listeners.subscribe(listener);\n }\n\n function notifyNestedSubs() {\n listeners.notify();\n }\n\n function handleChangeWrapper() {\n if (subscription.onStateChange) {\n subscription.onStateChange();\n }\n }\n\n function isSubscribed() {\n return Boolean(unsubscribe);\n }\n\n function trySubscribe() {\n if (!unsubscribe) {\n unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);\n listeners = createListenerCollection();\n }\n }\n\n function tryUnsubscribe() {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n listeners.clear();\n listeners = nullListeners;\n }\n }\n\n var subscription = {\n addNestedSub: addNestedSub,\n notifyNestedSubs: notifyNestedSubs,\n handleChangeWrapper: handleChangeWrapper,\n isSubscribed: isSubscribed,\n trySubscribe: trySubscribe,\n tryUnsubscribe: tryUnsubscribe,\n getListeners: function getListeners() {\n return listeners;\n }\n };\n return subscription;\n}","import { useEffect, useLayoutEffect } from 'react'; // 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 need useLayoutEffect to ensure the store\n// subscription callback always has the selector from the latest render commit\n// available, otherwise a store update may happen between render and the effect,\n// which may cause missed updates; we also must ensure the store subscription\n// is created synchronously, otherwise a store update may occur before the\n// subscription is created and an inconsistent state may be observed\n\nexport var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? useLayoutEffect : useEffect;","import React, { useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { ReactReduxContext } from './Context';\nimport { createSubscription } from '../utils/Subscription';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\n\nfunction Provider(_ref) {\n var store = _ref.store,\n context = _ref.context,\n children = _ref.children;\n var contextValue = useMemo(function () {\n var subscription = createSubscription(store);\n subscription.onStateChange = subscription.notifyNestedSubs;\n return {\n store: store,\n subscription: subscription\n };\n }, [store]);\n var previousState = useMemo(function () {\n return store.getState();\n }, [store]);\n useIsomorphicLayoutEffect(function () {\n var subscription = contextValue.subscription;\n subscription.trySubscribe();\n\n if (previousState !== store.getState()) {\n subscription.notifyNestedSubs();\n }\n\n return function () {\n subscription.tryUnsubscribe();\n subscription.onStateChange = null;\n };\n }, [contextValue, previousState]);\n var Context = context || ReactReduxContext;\n return /*#__PURE__*/React.createElement(Context.Provider, {\n value: contextValue\n }, children);\n}\n\nif (process.env.NODE_ENV !== 'production') {\n Provider.propTypes = {\n store: PropTypes.shape({\n subscribe: PropTypes.func.isRequired,\n dispatch: PropTypes.func.isRequired,\n getState: PropTypes.func.isRequired\n }),\n context: PropTypes.object,\n children: PropTypes.any\n };\n}\n\nexport default Provider;","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nvar _excluded = [\"getDisplayName\", \"methodName\", \"renderCountProp\", \"shouldHandleStateChanges\", \"storeKey\", \"withRef\", \"forwardRef\", \"context\"],\n _excluded2 = [\"reactReduxForwardedRef\"];\nimport hoistStatics from 'hoist-non-react-statics';\nimport React, { useContext, useMemo, useRef, useReducer } from 'react';\nimport { isValidElementType, isContextConsumer } from 'react-is';\nimport { createSubscription } from '../utils/Subscription';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\nimport { ReactReduxContext } from './Context'; // Define some constant arrays just to avoid re-creating these\n\nvar EMPTY_ARRAY = [];\nvar NO_SUBSCRIPTION_ARRAY = [null, null];\n\nvar stringifyComponent = function stringifyComponent(Comp) {\n try {\n return JSON.stringify(Comp);\n } catch (err) {\n return String(Comp);\n }\n};\n\nfunction storeStateUpdatesReducer(state, action) {\n var updateCount = state[1];\n return [action.payload, updateCount + 1];\n}\n\nfunction useIsomorphicLayoutEffectWithArgs(effectFunc, effectArgs, dependencies) {\n useIsomorphicLayoutEffect(function () {\n return effectFunc.apply(void 0, effectArgs);\n }, dependencies);\n}\n\nfunction captureWrapperProps(lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, actualChildProps, childPropsFromStoreUpdate, notifyNestedSubs) {\n // We want to capture the wrapper props and child props we used for later comparisons\n lastWrapperProps.current = wrapperProps;\n lastChildProps.current = actualChildProps;\n renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update\n\n if (childPropsFromStoreUpdate.current) {\n childPropsFromStoreUpdate.current = null;\n notifyNestedSubs();\n }\n}\n\nfunction subscribeUpdates(shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, childPropsFromStoreUpdate, notifyNestedSubs, forceComponentUpdateDispatch) {\n // If we're not subscribed to the store, nothing to do here\n if (!shouldHandleStateChanges) return; // Capture values for checking if and when this component unmounts\n\n var didUnsubscribe = false;\n var lastThrownError = null; // We'll run this callback every time a store subscription update propagates to this component\n\n var checkForUpdates = function checkForUpdates() {\n if (didUnsubscribe) {\n // Don't run stale listeners.\n // Redux doesn't guarantee unsubscriptions happen until next dispatch.\n return;\n }\n\n var latestStoreState = store.getState();\n var newChildProps, error;\n\n try {\n // Actually run the selector with the most recent store state and wrapper props\n // to determine what the child props should be\n newChildProps = childPropsSelector(latestStoreState, lastWrapperProps.current);\n } catch (e) {\n error = e;\n lastThrownError = e;\n }\n\n if (!error) {\n lastThrownError = null;\n } // If the child props haven't changed, nothing to do here - cascade the subscription update\n\n\n if (newChildProps === lastChildProps.current) {\n if (!renderIsScheduled.current) {\n notifyNestedSubs();\n }\n } else {\n // Save references to the new child props. Note that we track the \"child props from store update\"\n // as a ref instead of a useState/useReducer because we need a way to determine if that value has\n // been processed. If this went into useState/useReducer, we couldn't clear out the value without\n // forcing another re-render, which we don't want.\n lastChildProps.current = newChildProps;\n childPropsFromStoreUpdate.current = newChildProps;\n renderIsScheduled.current = true; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render\n\n forceComponentUpdateDispatch({\n type: 'STORE_UPDATED',\n payload: {\n error: error\n }\n });\n }\n }; // Actually subscribe to the nearest connected ancestor (or store)\n\n\n subscription.onStateChange = checkForUpdates;\n subscription.trySubscribe(); // Pull data from the store after first render in case the store has\n // changed since we began.\n\n checkForUpdates();\n\n var unsubscribeWrapper = function unsubscribeWrapper() {\n didUnsubscribe = true;\n subscription.tryUnsubscribe();\n subscription.onStateChange = null;\n\n if (lastThrownError) {\n // It's possible that we caught an error due to a bad mapState function, but the\n // parent re-rendered without this component and we're about to unmount.\n // This shouldn't happen as long as we do top-down subscriptions correctly, but\n // if we ever do those wrong, this throw will surface the error in our tests.\n // In that case, throw the error from here so it doesn't get lost.\n throw lastThrownError;\n }\n };\n\n return unsubscribeWrapper;\n}\n\nvar initStateUpdates = function initStateUpdates() {\n return [null, 0];\n};\n\nexport default function connectAdvanced(\n/*\n selectorFactory is a func that is responsible for returning the selector function used to\n compute new props from state, props, and dispatch. For example:\n export default connectAdvanced((dispatch, options) => (state, props) => ({\n thing: state.things[props.thingId],\n saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),\n }))(YourComponent)\n Access to dispatch is provided to the factory so selectorFactories can bind actionCreators\n outside of their selector as an optimization. Options passed to connectAdvanced are passed to\n the selectorFactory, along with displayName and WrappedComponent, as the second argument.\n Note that selectorFactory is responsible for all caching/memoization of inbound and outbound\n props. Do not use connectAdvanced directly without memoizing results between calls to your\n selector, otherwise the Connect component will re-render on every state or props change.\n*/\nselectorFactory, // options object:\n_ref) {\n if (_ref === void 0) {\n _ref = {};\n }\n\n var _ref2 = _ref,\n _ref2$getDisplayName = _ref2.getDisplayName,\n getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {\n return \"ConnectAdvanced(\" + name + \")\";\n } : _ref2$getDisplayName,\n _ref2$methodName = _ref2.methodName,\n methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,\n _ref2$renderCountProp = _ref2.renderCountProp,\n renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,\n _ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,\n shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,\n _ref2$storeKey = _ref2.storeKey,\n storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,\n _ref2$withRef = _ref2.withRef,\n withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,\n _ref2$forwardRef = _ref2.forwardRef,\n forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef,\n _ref2$context = _ref2.context,\n context = _ref2$context === void 0 ? ReactReduxContext : _ref2$context,\n connectOptions = _objectWithoutPropertiesLoose(_ref2, _excluded);\n\n if (process.env.NODE_ENV !== 'production') {\n if (renderCountProp !== undefined) {\n throw new Error(\"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension\");\n }\n\n if (withRef) {\n throw new Error('withRef is removed. To access the wrapped instance, use a ref on the connected component');\n }\n\n var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + \"React.createContext(), and pass the context object to React Redux's Provider and specific components\" + ' like: . ' + 'You may also pass a {context : MyContext} option to connect';\n\n if (storeKey !== 'store') {\n throw new Error('storeKey has been removed and does not do anything. ' + customStoreWarningMessage);\n }\n }\n\n var Context = context;\n return function wrapWithConnect(WrappedComponent) {\n if (process.env.NODE_ENV !== 'production' && !isValidElementType(WrappedComponent)) {\n throw new Error(\"You must pass a component to the function returned by \" + (methodName + \". Instead received \" + stringifyComponent(WrappedComponent)));\n }\n\n var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n var displayName = getDisplayName(wrappedComponentName);\n\n var selectorFactoryOptions = _extends({}, connectOptions, {\n getDisplayName: getDisplayName,\n methodName: methodName,\n renderCountProp: renderCountProp,\n shouldHandleStateChanges: shouldHandleStateChanges,\n storeKey: storeKey,\n displayName: displayName,\n wrappedComponentName: wrappedComponentName,\n WrappedComponent: WrappedComponent\n });\n\n var pure = connectOptions.pure;\n\n function createChildSelector(store) {\n return selectorFactory(store.dispatch, selectorFactoryOptions);\n } // If we aren't running in \"pure\" mode, we don't want to memoize values.\n // To avoid conditionally calling hooks, we fall back to a tiny wrapper\n // that just executes the given callback immediately.\n\n\n var usePureOnlyMemo = pure ? useMemo : function (callback) {\n return callback();\n };\n\n function ConnectFunction(props) {\n var _useMemo = useMemo(function () {\n // Distinguish between actual \"data\" props that were passed to the wrapper component,\n // and values needed to control behavior (forwarded refs, alternate context instances).\n // To maintain the wrapperProps object reference, memoize this destructuring.\n var reactReduxForwardedRef = props.reactReduxForwardedRef,\n wrapperProps = _objectWithoutPropertiesLoose(props, _excluded2);\n\n return [props.context, reactReduxForwardedRef, wrapperProps];\n }, [props]),\n propsContext = _useMemo[0],\n reactReduxForwardedRef = _useMemo[1],\n wrapperProps = _useMemo[2];\n\n var ContextToUse = useMemo(function () {\n // Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.\n // Memoize the check that determines which context instance we should use.\n return propsContext && propsContext.Consumer && isContextConsumer( /*#__PURE__*/React.createElement(propsContext.Consumer, null)) ? propsContext : Context;\n }, [propsContext, Context]); // Retrieve the store and ancestor subscription via context, if available\n\n var contextValue = useContext(ContextToUse); // The store _must_ exist as either a prop or in context.\n // We'll check to see if it _looks_ like a Redux store first.\n // This allows us to pass through a `store` prop that is just a plain value.\n\n var didStoreComeFromProps = Boolean(props.store) && Boolean(props.store.getState) && Boolean(props.store.dispatch);\n var didStoreComeFromContext = Boolean(contextValue) && Boolean(contextValue.store);\n\n if (process.env.NODE_ENV !== 'production' && !didStoreComeFromProps && !didStoreComeFromContext) {\n throw new Error(\"Could not find \\\"store\\\" in the context of \" + (\"\\\"\" + displayName + \"\\\". Either wrap the root component in a , \") + \"or pass a custom React context provider to and the corresponding \" + (\"React context consumer to \" + displayName + \" in connect options.\"));\n } // Based on the previous check, one of these must be true\n\n\n var store = didStoreComeFromProps ? props.store : contextValue.store;\n var childPropsSelector = useMemo(function () {\n // The child props selector needs the store reference as an input.\n // Re-create this selector whenever the store changes.\n return createChildSelector(store);\n }, [store]);\n\n var _useMemo2 = useMemo(function () {\n if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY; // This Subscription's source should match where store came from: props vs. context. A component\n // connected to the store via props shouldn't use subscription from context, or vice versa.\n\n // This Subscription's source should match where store came from: props vs. context. A component\n // connected to the store via props shouldn't use subscription from context, or vice versa.\n var subscription = createSubscription(store, didStoreComeFromProps ? null : contextValue.subscription); // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in\n // the middle of the notification loop, where `subscription` will then be null. This can\n // probably be avoided if Subscription's listeners logic is changed to not call listeners\n // that have been unsubscribed in the middle of the notification loop.\n\n // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in\n // the middle of the notification loop, where `subscription` will then be null. This can\n // probably be avoided if Subscription's listeners logic is changed to not call listeners\n // that have been unsubscribed in the middle of the notification loop.\n var notifyNestedSubs = subscription.notifyNestedSubs.bind(subscription);\n return [subscription, notifyNestedSubs];\n }, [store, didStoreComeFromProps, contextValue]),\n subscription = _useMemo2[0],\n notifyNestedSubs = _useMemo2[1]; // Determine what {store, subscription} value should be put into nested context, if necessary,\n // and memoize that value to avoid unnecessary context updates.\n\n\n var overriddenContextValue = useMemo(function () {\n if (didStoreComeFromProps) {\n // This component is directly subscribed to a store from props.\n // We don't want descendants reading from this store - pass down whatever\n // the existing context value is from the nearest connected ancestor.\n return contextValue;\n } // Otherwise, put this component's subscription instance into context, so that\n // connected descendants won't update until after this component is done\n\n\n return _extends({}, contextValue, {\n subscription: subscription\n });\n }, [didStoreComeFromProps, contextValue, subscription]); // We need to force this wrapper component to re-render whenever a Redux store update\n // causes a change to the calculated child component props (or we caught an error in mapState)\n\n var _useReducer = useReducer(storeStateUpdatesReducer, EMPTY_ARRAY, initStateUpdates),\n _useReducer$ = _useReducer[0],\n previousStateUpdateResult = _useReducer$[0],\n forceComponentUpdateDispatch = _useReducer[1]; // Propagate any mapState/mapDispatch errors upwards\n\n\n if (previousStateUpdateResult && previousStateUpdateResult.error) {\n throw previousStateUpdateResult.error;\n } // Set up refs to coordinate values between the subscription effect and the render logic\n\n\n var lastChildProps = useRef();\n var lastWrapperProps = useRef(wrapperProps);\n var childPropsFromStoreUpdate = useRef();\n var renderIsScheduled = useRef(false);\n var actualChildProps = usePureOnlyMemo(function () {\n // Tricky logic here:\n // - This render may have been triggered by a Redux store update that produced new child props\n // - However, we may have gotten new wrapper props after that\n // If we have new child props, and the same wrapper props, we know we should use the new child props as-is.\n // But, if we have new wrapper props, those might change the child props, so we have to recalculate things.\n // So, we'll use the child props from store update only if the wrapper props are the same as last time.\n if (childPropsFromStoreUpdate.current && wrapperProps === lastWrapperProps.current) {\n return childPropsFromStoreUpdate.current;\n } // TODO We're reading the store directly in render() here. Bad idea?\n // This will likely cause Bad Things (TM) to happen in Concurrent Mode.\n // Note that we do this because on renders _not_ caused by store updates, we need the latest store state\n // to determine what the child props should be.\n\n\n return childPropsSelector(store.getState(), wrapperProps);\n }, [store, previousStateUpdateResult, wrapperProps]); // We need this to execute synchronously every time we re-render. However, React warns\n // about useLayoutEffect in SSR, so we try to detect environment and fall back to\n // just useEffect instead to avoid the warning, since neither will run anyway.\n\n useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, actualChildProps, childPropsFromStoreUpdate, notifyNestedSubs]); // Our re-subscribe logic only runs when the store/subscription setup changes\n\n useIsomorphicLayoutEffectWithArgs(subscribeUpdates, [shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, childPropsFromStoreUpdate, notifyNestedSubs, forceComponentUpdateDispatch], [store, subscription, childPropsSelector]); // Now that all that's done, we can finally try to actually render the child component.\n // We memoize the elements for the rendered child component as an optimization.\n\n var renderedWrappedComponent = useMemo(function () {\n return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, actualChildProps, {\n ref: reactReduxForwardedRef\n }));\n }, [reactReduxForwardedRef, WrappedComponent, actualChildProps]); // If React sees the exact same element reference as last time, it bails out of re-rendering\n // that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.\n\n var renderedChild = useMemo(function () {\n if (shouldHandleStateChanges) {\n // If this component is subscribed to store updates, we need to pass its own\n // subscription instance down to our descendants. That means rendering the same\n // Context instance, and putting a different value into the context.\n return /*#__PURE__*/React.createElement(ContextToUse.Provider, {\n value: overriddenContextValue\n }, renderedWrappedComponent);\n }\n\n return renderedWrappedComponent;\n }, [ContextToUse, renderedWrappedComponent, overriddenContextValue]);\n return renderedChild;\n } // If we're in \"pure\" mode, ensure our wrapper component only re-renders when incoming props have changed.\n\n\n var Connect = pure ? React.memo(ConnectFunction) : ConnectFunction;\n Connect.WrappedComponent = WrappedComponent;\n Connect.displayName = ConnectFunction.displayName = displayName;\n\n if (forwardRef) {\n var forwarded = React.forwardRef(function forwardConnectRef(props, ref) {\n return /*#__PURE__*/React.createElement(Connect, _extends({}, props, {\n reactReduxForwardedRef: ref\n }));\n });\n forwarded.displayName = displayName;\n forwarded.WrappedComponent = WrappedComponent;\n return hoistStatics(forwarded, WrappedComponent);\n }\n\n return hoistStatics(Connect, WrappedComponent);\n };\n}","function is(x, y) {\n if (x === y) {\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\n\nexport default function shallowEqual(objA, objB) {\n if (is(objA, objB)) return true;\n\n if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n if (keysA.length !== keysB.length) return false;\n\n for (var i = 0; i < keysA.length; i++) {\n if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n\n return true;\n}","import verifyPlainObject from '../utils/verifyPlainObject';\nexport function wrapMapToPropsConstant(getConstant) {\n return function initConstantSelector(dispatch, options) {\n var constant = getConstant(dispatch, options);\n\n function constantSelector() {\n return constant;\n }\n\n constantSelector.dependsOnOwnProps = false;\n return constantSelector;\n };\n} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args\n// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine\n// whether mapToProps needs to be invoked when props have changed.\n//\n// A length of one signals that mapToProps does not depend on props from the parent component.\n// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and\n// therefore not reporting its length accurately..\n\nexport function getDependsOnOwnProps(mapToProps) {\n return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;\n} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,\n// this function wraps mapToProps in a proxy function which does several things:\n//\n// * Detects whether the mapToProps function being called depends on props, which\n// is used by selectorFactory to decide if it should reinvoke on props changes.\n//\n// * On first call, handles mapToProps if returns another function, and treats that\n// new function as the true mapToProps for subsequent calls.\n//\n// * On first call, verifies the first result is a plain object, in order to warn\n// the developer that their mapToProps function is not returning a valid result.\n//\n\nexport function wrapMapToPropsFunc(mapToProps, methodName) {\n return function initProxySelector(dispatch, _ref) {\n var displayName = _ref.displayName;\n\n var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {\n return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);\n }; // allow detectFactoryAndVerify to get ownProps\n\n\n proxy.dependsOnOwnProps = true;\n\n proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {\n proxy.mapToProps = mapToProps;\n proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);\n var props = proxy(stateOrDispatch, ownProps);\n\n if (typeof props === 'function') {\n proxy.mapToProps = props;\n proxy.dependsOnOwnProps = getDependsOnOwnProps(props);\n props = proxy(stateOrDispatch, ownProps);\n }\n\n if (process.env.NODE_ENV !== 'production') verifyPlainObject(props, displayName, methodName);\n return props;\n };\n\n return proxy;\n };\n}","import bindActionCreators from '../utils/bindActionCreators';\nimport { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps';\nexport function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {\n return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;\n}\nexport function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {\n return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {\n return {\n dispatch: dispatch\n };\n }) : undefined;\n}\nexport function whenMapDispatchToPropsIsObject(mapDispatchToProps) {\n return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {\n return bindActionCreators(mapDispatchToProps, dispatch);\n }) : undefined;\n}\nexport default [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];","export default function bindActionCreators(actionCreators, dispatch) {\n var boundActionCreators = {};\n\n var _loop = function _loop(key) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = function () {\n return dispatch(actionCreator.apply(void 0, arguments));\n };\n }\n };\n\n for (var key in actionCreators) {\n _loop(key);\n }\n\n return boundActionCreators;\n}","import { wrapMapToPropsConstant, wrapMapToPropsFunc } from './wrapMapToProps';\nexport function whenMapStateToPropsIsFunction(mapStateToProps) {\n return typeof mapStateToProps === 'function' ? wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps') : undefined;\n}\nexport function whenMapStateToPropsIsMissing(mapStateToProps) {\n return !mapStateToProps ? wrapMapToPropsConstant(function () {\n return {};\n }) : undefined;\n}\nexport default [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport verifyPlainObject from '../utils/verifyPlainObject';\nexport function defaultMergeProps(stateProps, dispatchProps, ownProps) {\n return _extends({}, ownProps, stateProps, dispatchProps);\n}\nexport function wrapMergePropsFunc(mergeProps) {\n return function initMergePropsProxy(dispatch, _ref) {\n var displayName = _ref.displayName,\n pure = _ref.pure,\n areMergedPropsEqual = _ref.areMergedPropsEqual;\n var hasRunOnce = false;\n var mergedProps;\n return function mergePropsProxy(stateProps, dispatchProps, ownProps) {\n var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);\n\n if (hasRunOnce) {\n if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;\n } else {\n hasRunOnce = true;\n mergedProps = nextMergedProps;\n if (process.env.NODE_ENV !== 'production') verifyPlainObject(mergedProps, displayName, 'mergeProps');\n }\n\n return mergedProps;\n };\n };\n}\nexport function whenMergePropsIsFunction(mergeProps) {\n return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;\n}\nexport function whenMergePropsIsOmitted(mergeProps) {\n return !mergeProps ? function () {\n return defaultMergeProps;\n } : undefined;\n}\nexport default [whenMergePropsIsFunction, whenMergePropsIsOmitted];","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nvar _excluded = [\"initMapStateToProps\", \"initMapDispatchToProps\", \"initMergeProps\"];\nimport verifySubselectors from './verifySubselectors';\nexport function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {\n return function impureFinalPropsSelector(state, ownProps) {\n return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);\n };\n}\nexport function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {\n var areStatesEqual = _ref.areStatesEqual,\n areOwnPropsEqual = _ref.areOwnPropsEqual,\n areStatePropsEqual = _ref.areStatePropsEqual;\n var hasRunAtLeastOnce = false;\n var state;\n var ownProps;\n var stateProps;\n var dispatchProps;\n var mergedProps;\n\n function handleFirstCall(firstState, firstOwnProps) {\n state = firstState;\n ownProps = firstOwnProps;\n stateProps = mapStateToProps(state, ownProps);\n dispatchProps = mapDispatchToProps(dispatch, ownProps);\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps);\n hasRunAtLeastOnce = true;\n return mergedProps;\n }\n\n function handleNewPropsAndNewState() {\n stateProps = mapStateToProps(state, ownProps);\n if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps);\n return mergedProps;\n }\n\n function handleNewProps() {\n if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);\n if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);\n mergedProps = mergeProps(stateProps, dispatchProps, ownProps);\n return mergedProps;\n }\n\n function handleNewState() {\n var nextStateProps = mapStateToProps(state, ownProps);\n var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);\n stateProps = nextStateProps;\n if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);\n return mergedProps;\n }\n\n function handleSubsequentCalls(nextState, nextOwnProps) {\n var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);\n var stateChanged = !areStatesEqual(nextState, state);\n state = nextState;\n ownProps = nextOwnProps;\n if (propsChanged && stateChanged) return handleNewPropsAndNewState();\n if (propsChanged) return handleNewProps();\n if (stateChanged) return handleNewState();\n return mergedProps;\n }\n\n return function pureFinalPropsSelector(nextState, nextOwnProps) {\n return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);\n };\n} // TODO: Add more comments\n// If pure is true, the selector returned by selectorFactory will memoize its results,\n// allowing connectAdvanced's shouldComponentUpdate to return false if final\n// props have not changed. If false, the selector will always return a new\n// object and shouldComponentUpdate will always return true.\n\nexport default function finalPropsSelectorFactory(dispatch, _ref2) {\n var initMapStateToProps = _ref2.initMapStateToProps,\n initMapDispatchToProps = _ref2.initMapDispatchToProps,\n initMergeProps = _ref2.initMergeProps,\n options = _objectWithoutPropertiesLoose(_ref2, _excluded);\n\n var mapStateToProps = initMapStateToProps(dispatch, options);\n var mapDispatchToProps = initMapDispatchToProps(dispatch, options);\n var mergeProps = initMergeProps(dispatch, options);\n\n if (process.env.NODE_ENV !== 'production') {\n verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);\n }\n\n var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;\n return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);\n}","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nvar _excluded = [\"pure\", \"areStatesEqual\", \"areOwnPropsEqual\", \"areStatePropsEqual\", \"areMergedPropsEqual\"];\nimport connectAdvanced from '../components/connectAdvanced';\nimport shallowEqual from '../utils/shallowEqual';\nimport defaultMapDispatchToPropsFactories from './mapDispatchToProps';\nimport defaultMapStateToPropsFactories from './mapStateToProps';\nimport defaultMergePropsFactories from './mergeProps';\nimport defaultSelectorFactory from './selectorFactory';\n/*\n connect is a facade over connectAdvanced. It turns its args into a compatible\n selectorFactory, which has the signature:\n\n (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps\n \n connect passes its args to connectAdvanced as options, which will in turn pass them to\n selectorFactory each time a Connect component instance is instantiated or hot reloaded.\n\n selectorFactory returns a final props selector from its mapStateToProps,\n mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,\n mergePropsFactories, and pure args.\n\n The resulting final props selector is called by the Connect component instance whenever\n it receives new props or store state.\n */\n\nfunction match(arg, factories, name) {\n for (var i = factories.length - 1; i >= 0; i--) {\n var result = factories[i](arg);\n if (result) return result;\n }\n\n return function (dispatch, options) {\n throw new Error(\"Invalid value of type \" + typeof arg + \" for \" + name + \" argument when connecting component \" + options.wrappedComponentName + \".\");\n };\n}\n\nfunction strictEqual(a, b) {\n return a === b;\n} // createConnect with default args builds the 'official' connect behavior. Calling it with\n// different options opens up some testing and extensibility scenarios\n\n\nexport function createConnect(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$connectHOC = _ref.connectHOC,\n connectHOC = _ref$connectHOC === void 0 ? connectAdvanced : _ref$connectHOC,\n _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,\n mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,\n _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,\n mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,\n _ref$mergePropsFactor = _ref.mergePropsFactories,\n mergePropsFactories = _ref$mergePropsFactor === void 0 ? defaultMergePropsFactories : _ref$mergePropsFactor,\n _ref$selectorFactory = _ref.selectorFactory,\n selectorFactory = _ref$selectorFactory === void 0 ? defaultSelectorFactory : _ref$selectorFactory;\n\n return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {\n if (_ref2 === void 0) {\n _ref2 = {};\n }\n\n var _ref3 = _ref2,\n _ref3$pure = _ref3.pure,\n pure = _ref3$pure === void 0 ? true : _ref3$pure,\n _ref3$areStatesEqual = _ref3.areStatesEqual,\n areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,\n _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,\n areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? shallowEqual : _ref3$areOwnPropsEqua,\n _ref3$areStatePropsEq = _ref3.areStatePropsEqual,\n areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? shallowEqual : _ref3$areStatePropsEq,\n _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,\n areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? shallowEqual : _ref3$areMergedPropsE,\n extraOptions = _objectWithoutPropertiesLoose(_ref3, _excluded);\n\n var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');\n var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');\n var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');\n return connectHOC(selectorFactory, _extends({\n // used in error messages\n methodName: 'connect',\n // used to compute Connect's displayName from the wrapped component's displayName.\n getDisplayName: function getDisplayName(name) {\n return \"Connect(\" + name + \")\";\n },\n // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes\n shouldHandleStateChanges: Boolean(mapStateToProps),\n // passed through to selectorFactory\n initMapStateToProps: initMapStateToProps,\n initMapDispatchToProps: initMapDispatchToProps,\n initMergeProps: initMergeProps,\n pure: pure,\n areStatesEqual: areStatesEqual,\n areOwnPropsEqual: areOwnPropsEqual,\n areStatePropsEqual: areStatePropsEqual,\n areMergedPropsEqual: areMergedPropsEqual\n }, extraOptions));\n };\n}\nexport default /*#__PURE__*/createConnect();","import { useContext } from 'react';\nimport { ReactReduxContext } from '../components/Context';\n/**\n * A hook to access the value of the `ReactReduxContext`. This is a low-level\n * hook that you should usually not need to call directly.\n *\n * @returns {any} the value of the `ReactReduxContext`\n *\n * @example\n *\n * import React from 'react'\n * import { useReduxContext } from 'react-redux'\n *\n * export const CounterComponent = ({ value }) => {\n * const { store } = useReduxContext()\n * return {store.getState()}
\n * }\n */\n\nexport function useReduxContext() {\n var contextValue = useContext(ReactReduxContext);\n\n if (process.env.NODE_ENV !== 'production' && !contextValue) {\n throw new Error('could not find react-redux context value; please ensure the component is wrapped in a ');\n }\n\n return contextValue;\n}","import { useContext } from 'react';\nimport { ReactReduxContext } from '../components/Context';\nimport { useReduxContext as useDefaultReduxContext } from './useReduxContext';\n/**\n * Hook factory, which creates a `useStore` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useStore` hook bound to the specified context.\n */\n\nexport function createStoreHook(context) {\n if (context === void 0) {\n context = ReactReduxContext;\n }\n\n var useReduxContext = context === ReactReduxContext ? useDefaultReduxContext : function () {\n return useContext(context);\n };\n return function useStore() {\n var _useReduxContext = useReduxContext(),\n store = _useReduxContext.store;\n\n return store;\n };\n}\n/**\n * A hook to access the redux store.\n *\n * @returns {any} the redux store\n *\n * @example\n *\n * import React from 'react'\n * import { useStore } from 'react-redux'\n *\n * export const ExampleComponent = () => {\n * const store = useStore()\n * return {store.getState()}
\n * }\n */\n\nexport var useStore = /*#__PURE__*/createStoreHook();","import { ReactReduxContext } from '../components/Context';\nimport { useStore as useDefaultStore, createStoreHook } from './useStore';\n/**\n * Hook factory, which creates a `useDispatch` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useDispatch` hook bound to the specified context.\n */\n\nexport function createDispatchHook(context) {\n if (context === void 0) {\n context = ReactReduxContext;\n }\n\n var useStore = context === ReactReduxContext ? useDefaultStore : createStoreHook(context);\n return function useDispatch() {\n var store = useStore();\n return store.dispatch;\n };\n}\n/**\n * A hook to access the redux `dispatch` function.\n *\n * @returns {any|function} redux store's `dispatch` function\n *\n * @example\n *\n * import React, { useCallback } from 'react'\n * import { useDispatch } from 'react-redux'\n *\n * export const CounterComponent = ({ value }) => {\n * const dispatch = useDispatch()\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\n * return (\n * \n * {value}\n * \n *
\n * )\n * }\n */\n\nexport var useDispatch = /*#__PURE__*/createDispatchHook();","import { useReducer, useRef, useMemo, useContext, useDebugValue } from 'react';\nimport { useReduxContext as useDefaultReduxContext } from './useReduxContext';\nimport { createSubscription } from '../utils/Subscription';\nimport { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect';\nimport { ReactReduxContext } from '../components/Context';\n\nvar refEquality = function refEquality(a, b) {\n return a === b;\n};\n\nfunction useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub) {\n var _useReducer = useReducer(function (s) {\n return s + 1;\n }, 0),\n forceRender = _useReducer[1];\n\n var subscription = useMemo(function () {\n return createSubscription(store, contextSub);\n }, [store, contextSub]);\n var latestSubscriptionCallbackError = useRef();\n var latestSelector = useRef();\n var latestStoreState = useRef();\n var latestSelectedState = useRef();\n var storeState = store.getState();\n var selectedState;\n\n try {\n if (selector !== latestSelector.current || storeState !== latestStoreState.current || latestSubscriptionCallbackError.current) {\n var newSelectedState = selector(storeState); // ensure latest selected state is reused so that a custom equality function can result in identical references\n\n if (latestSelectedState.current === undefined || !equalityFn(newSelectedState, latestSelectedState.current)) {\n selectedState = newSelectedState;\n } else {\n selectedState = latestSelectedState.current;\n }\n } else {\n selectedState = latestSelectedState.current;\n }\n } catch (err) {\n if (latestSubscriptionCallbackError.current) {\n err.message += \"\\nThe error may be correlated with this previous error:\\n\" + latestSubscriptionCallbackError.current.stack + \"\\n\\n\";\n }\n\n throw err;\n }\n\n useIsomorphicLayoutEffect(function () {\n latestSelector.current = selector;\n latestStoreState.current = storeState;\n latestSelectedState.current = selectedState;\n latestSubscriptionCallbackError.current = undefined;\n });\n useIsomorphicLayoutEffect(function () {\n function checkForUpdates() {\n try {\n var newStoreState = store.getState(); // Avoid calling selector multiple times if the store's state has not changed\n\n if (newStoreState === latestStoreState.current) {\n return;\n }\n\n var _newSelectedState = latestSelector.current(newStoreState);\n\n if (equalityFn(_newSelectedState, latestSelectedState.current)) {\n return;\n }\n\n latestSelectedState.current = _newSelectedState;\n latestStoreState.current = newStoreState;\n } catch (err) {\n // we ignore all errors here, since when the component\n // is re-rendered, the selectors are called again, and\n // will throw again, if neither props nor store state\n // changed\n latestSubscriptionCallbackError.current = err;\n }\n\n forceRender();\n }\n\n subscription.onStateChange = checkForUpdates;\n subscription.trySubscribe();\n checkForUpdates();\n return function () {\n return subscription.tryUnsubscribe();\n };\n }, [store, subscription]);\n return selectedState;\n}\n/**\n * Hook factory, which creates a `useSelector` hook bound to a given context.\n *\n * @param {React.Context} [context=ReactReduxContext] Context passed to your ``.\n * @returns {Function} A `useSelector` hook bound to the specified context.\n */\n\n\nexport function createSelectorHook(context) {\n if (context === void 0) {\n context = ReactReduxContext;\n }\n\n var useReduxContext = context === ReactReduxContext ? useDefaultReduxContext : function () {\n return useContext(context);\n };\n return function useSelector(selector, equalityFn) {\n if (equalityFn === void 0) {\n equalityFn = refEquality;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!selector) {\n throw new Error(\"You must pass a selector to useSelector\");\n }\n\n if (typeof selector !== 'function') {\n throw new Error(\"You must pass a function as a selector to useSelector\");\n }\n\n if (typeof equalityFn !== 'function') {\n throw new Error(\"You must pass a function as an equality function to useSelector\");\n }\n }\n\n var _useReduxContext = useReduxContext(),\n store = _useReduxContext.store,\n contextSub = _useReduxContext.subscription;\n\n var selectedState = useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub);\n useDebugValue(selectedState);\n return selectedState;\n };\n}\n/**\n * A hook to access the redux store's state. This hook takes a selector function\n * as an argument. The selector is called with the store state.\n *\n * This hook takes an optional equality comparison function as the second parameter\n * that allows you to customize the way the selected state is compared to determine\n * whether the component needs to be re-rendered.\n *\n * @param {Function} selector the selector function\n * @param {Function=} equalityFn the function that will be used to determine equality\n *\n * @returns {any} the selected state\n *\n * @example\n *\n * import React from 'react'\n * import { useSelector } from 'react-redux'\n *\n * export const CounterComponent = () => {\n * const counter = useSelector(state => state.counter)\n * return {counter}
\n * }\n */\n\nexport var useSelector = /*#__PURE__*/createSelectorHook();","export * from './exports';\nimport { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates';\nimport { setBatch } from './utils/batch'; // Enable batched updates in our subscriptions for use\n// with standard React renderers (ReactDOM, React Native)\n\nsetBatch(batch);\nexport { batch };","/** @license React v17.0.2\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;\nif(\"function\"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x(\"react.element\");c=x(\"react.portal\");d=x(\"react.fragment\");e=x(\"react.strict_mode\");f=x(\"react.profiler\");g=x(\"react.provider\");h=x(\"react.context\");k=x(\"react.forward_ref\");l=x(\"react.suspense\");m=x(\"react.suspense_list\");n=x(\"react.memo\");p=x(\"react.lazy\");q=x(\"react.block\");r=x(\"react.server.block\");u=x(\"react.fundamental\");v=x(\"react.debug_trace_mode\");w=x(\"react.legacy_hidden\")}\nfunction y(a){if(\"object\"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;\nexports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};\nexports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||\"object\"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};\nexports.typeOf=y;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import { shouldUpdateNode } from 'router5-transition-path';\nimport React, { Component, useContext, useEffect, useState } from 'react';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\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++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\n\nvar createContext = React.createContext;\r\nvar routeContext = createContext(null);\r\nvar routerContext = createContext(null);\n\nvar RouterProvider = /** @class */ (function (_super) {\r\n __extends(RouterProvider, _super);\r\n function RouterProvider(props) {\r\n var _this = _super.call(this, props) || this;\r\n _this.mounted = false;\r\n _this.routeState = {\r\n route: props.router.getState(),\r\n previousRoute: null\r\n };\r\n if (typeof window !== 'undefined') {\r\n var listener = function (_a) {\r\n var route = _a.route, previousRoute = _a.previousRoute;\r\n _this.routeState = {\r\n route: route,\r\n previousRoute: previousRoute\r\n };\r\n if (_this.mounted) {\r\n _this.forceUpdate();\r\n }\r\n };\r\n _this.unsubscribe = _this.props.router.subscribe(listener);\r\n }\r\n return _this;\r\n }\r\n RouterProvider.prototype.componentDidMount = function () {\r\n this.mounted = true;\r\n };\r\n RouterProvider.prototype.componentWillUnmount = function () {\r\n if (this.unsubscribe) {\r\n this.unsubscribe();\r\n }\r\n };\r\n RouterProvider.prototype.render = function () {\r\n return (React.createElement(routerContext.Provider, { value: this.props.router },\r\n React.createElement(routeContext.Provider, { value: __assign({ router: this.props.router }, this.routeState) }, this.props.children)));\r\n };\r\n return RouterProvider;\r\n}(React.PureComponent));\n\nvar BaseLink = /** @class */ (function (_super) {\r\n __extends(BaseLink, _super);\r\n function BaseLink(props, context) {\r\n var _this = _super.call(this, props, context) || this;\r\n _this.router = _this.props.router;\r\n _this.isActive = _this.isActive.bind(_this);\r\n _this.clickHandler = _this.clickHandler.bind(_this);\r\n _this.callback = _this.callback.bind(_this);\r\n _this.state = { active: _this.isActive() };\r\n return _this;\r\n }\r\n BaseLink.prototype.buildUrl = function (routeName, routeParams) {\r\n //@ts-ignore\r\n if (this.router.buildUrl) {\r\n //@ts-ignore\r\n return this.router.buildUrl(routeName, routeParams);\r\n }\r\n return this.router.buildPath(routeName, routeParams);\r\n };\r\n BaseLink.prototype.isActive = function () {\r\n var _a = this.props, routeName = _a.routeName, _b = _a.routeParams, routeParams = _b === void 0 ? {} : _b, _c = _a.activeStrict, activeStrict = _c === void 0 ? false : _c, _d = _a.ignoreQueryParams, ignoreQueryParams = _d === void 0 ? true : _d;\r\n return this.router.isActive(routeName, routeParams, activeStrict, ignoreQueryParams);\r\n };\r\n BaseLink.prototype.callback = function (err, state) {\r\n if (!err && this.props.successCallback) {\r\n this.props.successCallback(state);\r\n }\r\n if (err && this.props.errorCallback) {\r\n this.props.errorCallback(err);\r\n }\r\n };\r\n BaseLink.prototype.clickHandler = function (evt) {\r\n var _a = this.props, onClick = _a.onClick, target = _a.target;\r\n if (onClick) {\r\n onClick(evt);\r\n if (evt.defaultPrevented) {\r\n return;\r\n }\r\n }\r\n var comboKey = evt.metaKey || evt.altKey || evt.ctrlKey || evt.shiftKey;\r\n if (evt.button === 0 && !comboKey && target !== '_blank') {\r\n evt.preventDefault();\r\n this.router.navigate(this.props.routeName, this.props.routeParams || {}, this.props.routeOptions || {}, this.callback);\r\n }\r\n };\r\n BaseLink.prototype.render = function () {\r\n /* eslint-disable */\r\n var _a = this.props, routeName = _a.routeName, routeParams = _a.routeParams, routeOptions = _a.routeOptions, className = _a.className, _b = _a.activeClassName, activeClassName = _b === void 0 ? 'active' : _b, activeStrict = _a.activeStrict, ignoreQueryParams = _a.ignoreQueryParams, route = _a.route, previousRoute = _a.previousRoute, router = _a.router, children = _a.children, onClick = _a.onClick, successCallback = _a.successCallback, errorCallback = _a.errorCallback, linkProps = __rest(_a, [\"routeName\", \"routeParams\", \"routeOptions\", \"className\", \"activeClassName\", \"activeStrict\", \"ignoreQueryParams\", \"route\", \"previousRoute\", \"router\", \"children\", \"onClick\", \"successCallback\", \"errorCallback\"]);\r\n /* eslint-enable */\r\n var active = this.isActive();\r\n var href = this.buildUrl(routeName, routeParams);\r\n var linkclassName = (active ? [activeClassName] : [])\r\n .concat(className ? className.split(' ') : [])\r\n .join(' ');\r\n return React.createElement('a', __assign({}, linkProps, { href: href, className: linkclassName, onClick: this.clickHandler }), children);\r\n };\r\n return BaseLink;\r\n}(Component));\n\nfunction withRouter(BaseComponent) {\r\n return function WithRouter(props) {\r\n return (React.createElement(routerContext.Consumer, null, function (router) { return React.createElement(BaseComponent, __assign({}, props, { router: router })); }));\r\n };\r\n}\n\nfunction withRoute(BaseComponent) {\r\n return function withRoute(props) {\r\n return (React.createElement(routeContext.Consumer, null, function (routeContext$$1) { return React.createElement(BaseComponent, __assign({}, props, routeContext$$1)); }));\r\n };\r\n}\n\nvar RouteNodeRenderer = /** @class */ (function (_super) {\r\n __extends(RouteNodeRenderer, _super);\r\n function RouteNodeRenderer(props) {\r\n return _super.call(this, props) || this;\r\n }\r\n RouteNodeRenderer.prototype.shouldComponentUpdate = function (nextProps) {\r\n return shouldUpdateNode(this.props.nodeName)(nextProps.route, nextProps.previousRoute);\r\n };\r\n RouteNodeRenderer.prototype.render = function () {\r\n var _a = this.props, router = _a.router, route = _a.route, previousRoute = _a.previousRoute;\r\n return this.props.children({ router: router, route: route, previousRoute: previousRoute });\r\n };\r\n return RouteNodeRenderer;\r\n}(React.Component));\r\nvar RouteNode = function (props) {\r\n return (React.createElement(routeContext.Consumer, null, function (routeContext$$1) { return React.createElement(RouteNodeRenderer, __assign({}, props, routeContext$$1)); }));\r\n};\n\nfunction routeNode(nodeName) {\r\n return function (BaseComponent) {\r\n function RouteNodeWrapper(props) {\r\n return (React.createElement(RouteNode, { nodeName: nodeName }, function (routeContext) { return (React.createElement(BaseComponent, __assign({}, props, routeContext))); }));\r\n }\r\n return RouteNodeWrapper;\r\n };\r\n}\n\nfunction useRouter() {\r\n return useContext(routerContext);\r\n}\n\nfunction useRoute() {\r\n return useContext(routeContext);\r\n}\n\nfunction useRouter$1(nodeName) {\r\n var router = useContext(routerContext);\r\n var _a = useState(function () { return ({\r\n previousRoute: null,\r\n route: router.getState()\r\n }); }), state = _a[0], setState = _a[1];\r\n useEffect(function () {\r\n return router.subscribe(function (_a) {\r\n var route = _a.route, previousRoute = _a.previousRoute;\r\n var shouldUpdate = shouldUpdateNode(nodeName)(route, previousRoute);\r\n if (shouldUpdate) {\r\n setState({\r\n route: route,\r\n previousRoute: previousRoute\r\n });\r\n }\r\n });\r\n }, []);\r\n return __assign({ router: router }, state);\r\n}\n\nvar ConnectedLink = withRoute(BaseLink);\r\nvar Link = withRouter(BaseLink);\r\nvar Router = routerContext.Consumer;\r\nvar Route = routeContext.Consumer;\n\nexport { RouterProvider, BaseLink, ConnectedLink, Link, withRouter, withRoute, routeNode, Router, Route, RouteNode, useRouter, useRoute, useRouter$1 as useRouteNode, routerContext, routeContext };\n","/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n","/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(12) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(13) : \"The slice reducer for key \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle '\" + ActionTypes.INIT + \"' or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var actionType = action && action.type;\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(14) : \"When called with an action of type \" + (actionType ? \"\\\"\" + String(actionType) + \"\\\"\" : '(unknown type)') + \", the slice reducer for key \\\"\" + _key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\");\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(16) : \"bindActionCreators expected an object or a function, but instead received: '\" + kindOf(actionCreators) + \"'. \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error(process.env.NODE_ENV === \"production\" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread(_objectSpread({}, store), {}, {\n dispatch: _dispatch\n });\n };\n };\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore, legacy_createStore };\n","// Cache implementation based on Erik Rasmussen's `lru-memoize`:\n// https://github.com/erikras/lru-memoize\nvar NOT_FOUND = 'NOT_FOUND';\n\nfunction createSingletonCache(equals) {\n var entry;\n return {\n get: function get(key) {\n if (entry && equals(entry.key, key)) {\n return entry.value;\n }\n\n return NOT_FOUND;\n },\n put: function put(key, value) {\n entry = {\n key: key,\n value: value\n };\n },\n getEntries: function getEntries() {\n return entry ? [entry] : [];\n },\n clear: function clear() {\n entry = undefined;\n }\n };\n}\n\nfunction createLruCache(maxSize, equals) {\n var entries = [];\n\n function get(key) {\n var cacheIndex = entries.findIndex(function (entry) {\n return equals(key, entry.key);\n }); // We found a cached entry\n\n if (cacheIndex > -1) {\n var entry = entries[cacheIndex]; // Cached entry not at top of cache, move it to the top\n\n if (cacheIndex > 0) {\n entries.splice(cacheIndex, 1);\n entries.unshift(entry);\n }\n\n return entry.value;\n } // No entry found in cache, return sentinel\n\n\n return NOT_FOUND;\n }\n\n function put(key, value) {\n if (get(key) === NOT_FOUND) {\n // TODO Is unshift slow?\n entries.unshift({\n key: key,\n value: value\n });\n\n if (entries.length > maxSize) {\n entries.pop();\n }\n }\n }\n\n function getEntries() {\n return entries;\n }\n\n function clear() {\n entries = [];\n }\n\n return {\n get: get,\n put: put,\n getEntries: getEntries,\n clear: clear\n };\n}\n\nexport var defaultEqualityCheck = function defaultEqualityCheck(a, b) {\n return a === b;\n};\nexport function createCacheKeyComparator(equalityCheck) {\n return function areArgumentsShallowlyEqual(prev, next) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n } // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n\n\n var length = prev.length;\n\n for (var i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n };\n}\n// defaultMemoize now supports a configurable cache size with LRU behavior,\n// and optional comparison of the result value with existing values\nexport function defaultMemoize(func, equalityCheckOrOptions) {\n var providedOptions = typeof equalityCheckOrOptions === 'object' ? equalityCheckOrOptions : {\n equalityCheck: equalityCheckOrOptions\n };\n var _providedOptions$equa = providedOptions.equalityCheck,\n equalityCheck = _providedOptions$equa === void 0 ? defaultEqualityCheck : _providedOptions$equa,\n _providedOptions$maxS = providedOptions.maxSize,\n maxSize = _providedOptions$maxS === void 0 ? 1 : _providedOptions$maxS,\n resultEqualityCheck = providedOptions.resultEqualityCheck;\n var comparator = createCacheKeyComparator(equalityCheck);\n var cache = maxSize === 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator); // we reference arguments instead of spreading them for performance reasons\n\n function memoized() {\n var value = cache.get(arguments);\n\n if (value === NOT_FOUND) {\n // @ts-ignore\n value = func.apply(null, arguments);\n\n if (resultEqualityCheck) {\n var entries = cache.getEntries();\n var matchingEntry = entries.find(function (entry) {\n return resultEqualityCheck(entry.value, value);\n });\n\n if (matchingEntry) {\n value = matchingEntry.value;\n }\n }\n\n cache.put(arguments, value);\n }\n\n return value;\n }\n\n memoized.clearCache = function () {\n return cache.clear();\n };\n\n return memoized;\n}","import { defaultMemoize, defaultEqualityCheck } from './defaultMemoize';\nexport { defaultMemoize, defaultEqualityCheck };\n\nfunction getDependencies(funcs) {\n var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;\n\n if (!dependencies.every(function (dep) {\n return typeof dep === 'function';\n })) {\n var dependencyTypes = dependencies.map(function (dep) {\n return typeof dep === 'function' ? \"function \" + (dep.name || 'unnamed') + \"()\" : typeof dep;\n }).join(', ');\n throw new Error(\"createSelector expects all input-selectors to be functions, but received the following types: [\" + dependencyTypes + \"]\");\n }\n\n return dependencies;\n}\n\nexport function createSelectorCreator(memoize) {\n for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n memoizeOptionsFromArgs[_key - 1] = arguments[_key];\n }\n\n var createSelector = function createSelector() {\n for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n funcs[_key2] = arguments[_key2];\n }\n\n var _recomputations = 0;\n\n var _lastResult; // Due to the intricacies of rest params, we can't do an optional arg after `...funcs`.\n // So, start by declaring the default value here.\n // (And yes, the words 'memoize' and 'options' appear too many times in this next sequence.)\n\n\n var directlyPassedOptions = {\n memoizeOptions: undefined\n }; // Normally, the result func or \"output selector\" is the last arg\n\n var resultFunc = funcs.pop(); // If the result func is actually an _object_, assume it's our options object\n\n if (typeof resultFunc === 'object') {\n directlyPassedOptions = resultFunc; // and pop the real result func off\n\n resultFunc = funcs.pop();\n }\n\n if (typeof resultFunc !== 'function') {\n throw new Error(\"createSelector expects an output function after the inputs, but received: [\" + typeof resultFunc + \"]\");\n } // Determine which set of options we're using. Prefer options passed directly,\n // but fall back to options given to createSelectorCreator.\n\n\n var _directlyPassedOption = directlyPassedOptions,\n _directlyPassedOption2 = _directlyPassedOption.memoizeOptions,\n memoizeOptions = _directlyPassedOption2 === void 0 ? memoizeOptionsFromArgs : _directlyPassedOption2; // Simplifying assumption: it's unlikely that the first options arg of the provided memoizer\n // is an array. In most libs I've looked at, it's an equality function or options object.\n // Based on that, if `memoizeOptions` _is_ an array, we assume it's a full\n // user-provided array of options. Otherwise, it must be just the _first_ arg, and so\n // we wrap it in an array so we can apply it.\n\n var finalMemoizeOptions = Array.isArray(memoizeOptions) ? memoizeOptions : [memoizeOptions];\n var dependencies = getDependencies(funcs);\n var memoizedResultFunc = memoize.apply(void 0, [function () {\n _recomputations++; // apply arguments instead of spreading for performance.\n\n return resultFunc.apply(null, arguments);\n }].concat(finalMemoizeOptions)); // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.\n\n var selector = memoize(function () {\n var params = [];\n var length = dependencies.length;\n\n for (var i = 0; i < length; i++) {\n // apply arguments instead of spreading and mutate a local list of params for performance.\n // @ts-ignore\n params.push(dependencies[i].apply(null, arguments));\n } // apply arguments instead of spreading for performance.\n\n\n _lastResult = memoizedResultFunc.apply(null, params);\n return _lastResult;\n });\n Object.assign(selector, {\n resultFunc: resultFunc,\n memoizedResultFunc: memoizedResultFunc,\n dependencies: dependencies,\n lastResult: function lastResult() {\n return _lastResult;\n },\n recomputations: function recomputations() {\n return _recomputations;\n },\n resetRecomputations: function resetRecomputations() {\n return _recomputations = 0;\n }\n });\n return selector;\n }; // @ts-ignore\n\n\n return createSelector;\n}\nexport var createSelector = /* #__PURE__ */createSelectorCreator(defaultMemoize);\n// Manual definition of state and output arguments\nexport var createStructuredSelector = function createStructuredSelector(selectors, selectorCreator) {\n if (selectorCreator === void 0) {\n selectorCreator = createSelector;\n }\n\n if (typeof selectors !== 'object') {\n throw new Error('createStructuredSelector expects first argument to be an object ' + (\"where each property is a selector, instead received a \" + typeof selectors));\n }\n\n var objectKeys = Object.keys(selectors);\n return selectorCreator( // @ts-ignore\n objectKeys.map(function (key) {\n return selectors[key];\n }), function () {\n for (var _len3 = arguments.length, values = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n values[_key3] = arguments[_key3];\n }\n\n return values.reduce(function (composition, value, index) {\n composition[objectKeys[index]] = value;\n return composition;\n }, {});\n });\n};","var dotOrEnd = '(\\\\..+$|$)';\r\nvar dotOrStart = '(^.+\\\\.|^)';\r\nvar getName = function (route) {\r\n return typeof route === 'string' ? route : route.name || '';\r\n};\r\nvar test = function (route, regex) {\r\n return regex.test(getName(route));\r\n};\r\nvar normaliseSegment = function (name) {\r\n return name.replace('.', '\\\\.');\r\n};\r\nvar testRouteWithSegment = function (start, end) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var route = args[0];\r\n var applySegment = function (segment) {\r\n return test(route, new RegExp(start + normaliseSegment(segment) + end));\r\n };\r\n if (args.length === 2) {\r\n return applySegment(args[1]);\r\n }\r\n return applySegment;\r\n };\r\n};\r\nvar startsWithSegment = testRouteWithSegment('^', dotOrEnd);\r\nvar endsWithSegment = testRouteWithSegment(dotOrStart, '$');\r\nvar includesSegment = testRouteWithSegment(dotOrStart, dotOrEnd);\n\nexport { startsWithSegment, endsWithSegment, includesSegment };\n","import { errorCodes, constants } from 'router5';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\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};\n\nvar value = function (arg) { return function () { return arg; }; };\r\nvar noop = function () { };\r\nvar isBrowser = typeof window !== 'undefined' && window.history;\r\nvar getBase = function () { return window.location.pathname; };\r\nvar supportsPopStateOnHashChange = function () {\r\n return window.navigator.userAgent.indexOf('Trident') === -1;\r\n};\r\nvar pushState = function (state, title, path) {\r\n return window.history.pushState(state, title, path);\r\n};\r\nvar replaceState = function (state, title, path) {\r\n return window.history.replaceState(state, title, path);\r\n};\r\nvar addPopstateListener = function (fn, opts) {\r\n var shouldAddHashChangeListener = opts.useHash && !supportsPopStateOnHashChange();\r\n window.addEventListener('popstate', fn);\r\n if (shouldAddHashChangeListener) {\r\n window.addEventListener('hashchange', fn);\r\n }\r\n return function () {\r\n window.removeEventListener('popstate', fn);\r\n if (shouldAddHashChangeListener) {\r\n window.removeEventListener('hashchange', fn);\r\n }\r\n };\r\n};\r\nvar getLocation = function (opts) {\r\n var path = opts.useHash\r\n ? window.location.hash.replace(new RegExp('^#' + opts.hashPrefix), '')\r\n : window.location.pathname.replace(new RegExp('^' + opts.base), '');\r\n // Fix issue with browsers that don't URL encode characters (Edge)\r\n var correctedPath = safelyEncodePath(path);\r\n return (correctedPath || '/') + window.location.search;\r\n};\r\nvar safelyEncodePath = function (path) {\r\n try {\r\n return encodeURI(decodeURI(path));\r\n }\r\n catch (_) {\r\n return path;\r\n }\r\n};\r\nvar getState = function () { return window.history.state; };\r\nvar getHash = function () { return window.location.hash; };\r\nvar browser = {};\r\nif (isBrowser) {\r\n browser = {\r\n getBase: getBase,\r\n pushState: pushState,\r\n replaceState: replaceState,\r\n addPopstateListener: addPopstateListener,\r\n getLocation: getLocation,\r\n getState: getState,\r\n getHash: getHash\r\n };\r\n}\r\nelse {\r\n browser = {\r\n getBase: value(''),\r\n pushState: noop,\r\n replaceState: noop,\r\n addPopstateListener: noop,\r\n getLocation: value(''),\r\n getState: value(null),\r\n getHash: value('')\r\n };\r\n}\r\nvar safeBrowser = browser;\n\nvar defaultOptions = {\r\n forceDeactivate: true,\r\n useHash: false,\r\n hashPrefix: '',\r\n base: '',\r\n mergeState: false,\r\n preserveHash: true\r\n};\r\nvar source = 'popstate';\r\nfunction browserPluginFactory(opts, browser) {\r\n if (browser === void 0) { browser = safeBrowser; }\r\n var options = __assign({}, defaultOptions, opts);\r\n var transitionOptions = {\r\n forceDeactivate: options.forceDeactivate,\r\n source: source\r\n };\r\n var removePopStateListener;\r\n return function browserPlugin(router) {\r\n var routerOptions = router.getOptions();\r\n var routerStart = router.start;\r\n router.buildUrl = function (route, params) {\r\n var base = options.base || '';\r\n var prefix = options.useHash ? \"#\" + options.hashPrefix : '';\r\n var path = router.buildPath(route, params);\r\n if (path === null)\r\n return null;\r\n return base + prefix + path;\r\n };\r\n var urlToPath = function (url) {\r\n var match = url.match(/^(?:http|https):\\/\\/(?:[0-9a-z_\\-.:]+?)(?=\\/)(.*)$/);\r\n var path = match ? match[1] : url;\r\n var pathParts = path.match(/^(.+?)(#.+?)?(\\?.+)?$/);\r\n if (!pathParts)\r\n throw new Error(\"[router5] Could not parse url \" + url);\r\n var pathname = pathParts[1];\r\n var hash = pathParts[2] || '';\r\n var search = pathParts[3] || '';\r\n return ((options.useHash\r\n ? hash.replace(new RegExp('^#' + options.hashPrefix), '')\r\n : options.base\r\n ? pathname.replace(new RegExp('^' + options.base), '')\r\n : pathname) + search);\r\n };\r\n router.matchUrl = function (url) { return router.matchPath(urlToPath(url)); };\r\n router.start = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n if (args.length === 0 || typeof args[0] === 'function') {\r\n routerStart.apply(void 0, [browser.getLocation(options)].concat(args));\r\n }\r\n else {\r\n routerStart.apply(void 0, args);\r\n }\r\n return router;\r\n };\r\n router.replaceHistoryState = function (name, params, title) {\r\n if (params === void 0) { params = {}; }\r\n if (title === void 0) { title = ''; }\r\n var route = router.buildState(name, params);\r\n var state = router.makeState(route.name, route.params, router.buildPath(route.name, route.params), { params: route.meta });\r\n var url = router.buildUrl(name, params);\r\n router.lastKnownState = state;\r\n browser.replaceState(state, title, url);\r\n };\r\n function updateBrowserState(state, url, replace) {\r\n var trimmedState = state\r\n ? {\r\n meta: state.meta,\r\n name: state.name,\r\n params: state.params,\r\n path: state.path\r\n }\r\n : state;\r\n var finalState = options.mergeState === true\r\n ? __assign({}, browser.getState(), trimmedState) : trimmedState;\r\n if (replace)\r\n browser.replaceState(finalState, '', url);\r\n else\r\n browser.pushState(finalState, '', url);\r\n }\r\n function onPopState(evt) {\r\n var routerState = router.getState();\r\n // Do nothing if no state or if last know state is poped state (it should never happen)\r\n var newState = !evt.state || !evt.state.name;\r\n var state = newState\r\n ? router.matchPath(browser.getLocation(options), source)\r\n : router.makeState(evt.state.name, evt.state.params, evt.state.path, __assign({}, evt.state.meta, { source: source }), evt.state.meta.id);\r\n var defaultRoute = routerOptions.defaultRoute, defaultParams = routerOptions.defaultParams;\r\n if (!state) {\r\n // If current state is already the default route, we will have a double entry\r\n // Navigating back and forth will emit SAME_STATES error\r\n defaultRoute &&\r\n router.navigateToDefault(__assign({}, transitionOptions, { reload: true, replace: true }));\r\n return;\r\n }\r\n if (routerState &&\r\n router.areStatesEqual(state, routerState, false)) {\r\n return;\r\n }\r\n router.transitionToState(state, routerState, transitionOptions, function (err, toState) {\r\n if (err) {\r\n if (err.redirect) {\r\n var _a = err.redirect, name_1 = _a.name, params = _a.params;\r\n router.navigate(name_1, params, __assign({}, transitionOptions, { replace: true, force: true, redirected: true }));\r\n }\r\n else if (err.code === errorCodes.CANNOT_DEACTIVATE) {\r\n var url = router.buildUrl(routerState.name, routerState.params);\r\n if (!newState) {\r\n // Keep history state unchanged but use current URL\r\n updateBrowserState(state, url, true);\r\n }\r\n // else do nothing or history will be messed up\r\n // TODO: history.back()?\r\n }\r\n else {\r\n // Force navigation to default state\r\n defaultRoute &&\r\n router.navigate(defaultRoute, defaultParams, __assign({}, transitionOptions, { reload: true, replace: true }));\r\n }\r\n }\r\n else {\r\n router.invokeEventListeners(constants.TRANSITION_SUCCESS, toState, routerState, { replace: true });\r\n }\r\n });\r\n }\r\n function onStart() {\r\n if (options.useHash && !options.base) {\r\n // Guess base\r\n options.base = browser.getBase();\r\n }\r\n removePopStateListener = browser.addPopstateListener(onPopState, options);\r\n }\r\n function teardown() {\r\n if (removePopStateListener) {\r\n removePopStateListener();\r\n removePopStateListener = undefined;\r\n }\r\n }\r\n function onTransitionSuccess(toState, fromState, opts) {\r\n var historyState = browser.getState();\r\n var hasState = historyState &&\r\n historyState.meta &&\r\n historyState.name &&\r\n historyState.params;\r\n var statesAreEqual = fromState && router.areStatesEqual(fromState, toState, false);\r\n var replace = opts.replace || !hasState || statesAreEqual;\r\n var url = router.buildUrl(toState.name, toState.params);\r\n if (fromState === null &&\r\n options.useHash === false &&\r\n options.preserveHash === true) {\r\n url += browser.getHash();\r\n }\r\n updateBrowserState(toState, url, replace);\r\n }\r\n return {\r\n onStart: onStart,\r\n onStop: teardown,\r\n teardown: teardown,\r\n onTransitionSuccess: onTransitionSuccess,\r\n onPopState: onPopState\r\n };\r\n };\r\n}\n\nexport default browserPluginFactory;\n","var noop = function () { };\r\nvar loggerPlugin = function () {\r\n var startGroup, endGroup;\r\n if (console.groupCollapsed) {\r\n startGroup = function (label) { return console.groupCollapsed(label); };\r\n endGroup = function () { return console.groupEnd(); };\r\n }\r\n else if (console.group) {\r\n startGroup = function (label) { return console.group(label); };\r\n endGroup = function () { return console.groupEnd(); };\r\n }\r\n else {\r\n startGroup = noop;\r\n endGroup = noop;\r\n }\r\n console.info('Router started');\r\n return {\r\n onStop: function () {\r\n console.info('Router stopped');\r\n },\r\n onTransitionStart: function (toState, fromState) {\r\n endGroup();\r\n startGroup('Router transition');\r\n console.log('Transition started from state');\r\n console.log(fromState);\r\n console.log('To state');\r\n console.log(toState);\r\n },\r\n onTransitionCancel: function () {\r\n console.warn('Transition cancelled');\r\n },\r\n onTransitionError: function (toState, fromState, err) {\r\n console.warn('Transition error with code ' + err.code);\r\n endGroup();\r\n },\r\n onTransitionSuccess: function () {\r\n console.log('Transition success');\r\n endGroup();\r\n }\r\n };\r\n};\n\nexport default loggerPlugin;\n","var nameToIDs = function (name) {\r\n return name\r\n .split('.')\r\n .reduce(function (ids, name) {\r\n return ids.concat(ids.length ? ids[ids.length - 1] + '.' + name : name);\r\n }, []);\r\n};\r\nvar exists = function (val) { return val !== undefined && val !== null; };\r\nvar hasMetaParams = function (state) { return state && state.meta && state.meta.params; };\r\nvar extractSegmentParams = function (name, state) {\r\n if (!hasMetaParams(state) || !exists(state.meta.params[name]))\r\n return {};\r\n return Object.keys(state.meta.params[name]).reduce(function (params, p) {\r\n params[p] = state.params[p];\r\n return params;\r\n }, {});\r\n};\r\nfunction transitionPath(toState, fromState) {\r\n var toStateOptions = (toState.meta && toState.meta && toState.meta.options) || {};\r\n var fromStateIds = fromState ? nameToIDs(fromState.name) : [];\r\n var toStateIds = nameToIDs(toState.name);\r\n var maxI = Math.min(fromStateIds.length, toStateIds.length);\r\n function pointOfDifference() {\r\n var i;\r\n var _loop_1 = function () {\r\n var left = fromStateIds[i];\r\n var right = toStateIds[i];\r\n if (left !== right)\r\n return { value: i };\r\n var leftParams = extractSegmentParams(left, toState);\r\n var rightParams = extractSegmentParams(right, fromState);\r\n if (Object.keys(leftParams).length !==\r\n Object.keys(rightParams).length)\r\n return { value: i };\r\n if (Object.keys(leftParams).length === 0)\r\n return \"continue\";\r\n var different = Object.keys(leftParams).some(function (p) { return rightParams[p] !== leftParams[p]; });\r\n if (different) {\r\n return { value: i };\r\n }\r\n };\r\n for (i = 0; i < maxI; i += 1) {\r\n var state_1 = _loop_1();\r\n if (typeof state_1 === \"object\")\r\n return state_1.value;\r\n }\r\n return i;\r\n }\r\n var i;\r\n if (!fromState || toStateOptions.reload) {\r\n i = 0;\r\n }\r\n else if (!hasMetaParams(fromState) && !hasMetaParams(toState)) {\r\n i = 0;\r\n }\r\n else {\r\n i = pointOfDifference();\r\n }\r\n var toDeactivate = fromStateIds.slice(i).reverse();\r\n var toActivate = toStateIds.slice(i);\r\n var intersection = fromState && i > 0 ? fromStateIds[i - 1] : '';\r\n return {\r\n intersection: intersection,\r\n toDeactivate: toDeactivate,\r\n toActivate: toActivate\r\n };\r\n}\n\nfunction shouldUpdateNode(nodeName) {\r\n return function (toState, fromSate) {\r\n var _a = transitionPath(toState, fromSate), intersection = _a.intersection, toActivate = _a.toActivate, toDeactivateReversed = _a.toDeactivate;\r\n var toDeactivate = toDeactivateReversed.slice().reverse();\r\n if (toState.meta.options && toState.meta.options.reload) {\r\n return true;\r\n }\r\n if (nodeName === intersection) {\r\n return true;\r\n }\r\n if (toActivate.indexOf(nodeName) === -1) {\r\n return false;\r\n }\r\n var matching = true;\r\n for (var i = 0; i < toActivate.length; i += 1) {\r\n var activatedSegment = toActivate[i];\r\n var sameLevelDeactivatedSegment = toDeactivate[i];\r\n matching = activatedSegment === sameLevelDeactivatedSegment;\r\n if (matching && activatedSegment === nodeName) {\r\n return true;\r\n }\r\n if (!matching) {\r\n return false;\r\n }\r\n }\r\n return false;\r\n };\r\n}\n\nexport default transitionPath;\nexport { shouldUpdateNode, nameToIDs };\n","import { build, parse } from 'search-params';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n\r\nvar __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};\n\nvar defaultOrConstrained = function (match) {\r\n return '(' +\r\n (match ? match.replace(/(^<|>$)/g, '') : \"[a-zA-Z0-9-_.~%':|=+\\\\*@]+\") +\r\n ')';\r\n};\r\nvar rules = [\r\n {\r\n name: 'url-parameter',\r\n pattern: /^:([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})(<(.+?)>)?/,\r\n regex: function (match) {\r\n return new RegExp(defaultOrConstrained(match[2]));\r\n }\r\n },\r\n {\r\n name: 'url-parameter-splat',\r\n pattern: /^\\*([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})/,\r\n regex: /([^?]*)/\r\n },\r\n {\r\n name: 'url-parameter-matrix',\r\n pattern: /^;([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})(<(.+?)>)?/,\r\n regex: function (match) {\r\n return new RegExp(';' + match[1] + '=' + defaultOrConstrained(match[2]));\r\n }\r\n },\r\n {\r\n name: 'query-parameter',\r\n pattern: /^(?:\\?|&)(?::)?([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})/\r\n },\r\n {\r\n name: 'delimiter',\r\n pattern: /^(\\/|\\?)/,\r\n regex: function (match) { return new RegExp('\\\\' + match[0]); }\r\n },\r\n {\r\n name: 'sub-delimiter',\r\n pattern: /^(!|&|-|_|\\.|;)/,\r\n regex: function (match) { return new RegExp(match[0]); }\r\n },\r\n {\r\n name: 'fragment',\r\n pattern: /^([0-9a-zA-Z]+)/,\r\n regex: function (match) { return new RegExp(match[0]); }\r\n }\r\n];\n\nvar tokenise = function (str, tokens) {\r\n if (tokens === void 0) { tokens = []; }\r\n // Look for a matching rule\r\n var matched = rules.some(function (rule) {\r\n var match = str.match(rule.pattern);\r\n if (!match) {\r\n return false;\r\n }\r\n tokens.push({\r\n type: rule.name,\r\n match: match[0],\r\n val: match.slice(1, 2),\r\n otherVal: match.slice(2),\r\n regex: rule.regex instanceof Function ? rule.regex(match) : rule.regex\r\n });\r\n if (match[0].length < str.length) {\r\n tokens = tokenise(str.substr(match[0].length), tokens);\r\n }\r\n return true;\r\n });\r\n // If no rules matched, throw an error (possible malformed path)\r\n if (!matched) {\r\n throw new Error(\"Could not parse path '\" + str + \"'\");\r\n }\r\n return tokens;\r\n};\n\nvar identity = function (_) { return _; };\r\nvar exists = function (val) { return val !== undefined && val !== null; };\r\nvar optTrailingSlash = function (source, strictTrailingSlash) {\r\n if (strictTrailingSlash) {\r\n return source;\r\n }\r\n if (source === '\\\\/') {\r\n return source;\r\n }\r\n return source.replace(/\\\\\\/$/, '') + '(?:\\\\/)?';\r\n};\r\nvar upToDelimiter = function (source, delimiter) {\r\n if (!delimiter) {\r\n return source;\r\n }\r\n return /(\\/)$/.test(source) ? source : source + '(\\\\/|\\\\?|\\\\.|;|$)';\r\n};\r\nvar appendQueryParam = function (params, param, val) {\r\n if (val === void 0) { val = ''; }\r\n var existingVal = params[param];\r\n if (existingVal === undefined) {\r\n params[param] = val;\r\n }\r\n else {\r\n params[param] = Array.isArray(existingVal)\r\n ? existingVal.concat(val)\r\n : [existingVal, val];\r\n }\r\n return params;\r\n};\r\nvar Path = /** @class */ (function () {\r\n function Path(path) {\r\n if (!path) {\r\n throw new Error('Missing path in Path constructor');\r\n }\r\n this.path = path;\r\n this.tokens = tokenise(path);\r\n this.hasUrlParams =\r\n this.tokens.filter(function (t) { return /^url-parameter/.test(t.type); }).length > 0;\r\n this.hasSpatParam =\r\n this.tokens.filter(function (t) { return /splat$/.test(t.type); }).length > 0;\r\n this.hasMatrixParams =\r\n this.tokens.filter(function (t) { return /matrix$/.test(t.type); }).length > 0;\r\n this.hasQueryParams =\r\n this.tokens.filter(function (t) { return /^query-parameter/.test(t.type); }).length > 0;\r\n // Extract named parameters from tokens\r\n this.spatParams = this.getParams('url-parameter-splat');\r\n this.urlParams = this.getParams(/^url-parameter/);\r\n // Query params\r\n this.queryParams = this.getParams('query-parameter');\r\n // All params\r\n this.params = this.urlParams.concat(this.queryParams);\r\n // Check if hasQueryParams\r\n // Regular expressions for url part only (full and partial match)\r\n this.source = this.tokens\r\n .filter(function (t) { return t.regex !== undefined; })\r\n .map(function (r) { return r.regex.source; })\r\n .join('');\r\n }\r\n Path.createPath = function (path) {\r\n return new Path(path);\r\n };\r\n Path.prototype.isQueryParam = function (name) {\r\n return this.queryParams.indexOf(name) !== -1;\r\n };\r\n Path.prototype.test = function (path, opts) {\r\n var _this = this;\r\n var options = __assign({ strictTrailingSlash: false, queryParams: {} }, opts);\r\n // trailingSlash: falsy => non optional, truthy => optional\r\n var source = optTrailingSlash(this.source, options.strictTrailingSlash);\r\n // Check if exact match\r\n var match = this.urlTest(path, source + (this.hasQueryParams ? '(\\\\?.*$|$)' : '$'), opts);\r\n // If no match, or no query params, no need to go further\r\n if (!match || !this.hasQueryParams) {\r\n return match;\r\n }\r\n // Extract query params\r\n var queryParams = parse(path, options.queryParams);\r\n var unexpectedQueryParams = Object.keys(queryParams).filter(function (p) { return !_this.isQueryParam(p); });\r\n if (unexpectedQueryParams.length === 0) {\r\n // Extend url match\r\n Object.keys(queryParams).forEach(function (p) { return (match[p] = queryParams[p]); });\r\n return match;\r\n }\r\n return null;\r\n };\r\n Path.prototype.partialTest = function (path, opts) {\r\n var _this = this;\r\n var options = __assign({ delimited: true, queryParams: {} }, opts);\r\n // Check if partial match (start of given path matches regex)\r\n // trailingSlash: falsy => non optional, truthy => optional\r\n var source = upToDelimiter(this.source, options.delimited);\r\n var match = this.urlTest(path, source, options);\r\n if (!match) {\r\n return match;\r\n }\r\n if (!this.hasQueryParams) {\r\n return match;\r\n }\r\n var queryParams = parse(path, options.queryParams);\r\n Object.keys(queryParams)\r\n .filter(function (p) { return _this.isQueryParam(p); })\r\n .forEach(function (p) { return appendQueryParam(match, p, queryParams[p]); });\r\n return match;\r\n };\r\n Path.prototype.build = function (params, opts) {\r\n var _this = this;\r\n if (params === void 0) { params = {}; }\r\n var options = __assign({ ignoreConstraints: false, ignoreSearch: false, queryParams: {} }, opts);\r\n var encodedUrlParams = Object.keys(params)\r\n .filter(function (p) { return !_this.isQueryParam(p); })\r\n .reduce(function (acc, key) {\r\n if (!exists(params[key])) {\r\n return acc;\r\n }\r\n var val = params[key];\r\n var encode = _this.isQueryParam(key) ? identity : encodeURI;\r\n if (typeof val === 'boolean') {\r\n acc[key] = val;\r\n }\r\n else if (Array.isArray(val)) {\r\n acc[key] = val.map(encode);\r\n }\r\n else {\r\n acc[key] = encode(val);\r\n }\r\n return acc;\r\n }, {});\r\n // Check all params are provided (not search parameters which are optional)\r\n if (this.urlParams.some(function (p) { return !exists(params[p]); })) {\r\n var missingParameters = this.urlParams.filter(function (p) { return !exists(params[p]); });\r\n throw new Error(\"Cannot build path: '\" +\r\n this.path +\r\n \"' requires missing parameters { \" +\r\n missingParameters.join(', ') +\r\n ' }');\r\n }\r\n // Check constraints\r\n if (!options.ignoreConstraints) {\r\n var constraintsPassed = this.tokens\r\n .filter(function (t) {\r\n return /^url-parameter/.test(t.type) && !/-splat$/.test(t.type);\r\n })\r\n .every(function (t) {\r\n return new RegExp('^' + defaultOrConstrained(t.otherVal[0]) + '$').test(encodedUrlParams[t.val]);\r\n });\r\n if (!constraintsPassed) {\r\n throw new Error(\"Some parameters of '\" + this.path + \"' are of invalid format\");\r\n }\r\n }\r\n var base = this.tokens\r\n .filter(function (t) { return /^query-parameter/.test(t.type) === false; })\r\n .map(function (t) {\r\n if (t.type === 'url-parameter-matrix') {\r\n return \";\" + t.val + \"=\" + encodedUrlParams[t.val[0]];\r\n }\r\n return /^url-parameter/.test(t.type)\r\n ? encodedUrlParams[t.val[0]]\r\n : t.match;\r\n })\r\n .join('');\r\n if (options.ignoreSearch) {\r\n return base;\r\n }\r\n var searchParams = this.queryParams\r\n .filter(function (p) { return Object.keys(params).indexOf(p) !== -1; })\r\n .reduce(function (sparams, paramName) {\r\n sparams[paramName] = params[paramName];\r\n return sparams;\r\n }, {});\r\n var searchPart = build(searchParams, options.queryParams);\r\n return searchPart ? base + '?' + searchPart : base;\r\n };\r\n Path.prototype.getParams = function (type) {\r\n var predicate = type instanceof RegExp\r\n ? function (t) { return type.test(t.type); }\r\n : function (t) { return t.type === type; };\r\n return this.tokens.filter(predicate).map(function (t) { return t.val[0]; });\r\n };\r\n Path.prototype.urlTest = function (path, source, _a) {\r\n var _this = this;\r\n var _b = (_a === void 0 ? {} : _a).caseSensitive, caseSensitive = _b === void 0 ? false : _b;\r\n var regex = new RegExp('^' + source, caseSensitive ? '' : 'i');\r\n var match = path.match(regex);\r\n if (!match) {\r\n return null;\r\n }\r\n else if (!this.urlParams.length) {\r\n return {};\r\n }\r\n // Reduce named params to key-value pairs\r\n return match\r\n .slice(1, this.urlParams.length + 1)\r\n .reduce(function (params, m, i) {\r\n params[_this.urlParams[i]] = decodeURIComponent(m);\r\n return params;\r\n }, {});\r\n };\r\n return Path;\r\n}());\n\nexport default Path;\nexport { Path };\n","import { build, omit, parse } from 'search-params';\nimport { Path } from 'path-parser';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n\r\nvar __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};\n\nvar getMetaFromSegments = function (segments) {\r\n var accName = '';\r\n return segments.reduce(function (meta, segment) {\r\n var urlParams = segment.parser.urlParams.reduce(function (params, p) {\r\n params[p] = 'url';\r\n return params;\r\n }, {});\r\n var allParams = segment.parser.queryParams.reduce(function (params, p) {\r\n params[p] = 'query';\r\n return params;\r\n }, urlParams);\r\n if (segment.name !== undefined) {\r\n accName = accName ? accName + '.' + segment.name : segment.name;\r\n meta[accName] = allParams;\r\n }\r\n return meta;\r\n }, {});\r\n};\r\nvar buildStateFromMatch = function (match) {\r\n if (!match || !match.segments || !match.segments.length) {\r\n return null;\r\n }\r\n var name = match.segments\r\n .map(function (segment) { return segment.name; })\r\n .filter(function (name) { return name; })\r\n .join('.');\r\n var params = match.params;\r\n return {\r\n name: name,\r\n params: params,\r\n meta: getMetaFromSegments(match.segments)\r\n };\r\n};\r\nvar buildPathFromSegments = function (segments, params, options) {\r\n if (params === void 0) { params = {}; }\r\n if (options === void 0) { options = {}; }\r\n if (!segments) {\r\n return null;\r\n }\r\n var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.trailingSlashMode;\r\n var searchParams = [];\r\n var nonSearchParams = [];\r\n for (var _i = 0, segments_1 = segments; _i < segments_1.length; _i++) {\r\n var segment = segments_1[_i];\r\n var parser = segment.parser;\r\n searchParams.push.apply(searchParams, parser.queryParams);\r\n nonSearchParams.push.apply(nonSearchParams, parser.urlParams);\r\n nonSearchParams.push.apply(nonSearchParams, parser.spatParams);\r\n }\r\n if (queryParamsMode === 'loose') {\r\n var extraParams = Object.keys(params).reduce(function (acc, p) {\r\n return searchParams.indexOf(p) === -1 &&\r\n nonSearchParams.indexOf(p) === -1\r\n ? acc.concat(p)\r\n : acc;\r\n }, []);\r\n searchParams.push.apply(searchParams, extraParams);\r\n }\r\n var searchParamsObject = searchParams.reduce(function (acc, paramName) {\r\n if (Object.keys(params).indexOf(paramName) !== -1) {\r\n acc[paramName] = params[paramName];\r\n }\r\n return acc;\r\n }, {});\r\n var searchPart = build(searchParamsObject, options.queryParams);\r\n var path = segments\r\n .reduce(function (path, segment) {\r\n var segmentPath = segment.parser.build(params, {\r\n ignoreSearch: true,\r\n queryParams: options.queryParams\r\n });\r\n return segment.absolute ? segmentPath : path + segmentPath;\r\n }, '')\r\n .replace(/\\/\\/{1,}/g, '/');\r\n var finalPath = path;\r\n if (options.trailingSlashMode === 'always') {\r\n finalPath = /\\/$/.test(path) ? path : path + \"/\";\r\n }\r\n else if (options.trailingSlashMode === 'never' && path !== '/') {\r\n finalPath = /\\/$/.test(path) ? path.slice(0, -1) : path;\r\n }\r\n return finalPath + (searchPart ? '?' + searchPart : '');\r\n};\r\nvar getPathFromSegments = function (segments) {\r\n return segments ? segments.map(function (segment) { return segment.path; }).join('') : null;\r\n};\n\nvar getPath = function (path) { return path.split('?')[0]; };\r\nvar getSearch = function (path) { return path.split('?')[1] || ''; };\r\nvar matchChildren = function (nodes, pathSegment, currentMatch, options, consumedBefore) {\r\n if (options === void 0) { options = {}; }\r\n var _a = options.queryParamsMode, queryParamsMode = _a === void 0 ? 'default' : _a, _b = options.strictTrailingSlash, strictTrailingSlash = _b === void 0 ? false : _b, _c = options.strongMatching, strongMatching = _c === void 0 ? true : _c, _d = options.caseSensitive, caseSensitive = _d === void 0 ? false : _d;\r\n var isRoot = nodes.length === 1 && nodes[0].name === '';\r\n var _loop_1 = function (child) {\r\n // Partially match path\r\n var match;\r\n var remainingPath = void 0;\r\n var segment = pathSegment;\r\n if (consumedBefore === '/' && child.path === '/') {\r\n // when we encounter repeating slashes we add the slash\r\n // back to the URL to make it de facto pathless\r\n segment = '/' + pathSegment;\r\n }\r\n if (!child.children.length) {\r\n match = child.parser.test(segment, {\r\n caseSensitive: caseSensitive,\r\n strictTrailingSlash: strictTrailingSlash,\r\n queryParams: options.queryParams\r\n });\r\n }\r\n if (!match) {\r\n match = child.parser.partialTest(segment, {\r\n delimited: strongMatching,\r\n caseSensitive: caseSensitive,\r\n queryParams: options.queryParams\r\n });\r\n }\r\n if (match) {\r\n // Remove consumed segment from path\r\n var consumedPath = child.parser.build(match, {\r\n ignoreSearch: true\r\n });\r\n if (!strictTrailingSlash && !child.children.length) {\r\n consumedPath = consumedPath.replace(/\\/$/, '');\r\n }\r\n // Can't create a regexp from the path because it might contain a\r\n // regexp character.\r\n if (segment.toLowerCase().indexOf(consumedPath.toLowerCase()) === 0) {\r\n remainingPath = segment.slice(consumedPath.length);\r\n }\r\n else {\r\n remainingPath = segment;\r\n }\r\n if (!strictTrailingSlash && !child.children.length) {\r\n remainingPath = remainingPath.replace(/^\\/\\?/, '?');\r\n }\r\n var querystring = omit(getSearch(segment.replace(consumedPath, '')), child.parser.queryParams, options.queryParams).querystring;\r\n remainingPath =\r\n getPath(remainingPath) + (querystring ? \"?\" + querystring : '');\r\n if (!strictTrailingSlash &&\r\n !isRoot &&\r\n remainingPath === '/' &&\r\n !/\\/$/.test(consumedPath)) {\r\n remainingPath = '';\r\n }\r\n currentMatch.segments.push(child);\r\n Object.keys(match).forEach(function (param) { return (currentMatch.params[param] = match[param]); });\r\n if (!isRoot && !remainingPath.length) {\r\n return { value: currentMatch };\r\n }\r\n if (!isRoot &&\r\n queryParamsMode !== 'strict' &&\r\n remainingPath.indexOf('?') === 0) {\r\n // unmatched queryParams in non strict mode\r\n var remainingQueryParams_1 = parse(remainingPath.slice(1), options.queryParams);\r\n Object.keys(remainingQueryParams_1).forEach(function (name) {\r\n return (currentMatch.params[name] = remainingQueryParams_1[name]);\r\n });\r\n return { value: currentMatch };\r\n }\r\n // Continue matching on non absolute children\r\n var children = child.getNonAbsoluteChildren();\r\n // If no children to match against but unmatched path left\r\n if (!children.length) {\r\n return { value: null };\r\n }\r\n return { value: matchChildren(children, remainingPath, currentMatch, options, consumedPath) };\r\n }\r\n };\r\n // for (child of node.children) {\r\n for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\r\n var child = nodes_1[_i];\r\n var state_1 = _loop_1(child);\r\n if (typeof state_1 === \"object\")\r\n return state_1.value;\r\n }\r\n return null;\r\n};\n\nfunction sortChildren(children) {\r\n var originalChildren = children.slice(0);\r\n return children.sort(sortPredicate(originalChildren));\r\n}\r\nvar sortPredicate = function (originalChildren) { return function (left, right) {\r\n var leftPath = left.path\r\n .replace(/<.*?>/g, '')\r\n .split('?')[0]\r\n .replace(/(.+)\\/$/, '$1');\r\n var rightPath = right.path\r\n .replace(/<.*?>/g, '')\r\n .split('?')[0]\r\n .replace(/(.+)\\/$/, '$1');\r\n // '/' last\r\n if (leftPath === '/') {\r\n return 1;\r\n }\r\n if (rightPath === '/') {\r\n return -1;\r\n }\r\n // Spat params last\r\n if (left.parser.hasSpatParam) {\r\n return 1;\r\n }\r\n if (right.parser.hasSpatParam) {\r\n return -1;\r\n }\r\n // No spat, number of segments (less segments last)\r\n var leftSegments = (leftPath.match(/\\//g) || []).length;\r\n var rightSegments = (rightPath.match(/\\//g) || []).length;\r\n if (leftSegments < rightSegments) {\r\n return 1;\r\n }\r\n if (leftSegments > rightSegments) {\r\n return -1;\r\n }\r\n // Same number of segments, number of URL params ascending\r\n var leftParamsCount = left.parser.urlParams.length;\r\n var rightParamsCount = right.parser.urlParams.length;\r\n if (leftParamsCount < rightParamsCount) {\r\n return -1;\r\n }\r\n if (leftParamsCount > rightParamsCount) {\r\n return 1;\r\n }\r\n // Same number of segments and params, last segment length descending\r\n var leftParamLength = (leftPath.split('/').slice(-1)[0] || '').length;\r\n var rightParamLength = (rightPath.split('/').slice(-1)[0] || '').length;\r\n if (leftParamLength < rightParamLength) {\r\n return 1;\r\n }\r\n if (leftParamLength > rightParamLength) {\r\n return -1;\r\n }\r\n // Same last segment length, preserve definition order. Note that we\r\n // cannot just return 0, as sort is not guaranteed to be a stable sort.\r\n return originalChildren.indexOf(left) - originalChildren.indexOf(right);\r\n}; };\n\nvar defaultBuildOptions = {\r\n queryParamsMode: 'default',\r\n trailingSlashMode: 'default'\r\n};\r\nvar defaultMatchOptions = __assign({}, defaultBuildOptions, { strongMatching: true });\r\nvar RouteNode = /** @class */ (function () {\r\n function RouteNode(name, path, childRoutes, cb, parent, finalSort, sort) {\r\n if (name === void 0) { name = ''; }\r\n if (path === void 0) { path = ''; }\r\n if (childRoutes === void 0) { childRoutes = []; }\r\n if (finalSort === void 0) { finalSort = true; }\r\n this.name = name;\r\n this.absolute = /^~/.test(path);\r\n this.path = this.absolute ? path.slice(1) : path;\r\n this.parser = this.path ? new Path(this.path) : null;\r\n this.children = [];\r\n this.parent = parent;\r\n this.checkParents();\r\n this.add(childRoutes, cb, finalSort ? false : sort !== false);\r\n if (finalSort) {\r\n this.sortDescendants();\r\n }\r\n return this;\r\n }\r\n RouteNode.prototype.getParentSegments = function (segments) {\r\n if (segments === void 0) { segments = []; }\r\n return this.parent && this.parent.parser\r\n ? this.parent.getParentSegments(segments.concat(this.parent))\r\n : segments.reverse();\r\n };\r\n RouteNode.prototype.setParent = function (parent) {\r\n this.parent = parent;\r\n this.checkParents();\r\n };\r\n RouteNode.prototype.setPath = function (path) {\r\n if (path === void 0) { path = ''; }\r\n this.path = path;\r\n this.parser = path ? new Path(path) : null;\r\n };\r\n RouteNode.prototype.add = function (route, cb, sort) {\r\n var _this = this;\r\n if (sort === void 0) { sort = true; }\r\n if (route === undefined || route === null) {\r\n return;\r\n }\r\n if (route instanceof Array) {\r\n route.forEach(function (r) { return _this.add(r, cb, sort); });\r\n return;\r\n }\r\n if (!(route instanceof RouteNode) && !(route instanceof Object)) {\r\n throw new Error('RouteNode.add() expects routes to be an Object or an instance of RouteNode.');\r\n }\r\n else if (route instanceof RouteNode) {\r\n route.setParent(this);\r\n this.addRouteNode(route, sort);\r\n }\r\n else {\r\n if (!route.name || !route.path) {\r\n throw new Error('RouteNode.add() expects routes to have a name and a path defined.');\r\n }\r\n var routeNode = new RouteNode(route.name, route.path, route.children, cb, this, false, sort);\r\n var fullName = routeNode\r\n .getParentSegments([routeNode])\r\n .map(function (_) { return _.name; })\r\n .join('.');\r\n if (cb) {\r\n cb(__assign({}, route, { name: fullName }));\r\n }\r\n this.addRouteNode(routeNode, sort);\r\n }\r\n return this;\r\n };\r\n RouteNode.prototype.addNode = function (name, path) {\r\n this.add(new RouteNode(name, path));\r\n return this;\r\n };\r\n RouteNode.prototype.getPath = function (routeName) {\r\n return getPathFromSegments(this.getSegmentsByName(routeName));\r\n };\r\n RouteNode.prototype.getNonAbsoluteChildren = function () {\r\n return this.children.filter(function (child) { return !child.absolute; });\r\n };\r\n RouteNode.prototype.sortChildren = function () {\r\n if (this.children.length) {\r\n sortChildren(this.children);\r\n }\r\n };\r\n RouteNode.prototype.sortDescendants = function () {\r\n this.sortChildren();\r\n this.children.forEach(function (child) { return child.sortDescendants(); });\r\n };\r\n RouteNode.prototype.buildPath = function (routeName, params, options) {\r\n if (params === void 0) { params = {}; }\r\n if (options === void 0) { options = {}; }\r\n var path = buildPathFromSegments(this.getSegmentsByName(routeName), params, options);\r\n return path;\r\n };\r\n RouteNode.prototype.buildState = function (name, params) {\r\n if (params === void 0) { params = {}; }\r\n var segments = this.getSegmentsByName(name);\r\n if (!segments || !segments.length) {\r\n return null;\r\n }\r\n return {\r\n name: name,\r\n params: params,\r\n meta: getMetaFromSegments(segments)\r\n };\r\n };\r\n RouteNode.prototype.matchPath = function (path, options) {\r\n if (options === void 0) { options = {}; }\r\n if (path === '' && !options.strictTrailingSlash) {\r\n path = '/';\r\n }\r\n var match = this.getSegmentsMatchingPath(path, options);\r\n if (match) {\r\n var matchedSegments = match.segments;\r\n if (matchedSegments[0].absolute) {\r\n var firstSegmentParams = matchedSegments[0].getParentSegments();\r\n matchedSegments.reverse();\r\n matchedSegments.push.apply(matchedSegments, firstSegmentParams);\r\n matchedSegments.reverse();\r\n }\r\n var lastSegment = matchedSegments[matchedSegments.length - 1];\r\n var lastSegmentSlashChild = lastSegment.findSlashChild();\r\n if (lastSegmentSlashChild) {\r\n matchedSegments.push(lastSegmentSlashChild);\r\n }\r\n }\r\n return buildStateFromMatch(match);\r\n };\r\n RouteNode.prototype.addRouteNode = function (route, sort) {\r\n if (sort === void 0) { sort = true; }\r\n var names = route.name.split('.');\r\n if (names.length === 1) {\r\n // Check duplicated routes\r\n if (this.children.map(function (child) { return child.name; }).indexOf(route.name) !==\r\n -1) {\r\n throw new Error(\"Alias \\\"\" + route.name + \"\\\" is already defined in route node\");\r\n }\r\n // Check duplicated paths\r\n if (this.children.map(function (child) { return child.path; }).indexOf(route.path) !==\r\n -1) {\r\n throw new Error(\"Path \\\"\" + route.path + \"\\\" is already defined in route node\");\r\n }\r\n this.children.push(route);\r\n if (sort) {\r\n this.sortChildren();\r\n }\r\n }\r\n else {\r\n // Locate parent node\r\n var segments = this.getSegmentsByName(names.slice(0, -1).join('.'));\r\n if (segments) {\r\n route.name = names[names.length - 1];\r\n segments[segments.length - 1].add(route);\r\n }\r\n else {\r\n throw new Error(\"Could not add route named '\" + route.name + \"', parent is missing.\");\r\n }\r\n }\r\n return this;\r\n };\r\n RouteNode.prototype.checkParents = function () {\r\n if (this.absolute && this.hasParentsParams()) {\r\n throw new Error('[RouteNode] A RouteNode with an abolute path cannot have parents with route parameters');\r\n }\r\n };\r\n RouteNode.prototype.hasParentsParams = function () {\r\n if (this.parent && this.parent.parser) {\r\n var parser = this.parent.parser;\r\n var hasParams = parser.hasUrlParams ||\r\n parser.hasSpatParam ||\r\n parser.hasMatrixParams ||\r\n parser.hasQueryParams;\r\n return hasParams || this.parent.hasParentsParams();\r\n }\r\n return false;\r\n };\r\n RouteNode.prototype.findAbsoluteChildren = function () {\r\n return this.children.reduce(function (absoluteChildren, child) {\r\n return absoluteChildren\r\n .concat(child.absolute ? child : [])\r\n .concat(child.findAbsoluteChildren());\r\n }, []);\r\n };\r\n RouteNode.prototype.findSlashChild = function () {\r\n var slashChildren = this.getNonAbsoluteChildren().filter(function (child) { return child.parser && /^\\/(\\?|$)/.test(child.parser.path); });\r\n return slashChildren[0];\r\n };\r\n RouteNode.prototype.getSegmentsByName = function (routeName) {\r\n var findSegmentByName = function (name, routes) {\r\n var filteredRoutes = routes.filter(function (r) { return r.name === name; });\r\n return filteredRoutes.length ? filteredRoutes[0] : undefined;\r\n };\r\n var segments = [];\r\n var routes = this.parser ? [this] : this.children;\r\n var names = (this.parser ? [''] : []).concat(routeName.split('.'));\r\n var matched = names.every(function (name) {\r\n var segment = findSegmentByName(name, routes);\r\n if (segment) {\r\n routes = segment.children;\r\n segments.push(segment);\r\n return true;\r\n }\r\n return false;\r\n });\r\n return matched ? segments : null;\r\n };\r\n RouteNode.prototype.getSegmentsMatchingPath = function (path, options) {\r\n var topLevelNodes = this.parser ? [this] : this.children;\r\n var startingNodes = topLevelNodes.reduce(function (nodes, node) { return nodes.concat(node, node.findAbsoluteChildren()); }, []);\r\n var currentMatch = {\r\n segments: [],\r\n params: {}\r\n };\r\n var finalMatch = matchChildren(startingNodes, path, currentMatch, options);\r\n if (finalMatch &&\r\n finalMatch.segments.length === 1 &&\r\n finalMatch.segments[0].name === '') {\r\n return null;\r\n }\r\n return finalMatch;\r\n };\r\n return RouteNode;\r\n}());\n\nexport default RouteNode;\n","import $$observable from 'symbol-observable';\nimport RouteNode from 'route-node';\nexport { default as RouteNode } from 'route-node';\nimport transitionPath, { nameToIDs } from 'router5-transition-path';\nexport { default as transitionPath } from 'router5-transition-path';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\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};\n\nvar defaultOptions = {\r\n trailingSlashMode: 'default',\r\n queryParamsMode: 'default',\r\n strictTrailingSlash: false,\r\n autoCleanUp: true,\r\n allowNotFound: false,\r\n strongMatching: true,\r\n rewritePathOnMatch: true,\r\n caseSensitive: false\r\n};\r\nfunction withOptions(options) {\r\n return function (router) {\r\n var routerOptions = __assign({}, defaultOptions, options);\r\n router.getOptions = function () { return routerOptions; };\r\n router.setOption = function (option, value) {\r\n routerOptions[option] = value;\r\n return router;\r\n };\r\n return router;\r\n };\r\n}\n\nvar errorCodes = {\r\n ROUTER_NOT_STARTED: 'NOT_STARTED',\r\n NO_START_PATH_OR_STATE: 'NO_START_PATH_OR_STATE',\r\n ROUTER_ALREADY_STARTED: 'ALREADY_STARTED',\r\n ROUTE_NOT_FOUND: 'ROUTE_NOT_FOUND',\r\n SAME_STATES: 'SAME_STATES',\r\n CANNOT_DEACTIVATE: 'CANNOT_DEACTIVATE',\r\n CANNOT_ACTIVATE: 'CANNOT_ACTIVATE',\r\n TRANSITION_ERR: 'TRANSITION_ERR',\r\n TRANSITION_CANCELLED: 'CANCELLED'\r\n};\r\nvar constants = {\r\n UNKNOWN_ROUTE: '@@router5/UNKNOWN_ROUTE',\r\n ROUTER_START: '$start',\r\n ROUTER_STOP: '$stop',\r\n TRANSITION_START: '$$start',\r\n TRANSITION_CANCEL: '$$cancel',\r\n TRANSITION_SUCCESS: '$$success',\r\n TRANSITION_ERROR: '$$error'\r\n};\n\nfunction withRoutes(routes) {\r\n return function (router) {\r\n router.forward = function (fromRoute, toRoute) {\r\n router.config.forwardMap[fromRoute] = toRoute;\r\n return router;\r\n };\r\n var rootNode = routes instanceof RouteNode\r\n ? routes\r\n : new RouteNode('', '', routes, onRouteAdded);\r\n function onRouteAdded(route) {\r\n if (route.canActivate)\r\n router.canActivate(route.name, route.canActivate);\r\n if (route.forwardTo)\r\n router.forward(route.name, route.forwardTo);\r\n if (route.decodeParams)\r\n router.config.decoders[route.name] = route.decodeParams;\r\n if (route.encodeParams)\r\n router.config.encoders[route.name] = route.encodeParams;\r\n if (route.defaultParams)\r\n router.config.defaultParams[route.name] = route.defaultParams;\r\n }\r\n router.rootNode = rootNode;\r\n router.add = function (routes, finalSort) {\r\n rootNode.add(routes, onRouteAdded, !finalSort);\r\n if (finalSort) {\r\n rootNode.sortDescendants();\r\n }\r\n return router;\r\n };\r\n router.addNode = function (name, path, canActivateHandler) {\r\n rootNode.addNode(name, path);\r\n if (canActivateHandler)\r\n router.canActivate(name, canActivateHandler);\r\n return router;\r\n };\r\n router.isActive = function (name, params, strictEquality, ignoreQueryParams) {\r\n if (params === void 0) { params = {}; }\r\n if (strictEquality === void 0) { strictEquality = false; }\r\n if (ignoreQueryParams === void 0) { ignoreQueryParams = true; }\r\n var activeState = router.getState();\r\n if (!activeState)\r\n return false;\r\n if (strictEquality || activeState.name === name) {\r\n return router.areStatesEqual(router.makeState(name, params), activeState, ignoreQueryParams);\r\n }\r\n return router.areStatesDescendants(router.makeState(name, params), activeState);\r\n };\r\n router.buildPath = function (route, params) {\r\n if (route === constants.UNKNOWN_ROUTE) {\r\n return params.path;\r\n }\r\n var paramsWithDefault = __assign({}, router.config.defaultParams[route], params);\r\n var _a = router.getOptions(), trailingSlashMode = _a.trailingSlashMode, queryParamsMode = _a.queryParamsMode, queryParams = _a.queryParams;\r\n var encodedParams = router.config.encoders[route]\r\n ? router.config.encoders[route](paramsWithDefault)\r\n : paramsWithDefault;\r\n return router.rootNode.buildPath(route, encodedParams, {\r\n trailingSlashMode: trailingSlashMode,\r\n queryParamsMode: queryParamsMode,\r\n queryParams: queryParams\r\n });\r\n };\r\n router.matchPath = function (path, source) {\r\n var options = router.getOptions();\r\n var match = router.rootNode.matchPath(path, options);\r\n if (match) {\r\n var name_1 = match.name, params = match.params, meta = match.meta;\r\n var decodedParams = router.config.decoders[name_1]\r\n ? router.config.decoders[name_1](params)\r\n : params;\r\n var _a = router.forwardState(name_1, decodedParams), routeName = _a.name, routeParams = _a.params;\r\n var builtPath = options.rewritePathOnMatch === false\r\n ? path\r\n : router.buildPath(routeName, routeParams);\r\n return router.makeState(routeName, routeParams, builtPath, {\r\n params: meta,\r\n source: source\r\n });\r\n }\r\n return null;\r\n };\r\n router.setRootPath = function (rootPath) {\r\n router.rootNode.setPath(rootPath);\r\n };\r\n return router;\r\n };\r\n}\n\nfunction withDependencies(dependencies) {\r\n return function (router) {\r\n var routerDependencies = dependencies;\r\n router.setDependency = function (dependencyName, dependency) {\r\n routerDependencies[dependencyName] = dependency;\r\n return router;\r\n };\r\n router.setDependencies = function (deps) {\r\n Object.keys(deps).forEach(function (name) {\r\n return router.setDependency(name, deps[name]);\r\n });\r\n return router;\r\n };\r\n router.getDependencies = function () { return routerDependencies; };\r\n router.getInjectables = function () { return [router, router.getDependencies()]; };\r\n router.executeFactory = function (factoryFunction) {\r\n return factoryFunction.apply(void 0, router.getInjectables());\r\n };\r\n return router;\r\n };\r\n}\n\nfunction withState(router) {\r\n var stateId = 0;\r\n var routerState = null;\r\n router.getState = function () { return routerState; };\r\n router.setState = function (state) {\r\n routerState = state;\r\n };\r\n router.makeState = function (name, params, path, meta, forceId) { return ({\r\n name: name,\r\n params: __assign({}, router.config.defaultParams[name], params),\r\n path: path,\r\n meta: meta\r\n ? __assign({}, meta, { id: forceId === undefined ? ++stateId : forceId }) : undefined\r\n }); };\r\n router.makeNotFoundState = function (path, options) {\r\n return router.makeState(constants.UNKNOWN_ROUTE, { path: path }, path, {\r\n options: options\r\n });\r\n };\r\n router.areStatesEqual = function (state1, state2, ignoreQueryParams) {\r\n if (ignoreQueryParams === void 0) { ignoreQueryParams = true; }\r\n if (state1.name !== state2.name)\r\n return false;\r\n var getUrlParams = function (name) {\r\n return router.rootNode\r\n //@ts-ignore\r\n .getSegmentsByName(name)\r\n .map(function (segment) { return segment.parser['urlParams']; })\r\n .reduce(function (params, p) { return params.concat(p); }, []);\r\n };\r\n var state1Params = ignoreQueryParams\r\n ? getUrlParams(state1.name)\r\n : Object.keys(state1.params);\r\n var state2Params = ignoreQueryParams\r\n ? getUrlParams(state2.name)\r\n : Object.keys(state2.params);\r\n return (state1Params.length === state2Params.length &&\r\n state1Params.every(function (p) { return state1.params[p] === state2.params[p]; }));\r\n };\r\n router.areStatesDescendants = function (parentState, childState) {\r\n var regex = new RegExp('^' + parentState.name + '\\\\.(.*)$');\r\n if (!regex.test(childState.name))\r\n return false;\r\n // If child state name extends parent state name, and all parent state params\r\n // are in child state params.\r\n return Object.keys(parentState.params).every(function (p) { return parentState.params[p] === childState.params[p]; });\r\n };\r\n router.forwardState = function (routeName, routeParams) {\r\n var name = router.config.forwardMap[routeName] || routeName;\r\n var params = __assign({}, router.config.defaultParams[routeName], router.config.defaultParams[name], routeParams);\r\n return {\r\n name: name,\r\n params: params\r\n };\r\n };\r\n router.buildState = function (routeName, routeParams) {\r\n var _a = router.forwardState(routeName, routeParams), name = _a.name, params = _a.params;\r\n return router.rootNode.buildState(name, params);\r\n };\r\n return router;\r\n}\n\nvar eventsMap = {\r\n onStart: constants.ROUTER_START,\r\n onStop: constants.ROUTER_STOP,\r\n onTransitionSuccess: constants.TRANSITION_SUCCESS,\r\n onTransitionStart: constants.TRANSITION_START,\r\n onTransitionError: constants.TRANSITION_ERROR,\r\n onTransitionCancel: constants.TRANSITION_CANCEL\r\n};\r\nfunction withPlugins(router) {\r\n var routerPlugins = [];\r\n router.getPlugins = function () { return routerPlugins; };\r\n router.usePlugin = function () {\r\n var plugins = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n plugins[_i] = arguments[_i];\r\n }\r\n var removePluginFns = plugins.map(function (plugin) {\r\n routerPlugins.push(plugin);\r\n return startPlugin(plugin);\r\n });\r\n return function () {\r\n routerPlugins = routerPlugins.filter(function (plugin) { return plugins.indexOf(plugin) === -1; });\r\n removePluginFns.forEach(function (removePlugin) { return removePlugin(); });\r\n };\r\n };\r\n function startPlugin(plugin) {\r\n var appliedPlugin = router.executeFactory(plugin);\r\n var removeEventListeners = Object.keys(eventsMap)\r\n .map(function (methodName) {\r\n if (appliedPlugin[methodName]) {\r\n return router.addEventListener(eventsMap[methodName], appliedPlugin[methodName]);\r\n }\r\n })\r\n .filter(Boolean);\r\n return function () {\r\n removeEventListeners.forEach(function (removeListener) { return removeListener(); });\r\n if (appliedPlugin.teardown) {\r\n appliedPlugin.teardown();\r\n }\r\n };\r\n }\r\n return router;\r\n}\n\nfunction withMiddleware(router) {\r\n var middlewareFactories = [];\r\n var middlewareFunctions = [];\r\n router.useMiddleware = function () {\r\n var middlewares = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n middlewares[_i] = arguments[_i];\r\n }\r\n var removePluginFns = middlewares.map(function (middleware) {\r\n var middlewareFunction = router.executeFactory(middleware);\r\n middlewareFactories.push(middleware);\r\n middlewareFunctions.push(middlewareFunction);\r\n return function () {\r\n middlewareFactories = middlewareFactories.filter(function (m) { return m !== middleware; });\r\n middlewareFunctions = middlewareFunctions.filter(function (m) { return m !== middlewareFunction; });\r\n };\r\n });\r\n return function () { return removePluginFns.forEach(function (fn) { return fn(); }); };\r\n };\r\n router.clearMiddleware = function () {\r\n middlewareFactories = [];\r\n middlewareFunctions = [];\r\n return router;\r\n };\r\n router.getMiddlewareFactories = function () { return middlewareFactories; };\r\n router.getMiddlewareFunctions = function () { return middlewareFunctions; };\r\n return router;\r\n}\n\nfunction withObservability(router) {\r\n var callbacks = {};\r\n router.invokeEventListeners = function (eventName) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n (callbacks[eventName] || []).forEach(function (cb) { return cb.apply(void 0, args); });\r\n };\r\n router.removeEventListener = function (eventName, cb) {\r\n callbacks[eventName] = callbacks[eventName].filter(function (_cb) { return _cb !== cb; });\r\n };\r\n router.addEventListener = function (eventName, cb) {\r\n callbacks[eventName] = (callbacks[eventName] || []).concat(cb);\r\n return function () { return router.removeEventListener(eventName, cb); };\r\n };\r\n function subscribe(listener) {\r\n var isObject = typeof listener === 'object';\r\n var finalListener = isObject ? listener.next.bind(listener) : listener;\r\n var unsubscribeHandler = router.addEventListener(constants.TRANSITION_SUCCESS, function (toState, fromState) {\r\n finalListener({\r\n route: toState,\r\n previousRoute: fromState\r\n });\r\n });\r\n return isObject\r\n ? { unsubscribe: unsubscribeHandler }\r\n : unsubscribeHandler;\r\n }\r\n function observable() {\r\n var _a;\r\n return _a = {\r\n subscribe: function (observer) {\r\n if (typeof observer !== 'object' || observer === null) {\r\n throw new TypeError('Expected the observer to be an object.');\r\n }\r\n return subscribe(observer);\r\n }\r\n },\r\n _a[$$observable] = function () {\r\n return this;\r\n },\r\n _a;\r\n }\r\n router.subscribe = subscribe;\r\n //@ts-ignore\r\n router[$$observable] = observable;\r\n //@ts-ignore\r\n router['@@observable'] = observable;\r\n return router;\r\n}\n\nfunction resolve(functions, _a, callback) {\r\n var isCancelled = _a.isCancelled, toState = _a.toState, fromState = _a.fromState, _b = _a.errorKey, errorKey = _b === void 0 ? undefined : _b;\r\n var remainingFunctions = Array.isArray(functions)\r\n ? functions\r\n : Object.keys(functions);\r\n var isState = function (obj) {\r\n return typeof obj === 'object' &&\r\n obj.name !== undefined &&\r\n obj.params !== undefined &&\r\n obj.path !== undefined;\r\n };\r\n var hasStateChanged = function (toState, fromState) {\r\n return fromState.name !== toState.name ||\r\n fromState.params !== toState.params ||\r\n fromState.path !== toState.path;\r\n };\r\n var mergeStates = function (toState, fromState) { return (__assign({}, fromState, toState, { meta: __assign({}, fromState.meta, toState.meta) })); };\r\n var processFn = function (stepFn, errBase, state, _done) {\r\n var done = function (err, newState) {\r\n if (err) {\r\n _done(err);\r\n }\r\n else if (newState && newState !== state && isState(newState)) {\r\n if (hasStateChanged(newState, state)) {\r\n console.error('[router5][transition] Warning: state values (name, params, path) were changed during transition process.');\r\n }\r\n _done(null, mergeStates(newState, state));\r\n }\r\n else {\r\n _done(null, state);\r\n }\r\n };\r\n var res = stepFn.call(null, state, fromState, done);\r\n if (isCancelled()) {\r\n done(null);\r\n }\r\n else if (typeof res === 'boolean') {\r\n done(res ? null : errBase);\r\n }\r\n else if (isState(res)) {\r\n done(null, res);\r\n }\r\n else if (res && typeof res.then === 'function') {\r\n res.then(function (resVal) {\r\n if (resVal instanceof Error)\r\n done({ error: resVal }, null);\r\n else\r\n done(null, resVal);\r\n }, function (err) {\r\n if (err instanceof Error) {\r\n console.error(err.stack || err);\r\n done(__assign({}, errBase, { promiseError: err }), null);\r\n }\r\n else {\r\n done(typeof err === 'object'\r\n ? __assign({}, errBase, err) : errBase, null);\r\n }\r\n });\r\n }\r\n // else: wait for done to be called\r\n };\r\n var next = function (err, state) {\r\n var _a;\r\n if (isCancelled()) {\r\n callback();\r\n }\r\n else if (err) {\r\n callback(err);\r\n }\r\n else {\r\n if (!remainingFunctions.length) {\r\n callback(null, state);\r\n }\r\n else {\r\n var isMapped = typeof remainingFunctions[0] === 'string';\r\n var errBase = errorKey && isMapped\r\n ? (_a = {}, _a[errorKey] = remainingFunctions[0], _a) : {};\r\n var stepFn = isMapped\r\n ? functions[remainingFunctions[0]]\r\n : remainingFunctions[0];\r\n remainingFunctions = remainingFunctions.slice(1);\r\n processFn(stepFn, errBase, state, next);\r\n }\r\n }\r\n };\r\n next(null, toState);\r\n}\n\nfunction transition(router, toState, fromState, opts, callback) {\r\n var cancelled = false;\r\n var completed = false;\r\n var options = router.getOptions();\r\n var _a = router.getLifecycleFunctions(), canDeactivateFunctions = _a[0], canActivateFunctions = _a[1];\r\n var middlewareFunctions = router.getMiddlewareFunctions();\r\n var isCancelled = function () { return cancelled; };\r\n var cancel = function () {\r\n if (!cancelled && !completed) {\r\n cancelled = true;\r\n callback({ code: errorCodes.TRANSITION_CANCELLED }, null);\r\n }\r\n };\r\n var done = function (err, state) {\r\n completed = true;\r\n if (isCancelled()) {\r\n return;\r\n }\r\n if (!err && options.autoCleanUp) {\r\n var activeSegments_1 = nameToIDs(toState.name);\r\n Object.keys(canDeactivateFunctions).forEach(function (name) {\r\n if (activeSegments_1.indexOf(name) === -1)\r\n router.clearCanDeactivate(name);\r\n });\r\n }\r\n callback(err, state || toState);\r\n };\r\n var makeError = function (base, err) { return (__assign({}, base, (err instanceof Object ? err : { error: err }))); };\r\n var isUnknownRoute = toState.name === constants.UNKNOWN_ROUTE;\r\n var asyncBase = { isCancelled: isCancelled, toState: toState, fromState: fromState };\r\n var _b = transitionPath(toState, fromState), toDeactivate = _b.toDeactivate, toActivate = _b.toActivate;\r\n var canDeactivate = !fromState || opts.forceDeactivate\r\n ? []\r\n : function (toState, fromState, cb) {\r\n var canDeactivateFunctionMap = toDeactivate\r\n .filter(function (name) { return canDeactivateFunctions[name]; })\r\n .reduce(function (fnMap, name) {\r\n var _a;\r\n return (__assign({}, fnMap, (_a = {}, _a[name] = canDeactivateFunctions[name], _a)));\r\n }, {});\r\n resolve(canDeactivateFunctionMap, __assign({}, asyncBase, { errorKey: 'segment' }), function (err) {\r\n return cb(err\r\n ? makeError({ code: errorCodes.CANNOT_DEACTIVATE }, err)\r\n : null);\r\n });\r\n };\r\n var canActivate = isUnknownRoute\r\n ? []\r\n : function (toState, fromState, cb) {\r\n var canActivateFunctionMap = toActivate\r\n .filter(function (name) { return canActivateFunctions[name]; })\r\n .reduce(function (fnMap, name) {\r\n var _a;\r\n return (__assign({}, fnMap, (_a = {}, _a[name] = canActivateFunctions[name], _a)));\r\n }, {});\r\n resolve(canActivateFunctionMap, __assign({}, asyncBase, { errorKey: 'segment' }), function (err) {\r\n return cb(err\r\n ? makeError({ code: errorCodes.CANNOT_ACTIVATE }, err)\r\n : null);\r\n });\r\n };\r\n var middleware = !middlewareFunctions.length\r\n ? []\r\n : function (toState, fromState, cb) {\r\n return resolve(middlewareFunctions, __assign({}, asyncBase), function (err, state) {\r\n return cb(err\r\n ? makeError({ code: errorCodes.TRANSITION_ERR }, err)\r\n : null, state || toState);\r\n });\r\n };\r\n var pipeline = []\r\n .concat(canDeactivate)\r\n .concat(canActivate)\r\n .concat(middleware);\r\n resolve(pipeline, asyncBase, done);\r\n return cancel;\r\n}\n\nvar noop = function (err, state) { };\r\nfunction withNavigation(router) {\r\n var cancelCurrentTransition;\r\n router.navigate = navigate;\r\n router.navigate = navigate;\r\n router.navigateToDefault = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var opts = typeof args[0] === 'object' ? args[0] : {};\r\n var done = args.length === 2\r\n ? args[1]\r\n : typeof args[0] === 'function'\r\n ? args[0]\r\n : noop;\r\n var options = router.getOptions();\r\n if (options.defaultRoute) {\r\n return navigate(options.defaultRoute, options.defaultParams, opts, done);\r\n }\r\n return function () { };\r\n };\r\n router.cancel = function () {\r\n if (cancelCurrentTransition) {\r\n cancelCurrentTransition('navigate');\r\n cancelCurrentTransition = null;\r\n }\r\n return router;\r\n };\r\n function navigate() {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var name = args[0];\r\n var lastArg = args[args.length - 1];\r\n var done = typeof lastArg === 'function' ? lastArg : noop;\r\n var params = typeof args[1] === 'object' ? args[1] : {};\r\n var opts = typeof args[2] === 'object' ? args[2] : {};\r\n if (!router.isStarted()) {\r\n done({ code: errorCodes.ROUTER_NOT_STARTED });\r\n return;\r\n }\r\n var route = router.buildState(name, params);\r\n if (!route) {\r\n var err = { code: errorCodes.ROUTE_NOT_FOUND };\r\n done(err);\r\n router.invokeEventListeners(constants.TRANSITION_ERROR, null, router.getState(), err);\r\n return;\r\n }\r\n var toState = router.makeState(route.name, route.params, router.buildPath(route.name, route.params), { params: route.meta, options: opts });\r\n var sameStates = router.getState()\r\n ? router.areStatesEqual(router.getState(), toState, false)\r\n : false;\r\n // Do not proceed further if states are the same and no reload\r\n // (no deactivation and no callbacks)\r\n if (sameStates && !opts.reload && !opts.force) {\r\n var err = { code: errorCodes.SAME_STATES };\r\n done(err);\r\n router.invokeEventListeners(constants.TRANSITION_ERROR, toState, router.getState(), err);\r\n return;\r\n }\r\n var fromState = router.getState();\r\n if (opts.skipTransition) {\r\n done(null, toState);\r\n return noop;\r\n }\r\n // Transition\r\n return router.transitionToState(toState, fromState, opts, function (err, state) {\r\n if (err) {\r\n if (err.redirect) {\r\n var _a = err.redirect, name_1 = _a.name, params_1 = _a.params;\r\n navigate(name_1, params_1, __assign({}, opts, { force: true, redirected: true }), done);\r\n }\r\n else {\r\n done(err);\r\n }\r\n }\r\n else {\r\n router.invokeEventListeners(constants.TRANSITION_SUCCESS, state, fromState, opts);\r\n done(null, state);\r\n }\r\n });\r\n }\r\n router.transitionToState = function (toState, fromState, options, done) {\r\n if (options === void 0) { options = {}; }\r\n if (done === void 0) { done = noop; }\r\n router.cancel();\r\n router.invokeEventListeners(constants.TRANSITION_START, toState, fromState);\r\n cancelCurrentTransition = transition(router, toState, fromState, options, function (err, state) {\r\n cancelCurrentTransition = null;\r\n state = state || toState;\r\n if (err) {\r\n if (err.code === errorCodes.TRANSITION_CANCELLED) {\r\n router.invokeEventListeners(constants.TRANSITION_CANCEL, toState, fromState);\r\n }\r\n else {\r\n router.invokeEventListeners(constants.TRANSITION_ERROR, toState, fromState, err);\r\n }\r\n done(err);\r\n }\r\n else {\r\n router.setState(state);\r\n done(null, state);\r\n }\r\n });\r\n return cancelCurrentTransition;\r\n };\r\n return router;\r\n}\n\nvar noop$1 = function () { };\r\nfunction withRouterLifecycle(router) {\r\n var started = false;\r\n router.isStarted = function () { return started; };\r\n //@ts-ignore\r\n router.start = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var options = router.getOptions();\r\n var lastArg = args[args.length - 1];\r\n var done = typeof lastArg === 'function' ? lastArg : noop$1;\r\n var startPathOrState = typeof args[0] !== 'function' ? args[0] : undefined;\r\n if (started) {\r\n done({ code: errorCodes.ROUTER_ALREADY_STARTED });\r\n return router;\r\n }\r\n var startPath, startState;\r\n started = true;\r\n router.invokeEventListeners(constants.ROUTER_START);\r\n // callback\r\n var cb = function (err, state, invokeErrCb) {\r\n if (invokeErrCb === void 0) { invokeErrCb = true; }\r\n if (!err)\r\n router.invokeEventListeners(constants.TRANSITION_SUCCESS, state, null, { replace: true });\r\n if (err && invokeErrCb)\r\n router.invokeEventListeners(constants.TRANSITION_ERROR, state, null, err);\r\n done(err, state);\r\n };\r\n if (startPathOrState === undefined && !options.defaultRoute) {\r\n return cb({ code: errorCodes.NO_START_PATH_OR_STATE });\r\n }\r\n if (typeof startPathOrState === 'string') {\r\n startPath = startPathOrState;\r\n }\r\n else if (typeof startPathOrState === 'object') {\r\n startState = startPathOrState;\r\n }\r\n if (!startState) {\r\n // If no supplied start state, get start state\r\n startState =\r\n startPath === undefined ? null : router.matchPath(startPath);\r\n // Navigate to default function\r\n var navigateToDefault_1 = function () {\r\n return router.navigateToDefault({ replace: true }, done);\r\n };\r\n var redirect_1 = function (route) {\r\n return router.navigate(route.name, route.params, { replace: true, reload: true, redirected: true }, done);\r\n };\r\n var transitionToState = function (state) {\r\n router.transitionToState(state, router.getState(), {}, function (err, state) {\r\n if (!err)\r\n cb(null, state);\r\n else if (err.redirect)\r\n redirect_1(err.redirect);\r\n else if (options.defaultRoute)\r\n navigateToDefault_1();\r\n else\r\n cb(err, null, false);\r\n });\r\n };\r\n // If matched start path\r\n if (startState) {\r\n transitionToState(startState);\r\n }\r\n else if (options.defaultRoute) {\r\n // If default, navigate to default\r\n navigateToDefault_1();\r\n }\r\n else if (options.allowNotFound) {\r\n transitionToState(router.makeNotFoundState(startPath, { replace: true }));\r\n }\r\n else {\r\n // No start match, no default => do nothing\r\n cb({ code: errorCodes.ROUTE_NOT_FOUND, path: startPath }, null);\r\n }\r\n }\r\n else {\r\n // Initialise router with provided start state\r\n router.setState(startState);\r\n cb(null, startState);\r\n }\r\n return router;\r\n };\r\n router.stop = function () {\r\n if (started) {\r\n router.setState(null);\r\n started = false;\r\n router.invokeEventListeners(constants.ROUTER_STOP);\r\n }\r\n return router;\r\n };\r\n return router;\r\n}\n\nvar toFunction = function (val) { return (typeof val === 'function' ? val : function () { return function () { return val; }; }); };\r\nfunction withRouteLifecycle(router) {\r\n var canDeactivateFactories = {};\r\n var canActivateFactories = {};\r\n var canDeactivateFunctions = {};\r\n var canActivateFunctions = {};\r\n router.getLifecycleFactories = function () {\r\n return [canDeactivateFactories, canActivateFactories];\r\n };\r\n router.getLifecycleFunctions = function () {\r\n return [canDeactivateFunctions, canActivateFunctions];\r\n };\r\n router.canDeactivate = function (name, canDeactivateHandler) {\r\n var factory = toFunction(canDeactivateHandler);\r\n canDeactivateFactories[name] = factory;\r\n canDeactivateFunctions[name] = router.executeFactory(factory);\r\n return router;\r\n };\r\n router.clearCanDeactivate = function (name) {\r\n canDeactivateFactories[name] = undefined;\r\n canDeactivateFunctions[name] = undefined;\r\n return router;\r\n };\r\n router.canActivate = function (name, canActivateHandler) {\r\n var factory = toFunction(canActivateHandler);\r\n canActivateFactories[name] = factory;\r\n canActivateFunctions[name] = router.executeFactory(factory);\r\n return router;\r\n };\r\n return router;\r\n}\n\nvar pipe = function () {\r\n var fns = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n fns[_i] = arguments[_i];\r\n }\r\n return function (arg) {\r\n return fns.reduce(function (prev, fn) { return fn(prev); }, arg);\r\n };\r\n};\r\nvar createRouter = function (routes, options, dependencies) {\r\n if (routes === void 0) { routes = []; }\r\n if (options === void 0) { options = {}; }\r\n if (dependencies === void 0) { dependencies = {}; }\r\n var config = {\r\n decoders: {},\r\n encoders: {},\r\n defaultParams: {},\r\n forwardMap: {}\r\n };\r\n return pipe(withOptions(options), withDependencies(dependencies), withObservability, withState, withRouterLifecycle, withRouteLifecycle, withNavigation, withPlugins, withMiddleware, withRoutes(routes))({ config: config });\r\n};\n\nfunction cloneRouter(router, dependencies) {\r\n var clonedRouter = createRouter(router.rootNode, router.getOptions(), dependencies);\r\n clonedRouter.useMiddleware.apply(clonedRouter, router.getMiddlewareFactories());\r\n clonedRouter.usePlugin.apply(clonedRouter, router.getPlugins());\r\n clonedRouter.config = router.config;\r\n var _a = router.getLifecycleFactories(), canDeactivateFactories = _a[0], canActivateFactories = _a[1];\r\n Object.keys(canDeactivateFactories).forEach(function (name) {\r\n return clonedRouter.canDeactivate(name, canDeactivateFactories[name]);\r\n });\r\n Object.keys(canActivateFactories).forEach(function (name) {\r\n return clonedRouter.canActivate(name, canActivateFactories[name]);\r\n });\r\n return clonedRouter;\r\n}\n\nexport default createRouter;\nexport { createRouter, cloneRouter, constants, errorCodes };\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar makeOptions = function (opts) {\r\n if (opts === void 0) { opts = {}; }\r\n return ({\r\n arrayFormat: opts.arrayFormat || 'none',\r\n booleanFormat: opts.booleanFormat || 'none',\r\n nullFormat: opts.nullFormat || 'default'\r\n });\r\n};\r\nvar encodeValue = function (value) { return encodeURIComponent(value); };\r\nvar decodeValue = function (value) { return decodeURIComponent(value); };\r\nvar encodeBoolean = function (name, value, opts) {\r\n if (opts.booleanFormat === 'empty-true' && value) {\r\n return name;\r\n }\r\n var encodedValue;\r\n if (opts.booleanFormat === 'unicode') {\r\n encodedValue = value ? '✓' : '✗';\r\n }\r\n else {\r\n encodedValue = value.toString();\r\n }\r\n return name + \"=\" + encodedValue;\r\n};\r\nvar encodeNull = function (name, opts) {\r\n if (opts.nullFormat === 'hidden') {\r\n return '';\r\n }\r\n if (opts.nullFormat === 'string') {\r\n return name + \"=null\";\r\n }\r\n return name;\r\n};\r\nvar getNameEncoder = function (opts) {\r\n if (opts.arrayFormat === 'index') {\r\n return function (name, index) { return name + \"[\" + index + \"]\"; };\r\n }\r\n if (opts.arrayFormat === 'brackets') {\r\n return function (name) { return name + \"[]\"; };\r\n }\r\n return function (name) { return name; };\r\n};\r\nvar encodeArray = function (name, arr, opts) {\r\n var encodeName = getNameEncoder(opts);\r\n return arr\r\n .map(function (val, index) { return encodeName(name, index) + \"=\" + encodeValue(val); })\r\n .join('&');\r\n};\r\nvar encode = function (name, value, opts) {\r\n if (value === null) {\r\n return encodeNull(name, opts);\r\n }\r\n if (typeof value === 'boolean') {\r\n return encodeBoolean(name, value, opts);\r\n }\r\n if (Array.isArray(value)) {\r\n return encodeArray(name, value, opts);\r\n }\r\n return name + \"=\" + encodeValue(value);\r\n};\r\nvar decode = function (value, opts) {\r\n if (value === undefined) {\r\n return opts.booleanFormat === 'empty-true' ? true : null;\r\n }\r\n if (opts.booleanFormat === 'string') {\r\n if (value === 'true') {\r\n return true;\r\n }\r\n if (value === 'false') {\r\n return false;\r\n }\r\n }\r\n else if (opts.booleanFormat === 'unicode') {\r\n if (decodeValue(value) === '✓') {\r\n return true;\r\n }\r\n if (decodeValue(value) === '✗') {\r\n return false;\r\n }\r\n }\r\n else if (opts.nullFormat === 'string') {\r\n if (value === 'null') {\r\n return null;\r\n }\r\n }\r\n return decodeValue(value);\r\n};\n\nvar getSearch = function (path) {\r\n var pos = path.indexOf('?');\r\n if (pos === -1) {\r\n return path;\r\n }\r\n return path.slice(pos + 1);\r\n};\r\nvar isSerialisable = function (val) { return val !== undefined; };\r\nvar parseName = function (name) {\r\n var bracketPosition = name.indexOf('[');\r\n var hasBrackets = bracketPosition !== -1;\r\n return {\r\n hasBrackets: hasBrackets,\r\n name: hasBrackets ? name.slice(0, bracketPosition) : name\r\n };\r\n};\n\n/**\r\n * Parse a querystring and return an object of parameters\r\n */\r\nvar parse = function (path, opts) {\r\n var options = makeOptions(opts);\r\n return getSearch(path)\r\n .split('&')\r\n .reduce(function (params, param) {\r\n var _a = param.split('='), rawName = _a[0], value = _a[1];\r\n var _b = parseName(rawName), hasBrackets = _b.hasBrackets, name = _b.name;\r\n var currentValue = params[name];\r\n var decodedValue = decode(value, options);\r\n if (currentValue === undefined) {\r\n params[name] = hasBrackets ? [decodedValue] : decodedValue;\r\n }\r\n else {\r\n params[name] = [].concat(currentValue, decodedValue);\r\n }\r\n return params;\r\n }, {});\r\n};\r\n/**\r\n * Build a querystring from an object of parameters\r\n */\r\nvar build = function (params, opts) {\r\n var options = makeOptions(opts);\r\n return Object.keys(params)\r\n .filter(function (paramName) { return isSerialisable(params[paramName]); })\r\n .map(function (paramName) { return encode(paramName, params[paramName], options); })\r\n .filter(Boolean)\r\n .join('&');\r\n};\r\n/**\r\n * Remove a list of parameters from a querystring\r\n */\r\nvar omit = function (path, paramsToOmit, opts) {\r\n var options = makeOptions(opts);\r\n var searchPart = getSearch(path);\r\n if (searchPart === '') {\r\n return {\r\n querystring: '',\r\n removedParams: {}\r\n };\r\n }\r\n var _a = path.split('&').reduce(function (_a, chunk) {\r\n var left = _a[0], right = _a[1];\r\n var rawName = chunk.split('=')[0];\r\n var name = parseName(rawName).name;\r\n return paramsToOmit.indexOf(name) === -1\r\n ? [left.concat(chunk), right]\r\n : [left, right.concat(chunk)];\r\n }, [[], []]), kept = _a[0], removed = _a[1];\r\n return {\r\n querystring: kept.join('&'),\r\n removedParams: parse(removed.join('&'), options)\r\n };\r\n};\r\n/**\r\n * Remove a list of parameters from a querystring\r\n */\r\nvar keep = function (path, paramsToKeep, opts) {\r\n var options = makeOptions(opts);\r\n var searchPart = getSearch(path);\r\n if (searchPart === '') {\r\n return {\r\n keptParams: {},\r\n querystring: ''\r\n };\r\n }\r\n var _a = path.split('&').reduce(function (_a, chunk) {\r\n var left = _a[0], right = _a[1];\r\n var rawName = chunk.split('=')[0];\r\n var name = parseName(rawName).name;\r\n return paramsToKeep.indexOf(name) >= 0\r\n ? [left.concat(chunk), right]\r\n : [left, right.concat(chunk)];\r\n }, [[], []]), kept = _a[0], removed = _a[1];\r\n return {\r\n keptParams: parse(kept.join('&'), options),\r\n querystring: kept.join('&')\r\n };\r\n};\n\nexports.parse = parse;\nexports.build = build;\nexports.omit = omit;\nexports.keep = keep;\n","'use strict';\n\nmodule.exports = (string, separator) => {\n\tif (!(typeof string === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError('Expected the arguments to be of type `string`');\n\t}\n\n\tif (separator === '') {\n\t\treturn [string];\n\t}\n\n\tconst separatorIndex = string.indexOf(separator);\n\n\tif (separatorIndex === -1) {\n\t\treturn [string];\n\t}\n\n\treturn [\n\t\tstring.slice(0, separatorIndex),\n\t\tstring.slice(separatorIndex + separator.length)\n\t];\n};\n","'use strict';\nmodule.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);\n","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n","export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n","(function(){var h=\"undefined\"!=typeof window&&window===this?this:\"undefined\"!=typeof global&&null!=global?global:this,k=\"function\"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};function l(){l=function(){};h.Symbol||(h.Symbol=m)}var n=0;function m(a){return\"jscomp_symbol_\"+(a||\"\")+n++}\nfunction p(){l();var a=h.Symbol.iterator;a||(a=h.Symbol.iterator=h.Symbol(\"iterator\"));\"function\"!=typeof Array.prototype[a]&&k(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return q(this)}});p=function(){}}function q(a){var b=0;return r(function(){return bb||(clearTimeout(a.j),a.j=setTimeout(function(){var b=performance.timing.navigationStart,d=B(a.g,a.b),b=(window.a&&window.a.A?1E3*window.a.A().C-b:0)||performance.timing.domContentLoadedEventEnd-b;if(a.u)var f=a.u;else performance.timing.domContentLoadedEventEnd?(f=performance.timing,f=f.domContentLoadedEventEnd-f.navigationStart):f=null;var e=performance.now();null===f&&G(a,Math.max(d+5E3,e+1E3));var g=a.a;5E3>e-d?d=null:(d=g.length?g[g.length-1].end:b,d=5E3>e-d?null:Math.max(d,\nf));d&&(a.s(d),clearTimeout(a.j),a.i=!1,a.c&&a.c.disconnect(),a.h&&a.h.disconnect());G(a,performance.now()+1E3)},b-performance.now()),a.v=b)}\nfunction D(a){a.c=new PerformanceObserver(function(b){b=t(b.getEntries());for(var c=b.next();!c.done;c=b.next())if(c=c.value,\"resource\"===c.entryType&&(a.b.push({start:c.fetchStart,end:c.responseEnd}),G(a,B(a.g,a.b)+5E3)),\"longtask\"===c.entryType){var d=c.startTime+c.duration;a.a.push({start:c.startTime,end:d});G(a,d+5E3)}});a.c.observe({entryTypes:[\"longtask\",\"resource\"]})}C.prototype.m=function(a){this.f.set(a,performance.now())};C.prototype.l=function(a){this.f.delete(a)};\nC.prototype.B=function(){G(this,performance.now()+5E3)};h.Object.defineProperties(C.prototype,{g:{configurable:!0,enumerable:!0,get:function(){return[].concat(u(this.f.values()))}}});var H={getFirstConsistentlyInteractive:function(a){a=a?a:{};return\"PerformanceLongTaskTiming\"in window?(new C(a)).getFirstConsistentlyInteractive():Promise.resolve(null)}};\n\"undefined\"!=typeof module&&module.exports?module.exports=H:\"function\"===typeof define&&define.amd?define(\"ttiPolyfill\",[],function(){return H}):window.ttiPolyfill=H;})();\n//# sourceMappingURL=tti-polyfill.js.map","/* UAParser.js v1.0.37\n Copyright © 2012-2021 Faisal Salman \n MIT License */\n(function(window,undefined){\"use strict\";var LIBVERSION=\"1.0.37\",EMPTY=\"\",UNKNOWN=\"?\",FUNC_TYPE=\"function\",UNDEF_TYPE=\"undefined\",OBJ_TYPE=\"object\",STR_TYPE=\"string\",MAJOR=\"major\",MODEL=\"model\",NAME=\"name\",TYPE=\"type\",VENDOR=\"vendor\",VERSION=\"version\",ARCHITECTURE=\"architecture\",CONSOLE=\"console\",MOBILE=\"mobile\",TABLET=\"tablet\",SMARTTV=\"smarttv\",WEARABLE=\"wearable\",EMBEDDED=\"embedded\",UA_MAX_LENGTH=500;var AMAZON=\"Amazon\",APPLE=\"Apple\",ASUS=\"ASUS\",BLACKBERRY=\"BlackBerry\",BROWSER=\"Browser\",CHROME=\"Chrome\",EDGE=\"Edge\",FIREFOX=\"Firefox\",GOOGLE=\"Google\",HUAWEI=\"Huawei\",LG=\"LG\",MICROSOFT=\"Microsoft\",MOTOROLA=\"Motorola\",OPERA=\"Opera\",SAMSUNG=\"Samsung\",SHARP=\"Sharp\",SONY=\"Sony\",XIAOMI=\"Xiaomi\",ZEBRA=\"Zebra\",FACEBOOK=\"Facebook\",CHROMIUM_OS=\"Chromium OS\",MAC_OS=\"Mac OS\";var extend=function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},enumerize=function(arr){var enums={};for(var i=0;i0){if(q.length===2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length===3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length===4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},strMapper=function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j