text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("knockout")):"function"==typeof define&&define.amd?define(["exports","knockout"],e):e((t.ko=t.ko||{},t.ko.router=t.ko.router||{}),t.ko)}(this,function(t,e){"use strict";function r(t,e,r,n){return new(r||(r=Promise))(function(o,i){function u(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(u,a)}c((n=n.apply(t,e||[])).next())})}function n(t,e){function r(t){return function(e){return n([t,e])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(u=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(u=u.call(i,r[1])).done)return u;switch(i=0,u&&(r=[0,u.value]),r[0]){case 0:case 1:u=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,i=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(u=c.trys,!(u=u.length>0&&u[u.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!u||r[1]>u[0]&&r[1]<u[3])){c.label=r[1];break}if(6===r[0]&&c.label<u[1]){c.label=u[1],u=r;break}if(u&&c.label<u[2]){c.label=u[2],c.ops.push(r);break}u[2]&&c.ops.pop(),c.trys.pop();continue}r=e.call(t,c)}catch(t){r=[6,t],i=0}finally{o=u=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}var o,i,u,a,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a}function o(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function i(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function c(t,e,r){function n(t){l[t]&&(f[t]=function(e){return new Promise(function(r,n){h.push([t,e,r,n])>1||o(t,e)})})}function o(t,e){try{i(l[t](e))}catch(t){s(h[0][3],t)}}function i(t){t.value instanceof a?Promise.resolve(t.value.v).then(u,c):s(h[0][2],t)}function u(t){o("next",t)}function c(t){o("throw",t)}function s(t,e){t(e),h.shift(),h.length&&o(h[0][0],h[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f,l=r.apply(t,e||[]),h=[];return f={},n("next"),n("throw"),n("return"),f[Symbol.asyncIterator]=function(){return this},f}function s(t,e){return e={exports:{}},t(e,e.exports),e.exports}function f(t){var e=Ar.call(t,Sr),r=t[Sr];try{t[Sr]=void 0;var n=!0}catch(t){}var o=kr.call(t);return n&&(e?t[Sr]=r:delete t[Sr]),o}function l(t){return Er.call(t)}function h(t){return null==t?void 0===t?zr:Cr:Mr&&Mr in Object(t)?f(t):l(t)}function p(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function d(t){if(!p(t))return!1;var e=h(t);return e==Nr||e==Tr||e==Dr||e==Br}function v(t){return void 0===t}function b(){}function y(t,e,r){return t===t&&(void 0!==r&&(t=t<=r?t:r),void 0!==e&&(t=t>=e?t:e)),t}function g(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function _(t){return null!=t&&"object"==typeof t}function m(t){return"symbol"==typeof t||_(t)&&h(t)==Fr}function w(t){if("string"==typeof t)return t;if(Ir(t))return g(t,w)+"";if(m(t))return qr?qr.call(t):"";var e=t+"";return"0"==e&&1/t==-Lr?"-0":e}function j(t){if("number"==typeof t)return t;if(m(t))return Qr;if(p(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=p(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Vr,"");var r=Gr.test(t);return r||Hr.test(t)?Kr(t.slice(2),r?2:8):Wr.test(t)?Qr:+t}function x(t){if(!t)return 0===t?t:0;if((t=j(t))===Jr||t===-Jr){return(t<0?-1:1)*Xr}return t===t?t:0}function O(t){var e=x(t),r=e%1;return e===e?r?e-r:e:0}function P(t){return null==t?"":w(t)}function $(t,e,r){return t=P(t),r=null==r?0:y(O(r),0,t.length),e=w(e),t.slice(r,r+e.length)==e}function A(t){return!0===t||!1===t||_(t)&&h(t)==Yr}function k(t,e){return function(r){return t(e(r))}}function S(t){if(!_(t)||h(t)!=tn)return!1;var e=Zr(t);if(null===e)return!0;var r=on.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&nn.call(r)==un}function R(t){return"string"==typeof t||!Ir(t)&&_(t)&&h(t)==an}function E(){if(!arguments.length)return[];var t=arguments[0];return Ir(t)?t:[t]}function C(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function z(t){return _(t)&&h(t)==cn}function M(t){return Ir(t)||hn(t)||!!(pn&&t&&t[pn])}function D(t,e,r,n,o){var i=-1,u=t.length;for(r||(r=M),o||(o=[]);++i<u;){var a=t[i];e>0&&r(a)?e>1?D(a,e-1,r,n,o):C(o,a):n||(o[o.length]=a)}return o}function N(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function T(){var t=arguments.length;if(!t)return[];for(var e=Array(t-1),r=arguments[0],n=t;n--;)e[n-1]=arguments[n];return C(Ir(r)?N(r):[r],D(e,1))}function B(t){return!!vn&&vn in t}function I(t){if(null!=t){try{return yn.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function F(t){return!(!p(t)||B(t))&&(d(t)?On:_n).test(I(t))}function L(t,e){return null==t?void 0:t[e]}function U(t,e){var r=L(t,e);return F(r)?r:void 0}function q(t,e,r){"__proto__"==e&&Pn?Pn(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function Q(t,e){return t===e||t!==t&&e!==e}function V(t,e,r){var n=t[e];An.call(t,e)&&Q(n,r)&&(void 0!==r||e in t)||q(t,e,r)}function W(t,e,r,n){var o=!r;r||(r={});for(var i=-1,u=e.length;++i<u;){var a=e[i],c=n?n(r[a],t[a],a,r,t):void 0;void 0===c&&(c=t[a]),o?q(r,a,c):V(r,a,c)}return r}function G(t){return t}function H(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function K(t,e,r){return e=kn(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=kn(n.length-e,0),u=Array(i);++o<i;)u[o]=n[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=n[o];return a[e]=r(u),H(t,this,a)}}function J(t){return function(){return t}}function X(t,e){return zn(K(t,e,G),t+"")}function Y(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Mn}function Z(t){return null!=t&&Y(t.length)&&!d(t)}function tt(t,e){return!!(e=null==e?Dn:e)&&("number"==typeof t||Nn.test(t))&&t>-1&&t%1==0&&t<e}function et(t,e,r){if(!p(r))return!1;var n=typeof e;return!!("number"==n?Z(r)&&tt(e,r.length):"string"==n&&e in r)&&Q(r[e],t)}function rt(t){return X(function(e,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,u=o>2?r[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,u&&et(r[0],r[1],u)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=r[n];a&&t(e,a,n,i)}return e})}function nt(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function ot(){return!1}function it(t){return _(t)&&Y(t.length)&&!!qn[h(t)]}function ut(t,e){var r=Ir(t),n=!r&&hn(t),o=!r&&!n&&Un(t),i=!r&&!n&&!o&&Jn(t),u=r||n||o||i,a=u?nt(t.length,String):[],c=a.length;for(var s in t)!e&&!Yn.call(t,s)||u&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||tt(s,c))||a.push(s);return a}function at(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Zn)}function ct(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}function st(t){if(!p(t))return ct(t);var e=at(t),r=[];for(var n in t)("constructor"!=n||!e&&eo.call(t,n))&&r.push(n);return r}function ft(t){return Z(t)?ut(t,!0):st(t)}function lt(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var u=t[r];e(u,r,t)&&(i[o++]=u)}return i}function ht(t){if(!at(t))return io(t);var e=[];for(var r in Object(t))ao.call(t,r)&&"constructor"!=r&&e.push(r);return e}function pt(t){return Z(t)?ut(t):ht(t)}function dt(t,e){return t&&oo(t,e,pt)}function vt(){this.__data__=[],this.size=0}function bt(t,e){for(var r=t.length;r--;)if(Q(t[r][0],e))return r;return-1}function yt(t){var e=this.__data__,r=bt(e,t);return!(r<0)&&(r==e.length-1?e.pop():fo.call(e,r,1),--this.size,!0)}function gt(t){var e=this.__data__,r=bt(e,t);return r<0?void 0:e[r][1]}function _t(t){return bt(this.__data__,t)>-1}function mt(t,e){var r=this.__data__,n=bt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function wt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jt(){this.__data__=new wt,this.size=0}function xt(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function Ot(t){return this.__data__.get(t)}function Pt(t){return this.__data__.has(t)}function $t(){this.__data__=ho?ho(null):{},this.size=0}function At(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function kt(t){var e=this.__data__;if(ho){var r=e[t];return r===po?void 0:r}return bo.call(e,t)?e[t]:void 0}function St(t){var e=this.__data__;return ho?void 0!==e[t]:go.call(e,t)}function Rt(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ho&&void 0===e?_o:e,this}function Et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ct(){this.size=0,this.__data__={hash:new Et,map:new(lo||wt),string:new Et}}function zt(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function Mt(t,e){var r=t.__data__;return zt(e)?r["string"==typeof e?"string":"hash"]:r.map}function Dt(t){var e=Mt(this,t).delete(t);return this.size-=e?1:0,e}function Nt(t){return Mt(this,t).get(t)}function Tt(t){return Mt(this,t).has(t)}function Bt(t,e){var r=Mt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}function It(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Ft(t,e){var r=this.__data__;if(r instanceof wt){var n=r.__data__;if(!lo||n.length<mo-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new It(n)}return r.set(t,e),this.size=r.size,this}function Lt(t){var e=this.__data__=new wt(t);this.size=e.size}function Ut(t){return this.__data__.set(t,wo),this}function qt(t){return this.__data__.has(t)}function Qt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new It;++e<r;)this.add(t[e])}function Vt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function Wt(t,e){return t.has(e)}function Gt(t,e,r,n,o,i){var u=r&jo,a=t.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var s=i.get(t);if(s&&i.get(e))return s==e;var f=-1,l=!0,h=r&xo?new Qt:void 0;for(i.set(t,e),i.set(e,t);++f<a;){var p=t[f],d=e[f];if(n)var v=u?n(d,p,f,e,t,i):n(p,d,f,t,e,i);if(void 0!==v){if(v)continue;l=!1;break}if(h){if(!Vt(e,function(t,e){if(!Wt(h,e)&&(p===t||o(p,t,r,n,i)))return h.push(e)})){l=!1;break}}else if(p!==d&&!o(p,d,r,n,i)){l=!1;break}}return i.delete(t),i.delete(e),l}function Ht(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function Kt(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}function Jt(t,e,r,n,o,i,u){switch(r){case To:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case No:return!(t.byteLength!=e.byteLength||!i(new Oo(t),new Oo(e)));case Ao:case ko:case Eo:return Q(+t,+e);case So:return t.name==e.name&&t.message==e.message;case Co:case Mo:return t==e+"";case Ro:var a=Ht;case zo:var c=n&Po;if(a||(a=Kt),t.size!=e.size&&!c)return!1;var s=u.get(t);if(s)return s==e;n|=$o,u.set(t,e);var f=Gt(a(t),a(e),n,o,i,u);return u.delete(t),f;case Do:if(Io)return Io.call(t)==Io.call(e)}return!1}function Xt(t,e,r){var n=e(t);return Ir(t)?n:C(n,r(t))}function Yt(){return[]}function Zt(t){return Xt(t,pt,qo)}function te(t,e,r,n,o,i){var u=r&Qo,a=Zt(t),c=a.length;if(c!=Zt(e).length&&!u)return!1;for(var s=c;s--;){var f=a[s];if(!(u?f in e:Wo.call(e,f)))return!1}var l=i.get(t);if(l&&i.get(e))return l==e;var h=!0;i.set(t,e),i.set(e,t);for(var p=u;++s<c;){f=a[s];var d=t[f],v=e[f];if(n)var b=u?n(v,d,f,e,t,i):n(d,v,f,t,e,i);if(!(void 0===b?d===v||o(d,v,r,n,i):b)){h=!1;break}p||(p="constructor"==f)}if(h&&!p){var y=t.constructor,g=e.constructor;y!=g&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof g&&g instanceof g)&&(h=!1)}return i.delete(t),i.delete(e),h}function ee(t,e,r,n,o,i){var u=Ir(t),a=Ir(e),c=u?ui:ni(t),s=a?ui:ni(e);c=c==ii?ai:c,s=s==ii?ai:s;var f=c==ai,l=s==ai,h=c==s;if(h&&Un(t)){if(!Un(e))return!1;u=!0,f=!1}if(h&&!f)return i||(i=new Lt),u||Jn(t)?Gt(t,e,r,n,o,i):Jt(t,e,c,r,n,o,i);if(!(r&oi)){var p=f&&si.call(t,"__wrapped__"),d=l&&si.call(e,"__wrapped__");if(p||d){var v=p?t.value():t,b=d?e.value():e;return i||(i=new Lt),o(v,b,r,n,i)}}return!!h&&(i||(i=new Lt),te(t,e,r,n,o,i))}function re(t,e,r,n,o){return t===e||(null==t||null==e||!_(t)&&!_(e)?t!==t&&e!==e:ee(t,e,r,n,re,o))}function ne(t,e,r,n){var o=r.length,i=o,u=!n;if(null==t)return!i;for(t=Object(t);o--;){var a=r[o];if(u&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){a=r[o];var c=a[0],s=t[c],f=a[1];if(u&&a[2]){if(void 0===s&&!(c in t))return!1}else{var l=new Lt;if(n)var h=n(s,f,c,t,e,l);if(!(void 0===h?re(f,s,fi|li,n,l):h))return!1}}return!0}function oe(t){return t===t&&!p(t)}function ie(t){for(var e=pt(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,oe(o)]}return e}function ue(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function ae(t){var e=ie(t);return 1==e.length&&e[0][2]?ue(e[0][0],e[0][1]):function(r){return r===t||ne(r,t,e)}}function ce(t,e){if(Ir(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!m(t))||(pi.test(t)||!hi.test(t)||null!=e&&t in Object(e))}function se(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(di);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var u=t.apply(this,n);return r.cache=i.set(o,u)||i,u};return r.cache=new(se.Cache||It),r}function fe(t,e){return Ir(t)?t:ce(t,e)?[t]:_i(P(t))}function le(t){if("string"==typeof t||m(t))return t;var e=t+"";return"0"==e&&1/t==-mi?"-0":e}function he(t,e){e=fe(e,t);for(var r=0,n=e.length;null!=t&&r<n;)t=t[le(e[r++])];return r&&r==n?t:void 0}function pe(t,e,r){var n=null==t?void 0:he(t,e);return void 0===n?r:n}function de(t,e){return null!=t&&e in Object(t)}function ve(t,e,r){e=fe(e,t);for(var n=-1,o=e.length,i=!1;++n<o;){var u=le(e[n]);if(!(i=null!=t&&r(t,u)))break;t=t[u]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Y(o)&&tt(u,o)&&(Ir(t)||hn(t))}function be(t,e){return null!=t&&ve(t,e,de)}function ye(t,e){return ce(t)&&oe(e)?ue(le(t),e):function(r){var n=pe(r,t);return void 0===n&&n===e?be(r,t):re(e,n,wi|ji)}}function ge(t){return function(e){return null==e?void 0:e[t]}}function _e(t){return function(e){return he(e,t)}}function me(t){return ce(t)?ge(le(t)):_e(t)}function we(t){return"function"==typeof t?t:null==t?G:"object"==typeof t?Ir(t)?ye(t[0],t[1]):ae(t):me(t)}function je(t,e){var r=-1,n=Z(t)?Array(t.length):[];return co(t,function(t,o,i){n[++r]=e(t,o,i)}),n}function xe(t,e){return(Ir(t)?g:je)(t,we(e,3))}function Oe(t,e){return D(xe(t,e),1)}function Pe(t,e){var r={};return e=we(e,3),dt(t,function(t,n,o){q(r,n,e(t,n,o))}),r}function $e(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function Ae(t,e,r,n,o){return o(t,function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)}),r}function ke(t,e,r){var n=Ir(t)?$e:Ae,o=arguments.length<3;return n(t,we(e,4),r,o,co)}function Se(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return r(this,void 0,void 0,function(){var r,i,a,c,s,f,l,h,p;return n(this,function(n){switch(n.label){case 0:r=0,i=!0,n.label=1;case 1:n.trys.push([1,6,7,8]),a=o(t),c=a.next(),n.label=2;case 2:return c.done?[3,5]:(s=c.value,r++,[4,De(s).apply(void 0,u(e))]);case 3:if(!1===(f=n.sent()))return i=!1,[3,5];n.label=4;case 4:return c=a.next(),[3,2];case 5:return[3,8];case 6:return l=n.sent(),h={error:l},[3,8];case 7:try{c&&!c.done&&(p=a.return)&&p.call(a)}finally{if(h)throw h.error}return[7];case 8:return[2,{count:r,success:i}]}})})}function Re(t,e){if(0===e.indexOf("//"))for(e=e.replace("//","/");!t.isRoot;)t=t.ctx.$parent.router;else for(0===e.indexOf("./")&&(e=e.replace("./","/"),t=t.ctx.$child.router);e&&e.match(/\/?\.\./i)&&!t.isRoot;)t=t.ctx.$parent.router,e=e.replace(/\/?\.\./i,"");return{router:t,path:e}}function Ee(t){var e=t.router,r=t.path;return e.ctx.base+r}function Ce(t){for(var e=t.router,r=t.path,n=e.ctx;n;){if(n.router.isNavigating(),n.$child?!$(r,n.pathname):r!==n.pathname)return!1;r=r.substr(n.pathname.length)||"/",n=n.$child}return!0}function ze(t){return"GeneratorFunction"===t.constructor.name}function Me(t){return!v(t)&&d(t.then)}function De(t){var e=this;return void 0===t&&(t=b),function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return r(e,void 0,void 0,function(){var e,r,i;return n(this,function(n){switch(n.label){case 0:return e=function(){return t.length===o.length+1?new Promise(function(e){t.apply(void 0,u(o,[e]))}):t.apply(void 0,u(o))},r=e(),Me(r)?[4,r]:[3,2];case 1:return i=n.sent(),[3,3];case 2:i=r,n.label=3;case 3:return[2,i]}})})}}function Ne(t,e){for(var r,n=[],o=0,i=0,u="",a=e&&e.delimiter||"/";null!=(r=Ri.exec(t));){var c=r[0],s=r[1],f=r.index;if(u+=t.slice(i,f),i=f+c.length,s)u+=s[1];else{var l=t[i],h=r[2],p=r[3],d=r[4],v=r[5],b=r[6],y=r[7];u&&(n.push(u),u="");var g=null!=h&&null!=l&&l!==h,_="+"===b||"*"===b,m="?"===b||"*"===b,w=r[2]||a,j=d||v;n.push({name:p||o++,prefix:h||"",delimiter:w,optional:m,repeat:_,partial:g,asterisk:!!y,pattern:j?Ue(j):y?".*":"[^"+Le(w)+"]+?"})}}return i<t.length&&(u+=t.substr(i)),u&&n.push(u),n}function Te(t,e){return Fe(Ne(t,e))}function Be(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Ie(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Fe(t){for(var e=new Array(t.length),r=0;r<t.length;r++)"object"==typeof t[r]&&(e[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r,n){for(var o="",i=r||{},u=n||{},a=u.pretty?Be:encodeURIComponent,c=0;c<t.length;c++){var s=t[c];if("string"!=typeof s){var f,l=i[s.name];if(null==l){if(s.optional){s.partial&&(o+=s.prefix);continue}throw new TypeError('Expected "'+s.name+'" to be defined')}if(Oi(l)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(0===l.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<l.length;h++){if(f=a(l[h]),!e[c].test(f))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but received `'+JSON.stringify(f)+"`");o+=(0===h?s.prefix:s.delimiter)+f}}else{if(f=s.asterisk?Ie(l):a(l),!e[c].test(f))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but received "'+f+'"');o+=s.prefix+f}}else o+=s}return o}}function Le(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function Ue(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function qe(t,e){return t.keys=e,t}function Qe(t){return t.sensitive?"":"i"}function Ve(t,e){var r=t.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)e.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return qe(t,e)}function We(t,e,r){for(var n=[],o=0;o<t.length;o++)n.push(Ke(t[o],e,r).source);return qe(new RegExp("(?:"+n.join("|")+")",Qe(r)),e)}function Ge(t,e,r){return He(Ne(t,r),e,r)}function He(t,e,r){Oi(e)||(r=e||r,e=[]),r=r||{};for(var n=r.strict,o=!1!==r.end,i="",u=0;u<t.length;u++){var a=t[u];if("string"==typeof a)i+=Le(a);else{var c=Le(a.prefix),s="(?:"+a.pattern+")";e.push(a),a.repeat&&(s+="(?:"+c+s+")*"),s=a.optional?a.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")",i+=s}}var f=Le(r.delimiter||"/"),l=i.slice(-f.length)===f;return n||(i=(l?i.slice(0,-f.length):i)+"(?:"+f+"(?=$))?"),i+=o?"$":n&&l?"":"(?="+f+"|$)",qe(new RegExp("^"+i,Qe(r)),e)}function Ke(t,e,r){return Oi(e)||(r=e||r,e=[]),r=r||{},t instanceof RegExp?Ve(t,e):Oi(t)?We(t,e,r):Ge(t,e,r)}function Je(t){for(;!v(t);){if(!v(t.$router))return t.$router;t=t.$parentContext}return Ci.head}function Xe(t){var e=this,r=Ci.head;if(r)for(;r.bound;)r=r.ctx.$child.router;else r=new Ci(Ci.getPathFromLocation(),void 0,t);if(r.bound=!0,r.isRoot)r.ctx.runBeforeRender().then(function(){r.ctx._redirect?r.ctx.runAfterRender().then(function(){var t=Re(r,r.ctx._redirect),e=t.router,n=t.path;e.update(n,r.ctx._redirectArgs)}):(r.ctx.render(),xe(Ci.onInit,function(t){return t(e)}))});else if(r.ctx._redirect){var n=Re(r,r.ctx._redirect),o=n.router,i=n.path;o.update(i,r.ctx._redirectArgs)}return r}var Ye=s(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),Ze=s(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),tr=Ye["__core-js_shared__"]||(Ye["__core-js_shared__"]={}),er=function(t){return tr[t]||(tr[t]={})},rr=0,nr=Math.random(),or=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++rr+nr).toString(36))},ir=s(function(t){var e=er("wks"),r=Ye.Symbol,n="function"==typeof r;(t.exports=function(t){return e[t]||(e[t]=n&&r[t]||(n?r:or)("Symbol."+t))}).store=e}),ur=ir,ar={f:ur},cr=function(t){return"object"==typeof t?null!==t:"function"==typeof t},sr=function(t){if(!cr(t))throw TypeError(t+" is not an object!");return t},fr=function(t){try{return!!t()}catch(t){return!0}},lr=!fr(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),hr=Ye.document,pr=cr(hr)&&cr(hr.createElement),dr=function(t){return pr?hr.createElement(t):{}},vr=!lr&&!fr(function(){return 7!=Object.defineProperty(dr("div"),"a",{get:function(){return 7}}).a}),br=function(t,e){if(!cr(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!cr(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!cr(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!cr(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},yr=Object.defineProperty,gr=lr?Object.defineProperty:function(t,e,r){if(sr(t),e=br(e,!0),sr(r),vr)try{return yr(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t},_r={f:gr},mr=_r.f,wr=function(t){var e=Ze.Symbol||(Ze.Symbol=Ye.Symbol||{});"_"==t.charAt(0)||t in e||mr(e,t,{value:ar.f(t)})};wr("asyncIterator"),wr("observable");var jr="object"==typeof global&&global&&global.Object===Object&&global,xr="object"==typeof self&&self&&self.Object===Object&&self,Or=jr||xr||Function("return this")(),Pr=Or.Symbol,$r=Object.prototype,Ar=$r.hasOwnProperty,kr=$r.toString,Sr=Pr?Pr.toStringTag:void 0,Rr=Object.prototype,Er=Rr.toString,Cr="[object Null]",zr="[object Undefined]",Mr=Pr?Pr.toStringTag:void 0,Dr="[object AsyncFunction]",Nr="[object Function]",Tr="[object GeneratorFunction]",Br="[object Proxy]",Ir=Array.isArray,Fr="[object Symbol]",Lr=1/0,Ur=Pr?Pr.prototype:void 0,qr=Ur?Ur.toString:void 0,Qr=NaN,Vr=/^\s+|\s+$/g,Wr=/^[-+]0x[0-9a-f]+$/i,Gr=/^0b[01]+$/i,Hr=/^0o[0-7]+$/i,Kr=parseInt,Jr=1/0,Xr=1.7976931348623157e308,Yr="[object Boolean]",Zr=k(Object.getPrototypeOf,Object),tn="[object Object]",en=Function.prototype,rn=Object.prototype,nn=en.toString,on=rn.hasOwnProperty,un=nn.call(Object),an="[object String]",cn="[object Arguments]",sn=Object.prototype,fn=sn.hasOwnProperty,ln=sn.propertyIsEnumerable,hn=z(function(){return arguments}())?z:function(t){return _(t)&&fn.call(t,"callee")&&!ln.call(t,"callee")},pn=Pr?Pr.isConcatSpreadable:void 0,dn=Or["__core-js_shared__"],vn=function(){var t=/[^.]+$/.exec(dn&&dn.keys&&dn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),bn=Function.prototype,yn=bn.toString,gn=/[\\^$.*+?()[\]{}|]/g,_n=/^\[object .+?Constructor\]$/,mn=Function.prototype,wn=Object.prototype,jn=mn.toString,xn=wn.hasOwnProperty,On=RegExp("^"+jn.call(xn).replace(gn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pn=function(){try{var t=U(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),$n=Object.prototype,An=$n.hasOwnProperty,kn=Math.max,Sn=Pn?function(t,e){return Pn(t,"toString",{configurable:!0,enumerable:!1,value:J(e),writable:!0})}:G,Rn=800,En=16,Cn=Date.now,zn=function(t){var e=0,r=0;return function(){var n=Cn(),o=En-(n-r);if(r=n,o>0){if(++e>=Rn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Sn),Mn=9007199254740991,Dn=9007199254740991,Nn=/^(?:0|[1-9]\d*)$/,Tn="object"==typeof t&&t&&!t.nodeType&&t,Bn=Tn&&"object"==typeof module&&module&&!module.nodeType&&module,In=Bn&&Bn.exports===Tn,Fn=In?Or.Buffer:void 0,Ln=Fn?Fn.isBuffer:void 0,Un=Ln||ot,qn={};qn["[object Float32Array]"]=qn["[object Float64Array]"]=qn["[object Int8Array]"]=qn["[object Int16Array]"]=qn["[object Int32Array]"]=qn["[object Uint8Array]"]=qn["[object Uint8ClampedArray]"]=qn["[object Uint16Array]"]=qn["[object Uint32Array]"]=!0,qn["[object Arguments]"]=qn["[object Array]"]=qn["[object ArrayBuffer]"]=qn["[object Boolean]"]=qn["[object DataView]"]=qn["[object Date]"]=qn["[object Error]"]=qn["[object Function]"]=qn["[object Map]"]=qn["[object Number]"]=qn["[object Object]"]=qn["[object RegExp]"]=qn["[object Set]"]=qn["[object String]"]=qn["[object WeakMap]"]=!1;var Qn="object"==typeof t&&t&&!t.nodeType&&t,Vn=Qn&&"object"==typeof module&&module&&!module.nodeType&&module,Wn=Vn&&Vn.exports===Qn,Gn=Wn&&jr.process,Hn=function(){try{return Gn&&Gn.binding&&Gn.binding("util")}catch(t){}}(),Kn=Hn&&Hn.isTypedArray,Jn=Kn?function(t){return function(e){return t(e)}}(Kn):it,Xn=Object.prototype,Yn=Xn.hasOwnProperty,Zn=Object.prototype,to=Object.prototype,eo=to.hasOwnProperty,ro=rt(function(t,e){W(e,ft(e),t)}),no=rt(function(t,e,r,n){W(e,ft(e),t,n)}),oo=function(t){return function(e,r,n){for(var o=-1,i=Object(e),u=n(e),a=u.length;a--;){var c=u[t?a:++o];if(!1===r(i[c],c,i))break}return e}}(),io=k(Object.keys,Object),uo=Object.prototype,ao=uo.hasOwnProperty,co=function(t,e){return function(r,n){if(null==r)return r;if(!Z(r))return t(r,n);for(var o=r.length,i=e?o:-1,u=Object(r);(e?i--:++i<o)&&!1!==n(u[i],i,u););return r}}(dt),so=Array.prototype,fo=so.splice;wt.prototype.clear=vt,wt.prototype.delete=yt,wt.prototype.get=gt,wt.prototype.has=_t,wt.prototype.set=mt;var lo=U(Or,"Map"),ho=U(Object,"create"),po="__lodash_hash_undefined__",vo=Object.prototype,bo=vo.hasOwnProperty,yo=Object.prototype,go=yo.hasOwnProperty,_o="__lodash_hash_undefined__";Et.prototype.clear=$t,Et.prototype.delete=At,Et.prototype.get=kt,Et.prototype.has=St,Et.prototype.set=Rt,It.prototype.clear=Ct,It.prototype.delete=Dt,It.prototype.get=Nt,It.prototype.has=Tt,It.prototype.set=Bt;var mo=200;Lt.prototype.clear=jt,Lt.prototype.delete=xt,Lt.prototype.get=Ot,Lt.prototype.has=Pt,Lt.prototype.set=Ft;var wo="__lodash_hash_undefined__";Qt.prototype.add=Qt.prototype.push=Ut,Qt.prototype.has=qt;var jo=1,xo=2,Oo=Or.Uint8Array,Po=1,$o=2,Ao="[object Boolean]",ko="[object Date]",So="[object Error]",Ro="[object Map]",Eo="[object Number]",Co="[object RegExp]",zo="[object Set]",Mo="[object String]",Do="[object Symbol]",No="[object ArrayBuffer]",To="[object DataView]",Bo=Pr?Pr.prototype:void 0,Io=Bo?Bo.valueOf:void 0,Fo=Object.prototype,Lo=Fo.propertyIsEnumerable,Uo=Object.getOwnPropertySymbols,qo=Uo?function(t){return null==t?[]:(t=Object(t),lt(Uo(t),function(e){return Lo.call(t,e)}))}:Yt,Qo=1,Vo=Object.prototype,Wo=Vo.hasOwnProperty,Go=U(Or,"DataView"),Ho=U(Or,"Promise"),Ko=U(Or,"Set"),Jo=U(Or,"WeakMap"),Xo=I(Go),Yo=I(lo),Zo=I(Ho),ti=I(Ko),ei=I(Jo),ri=h;(Go&&"[object DataView]"!=ri(new Go(new ArrayBuffer(1)))||lo&&"[object Map]"!=ri(new lo)||Ho&&"[object Promise]"!=ri(Ho.resolve())||Ko&&"[object Set]"!=ri(new Ko)||Jo&&"[object WeakMap]"!=ri(new Jo))&&(ri=function(t){var e=h(t),r="[object Object]"==e?t.constructor:void 0,n=r?I(r):"";if(n)switch(n){case Xo:return"[object DataView]";case Yo:return"[object Map]";case Zo:return"[object Promise]";case ti:return"[object Set]";case ei:return"[object WeakMap]"}return e});var ni=ri,oi=1,ii="[object Arguments]",ui="[object Array]",ai="[object Object]",ci=Object.prototype,si=ci.hasOwnProperty,fi=1,li=2,hi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pi=/^\w*$/,di="Expected a function";se.Cache=It;var vi=500,bi=/^\./,yi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gi=/\\(\\)?/g,_i=function(t){var e=se(t,function(t){return r.size===vi&&r.clear(),t}),r=e.cache;return e}(function(t){var e=[];return bi.test(t)&&e.push(""),t.replace(yi,function(t,r,n,o){e.push(n?o.replace(gi,"$1"):r||t)}),e}),mi=1/0,wi=1,ji=2,xi=function(){function t(t,e,r,n){void 0===n&&(n={}),this._queue=[],this._beforeNavigateCallbacks=[],this._appMiddlewareDownstream=[],this._routeMiddlewareDownstream=[];var o=t.resolveRoute(r),u=i(o.parse(r),3),a=u[0],c=u[1],s=u[2];ro(this,{$parent:e,router:t,route:o,params:a,path:r,pathname:c},n),e&&(e.$child=this),s&&new Ci(s,this).ctx}return t.prototype.addBeforeNavigateCallback=function(t){this._beforeNavigateCallbacks.unshift(t)},Object.defineProperty(t.prototype,"base",{get:function(){return this.router.isRoot?Ci.base:this.$parent.base+this.$parent.pathname},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canonicalPath",{get:function(){return this.base.replace(new RegExp(this.$root.base,"i"),"")+this.pathname},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"$root",{get:function(){for(var t=this;t;){if(!t.$parent)return t;t=t.$parent}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"$parents",{get:function(){for(var t=[],e=this.$parent;e;)t.push(e),e=e.$parent;return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"$children",{get:function(){for(var t=[],e=this.$child;e;)t.push(e),e=e.$child;return t},enumerable:!0,configurable:!0}),t.prototype.queue=function(t){this._queue.push(t)},t.prototype.redirect=function(t,e){void 0===e&&(e={}),this._redirect=t,this._redirectArgs=ro({},e,{push:!1})},t.prototype.runBeforeNavigateCallbacks=function(){return r(this,void 0,void 0,function(){var t,e,r;return n(this,function(n){switch(n.label){case 0:for(t=this,e=[];t;)e=u(t._beforeNavigateCallbacks,e),t=t.$child;return[4,Se(e)];case 1:return r=n.sent().success,[2,r]}})})},t.prototype.flushQueue=function(){return r(this,void 0,void 0,function(){var t,e,r=this;return n(this,function(n){switch(n.label){case 0:return t=Promise.all(this._queue).then(function(){r._queue=[]}),e=xe(this.$children,function(t){return t.flushQueue()}),[4,Promise.all(u([t],e))];case 1:return n.sent(),[2]}})})},t.prototype.render=function(){for(var t=this;t;)v(t._redirect)&&t.router.component(t.route.component),t=t.$child;e.tasks.runEarly()},t.prototype.runBeforeRender=function(e){return void 0===e&&(e=!0),r(this,void 0,void 0,function(){var r,o,i,u;return n(this,function(n){switch(n.label){case 0:return r=t.runMiddleware(Ci.middleware,this),o=t.runMiddleware(this.route.middleware,this),[4,Se(r)];case 1:return i=n.sent().count,[4,Se(o)];case 2:return u=n.sent().count,this._appMiddlewareDownstream=r.slice(0,i),this._routeMiddlewareDownstream=o.slice(0,u),this.$child&&v(this._redirect)?[4,this.$child.runBeforeRender(!1)]:[3,4];case 3:n.sent(),n.label=4;case 4:return e?[4,this.flushQueue()]:[3,6];case 5:n.sent(),n.label=6;case 6:return[2]}})})},t.prototype.runAfterRender=function(){return r(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,Se(T(this._appMiddlewareDownstream,this._routeMiddlewareDownstream))];case 1:return t.sent(),[4,this.flushQueue()];case 2:return t.sent(),[2]}})})},t.prototype.runBeforeDispose=function(t){return void 0===t&&(t=!0),r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:
  return this.$child&&v(this._redirect)?[4,this.$child.runBeforeDispose(!1)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[4,Se(T(this._routeMiddlewareDownstream,this._appMiddlewareDownstream))];case 3:return e.sent(),t?[4,this.flushQueue()]:[3,5];case 4:e.sent(),e.label=5;case 5:return[2]}})})},t.prototype.runAfterDispose=function(t){return void 0===t&&(t=!0),r(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return this.$child&&v(this._redirect)?[4,this.$child.runAfterDispose(!1)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[4,Se(T(this._routeMiddlewareDownstream,this._appMiddlewareDownstream))];case 3:return e.sent(),t?[4,this.flushQueue()]:[3,5];case 4:e.sent(),e.label=5;case 5:return[2]}})})},t.runMiddleware=function(e,o){var i=this;return xe(e,function(e){var u=t.generatorify(e)(o),a=!0;return function(){return r(i,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return t=u.next()||{},Me(t)?[4,t]:[3,2];case 1:return e.sent(),[3,4];case 2:return Me(t.value)?[4,t.value]:[3,4];case 3:e.sent(),e.label=4;case 4:return a?(a=!1,[2,v(o._redirect)]):[2,!0]}})})}})},t.generatorify=function(t){return ze(t)?t:function(e){return c(this,arguments,function(){var r;return n(this,function(n){switch(n.label){case 0:return[4,a(De(t)(e))];case 1:return r=n.sent(),S(r)?[4,a(De(r.beforeRender)())]:[3,10];case 2:return[4,n.sent()];case 3:return n.sent(),[4,a(De(r.afterRender)())];case 4:return[4,n.sent()];case 5:return n.sent(),[4,a(De(r.beforeDispose)())];case 6:return[4,n.sent()];case 7:return n.sent(),[4,a(De(r.afterDispose)())];case 8:return[4,n.sent()];case 9:return n.sent(),[3,12];case 10:return[4,r];case 11:n.sent(),n.label=12;case 12:return[2]}})})}},t}(),Oi=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},Pi=Ke,$i=Ne,Ai=Te,ki=Fe,Si=He,Ri=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");Pi.parse=$i,Pi.compile=Ai,Pi.tokensToFunction=ki,Pi.tokensToRegExp=Si;var Ei=function(){function t(e,r){var n=i(t.parseConfig(r),3),o=n[0],u=n[1],a=n[2];this.path=e,this.component=o,this.middleware=u,this.children=a;var c=i(t.parsePath(e,!v(a)),2),s=c[0],f=c[1];this.keys=s,this.regexp=f}return t.prototype.matches=function(t){var e=this.regexp.exec(t);if(null===e)return!1;if(this.children){try{for(var r=o(this.children),n=r.next();!n.done;n=r.next()){var i=n.value,u="/"+(e[e.length-1]||"");if(i.matches(u))return!0}}catch(t){a={error:t}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(a)throw a.error}}return!1}return!0;var a,c},t.prototype.parse=function(t){for(var e,r={},n=this.regexp.exec(t),o=1,i=n.length;o<i;++o){var u=this.keys[o-1],a=n[o]||"";"__child_path__"===u.name?(e="/"+a,t=t.replace(new RegExp(e+"$"),"")):r[u.name]=a}return[r,t,e]},t.parseConfig=function(e){var r,n,o=ke(e,function(e,o){return R(o)?(o=o,r=o):S(o)?(o=o,n=xe(o,function(e,r){return new t(r,e)}),r||(r="ko-component-router")):d(o)&&(o=o,e.push(o)),e},[]);return[r,o,n]},t.parsePath=function(t,e){e&&(t=t.replace(/\/?!?$/,"/!")),t="!"===t[t.length-1]?t.replace("!",":__child_path__(.*)?"):t.replace(/\(?\*\)?/,"(.*)");var r=[];return[r,Pi(t,r)]},t}(),Ci=function(){function t(r,n,o){void 0===o&&(o={}),this.onInit=[],this.component=e.observable(null),this.isNavigating=e.observable(!0),this.isRoot=v(n),this.routes=this.isRoot?t.createRoutes(t.routes):n.route.children,this.isRoot&&(t.head=this,document.addEventListener(t.events.click,t.onclick),window.addEventListener(t.events.popstate,t.onpopstate)),this.ctx=new xi(this,n,t.getPath(r),o)}return Object.defineProperty(t.prototype,"initialized",{get:function(){var t=this;return this.isNavigating()?new Promise(function(e){return t.onInit.push(e)}):Promise.resolve(this)},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;this.isNavigating(!1),this.ctx.runAfterRender().then(function(){for(var e=t.ctx;e;)xe(e.router.onInit,function(t){return function(e){return e(t)}}(e.router)),e=e.$child})},t.prototype.update=function(o,u){return r(this,void 0,void 0,function(){var r,a,c,s,f,l,h,p,d,b,y,g,_,m,w,j;return n(this,function(n){switch(n.label){case 0:return r=A(u)?{push:u}:v(u)?{}:u,v(r.push)&&(r.push=!0),v(r.with)&&(r.with={}),a=this.ctx,c=t.parseUrl(o),s=c.search,f=c.hash,l=t.getPath(o),h=this.resolveRoute(l),p=i(h.parse(l),3),d=p[1],b=p[2],y=a.pathname===d,a.$child&&y&&!r.force?[4,a.$child.router.update(b+s+f,r)]:[3,2];case 1:return[2,n.sent()];case 2:return g=new xi(this,this.ctx.$parent,l,r.with),g.route?[4,a.runBeforeNavigateCallbacks()]:[2,!1];case 3:return!1===(_=n.sent())?[2,!1]:(this.isNavigating(!0),[4,a.runBeforeDispose()]);case 4:return n.sent(),history[r.push?"pushState":"replaceState"](history.state,document.title,g.base+g.path+s+f),[4,g.runBeforeRender()];case 5:return n.sent(),v(g._redirect)&&(this.component(null),e.tasks.runEarly()),this.ctx=g,[4,a.runAfterDispose()];case 6:return n.sent(),g.render(),v(g._redirect)?[3,8]:[4,g.runAfterRender()];case 7:n.sent(),m=Re(g.router,g._redirect),w=m.router,j=m.path,w.update(j,g._redirectArgs),n.label=8;case 8:return[2,!0]}})})},t.prototype.resolveRoute=function(t){var e,r=1/0;for(var n in this.routes)if(this.routes.hasOwnProperty(n)){var o=this.routes[n];if(o.matches(t)){if(0===o.keys.length)return o;(r===1/0||o.keys.length<r&&".*"!==o.keys[0].pattern)&&(r=o.keys.length,e=o)}}return e},t.prototype.dispose=function(){this.isRoot&&(document.removeEventListener(t.events.click,t.onclick,!1),window.removeEventListener(t.events.popstate,t.onpopstate,!1),delete t.head)},Object.defineProperty(t,"initialized",{get:function(){var e=this;return t.head?Promise.resolve(t.head):new Promise(function(t){return e.onInit.push(t)})},enumerable:!0,configurable:!0}),Object.defineProperty(t,"base",{get:function(){return t.config.base+(t.config.hashbang?"/#!":"")},enumerable:!0,configurable:!0}),t.setConfig=function(e){var r=e.base,n=e.hashbang,o=e.activePathCSSClass;no(t.config,{base:r,hashbang:n,activePathCSSClass:o},function(t,e){return v(e)?t:e})},t.use=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];(n=t.middleware).push.apply(n,u(e));var n},t.usePlugin=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];(n=t.plugins).push.apply(n,u(e));var n},t.useRoutes=function(e){ro(t.routes,t.normalizeRoutes(e))},t.get=function(e){for(var r=t.head;e-- >0;)r=r.ctx.$child.router;return r},t.update=function(e,o){return r(this,void 0,void 0,function(){return n(this,function(r){switch(r.label){case 0:return[4,t.head.update(e,o)];case 1:return[2,r.sent()]}})})},t.getPathFromLocation=function(){var e=location.pathname+location.search+location.hash,r=t.config.base.replace("#!","#?!?");return e.replace(new RegExp(r,"i"),"")},t.onclick=function(e){if(!e.defaultPrevented){for(var r=e.target;r&&"A"!==r.nodeName;)r=r.parentNode;if(r&&"A"===r.nodeName){var n=r.pathname,o=r.search,i=r.hash,u=void 0===i?"":i,a=(n+o+u).replace(new RegExp(t.base,"i"),""),c=t.hasRoute(a),s=!t.sameOrigin(r.href),f=1!==t.which(e),l=r.hasAttribute("download"),h="#"===r.getAttribute("href"),p=0===(r.getAttribute("href")||"").indexOf("mailto:"),d="external"===r.getAttribute("rel"),v=e.metaKey||e.ctrlKey||e.shiftKey,b=r.hasAttribute("target");!c||s||f||l||h||p||d||v||b||(t.update(a),e.preventDefault())}}},t.onpopstate=function(e){t.update(t.getPathFromLocation(),!1),e.preventDefault()},t.canonicalizePath=function(t){return t.replace(new RegExp("/?#?!?/?"),"/")},t.parseUrl=function(e){var r=document.createElement("a"),n=t.base.toLowerCase();return n&&0===e.toLowerCase().indexOf(n)&&(e=e.replace(new RegExp(n,"i"),"")||"/"),r.href=t.canonicalizePath(e),{hash:r.hash,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname,search:r.search}},t.getPath=function(e){return t.parseUrl(e).pathname},t.hasRoute=function(e){return!v(t.head.resolveRoute(t.getPath(e)))},t.createRoutes=function(t){return xe(t,function(t,e){return new Ei(e,t)})},t.normalizeRoutes=function(e){return Pe(e,function(e){return xe(t.runPlugins(e),function(e){return S(e)?t.normalizeRoutes(e):e})})},t.runPlugins=function(e){return Oe(E(e),function(e){var r=ke(t.plugins,function(t,r){var n=r(e);return v(n)?t:t.concat(E(n))},[]);return r.length>0?r:e})},t.sameOrigin=function(t){var e=location.hostname,r=location.port,n=location.protocol,o=n+"//"+e;return r&&(o+=":"+r),t&&0===t.indexOf(o)},t.which=function(t){return t=t||window.event,null===t.which?t.button:t.which},t.routes={},t.events={click:document.ontouchstart?"touchstart":"click",popstate:"popstate"},t.onInit=[],t.middleware=[],t.plugins=[],t.config={base:"",hashbang:!1,activePathCSSClass:"active-path"},t}();e.bindingHandlers.path={init:function(t,r,n,o,i){var u=n.get("pathActiveClass")||Ci.config.activePathCSSClass;Ci.initialized.then(function(){var n=e.pureComputed(function(){return Re(Je(i),e.unwrap(r()))});e.applyBindingsToNode(t,{attr:{href:e.pureComputed(function(){return Ee(n())})},css:(o={},o[u]=e.pureComputed(function(){return Ce(n())}),o)});var o})}},e.components.register("ko-component-router",{synchronous:!0,viewModel:{createViewModel:Xe},template:'<div data-bind="if: component">\n      <div class="ko-component-router-view" data-bind="__ko_component_router__"></div>\n    </div>'}),e.bindingHandlers.__ko_component_router__={init:function(t,r,n,o,i){var u=i.$rawData;return e.applyBindingsToNode(t,{css:u.component,component:{name:u.component,params:u.ctx}},i.extend({$router:u})),u.isRoot?u.init():u.ctx.$parent.router.initialized.then(function(){return u.init()}),{controlsDescendantBindings:!0}}},t.Context=xi,t.Route=Ei,t.Router=Ci,t.isActivePath=Ce,t.resolveHref=Ee,Object.defineProperty(t,"__esModule",{value:!0})});