Socket
Socket
Sign inDemoInstall

history

Package Overview
Dependencies
2
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-beta.9 to 5.0.0

2

browser.js

@@ -5,4 +5,4 @@ function m(){m=Object.assign||function(a){for(var c=1;c<arguments.length;c++){var g=arguments[c],h;for(h in g)Object.prototype.hasOwnProperty.call(g,h)&&(a[h]=g[h])}return a};return m.apply(this,arguments)}var r,v=r||(r={});v.Pop="POP";v.Push="PUSH";v.Replace="REPLACE";var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function z(a,c){if(!a){"undefined"!==typeof console&&console.warn(c);try{throw Error(c);}catch(g){}}}

b.substr(e),b=b.substr(0,e));b&&(d.pathname=b)}b=d}return y(c({},f,{},b,{state:a,key:Math.random().toString(36).substr(2,8)}))}function w(b){x=b;b=c();l=b[0];t=b[1];B.call({action:x,location:t})}function C(b,a){function c(){C(b,a)}var f=r.Push,d=h(b,a);if(!k.length||(k.call({action:f,location:d,retry:c}),!1)){var e=[{usr:d.state,key:d.key,idx:l+1},g(d)];d=e[0];e=e[1];try{p.pushState(d,"",e)}catch(G){n.location.assign(e)}w(f)}}function D(a,c){function b(){D(a,c)}var f=r.Replace,d=h(a,c);k.length&&
(k.call({action:f,location:d,retry:b}),1)||(d=[{usr:d.state,key:d.key,idx:l},g(d)],p.replaceState(d[0],"",d[1]),w(f))}function q(a){p.go(a)}a=(void 0===a?{}:a).window;var n=void 0===a?document.defaultView:a,p=n.history,u=null;n.addEventListener("popstate",function(){if(u)k.call(u),u=null;else{var a=r.Pop,f=c(),g=f[0];f=f[1];if(k.length)if(null!=g){var h=l-g;h&&(u={action:a,location:f,retry:function(){q(-1*h)}},q(h))}else"production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):
(k.call({action:f,location:d,retry:b}),1)||(d=[{usr:d.state,key:d.key,idx:l},g(d)],p.replaceState(d[0],"",d[1]),w(f))}function q(a){p.go(a)}void 0===a&&(a={});a=a.window;var n=void 0===a?document.defaultView:a,p=n.history,u=null;n.addEventListener("popstate",function(){if(u)k.call(u),u=null;else{var a=r.Pop,f=c(),g=f[0];f=f[1];if(k.length)if(null!=g){var h=l-g;h&&(u={action:a,location:f,retry:function(){q(-1*h)}},q(h))}else"production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):
void 0;else w(a)}});var x=r.Pop;a=c();var l=a[0],t=a[1],B=E(),k=E();null==l&&(l=0,p.replaceState(m({},p.state,{idx:l}),""));return{get action(){return x},get location(){return t},createHref:g,push:C,replace:D,go:q,back:function(){q(-1)},forward:function(){q(1)},listen:function(a){return B.push(a)},block:function(a){var b=k.push(a);1===k.length&&n.addEventListener("beforeunload",A);return function(){b();k.length||n.removeEventListener("beforeunload",A)}}}}();export default F;
//# sourceMappingURL=browser.js.map

@@ -7,4 +7,4 @@ function m(){m=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b],g;for(g in c)Object.prototype.hasOwnProperty.call(c,g)&&(a[g]=c[g])}return a};return m.apply(this,arguments)}var r,u=r||(r={});u.Pop="POP";u.Push="PUSH";u.Replace="REPLACE";var v="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function w(a,b){if(!a){"undefined"!==typeof console&&console.warn(b);try{throw Error(b);}catch(c){}}}

w("/"===d.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")"):void 0;if(!f.length||(f.call({action:e,location:d,retry:c}),!1)){var k=[{usr:d.state,key:d.key,idx:l+1},g(d)];d=k[0];k=k[1];try{n.pushState(d,"",k)}catch(J){h.location.assign(k)}y(e)}}function H(a,b){function c(){H(a,b)}var k=r.Replace,d=E(a,b);"production"!==process.env.NODE_ENV?w("/"===d.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+
")"):void 0;f.length&&(f.call({action:k,location:d,retry:c}),1)||(d=[{usr:d.state,key:d.key,idx:l},g(d)],n.replaceState(d[0],"",d[1]),y(k))}function p(a){n.go(a)}a=(void 0===a?{}:a).window;var h=void 0===a?document.defaultView:a,n=h.history,t=null;h.addEventListener("popstate",c);h.addEventListener("hashchange",function(){var a=b()[1];C(a)!==C(q)&&c()});var z=r.Pop;a=b();var l=a[0],q=a[1],F=B(),f=B();null==l&&(l=0,n.replaceState(m({},n.state,{idx:l}),""));return{get action(){return z},get location(){return q},
")"):void 0;f.length&&(f.call({action:k,location:d,retry:c}),1)||(d=[{usr:d.state,key:d.key,idx:l},g(d)],n.replaceState(d[0],"",d[1]),y(k))}function p(a){n.go(a)}void 0===a&&(a={});a=a.window;var h=void 0===a?document.defaultView:a,n=h.history,t=null;h.addEventListener("popstate",c);h.addEventListener("hashchange",function(){var a=b()[1];C(a)!==C(q)&&c()});var z=r.Pop;a=b();var l=a[0],q=a[1],F=B(),f=B();null==l&&(l=0,n.replaceState(m({},n.state,{idx:l}),""));return{get action(){return z},get location(){return q},
createHref:g,push:G,replace:H,go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(a){return F.push(a)},block:function(a){var b=f.push(a);1===f.length&&h.addEventListener("beforeunload",A);return function(){b();f.length||h.removeEventListener("beforeunload",A)}}}}();export default I;
//# sourceMappingURL=hash.js.map

@@ -1,16 +0,16 @@

var l,w=l||(l={});w.Pop="POP";w.Push="PUSH";w.Replace="REPLACE";function x(c,d){if(!c){"undefined"!==typeof console&&console.warn(d);try{throw Error(d);}catch(h){}}}function y(c){c.preventDefault();c.returnValue=""}function z(){let c=[];return{get length(){return c.length},push(d){c.push(d);return function(){c=c.filter(c=>c!==d)}},call(d){c.forEach(c=>c&&c(d))}}}function B(){return Math.random().toString(36).substr(2,8)}
function C({pathname:c="/",search:d="",hash:h=""}){return c+d+h}function D(c){let d={};if(c){var h=c.indexOf("#");0<=h&&(d.hash=c.substr(h),c=c.substr(0,h));h=c.indexOf("?");0<=h&&(d.search=c.substr(h),c=c.substr(0,h));c&&(d.pathname=c)}return d}
function createBrowserHistory({window:c=document.defaultView}={}){function d(){let {pathname:a,search:e,hash:b}=c.location,A=f.state||{};return[A.idx,Object.freeze({pathname:a,search:e,hash:b,state:A.usr||null,key:A.key||"default"})]}function h(a){return"string"===typeof a?a:C(a)}function r(a,e=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},m),"string"===typeof a?D(a):a),{state:e,key:B()}))}function t(a){p=a;[k,m]=d();q.call({action:p,location:m})}function u(a,e){function E(){u(a,
e)}let A=l.Push,d=r(a,e);if(!b.length||(b.call({action:A,location:d,retry:E}),!1)){let [e,a]=[{usr:d.state,key:d.key,idx:k+1},h(d)];try{f.pushState(e,"",a)}catch(F){c.location.assign(a)}t(A)}}function v(a,e){function c(){v(a,e)}let d=l.Replace,g=r(a,e);if(!b.length||(b.call({action:d,location:g,retry:c}),!1)){let [e,a]=[{usr:g.state,key:g.key,idx:k},h(g)];f.replaceState(e,"",a);t(d)}}function n(a){f.go(a)}let f=c.history,g=null;c.addEventListener("popstate",function(){if(g)b.call(g),g=null;else{let a=
l.Pop,[e,c]=d();if(b.length)if(null!=e){let b=k-e;b&&(g={action:a,location:c,retry(){n(-1*b)}},n(b))}else x(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else t(a)}});let p=l.Pop,[k,m]=d(),q=z(),b=z();null==k&&(k=0,f.replaceState(Object.assign(Object.assign({},
f.state),{idx:k}),""));return{get action(){return p},get location(){return m},createHref:h,push:u,replace:v,go:n,back(){n(-1)},forward(){n(1)},listen(a){return q.push(a)},block(a){let e=b.push(a);1===b.length&&c.addEventListener("beforeunload",y);return function(){e();b.length||c.removeEventListener("beforeunload",y)}}}};
function createHashHistory({window:c=document.defaultView}={}){function d(){let {pathname:e="/",search:a="",hash:b=""}=D(c.location.hash.substr(1)),d=g.state||{};return[d.idx,Object.freeze({pathname:e,search:a,hash:b,state:d.usr||null,key:d.key||"default"})]}function h(){if(p)a.call(p),p=null;else{let e=l.Pop,[b,c]=d();if(a.length)if(null!=b){let a=m-b;a&&(p={action:e,location:c,retry(){f(-1*a)}},f(a))}else x(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");
else u(e)}}function r(a){var e=document.querySelector("base");var b="";e&&e.getAttribute("href")&&(e=c.location.href,b=e.indexOf("#"),b=-1===b?e:e.slice(0,b));e=b;return e+"#"+("string"===typeof a?a:C(a))}function t(a,b=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},q),"string"===typeof a?D(a):a),{state:b,key:B()}))}function u(a){k=a;[m,q]=d();b.call({action:k,location:q})}function v(b,d){function e(){v(b,d)}let h=l.Push,f=t(b,d);x("/"===f.pathname.charAt(0),`Relative pathnames are not supported in hash history.push(${JSON.stringify(b)})`);
if(!a.length||(a.call({action:h,location:f,retry:e}),!1)){let [a,b]=[{usr:f.state,key:f.key,idx:m+1},r(f)];try{g.pushState(a,"",b)}catch(G){c.location.assign(b)}u(h)}}function n(b,c){function e(){n(b,c)}let d=l.Replace,f=t(b,c);x("/"===f.pathname.charAt(0),`Relative pathnames are not supported in hash history.replace(${JSON.stringify(b)})`);if(!a.length||(a.call({action:d,location:f,retry:e}),!1)){let [a,b]=[{usr:f.state,key:f.key,idx:m},r(f)];g.replaceState(a,"",b);u(d)}}function f(a){g.go(a)}let g=
c.history,p=null;c.addEventListener("popstate",h);c.addEventListener("hashchange",()=>{let [,a]=d();C(a)!==C(q)&&h()});let k=l.Pop,[m,q]=d(),b=z(),a=z();null==m&&(m=0,g.replaceState(Object.assign(Object.assign({},g.state),{idx:m}),""));return{get action(){return k},get location(){return q},createHref:r,push:v,replace:n,go:f,back(){f(-1)},forward(){f(1)},listen(a){return b.push(a)},block(b){let e=a.push(b);1===a.length&&c.addEventListener("beforeunload",y);return function(){e();a.length||c.removeEventListener("beforeunload",
y)}}}};
function createMemoryHistory({initialEntries:c=["/"],initialIndex:d=0}={}){function h(b,a=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},k),"string"===typeof b?D(b):b),{state:a,key:B()}))}function r(b,a,c){return!q.length||(q.call({action:b,location:a,retry:c}),!1)}function t(b,a){p=b;k=a;m.call({action:p,location:k})}function u(b,a){let c=l.Push,d=h(b,a);x("/"===k.pathname.charAt(0),`Relative pathnames are not supported in memory history.push(${JSON.stringify(b)})`);r(c,
d,function(){u(b,a)})&&(g+=1,f.splice(g,f.length,d),t(c,d))}function v(b,a){let c=l.Replace,d=h(b,a);x("/"===k.pathname.charAt(0),`Relative pathnames are not supported in memory history.replace(${JSON.stringify(b)})`);r(c,d,function(){v(b,a)})&&(f[g]=d,t(c,d))}function n(b){let a=Math.min(Math.max(g+b,0),f.length-1),c=l.Pop,d=f[a];r(c,d,function(){n(b)})&&(g=a,t(c,d))}let f=c.map(b=>{let a=Object.freeze(Object.assign({pathname:"/",search:"",hash:"",state:null,key:B()},"string"===typeof b?D(b):b));
x("/"===a.pathname.charAt(0),`Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: ${JSON.stringify(b)})`);return a}),g=Math.min(Math.max(d,0),f.length-1),p=l.Pop,k=f[g],m=z(),q=z();return{get index(){return g},get action(){return p},get location(){return k},createHref:function(b){return"string"===typeof b?b:C(b)},push:u,replace:v,go:n,back(){n(-1)},forward(){n(1)},listen(b){return m.push(b)},block(b){return q.push(b)}}};
export{l as Action,createBrowserHistory,createHashHistory,createMemoryHistory,C as createPath,D as parsePath}
var m,x=m||(m={});x.Pop="POP";x.Push="PUSH";x.Replace="REPLACE";function y(c,d){if(!c){"undefined"!==typeof console&&console.warn(d);try{throw Error(d);}catch(f){}}}function z(c){c.preventDefault();c.returnValue=""}function A(){let c=[];return{get length(){return c.length},push(d){c.push(d);return function(){c=c.filter(c=>c!==d)}},call(d){c.forEach(c=>c&&c(d))}}}function B(){return Math.random().toString(36).substr(2,8)}
function C({pathname:c="/",search:d="",hash:f=""}){return c+d+f}function D(c){let d={};if(c){var f=c.indexOf("#");0<=f&&(d.hash=c.substr(f),c=c.substr(0,f));f=c.indexOf("?");0<=f&&(d.search=c.substr(f),c=c.substr(0,f));c&&(d.pathname=c)}return d}
function createBrowserHistory(c={}){function d(){let {pathname:a,search:e,hash:b}=k.location,c=g.state||{};return[c.idx,Object.freeze({pathname:a,search:e,hash:b,state:c.usr||null,key:c.key||"default"})]}function f(a){return"string"===typeof a?a:C(a)}function r(a,e=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},n),"string"===typeof a?D(a):a),{state:e,key:B()}))}function v(a){p=a;[l,n]=d();q.call({action:p,location:n})}function w(a,e){function E(){w(a,e)}let c=m.Push,
d=r(a,e);if(!b.length||(b.call({action:c,location:d,retry:E}),!1)){let [e,a]=[{usr:d.state,key:d.key,idx:l+1},f(d)];try{g.pushState(e,"",a)}catch(F){k.location.assign(a)}v(c)}}function t(a,e){function c(){t(a,e)}let d=m.Replace,h=r(a,e);if(!b.length||(b.call({action:d,location:h,retry:c}),!1)){let [e,a]=[{usr:h.state,key:h.key,idx:l},f(h)];g.replaceState(e,"",a);v(d)}}function u(a){g.go(a)}let {window:k=document.defaultView}=c,g=k.history,h=null;k.addEventListener("popstate",function(){if(h)b.call(h),
h=null;else{let a=m.Pop,[e,c]=d();if(b.length)if(null!=e){let b=l-e;b&&(h={action:a,location:c,retry(){u(-1*b)}},u(b))}else y(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else v(a)}});let p=m.Pop,[l,n]=d(),q=A(),b=A();null==l&&(l=0,g.replaceState(Object.assign(Object.assign({},
g.state),{idx:l}),""));return{get action(){return p},get location(){return n},createHref:f,push:w,replace:t,go:u,back(){u(-1)},forward(){u(1)},listen(a){return q.push(a)},block(a){let e=b.push(a);1===b.length&&k.addEventListener("beforeunload",z);return function(){e();b.length||k.removeEventListener("beforeunload",z)}}}};
function createHashHistory(c={}){function d(){let {pathname:e="/",search:a="",hash:b=""}=D(g.location.hash.substr(1)),c=h.state||{};return[c.idx,Object.freeze({pathname:e,search:a,hash:b,state:c.usr||null,key:c.key||"default"})]}function f(){if(p)a.call(p),p=null;else{let e=m.Pop,[b,c]=d();if(a.length)if(null!=b){let a=n-b;a&&(p={action:e,location:c,retry(){k(-1*a)}},k(a))}else y(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");
else w(e)}}function r(a){var e=document.querySelector("base");var b="";e&&e.getAttribute("href")&&(e=g.location.href,b=e.indexOf("#"),b=-1===b?e:e.slice(0,b));e=b;return e+"#"+("string"===typeof a?a:C(a))}function v(a,b=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},q),"string"===typeof a?D(a):a),{state:b,key:B()}))}function w(a){l=a;[n,q]=d();b.call({action:l,location:q})}function t(b,c){function e(){t(b,c)}let d=m.Push,f=v(b,c);y("/"===f.pathname.charAt(0),`Relative pathnames are not supported in hash history.push(${JSON.stringify(b)})`);
if(!a.length||(a.call({action:d,location:f,retry:e}),!1)){let [a,b]=[{usr:f.state,key:f.key,idx:n+1},r(f)];try{h.pushState(a,"",b)}catch(G){g.location.assign(b)}w(d)}}function u(b,c){function e(){u(b,c)}let d=m.Replace,f=v(b,c);y("/"===f.pathname.charAt(0),`Relative pathnames are not supported in hash history.replace(${JSON.stringify(b)})`);if(!a.length||(a.call({action:d,location:f,retry:e}),!1)){let [a,b]=[{usr:f.state,key:f.key,idx:n},r(f)];h.replaceState(a,"",b);w(d)}}function k(a){h.go(a)}let {window:g=
document.defaultView}=c,h=g.history,p=null;g.addEventListener("popstate",f);g.addEventListener("hashchange",()=>{let [,a]=d();C(a)!==C(q)&&f()});let l=m.Pop,[n,q]=d(),b=A(),a=A();null==n&&(n=0,h.replaceState(Object.assign(Object.assign({},h.state),{idx:n}),""));return{get action(){return l},get location(){return q},createHref:r,push:t,replace:u,go:k,back(){k(-1)},forward(){k(1)},listen(a){return b.push(a)},block(b){let c=a.push(b);1===a.length&&g.addEventListener("beforeunload",z);return function(){c();
a.length||g.removeEventListener("beforeunload",z)}}}};
function createMemoryHistory(c={}){function d(b,a=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},l),"string"===typeof b?D(b):b),{state:a,key:B()}))}function f(b,a,c){return!q.length||(q.call({action:b,location:a,retry:c}),!1)}function r(b,a){p=b;l=a;n.call({action:p,location:l})}function v(b,a){let c=m.Push,k=d(b,a);y("/"===l.pathname.charAt(0),`Relative pathnames are not supported in memory history.push(${JSON.stringify(b)})`);f(c,k,function(){v(b,a)})&&(h+=1,g.splice(h,
g.length,k),r(c,k))}function w(b,a){let c=m.Replace,k=d(b,a);y("/"===l.pathname.charAt(0),`Relative pathnames are not supported in memory history.replace(${JSON.stringify(b)})`);f(c,k,function(){w(b,a)})&&(g[h]=k,r(c,k))}function t(b){let a=Math.min(Math.max(h+b,0),g.length-1),c=m.Pop,d=g[a];f(c,d,function(){t(b)})&&(h=a,r(c,d))}let {initialEntries:u=["/"],initialIndex:k}=c,g=u.map(b=>{let a=Object.freeze(Object.assign({pathname:"/",search:"",hash:"",state:null,key:B()},"string"===typeof b?D(b):b));
y("/"===a.pathname.charAt(0),`Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: ${JSON.stringify(b)})`);return a}),h=Math.min(Math.max(null==k?g.length-1:k,0),g.length-1),p=m.Pop,l=g[h],n=A(),q=A();return{get index(){return h},get action(){return p},get location(){return l},createHref:function(b){return"string"===typeof b?b:C(b)},push:v,replace:w,go:t,back(){t(-1)},forward(){t(1)},listen(b){return n.push(b)},block(b){return q.push(b)}}};
export{m as Action,createBrowserHistory,createHashHistory,createMemoryHistory,C as createPath,D as parsePath}
//# sourceMappingURL=history.development.js.map

@@ -1,2 +0,2 @@

var t,e=t||(t={});function n(t){t.preventDefault(),t.returnValue=""}function a(){let t=[];return{get length(){return t.length},push:e=>(t.push(e),function(){t=t.filter(t=>t!==e)}),call(e){t.forEach(t=>t&&t(e))}}}function i(){return Math.random().toString(36).substr(2,8)}function l({pathname:t="/",search:e="",hash:n=""}){return t+e+n}function r(t){let e={};if(t){var n=t.indexOf("#");0<=n&&(e.hash=t.substr(n),t=t.substr(0,n)),0<=(n=t.indexOf("?"))&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function o({window:e=document.defaultView}={}){function o(){let{pathname:t,search:n,hash:a}=e.location,i=h.state||{};return[i.idx,{pathname:t,search:n,hash:a,state:i.usr||null,key:i.key||"default"}]}function c(t){return"string"==typeof t?t:l(t)}function s(t,e=null){return Object.assign(Object.assign(Object.assign({},y),"string"==typeof t?r(t):t),{state:e,key:i()})}function u(t){p=t,[d,y]=o(),b.call({action:p,location:y})}function f(t){h.go(t)}let h=e.history,g=null;e.addEventListener("popstate",(function(){if(g)k.call(g),g=null;else{let e=t.Pop,[n,a]=o();if(k.length){if(null!=n){let t=d-n;t&&(g={action:e,location:a,retry(){f(-1*t)}},f(t))}}else u(e)}}));let p=t.Pop,[d,y]=o(),b=a(),k=a();return null==d&&(d=0,h.replaceState(Object.assign(Object.assign({},h.state),{idx:d}),"")),{get action(){return p},get location(){return y},createHref:c,push:function n(a,i){let l=t.Push,r=s(a,i);if(!k.length||(k.call({action:l,location:r,retry:function(){n(a,i)}}),0)){let[t,n]=[{usr:r.state,key:r.key,idx:d+1},c(r)];try{h.pushState(t,"",n)}catch(o){e.location.assign(n)}u(l)}},replace:function e(n,a){let i=t.Replace,l=s(n,a);if(!k.length||(k.call({action:i,location:l,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:l.state,key:l.key,idx:d},c(l)];h.replaceState(t,"",e),u(i)}},go:f,back(){f(-1)},forward(){f(1)},listen:t=>b.push(t),block(t){let a=k.push(t);return 1===k.length&&e.addEventListener("beforeunload",n),function(){a(),k.length||e.removeEventListener("beforeunload",n)}}}}function c({window:e=document.defaultView}={}){function o(){let{pathname:t="/",search:n="",hash:a=""}=r(e.location.hash.substr(1)),i=g.state||{};return[i.idx,{pathname:t,search:n,hash:a,state:i.usr||null,key:i.key||"default"}]}function c(){if(p)m.call(p),p=null;else{let e=t.Pop,[n,a]=o();if(m.length){if(null!=n){let t=y-n;t&&(p={action:e,location:a,retry(){h(-1*t)}},h(t))}}else f(e)}}function s(t){var n=document.querySelector("base"),a="";return n&&n.getAttribute("href")&&(a=-1===(a=(n=e.location.href).indexOf("#"))?n:n.slice(0,a)),(n=a)+"#"+("string"==typeof t?t:l(t))}function u(t,e=null){return Object.assign(Object.assign(Object.assign({},b),"string"==typeof t?r(t):t),{state:e,key:i()})}function f(t){d=t,[y,b]=o(),k.call({action:d,location:b})}function h(t){g.go(t)}let g=e.history,p=null;e.addEventListener("popstate",c),e.addEventListener("hashchange",()=>{let[,t]=o();l(t)!==l(b)&&c()});let d=t.Pop,[y,b]=o(),k=a(),m=a();return null==y&&(y=0,g.replaceState(Object.assign(Object.assign({},g.state),{idx:y}),"")),{get action(){return d},get location(){return b},createHref:s,push:function n(a,i){let l=t.Push,r=u(a,i);if(!m.length||(m.call({action:l,location:r,retry:function(){n(a,i)}}),0)){let[t,n]=[{usr:r.state,key:r.key,idx:y+1},s(r)];try{g.pushState(t,"",n)}catch(o){e.location.assign(n)}f(l)}},replace:function e(n,a){let i=t.Replace,l=u(n,a);if(!m.length||(m.call({action:i,location:l,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:l.state,key:l.key,idx:y},s(l)];g.replaceState(t,"",e),f(i)}},go:h,back(){h(-1)},forward(){h(1)},listen:t=>k.push(t),block(t){let a=m.push(t);return 1===m.length&&e.addEventListener("beforeunload",n),function(){a(),m.length||e.removeEventListener("beforeunload",n)}}}}function s({initialEntries:e=["/"],initialIndex:n=0}={}){function o(t,e=null){return Object.assign(Object.assign(Object.assign({},p),"string"==typeof t?r(t):t),{state:e,key:i()})}function c(t,e,n){return!y.length||(y.call({action:t,location:e,retry:n}),!1)}function s(t,e){g=t,p=e,d.call({action:g,location:p})}function u(e){let n=Math.min(Math.max(h+e,0),f.length-1),a=t.Pop,i=f[n];c(a,i,(function(){u(e)}))&&(h=n,s(a,i))}let f=e.map(t=>Object.assign({pathname:"/",search:"",hash:"",state:null,key:i()},"string"==typeof t?r(t):t)),h=Math.min(Math.max(n,0),f.length-1),g=t.Pop,p=f[h],d=a(),y=a();return{get index(){return h},get action(){return g},get location(){return p},createHref:function(t){return"string"==typeof t?t:l(t)},push:function e(n,a){let i=t.Push,l=o(n,a);c(i,l,(function(){e(n,a)}))&&(h+=1,f.splice(h,f.length,l),s(i,l))},replace:function e(n,a){let i=t.Replace,l=o(n,a);c(i,l,(function(){e(n,a)}))&&(f[h]=l,s(i,l))},go:u,back(){u(-1)},forward(){u(1)},listen:t=>d.push(t),block:t=>y.push(t)}}e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE";export{t as Action,o as createBrowserHistory,c as createHashHistory,s as createMemoryHistory,l as createPath,r as parsePath};
var t,e=t||(t={});function n(t){t.preventDefault(),t.returnValue=""}function a(){let t=[];return{get length(){return t.length},push:e=>(t.push(e),function(){t=t.filter(t=>t!==e)}),call(e){t.forEach(t=>t&&t(e))}}}function l(){return Math.random().toString(36).substr(2,8)}function i({pathname:t="/",search:e="",hash:n=""}){return t+e+n}function r(t){let e={};if(t){var n=t.indexOf("#");0<=n&&(e.hash=t.substr(n),t=t.substr(0,n)),0<=(n=t.indexOf("?"))&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function o(e={}){function o(){let{pathname:t,search:e,hash:n}=h.location,a=g.state||{};return[a.idx,{pathname:t,search:e,hash:n,state:a.usr||null,key:a.key||"default"}]}function c(t){return"string"==typeof t?t:i(t)}function s(t,e=null){return Object.assign(Object.assign(Object.assign({},b),"string"==typeof t?r(t):t),{state:e,key:l()})}function u(t){d=t,[y,b]=o(),k.call({action:d,location:b})}function f(t){g.go(t)}let{window:h=document.defaultView}=e,g=h.history,p=null;h.addEventListener("popstate",(function(){if(p)m.call(p),p=null;else{let e=t.Pop,[n,a]=o();if(m.length){if(null!=n){let t=y-n;t&&(p={action:e,location:a,retry(){f(-1*t)}},f(t))}}else u(e)}}));let d=t.Pop,[y,b]=o(),k=a(),m=a();return null==y&&(y=0,g.replaceState(Object.assign(Object.assign({},g.state),{idx:y}),"")),{get action(){return d},get location(){return b},createHref:c,push:function e(n,a){let l=t.Push,i=s(n,a);if(!m.length||(m.call({action:l,location:i,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:i.state,key:i.key,idx:y+1},c(i)];try{g.pushState(t,"",e)}catch(r){h.location.assign(e)}u(l)}},replace:function e(n,a){let l=t.Replace,i=s(n,a);if(!m.length||(m.call({action:l,location:i,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:i.state,key:i.key,idx:y},c(i)];g.replaceState(t,"",e),u(l)}},go:f,back(){f(-1)},forward(){f(1)},listen:t=>k.push(t),block(t){let e=m.push(t);return 1===m.length&&h.addEventListener("beforeunload",n),function(){e(),m.length||h.removeEventListener("beforeunload",n)}}}}function c(e={}){function o(){let{pathname:t="/",search:e="",hash:n=""}=r(g.location.hash.substr(1)),a=p.state||{};return[a.idx,{pathname:t,search:e,hash:n,state:a.usr||null,key:a.key||"default"}]}function c(){if(d)O.call(d),d=null;else{let e=t.Pop,[n,a]=o();if(O.length){if(null!=n){let t=b-n;t&&(d={action:e,location:a,retry(){h(-1*t)}},h(t))}}else f(e)}}function s(t){var e=document.querySelector("base"),n="";return e&&e.getAttribute("href")&&(n=-1===(n=(e=g.location.href).indexOf("#"))?e:e.slice(0,n)),(e=n)+"#"+("string"==typeof t?t:i(t))}function u(t,e=null){return Object.assign(Object.assign(Object.assign({},k),"string"==typeof t?r(t):t),{state:e,key:l()})}function f(t){y=t,[b,k]=o(),m.call({action:y,location:k})}function h(t){p.go(t)}let{window:g=document.defaultView}=e,p=g.history,d=null;g.addEventListener("popstate",c),g.addEventListener("hashchange",()=>{let[,t]=o();i(t)!==i(k)&&c()});let y=t.Pop,[b,k]=o(),m=a(),O=a();return null==b&&(b=0,p.replaceState(Object.assign(Object.assign({},p.state),{idx:b}),"")),{get action(){return y},get location(){return k},createHref:s,push:function e(n,a){let l=t.Push,i=u(n,a);if(!O.length||(O.call({action:l,location:i,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:i.state,key:i.key,idx:b+1},s(i)];try{p.pushState(t,"",e)}catch(r){g.location.assign(e)}f(l)}},replace:function e(n,a){let l=t.Replace,i=u(n,a);if(!O.length||(O.call({action:l,location:i,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:i.state,key:i.key,idx:b},s(i)];p.replaceState(t,"",e),f(l)}},go:h,back(){h(-1)},forward(){h(1)},listen:t=>m.push(t),block(t){let e=O.push(t);return 1===O.length&&g.addEventListener("beforeunload",n),function(){e(),O.length||g.removeEventListener("beforeunload",n)}}}}function s(e={}){function n(t,e=null){return Object.assign(Object.assign(Object.assign({},d),"string"==typeof t?r(t):t),{state:e,key:l()})}function o(t,e,n){return!b.length||(b.call({action:t,location:e,retry:n}),!1)}function c(t,e){p=t,d=e,y.call({action:p,location:d})}function s(e){let n=Math.min(Math.max(g+e,0),h.length-1),a=t.Pop,l=h[n];o(a,l,(function(){s(e)}))&&(g=n,c(a,l))}let{initialEntries:u=["/"],initialIndex:f}=e,h=u.map(t=>Object.assign({pathname:"/",search:"",hash:"",state:null,key:l()},"string"==typeof t?r(t):t)),g=Math.min(Math.max(null==f?h.length-1:f,0),h.length-1),p=t.Pop,d=h[g],y=a(),b=a();return{get index(){return g},get action(){return p},get location(){return d},createHref:function(t){return"string"==typeof t?t:i(t)},push:function e(a,l){let i=t.Push,r=n(a,l);o(i,r,(function(){e(a,l)}))&&(g+=1,h.splice(g,h.length,r),c(i,r))},replace:function e(a,l){let i=t.Replace,r=n(a,l);o(i,r,(function(){e(a,l)}))&&(h[g]=r,c(i,r))},go:s,back(){s(-1)},forward(){s(1)},listen:t=>y.push(t),block:t=>b.push(t)}}e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE";export{t as Action,o as createBrowserHistory,c as createHashHistory,s as createMemoryHistory,i as createPath,r as parsePath};
//# sourceMappingURL=history.production.min.js.map
/**
* Actions represent the type of change to a location value.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#action
*/

@@ -26,99 +28,124 @@ export declare enum Action {

/**
* A URL path including the pathname, search string, and hash. No URL protocol
* or domain information should be part of a path.
* A URL pathname, beginning with a /.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname
*/
export declare type Path = string;
export declare type Pathname = string;
/**
* A URL search string, beginning with a ?.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search
*/
export declare type Search = string;
/**
* A URL fragment identifier, beginning with a #.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash
*/
export declare type Hash = string;
/**
* An object that is used to associate some arbitrary data with a location, but
* that does not appear in the URL path.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/History/state
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state
*/
export declare type State = object | null;
/**
* The pieces of a URL path.
* A unique string associated with a location. May be used to safely store
* and retrieve data in some other storage API, like `localStorage`.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key
*/
export interface PathPieces {
export declare type Key = string;
/**
* The pathname, search, and hash values of a URL.
*/
export interface Path {
/**
* The URL pathname, beginning with a /.
* A URL pathname, beginning with a /.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname
*/
pathname?: string;
pathname: Pathname;
/**
* The URL search string, beginning with a ?.
* A URL search string, beginning with a ?.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Location/search
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search
*/
search?: string;
search: Search;
/**
* The URL fragment identifier, beginning with a #.
* A URL fragment identifier, beginning with a #.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Location/hash
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash
*/
hash?: string;
hash: Hash;
}
/**
* The pieces of a Location object.
* An entry in a history stack. A location contains information about the
* URL path, as well as possibly some arbitrary state and a key.
*
* @typeParam S - The type for the state object (optional)
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location
*/
export interface LocationPieces<S extends State = State> extends PathPieces {
export interface Location<S extends State = State> extends Path {
/**
* Additional state tied to this location.
* An object of arbitrary data associated with this location.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/History/state
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state
*/
state?: S;
state: S;
/**
* A unique string associated with this location. May be used to safely store
* and retrieve data in some other storage API, like `localStorage`. This
* value is always "default" on the initial location.
* and retrieve data in some other storage API, like `localStorage`.
*
* Note: This value is always "default" on the initial location.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key
*/
key?: string;
key: Key;
}
/**
* A location represents the current state in a history stack. It contains
* information about the URL path, as well as some state and a key. Analogous
* to the web's window.location API, but much smaller.
*
* @typeParam S - The type for the state object (optional)
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/location
* A partial Path object that may be missing some properties.
*/
export interface Location<S extends State = State> extends LocationPieces<S> {
export interface PartialPath {
/**
* The URL pathname, beginning with a /.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname
*/
pathname: string;
pathname?: Pathname;
/**
* The URL search string, beginning with a ?.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Location/search
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search
*/
search: string;
search?: Search;
/**
* The URL fragment identifier, beginning with a #.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Location/hash
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash
*/
hash: string;
hash?: Hash;
}
/**
* A partial Location object that may be missing some properties.
*/
export interface PartialLocation<S extends State = State> extends PartialPath {
/**
* Additional state tied to this location.
* An object of arbitrary data associated with this location.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/History/state
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state
*/
state: S;
state?: S;
/**
* A unique string associated with this location. May be used to safely store
* and retrieve data in some other storage API, like `localStorage`. This
* value is always "default" on the initial location.
* and retrieve data in some other storage API, like `localStorage`.
*
* Note: This value is always "default" on the initial location.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key
*/
key: string;
key?: Key;
}
/**
* A change to the current location.
*
* @typeParam S - The type for the location's state object (optional)
*/

@@ -137,4 +164,2 @@ export interface Update<S extends State = State> {

* A function that receives notifications about location changes.
*
* @typeParam S - The type for the location's state object (optional)
*/

@@ -147,4 +172,2 @@ export interface Listener<S extends State = State> {

* after obtaining user confirmation.
*
* @typeParam S - The type for the location's state object (optional)
*/

@@ -159,4 +182,2 @@ export interface Transition<S extends State = State> extends Update<S> {

* A function that receives transitions when navigation is blocked.
*
* @typeParam S - The type for the location's state object (optional)
*/

@@ -167,5 +188,7 @@ export interface Blocker<S extends State = State> {

/**
* A URL path or an object that contains the pieces of a URL path.
* Describes a location that is the destination of some navigation, either via
* `history.push` or `history.replace`. May be either a URL or the pieces of a
* URL path.
*/
export declare type To = Path | PathPieces;
export declare type To = string | PartialPath;
/**

@@ -176,6 +199,4 @@ * A history is an interface to the navigation stack. The history serves as the

*
* It is analogous to the web's window.history object, but with a smaller, more
* It is similar to the DOM's `window.history` object, but with a smaller, more
* focused API.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/history
*/

@@ -186,2 +207,4 @@ export interface History<S extends State = State> {

* Action.Pop when a history instance is first created. This value is mutable.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.action
*/

@@ -191,2 +214,4 @@ readonly action: Action;

* The current location. This value is mutable.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.location
*/

@@ -199,4 +224,6 @@ readonly location: Location<S>;

* @param to - The destination URL
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.createHref
*/
createHref(to: Path | PathPieces): string;
createHref(to: To): string;
/**

@@ -209,4 +236,6 @@ * Pushes a new location onto the history stack, increasing its length by one.

* @param state - Data to associate with the new location
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.push
*/
push(to: To, state?: State): void;
push(to: To, state?: S): void;
/**

@@ -218,4 +247,6 @@ * Replaces the current location in the history stack with a new one. The

* @param state - Data to associate with the new location
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.replace
*/
replace(to: To, state?: State): void;
replace(to: To, state?: S): void;
/**

@@ -225,5 +256,7 @@ * Navigates `n` entries backward/forward in the history stack relative to the

*
* @param n - The delta in the stack index
* @param delta - The delta in the stack index
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.go
*/
go(n: number): void;
go(delta: number): void;
/**

@@ -234,2 +267,4 @@ * Navigates to the previous entry in the stack. Identical to go(-1).

* will unload the current document.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.back
*/

@@ -239,2 +274,4 @@ back(): void;

* Navigates to the next entry in the stack. Identical to go(1).
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.forward
*/

@@ -246,3 +283,6 @@ forward(): void;

*
* @param listener - A function that will be called when the location changes
* @returns unlisten - A function that may be used to stop listening
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.listen
*/

@@ -254,3 +294,6 @@ listen(listener: Listener<S>): () => void;

*
* @param blocker - A function that will be called when a transition is blocked
* @returns unblock - A function that may be used to stop blocking
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.block
*/

@@ -263,2 +306,4 @@ block(blocker: Blocker<S>): () => void;

* cleanest URLs the browser's address bar.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#browserhistory
*/

@@ -275,2 +320,4 @@ export interface BrowserHistory<S extends State = State> extends History<S> {

* which pages are served at which URLs.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#hashhistory
*/

@@ -283,2 +330,4 @@ export interface HashHistory<S extends State = State> extends History<S> {

* Native.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#memoryhistory
*/

@@ -288,2 +337,5 @@ export interface MemoryHistory<S extends State = State> extends History<S> {

}
export declare type BrowserHistoryOptions = {
window?: Window;
};
/**

@@ -293,6 +345,9 @@ * Browser history stores the location in regular URLs. This is the standard for

* serve the same app at multiple URLs.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createbrowserhistory
*/
export declare function createBrowserHistory({ window }?: {
export declare function createBrowserHistory(options?: BrowserHistoryOptions): BrowserHistory;
export declare type HashHistoryOptions = {
window?: Window;
}): BrowserHistory;
};
/**

@@ -303,17 +358,33 @@ * Hash history stores the location in window.location.hash. This makes it ideal

* reserved for something else.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createhashhistory
*/
export declare function createHashHistory({ window }?: {
window?: Window;
}): HashHistory;
export declare type InitialEntry = Path | LocationPieces;
export declare function createHashHistory(options?: HashHistoryOptions): HashHistory;
/**
* Memory history stores the current location in memory. It is designed for use
* in stateful non-browser environments like headless tests (in node.js) and
* React Native.
* A user-supplied object that describes a location. Used when providing
* entries to `createMemoryHistory` via its `initialEntries` option.
*/
export declare function createMemoryHistory({ initialEntries, initialIndex }?: {
export declare type InitialEntry = string | PartialLocation;
export declare type MemoryHistoryOptions = {
initialEntries?: InitialEntry[];
initialIndex?: number;
}): MemoryHistory;
export declare function createPath({ pathname, search, hash }: PathPieces): string;
export declare function parsePath(path: Path): PathPieces;
};
/**
* 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/ReactTraining/history/tree/master/docs/api-reference.md#creatememoryhistory
*/
export declare function createMemoryHistory(options?: MemoryHistoryOptions): MemoryHistory;
/**
* Creates a string URL path from the given pathname, search, and hash components.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createpath
*/
export declare function createPath({ pathname, search, hash }: PartialPath): string;
/**
* Parses a string URL path into its separate pathname, search, and hash components.
*
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#parsepath
*/
export declare function parsePath(path: string): PartialPath;

@@ -1,17 +0,17 @@

import _extends from'@babel/runtime/helpers/esm/extends';var n,x=n||(n={});x.Pop="POP";x.Push="PUSH";x.Replace="REPLACE";var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function z(a,b){if(!a){"undefined"!==typeof console&&console.warn(b);try{throw Error(b);}catch(g){}}}function A(a){a.preventDefault();a.returnValue=""}
import _extends from'@babel/runtime/helpers/esm/extends';var m,x=m||(m={});x.Pop="POP";x.Push="PUSH";x.Replace="REPLACE";var y="production"!==process.env.NODE_ENV?function(a){return Object.freeze(a)}:function(a){return a};function z(a,b){if(!a){"undefined"!==typeof console&&console.warn(b);try{throw Error(b);}catch(g){}}}function A(a){a.preventDefault();a.returnValue=""}
function B(){var a=[];return{get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b})}},call:function(b){a.forEach(function(a){return a&&a(b)})}}}function D(){return Math.random().toString(36).substr(2,8)}function E(a){var b=a.pathname,g=a.search;a=a.hash;return(void 0===b?"/":b)+(void 0===g?"":g)+(void 0===a?"":a)}
function F(a){var b={};if(a){var g=a.indexOf("#");0<=g&&(b.hash=a.substr(g),a=a.substr(0,g));g=a.indexOf("?");0<=g&&(b.search=a.substr(g),a=a.substr(0,g));a&&(b.pathname=a)}return b}
function createBrowserHistory(a){function b(){var a=h.location,d=f.state||{};return[d.idx,y({pathname:a.pathname,search:a.search,hash:a.hash,state:d.usr||null,key:d.key||"default"})]}function g(a){return"string"===typeof a?a:E(a)}function t(a,d){void 0===d&&(d=null);return y(_extends({},l,{},"string"===typeof a?F(a):a,{state:d,key:D()}))}function v(a){p=a;a=b();r=a[0];l=a[1];c.call({action:p,location:l})}function w(a,d){function c(){w(a,d)}var k=n.Push,C=t(a,d);if(!e.length||(e.call({action:k,
location:C,retry:c}),!1)){var b=[{usr:C.state,key:C.key,idx:r+1},g(C)];C=b[0];b=b[1];try{f.pushState(C,"",b)}catch(G){h.location.assign(b)}v(k)}}function u(a,d){function c(){u(a,d)}var b=n.Replace,k=t(a,d);e.length&&(e.call({action:b,location:k,retry:c}),1)||(k=[{usr:k.state,key:k.key,idx:r},g(k)],f.replaceState(k[0],"",k[1]),v(b))}function m(a){f.go(a)}a=(void 0===a?{}:a).window;var h=void 0===a?document.defaultView:a,f=h.history,q=null;h.addEventListener("popstate",function(){if(q)e.call(q),q=null;
else{var a=n.Pop,d=b(),c=d[0];d=d[1];if(e.length)if(null!=c){var f=r-c;f&&(q={action:a,location:d,retry:function(){m(-1*f)}},m(f))}else"production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):void 0;else v(a)}});var p=n.Pop;
a=b();var r=a[0],l=a[1],c=B(),e=B();null==r&&(r=0,f.replaceState(_extends({},f.state,{idx:r}),""));return{get action(){return p},get location(){return l},createHref:g,push:w,replace:u,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(a){return c.push(a)},block:function(a){var d=e.push(a);1===e.length&&h.addEventListener("beforeunload",A);return function(){d();e.length||h.removeEventListener("beforeunload",A)}}}};
function createHashHistory(a){function b(){var a=F(f.location.hash.substr(1)),c=a.pathname,b=a.search;a=a.hash;var e=q.state||{};return[e.idx,y({pathname:void 0===c?"/":c,search:void 0===b?"":b,hash:void 0===a?"":a,state:e.usr||null,key:e.key||"default"})]}function g(){if(p)k.call(p),p=null;else{var a=n.Pop,c=b(),e=c[0];c=c[1];if(k.length)if(null!=e){var f=l-e;f&&(p={action:a,location:c,retry:function(){h(-1*f)}},h(f))}else"production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):
void 0;else w(a)}}function t(a){var d=document.querySelector("base"),c="";d&&d.getAttribute("href")&&(d=f.location.href,c=d.indexOf("#"),c=-1===c?d:d.slice(0,c));return c+"#"+("string"===typeof a?a:E(a))}function v(a,b){void 0===b&&(b=null);return y(_extends({},c,{},"string"===typeof a?F(a):a,{state:b,key:D()}))}function w(a){r=a;a=b();l=a[0];c=a[1];e.call({action:r,location:c})}function u(a,c){function d(){u(a,c)}var b=n.Push,e=v(a,c);"production"!==process.env.NODE_ENV?z("/"===e.pathname.charAt(0),
"Relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")"):void 0;if(!k.length||(k.call({action:b,location:e,retry:d}),!1)){var g=[{usr:e.state,key:e.key,idx:l+1},t(e)];e=g[0];g=g[1];try{q.pushState(e,"",g)}catch(H){f.location.assign(g)}w(b)}}function m(a,c){function d(){m(a,c)}var e=n.Replace,b=v(a,c);"production"!==process.env.NODE_ENV?z("/"===b.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")"):void 0;k.length&&(k.call({action:e,
location:b,retry:d}),1)||(b=[{usr:b.state,key:b.key,idx:l},t(b)],q.replaceState(b[0],"",b[1]),w(e))}function h(a){q.go(a)}a=(void 0===a?{}:a).window;var f=void 0===a?document.defaultView:a,q=f.history,p=null;f.addEventListener("popstate",g);f.addEventListener("hashchange",function(){var a=b()[1];E(a)!==E(c)&&g()});var r=n.Pop;a=b();var l=a[0],c=a[1],e=B(),k=B();null==l&&(l=0,q.replaceState(_extends({},q.state,{idx:l}),""));return{get action(){return r},get location(){return c},createHref:t,push:u,
replace:m,go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(a){return e.push(a)},block:function(a){var c=k.push(a);1===k.length&&f.addEventListener("beforeunload",A);return function(){c();k.length||f.removeEventListener("beforeunload",A)}}}};
function createMemoryHistory(a){function b(a,b){void 0===b&&(b=null);return y(_extends({},p,{},"string"===typeof a?F(a):a,{state:b,key:D()}))}function g(a,b,f){return!l.length||(l.call({action:a,location:b,retry:f}),!1)}function t(a,b){q=a;p=b;r.call({action:q,location:p})}function v(a,e){var c=n.Push,d=b(a,e);"production"!==process.env.NODE_ENV?z("/"===p.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(a)+")"):void 0;g(c,d,function(){v(a,e)})&&
(f+=1,h.splice(f,h.length,d),t(c,d))}function w(a,e){var c=n.Replace,d=b(a,e);"production"!==process.env.NODE_ENV?z("/"===p.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(a)+")"):void 0;g(c,d,function(){w(a,e)})&&(h[f]=d,t(c,d))}function u(a){var b=Math.min(Math.max(f+a,0),h.length-1),c=n.Pop,d=h[b];g(c,d,function(){u(a)})&&(f=b,t(c,d))}var m=void 0===a?{}:a;a=m.initialEntries;m=m.initialIndex;m=void 0===m?0:m;var h=(void 0===a?["/"]:a).map(function(a){var b=
y(_extends({pathname:"/",search:"",hash:"",state:null,key:D()},"string"===typeof a?F(a):a));"production"!==process.env.NODE_ENV?z("/"===b.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(a)+")"):void 0;return b}),f=Math.min(Math.max(m,0),h.length-1),q=n.Pop,p=h[f],r=B(),l=B();return{get index(){return f},get action(){return q},get location(){return p},createHref:function(a){return"string"===typeof a?a:E(a)},push:v,
replace:w,go:u,back:function(){u(-1)},forward:function(){u(1)},listen:function(a){return r.push(a)},block:function(a){return l.push(a)}}};export{n as Action,createBrowserHistory,createHashHistory,createMemoryHistory,E as createPath,F as parsePath}
function createBrowserHistory(a){function b(){var a=h.location,d=f.state||{};return[d.idx,y({pathname:a.pathname,search:a.search,hash:a.hash,state:d.usr||null,key:d.key||"default"})]}function g(a){return"string"===typeof a?a:E(a)}function t(a,d){void 0===d&&(d=null);return y(_extends({},l,{},"string"===typeof a?F(a):a,{state:d,key:D()}))}function v(a){n=a;a=b();q=a[0];l=a[1];c.call({action:n,location:l})}function w(a,d){function c(){w(a,d)}var k=m.Push,C=t(a,d);if(!e.length||(e.call({action:k,
location:C,retry:c}),!1)){var b=[{usr:C.state,key:C.key,idx:q+1},g(C)];C=b[0];b=b[1];try{f.pushState(C,"",b)}catch(G){h.location.assign(b)}v(k)}}function u(a,d){function c(){u(a,d)}var b=m.Replace,k=t(a,d);e.length&&(e.call({action:b,location:k,retry:c}),1)||(k=[{usr:k.state,key:k.key,idx:q},g(k)],f.replaceState(k[0],"",k[1]),v(b))}function r(a){f.go(a)}void 0===a&&(a={});a=a.window;var h=void 0===a?document.defaultView:a,f=h.history,p=null;h.addEventListener("popstate",function(){if(p)e.call(p),
p=null;else{var a=m.Pop,d=b(),c=d[0];d=d[1];if(e.length)if(null!=c){var f=q-c;f&&(p={action:a,location:d,retry:function(){r(-1*f)}},r(f))}else"production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):void 0;else v(a)}});var n=
m.Pop;a=b();var q=a[0],l=a[1],c=B(),e=B();null==q&&(q=0,f.replaceState(_extends({},f.state,{idx:q}),""));return{get action(){return n},get location(){return l},createHref:g,push:w,replace:u,go:r,back:function(){r(-1)},forward:function(){r(1)},listen:function(a){return c.push(a)},block:function(a){var d=e.push(a);1===e.length&&h.addEventListener("beforeunload",A);return function(){d();e.length||h.removeEventListener("beforeunload",A)}}}};
function createHashHistory(a){function b(){var a=F(f.location.hash.substr(1)),c=a.pathname,b=a.search;a=a.hash;var e=p.state||{};return[e.idx,y({pathname:void 0===c?"/":c,search:void 0===b?"":b,hash:void 0===a?"":a,state:e.usr||null,key:e.key||"default"})]}function g(){if(n)k.call(n),n=null;else{var a=m.Pop,c=b(),e=c[0];c=c[1];if(k.length)if(null!=e){var f=l-e;f&&(n={action:a,location:c,retry:function(){h(-1*f)}},h(f))}else"production"!==process.env.NODE_ENV?z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."):
void 0;else w(a)}}function t(a){var d=document.querySelector("base"),c="";d&&d.getAttribute("href")&&(d=f.location.href,c=d.indexOf("#"),c=-1===c?d:d.slice(0,c));return c+"#"+("string"===typeof a?a:E(a))}function v(a,b){void 0===b&&(b=null);return y(_extends({},c,{},"string"===typeof a?F(a):a,{state:b,key:D()}))}function w(a){q=a;a=b();l=a[0];c=a[1];e.call({action:q,location:c})}function u(a,c){function d(){u(a,c)}var b=m.Push,e=v(a,c);"production"!==process.env.NODE_ENV?z("/"===e.pathname.charAt(0),
"Relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")"):void 0;if(!k.length||(k.call({action:b,location:e,retry:d}),!1)){var g=[{usr:e.state,key:e.key,idx:l+1},t(e)];e=g[0];g=g[1];try{p.pushState(e,"",g)}catch(H){f.location.assign(g)}w(b)}}function r(a,c){function d(){r(a,c)}var e=m.Replace,b=v(a,c);"production"!==process.env.NODE_ENV?z("/"===b.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")"):void 0;k.length&&(k.call({action:e,
location:b,retry:d}),1)||(b=[{usr:b.state,key:b.key,idx:l},t(b)],p.replaceState(b[0],"",b[1]),w(e))}function h(a){p.go(a)}void 0===a&&(a={});a=a.window;var f=void 0===a?document.defaultView:a,p=f.history,n=null;f.addEventListener("popstate",g);f.addEventListener("hashchange",function(){var a=b()[1];E(a)!==E(c)&&g()});var q=m.Pop;a=b();var l=a[0],c=a[1],e=B(),k=B();null==l&&(l=0,p.replaceState(_extends({},p.state,{idx:l}),""));return{get action(){return q},get location(){return c},createHref:t,push:u,
replace:r,go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(a){return e.push(a)},block:function(a){var c=k.push(a);1===k.length&&f.addEventListener("beforeunload",A);return function(){c();k.length||f.removeEventListener("beforeunload",A)}}}};
function createMemoryHistory(a){function b(a,b){void 0===b&&(b=null);return y(_extends({},n,{},"string"===typeof a?F(a):a,{state:b,key:D()}))}function g(a,b,f){return!l.length||(l.call({action:a,location:b,retry:f}),!1)}function t(a,b){p=a;n=b;q.call({action:p,location:n})}function v(a,e){var c=m.Push,d=b(a,e);"production"!==process.env.NODE_ENV?z("/"===n.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(a)+")"):void 0;g(c,d,function(){v(a,e)})&&
(f+=1,h.splice(f,h.length,d),t(c,d))}function w(a,e){var c=m.Replace,d=b(a,e);"production"!==process.env.NODE_ENV?z("/"===n.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(a)+")"):void 0;g(c,d,function(){w(a,e)})&&(h[f]=d,t(c,d))}function u(a){var b=Math.min(Math.max(f+a,0),h.length-1),c=m.Pop,d=h[b];g(c,d,function(){u(a)})&&(f=b,t(c,d))}void 0===a&&(a={});var r=a;a=r.initialEntries;r=r.initialIndex;var h=(void 0===a?["/"]:a).map(function(a){var b=
y(_extends({pathname:"/",search:"",hash:"",state:null,key:D()},"string"===typeof a?F(a):a));"production"!==process.env.NODE_ENV?z("/"===b.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(a)+")"):void 0;return b}),f=Math.min(Math.max(null==r?h.length-1:r,0),h.length-1),p=m.Pop,n=h[f],q=B(),l=B();return{get index(){return f},get action(){return p},get location(){return n},createHref:function(a){return"string"===typeof a?
a:E(a)},push:v,replace:w,go:u,back:function(){u(-1)},forward:function(){u(1)},listen:function(a){return q.push(a)},block:function(a){return l.push(a)}}};export{m as Action,createBrowserHistory,createHashHistory,createMemoryHistory,E as createPath,F as parsePath}
//# sourceMappingURL=index.js.map
{
"name": "history",
"version": "5.0.0-beta.9",
"version": "5.0.0",
"description": "Manage session history with JavaScript",

@@ -5,0 +5,0 @@ "author": "React Training <hello@reacttraining.com>",

@@ -8,8 +8,10 @@ # history &middot; [![npm package][npm-badge]][npm] [![Travis][build-badge]][build]

The history library lets you easily manage session history anywhere JavaScript runs. `history` abstracts away the differences in various environments and provides a minimal API that lets you manage the history stack, navigate, and persist state between sessions.
The history library lets you easily manage session history anywhere JavaScript runs. A `history` object abstracts away the differences in various environments and provides a minimal API that lets you manage the history stack, navigate, and persist state between sessions.
## Documentation
Documentation for the current branch can be found in the [docs](docs) directory.
Documentation for version 5 can be found in the [docs](docs) directory. This is the current stable release. Version 5 is used in React Router version 6.
Documentation for version 4 can be found [on the v4 branch](https://github.com/ReactTraining/history/tree/v4/docs). Version 4 is used in React Router versions 4 and 5.
## Changes

@@ -23,6 +25,4 @@

Development of the current stable release, version 4, happens on [the `master` branch](https://github.com/ReactTraining/history/tree/master). Please keep in mind that this branch may include some work that has not yet been published as part of an official release. However, since `master` is always stable, you should feel free to build your own working release straight from master at any time.
Development of the current stable release, version 5, happens on [the `master` branch](https://github.com/ReactTraining/history/tree/master). Please keep in mind that this branch may include some work that has not yet been published as part of an official release. However, since `master` is always stable, you should feel free to build your own working release straight from master at any time.
Development of the next major release, version 5, happens on [the `dev` branch](https://github.com/ReactTraining/history/tree/dev).
If you're interested in helping out, please read [our contributing guidelines](CONTRIBUTING.md).

@@ -32,5 +32,3 @@

`history` is developed and maintained by [React Training](https://reacttraining.com). If
you're interested in learning more about what React can do for your company, please
[get in touch](mailto:hello@reacttraining.com)!
`history` is developed and maintained by [React Training](https://reacttraining.com). If you're interested in learning more about what React can do for your company, please [get in touch](mailto:hello@reacttraining.com)!

@@ -37,0 +35,0 @@ ## Thanks

'use strict';(function(c,t){"object"===typeof exports&&"undefined"!==typeof module?t(exports):"function"===typeof define&&define.amd?define(["exports"],t):(c=c||self,t(c.HistoryLibrary={}))})(this,function(c){function t(){t=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var f=arguments[b],c;for(c in f)Object.prototype.hasOwnProperty.call(f,c)&&(a[c]=f[c])}return a};return t.apply(this,arguments)}function y(a,b){if(!a){"undefined"!==typeof console&&console.warn(b);try{throw Error(b);
}catch(f){}}}function D(a){a.preventDefault();a.returnValue=""}function z(){var a=[];return{get length(){return a.length},push:function(b){a.push(b);return function(){a=a.filter(function(a){return a!==b})}},call:function(b){a.forEach(function(a){return a&&a(b)})}}}function E(){return Math.random().toString(36).substr(2,8)}function A(a){var b=a.pathname,c=a.search;a=a.hash;return(void 0===b?"/":b)+(void 0===c?"":c)+(void 0===a?"":a)}function B(a){var c={};if(a){var f=a.indexOf("#");0<=f&&(c.hash=a.substr(f),
a=a.substr(0,f));f=a.indexOf("?");0<=f&&(c.search=a.substr(f),a=a.substr(0,f));a&&(c.pathname=a)}return c}(function(a){a.Pop="POP";a.Push="PUSH";a.Replace="REPLACE"})(c.Action||(c.Action={}));c.createBrowserHistory=function(a){function b(){var a=k.location,e=h.state||{};return[e.idx,Object.freeze({pathname:a.pathname,search:a.search,hash:a.hash,state:e.usr||null,key:e.key||"default"})]}function f(a){return"string"===typeof a?a:A(a)}function u(a,e){void 0===e&&(e=null);return Object.freeze(t({},m,
{},"string"===typeof a?B(a):a,{state:e,key:E()}))}function w(a){p=a;a=b();r=a[0];m=a[1];d.call({action:p,location:m})}function x(a,e){function d(){x(a,e)}var l=c.Action.Push,C=u(a,e);if(!g.length||(g.call({action:l,location:C,retry:d}),!1)){var b=[{usr:C.state,key:C.key,idx:r+1},f(C)];C=b[0];b=b[1];try{h.pushState(C,"",b)}catch(F){k.location.assign(b)}w(l)}}function v(a,e){function d(){v(a,e)}var b=c.Action.Replace,l=u(a,e);g.length&&(g.call({action:b,location:l,retry:d}),1)||(l=[{usr:l.state,key:l.key,
idx:r},f(l)],h.replaceState(l[0],"",l[1]),w(b))}function n(a){h.go(a)}a=(void 0===a?{}:a).window;var k=void 0===a?document.defaultView:a,h=k.history,q=null;k.addEventListener("popstate",function(){if(q)g.call(q),q=null;else{var a=c.Action.Pop,e=b(),d=e[0];e=e[1];if(g.length)if(null!=d){var f=r-d;f&&(q={action:a,location:e,retry:function(){n(-1*f)}},n(f))}else y(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");
else w(a)}});var p=c.Action.Pop;a=b();var r=a[0],m=a[1],d=z(),g=z();null==r&&(r=0,h.replaceState(t({},h.state,{idx:r}),""));return{get action(){return p},get location(){return m},createHref:f,push:x,replace:v,go:n,back:function(){n(-1)},forward:function(){n(1)},listen:function(a){return d.push(a)},block:function(a){var e=g.push(a);1===g.length&&k.addEventListener("beforeunload",D);return function(){e();g.length||k.removeEventListener("beforeunload",D)}}}};c.createHashHistory=function(a){function b(){var a=
B(h.location.hash.substr(1)),d=a.pathname,c=a.search;a=a.hash;var b=q.state||{};return[b.idx,Object.freeze({pathname:void 0===d?"/":d,search:void 0===c?"":c,hash:void 0===a?"":a,state:b.usr||null,key:b.key||"default"})]}function f(){if(p)l.call(p),p=null;else{var a=c.Action.Pop,d=b(),g=d[0];d=d[1];if(l.length)if(null!=g){var f=m-g;f&&(p={action:a,location:d,retry:function(){k(-1*f)}},k(f))}else y(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");
else x(a)}}function u(a){var e=document.querySelector("base"),d="";e&&e.getAttribute("href")&&(e=h.location.href,d=e.indexOf("#"),d=-1===d?e:e.slice(0,d));return d+"#"+("string"===typeof a?a:A(a))}function w(a,c){void 0===c&&(c=null);return Object.freeze(t({},d,{},"string"===typeof a?B(a):a,{state:c,key:E()}))}function x(a){r=a;a=b();m=a[0];d=a[1];g.call({action:r,location:d})}function v(a,d){function e(){v(a,d)}var b=c.Action.Push,g=w(a,d);y("/"===g.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+
JSON.stringify(a)+")");if(!l.length||(l.call({action:b,location:g,retry:e}),!1)){var f=[{usr:g.state,key:g.key,idx:m+1},u(g)];g=f[0];f=f[1];try{q.pushState(g,"",f)}catch(G){h.location.assign(f)}x(b)}}function n(a,d){function e(){n(a,d)}var g=c.Action.Replace,b=w(a,d);y("/"===b.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")");l.length&&(l.call({action:g,location:b,retry:e}),1)||(b=[{usr:b.state,key:b.key,idx:m},u(b)],q.replaceState(b[0],"",b[1]),
x(g))}function k(a){q.go(a)}a=(void 0===a?{}:a).window;var h=void 0===a?document.defaultView:a,q=h.history,p=null;h.addEventListener("popstate",f);h.addEventListener("hashchange",function(){var a=b()[1];A(a)!==A(d)&&f()});var r=c.Action.Pop;a=b();var m=a[0],d=a[1],g=z(),l=z();null==m&&(m=0,q.replaceState(t({},q.state,{idx:m}),""));return{get action(){return r},get location(){return d},createHref:u,push:v,replace:n,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(a){return g.push(a)},
block:function(a){var d=l.push(a);1===l.length&&h.addEventListener("beforeunload",D);return function(){d();l.length||h.removeEventListener("beforeunload",D)}}}};c.createMemoryHistory=function(a){function b(a,b){void 0===b&&(b=null);return Object.freeze(t({},p,{},"string"===typeof a?B(a):a,{state:b,key:E()}))}function f(a,b,c){return!m.length||(m.call({action:a,location:b,retry:c}),!1)}function u(a,b){q=a;p=b;r.call({action:q,location:p})}function w(a,g){var d=c.Action.Push,e=b(a,g);y("/"===p.pathname.charAt(0),
"Relative pathnames are not supported in memory history.push("+JSON.stringify(a)+")");f(d,e,function(){w(a,g)})&&(h+=1,k.splice(h,k.length,e),u(d,e))}function x(a,g){var d=c.Action.Replace,e=b(a,g);y("/"===p.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(a)+")");f(d,e,function(){x(a,g)})&&(k[h]=e,u(d,e))}function v(a){var b=Math.min(Math.max(h+a,0),k.length-1),d=c.Action.Pop,e=k[b];f(d,e,function(){v(a)})&&(h=b,u(d,e))}var n=void 0===a?{}:a;a=n.initialEntries;
n=n.initialIndex;n=void 0===n?0:n;var k=(void 0===a?["/"]:a).map(function(a){var b=Object.freeze(t({pathname:"/",search:"",hash:"",state:null,key:E()},"string"===typeof a?B(a):a));y("/"===b.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(a)+")");return b}),h=Math.min(Math.max(n,0),k.length-1),q=c.Action.Pop,p=k[h],r=z(),m=z();return{get index(){return h},get action(){return q},get location(){return p},createHref:function(a){return"string"===
typeof a?a:A(a)},push:w,replace:x,go:v,back:function(){v(-1)},forward:function(){v(1)},listen:function(a){return r.push(a)},block:function(a){return m.push(a)}}};c.createPath=A;c.parsePath=B;Object.defineProperty(c,"__esModule",{value:!0})});
{},"string"===typeof a?B(a):a,{state:e,key:E()}))}function w(a){n=a;a=b();q=a[0];m=a[1];d.call({action:n,location:m})}function x(a,e){function d(){x(a,e)}var l=c.Action.Push,C=u(a,e);if(!g.length||(g.call({action:l,location:C,retry:d}),!1)){var b=[{usr:C.state,key:C.key,idx:q+1},f(C)];C=b[0];b=b[1];try{h.pushState(C,"",b)}catch(F){k.location.assign(b)}w(l)}}function v(a,e){function d(){v(a,e)}var b=c.Action.Replace,l=u(a,e);g.length&&(g.call({action:b,location:l,retry:d}),1)||(l=[{usr:l.state,key:l.key,
idx:q},f(l)],h.replaceState(l[0],"",l[1]),w(b))}function r(a){h.go(a)}void 0===a&&(a={});a=a.window;var k=void 0===a?document.defaultView:a,h=k.history,p=null;k.addEventListener("popstate",function(){if(p)g.call(p),p=null;else{var a=c.Action.Pop,e=b(),d=e[0];e=e[1];if(g.length)if(null!=d){var f=q-d;f&&(p={action:a,location:e,retry:function(){r(-1*f)}},r(f))}else y(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");
else w(a)}});var n=c.Action.Pop;a=b();var q=a[0],m=a[1],d=z(),g=z();null==q&&(q=0,h.replaceState(t({},h.state,{idx:q}),""));return{get action(){return n},get location(){return m},createHref:f,push:x,replace:v,go:r,back:function(){r(-1)},forward:function(){r(1)},listen:function(a){return d.push(a)},block:function(a){var e=g.push(a);1===g.length&&k.addEventListener("beforeunload",D);return function(){e();g.length||k.removeEventListener("beforeunload",D)}}}};c.createHashHistory=function(a){function b(){var a=
B(h.location.hash.substr(1)),d=a.pathname,c=a.search;a=a.hash;var b=p.state||{};return[b.idx,Object.freeze({pathname:void 0===d?"/":d,search:void 0===c?"":c,hash:void 0===a?"":a,state:b.usr||null,key:b.key||"default"})]}function f(){if(n)l.call(n),n=null;else{var a=c.Action.Pop,d=b(),g=d[0];d=d[1];if(l.length)if(null!=g){var f=m-g;f&&(n={action:a,location:d,retry:function(){k(-1*f)}},k(f))}else y(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");
else x(a)}}function u(a){var e=document.querySelector("base"),d="";e&&e.getAttribute("href")&&(e=h.location.href,d=e.indexOf("#"),d=-1===d?e:e.slice(0,d));return d+"#"+("string"===typeof a?a:A(a))}function w(a,c){void 0===c&&(c=null);return Object.freeze(t({},d,{},"string"===typeof a?B(a):a,{state:c,key:E()}))}function x(a){q=a;a=b();m=a[0];d=a[1];g.call({action:q,location:d})}function v(a,d){function e(){v(a,d)}var b=c.Action.Push,g=w(a,d);y("/"===g.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+
JSON.stringify(a)+")");if(!l.length||(l.call({action:b,location:g,retry:e}),!1)){var f=[{usr:g.state,key:g.key,idx:m+1},u(g)];g=f[0];f=f[1];try{p.pushState(g,"",f)}catch(G){h.location.assign(f)}x(b)}}function r(a,d){function e(){r(a,d)}var g=c.Action.Replace,b=w(a,d);y("/"===b.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")");l.length&&(l.call({action:g,location:b,retry:e}),1)||(b=[{usr:b.state,key:b.key,idx:m},u(b)],p.replaceState(b[0],"",b[1]),
x(g))}function k(a){p.go(a)}void 0===a&&(a={});a=a.window;var h=void 0===a?document.defaultView:a,p=h.history,n=null;h.addEventListener("popstate",f);h.addEventListener("hashchange",function(){var a=b()[1];A(a)!==A(d)&&f()});var q=c.Action.Pop;a=b();var m=a[0],d=a[1],g=z(),l=z();null==m&&(m=0,p.replaceState(t({},p.state,{idx:m}),""));return{get action(){return q},get location(){return d},createHref:u,push:v,replace:r,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(a){return g.push(a)},
block:function(a){var d=l.push(a);1===l.length&&h.addEventListener("beforeunload",D);return function(){d();l.length||h.removeEventListener("beforeunload",D)}}}};c.createMemoryHistory=function(a){function b(a,b){void 0===b&&(b=null);return Object.freeze(t({},n,{},"string"===typeof a?B(a):a,{state:b,key:E()}))}function f(a,b,c){return!m.length||(m.call({action:a,location:b,retry:c}),!1)}function u(a,b){p=a;n=b;q.call({action:p,location:n})}function w(a,g){var d=c.Action.Push,e=b(a,g);y("/"===n.pathname.charAt(0),
"Relative pathnames are not supported in memory history.push("+JSON.stringify(a)+")");f(d,e,function(){w(a,g)})&&(h+=1,k.splice(h,k.length,e),u(d,e))}function x(a,g){var d=c.Action.Replace,e=b(a,g);y("/"===n.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(a)+")");f(d,e,function(){x(a,g)})&&(k[h]=e,u(d,e))}function v(a){var b=Math.min(Math.max(h+a,0),k.length-1),d=c.Action.Pop,e=k[b];f(d,e,function(){v(a)})&&(h=b,u(d,e))}void 0===a&&(a={});var r=
a;a=r.initialEntries;r=r.initialIndex;var k=(void 0===a?["/"]:a).map(function(a){var b=Object.freeze(t({pathname:"/",search:"",hash:"",state:null,key:E()},"string"===typeof a?B(a):a));y("/"===b.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(a)+")");return b}),h=Math.min(Math.max(null==r?k.length-1:r,0),k.length-1),p=c.Action.Pop,n=k[h],q=z(),m=z();return{get index(){return h},get action(){return p},get location(){return n},
createHref:function(a){return"string"===typeof a?a:A(a)},push:w,replace:x,go:v,back:function(){v(-1)},forward:function(){v(1)},listen:function(a){return q.push(a)},block:function(a){return m.push(a)}}};c.createPath=A;c.parsePath=B;Object.defineProperty(c,"__esModule",{value:!0})});
//# sourceMappingURL=history.development.js.map

@@ -1,2 +0,2 @@

"use strict";!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).HistoryLibrary={})}(this,(function(t){function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e,r=arguments[n];for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t){t.preventDefault(),t.returnValue=""}function r(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter((function(t){return t!==n}))}},call:function(n){t.forEach((function(t){return t&&t(n)}))}}}function o(){return Math.random().toString(36).substr(2,8)}function i(t){var n=t.pathname,e=t.search;return(void 0===n?"/":n)+(void 0===e?"":e)+(void 0===(t=t.hash)?"":t)}function a(t){var n={};if(t){var e=t.indexOf("#");0<=e&&(n.hash=t.substr(e),t=t.substr(0,e)),0<=(e=t.indexOf("?"))&&(n.search=t.substr(e),t=t.substr(0,e)),t&&(n.pathname=t)}return n}var c;(c=t.Action||(t.Action={})).Pop="POP",c.Push="PUSH",c.Replace="REPLACE",t.createBrowserHistory=function(c){function u(){var t=d.location,n=p.state||{};return[n.idx,{pathname:t.pathname,search:t.search,hash:t.hash,state:n.usr||null,key:n.key||"default"}]}function l(t){return"string"==typeof t?t:i(t)}function s(t,e){return void 0===e&&(e=null),n({},b,{},"string"==typeof t?a(t):t,{state:e,key:o()})}function f(t){y=t,t=u(),g=t[0],b=t[1],k.call({action:y,location:b})}function h(t){p.go(t)}var d=void 0===(c=(void 0===c?{}:c).window)?document.defaultView:c,p=d.history,v=null;d.addEventListener("popstate",(function(){if(v)m.call(v),v=null;else{var n=t.Action.Pop,e=u(),r=e[0];if(e=e[1],m.length){if(null!=r){var o=g-r;o&&(v={action:n,location:e,retry:function(){h(-1*o)}},h(o))}}else f(n)}}));var y=t.Action.Pop,g=(c=u())[0],b=c[1],k=r(),m=r();return null==g&&(g=0,p.replaceState(n({},p.state,{idx:g}),"")),{get action(){return y},get location(){return b},createHref:l,push:function n(e,r){var o=t.Action.Push,i=s(e,r);if(!m.length||(m.call({action:o,location:i,retry:function(){n(e,r)}}),0)){var a=[{usr:i.state,key:i.key,idx:g+1},l(i)];i=a[0],a=a[1];try{p.pushState(i,"",a)}catch(t){d.location.assign(a)}f(o)}},replace:function n(e,r){var o=t.Action.Replace,i=s(e,r);m.length&&(m.call({action:o,location:i,retry:function(){n(e,r)}}),1)||(i=[{usr:i.state,key:i.key,idx:g},l(i)],p.replaceState(i[0],"",i[1]),f(o))},go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(t){return k.push(t)},block:function(t){var n=m.push(t);return 1===m.length&&d.addEventListener("beforeunload",e),function(){n(),m.length||d.removeEventListener("beforeunload",e)}}}},t.createHashHistory=function(c){function u(){var t=a(p.location.hash.substr(1)),n=t.pathname,e=t.search;t=t.hash;var r=v.state||{};return[r.idx,{pathname:void 0===n?"/":n,search:void 0===e?"":e,hash:void 0===t?"":t,state:r.usr||null,key:r.key||"default"}]}function l(){if(y)P.call(y),y=null;else{var n=t.Action.Pop,e=u(),r=e[0];if(e=e[1],P.length){if(null!=r){var o=b-r;o&&(y={action:n,location:e,retry:function(){d(-1*o)}},d(o))}}else h(n)}}function s(t){var n=document.querySelector("base"),e="";return n&&n.getAttribute("href")&&(e=-1===(e=(n=p.location.href).indexOf("#"))?n:n.slice(0,e)),e+"#"+("string"==typeof t?t:i(t))}function f(t,e){return void 0===e&&(e=null),n({},k,{},"string"==typeof t?a(t):t,{state:e,key:o()})}function h(t){g=t,t=u(),b=t[0],k=t[1],m.call({action:g,location:k})}function d(t){v.go(t)}var p=void 0===(c=(void 0===c?{}:c).window)?document.defaultView:c,v=p.history,y=null;p.addEventListener("popstate",l),p.addEventListener("hashchange",(function(){i(u()[1])!==i(k)&&l()}));var g=t.Action.Pop,b=(c=u())[0],k=c[1],m=r(),P=r();return null==b&&(b=0,v.replaceState(n({},v.state,{idx:b}),"")),{get action(){return g},get location(){return k},createHref:s,push:function n(e,r){var o=t.Action.Push,i=f(e,r);if(!P.length||(P.call({action:o,location:i,retry:function(){n(e,r)}}),0)){var a=[{usr:i.state,key:i.key,idx:b+1},s(i)];i=a[0],a=a[1];try{v.pushState(i,"",a)}catch(t){p.location.assign(a)}h(o)}},replace:function n(e,r){var o=t.Action.Replace,i=f(e,r);P.length&&(P.call({action:o,location:i,retry:function(){n(e,r)}}),1)||(i=[{usr:i.state,key:i.key,idx:b},s(i)],v.replaceState(i[0],"",i[1]),h(o))},go:d,back:function(){d(-1)},forward:function(){d(1)},listen:function(t){return m.push(t)},block:function(t){var n=P.push(t);return 1===P.length&&p.addEventListener("beforeunload",e),function(){n(),P.length||p.removeEventListener("beforeunload",e)}}}},t.createMemoryHistory=function(e){function c(t,e){return void 0===e&&(e=null),n({},v,{},"string"==typeof t?a(t):t,{state:e,key:o()})}function u(t,n,e){return!g.length||(g.call({action:t,location:n,retry:e}),!1)}function l(t,n){p=t,v=n,y.call({action:p,location:v})}function s(n){var e=Math.min(Math.max(d+n,0),h.length-1),r=t.Action.Pop,o=h[e];u(r,o,(function(){s(n)}))&&(d=e,l(r,o))}var f=void 0===e?{}:e;e=f.initialEntries,f=void 0===(f=f.initialIndex)?0:f;var h=(void 0===e?["/"]:e).map((function(t){return n({pathname:"/",search:"",hash:"",state:null,key:o()},"string"==typeof t?a(t):t)})),d=Math.min(Math.max(f,0),h.length-1),p=t.Action.Pop,v=h[d],y=r(),g=r();return{get index(){return d},get action(){return p},get location(){return v},createHref:function(t){return"string"==typeof t?t:i(t)},push:function n(e,r){var o=t.Action.Push,i=c(e,r);u(o,i,(function(){n(e,r)}))&&(d+=1,h.splice(d,h.length,i),l(o,i))},replace:function n(e,r){var o=t.Action.Replace,i=c(e,r);u(o,i,(function(){n(e,r)}))&&(h[d]=i,l(o,i))},go:s,back:function(){s(-1)},forward:function(){s(1)},listen:function(t){return y.push(t)},block:function(t){return g.push(t)}}},t.createPath=i,t.parsePath=a,Object.defineProperty(t,"__esModule",{value:!0})}));
"use strict";!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).HistoryLibrary={})}(this,(function(t){function n(){return(n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e,r=arguments[n];for(e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t){t.preventDefault(),t.returnValue=""}function r(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter((function(t){return t!==n}))}},call:function(n){t.forEach((function(t){return t&&t(n)}))}}}function o(){return Math.random().toString(36).substr(2,8)}function i(t){var n=t.pathname,e=t.search;return(void 0===n?"/":n)+(void 0===e?"":e)+(void 0===(t=t.hash)?"":t)}function a(t){var n={};if(t){var e=t.indexOf("#");0<=e&&(n.hash=t.substr(e),t=t.substr(0,e)),0<=(e=t.indexOf("?"))&&(n.search=t.substr(e),t=t.substr(0,e)),t&&(n.pathname=t)}return n}var c;(c=t.Action||(t.Action={})).Pop="POP",c.Push="PUSH",c.Replace="REPLACE",t.createBrowserHistory=function(c){function u(){var t=p.location,n=d.state||{};return[n.idx,{pathname:t.pathname,search:t.search,hash:t.hash,state:n.usr||null,key:n.key||"default"}]}function l(t){return"string"==typeof t?t:i(t)}function s(t,e){return void 0===e&&(e=null),n({},b,{},"string"==typeof t?a(t):t,{state:e,key:o()})}function f(t){y=t,t=u(),g=t[0],b=t[1],k.call({action:y,location:b})}function h(t){d.go(t)}void 0===c&&(c={});var p=void 0===(c=c.window)?document.defaultView:c,d=p.history,v=null;p.addEventListener("popstate",(function(){if(v)m.call(v),v=null;else{var n=t.Action.Pop,e=u(),r=e[0];if(e=e[1],m.length){if(null!=r){var o=g-r;o&&(v={action:n,location:e,retry:function(){h(-1*o)}},h(o))}}else f(n)}}));var y=t.Action.Pop,g=(c=u())[0],b=c[1],k=r(),m=r();return null==g&&(g=0,d.replaceState(n({},d.state,{idx:g}),"")),{get action(){return y},get location(){return b},createHref:l,push:function n(e,r){var o=t.Action.Push,i=s(e,r);if(!m.length||(m.call({action:o,location:i,retry:function(){n(e,r)}}),0)){var a=[{usr:i.state,key:i.key,idx:g+1},l(i)];i=a[0],a=a[1];try{d.pushState(i,"",a)}catch(t){p.location.assign(a)}f(o)}},replace:function n(e,r){var o=t.Action.Replace,i=s(e,r);m.length&&(m.call({action:o,location:i,retry:function(){n(e,r)}}),1)||(i=[{usr:i.state,key:i.key,idx:g},l(i)],d.replaceState(i[0],"",i[1]),f(o))},go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(t){return k.push(t)},block:function(t){var n=m.push(t);return 1===m.length&&p.addEventListener("beforeunload",e),function(){n(),m.length||p.removeEventListener("beforeunload",e)}}}},t.createHashHistory=function(c){function u(){var t=a(d.location.hash.substr(1)),n=t.pathname,e=t.search;t=t.hash;var r=v.state||{};return[r.idx,{pathname:void 0===n?"/":n,search:void 0===e?"":e,hash:void 0===t?"":t,state:r.usr||null,key:r.key||"default"}]}function l(){if(y)P.call(y),y=null;else{var n=t.Action.Pop,e=u(),r=e[0];if(e=e[1],P.length){if(null!=r){var o=b-r;o&&(y={action:n,location:e,retry:function(){p(-1*o)}},p(o))}}else h(n)}}function s(t){var n=document.querySelector("base"),e="";return n&&n.getAttribute("href")&&(e=-1===(e=(n=d.location.href).indexOf("#"))?n:n.slice(0,e)),e+"#"+("string"==typeof t?t:i(t))}function f(t,e){return void 0===e&&(e=null),n({},k,{},"string"==typeof t?a(t):t,{state:e,key:o()})}function h(t){g=t,t=u(),b=t[0],k=t[1],m.call({action:g,location:k})}function p(t){v.go(t)}void 0===c&&(c={});var d=void 0===(c=c.window)?document.defaultView:c,v=d.history,y=null;d.addEventListener("popstate",l),d.addEventListener("hashchange",(function(){i(u()[1])!==i(k)&&l()}));var g=t.Action.Pop,b=(c=u())[0],k=c[1],m=r(),P=r();return null==b&&(b=0,v.replaceState(n({},v.state,{idx:b}),"")),{get action(){return g},get location(){return k},createHref:s,push:function n(e,r){var o=t.Action.Push,i=f(e,r);if(!P.length||(P.call({action:o,location:i,retry:function(){n(e,r)}}),0)){var a=[{usr:i.state,key:i.key,idx:b+1},s(i)];i=a[0],a=a[1];try{v.pushState(i,"",a)}catch(t){d.location.assign(a)}h(o)}},replace:function n(e,r){var o=t.Action.Replace,i=f(e,r);P.length&&(P.call({action:o,location:i,retry:function(){n(e,r)}}),1)||(i=[{usr:i.state,key:i.key,idx:b},s(i)],v.replaceState(i[0],"",i[1]),h(o))},go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(t){return m.push(t)},block:function(t){var n=P.push(t);return 1===P.length&&d.addEventListener("beforeunload",e),function(){n(),P.length||d.removeEventListener("beforeunload",e)}}}},t.createMemoryHistory=function(e){function c(t,e){return void 0===e&&(e=null),n({},v,{},"string"==typeof t?a(t):t,{state:e,key:o()})}function u(t,n,e){return!g.length||(g.call({action:t,location:n,retry:e}),!1)}function l(t,n){d=t,v=n,y.call({action:d,location:v})}function s(n){var e=Math.min(Math.max(p+n,0),h.length-1),r=t.Action.Pop,o=h[e];u(r,o,(function(){s(n)}))&&(p=e,l(r,o))}void 0===e&&(e={});var f=e;e=f.initialEntries,f=f.initialIndex;var h=(void 0===e?["/"]:e).map((function(t){return n({pathname:"/",search:"",hash:"",state:null,key:o()},"string"==typeof t?a(t):t)})),p=Math.min(Math.max(null==f?h.length-1:f,0),h.length-1),d=t.Action.Pop,v=h[p],y=r(),g=r();return{get index(){return p},get action(){return d},get location(){return v},createHref:function(t){return"string"==typeof t?t:i(t)},push:function n(e,r){var o=t.Action.Push,i=c(e,r);u(o,i,(function(){n(e,r)}))&&(p+=1,h.splice(p,h.length,i),l(o,i))},replace:function n(e,r){var o=t.Action.Replace,i=c(e,r);u(o,i,(function(){n(e,r)}))&&(h[p]=i,l(o,i))},go:s,back:function(){s(-1)},forward:function(){s(1)},listen:function(t){return y.push(t)},block:function(t){return g.push(t)}}},t.createPath=i,t.parsePath=a,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=history.production.min.js.map
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