!function(t){var e=document.location;function r(){return""===e.hash||"#!"===e.hash||"#"===e.hash}var i={mode:"modern",hash:e.hash,history:!1,check:function(){var t=e.hash;t!=this.hash&&(this.hash=t,this.onHashChanged())},fire:function(){"modern"===this.mode?!0===this.history?window.onpopstate():window.onhashchange():this.onHashChanged()},init:function(t,e){var r=this;function i(t){for(var e=0,r=n.listeners.length;e<r;e++)n.listeners[e](t)}if(this.history=e,n.listeners||(n.listeners=[]),"onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7))!0===this.history?setTimeout((function(){window.onpopstate=i}),500):window.onhashchange=i,this.mode="modern";else{var o=document.createElement("iframe");o.id="state-frame",o.style.display="none",document.body.appendChild(o),this.writeFrame(""),"onpropertychange"in document&&"attachEvent"in document&&document.attachEvent("onpropertychange",(function(){"location"===event.propertyName&&r.check()})),window.setInterval((function(){r.check()}),50),this.onHashChanged=i,this.mode="legacy"}return n.listeners.push(t),this.mode},destroy:function(t){if(n&&n.listeners)for(var e=n.listeners,r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},setHash:function(t){return"legacy"===this.mode&&this.writeFrame(t),!0===this.history?(window.history.pushState({},document.title,t),this.fire()):e.hash="/"===t[0]?t:"/"+t,this},writeFrame:function(t){var e=document.getElementById("state-frame"),r=e.contentDocument||e.contentWindow.document;r.open(),r.write("<script>_hash = '"+t+"'; onload = parent.listener.syncHash;<script>"),r.close()},syncHash:function(){var t=this._hash;return t!=e.hash&&(e.hash=t),this},onHashChanged:function(){}},n=t.Router=function(t){if(!(this instanceof n))return new n(t);this.params={},this.routes={},this.methods=["on","once","after","before"],this.scope=[],this._methods={},this._insert=this.insert,this.insert=this.insertEx,this.historySupport=null!=(null!=window.history?window.history.pushState:null),this.configure(),this.mount(t||{})};function o(t,e){for(var r=0;r<t.length;r+=1)if(!1===e(t[r],r,t))return}function h(t){for(var e=[],r=0,i=t.length;r<i;r++)e=e.concat(t[r]);return e}function a(t,e,r){if(!t.length)return r();var i=0;!function n(){e(t[i],(function(e){e||!1===e?(r(e),r=function(){}):(i+=1)===t.length?r():n()}))}()}function c(t,e,r){for(var i in r=t,e)if(e.hasOwnProperty(i)&&(r=e[i](t))!==t)break;return r===t?"([._a-zA-Z0-9-%()]+)":r}function u(t,e,r,i){var n,o=0,s=0,h=0;r=(r||"(").toString(),i=(i||")").toString();for(n=0;n<t.length;n++){var a=t[n];if(a.indexOf(r,o)>a.indexOf(i,o)||~a.indexOf(r,o)&&!~a.indexOf(i,o)||!~a.indexOf(r,o)&&~a.indexOf(i,o)){if(s=a.indexOf(r,o),h=a.indexOf(i,o),~s&&!~h||!~s&&~h){var c=t.slice(0,(n||1)+1).join(e);t=[c].concat(t.slice((n||1)+1))}o=(h>s?h:s)+1,n=0}else o=0}return t}n.prototype.init=function(t){var n,o=this;return this.handler=function(t){var e=t&&t.newURL||window.location.hash,r=!0===o.history?o.getPath():e.replace(/.*#!|.*#/,"");o.dispatch("on","/"===r.charAt(0)?r:"/"+r)},i.init(this.handler,this.history),!1===this.history?r()&&t?e.hash=t:r()||o.dispatch("on","/"+e.hash.replace(/^(#!\/|#!|\/|#\/|#)/,"")):(this.convert_hash_in_init?(n=r()&&t?t:r()?null:e.hash.replace(/^(#!|#)/,""))&&window.history.replaceState({},document.title,n):n=this.getPath(),(n||!0===this.run_in_init)&&this.handler()),this},n.prototype.explode=function(){var t=!0===this.history?this.getPath():e.hash;return"/"===t.charAt(1)&&(t=t.slice(1)),t.slice(1,t.length).split("/")},n.prototype.setRoute=function(t,e,r){var n=this.explode();return"number"==typeof t&&"string"==typeof e?n[t]=e:"string"==typeof r?n.splice(t,e,s):n=[t],i.setHash(n.join("/")),n},n.prototype.insertEx=function(t,e,r,i){return"once"===t&&(t="on",r=function(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}(r)),this._insert(t,e,r,i)},n.prototype.getRoute=function(t){var e=t;if("number"==typeof t)e=this.explode()[t];else if("string"==typeof t){e=this.explode().indexOf(t)}else e=this.explode();return e},n.prototype.destroy=function(){return i.destroy(this.handler),this},n.prototype.getPath=function(){var t=window.location.pathname;return"/"!==t.substr(0,1)&&(t="/"+t),t};var f=/\?.*/;n.prototype.configure=function(t){t=t||{};for(var e=0;e<this.methods.length;e++)this._methods[this.methods[e]]=!0;return this.recurse=t.recurse||this.recurse||!1,this.async=t.async||!1,this.delimiter=t.delimiter||"/",this.strict=void 0===t.strict||t.strict,this.notfound=t.notfound,this.resource=t.resource,this.history=t.html5history&&this.historySupport||!1,this.run_in_init=!0===this.history&&!1!==t.run_handler_in_init,this.convert_hash_in_init=!0===this.history&&!1!==t.convert_hash_in_init,this.every={after:t.after||null,before:t.before||null,on:t.on||null},this},n.prototype.param=function(t,e){":"!==t[0]&&(t=":"+t);var r=new RegExp(t,"g");return this.params[t]=function(t){return t.replace(r,e.source||e)},this},n.prototype.on=n.prototype.route=function(t,e,r){var i=this;return r||"function"!=typeof e||(r=e,e=t,t="on"),Array.isArray(e)?e.forEach((function(e){i.on(t,e,r)})):(e.source&&(e=e.source.replace(/\\\//gi,"/")),Array.isArray(t)?t.forEach((function(t){i.on(t.toLowerCase(),e,r)})):(e=u(e=e.split(new RegExp(this.delimiter)),this.delimiter),void this.insert(t,this.scope.concat(e),r)))},n.prototype.path=function(t,e){var r=this.scope.length;t.source&&(t=t.source.replace(/\\\//gi,"/")),t=u(t=t.split(new RegExp(this.delimiter)),this.delimiter),this.scope=this.scope.concat(t),e.call(this,this),this.scope.splice(r,t.length)},n.prototype.dispatch=function(t,e,r){var i,n=this,o=this.traverse(t,e.replace(f,""),this.routes,""),s=this._invoked;if(this._invoked=!0,!o||0===o.length)return this.last=[],"function"==typeof this.notfound&&this.invoke([this.notfound],{method:t,path:e},r),!1;function h(){n.last=o.after,n.invoke(n.runlist(o),n,r)}return"forward"===this.recurse&&(o=o.reverse()),(i=this.every&&this.every.after?[this.every.after].concat(this.last):[this.last])&&i.length>0&&s?(this.async?this.invoke(i,this,h):(this.invoke(i,this),h()),!0):(h(),!0)},n.prototype.invoke=function(t,e,r){var i,n=this;this.async?(i=function(r,n){if(Array.isArray(r))return a(r,i,n);"function"==typeof r&&r.apply(e,(t.captures||[]).concat(n))},a(t,i,(function(){r&&r.apply(e,arguments)}))):(i=function(r){return Array.isArray(r)?o(r,i):"function"==typeof r?r.apply(e,t.captures||[]):void("string"==typeof r&&n.resource&&n.resource[r].apply(e,t.captures||[]))},o(t,i))},n.prototype.traverse=function(t,e,r,i,n){var o,s,h,a,c=[];function u(t){if(!n)return t;var e=function t(e){for(var r=[],i=0;i<e.length;i++)r[i]=Array.isArray(e[i])?t(e[i]):e[i];return r}(t);return e.matched=t.matched,e.captures=t.captures,e.after=t.after.filter(n),function t(e){for(var r=e.length-1;r>=0;r--)Array.isArray(e[r])?(t(e[r]),0===e[r].length&&e.splice(r,1)):n(e[r])||e.splice(r,1)}(e),e}if(e===this.delimiter&&r[t])return(a=[[r.before,r[t]].filter(Boolean)]).after=[r.after].filter(Boolean),a.matched=!0,a.captures=[],u(a);for(var f in r)if(r.hasOwnProperty(f)&&(!this._methods[f]||this._methods[f]&&"object"==typeof r[f]&&!Array.isArray(r[f]))){if(o=s=i+this.delimiter+f,this.strict||(s+="["+this.delimiter+"]?"),!(h=e.match(new RegExp("^"+s))))continue;if(h[0]&&h[0]==e&&r[f][t])return(a=[[r[f].before,r[f][t]].filter(Boolean)]).after=[r[f].after].filter(Boolean),a.matched=!0,a.captures=h.slice(1),this.recurse&&r===this.routes&&(a.push([r.before,r.on].filter(Boolean)),a.after=a.after.concat([r.after].filter(Boolean))),u(a);if((a=this.traverse(t,e,r[f],o)).matched)return a.length>0&&(c=c.concat(a)),this.recurse&&(c.push([r[f].before,r[f].on].filter(Boolean)),a.after=a.after.concat([r[f].after].filter(Boolean)),r===this.routes&&(c.push([r.before,r.on].filter(Boolean)),a.after=a.after.concat([r.after].filter(Boolean)))),c.matched=!0,c.captures=a.captures,c.after=a.after,u(c)}return!1},n.prototype.insert=function(t,e,r,i){var n,o,s,h;if(e=e.filter((function(t){return t&&t.length>0})),i=i||this.routes,h=e.shift(),/\:|\*/.test(h)&&!/\\d|\\w/.test(h)&&(h=function(t,e){for(var r,i=0,n="";r=t.substr(i).match(/[^\w\d\- %@&]*\*[^\w\d\- %@&]*/);)i=r.index+r[0].length,r[0]=r[0].replace(/^\*/,"([_.()!\\ %@&a-zA-Z0-9-]+)"),n+=t.substr(0,r.index)+r[0];var o,s,h=(t=n+=t.substr(i)).match(/:([^\/]+)/gi);if(h){s=h.length;for(var a=0;a<s;a++)t="::"===(o=h[a]).slice(0,2)?o.slice(1):t.replace(o,c(o,e))}return t}(h,this.params)),e.length>0)return i[h]=i[h]||{},this.insert(t,e,r,i[h]);if(h||e.length||i!==this.routes){if(n=typeof i[h],o=Array.isArray(i[h]),i[h]&&!o&&"object"==n)switch(typeof i[h][t]){case"function":return void(i[h][t]=[i[h][t],r]);case"object":return void i[h][t].push(r);case"undefined":return void(i[h][t]=r)}else if("undefined"==n)return(s={})[t]=r,void(i[h]=s);throw new Error("Invalid route context: "+n)}switch(typeof i[t]){case"function":return void(i[t]=[i[t],r]);case"object":return void i[t].push(r);case"undefined":return void(i[t]=r)}},n.prototype.extend=function(t){var e,r=this,i=t.length;function n(t){r._methods[t]=!0,r[t]=function(){var e=1===arguments.length?[t,""]:[t];r.on.apply(r,e.concat(Array.prototype.slice.call(arguments)))}}for(e=0;e<i;e++)n(t[e])},n.prototype.runlist=function(t){var e=this.every&&this.every.before?[this.every.before].concat(h(t)):h(t);return this.every&&this.every.on&&e.push(this.every.on),e.captures=t.captures,e.source=t.source,e},n.prototype.mount=function(t,e){if(t&&"object"==typeof t&&!Array.isArray(t)){var r=this;for(var i in e=e||[],Array.isArray(e)||(e=e.split(r.delimiter)),t)t.hasOwnProperty(i)&&n(i,e.slice(0))}function n(e,i){var n=e,o=e.split(r.delimiter),s=typeof t[e],h=""===o[0]||!r._methods[o[0]],a=h?"on":n;if(h&&(n=n.slice((n.match(new RegExp("^"+r.delimiter))||[""])[0].length),o.shift()),h&&"object"===s&&!Array.isArray(t[e]))return i=i.concat(o),void r.mount(t[e],i);h&&(i=u(i=i.concat(n.split(r.delimiter)),r.delimiter)),r.insert(a,i,t[e])}}}("object"==typeof exports?exports:window);
//# sourceMappingURL=director-hashbang.min.js.map
