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){}}}
function A(a){a.preventDefault();a.returnValue=""}function E(){var a=[];return{get length(){return a.length},push:function(c){a.push(c);return function(){a=a.filter(function(a){return a!==c})}},call:function(c){a.forEach(function(a){return a&&a(c)})}}}
var F=function(a){function c(){var b=n.location,a=p.state||{};return[a.idx,y({pathname:b.pathname,search:b.search,hash:b.hash,state:a.usr||null,key:a.key||"default"})]}function g(b){if("string"===typeof b)var a=b;else{a=b.pathname;var c=b.search;b=b.hash;a=(void 0===a?"/":a)+(void 0===c?"":c)+(void 0===b?"":b)}return a}function h(b,a){void 0===a&&(a=null);var c=m,f=t;if("string"===typeof b){var d={};if(b){var e=b.indexOf("#");0<=e&&(d.hash=b.substr(e),b=b.substr(0,e));e=b.indexOf("?");0<=e&&(d.search=
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)}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
