text: '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 f=1;f<arguments.length;f++){var e=arguments[f],t;for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(b[t]=e[t])}return b};return y.apply(this,arguments)}function C(b,f){if(!b){"undefined"!==typeof console&&
  console.warn(f);try{throw Error(f);}catch(e){}}}function H(b){b.preventDefault();b.returnValue=""}function D(){var b=[];return{get length(){return b.length},push:function(f){b.push(f);return function(){b=b.filter(function(e){return e!==f})}},call:function(f){b.forEach(function(e){return e&&e(f)})}}}function I(){return Math.random().toString(36).substr(2,8)}function E(b){var f=b.pathname;f=void 0===f?"/":f;var e=b.search;e=void 0===e?"":e;b=b.hash;b=void 0===b?"":b;e&&"?"!==e&&(f+="?"===e.charAt(0)?
  e:"?"+e);b&&"#"!==b&&(f+="#"===b.charAt(0)?b:"#"+b);return f}function F(b){var f={};if(b){var e=b.indexOf("#");0<=e&&(f.hash=b.substr(e),b=b.substr(0,e));e=b.indexOf("?");0<=e&&(f.search=b.substr(e),b=b.substr(0,e));b&&(f.pathname=b)}return f}l.Action=void 0;(function(b){b.Pop="POP";b.Push="PUSH";b.Replace="REPLACE"})(l.Action||(l.Action={}));l.createBrowserHistory=function(b){function f(){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 e(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=f();w=c[0];r=c[1];d.call({action:u,location:r})}function B(c,a){function g(){B(c,a)}var m=l.Action.Push,k=t(c,a);if(!h.length||(h.call({action:m,location:k,retry:g}),!1)){var p=[{usr:k.state,key:k.key,idx:w+1},e(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 g(){z(c,a)}var m=l.Action.Replace,k=t(c,a);h.length&&(h.call({action:m,location:k,retry:g}),1)||(k=[{usr:k.state,key:k.key,idx:w},e(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)h.call(v),v=null;else{var c=l.Action.Pop,a=f(),g=a[0];a=a[1];if(h.length)if(null!=g){var m=w-g;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=f();var w=b[0],r=b[1],d=D(),h=D();null==w&&(w=0,n.replaceState(y({},n.state,{idx:w}),""));return{get action(){return u},get location(){return r},createHref:e,
  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=h.push(c);1===h.length&&q.addEventListener("beforeunload",H);return function(){a();h.length||q.removeEventListener("beforeunload",H)}}}};l.createHashHistory=function(b){function f(){var a=F(n.location.hash.substr(1)),g=a.pathname,m=a.search;a=a.hash;var k=v.state||{};return[k.idx,Object.freeze({pathname:void 0===g?"/":g,search:void 0===m?"":m,hash:void 0===a?"":a,state:k.usr||
  null,key:k.key||"default"})]}function e(){if(u)c.call(u),u=null;else{var a=l.Action.Pop,g=f(),m=g[0];g=g[1];if(c.length)if(null!=m){var k=r-m;k&&(u={action:a,location:g,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 g=document.querySelector("base"),m="";g&&g.getAttribute("href")&&(g=n.location.href,m=g.indexOf("#"),m=-1===m?g:g.slice(0,m));return m+"#"+("string"===typeof a?a:E(a))}function A(a,g){void 0===g&&(g=null);return Object.freeze(y({pathname:d.pathname,hash:"",search:""},"string"===typeof a?F(a):a,{state:g,key:I()}))}function B(a){w=a;a=f();r=a[0];d=a[1];h.call({action:w,location:d})}function z(a,g){function m(){z(a,g)}var k=l.Action.Push,p=A(a,g);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,g){function m(){x(a,g)}var k=l.Action.Replace,p=A(a,g);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",e);n.addEventListener("hashchange",function(){var a=f()[1];E(a)!==E(d)&&e()});var w=l.Action.Pop;b=f();var r=b[0],d=b[1],h=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 h.push(a)},block:function(a){var g=c.push(a);1===c.length&&n.addEventListener("beforeunload",H);return function(){g();c.length||n.removeEventListener("beforeunload",H)}}}};l.createMemoryHistory=function(b){function f(d,h){void 0===h&&(h=null);return Object.freeze(y({pathname:u.pathname,search:"",hash:""},"string"===typeof d?F(d):d,{state:h,key:I()}))}function e(d,h,c){return!r.length||(r.call({action:d,location:h,retry:c}),!1)}function t(d,h){v=d;
  u=h;w.call({action:v,location:u})}function A(d,h){var c=l.Action.Push,a=f(d,h);C("/"===u.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")");e(c,a,function(){A(d,h)})&&(n+=1,q.splice(n,q.length,a),t(c,a))}function B(d,h){var c=l.Action.Replace,a=f(d,h);C("/"===u.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")");e(c,a,function(){B(d,h)})&&(q[n]=a,t(c,a))}function z(d){var h=Math.min(Math.max(n+
  d,0),q.length-1),c=l.Action.Pop,a=q[h];e(c,a,function(){z(d)})&&(n=h,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 h=Object.freeze(y({pathname:"/",search:"",hash:"",state:null,key:I()},"string"===typeof d?F(d):d));C("/"===h.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")");return h}),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
  