`.\r\n * @returns {Function} A `useDispatch` hook bound to the specified context.\r\n */\n\nexport function createDispatchHook(context = ReactReduxContext) {\n const useStore = // @ts-ignore\n context === ReactReduxContext ? useDefaultStore : createStoreHook(context);\n return function useDispatch() {\n const store = useStore(); // @ts-ignore\n\n return store.dispatch;\n };\n}\n/**\r\n * A hook to access the redux `dispatch` function.\r\n *\r\n * @returns {any|function} redux store's `dispatch` function\r\n *\r\n * @example\r\n *\r\n * import React, { useCallback } from 'react'\r\n * import { useDispatch } from 'react-redux'\r\n *\r\n * export const CounterComponent = ({ value }) => {\r\n * const dispatch = useDispatch()\r\n * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])\r\n * return (\r\n * \r\n * {value}\r\n * \r\n *
\r\n * )\r\n * }\r\n */\n\nexport const useDispatch = /*#__PURE__*/createDispatchHook();","import Provider from './components/Provider';\nimport connect from './components/connect';\nimport { ReactReduxContext } from './components/Context';\nimport { useDispatch, createDispatchHook } from './hooks/useDispatch';\nimport { useSelector, createSelectorHook } from './hooks/useSelector';\nimport { useStore, createStoreHook } from './hooks/useStore';\nimport shallowEqual from './utils/shallowEqual';\nexport * from './types';\nexport { Provider, ReactReduxContext, connect, useDispatch, createDispatchHook, useSelector, createSelectorHook, useStore, createStoreHook, shallowEqual };","// The primary entry point assumes we're working with standard ReactDOM/RN, but\n// older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x).\n// Because of that, the useSyncExternalStore compat shim is needed.\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates';\nimport { setBatch } from './utils/batch';\nimport { initializeUseSelector } from './hooks/useSelector';\nimport { initializeConnect } from './components/connect';\ninitializeUseSelector(useSyncExternalStoreWithSelector);\ninitializeConnect(useSyncExternalStore); // Enable batched updates in our subscriptions for use\n// with standard React renderers (ReactDOM, React Native)\n\nsetBatch(batch);\nexport { batch };\nexport * from './exports';","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _default = function _default(position, metric, axis) {\n var positionPercent = position === 0 ? position : position + metric;\n var positionCss = axis === 'horizontal' ? [positionPercent, 0, 0] : [0, positionPercent, 0];\n var transitionProp = 'translate3d';\n var translatedPosition = '(' + positionCss.join(',') + ')';\n return transitionProp + translatedPosition;\n};\n\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.fadeAnimationHandler = exports.slideStopSwipingHandler = exports.slideSwipeAnimationHandler = exports.slideAnimationHandler = void 0;\n\nvar _react = require(\"react\");\n\nvar _CSSTranslate = _interopRequireDefault(require(\"../../CSSTranslate\"));\n\nvar _utils = require(\"./utils\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Main animation handler for the default 'sliding' style animation\n * @param props\n * @param state\n */\nvar slideAnimationHandler = function slideAnimationHandler(props, state) {\n var returnStyles = {};\n var selectedItem = state.selectedItem;\n var previousItem = selectedItem;\n var lastPosition = _react.Children.count(props.children) - 1;\n var needClonedSlide = props.infiniteLoop && (selectedItem < 0 || selectedItem > lastPosition); // Handle list position if it needs a clone\n\n if (needClonedSlide) {\n if (previousItem < 0) {\n if (props.centerMode && props.centerSlidePercentage && props.axis === 'horizontal') {\n returnStyles.itemListStyle = (0, _utils.setPosition)(-(lastPosition + 2) * props.centerSlidePercentage - (100 - props.centerSlidePercentage) / 2, props.axis);\n } else {\n returnStyles.itemListStyle = (0, _utils.setPosition)(-(lastPosition + 2) * 100, props.axis);\n }\n } else if (previousItem > lastPosition) {\n returnStyles.itemListStyle = (0, _utils.setPosition)(0, props.axis);\n }\n\n return returnStyles;\n }\n\n var currentPosition = (0, _utils.getPosition)(selectedItem, props); // if 3d is available, let's take advantage of the performance of transform\n\n var transformProp = (0, _CSSTranslate.default)(currentPosition, '%', props.axis);\n var transitionTime = props.transitionTime + 'ms';\n returnStyles.itemListStyle = {\n WebkitTransform: transformProp,\n msTransform: transformProp,\n OTransform: transformProp,\n transform: transformProp\n };\n\n if (!state.swiping) {\n returnStyles.itemListStyle = _objectSpread(_objectSpread({}, returnStyles.itemListStyle), {}, {\n WebkitTransitionDuration: transitionTime,\n MozTransitionDuration: transitionTime,\n OTransitionDuration: transitionTime,\n transitionDuration: transitionTime,\n msTransitionDuration: transitionTime\n });\n }\n\n return returnStyles;\n};\n/**\n * Swiping animation handler for the default 'sliding' style animation\n * @param delta\n * @param props\n * @param state\n * @param setState\n */\n\n\nexports.slideAnimationHandler = slideAnimationHandler;\n\nvar slideSwipeAnimationHandler = function slideSwipeAnimationHandler(delta, props, state, setState) {\n var returnStyles = {};\n var isHorizontal = props.axis === 'horizontal';\n\n var childrenLength = _react.Children.count(props.children);\n\n var initialBoundry = 0;\n var currentPosition = (0, _utils.getPosition)(state.selectedItem, props);\n var finalBoundry = props.infiniteLoop ? (0, _utils.getPosition)(childrenLength - 1, props) - 100 : (0, _utils.getPosition)(childrenLength - 1, props);\n var axisDelta = isHorizontal ? delta.x : delta.y;\n var handledDelta = axisDelta; // prevent user from swiping left out of boundaries\n\n if (currentPosition === initialBoundry && axisDelta > 0) {\n handledDelta = 0;\n } // prevent user from swiping right out of boundaries\n\n\n if (currentPosition === finalBoundry && axisDelta < 0) {\n handledDelta = 0;\n }\n\n var position = currentPosition + 100 / (state.itemSize / handledDelta);\n var hasMoved = Math.abs(axisDelta) > props.swipeScrollTolerance;\n\n if (props.infiniteLoop && hasMoved) {\n // When allowing infinite loop, if we slide left from position 0 we reveal the cloned last slide that appears before it\n // if we slide even further we need to jump to other side so it can continue - and vice versa for the last slide\n if (state.selectedItem === 0 && position > -100) {\n position -= childrenLength * 100;\n } else if (state.selectedItem === childrenLength - 1 && position < -childrenLength * 100) {\n position += childrenLength * 100;\n }\n }\n\n if (!props.preventMovementUntilSwipeScrollTolerance || hasMoved || state.swipeMovementStarted) {\n if (!state.swipeMovementStarted) {\n setState({\n swipeMovementStarted: true\n });\n }\n\n returnStyles.itemListStyle = (0, _utils.setPosition)(position, props.axis);\n } //allows scroll if the swipe was within the tolerance\n\n\n if (hasMoved && !state.cancelClick) {\n setState({\n cancelClick: true\n });\n }\n\n return returnStyles;\n};\n/**\n * Default 'sliding' style animination handler for when a swipe action stops.\n * @param props\n * @param state\n */\n\n\nexports.slideSwipeAnimationHandler = slideSwipeAnimationHandler;\n\nvar slideStopSwipingHandler = function slideStopSwipingHandler(props, state) {\n var currentPosition = (0, _utils.getPosition)(state.selectedItem, props);\n var itemListStyle = (0, _utils.setPosition)(currentPosition, props.axis);\n return {\n itemListStyle: itemListStyle\n };\n};\n/**\n * Main animation handler for the default 'fade' style animation\n * @param props\n * @param state\n */\n\n\nexports.slideStopSwipingHandler = slideStopSwipingHandler;\n\nvar fadeAnimationHandler = function fadeAnimationHandler(props, state) {\n var transitionTime = props.transitionTime + 'ms';\n var transitionTimingFunction = 'ease-in-out';\n var slideStyle = {\n position: 'absolute',\n display: 'block',\n zIndex: -2,\n minHeight: '100%',\n opacity: 0,\n top: 0,\n right: 0,\n left: 0,\n bottom: 0,\n transitionTimingFunction: transitionTimingFunction,\n msTransitionTimingFunction: transitionTimingFunction,\n MozTransitionTimingFunction: transitionTimingFunction,\n WebkitTransitionTimingFunction: transitionTimingFunction,\n OTransitionTimingFunction: transitionTimingFunction\n };\n\n if (!state.swiping) {\n slideStyle = _objectSpread(_objectSpread({}, slideStyle), {}, {\n WebkitTransitionDuration: transitionTime,\n MozTransitionDuration: transitionTime,\n OTransitionDuration: transitionTime,\n transitionDuration: transitionTime,\n msTransitionDuration: transitionTime\n });\n }\n\n return {\n slideStyle: slideStyle,\n selectedStyle: _objectSpread(_objectSpread({}, slideStyle), {}, {\n opacity: 1,\n position: 'relative'\n }),\n prevStyle: _objectSpread({}, slideStyle)\n };\n};\n\nexports.fadeAnimationHandler = fadeAnimationHandler;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _react = _interopRequireWildcard(require(\"react\"));\n\nvar _reactEasySwipe = _interopRequireDefault(require(\"react-easy-swipe\"));\n\nvar _cssClasses = _interopRequireDefault(require(\"../../cssClasses\"));\n\nvar _Thumbs = _interopRequireDefault(require(\"../Thumbs\"));\n\nvar _document = _interopRequireDefault(require(\"../../shims/document\"));\n\nvar _window = _interopRequireDefault(require(\"../../shims/window\"));\n\nvar _utils = require(\"./utils\");\n\nvar _animations = require(\"./animations\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _getRequireWildcardCache() { if (typeof WeakMap !== \"function\") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar Carousel = /*#__PURE__*/function (_React$Component) {\n _inherits(Carousel, _React$Component);\n\n var _super = _createSuper(Carousel);\n\n // @ts-ignore\n function Carousel(props) {\n var _this;\n\n _classCallCheck(this, Carousel);\n\n _this = _super.call(this, props);\n\n _defineProperty(_assertThisInitialized(_this), \"thumbsRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"carouselWrapperRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"listRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"itemsRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"timer\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"animationHandler\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"setThumbsRef\", function (node) {\n _this.thumbsRef = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setCarouselWrapperRef\", function (node) {\n _this.carouselWrapperRef = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setListRef\", function (node) {\n _this.listRef = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setItemsRef\", function (node, index) {\n if (!_this.itemsRef) {\n _this.itemsRef = [];\n }\n\n _this.itemsRef[index] = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"autoPlay\", function () {\n if (_react.Children.count(_this.props.children) <= 1) {\n return;\n }\n\n _this.clearAutoPlay();\n\n if (!_this.props.autoPlay) {\n return;\n }\n\n _this.timer = setTimeout(function () {\n _this.increment();\n }, _this.props.interval);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"clearAutoPlay\", function () {\n if (_this.timer) clearTimeout(_this.timer);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"resetAutoPlay\", function () {\n _this.clearAutoPlay();\n\n _this.autoPlay();\n });\n\n _defineProperty(_assertThisInitialized(_this), \"stopOnHover\", function () {\n _this.setState({\n isMouseEntered: true\n }, _this.clearAutoPlay);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"startOnLeave\", function () {\n _this.setState({\n isMouseEntered: false\n }, _this.autoPlay);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"isFocusWithinTheCarousel\", function () {\n if (!_this.carouselWrapperRef) {\n return false;\n }\n\n if ((0, _document.default)().activeElement === _this.carouselWrapperRef || _this.carouselWrapperRef.contains((0, _document.default)().activeElement)) {\n return true;\n }\n\n return false;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"navigateWithKeyboard\", function (e) {\n if (!_this.isFocusWithinTheCarousel()) {\n return;\n }\n\n var axis = _this.props.axis;\n var isHorizontal = axis === 'horizontal';\n var keyNames = {\n ArrowUp: 38,\n ArrowRight: 39,\n ArrowDown: 40,\n ArrowLeft: 37\n };\n var nextKey = isHorizontal ? keyNames.ArrowRight : keyNames.ArrowDown;\n var prevKey = isHorizontal ? keyNames.ArrowLeft : keyNames.ArrowUp;\n\n if (nextKey === e.keyCode) {\n _this.increment();\n } else if (prevKey === e.keyCode) {\n _this.decrement();\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateSizes\", function () {\n if (!_this.state.initialized || !_this.itemsRef || _this.itemsRef.length === 0) {\n return;\n }\n\n var isHorizontal = _this.props.axis === 'horizontal';\n var firstItem = _this.itemsRef[0];\n\n if (!firstItem) {\n return;\n }\n\n var itemSize = isHorizontal ? firstItem.clientWidth : firstItem.clientHeight;\n\n _this.setState({\n itemSize: itemSize\n });\n\n if (_this.thumbsRef) {\n _this.thumbsRef.updateSizes();\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setMountState\", function () {\n _this.setState({\n hasMount: true\n });\n\n _this.updateSizes();\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleClickItem\", function (index, item) {\n if (_react.Children.count(_this.props.children) === 0) {\n return;\n }\n\n if (_this.state.cancelClick) {\n _this.setState({\n cancelClick: false\n });\n\n return;\n }\n\n _this.props.onClickItem(index, item);\n\n if (index !== _this.state.selectedItem) {\n _this.setState({\n selectedItem: index\n });\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleOnChange\", function (index, item) {\n if (_react.Children.count(_this.props.children) <= 1) {\n return;\n }\n\n _this.props.onChange(index, item);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleClickThumb\", function (index, item) {\n _this.props.onClickThumb(index, item);\n\n _this.moveTo(index);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeStart\", function (event) {\n _this.setState({\n swiping: true\n });\n\n _this.props.onSwipeStart(event);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeEnd\", function (event) {\n _this.setState({\n swiping: false,\n cancelClick: false,\n swipeMovementStarted: false\n });\n\n _this.props.onSwipeEnd(event);\n\n _this.clearAutoPlay();\n\n if (_this.state.autoPlay) {\n _this.autoPlay();\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeMove\", function (delta, event) {\n _this.props.onSwipeMove(event);\n\n var animationHandlerResponse = _this.props.swipeAnimationHandler(delta, _this.props, _this.state, _this.setState.bind(_assertThisInitialized(_this)));\n\n _this.setState(_objectSpread({}, animationHandlerResponse)); // If we have not moved, we should have an empty object returned\n // Return false to allow scrolling when not swiping\n\n\n return !!Object.keys(animationHandlerResponse).length;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"decrement\", function () {\n var positions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n _this.moveTo(_this.state.selectedItem - (typeof positions === 'number' ? positions : 1));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"increment\", function () {\n var positions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n\n _this.moveTo(_this.state.selectedItem + (typeof positions === 'number' ? positions : 1));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"moveTo\", function (position) {\n if (typeof position !== 'number') {\n return;\n }\n\n var lastPosition = _react.Children.count(_this.props.children) - 1;\n\n if (position < 0) {\n position = _this.props.infiniteLoop ? lastPosition : 0;\n }\n\n if (position > lastPosition) {\n position = _this.props.infiniteLoop ? 0 : lastPosition;\n }\n\n _this.selectItem({\n // if it's not a slider, we don't need to set position here\n selectedItem: position\n }); // don't reset auto play when stop on hover is enabled, doing so will trigger a call to auto play more than once\n // and will result in the interval function not being cleared correctly.\n\n\n if (_this.state.autoPlay && _this.state.isMouseEntered === false) {\n _this.resetAutoPlay();\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onClickNext\", function () {\n _this.increment(1);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onClickPrev\", function () {\n _this.decrement(1);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeForward\", function () {\n _this.increment(1);\n\n if (_this.props.emulateTouch) {\n _this.setState({\n cancelClick: true\n });\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeBackwards\", function () {\n _this.decrement(1);\n\n if (_this.props.emulateTouch) {\n _this.setState({\n cancelClick: true\n });\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"changeItem\", function (newIndex) {\n return function (e) {\n if (!(0, _utils.isKeyboardEvent)(e) || e.key === 'Enter') {\n _this.moveTo(newIndex);\n }\n };\n });\n\n _defineProperty(_assertThisInitialized(_this), \"selectItem\", function (state) {\n // Merge in the new state while updating updating previous item\n _this.setState(_objectSpread({\n previousItem: _this.state.selectedItem\n }, state), function () {\n // Run animation handler and update styles based on it\n _this.setState(_this.animationHandler(_this.props, _this.state));\n });\n\n _this.handleOnChange(state.selectedItem, _react.Children.toArray(_this.props.children)[state.selectedItem]);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"getInitialImage\", function () {\n var selectedItem = _this.props.selectedItem;\n var item = _this.itemsRef && _this.itemsRef[selectedItem];\n var images = item && item.getElementsByTagName('img') || [];\n return images[0];\n });\n\n _defineProperty(_assertThisInitialized(_this), \"getVariableItemHeight\", function (position) {\n var item = _this.itemsRef && _this.itemsRef[position];\n\n if (_this.state.hasMount && item && item.children.length) {\n var slideImages = item.children[0].getElementsByTagName('img') || [];\n\n if (slideImages.length > 0) {\n var image = slideImages[0];\n\n if (!image.complete) {\n // if the image is still loading, the size won't be available so we trigger a new render after it's done\n var onImageLoad = function onImageLoad() {\n _this.forceUpdate();\n\n image.removeEventListener('load', onImageLoad);\n };\n\n image.addEventListener('load', onImageLoad);\n }\n } // try to get img first, if img not there find first display tag\n\n\n var displayItem = slideImages[0] || item.children[0];\n var height = displayItem.clientHeight;\n return height > 0 ? height : null;\n }\n\n return null;\n });\n\n var initState = {\n initialized: false,\n previousItem: props.selectedItem,\n selectedItem: props.selectedItem,\n hasMount: false,\n isMouseEntered: false,\n autoPlay: props.autoPlay,\n swiping: false,\n swipeMovementStarted: false,\n cancelClick: false,\n itemSize: 1,\n itemListStyle: {},\n slideStyle: {},\n selectedStyle: {},\n prevStyle: {}\n };\n _this.animationHandler = typeof props.animationHandler === 'function' && props.animationHandler || props.animationHandler === 'fade' && _animations.fadeAnimationHandler || _animations.slideAnimationHandler;\n _this.state = _objectSpread(_objectSpread({}, initState), _this.animationHandler(props, initState));\n return _this;\n }\n\n _createClass(Carousel, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n if (!this.props.children) {\n return;\n }\n\n this.setupCarousel();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n if (!prevProps.children && this.props.children && !this.state.initialized) {\n this.setupCarousel();\n }\n\n if (!prevProps.autoFocus && this.props.autoFocus) {\n this.forceFocus();\n }\n\n if (prevState.swiping && !this.state.swiping) {\n // We stopped swiping, ensure we are heading to the new/current slide and not stuck\n this.setState(_objectSpread({}, this.props.stopSwipingHandler(this.props, this.state)));\n }\n\n if (prevProps.selectedItem !== this.props.selectedItem || prevProps.centerMode !== this.props.centerMode) {\n this.updateSizes();\n this.moveTo(this.props.selectedItem);\n }\n\n if (prevProps.autoPlay !== this.props.autoPlay) {\n if (this.props.autoPlay) {\n this.setupAutoPlay();\n } else {\n this.destroyAutoPlay();\n }\n\n this.setState({\n autoPlay: this.props.autoPlay\n });\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.destroyCarousel();\n }\n }, {\n key: \"setupCarousel\",\n value: function setupCarousel() {\n var _this2 = this;\n\n this.bindEvents();\n\n if (this.state.autoPlay && _react.Children.count(this.props.children) > 1) {\n this.setupAutoPlay();\n }\n\n if (this.props.autoFocus) {\n this.forceFocus();\n }\n\n this.setState({\n initialized: true\n }, function () {\n var initialImage = _this2.getInitialImage();\n\n if (initialImage && !initialImage.complete) {\n // if it's a carousel of images, we set the mount state after the first image is loaded\n initialImage.addEventListener('load', _this2.setMountState);\n } else {\n _this2.setMountState();\n }\n });\n }\n }, {\n key: \"destroyCarousel\",\n value: function destroyCarousel() {\n if (this.state.initialized) {\n this.unbindEvents();\n this.destroyAutoPlay();\n }\n }\n }, {\n key: \"setupAutoPlay\",\n value: function setupAutoPlay() {\n this.autoPlay();\n var carouselWrapper = this.carouselWrapperRef;\n\n if (this.props.stopOnHover && carouselWrapper) {\n carouselWrapper.addEventListener('mouseenter', this.stopOnHover);\n carouselWrapper.addEventListener('mouseleave', this.startOnLeave);\n }\n }\n }, {\n key: \"destroyAutoPlay\",\n value: function destroyAutoPlay() {\n this.clearAutoPlay();\n var carouselWrapper = this.carouselWrapperRef;\n\n if (this.props.stopOnHover && carouselWrapper) {\n carouselWrapper.removeEventListener('mouseenter', this.stopOnHover);\n carouselWrapper.removeEventListener('mouseleave', this.startOnLeave);\n }\n }\n }, {\n key: \"bindEvents\",\n value: function bindEvents() {\n // as the widths are calculated, we need to resize\n // the carousel when the window is resized\n (0, _window.default)().addEventListener('resize', this.updateSizes); // issue #2 - image loading smaller\n\n (0, _window.default)().addEventListener('DOMContentLoaded', this.updateSizes);\n\n if (this.props.useKeyboardArrows) {\n (0, _document.default)().addEventListener('keydown', this.navigateWithKeyboard);\n }\n }\n }, {\n key: \"unbindEvents\",\n value: function unbindEvents() {\n // removing listeners\n (0, _window.default)().removeEventListener('resize', this.updateSizes);\n (0, _window.default)().removeEventListener('DOMContentLoaded', this.updateSizes);\n var initialImage = this.getInitialImage();\n\n if (initialImage) {\n initialImage.removeEventListener('load', this.setMountState);\n }\n\n if (this.props.useKeyboardArrows) {\n (0, _document.default)().removeEventListener('keydown', this.navigateWithKeyboard);\n }\n }\n }, {\n key: \"forceFocus\",\n value: function forceFocus() {\n var _this$carouselWrapper;\n\n (_this$carouselWrapper = this.carouselWrapperRef) === null || _this$carouselWrapper === void 0 ? void 0 : _this$carouselWrapper.focus();\n }\n }, {\n key: \"renderItems\",\n value: function renderItems(isClone) {\n var _this3 = this;\n\n if (!this.props.children) {\n return [];\n }\n\n return _react.Children.map(this.props.children, function (item, index) {\n var isSelected = index === _this3.state.selectedItem;\n var isPrevious = index === _this3.state.previousItem;\n var style = isSelected && _this3.state.selectedStyle || isPrevious && _this3.state.prevStyle || _this3.state.slideStyle || {};\n\n if (_this3.props.centerMode && _this3.props.axis === 'horizontal') {\n style = _objectSpread(_objectSpread({}, style), {}, {\n minWidth: _this3.props.centerSlidePercentage + '%'\n });\n }\n\n if (_this3.state.swiping && _this3.state.swipeMovementStarted) {\n style = _objectSpread(_objectSpread({}, style), {}, {\n pointerEvents: 'none'\n });\n }\n\n var slideProps = {\n ref: function ref(e) {\n return _this3.setItemsRef(e, index);\n },\n key: 'itemKey' + index + (isClone ? 'clone' : ''),\n className: _cssClasses.default.ITEM(true, index === _this3.state.selectedItem, index === _this3.state.previousItem),\n onClick: _this3.handleClickItem.bind(_this3, index, item),\n style: style\n };\n return /*#__PURE__*/_react.default.createElement(\"li\", slideProps, _this3.props.renderItem(item, {\n isSelected: index === _this3.state.selectedItem,\n isPrevious: index === _this3.state.previousItem\n }));\n });\n }\n }, {\n key: \"renderControls\",\n value: function renderControls() {\n var _this4 = this;\n\n var _this$props = this.props,\n showIndicators = _this$props.showIndicators,\n labels = _this$props.labels,\n renderIndicator = _this$props.renderIndicator,\n children = _this$props.children;\n\n if (!showIndicators) {\n return null;\n }\n\n return /*#__PURE__*/_react.default.createElement(\"ul\", {\n className: \"control-dots\"\n }, _react.Children.map(children, function (_, index) {\n return renderIndicator && renderIndicator(_this4.changeItem(index), index === _this4.state.selectedItem, index, labels.item);\n }));\n }\n }, {\n key: \"renderStatus\",\n value: function renderStatus() {\n if (!this.props.showStatus) {\n return null;\n }\n\n return /*#__PURE__*/_react.default.createElement(\"p\", {\n className: \"carousel-status\"\n }, this.props.statusFormatter(this.state.selectedItem + 1, _react.Children.count(this.props.children)));\n }\n }, {\n key: \"renderThumbs\",\n value: function renderThumbs() {\n if (!this.props.showThumbs || !this.props.children || _react.Children.count(this.props.children) === 0) {\n return null;\n }\n\n return /*#__PURE__*/_react.default.createElement(_Thumbs.default, {\n ref: this.setThumbsRef,\n onSelectItem: this.handleClickThumb,\n selectedItem: this.state.selectedItem,\n transitionTime: this.props.transitionTime,\n thumbWidth: this.props.thumbWidth,\n labels: this.props.labels,\n emulateTouch: this.props.emulateTouch\n }, this.props.renderThumbs(this.props.children));\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this5 = this;\n\n if (!this.props.children || _react.Children.count(this.props.children) === 0) {\n return null;\n }\n\n var isSwipeable = this.props.swipeable && _react.Children.count(this.props.children) > 1;\n var isHorizontal = this.props.axis === 'horizontal';\n var canShowArrows = this.props.showArrows && _react.Children.count(this.props.children) > 1; // show left arrow?\n\n var hasPrev = canShowArrows && (this.state.selectedItem > 0 || this.props.infiniteLoop) || false; // show right arrow\n\n var hasNext = canShowArrows && (this.state.selectedItem < _react.Children.count(this.props.children) - 1 || this.props.infiniteLoop) || false;\n var itemsClone = this.renderItems(true);\n var firstClone = itemsClone.shift();\n var lastClone = itemsClone.pop();\n var swiperProps = {\n className: _cssClasses.default.SLIDER(true, this.state.swiping),\n onSwipeMove: this.onSwipeMove,\n onSwipeStart: this.onSwipeStart,\n onSwipeEnd: this.onSwipeEnd,\n style: this.state.itemListStyle,\n tolerance: this.props.swipeScrollTolerance\n };\n var containerStyles = {};\n\n if (isHorizontal) {\n swiperProps.onSwipeLeft = this.onSwipeForward;\n swiperProps.onSwipeRight = this.onSwipeBackwards;\n\n if (this.props.dynamicHeight) {\n var itemHeight = this.getVariableItemHeight(this.state.selectedItem); // swiperProps.style.height = itemHeight || 'auto';\n\n containerStyles.height = itemHeight || 'auto';\n }\n } else {\n swiperProps.onSwipeUp = this.props.verticalSwipe === 'natural' ? this.onSwipeBackwards : this.onSwipeForward;\n swiperProps.onSwipeDown = this.props.verticalSwipe === 'natural' ? this.onSwipeForward : this.onSwipeBackwards;\n swiperProps.style = _objectSpread(_objectSpread({}, swiperProps.style), {}, {\n height: this.state.itemSize\n });\n containerStyles.height = this.state.itemSize;\n }\n\n return /*#__PURE__*/_react.default.createElement(\"div\", {\n \"aria-label\": this.props.ariaLabel,\n className: _cssClasses.default.ROOT(this.props.className),\n ref: this.setCarouselWrapperRef,\n tabIndex: this.props.useKeyboardArrows ? 0 : undefined\n }, /*#__PURE__*/_react.default.createElement(\"div\", {\n className: _cssClasses.default.CAROUSEL(true),\n style: {\n width: this.props.width\n }\n }, this.renderControls(), this.props.renderArrowPrev(this.onClickPrev, hasPrev, this.props.labels.leftArrow), /*#__PURE__*/_react.default.createElement(\"div\", {\n className: _cssClasses.default.WRAPPER(true, this.props.axis),\n style: containerStyles\n }, isSwipeable ? /*#__PURE__*/_react.default.createElement(_reactEasySwipe.default, _extends({\n tagName: \"ul\",\n innerRef: this.setListRef\n }, swiperProps, {\n allowMouseEvents: this.props.emulateTouch\n }), this.props.infiniteLoop && lastClone, this.renderItems(), this.props.infiniteLoop && firstClone) : /*#__PURE__*/_react.default.createElement(\"ul\", {\n className: _cssClasses.default.SLIDER(true, this.state.swiping),\n ref: function ref(node) {\n return _this5.setListRef(node);\n },\n style: this.state.itemListStyle || {}\n }, this.props.infiniteLoop && lastClone, this.renderItems(), this.props.infiniteLoop && firstClone)), this.props.renderArrowNext(this.onClickNext, hasNext, this.props.labels.rightArrow), this.renderStatus()), this.renderThumbs());\n }\n }]);\n\n return Carousel;\n}(_react.default.Component);\n\nexports.default = Carousel;\n\n_defineProperty(Carousel, \"displayName\", 'Carousel');\n\n_defineProperty(Carousel, \"defaultProps\", {\n ariaLabel: undefined,\n axis: 'horizontal',\n centerSlidePercentage: 80,\n interval: 3000,\n labels: {\n leftArrow: 'previous slide / item',\n rightArrow: 'next slide / item',\n item: 'slide item'\n },\n onClickItem: _utils.noop,\n onClickThumb: _utils.noop,\n onChange: _utils.noop,\n onSwipeStart: function onSwipeStart() {},\n onSwipeEnd: function onSwipeEnd() {},\n onSwipeMove: function onSwipeMove() {\n return false;\n },\n preventMovementUntilSwipeScrollTolerance: false,\n renderArrowPrev: function renderArrowPrev(onClickHandler, hasPrev, label) {\n return /*#__PURE__*/_react.default.createElement(\"button\", {\n type: \"button\",\n \"aria-label\": label,\n className: _cssClasses.default.ARROW_PREV(!hasPrev),\n onClick: onClickHandler\n });\n },\n renderArrowNext: function renderArrowNext(onClickHandler, hasNext, label) {\n return /*#__PURE__*/_react.default.createElement(\"button\", {\n type: \"button\",\n \"aria-label\": label,\n className: _cssClasses.default.ARROW_NEXT(!hasNext),\n onClick: onClickHandler\n });\n },\n renderIndicator: function renderIndicator(onClickHandler, isSelected, index, label) {\n return /*#__PURE__*/_react.default.createElement(\"li\", {\n className: _cssClasses.default.DOT(isSelected),\n onClick: onClickHandler,\n onKeyDown: onClickHandler,\n value: index,\n key: index,\n role: \"button\",\n tabIndex: 0,\n \"aria-label\": \"\".concat(label, \" \").concat(index + 1)\n });\n },\n renderItem: function renderItem(item) {\n return item;\n },\n renderThumbs: function renderThumbs(children) {\n var images = _react.Children.map(children, function (item) {\n var img = item; // if the item is not an image, try to find the first image in the item's children.\n\n if (item.type !== 'img') {\n img = _react.Children.toArray(item.props.children).find(function (children) {\n return children.type === 'img';\n });\n }\n\n if (!img) {\n return undefined;\n }\n\n return img;\n });\n\n if (images.filter(function (image) {\n return image;\n }).length === 0) {\n console.warn(\"No images found! Can't build the thumb list without images. If you don't need thumbs, set showThumbs={false} in the Carousel. Note that it's not possible to get images rendered inside custom components. More info at https://github.com/leandrowd/react-responsive-carousel/blob/master/TROUBLESHOOTING.md\");\n return [];\n }\n\n return images;\n },\n statusFormatter: _utils.defaultStatusFormatter,\n selectedItem: 0,\n showArrows: true,\n showIndicators: true,\n showStatus: true,\n showThumbs: true,\n stopOnHover: true,\n swipeScrollTolerance: 5,\n swipeable: true,\n transitionTime: 350,\n verticalSwipe: 'standard',\n width: '100%',\n animationHandler: 'slide',\n swipeAnimationHandler: _animations.slideSwipeAnimationHandler,\n stopSwipingHandler: _animations.slideStopSwipingHandler\n});","\"use strict\";","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.setPosition = exports.getPosition = exports.isKeyboardEvent = exports.defaultStatusFormatter = exports.noop = void 0;\n\nvar _react = require(\"react\");\n\nvar _CSSTranslate = _interopRequireDefault(require(\"../../CSSTranslate\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar noop = function noop() {};\n\nexports.noop = noop;\n\nvar defaultStatusFormatter = function defaultStatusFormatter(current, total) {\n return \"\".concat(current, \" of \").concat(total);\n};\n\nexports.defaultStatusFormatter = defaultStatusFormatter;\n\nvar isKeyboardEvent = function isKeyboardEvent(e) {\n return e ? e.hasOwnProperty('key') : false;\n};\n/**\n * Gets the list 'position' relative to a current index\n * @param index\n */\n\n\nexports.isKeyboardEvent = isKeyboardEvent;\n\nvar getPosition = function getPosition(index, props) {\n if (props.infiniteLoop) {\n // index has to be added by 1 because of the first cloned slide\n ++index;\n }\n\n if (index === 0) {\n return 0;\n }\n\n var childrenLength = _react.Children.count(props.children);\n\n if (props.centerMode && props.axis === 'horizontal') {\n var currentPosition = -index * props.centerSlidePercentage;\n var lastPosition = childrenLength - 1;\n\n if (index && (index !== lastPosition || props.infiniteLoop)) {\n currentPosition += (100 - props.centerSlidePercentage) / 2;\n } else if (index === lastPosition) {\n currentPosition += 100 - props.centerSlidePercentage;\n }\n\n return currentPosition;\n }\n\n return -index * 100;\n};\n/**\n * Sets the 'position' transform for sliding animations\n * @param position\n * @param forceReflow\n */\n\n\nexports.getPosition = getPosition;\n\nvar setPosition = function setPosition(position, axis) {\n var style = {};\n ['WebkitTransform', 'MozTransform', 'MsTransform', 'OTransform', 'transform', 'msTransform'].forEach(function (prop) {\n // @ts-ignore\n style[prop] = (0, _CSSTranslate.default)(position, '%', axis);\n });\n return style;\n};\n\nexports.setPosition = setPosition;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _react = _interopRequireWildcard(require(\"react\"));\n\nvar _cssClasses = _interopRequireDefault(require(\"../cssClasses\"));\n\nvar _dimensions = require(\"../dimensions\");\n\nvar _CSSTranslate = _interopRequireDefault(require(\"../CSSTranslate\"));\n\nvar _reactEasySwipe = _interopRequireDefault(require(\"react-easy-swipe\"));\n\nvar _window = _interopRequireDefault(require(\"../shims/window\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _getRequireWildcardCache() { if (typeof WeakMap !== \"function\") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar isKeyboardEvent = function isKeyboardEvent(e) {\n return e.hasOwnProperty('key');\n};\n\nvar Thumbs = /*#__PURE__*/function (_Component) {\n _inherits(Thumbs, _Component);\n\n var _super = _createSuper(Thumbs);\n\n function Thumbs(_props) {\n var _this;\n\n _classCallCheck(this, Thumbs);\n\n _this = _super.call(this, _props);\n\n _defineProperty(_assertThisInitialized(_this), \"itemsWrapperRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"itemsListRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"thumbsRef\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"setItemsWrapperRef\", function (node) {\n _this.itemsWrapperRef = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setItemsListRef\", function (node) {\n _this.itemsListRef = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"setThumbsRef\", function (node, index) {\n if (!_this.thumbsRef) {\n _this.thumbsRef = [];\n }\n\n _this.thumbsRef[index] = node;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"updateSizes\", function () {\n if (!_this.props.children || !_this.itemsWrapperRef || !_this.thumbsRef) {\n return;\n }\n\n var total = _react.Children.count(_this.props.children);\n\n var wrapperSize = _this.itemsWrapperRef.clientWidth;\n var itemSize = _this.props.thumbWidth ? _this.props.thumbWidth : (0, _dimensions.outerWidth)(_this.thumbsRef[0]);\n var visibleItems = Math.floor(wrapperSize / itemSize);\n var showArrows = visibleItems < total;\n var lastPosition = showArrows ? total - visibleItems : 0;\n\n _this.setState(function (_state, props) {\n return {\n itemSize: itemSize,\n visibleItems: visibleItems,\n firstItem: showArrows ? _this.getFirstItem(props.selectedItem) : 0,\n lastPosition: lastPosition,\n showArrows: showArrows\n };\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"handleClickItem\", function (index, item, e) {\n if (!isKeyboardEvent(e) || e.key === 'Enter') {\n var handler = _this.props.onSelectItem;\n\n if (typeof handler === 'function') {\n handler(index, item);\n }\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeStart\", function () {\n _this.setState({\n swiping: true\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeEnd\", function () {\n _this.setState({\n swiping: false\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onSwipeMove\", function (delta) {\n var deltaX = delta.x;\n\n if (!_this.state.itemSize || !_this.itemsWrapperRef || !_this.state.visibleItems) {\n return false;\n }\n\n var leftBoundary = 0;\n\n var childrenLength = _react.Children.count(_this.props.children);\n\n var currentPosition = -(_this.state.firstItem * 100) / _this.state.visibleItems;\n var lastLeftItem = Math.max(childrenLength - _this.state.visibleItems, 0);\n var lastLeftBoundary = -lastLeftItem * 100 / _this.state.visibleItems; // prevent user from swiping left out of boundaries\n\n if (currentPosition === leftBoundary && deltaX > 0) {\n deltaX = 0;\n } // prevent user from swiping right out of boundaries\n\n\n if (currentPosition === lastLeftBoundary && deltaX < 0) {\n deltaX = 0;\n }\n\n var wrapperSize = _this.itemsWrapperRef.clientWidth;\n var position = currentPosition + 100 / (wrapperSize / deltaX); // if 3d isn't available we will use left to move\n\n if (_this.itemsListRef) {\n ['WebkitTransform', 'MozTransform', 'MsTransform', 'OTransform', 'transform', 'msTransform'].forEach(function (prop) {\n _this.itemsListRef.style[prop] = (0, _CSSTranslate.default)(position, '%', _this.props.axis);\n });\n }\n\n return true;\n });\n\n _defineProperty(_assertThisInitialized(_this), \"slideRight\", function (positions) {\n _this.moveTo(_this.state.firstItem - (typeof positions === 'number' ? positions : 1));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"slideLeft\", function (positions) {\n _this.moveTo(_this.state.firstItem + (typeof positions === 'number' ? positions : 1));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"moveTo\", function (position) {\n // position can't be lower than 0\n position = position < 0 ? 0 : position; // position can't be higher than last postion\n\n position = position >= _this.state.lastPosition ? _this.state.lastPosition : position;\n\n _this.setState({\n firstItem: position\n });\n });\n\n _this.state = {\n selectedItem: _props.selectedItem,\n swiping: false,\n showArrows: false,\n firstItem: 0,\n visibleItems: 0,\n lastPosition: 0\n };\n return _this;\n }\n\n _createClass(Thumbs, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.setupThumbs();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (this.props.selectedItem !== this.state.selectedItem) {\n this.setState({\n selectedItem: this.props.selectedItem,\n firstItem: this.getFirstItem(this.props.selectedItem)\n });\n }\n\n if (this.props.children === prevProps.children) {\n return;\n } // This will capture any size changes for arrow adjustments etc.\n // usually in the same render cycle so we don't see any flickers\n\n\n this.updateSizes();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.destroyThumbs();\n }\n }, {\n key: \"setupThumbs\",\n value: function setupThumbs() {\n // as the widths are calculated, we need to resize\n // the carousel when the window is resized\n (0, _window.default)().addEventListener('resize', this.updateSizes); // issue #2 - image loading smaller\n\n (0, _window.default)().addEventListener('DOMContentLoaded', this.updateSizes); // when the component is rendered we need to calculate\n // the container size to adjust the responsive behaviour\n\n this.updateSizes();\n }\n }, {\n key: \"destroyThumbs\",\n value: function destroyThumbs() {\n // removing listeners\n (0, _window.default)().removeEventListener('resize', this.updateSizes);\n (0, _window.default)().removeEventListener('DOMContentLoaded', this.updateSizes);\n }\n }, {\n key: \"getFirstItem\",\n value: function getFirstItem(selectedItem) {\n var firstItem = selectedItem;\n\n if (selectedItem >= this.state.lastPosition) {\n firstItem = this.state.lastPosition;\n }\n\n if (selectedItem < this.state.firstItem + this.state.visibleItems) {\n firstItem = this.state.firstItem;\n }\n\n if (selectedItem < this.state.firstItem) {\n firstItem = selectedItem;\n }\n\n return firstItem;\n }\n }, {\n key: \"renderItems\",\n value: function renderItems() {\n var _this2 = this;\n\n return this.props.children.map(function (img, index) {\n var itemClass = _cssClasses.default.ITEM(false, index === _this2.state.selectedItem);\n\n var thumbProps = {\n key: index,\n ref: function ref(e) {\n return _this2.setThumbsRef(e, index);\n },\n className: itemClass,\n onClick: _this2.handleClickItem.bind(_this2, index, _this2.props.children[index]),\n onKeyDown: _this2.handleClickItem.bind(_this2, index, _this2.props.children[index]),\n 'aria-label': \"\".concat(_this2.props.labels.item, \" \").concat(index + 1),\n style: {\n width: _this2.props.thumbWidth\n }\n };\n return /*#__PURE__*/_react.default.createElement(\"li\", _extends({}, thumbProps, {\n role: \"button\",\n tabIndex: 0\n }), img);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n if (!this.props.children) {\n return null;\n }\n\n var isSwipeable = _react.Children.count(this.props.children) > 1; // show left arrow?\n\n var hasPrev = this.state.showArrows && this.state.firstItem > 0; // show right arrow\n\n var hasNext = this.state.showArrows && this.state.firstItem < this.state.lastPosition; // obj to hold the transformations and styles\n\n var itemListStyles = {};\n var currentPosition = -this.state.firstItem * (this.state.itemSize || 0);\n var transformProp = (0, _CSSTranslate.default)(currentPosition, 'px', this.props.axis);\n var transitionTime = this.props.transitionTime + 'ms';\n itemListStyles = {\n WebkitTransform: transformProp,\n MozTransform: transformProp,\n MsTransform: transformProp,\n OTransform: transformProp,\n transform: transformProp,\n msTransform: transformProp,\n WebkitTransitionDuration: transitionTime,\n MozTransitionDuration: transitionTime,\n MsTransitionDuration: transitionTime,\n OTransitionDuration: transitionTime,\n transitionDuration: transitionTime,\n msTransitionDuration: transitionTime\n };\n return /*#__PURE__*/_react.default.createElement(\"div\", {\n className: _cssClasses.default.CAROUSEL(false)\n }, /*#__PURE__*/_react.default.createElement(\"div\", {\n className: _cssClasses.default.WRAPPER(false),\n ref: this.setItemsWrapperRef\n }, /*#__PURE__*/_react.default.createElement(\"button\", {\n type: \"button\",\n className: _cssClasses.default.ARROW_PREV(!hasPrev),\n onClick: function onClick() {\n return _this3.slideRight();\n },\n \"aria-label\": this.props.labels.leftArrow\n }), isSwipeable ? /*#__PURE__*/_react.default.createElement(_reactEasySwipe.default, {\n tagName: \"ul\",\n className: _cssClasses.default.SLIDER(false, this.state.swiping),\n onSwipeLeft: this.slideLeft,\n onSwipeRight: this.slideRight,\n onSwipeMove: this.onSwipeMove,\n onSwipeStart: this.onSwipeStart,\n onSwipeEnd: this.onSwipeEnd,\n style: itemListStyles,\n innerRef: this.setItemsListRef,\n allowMouseEvents: this.props.emulateTouch\n }, this.renderItems()) : /*#__PURE__*/_react.default.createElement(\"ul\", {\n className: _cssClasses.default.SLIDER(false, this.state.swiping),\n ref: function ref(node) {\n return _this3.setItemsListRef(node);\n },\n style: itemListStyles\n }, this.renderItems()), /*#__PURE__*/_react.default.createElement(\"button\", {\n type: \"button\",\n className: _cssClasses.default.ARROW_NEXT(!hasNext),\n onClick: function onClick() {\n return _this3.slideLeft();\n },\n \"aria-label\": this.props.labels.rightArrow\n })));\n }\n }]);\n\n return Thumbs;\n}(_react.Component);\n\nexports.default = Thumbs;\n\n_defineProperty(Thumbs, \"displayName\", 'Thumbs');\n\n_defineProperty(Thumbs, \"defaultProps\", {\n axis: 'horizontal',\n labels: {\n leftArrow: 'previous slide / item',\n rightArrow: 'next slide / item',\n item: 'slide item'\n },\n selectedItem: 0,\n thumbWidth: 80,\n transitionTime: 350\n});","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _classnames = _interopRequireDefault(require(\"classnames\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar _default = {\n ROOT: function ROOT(customClassName) {\n return (0, _classnames.default)(_defineProperty({\n 'carousel-root': true\n }, customClassName || '', !!customClassName));\n },\n CAROUSEL: function CAROUSEL(isSlider) {\n return (0, _classnames.default)({\n carousel: true,\n 'carousel-slider': isSlider\n });\n },\n WRAPPER: function WRAPPER(isSlider, axis) {\n return (0, _classnames.default)({\n 'thumbs-wrapper': !isSlider,\n 'slider-wrapper': isSlider,\n 'axis-horizontal': axis === 'horizontal',\n 'axis-vertical': axis !== 'horizontal'\n });\n },\n SLIDER: function SLIDER(isSlider, isSwiping) {\n return (0, _classnames.default)({\n thumbs: !isSlider,\n slider: isSlider,\n animated: !isSwiping\n });\n },\n ITEM: function ITEM(isSlider, selected, previous) {\n return (0, _classnames.default)({\n thumb: !isSlider,\n slide: isSlider,\n selected: selected,\n previous: previous\n });\n },\n ARROW_PREV: function ARROW_PREV(disabled) {\n return (0, _classnames.default)({\n 'control-arrow control-prev': true,\n 'control-disabled': disabled\n });\n },\n ARROW_NEXT: function ARROW_NEXT(disabled) {\n return (0, _classnames.default)({\n 'control-arrow control-next': true,\n 'control-disabled': disabled\n });\n },\n DOT: function DOT(selected) {\n return (0, _classnames.default)({\n dot: true,\n selected: selected\n });\n }\n};\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.outerWidth = void 0;\n\nvar outerWidth = function outerWidth(el) {\n var width = el.offsetWidth;\n var style = getComputedStyle(el);\n width += parseInt(style.marginLeft) + parseInt(style.marginRight);\n return width;\n};\n\nexports.outerWidth = outerWidth;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"Carousel\", {\n enumerable: true,\n get: function get() {\n return _Carousel.default;\n }\n});\nObject.defineProperty(exports, \"CarouselProps\", {\n enumerable: true,\n get: function get() {\n return _types.CarouselProps;\n }\n});\nObject.defineProperty(exports, \"Thumbs\", {\n enumerable: true,\n get: function get() {\n return _Thumbs.default;\n }\n});\n\nvar _Carousel = _interopRequireDefault(require(\"./components/Carousel\"));\n\nvar _types = require(\"./components/Carousel/types\");\n\nvar _Thumbs = _interopRequireDefault(require(\"./components/Thumbs\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _default = function _default() {\n return document;\n};\n\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _default = function _default() {\n return window;\n};\n\nexports.default = _default;","/**\n * @remix-run/router v1.12.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, index];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(branches[i],\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n safelyDecodeURI(pathname));\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:\\w+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname) {\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n if (!match) return null;\n Object.assign(matchedParams, match.params);\n let route = meta.route;\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:(\\w+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = safelyDecodeURIComponent(value || \"\", paramName);\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:(\\w+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction safelyDecodeURI(value) {\n try {\n return decodeURI(value);\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\nfunction safelyDecodeURIComponent(value, paramName) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(false, \"The value for the URL param \\\"\" + paramName + \"\\\" will not be decoded because\" + (\" the string \\\"\" + value + \"\\\" is a malformed URL segment. This is probably\") + (\" due to a bad percent encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else if (isPathRelative) {\n let fromSegments = routePathnames[routePathnames.length - 1].replace(/^\\//, \"\").split(\"/\");\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n // With relative=\"path\", each leading .. segment means \"go up one URL segment\"\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n fromSegments.pop();\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = \"/\" + fromSegments.join(\"/\");\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n // If there are more \"..\" segments than parent routes, resolve relative to\n // the root / URL.\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_prependBasename: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialErrors = null;\n if (initialMatches == null) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n let initialized =\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n !initialMatches.some(m => m.route.lazy) && (\n // And we have to either have no loaders or have been provided hydrationData\n !initialMatches.some(m => m.route.loader) || init.hydrationData != null);\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = [];\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let ignoreNextHistoryUpdate = false;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n ignoreNextHistoryUpdate = true;\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked\n init.history.go(delta);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location);\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n unstable_viewTransitionOpts: opts.viewTransitionOpts,\n unstable_flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n cancelledFetcherLoads = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.unstable_flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.unstable_viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial load will always\n // be \"same hash\". For example, on /page#hash and submit a