history
Advanced tools
Comparing version 5.0.2 to 5.0.3
function p(){p=Object.assign||function(b){for(var e=1;e<arguments.length;e++){var f=arguments[e],m;for(m in f)Object.prototype.hasOwnProperty.call(f,m)&&(b[m]=f[m])}return b};return p.apply(this,arguments)}var u,x=u||(u={});x.Pop="POP";x.Push="PUSH";x.Replace="REPLACE";var A="production"!==process.env.NODE_ENV?function(b){return Object.freeze(b)}:function(b){return b};function B(b,e){if(!b){"undefined"!==typeof console&&console.warn(e);try{throw Error(e);}catch(f){}}} | ||
function C(b){b.preventDefault();b.returnValue=""}function G(){var b=[];return{get length(){return b.length},push:function(e){b.push(e);return function(){b=b.filter(function(f){return f!==e})}},call:function(e){b.forEach(function(f){return f&&f(e)})}}} | ||
var H=function(b){function e(){var a=q.location,c=r.state||{};return[c.idx,A({pathname:a.pathname,search:a.search,hash:a.hash,state:c.usr||null,key:c.key||"default"})]}function f(a){if("string"===typeof a)var c=a;else{c=a.pathname;var h=a.search;a=a.hash;c=(void 0===c?"/":c)+(void 0===h?"":h)+(void 0===a?"":a)}return c}function m(a,c){void 0===c&&(c=null);var h=p,k=v;if("string"===typeof a){var d={search:""};if(a){var g=a.indexOf("#");0<=g&&(d.hash=a.substr(g),a=a.substr(0,g));g=a.indexOf("?");0<= | ||
g&&(d.search=a.substr(g),a=a.substr(0,g));a&&(d.pathname=a)}a=d}return A(h({},k,a,{state:c,key:Math.random().toString(36).substr(2,8)}))}function y(a){z=a;a=e();n=a[0];v=a[1];D.call({action:z,location:v})}function E(a,c){function h(){E(a,c)}var k=u.Push,d=m(a,c);if(!l.length||(l.call({action:k,location:d,retry:h}),!1)){var g=[{usr:d.state,key:d.key,idx:n+1},f(d)];d=g[0];g=g[1];try{r.pushState(d,"",g)}catch(I){q.location.assign(g)}y(k)}}function F(a,c){function h(){F(a,c)}var k=u.Replace,d=m(a,c); | ||
l.length&&(l.call({action:k,location:d,retry:h}),1)||(d=[{usr:d.state,key:d.key,idx:n},f(d)],r.replaceState(d[0],"",d[1]),y(k))}function t(a){r.go(a)}void 0===b&&(b={});b=b.window;var q=void 0===b?document.defaultView:b,r=q.history,w=null;q.addEventListener("popstate",function(){if(w)l.call(w),w=null;else{var a=u.Pop,c=e(),h=c[0];c=c[1];if(l.length)if(null!=h){var k=n-h;k&&(w={action:a,location:c,retry:function(){t(-1*k)}},t(k))}else"production"!==process.env.NODE_ENV?B(!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."): | ||
var H=function(b){function e(){var a=q.location,c=r.state||{};return[c.idx,A({pathname:a.pathname,search:a.search,hash:a.hash,state:c.usr||null,key:c.key||"default"})]}function f(a){if("string"===typeof a)var c=a;else{c=a.pathname;var h=a.search;a=a.hash;c=(void 0===c?"/":c)+(void 0===h?"":h)+(void 0===a?"":a)}return c}function m(a,c){void 0===c&&(c=null);var h=p,k={pathname:v.pathname,hash:"",search:""};if("string"===typeof a){var d={};if(a){var g=a.indexOf("#");0<=g&&(d.hash=a.substr(g),a=a.substr(0, | ||
g));g=a.indexOf("?");0<=g&&(d.search=a.substr(g),a=a.substr(0,g));a&&(d.pathname=a)}a=d}return A(h(k,a,{state:c,key:Math.random().toString(36).substr(2,8)}))}function y(a){z=a;a=e();n=a[0];v=a[1];D.call({action:z,location:v})}function E(a,c){function h(){E(a,c)}var k=u.Push,d=m(a,c);if(!l.length||(l.call({action:k,location:d,retry:h}),!1)){var g=[{usr:d.state,key:d.key,idx:n+1},f(d)];d=g[0];g=g[1];try{r.pushState(d,"",g)}catch(I){q.location.assign(g)}y(k)}}function F(a,c){function h(){F(a,c)}var k= | ||
u.Replace,d=m(a,c);l.length&&(l.call({action:k,location:d,retry:h}),1)||(d=[{usr:d.state,key:d.key,idx:n},f(d)],r.replaceState(d[0],"",d[1]),y(k))}function t(a){r.go(a)}void 0===b&&(b={});b=b.window;var q=void 0===b?document.defaultView:b,r=q.history,w=null;q.addEventListener("popstate",function(){if(w)l.call(w),w=null;else{var a=u.Pop,c=e(),h=c[0];c=c[1];if(l.length)if(null!=h){var k=n-h;k&&(w={action:a,location:c,retry:function(){t(-1*k)}},t(k))}else"production"!==process.env.NODE_ENV?B(!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 y(a)}});var z=u.Pop;b=e();var n=b[0],v=b[1],D=G(),l=G();null==n&&(n=0,r.replaceState(p({},r.state,{idx:n}),""));return{get action(){return z},get location(){return v},createHref:f,push:E,replace:F,go:t,back:function(){t(-1)},forward:function(){t(1)},listen:function(a){return D.push(a)},block:function(a){var c=l.push(a);1===l.length&&q.addEventListener("beforeunload",C);return function(){c();l.length||q.removeEventListener("beforeunload",C)}}}}();export default H | ||
//# sourceMappingURL=browser.js.map |
10
hash.js
function p(){p=Object.assign||function(a){for(var d=1;d<arguments.length;d++){var e=arguments[d],l;for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&(a[l]=e[l])}return a};return p.apply(this,arguments)}var v,x=v||(v={});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,d){if(!a){"undefined"!==typeof console&&console.warn(d);try{throw Error(d);}catch(e){}}} | ||
function C(a){a.preventDefault();a.returnValue=""}function D(){var a=[];return{get length(){return a.length},push:function(d){a.push(d);return function(){a=a.filter(function(e){return e!==d})}},call:function(d){a.forEach(function(e){return e&&e(d)})}}}function E(a){var d=a.pathname,e=a.search;a=a.hash;return(void 0===d?"/":d)+(void 0===e?"":e)+(void 0===a?"":a)} | ||
function F(a){var d={search:""};if(a){var e=a.indexOf("#");0<=e&&(d.hash=a.substr(e),a=a.substr(0,e));e=a.indexOf("?");0<=e&&(d.search=a.substr(e),a=a.substr(0,e));a&&(d.pathname=a)}return d} | ||
function F(a){var d={};if(a){var e=a.indexOf("#");0<=e&&(d.hash=a.substr(e),a=a.substr(0,e));e=a.indexOf("?");0<=e&&(d.search=a.substr(e),a=a.substr(0,e));a&&(d.pathname=a)}return d} | ||
var K=function(a){function d(){var b=F(m.location.hash.substr(1)),c=b.pathname,g=b.search;b=b.hash;var h=q.state||{};return[h.idx,y({pathname:void 0===c?"/":c,search:void 0===g?"":g,hash:void 0===b?"":b,state:h.usr||null,key:h.key||"default"})]}function e(){if(w)k.call(w),w=null;else{var b=v.Pop,c=d(),g=c[0];c=c[1];if(k.length)if(null!=g){var h=n-g;h&&(w={action:b,location:c,retry:function(){r(-1*h)}},r(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 A(b)}}function l(b){var c=document.querySelector("base"),g="";c&&c.getAttribute("href")&&(c=m.location.href,g=c.indexOf("#"),g=-1===g?c:c.slice(0,g));return g+"#"+("string"===typeof b?b:E(b))}function G(b,c){void 0===c&&(c=null);return y(p({},t,"string"===typeof b?F(b):b,{state:c,key:Math.random().toString(36).substr(2,8)}))}function A(b){B=b;b=d();n=b[0];t=b[1];H.call({action:B,location:t})}function I(b,c){function g(){I(b,c)}var h=v.Push,f=G(b,c);"production"!==process.env.NODE_ENV? | ||
z("/"===f.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(b)+")"):void 0;if(!k.length||(k.call({action:h,location:f,retry:g}),!1)){var u=[{usr:f.state,key:f.key,idx:n+1},l(f)];f=u[0];u=u[1];try{q.pushState(f,"",u)}catch(L){m.location.assign(u)}A(h)}}function J(b,c){function g(){J(b,c)}var h=v.Replace,f=G(b,c);"production"!==process.env.NODE_ENV?z("/"===f.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(b)+ | ||
")"):void 0;k.length&&(k.call({action:h,location:f,retry:g}),1)||(f=[{usr:f.state,key:f.key,idx:n},l(f)],q.replaceState(f[0],"",f[1]),A(h))}function r(b){q.go(b)}void 0===a&&(a={});a=a.window;var m=void 0===a?document.defaultView:a,q=m.history,w=null;m.addEventListener("popstate",e);m.addEventListener("hashchange",function(){var b=d()[1];E(b)!==E(t)&&e()});var B=v.Pop;a=d();var n=a[0],t=a[1],H=D(),k=D();null==n&&(n=0,q.replaceState(p({},q.state,{idx:n}),""));return{get action(){return B},get location(){return t}, | ||
createHref:l,push:I,replace:J,go:r,back:function(){r(-1)},forward:function(){r(1)},listen:function(b){return H.push(b)},block:function(b){var c=k.push(b);1===k.length&&m.addEventListener("beforeunload",C);return function(){c();k.length||m.removeEventListener("beforeunload",C)}}}}();export default K | ||
void 0;else A(b)}}function l(b){var c=document.querySelector("base"),g="";c&&c.getAttribute("href")&&(c=m.location.href,g=c.indexOf("#"),g=-1===g?c:c.slice(0,g));return g+"#"+("string"===typeof b?b:E(b))}function G(b,c){void 0===c&&(c=null);return y(p({pathname:t.pathname,hash:"",search:""},"string"===typeof b?F(b):b,{state:c,key:Math.random().toString(36).substr(2,8)}))}function A(b){B=b;b=d();n=b[0];t=b[1];H.call({action:B,location:t})}function I(b,c){function g(){I(b,c)}var h=v.Push,f=G(b,c);"production"!== | ||
process.env.NODE_ENV?z("/"===f.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(b)+")"):void 0;if(!k.length||(k.call({action:h,location:f,retry:g}),!1)){var u=[{usr:f.state,key:f.key,idx:n+1},l(f)];f=u[0];u=u[1];try{q.pushState(f,"",u)}catch(L){m.location.assign(u)}A(h)}}function J(b,c){function g(){J(b,c)}var h=v.Replace,f=G(b,c);"production"!==process.env.NODE_ENV?z("/"===f.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+ | ||
JSON.stringify(b)+")"):void 0;k.length&&(k.call({action:h,location:f,retry:g}),1)||(f=[{usr:f.state,key:f.key,idx:n},l(f)],q.replaceState(f[0],"",f[1]),A(h))}function r(b){q.go(b)}void 0===a&&(a={});a=a.window;var m=void 0===a?document.defaultView:a,q=m.history,w=null;m.addEventListener("popstate",e);m.addEventListener("hashchange",function(){var b=d()[1];E(b)!==E(t)&&e()});var B=v.Pop;a=d();var n=a[0],t=a[1],H=D(),k=D();null==n&&(n=0,q.replaceState(p({},q.state,{idx:n}),""));return{get action(){return B}, | ||
get location(){return t},createHref:l,push:I,replace:J,go:r,back:function(){r(-1)},forward:function(){r(1)},listen:function(b){return H.push(b)},block:function(b){var c=k.push(b);1===k.length&&m.addEventListener("beforeunload",C);return function(){c();k.length||m.removeEventListener("beforeunload",C)}}}}();export default K | ||
//# sourceMappingURL=hash.js.map |
var p,C=p||(p={});C.Pop="POP";C.Push="PUSH";C.Replace="REPLACE";function D(e,g){if(!e){"undefined"!==typeof console&&console.warn(g);try{throw Error(g);}catch(h){}}}function E(e){e.preventDefault();e.returnValue=""}function F(){let e=[];return{get length(){return e.length},push(g){e.push(g);return function(){e=e.filter(h=>h!==g)}},call(g){e.forEach(h=>h&&h(g))}}}function H(){return Math.random().toString(36).substr(2,8)} | ||
function I({pathname:e="/",search:g="",hash:h=""}){return e+g+h}function J(e){let g={search:""};if(e){var h=e.indexOf("#");0<=h&&(g.hash=e.substr(h),e=e.substr(0,h));h=e.indexOf("?");0<=h&&(g.search=e.substr(h),e=e.substr(0,h));e&&(g.pathname=e)}return g} | ||
function createBrowserHistory(e={}){function g(){let {pathname:b,search:a,hash:d}=q.location,f=k.state||{};return[f.idx,Object.freeze({pathname:b,search:a,hash:d,state:f.usr||null,key:f.key||"default"})]}function h(b){return"string"===typeof b?b:I(b)}function w(b,a=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},r),"string"===typeof b?J(b):b),{state:a,key:H()}))}function z(b){u=b;[n,r]=g();v.call({action:u,location:r})}function A(b,a){function d(){A(b,a)}let f=p.Push, | ||
l=w(b,a);if(!c.length||(c.call({action:f,location:l,retry:d}),!1)){let [t,B]=[{usr:l.state,key:l.key,idx:n+1},h(l)];try{k.pushState(t,"",B)}catch(G){q.location.assign(B)}z(f)}}function x(b,a){function d(){x(b,a)}let f=p.Replace,l=w(b,a);if(!c.length||(c.call({action:f,location:l,retry:d}),!1)){let [t,B]=[{usr:l.state,key:l.key,idx:n},h(l)];k.replaceState(t,"",B);z(f)}}function y(b){k.go(b)}let {window:q=document.defaultView}=e,k=q.history,m=null;q.addEventListener("popstate",function(){if(m)c.call(m), | ||
function I({pathname:e="/",search:g="",hash:h=""}){return e+g+h}function J(e){let g={};if(e){var h=e.indexOf("#");0<=h&&(g.hash=e.substr(h),e=e.substr(0,h));h=e.indexOf("?");0<=h&&(g.search=e.substr(h),e=e.substr(0,h));e&&(g.pathname=e)}return g} | ||
function createBrowserHistory(e={}){function g(){let {pathname:b,search:a,hash:d}=q.location,f=k.state||{};return[f.idx,Object.freeze({pathname:b,search:a,hash:d,state:f.usr||null,key:f.key||"default"})]}function h(b){return"string"===typeof b?b:I(b)}function w(b,a=null){return Object.freeze(Object.assign(Object.assign({pathname:r.pathname,hash:"",search:""},"string"===typeof b?J(b):b),{state:a,key:H()}))}function z(b){u=b;[n,r]=g();v.call({action:u,location:r})}function A(b,a){function d(){A(b, | ||
a)}let f=p.Push,l=w(b,a);if(!c.length||(c.call({action:f,location:l,retry:d}),!1)){let [t,B]=[{usr:l.state,key:l.key,idx:n+1},h(l)];try{k.pushState(t,"",B)}catch(G){q.location.assign(B)}z(f)}}function x(b,a){function d(){x(b,a)}let f=p.Replace,l=w(b,a);if(!c.length||(c.call({action:f,location:l,retry:d}),!1)){let [t,B]=[{usr:l.state,key:l.key,idx:n},h(l)];k.replaceState(t,"",B);z(f)}}function y(b){k.go(b)}let {window:q=document.defaultView}=e,k=q.history,m=null;q.addEventListener("popstate",function(){if(m)c.call(m), | ||
m=null;else{let b=p.Pop,[a,d]=g();if(c.length)if(null!=a){let f=n-a;f&&(m={action:b,location:d,retry(){y(-1*f)}},y(f))}else D(!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 z(b)}});let u=p.Pop,[n,r]=g(),v=F(),c=F();null==n&&(n=0,k.replaceState(Object.assign(Object.assign({}, | ||
k.state),{idx:n}),""));return{get action(){return u},get location(){return r},createHref:h,push:A,replace:x,go:y,back(){y(-1)},forward(){y(1)},listen(b){return v.push(b)},block(b){let a=c.push(b);1===c.length&&q.addEventListener("beforeunload",E);return function(){a();c.length||q.removeEventListener("beforeunload",E)}}}}; | ||
function createHashHistory(e={}){function g(){let {pathname:a="/",search:d="",hash:f=""}=J(k.location.hash.substr(1)),l=m.state||{};return[l.idx,Object.freeze({pathname:a,search:d,hash:f,state:l.usr||null,key:l.key||"default"})]}function h(){if(u)b.call(u),u=null;else{let a=p.Pop,[d,f]=g();if(b.length)if(null!=d){let l=r-d;l&&(u={action:a,location:f,retry(){q(-1*l)}},q(l))}else D(!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 A(a)}}function w(a){var d=document.querySelector("base"),f="";d&&d.getAttribute("href")&&(d=k.location.href,f=d.indexOf("#"),f=-1===f?d:d.slice(0,f));return f+"#"+("string"===typeof a?a:I(a))}function z(a,d=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},v),"string"===typeof a?J(a):a),{state:d,key:H()}))}function A(a){n=a;[r,v]=g();c.call({action:n,location:v})}function x(a,d){function f(){x(a,d)}let l=p.Push,t=z(a,d);D("/"===t.pathname.charAt(0),`Relative pathnames are not supported in hash history.push(${JSON.stringify(a)})`); | ||
else A(a)}}function w(a){var d=document.querySelector("base"),f="";d&&d.getAttribute("href")&&(d=k.location.href,f=d.indexOf("#"),f=-1===f?d:d.slice(0,f));return f+"#"+("string"===typeof a?a:I(a))}function z(a,d=null){return Object.freeze(Object.assign(Object.assign({pathname:v.pathname,hash:"",search:""},"string"===typeof a?J(a):a),{state:d,key:H()}))}function A(a){n=a;[r,v]=g();c.call({action:n,location:v})}function x(a,d){function f(){x(a,d)}let l=p.Push,t=z(a,d);D("/"===t.pathname.charAt(0),`Relative pathnames are not supported in hash history.push(${JSON.stringify(a)})`); | ||
if(!b.length||(b.call({action:l,location:t,retry:f}),!1)){let [B,G]=[{usr:t.state,key:t.key,idx:r+1},w(t)];try{m.pushState(B,"",G)}catch(K){k.location.assign(G)}A(l)}}function y(a,d){function f(){y(a,d)}let l=p.Replace,t=z(a,d);D("/"===t.pathname.charAt(0),`Relative pathnames are not supported in hash history.replace(${JSON.stringify(a)})`);if(!b.length||(b.call({action:l,location:t,retry:f}),!1)){let [B,G]=[{usr:t.state,key:t.key,idx:r},w(t)];m.replaceState(B,"",G);A(l)}}function q(a){m.go(a)}let {window:k= | ||
document.defaultView}=e,m=k.history,u=null;k.addEventListener("popstate",h);k.addEventListener("hashchange",()=>{let [,a]=g();I(a)!==I(v)&&h()});let n=p.Pop,[r,v]=g(),c=F(),b=F();null==r&&(r=0,m.replaceState(Object.assign(Object.assign({},m.state),{idx:r}),""));return{get action(){return n},get location(){return v},createHref:w,push:x,replace:y,go:q,back(){q(-1)},forward(){q(1)},listen(a){return c.push(a)},block(a){let d=b.push(a);1===b.length&&k.addEventListener("beforeunload",E);return function(){d(); | ||
b.length||k.removeEventListener("beforeunload",E)}}}}; | ||
function createMemoryHistory(e={}){function g(c,b=null){return Object.freeze(Object.assign(Object.assign(Object.assign({},n),"string"===typeof c?J(c):c),{state:b,key:H()}))}function h(c,b,a){return!v.length||(v.call({action:c,location:b,retry:a}),!1)}function w(c,b){u=c;n=b;r.call({action:u,location:n})}function z(c,b){let a=p.Push,d=g(c,b);D("/"===n.pathname.charAt(0),`Relative pathnames are not supported in memory history.push(${JSON.stringify(c)})`);h(a,d,function(){z(c,b)})&&(m+=1,k.splice(m, | ||
k.length,d),w(a,d))}function A(c,b){let a=p.Replace,d=g(c,b);D("/"===n.pathname.charAt(0),`Relative pathnames are not supported in memory history.replace(${JSON.stringify(c)})`);h(a,d,function(){A(c,b)})&&(k[m]=d,w(a,d))}function x(c){let b=Math.min(Math.max(m+c,0),k.length-1),a=p.Pop,d=k[b];h(a,d,function(){x(c)})&&(m=b,w(a,d))}let {initialEntries:y=["/"],initialIndex:q}=e,k=y.map(c=>{let b=Object.freeze(Object.assign({pathname:"/",search:"",hash:"",state:null,key:H()},"string"===typeof c?J(c):c)); | ||
D("/"===b.pathname.charAt(0),`Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: ${JSON.stringify(c)})`);return b}),m=Math.min(Math.max(null==q?k.length-1:q,0),k.length-1),u=p.Pop,n=k[m],r=F(),v=F();return{get index(){return m},get action(){return u},get location(){return n},createHref:function(c){return"string"===typeof c?c:I(c)},push:z,replace:A,go:x,back(){x(-1)},forward(){x(1)},listen(c){return r.push(c)},block(c){return v.push(c)}}}; | ||
function createMemoryHistory(e={}){function g(c,b=null){return Object.freeze(Object.assign(Object.assign({pathname:n.pathname,search:"",hash:""},"string"===typeof c?J(c):c),{state:b,key:H()}))}function h(c,b,a){return!v.length||(v.call({action:c,location:b,retry:a}),!1)}function w(c,b){u=c;n=b;r.call({action:u,location:n})}function z(c,b){let a=p.Push,d=g(c,b);D("/"===n.pathname.charAt(0),`Relative pathnames are not supported in memory history.push(${JSON.stringify(c)})`);h(a,d,function(){z(c, | ||
b)})&&(m+=1,k.splice(m,k.length,d),w(a,d))}function A(c,b){let a=p.Replace,d=g(c,b);D("/"===n.pathname.charAt(0),`Relative pathnames are not supported in memory history.replace(${JSON.stringify(c)})`);h(a,d,function(){A(c,b)})&&(k[m]=d,w(a,d))}function x(c){let b=Math.min(Math.max(m+c,0),k.length-1),a=p.Pop,d=k[b];h(a,d,function(){x(c)})&&(m=b,w(a,d))}let {initialEntries:y=["/"],initialIndex:q}=e,k=y.map(c=>{let b=Object.freeze(Object.assign({pathname:"/",search:"",hash:"",state:null,key:H()},"string"=== | ||
typeof c?J(c):c));D("/"===b.pathname.charAt(0),`Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: ${JSON.stringify(c)})`);return b}),m=Math.min(Math.max(null==q?k.length-1:q,0),k.length-1),u=p.Pop,n=k[m],r=F(),v=F();return{get index(){return m},get action(){return u},get location(){return n},createHref:function(c){return"string"===typeof c?c:I(c)},push:z,replace:A,go:x,back(){x(-1)},forward(){x(1)},listen(c){return r.push(c)},block(c){return v.push(c)}}}; | ||
export{p as Action,createBrowserHistory,createHashHistory,createMemoryHistory,I as createPath,J 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 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={search:""};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}=f.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 h(t){g.go(t)}let{window:f=document.defaultView}=e,g=f.history,p=null;f.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(){h(-1*t)}},h(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){f.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:h,back(){h(-1)},forward(){h(1)},listen:t=>k.push(t),block(t){let e=m.push(t);return 1===m.length&&f.addEventListener("beforeunload",n),function(){e(),m.length||f.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(){f(-1*t)}},f(t))}}else h(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)),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 h(t){y=t,[b,k]=o(),m.call({action:y,location:k})}function f(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)}h(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),h(l)}},go:f,back(){f(-1)},forward(){f(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),f.length-1),a=t.Pop,l=f[n];o(a,l,(function(){s(e)}))&&(g=n,c(a,l))}let{initialEntries:u=["/"],initialIndex:h}=e,f=u.map((t=>Object.assign({pathname:"/",search:"",hash:"",state:null,key:l()},"string"==typeof t?r(t):t))),g=Math.min(Math.max(null==h?f.length-1:h,0),f.length-1),p=t.Pop,d=f[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,f.splice(g,f.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)}))&&(f[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}; | ||
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 r({pathname:t="/",search:e="",hash:n=""}){return t+e+n}function i(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}=f.location,a=p.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:r(t)}function s(t,e=null){return Object.assign(Object.assign({pathname:b.pathname,hash:"",search:""},"string"==typeof t?i(t):t),{state:e,key:l()})}function u(t){d=t,[y,b]=o(),m.call({action:d,location:b})}function h(t){p.go(t)}let{window:f=document.defaultView}=e,p=f.history,g=null;f.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=y-n;t&&(g={action:e,location:a,retry(){h(-1*t)}},h(t))}}else u(e)}}));let d=t.Pop,[y,b]=o(),m=a(),k=a();return null==y&&(y=0,p.replaceState(Object.assign(Object.assign({},p.state),{idx:y}),"")),{get action(){return d},get location(){return b},createHref:c,push:function e(n,a){let l=t.Push,r=s(n,a);if(!k.length||(k.call({action:l,location:r,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:r.state,key:r.key,idx:y+1},c(r)];try{p.pushState(t,"",e)}catch(i){f.location.assign(e)}u(l)}},replace:function e(n,a){let l=t.Replace,r=s(n,a);if(!k.length||(k.call({action:l,location:r,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:r.state,key:r.key,idx:y},c(r)];p.replaceState(t,"",e),u(l)}},go:h,back(){h(-1)},forward(){h(1)},listen:t=>m.push(t),block(t){let e=k.push(t);return 1===k.length&&f.addEventListener("beforeunload",n),function(){e(),k.length||f.removeEventListener("beforeunload",n)}}}}function c(e={}){function o(){let{pathname:t="/",search:e="",hash:n=""}=i(p.location.hash.substr(1)),a=g.state||{};return[a.idx,{pathname:t,search:e,hash:n,state:a.usr||null,key:a.key||"default"}]}function c(){if(d)P.call(d),d=null;else{let e=t.Pop,[n,a]=o();if(P.length){if(null!=n){let t=b-n;t&&(d={action:e,location:a,retry(){f(-1*t)}},f(t))}}else h(e)}}function s(t){var e=document.querySelector("base"),n="";return e&&e.getAttribute("href")&&(n=-1===(n=(e=p.location.href).indexOf("#"))?e:e.slice(0,n)),n+"#"+("string"==typeof t?t:r(t))}function u(t,e=null){return Object.assign(Object.assign({pathname:m.pathname,hash:"",search:""},"string"==typeof t?i(t):t),{state:e,key:l()})}function h(t){y=t,[b,m]=o(),k.call({action:y,location:m})}function f(t){g.go(t)}let{window:p=document.defaultView}=e,g=p.history,d=null;p.addEventListener("popstate",c),p.addEventListener("hashchange",(()=>{let[,t]=o();r(t)!==r(m)&&c()}));let y=t.Pop,[b,m]=o(),k=a(),P=a();return null==b&&(b=0,g.replaceState(Object.assign(Object.assign({},g.state),{idx:b}),"")),{get action(){return y},get location(){return m},createHref:s,push:function e(n,a){let l=t.Push,r=u(n,a);if(!P.length||(P.call({action:l,location:r,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:r.state,key:r.key,idx:b+1},s(r)];try{g.pushState(t,"",e)}catch(i){p.location.assign(e)}h(l)}},replace:function e(n,a){let l=t.Replace,r=u(n,a);if(!P.length||(P.call({action:l,location:r,retry:function(){e(n,a)}}),0)){let[t,e]=[{usr:r.state,key:r.key,idx:b},s(r)];g.replaceState(t,"",e),h(l)}},go:f,back(){f(-1)},forward(){f(1)},listen:t=>k.push(t),block(t){let e=P.push(t);return 1===P.length&&p.addEventListener("beforeunload",n),function(){e(),P.length||p.removeEventListener("beforeunload",n)}}}}function s(e={}){function n(t,e=null){return Object.assign(Object.assign({pathname:d.pathname,search:"",hash:""},"string"==typeof t?i(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){g=t,d=e,y.call({action:g,location:d})}function s(e){let n=Math.min(Math.max(p+e,0),f.length-1),a=t.Pop,l=f[n];o(a,l,(function(){s(e)}))&&(p=n,c(a,l))}let{initialEntries:u=["/"],initialIndex:h}=e,f=u.map((t=>Object.assign({pathname:"/",search:"",hash:"",state:null,key:l()},"string"==typeof t?i(t):t))),p=Math.min(Math.max(null==h?f.length-1:h,0),f.length-1),g=t.Pop,d=f[p],y=a(),b=a();return{get index(){return p},get action(){return g},get location(){return d},createHref:function(t){return"string"==typeof t?t:r(t)},push:function e(a,l){let r=t.Push,i=n(a,l);o(r,i,(function(){e(a,l)}))&&(p+=1,f.splice(p,f.length,i),c(r,i))},replace:function e(a,l){let r=t.Replace,i=n(a,l);o(r,i,(function(){e(a,l)}))&&(f[p]=i,c(r,i))},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,r as createPath,i as parsePath}; | ||
//# sourceMappingURL=history.production.min.js.map |
26
index.js
import _extends from'@babel/runtime/helpers/esm/extends';var r,B=r||(r={});B.Pop="POP";B.Push="PUSH";B.Replace="REPLACE";var C="production"!==process.env.NODE_ENV?function(b){return Object.freeze(b)}:function(b){return b};function D(b,h){if(!b){"undefined"!==typeof console&&console.warn(h);try{throw Error(h);}catch(k){}}}function E(b){b.preventDefault();b.returnValue=""} | ||
function F(){var b=[];return{get length(){return b.length},push:function(h){b.push(h);return function(){b=b.filter(function(k){return k!==h})}},call:function(h){b.forEach(function(k){return k&&k(h)})}}}function H(){return Math.random().toString(36).substr(2,8)}function I(b){var h=b.pathname,k=b.search;b=b.hash;return(void 0===h?"/":h)+(void 0===k?"":k)+(void 0===b?"":b)} | ||
function J(b){var h={search:""};if(b){var k=b.indexOf("#");0<=k&&(h.hash=b.substr(k),b=b.substr(0,k));k=b.indexOf("?");0<=k&&(h.search=b.substr(k),b=b.substr(0,k));b&&(h.pathname=b)}return h} | ||
function createBrowserHistory(b){function h(){var c=p.location,a=m.state||{};return[a.idx,C({pathname:c.pathname,search:c.search,hash:c.hash,state:a.usr||null,key:a.key||"default"})]}function k(c){return"string"===typeof c?c:I(c)}function x(c,a){void 0===a&&(a=null);return C(_extends({},q,"string"===typeof c?J(c):c,{state:a,key:H()}))}function z(c){t=c;c=h();v=c[0];q=c[1];d.call({action:t,location:q})}function A(c,a){function e(){A(c,a)}var l=r.Push,g=x(c,a);if(!f.length||(f.call({action:l, | ||
location:g,retry:e}),!1)){var n=[{usr:g.state,key:g.key,idx:v+1},k(g)];g=n[0];n=n[1];try{m.pushState(g,"",n)}catch(G){p.location.assign(n)}z(l)}}function y(c,a){function e(){y(c,a)}var l=r.Replace,g=x(c,a);f.length&&(f.call({action:l,location:g,retry:e}),1)||(g=[{usr:g.state,key:g.key,idx:v},k(g)],m.replaceState(g[0],"",g[1]),z(l))}function w(c){m.go(c)}void 0===b&&(b={});b=b.window;var p=void 0===b?document.defaultView:b,m=p.history,u=null;p.addEventListener("popstate",function(){if(u)f.call(u), | ||
u=null;else{var c=r.Pop,a=h(),e=a[0];a=a[1];if(f.length)if(null!=e){var l=v-e;l&&(u={action:c,location:a,retry:function(){w(-1*l)}},w(l))}else"production"!==process.env.NODE_ENV?D(!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 z(c)}});var t= | ||
r.Pop;b=h();var v=b[0],q=b[1],d=F(),f=F();null==v&&(v=0,m.replaceState(_extends({},m.state,{idx:v}),""));return{get action(){return t},get location(){return q},createHref:k,push:A,replace:y,go:w,back:function(){w(-1)},forward:function(){w(1)},listen:function(c){return d.push(c)},block:function(c){var a=f.push(c);1===f.length&&p.addEventListener("beforeunload",E);return function(){a();f.length||p.removeEventListener("beforeunload",E)}}}}; | ||
function J(b){var h={};if(b){var k=b.indexOf("#");0<=k&&(h.hash=b.substr(k),b=b.substr(0,k));k=b.indexOf("?");0<=k&&(h.search=b.substr(k),b=b.substr(0,k));b&&(h.pathname=b)}return h} | ||
function createBrowserHistory(b){function h(){var c=p.location,a=m.state||{};return[a.idx,C({pathname:c.pathname,search:c.search,hash:c.hash,state:a.usr||null,key:a.key||"default"})]}function k(c){return"string"===typeof c?c:I(c)}function x(c,a){void 0===a&&(a=null);return C(_extends({pathname:q.pathname,hash:"",search:""},"string"===typeof c?J(c):c,{state:a,key:H()}))}function z(c){t=c;c=h();v=c[0];q=c[1];d.call({action:t,location:q})}function A(c,a){function e(){A(c,a)}var l=r.Push,g=x(c, | ||
a);if(!f.length||(f.call({action:l,location:g,retry:e}),!1)){var n=[{usr:g.state,key:g.key,idx:v+1},k(g)];g=n[0];n=n[1];try{m.pushState(g,"",n)}catch(G){p.location.assign(n)}z(l)}}function y(c,a){function e(){y(c,a)}var l=r.Replace,g=x(c,a);f.length&&(f.call({action:l,location:g,retry:e}),1)||(g=[{usr:g.state,key:g.key,idx:v},k(g)],m.replaceState(g[0],"",g[1]),z(l))}function w(c){m.go(c)}void 0===b&&(b={});b=b.window;var p=void 0===b?document.defaultView:b,m=p.history,u=null;p.addEventListener("popstate", | ||
function(){if(u)f.call(u),u=null;else{var c=r.Pop,a=h(),e=a[0];a=a[1];if(f.length)if(null!=e){var l=v-e;l&&(u={action:c,location:a,retry:function(){w(-1*l)}},w(l))}else"production"!==process.env.NODE_ENV?D(!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 z(c)}});var t=r.Pop;b=h();var v=b[0],q=b[1],d=F(),f=F();null==v&&(v=0,m.replaceState(_extends({},m.state,{idx:v}),""));return{get action(){return t},get location(){return q},createHref:k,push:A,replace:y,go:w,back:function(){w(-1)},forward:function(){w(1)},listen:function(c){return d.push(c)},block:function(c){var a=f.push(c);1===f.length&&p.addEventListener("beforeunload",E);return function(){a();f.length||p.removeEventListener("beforeunload",E)}}}}; | ||
function createHashHistory(b){function h(){var a=J(m.location.hash.substr(1)),e=a.pathname,l=a.search;a=a.hash;var g=u.state||{};return[g.idx,C({pathname:void 0===e?"/":e,search:void 0===l?"":l,hash:void 0===a?"":a,state:g.usr||null,key:g.key||"default"})]}function k(){if(t)c.call(t),t=null;else{var a=r.Pop,e=h(),l=e[0];e=e[1];if(c.length)if(null!=l){var g=q-l;g&&(t={action:a,location:e,retry:function(){p(-1*g)}},p(g))}else"production"!==process.env.NODE_ENV?D(!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 A(a)}}function x(a){var e=document.querySelector("base"),l="";e&&e.getAttribute("href")&&(e=m.location.href,l=e.indexOf("#"),l=-1===l?e:e.slice(0,l));return l+"#"+("string"===typeof a?a:I(a))}function z(a,e){void 0===e&&(e=null);return C(_extends({},d,"string"===typeof a?J(a):a,{state:e,key:H()}))}function A(a){v=a;a=h();q=a[0];d=a[1];f.call({action:v,location:d})}function y(a,e){function l(){y(a,e)}var g=r.Push,n=z(a,e);"production"!==process.env.NODE_ENV?D("/"===n.pathname.charAt(0), | ||
"Relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")"):void 0;if(!c.length||(c.call({action:g,location:n,retry:l}),!1)){var G=[{usr:n.state,key:n.key,idx:q+1},x(n)];n=G[0];G=G[1];try{u.pushState(n,"",G)}catch(K){m.location.assign(G)}A(g)}}function w(a,e){function l(){w(a,e)}var g=r.Replace,n=z(a,e);"production"!==process.env.NODE_ENV?D("/"===n.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")"):void 0;c.length&&(c.call({action:g, | ||
location:n,retry:l}),1)||(n=[{usr:n.state,key:n.key,idx:q},x(n)],u.replaceState(n[0],"",n[1]),A(g))}function p(a){u.go(a)}void 0===b&&(b={});b=b.window;var m=void 0===b?document.defaultView:b,u=m.history,t=null;m.addEventListener("popstate",k);m.addEventListener("hashchange",function(){var a=h()[1];I(a)!==I(d)&&k()});var v=r.Pop;b=h();var q=b[0],d=b[1],f=F(),c=F();null==q&&(q=0,u.replaceState(_extends({},u.state,{idx:q}),""));return{get action(){return v},get location(){return d},createHref:x,push:y, | ||
replace:w,go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(a){return f.push(a)},block:function(a){var e=c.push(a);1===c.length&&m.addEventListener("beforeunload",E);return function(){e();c.length||m.removeEventListener("beforeunload",E)}}}}; | ||
function createMemoryHistory(b){function h(d,f){void 0===f&&(f=null);return C(_extends({},t,"string"===typeof d?J(d):d,{state:f,key:H()}))}function k(d,f,c){return!q.length||(q.call({action:d,location:f,retry:c}),!1)}function x(d,f){u=d;t=f;v.call({action:u,location:t})}function z(d,f){var c=r.Push,a=h(d,f);"production"!==process.env.NODE_ENV?D("/"===t.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")"):void 0;k(c,a,function(){z(d,f)})&& | ||
(m+=1,p.splice(m,p.length,a),x(c,a))}function A(d,f){var c=r.Replace,a=h(d,f);"production"!==process.env.NODE_ENV?D("/"===t.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")"):void 0;k(c,a,function(){A(d,f)})&&(p[m]=a,x(c,a))}function y(d){var f=Math.min(Math.max(m+d,0),p.length-1),c=r.Pop,a=p[f];k(c,a,function(){y(d)})&&(m=f,x(c,a))}void 0===b&&(b={});var w=b;b=w.initialEntries;w=w.initialIndex;var p=(void 0===b?["/"]:b).map(function(d){var f= | ||
C(_extends({pathname:"/",search:"",hash:"",state:null,key:H()},"string"===typeof d?J(d):d));"production"!==process.env.NODE_ENV?D("/"===f.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")"):void 0;return f}),m=Math.min(Math.max(null==w?p.length-1:w,0),p.length-1),u=r.Pop,t=p[m],v=F(),q=F();return{get index(){return m},get action(){return u},get location(){return t},createHref:function(d){return"string"===typeof d? | ||
d:I(d)},push:z,replace:A,go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(d){return v.push(d)},block:function(d){return q.push(d)}}};export{r as Action,createBrowserHistory,createHashHistory,createMemoryHistory,I as createPath,J as parsePath} | ||
void 0;else A(a)}}function x(a){var e=document.querySelector("base"),l="";e&&e.getAttribute("href")&&(e=m.location.href,l=e.indexOf("#"),l=-1===l?e:e.slice(0,l));return l+"#"+("string"===typeof a?a:I(a))}function z(a,e){void 0===e&&(e=null);return C(_extends({pathname:d.pathname,hash:"",search:""},"string"===typeof a?J(a):a,{state:e,key:H()}))}function A(a){v=a;a=h();q=a[0];d=a[1];f.call({action:v,location:d})}function y(a,e){function l(){y(a,e)}var g=r.Push,n=z(a,e);"production"!==process.env.NODE_ENV? | ||
D("/"===n.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")"):void 0;if(!c.length||(c.call({action:g,location:n,retry:l}),!1)){var G=[{usr:n.state,key:n.key,idx:q+1},x(n)];n=G[0];G=G[1];try{u.pushState(n,"",G)}catch(K){m.location.assign(G)}A(g)}}function w(a,e){function l(){w(a,e)}var g=r.Replace,n=z(a,e);"production"!==process.env.NODE_ENV?D("/"===n.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+ | ||
")"):void 0;c.length&&(c.call({action:g,location:n,retry:l}),1)||(n=[{usr:n.state,key:n.key,idx:q},x(n)],u.replaceState(n[0],"",n[1]),A(g))}function p(a){u.go(a)}void 0===b&&(b={});b=b.window;var m=void 0===b?document.defaultView:b,u=m.history,t=null;m.addEventListener("popstate",k);m.addEventListener("hashchange",function(){var a=h()[1];I(a)!==I(d)&&k()});var v=r.Pop;b=h();var q=b[0],d=b[1],f=F(),c=F();null==q&&(q=0,u.replaceState(_extends({},u.state,{idx:q}),""));return{get action(){return v},get location(){return d}, | ||
createHref:x,push:y,replace:w,go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(a){return f.push(a)},block:function(a){var e=c.push(a);1===c.length&&m.addEventListener("beforeunload",E);return function(){e();c.length||m.removeEventListener("beforeunload",E)}}}}; | ||
function createMemoryHistory(b){function h(d,f){void 0===f&&(f=null);return C(_extends({pathname:t.pathname,search:"",hash:""},"string"===typeof d?J(d):d,{state:f,key:H()}))}function k(d,f,c){return!q.length||(q.call({action:d,location:f,retry:c}),!1)}function x(d,f){u=d;t=f;v.call({action:u,location:t})}function z(d,f){var c=r.Push,a=h(d,f);"production"!==process.env.NODE_ENV?D("/"===t.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")"): | ||
void 0;k(c,a,function(){z(d,f)})&&(m+=1,p.splice(m,p.length,a),x(c,a))}function A(d,f){var c=r.Replace,a=h(d,f);"production"!==process.env.NODE_ENV?D("/"===t.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")"):void 0;k(c,a,function(){A(d,f)})&&(p[m]=a,x(c,a))}function y(d){var f=Math.min(Math.max(m+d,0),p.length-1),c=r.Pop,a=p[f];k(c,a,function(){y(d)})&&(m=f,x(c,a))}void 0===b&&(b={});var w=b;b=w.initialEntries;w=w.initialIndex;var p=(void 0=== | ||
b?["/"]:b).map(function(d){var f=C(_extends({pathname:"/",search:"",hash:"",state:null,key:H()},"string"===typeof d?J(d):d));"production"!==process.env.NODE_ENV?D("/"===f.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")"):void 0;return f}),m=Math.min(Math.max(null==w?p.length-1:w,0),p.length-1),u=r.Pop,t=p[m],v=F(),q=F();return{get index(){return m},get action(){return u},get location(){return t},createHref:function(d){return"string"=== | ||
typeof d?d:I(d)},push:z,replace:A,go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(d){return v.push(d)},block:function(d){return q.push(d)}}};export{r as Action,createBrowserHistory,createHashHistory,createMemoryHistory,I as createPath,J as parsePath} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "history", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Manage session history with JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "React Training <hello@reacttraining.com>", |
'use strict';(function(l,y){"object"===typeof exports&&"undefined"!==typeof module?y(exports):"function"===typeof define&&define.amd?define(["exports"],y):(l="undefined"!==typeof globalThis?globalThis:l||self,y(l.HistoryLibrary={}))})(this,function(l){function y(){y=Object.assign||function(b){for(var g=1;g<arguments.length;g++){var h=arguments[g],t;for(t in h)Object.prototype.hasOwnProperty.call(h,t)&&(b[t]=h[t])}return b};return y.apply(this,arguments)}function C(b,g){if(!b){"undefined"!==typeof console&& | ||
console.warn(g);try{throw Error(g);}catch(h){}}}function H(b){b.preventDefault();b.returnValue=""}function D(){var b=[];return{get length(){return b.length},push:function(g){b.push(g);return function(){b=b.filter(function(h){return h!==g})}},call:function(g){b.forEach(function(h){return h&&h(g)})}}}function I(){return Math.random().toString(36).substr(2,8)}function E(b){var g=b.pathname,h=b.search;b=b.hash;return(void 0===g?"/":g)+(void 0===h?"":h)+(void 0===b?"":b)}function F(b){var g={search:""}; | ||
if(b){var h=b.indexOf("#");0<=h&&(g.hash=b.substr(h),b=b.substr(0,h));h=b.indexOf("?");0<=h&&(g.search=b.substr(h),b=b.substr(0,h));b&&(g.pathname=b)}return g}l.Action=void 0;(function(b){b.Pop="POP";b.Push="PUSH";b.Replace="REPLACE"})(l.Action||(l.Action={}));l.createBrowserHistory=function(b){function g(){var c=q.location,a=n.state||{};return[a.idx,Object.freeze({pathname:c.pathname,search:c.search,hash:c.hash,state:a.usr||null,key:a.key||"default"})]}function h(c){return"string"===typeof c?c:E(c)} | ||
function t(c,a){void 0===a&&(a=null);return Object.freeze(y({},r,"string"===typeof c?F(c):c,{state:a,key:I()}))}function A(c){u=c;c=g();w=c[0];r=c[1];d.call({action:u,location:r})}function B(c,a){function e(){B(c,a)}var m=l.Action.Push,k=t(c,a);if(!f.length||(f.call({action:m,location:k,retry:e}),!1)){var p=[{usr:k.state,key:k.key,idx:w+1},h(k)];k=p[0];p=p[1];try{n.pushState(k,"",p)}catch(G){q.location.assign(p)}A(m)}}function z(c,a){function e(){z(c,a)}var m=l.Action.Replace,k=t(c,a);f.length&&(f.call({action:m, | ||
location:k,retry:e}),1)||(k=[{usr:k.state,key:k.key,idx:w},h(k)],n.replaceState(k[0],"",k[1]),A(m))}function x(c){n.go(c)}void 0===b&&(b={});b=b.window;var q=void 0===b?document.defaultView:b,n=q.history,v=null;q.addEventListener("popstate",function(){if(v)f.call(v),v=null;else{var c=l.Action.Pop,a=g(),e=a[0];a=a[1];if(f.length)if(null!=e){var m=w-e;m&&(v={action:c,location:a,retry:function(){x(-1*m)}},x(m))}else C(!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."); | ||
console.warn(g);try{throw Error(g);}catch(h){}}}function H(b){b.preventDefault();b.returnValue=""}function D(){var b=[];return{get length(){return b.length},push:function(g){b.push(g);return function(){b=b.filter(function(h){return h!==g})}},call:function(g){b.forEach(function(h){return h&&h(g)})}}}function I(){return Math.random().toString(36).substr(2,8)}function E(b){var g=b.pathname,h=b.search;b=b.hash;return(void 0===g?"/":g)+(void 0===h?"":h)+(void 0===b?"":b)}function F(b){var g={};if(b){var h= | ||
b.indexOf("#");0<=h&&(g.hash=b.substr(h),b=b.substr(0,h));h=b.indexOf("?");0<=h&&(g.search=b.substr(h),b=b.substr(0,h));b&&(g.pathname=b)}return g}l.Action=void 0;(function(b){b.Pop="POP";b.Push="PUSH";b.Replace="REPLACE"})(l.Action||(l.Action={}));l.createBrowserHistory=function(b){function g(){var c=q.location,a=n.state||{};return[a.idx,Object.freeze({pathname:c.pathname,search:c.search,hash:c.hash,state:a.usr||null,key:a.key||"default"})]}function h(c){return"string"===typeof c?c:E(c)}function t(c, | ||
a){void 0===a&&(a=null);return Object.freeze(y({pathname:r.pathname,hash:"",search:""},"string"===typeof c?F(c):c,{state:a,key:I()}))}function A(c){u=c;c=g();w=c[0];r=c[1];d.call({action:u,location:r})}function B(c,a){function e(){B(c,a)}var m=l.Action.Push,k=t(c,a);if(!f.length||(f.call({action:m,location:k,retry:e}),!1)){var p=[{usr:k.state,key:k.key,idx:w+1},h(k)];k=p[0];p=p[1];try{n.pushState(k,"",p)}catch(G){q.location.assign(p)}A(m)}}function z(c,a){function e(){z(c,a)}var m=l.Action.Replace, | ||
k=t(c,a);f.length&&(f.call({action:m,location:k,retry:e}),1)||(k=[{usr:k.state,key:k.key,idx:w},h(k)],n.replaceState(k[0],"",k[1]),A(m))}function x(c){n.go(c)}void 0===b&&(b={});b=b.window;var q=void 0===b?document.defaultView:b,n=q.history,v=null;q.addEventListener("popstate",function(){if(v)f.call(v),v=null;else{var c=l.Action.Pop,a=g(),e=a[0];a=a[1];if(f.length)if(null!=e){var m=w-e;m&&(v={action:c,location:a,retry:function(){x(-1*m)}},x(m))}else C(!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 A(c)}});var u=l.Action.Pop;b=g();var w=b[0],r=b[1],d=D(),f=D();null==w&&(w=0,n.replaceState(y({},n.state,{idx:w}),""));return{get action(){return u},get location(){return r},createHref:h,push:B,replace:z,go:x,back:function(){x(-1)},forward:function(){x(1)},listen:function(c){return d.push(c)},block:function(c){var a=f.push(c);1===f.length&&q.addEventListener("beforeunload",H);return function(){a();f.length||q.removeEventListener("beforeunload",H)}}}};l.createHashHistory=function(b){function g(){var a= | ||
F(n.location.hash.substr(1)),e=a.pathname,m=a.search;a=a.hash;var k=v.state||{};return[k.idx,Object.freeze({pathname:void 0===e?"/":e,search:void 0===m?"":m,hash:void 0===a?"":a,state:k.usr||null,key:k.key||"default"})]}function h(){if(u)c.call(u),u=null;else{var a=l.Action.Pop,e=g(),m=e[0];e=e[1];if(c.length)if(null!=m){var k=r-m;k&&(u={action:a,location:e,retry:function(){q(-1*k)}},q(k))}else C(!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 B(a)}}function t(a){var e=document.querySelector("base"),m="";e&&e.getAttribute("href")&&(e=n.location.href,m=e.indexOf("#"),m=-1===m?e:e.slice(0,m));return m+"#"+("string"===typeof a?a:E(a))}function A(a,e){void 0===e&&(e=null);return Object.freeze(y({},d,"string"===typeof a?F(a):a,{state:e,key:I()}))}function B(a){w=a;a=g();r=a[0];d=a[1];f.call({action:w,location:d})}function z(a,e){function m(){z(a,e)}var k=l.Action.Push,p=A(a,e);C("/"===p.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+ | ||
JSON.stringify(a)+")");if(!c.length||(c.call({action:k,location:p,retry:m}),!1)){var G=[{usr:p.state,key:p.key,idx:r+1},t(p)];p=G[0];G=G[1];try{v.pushState(p,"",G)}catch(J){n.location.assign(G)}B(k)}}function x(a,e){function m(){x(a,e)}var k=l.Action.Replace,p=A(a,e);C("/"===p.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")");c.length&&(c.call({action:k,location:p,retry:m}),1)||(p=[{usr:p.state,key:p.key,idx:r},t(p)],v.replaceState(p[0],"",p[1]), | ||
B(k))}function q(a){v.go(a)}void 0===b&&(b={});b=b.window;var n=void 0===b?document.defaultView:b,v=n.history,u=null;n.addEventListener("popstate",h);n.addEventListener("hashchange",function(){var a=g()[1];E(a)!==E(d)&&h()});var w=l.Action.Pop;b=g();var r=b[0],d=b[1],f=D(),c=D();null==r&&(r=0,v.replaceState(y({},v.state,{idx:r}),""));return{get action(){return w},get location(){return d},createHref:t,push:z,replace:x,go:q,back:function(){q(-1)},forward:function(){q(1)},listen:function(a){return f.push(a)}, | ||
block:function(a){var e=c.push(a);1===c.length&&n.addEventListener("beforeunload",H);return function(){e();c.length||n.removeEventListener("beforeunload",H)}}}};l.createMemoryHistory=function(b){function g(d,f){void 0===f&&(f=null);return Object.freeze(y({},u,"string"===typeof d?F(d):d,{state:f,key:I()}))}function h(d,f,c){return!r.length||(r.call({action:d,location:f,retry:c}),!1)}function t(d,f){v=d;u=f;w.call({action:v,location:u})}function A(d,f){var c=l.Action.Push,a=g(d,f);C("/"===u.pathname.charAt(0), | ||
"Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")");h(c,a,function(){A(d,f)})&&(n+=1,q.splice(n,q.length,a),t(c,a))}function B(d,f){var c=l.Action.Replace,a=g(d,f);C("/"===u.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")");h(c,a,function(){B(d,f)})&&(q[n]=a,t(c,a))}function z(d){var f=Math.min(Math.max(n+d,0),q.length-1),c=l.Action.Pop,a=q[f];h(c,a,function(){z(d)})&&(n=f,t(c,a))}void 0===b&&(b={});var x= | ||
b;b=x.initialEntries;x=x.initialIndex;var q=(void 0===b?["/"]:b).map(function(d){var f=Object.freeze(y({pathname:"/",search:"",hash:"",state:null,key:I()},"string"===typeof d?F(d):d));C("/"===f.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")");return f}),n=Math.min(Math.max(null==x?q.length-1:x,0),q.length-1),v=l.Action.Pop,u=q[n],w=D(),r=D();return{get index(){return n},get action(){return v},get location(){return u}, | ||
createHref:function(d){return"string"===typeof d?d:E(d)},push:A,replace:B,go:z,back:function(){z(-1)},forward:function(){z(1)},listen:function(d){return w.push(d)},block:function(d){return r.push(d)}}};l.createPath=E;l.parsePath=F;Object.defineProperty(l,"__esModule",{value:!0})}) | ||
else B(a)}}function t(a){var e=document.querySelector("base"),m="";e&&e.getAttribute("href")&&(e=n.location.href,m=e.indexOf("#"),m=-1===m?e:e.slice(0,m));return m+"#"+("string"===typeof a?a:E(a))}function A(a,e){void 0===e&&(e=null);return Object.freeze(y({pathname:d.pathname,hash:"",search:""},"string"===typeof a?F(a):a,{state:e,key:I()}))}function B(a){w=a;a=g();r=a[0];d=a[1];f.call({action:w,location:d})}function z(a,e){function m(){z(a,e)}var k=l.Action.Push,p=A(a,e);C("/"===p.pathname.charAt(0), | ||
"Relative pathnames are not supported in hash history.push("+JSON.stringify(a)+")");if(!c.length||(c.call({action:k,location:p,retry:m}),!1)){var G=[{usr:p.state,key:p.key,idx:r+1},t(p)];p=G[0];G=G[1];try{v.pushState(p,"",G)}catch(J){n.location.assign(G)}B(k)}}function x(a,e){function m(){x(a,e)}var k=l.Action.Replace,p=A(a,e);C("/"===p.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(a)+")");c.length&&(c.call({action:k,location:p,retry:m}),1)||(p= | ||
[{usr:p.state,key:p.key,idx:r},t(p)],v.replaceState(p[0],"",p[1]),B(k))}function q(a){v.go(a)}void 0===b&&(b={});b=b.window;var n=void 0===b?document.defaultView:b,v=n.history,u=null;n.addEventListener("popstate",h);n.addEventListener("hashchange",function(){var a=g()[1];E(a)!==E(d)&&h()});var w=l.Action.Pop;b=g();var r=b[0],d=b[1],f=D(),c=D();null==r&&(r=0,v.replaceState(y({},v.state,{idx:r}),""));return{get action(){return w},get location(){return d},createHref:t,push:z,replace:x,go:q,back:function(){q(-1)}, | ||
forward:function(){q(1)},listen:function(a){return f.push(a)},block:function(a){var e=c.push(a);1===c.length&&n.addEventListener("beforeunload",H);return function(){e();c.length||n.removeEventListener("beforeunload",H)}}}};l.createMemoryHistory=function(b){function g(d,f){void 0===f&&(f=null);return Object.freeze(y({pathname:u.pathname,search:"",hash:""},"string"===typeof d?F(d):d,{state:f,key:I()}))}function h(d,f,c){return!r.length||(r.call({action:d,location:f,retry:c}),!1)}function t(d,f){v=d; | ||
u=f;w.call({action:v,location:u})}function A(d,f){var c=l.Action.Push,a=g(d,f);C("/"===u.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")");h(c,a,function(){A(d,f)})&&(n+=1,q.splice(n,q.length,a),t(c,a))}function B(d,f){var c=l.Action.Replace,a=g(d,f);C("/"===u.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")");h(c,a,function(){B(d,f)})&&(q[n]=a,t(c,a))}function z(d){var f=Math.min(Math.max(n+ | ||
d,0),q.length-1),c=l.Action.Pop,a=q[f];h(c,a,function(){z(d)})&&(n=f,t(c,a))}void 0===b&&(b={});var x=b;b=x.initialEntries;x=x.initialIndex;var q=(void 0===b?["/"]:b).map(function(d){var f=Object.freeze(y({pathname:"/",search:"",hash:"",state:null,key:I()},"string"===typeof d?F(d):d));C("/"===f.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")");return f}),n=Math.min(Math.max(null==x?q.length-1:x,0),q.length- | ||
1),v=l.Action.Pop,u=q[n],w=D(),r=D();return{get index(){return n},get action(){return v},get location(){return u},createHref:function(d){return"string"===typeof d?d:E(d)},push:A,replace:B,go:z,back:function(){z(-1)},forward:function(){z(1)},listen:function(d){return w.push(d)},block:function(d){return r.push(d)}}};l.createPath=E;l.parsePath=F;Object.defineProperty(l,"__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="undefined"!=typeof globalThis?globalThis: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={search:""};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;t.Action=void 0,(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)}void 0===c&&(c={});var d=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)}void 0===c&&(c={});var p=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))}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)})),d=Math.min(Math.max(null==f?h.length-1: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="undefined"!=typeof globalThis?globalThis: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 a(t){var n=t.pathname,e=t.search;return(void 0===n?"/":n)+(void 0===e?"":e)+(void 0===(t=t.hash)?"":t)}function i(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;t.Action=void 0,(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:a(t)}function s(t,e){return void 0===e&&(e=null),n({pathname:m.pathname,hash:"",search:""},"string"==typeof t?i(t):t,{state:e,key:o()})}function f(t){y=t,t=u(),g=t[0],m=t[1],b.call({action:y,location:m})}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)k.call(v),v=null;else{var n=t.Action.Pop,e=u(),r=e[0];if(e=e[1],k.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],m=c[1],b=r(),k=r();return null==g&&(g=0,d.replaceState(n({},d.state,{idx:g}),"")),{get action(){return y},get location(){return m},createHref:l,push:function n(e,r){var o=t.Action.Push,a=s(e,r);if(!k.length||(k.call({action:o,location:a,retry:function(){n(e,r)}}),0)){var i=[{usr:a.state,key:a.key,idx:g+1},l(a)];a=i[0],i=i[1];try{d.pushState(a,"",i)}catch(t){p.location.assign(i)}f(o)}},replace:function n(e,r){var o=t.Action.Replace,a=s(e,r);k.length&&(k.call({action:o,location:a,retry:function(){n(e,r)}}),1)||(a=[{usr:a.state,key:a.key,idx:g},l(a)],d.replaceState(a[0],"",a[1]),f(o))},go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(t){return b.push(t)},block:function(t){var n=k.push(t);return 1===k.length&&p.addEventListener("beforeunload",e),function(){n(),k.length||p.removeEventListener("beforeunload",e)}}}},t.createHashHistory=function(c){function u(){var t=i(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=m-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:a(t))}function f(t,e){return void 0===e&&(e=null),n({pathname:b.pathname,hash:"",search:""},"string"==typeof t?i(t):t,{state:e,key:o()})}function h(t){g=t,t=u(),m=t[0],b=t[1],k.call({action:g,location:b})}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(){a(u()[1])!==a(b)&&l()}));var g=t.Action.Pop,m=(c=u())[0],b=c[1],k=r(),P=r();return null==m&&(m=0,v.replaceState(n({},v.state,{idx:m}),"")),{get action(){return g},get location(){return b},createHref:s,push:function n(e,r){var o=t.Action.Push,a=f(e,r);if(!P.length||(P.call({action:o,location:a,retry:function(){n(e,r)}}),0)){var i=[{usr:a.state,key:a.key,idx:m+1},s(a)];a=i[0],i=i[1];try{v.pushState(a,"",i)}catch(t){d.location.assign(i)}h(o)}},replace:function n(e,r){var o=t.Action.Replace,a=f(e,r);P.length&&(P.call({action:o,location:a,retry:function(){n(e,r)}}),1)||(a=[{usr:a.state,key:a.key,idx:m},s(a)],v.replaceState(a[0],"",a[1]),h(o))},go:p,back:function(){p(-1)},forward:function(){p(1)},listen:function(t){return k.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({pathname:v.pathname,search:"",hash:""},"string"==typeof t?i(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?i(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:a(t)},push:function n(e,r){var o=t.Action.Push,a=c(e,r);u(o,a,(function(){n(e,r)}))&&(p+=1,h.splice(p,h.length,a),l(o,a))},replace:function n(e,r){var o=t.Action.Replace,a=c(e,r);u(o,a,(function(){n(e,r)}))&&(h[p]=a,l(o,a))},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=a,t.parsePath=i,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=history.production.min.js.map |
56347
508