!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.highway=e()}(this,function(){function t(){}t.prototype={on:function(t,e,r){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:r}),this},once:function(t,e,r){var i=this;function n(){i.off(t,n),e.apply(r,arguments)}return n._=e,this.on(t,n,r)},emit:function(t){for(var e=[].slice.call(arguments,1),r=((this.e||(this.e={}))[t]||[]).slice(),i=0,n=r.length;i=200&&e.status<300)return e.text();window.location.href=t.location.href})}catch(t){return Promise.reject(t)}},e.prototype.beforeFetch=function(){try{var t=this;function e(){t.afterFetch()}t.pushState(),t.running=!0,t.emit("NAVIGATE_OUT",{from:{page:t.From.properties.page,view:t.From.properties.view},trigger:t.trigger,location:t.location});var r={trigger:t.trigger,contextual:t.Contextual},i=t.cache.has(t.location.href)?Promise.resolve(t.From.hide(r)).then(function(){t.properties=t.cache.get(t.location.href)}):Promise.resolve(Promise.all([t.fetch(),t.From.hide(r)])).then(function(e){t.properties=t.Helpers.getProperties(e[0]),t.cache.set(t.location.href,t.properties)});return Promise.resolve(i&&i.then?i.then(e):e())}catch(t){return Promise.reject(t)}},e.prototype.afterFetch=function(){try{var t=this;return Promise.resolve(t.properties.renderer).then(function(e){return t.To=new e(t.properties),t.To.add(),t.emit("NAVIGATE_IN",{to:{page:t.To.properties.page,view:t.To.wrap.lastElementChild},trigger:t.trigger,location:t.location}),Promise.resolve(t.To.show({trigger:t.trigger,contextual:t.Contextual})).then(function(){t.popping=!1,t.running=!1,t.detach(t.links),t.links=document.querySelectorAll("a:not([target]):not([data-router-disabled])"),t.attach(t.links),t.emit("NAVIGATE_END",{to:{page:t.To.properties.page,view:t.To.wrap.lastElementChild},from:{page:t.From.properties.page,view:t.From.properties.view},trigger:t.trigger,location:t.location}),t.From=t.To,t.trigger=null})})}catch(t){return Promise.reject(t)}},e}(e),s=function(t,e){this.wrap=t,this.name=e};return s.prototype.show=function(t){var e=this,r=t.trigger,i=t.contextual,n=this.wrap.lastElementChild,o=this.wrap.firstElementChild;return new Promise(function(t){i?(n.setAttribute("data-transition-in",i.name),n.removeAttribute("data-transition-out",i.name),i.in&&i.in({to:n,from:o,trigger:r,done:t})):(n.setAttribute("data-transition-in",e.name),n.removeAttribute("data-transition-out",e.name),e.in&&e.in({to:n,from:o,trigger:r,done:t}))})},s.prototype.hide=function(t){var e=this,r=t.trigger,i=t.contextual,n=this.wrap.firstElementChild;return new Promise(function(t){i?(n.setAttribute("data-transition-out",i.name),n.removeAttribute("data-transition-in",i.name),i.out&&i.out({from:n,trigger:r,done:t})):(n.setAttribute("data-transition-out",e.name),n.removeAttribute("data-transition-in",e.name),e.out&&e.out({from:n,trigger:r,done:t}))})},console.log("Highway v2.2.0"),{Core:o,Helpers:n,Renderer:r,Transition:s}}); //# sourceMappingURL=highway.min.js.map