diff --git a/2/ecolyo.9a0bc227ec1e2cf910ed.js b/2/ecolyo.defa0df2dbc2718eb0b7.js similarity index 99% rename from 2/ecolyo.9a0bc227ec1e2cf910ed.js rename to 2/ecolyo.defa0df2dbc2718eb0b7.js index 7c2f4c3f4c2078e05c2f5bb48a516e5424689216..ecd3e07e428f812bd91c5132a40ca4da32f080bc 100644 --- a/2/ecolyo.9a0bc227ec1e2cf910ed.js +++ b/2/ecolyo.defa0df2dbc2718eb0b7.js @@ -123,7 +123,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _profileType = _interopRequireDefault(__webpack_require__("7e12")); @@ -1078,7 +1078,7 @@ var _usageEvent = __webpack_require__("/fHX"); var _luxon = __webpack_require__("ExVU"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _usageEvent2 = _interopRequireDefault(__webpack_require__("dECN")); @@ -2425,7 +2425,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireDefault(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("7ttY"); diff --git a/3/ecolyo.81b21fb81dc9384b8b8f.js b/3/ecolyo.a2e7ed5645b9d29e5e34.js similarity index 99% rename from 3/ecolyo.81b21fb81dc9384b8b8f.js rename to 3/ecolyo.a2e7ed5645b9d29e5e34.js index efc1c98309b572e4e4a0413edbb37ecabbe48972..02b9a4ac47162cf6ff861aad8704e94de68bba93 100644 --- a/3/ecolyo.81b21fb81dc9384b8b8f.js +++ b/3/ecolyo.a2e7ed5645b9d29e5e34.js @@ -847,7 +847,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _global = __webpack_require__("c4IZ"); @@ -1200,7 +1200,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _profile = _interopRequireDefault(__webpack_require__("2l2O")); @@ -3562,7 +3562,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _classnames = _interopRequireDefault(__webpack_require__("TSYQ")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _cozyClient = __webpack_require__("SH7X"); @@ -4016,7 +4016,7 @@ var _konnectorError = __webpack_require__("fdru"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _account = _interopRequireDefault(__webpack_require__("gucQ")); @@ -4354,7 +4354,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _picto = __webpack_require__("6DBe"); @@ -5875,7 +5875,7 @@ var _usageEvent = __webpack_require__("/fHX"); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _dateChart = _interopRequireDefault(__webpack_require__("Ty7+")); @@ -6642,7 +6642,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _global = __webpack_require__("c4IZ"); diff --git a/4/ecolyo.8d9d45d9f90c6d0d5b51.js b/4/ecolyo.d05d0a9cb3d37a7adbf7.js similarity index 99% rename from 4/ecolyo.8d9d45d9f90c6d0d5b51.js rename to 4/ecolyo.d05d0a9cb3d37a7adbf7.js index 456a8d7b42f012dc4d815162515f2f64f26fe614..704656ace3eb7644b586af634feb56ca64a98c4e 100644 --- a/4/ecolyo.8d9d45d9f90c6d0d5b51.js +++ b/4/ecolyo.d05d0a9cb3d37a7adbf7.js @@ -47,7 +47,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _ecogesture2 = _interopRequireDefault(__webpack_require__("w4u3")); @@ -711,7 +711,7 @@ var _StyledIcon = _interopRequireDefault(__webpack_require__("I07j")); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _utils = __webpack_require__("c+yx"); @@ -910,7 +910,7 @@ var _ecogesture = __webpack_require__("SpsK"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("Tmyz"); @@ -1324,7 +1324,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireDefault(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("Pw+N"); diff --git a/6/ecolyo.4ac17254a40ee0369074.js b/6/ecolyo.9ae968abed72f68c92f4.js similarity index 99% rename from 6/ecolyo.4ac17254a40ee0369074.js rename to 6/ecolyo.9ae968abed72f68c92f4.js index e26b1337804864f5533747e7cbb426fea4ab361e..a24ecbcdb76799d2d674442104f680895312ffd0 100644 --- a/6/ecolyo.4ac17254a40ee0369074.js +++ b/6/ecolyo.9ae968abed72f68c92f4.js @@ -298,7 +298,7 @@ var _Icon = _interopRequireDefault(__webpack_require__("y6ex")); var _userExploration = __webpack_require__("/rev"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -517,7 +517,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireDefault(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("xZ9X"); @@ -1562,7 +1562,7 @@ var _usageEvent = __webpack_require__("/fHX"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _usageEvent2 = _interopRequireDefault(__webpack_require__("dECN")); diff --git a/8/ecolyo.3948d4a9669a335f3bc3.js b/8/ecolyo.177040fdffb0b92f3d5d.js similarity index 99% rename from 8/ecolyo.3948d4a9669a335f3bc3.js rename to 8/ecolyo.177040fdffb0b92f3d5d.js index fc314b407ca8b94bb6df27fd81e76cd8824154ca..bf3b2c786dcca0504c9f3fc5135d443bf99dd6e4 100644 --- a/8/ecolyo.3948d4a9669a335f3bc3.js +++ b/8/ecolyo.177040fdffb0b92f3d5d.js @@ -59,7 +59,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _ecogesture = _interopRequireDefault(__webpack_require__("w4u3")); @@ -518,7 +518,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("nJi4"); diff --git a/app/ecolyo.abc18aebd48b3e1ab8ee.js b/app/ecolyo.6102bc1a381cd3f616ef.js similarity index 99% rename from app/ecolyo.abc18aebd48b3e1ab8ee.js rename to app/ecolyo.6102bc1a381cd3f616ef.js index 58d4705946d8c2bb1a9186bc017d92477a026411..c15da4aa866241813c9a52e14c9d27184b84559e 100644 --- a/app/ecolyo.abc18aebd48b3e1ab8ee.js +++ b/app/ecolyo.6102bc1a381cd3f616ef.js @@ -64,7 +64,7 @@ /******/ /******/ // script path function /******/ function jsonpScriptSrc(chunkId) { -/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "/ecolyo." + {"2":"9a0bc227ec1e2cf910ed","3":"81b21fb81dc9384b8b8f","4":"8d9d45d9f90c6d0d5b51","5":"3a48b3c8783b8b429d7f","6":"4ac17254a40ee0369074","7":"403585665c5e67c3d156","8":"3948d4a9669a335f3bc3","9":"9ad8f654859d6a5af353"}[chunkId] + ".js" +/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "/ecolyo." + {"2":"defa0df2dbc2718eb0b7","3":"a2e7ed5645b9d29e5e34","4":"d05d0a9cb3d37a7adbf7","5":"3a48b3c8783b8b429d7f","6":"9ae968abed72f68c92f4","7":"403585665c5e67c3d156","8":"177040fdffb0b92f3d5d","9":"9ad8f654859d6a5af353"}[chunkId] + ".js" /******/ } /******/ /******/ // The require function @@ -614,7 +614,7 @@ var _I18n = __webpack_require__("buk/"); var _doctypes = _interopRequireDefault(__webpack_require__("D2hQ")); -var _history = __webpack_require__("LhCv"); +var _history = __webpack_require__("JRJN"); var _lodash = __webpack_require__("LvDl"); @@ -624,7 +624,7 @@ var _reactDom = __webpack_require__("i8i4"); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _environment = _interopRequireDefault(__webpack_require__("X6DI")); @@ -2231,7 +2231,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _profile = __webpack_require__("jPH6"); @@ -2479,7 +2479,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("ZkBf"); @@ -5330,7 +5330,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _challenge = _interopRequireDefault(__webpack_require__("kdea")); @@ -8097,7 +8097,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _DuelEmptyValueModal = _interopRequireDefault(__webpack_require__("upmN")); @@ -10130,7 +10130,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _modal = __webpack_require__("lSJB"); @@ -12196,7 +12196,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("IzCH"); @@ -12271,7 +12271,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _quiz = _interopRequireDefault(__webpack_require__("CUhI")); @@ -12696,7 +12696,7 @@ var _userChallenge2 = __webpack_require__("dQx6"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _utils = __webpack_require__("c+yx"); @@ -13151,7 +13151,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _challenge = _interopRequireDefault(__webpack_require__("kdea")); @@ -13741,7 +13741,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _profile = __webpack_require__("jPH6"); @@ -14042,7 +14042,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _terms = _interopRequireDefault(__webpack_require__("wPjT")); @@ -14778,7 +14778,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _ecogesture = _interopRequireDefault(__webpack_require__("w4u3")); @@ -16075,7 +16075,7 @@ var _profileType = __webpack_require__("D9qV"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -16164,7 +16164,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("k45u"); @@ -16870,7 +16870,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _challenge = _interopRequireDefault(__webpack_require__("kdea")); @@ -24418,7 +24418,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _profileEcogestureForm = _interopRequireDefault(__webpack_require__("QCFg")); @@ -25098,7 +25098,7 @@ var _react2 = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _profileType = _interopRequireDefault(__webpack_require__("7e12")); @@ -25879,7 +25879,7 @@ var _Icon = _interopRequireDefault(__webpack_require__("y6ex")); var _screen = __webpack_require__("41Xj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -26065,7 +26065,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _challenge = _interopRequireDefault(__webpack_require__("kdea")); @@ -26888,7 +26888,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _usageEvent2 = _interopRequireDefault(__webpack_require__("dECN")); @@ -29719,7 +29719,7 @@ var _I18n = __webpack_require__("buk/"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); __webpack_require__("jR4R"); @@ -30889,7 +30889,7 @@ var _react = _interopRequireWildcard(__webpack_require__("q1tI")); var _reactRedux = __webpack_require__("/MKj"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _challenge = _interopRequireDefault(__webpack_require__("kdea")); @@ -32498,7 +32498,7 @@ var _userChallenge = __webpack_require__("dQx6"); var _userExploration = __webpack_require__("/rev"); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); var _challenge = _interopRequireDefault(__webpack_require__("kdea")); @@ -32694,7 +32694,7 @@ var _fluid = __webpack_require__("5Wkc"); var _react = _interopRequireWildcard(__webpack_require__("q1tI")); -var _reactRouterDom = __webpack_require__("55Ip"); +var _reactRouterDom = __webpack_require__("SOjZ"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } diff --git a/index.html b/index.html index bc812da7723120b5772b3accf7c188fcacd88003..e05ad54e283022cf7f2a8266beedad678e546dda 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,viewport-fit=cover"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><!-- PWA Colors --><meta name="theme-color" content="#343641"><meta name="background-color" content="#121212"><!-- PWA iOS title --><meta name="apple-mobile-web-app-title" content="Ecolyo">{{.ThemeCSS}} {{.CozyBar}}<script src="//{{.Domain}}/assets/js/piwik.js"></script></head><body><div role="application" class="application" data-cozy="{{.CozyData}}"><script src="vendors/ecolyo.67505ba9aa7c653980b0.js"></script><script src="app/ecolyo.abc18aebd48b3e1ab8ee.js"></script></div></body></html> \ No newline at end of file +<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,viewport-fit=cover"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><!-- PWA Colors --><meta name="theme-color" content="#343641"><meta name="background-color" content="#121212"><!-- PWA iOS title --><meta name="apple-mobile-web-app-title" content="Ecolyo">{{.ThemeCSS}} {{.CozyBar}}<script src="//{{.Domain}}/assets/js/piwik.js"></script></head><body><div role="application" class="application" data-cozy="{{.CozyData}}"><script src="vendors/ecolyo.35f915516b9585855081.js"></script><script src="app/ecolyo.6102bc1a381cd3f616ef.js"></script></div></body></html> \ No newline at end of file diff --git a/vendors/ecolyo.67505ba9aa7c653980b0.js b/vendors/ecolyo.35f915516b9585855081.js similarity index 98% rename from vendors/ecolyo.67505ba9aa7c653980b0.js rename to vendors/ecolyo.35f915516b9585855081.js index 38412fda22503c2aa3f6b631e45e54bf71c08368..fed50052a98ead78ae31a5282ff876f789e053d6 100644 --- a/vendors/ecolyo.67505ba9aa7c653980b0.js +++ b/vendors/ecolyo.35f915516b9585855081.js @@ -39280,324 +39280,6 @@ if (_global["default"]._babelPolyfill && typeof console !== "undefined" && conso _global["default"]._babelPolyfill = true; -/***/ }), - -/***/ "55Ip": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserRouter", function() { return BrowserRouter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashRouter", function() { return HashRouter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Link", function() { return Link; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavLink", function() { return NavLink; }); -/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("Ty5D"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MemoryRouter", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["MemoryRouter"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Prompt", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["Prompt"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Redirect", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["Redirect"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["Route"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["Router"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StaticRouter", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["StaticRouter"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["Switch"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "generatePath", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["generatePath"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matchPath", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["matchPath"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useHistory", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["useHistory"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useLocation", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["useLocation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useParams", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["useParams"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useRouteMatch", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["useRouteMatch"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withRouter", function() { return react_router__WEBPACK_IMPORTED_MODULE_0__["withRouter"]; }); - -/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("dI71"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("q1tI"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("LhCv"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("17x9"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("LUQC"); -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("wx14"); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("zLVn"); -/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("9R94"); - - - - - - - - - - - -/** - * The public API for a <Router> that uses HTML5 history. - */ - -var BrowserRouter = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(BrowserRouter, _React$Component); - - function BrowserRouter() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; - _this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__["createBrowserHistory"])(_this.props); - return _this; - } - - var _proto = BrowserRouter.prototype; - - _proto.render = function render() { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__["Router"], { - history: this.history, - children: this.props.children - }); - }; - - return BrowserRouter; -}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component); - -if (false) {} - -/** - * The public API for a <Router> that uses window.location.hash. - */ - -var HashRouter = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(HashRouter, _React$Component); - - function HashRouter() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; - _this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__["createHashHistory"])(_this.props); - return _this; - } - - var _proto = HashRouter.prototype; - - _proto.render = function render() { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__["Router"], { - history: this.history, - children: this.props.children - }); - }; - - return HashRouter; -}(react__WEBPACK_IMPORTED_MODULE_2___default.a.Component); - -if (false) {} - -var resolveToLocation = function resolveToLocation(to, currentLocation) { - return typeof to === "function" ? to(currentLocation) : to; -}; -var normalizeToLocation = function normalizeToLocation(to, currentLocation) { - return typeof to === "string" ? Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(to, null, null, currentLocation) : to; -}; - -var forwardRefShim = function forwardRefShim(C) { - return C; -}; - -var forwardRef = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef; - -if (typeof forwardRef === "undefined") { - forwardRef = forwardRefShim; -} - -function isModifiedEvent(event) { - return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); -} - -var LinkAnchor = forwardRef(function (_ref, forwardedRef) { - var innerRef = _ref.innerRef, - navigate = _ref.navigate, - _onClick = _ref.onClick, - rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_7__["default"])(_ref, ["innerRef", "navigate", "onClick"]); - - var target = rest.target; - - var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__["default"])({}, rest, { - onClick: function onClick(event) { - try { - if (_onClick) _onClick(event); - } catch (ex) { - event.preventDefault(); - throw ex; - } - - if (!event.defaultPrevented && // onClick prevented default - event.button === 0 && ( // ignore everything but left clicks - !target || target === "_self") && // let browser handle "target=_blank" etc. - !isModifiedEvent(event) // ignore clicks with modifier keys - ) { - event.preventDefault(); - navigate(); - } - } - }); // React 15 compat - - - if (forwardRefShim !== forwardRef) { - props.ref = forwardedRef || innerRef; - } else { - props.ref = innerRef; - } - /* eslint-disable-next-line jsx-a11y/anchor-has-content */ - - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement("a", props); -}); - -if (false) {} -/** - * The public API for rendering a history-aware <a>. - */ - - -var Link = forwardRef(function (_ref2, forwardedRef) { - var _ref2$component = _ref2.component, - component = _ref2$component === void 0 ? LinkAnchor : _ref2$component, - replace = _ref2.replace, - to = _ref2.to, - innerRef = _ref2.innerRef, - rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_7__["default"])(_ref2, ["component", "replace", "to", "innerRef"]); - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__["__RouterContext"].Consumer, null, function (context) { - !context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_8__["default"])(false) : void 0; - var history = context.history; - var location = normalizeToLocation(resolveToLocation(to, context.location), context.location); - var href = location ? history.createHref(location) : ""; - - var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__["default"])({}, rest, { - href: href, - navigate: function navigate() { - var location = resolveToLocation(to, context.location); - var isDuplicateNavigation = Object(history__WEBPACK_IMPORTED_MODULE_3__["createPath"])(context.location) === Object(history__WEBPACK_IMPORTED_MODULE_3__["createPath"])(normalizeToLocation(location)); - var method = replace || isDuplicateNavigation ? history.replace : history.push; - method(location); - } - }); // React 15 compat - - - if (forwardRefShim !== forwardRef) { - props.ref = forwardedRef || innerRef; - } else { - props.innerRef = innerRef; - } - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(component, props); - }); -}); - -if (false) { var refType, toType; } - -var forwardRefShim$1 = function forwardRefShim(C) { - return C; -}; - -var forwardRef$1 = react__WEBPACK_IMPORTED_MODULE_2___default.a.forwardRef; - -if (typeof forwardRef$1 === "undefined") { - forwardRef$1 = forwardRefShim$1; -} - -function joinClassnames() { - for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) { - classnames[_key] = arguments[_key]; - } - - return classnames.filter(function (i) { - return i; - }).join(" "); -} -/** - * A <Link> wrapper that knows if it's "active" or not. - */ - - -var NavLink = forwardRef$1(function (_ref, forwardedRef) { - var _ref$ariaCurrent = _ref["aria-current"], - ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent, - _ref$activeClassName = _ref.activeClassName, - activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName, - activeStyle = _ref.activeStyle, - classNameProp = _ref.className, - exact = _ref.exact, - isActiveProp = _ref.isActive, - locationProp = _ref.location, - sensitive = _ref.sensitive, - strict = _ref.strict, - styleProp = _ref.style, - to = _ref.to, - innerRef = _ref.innerRef, - rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_7__["default"])(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]); - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(react_router__WEBPACK_IMPORTED_MODULE_0__["__RouterContext"].Consumer, null, function (context) { - !context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_8__["default"])(false) : void 0; - var currentLocation = locationProp || context.location; - var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation); - var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202 - - var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"); - var match = escapedPath ? Object(react_router__WEBPACK_IMPORTED_MODULE_0__["matchPath"])(currentLocation.pathname, { - path: escapedPath, - exact: exact, - sensitive: sensitive, - strict: strict - }) : null; - var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match); - var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp; - var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp; - - if (isActive) { - className = joinClassnames(className, activeClassName); - style = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__["default"])({}, style, activeStyle); - } - - var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_6__["default"])({ - "aria-current": isActive && ariaCurrent || null, - className: className, - style: style, - to: toLocation - }, rest); // React 15 compat - - - if (forwardRefShim$1 !== forwardRef$1) { - props.ref = forwardedRef || innerRef; - } else { - props.innerRef = innerRef; - } - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(Link, props); - }); -}); - -if (false) { var ariaCurrentType; } - - -//# sourceMappingURL=react-router-dom.js.map - - /***/ }), /***/ "56Ss": @@ -61459,31 +61141,6 @@ class SentryError extends Error { //# sourceMappingURL=error.js.map -/***/ }), - -/***/ "9R94": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return invariant; }); -var isProduction = "production" === 'production'; -var prefix = 'Invariant failed'; -function invariant(condition, message) { - if (condition) { - return; - } - if (isProduction) { - throw new Error(prefix); - } - var provided = typeof message === 'function' ? message() : message; - var value = provided ? prefix + ": " + provided : prefix; - throw new Error(value); -} - - - - /***/ }), /***/ "9SQf": @@ -70646,16 +70303,6 @@ $export($export.P + $export.F * __webpack_require__("eeVq")(function () { }); -/***/ }), - -/***/ "AqCL": -/***/ (function(module, exports) { - -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - - /***/ }), /***/ "AqyA": @@ -132902,6 +132549,811 @@ function minIndex(values, valueof) { } +/***/ }), + +/***/ "JRJN": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Action", function() { return Action; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return createBrowserHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return createHashHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return createMemoryHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; }); +/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("iYLG"); + + +/** + * Actions represent the type of change to a location value. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action + */ +var Action; + +(function (Action) { + /** + * A POP indicates a change to an arbitrary index in the history stack, such + * as a back or forward navigation. It does not describe the direction of the + * navigation, only that the current index changed. + * + * Note: This is the default action for newly created history objects. + */ + Action["Pop"] = "POP"; + /** + * A PUSH indicates a new entry being added to the history stack, such as when + * a link is clicked and a new page loads. When this happens, all subsequent + * entries in the stack are lost. + */ + + Action["Push"] = "PUSH"; + /** + * A REPLACE indicates the entry at the current index in the history stack + * being replaced by a new one. + */ + + Action["Replace"] = "REPLACE"; +})(Action || (Action = {})); + +var readOnly = false ? undefined : function (obj) { + return obj; +}; + +function warning(cond, message) { + if (!cond) { + // eslint-disable-next-line no-console + if (typeof console !== 'undefined') console.warn(message); + + try { + // Welcome to debugging history! + // + // This error is thrown as a convenience so you can more easily + // find the source for a warning that appears in the console by + // enabling "pause on exceptions" in your JavaScript debugger. + throw new Error(message); // eslint-disable-next-line no-empty + } catch (e) {} + } +} + +var BeforeUnloadEventType = 'beforeunload'; +var HashChangeEventType = 'hashchange'; +var PopStateEventType = 'popstate'; +/** + * Browser history stores the location in regular URLs. This is the standard for + * most web apps, but it requires some configuration on the server to ensure you + * serve the same app at multiple URLs. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory + */ + +function createBrowserHistory(options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + _options$window = _options.window, + window = _options$window === void 0 ? document.defaultView : _options$window; + var globalHistory = window.history; + + function getIndexAndLocation() { + var _window$location = window.location, + pathname = _window$location.pathname, + search = _window$location.search, + hash = _window$location.hash; + var state = globalHistory.state || {}; + return [state.idx, readOnly({ + pathname: pathname, + search: search, + hash: hash, + state: state.usr || null, + key: state.key || 'default' + })]; + } + + var blockedPopTx = null; + + function handlePop() { + if (blockedPopTx) { + blockers.call(blockedPopTx); + blockedPopTx = null; + } else { + var nextAction = Action.Pop; + + var _getIndexAndLocation = getIndexAndLocation(), + nextIndex = _getIndexAndLocation[0], + nextLocation = _getIndexAndLocation[1]; + + if (blockers.length) { + if (nextIndex != null) { + var delta = index - nextIndex; + + if (delta) { + // Revert the POP + blockedPopTx = { + action: nextAction, + location: nextLocation, + retry: function retry() { + go(delta * -1); + } + }; + go(delta); + } + } else { + // Trying to POP to a location with no index. We did not create + // this location, so we can't effectively block the navigation. + false ? undefined : void 0; + } + } else { + applyTx(nextAction); + } + } + } + + window.addEventListener(PopStateEventType, handlePop); + var action = Action.Pop; + + var _getIndexAndLocation2 = getIndexAndLocation(), + index = _getIndexAndLocation2[0], + location = _getIndexAndLocation2[1]; + + var listeners = createEvents(); + var blockers = createEvents(); + + if (index == null) { + index = 0; + globalHistory.replaceState(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, globalHistory.state, { + idx: index + }), ''); + } + + function createHref(to) { + return typeof to === 'string' ? to : createPath(to); + } // state defaults to `null` because `window.history.state` does + + + function getNextLocation(to, state) { + if (state === void 0) { + state = null; + } + + return readOnly(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ + pathname: location.pathname, + hash: '', + search: '' + }, typeof to === 'string' ? parsePath(to) : to, { + state: state, + key: createKey() + })); + } + + function getHistoryStateAndUrl(nextLocation, index) { + return [{ + usr: nextLocation.state, + key: nextLocation.key, + idx: index + }, createHref(nextLocation)]; + } + + function allowTx(action, location, retry) { + return !blockers.length || (blockers.call({ + action: action, + location: location, + retry: retry + }), false); + } + + function applyTx(nextAction) { + action = nextAction; + + var _getIndexAndLocation3 = getIndexAndLocation(); + + index = _getIndexAndLocation3[0]; + location = _getIndexAndLocation3[1]; + listeners.call({ + action: action, + location: location + }); + } + + function push(to, state) { + var nextAction = Action.Push; + var nextLocation = getNextLocation(to, state); + + function retry() { + push(to, state); + } + + if (allowTx(nextAction, nextLocation, retry)) { + var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1), + historyState = _getHistoryStateAndUr[0], + url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading + // try...catch because iOS limits us to 100 pushState calls :/ + + + try { + globalHistory.pushState(historyState, '', url); + } catch (error) { + // They are going to lose state here, but there is no real + // way to warn them about it since the page will refresh... + window.location.assign(url); + } + + applyTx(nextAction); + } + } + + function replace(to, state) { + var nextAction = Action.Replace; + var nextLocation = getNextLocation(to, state); + + function retry() { + replace(to, state); + } + + if (allowTx(nextAction, nextLocation, retry)) { + var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index), + historyState = _getHistoryStateAndUr2[0], + url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading + + + globalHistory.replaceState(historyState, '', url); + applyTx(nextAction); + } + } + + function go(delta) { + globalHistory.go(delta); + } + + var history = { + get action() { + return action; + }, + + get location() { + return location; + }, + + createHref: createHref, + push: push, + replace: replace, + go: go, + back: function back() { + go(-1); + }, + forward: function forward() { + go(1); + }, + listen: function listen(listener) { + return listeners.push(listener); + }, + block: function block(blocker) { + var unblock = blockers.push(blocker); + + if (blockers.length === 1) { + window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); + } + + return function () { + unblock(); // Remove the beforeunload listener so the document may + // still be salvageable in the pagehide event. + // See https://html.spec.whatwg.org/#unloading-documents + + if (!blockers.length) { + window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); + } + }; + } + }; + return history; +} +/** + * Hash history stores the location in window.location.hash. This makes it ideal + * for situations where you don't want to send the location to the server for + * some reason, either because you do cannot configure it or the URL space is + * reserved for something else. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory + */ + +function createHashHistory(options) { + if (options === void 0) { + options = {}; + } + + var _options2 = options, + _options2$window = _options2.window, + window = _options2$window === void 0 ? document.defaultView : _options2$window; + var globalHistory = window.history; + + function getIndexAndLocation() { + var _parsePath = parsePath(window.location.hash.substr(1)), + _parsePath$pathname = _parsePath.pathname, + pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname, + _parsePath$search = _parsePath.search, + search = _parsePath$search === void 0 ? '' : _parsePath$search, + _parsePath$hash = _parsePath.hash, + hash = _parsePath$hash === void 0 ? '' : _parsePath$hash; + + var state = globalHistory.state || {}; + return [state.idx, readOnly({ + pathname: pathname, + search: search, + hash: hash, + state: state.usr || null, + key: state.key || 'default' + })]; + } + + var blockedPopTx = null; + + function handlePop() { + if (blockedPopTx) { + blockers.call(blockedPopTx); + blockedPopTx = null; + } else { + var nextAction = Action.Pop; + + var _getIndexAndLocation4 = getIndexAndLocation(), + nextIndex = _getIndexAndLocation4[0], + nextLocation = _getIndexAndLocation4[1]; + + if (blockers.length) { + if (nextIndex != null) { + var delta = index - nextIndex; + + if (delta) { + // Revert the POP + blockedPopTx = { + action: nextAction, + location: nextLocation, + retry: function retry() { + go(delta * -1); + } + }; + go(delta); + } + } else { + // Trying to POP to a location with no index. We did not create + // this location, so we can't effectively block the navigation. + false ? undefined : void 0; + } + } else { + applyTx(nextAction); + } + } + } + + window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge + // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event + + window.addEventListener(HashChangeEventType, function () { + var _getIndexAndLocation5 = getIndexAndLocation(), + nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events. + + + if (createPath(nextLocation) !== createPath(location)) { + handlePop(); + } + }); + var action = Action.Pop; + + var _getIndexAndLocation6 = getIndexAndLocation(), + index = _getIndexAndLocation6[0], + location = _getIndexAndLocation6[1]; + + var listeners = createEvents(); + var blockers = createEvents(); + + if (index == null) { + index = 0; + globalHistory.replaceState(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, globalHistory.state, { + idx: index + }), ''); + } + + function getBaseHref() { + var base = document.querySelector('base'); + var href = ''; + + if (base && base.getAttribute('href')) { + var url = window.location.href; + var hashIndex = url.indexOf('#'); + href = hashIndex === -1 ? url : url.slice(0, hashIndex); + } + + return href; + } + + function createHref(to) { + return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to)); + } + + function getNextLocation(to, state) { + if (state === void 0) { + state = null; + } + + return readOnly(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ + pathname: location.pathname, + hash: '', + search: '' + }, typeof to === 'string' ? parsePath(to) : to, { + state: state, + key: createKey() + })); + } + + function getHistoryStateAndUrl(nextLocation, index) { + return [{ + usr: nextLocation.state, + key: nextLocation.key, + idx: index + }, createHref(nextLocation)]; + } + + function allowTx(action, location, retry) { + return !blockers.length || (blockers.call({ + action: action, + location: location, + retry: retry + }), false); + } + + function applyTx(nextAction) { + action = nextAction; + + var _getIndexAndLocation7 = getIndexAndLocation(); + + index = _getIndexAndLocation7[0]; + location = _getIndexAndLocation7[1]; + listeners.call({ + action: action, + location: location + }); + } + + function push(to, state) { + var nextAction = Action.Push; + var nextLocation = getNextLocation(to, state); + + function retry() { + push(to, state); + } + + false ? undefined : void 0; + + if (allowTx(nextAction, nextLocation, retry)) { + var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1), + historyState = _getHistoryStateAndUr3[0], + url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading + // try...catch because iOS limits us to 100 pushState calls :/ + + + try { + globalHistory.pushState(historyState, '', url); + } catch (error) { + // They are going to lose state here, but there is no real + // way to warn them about it since the page will refresh... + window.location.assign(url); + } + + applyTx(nextAction); + } + } + + function replace(to, state) { + var nextAction = Action.Replace; + var nextLocation = getNextLocation(to, state); + + function retry() { + replace(to, state); + } + + false ? undefined : void 0; + + if (allowTx(nextAction, nextLocation, retry)) { + var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index), + historyState = _getHistoryStateAndUr4[0], + url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading + + + globalHistory.replaceState(historyState, '', url); + applyTx(nextAction); + } + } + + function go(delta) { + globalHistory.go(delta); + } + + var history = { + get action() { + return action; + }, + + get location() { + return location; + }, + + createHref: createHref, + push: push, + replace: replace, + go: go, + back: function back() { + go(-1); + }, + forward: function forward() { + go(1); + }, + listen: function listen(listener) { + return listeners.push(listener); + }, + block: function block(blocker) { + var unblock = blockers.push(blocker); + + if (blockers.length === 1) { + window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); + } + + return function () { + unblock(); // Remove the beforeunload listener so the document may + // still be salvageable in the pagehide event. + // See https://html.spec.whatwg.org/#unloading-documents + + if (!blockers.length) { + window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); + } + }; + } + }; + return history; +} +/** + * Memory history stores the current location in memory. It is designed for use + * in stateful non-browser environments like tests and React Native. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory + */ + +function createMemoryHistory(options) { + if (options === void 0) { + options = {}; + } + + var _options3 = options, + _options3$initialEntr = _options3.initialEntries, + initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr, + initialIndex = _options3.initialIndex; + var entries = initialEntries.map(function (entry) { + var location = readOnly(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ + pathname: '/', + search: '', + hash: '', + state: null, + key: createKey() + }, typeof entry === 'string' ? parsePath(entry) : entry)); + false ? undefined : void 0; + return location; + }); + var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1); + var action = Action.Pop; + var location = entries[index]; + var listeners = createEvents(); + var blockers = createEvents(); + + function createHref(to) { + return typeof to === 'string' ? to : createPath(to); + } + + function getNextLocation(to, state) { + if (state === void 0) { + state = null; + } + + return readOnly(Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ + pathname: location.pathname, + search: '', + hash: '' + }, typeof to === 'string' ? parsePath(to) : to, { + state: state, + key: createKey() + })); + } + + function allowTx(action, location, retry) { + return !blockers.length || (blockers.call({ + action: action, + location: location, + retry: retry + }), false); + } + + function applyTx(nextAction, nextLocation) { + action = nextAction; + location = nextLocation; + listeners.call({ + action: action, + location: location + }); + } + + function push(to, state) { + var nextAction = Action.Push; + var nextLocation = getNextLocation(to, state); + + function retry() { + push(to, state); + } + + false ? undefined : void 0; + + if (allowTx(nextAction, nextLocation, retry)) { + index += 1; + entries.splice(index, entries.length, nextLocation); + applyTx(nextAction, nextLocation); + } + } + + function replace(to, state) { + var nextAction = Action.Replace; + var nextLocation = getNextLocation(to, state); + + function retry() { + replace(to, state); + } + + false ? undefined : void 0; + + if (allowTx(nextAction, nextLocation, retry)) { + entries[index] = nextLocation; + applyTx(nextAction, nextLocation); + } + } + + function go(delta) { + var nextIndex = clamp(index + delta, 0, entries.length - 1); + var nextAction = Action.Pop; + var nextLocation = entries[nextIndex]; + + function retry() { + go(delta); + } + + if (allowTx(nextAction, nextLocation, retry)) { + index = nextIndex; + applyTx(nextAction, nextLocation); + } + } + + var history = { + get index() { + return index; + }, + + get action() { + return action; + }, + + get location() { + return location; + }, + + createHref: createHref, + push: push, + replace: replace, + go: go, + back: function back() { + go(-1); + }, + forward: function forward() { + go(1); + }, + listen: function listen(listener) { + return listeners.push(listener); + }, + block: function block(blocker) { + return blockers.push(blocker); + } + }; + return history; +} //////////////////////////////////////////////////////////////////////////////// +// UTILS +//////////////////////////////////////////////////////////////////////////////// + +function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); +} + +function promptBeforeUnload(event) { + // Cancel the event. + event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set. + + event.returnValue = ''; +} + +function createEvents() { + var handlers = []; + return { + get length() { + return handlers.length; + }, + + push: function push(fn) { + handlers.push(fn); + return function () { + handlers = handlers.filter(function (handler) { + return handler !== fn; + }); + }; + }, + call: function call(arg) { + handlers.forEach(function (fn) { + return fn && fn(arg); + }); + } + }; +} + +function createKey() { + return Math.random().toString(36).substr(2, 8); +} +/** + * Creates a string URL path from the given pathname, search, and hash components. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath + */ + + +function createPath(_ref) { + var _ref$pathname = _ref.pathname, + pathname = _ref$pathname === void 0 ? '/' : _ref$pathname, + _ref$search = _ref.search, + search = _ref$search === void 0 ? '' : _ref$search, + _ref$hash = _ref.hash, + hash = _ref$hash === void 0 ? '' : _ref$hash; + if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search; + if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash; + return pathname; +} +/** + * Parses a string URL path into its separate pathname, search, and hash components. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath + */ + +function parsePath(path) { + var parsedPath = {}; + + if (path) { + var hashIndex = path.indexOf('#'); + + if (hashIndex >= 0) { + parsedPath.hash = path.substr(hashIndex); + path = path.substr(0, hashIndex); + } + + var searchIndex = path.indexOf('?'); + + if (searchIndex >= 0) { + parsedPath.search = path.substr(searchIndex); + path = path.substr(0, searchIndex); + } + + if (path) { + parsedPath.pathname = path; + } + } + + return parsedPath; +} + + +//# sourceMappingURL=index.js.map + + /***/ }), /***/ "JSQU": @@ -168171,946 +168623,6 @@ module.exports = function (that, maxLength, fillString, left) { }; -/***/ }), - -/***/ "LhCv": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return createBrowserHistory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return createHashHistory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return createMemoryHistory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return createLocation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return locationsAreEqual; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; }); -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14"); -/* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("lCFh"); -/* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("xhmd"); -/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("LUQC"); -/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("9R94"); - - - - - - -function addLeadingSlash(path) { - return path.charAt(0) === '/' ? path : '/' + path; -} -function stripLeadingSlash(path) { - return path.charAt(0) === '/' ? path.substr(1) : path; -} -function hasBasename(path, prefix) { - return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1; -} -function stripBasename(path, prefix) { - return hasBasename(path, prefix) ? path.substr(prefix.length) : path; -} -function stripTrailingSlash(path) { - return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; -} -function parsePath(path) { - var pathname = path || '/'; - var search = ''; - var hash = ''; - var hashIndex = pathname.indexOf('#'); - - if (hashIndex !== -1) { - hash = pathname.substr(hashIndex); - pathname = pathname.substr(0, hashIndex); - } - - var searchIndex = pathname.indexOf('?'); - - if (searchIndex !== -1) { - search = pathname.substr(searchIndex); - pathname = pathname.substr(0, searchIndex); - } - - return { - pathname: pathname, - search: search === '?' ? '' : search, - hash: hash === '#' ? '' : hash - }; -} -function createPath(location) { - var pathname = location.pathname, - search = location.search, - hash = location.hash; - var path = pathname || '/'; - if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search; - if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash; - return path; -} - -function createLocation(path, state, key, currentLocation) { - var location; - - if (typeof path === 'string') { - // Two-arg form: push(path, state) - location = parsePath(path); - location.state = state; - } else { - // One-arg form: push(location) - location = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, path); - if (location.pathname === undefined) location.pathname = ''; - - if (location.search) { - if (location.search.charAt(0) !== '?') location.search = '?' + location.search; - } else { - location.search = ''; - } - - if (location.hash) { - if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; - } else { - location.hash = ''; - } - - if (state !== undefined && location.state === undefined) location.state = state; - } - - try { - location.pathname = decodeURI(location.pathname); - } catch (e) { - if (e instanceof URIError) { - throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); - } else { - throw e; - } - } - - if (key) location.key = key; - - if (currentLocation) { - // Resolve incomplete/relative pathname relative to current location. - if (!location.pathname) { - location.pathname = currentLocation.pathname; - } else if (location.pathname.charAt(0) !== '/') { - location.pathname = Object(resolve_pathname__WEBPACK_IMPORTED_MODULE_1__["default"])(location.pathname, currentLocation.pathname); - } - } else { - // When there is no prior location and pathname is empty, set it to / - if (!location.pathname) { - location.pathname = '/'; - } - } - - return location; -} -function locationsAreEqual(a, b) { - return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && Object(value_equal__WEBPACK_IMPORTED_MODULE_2__["default"])(a.state, b.state); -} - -function createTransitionManager() { - var prompt = null; - - function setPrompt(nextPrompt) { - false ? undefined : void 0; - prompt = nextPrompt; - return function () { - if (prompt === nextPrompt) prompt = null; - }; - } - - function confirmTransitionTo(location, action, getUserConfirmation, callback) { - // TODO: If another transition starts while we're still confirming - // the previous one, we may end up in a weird state. Figure out the - // best way to handle this. - if (prompt != null) { - var result = typeof prompt === 'function' ? prompt(location, action) : prompt; - - if (typeof result === 'string') { - if (typeof getUserConfirmation === 'function') { - getUserConfirmation(result, callback); - } else { - false ? undefined : void 0; - callback(true); - } - } else { - // Return false from a transition hook to cancel the transition. - callback(result !== false); - } - } else { - callback(true); - } - } - - var listeners = []; - - function appendListener(fn) { - var isActive = true; - - function listener() { - if (isActive) fn.apply(void 0, arguments); - } - - listeners.push(listener); - return function () { - isActive = false; - listeners = listeners.filter(function (item) { - return item !== listener; - }); - }; - } - - function notifyListeners() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - listeners.forEach(function (listener) { - return listener.apply(void 0, args); - }); - } - - return { - setPrompt: setPrompt, - confirmTransitionTo: confirmTransitionTo, - appendListener: appendListener, - notifyListeners: notifyListeners - }; -} - -var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); -function getConfirmation(message, callback) { - callback(window.confirm(message)); // eslint-disable-line no-alert -} -/** - * Returns true if the HTML5 history API is supported. Taken from Modernizr. - * - * https://github.com/Modernizr/Modernizr/blob/master/LICENSE - * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js - * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 - */ - -function supportsHistory() { - var ua = window.navigator.userAgent; - if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; - return window.history && 'pushState' in window.history; -} -/** - * Returns true if browser fires popstate on hash change. - * IE10 and IE11 do not. - */ - -function supportsPopStateOnHashChange() { - return window.navigator.userAgent.indexOf('Trident') === -1; -} -/** - * Returns false if using go(n) with hash history causes a full page reload. - */ - -function supportsGoWithoutReloadUsingHash() { - return window.navigator.userAgent.indexOf('Firefox') === -1; -} -/** - * Returns true if a given popstate event is an extraneous WebKit event. - * Accounts for the fact that Chrome on iOS fires real popstate events - * containing undefined state when pressing the back button. - */ - -function isExtraneousPopstateEvent(event) { - return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; -} - -var PopStateEvent = 'popstate'; -var HashChangeEvent = 'hashchange'; - -function getHistoryState() { - try { - return window.history.state || {}; - } catch (e) { - // IE 11 sometimes throws when accessing window.history.state - // See https://github.com/ReactTraining/history/pull/289 - return {}; - } -} -/** - * Creates a history object that uses the HTML5 history API including - * pushState, replaceState, and the popstate event. - */ - - -function createBrowserHistory(props) { - if (props === void 0) { - props = {}; - } - - !canUseDOM ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false) : void 0; - var globalHistory = window.history; - var canUseHistory = supportsHistory(); - var needsHashChangeListener = !supportsPopStateOnHashChange(); - var _props = props, - _props$forceRefresh = _props.forceRefresh, - forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh, - _props$getUserConfirm = _props.getUserConfirmation, - getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, - _props$keyLength = _props.keyLength, - keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; - var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; - - function getDOMLocation(historyState) { - var _ref = historyState || {}, - key = _ref.key, - state = _ref.state; - - var _window$location = window.location, - pathname = _window$location.pathname, - search = _window$location.search, - hash = _window$location.hash; - var path = pathname + search + hash; - false ? undefined : void 0; - if (basename) path = stripBasename(path, basename); - return createLocation(path, state, key); - } - - function createKey() { - return Math.random().toString(36).substr(2, keyLength); - } - - var transitionManager = createTransitionManager(); - - function setState(nextState) { - Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); - - history.length = globalHistory.length; - transitionManager.notifyListeners(history.location, history.action); - } - - function handlePopState(event) { - // Ignore extraneous popstate events in WebKit. - if (isExtraneousPopstateEvent(event)) return; - handlePop(getDOMLocation(event.state)); - } - - function handleHashChange() { - handlePop(getDOMLocation(getHistoryState())); - } - - var forceNextPop = false; - - function handlePop(location) { - if (forceNextPop) { - forceNextPop = false; - setState(); - } else { - var action = 'POP'; - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (ok) { - setState({ - action: action, - location: location - }); - } else { - revertPop(location); - } - }); - } - } - - function revertPop(fromLocation) { - var toLocation = history.location; // TODO: We could probably make this more reliable by - // keeping a list of keys we've seen in sessionStorage. - // Instead, we just default to 0 for keys we don't know. - - var toIndex = allKeys.indexOf(toLocation.key); - if (toIndex === -1) toIndex = 0; - var fromIndex = allKeys.indexOf(fromLocation.key); - if (fromIndex === -1) fromIndex = 0; - var delta = toIndex - fromIndex; - - if (delta) { - forceNextPop = true; - go(delta); - } - } - - var initialLocation = getDOMLocation(getHistoryState()); - var allKeys = [initialLocation.key]; // Public interface - - function createHref(location) { - return basename + createPath(location); - } - - function push(path, state) { - false ? undefined : void 0; - var action = 'PUSH'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var href = createHref(location); - var key = location.key, - state = location.state; - - if (canUseHistory) { - globalHistory.pushState({ - key: key, - state: state - }, null, href); - - if (forceRefresh) { - window.location.href = href; - } else { - var prevIndex = allKeys.indexOf(history.location.key); - var nextKeys = allKeys.slice(0, prevIndex + 1); - nextKeys.push(location.key); - allKeys = nextKeys; - setState({ - action: action, - location: location - }); - } - } else { - false ? undefined : void 0; - window.location.href = href; - } - }); - } - - function replace(path, state) { - false ? undefined : void 0; - var action = 'REPLACE'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var href = createHref(location); - var key = location.key, - state = location.state; - - if (canUseHistory) { - globalHistory.replaceState({ - key: key, - state: state - }, null, href); - - if (forceRefresh) { - window.location.replace(href); - } else { - var prevIndex = allKeys.indexOf(history.location.key); - if (prevIndex !== -1) allKeys[prevIndex] = location.key; - setState({ - action: action, - location: location - }); - } - } else { - false ? undefined : void 0; - window.location.replace(href); - } - }); - } - - function go(n) { - globalHistory.go(n); - } - - function goBack() { - go(-1); - } - - function goForward() { - go(1); - } - - var listenerCount = 0; - - function checkDOMListeners(delta) { - listenerCount += delta; - - if (listenerCount === 1 && delta === 1) { - window.addEventListener(PopStateEvent, handlePopState); - if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange); - } else if (listenerCount === 0) { - window.removeEventListener(PopStateEvent, handlePopState); - if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange); - } - } - - var isBlocked = false; - - function block(prompt) { - if (prompt === void 0) { - prompt = false; - } - - var unblock = transitionManager.setPrompt(prompt); - - if (!isBlocked) { - checkDOMListeners(1); - isBlocked = true; - } - - return function () { - if (isBlocked) { - isBlocked = false; - checkDOMListeners(-1); - } - - return unblock(); - }; - } - - function listen(listener) { - var unlisten = transitionManager.appendListener(listener); - checkDOMListeners(1); - return function () { - checkDOMListeners(-1); - unlisten(); - }; - } - - var history = { - length: globalHistory.length, - action: 'POP', - location: initialLocation, - createHref: createHref, - push: push, - replace: replace, - go: go, - goBack: goBack, - goForward: goForward, - block: block, - listen: listen - }; - return history; -} - -var HashChangeEvent$1 = 'hashchange'; -var HashPathCoders = { - hashbang: { - encodePath: function encodePath(path) { - return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path); - }, - decodePath: function decodePath(path) { - return path.charAt(0) === '!' ? path.substr(1) : path; - } - }, - noslash: { - encodePath: stripLeadingSlash, - decodePath: addLeadingSlash - }, - slash: { - encodePath: addLeadingSlash, - decodePath: addLeadingSlash - } -}; - -function stripHash(url) { - var hashIndex = url.indexOf('#'); - return hashIndex === -1 ? url : url.slice(0, hashIndex); -} - -function getHashPath() { - // We can't use window.location.hash here because it's not - // consistent across browsers - Firefox will pre-decode it! - var href = window.location.href; - var hashIndex = href.indexOf('#'); - return hashIndex === -1 ? '' : href.substring(hashIndex + 1); -} - -function pushHashPath(path) { - window.location.hash = path; -} - -function replaceHashPath(path) { - window.location.replace(stripHash(window.location.href) + '#' + path); -} - -function createHashHistory(props) { - if (props === void 0) { - props = {}; - } - - !canUseDOM ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false) : void 0; - var globalHistory = window.history; - var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); - var _props = props, - _props$getUserConfirm = _props.getUserConfirmation, - getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, - _props$hashType = _props.hashType, - hashType = _props$hashType === void 0 ? 'slash' : _props$hashType; - var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; - var _HashPathCoders$hashT = HashPathCoders[hashType], - encodePath = _HashPathCoders$hashT.encodePath, - decodePath = _HashPathCoders$hashT.decodePath; - - function getDOMLocation() { - var path = decodePath(getHashPath()); - false ? undefined : void 0; - if (basename) path = stripBasename(path, basename); - return createLocation(path); - } - - var transitionManager = createTransitionManager(); - - function setState(nextState) { - Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); - - history.length = globalHistory.length; - transitionManager.notifyListeners(history.location, history.action); - } - - var forceNextPop = false; - var ignorePath = null; - - function locationsAreEqual$$1(a, b) { - return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash; - } - - function handleHashChange() { - var path = getHashPath(); - var encodedPath = encodePath(path); - - if (path !== encodedPath) { - // Ensure we always have a properly-encoded hash. - replaceHashPath(encodedPath); - } else { - var location = getDOMLocation(); - var prevLocation = history.location; - if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change. - - if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace. - - ignorePath = null; - handlePop(location); - } - } - - function handlePop(location) { - if (forceNextPop) { - forceNextPop = false; - setState(); - } else { - var action = 'POP'; - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (ok) { - setState({ - action: action, - location: location - }); - } else { - revertPop(location); - } - }); - } - } - - function revertPop(fromLocation) { - var toLocation = history.location; // TODO: We could probably make this more reliable by - // keeping a list of paths we've seen in sessionStorage. - // Instead, we just default to 0 for paths we don't know. - - var toIndex = allPaths.lastIndexOf(createPath(toLocation)); - if (toIndex === -1) toIndex = 0; - var fromIndex = allPaths.lastIndexOf(createPath(fromLocation)); - if (fromIndex === -1) fromIndex = 0; - var delta = toIndex - fromIndex; - - if (delta) { - forceNextPop = true; - go(delta); - } - } // Ensure the hash is encoded properly before doing anything else. - - - var path = getHashPath(); - var encodedPath = encodePath(path); - if (path !== encodedPath) replaceHashPath(encodedPath); - var initialLocation = getDOMLocation(); - var allPaths = [createPath(initialLocation)]; // Public interface - - function createHref(location) { - var baseTag = document.querySelector('base'); - var href = ''; - - if (baseTag && baseTag.getAttribute('href')) { - href = stripHash(window.location.href); - } - - return href + '#' + encodePath(basename + createPath(location)); - } - - function push(path, state) { - false ? undefined : void 0; - var action = 'PUSH'; - var location = createLocation(path, undefined, undefined, history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var path = createPath(location); - var encodedPath = encodePath(basename + path); - var hashChanged = getHashPath() !== encodedPath; - - if (hashChanged) { - // We cannot tell if a hashchange was caused by a PUSH, so we'd - // rather setState here and ignore the hashchange. The caveat here - // is that other hash histories in the page will consider it a POP. - ignorePath = path; - pushHashPath(encodedPath); - var prevIndex = allPaths.lastIndexOf(createPath(history.location)); - var nextPaths = allPaths.slice(0, prevIndex + 1); - nextPaths.push(path); - allPaths = nextPaths; - setState({ - action: action, - location: location - }); - } else { - false ? undefined : void 0; - setState(); - } - }); - } - - function replace(path, state) { - false ? undefined : void 0; - var action = 'REPLACE'; - var location = createLocation(path, undefined, undefined, history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var path = createPath(location); - var encodedPath = encodePath(basename + path); - var hashChanged = getHashPath() !== encodedPath; - - if (hashChanged) { - // We cannot tell if a hashchange was caused by a REPLACE, so we'd - // rather setState here and ignore the hashchange. The caveat here - // is that other hash histories in the page will consider it a POP. - ignorePath = path; - replaceHashPath(encodedPath); - } - - var prevIndex = allPaths.indexOf(createPath(history.location)); - if (prevIndex !== -1) allPaths[prevIndex] = path; - setState({ - action: action, - location: location - }); - }); - } - - function go(n) { - false ? undefined : void 0; - globalHistory.go(n); - } - - function goBack() { - go(-1); - } - - function goForward() { - go(1); - } - - var listenerCount = 0; - - function checkDOMListeners(delta) { - listenerCount += delta; - - if (listenerCount === 1 && delta === 1) { - window.addEventListener(HashChangeEvent$1, handleHashChange); - } else if (listenerCount === 0) { - window.removeEventListener(HashChangeEvent$1, handleHashChange); - } - } - - var isBlocked = false; - - function block(prompt) { - if (prompt === void 0) { - prompt = false; - } - - var unblock = transitionManager.setPrompt(prompt); - - if (!isBlocked) { - checkDOMListeners(1); - isBlocked = true; - } - - return function () { - if (isBlocked) { - isBlocked = false; - checkDOMListeners(-1); - } - - return unblock(); - }; - } - - function listen(listener) { - var unlisten = transitionManager.appendListener(listener); - checkDOMListeners(1); - return function () { - checkDOMListeners(-1); - unlisten(); - }; - } - - var history = { - length: globalHistory.length, - action: 'POP', - location: initialLocation, - createHref: createHref, - push: push, - replace: replace, - go: go, - goBack: goBack, - goForward: goForward, - block: block, - listen: listen - }; - return history; -} - -function clamp(n, lowerBound, upperBound) { - return Math.min(Math.max(n, lowerBound), upperBound); -} -/** - * Creates a history object that stores locations in memory. - */ - - -function createMemoryHistory(props) { - if (props === void 0) { - props = {}; - } - - var _props = props, - getUserConfirmation = _props.getUserConfirmation, - _props$initialEntries = _props.initialEntries, - initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries, - _props$initialIndex = _props.initialIndex, - initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex, - _props$keyLength = _props.keyLength, - keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; - var transitionManager = createTransitionManager(); - - function setState(nextState) { - Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); - - history.length = history.entries.length; - transitionManager.notifyListeners(history.location, history.action); - } - - function createKey() { - return Math.random().toString(36).substr(2, keyLength); - } - - var index = clamp(initialIndex, 0, initialEntries.length - 1); - var entries = initialEntries.map(function (entry) { - return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); - }); // Public interface - - var createHref = createPath; - - function push(path, state) { - false ? undefined : void 0; - var action = 'PUSH'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var prevIndex = history.index; - var nextIndex = prevIndex + 1; - var nextEntries = history.entries.slice(0); - - if (nextEntries.length > nextIndex) { - nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); - } else { - nextEntries.push(location); - } - - setState({ - action: action, - location: location, - index: nextIndex, - entries: nextEntries - }); - }); - } - - function replace(path, state) { - false ? undefined : void 0; - var action = 'REPLACE'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - history.entries[history.index] = location; - setState({ - action: action, - location: location - }); - }); - } - - function go(n) { - var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); - var action = 'POP'; - var location = history.entries[nextIndex]; - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (ok) { - setState({ - action: action, - location: location, - index: nextIndex - }); - } else { - // Mimic the behavior of DOM histories by - // causing a render after a cancelled POP. - setState(); - } - }); - } - - function goBack() { - go(-1); - } - - function goForward() { - go(1); - } - - function canGo(n) { - var nextIndex = history.index + n; - return nextIndex >= 0 && nextIndex < history.entries.length; - } - - function block(prompt) { - if (prompt === void 0) { - prompt = false; - } - - return transitionManager.setPrompt(prompt); - } - - function listen(listener) { - return transitionManager.appendListener(listener); - } - - var history = { - length: entries.length, - action: 'POP', - location: entries[index], - index: index, - entries: entries, - createHref: createHref, - push: push, - replace: replace, - go: go, - goBack: goBack, - goForward: goForward, - canGo: canGo, - block: block, - listen: listen - }; - return history; -} - - - - /***/ }), /***/ "Ljet": @@ -218219,6 +217731,1071 @@ var ContainerService = /*#__PURE__*/function () { return ContainerService; }(); +/***/ }), + +/***/ "SOjZ": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserRouter", function() { return BrowserRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Form", function() { return Form; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashRouter", function() { return HashRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Link", function() { return Link; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavLink", function() { return NavLink; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ScrollRestoration", function() { return ScrollRestoration; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_useScrollRestoration", function() { return useScrollRestoration; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBrowserRouter", function() { return createBrowserRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHashRouter", function() { return createHashRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSearchParams", function() { return createSearchParams; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unstable_HistoryRouter", function() { return HistoryRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useBeforeUnload", function() { return useBeforeUnload; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useFetcher", function() { return useFetcher; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useFetchers", function() { return useFetchers; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useFormAction", function() { return useFormAction; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLinkClickHandler", function() { return useLinkClickHandler; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useSearchParams", function() { return useSearchParams; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useSubmit", function() { return useSubmit; }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("q1tI"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("V4z/"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbortedDeferredError", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["AbortedDeferredError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Await", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["Await"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MemoryRouter", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["MemoryRouter"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Navigate", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["Navigate"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NavigationType", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["NavigationType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Outlet", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["Outlet"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["Route"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["Router"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RouterProvider", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["RouterProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Routes", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["Routes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_DataRouterContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_DataRouterContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_DataRouterStateContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_DataRouterStateContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_DataStaticRouterContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_DataStaticRouterContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_LocationContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_LocationContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_NavigationContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_NavigationContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_RouteContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_RouteContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_enhanceManualRouteObjects", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_enhanceManualRouteObjects"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createMemoryRouter", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["createMemoryRouter"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["createPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createRoutesFromChildren", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["createRoutesFromChildren"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createRoutesFromElements", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["createRoutesFromElements"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["defer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "generatePath", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["generatePath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isRouteErrorResponse", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["isRouteErrorResponse"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "json", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["json"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matchPath", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["matchPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matchRoutes", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["matchRoutes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["parsePath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "redirect", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["redirect"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "renderMatches", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["renderMatches"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resolvePath", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["resolvePath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useActionData", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useActionData"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useAsyncError", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useAsyncError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useAsyncValue", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useAsyncValue"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useHref", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useHref"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useInRouterContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useInRouterContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useLoaderData", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useLoaderData"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useLocation", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useLocation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useMatch", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useMatch"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useMatches", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useMatches"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useNavigate", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useNavigate"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useNavigation", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useNavigation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useNavigationType", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useNavigationType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useOutlet", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useOutlet"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useOutletContext", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useOutletContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useParams", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useParams"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useResolvedPath", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useResolvedPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useRevalidator", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useRevalidator"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useRouteError", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useRouteError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useRouteLoaderData", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useRouteLoaderData"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useRoutes", function() { return react_router__WEBPACK_IMPORTED_MODULE_1__["useRoutes"]; }); + +/* harmony import */ var _remix_run_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("hk2M"); +/** + * React Router DOM v6.6.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ + + + + + +function _extends() { + _extends = Object.assign ? Object.assign.bind() : 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); +} + +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +const defaultMethod = "get"; +const defaultEncType = "application/x-www-form-urlencoded"; +function isHtmlElement(object) { + return object != null && typeof object.tagName === "string"; +} +function isButtonElement(object) { + return isHtmlElement(object) && object.tagName.toLowerCase() === "button"; +} +function isFormElement(object) { + return isHtmlElement(object) && object.tagName.toLowerCase() === "form"; +} +function isInputElement(object) { + return isHtmlElement(object) && object.tagName.toLowerCase() === "input"; +} + +function isModifiedEvent(event) { + return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); +} + +function shouldProcessLinkClick(event, target) { + return event.button === 0 && ( // Ignore everything but left clicks + !target || target === "_self") && // Let browser handle "target=_blank" etc. + !isModifiedEvent(event) // Ignore clicks with modifier keys + ; +} +/** + * Creates a URLSearchParams object using the given initializer. + * + * This is identical to `new URLSearchParams(init)` except it also + * supports arrays as values in the object form of the initializer + * instead of just strings. This is convenient when you need multiple + * values for a given key, but don't want to use an array initializer. + * + * For example, instead of: + * + * let searchParams = new URLSearchParams([ + * ['sort', 'name'], + * ['sort', 'price'] + * ]); + * + * you can do: + * + * let searchParams = createSearchParams({ + * sort: ['name', 'price'] + * }); + */ + +function createSearchParams(init) { + if (init === void 0) { + init = ""; + } + + return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => { + let value = init[key]; + return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]); + }, [])); +} +function getSearchParamsForLocation(locationSearch, defaultSearchParams) { + let searchParams = createSearchParams(locationSearch); + + for (let key of defaultSearchParams.keys()) { + if (!searchParams.has(key)) { + defaultSearchParams.getAll(key).forEach(value => { + searchParams.append(key, value); + }); + } + } + + return searchParams; +} +function getFormSubmissionInfo(target, defaultAction, options) { + let method; + let action; + let encType; + let formData; + + if (isFormElement(target)) { + let submissionTrigger = options.submissionTrigger; + method = options.method || target.getAttribute("method") || defaultMethod; + action = options.action || target.getAttribute("action") || defaultAction; + encType = options.encType || target.getAttribute("enctype") || defaultEncType; + formData = new FormData(target); + + if (submissionTrigger && submissionTrigger.name) { + formData.append(submissionTrigger.name, submissionTrigger.value); + } + } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) { + let form = target.form; + + if (form == null) { + throw new Error("Cannot submit a <button> or <input type=\"submit\"> without a <form>"); + } // <button>/<input type="submit"> may override attributes of <form> + + + method = options.method || target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod; + action = options.action || target.getAttribute("formaction") || form.getAttribute("action") || defaultAction; + encType = options.encType || target.getAttribute("formenctype") || form.getAttribute("enctype") || defaultEncType; + formData = new FormData(form); // Include name + value from a <button>, appending in case the button name + // matches an existing input name + + if (target.name) { + formData.append(target.name, target.value); + } + } else if (isHtmlElement(target)) { + throw new Error("Cannot submit element that is not <form>, <button>, or " + "<input type=\"submit|image\">"); + } else { + method = options.method || defaultMethod; + action = options.action || defaultAction; + encType = options.encType || defaultEncType; + + if (target instanceof FormData) { + formData = target; + } else { + formData = new FormData(); + + if (target instanceof URLSearchParams) { + for (let [name, value] of target) { + formData.append(name, value); + } + } else if (target != null) { + for (let name of Object.keys(target)) { + formData.append(name, target[name]); + } + } + } + } + + let { + protocol, + host + } = window.location; + let url = new URL(action, protocol + "//" + host); + return { + url, + method: method.toLowerCase(), + encType, + formData + }; +} + +const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"], + _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"], + _excluded3 = ["reloadDocument", "replace", "method", "action", "onSubmit", "fetcherKey", "routeId", "relative"]; +//#region Routers +//////////////////////////////////////////////////////////////////////////////// + +function createBrowserRouter(routes, opts) { + return Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["createRouter"])({ + basename: opts == null ? void 0 : opts.basename, + history: Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["createBrowserHistory"])({ + window: opts == null ? void 0 : opts.window + }), + hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(), + routes: Object(react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_enhanceManualRouteObjects"])(routes) + }).initialize(); +} +function createHashRouter(routes, opts) { + return Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["createRouter"])({ + basename: opts == null ? void 0 : opts.basename, + history: Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["createHashHistory"])({ + window: opts == null ? void 0 : opts.window + }), + hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(), + routes: Object(react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_enhanceManualRouteObjects"])(routes) + }).initialize(); +} + +function parseHydrationData() { + var _window; + + let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData; + + if (state && state.errors) { + state = _extends({}, state, { + errors: deserializeErrors(state.errors) + }); + } + + return state; +} + +function deserializeErrors(errors) { + if (!errors) return null; + let entries = Object.entries(errors); + let serialized = {}; + + for (let [key, val] of entries) { + // Hey you! If you change this, please change the corresponding logic in + // serializeErrors in react-router-dom/server.tsx :) + if (val && val.__type === "RouteErrorResponse") { + serialized[key] = new _remix_run_router__WEBPACK_IMPORTED_MODULE_2__["ErrorResponse"](val.status, val.statusText, val.data, val.internal === true); + } else if (val && val.__type === "Error") { + let error = new Error(val.message); // Wipe away the client-side stack trace. Nothing to fill it in with + // because we don't serialize SSR stack traces for security reasons + + error.stack = ""; + serialized[key] = error; + } else { + serialized[key] = val; + } + } + + return serialized; +} +/** + * A `<Router>` for use in web browsers. Provides the cleanest URLs. + */ + + +function BrowserRouter(_ref) { + let { + basename, + children, + window + } = _ref; + let historyRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"](); + + if (historyRef.current == null) { + historyRef.current = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["createBrowserHistory"])({ + window, + v5Compat: true + }); + } + + let history = historyRef.current; + let [state, setState] = react__WEBPACK_IMPORTED_MODULE_0__["useState"]({ + action: history.action, + location: history.location + }); + react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => history.listen(setState), [history]); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react_router__WEBPACK_IMPORTED_MODULE_1__["Router"], { + basename: basename, + children: children, + location: state.location, + navigationType: state.action, + navigator: history + }); +} +/** + * A `<Router>` for use in web browsers. Stores the location in the hash + * portion of the URL so it is not sent to the server. + */ + +function HashRouter(_ref2) { + let { + basename, + children, + window + } = _ref2; + let historyRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"](); + + if (historyRef.current == null) { + historyRef.current = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["createHashHistory"])({ + window, + v5Compat: true + }); + } + + let history = historyRef.current; + let [state, setState] = react__WEBPACK_IMPORTED_MODULE_0__["useState"]({ + action: history.action, + location: history.location + }); + react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => history.listen(setState), [history]); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react_router__WEBPACK_IMPORTED_MODULE_1__["Router"], { + basename: basename, + children: children, + location: state.location, + navigationType: state.action, + navigator: history + }); +} +/** + * A `<Router>` that accepts a pre-instantiated history object. It's important + * to note that using your own history object is highly discouraged and may add + * two versions of the history library to your bundles unless you use the same + * version of the history library that React Router uses internally. + */ + +function HistoryRouter(_ref3) { + let { + basename, + children, + history + } = _ref3; + const [state, setState] = react__WEBPACK_IMPORTED_MODULE_0__["useState"]({ + action: history.action, + location: history.location + }); + react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => history.listen(setState), [history]); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react_router__WEBPACK_IMPORTED_MODULE_1__["Router"], { + basename: basename, + children: children, + location: state.location, + navigationType: state.action, + navigator: history + }); +} + +if (false) {} +/** + * The public API for rendering a history-aware <a>. + */ + +const Link = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"](function LinkWithRef(_ref4, ref) { + let { + onClick, + relative, + reloadDocument, + replace, + state, + target, + to, + preventScrollReset + } = _ref4, + rest = _objectWithoutPropertiesLoose(_ref4, _excluded); + + let href = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useHref"])(to, { + relative + }); + let internalOnClick = useLinkClickHandler(to, { + replace, + state, + target, + preventScrollReset, + relative + }); + + function handleClick(event) { + if (onClick) onClick(event); + + if (!event.defaultPrevented) { + internalOnClick(event); + } + } + + return ( + /*#__PURE__*/ + // eslint-disable-next-line jsx-a11y/anchor-has-content + react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("a", _extends({}, rest, { + href: href, + onClick: reloadDocument ? onClick : handleClick, + ref: ref, + target: target + })) + ); +}); + +if (false) {} +/** + * A <Link> wrapper that knows if it's "active" or not. + */ + + +const NavLink = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"](function NavLinkWithRef(_ref5, ref) { + let { + "aria-current": ariaCurrentProp = "page", + caseSensitive = false, + className: classNameProp = "", + end = false, + style: styleProp, + to, + children + } = _ref5, + rest = _objectWithoutPropertiesLoose(_ref5, _excluded2); + + let path = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useResolvedPath"])(to, { + relative: rest.relative + }); + let location = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useLocation"])(); + let routerState = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_DataRouterStateContext"]); + let { + navigator + } = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_NavigationContext"]); + let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname; + let locationPathname = location.pathname; + let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null; + + if (!caseSensitive) { + locationPathname = locationPathname.toLowerCase(); + nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null; + toPathname = toPathname.toLowerCase(); + } + + let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/"; + let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/"); + let ariaCurrent = isActive ? ariaCurrentProp : undefined; + let className; + + if (typeof classNameProp === "function") { + className = classNameProp({ + isActive, + isPending + }); + } else { + // If the className prop is not a function, we use a default `active` + // class for <NavLink />s that are active. In v5 `active` was the default + // value for `activeClassName`, but we are removing that API and can still + // use the old default behavior for a cleaner upgrade path and keep the + // simple styling rules working as they currently do. + className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null].filter(Boolean).join(" "); + } + + let style = typeof styleProp === "function" ? styleProp({ + isActive, + isPending + }) : styleProp; + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](Link, _extends({}, rest, { + "aria-current": ariaCurrent, + className: className, + ref: ref, + style: style, + to: to + }), typeof children === "function" ? children({ + isActive, + isPending + }) : children); +}); + +if (false) {} +/** + * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except + * that the interaction with the server is with `fetch` instead of new document + * requests, allowing components to add nicer UX to the page as the form is + * submitted and returns with data. + */ + + +const Form = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"]((props, ref) => { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](FormImpl, _extends({}, props, { + ref: ref + })); +}); + +if (false) {} + +const FormImpl = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"]((_ref6, forwardedRef) => { + let { + reloadDocument, + replace, + method = defaultMethod, + action, + onSubmit, + fetcherKey, + routeId, + relative + } = _ref6, + props = _objectWithoutPropertiesLoose(_ref6, _excluded3); + + let submit = useSubmitImpl(fetcherKey, routeId); + let formMethod = method.toLowerCase() === "get" ? "get" : "post"; + let formAction = useFormAction(action, { + relative + }); + + let submitHandler = event => { + onSubmit && onSubmit(event); + if (event.defaultPrevented) return; + event.preventDefault(); + let submitter = event.nativeEvent.submitter; + let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method; + submit(submitter || event.currentTarget, { + method: submitMethod, + replace, + relative + }); + }; + + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("form", _extends({ + ref: forwardedRef, + method: formMethod, + action: formAction, + onSubmit: reloadDocument ? onSubmit : submitHandler + }, props)); +}); + +if (false) {} +/** + * This component will emulate the browser's scroll restoration on location + * changes. + */ + + +function ScrollRestoration(_ref7) { + let { + getKey, + storageKey + } = _ref7; + useScrollRestoration({ + getKey, + storageKey + }); + return null; +} + +if (false) {} //#endregion +//////////////////////////////////////////////////////////////////////////////// +//#region Hooks +//////////////////////////////////////////////////////////////////////////////// + + +var DataRouterHook; + +(function (DataRouterHook) { + DataRouterHook["UseScrollRestoration"] = "useScrollRestoration"; + DataRouterHook["UseSubmitImpl"] = "useSubmitImpl"; + DataRouterHook["UseFetcher"] = "useFetcher"; +})(DataRouterHook || (DataRouterHook = {})); + +var DataRouterStateHook; + +(function (DataRouterStateHook) { + DataRouterStateHook["UseFetchers"] = "useFetchers"; + DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration"; +})(DataRouterStateHook || (DataRouterStateHook = {})); + +function getDataRouterConsoleError(hookName) { + return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router."; +} + +function useDataRouterContext(hookName) { + let ctx = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_DataRouterContext"]); + !ctx ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + return ctx; +} + +function useDataRouterState(hookName) { + let state = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_DataRouterStateContext"]); + !state ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + return state; +} +/** + * Handles the click behavior for router `<Link>` components. This is useful if + * you need to create custom `<Link>` components with the same click behavior we + * use in our exported `<Link>`. + */ + + +function useLinkClickHandler(to, _temp) { + let { + target, + replace: replaceProp, + state, + preventScrollReset, + relative + } = _temp === void 0 ? {} : _temp; + let navigate = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useNavigate"])(); + let location = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useLocation"])(); + let path = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useResolvedPath"])(to, { + relative + }); + return react__WEBPACK_IMPORTED_MODULE_0__["useCallback"](event => { + if (shouldProcessLinkClick(event, target)) { + event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of + // a push, so do the same here unless the replace prop is explicitly set + + let replace = replaceProp !== undefined ? replaceProp : Object(react_router__WEBPACK_IMPORTED_MODULE_1__["createPath"])(location) === Object(react_router__WEBPACK_IMPORTED_MODULE_1__["createPath"])(path); + navigate(to, { + replace, + state, + preventScrollReset, + relative + }); + } + }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative]); +} +/** + * A convenient wrapper for reading and writing search parameters via the + * URLSearchParams interface. + */ + +function useSearchParams(defaultInit) { + false ? undefined : void 0; + let defaultSearchParamsRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"](createSearchParams(defaultInit)); + let location = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useLocation"])(); + let searchParams = react__WEBPACK_IMPORTED_MODULE_0__["useMemo"](() => getSearchParamsForLocation(location.search, defaultSearchParamsRef.current), [location.search]); + let navigate = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useNavigate"])(); + let setSearchParams = react__WEBPACK_IMPORTED_MODULE_0__["useCallback"]((nextInit, navigateOptions) => { + const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit); + navigate("?" + newSearchParams, navigateOptions); + }, [navigate, searchParams]); + return [searchParams, setSearchParams]; +} +/** + * Returns a function that may be used to programmatically submit a form (or + * some arbitrary data) to the server. + */ + +function useSubmit() { + return useSubmitImpl(); +} + +function useSubmitImpl(fetcherKey, routeId) { + let { + router + } = useDataRouterContext(DataRouterHook.UseSubmitImpl); + let defaultAction = useFormAction(); + return react__WEBPACK_IMPORTED_MODULE_0__["useCallback"](function (target, options) { + if (options === void 0) { + options = {}; + } + + if (typeof document === "undefined") { + throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead."); + } + + let { + method, + encType, + formData, + url + } = getFormSubmissionInfo(target, defaultAction, options); + let href = url.pathname + url.search; + let opts = { + replace: options.replace, + formData, + formMethod: method, + formEncType: encType + }; + + if (fetcherKey) { + !(routeId != null) ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + router.fetch(fetcherKey, routeId, href, opts); + } else { + router.navigate(href, opts); + } + }, [defaultAction, router, fetcherKey, routeId]); +} + +function useFormAction(action, _temp2) { + let { + relative + } = _temp2 === void 0 ? {} : _temp2; + let { + basename + } = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_NavigationContext"]); + let routeContext = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_RouteContext"]); + !routeContext ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + let [match] = routeContext.matches.slice(-1); // Shallow clone path so we can modify it below, otherwise we modify the + // object referenced by useMemo inside useResolvedPath + + let path = _extends({}, Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useResolvedPath"])(action ? action : ".", { + relative + })); // Previously we set the default action to ".". The problem with this is that + // `useResolvedPath(".")` excludes search params and the hash of the resolved + // URL. This is the intended behavior of when "." is specifically provided as + // the form action, but inconsistent w/ browsers when the action is omitted. + // https://github.com/remix-run/remix/issues/927 + + + let location = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useLocation"])(); + + if (action == null) { + // Safe to write to these directly here since if action was undefined, we + // would have called useResolvedPath(".") which will never include a search + // or hash + path.search = location.search; + path.hash = location.hash; // When grabbing search params from the URL, remove the automatically + // inserted ?index param so we match the useResolvedPath search behavior + // which would not include ?index + + if (match.route.index) { + let params = new URLSearchParams(path.search); + params.delete("index"); + path.search = params.toString() ? "?" + params.toString() : ""; + } + } + + if ((!action || action === ".") && match.route.index) { + path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index"; + } // If we're operating within a basename, prepend it to the pathname prior + // to creating the form action. If this is a root navigation, then just use + // the raw basename which allows the basename to have full control over the + // presence of a trailing slash on root actions + + + if (basename !== "/") { + path.pathname = path.pathname === "/" ? basename : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["joinPaths"])([basename, path.pathname]); + } + + return Object(react_router__WEBPACK_IMPORTED_MODULE_1__["createPath"])(path); +} + +function createFetcherForm(fetcherKey, routeId) { + let FetcherForm = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"]((props, ref) => { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](FormImpl, _extends({}, props, { + ref: ref, + fetcherKey: fetcherKey, + routeId: routeId + })); + }); + + if (false) {} + + return FetcherForm; +} + +let fetcherId = 0; +/** + * Interacts with route loaders and actions without causing a navigation. Great + * for any interaction that stays on the same page. + */ + +function useFetcher() { + var _route$matches; + + let { + router + } = useDataRouterContext(DataRouterHook.UseFetcher); + let route = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](react_router__WEBPACK_IMPORTED_MODULE_1__["UNSAFE_RouteContext"]); + !route ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id; + !(routeId != null) ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + let [fetcherKey] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](() => String(++fetcherId)); + let [Form] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](() => { + !routeId ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + return createFetcherForm(fetcherKey, routeId); + }); + let [load] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](() => href => { + !router ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + !routeId ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_2__["invariant"])(false) : void 0; + router.fetch(fetcherKey, routeId, href); + }); + let submit = useSubmitImpl(fetcherKey, routeId); + let fetcher = router.getFetcher(fetcherKey); + let fetcherWithComponents = react__WEBPACK_IMPORTED_MODULE_0__["useMemo"](() => _extends({ + Form, + submit, + load + }, fetcher), [fetcher, Form, submit, load]); + react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => { + // Is this busted when the React team gets real weird and calls effects + // twice on mount? We really just need to garbage collect here when this + // fetcher is no longer around. + return () => { + if (!router) { + console.warn("No fetcher available to clean up from useFetcher()"); + return; + } + + router.deleteFetcher(fetcherKey); + }; + }, [router, fetcherKey]); + return fetcherWithComponents; +} +/** + * Provides all fetchers currently on the page. Useful for layouts and parent + * routes that need to provide pending/optimistic UI regarding the fetch. + */ + +function useFetchers() { + let state = useDataRouterState(DataRouterStateHook.UseFetchers); + return [...state.fetchers.values()]; +} +const SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions"; +let savedScrollPositions = {}; +/** + * When rendered inside a RouterProvider, will restore scroll positions on navigations + */ + +function useScrollRestoration(_temp3) { + let { + getKey, + storageKey + } = _temp3 === void 0 ? {} : _temp3; + let { + router + } = useDataRouterContext(DataRouterHook.UseScrollRestoration); + let { + restoreScrollPosition, + preventScrollReset + } = useDataRouterState(DataRouterStateHook.UseScrollRestoration); + let location = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useLocation"])(); + let matches = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useMatches"])(); + let navigation = Object(react_router__WEBPACK_IMPORTED_MODULE_1__["useNavigation"])(); // Trigger manual scroll restoration while we're active + + react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => { + window.history.scrollRestoration = "manual"; + return () => { + window.history.scrollRestoration = "auto"; + }; + }, []); // Save positions on unload + + useBeforeUnload(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"](() => { + if (navigation.state === "idle") { + let key = (getKey ? getKey(location, matches) : null) || location.key; + savedScrollPositions[key] = window.scrollY; + } + + sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions)); + window.history.scrollRestoration = "auto"; + }, [storageKey, getKey, navigation.state, location, matches])); // Read in any saved scroll locations + + if (typeof document !== "undefined") { + // eslint-disable-next-line react-hooks/rules-of-hooks + react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => { + try { + let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY); + + if (sessionPositions) { + savedScrollPositions = JSON.parse(sessionPositions); + } + } catch (e) {// no-op, use default empty object + } + }, [storageKey]); // Enable scroll restoration in the router + // eslint-disable-next-line react-hooks/rules-of-hooks + + react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => { + let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey); + return () => disableScrollRestoration && disableScrollRestoration(); + }, [router, getKey]); // Restore scrolling when state.restoreScrollPosition changes + // eslint-disable-next-line react-hooks/rules-of-hooks + + react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => { + // Explicit false means don't do anything (used for submissions) + if (restoreScrollPosition === false) { + return; + } // been here before, scroll to it + + + if (typeof restoreScrollPosition === "number") { + window.scrollTo(0, restoreScrollPosition); + return; + } // try to scroll to the hash + + + if (location.hash) { + let el = document.getElementById(location.hash.slice(1)); + + if (el) { + el.scrollIntoView(); + return; + } + } // Opt out of scroll reset if this link requested it + + + if (preventScrollReset === true) { + return; + } // otherwise go to the top on new locations + + + window.scrollTo(0, 0); + }, [location, restoreScrollPosition, preventScrollReset]); + } +} +/** + * Setup a callback to be fired on the window's `beforeunload` event. This is + * useful for saving some data to `window.localStorage` just before the page + * refreshes. + * + * Note: The `callback` argument should be a function created with + * `React.useCallback()`. + */ + + +function useBeforeUnload(callback) { + react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => { + window.addEventListener("beforeunload", callback); + return () => { + window.removeEventListener("beforeunload", callback); + }; + }, [callback]); +} //#endregion +//////////////////////////////////////////////////////////////////////////////// +//#region Utils +//////////////////////////////////////////////////////////////////////////////// + +function warning(cond, message) { + if (!cond) { + // eslint-disable-next-line no-console + if (typeof console !== "undefined") console.warn(message); + + try { + // Welcome to debugging React Router! + // + // This error is thrown as a convenience so you can more easily + // find the source for a warning that appears in the console by + // enabling "pause on exceptions" in your JavaScript debugger. + throw new Error(message); // eslint-disable-next-line no-empty + } catch (e) {} + } +} //#endregion + + +//# sourceMappingURL=index.js.map + + /***/ }), /***/ "SPin": @@ -224743,698 +225320,6 @@ var isCordova = function isCordova() { exports.isCordova = isCordova; -/***/ }), - -/***/ "Ty5D": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MemoryRouter", function() { return MemoryRouter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Prompt", function() { return Prompt; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Redirect", function() { return Redirect; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return Route; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return Router; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticRouter", function() { return StaticRouter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__HistoryContext", function() { return historyContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__RouterContext", function() { return context; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generatePath", function() { return generatePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchPath", function() { return matchPath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useHistory", function() { return useHistory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLocation", function() { return useLocation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useParams", function() { return useParams; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRouteMatch", function() { return useRouteMatch; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withRouter", function() { return withRouter; }); -/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("dI71"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("q1tI"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("17x9"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("LhCv"); -/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("LUQC"); -/* harmony import */ var mini_create_react_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("tEiQ"); -/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("9R94"); -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("wx14"); -/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("vRGJ"); -/* harmony import */ var path_to_regexp__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(path_to_regexp__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("TOwV"); -/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_is__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("zLVn"); -/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("2mql"); -/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_11__); - - - - - - - - - - - - - -// TODO: Replace with React.createContext once we can assume React 16+ - -var createNamedContext = function createNamedContext(name) { - var context = Object(mini_create_react_context__WEBPACK_IMPORTED_MODULE_5__["default"])(); - context.displayName = name; - return context; -}; - -var historyContext = /*#__PURE__*/createNamedContext("Router-History"); - -var context = /*#__PURE__*/createNamedContext("Router"); - -/** - * The public API for putting history on context. - */ - -var Router = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(Router, _React$Component); - - Router.computeRootMatch = function computeRootMatch(pathname) { - return { - path: "/", - url: "/", - params: {}, - isExact: pathname === "/" - }; - }; - - function Router(props) { - var _this; - - _this = _React$Component.call(this, props) || this; - _this.state = { - location: props.history.location - }; // This is a bit of a hack. We have to start listening for location - // changes here in the constructor in case there are any <Redirect>s - // on the initial render. If there are, they will replace/push when - // they mount and since cDM fires in children before parents, we may - // get a new location before the <Router> is mounted. - - _this._isMounted = false; - _this._pendingLocation = null; - - if (!props.staticContext) { - _this.unlisten = props.history.listen(function (location) { - _this._pendingLocation = location; - }); - } - - return _this; - } - - var _proto = Router.prototype; - - _proto.componentDidMount = function componentDidMount() { - var _this2 = this; - - this._isMounted = true; - - if (this.unlisten) { - // Any pre-mount location changes have been captured at - // this point, so unregister the listener. - this.unlisten(); - } - - if (!this.props.staticContext) { - this.unlisten = this.props.history.listen(function (location) { - if (_this2._isMounted) { - _this2.setState({ - location: location - }); - } - }); - } - - if (this._pendingLocation) { - this.setState({ - location: this._pendingLocation - }); - } - }; - - _proto.componentWillUnmount = function componentWillUnmount() { - if (this.unlisten) { - this.unlisten(); - this._isMounted = false; - this._pendingLocation = null; - } - }; - - _proto.render = function render() { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Provider, { - value: { - history: this.props.history, - location: this.state.location, - match: Router.computeRootMatch(this.state.location.pathname), - staticContext: this.props.staticContext - } - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(historyContext.Provider, { - children: this.props.children || null, - value: this.props.history - })); - }; - - return Router; -}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); - -if (false) {} - -/** - * The public API for a <Router> that stores location in memory. - */ - -var MemoryRouter = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(MemoryRouter, _React$Component); - - function MemoryRouter() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; - _this.history = Object(history__WEBPACK_IMPORTED_MODULE_3__["createMemoryHistory"])(_this.props); - return _this; - } - - var _proto = MemoryRouter.prototype; - - _proto.render = function render() { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Router, { - history: this.history, - children: this.props.children - }); - }; - - return MemoryRouter; -}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); - -if (false) {} - -var Lifecycle = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(Lifecycle, _React$Component); - - function Lifecycle() { - return _React$Component.apply(this, arguments) || this; - } - - var _proto = Lifecycle.prototype; - - _proto.componentDidMount = function componentDidMount() { - if (this.props.onMount) this.props.onMount.call(this, this); - }; - - _proto.componentDidUpdate = function componentDidUpdate(prevProps) { - if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps); - }; - - _proto.componentWillUnmount = function componentWillUnmount() { - if (this.props.onUnmount) this.props.onUnmount.call(this, this); - }; - - _proto.render = function render() { - return null; - }; - - return Lifecycle; -}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); - -/** - * The public API for prompting the user before navigating away from a screen. - */ - -function Prompt(_ref) { - var message = _ref.message, - _ref$when = _ref.when, - when = _ref$when === void 0 ? true : _ref$when; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { - !context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false) : void 0; - if (!when || context.staticContext) return null; - var method = context.history.block; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Lifecycle, { - onMount: function onMount(self) { - self.release = method(message); - }, - onUpdate: function onUpdate(self, prevProps) { - if (prevProps.message !== message) { - self.release(); - self.release = method(message); - } - }, - onUnmount: function onUnmount(self) { - self.release(); - }, - message: message - }); - }); -} - -if (false) { var messageType; } - -var cache = {}; -var cacheLimit = 10000; -var cacheCount = 0; - -function compilePath(path) { - if (cache[path]) return cache[path]; - var generator = path_to_regexp__WEBPACK_IMPORTED_MODULE_8___default.a.compile(path); - - if (cacheCount < cacheLimit) { - cache[path] = generator; - cacheCount++; - } - - return generator; -} -/** - * Public API for generating a URL pathname from a path and parameters. - */ - - -function generatePath(path, params) { - if (path === void 0) { - path = "/"; - } - - if (params === void 0) { - params = {}; - } - - return path === "/" ? path : compilePath(path)(params, { - pretty: true - }); -} - -/** - * The public API for navigating programmatically with a component. - */ - -function Redirect(_ref) { - var computedMatch = _ref.computedMatch, - to = _ref.to, - _ref$push = _ref.push, - push = _ref$push === void 0 ? false : _ref$push; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { - !context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false) : void 0; - var history = context.history, - staticContext = context.staticContext; - var method = push ? history.push : history.replace; - var location = Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, to, { - pathname: generatePath(to.pathname, computedMatch.params) - }) : to); // When rendering in a static context, - // set the new location immediately. - - if (staticContext) { - method(location); - return null; - } - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Lifecycle, { - onMount: function onMount() { - method(location); - }, - onUpdate: function onUpdate(self, prevProps) { - var prevLocation = Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(prevProps.to); - - if (!Object(history__WEBPACK_IMPORTED_MODULE_3__["locationsAreEqual"])(prevLocation, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, location, { - key: prevLocation.key - }))) { - method(location); - } - }, - to: to - }); - }); -} - -if (false) {} - -var cache$1 = {}; -var cacheLimit$1 = 10000; -var cacheCount$1 = 0; - -function compilePath$1(path, options) { - var cacheKey = "" + options.end + options.strict + options.sensitive; - var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {}); - if (pathCache[path]) return pathCache[path]; - var keys = []; - var regexp = path_to_regexp__WEBPACK_IMPORTED_MODULE_8___default()(path, keys, options); - var result = { - regexp: regexp, - keys: keys - }; - - if (cacheCount$1 < cacheLimit$1) { - pathCache[path] = result; - cacheCount$1++; - } - - return result; -} -/** - * Public API for matching a URL pathname to a path. - */ - - -function matchPath(pathname, options) { - if (options === void 0) { - options = {}; - } - - if (typeof options === "string" || Array.isArray(options)) { - options = { - path: options - }; - } - - var _options = options, - path = _options.path, - _options$exact = _options.exact, - exact = _options$exact === void 0 ? false : _options$exact, - _options$strict = _options.strict, - strict = _options$strict === void 0 ? false : _options$strict, - _options$sensitive = _options.sensitive, - sensitive = _options$sensitive === void 0 ? false : _options$sensitive; - var paths = [].concat(path); - return paths.reduce(function (matched, path) { - if (!path && path !== "") return null; - if (matched) return matched; - - var _compilePath = compilePath$1(path, { - end: exact, - strict: strict, - sensitive: sensitive - }), - regexp = _compilePath.regexp, - keys = _compilePath.keys; - - var match = regexp.exec(pathname); - if (!match) return null; - var url = match[0], - values = match.slice(1); - var isExact = pathname === url; - if (exact && !isExact) return null; - return { - path: path, - // the path used to match - url: path === "/" && url === "" ? "/" : url, - // the matched portion of the URL - isExact: isExact, - // whether or not we matched exactly - params: keys.reduce(function (memo, key, index) { - memo[key.name] = values[index]; - return memo; - }, {}) - }; - }, null); -} - -function isEmptyChildren(children) { - return react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.count(children) === 0; -} - -function evalChildrenDev(children, props, path) { - var value = children(props); - false ? undefined : void 0; - return value || null; -} -/** - * The public API for matching a single path and rendering. - */ - - -var Route = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(Route, _React$Component); - - function Route() { - return _React$Component.apply(this, arguments) || this; - } - - var _proto = Route.prototype; - - _proto.render = function render() { - var _this = this; - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context$1) { - !context$1 ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false) : void 0; - var location = _this.props.location || context$1.location; - var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us - : _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match; - - var props = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, context$1, { - location: location, - match: match - }); - - var _this$props = _this.props, - children = _this$props.children, - component = _this$props.component, - render = _this$props.render; // Preact uses an empty array as children by - // default, so use null if that's the case. - - if (Array.isArray(children) && isEmptyChildren(children)) { - children = null; - } - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Provider, { - value: props - }, props.match ? children ? typeof children === "function" ? false ? undefined : children(props) : children : component ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? false ? undefined : children(props) : null); - }); - }; - - return Route; -}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); - -if (false) {} - -function addLeadingSlash(path) { - return path.charAt(0) === "/" ? path : "/" + path; -} - -function addBasename(basename, location) { - if (!basename) return location; - return Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, location, { - pathname: addLeadingSlash(basename) + location.pathname - }); -} - -function stripBasename(basename, location) { - if (!basename) return location; - var base = addLeadingSlash(basename); - if (location.pathname.indexOf(base) !== 0) return location; - return Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, location, { - pathname: location.pathname.substr(base.length) - }); -} - -function createURL(location) { - return typeof location === "string" ? location : Object(history__WEBPACK_IMPORTED_MODULE_3__["createPath"])(location); -} - -function staticHandler(methodName) { - return function () { - false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false) ; - }; -} - -function noop() {} -/** - * The public top-level API for a "static" <Router>, so-called because it - * can't actually change the current location. Instead, it just records - * location changes in a context object. Useful mainly in testing and - * server-rendering scenarios. - */ - - -var StaticRouter = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(StaticRouter, _React$Component); - - function StaticRouter() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; - - _this.handlePush = function (location) { - return _this.navigateTo(location, "PUSH"); - }; - - _this.handleReplace = function (location) { - return _this.navigateTo(location, "REPLACE"); - }; - - _this.handleListen = function () { - return noop; - }; - - _this.handleBlock = function () { - return noop; - }; - - return _this; - } - - var _proto = StaticRouter.prototype; - - _proto.navigateTo = function navigateTo(location, action) { - var _this$props = this.props, - _this$props$basename = _this$props.basename, - basename = _this$props$basename === void 0 ? "" : _this$props$basename, - _this$props$context = _this$props.context, - context = _this$props$context === void 0 ? {} : _this$props$context; - context.action = action; - context.location = addBasename(basename, Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(location)); - context.url = createURL(context.location); - }; - - _proto.render = function render() { - var _this$props2 = this.props, - _this$props2$basename = _this$props2.basename, - basename = _this$props2$basename === void 0 ? "" : _this$props2$basename, - _this$props2$context = _this$props2.context, - context = _this$props2$context === void 0 ? {} : _this$props2$context, - _this$props2$location = _this$props2.location, - location = _this$props2$location === void 0 ? "/" : _this$props2$location, - rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_10__["default"])(_this$props2, ["basename", "context", "location"]); - - var history = { - createHref: function createHref(path) { - return addLeadingSlash(basename + createURL(path)); - }, - action: "POP", - location: stripBasename(basename, Object(history__WEBPACK_IMPORTED_MODULE_3__["createLocation"])(location)), - push: this.handlePush, - replace: this.handleReplace, - go: staticHandler("go"), - goBack: staticHandler("goBack"), - goForward: staticHandler("goForward"), - listen: this.handleListen, - block: this.handleBlock - }; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Router, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, rest, { - history: history, - staticContext: context - })); - }; - - return StaticRouter; -}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); - -if (false) {} - -/** - * The public API for rendering the first <Route> that matches. - */ - -var Switch = /*#__PURE__*/function (_React$Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(Switch, _React$Component); - - function Switch() { - return _React$Component.apply(this, arguments) || this; - } - - var _proto = Switch.prototype; - - _proto.render = function render() { - var _this = this; - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { - !context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false) : void 0; - var location = _this.props.location || context.location; - var element, match; // We use React.Children.forEach instead of React.Children.toArray().find() - // here because toArray adds keys to all child elements and we do not want - // to trigger an unmount/remount for two <Route>s that render the same - // component at different URLs. - - react__WEBPACK_IMPORTED_MODULE_1___default.a.Children.forEach(_this.props.children, function (child) { - if (match == null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.isValidElement(child)) { - element = child; - var path = child.props.path || child.props.from; - match = path ? matchPath(location.pathname, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, child.props, { - path: path - })) : context.match; - } - }); - return match ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.cloneElement(element, { - location: location, - computedMatch: match - }) : null; - }); - }; - - return Switch; -}(react__WEBPACK_IMPORTED_MODULE_1___default.a.Component); - -if (false) {} - -/** - * A public higher-order component to access the imperative API - */ - -function withRouter(Component) { - var displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; - - var C = function C(props) { - var wrappedComponentRef = props.wrappedComponentRef, - remainingProps = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_10__["default"])(props, ["wrappedComponentRef"]); - - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(context.Consumer, null, function (context) { - !context ? false ? undefined : Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_6__["default"])(false) : void 0; - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Component, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_7__["default"])({}, remainingProps, context, { - ref: wrappedComponentRef - })); - }); - }; - - C.displayName = displayName; - C.WrappedComponent = Component; - - if (false) {} - - return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_11___default()(C, Component); -} - -var useContext = react__WEBPACK_IMPORTED_MODULE_1___default.a.useContext; -function useHistory() { - if (false) {} - - return useContext(historyContext); -} -function useLocation() { - if (false) {} - - return useContext(context).location; -} -function useParams() { - if (false) {} - - var match = useContext(context).match; - return match ? match.params : {}; -} -function useRouteMatch(path) { - if (false) {} - - var location = useLocation(); - var match = useContext(context).match; - return path ? matchPath(location.pathname, path) : match; -} - -if (false) { var secondaryBuildName, initialBuildName, buildNames, key, global; } - - -//# sourceMappingURL=react-router.js.map - - /***/ }), /***/ "TyMH": @@ -236571,6 +236456,1385 @@ var PreloginRequest = function PreloginRequest(email) { this.email = email; }; +/***/ }), + +/***/ "V4z/": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Await", function() { return Await; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MemoryRouter", function() { return MemoryRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Navigate", function() { return Navigate; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Outlet", function() { return Outlet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Route", function() { return Route; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return Router; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterProvider", function() { return RouterProvider; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Routes", function() { return Routes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_DataRouterContext", function() { return DataRouterContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_DataRouterStateContext", function() { return DataRouterStateContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_DataStaticRouterContext", function() { return DataStaticRouterContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_LocationContext", function() { return LocationContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_NavigationContext", function() { return NavigationContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_RouteContext", function() { return RouteContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_enhanceManualRouteObjects", function() { return enhanceManualRouteObjects; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMemoryRouter", function() { return createMemoryRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRoutesFromChildren", function() { return createRoutesFromChildren; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRoutesFromElements", function() { return createRoutesFromChildren; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMatches", function() { return renderMatches; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useActionData", function() { return useActionData; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useAsyncError", function() { return useAsyncError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useAsyncValue", function() { return useAsyncValue; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useHref", function() { return useHref; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useInRouterContext", function() { return useInRouterContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLoaderData", function() { return useLoaderData; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLocation", function() { return useLocation; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useMatch", function() { return useMatch; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useMatches", function() { return useMatches; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useNavigate", function() { return useNavigate; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useNavigation", function() { return useNavigation; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useNavigationType", function() { return useNavigationType; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useOutlet", function() { return useOutlet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useOutletContext", function() { return useOutletContext; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useParams", function() { return useParams; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useResolvedPath", function() { return useResolvedPath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRevalidator", function() { return useRevalidator; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRouteError", function() { return useRouteError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRouteLoaderData", function() { return useRouteLoaderData; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRoutes", function() { return useRoutes; }); +/* harmony import */ var _remix_run_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("hk2M"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbortedDeferredError", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["AbortedDeferredError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NavigationType", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["Action"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["createPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["defer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "generatePath", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["generatePath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isRouteErrorResponse", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["isRouteErrorResponse"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "json", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["json"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matchPath", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["matchPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "matchRoutes", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["matchRoutes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["parsePath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "redirect", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["redirect"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resolvePath", function() { return _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["resolvePath"]; }); + +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("q1tI"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); +/** + * React Router v6.6.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ + + + + +function _extends() { + _extends = Object.assign ? Object.assign.bind() : 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); +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + +function isPolyfill(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} + +const is = typeof Object.is === "function" ? Object.is : isPolyfill; // Intentionally not using named imports because Rollup uses dynamic +// dispatch for CommonJS interop named imports. + +const { + useState, + useEffect, + useLayoutEffect, + useDebugValue +} = react__WEBPACK_IMPORTED_MODULE_1__; +let didWarnOld18Alpha = false; +let didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works +// because of a very particular set of implementation details and assumptions +// -- change any one of them and it will break. The most important assumption +// is that updates are always synchronous, because concurrent rendering is +// only available in versions of React that also have a built-in +// useSyncExternalStore API. And we only use this shim when the built-in API +// does not exist. +// +// Do not assume that the clever hacks used by this hook also work in general. +// The point of this shim is to replace the need for hacks by other libraries. + +function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of +// React do not expose a way to check if we're hydrating. So users of the shim +// will need to track that themselves and return the correct value +// from `getSnapshot`. +getServerSnapshot) { + if (false) {} // Read the current snapshot from the store on every render. Again, this + // breaks the rules of React, and only works here because of specific + // implementation details, most importantly that updates are + // always synchronous. + + + const value = getSnapshot(); + + if (false) {} // Because updates are synchronous, we don't queue them. Instead we force a + // re-render whenever the subscribed state changes by updating an some + // arbitrary useState hook. Then, during render, we call getSnapshot to read + // the current value. + // + // Because we don't actually use the state returned by the useState hook, we + // can save a bit of memory by storing other stuff in that slot. + // + // To implement the early bailout, we need to track some things on a mutable + // object. Usually, we would put that in a useRef hook, but we can stash it in + // our useState hook instead. + // + // To force a re-render, we call forceUpdate({inst}). That works because the + // new object always fails an equality check. + + + const [{ + inst + }, forceUpdate] = useState({ + inst: { + value, + getSnapshot + } + }); // Track the latest getSnapshot function with a ref. This needs to be updated + // in the layout phase so we can access it during the tearing check that + // happens on subscribe. + + useLayoutEffect(() => { + inst.value = value; + inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the + // commit phase if there was an interleaved mutation. In concurrent mode + // this can happen all the time, but even in synchronous mode, an earlier + // effect may have mutated the store. + + if (checkIfSnapshotChanged(inst)) { + // Force a re-render. + forceUpdate({ + inst + }); + } // eslint-disable-next-line react-hooks/exhaustive-deps + + }, [subscribe, value, getSnapshot]); + useEffect(() => { + // Check for changes right before subscribing. Subsequent changes will be + // detected in the subscription handler. + if (checkIfSnapshotChanged(inst)) { + // Force a re-render. + forceUpdate({ + inst + }); + } + + const handleStoreChange = () => { + // TODO: Because there is no cross-renderer API for batching updates, it's + // up to the consumer of this library to wrap their subscription event + // with unstable_batchedUpdates. Should we try to detect when this isn't + // the case and print a warning in development? + // The store changed. Check if the snapshot changed since the last time we + // read from the store. + if (checkIfSnapshotChanged(inst)) { + // Force a re-render. + forceUpdate({ + inst + }); + } + }; // Subscribe to the store and return a clean-up function. + + + return subscribe(handleStoreChange); // eslint-disable-next-line react-hooks/exhaustive-deps + }, [subscribe]); + useDebugValue(value); + return value; +} + +function checkIfSnapshotChanged(inst) { + const latestGetSnapshot = inst.getSnapshot; + const prevValue = inst.value; + + try { + const nextValue = latestGetSnapshot(); + return !is(prevValue, nextValue); + } catch (error) { + return true; + } +} + +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ +function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) { + // Note: The shim does not use getServerSnapshot, because pre-18 versions of + // React do not expose a way to check if we're hydrating. So users of the shim + // will need to track that themselves and return the correct value + // from `getSnapshot`. + return getSnapshot(); +} + +/** + * Inlined into the react-router repo since use-sync-external-store does not + * provide a UMD-compatible package, so we need this to be able to distribute + * UMD react-router bundles + */ +const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"); +const isServerEnvironment = !canUseDOM; +const shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2; +const useSyncExternalStore = "useSyncExternalStore" in react__WEBPACK_IMPORTED_MODULE_1__ ? (module => module.useSyncExternalStore)(react__WEBPACK_IMPORTED_MODULE_1__) : shim; + +// Contexts for data routers +const DataStaticRouterContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +const DataRouterContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +const DataRouterStateContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +const AwaitContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +const NavigationContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +const LocationContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +const RouteContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"]({ + outlet: null, + matches: [] +}); + +if (false) {} + +const RouteErrorContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); + +if (false) {} + +/** + * Returns the full href for the given "to" value. This is useful for building + * custom links that are also accessible and preserve right-click behavior. + * + * @see https://reactrouter.com/hooks/use-href + */ + +function useHref(to, _temp) { + let { + relative + } = _temp === void 0 ? {} : _temp; + !useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + let { + basename, + navigator + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](NavigationContext); + let { + hash, + pathname, + search + } = useResolvedPath(to, { + relative + }); + let joinedPathname = pathname; // If we're operating within a basename, prepend it to the pathname prior + // to creating the href. If this is a root navigation, then just use the raw + // basename which allows the basename to have full control over the presence + // of a trailing slash on root links + + if (basename !== "/") { + joinedPathname = pathname === "/" ? basename : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["joinPaths"])([basename, pathname]); + } + + return navigator.createHref({ + pathname: joinedPathname, + search, + hash + }); +} +/** + * Returns true if this component is a descendant of a <Router>. + * + * @see https://reactrouter.com/hooks/use-in-router-context + */ + +function useInRouterContext() { + return react__WEBPACK_IMPORTED_MODULE_1__["useContext"](LocationContext) != null; +} +/** + * Returns the current location object, which represents the current URL in web + * browsers. + * + * Note: If you're using this it may mean you're doing some of your own + * "routing" in your app, and we'd like to know what your use case is. We may + * be able to provide something higher-level to better suit your needs. + * + * @see https://reactrouter.com/hooks/use-location + */ + +function useLocation() { + !useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + return react__WEBPACK_IMPORTED_MODULE_1__["useContext"](LocationContext).location; +} +/** + * Returns the current navigation action which describes how the router came to + * the current location, either by a pop, push, or replace on the history stack. + * + * @see https://reactrouter.com/hooks/use-navigation-type + */ + +function useNavigationType() { + return react__WEBPACK_IMPORTED_MODULE_1__["useContext"](LocationContext).navigationType; +} +/** + * Returns a PathMatch object if the given pattern matches the current URL. + * This is useful for components that need to know "active" state, e.g. + * <NavLink>. + * + * @see https://reactrouter.com/hooks/use-match + */ + +function useMatch(pattern) { + !useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + let { + pathname + } = useLocation(); + return react__WEBPACK_IMPORTED_MODULE_1__["useMemo"](() => Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["matchPath"])(pattern, pathname), [pathname, pattern]); +} +/** + * The interface for the navigate() function returned from useNavigate(). + */ + +/** + * Returns an imperative method for changing the location. Used by <Link>s, but + * may also be used by other elements to change the location. + * + * @see https://reactrouter.com/hooks/use-navigate + */ +function useNavigate() { + !useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + let { + basename, + navigator + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](NavigationContext); + let { + matches + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext); + let { + pathname: locationPathname + } = useLocation(); + let routePathnamesJson = JSON.stringify(Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["UNSAFE_getPathContributingMatches"])(matches).map(match => match.pathnameBase)); + let activeRef = react__WEBPACK_IMPORTED_MODULE_1__["useRef"](false); + react__WEBPACK_IMPORTED_MODULE_1__["useEffect"](() => { + activeRef.current = true; + }); + let navigate = react__WEBPACK_IMPORTED_MODULE_1__["useCallback"](function (to, options) { + if (options === void 0) { + options = {}; + } + + false ? undefined : void 0; + if (!activeRef.current) return; + + if (typeof to === "number") { + navigator.go(to); + return; + } + + let path = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["resolveTo"])(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path"); // If we're operating within a basename, prepend it to the pathname prior + // to handing off to history. If this is a root navigation, then we + // navigate to the raw basename which allows the basename to have full + // control over the presence of a trailing slash on root links + + if (basename !== "/") { + path.pathname = path.pathname === "/" ? basename : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["joinPaths"])([basename, path.pathname]); + } + + (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options); + }, [basename, navigator, routePathnamesJson, locationPathname]); + return navigate; +} +const OutletContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createContext"](null); +/** + * Returns the context (if provided) for the child route at this level of the route + * hierarchy. + * @see https://reactrouter.com/hooks/use-outlet-context + */ + +function useOutletContext() { + return react__WEBPACK_IMPORTED_MODULE_1__["useContext"](OutletContext); +} +/** + * Returns the element for the child route at this level of the route + * hierarchy. Used internally by <Outlet> to render child routes. + * + * @see https://reactrouter.com/hooks/use-outlet + */ + +function useOutlet(context) { + let outlet = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext).outlet; + + if (outlet) { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](OutletContext.Provider, { + value: context + }, outlet); + } + + return outlet; +} +/** + * Returns an object of key/value pairs of the dynamic params from the current + * URL that were matched by the route path. + * + * @see https://reactrouter.com/hooks/use-params + */ + +function useParams() { + let { + matches + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext); + let routeMatch = matches[matches.length - 1]; + return routeMatch ? routeMatch.params : {}; +} +/** + * Resolves the pathname of the given `to` value against the current location. + * + * @see https://reactrouter.com/hooks/use-resolved-path + */ + +function useResolvedPath(to, _temp2) { + let { + relative + } = _temp2 === void 0 ? {} : _temp2; + let { + matches + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext); + let { + pathname: locationPathname + } = useLocation(); + let routePathnamesJson = JSON.stringify(Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["UNSAFE_getPathContributingMatches"])(matches).map(match => match.pathnameBase)); + return react__WEBPACK_IMPORTED_MODULE_1__["useMemo"](() => Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["resolveTo"])(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]); +} +/** + * Returns the element of the route that matched the current location, prepared + * with the correct context to render the remainder of the route tree. Route + * elements in the tree must render an <Outlet> to render their child route's + * element. + * + * @see https://reactrouter.com/hooks/use-routes + */ + +function useRoutes(routes, locationArg) { + !useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + let { + navigator + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](NavigationContext); + let dataRouterStateContext = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](DataRouterStateContext); + let { + matches: parentMatches + } = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext); + let routeMatch = parentMatches[parentMatches.length - 1]; + let parentParams = routeMatch ? routeMatch.params : {}; + let parentPathname = routeMatch ? routeMatch.pathname : "/"; + let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/"; + let parentRoute = routeMatch && routeMatch.route; + + if (false) {} + + let locationFromContext = useLocation(); + let location; + + if (locationArg) { + var _parsedLocationArg$pa; + + let parsedLocationArg = typeof locationArg === "string" ? Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["parsePath"])(locationArg) : locationArg; + !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + location = parsedLocationArg; + } else { + location = locationFromContext; + } + + let pathname = location.pathname || "/"; + let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/"; + let matches = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["matchRoutes"])(routes, { + pathname: remainingPathname + }); + + if (false) {} + + let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, { + params: Object.assign({}, parentParams, match.params), + pathname: Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["joinPaths"])([parentPathnameBase, // Re-encode pathnames that were decoded inside matchRoutes + navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]), + pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["joinPaths"])([parentPathnameBase, // Re-encode pathnames that were decoded inside matchRoutes + navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase]) + })), parentMatches, dataRouterStateContext || undefined); // When a user passes in a `locationArg`, the associated routes need to + // be wrapped in a new `LocationContext.Provider` in order for `useLocation` + // to use the scoped location instead of the global location. + + + if (locationArg && renderedMatches) { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](LocationContext.Provider, { + value: { + location: _extends({ + pathname: "/", + search: "", + hash: "", + state: null, + key: "default" + }, location), + navigationType: _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["Action"].Pop + } + }, renderedMatches); + } + + return renderedMatches; +} + +function DefaultErrorElement() { + let error = useRouteError(); + let message = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["isRouteErrorResponse"])(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error); + let stack = error instanceof Error ? error.stack : null; + let lightgrey = "rgba(200,200,200, 0.5)"; + let preStyles = { + padding: "0.5rem", + backgroundColor: lightgrey + }; + let codeStyles = { + padding: "2px 4px", + backgroundColor: lightgrey + }; + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("h2", null, "Unhandled Thrown Error!"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("h3", { + style: { + fontStyle: "italic" + } + }, message), stack ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("pre", { + style: preStyles + }, stack) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("p", null, "\uD83D\uDCBF Hey developer \uD83D\uDC4B"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("p", null, "You can provide a way better UX than this when your app throws errors by providing your own\xA0", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("code", { + style: codeStyles + }, "errorElement"), " props on\xA0", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"]("code", { + style: codeStyles + }, "<Route>"))); +} + +class RenderErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_1__["Component"] { + constructor(props) { + super(props); + this.state = { + location: props.location, + error: props.error + }; + } + + static getDerivedStateFromError(error) { + return { + error: error + }; + } + + static getDerivedStateFromProps(props, state) { + // When we get into an error state, the user will likely click "back" to the + // previous page that didn't have an error. Because this wraps the entire + // application, that will have no effect--the error page continues to display. + // This gives us a mechanism to recover from the error when the location changes. + // + // Whether we're in an error state or not, we update the location in state + // so that when we are in an error state, it gets reset when a new location + // comes in and the user recovers from the error. + if (state.location !== props.location) { + return { + error: props.error, + location: props.location + }; + } // If we're not changing locations, preserve the location but still surface + // any new errors that may come through. We retain the existing error, we do + // this because the error provided from the app state may be cleared without + // the location changing. + + + return { + error: props.error || state.error, + location: state.location + }; + } + + componentDidCatch(error, errorInfo) { + console.error("React Router caught the following error during render", error, errorInfo); + } + + render() { + return this.state.error ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](RouteContext.Provider, { + value: this.props.routeContext + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](RouteErrorContext.Provider, { + value: this.state.error, + children: this.props.component + })) : this.props.children; + } + +} + +function RenderedRoute(_ref) { + let { + routeContext, + match, + children + } = _ref; + let dataStaticRouterContext = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](DataStaticRouterContext); // Track how deep we got in our render pass to emulate SSR componentDidCatch + // in a DataStaticRouter + + if (dataStaticRouterContext && match.route.errorElement) { + dataStaticRouterContext._deepestRenderedBoundaryId = match.route.id; + } + + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](RouteContext.Provider, { + value: routeContext + }, children); +} + +function _renderMatches(matches, parentMatches, dataRouterState) { + if (parentMatches === void 0) { + parentMatches = []; + } + + if (matches == null) { + if (dataRouterState != null && dataRouterState.errors) { + // Don't bail if we have data router errors so we can render them in the + // boundary. Use the pre-matched (or shimmed) matches + matches = dataRouterState.matches; + } else { + return null; + } + } + + let renderedMatches = matches; // If we have data errors, trim matches to the highest error boundary + + let errors = dataRouterState == null ? void 0 : dataRouterState.errors; + + if (errors != null) { + let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id])); + !(errorIndex >= 0) ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1)); + } + + return renderedMatches.reduceRight((outlet, match, index) => { + let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null; // Only data routers handle errors + + let errorElement = dataRouterState ? match.route.errorElement || /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](DefaultErrorElement, null) : null; + let matches = parentMatches.concat(renderedMatches.slice(0, index + 1)); + + let getChildren = () => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](RenderedRoute, { + match: match, + routeContext: { + outlet, + matches + } + }, error ? errorElement : match.route.element !== undefined ? match.route.element : outlet); // Only wrap in an error boundary within data router usages when we have an + // errorElement on this route. Otherwise let it bubble up to an ancestor + // errorElement + + + return dataRouterState && (match.route.errorElement || index === 0) ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](RenderErrorBoundary, { + location: dataRouterState.location, + component: errorElement, + error: error, + children: getChildren(), + routeContext: { + outlet: null, + matches + } + }) : getChildren(); + }, null); +} +var DataRouterHook; + +(function (DataRouterHook) { + DataRouterHook["UseRevalidator"] = "useRevalidator"; +})(DataRouterHook || (DataRouterHook = {})); + +var DataRouterStateHook; + +(function (DataRouterStateHook) { + DataRouterStateHook["UseLoaderData"] = "useLoaderData"; + DataRouterStateHook["UseActionData"] = "useActionData"; + DataRouterStateHook["UseRouteError"] = "useRouteError"; + DataRouterStateHook["UseNavigation"] = "useNavigation"; + DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData"; + DataRouterStateHook["UseMatches"] = "useMatches"; + DataRouterStateHook["UseRevalidator"] = "useRevalidator"; +})(DataRouterStateHook || (DataRouterStateHook = {})); + +function getDataRouterConsoleError(hookName) { + return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router."; +} + +function useDataRouterContext(hookName) { + let ctx = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](DataRouterContext); + !ctx ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + return ctx; +} + +function useDataRouterState(hookName) { + let state = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](DataRouterStateContext); + !state ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + return state; +} + +function useRouteContext(hookName) { + let route = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext); + !route ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + return route; +} + +function useCurrentRouteId(hookName) { + let route = useRouteContext(hookName); + let thisRoute = route.matches[route.matches.length - 1]; + !thisRoute.route.id ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + return thisRoute.route.id; +} +/** + * Returns the current navigation, defaulting to an "idle" navigation when + * no navigation is in progress + */ + + +function useNavigation() { + let state = useDataRouterState(DataRouterStateHook.UseNavigation); + return state.navigation; +} +/** + * Returns a revalidate function for manually triggering revalidation, as well + * as the current state of any manual revalidations + */ + +function useRevalidator() { + let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator); + let state = useDataRouterState(DataRouterStateHook.UseRevalidator); + return { + revalidate: dataRouterContext.router.revalidate, + state: state.revalidation + }; +} +/** + * Returns the active route matches, useful for accessing loaderData for + * parent/child routes or the route "handle" property + */ + +function useMatches() { + let { + matches, + loaderData + } = useDataRouterState(DataRouterStateHook.UseMatches); + return react__WEBPACK_IMPORTED_MODULE_1__["useMemo"](() => matches.map(match => { + let { + pathname, + params + } = match; // Note: This structure matches that created by createUseMatchesMatch + // in the @remix-run/router , so if you change this please also change + // that :) Eventually we'll DRY this up + + return { + id: match.route.id, + pathname, + params, + data: loaderData[match.route.id], + handle: match.route.handle + }; + }), [matches, loaderData]); +} +/** + * Returns the loader data for the nearest ancestor Route loader + */ + +function useLoaderData() { + let state = useDataRouterState(DataRouterStateHook.UseLoaderData); + let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData); + + if (state.errors && state.errors[routeId] != null) { + console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")"); + return undefined; + } + + return state.loaderData[routeId]; +} +/** + * Returns the loaderData for the given routeId + */ + +function useRouteLoaderData(routeId) { + let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData); + return state.loaderData[routeId]; +} +/** + * Returns the action data for the nearest ancestor Route action + */ + +function useActionData() { + let state = useDataRouterState(DataRouterStateHook.UseActionData); + let route = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteContext); + !route ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + return Object.values((state == null ? void 0 : state.actionData) || {})[0]; +} +/** + * Returns the nearest ancestor Route error, which could be a loader/action + * error or a render error. This is intended to be called from your + * errorElement to display a proper error message. + */ + +function useRouteError() { + var _state$errors; + + let error = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](RouteErrorContext); + let state = useDataRouterState(DataRouterStateHook.UseRouteError); + let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError); // If this was a render error, we put it in a RouteError context inside + // of RenderErrorBoundary + + if (error) { + return error; + } // Otherwise look for errors from our data router state + + + return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId]; +} +/** + * Returns the happy-path data from the nearest ancestor <Await /> value + */ + +function useAsyncValue() { + let value = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](AwaitContext); + return value == null ? void 0 : value._data; +} +/** + * Returns the error from the nearest ancestor <Await /> value + */ + +function useAsyncError() { + let value = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](AwaitContext); + return value == null ? void 0 : value._error; +} +const alreadyWarned = {}; + +function warningOnce(key, cond, message) { + if (!cond && !alreadyWarned[key]) { + alreadyWarned[key] = true; + false ? undefined : void 0; + } +} + +/** + * Given a Remix Router instance, render the appropriate UI + */ +function RouterProvider(_ref) { + let { + fallbackElement, + router + } = _ref; + // Sync router state to our component state to force re-renders + let state = useSyncExternalStore(router.subscribe, () => router.state, // We have to provide this so React@18 doesn't complain during hydration, + // but we pass our serialized hydration data into the router so state here + // is already synced with what the server saw + () => router.state); + let navigator = react__WEBPACK_IMPORTED_MODULE_1__["useMemo"](() => { + return { + createHref: router.createHref, + encodeLocation: router.encodeLocation, + go: n => router.navigate(n), + push: (to, state, opts) => router.navigate(to, { + state, + preventScrollReset: opts == null ? void 0 : opts.preventScrollReset + }), + replace: (to, state, opts) => router.navigate(to, { + replace: true, + state, + preventScrollReset: opts == null ? void 0 : opts.preventScrollReset + }) + }; + }, [router]); + let basename = router.basename || "/"; + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](DataRouterContext.Provider, { + value: { + router, + navigator, + static: false, + // Do we need this? + basename + } + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](DataRouterStateContext.Provider, { + value: state + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](Router, { + basename: router.basename, + location: router.state.location, + navigationType: router.state.historyAction, + navigator: navigator + }, router.state.initialized ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](Routes, null) : fallbackElement))); +} + +/** + * A <Router> that stores all entries in memory. + * + * @see https://reactrouter.com/router-components/memory-router + */ +function MemoryRouter(_ref2) { + let { + basename, + children, + initialEntries, + initialIndex + } = _ref2; + let historyRef = react__WEBPACK_IMPORTED_MODULE_1__["useRef"](); + + if (historyRef.current == null) { + historyRef.current = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["createMemoryHistory"])({ + initialEntries, + initialIndex, + v5Compat: true + }); + } + + let history = historyRef.current; + let [state, setState] = react__WEBPACK_IMPORTED_MODULE_1__["useState"]({ + action: history.action, + location: history.location + }); + react__WEBPACK_IMPORTED_MODULE_1__["useLayoutEffect"](() => history.listen(setState), [history]); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](Router, { + basename: basename, + children: children, + location: state.location, + navigationType: state.action, + navigator: history + }); +} + +/** + * Changes the current location. + * + * Note: This API is mostly useful in React.Component subclasses that are not + * able to use hooks. In functional components, we recommend you use the + * `useNavigate` hook instead. + * + * @see https://reactrouter.com/components/navigate + */ +function Navigate(_ref3) { + let { + to, + replace, + state, + relative + } = _ref3; + !useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + false ? undefined : void 0; + let dataRouterState = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](DataRouterStateContext); + let navigate = useNavigate(); + react__WEBPACK_IMPORTED_MODULE_1__["useEffect"](() => { + // Avoid kicking off multiple navigations if we're in the middle of a + // data-router navigation, since components get re-rendered when we enter + // a submitting/loading state + if (dataRouterState && dataRouterState.navigation.state !== "idle") { + return; + } + + navigate(to, { + replace, + state, + relative + }); + }); + return null; +} + +/** + * Renders the child route's element, if there is one. + * + * @see https://reactrouter.com/components/outlet + */ +function Outlet(props) { + return useOutlet(props.context); +} + +/** + * Declares an element that should be rendered at a certain URL path. + * + * @see https://reactrouter.com/components/route + */ +function Route(_props) { + false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) ; +} + +/** + * Provides location context for the rest of the app. + * + * Note: You usually won't render a <Router> directly. Instead, you'll render a + * router that is more specific to your environment such as a <BrowserRouter> + * in web browsers or a <StaticRouter> for server rendering. + * + * @see https://reactrouter.com/router-components/router + */ +function Router(_ref4) { + let { + basename: basenameProp = "/", + children = null, + location: locationProp, + navigationType = _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["Action"].Pop, + navigator, + static: staticProp = false + } = _ref4; + !!useInRouterContext() ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control + // the enforcement of trailing slashes throughout the app + + let basename = basenameProp.replace(/^\/*/, "/"); + let navigationContext = react__WEBPACK_IMPORTED_MODULE_1__["useMemo"](() => ({ + basename, + navigator, + static: staticProp + }), [basename, navigator, staticProp]); + + if (typeof locationProp === "string") { + locationProp = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["parsePath"])(locationProp); + } + + let { + pathname = "/", + search = "", + hash = "", + state = null, + key = "default" + } = locationProp; + let location = react__WEBPACK_IMPORTED_MODULE_1__["useMemo"](() => { + let trailingPathname = Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["stripBasename"])(pathname, basename); + + if (trailingPathname == null) { + return null; + } + + return { + pathname: trailingPathname, + search, + hash, + state, + key + }; + }, [basename, pathname, search, hash, state, key]); + false ? undefined : void 0; + + if (location == null) { + return null; + } + + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](NavigationContext.Provider, { + value: navigationContext + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](LocationContext.Provider, { + children: children, + value: { + location, + navigationType + } + })); +} + +/** + * A container for a nested tree of <Route> elements that renders the branch + * that best matches the current location. + * + * @see https://reactrouter.com/components/routes + */ +function Routes(_ref5) { + let { + children, + location + } = _ref5; + let dataRouterContext = react__WEBPACK_IMPORTED_MODULE_1__["useContext"](DataRouterContext); // When in a DataRouterContext _without_ children, we use the router routes + // directly. If we have children, then we're in a descendant tree and we + // need to use child routes. + + let routes = dataRouterContext && !children ? dataRouterContext.router.routes : createRoutesFromChildren(children); + return useRoutes(routes, location); +} + +/** + * Component to use for rendering lazily loaded data from returning defer() + * in a loader function + */ +function Await(_ref6) { + let { + children, + errorElement, + resolve + } = _ref6; + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](AwaitErrorBoundary, { + resolve: resolve, + errorElement: errorElement + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](ResolveAwait, null, children)); +} +var AwaitRenderStatus; + +(function (AwaitRenderStatus) { + AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending"; + AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success"; + AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error"; +})(AwaitRenderStatus || (AwaitRenderStatus = {})); + +const neverSettledPromise = new Promise(() => {}); + +class AwaitErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_1__["Component"] { + constructor(props) { + super(props); + this.state = { + error: null + }; + } + + static getDerivedStateFromError(error) { + return { + error + }; + } + + componentDidCatch(error, errorInfo) { + console.error("<Await> caught the following error during render", error, errorInfo); + } + + render() { + let { + children, + errorElement, + resolve + } = this.props; + let promise = null; + let status = AwaitRenderStatus.pending; + + if (!(resolve instanceof Promise)) { + // Didn't get a promise - provide as a resolved promise + status = AwaitRenderStatus.success; + promise = Promise.resolve(); + Object.defineProperty(promise, "_tracked", { + get: () => true + }); + Object.defineProperty(promise, "_data", { + get: () => resolve + }); + } else if (this.state.error) { + // Caught a render error, provide it as a rejected promise + status = AwaitRenderStatus.error; + let renderError = this.state.error; + promise = Promise.reject().catch(() => {}); // Avoid unhandled rejection warnings + + Object.defineProperty(promise, "_tracked", { + get: () => true + }); + Object.defineProperty(promise, "_error", { + get: () => renderError + }); + } else if (resolve._tracked) { + // Already tracked promise - check contents + promise = resolve; + status = promise._error !== undefined ? AwaitRenderStatus.error : promise._data !== undefined ? AwaitRenderStatus.success : AwaitRenderStatus.pending; + } else { + // Raw (untracked) promise - track it + status = AwaitRenderStatus.pending; + Object.defineProperty(resolve, "_tracked", { + get: () => true + }); + promise = resolve.then(data => Object.defineProperty(resolve, "_data", { + get: () => data + }), error => Object.defineProperty(resolve, "_error", { + get: () => error + })); + } + + if (status === AwaitRenderStatus.error && promise._error instanceof _remix_run_router__WEBPACK_IMPORTED_MODULE_0__["AbortedDeferredError"]) { + // Freeze the UI by throwing a never resolved promise + throw neverSettledPromise; + } + + if (status === AwaitRenderStatus.error && !errorElement) { + // No errorElement, throw to the nearest route-level error boundary + throw promise._error; + } + + if (status === AwaitRenderStatus.error) { + // Render via our errorElement + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](AwaitContext.Provider, { + value: promise, + children: errorElement + }); + } + + if (status === AwaitRenderStatus.success) { + // Render children with resolved value + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](AwaitContext.Provider, { + value: promise, + children: children + }); + } // Throw to the suspense boundary + + + throw promise; + } + +} +/** + * @private + * Indirection to leverage useAsyncValue for a render-prop API on <Await> + */ + + +function ResolveAwait(_ref7) { + let { + children + } = _ref7; + let data = useAsyncValue(); + + if (typeof children === "function") { + return children(data); + } + + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["createElement"](react__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null, children); +} /////////////////////////////////////////////////////////////////////////////// +// UTILS +/////////////////////////////////////////////////////////////////////////////// + +/** + * Creates a route config from a React "children" object, which is usually + * either a `<Route>` element or an array of them. Used internally by + * `<Routes>` to create a route config from its children. + * + * @see https://reactrouter.com/utils/create-routes-from-children + */ + + +function createRoutesFromChildren(children, parentPath) { + if (parentPath === void 0) { + parentPath = []; + } + + let routes = []; + react__WEBPACK_IMPORTED_MODULE_1__["Children"].forEach(children, (element, index) => { + if (! /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__["isValidElement"](element)) { + // Ignore non-elements. This allows people to more easily inline + // conditionals in their route config. + return; + } + + if (element.type === react__WEBPACK_IMPORTED_MODULE_1__["Fragment"]) { + // Transparently support React.Fragment and its children. + routes.push.apply(routes, createRoutesFromChildren(element.props.children, parentPath)); + return; + } + + !(element.type === Route) ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + !(!element.props.index || !element.props.children) ? false ? undefined : Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["invariant"])(false) : void 0; + let treePath = [...parentPath, index]; + let route = { + id: element.props.id || treePath.join("-"), + caseSensitive: element.props.caseSensitive, + element: element.props.element, + index: element.props.index, + path: element.props.path, + loader: element.props.loader, + action: element.props.action, + errorElement: element.props.errorElement, + hasErrorBoundary: element.props.errorElement != null, + shouldRevalidate: element.props.shouldRevalidate, + handle: element.props.handle + }; + + if (element.props.children) { + route.children = createRoutesFromChildren(element.props.children, treePath); + } + + routes.push(route); + }); + return routes; +} +/** + * Renders the result of `matchRoutes()` into a React element. + */ + +function renderMatches(matches) { + return _renderMatches(matches); +} +/** + * @private + * Walk the route tree and add hasErrorBoundary if it's not provided, so that + * users providing manual route arrays can just specify errorElement + */ + +function enhanceManualRouteObjects(routes) { + return routes.map(route => { + let routeClone = _extends({}, route); + + if (routeClone.hasErrorBoundary == null) { + routeClone.hasErrorBoundary = routeClone.errorElement != null; + } + + if (routeClone.children) { + routeClone.children = enhanceManualRouteObjects(routeClone.children); + } + + return routeClone; + }); +} + +function createMemoryRouter(routes, opts) { + return Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["createRouter"])({ + basename: opts == null ? void 0 : opts.basename, + history: Object(_remix_run_router__WEBPACK_IMPORTED_MODULE_0__["createMemoryHistory"])({ + initialEntries: opts == null ? void 0 : opts.initialEntries, + initialIndex: opts == null ? void 0 : opts.initialIndex + }), + hydrationData: opts == null ? void 0 : opts.hydrationData, + routes: enhanceManualRouteObjects(routes) + }).initialize(); +} /////////////////////////////////////////////////////////////////////////////// + + +//# sourceMappingURL=index.js.map + + /***/ }), /***/ "V61c": @@ -297855,6 +299119,3718 @@ function transform(node) { } +/***/ }), + +/***/ "hk2M": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortedDeferredError", function() { return AbortedDeferredError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Action", function() { return Action; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorResponse", function() { return ErrorResponse; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDLE_FETCHER", function() { return IDLE_FETCHER; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IDLE_NAVIGATION", function() { return IDLE_NAVIGATION; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_convertRoutesToDataRoutes", function() { return convertRoutesToDataRoutes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSAFE_getPathContributingMatches", function() { return getPathContributingMatches; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return createBrowserHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return createHashHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return createMemoryHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRouter", function() { return createRouter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStaticHandler", function() { return createStaticHandler; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return defer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generatePath", function() { return generatePath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStaticContextFromError", function() { return getStaticContextFromError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getToPathname", function() { return getToPathname; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invariant", function() { return invariant; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRouteErrorResponse", function() { return isRouteErrorResponse; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "joinPaths", function() { return joinPaths; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "json", function() { return json; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchPath", function() { return matchPath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchRoutes", function() { return matchRoutes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalizePathname", function() { return normalizePathname; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redirect", function() { return redirect; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolvePath", function() { return resolvePath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveTo", function() { return resolveTo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripBasename", function() { return stripBasename; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warning", function() { return warning; }); +/** + * @remix-run/router v1.2.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */ +function _extends() { + _extends = Object.assign ? Object.assign.bind() : 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); +} + +//////////////////////////////////////////////////////////////////////////////// +//#region Types and Constants +//////////////////////////////////////////////////////////////////////////////// + +/** + * Actions represent the type of change to a location value. + */ +var Action; + +(function (Action) { + /** + * A POP indicates a change to an arbitrary index in the history stack, such + * as a back or forward navigation. It does not describe the direction of the + * navigation, only that the current index changed. + * + * Note: This is the default action for newly created history objects. + */ + Action["Pop"] = "POP"; + /** + * A PUSH indicates a new entry being added to the history stack, such as when + * a link is clicked and a new page loads. When this happens, all subsequent + * entries in the stack are lost. + */ + + Action["Push"] = "PUSH"; + /** + * A REPLACE indicates the entry at the current index in the history stack + * being replaced by a new one. + */ + + Action["Replace"] = "REPLACE"; +})(Action || (Action = {})); + +const PopStateEventType = "popstate"; +/** + * Memory history stores the current location in memory. It is designed for use + * in stateful non-browser environments like tests and React Native. + */ + +function createMemoryHistory(options) { + if (options === void 0) { + options = {}; + } + + let { + initialEntries = ["/"], + initialIndex, + v5Compat = false + } = options; + let entries; // Declare so we can access from createMemoryLocation + + entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : undefined)); + let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex); + let action = Action.Pop; + let listener = null; + + function clampIndex(n) { + return Math.min(Math.max(n, 0), entries.length - 1); + } + + function getCurrentLocation() { + return entries[index]; + } + + function createMemoryLocation(to, state, key) { + if (state === void 0) { + state = null; + } + + let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key); + warning$1(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to)); + return location; + } + + let history = { + get index() { + return index; + }, + + get action() { + return action; + }, + + get location() { + return getCurrentLocation(); + }, + + createHref(to) { + return typeof to === "string" ? to : createPath(to); + }, + + encodeLocation(to) { + let path = typeof to === "string" ? parsePath(to) : to; + return { + pathname: path.pathname || "", + search: path.search || "", + hash: path.hash || "" + }; + }, + + push(to, state) { + action = Action.Push; + let nextLocation = createMemoryLocation(to, state); + index += 1; + entries.splice(index, entries.length, nextLocation); + + if (v5Compat && listener) { + listener({ + action, + location: nextLocation + }); + } + }, + + replace(to, state) { + action = Action.Replace; + let nextLocation = createMemoryLocation(to, state); + entries[index] = nextLocation; + + if (v5Compat && listener) { + listener({ + action, + location: nextLocation + }); + } + }, + + go(delta) { + action = Action.Pop; + index = clampIndex(index + delta); + + if (listener) { + listener({ + action, + location: getCurrentLocation() + }); + } + }, + + listen(fn) { + listener = fn; + return () => { + listener = null; + }; + } + + }; + return history; +} +/** + * Browser history stores the location in regular URLs. This is the standard for + * most web apps, but it requires some configuration on the server to ensure you + * serve the same app at multiple URLs. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory + */ + +function createBrowserHistory(options) { + if (options === void 0) { + options = {}; + } + + function createBrowserLocation(window, globalHistory) { + let { + pathname, + search, + hash + } = window.location; + return createLocation("", { + pathname, + search, + hash + }, // state defaults to `null` because `window.history.state` does + globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default"); + } + + function createBrowserHref(window, to) { + return typeof to === "string" ? to : createPath(to); + } + + return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options); +} +/** + * Hash history stores the location in window.location.hash. This makes it ideal + * for situations where you don't want to send the location to the server for + * some reason, either because you do cannot configure it or the URL space is + * reserved for something else. + * + * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory + */ + +function createHashHistory(options) { + if (options === void 0) { + options = {}; + } + + function createHashLocation(window, globalHistory) { + let { + pathname = "/", + search = "", + hash = "" + } = parsePath(window.location.hash.substr(1)); + return createLocation("", { + pathname, + search, + hash + }, // state defaults to `null` because `window.history.state` does + globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default"); + } + + function createHashHref(window, to) { + let base = window.document.querySelector("base"); + let href = ""; + + if (base && base.getAttribute("href")) { + let url = window.location.href; + let hashIndex = url.indexOf("#"); + href = hashIndex === -1 ? url : url.slice(0, hashIndex); + } + + return href + "#" + (typeof to === "string" ? to : createPath(to)); + } + + function validateHashLocation(location, to) { + warning$1(location.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(to) + ")"); + } + + return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options); +} +function invariant(value, message) { + if (value === false || value === null || typeof value === "undefined") { + throw new Error(message); + } +} + +function warning$1(cond, message) { + if (!cond) { + // eslint-disable-next-line no-console + if (typeof console !== "undefined") console.warn(message); + + try { + // Welcome to debugging history! + // + // This error is thrown as a convenience so you can more easily + // find the source for a warning that appears in the console by + // enabling "pause on exceptions" in your JavaScript debugger. + throw new Error(message); // eslint-disable-next-line no-empty + } catch (e) {} + } +} + +function createKey() { + return Math.random().toString(36).substr(2, 8); +} +/** + * For browser-based histories, we combine the state and key into an object + */ + + +function getHistoryState(location) { + return { + usr: location.state, + key: location.key + }; +} +/** + * Creates a Location object with a unique key from the given Path + */ + + +function createLocation(current, to, state, key) { + if (state === void 0) { + state = null; + } + + let location = _extends({ + pathname: typeof current === "string" ? current : current.pathname, + search: "", + hash: "" + }, typeof to === "string" ? parsePath(to) : to, { + state, + // TODO: This could be cleaned up. push/replace should probably just take + // full Locations now and avoid the need to run through this flow at all + // But that's a pretty big refactor to the current test suite so going to + // keep as is for the time being and just let any incoming keys take precedence + key: to && to.key || key || createKey() + }); + + return location; +} +/** + * Creates a string URL path from the given pathname, search, and hash components. + */ + +function createPath(_ref) { + let { + pathname = "/", + search = "", + hash = "" + } = _ref; + if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search; + if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash; + return pathname; +} +/** + * Parses a string URL path into its separate pathname, search, and hash components. + */ + +function parsePath(path) { + let parsedPath = {}; + + if (path) { + let hashIndex = path.indexOf("#"); + + if (hashIndex >= 0) { + parsedPath.hash = path.substr(hashIndex); + path = path.substr(0, hashIndex); + } + + let searchIndex = path.indexOf("?"); + + if (searchIndex >= 0) { + parsedPath.search = path.substr(searchIndex); + path = path.substr(0, searchIndex); + } + + if (path) { + parsedPath.pathname = path; + } + } + + return parsedPath; +} +function createClientSideURL(location) { + // window.location.origin is "null" (the literal string value) in Firefox + // under certain conditions, notably when serving from a local HTML file + // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297 + let base = typeof window !== "undefined" && typeof window.location !== "undefined" && window.location.origin !== "null" ? window.location.origin : window.location.href; + let href = typeof location === "string" ? location : createPath(location); + invariant(base, "No window.location.(origin|href) available to create URL for href: " + href); + return new URL(href, base); +} + +function getUrlBasedHistory(getLocation, createHref, validateLocation, options) { + if (options === void 0) { + options = {}; + } + + let { + window = document.defaultView, + v5Compat = false + } = options; + let globalHistory = window.history; + let action = Action.Pop; + let listener = null; + + function handlePop() { + action = Action.Pop; + + if (listener) { + listener({ + action, + location: history.location + }); + } + } + + function push(to, state) { + action = Action.Push; + let location = createLocation(history.location, to, state); + if (validateLocation) validateLocation(location, to); + let historyState = getHistoryState(location); + let url = history.createHref(location); // try...catch because iOS limits us to 100 pushState calls :/ + + try { + globalHistory.pushState(historyState, "", url); + } catch (error) { + // They are going to lose state here, but there is no real + // way to warn them about it since the page will refresh... + window.location.assign(url); + } + + if (v5Compat && listener) { + listener({ + action, + location: history.location + }); + } + } + + function replace(to, state) { + action = Action.Replace; + let location = createLocation(history.location, to, state); + if (validateLocation) validateLocation(location, to); + let historyState = getHistoryState(location); + let url = history.createHref(location); + globalHistory.replaceState(historyState, "", url); + + if (v5Compat && listener) { + listener({ + action, + location: history.location + }); + } + } + + let history = { + get action() { + return action; + }, + + get location() { + return getLocation(window, globalHistory); + }, + + listen(fn) { + if (listener) { + throw new Error("A history only accepts one active listener"); + } + + window.addEventListener(PopStateEventType, handlePop); + listener = fn; + return () => { + window.removeEventListener(PopStateEventType, handlePop); + listener = null; + }; + }, + + createHref(to) { + return createHref(window, to); + }, + + encodeLocation(to) { + // Encode a Location the same way window.location would + let url = createClientSideURL(typeof to === "string" ? to : createPath(to)); + return { + pathname: url.pathname, + search: url.search, + hash: url.hash + }; + }, + + push, + replace, + + go(n) { + return globalHistory.go(n); + } + + }; + return history; +} //#endregion + +var ResultType; + +(function (ResultType) { + ResultType["data"] = "data"; + ResultType["deferred"] = "deferred"; + ResultType["redirect"] = "redirect"; + ResultType["error"] = "error"; +})(ResultType || (ResultType = {})); + +function isIndexRoute(route) { + return route.index === true; +} // Walk the route tree generating unique IDs where necessary so we are working +// solely with AgnosticDataRouteObject's within the Router + + +function convertRoutesToDataRoutes(routes, parentPath, allIds) { + if (parentPath === void 0) { + parentPath = []; + } + + if (allIds === void 0) { + allIds = new Set(); + } + + return routes.map((route, index) => { + let treePath = [...parentPath, index]; + let id = typeof route.id === "string" ? route.id : treePath.join("-"); + invariant(route.index !== true || !route.children, "Cannot specify children on an index route"); + invariant(!allIds.has(id), "Found a route id collision on id \"" + id + "\". Route " + "id's must be globally unique within Data Router usages"); + allIds.add(id); + + if (isIndexRoute(route)) { + let indexRoute = _extends({}, route, { + id + }); + + return indexRoute; + } else { + let pathOrLayoutRoute = _extends({}, route, { + id, + children: route.children ? convertRoutesToDataRoutes(route.children, treePath, allIds) : undefined + }); + + return pathOrLayoutRoute; + } + }); +} +/** + * Matches the given routes to a location and returns the match data. + * + * @see https://reactrouter.com/utils/match-routes + */ + +function matchRoutes(routes, locationArg, basename) { + if (basename === void 0) { + basename = "/"; + } + + let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg; + let pathname = stripBasename(location.pathname || "/", basename); + + if (pathname == null) { + return null; + } + + let branches = flattenRoutes(routes); + rankRouteBranches(branches); + let matches = null; + + for (let i = 0; matches == null && i < branches.length; ++i) { + matches = matchRouteBranch(branches[i], // Incoming pathnames are generally encoded from either window.location + // or from router.navigate, but we want to match against the unencoded + // paths in the route definitions. Memory router locations won't be + // encoded here but there also shouldn't be anything to decode so this + // should be a safe operation. This avoids needing matchRoutes to be + // history-aware. + safelyDecodeURI(pathname)); + } + + return matches; +} + +function flattenRoutes(routes, branches, parentsMeta, parentPath) { + if (branches === void 0) { + branches = []; + } + + if (parentsMeta === void 0) { + parentsMeta = []; + } + + if (parentPath === void 0) { + parentPath = ""; + } + + let flattenRoute = (route, index, relativePath) => { + let meta = { + relativePath: relativePath === undefined ? route.path || "" : relativePath, + caseSensitive: route.caseSensitive === true, + childrenIndex: index, + route + }; + + if (meta.relativePath.startsWith("/")) { + 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."); + meta.relativePath = meta.relativePath.slice(parentPath.length); + } + + let path = joinPaths([parentPath, meta.relativePath]); + let routesMeta = parentsMeta.concat(meta); // Add the children before adding this route to the array so we traverse the + // route tree depth-first and child routes appear before their parents in + // the "flattened" version. + + if (route.children && route.children.length > 0) { + invariant( // Our types know better, but runtime JS may not! + // @ts-expect-error + route.index !== true, "Index routes must not have child routes. Please remove " + ("all child routes from route path \"" + path + "\".")); + flattenRoutes(route.children, branches, routesMeta, path); + } // Routes without a path shouldn't ever match by themselves unless they are + // index routes, so don't add them to the list of possible branches. + + + if (route.path == null && !route.index) { + return; + } + + branches.push({ + path, + score: computeScore(path, route.index), + routesMeta + }); + }; + + routes.forEach((route, index) => { + var _route$path; + + // coarse-grain check for optional params + if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) { + flattenRoute(route, index); + } else { + for (let exploded of explodeOptionalSegments(route.path)) { + flattenRoute(route, index, exploded); + } + } + }); + return branches; +} +/** + * Computes all combinations of optional path segments for a given path, + * excluding combinations that are ambiguous and of lower priority. + * + * For example, `/one/:two?/three/:four?/:five?` explodes to: + * - `/one/three` + * - `/one/:two/three` + * - `/one/three/:four` + * - `/one/three/:five` + * - `/one/:two/three/:four` + * - `/one/:two/three/:five` + * - `/one/three/:four/:five` + * - `/one/:two/three/:four/:five` + */ + + +function explodeOptionalSegments(path) { + let segments = path.split("/"); + if (segments.length === 0) return []; + let [first, ...rest] = segments; // Optional path segments are denoted by a trailing `?` + + let isOptional = first.endsWith("?"); // Compute the corresponding required segment: `foo?` -> `foo` + + let required = first.replace(/\?$/, ""); + + if (rest.length === 0) { + // Intepret empty string as omitting an optional segment + // `["one", "", "three"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three` + return isOptional ? [required, ""] : [required]; + } + + let restExploded = explodeOptionalSegments(rest.join("/")); + let result = []; // All child paths with the prefix. Do this for all children before the + // optional version for all children so we get consistent ordering where the + // parent optional aspect is preferred as required. Otherwise, we can get + // child sections interspersed where deeper optional segments are higher than + // parent optional segments, where for example, /:two would explodes _earlier_ + // then /:one. By always including the parent as required _for all children_ + // first, we avoid this issue + + result.push(...restExploded.map(subpath => subpath === "" ? required : [required, subpath].join("/"))); // Then if this is an optional value, add all child versions without + + if (isOptional) { + result.push(...restExploded); + } // for absolute paths, ensure `/` instead of empty segment + + + return result.map(exploded => path.startsWith("/") && exploded === "" ? "/" : exploded); +} + +function rankRouteBranches(branches) { + branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first + : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex))); +} + +const paramRe = /^:\w+$/; +const dynamicSegmentValue = 3; +const indexRouteValue = 2; +const emptySegmentValue = 1; +const staticSegmentValue = 10; +const splatPenalty = -2; + +const isSplat = s => s === "*"; + +function computeScore(path, index) { + let segments = path.split("/"); + let initialScore = segments.length; + + if (segments.some(isSplat)) { + initialScore += splatPenalty; + } + + if (index) { + initialScore += indexRouteValue; + } + + return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore); +} + +function compareIndexes(a, b) { + let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]); + return siblings ? // If two routes are siblings, we should try to match the earlier sibling + // first. This allows people to have fine-grained control over the matching + // behavior by simply putting routes with identical paths in the order they + // want them tried. + a[a.length - 1] - b[b.length - 1] : // Otherwise, it doesn't really make sense to rank non-siblings by index, + // so they sort equally. + 0; +} + +function matchRouteBranch(branch, pathname) { + let { + routesMeta + } = branch; + let matchedParams = {}; + let matchedPathname = "/"; + let matches = []; + + for (let i = 0; i < routesMeta.length; ++i) { + let meta = routesMeta[i]; + let end = i === routesMeta.length - 1; + let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/"; + let match = matchPath({ + path: meta.relativePath, + caseSensitive: meta.caseSensitive, + end + }, remainingPathname); + if (!match) return null; + Object.assign(matchedParams, match.params); + let route = meta.route; + matches.push({ + // TODO: Can this as be avoided? + params: matchedParams, + pathname: joinPaths([matchedPathname, match.pathname]), + pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])), + route + }); + + if (match.pathnameBase !== "/") { + matchedPathname = joinPaths([matchedPathname, match.pathnameBase]); + } + } + + return matches; +} +/** + * Returns a path with params interpolated. + * + * @see https://reactrouter.com/utils/generate-path + */ + + +function generatePath(originalPath, params) { + if (params === void 0) { + params = {}; + } + + let path = originalPath; + + if (path.endsWith("*") && path !== "*" && !path.endsWith("/*")) { + 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(/\*$/, "/*") + "\".")); + path = path.replace(/\*$/, "/*"); + } + + return path.replace(/^:(\w+)/g, (_, key) => { + invariant(params[key] != null, "Missing \":" + key + "\" param"); + return params[key]; + }).replace(/\/:(\w+)/g, (_, key) => { + invariant(params[key] != null, "Missing \":" + key + "\" param"); + return "/" + params[key]; + }).replace(/(\/?)\*/, (_, prefix, __, str) => { + const star = "*"; + + if (params[star] == null) { + // If no splat was provided, trim the trailing slash _unless_ it's + // the entire path + return str === "/*" ? "/" : ""; + } // Apply the splat + + + return "" + prefix + params[star]; + }); +} +/** + * Performs pattern matching on a URL pathname and returns information about + * the match. + * + * @see https://reactrouter.com/utils/match-path + */ + +function matchPath(pattern, pathname) { + if (typeof pattern === "string") { + pattern = { + path: pattern, + caseSensitive: false, + end: true + }; + } + + let [matcher, paramNames] = compilePath(pattern.path, pattern.caseSensitive, pattern.end); + let match = pathname.match(matcher); + if (!match) return null; + let matchedPathname = match[0]; + let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1"); + let captureGroups = match.slice(1); + let params = paramNames.reduce((memo, paramName, index) => { + // We need to compute the pathnameBase here using the raw splat value + // instead of using params["*"] later because it will be decoded then + if (paramName === "*") { + let splatValue = captureGroups[index] || ""; + pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1"); + } + + memo[paramName] = safelyDecodeURIComponent(captureGroups[index] || "", paramName); + return memo; + }, {}); + return { + params, + pathname: matchedPathname, + pathnameBase, + pattern + }; +} + +function compilePath(path, caseSensitive, end) { + if (caseSensitive === void 0) { + caseSensitive = false; + } + + if (end === void 0) { + end = true; + } + + 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(/\*$/, "/*") + "\".")); + let paramNames = []; + let regexpSource = "^" + path.replace(/\/*\*?$/, "") // Ignore trailing / and /*, we'll handle it below + .replace(/^\/*/, "/") // Make sure it has a leading / + .replace(/[\\.*+^$?{}|()[\]]/g, "\\$&") // Escape special regex chars + .replace(/\/:(\w+)/g, (_, paramName) => { + paramNames.push(paramName); + return "/([^\\/]+)"; + }); + + if (path.endsWith("*")) { + paramNames.push("*"); + regexpSource += path === "*" || path === "/*" ? "(.*)$" // Already matched the initial /, just match the rest + : "(?:\\/(.+)|\\/*)$"; // Don't include the / in params["*"] + } else if (end) { + // When matching to the end, ignore trailing slashes + regexpSource += "\\/*$"; + } else if (path !== "" && path !== "/") { + // If our path is non-empty and contains anything beyond an initial slash, + // then we have _some_ form of path in our regex so we should expect to + // match only if we find the end of this path segment. Look for an optional + // non-captured trailing slash (to match a portion of the URL) or the end + // of the path (if we've matched to the end). We used to do this with a + // word boundary but that gives false positives on routes like + // /user-preferences since `-` counts as a word boundary. + regexpSource += "(?:(?=\\/|$))"; + } else ; + + let matcher = new RegExp(regexpSource, caseSensitive ? undefined : "i"); + return [matcher, paramNames]; +} + +function safelyDecodeURI(value) { + try { + return decodeURI(value); + } catch (error) { + 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 + ").")); + return value; + } +} + +function safelyDecodeURIComponent(value, paramName) { + try { + return decodeURIComponent(value); + } catch (error) { + 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 + ").")); + return value; + } +} +/** + * @private + */ + + +function stripBasename(pathname, basename) { + if (basename === "/") return pathname; + + if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) { + return null; + } // We want to leave trailing slash behavior in the user's control, so if they + // specify a basename with a trailing slash, we should support it + + + let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length; + let nextChar = pathname.charAt(startIndex); + + if (nextChar && nextChar !== "/") { + // pathname does not start with basename/ + return null; + } + + return pathname.slice(startIndex) || "/"; +} +/** + * @private + */ + +function warning(cond, message) { + if (!cond) { + // eslint-disable-next-line no-console + if (typeof console !== "undefined") console.warn(message); + + try { + // Welcome to debugging React Router! + // + // This error is thrown as a convenience so you can more easily + // find the source for a warning that appears in the console by + // enabling "pause on exceptions" in your JavaScript debugger. + throw new Error(message); // eslint-disable-next-line no-empty + } catch (e) {} + } +} +/** + * Returns a resolved path object relative to the given pathname. + * + * @see https://reactrouter.com/utils/resolve-path + */ + +function resolvePath(to, fromPathname) { + if (fromPathname === void 0) { + fromPathname = "/"; + } + + let { + pathname: toPathname, + search = "", + hash = "" + } = typeof to === "string" ? parsePath(to) : to; + let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname; + return { + pathname, + search: normalizeSearch(search), + hash: normalizeHash(hash) + }; +} + +function resolvePathname(relativePath, fromPathname) { + let segments = fromPathname.replace(/\/+$/, "").split("/"); + let relativeSegments = relativePath.split("/"); + relativeSegments.forEach(segment => { + if (segment === "..") { + // Keep the root "" segment so the pathname starts at / + if (segments.length > 1) segments.pop(); + } else if (segment !== ".") { + segments.push(segment); + } + }); + return segments.length > 1 ? segments.join("/") : "/"; +} + +function getInvalidPathError(char, field, dest, path) { + 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 <Link to=\"...\"> and the router will parse it for you."; +} +/** + * @private + * + * When processing relative navigation we want to ignore ancestor routes that + * do not contribute to the path, such that index/pathless layout routes don't + * interfere. + * + * For example, when moving a route element into an index route and/or a + * pathless layout route, relative link behavior contained within should stay + * the same. Both of the following examples should link back to the root: + * + * <Route path="/"> + * <Route path="accounts" element={<Link to=".."}> + * </Route> + * + * <Route path="/"> + * <Route path="accounts"> + * <Route element={<AccountsLayout />}> // <-- Does not contribute + * <Route index element={<Link to=".."} /> // <-- Does not contribute + * </Route + * </Route> + * </Route> + */ + + +function getPathContributingMatches(matches) { + return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0); +} +/** + * @private + */ + +function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) { + if (isPathRelative === void 0) { + isPathRelative = false; + } + + let to; + + if (typeof toArg === "string") { + to = parsePath(toArg); + } else { + to = _extends({}, toArg); + invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to)); + invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to)); + invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to)); + } + + let isEmptyPath = toArg === "" || to.pathname === ""; + let toPathname = isEmptyPath ? "/" : to.pathname; + let from; // Routing is relative to the current pathname if explicitly requested. + // + // If a pathname is explicitly provided in `to`, it should be relative to the + // route context. This is explained in `Note on `<Link to>` values` in our + // migration guide from v5 as a means of disambiguation between `to` values + // that begin with `/` and those that do not. However, this is problematic for + // `to` values that do not provide a pathname. `to` can simply be a search or + // hash string, in which case we should assume that the navigation is relative + // to the current location's pathname and *not* the route pathname. + + if (isPathRelative || toPathname == null) { + from = locationPathname; + } else { + let routePathnameIndex = routePathnames.length - 1; + + if (toPathname.startsWith("..")) { + let toSegments = toPathname.split("/"); // Each leading .. segment means "go up one route" instead of "go up one + // URL segment". This is a key difference from how <a href> works and a + // major reason we call this a "to" value instead of a "href". + + while (toSegments[0] === "..") { + toSegments.shift(); + routePathnameIndex -= 1; + } + + to.pathname = toSegments.join("/"); + } // If there are more ".." segments than parent routes, resolve relative to + // the root / URL. + + + from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/"; + } + + let path = resolvePath(to, from); // Ensure the pathname has a trailing slash if the original "to" had one + + let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/"); // Or if this was a link to the current path which has a trailing slash + + let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/"); + + if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) { + path.pathname += "/"; + } + + return path; +} +/** + * @private + */ + +function getToPathname(to) { + // Empty strings should be treated the same as / paths + return to === "" || to.pathname === "" ? "/" : typeof to === "string" ? parsePath(to).pathname : to.pathname; +} +/** + * @private + */ + +const joinPaths = paths => paths.join("/").replace(/\/\/+/g, "/"); +/** + * @private + */ + +const normalizePathname = pathname => pathname.replace(/\/+$/, "").replace(/^\/*/, "/"); +/** + * @private + */ + +const normalizeSearch = search => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search; +/** + * @private + */ + +const normalizeHash = hash => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash; +/** + * This is a shortcut for creating `application/json` responses. Converts `data` + * to JSON and sets the `Content-Type` header. + */ + +const json = function json(data, init) { + if (init === void 0) { + init = {}; + } + + let responseInit = typeof init === "number" ? { + status: init + } : init; + let headers = new Headers(responseInit.headers); + + if (!headers.has("Content-Type")) { + headers.set("Content-Type", "application/json; charset=utf-8"); + } + + return new Response(JSON.stringify(data), _extends({}, responseInit, { + headers + })); +}; +class AbortedDeferredError extends Error {} +class DeferredData { + constructor(data) { + this.pendingKeys = new Set(); + this.subscriber = undefined; + invariant(data && typeof data === "object" && !Array.isArray(data), "defer() only accepts plain objects"); // Set up an AbortController + Promise we can race against to exit early + // cancellation + + let reject; + this.abortPromise = new Promise((_, r) => reject = r); + this.controller = new AbortController(); + + let onAbort = () => reject(new AbortedDeferredError("Deferred data aborted")); + + this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", onAbort); + + this.controller.signal.addEventListener("abort", onAbort); + this.data = Object.entries(data).reduce((acc, _ref) => { + let [key, value] = _ref; + return Object.assign(acc, { + [key]: this.trackPromise(key, value) + }); + }, {}); + } + + trackPromise(key, value) { + if (!(value instanceof Promise)) { + return value; + } + + this.pendingKeys.add(key); // We store a little wrapper promise that will be extended with + // _data/_error props upon resolve/reject + + let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, null, data), error => this.onSettle(promise, key, error)); // Register rejection listeners to avoid uncaught promise rejections on + // errors or aborted deferred values + + promise.catch(() => {}); + Object.defineProperty(promise, "_tracked", { + get: () => true + }); + return promise; + } + + onSettle(promise, key, error, data) { + if (this.controller.signal.aborted && error instanceof AbortedDeferredError) { + this.unlistenAbortSignal(); + Object.defineProperty(promise, "_error", { + get: () => error + }); + return Promise.reject(error); + } + + this.pendingKeys.delete(key); + + if (this.done) { + // Nothing left to abort! + this.unlistenAbortSignal(); + } + + const subscriber = this.subscriber; + + if (error) { + Object.defineProperty(promise, "_error", { + get: () => error + }); + subscriber && subscriber(false); + return Promise.reject(error); + } + + Object.defineProperty(promise, "_data", { + get: () => data + }); + subscriber && subscriber(false); + return data; + } + + subscribe(fn) { + this.subscriber = fn; + } + + cancel() { + this.controller.abort(); + this.pendingKeys.forEach((v, k) => this.pendingKeys.delete(k)); + let subscriber = this.subscriber; + subscriber && subscriber(true); + } + + async resolveData(signal) { + let aborted = false; + + if (!this.done) { + let onAbort = () => this.cancel(); + + signal.addEventListener("abort", onAbort); + aborted = await new Promise(resolve => { + this.subscribe(aborted => { + signal.removeEventListener("abort", onAbort); + + if (aborted || this.done) { + resolve(aborted); + } + }); + }); + } + + return aborted; + } + + get done() { + return this.pendingKeys.size === 0; + } + + get unwrappedData() { + invariant(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds"); + return Object.entries(this.data).reduce((acc, _ref2) => { + let [key, value] = _ref2; + return Object.assign(acc, { + [key]: unwrapTrackedPromise(value) + }); + }, {}); + } + +} + +function isTrackedPromise(value) { + return value instanceof Promise && value._tracked === true; +} + +function unwrapTrackedPromise(value) { + if (!isTrackedPromise(value)) { + return value; + } + + if (value._error) { + throw value._error; + } + + return value._data; +} + +function defer(data) { + return new DeferredData(data); +} +/** + * A redirect response. Sets the status code and the `Location` header. + * Defaults to "302 Found". + */ + +const redirect = function redirect(url, init) { + if (init === void 0) { + init = 302; + } + + let responseInit = init; + + if (typeof responseInit === "number") { + responseInit = { + status: responseInit + }; + } else if (typeof responseInit.status === "undefined") { + responseInit.status = 302; + } + + let headers = new Headers(responseInit.headers); + headers.set("Location", url); + return new Response(null, _extends({}, responseInit, { + headers + })); +}; +/** + * @private + * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies + */ + +class ErrorResponse { + constructor(status, statusText, data, internal) { + if (internal === void 0) { + internal = false; + } + + this.status = status; + this.statusText = statusText || ""; + this.internal = internal; + + if (data instanceof Error) { + this.data = data.toString(); + this.error = data; + } else { + this.data = data; + } + } + +} +/** + * Check if the given error is an ErrorResponse generated from a 4xx/5xx + * Response throw from an action/loader + */ + +function isRouteErrorResponse(e) { + return e instanceof ErrorResponse; +} + +const validMutationMethodsArr = ["post", "put", "patch", "delete"]; +const validMutationMethods = new Set(validMutationMethodsArr); +const validRequestMethodsArr = ["get", ...validMutationMethodsArr]; +const validRequestMethods = new Set(validRequestMethodsArr); +const redirectStatusCodes = new Set([301, 302, 303, 307, 308]); +const redirectPreserveMethodStatusCodes = new Set([307, 308]); +const IDLE_NAVIGATION = { + state: "idle", + location: undefined, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined +}; +const IDLE_FETCHER = { + state: "idle", + data: undefined, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined +}; +const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; +const isServer = !isBrowser; //#endregion +//////////////////////////////////////////////////////////////////////////////// +//#region createRouter +//////////////////////////////////////////////////////////////////////////////// + +/** + * Create a router and listen to history POP navigations + */ + +function createRouter(init) { + invariant(init.routes.length > 0, "You must provide a non-empty routes array to createRouter"); + let dataRoutes = convertRoutesToDataRoutes(init.routes); // Cleanup function for history + + let unlistenHistory = null; // Externally-provided functions to call on all state changes + + let subscribers = new Set(); // Externally-provided object to hold scroll restoration locations during routing + + let savedScrollPositions = null; // Externally-provided function to get scroll restoration keys + + let getScrollRestorationKey = null; // Externally-provided function to get current scroll position + + let getScrollPosition = null; // One-time flag to control the initial hydration scroll restoration. Because + // we don't get the saved positions from <ScrollRestoration /> until _after_ + // the initial render, we need to manually trigger a separate updateState to + // send along the restoreScrollPosition + // Set to true if we have `hydrationData` since we assume we were SSR'd and that + // SSR did the initial scroll restoration. + + let initialScrollRestored = init.hydrationData != null; + let initialMatches = matchRoutes(dataRoutes, init.history.location, init.basename); + let initialErrors = null; + + if (initialMatches == null) { + // If we do not match a user-provided-route, fall back to the root + // to allow the error boundary to take over + let error = getInternalRouterError(404, { + pathname: init.history.location.pathname + }); + let { + matches, + route + } = getShortCircuitMatches(dataRoutes); + initialMatches = matches; + initialErrors = { + [route.id]: error + }; + } + + let initialized = !initialMatches.some(m => m.route.loader) || init.hydrationData != null; + let router; + let state = { + historyAction: init.history.action, + location: init.history.location, + matches: initialMatches, + initialized, + navigation: IDLE_NAVIGATION, + // Don't restore on initial updateState() if we were SSR'd + restoreScrollPosition: init.hydrationData != null ? false : null, + preventScrollReset: false, + revalidation: "idle", + loaderData: init.hydrationData && init.hydrationData.loaderData || {}, + actionData: init.hydrationData && init.hydrationData.actionData || null, + errors: init.hydrationData && init.hydrationData.errors || initialErrors, + fetchers: new Map() + }; // -- Stateful internal variables to manage navigations -- + // Current navigation in progress (to be committed in completeNavigation) + + let pendingAction = Action.Pop; // Should the current navigation prevent the scroll reset if scroll cannot + // be restored? + + let pendingPreventScrollReset = false; // AbortController for the active navigation + + let pendingNavigationController; // We use this to avoid touching history in completeNavigation if a + // revalidation is entirely uninterrupted + + let isUninterruptedRevalidation = false; // Use this internal flag to force revalidation of all loaders: + // - submissions (completed or interrupted) + // - useRevalidate() + // - X-Remix-Revalidate (from redirect) + + let isRevalidationRequired = false; // Use this internal array to capture routes that require revalidation due + // to a cancelled deferred on action submission + + let cancelledDeferredRoutes = []; // Use this internal array to capture fetcher loads that were cancelled by an + // action navigation and require revalidation + + let cancelledFetcherLoads = []; // AbortControllers for any in-flight fetchers + + let fetchControllers = new Map(); // Track loads based on the order in which they started + + let incrementingLoadId = 0; // Track the outstanding pending navigation data load to be compared against + // the globally incrementing load when a fetcher load lands after a completed + // navigation + + let pendingNavigationLoadId = -1; // Fetchers that triggered data reloads as a result of their actions + + let fetchReloadIds = new Map(); // Fetchers that triggered redirect navigations from their actions + + let fetchRedirectIds = new Set(); // Most recent href/match for fetcher.load calls for fetchers + + let fetchLoadMatches = new Map(); // Store DeferredData instances for active route matches. When a + // route loader returns defer() we stick one in here. Then, when a nested + // promise resolves we update loaderData. If a new navigation starts we + // cancel active deferreds for eliminated routes. + + let activeDeferreds = new Map(); // Initialize the router, all side effects should be kicked off from here. + // Implemented as a Fluent API for ease of: + // let router = createRouter(init).initialize(); + + function initialize() { + // If history informs us of a POP navigation, start the navigation but do not update + // state. We'll update our own state once the navigation completes + unlistenHistory = init.history.listen(_ref => { + let { + action: historyAction, + location + } = _ref; + return startNavigation(historyAction, location); + }); // Kick off initial data load if needed. Use Pop to avoid modifying history + + if (!state.initialized) { + startNavigation(Action.Pop, state.location); + } + + return router; + } // Clean up a router and it's side effects + + + function dispose() { + if (unlistenHistory) { + unlistenHistory(); + } + + subscribers.clear(); + pendingNavigationController && pendingNavigationController.abort(); + state.fetchers.forEach((_, key) => deleteFetcher(key)); + } // Subscribe to state updates for the router + + + function subscribe(fn) { + subscribers.add(fn); + return () => subscribers.delete(fn); + } // Update our state and notify the calling context of the change + + + function updateState(newState) { + state = _extends({}, state, newState); + subscribers.forEach(subscriber => subscriber(state)); + } // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION + // and setting state.[historyAction/location/matches] to the new route. + // - Location is a required param + // - Navigation will always be set to IDLE_NAVIGATION + // - Can pass any other state in newState + + + function completeNavigation(location, newState) { + var _location$state; + + // Deduce if we're in a loading/actionReload state: + // - We have committed actionData in the store + // - The current navigation was a mutation submission + // - We're past the submitting state and into the loading state + // - The location being loaded is not the result of a redirect + 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; + let actionData; + + if (newState.actionData) { + if (Object.keys(newState.actionData).length > 0) { + actionData = newState.actionData; + } else { + // Empty actionData -> clear prior actionData due to an action error + actionData = null; + } + } else if (isActionReload) { + // Keep the current data if we're wrapping up the action reload + actionData = state.actionData; + } else { + // Clear actionData on any other completed navigations + actionData = null; + } // Always preserve any existing loaderData from re-used routes + + + let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData; + updateState(_extends({}, newState, { + actionData, + loaderData, + historyAction: pendingAction, + location, + initialized: true, + navigation: IDLE_NAVIGATION, + revalidation: "idle", + // Don't restore on submission navigations + restoreScrollPosition: state.navigation.formData ? false : getSavedScrollPosition(location, newState.matches || state.matches), + preventScrollReset: pendingPreventScrollReset + })); + + if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) { + init.history.push(location, location.state); + } else if (pendingAction === Action.Replace) { + init.history.replace(location, location.state); + } // Reset stateful navigation vars + + + pendingAction = Action.Pop; + pendingPreventScrollReset = false; + isUninterruptedRevalidation = false; + isRevalidationRequired = false; + cancelledDeferredRoutes = []; + cancelledFetcherLoads = []; + } // Trigger a navigation event, which can either be a numerical POP or a PUSH + // replace with an optional submission + + + async function navigate(to, opts) { + if (typeof to === "number") { + init.history.go(to); + return; + } + + let { + path, + submission, + error + } = normalizeNavigateOptions(to, opts); + let location = createLocation(state.location, path, opts && opts.state); // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded + // URL from window.location, so we need to encode it here so the behavior + // remains the same as POP and non-data-router usages. new URL() does all + // the same encoding we'd get from a history.pushState/window.location read + // without having to touch history + + location = _extends({}, location, init.history.encodeLocation(location)); + let userReplace = opts && opts.replace != null ? opts.replace : undefined; + let historyAction = Action.Push; + + if (userReplace === true) { + historyAction = Action.Replace; + } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) { + // By default on submissions to the current location we REPLACE so that + // users don't have to double-click the back button to get to the prior + // location. If the user redirects to a different location from the + // action/loader this will be ignored and the redirect will be a PUSH + historyAction = Action.Replace; + } + + let preventScrollReset = opts && "preventScrollReset" in opts ? opts.preventScrollReset === true : undefined; + return await startNavigation(historyAction, location, { + submission, + // Send through the formData serialization error if we have one so we can + // render at the right error boundary after we match routes + pendingError: error, + preventScrollReset, + replace: opts && opts.replace + }); + } // Revalidate all current loaders. If a navigation is in progress or if this + // is interrupted by a navigation, allow this to "succeed" by calling all + // loaders during the next loader round + + + function revalidate() { + interruptActiveLoads(); + updateState({ + revalidation: "loading" + }); // If we're currently submitting an action, we don't need to start a new + // navigation, we'll just let the follow up loader execution call all loaders + + if (state.navigation.state === "submitting") { + return; + } // If we're currently in an idle state, start a new navigation for the current + // action/location and mark it as uninterrupted, which will skip the history + // update in completeNavigation + + + if (state.navigation.state === "idle") { + startNavigation(state.historyAction, state.location, { + startUninterruptedRevalidation: true + }); + return; + } // Otherwise, if we're currently in a loading state, just start a new + // navigation to the navigation.location but do not trigger an uninterrupted + // revalidation so that history correctly updates once the navigation completes + + + startNavigation(pendingAction || state.historyAction, state.navigation.location, { + overrideNavigation: state.navigation + }); + } // Start a navigation to the given action/location. Can optionally provide a + // overrideNavigation which will override the normalLoad in the case of a redirect + // navigation + + + async function startNavigation(historyAction, location, opts) { + // Abort any in-progress navigations and start a new one. Unset any ongoing + // uninterrupted revalidations unless told otherwise, since we want this + // new navigation to update history normally + pendingNavigationController && pendingNavigationController.abort(); + pendingNavigationController = null; + pendingAction = historyAction; + isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true; // Save the current scroll position every time we start a new navigation, + // and track whether we should reset scroll on completion + + saveScrollPosition(state.location, state.matches); + pendingPreventScrollReset = (opts && opts.preventScrollReset) === true; + let loadingNavigation = opts && opts.overrideNavigation; + let matches = matchRoutes(dataRoutes, location, init.basename); // Short circuit with a 404 on the root error boundary if we match nothing + + if (!matches) { + let error = getInternalRouterError(404, { + pathname: location.pathname + }); + let { + matches: notFoundMatches, + route + } = getShortCircuitMatches(dataRoutes); // Cancel all pending deferred on 404s since we don't keep any routes + + cancelActiveDeferreds(); + completeNavigation(location, { + matches: notFoundMatches, + loaderData: {}, + errors: { + [route.id]: error + } + }); + return; + } // Short circuit if it's only a hash change + + + if (isHashChangeOnly(state.location, location)) { + completeNavigation(location, { + matches + }); + return; + } // Create a controller/Request for this navigation + + + pendingNavigationController = new AbortController(); + let request = createClientSideRequest(location, pendingNavigationController.signal, opts && opts.submission); + let pendingActionData; + let pendingError; + + if (opts && opts.pendingError) { + // If we have a pendingError, it means the user attempted a GET submission + // with binary FormData so assign here and skip to handleLoaders. That + // way we handle calling loaders above the boundary etc. It's not really + // different from an actionError in that sense. + pendingError = { + [findNearestBoundary(matches).route.id]: opts.pendingError + }; + } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) { + // Call action if we received an action submission + let actionOutput = await handleAction(request, location, opts.submission, matches, { + replace: opts.replace + }); + + if (actionOutput.shortCircuited) { + return; + } + + pendingActionData = actionOutput.pendingActionData; + pendingError = actionOutput.pendingActionError; + + let navigation = _extends({ + state: "loading", + location + }, opts.submission); + + loadingNavigation = navigation; // Create a GET request for the loaders + + request = new Request(request.url, { + signal: request.signal + }); + } // Call loaders + + + let { + shortCircuited, + loaderData, + errors + } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.replace, pendingActionData, pendingError); + + if (shortCircuited) { + return; + } // Clean up now that the action/loaders have completed. Don't clean up if + // we short circuited because pendingNavigationController will have already + // been assigned to a new controller for the next navigation + + + pendingNavigationController = null; + completeNavigation(location, _extends({ + matches + }, pendingActionData ? { + actionData: pendingActionData + } : {}, { + loaderData, + errors + })); + } // Call the action matched by the leaf route for this navigation and handle + // redirects/errors + + + async function handleAction(request, location, submission, matches, opts) { + interruptActiveLoads(); // Put us in a submitting state + + let navigation = _extends({ + state: "submitting", + location + }, submission); + + updateState({ + navigation + }); // Call our action and get the result + + let result; + let actionMatch = getTargetMatch(matches, location); + + if (!actionMatch.route.action) { + result = { + type: ResultType.error, + error: getInternalRouterError(405, { + method: request.method, + pathname: location.pathname, + routeId: actionMatch.route.id + }) + }; + } else { + result = await callLoaderOrAction("action", request, actionMatch, matches, router.basename); + + if (request.signal.aborted) { + return { + shortCircuited: true + }; + } + } + + if (isRedirectResult(result)) { + let replace; + + if (opts && opts.replace != null) { + replace = opts.replace; + } else { + // If the user didn't explicity indicate replace behavior, replace if + // we redirected to the exact same location we're currently at to avoid + // double back-buttons + replace = result.location === state.location.pathname + state.location.search; + } + + await startRedirectNavigation(state, result, { + submission, + replace + }); + return { + shortCircuited: true + }; + } + + if (isErrorResult(result)) { + // Store off the pending error - we use it to determine which loaders + // to call and will commit it when we complete the navigation + let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id); // By default, all submissions are REPLACE navigations, but if the + // action threw an error that'll be rendered in an errorElement, we fall + // back to PUSH so that the user can use the back button to get back to + // the pre-submission form location to try again + + if ((opts && opts.replace) !== true) { + pendingAction = Action.Push; + } + + return { + // Send back an empty object we can use to clear out any prior actionData + pendingActionData: {}, + pendingActionError: { + [boundaryMatch.route.id]: result.error + } + }; + } + + if (isDeferredResult(result)) { + throw new Error("defer() is not supported in actions"); + } + + return { + pendingActionData: { + [actionMatch.route.id]: result.data + } + }; + } // Call all applicable loaders for the given matches, handling redirects, + // errors, etc. + + + async function handleLoaders(request, location, matches, overrideNavigation, submission, replace, pendingActionData, pendingError) { + // Figure out the right navigation we want to use for data loading + let loadingNavigation = overrideNavigation; + + if (!loadingNavigation) { + let navigation = _extends({ + state: "loading", + location, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined + }, submission); + + loadingNavigation = navigation; + } // If this was a redirect from an action we don't have a "submission" but + // we have it on the loading navigation so use that if available + + + let activeSubmission = submission ? submission : loadingNavigation.formMethod && loadingNavigation.formAction && loadingNavigation.formData && loadingNavigation.formEncType ? { + formMethod: loadingNavigation.formMethod, + formAction: loadingNavigation.formAction, + formData: loadingNavigation.formData, + formEncType: loadingNavigation.formEncType + } : undefined; + let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, pendingActionData, pendingError, fetchLoadMatches); // Cancel pending deferreds for no-longer-matched routes or routes we're + // about to reload. Note that if this is an action reload we would have + // already cancelled all pending deferreds so this would be a no-op + + cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId)); // Short circuit if we have no loaders to run + + if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) { + completeNavigation(location, _extends({ + matches, + loaderData: {}, + // Commit pending error if we're short circuiting + errors: pendingError || null + }, pendingActionData ? { + actionData: pendingActionData + } : {})); + return { + shortCircuited: true + }; + } // If this is an uninterrupted revalidation, we remain in our current idle + // state. If not, we need to switch to our loading state and load data, + // preserving any new action data or existing action data (in the case of + // a revalidation interrupting an actionReload) + + + if (!isUninterruptedRevalidation) { + revalidatingFetchers.forEach(_ref2 => { + let [key] = _ref2; + let fetcher = state.fetchers.get(key); + let revalidatingFetcher = { + state: "loading", + data: fetcher && fetcher.data, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined, + " _hasFetcherDoneAnything ": true + }; + state.fetchers.set(key, revalidatingFetcher); + }); + let actionData = pendingActionData || state.actionData; + updateState(_extends({ + navigation: loadingNavigation + }, actionData ? Object.keys(actionData).length === 0 ? { + actionData: null + } : { + actionData + } : {}, revalidatingFetchers.length > 0 ? { + fetchers: new Map(state.fetchers) + } : {})); + } + + pendingNavigationLoadId = ++incrementingLoadId; + revalidatingFetchers.forEach(_ref3 => { + let [key] = _ref3; + return fetchControllers.set(key, pendingNavigationController); + }); + let { + results, + loaderResults, + fetcherResults + } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request); + + if (request.signal.aborted) { + return { + shortCircuited: true + }; + } // Clean up _after_ loaders have completed. Don't clean up if we short + // circuited because fetchControllers would have been aborted and + // reassigned to new controllers for the next navigation + + + revalidatingFetchers.forEach(_ref4 => { + let [key] = _ref4; + return fetchControllers.delete(key); + }); // If any loaders returned a redirect Response, start a new REPLACE navigation + + let redirect = findRedirect(results); + + if (redirect) { + await startRedirectNavigation(state, redirect, { + replace + }); + return { + shortCircuited: true + }; + } // Process and commit output from loaders + + + let { + loaderData, + errors + } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds); // Wire up subscribers to update loaderData as promises settle + + activeDeferreds.forEach((deferredData, routeId) => { + deferredData.subscribe(aborted => { + // Note: No need to updateState here since the TrackedPromise on + // loaderData is stable across resolve/reject + // Remove this instance if we were aborted or if promises have settled + if (aborted || deferredData.done) { + activeDeferreds.delete(routeId); + } + }); + }); + markFetchRedirectsDone(); + let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId); + return _extends({ + loaderData, + errors + }, didAbortFetchLoads || revalidatingFetchers.length > 0 ? { + fetchers: new Map(state.fetchers) + } : {}); + } + + function getFetcher(key) { + return state.fetchers.get(key) || IDLE_FETCHER; + } // Trigger a fetcher load/submit for the given fetcher key + + + function fetch(key, routeId, href, opts) { + if (isServer) { + throw new Error("router.fetch() was called during the server render, but it shouldn't be. " + "You are likely calling a useFetcher() method in the body of your component. " + "Try moving it to a useEffect or a callback."); + } + + if (fetchControllers.has(key)) abortFetcher(key); + let matches = matchRoutes(dataRoutes, href, init.basename); + + if (!matches) { + setFetcherError(key, routeId, getInternalRouterError(404, { + pathname: href + })); + return; + } + + let { + path, + submission + } = normalizeNavigateOptions(href, opts, true); + let match = getTargetMatch(matches, path); + + if (submission && isMutationMethod(submission.formMethod)) { + handleFetcherAction(key, routeId, path, match, matches, submission); + return; + } // Store off the match so we can call it's shouldRevalidate on subsequent + // revalidations + + + fetchLoadMatches.set(key, [path, match, matches]); + handleFetcherLoader(key, routeId, path, match, matches, submission); + } // Call the action for the matched fetcher.submit(), and then handle redirects, + // errors, and revalidation + + + async function handleFetcherAction(key, routeId, path, match, requestMatches, submission) { + interruptActiveLoads(); + fetchLoadMatches.delete(key); + + if (!match.route.action) { + let error = getInternalRouterError(405, { + method: submission.formMethod, + pathname: path, + routeId: routeId + }); + setFetcherError(key, routeId, error); + return; + } // Put this fetcher into it's submitting state + + + let existingFetcher = state.fetchers.get(key); + + let fetcher = _extends({ + state: "submitting" + }, submission, { + data: existingFetcher && existingFetcher.data, + " _hasFetcherDoneAnything ": true + }); + + state.fetchers.set(key, fetcher); + updateState({ + fetchers: new Map(state.fetchers) + }); // Call the action for the fetcher + + let abortController = new AbortController(); + let fetchRequest = createClientSideRequest(path, abortController.signal, submission); + fetchControllers.set(key, abortController); + let actionResult = await callLoaderOrAction("action", fetchRequest, match, requestMatches, router.basename); + + if (fetchRequest.signal.aborted) { + // We can delete this so long as we weren't aborted by ou our own fetcher + // re-submit which would have put _new_ controller is in fetchControllers + if (fetchControllers.get(key) === abortController) { + fetchControllers.delete(key); + } + + return; + } + + if (isRedirectResult(actionResult)) { + fetchControllers.delete(key); + fetchRedirectIds.add(key); + + let loadingFetcher = _extends({ + state: "loading" + }, submission, { + data: undefined, + " _hasFetcherDoneAnything ": true + }); + + state.fetchers.set(key, loadingFetcher); + updateState({ + fetchers: new Map(state.fetchers) + }); + return startRedirectNavigation(state, actionResult, { + isFetchActionRedirect: true + }); + } // Process any non-redirect errors thrown + + + if (isErrorResult(actionResult)) { + setFetcherError(key, routeId, actionResult.error); + return; + } + + if (isDeferredResult(actionResult)) { + invariant(false, "defer() is not supported in actions"); + } // Start the data load for current matches, or the next location if we're + // in the middle of a navigation + + + let nextLocation = state.navigation.location || state.location; + let revalidationRequest = createClientSideRequest(nextLocation, abortController.signal); + let matches = state.navigation.state !== "idle" ? matchRoutes(dataRoutes, state.navigation.location, init.basename) : state.matches; + invariant(matches, "Didn't find any matches after fetcher action"); + let loadId = ++incrementingLoadId; + fetchReloadIds.set(key, loadId); + + let loadFetcher = _extends({ + state: "loading", + data: actionResult.data + }, submission, { + " _hasFetcherDoneAnything ": true + }); + + state.fetchers.set(key, loadFetcher); + let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, { + [match.route.id]: actionResult.data + }, undefined, // No need to send through errors since we short circuit above + fetchLoadMatches); // Put all revalidating fetchers into the loading state, except for the + // current fetcher which we want to keep in it's current loading state which + // contains it's action submission info + action data + + revalidatingFetchers.filter(_ref5 => { + let [staleKey] = _ref5; + return staleKey !== key; + }).forEach(_ref6 => { + let [staleKey] = _ref6; + let existingFetcher = state.fetchers.get(staleKey); + let revalidatingFetcher = { + state: "loading", + data: existingFetcher && existingFetcher.data, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined, + " _hasFetcherDoneAnything ": true + }; + state.fetchers.set(staleKey, revalidatingFetcher); + fetchControllers.set(staleKey, abortController); + }); + updateState({ + fetchers: new Map(state.fetchers) + }); + let { + results, + loaderResults, + fetcherResults + } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest); + + if (abortController.signal.aborted) { + return; + } + + fetchReloadIds.delete(key); + fetchControllers.delete(key); + revalidatingFetchers.forEach(_ref7 => { + let [staleKey] = _ref7; + return fetchControllers.delete(staleKey); + }); + let redirect = findRedirect(results); + + if (redirect) { + return startRedirectNavigation(state, redirect); + } // Process and commit output from loaders + + + let { + loaderData, + errors + } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds); + let doneFetcher = { + state: "idle", + data: actionResult.data, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined, + " _hasFetcherDoneAnything ": true + }; + state.fetchers.set(key, doneFetcher); + let didAbortFetchLoads = abortStaleFetchLoads(loadId); // If we are currently in a navigation loading state and this fetcher is + // more recent than the navigation, we want the newer data so abort the + // navigation and complete it with the fetcher data + + if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) { + invariant(pendingAction, "Expected pending action"); + pendingNavigationController && pendingNavigationController.abort(); + completeNavigation(state.navigation.location, { + matches, + loaderData, + errors, + fetchers: new Map(state.fetchers) + }); + } else { + // otherwise just update with the fetcher data, preserving any existing + // loaderData for loaders that did not need to reload. We have to + // manually merge here since we aren't going through completeNavigation + updateState(_extends({ + errors, + loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors) + }, didAbortFetchLoads ? { + fetchers: new Map(state.fetchers) + } : {})); + isRevalidationRequired = false; + } + } // Call the matched loader for fetcher.load(), handling redirects, errors, etc. + + + async function handleFetcherLoader(key, routeId, path, match, matches, submission) { + let existingFetcher = state.fetchers.get(key); // Put this fetcher into it's loading state + + let loadingFetcher = _extends({ + state: "loading", + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined + }, submission, { + data: existingFetcher && existingFetcher.data, + " _hasFetcherDoneAnything ": true + }); + + state.fetchers.set(key, loadingFetcher); + updateState({ + fetchers: new Map(state.fetchers) + }); // Call the loader for this fetcher route match + + let abortController = new AbortController(); + let fetchRequest = createClientSideRequest(path, abortController.signal); + fetchControllers.set(key, abortController); + let result = await callLoaderOrAction("loader", fetchRequest, match, matches, router.basename); // Deferred isn't supported or fetcher loads, await everything and treat it + // as a normal load. resolveDeferredData will return undefined if this + // fetcher gets aborted, so we just leave result untouched and short circuit + // below if that happens + + if (isDeferredResult(result)) { + result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result; + } // We can delete this so long as we weren't aborted by ou our own fetcher + // re-load which would have put _new_ controller is in fetchControllers + + + if (fetchControllers.get(key) === abortController) { + fetchControllers.delete(key); + } + + if (fetchRequest.signal.aborted) { + return; + } // If the loader threw a redirect Response, start a new REPLACE navigation + + + if (isRedirectResult(result)) { + await startRedirectNavigation(state, result); + return; + } // Process any non-redirect errors thrown + + + if (isErrorResult(result)) { + let boundaryMatch = findNearestBoundary(state.matches, routeId); + state.fetchers.delete(key); // TODO: In remix, this would reset to IDLE_NAVIGATION if it was a catch - + // do we need to behave any differently with our non-redirect errors? + // What if it was a non-redirect Response? + + updateState({ + fetchers: new Map(state.fetchers), + errors: { + [boundaryMatch.route.id]: result.error + } + }); + return; + } + + invariant(!isDeferredResult(result), "Unhandled fetcher deferred data"); // Put the fetcher back into an idle state + + let doneFetcher = { + state: "idle", + data: result.data, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined, + " _hasFetcherDoneAnything ": true + }; + state.fetchers.set(key, doneFetcher); + updateState({ + fetchers: new Map(state.fetchers) + }); + } + /** + * Utility function to handle redirects returned from an action or loader. + * Normally, a redirect "replaces" the navigation that triggered it. So, for + * example: + * + * - user is on /a + * - user clicks a link to /b + * - loader for /b redirects to /c + * + * In a non-JS app the browser would track the in-flight navigation to /b and + * then replace it with /c when it encountered the redirect response. In + * the end it would only ever update the URL bar with /c. + * + * In client-side routing using pushState/replaceState, we aim to emulate + * this behavior and we also do not update history until the end of the + * navigation (including processed redirects). This means that we never + * actually touch history until we've processed redirects, so we just use + * the history action from the original navigation (PUSH or REPLACE). + */ + + + async function startRedirectNavigation(state, redirect, _temp) { + var _window; + + let { + submission, + replace, + isFetchActionRedirect + } = _temp === void 0 ? {} : _temp; + + if (redirect.revalidate) { + isRevalidationRequired = true; + } + + let redirectLocation = createLocation(state.location, redirect.location, // TODO: This can be removed once we get rid of useTransition in Remix v2 + _extends({ + _isRedirect: true + }, isFetchActionRedirect ? { + _isFetchActionRedirect: true + } : {})); + invariant(redirectLocation, "Expected a location on the redirect navigation"); // Check if this an external redirect that goes to a new origin + + if (typeof ((_window = window) == null ? void 0 : _window.location) !== "undefined") { + let newOrigin = createClientSideURL(redirect.location).origin; + + if (window.location.origin !== newOrigin) { + if (replace) { + window.location.replace(redirect.location); + } else { + window.location.assign(redirect.location); + } + + return; + } + } // There's no need to abort on redirects, since we don't detect the + // redirect until the action/loaders have settled + + + pendingNavigationController = null; + let redirectHistoryAction = replace === true ? Action.Replace : Action.Push; // Use the incoming submission if provided, fallback on the active one in + // state.navigation + + let { + formMethod, + formAction, + formEncType, + formData + } = state.navigation; + + if (!submission && formMethod && formAction && formData && formEncType) { + submission = { + formMethod, + formAction, + formEncType, + formData + }; + } // If this was a 307/308 submission we want to preserve the HTTP method and + // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the + // redirected location + + + if (redirectPreserveMethodStatusCodes.has(redirect.status) && submission && isMutationMethod(submission.formMethod)) { + await startNavigation(redirectHistoryAction, redirectLocation, { + submission: _extends({}, submission, { + formAction: redirect.location + }) + }); + } else { + // Otherwise, we kick off a new loading navigation, preserving the + // submission info for the duration of this navigation + await startNavigation(redirectHistoryAction, redirectLocation, { + overrideNavigation: { + state: "loading", + location: redirectLocation, + formMethod: submission ? submission.formMethod : undefined, + formAction: submission ? submission.formAction : undefined, + formEncType: submission ? submission.formEncType : undefined, + formData: submission ? submission.formData : undefined + } + }); + } + } + + async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) { + // Call all navigation loaders and revalidating fetcher loaders in parallel, + // then slice off the results into separate arrays so we can handle them + // accordingly + let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction("loader", request, match, matches, router.basename)), ...fetchersToLoad.map(_ref8 => { + let [, href, match, fetchMatches] = _ref8; + return callLoaderOrAction("loader", createClientSideRequest(href, request.signal), match, fetchMatches, router.basename); + })]); + let loaderResults = results.slice(0, matchesToLoad.length); + let fetcherResults = results.slice(matchesToLoad.length); + await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, request.signal, false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(_ref9 => { + let [,, match] = _ref9; + return match; + }), fetcherResults, request.signal, true)]); + return { + results, + loaderResults, + fetcherResults + }; + } + + function interruptActiveLoads() { + // Every interruption triggers a revalidation + isRevalidationRequired = true; // Cancel pending route-level deferreds and mark cancelled routes for + // revalidation + + cancelledDeferredRoutes.push(...cancelActiveDeferreds()); // Abort in-flight fetcher loads + + fetchLoadMatches.forEach((_, key) => { + if (fetchControllers.has(key)) { + cancelledFetcherLoads.push(key); + abortFetcher(key); + } + }); + } + + function setFetcherError(key, routeId, error) { + let boundaryMatch = findNearestBoundary(state.matches, routeId); + deleteFetcher(key); + updateState({ + errors: { + [boundaryMatch.route.id]: error + }, + fetchers: new Map(state.fetchers) + }); + } + + function deleteFetcher(key) { + if (fetchControllers.has(key)) abortFetcher(key); + fetchLoadMatches.delete(key); + fetchReloadIds.delete(key); + fetchRedirectIds.delete(key); + state.fetchers.delete(key); + } + + function abortFetcher(key) { + let controller = fetchControllers.get(key); + invariant(controller, "Expected fetch controller: " + key); + controller.abort(); + fetchControllers.delete(key); + } + + function markFetchersDone(keys) { + for (let key of keys) { + let fetcher = getFetcher(key); + let doneFetcher = { + state: "idle", + data: fetcher.data, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined, + " _hasFetcherDoneAnything ": true + }; + state.fetchers.set(key, doneFetcher); + } + } + + function markFetchRedirectsDone() { + let doneKeys = []; + + for (let key of fetchRedirectIds) { + let fetcher = state.fetchers.get(key); + invariant(fetcher, "Expected fetcher: " + key); + + if (fetcher.state === "loading") { + fetchRedirectIds.delete(key); + doneKeys.push(key); + } + } + + markFetchersDone(doneKeys); + } + + function abortStaleFetchLoads(landedId) { + let yeetedKeys = []; + + for (let [key, id] of fetchReloadIds) { + if (id < landedId) { + let fetcher = state.fetchers.get(key); + invariant(fetcher, "Expected fetcher: " + key); + + if (fetcher.state === "loading") { + abortFetcher(key); + fetchReloadIds.delete(key); + yeetedKeys.push(key); + } + } + } + + markFetchersDone(yeetedKeys); + return yeetedKeys.length > 0; + } + + function cancelActiveDeferreds(predicate) { + let cancelledRouteIds = []; + activeDeferreds.forEach((dfd, routeId) => { + if (!predicate || predicate(routeId)) { + // Cancel the deferred - but do not remove from activeDeferreds here - + // we rely on the subscribers to do that so our tests can assert proper + // cleanup via _internalActiveDeferreds + dfd.cancel(); + cancelledRouteIds.push(routeId); + activeDeferreds.delete(routeId); + } + }); + return cancelledRouteIds; + } // Opt in to capturing and reporting scroll positions during navigations, + // used by the <ScrollRestoration> component + + + function enableScrollRestoration(positions, getPosition, getKey) { + savedScrollPositions = positions; + getScrollPosition = getPosition; + + getScrollRestorationKey = getKey || (location => location.key); // Perform initial hydration scroll restoration, since we miss the boat on + // the initial updateState() because we've not yet rendered <ScrollRestoration/> + // and therefore have no savedScrollPositions available + + + if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) { + initialScrollRestored = true; + let y = getSavedScrollPosition(state.location, state.matches); + + if (y != null) { + updateState({ + restoreScrollPosition: y + }); + } + } + + return () => { + savedScrollPositions = null; + getScrollPosition = null; + getScrollRestorationKey = null; + }; + } + + function saveScrollPosition(location, matches) { + if (savedScrollPositions && getScrollRestorationKey && getScrollPosition) { + let userMatches = matches.map(m => createUseMatchesMatch(m, state.loaderData)); + let key = getScrollRestorationKey(location, userMatches) || location.key; + savedScrollPositions[key] = getScrollPosition(); + } + } + + function getSavedScrollPosition(location, matches) { + if (savedScrollPositions && getScrollRestorationKey && getScrollPosition) { + let userMatches = matches.map(m => createUseMatchesMatch(m, state.loaderData)); + let key = getScrollRestorationKey(location, userMatches) || location.key; + let y = savedScrollPositions[key]; + + if (typeof y === "number") { + return y; + } + } + + return null; + } + + router = { + get basename() { + return init.basename; + }, + + get state() { + return state; + }, + + get routes() { + return dataRoutes; + }, + + initialize, + subscribe, + enableScrollRestoration, + navigate, + fetch, + revalidate, + // Passthrough to history-aware createHref used by useHref so we get proper + // hash-aware URLs in DOM paths + createHref: to => init.history.createHref(to), + encodeLocation: to => init.history.encodeLocation(to), + getFetcher, + deleteFetcher, + dispose, + _internalFetchControllers: fetchControllers, + _internalActiveDeferreds: activeDeferreds + }; + return router; +} //#endregion +//////////////////////////////////////////////////////////////////////////////// +//#region createStaticHandler +//////////////////////////////////////////////////////////////////////////////// + +function createStaticHandler(routes, opts) { + invariant(routes.length > 0, "You must provide a non-empty routes array to createStaticHandler"); + let dataRoutes = convertRoutesToDataRoutes(routes); + let basename = (opts ? opts.basename : null) || "/"; + /** + * The query() method is intended for document requests, in which we want to + * call an optional action and potentially multiple loaders for all nested + * routes. It returns a StaticHandlerContext object, which is very similar + * to the router state (location, loaderData, actionData, errors, etc.) and + * also adds SSR-specific information such as the statusCode and headers + * from action/loaders Responses. + * + * It _should_ never throw and should report all errors through the + * returned context.errors object, properly associating errors to their error + * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be + * used to emulate React error boundaries during SSr by performing a second + * pass only down to the boundaryId. + * + * The one exception where we do not return a StaticHandlerContext is when a + * redirect response is returned or thrown from any action/loader. We + * propagate that out and return the raw Response so the HTTP server can + * return it directly. + */ + + async function query(request, _temp2) { + let { + requestContext + } = _temp2 === void 0 ? {} : _temp2; + let url = new URL(request.url); + let method = request.method.toLowerCase(); + let location = createLocation("", createPath(url), null, "default"); + let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't + + if (!isValidMethod(method) && method !== "head") { + let error = getInternalRouterError(405, { + method + }); + let { + matches: methodNotAllowedMatches, + route + } = getShortCircuitMatches(dataRoutes); + return { + basename, + location, + matches: methodNotAllowedMatches, + loaderData: {}, + actionData: null, + errors: { + [route.id]: error + }, + statusCode: error.status, + loaderHeaders: {}, + actionHeaders: {} + }; + } else if (!matches) { + let error = getInternalRouterError(404, { + pathname: location.pathname + }); + let { + matches: notFoundMatches, + route + } = getShortCircuitMatches(dataRoutes); + return { + basename, + location, + matches: notFoundMatches, + loaderData: {}, + actionData: null, + errors: { + [route.id]: error + }, + statusCode: error.status, + loaderHeaders: {}, + actionHeaders: {} + }; + } + + let result = await queryImpl(request, location, matches, requestContext); + + if (isResponse(result)) { + return result; + } // When returning StaticHandlerContext, we patch back in the location here + // since we need it for React Context. But this helps keep our submit and + // loadRouteData operating on a Request instead of a Location + + + return _extends({ + location, + basename + }, result); + } + /** + * The queryRoute() method is intended for targeted route requests, either + * for fetch ?_data requests or resource route requests. In this case, we + * are only ever calling a single action or loader, and we are returning the + * returned value directly. In most cases, this will be a Response returned + * from the action/loader, but it may be a primitive or other value as well - + * and in such cases the calling context should handle that accordingly. + * + * We do respect the throw/return differentiation, so if an action/loader + * throws, then this method will throw the value. This is important so we + * can do proper boundary identification in Remix where a thrown Response + * must go to the Catch Boundary but a returned Response is happy-path. + * + * One thing to note is that any Router-initiated Errors that make sense + * to associate with a status code will be thrown as an ErrorResponse + * instance which include the raw Error, such that the calling context can + * serialize the error as they see fit while including the proper response + * code. Examples here are 404 and 405 errors that occur prior to reaching + * any user-defined loaders. + */ + + + async function queryRoute(request, _temp3) { + let { + routeId, + requestContext + } = _temp3 === void 0 ? {} : _temp3; + let url = new URL(request.url); + let method = request.method.toLowerCase(); + let location = createLocation("", createPath(url), null, "default"); + let matches = matchRoutes(dataRoutes, location, basename); // SSR supports HEAD requests while SPA doesn't + + if (!isValidMethod(method) && method !== "head") { + throw getInternalRouterError(405, { + method + }); + } else if (!matches) { + throw getInternalRouterError(404, { + pathname: location.pathname + }); + } + + let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location); + + if (routeId && !match) { + throw getInternalRouterError(403, { + pathname: location.pathname, + routeId + }); + } else if (!match) { + // This should never hit I don't think? + throw getInternalRouterError(404, { + pathname: location.pathname + }); + } + + let result = await queryImpl(request, location, matches, requestContext, match); + + if (isResponse(result)) { + return result; + } + + let error = result.errors ? Object.values(result.errors)[0] : undefined; + + if (error !== undefined) { + // If we got back result.errors, that means the loader/action threw + // _something_ that wasn't a Response, but it's not guaranteed/required + // to be an `instanceof Error` either, so we have to use throw here to + // preserve the "error" state outside of queryImpl. + throw error; + } // Pick off the right state value to return + + + let routeData = [result.actionData, result.loaderData].find(v => v); + return Object.values(routeData || {})[0]; + } + + async function queryImpl(request, location, matches, requestContext, routeMatch) { + invariant(request.signal, "query()/queryRoute() requests must contain an AbortController signal"); + + try { + if (isMutationMethod(request.method.toLowerCase())) { + let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, routeMatch != null); + return result; + } + + let result = await loadRouteData(request, matches, requestContext, routeMatch); + return isResponse(result) ? result : _extends({}, result, { + actionData: null, + actionHeaders: {} + }); + } catch (e) { + // If the user threw/returned a Response in callLoaderOrAction, we throw + // it to bail out and then return or throw here based on whether the user + // returned or threw + if (isQueryRouteResponse(e)) { + if (e.type === ResultType.error && !isRedirectResponse(e.response)) { + throw e.response; + } + + return e.response; + } // Redirects are always returned since they don't propagate to catch + // boundaries + + + if (isRedirectResponse(e)) { + return e; + } + + throw e; + } + } + + async function submit(request, matches, actionMatch, requestContext, isRouteRequest) { + let result; + + if (!actionMatch.route.action) { + let error = getInternalRouterError(405, { + method: request.method, + pathname: new URL(request.url).pathname, + routeId: actionMatch.route.id + }); + + if (isRouteRequest) { + throw error; + } + + result = { + type: ResultType.error, + error + }; + } else { + result = await callLoaderOrAction("action", request, actionMatch, matches, basename, true, isRouteRequest, requestContext); + + if (request.signal.aborted) { + let method = isRouteRequest ? "queryRoute" : "query"; + throw new Error(method + "() call aborted"); + } + } + + if (isRedirectResult(result)) { + // Uhhhh - this should never happen, we should always throw these from + // callLoaderOrAction, but the type narrowing here keeps TS happy and we + // can get back on the "throw all redirect responses" train here should + // this ever happen :/ + throw new Response(null, { + status: result.status, + headers: { + Location: result.location + } + }); + } + + if (isDeferredResult(result)) { + throw new Error("defer() is not supported in actions"); + } + + if (isRouteRequest) { + // Note: This should only be non-Response values if we get here, since + // isRouteRequest should throw any Response received in callLoaderOrAction + if (isErrorResult(result)) { + throw result.error; + } + + return { + matches: [actionMatch], + loaderData: {}, + actionData: { + [actionMatch.route.id]: result.data + }, + errors: null, + // Note: statusCode + headers are unused here since queryRoute will + // return the raw Response or value + statusCode: 200, + loaderHeaders: {}, + actionHeaders: {} + }; + } + + if (isErrorResult(result)) { + // Store off the pending error - we use it to determine which loaders + // to call and will commit it when we complete the navigation + let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id); + let context = await loadRouteData(request, matches, requestContext, undefined, { + [boundaryMatch.route.id]: result.error + }); // action status codes take precedence over loader status codes + + return _extends({}, context, { + statusCode: isRouteErrorResponse(result.error) ? result.error.status : 500, + actionData: null, + actionHeaders: _extends({}, result.headers ? { + [actionMatch.route.id]: result.headers + } : {}) + }); + } // Create a GET request for the loaders + + + let loaderRequest = new Request(request.url, { + headers: request.headers, + redirect: request.redirect, + signal: request.signal + }); + let context = await loadRouteData(loaderRequest, matches, requestContext); + return _extends({}, context, result.statusCode ? { + statusCode: result.statusCode + } : {}, { + actionData: { + [actionMatch.route.id]: result.data + }, + actionHeaders: _extends({}, result.headers ? { + [actionMatch.route.id]: result.headers + } : {}) + }); + } + + async function loadRouteData(request, matches, requestContext, routeMatch, pendingActionError) { + let isRouteRequest = routeMatch != null; // Short circuit if we have no loaders to run (queryRoute()) + + if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader)) { + throw getInternalRouterError(400, { + method: request.method, + pathname: new URL(request.url).pathname, + routeId: routeMatch == null ? void 0 : routeMatch.route.id + }); + } + + let requestMatches = routeMatch ? [routeMatch] : getLoaderMatchesUntilBoundary(matches, Object.keys(pendingActionError || {})[0]); + let matchesToLoad = requestMatches.filter(m => m.route.loader); // Short circuit if we have no loaders to run (query()) + + if (matchesToLoad.length === 0) { + return { + matches, + // Add a null for all matched routes for proper revalidation on the client + loaderData: matches.reduce((acc, m) => Object.assign(acc, { + [m.route.id]: null + }), {}), + errors: pendingActionError || null, + statusCode: 200, + loaderHeaders: {} + }; + } + + let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction("loader", request, match, matches, basename, true, isRouteRequest, requestContext))]); + + if (request.signal.aborted) { + let method = isRouteRequest ? "queryRoute" : "query"; + throw new Error(method + "() call aborted"); + } + + let executedLoaders = new Set(); + results.forEach((result, i) => { + executedLoaders.add(matchesToLoad[i].route.id); // Can't do anything with these without the Remix side of things, so just + // cancel them for now + + if (isDeferredResult(result)) { + result.deferredData.cancel(); + } + }); // Process and commit output from loaders + + let context = processRouteLoaderData(matches, matchesToLoad, results, pendingActionError); // Add a null for any non-loader matches for proper revalidation on the client + + matches.forEach(match => { + if (!executedLoaders.has(match.route.id)) { + context.loaderData[match.route.id] = null; + } + }); + return _extends({}, context, { + matches + }); + } + + return { + dataRoutes, + query, + queryRoute + }; +} //#endregion +//////////////////////////////////////////////////////////////////////////////// +//#region Helpers +//////////////////////////////////////////////////////////////////////////////// + +/** + * Given an existing StaticHandlerContext and an error thrown at render time, + * provide an updated StaticHandlerContext suitable for a second SSR render + */ + +function getStaticContextFromError(routes, context, error) { + let newContext = _extends({}, context, { + statusCode: 500, + errors: { + [context._deepestRenderedBoundaryId || routes[0].id]: error + } + }); + + return newContext; +} + +function isSubmissionNavigation(opts) { + return opts != null && "formData" in opts; +} // Normalize navigation options by converting formMethod=GET formData objects to +// URLSearchParams so they behave identically to links with query params + + +function normalizeNavigateOptions(to, opts, isFetcher) { + if (isFetcher === void 0) { + isFetcher = false; + } + + let path = typeof to === "string" ? to : createPath(to); // Return location verbatim on non-submission navigations + + if (!opts || !isSubmissionNavigation(opts)) { + return { + path + }; + } + + if (opts.formMethod && !isValidMethod(opts.formMethod)) { + return { + path, + error: getInternalRouterError(405, { + method: opts.formMethod + }) + }; + } // Create a Submission on non-GET navigations + + + let submission; + + if (opts.formData) { + submission = { + formMethod: opts.formMethod || "get", + formAction: stripHashFromPath(path), + formEncType: opts && opts.formEncType || "application/x-www-form-urlencoded", + formData: opts.formData + }; + + if (isMutationMethod(submission.formMethod)) { + return { + path, + submission + }; + } + } // Flatten submission onto URLSearchParams for GET submissions + + + let parsedPath = parsePath(path); + + try { + let searchParams = convertFormDataToSearchParams(opts.formData); // Since fetcher GET submissions only run a single loader (as opposed to + // navigation GET submissions which run all loaders), we need to preserve + // any incoming ?index params + + if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) { + searchParams.append("index", ""); + } + + parsedPath.search = "?" + searchParams; + } catch (e) { + return { + path, + error: getInternalRouterError(400) + }; + } + + return { + path: createPath(parsedPath), + submission + }; +} // Filter out all routes below any caught error as they aren't going to +// render so we don't need to load them + + +function getLoaderMatchesUntilBoundary(matches, boundaryId) { + let boundaryMatches = matches; + + if (boundaryId) { + let index = matches.findIndex(m => m.route.id === boundaryId); + + if (index >= 0) { + boundaryMatches = matches.slice(0, index); + } + } + + return boundaryMatches; +} + +function getMatchesToLoad(state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, pendingActionData, pendingError, fetchLoadMatches) { + let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined; // Pick navigation matches that are net-new or qualify for revalidation + + let boundaryId = pendingError ? Object.keys(pendingError)[0] : undefined; + let boundaryMatches = getLoaderMatchesUntilBoundary(matches, boundaryId); + let navigationMatches = boundaryMatches.filter((match, index) => match.route.loader != null && (isNewLoader(state.loaderData, state.matches[index], match) || // If this route had a pending deferred cancelled it must be revalidated + cancelledDeferredRoutes.some(id => id === match.route.id) || shouldRevalidateLoader(state.location, state.matches[index], submission, location, match, isRevalidationRequired, actionResult))); // Pick fetcher.loads that need to be revalidated + + let revalidatingFetchers = []; + fetchLoadMatches && fetchLoadMatches.forEach((_ref10, key) => { + let [href, match, fetchMatches] = _ref10; + + // This fetcher was cancelled from a prior action submission - force reload + if (cancelledFetcherLoads.includes(key)) { + revalidatingFetchers.push([key, href, match, fetchMatches]); + } else if (isRevalidationRequired) { + let shouldRevalidate = shouldRevalidateLoader(href, match, submission, href, match, isRevalidationRequired, actionResult); + + if (shouldRevalidate) { + revalidatingFetchers.push([key, href, match, fetchMatches]); + } + } + }); + return [navigationMatches, revalidatingFetchers]; +} + +function isNewLoader(currentLoaderData, currentMatch, match) { + let isNew = // [a] -> [a, b] + !currentMatch || // [a, b] -> [a, c] + match.route.id !== currentMatch.route.id; // Handle the case that we don't have data for a re-used route, potentially + // from a prior error or from a cancelled pending deferred + + let isMissingData = currentLoaderData[match.route.id] === undefined; // Always load if this is a net-new route or we don't yet have data + + return isNew || isMissingData; +} + +function isNewRouteInstance(currentMatch, match) { + let currentPath = currentMatch.route.path; + return (// param change for this match, /users/123 -> /users/456 + currentMatch.pathname !== match.pathname || // splat param changed, which is not present in match.path + // e.g. /files/images/avatar.jpg -> files/finances.xls + currentPath && currentPath.endsWith("*") && currentMatch.params["*"] !== match.params["*"] + ); +} + +function shouldRevalidateLoader(currentLocation, currentMatch, submission, location, match, isRevalidationRequired, actionResult) { + let currentUrl = createClientSideURL(currentLocation); + let currentParams = currentMatch.params; + let nextUrl = createClientSideURL(location); + let nextParams = match.params; // This is the default implementation as to when we revalidate. If the route + // provides it's own implementation, then we give them full control but + // provide this value so they can leverage it if needed after they check + // their own specific use cases + // Note that fetchers always provide the same current/next locations so the + // URL-based checks here don't apply to fetcher shouldRevalidate calls + + let defaultShouldRevalidate = isNewRouteInstance(currentMatch, match) || // Clicked the same link, resubmitted a GET form + currentUrl.toString() === nextUrl.toString() || // Search params affect all loaders + currentUrl.search !== nextUrl.search || // Forced revalidation due to submission, useRevalidate, or X-Remix-Revalidate + isRevalidationRequired; + + if (match.route.shouldRevalidate) { + let routeChoice = match.route.shouldRevalidate(_extends({ + currentUrl, + currentParams, + nextUrl, + nextParams + }, submission, { + actionResult, + defaultShouldRevalidate + })); + + if (typeof routeChoice === "boolean") { + return routeChoice; + } + } + + return defaultShouldRevalidate; +} + +async function callLoaderOrAction(type, request, match, matches, basename, isStaticRequest, isRouteRequest, requestContext) { + if (basename === void 0) { + basename = "/"; + } + + if (isStaticRequest === void 0) { + isStaticRequest = false; + } + + if (isRouteRequest === void 0) { + isRouteRequest = false; + } + + let resultType; + let result; // Setup a promise we can race against so that abort signals short circuit + + let reject; + let abortPromise = new Promise((_, r) => reject = r); + + let onReject = () => reject(); + + request.signal.addEventListener("abort", onReject); + + try { + let handler = match.route[type]; + invariant(handler, "Could not find the " + type + " to run on the \"" + match.route.id + "\" route"); + result = await Promise.race([handler({ + request, + params: match.params, + context: requestContext + }), abortPromise]); + invariant(result !== undefined, "You defined " + (type === "action" ? "an action" : "a loader") + " for route " + ("\"" + match.route.id + "\" but didn't return anything from your `" + type + "` ") + "function. Please return a value or `null`."); + } catch (e) { + resultType = ResultType.error; + result = e; + } finally { + request.signal.removeEventListener("abort", onReject); + } + + if (isResponse(result)) { + let status = result.status; // Process redirects + + if (redirectStatusCodes.has(status)) { + let location = result.headers.get("Location"); + invariant(location, "Redirects returned/thrown from loaders/actions must have a Location header"); + let isAbsolute = /^[a-z+]+:\/\//i.test(location) || location.startsWith("//"); // Support relative routing in internal redirects + + if (!isAbsolute) { + let activeMatches = matches.slice(0, matches.indexOf(match) + 1); + let routePathnames = getPathContributingMatches(activeMatches).map(match => match.pathnameBase); + let resolvedLocation = resolveTo(location, routePathnames, new URL(request.url).pathname); + invariant(createPath(resolvedLocation), "Unable to resolve redirect location: " + location); // Prepend the basename to the redirect location if we have one + + if (basename) { + let path = resolvedLocation.pathname; + resolvedLocation.pathname = path === "/" ? basename : joinPaths([basename, path]); + } + + location = createPath(resolvedLocation); + } // Don't process redirects in the router during static requests requests. + // Instead, throw the Response and let the server handle it with an HTTP + // redirect. We also update the Location header in place in this flow so + // basename and relative routing is taken into account + + + if (isStaticRequest) { + result.headers.set("Location", location); + throw result; + } + + return { + type: ResultType.redirect, + status, + location, + revalidate: result.headers.get("X-Remix-Revalidate") !== null + }; + } // For SSR single-route requests, we want to hand Responses back directly + // without unwrapping. We do this with the QueryRouteResponse wrapper + // interface so we can know whether it was returned or thrown + + + if (isRouteRequest) { + // eslint-disable-next-line no-throw-literal + throw { + type: resultType || ResultType.data, + response: result + }; + } + + let data; + let contentType = result.headers.get("Content-Type"); // Check between word boundaries instead of startsWith() due to the last + // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type + + if (contentType && /\bapplication\/json\b/.test(contentType)) { + data = await result.json(); + } else { + data = await result.text(); + } + + if (resultType === ResultType.error) { + return { + type: resultType, + error: new ErrorResponse(status, result.statusText, data), + headers: result.headers + }; + } + + return { + type: ResultType.data, + data, + statusCode: result.status, + headers: result.headers + }; + } + + if (resultType === ResultType.error) { + return { + type: resultType, + error: result + }; + } + + if (result instanceof DeferredData) { + return { + type: ResultType.deferred, + deferredData: result + }; + } + + return { + type: ResultType.data, + data: result + }; +} // Utility method for creating the Request instances for loaders/actions during +// client-side navigations and fetches. During SSR we will always have a +// Request instance from the static handler (query/queryRoute) + + +function createClientSideRequest(location, signal, submission) { + let url = createClientSideURL(stripHashFromPath(location)).toString(); + let init = { + signal + }; + + if (submission && isMutationMethod(submission.formMethod)) { + let { + formMethod, + formEncType, + formData + } = submission; + init.method = formMethod.toUpperCase(); + init.body = formEncType === "application/x-www-form-urlencoded" ? convertFormDataToSearchParams(formData) : formData; + } // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request) + + + return new Request(url, init); +} + +function convertFormDataToSearchParams(formData) { + let searchParams = new URLSearchParams(); + + for (let [key, value] of formData.entries()) { + invariant(typeof value === "string", 'File inputs are not supported with encType "application/x-www-form-urlencoded", ' + 'please use "multipart/form-data" instead.'); + searchParams.append(key, value); + } + + return searchParams; +} + +function processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds) { + // Fill in loaderData/errors from our loaders + let loaderData = {}; + let errors = null; + let statusCode; + let foundError = false; + let loaderHeaders = {}; // Process loader results into state.loaderData/state.errors + + results.forEach((result, index) => { + let id = matchesToLoad[index].route.id; + invariant(!isRedirectResult(result), "Cannot handle redirect results in processLoaderData"); + + if (isErrorResult(result)) { + // Look upwards from the matched route for the closest ancestor + // error boundary, defaulting to the root match + let boundaryMatch = findNearestBoundary(matches, id); + let error = result.error; // If we have a pending action error, we report it at the highest-route + // that throws a loader error, and then clear it out to indicate that + // it was consumed + + if (pendingError) { + error = Object.values(pendingError)[0]; + pendingError = undefined; + } + + errors = errors || {}; // Prefer higher error values if lower errors bubble to the same boundary + + if (errors[boundaryMatch.route.id] == null) { + errors[boundaryMatch.route.id] = error; + } // Clear our any prior loaderData for the throwing route + + + loaderData[id] = undefined; // Once we find our first (highest) error, we set the status code and + // prevent deeper status codes from overriding + + if (!foundError) { + foundError = true; + statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500; + } + + if (result.headers) { + loaderHeaders[id] = result.headers; + } + } else if (isDeferredResult(result)) { + activeDeferreds && activeDeferreds.set(id, result.deferredData); + loaderData[id] = result.deferredData.data; // TODO: Add statusCode/headers once we wire up streaming in Remix + } else { + loaderData[id] = result.data; // Error status codes always override success status codes, but if all + // loaders are successful we take the deepest status code. + + if (result.statusCode != null && result.statusCode !== 200 && !foundError) { + statusCode = result.statusCode; + } + + if (result.headers) { + loaderHeaders[id] = result.headers; + } + } + }); // If we didn't consume the pending action error (i.e., all loaders + // resolved), then consume it here. Also clear out any loaderData for the + // throwing route + + if (pendingError) { + errors = pendingError; + loaderData[Object.keys(pendingError)[0]] = undefined; + } + + return { + loaderData, + errors, + statusCode: statusCode || 200, + loaderHeaders + }; +} + +function processLoaderData(state, matches, matchesToLoad, results, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds) { + let { + loaderData, + errors + } = processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds); // Process results from our revalidating fetchers + + for (let index = 0; index < revalidatingFetchers.length; index++) { + let [key,, match] = revalidatingFetchers[index]; + invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, "Did not find corresponding fetcher result"); + let result = fetcherResults[index]; // Process fetcher non-redirect errors + + if (isErrorResult(result)) { + let boundaryMatch = findNearestBoundary(state.matches, match.route.id); + + if (!(errors && errors[boundaryMatch.route.id])) { + errors = _extends({}, errors, { + [boundaryMatch.route.id]: result.error + }); + } + + state.fetchers.delete(key); + } else if (isRedirectResult(result)) { + // Should never get here, redirects should get processed above, but we + // keep this to type narrow to a success result in the else + throw new Error("Unhandled fetcher revalidation redirect"); + } else if (isDeferredResult(result)) { + // Should never get here, deferred data should be awaited for fetchers + // in resolveDeferredResults + throw new Error("Unhandled fetcher deferred data"); + } else { + let doneFetcher = { + state: "idle", + data: result.data, + formMethod: undefined, + formAction: undefined, + formEncType: undefined, + formData: undefined, + " _hasFetcherDoneAnything ": true + }; + state.fetchers.set(key, doneFetcher); + } + } + + return { + loaderData, + errors + }; +} + +function mergeLoaderData(loaderData, newLoaderData, matches, errors) { + let mergedLoaderData = _extends({}, newLoaderData); + + for (let match of matches) { + let id = match.route.id; + + if (newLoaderData.hasOwnProperty(id)) { + if (newLoaderData[id] !== undefined) { + mergedLoaderData[id] = newLoaderData[id]; + } + } else if (loaderData[id] !== undefined) { + mergedLoaderData[id] = loaderData[id]; + } + + if (errors && errors.hasOwnProperty(id)) { + // Don't keep any loader data below the boundary + break; + } + } + + return mergedLoaderData; +} // Find the nearest error boundary, looking upwards from the leaf route (or the +// route specified by routeId) for the closest ancestor error boundary, +// defaulting to the root match + + +function findNearestBoundary(matches, routeId) { + let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches]; + return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0]; +} + +function getShortCircuitMatches(routes) { + // Prefer a root layout route if present, otherwise shim in a route object + let route = routes.find(r => r.index || !r.path || r.path === "/") || { + id: "__shim-error-route__" + }; + return { + matches: [{ + params: {}, + pathname: "", + pathnameBase: "", + route + }], + route + }; +} + +function getInternalRouterError(status, _temp4) { + let { + pathname, + routeId, + method + } = _temp4 === void 0 ? {} : _temp4; + let statusText = "Unknown Server Error"; + let errorMessage = "Unknown @remix-run/router error"; + + if (status === 400) { + statusText = "Bad Request"; + + if (method && pathname && routeId) { + errorMessage = "You made a " + method + " request to \"" + pathname + "\" but " + ("did not provide a `loader` for route \"" + routeId + "\", ") + "so there is no way to handle the request."; + } else { + errorMessage = "Cannot submit binary form data using GET"; + } + } else if (status === 403) { + statusText = "Forbidden"; + errorMessage = "Route \"" + routeId + "\" does not match URL \"" + pathname + "\""; + } else if (status === 404) { + statusText = "Not Found"; + errorMessage = "No route matches URL \"" + pathname + "\""; + } else if (status === 405) { + statusText = "Method Not Allowed"; + + if (method && pathname && routeId) { + errorMessage = "You made a " + method.toUpperCase() + " request to \"" + pathname + "\" but " + ("did not provide an `action` for route \"" + routeId + "\", ") + "so there is no way to handle the request."; + } else if (method) { + errorMessage = "Invalid request method \"" + method.toUpperCase() + "\""; + } + } + + return new ErrorResponse(status || 500, statusText, new Error(errorMessage), true); +} // Find any returned redirect errors, starting from the lowest match + + +function findRedirect(results) { + for (let i = results.length - 1; i >= 0; i--) { + let result = results[i]; + + if (isRedirectResult(result)) { + return result; + } + } +} + +function stripHashFromPath(path) { + let parsedPath = typeof path === "string" ? parsePath(path) : path; + return createPath(_extends({}, parsedPath, { + hash: "" + })); +} + +function isHashChangeOnly(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash !== b.hash; +} + +function isDeferredResult(result) { + return result.type === ResultType.deferred; +} + +function isErrorResult(result) { + return result.type === ResultType.error; +} + +function isRedirectResult(result) { + return (result && result.type) === ResultType.redirect; +} + +function isResponse(value) { + return value != null && typeof value.status === "number" && typeof value.statusText === "string" && typeof value.headers === "object" && typeof value.body !== "undefined"; +} + +function isRedirectResponse(result) { + if (!isResponse(result)) { + return false; + } + + let status = result.status; + let location = result.headers.get("Location"); + return status >= 300 && status <= 399 && location != null; +} + +function isQueryRouteResponse(obj) { + return obj && isResponse(obj.response) && (obj.type === ResultType.data || ResultType.error); +} + +function isValidMethod(method) { + return validRequestMethods.has(method); +} + +function isMutationMethod(method) { + return validMutationMethods.has(method); +} + +async function resolveDeferredResults(currentMatches, matchesToLoad, results, signal, isFetcher, currentLoaderData) { + for (let index = 0; index < results.length; index++) { + let result = results[index]; + let match = matchesToLoad[index]; + let currentMatch = currentMatches.find(m => m.route.id === match.route.id); + let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined; + + if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) { + // Note: we do not have to touch activeDeferreds here since we race them + // against the signal in resolveDeferredData and they'll get aborted + // there if needed + await resolveDeferredData(result, signal, isFetcher).then(result => { + if (result) { + results[index] = result || results[index]; + } + }); + } + } +} + +async function resolveDeferredData(result, signal, unwrap) { + if (unwrap === void 0) { + unwrap = false; + } + + let aborted = await result.deferredData.resolveData(signal); + + if (aborted) { + return; + } + + if (unwrap) { + try { + return { + type: ResultType.data, + data: result.deferredData.unwrappedData + }; + } catch (e) { + // Handle any TrackedPromise._error values encountered while unwrapping + return { + type: ResultType.error, + error: e + }; + } + } + + return { + type: ResultType.data, + data: result.deferredData.data + }; +} + +function hasNakedIndexQuery(search) { + return new URLSearchParams(search).getAll("index").some(v => v === ""); +} // Note: This should match the format exported by useMatches, so if you change +// this please also change that :) Eventually we'll DRY this up + + +function createUseMatchesMatch(match, loaderData) { + let { + route, + pathname, + params + } = match; + return { + id: route.id, + pathname, + params, + data: loaderData[route.id], + handle: route.handle + }; +} + +function getTargetMatch(matches, location) { + let search = typeof location === "string" ? parsePath(location).search : location.search; + + if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || "")) { + // Return the leaf index route when index is present + return matches[matches.length - 1]; + } // Otherwise grab the deepest "path contributing" match (ignoring index and + // pathless layout routes) + + + let pathMatches = getPathContributingMatches(matches); + return pathMatches[pathMatches.length - 1]; +} //#endregion + + +//# sourceMappingURL=router.js.map + + /***/ }), /***/ "hkWm": @@ -302427,6 +307403,29 @@ function getISOYear (dirtyDate) { module.exports = getISOYear +/***/ }), + +/***/ "iYLG": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _extends; }); +function _extends() { + _extends = Object.assign ? Object.assign.bind() : 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); +} + /***/ }), /***/ "iae6": @@ -314581,90 +319580,6 @@ var buildPremiumLink = function buildPremiumLink(instanceInfo) { exports.buildPremiumLink = buildPremiumLink; -/***/ }), - -/***/ "lCFh": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -function isAbsolute(pathname) { - return pathname.charAt(0) === '/'; -} - -// About 1.5x faster than the two-arg version of Array#splice() -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { - list[i] = list[k]; - } - - list.pop(); -} - -// This implementation is based heavily on node's url.parse -function resolvePathname(to, from) { - if (from === undefined) from = ''; - - var toParts = (to && to.split('/')) || []; - var fromParts = (from && from.split('/')) || []; - - var isToAbs = to && isAbsolute(to); - var isFromAbs = from && isAbsolute(from); - var mustEndAbs = isToAbs || isFromAbs; - - if (to && isAbsolute(to)) { - // to is absolute - fromParts = toParts; - } else if (toParts.length) { - // to is relative, drop the filename - fromParts.pop(); - fromParts = fromParts.concat(toParts); - } - - if (!fromParts.length) return '/'; - - var hasTrailingSlash; - if (fromParts.length) { - var last = fromParts[fromParts.length - 1]; - hasTrailingSlash = last === '.' || last === '..' || last === ''; - } else { - hasTrailingSlash = false; - } - - var up = 0; - for (var i = fromParts.length; i >= 0; i--) { - var part = fromParts[i]; - - if (part === '.') { - spliceOne(fromParts, i); - } else if (part === '..') { - spliceOne(fromParts, i); - up++; - } else if (up) { - spliceOne(fromParts, i); - up--; - } - } - - if (!mustEndAbs) for (; up--; up) fromParts.unshift('..'); - - if ( - mustEndAbs && - fromParts[0] !== '' && - (!fromParts[0] || !isAbsolute(fromParts[0])) - ) - fromParts.unshift(''); - - var result = fromParts.join('/'); - - if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; - - return result; -} - -/* harmony default export */ __webpack_exports__["default"] = (resolvePathname); - - /***/ }), /***/ "lCdf": @@ -369030,196 +373945,6 @@ logger.pipe = function() { }; module.exports = logger; -/***/ }), - -/***/ "tEiQ": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("q1tI"); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("dI71"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("17x9"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("LUQC"); - - - - - -var MAX_SIGNED_31_BIT_INT = 1073741823; -var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; - -function getUniqueId() { - var key = '__global_unique_id__'; - return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1; -} - -function objectIs(x, y) { - if (x === y) { - return x !== 0 || 1 / x === 1 / y; - } else { - return x !== x && y !== y; - } -} - -function createEventEmitter(value) { - var handlers = []; - return { - on: function on(handler) { - handlers.push(handler); - }, - off: function off(handler) { - handlers = handlers.filter(function (h) { - return h !== handler; - }); - }, - get: function get() { - return value; - }, - set: function set(newValue, changedBits) { - value = newValue; - handlers.forEach(function (handler) { - return handler(value, changedBits); - }); - } - }; -} - -function onlyChild(children) { - return Array.isArray(children) ? children[0] : children; -} - -function createReactContext(defaultValue, calculateChangedBits) { - var _Provider$childContex, _Consumer$contextType; - - var contextProp = '__create-react-context-' + getUniqueId() + '__'; - - var Provider = /*#__PURE__*/function (_Component) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(Provider, _Component); - - function Provider() { - var _this; - - _this = _Component.apply(this, arguments) || this; - _this.emitter = createEventEmitter(_this.props.value); - return _this; - } - - var _proto = Provider.prototype; - - _proto.getChildContext = function getChildContext() { - var _ref; - - return _ref = {}, _ref[contextProp] = this.emitter, _ref; - }; - - _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { - if (this.props.value !== nextProps.value) { - var oldValue = this.props.value; - var newValue = nextProps.value; - var changedBits; - - if (objectIs(oldValue, newValue)) { - changedBits = 0; - } else { - changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; - - if (false) {} - - changedBits |= 0; - - if (changedBits !== 0) { - this.emitter.set(nextProps.value, changedBits); - } - } - } - }; - - _proto.render = function render() { - return this.props.children; - }; - - return Provider; - }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); - - Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object.isRequired, _Provider$childContex); - - var Consumer = /*#__PURE__*/function (_Component2) { - Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(Consumer, _Component2); - - function Consumer() { - var _this2; - - _this2 = _Component2.apply(this, arguments) || this; - _this2.state = { - value: _this2.getValue() - }; - - _this2.onUpdate = function (newValue, changedBits) { - var observedBits = _this2.observedBits | 0; - - if ((observedBits & changedBits) !== 0) { - _this2.setState({ - value: _this2.getValue() - }); - } - }; - - return _this2; - } - - var _proto2 = Consumer.prototype; - - _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { - var observedBits = nextProps.observedBits; - this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; - }; - - _proto2.componentDidMount = function componentDidMount() { - if (this.context[contextProp]) { - this.context[contextProp].on(this.onUpdate); - } - - var observedBits = this.props.observedBits; - this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; - }; - - _proto2.componentWillUnmount = function componentWillUnmount() { - if (this.context[contextProp]) { - this.context[contextProp].off(this.onUpdate); - } - }; - - _proto2.getValue = function getValue() { - if (this.context[contextProp]) { - return this.context[contextProp].get(); - } else { - return defaultValue; - } - }; - - _proto2.render = function render() { - return onlyChild(this.props.children)(this.state.value); - }; - - return Consumer; - }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); - - Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object, _Consumer$contextType); - return { - Provider: Provider, - Consumer: Consumer - }; -} - -var index = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext || createReactContext; - -/* harmony default export */ __webpack_exports__["default"] = (index); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("yLpj"))) - /***/ }), /***/ "tIkd": @@ -381124,439 +385849,6 @@ function addGlobalEventProcessor(callback) { //# sourceMappingURL=scope.js.map -/***/ }), - -/***/ "vRGJ": -/***/ (function(module, exports, __webpack_require__) { - -var isarray = __webpack_require__("AqCL") - -/** - * Expose `pathToRegexp`. - */ -module.exports = pathToRegexp -module.exports.parse = parse -module.exports.compile = compile -module.exports.tokensToFunction = tokensToFunction -module.exports.tokensToRegExp = tokensToRegExp - -/** - * The main path matching regexp utility. - * - * @type {RegExp} - */ -var PATH_REGEXP = new RegExp([ - // Match escaped characters that would otherwise appear in future matches. - // This allows the user to escape special characters that won't transform. - '(\\\\.)', - // Match Express-style parameters and un-named parameters with a prefix - // and optional suffixes. Matches appear as: - // - // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] - // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] - // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] - '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' -].join('|'), 'g') - -/** - * Parse a string for the raw tokens. - * - * @param {string} str - * @param {Object=} options - * @return {!Array} - */ -function parse (str, options) { - var tokens = [] - var key = 0 - var index = 0 - var path = '' - var defaultDelimiter = options && options.delimiter || '/' - var res - - while ((res = PATH_REGEXP.exec(str)) != null) { - var m = res[0] - var escaped = res[1] - var offset = res.index - path += str.slice(index, offset) - index = offset + m.length - - // Ignore already escaped sequences. - if (escaped) { - path += escaped[1] - continue - } - - var next = str[index] - var prefix = res[2] - var name = res[3] - var capture = res[4] - var group = res[5] - var modifier = res[6] - var asterisk = res[7] - - // Push the current path onto the tokens. - if (path) { - tokens.push(path) - path = '' - } - - var partial = prefix != null && next != null && next !== prefix - var repeat = modifier === '+' || modifier === '*' - var optional = modifier === '?' || modifier === '*' - var delimiter = res[2] || defaultDelimiter - var pattern = capture || group - - tokens.push({ - name: name || key++, - prefix: prefix || '', - delimiter: delimiter, - optional: optional, - repeat: repeat, - partial: partial, - asterisk: !!asterisk, - pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') - }) - } - - // Match any characters still remaining. - if (index < str.length) { - path += str.substr(index) - } - - // If the path exists, push it onto the end. - if (path) { - tokens.push(path) - } - - return tokens -} - -/** - * Compile a string to a template function for the path. - * - * @param {string} str - * @param {Object=} options - * @return {!function(Object=, Object=)} - */ -function compile (str, options) { - return tokensToFunction(parse(str, options), options) -} - -/** - * Prettier encoding of URI path segments. - * - * @param {string} - * @return {string} - */ -function encodeURIComponentPretty (str) { - return encodeURI(str).replace(/[\/?#]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} - -/** - * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. - * - * @param {string} - * @return {string} - */ -function encodeAsterisk (str) { - return encodeURI(str).replace(/[?#]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} - -/** - * Expose a method for transforming tokens into the path function. - */ -function tokensToFunction (tokens, options) { - // Compile all the tokens into regexps. - var matches = new Array(tokens.length) - - // Compile all the patterns before compilation. - for (var i = 0; i < tokens.length; i++) { - if (typeof tokens[i] === 'object') { - matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options)) - } - } - - return function (obj, opts) { - var path = '' - var data = obj || {} - var options = opts || {} - var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent - - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i] - - if (typeof token === 'string') { - path += token - - continue - } - - var value = data[token.name] - var segment - - if (value == null) { - if (token.optional) { - // Prepend partial segment prefixes. - if (token.partial) { - path += token.prefix - } - - continue - } else { - throw new TypeError('Expected "' + token.name + '" to be defined') - } - } - - if (isarray(value)) { - if (!token.repeat) { - throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') - } - - if (value.length === 0) { - if (token.optional) { - continue - } else { - throw new TypeError('Expected "' + token.name + '" to not be empty') - } - } - - for (var j = 0; j < value.length; j++) { - segment = encode(value[j]) - - if (!matches[i].test(segment)) { - throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') - } - - path += (j === 0 ? token.prefix : token.delimiter) + segment - } - - continue - } - - segment = token.asterisk ? encodeAsterisk(value) : encode(value) - - if (!matches[i].test(segment)) { - throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') - } - - path += token.prefix + segment - } - - return path - } -} - -/** - * Escape a regular expression string. - * - * @param {string} str - * @return {string} - */ -function escapeString (str) { - return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') -} - -/** - * Escape the capturing group by escaping special characters and meaning. - * - * @param {string} group - * @return {string} - */ -function escapeGroup (group) { - return group.replace(/([=!:$\/()])/g, '\\$1') -} - -/** - * Attach the keys as a property of the regexp. - * - * @param {!RegExp} re - * @param {Array} keys - * @return {!RegExp} - */ -function attachKeys (re, keys) { - re.keys = keys - return re -} - -/** - * Get the flags for a regexp from the options. - * - * @param {Object} options - * @return {string} - */ -function flags (options) { - return options && options.sensitive ? '' : 'i' -} - -/** - * Pull out keys from a regexp. - * - * @param {!RegExp} path - * @param {!Array} keys - * @return {!RegExp} - */ -function regexpToRegexp (path, keys) { - // Use a negative lookahead to match only capturing groups. - var groups = path.source.match(/\((?!\?)/g) - - if (groups) { - for (var i = 0; i < groups.length; i++) { - keys.push({ - name: i, - prefix: null, - delimiter: null, - optional: false, - repeat: false, - partial: false, - asterisk: false, - pattern: null - }) - } - } - - return attachKeys(path, keys) -} - -/** - * Transform an array into a regexp. - * - * @param {!Array} path - * @param {Array} keys - * @param {!Object} options - * @return {!RegExp} - */ -function arrayToRegexp (path, keys, options) { - var parts = [] - - for (var i = 0; i < path.length; i++) { - parts.push(pathToRegexp(path[i], keys, options).source) - } - - var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)) - - return attachKeys(regexp, keys) -} - -/** - * Create a path regexp from string input. - * - * @param {string} path - * @param {!Array} keys - * @param {!Object} options - * @return {!RegExp} - */ -function stringToRegexp (path, keys, options) { - return tokensToRegExp(parse(path, options), keys, options) -} - -/** - * Expose a function for taking tokens and returning a RegExp. - * - * @param {!Array} tokens - * @param {(Array|Object)=} keys - * @param {Object=} options - * @return {!RegExp} - */ -function tokensToRegExp (tokens, keys, options) { - if (!isarray(keys)) { - options = /** @type {!Object} */ (keys || options) - keys = [] - } - - options = options || {} - - var strict = options.strict - var end = options.end !== false - var route = '' - - // Iterate over the tokens and create our regexp string. - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i] - - if (typeof token === 'string') { - route += escapeString(token) - } else { - var prefix = escapeString(token.prefix) - var capture = '(?:' + token.pattern + ')' - - keys.push(token) - - if (token.repeat) { - capture += '(?:' + prefix + capture + ')*' - } - - if (token.optional) { - if (!token.partial) { - capture = '(?:' + prefix + '(' + capture + '))?' - } else { - capture = prefix + '(' + capture + ')?' - } - } else { - capture = prefix + '(' + capture + ')' - } - - route += capture - } - } - - var delimiter = escapeString(options.delimiter || '/') - var endsWithDelimiter = route.slice(-delimiter.length) === delimiter - - // In non-strict mode we allow a slash at the end of match. If the path to - // match already ends with a slash, we remove it for consistency. The slash - // is valid at the end of a path match, not in the middle. This is important - // in non-ending mode, where "/test/" shouldn't match "/test//route". - if (!strict) { - route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?' - } - - if (end) { - route += '$' - } else { - // In non-ending mode, we need the capturing groups to match as much as - // possible by using a positive lookahead to the end or next path segment. - route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)' - } - - return attachKeys(new RegExp('^' + route, flags(options)), keys) -} - -/** - * Normalize the given path string, returning a regular expression. - * - * An empty array can be passed in for the keys, which will hold the - * placeholder key descriptions. For example, using `/user/:id`, `keys` will - * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. - * - * @param {(string|RegExp|Array)} path - * @param {(Array|Object)=} keys - * @param {Object=} options - * @return {!RegExp} - */ -function pathToRegexp (path, keys, options) { - if (!isarray(keys)) { - options = /** @type {!Object} */ (keys || options) - keys = [] - } - - options = options || {} - - if (path instanceof RegExp) { - return regexpToRegexp(path, /** @type {!Array} */ (keys)) - } - - if (isarray(path)) { - return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) - } - - return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) -} - - /***/ }), /***/ "vRN8": @@ -394182,51 +398474,6 @@ var $isNaN = Number.isNaN || function (a) { return a !== a; }; module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; }; -/***/ }), - -/***/ "xhmd": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -function valueOf(obj) { - return obj.valueOf ? obj.valueOf() : Object.prototype.valueOf.call(obj); -} - -function valueEqual(a, b) { - // Test for strict equality first. - if (a === b) return true; - - // Otherwise, if either of them == null they are not equal. - if (a == null || b == null) return false; - - if (Array.isArray(a)) { - return ( - Array.isArray(b) && - a.length === b.length && - a.every(function(item, index) { - return valueEqual(item, b[index]); - }) - ); - } - - if (typeof a === 'object' || typeof b === 'object') { - var aValue = valueOf(a); - var bValue = valueOf(b); - - if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); - - return Object.keys(Object.assign({}, a, b)).every(function(key) { - return valueEqual(a[key], b[key]); - }); - } - - return false; -} - -/* harmony default export */ __webpack_exports__["default"] = (valueEqual); - - /***/ }), /***/ "xk4V":