File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
var t;!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(t||(t={}));function e(e={}){let{window:n=document.defaultView}=e,a=n.history;function r(){let{pathname:t,search:e,hash:r}=n.location,l=a.state||{};return[l.idx,{pathname:t,search:e,hash:r,state:l.usr||null,key:l.key||"default"}]}let s=null;n.addEventListener("popstate",(function(){if(s)d.call(s),s=null;else{let e=t.Pop,[n,a]=r();if(d.length){if(null!=n){let t=f-n;t&&(s={action:e,location:a,retry(){P(-1*t)}},P(t))}}else O(e)}}));let h=t.Pop,[f,p]=r(),g=i(),d=i();function b(t){return"string"==typeof t?t:c(t)}function y(t,e=null){return Object.assign(Object.assign({pathname:p.pathname,hash:"",search:""},"string"==typeof t?u(t):t),{state:e,key:o()})}function m(t,e){return[{usr:t.state,key:t.key,idx:e},b(t)]}function k(t,e,n){return!d.length||(d.call({action:t,location:e,retry:n}),!1)}function O(t){h=t,[f,p]=r(),g.call({action:h,location:p})}function P(t){a.go(t)}return null==f&&(f=0,a.replaceState(Object.assign(Object.assign({},a.state),{idx:f}),"")),{get action(){return h},get location(){return p},createHref:b,push:function e(r,l){let i=t.Push,o=y(r,l);if(k(i,o,(function(){e(r,l)}))){let[t,e]=m(o,f+1);try{a.pushState(t,"",e)}catch(c){n.location.assign(e)}O(i)}},replace:function e(n,r){let l=t.Replace,i=y(n,r);if(k(l,i,(function(){e(n,r)}))){let[t,e]=m(i,f);a.replaceState(t,"",e),O(l)}},go:P,back(){P(-1)},forward(){P(1)},listen:t=>g.push(t),block(t){let e=d.push(t);return 1===d.length&&n.addEventListener("beforeunload",l),function(){e(),d.length||n.removeEventListener("beforeunload",l)}}}}function n(e={}){let{window:n=document.defaultView}=e,a=n.history;function r(){let{pathname:t="/",search:e="",hash:r=""}=u(n.location.hash.substr(1)),l=a.state||{};return[l.idx,{pathname:t,search:e,hash:r,state:l.usr||null,key:l.key||"default"}]}let s=null;function h(){if(s)b.call(s),s=null;else{let e=t.Pop,[n,a]=r();if(b.length){if(null!=n){let t=p-n;t&&(s={action:e,location:a,retry(){x(-1*t)}},x(t))}}else P(e)}}n.addEventListener("popstate",h),n.addEventListener("hashchange",(()=>{let[,t]=r();c(t)!==c(g)&&h()}));let f=t.Pop,[p,g]=r(),d=i(),b=i();function y(t){return function(){let t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){let t=n.location.href,a=t.indexOf("#");e=-1===a?t:t.slice(0,a)}return e}()+"#"+("string"==typeof t?t:c(t))}function m(t,e=null){return Object.assign(Object.assign({pathname:g.pathname,hash:"",search:""},"string"==typeof t?u(t):t),{state:e,key:o()})}function k(t,e){return[{usr:t.state,key:t.key,idx:e},y(t)]}function O(t,e,n){return!b.length||(b.call({action:t,location:e,retry:n}),!1)}function P(t){f=t,[p,g]=r(),d.call({action:f,location:g})}function x(t){a.go(t)}return null==p&&(p=0,a.replaceState(Object.assign(Object.assign({},a.state),{idx:p}),"")),{get action(){return f},get location(){return g},createHref:y,push:function e(r,l){let i=t.Push,o=m(r,l);if(O(i,o,(function(){e(r,l)}))){let[t,e]=k(o,p+1);try{a.pushState(t,"",e)}catch(c){n.location.assign(e)}P(i)}},replace:function e(n,r){let l=t.Replace,i=m(n,r);if(O(l,i,(function(){e(n,r)}))){let[t,e]=k(i,p);a.replaceState(t,"",e),P(l)}},go:x,back(){x(-1)},forward(){x(1)},listen:t=>d.push(t),block(t){let e=b.push(t);return 1===b.length&&n.addEventListener("beforeunload",l),function(){e(),b.length||n.removeEventListener("beforeunload",l)}}}}function a(e={}){let{initialEntries:n=["/"],initialIndex:a}=e,l=n.map((t=>Object.assign({pathname:"/",search:"",hash:"",state:null,key:o()},"string"==typeof t?u(t):t))),s=r(null==a?l.length-1:a,0,l.length-1),h=t.Pop,f=l[s],p=i(),g=i();function d(t,e=null){return Object.assign(Object.assign({pathname:f.pathname,search:"",hash:""},"string"==typeof t?u(t):t),{state:e,key:o()})}function b(t,e,n){return!g.length||(g.call({action:t,location:e,retry:n}),!1)}function y(t,e){h=t,f=e,p.call({action:h,location:f})}function m(e){let n=r(s+e,0,l.length-1),a=t.Pop,i=l[n];b(a,i,(function(){m(e)}))&&(s=n,y(a,i))}return{get index(){return s},get action(){return h},get location(){return f},createHref:function(t){return"string"==typeof t?t:c(t)},push:function e(n,a){let r=t.Push,i=d(n,a);b(r,i,(function(){e(n,a)}))&&(s+=1,l.splice(s,l.length,i),y(r,i))},replace:function e(n,a){let r=t.Replace,i=d(n,a);b(r,i,(function(){e(n,a)}))&&(l[s]=i,y(r,i))},go:m,back(){m(-1)},forward(){m(1)},listen:t=>p.push(t),block:t=>g.push(t)}}function r(t,e,n){return Math.min(Math.max(t,e),n)}function l(t){t.preventDefault(),t.returnValue=""}function i(){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 o(){return Math.random().toString(36).substr(2,8)}function c({pathname:t="/",search:e="",hash:n=""}){return e&&"?"!==e&&(t+="?"===e.charAt(0)?e:"?"+e),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function u(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let a=t.indexOf("?");a>=0&&(e.search=t.substr(a),t=t.substr(0,a)),t&&(e.pathname=t)}return e}export{t as Action,e as createBrowserHistory,n as createHashHistory,a as createMemoryHistory,c as createPath,u as parsePath};
//# sourceMappingURL=history.production.min.js.map