Socket
Socket
Sign inDemoInstall

@tanstack/react-location

Package Overview
Dependencies
8
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.7.3 to 3.7.4

124

build/cjs/index.js

@@ -40,4 +40,4 @@ /**

const _excluded = ["children", "location"],
_excluded2 = ["location"],
const _excluded = ["children", "location", "__experimental__snapshot"],
_excluded2 = ["location", "__experimental__snapshot"],
_excluded3 = ["basepath", "routes"],

@@ -179,3 +179,4 @@ _excluded4 = ["to", "search", "hash", "children", "target", "style", "replace", "onClick", "onMouseEnter", "className", "getActiveProps", "getInactiveProps", "activeOptions", "preload", "disabled", "_ref"],

children,
location
location,
__experimental__snapshot
} = _ref2,

@@ -189,3 +190,3 @@ rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref2, _excluded);

location,
// snapshot,
__experimental__snapshot,
routes: rest.routes

@@ -245,4 +246,7 @@ });

constructor(_ref3) {
var _experimental__snaps5;
let {
location
location,
__experimental__snapshot
} = _ref3,

@@ -394,39 +398,47 @@ rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref3, _excluded2);

this.update(rest); // if (snapshot) {
// const matchLoader = new MatchLoader(this, location.current)
// matchLoader.matches.forEach((match, index) => {
// if (match.id !== snapshot.matches[index]?.id) {
// throw new Error(
// `Router hydration mismatch: ${match.id} !== ${snapshot.matches[index]?.id}`,
// )
// }
// match.ownData = snapshot.matches[index]?.ownData ?? {}
// })
// cascadeMatchData(matchLoader.matches)
// }
this.__experimental__createSnapshot = () => {
return {
location: this.state.location,
matches: this.state.matches.map(_ref5 => {
let {
ownData,
id
} = _ref5;
return {
id,
ownData
};
})
};
};
this.update(rest);
let matches = [];
if (__experimental__snapshot) {
const matchLoader = new MatchLoader(this, location.current);
matchLoader.matches.forEach((match, index) => {
var _experimental__snaps, _experimental__snaps3, _experimental__snaps4;
if (match.id !== ((_experimental__snaps = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps.id)) {
var _experimental__snaps2;
throw new Error("Router hydration mismatch: " + match.id + " !== " + ((_experimental__snaps2 = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps2.id));
}
match.ownData = (_experimental__snaps3 = (_experimental__snaps4 = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps4.ownData) != null ? _experimental__snaps3 : {};
});
cascadeMatchData(matchLoader.matches);
matches = matchLoader.matches;
}
this.state = {
// location: snapshot?.location ?? location.current,
// matches: matchLoader.matches,
location: location.current,
matches: []
location: (_experimental__snaps5 = __experimental__snapshot == null ? void 0 : __experimental__snapshot.location) != null ? _experimental__snaps5 : location.current,
matches: matches
};
location.subscribe(() => this.notify());
} // snapshot = (): RouterSnapshot<TGenerics> => {
// return {
// location: this.state.location,
// matches: this.state.matches.map(({ ownData, id }) => {
// return {
// id,
// ownData,
// }
// }),
// }
// }
}
}
function useLocation() {
// const getIsMounted = useGetIsMounted()
// const [, rerender] = React.useReducer((d) => d + 1, 0)
const context = React__namespace.useContext(LocationContext);

@@ -476,5 +488,5 @@ warning(!!context, 'useLocation must be used within a <ReactLocation />');

this.load = opts => {
var _ref5, _opts$maxAge;
var _ref6, _opts$maxAge;
this.maxAge = (_ref5 = (_opts$maxAge = opts.maxAge) != null ? _opts$maxAge : this.route.loaderMaxAge) != null ? _ref5 : opts.router.defaultLoaderMaxAge;
this.maxAge = (_ref6 = (_opts$maxAge = opts.maxAge) != null ? _opts$maxAge : this.route.loaderMaxAge) != null ? _ref6 : opts.router.defaultLoaderMaxAge;

@@ -808,3 +820,3 @@ if (this.loaderPromise) {

function navigate(_ref6) {
function navigate(_ref7) {
var _fromCurrent;

@@ -819,3 +831,3 @@

fromCurrent
} = _ref6;
} = _ref7;
fromCurrent = (_fromCurrent = fromCurrent) != null ? _fromCurrent : typeof to === 'undefined';

@@ -865,3 +877,3 @@ const next = buildNext({

const Link = function Link(_ref7) {
const Link = function Link(_ref8) {
var _preload;

@@ -888,4 +900,4 @@

_ref
} = _ref7,
rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref7, _excluded4);
} = _ref8,
rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref8, _excluded4);

@@ -960,16 +972,16 @@ const loadRoute = useLoadRoute();

const _ref8 = isActive ? getActiveProps() : {},
const _ref9 = isActive ? getActiveProps() : {},
{
style: activeStyle = {},
className: activeClassName = ''
} = _ref8,
activeRest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref8, _excluded5); // Get the inactive props
} = _ref9,
activeRest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref9, _excluded5); // Get the inactive props
const _ref9 = isActive ? {} : getInactiveProps(),
const _ref10 = isActive ? {} : getInactiveProps(),
{
style: inactiveStyle = {},
className: inactiveClassName = ''
} = _ref9,
inactiveRest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref9, _excluded6);
} = _ref10,
inactiveRest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref10, _excluded6);

@@ -1100,7 +1112,7 @@ return /*#__PURE__*/React__namespace.createElement("a", _rollupPluginBabelHelpers["extends"]({

const resolvePath = useResolvePath();
return useLatestCallback(_ref10 => {
return useLatestCallback(_ref11 => {
let {
pending
} = _ref10,
matchLocation = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref10, _excluded7);
} = _ref11,
matchLocation = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref11, _excluded7);

@@ -1124,7 +1136,7 @@ matchLocation = _rollupPluginBabelHelpers["extends"]({}, matchLocation, {

}
function MatchRoute(_ref11) {
function MatchRoute(_ref12) {
let {
children
} = _ref11,
rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref11, _excluded8);
} = _ref12,
rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref12, _excluded8);

@@ -1155,3 +1167,3 @@ const matchRoute = useMatchRoute();

}
function Prompt(_ref12) {
function Prompt(_ref13) {
let {

@@ -1161,3 +1173,3 @@ message,

children
} = _ref12;
} = _ref13;
usePrompt(message, when != null ? when : true);

@@ -1164,0 +1176,0 @@ return children != null ? children : null;

@@ -101,4 +101,4 @@ /**

const _excluded = ["children", "location"],
_excluded2 = ["location"],
const _excluded = ["children", "location", "__experimental__snapshot"],
_excluded2 = ["location", "__experimental__snapshot"],
_excluded3 = ["basepath", "routes"],

@@ -240,3 +240,4 @@ _excluded4 = ["to", "search", "hash", "children", "target", "style", "replace", "onClick", "onMouseEnter", "className", "getActiveProps", "getInactiveProps", "activeOptions", "preload", "disabled", "_ref"],

children,
location
location,
__experimental__snapshot
} = _ref2,

@@ -250,3 +251,3 @@ rest = _objectWithoutPropertiesLoose(_ref2, _excluded);

location,
// snapshot,
__experimental__snapshot,
routes: rest.routes

@@ -306,4 +307,7 @@ });

constructor(_ref3) {
var _experimental__snaps5;
let {
location
location,
__experimental__snapshot
} = _ref3,

@@ -455,39 +459,47 @@ rest = _objectWithoutPropertiesLoose(_ref3, _excluded2);

this.update(rest); // if (snapshot) {
// const matchLoader = new MatchLoader(this, location.current)
// matchLoader.matches.forEach((match, index) => {
// if (match.id !== snapshot.matches[index]?.id) {
// throw new Error(
// `Router hydration mismatch: ${match.id} !== ${snapshot.matches[index]?.id}`,
// )
// }
// match.ownData = snapshot.matches[index]?.ownData ?? {}
// })
// cascadeMatchData(matchLoader.matches)
// }
this.__experimental__createSnapshot = () => {
return {
location: this.state.location,
matches: this.state.matches.map(_ref5 => {
let {
ownData,
id
} = _ref5;
return {
id,
ownData
};
})
};
};
this.update(rest);
let matches = [];
if (__experimental__snapshot) {
const matchLoader = new MatchLoader(this, location.current);
matchLoader.matches.forEach((match, index) => {
var _experimental__snaps, _experimental__snaps3, _experimental__snaps4;
if (match.id !== ((_experimental__snaps = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps.id)) {
var _experimental__snaps2;
throw new Error("Router hydration mismatch: " + match.id + " !== " + ((_experimental__snaps2 = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps2.id));
}
match.ownData = (_experimental__snaps3 = (_experimental__snaps4 = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps4.ownData) != null ? _experimental__snaps3 : {};
});
cascadeMatchData(matchLoader.matches);
matches = matchLoader.matches;
}
this.state = {
// location: snapshot?.location ?? location.current,
// matches: matchLoader.matches,
location: location.current,
matches: []
location: (_experimental__snaps5 = __experimental__snapshot == null ? void 0 : __experimental__snapshot.location) != null ? _experimental__snaps5 : location.current,
matches: matches
};
location.subscribe(() => this.notify());
} // snapshot = (): RouterSnapshot<TGenerics> => {
// return {
// location: this.state.location,
// matches: this.state.matches.map(({ ownData, id }) => {
// return {
// id,
// ownData,
// }
// }),
// }
// }
}
}
function useLocation() {
// const getIsMounted = useGetIsMounted()
// const [, rerender] = React.useReducer((d) => d + 1, 0)
const context = React.useContext(LocationContext);

@@ -537,5 +549,5 @@ warning(!!context, 'useLocation must be used within a <ReactLocation />');

this.load = opts => {
var _ref5, _opts$maxAge;
var _ref6, _opts$maxAge;
this.maxAge = (_ref5 = (_opts$maxAge = opts.maxAge) != null ? _opts$maxAge : this.route.loaderMaxAge) != null ? _ref5 : opts.router.defaultLoaderMaxAge;
this.maxAge = (_ref6 = (_opts$maxAge = opts.maxAge) != null ? _opts$maxAge : this.route.loaderMaxAge) != null ? _ref6 : opts.router.defaultLoaderMaxAge;

@@ -869,3 +881,3 @@ if (this.loaderPromise) {

function navigate(_ref6) {
function navigate(_ref7) {
var _fromCurrent;

@@ -880,3 +892,3 @@

fromCurrent
} = _ref6;
} = _ref7;
fromCurrent = (_fromCurrent = fromCurrent) != null ? _fromCurrent : typeof to === 'undefined';

@@ -926,3 +938,3 @@ const next = buildNext({

const Link = function Link(_ref7) {
const Link = function Link(_ref8) {
var _preload;

@@ -949,4 +961,4 @@

_ref
} = _ref7,
rest = _objectWithoutPropertiesLoose(_ref7, _excluded4);
} = _ref8,
rest = _objectWithoutPropertiesLoose(_ref8, _excluded4);

@@ -1021,16 +1033,16 @@ const loadRoute = useLoadRoute();

const _ref8 = isActive ? getActiveProps() : {},
const _ref9 = isActive ? getActiveProps() : {},
{
style: activeStyle = {},
className: activeClassName = ''
} = _ref8,
activeRest = _objectWithoutPropertiesLoose(_ref8, _excluded5); // Get the inactive props
} = _ref9,
activeRest = _objectWithoutPropertiesLoose(_ref9, _excluded5); // Get the inactive props
const _ref9 = isActive ? {} : getInactiveProps(),
const _ref10 = isActive ? {} : getInactiveProps(),
{
style: inactiveStyle = {},
className: inactiveClassName = ''
} = _ref9,
inactiveRest = _objectWithoutPropertiesLoose(_ref9, _excluded6);
} = _ref10,
inactiveRest = _objectWithoutPropertiesLoose(_ref10, _excluded6);

@@ -1161,7 +1173,7 @@ return /*#__PURE__*/React.createElement("a", _extends({

const resolvePath = useResolvePath();
return useLatestCallback(_ref10 => {
return useLatestCallback(_ref11 => {
let {
pending
} = _ref10,
matchLocation = _objectWithoutPropertiesLoose(_ref10, _excluded7);
} = _ref11,
matchLocation = _objectWithoutPropertiesLoose(_ref11, _excluded7);

@@ -1185,7 +1197,7 @@ matchLocation = _extends({}, matchLocation, {

}
function MatchRoute(_ref11) {
function MatchRoute(_ref12) {
let {
children
} = _ref11,
rest = _objectWithoutPropertiesLoose(_ref11, _excluded8);
} = _ref12,
rest = _objectWithoutPropertiesLoose(_ref12, _excluded8);

@@ -1216,3 +1228,3 @@ const matchRoute = useMatchRoute();

}
function Prompt(_ref12) {
function Prompt(_ref13) {
let {

@@ -1222,3 +1234,3 @@ message,

children
} = _ref12;
} = _ref13;
usePrompt(message, when != null ? when : true);

@@ -1225,0 +1237,0 @@ return children != null ? children : null;

@@ -10,3 +10,3 @@ {

{
"uid": "2047-9",
"uid": "aa39-9",
"name": "\u0000rollupPluginBabelHelpers.js"

@@ -18,7 +18,7 @@ },

{
"uid": "2047-11",
"uid": "aa39-11",
"name": "qss.ts"
},
{
"uid": "2047-13",
"uid": "aa39-13",
"name": "index.tsx"

@@ -34,26 +34,26 @@ }

"nodeParts": {
"2047-9": {
"aa39-9": {
"renderedLength": 771,
"gzipLength": 353,
"brotliLength": 0,
"mainUid": "2047-8"
"mainUid": "aa39-8"
},
"2047-11": {
"aa39-11": {
"renderedLength": 1241,
"gzipLength": 523,
"brotliLength": 0,
"mainUid": "2047-10"
"mainUid": "aa39-10"
},
"2047-13": {
"renderedLength": 41460,
"gzipLength": 9509,
"aa39-13": {
"renderedLength": 42088,
"gzipLength": 9523,
"brotliLength": 0,
"mainUid": "2047-12"
"mainUid": "aa39-12"
}
},
"nodeMetas": {
"2047-8": {
"aa39-8": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.min.js": "2047-9"
"index.production.min.js": "aa39-9"
},

@@ -63,10 +63,10 @@ "imported": [],

{
"uid": "2047-12"
"uid": "aa39-12"
}
]
},
"2047-10": {
"aa39-10": {
"id": "/packages/react-location/src/qss.ts",
"moduleParts": {
"index.production.min.js": "2047-11"
"index.production.min.js": "aa39-11"
},

@@ -76,23 +76,23 @@ "imported": [],

{
"uid": "2047-12"
"uid": "aa39-12"
}
]
},
"2047-12": {
"aa39-12": {
"id": "/packages/react-location/src/index.tsx",
"moduleParts": {
"index.production.min.js": "2047-13"
"index.production.min.js": "aa39-13"
},
"imported": [
{
"uid": "2047-8"
"uid": "aa39-8"
},
{
"uid": "2047-14"
"uid": "aa39-14"
},
{
"uid": "2047-15"
"uid": "aa39-15"
},
{
"uid": "2047-10"
"uid": "aa39-10"
}

@@ -103,3 +103,3 @@ ],

},
"2047-14": {
"aa39-14": {
"id": "react",

@@ -110,3 +110,3 @@ "moduleParts": {},

{
"uid": "2047-12"
"uid": "aa39-12"
}

@@ -116,3 +116,3 @@ ],

},
"2047-15": {
"aa39-15": {
"id": "history",

@@ -123,3 +123,3 @@ "moduleParts": {},

{
"uid": "2047-12"
"uid": "aa39-12"
}

@@ -126,0 +126,0 @@ ],

@@ -109,4 +109,5 @@ import * as React from 'react';

caseSensitive?: boolean;
__experimental__snapshot?: __Experimental__RouterSnapshot<TGenerics>;
};
export declare type RouterSnapshot<TGenerics> = {
export declare type __Experimental__RouterSnapshot<TGenerics> = {
location: Location<TGenerics>;

@@ -202,3 +203,3 @@ matches: SnapshotRouteMatch<TGenerics>[];

export declare function MatchesProvider<TGenerics>(props: MatchesProviderProps<TGenerics>): JSX.Element;
export declare function Router<TGenerics extends PartialGenerics = DefaultGenerics>({ children, location, ...rest }: RouterProps<TGenerics>): JSX.Element;
export declare function Router<TGenerics extends PartialGenerics = DefaultGenerics>({ children, location, __experimental__snapshot, ...rest }: RouterProps<TGenerics>): JSX.Element;
declare type RouterInstanceState<TGenerics> = {

@@ -225,4 +226,5 @@ state: TransitionState<TGenerics>;

routesById: Record<string, Route<TGenerics>>;
constructor({ location, ...rest }: {
constructor({ location, __experimental__snapshot, ...rest }: {
location: ReactLocation<TGenerics>;
__experimental__snapshot?: __Experimental__RouterSnapshot<TGenerics>;
} & RouterOptions<TGenerics>);

@@ -237,2 +239,3 @@ update: ({ basepath, routes, ...opts }: RouterOptions<TGenerics>) => void;

};
__experimental__createSnapshot: () => __Experimental__RouterSnapshot<TGenerics>;
}

@@ -239,0 +242,0 @@ export declare type UseLocationType<TGenerics extends PartialGenerics = DefaultGenerics> = () => ReactLocation<TGenerics>;

@@ -123,4 +123,4 @@ /**

const _excluded = ["children", "location"],
_excluded2 = ["location"],
const _excluded = ["children", "location", "__experimental__snapshot"],
_excluded2 = ["location", "__experimental__snapshot"],
_excluded3 = ["basepath", "routes"],

@@ -262,3 +262,4 @@ _excluded4 = ["to", "search", "hash", "children", "target", "style", "replace", "onClick", "onMouseEnter", "className", "getActiveProps", "getInactiveProps", "activeOptions", "preload", "disabled", "_ref"],

children,
location
location,
__experimental__snapshot
} = _ref2,

@@ -272,3 +273,3 @@ rest = _objectWithoutPropertiesLoose(_ref2, _excluded);

location,
// snapshot,
__experimental__snapshot,
routes: rest.routes

@@ -328,4 +329,7 @@ });

constructor(_ref3) {
var _experimental__snaps5;
let {
location
location,
__experimental__snapshot
} = _ref3,

@@ -477,39 +481,47 @@ rest = _objectWithoutPropertiesLoose(_ref3, _excluded2);

this.update(rest); // if (snapshot) {
// const matchLoader = new MatchLoader(this, location.current)
// matchLoader.matches.forEach((match, index) => {
// if (match.id !== snapshot.matches[index]?.id) {
// throw new Error(
// `Router hydration mismatch: ${match.id} !== ${snapshot.matches[index]?.id}`,
// )
// }
// match.ownData = snapshot.matches[index]?.ownData ?? {}
// })
// cascadeMatchData(matchLoader.matches)
// }
this.__experimental__createSnapshot = () => {
return {
location: this.state.location,
matches: this.state.matches.map(_ref5 => {
let {
ownData,
id
} = _ref5;
return {
id,
ownData
};
})
};
};
this.update(rest);
let matches = [];
if (__experimental__snapshot) {
const matchLoader = new MatchLoader(this, location.current);
matchLoader.matches.forEach((match, index) => {
var _experimental__snaps, _experimental__snaps3, _experimental__snaps4;
if (match.id !== ((_experimental__snaps = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps.id)) {
var _experimental__snaps2;
throw new Error("Router hydration mismatch: " + match.id + " !== " + ((_experimental__snaps2 = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps2.id));
}
match.ownData = (_experimental__snaps3 = (_experimental__snaps4 = __experimental__snapshot.matches[index]) == null ? void 0 : _experimental__snaps4.ownData) != null ? _experimental__snaps3 : {};
});
cascadeMatchData(matchLoader.matches);
matches = matchLoader.matches;
}
this.state = {
// location: snapshot?.location ?? location.current,
// matches: matchLoader.matches,
location: location.current,
matches: []
location: (_experimental__snaps5 = __experimental__snapshot == null ? void 0 : __experimental__snapshot.location) != null ? _experimental__snaps5 : location.current,
matches: matches
};
location.subscribe(() => this.notify());
} // snapshot = (): RouterSnapshot<TGenerics> => {
// return {
// location: this.state.location,
// matches: this.state.matches.map(({ ownData, id }) => {
// return {
// id,
// ownData,
// }
// }),
// }
// }
}
}
function useLocation() {
// const getIsMounted = useGetIsMounted()
// const [, rerender] = React.useReducer((d) => d + 1, 0)
const context = React__namespace.useContext(LocationContext);

@@ -559,5 +571,5 @@ warning(!!context, 'useLocation must be used within a <ReactLocation />');

this.load = opts => {
var _ref5, _opts$maxAge;
var _ref6, _opts$maxAge;
this.maxAge = (_ref5 = (_opts$maxAge = opts.maxAge) != null ? _opts$maxAge : this.route.loaderMaxAge) != null ? _ref5 : opts.router.defaultLoaderMaxAge;
this.maxAge = (_ref6 = (_opts$maxAge = opts.maxAge) != null ? _opts$maxAge : this.route.loaderMaxAge) != null ? _ref6 : opts.router.defaultLoaderMaxAge;

@@ -891,3 +903,3 @@ if (this.loaderPromise) {

function navigate(_ref6) {
function navigate(_ref7) {
var _fromCurrent;

@@ -902,3 +914,3 @@

fromCurrent
} = _ref6;
} = _ref7;
fromCurrent = (_fromCurrent = fromCurrent) != null ? _fromCurrent : typeof to === 'undefined';

@@ -948,3 +960,3 @@ const next = buildNext({

const Link = function Link(_ref7) {
const Link = function Link(_ref8) {
var _preload;

@@ -971,4 +983,4 @@

_ref
} = _ref7,
rest = _objectWithoutPropertiesLoose(_ref7, _excluded4);
} = _ref8,
rest = _objectWithoutPropertiesLoose(_ref8, _excluded4);

@@ -1043,16 +1055,16 @@ const loadRoute = useLoadRoute();

const _ref8 = isActive ? getActiveProps() : {},
const _ref9 = isActive ? getActiveProps() : {},
{
style: activeStyle = {},
className: activeClassName = ''
} = _ref8,
activeRest = _objectWithoutPropertiesLoose(_ref8, _excluded5); // Get the inactive props
} = _ref9,
activeRest = _objectWithoutPropertiesLoose(_ref9, _excluded5); // Get the inactive props
const _ref9 = isActive ? {} : getInactiveProps(),
const _ref10 = isActive ? {} : getInactiveProps(),
{
style: inactiveStyle = {},
className: inactiveClassName = ''
} = _ref9,
inactiveRest = _objectWithoutPropertiesLoose(_ref9, _excluded6);
} = _ref10,
inactiveRest = _objectWithoutPropertiesLoose(_ref10, _excluded6);

@@ -1181,7 +1193,7 @@ return /*#__PURE__*/React__namespace.createElement("a", _extends({

const resolvePath = useResolvePath();
return useLatestCallback(_ref10 => {
return useLatestCallback(_ref11 => {
let {
pending
} = _ref10,
matchLocation = _objectWithoutPropertiesLoose(_ref10, _excluded7);
} = _ref11,
matchLocation = _objectWithoutPropertiesLoose(_ref11, _excluded7);

@@ -1205,7 +1217,7 @@ matchLocation = _extends({}, matchLocation, {

}
function MatchRoute(_ref11) {
function MatchRoute(_ref12) {
let {
children
} = _ref11,
rest = _objectWithoutPropertiesLoose(_ref11, _excluded8);
} = _ref12,
rest = _objectWithoutPropertiesLoose(_ref12, _excluded8);

@@ -1236,3 +1248,3 @@ const matchRoute = useMatchRoute();

}
function Prompt(_ref12) {
function Prompt(_ref13) {
let {

@@ -1242,3 +1254,3 @@ message,

children
} = _ref12;
} = _ref13;
usePrompt(message, when != null ? when : true);

@@ -1245,0 +1257,0 @@ return children != null ? children : null;

@@ -11,3 +11,3 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("history")):"function"==typeof define&&define.amd?define(["exports","react","history"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactLocation={},t.React,t.History)}(this,(function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var s=r(e);function a(){return a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a.apply(this,arguments)}function i(t,e){if(null==t)return{};var n,r,s={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(s[n]=t[n]);return s}function o(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0?+e:e))}const u=["children","location"],c=["location"],l=["basepath","routes"],h=["to","search","hash","children","target","style","replace","onClick","onMouseEnter","className","getActiveProps","getInactiveProps","activeOptions","preload","disabled","_ref"],d=["style","className"],f=["style","className"],p=["pending"],m=["children"],v=s.createContext(null),g=s.createContext(null),y=s.createContext(null),b=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement),M=b?s.useLayoutEffect:s.useEffect;class w{constructor(){this.listeners=[]}subscribe(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter((e=>e!==t))}}notify(){this.listeners.forEach((t=>t()))}}function P(t){return s.createElement(g.Provider,t)}function E(){const t=L(),e=_(),n=T();return M((()=>{e({to:".",search:!0,hash:!0}).href!==t.current.href&&n({to:".",search:!0,hash:!0,fromCurrent:!0,replace:!0})}),[]),null}class x extends w{constructor(t){let{location:e}=t,n=i(t,c);super(),this.routesById={},this.update=t=>{let{basepath:e,routes:n}=t,r=i(t,l);Object.assign(this,r),this.basepath=W("/"+(null!=e?e:"")),this.routesById={};const s=(t,e)=>t.map((t=>{var n,i,o,u;const c=null!=(n=t.path)?n:"*",l=K(["root"===(null==e?void 0:e.id)?"":null==e?void 0:e.id,(null==c?void 0:c.replace(/(.)\/$/,"$1"))+(t.id?"-"+t.id:"")]);if(t=a({},t,{pendingMs:null!=(i=t.pendingMs)?i:null==r?void 0:r.defaultPendingMs,pendingMinMs:null!=(o=t.pendingMinMs)?o:null==r?void 0:r.defaultPendingMinMs,id:l}),this.routesById[l])throw new Error;return this.routesById[l]=t,t.children=null!=(u=t.children)&&u.length?s(t.children,t):void 0,t}));this.routes=s(n),this.rootMatch={id:"root",params:{},search:{},pathname:this.basepath,route:null,ownData:{},data:{},isLoading:!1,status:"resolved"}},this.setState=t=>{const e=t({state:this.state,pending:this.pending});this.state=e.state,this.pending=e.pending,this.cleanMatchCache(),this.notify()},this.matchCache={},this.cleanMatchCache=()=>{var t,e,n;const r=[...null!=(t=null==this?void 0:this.state.matches)?t:[],...null!=(e=null==this||null==(n=this.pending)?void 0:n.matches)?e:[]].map((t=>t.id));Object.values(this.matchCache).forEach((t=>{var e;if(!t.updatedAt)return;if(r.includes(t.id))return;const n=Date.now()-(null!=(e=t.updatedAt)?e:0);(!t.maxAge||n>t.maxAge)&&(t.route.unloader&&t.route.unloader(t),delete this.matchCache[t.id])}))},this.updateLocation=t=>{let e;return{promise:new Promise((n=>{const r=new A(this,t);this.setState((t=>a({},t,{pending:{location:r.location,matches:r.matches}}))),e=r.subscribe((()=>{const t=this.state.matches;t.filter((t=>!r.matches.find((e=>e.id===t.id)))).forEach((t=>{null==t.onExit||t.onExit(t)})),t.filter((t=>r.matches.find((e=>e.id===t.id)))).forEach((t=>{null==t.route.onTransition||t.route.onTransition(t)})),r.matches.filter((e=>!t.find((t=>t.id===e.id)))).forEach((t=>{t.onExit=null==t.route.onMatch?void 0:t.route.onMatch(t)})),this.setState((t=>a({},t,{state:{location:r.location,matches:r.matches},pending:void 0}))),n()})),r.loadData(),r.startPending()})),unsubscribe:e}},this.update(n),this.state={location:e.current,matches:[]},e.subscribe((()=>this.notify()))}}function L(){const t=s.useContext(v);return z(!!t,"useLocation must be used within a <ReactLocation />"),t.location}class R{constructor(t){this.status="loading",this.ownData={},this.data={},this.isLoading=!1,this.notify=t=>{var e;null==(e=this.matchLoader)||e.preNotify(t?this:void 0)},this.assignMatchLoader=t=>{this.matchLoader=t},this.startPending=()=>{this.pendingTimeout&&clearTimeout(this.pendingTimeout),void 0!==this.route.pendingMs&&(this.pendingTimeout=setTimeout((()=>{var t;"loading"===this.status&&(this.status="pending"),null==(t=this.notify)||t.call(this),void 0!==this.route.pendingMinMs&&(this.pendingMinPromise=new Promise((t=>setTimeout(t,this.route.pendingMinMs))))}),this.route.pendingMs))},this.load=t=>{var e,n;if(this.maxAge=null!=(e=null!=(n=t.maxAge)?n:this.route.loaderMaxAge)?e:t.router.defaultLoaderMaxAge,this.loaderPromise)return;const r=this.route.import;this.loaderPromise=(r?(()=>(this.isLoading=!0,r({params:this.params,search:this.search}).then((t=>{this.route=a({},this.route,t)}))))():Promise.resolve()).then((()=>{const e=[];["element","errorElement","pendingElement"].forEach((t=>{const n=this.route[t];this[t]||("function"==typeof n?(this.isLoading=!0,e.push(n(this).then((e=>{this[t]=e})))):this[t]=this.route[t])}));const n=this.route.loader,r=n?new Promise((async e=>{this.isLoading=!0;const r=t=>{this.updatedAt=Date.now(),e(this.ownData),this.status=t},s=t=>{this.ownData=t,this.error=void 0,r("resolved")},a=t=>{console.error(t),this.error=t,r("rejected")};try{s(await n(this,{parentMatch:t.parentMatch,dispatch:async t=>{var e;"resolve"===t.type?s(t.data):"reject"===t.type?a(t.error):"loading"===t.type?this.isLoading=!0:"maxAge"===t.type&&(this.maxAge=t.maxAge),this.updatedAt=Date.now(),null==(e=this.notify)||e.call(this,!0)}}))}catch(t){a(t)}})):Promise.resolve();return Promise.all([...e,r]).then((()=>{this.status="resolved",this.isLoading=!1,this.startPending=void 0})).then((()=>this.pendingMinPromise)).then((()=>{var t;this.pendingTimeout&&clearTimeout(this.pendingTimeout),null==(t=this.notify)||t.call(this,!0)}))})).then((()=>this.ownData))},Object.assign(this,t)}}class A extends w{constructor(t,e){var n;super(),n=this,this.preNotifiedMatches=[],this.status="pending",this.preNotify=t=>{var e;t&&(this.preNotifiedMatches.includes(t)||this.preNotifiedMatches.push(t)),t&&this.preNotifiedMatches.length!==this.matches.length||(this.status="resolved",null==(e=this.matches)||e.forEach(((t,n)=>{var r;const s=null==e?void 0:e[n-1];t.data=a({},null!=(r=null==s?void 0:s.data)?r:{},t.ownData)})),this.notify())},this.loadData=async function(t){var e;let{maxAge:r}=void 0===t?{}:t;if(n.router.cleanMatchCache(),null!=(e=n.matches)&&e.length)return n.firstRenderPromises=[],n.matches.forEach(((t,e)=>{var s,a;const i=null==(s=n.matches)?void 0:s[e-1];null==t.assignMatchLoader||t.assignMatchLoader(n),null==t.load||t.load({maxAge:r,parentMatch:i,router:n.router}),null==(a=n.firstRenderPromises)||a.push(t.loaderPromise)})),await Promise.all(n.firstRenderPromises).then((()=>(n.preNotify(),n.matches)));n.preNotify()},this.load=async function(t){let{maxAge:e}=void 0===t?{}:t;return await n.loadData({maxAge:e})},this.startPending=async()=>{this.matches.forEach((t=>null==t.startPending?void 0:t.startPending()))},this.router=t,this.location=e,this.matches=[];const r=j(this.router,this.location);this.matches=null==r?void 0:r.map((t=>(this.router.matchCache[t.id]||(this.router.matchCache[t.id]=new R(t)),this.router.matchCache[t.id])))}}function O(){const t=s.useContext(y);if(!t)throw z(!0,"You are trying to use useRouter() outside of ReactLocation!"),new Error;return t.router}function j(t,e){if(!t.routes.length)return[];const n=[],r=async(s,i)=>{var o;let{pathname:u,params:c}=i;const l=(null!=t&&t.filterRoutes?null==t?void 0:t.filterRoutes(s):s).find((n=>{var r,s;const i=K([u,n.path]),o=!!("/"!==n.path||null!=(r=n.children)&&r.length),l=I(e,{to:i,search:n.search,fuzzy:o,caseSensitive:null!=(s=n.caseSensitive)?s:t.caseSensitive});return l&&(c=a({},c,l)),!!l}));if(!l)return;const h=C(l.path,c);u=K([u,h]);const d={id:C(l.id,c,!0),route:l,params:c,pathname:u,search:e.search};n.push(d),null!=(o=l.children)&&o.length&&r(l.children,d)};return r(t.routes,t.rootMatch),n}function C(t,e,n){return K(J(t).map((t=>{return"*"!==t.value||n?"param"===t.type?null!=(r=e[t.value.substring(1)])?r:"":t.value:"";var r})))}function S(){const t=L(),e=k(),n=O(),r=_();return Y((async function(s,i){var o;void 0===s&&(s=t.current);const u=r(a({},s,{from:null!=(o=s.from)?o:{pathname:e.pathname}})),c=new A(n,u);return await c.load(i)}))}function N(){return s.useContext(g)}function k(){var t;return null==(t=N())?void 0:t[0]}function T(){const t=L(),e=k(),n=_();return Y((function(r){var s;let{search:a,hash:i,replace:o,from:u,to:c,fromCurrent:l}=r;l=null!=(s=l)?s:void 0===c;const h=n({to:c,search:a,hash:i,from:l?t.current:null!=u?u:{pathname:e.pathname}});t.navigate(h,o)}))}function _(){const t=L(),e=O();return Y((n=>{const r=t.buildNext(e.basepath,n),s=j(e,r).map((t=>{var e;return null!=(e=t.route.searchFilters)?e:[]})).flat().filter(Boolean);return t.buildNext(e.basepath,a({},n,{__searchFilters:s}))}))}function B(){var t;const e=O(),[n,...r]=N(),a=r[0];if(!a)return null;const i=null!=(t=a.errorElement)?t:e.defaultErrorElement,o=(()=>{var t,n;if("rejected"===a.status){if(i)return i;if(!e.useErrorBoundary)return"An unknown error occured!";throw a.error}const r=null!=(t=a.pendingElement)?t:e.defaultPendingElement;if("loading"===a.status)return null;if("pending"===a.status&&(a.route.pendingMs||r))return null!=r?r:null;const o=null!=(n=a.element)?n:e.defaultElement;return null!=o?o:s.createElement(B,null)})();return s.createElement(P,{value:r},o)}function D(){const t=O(),e=k();return Y((n=>$(t.basepath,e.pathname,W(n))))}function I(t,e){const n=q(t,e),r=function(t,e){return!(!e.search||!e.search(t.search))}(t,e);if((!e.to||n)&&(!e.search||r))return null!=n?n:{}}function H(){const t=O(),e=D();return Y((n=>{let{pending:r}=n,s=i(n,p);if(s=a({},s,{to:s.to?e(""+s.to):void 0}),r){var o;if(null==(o=t.pending)||!o.location)return;return I(t.pending.location,s)}return I(t.state.location,s)}))}function U(t,e){const n=L();s.useEffect((()=>{if(!e)return;let r=n.history.block((e=>{window.confirm(t)?(r(),e.retry()):n.current.pathname=window.location.pathname}));return r}),[e,n,t])}function z(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}function F(t,e){return"function"==typeof t?t(e):t}function K(t){return W(t.filter(Boolean).join("/"))}function W(t){return(""+t).replace(/\/{2,}/g,"/")}function q(t,e){var n;const r=J(t.pathname),s=J(""+(null!=(n=e.to)?n:"*")),a={};return(()=>{for(let t=0;t<Math.max(r.length,s.length);t++){const n=r[t],i=s[t],o=t===s.length-1,u=t===r.length-1;if(i){if("wildcard"===i.type)return!(null==n||!n.value)&&(a["*"]=K(r.slice(t).map((t=>t.value))),!0);if("pathname"===i.type){if("/"===i.value&&(null==n||!n.value))return!0;if(n)if(e.caseSensitive){if(i.value!==n.value)return!1}else if(i.value.toLowerCase()!==n.value.toLowerCase())return!1}if(!n)return!1;"param"===i.type&&(a[i.value.substring(1)]=n.value)}if(o&&!u)return!!e.fuzzy}return!0})()?a:void 0}function J(t){if(!t)return[];const e=[];if("/"===(t=W(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const n=t.split("/").filter(Boolean);return e.push(...n.map((t=>t.startsWith("*")?{type:"wildcard",value:t}:":"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function $(t,e,n){e=e.replace(new RegExp("^"+t),"/"),n=n.replace(new RegExp("^"+t),"/");let r=J(e);const s=J(n);s.forEach(((t,e)=>{if("/"===t.value)e?e===s.length-1&&r.push(t):r=[t];else if(".."===t.value)r.pop();else{if("."===t.value)return;r.push(t)}}));return W(K([t,...r.map((t=>t.value))]))}function Y(t){const e=s.useRef(),n=s.useRef(t);return n.current=t,e.current||(e.current=function(){return n.current(...arguments)}),e.current}function G(t,e){if(t===e)return t;const n=Array.isArray(t)&&Array.isArray(e);if(n||Q(t)&&Q(e)){const r=n?t.length:Object.keys(t).length,s=n?e:Object.keys(e),a=s.length,i=n?[]:{};let o=0;for(let r=0;r<a;r++){const a=n?r:s[r];i[a]=G(t[a],e[a]),i[a]===t[a]&&o++}return r===a&&o===r?t:i}return e}function Q(t){if(!V(t))return!1;const e=t.constructor;if(void 0===e)return!0;const n=e.prototype;return!!V(n)&&!!n.hasOwnProperty("isPrototypeOf")}function V(t){return"[object Object]"===Object.prototype.toString.call(t)}const X=tt(JSON.parse),Z=et(JSON.stringify);function tt(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let n=function(t){for(var e,n,r={},s=t.split("&");e=s.shift();)void 0!==r[n=(e=e.split("=")).shift()]?r[n]=[].concat(r[n],o(e.shift())):r[n]=o(e.shift());return r}(e);for(let e in n){const r=n[e];if("string"==typeof r)try{n[e]=t(r)}catch(t){}}return n}}function et(t){return e=>{(e=a({},e))&&Object.keys(e).forEach((n=>{const r=e[n];if(void 0===r||void 0===r)delete e[n];else if(r&&"object"==typeof r&&null!==r)try{e[n]=t(r)}catch(t){}}));const n=function(t,e){var n,r,s,a="";for(n in t)if(void 0!==(s=t[n]))if(Array.isArray(s))for(r=0;r<s.length;r++)a&&(a+="&"),a+=encodeURIComponent(n)+"="+encodeURIComponent(s[r]);else a&&(a+="&"),a+=encodeURIComponent(n)+"="+encodeURIComponent(s);return(e||"")+a}(e).toString();return n?"?"+n:""}}Object.defineProperty(t,"createBrowserHistory",{enumerable:!0,get:function(){return n.createBrowserHistory}}),Object.defineProperty(t,"createHashHistory",{enumerable:!0,get:function(){return n.createHashHistory}}),Object.defineProperty(t,"createMemoryHistory",{enumerable:!0,get:function(){return n.createMemoryHistory}}),t.Link=function(t){var e;let{to:n=".",search:r,hash:o,children:u,target:c,style:l={},replace:p,onClick:m,onMouseEnter:v,className:g="",getActiveProps:y=(()=>({className:"active"})),getInactiveProps:b=(()=>({})),activeOptions:M,preload:w,disabled:P,_ref:E}=t,x=i(t,h);const R=S(),A=k(),j=L(),C=O(),N=T(),B=_();w=null!=(e=w)?e:C.defaultLinkPreloadMaxAge;try{z(!1,"<Link /> should not be used for external URLs like: "+new URL(""+n).href)}catch(t){}const D=B({to:n,search:r,hash:o,from:{pathname:A.pathname}}),I=j.current.pathname===D.pathname,H=j.current.pathname.split("/"),U=D.pathname.split("/").every(((t,e)=>t===H[e])),F=j.current.hash===D.hash,K=null!=M&&M.exact?I:U,W=null==M||!M.includeHash||F,q=K&&W,J=q?y():{},{style:$={},className:Y=""}=J,G=i(J,d),Q=q?{}:b(),{style:V={},className:X=""}=Q,Z=i(Q,f);return s.createElement("a",a({ref:E,href:P?void 0:D.href,onClick:t=>{P||(m&&m(t),function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||c&&"_self"!==c||0!==t.button||(t.preventDefault(),N({to:n,search:r,hash:o,replace:p,from:{pathname:A.pathname}})))},onMouseEnter:t=>{v&&v(t),w&&w>0&&R({to:n,search:r,hash:o},{maxAge:w})},target:c,style:a({},l,$,V),className:[g,Y,X].filter(Boolean).join(" ")||void 0},P?{role:"link","aria-disabled":!0}:void 0,x,G,Z,{children:"function"==typeof u?u({isActive:q}):u}))},t.MatchRoute=function(t){let{children:e}=t,n=i(t,m);const r=H()(n);return"function"==typeof e?e(r):r?e:null},t.MatchesProvider=P,t.Navigate=function(t){let e=T();return M((()=>{e(t)}),[e]),null},t.Outlet=B,t.Prompt=function(t){let{message:e,when:n,children:r}=t;return U(e,null==n||n),null!=r?r:null},t.ReactLocation=class extends w{constructor(t){var e,r;super(),this.isTransitioning=!1,this.history=(null==t?void 0:t.history)||(b?n.createBrowserHistory():n.createMemoryHistory()),this.stringifySearch=null!=(e=null==t?void 0:t.stringifySearch)?e:Z,this.parseSearch=null!=(r=null==t?void 0:t.parseSearch)?r:X,this.current=this.parseLocation(this.history.location),this.destroy=this.history.listen((t=>{this.current=this.parseLocation(t.location,this.current),this.notify()}))}buildNext(t,e){var n,r,s,i;void 0===t&&(t="/"),void 0===e&&(e={});const o=a({},this.current,e.from),u=$(t,o.pathname,""+(null!=(n=e.to)?n:".")),c=null!=(r=e.__searchFilters)&&r.length?e.__searchFilters.reduce(((t,e)=>e(t)),o.search):o.search,l=!0===e.search?c:e.search?null!=(s=F(e.search,c))?s:{}:null!=(i=e.__searchFilters)&&i.length?c:{},h=G(o.search,l),d=this.stringifySearch(h);let f=!0===e.hash?o.hash:F(e.hash,o.hash);return f=f?"#"+f:"",{pathname:u,search:h,searchStr:d,hash:f,href:""+u+d+f,key:e.key}}navigate(t,e){this.current=t,this.navigateTimeout&&clearTimeout(this.navigateTimeout);let n="replace";e||(n="push");return this.parseLocation(this.history.location).href===this.current.href&&!this.current.key&&(n="replace"),"replace"===n?this.history.replace({pathname:this.current.pathname,hash:this.current.hash,search:this.current.searchStr}):this.history.push({pathname:this.current.pathname,hash:this.current.hash,search:this.current.searchStr})}parseLocation(t,e){var n;const r=this.parseSearch(t.search);return{pathname:t.pathname,searchStr:t.search,search:G(null==e?void 0:e.search,r),hash:null!=(n=t.hash.split("#").reverse()[0])?n:"",href:""+t.pathname+t.search+t.hash,key:t.key}}},t.RouteMatch=R,t.Router=function(t){let{children:e,location:n}=t,r=i(t,u);const a=s.useRef(null);a.current||(a.current=new x({location:n,routes:r.routes}));const o=a.current,[c,l]=s.useReducer((()=>({})),{});return o.update(r),M((()=>o.subscribe((()=>{l()}))),[]),M((()=>o.updateLocation(n.current).unsubscribe),[n.current.key]),s.createElement(v.Provider,{value:{location:n}},s.createElement(y.Provider,{value:{router:o}},s.createElement(E,null),s.createElement(P,{value:[o.rootMatch,...o.state.matches]},null!=e?e:s.createElement(B,null))))},t.RouterInstance=x,t.cleanPath=W,t.defaultParseSearch=X,t.defaultStringifySearch=Z,t.functionalUpdate=F,t.matchByPath=q,t.matchRoute=I,t.matchRoutes=j,t.parsePathname=J,t.parseSearchWith=tt,t.resolvePath=$,t.stringifySearchWith=et,t.useLoadRoute=S,t.useLocation=L,t.useMatch=k,t.useMatchRoute=H,t.useMatches=N,t.useNavigate=T,t.useParentMatches=function(){const t=O(),e=k(),n=t.state.matches;return n.slice(0,n.findIndex((t=>t.id===e.id))-1)},t.usePrompt=U,t.useResolvePath=D,t.useRouter=O,t.useSearch=function(){return L().current.search},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("history")):"function"==typeof define&&define.amd?define(["exports","react","history"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ReactLocation={},t.React,t.History)}(this,(function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var a=r(e);function s(){return s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s.apply(this,arguments)}function i(t,e){if(null==t)return{};var n,r,a={},s=Object.keys(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||(a[n]=t[n]);return a}function o(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||(0*+e==0?+e:e))}const c=["children","location","__experimental__snapshot"],u=["location","__experimental__snapshot"],l=["basepath","routes"],h=["to","search","hash","children","target","style","replace","onClick","onMouseEnter","className","getActiveProps","getInactiveProps","activeOptions","preload","disabled","_ref"],d=["style","className"],f=["style","className"],p=["pending"],m=["children"],v=a.createContext(null),g=a.createContext(null),y=a.createContext(null),b=Boolean("undefined"!=typeof window&&window.document&&window.document.createElement),w=b?a.useLayoutEffect:a.useEffect;class M{constructor(){this.listeners=[]}subscribe(t){return this.listeners.push(t),()=>{this.listeners=this.listeners.filter((e=>e!==t))}}notify(){this.listeners.forEach((t=>t()))}}function P(t){return a.createElement(g.Provider,t)}function E(){const t=_(),e=T(),n=D();return w((()=>{e({to:".",search:!0,hash:!0}).href!==t.current.href&&n({to:".",search:!0,hash:!0,fromCurrent:!0,replace:!0})}),[]),null}class x extends M{constructor(t){var e;let{location:n,__experimental__snapshot:r}=t,a=i(t,u);super(),this.routesById={},this.update=t=>{let{basepath:e,routes:n}=t,r=i(t,l);Object.assign(this,r),this.basepath=q("/"+(null!=e?e:"")),this.routesById={};const a=(t,e)=>t.map((t=>{var n,i,o,c;const u=null!=(n=t.path)?n:"*",l=W(["root"===(null==e?void 0:e.id)?"":null==e?void 0:e.id,(null==u?void 0:u.replace(/(.)\/$/,"$1"))+(t.id?"-"+t.id:"")]);if(t=s({},t,{pendingMs:null!=(i=t.pendingMs)?i:null==r?void 0:r.defaultPendingMs,pendingMinMs:null!=(o=t.pendingMinMs)?o:null==r?void 0:r.defaultPendingMinMs,id:l}),this.routesById[l])throw new Error;return this.routesById[l]=t,t.children=null!=(c=t.children)&&c.length?a(t.children,t):void 0,t}));this.routes=a(n),this.rootMatch={id:"root",params:{},search:{},pathname:this.basepath,route:null,ownData:{},data:{},isLoading:!1,status:"resolved"}},this.setState=t=>{const e=t({state:this.state,pending:this.pending});this.state=e.state,this.pending=e.pending,this.cleanMatchCache(),this.notify()},this.matchCache={},this.cleanMatchCache=()=>{var t,e,n;const r=[...null!=(t=null==this?void 0:this.state.matches)?t:[],...null!=(e=null==this||null==(n=this.pending)?void 0:n.matches)?e:[]].map((t=>t.id));Object.values(this.matchCache).forEach((t=>{var e;if(!t.updatedAt)return;if(r.includes(t.id))return;const n=Date.now()-(null!=(e=t.updatedAt)?e:0);(!t.maxAge||n>t.maxAge)&&(t.route.unloader&&t.route.unloader(t),delete this.matchCache[t.id])}))},this.updateLocation=t=>{let e;return{promise:new Promise((n=>{const r=new L(this,t);this.setState((t=>s({},t,{pending:{location:r.location,matches:r.matches}}))),e=r.subscribe((()=>{const t=this.state.matches;t.filter((t=>!r.matches.find((e=>e.id===t.id)))).forEach((t=>{null==t.onExit||t.onExit(t)})),t.filter((t=>r.matches.find((e=>e.id===t.id)))).forEach((t=>{null==t.route.onTransition||t.route.onTransition(t)})),r.matches.filter((e=>!t.find((t=>t.id===e.id)))).forEach((t=>{t.onExit=null==t.route.onMatch?void 0:t.route.onMatch(t)})),this.setState((t=>s({},t,{state:{location:r.location,matches:r.matches},pending:void 0}))),n()})),r.loadData(),r.startPending()})),unsubscribe:e}},this.__experimental__createSnapshot=()=>({location:this.state.location,matches:this.state.matches.map((t=>{let{ownData:e,id:n}=t;return{id:n,ownData:e}}))}),this.update(a);let o=[];if(r){const t=new L(this,n.current);t.matches.forEach(((t,e)=>{var n,a,s,i;if(t.id!==(null==(n=r.matches[e])?void 0:n.id))throw new Error("Router hydration mismatch: "+t.id+" !== "+(null==(i=r.matches[e])?void 0:i.id));t.ownData=null!=(a=null==(s=r.matches[e])?void 0:s.ownData)?a:{}})),A(t.matches),o=t.matches}this.state={location:null!=(e=null==r?void 0:r.location)?e:n.current,matches:o},n.subscribe((()=>this.notify()))}}function _(){const t=a.useContext(v);return F(!!t,"useLocation must be used within a <ReactLocation />"),t.location}class R{constructor(t){this.status="loading",this.ownData={},this.data={},this.isLoading=!1,this.notify=t=>{var e;null==(e=this.matchLoader)||e.preNotify(t?this:void 0)},this.assignMatchLoader=t=>{this.matchLoader=t},this.startPending=()=>{this.pendingTimeout&&clearTimeout(this.pendingTimeout),void 0!==this.route.pendingMs&&(this.pendingTimeout=setTimeout((()=>{var t;"loading"===this.status&&(this.status="pending"),null==(t=this.notify)||t.call(this),void 0!==this.route.pendingMinMs&&(this.pendingMinPromise=new Promise((t=>setTimeout(t,this.route.pendingMinMs))))}),this.route.pendingMs))},this.load=t=>{var e,n;if(this.maxAge=null!=(e=null!=(n=t.maxAge)?n:this.route.loaderMaxAge)?e:t.router.defaultLoaderMaxAge,this.loaderPromise)return;const r=this.route.import;this.loaderPromise=(r?(()=>(this.isLoading=!0,r({params:this.params,search:this.search}).then((t=>{this.route=s({},this.route,t)}))))():Promise.resolve()).then((()=>{const e=[];["element","errorElement","pendingElement"].forEach((t=>{const n=this.route[t];this[t]||("function"==typeof n?(this.isLoading=!0,e.push(n(this).then((e=>{this[t]=e})))):this[t]=this.route[t])}));const n=this.route.loader,r=n?new Promise((async e=>{this.isLoading=!0;const r=t=>{this.updatedAt=Date.now(),e(this.ownData),this.status=t},a=t=>{this.ownData=t,this.error=void 0,r("resolved")},s=t=>{console.error(t),this.error=t,r("rejected")};try{a(await n(this,{parentMatch:t.parentMatch,dispatch:async t=>{var e;"resolve"===t.type?a(t.data):"reject"===t.type?s(t.error):"loading"===t.type?this.isLoading=!0:"maxAge"===t.type&&(this.maxAge=t.maxAge),this.updatedAt=Date.now(),null==(e=this.notify)||e.call(this,!0)}}))}catch(t){s(t)}})):Promise.resolve();return Promise.all([...e,r]).then((()=>{this.status="resolved",this.isLoading=!1,this.startPending=void 0})).then((()=>this.pendingMinPromise)).then((()=>{var t;this.pendingTimeout&&clearTimeout(this.pendingTimeout),null==(t=this.notify)||t.call(this,!0)}))})).then((()=>this.ownData))},Object.assign(this,t)}}class L extends M{constructor(t,e){var n;super(),n=this,this.preNotifiedMatches=[],this.status="pending",this.preNotify=t=>{t&&(this.preNotifiedMatches.includes(t)||this.preNotifiedMatches.push(t)),t&&this.preNotifiedMatches.length!==this.matches.length||(this.status="resolved",A(this.matches),this.notify())},this.loadData=async function(t){var e;let{maxAge:r}=void 0===t?{}:t;if(n.router.cleanMatchCache(),null!=(e=n.matches)&&e.length)return n.firstRenderPromises=[],n.matches.forEach(((t,e)=>{var a,s;const i=null==(a=n.matches)?void 0:a[e-1];null==t.assignMatchLoader||t.assignMatchLoader(n),null==t.load||t.load({maxAge:r,parentMatch:i,router:n.router}),null==(s=n.firstRenderPromises)||s.push(t.loaderPromise)})),await Promise.all(n.firstRenderPromises).then((()=>(n.preNotify(),n.matches)));n.preNotify()},this.load=async function(t){let{maxAge:e}=void 0===t?{}:t;return await n.loadData({maxAge:e})},this.startPending=async()=>{this.matches.forEach((t=>null==t.startPending?void 0:t.startPending()))},this.router=t,this.location=e,this.matches=[];const r=j(this.router,this.location);this.matches=null==r?void 0:r.map((t=>(this.router.matchCache[t.id]||(this.router.matchCache[t.id]=new R(t)),this.router.matchCache[t.id])))}}function A(t){null==t||t.forEach(((e,n)=>{var r;const a=null==t?void 0:t[n-1];e.data=s({},null!=(r=null==a?void 0:a.data)?r:{},e.ownData)}))}function O(){const t=a.useContext(y);if(!t)throw F(!0,"You are trying to use useRouter() outside of ReactLocation!"),new Error;return t.router}function j(t,e){if(!t.routes.length)return[];const n=[],r=async(a,i)=>{var o;let{pathname:c,params:u}=i;const l=(null!=t&&t.filterRoutes?null==t?void 0:t.filterRoutes(a):a).find((n=>{var r,a;const i=W([c,n.path]),o=!!("/"!==n.path||null!=(r=n.children)&&r.length),l=H(e,{to:i,search:n.search,fuzzy:o,caseSensitive:null!=(a=n.caseSensitive)?a:t.caseSensitive});return l&&(u=s({},u,l)),!!l}));if(!l)return;const h=S(l.path,u);c=W([c,h]);const d={id:S(l.id,u,!0),route:l,params:u,pathname:c,search:e.search};n.push(d),null!=(o=l.children)&&o.length&&r(l.children,d)};return r(t.routes,t.rootMatch),n}function S(t,e,n){return W($(t).map((t=>{return"*"!==t.value||n?"param"===t.type?null!=(r=e[t.value.substring(1)])?r:"":t.value:"";var r})))}function C(){const t=_(),e=k(),n=O(),r=T();return G((async function(a,i){var o;void 0===a&&(a=t.current);const c=r(s({},a,{from:null!=(o=a.from)?o:{pathname:e.pathname}})),u=new L(n,c);return await u.load(i)}))}function N(){return a.useContext(g)}function k(){var t;return null==(t=N())?void 0:t[0]}function D(){const t=_(),e=k(),n=T();return G((function(r){var a;let{search:s,hash:i,replace:o,from:c,to:u,fromCurrent:l}=r;l=null!=(a=l)?a:void 0===u;const h=n({to:u,search:s,hash:i,from:l?t.current:null!=c?c:{pathname:e.pathname}});t.navigate(h,o)}))}function T(){const t=_(),e=O();return G((n=>{const r=t.buildNext(e.basepath,n),a=j(e,r).map((t=>{var e;return null!=(e=t.route.searchFilters)?e:[]})).flat().filter(Boolean);return t.buildNext(e.basepath,s({},n,{__searchFilters:a}))}))}function B(){var t;const e=O(),[n,...r]=N(),s=r[0];if(!s)return null;const i=null!=(t=s.errorElement)?t:e.defaultErrorElement,o=(()=>{var t,n;if("rejected"===s.status){if(i)return i;if(!e.useErrorBoundary)return"An unknown error occured!";throw s.error}const r=null!=(t=s.pendingElement)?t:e.defaultPendingElement;if("loading"===s.status)return null;if("pending"===s.status&&(s.route.pendingMs||r))return null!=r?r:null;const o=null!=(n=s.element)?n:e.defaultElement;return null!=o?o:a.createElement(B,null)})();return a.createElement(P,{value:r},o)}function I(){const t=O(),e=k();return G((n=>Y(t.basepath,e.pathname,q(n))))}function H(t,e){const n=J(t,e),r=function(t,e){return!(!e.search||!e.search(t.search))}(t,e);if((!e.to||n)&&(!e.search||r))return null!=n?n:{}}function U(){const t=O(),e=I();return G((n=>{let{pending:r}=n,a=i(n,p);if(a=s({},a,{to:a.to?e(""+a.to):void 0}),r){var o;if(null==(o=t.pending)||!o.location)return;return H(t.pending.location,a)}return H(t.state.location,a)}))}function z(t,e){const n=_();a.useEffect((()=>{if(!e)return;let r=n.history.block((e=>{window.confirm(t)?(r(),e.retry()):n.current.pathname=window.location.pathname}));return r}),[e,n,t])}function F(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}function K(t,e){return"function"==typeof t?t(e):t}function W(t){return q(t.filter(Boolean).join("/"))}function q(t){return(""+t).replace(/\/{2,}/g,"/")}function J(t,e){var n;const r=$(t.pathname),a=$(""+(null!=(n=e.to)?n:"*")),s={};return(()=>{for(let t=0;t<Math.max(r.length,a.length);t++){const n=r[t],i=a[t],o=t===a.length-1,c=t===r.length-1;if(i){if("wildcard"===i.type)return!(null==n||!n.value)&&(s["*"]=W(r.slice(t).map((t=>t.value))),!0);if("pathname"===i.type){if("/"===i.value&&(null==n||!n.value))return!0;if(n)if(e.caseSensitive){if(i.value!==n.value)return!1}else if(i.value.toLowerCase()!==n.value.toLowerCase())return!1}if(!n)return!1;"param"===i.type&&(s[i.value.substring(1)]=n.value)}if(o&&!c)return!!e.fuzzy}return!0})()?s:void 0}function $(t){if(!t)return[];const e=[];if("/"===(t=q(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const n=t.split("/").filter(Boolean);return e.push(...n.map((t=>t.startsWith("*")?{type:"wildcard",value:t}:":"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function Y(t,e,n){e=e.replace(new RegExp("^"+t),"/"),n=n.replace(new RegExp("^"+t),"/");let r=$(e);const a=$(n);a.forEach(((t,e)=>{if("/"===t.value)e?e===a.length-1&&r.push(t):r=[t];else if(".."===t.value)r.pop();else{if("."===t.value)return;r.push(t)}}));return q(W([t,...r.map((t=>t.value))]))}function G(t){const e=a.useRef(),n=a.useRef(t);return n.current=t,e.current||(e.current=function(){return n.current(...arguments)}),e.current}function Q(t,e){if(t===e)return t;const n=Array.isArray(t)&&Array.isArray(e);if(n||V(t)&&V(e)){const r=n?t.length:Object.keys(t).length,a=n?e:Object.keys(e),s=a.length,i=n?[]:{};let o=0;for(let r=0;r<s;r++){const s=n?r:a[r];i[s]=Q(t[s],e[s]),i[s]===t[s]&&o++}return r===s&&o===r?t:i}return e}function V(t){if(!X(t))return!1;const e=t.constructor;if(void 0===e)return!0;const n=e.prototype;return!!X(n)&&!!n.hasOwnProperty("isPrototypeOf")}function X(t){return"[object Object]"===Object.prototype.toString.call(t)}const Z=et(JSON.parse),tt=nt(JSON.stringify);function et(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let n=function(t){for(var e,n,r={},a=t.split("&");e=a.shift();)void 0!==r[n=(e=e.split("=")).shift()]?r[n]=[].concat(r[n],o(e.shift())):r[n]=o(e.shift());return r}(e);for(let e in n){const r=n[e];if("string"==typeof r)try{n[e]=t(r)}catch(t){}}return n}}function nt(t){return e=>{(e=s({},e))&&Object.keys(e).forEach((n=>{const r=e[n];if(void 0===r||void 0===r)delete e[n];else if(r&&"object"==typeof r&&null!==r)try{e[n]=t(r)}catch(t){}}));const n=function(t,e){var n,r,a,s="";for(n in t)if(void 0!==(a=t[n]))if(Array.isArray(a))for(r=0;r<a.length;r++)s&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(a[r]);else s&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(a);return(e||"")+s}(e).toString();return n?"?"+n:""}}Object.defineProperty(t,"createBrowserHistory",{enumerable:!0,get:function(){return n.createBrowserHistory}}),Object.defineProperty(t,"createHashHistory",{enumerable:!0,get:function(){return n.createHashHistory}}),Object.defineProperty(t,"createMemoryHistory",{enumerable:!0,get:function(){return n.createMemoryHistory}}),t.Link=function(t){var e;let{to:n=".",search:r,hash:o,children:c,target:u,style:l={},replace:p,onClick:m,onMouseEnter:v,className:g="",getActiveProps:y=(()=>({className:"active"})),getInactiveProps:b=(()=>({})),activeOptions:w,preload:M,disabled:P,_ref:E}=t,x=i(t,h);const R=C(),L=k(),A=_(),j=O(),S=D(),N=T();M=null!=(e=M)?e:j.defaultLinkPreloadMaxAge;try{F(!1,"<Link /> should not be used for external URLs like: "+new URL(""+n).href)}catch(t){}const B=N({to:n,search:r,hash:o,from:{pathname:L.pathname}}),I=A.current.pathname===B.pathname,H=A.current.pathname.split("/"),U=B.pathname.split("/").every(((t,e)=>t===H[e])),z=A.current.hash===B.hash,K=null!=w&&w.exact?I:U,W=null==w||!w.includeHash||z,q=K&&W,J=q?y():{},{style:$={},className:Y=""}=J,G=i(J,d),Q=q?{}:b(),{style:V={},className:X=""}=Q,Z=i(Q,f);return a.createElement("a",s({ref:E,href:P?void 0:B.href,onClick:t=>{P||(m&&m(t),function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||u&&"_self"!==u||0!==t.button||(t.preventDefault(),S({to:n,search:r,hash:o,replace:p,from:{pathname:L.pathname}})))},onMouseEnter:t=>{v&&v(t),M&&M>0&&R({to:n,search:r,hash:o},{maxAge:M})},target:u,style:s({},l,$,V),className:[g,Y,X].filter(Boolean).join(" ")||void 0},P?{role:"link","aria-disabled":!0}:void 0,x,G,Z,{children:"function"==typeof c?c({isActive:q}):c}))},t.MatchRoute=function(t){let{children:e}=t,n=i(t,m);const r=U()(n);return"function"==typeof e?e(r):r?e:null},t.MatchesProvider=P,t.Navigate=function(t){let e=D();return w((()=>{e(t)}),[e]),null},t.Outlet=B,t.Prompt=function(t){let{message:e,when:n,children:r}=t;return z(e,null==n||n),null!=r?r:null},t.ReactLocation=class extends M{constructor(t){var e,r;super(),this.isTransitioning=!1,this.history=(null==t?void 0:t.history)||(b?n.createBrowserHistory():n.createMemoryHistory()),this.stringifySearch=null!=(e=null==t?void 0:t.stringifySearch)?e:tt,this.parseSearch=null!=(r=null==t?void 0:t.parseSearch)?r:Z,this.current=this.parseLocation(this.history.location),this.destroy=this.history.listen((t=>{this.current=this.parseLocation(t.location,this.current),this.notify()}))}buildNext(t,e){var n,r,a,i;void 0===t&&(t="/"),void 0===e&&(e={});const o=s({},this.current,e.from),c=Y(t,o.pathname,""+(null!=(n=e.to)?n:".")),u=null!=(r=e.__searchFilters)&&r.length?e.__searchFilters.reduce(((t,e)=>e(t)),o.search):o.search,l=!0===e.search?u:e.search?null!=(a=K(e.search,u))?a:{}:null!=(i=e.__searchFilters)&&i.length?u:{},h=Q(o.search,l),d=this.stringifySearch(h);let f=!0===e.hash?o.hash:K(e.hash,o.hash);return f=f?"#"+f:"",{pathname:c,search:h,searchStr:d,hash:f,href:""+c+d+f,key:e.key}}navigate(t,e){this.current=t,this.navigateTimeout&&clearTimeout(this.navigateTimeout);let n="replace";e||(n="push");return this.parseLocation(this.history.location).href===this.current.href&&!this.current.key&&(n="replace"),"replace"===n?this.history.replace({pathname:this.current.pathname,hash:this.current.hash,search:this.current.searchStr}):this.history.push({pathname:this.current.pathname,hash:this.current.hash,search:this.current.searchStr})}parseLocation(t,e){var n;const r=this.parseSearch(t.search);return{pathname:t.pathname,searchStr:t.search,search:Q(null==e?void 0:e.search,r),hash:null!=(n=t.hash.split("#").reverse()[0])?n:"",href:""+t.pathname+t.search+t.hash,key:t.key}}},t.RouteMatch=R,t.Router=function(t){let{children:e,location:n,__experimental__snapshot:r}=t,s=i(t,c);const o=a.useRef(null);o.current||(o.current=new x({location:n,__experimental__snapshot:r,routes:s.routes}));const u=o.current,[l,h]=a.useReducer((()=>({})),{});return u.update(s),w((()=>u.subscribe((()=>{h()}))),[]),w((()=>u.updateLocation(n.current).unsubscribe),[n.current.key]),a.createElement(v.Provider,{value:{location:n}},a.createElement(y.Provider,{value:{router:u}},a.createElement(E,null),a.createElement(P,{value:[u.rootMatch,...u.state.matches]},null!=e?e:a.createElement(B,null))))},t.RouterInstance=x,t.cleanPath=q,t.defaultParseSearch=Z,t.defaultStringifySearch=tt,t.functionalUpdate=K,t.matchByPath=J,t.matchRoute=H,t.matchRoutes=j,t.parsePathname=$,t.parseSearchWith=et,t.resolvePath=Y,t.stringifySearchWith=nt,t.useLoadRoute=C,t.useLocation=_,t.useMatch=k,t.useMatchRoute=U,t.useMatches=N,t.useNavigate=D,t.useParentMatches=function(){const t=O(),e=k(),n=t.state.matches;return n.slice(0,n.findIndex((t=>t.id===e.id))-1)},t.usePrompt=z,t.useResolvePath=I,t.useRouter=O,t.useSearch=function(){return _().current.search},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.min.js.map
{
"name": "@tanstack/react-location",
"author": "Tanner Linsley",
"version": "3.7.3",
"version": "3.7.4",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "tanstack/react-location",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc