Comparing version 0.11.1 to 0.11.2
@@ -177,3 +177,5 @@ "use strict"; | ||
lastChunk = item.chunksCache[item.chunksCache.length - 1]; | ||
if (lastChunk.type !== 'mount' && lastChunk.type !== 'error') { | ||
if (lastChunk.type !== 'mount' && | ||
lastChunk.type !== 'error' && | ||
(!this.options.predicate || this.options.predicate(lastChunk, item.chunksCache))) { | ||
chunksMapArray.push([ | ||
@@ -180,0 +182,0 @@ URLTools_1.joinPaths(item.pathname, '/'), |
@@ -175,3 +175,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
lastChunk = item.chunksCache[item.chunksCache.length - 1]; | ||
if (lastChunk.type !== 'mount' && lastChunk.type !== 'error') { | ||
if (lastChunk.type !== 'mount' && | ||
lastChunk.type !== 'error' && | ||
(!this.options.predicate || this.options.predicate(lastChunk, item.chunksCache))) { | ||
chunksMapArray.push([ | ||
@@ -178,0 +180,0 @@ joinPaths(item.pathname, '/'), |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("history")):"function"==typeof define&&define.amd?define(["exports","history"],t):t((e=e||self).Navi={},e.History)}(this,function(e,t){"use strict";var r=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},n=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("composeMatchers() expects at least one matcher.");return 1===e.length?e[0]:e.reduce(function(e,t){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return e(t.apply(void 0,n(r)))}})}function i(e,t){return e==t||!(!e||!t)&&(e.pathname==t.pathname&&e.search==t.search&&e.hash==t.hash&&e.state==t.state)}var a=/((((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;function s(e,t){var r,n,o,i,s,l,h=void 0===t?{}:t,f=h.ensureTrailingSlash,p=void 0===f||f,b=h.removeHash,d=void 0!==b&&b;if("string"==typeof e){var y=a.exec(e);if(!y)throw new Error("Couldn't parse the provided URL.");r="",n=y[2]||"",o=u(i=y[6]||""),s=y[7]||""}else r=e.hostname||"",n=e.pathname||"",o=e.query||(e.search?u(e.search):{}),i=e.search||c(o),s=e.hash||"",l=e.state;return p&&n.length&&"/"!==n.substr(-1)&&(n+="/"),{hostname:r,pathname:n,query:o,search:i,hash:d?"":s,href:n+i+s,state:l}}function u(e,t){if(void 0===t&&(t="?"),!e||e[0]!=t)return{};for(var r={},n=e.slice(1).split("&"),o=0,i=n.length;o<i;o++){var a=n[o].split("=");r[a[0]]=a[1]?decodeURIComponent(a[1]):""}return r}function c(e,t){void 0===t&&(t="?");var r=Object.keys(e);if(0===r.length)return"";for(var n=[],o=0,i=r.length;o<i;o++){var a=r[o],s=String(e[a]);n.push(""===s?a:a+"="+encodeURIComponent(s))}return t+n.join("&")}function l(e,t){return t?("/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),"/"===t[0]&&(t=t.substr(1)),e+"/"+t):e}var h,f=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),p=function(e){function t(t){var r=this,n=this.constructor.prototype;return(r=e.call(this,t)||this).__proto__=n,Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,r.constructor):Object.defineProperty(r,"stack",{value:(new Error).stack}),Object.defineProperty(r,"message",{value:t}),r}return f(t,e),t}(Error),b=function(e){function t(t){var r=e.call(this,"URL not found: "+t)||this;return r.pathname=t,r.status=404,r.name="NotFoundError",r}return f(t,e),t}(p),d=function(e){function t(t){var r=e.call(this,"URL not managed by router: "+t.href)||this;return r.url=t,r.name="OutOfRootError",r}return f(t,e),t}(p);function y(e,t,r,n){return void 0===n&&(n=!0),Object.assign({type:e,url:s({pathname:t.mountpath,query:t.query},{ensureTrailingSlash:n})},r)}function v(e){var t=l(e.mountpath,e.path);return{type:"error",url:s({pathname:t,query:e.query}),error:new b(t)}}var m=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},w=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function g(e,t,r,n){var o,i,a,s,u,c,h;return m(this,function(f){switch(f.label){case 0:o="function"==typeof e?e:function(){return e};try{i=o(t,r)}catch(e){i=Promise.reject(e)}return(p=i)&&p.then?[3,1]:(a=n(i),[3,7]);case 1:s=i.then(x),u=function(e){var t={};return e.then(function(e){t.value=e,t.outcome="resolved"},function(e){t.error=e,t.outcome="rejected"}),t}(s),c=[y("busy",t,{promise:s})],f.label=2;case 2:return u.outcome?[3,4]:[4,c];case 3:return f.sent(),[3,2];case 4:return"rejected"!==u.outcome?[3,6]:((h=u.error)instanceof b&&!h.pathname&&(h.pathname=l(t.mountpath,t.path)),[4,[y("error",t,{error:h})]]);case 5:return f.sent(),[3,7];case 6:a=n(u.value),f.label=7;case 7:return a?Array.isArray(a)?[4,a.length?a:[]]:[3,9]:[3,11];case 8:return f.sent(),[3,11];case 9:return[5,w(a)];case 10:f.sent(),f.label=11;case 11:return[2]}var p})}function x(e){return function(e){return e&&"object"==typeof e&&"default"in e}(e)?e.default:e}var S=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function R(e,t){var r,n,o,i;return S(this,function(a){switch(a.label){case 0:o=[],i=[],a.label=1;case 1:return(r=e.next()).done||(o=r.value||[]),(n=t.next()).done||(i=n.value||[]),[4,o.concat(i)];case 2:a.sent(),a.label=3;case 3:if(!r.done||!n.done)return[3,1];a.label=4;case 4:return[2]}})}var k=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},O=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function P(e,t,r,n){function o(t,o,i){var a,s;return k(this,function(u){switch(u.label){case 0:return a=t.path,i||!a||"/"===a?[3,2]:[4,[v(t)]];case 1:return u.sent(),[3,4];case 2:return s=n&&!n(t)?function(){return k(this,function(e){switch(e.label){case 0:return[4,[]];case 1:return e.sent(),[2]}})}():g(e,t,o,function(e){return r(e,t)}),[5,O(i?R(s,i(t,o)):s)];case 3:u.sent(),u.label=4;case 4:return[2]}})}return function(e){return function(r,n){return o(r,n,t?t():e)}}}function j(e,t){return P(e,t,function(e,t){return e?[y("view",t,{view:e})]:[]},function(e){return"HEAD"!==e.method})}var E=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},C=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function L(e){return function(){return function(t,r){return E(this,function(n){switch(n.label){case 0:return[5,C(g(e,t,r,function(e){return e()(t,r)}))];case 1:return n.sent(),[2]}})}}}function U(e,t){return Object.defineProperties(t,{mountname:{get:function(){return t.mountpath}},pathname:{get:function(){return t.mountpath}},context:{get:function(){return e}}}),t}var T=function(){return(T=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},I="\0";function M(e,t){var r=e;if(r.length>1&&"/"===r.substr(-1)&&(r=r.substr(0,r.length-1)),"/"!==r[0]&&(r="/"+r),/\/{2,}/.test(r)&&(r=r.replace(/\/{2,}/g,"/")),/^([A-Za-z0-9\$\-_\.+!*'\(\),\/]|\/:)+$/.test(r),0===r.length)throw new Error('You cannot use an empty string "" as a pattern!');for(var n=r.split("/").slice(1),o=[],i=[],a=["^"],s=0;s<n.length;s++){var u=n[s];u.length>1&&":"===u[0]?(o.push(u.slice(1)),i.push(I),a.push("([^/]+)")):(i.push(u),a.push(u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))}return{key:i.join("/"),matcher:t,pattern:r,pathParamNames:o.length?o:void 0,regExp:new RegExp(a.join("/"))}}function D(e,t,r){var n=t.regExp.exec(e.path);if(n){var o=n[0],i=e.params;if(t.pathParamNames){i=T({},e.params);for(var a=0;a<t.pathParamNames.length;a++){i[t.pathParamNames[a]]=n[a+1]}}var s=e.path.slice(o.length)||"/",u=l(e.mountpath,o);return U(r,T({},e,{params:i,mountpath:u,path:s,url:s+e.search}))}}var G=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function q(e){if(!e)throw new Error("mount() must be supplied with a paths object.");var t=Object.keys(e),r=t.map(function(t){return M(t,e[t])}).sort(function(e,t){return r=e.key,n=t.key,r<n?-1:r>n?1:0;var r,n});return function(){return function(e,n){var o,i,a,s,u,c,l,h;return G(this,function(f){switch(f.label){case 0:for(s=r.length-1;s>=0;s--)if(u=r[s],c=D(e,u,n)){l=u.matcher(),i=l(c,n);break}f.label=1;case 1:return!i||a&&a.done||(a=i.next()),o=[y("mount",e,{patterns:t},!1)],(h=a&&a.value)?o=o.concat(h.length?h:[]):o.push(v(e)),[4,o];case 2:f.sent(),f.label=3;case 3:if(o.filter(H).length)return[3,1];f.label=4;case 4:return[2]}})}}}function H(e){return"busy"===e.type}function _(e){return P(e,void 0,function(e,t){var r,n=t.path;return n&&"/"!==n?[v(t)]:("string"==typeof e?r="./"===e.slice(0,2)?l(t.mountpath.split("/").slice(0,-1).join("/"),e.slice(2)):e:e&&(r=s(e).href),r?[y("redirect",t,{to:r})]:[])})}var N=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},A=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function V(e,t){return function(r){return function(n,o){return function(t,r,n){return N(this,function(o){switch(o.label){case 0:return[5,A(g(e,t,r,function(e){return n(t,e||{})}))];case 1:return o.sent(),[2]}})}(n,o,t?t():r)}}}function Q(e,t){return P(e,t,function(e,t){return e?[y("data",t,{data:e})]:[]})}function F(e,t){return P(e,t,function(e,t){return e?[y("title",t,{title:e})]:[]})}var $=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},z=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},B=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r},Y=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function Z(e){return function(t,r){return $(this,void 0,void 0,function(){var n,o,i,a;return z(this,function(s){switch(s.label){case 0:return n=e.getMeta?Promise.resolve(e.getMeta(t,r,void 0)).then(x).then(J):Promise.resolve(e.meta||{}),o=e.getTitle?Promise.resolve(e.getTitle(t,r,n)).then(x):Promise.resolve(e.title),"HEAD"!==t.method&&(i=e.getContent?Promise.resolve(e.getContent(t,r,n)).then(x):Promise.resolve(e.content)),a={},[4,n];case 1:return a.meta=s.sent(),[4,i];case 2:return a.content=s.sent(),[4,o];case 3:return[2,(a.title=s.sent(),a)]}})})}}function J(e){return e||{}}function K(e,t){return P(e,t,function(e,t){return e?[y("head",t,{head:e})]:[]},function(e){return"HEAD"!==e.method})}function W(e,t){return P(e,t,function(e,t){return e?[y("headers",t,{headers:e})]:[]})}function X(e,t){return P(e,t,function(e,t){return e?[y("status",t,{status:e})]:[]})}var ee=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},te=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},re=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r};function ne(e){return e||{}}var oe=function(){function e(e,t){this.close=e,this.observer=t,this.observer.start&&this.observer.start(this)}return e.prototype.unsubscribe=function(){this.closed||(this.closed=!0,this.close(this.observer),delete this.close,delete this.observer)},e}();function ie(e,t,r){return"function"==typeof e?{next:e,error:t,complete:r}:e}function ae(e){return new Promise(function(t,r){e.subscribe({start:function(e){this.subscription=e},next:function(e){this.value=e},complete:function(){t(this.value),this.subscription.unsubscribe()},error:function(e){r(e),this.subscription.unsubscribe()}})})}var se=function(){function e(e,t,r,n){var o=this;this.handleUnsubscribe=function(e){var t=o.observers.indexOf(e);-1!==t&&o.observers.splice(t,1)},this.handleChange=function(e){if(e===o.lastListenId){o.lastListenId++,o.refresh();for(var t=o.result.done||o.result.value.every(function(e){return"busy"!==e.type}),r=0;r<o.observers.length;r++){var n=o.observers[r];n.next(o.result.value),t&&n.complete&&n.complete()}t&&delete o.matcherIterator}},this.refresh=function(){var e=o.matcherIterator.next();if(e.value&&(o.result=e),!o.result.done){var t=++o.lastListenId,r=function(){return o.handleChange(t)};Promise.race(o.result.value.filter(ue).map(ce)).then(r,r)}},this.url=e,this.lastListenId=0,this.observers=[],this.matcherIterator=n(t,r)}return e.prototype.subscribe=function(e,t,r){if(!this.matcherIterator)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=ie(e,t,r);this.observers.push(n);var o=new oe(this.handleUnsubscribe,n);return 1===this.observers.length&&this.handleChange(this.lastListenId),o},e}();function ue(e){return"busy"===e.type}function ce(e){return e.promise}var le=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},he=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},fe=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},pe=function(){function e(e,t,r,n,o,i){var a=this;this.handleUnsubscribe=function(e){var t=a.observers.indexOf(e);-1!==t&&a.observers.splice(t,1)},this.handleResolverUpdate=function(e){e===a.lastListenId&&(a.lastListenId++,a.isRefreshing?a.isRefreshScheduled||(a.isRefreshScheduled=!0):a.refresh())},this.refresh=function(){return le(a,void 0,void 0,function(){var e,t,r,n,o,i,a,s,u,c,h,f,p,b,d,y,v,m,w=this;return he(this,function(g){switch(g.label){case 0:this.isRefreshScheduled=!1,this.isRefreshing=!0,e=[],t=0,r=function(){var r,o,i,a,s,u,c,h,f,p,b;return he(this,function(d){switch(d.label){case 0:r=n.mapItems[t],o=r.pathname,i=r.matcherIterator.next(),r.lastResult&&!i.value||(r.lastResult=i),a=r.lastResult.value,r.chunksCache=a||[],s=a.findIndex(function(e){return"error"===e.type||e.url.href.length>=r.url.href.length&&("mount"===e.type&&r.lastMountPatterns!==e.patterns||"redirect"===e.type&&r.lastRedirectTo!==e.to)}),d.label=1;case 1:if(!(s>=0&&s<a.length))return[3,6];if(u=a[s],s++,"error"===u.type||n.options.predicate&&!n.options.predicate(u,a))return n.removeFromQueue(r),[2,"continue-items"];if("redirect"===u.type&&(r.lastRedirectTo=u.to,n.options.followRedirects&&n.addToQueue(u.to,r.depth+1,r.walkedPatternLists,o,r.order)),"mount"!==u.type)return[3,5];if(c=u.patterns,r.lastMountPatterns=c,h=c.slice(0).sort().join("\n"),!c||r.walkedPatternLists.has(h))return[3,5];r.walkedPatternLists.add(h),f=0,d.label=2;case 2:return f<c.length?[4,n.expandPatterns(l(o,c[f]))]:[3,5];case 3:for(p=d.sent(),b=0;b<p.length;b++)n.addToQueue(p[b],r.depth+1,r.walkedPatternLists,o,r.order.concat(f,b));d.label=4;case 4:return f++,[3,2];case 5:return[3,1];case 6:return a&&(e=e.concat(a)),t++,[2]}})},n=this,g.label=1;case 1:return t<this.mapItems.length?[5,r()]:[3,3];case 2:switch(g.sent()){case"continue-items":return[3,1]}return[3,1];case 3:for(o=[],i=0;i<this.mapItems.length;i++)a=this.mapItems[i],"mount"!==(s=a.chunksCache[a.chunksCache.length-1]).type&&"error"!==s.type&&o.push([l(a.pathname,"/"),a.chunksCache,a.order]);if(u=++this.lastListenId,c=function(){return w.handleResolverUpdate(u)},Promise.race(e.filter(be).map(de)).then(c,c),o.sort(function(e,t){var r=e[2],n=t[2];if(r.length<n.length)return-1;if(r.length>n.length)return 1;for(var o=0;o<r.length;o++){if(r[o]<n[o])return-1;if(r[o]>n[o])return 1}return 0}),this.isRefreshScheduled)this.refresh();else{for(h={},f=!0,p=0;p<o.length;p++)b=fe(o[p],2),d=b[0],(y=b[1]).some(function(e){return"busy"===e.type})&&(f=!1),h[d]=y;for(v=0;v<this.observers.length;v++)(m=this.observers[v]).next(h),f&&m.complete&&m.complete();f&&(delete this.rootContext,delete this.mapItems,delete this.router,delete this.observers),this.isRefreshing=!1}return[2]}})})},this.observers=[],this.lastListenId=0,this.mapItems=[],this.router=o,this.rootContext=t,this.matcherGeneratorFunction=r,this.rootMapping=n,this.options=i,this.seenPathnames=new Set;var s=e.pathname;"/"===s.substr(-1)&&(s=s.substr(0,s.length-1)),this.addToQueue(s,0,new Set)}return e.prototype.subscribe=function(e,t,r){if(!this.observers)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=ie(e,t,r);this.observers.push(n);var o=new oe(this.handleUnsubscribe,n);return 1===this.observers.length&&this.refresh(),o},e.prototype.expandPatterns=function(e){return le(this,void 0,void 0,function(){var t;return he(this,function(r){switch(r.label){case 0:return this.options.expandPattern?[4,this.options.expandPattern(e,this.router)]:[3,2];case 1:if(t=r.sent())return[2,t];r.label=2;case 2:return[2,[e].filter(function(e){return!/\/:/.test(e)})]}})})},e.prototype.removeFromQueue=function(e){var t=this.mapItems.indexOf(e);-1!==t&&this.mapItems.splice(t,1)},e.prototype.addToQueue=function(e,t,r,n,o){if(void 0===o&&(o=[0]),!this.seenPathnames.has(e)&&(!this.options.maxDepth||t<=this.options.maxDepth)){this.seenPathnames.add(e);var i=s(e,{ensureTrailingSlash:!1,removeHash:!0}),a=D(U(this.rootContext,{body:null,headers:this.options.headers||{},method:this.options.method||"HEAD",params:{},hostname:this.options.hostname||"",mountpath:"",query:i.query,search:i.search,router:this.router,path:i.pathname,url:i.pathname+i.search,originalUrl:i.href}),this.rootMapping,this.rootContext);a&&this.mapItems.push({url:i,fromPathname:n,depth:t,pathname:e,order:o,walkedPatternLists:new Set(r),matcherIterator:this.matcherGeneratorFunction(a,this.rootContext)})}},e}();function be(e){return"busy"===e.type}function de(e){return e.promise}var ye=function(){return(ye=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function ve(e,t){return e=function(e,t){if(e){if("url"===t.type)return ye({},e,{chunks:e.chunks.filter(function(e){return"url"!==e.type}),url:t.url});if("ready"!==e.type)return e}var r={lastChunk:t,chunks:e?e.chunks.concat(t):[t],data:e?e.data:{},headers:e?e.headers:{},heads:e?e.heads:[],status:e?e.status:200,title:e&&e.title,url:e?e.url:t.url,views:e?e.views:[]};switch(t.type){case"busy":return ye({},r,{type:"busy"});case"data":return ye({},r,{type:"ready",data:ye({},r.data,t.data)});case"error":return ye({},r,{type:"error",error:t.error,status:r.status&&r.status>=400?r.status:t.error.status||500});case"head":return ye({},r,{type:"ready",heads:r.heads.concat(t.head)});case"headers":return ye({},r,{type:"ready",headers:ye({},r.headers,t.headers)});case"redirect":return ye({},r,{type:"redirect",to:t.to});case"status":return ye({},r,{type:"ready",status:t.status});case"title":return ye({},r,{type:"ready",title:t.title});case"view":return ye({},r,{type:"ready",views:r.views.concat(t.view)});default:return ye({},r,{type:"ready"})}}(e,t),Object.defineProperties(e,{meta:{configurable:!0,get:function(){return e.data}},content:{configurable:!0,get:function(){return t.view}},segments:{configurable:!0,get:function(){return e.chunks}},lastSegment:{configurable:!0,get:function(){return e.lastChunk}}}),e}var me=function(){function e(e){this.context=e.context||{},this.matcherGenerator=e.routes(),this.reducer=e.reducer||ve;var t,r,n=e.basename;n&&"/"===n.slice(-1)&&(n=n.slice(0,-1)),this.rootMapping=(t=e.routes,void 0===(r=n)&&(r=""),""!==r?M(r,t):{pattern:r,key:"",regExp:new RegExp(""),matcher:t})}return e.prototype.setContext=function(e){this.context=e||{}},e.prototype.createObservable=function(e,t){void 0===t&&(t={}),e.hash&&delete(e=Object.assign({},e)).hash;var r=D(U(this.context,{body:t.body,headers:t.headers||{},method:t.method||"GET",hostname:e.hostname,mountpath:"",params:e.query,query:e.query,search:e.search,router:this,url:e.pathname+e.search,originalUrl:e.href,path:e.pathname}),this.rootMapping,this.context);if(r)return new se(e,r,this.context,this.matcherGenerator)},e.prototype.createMapObservable=function(e,t){return void 0===t&&(t={}),new pe(s(e,{ensureTrailingSlash:!1}),this.context,this.matcherGenerator,this.rootMapping,this,t)},e.prototype.resolve=function(e,t){var r,n=this;if(void 0===t&&(t={}),Array.isArray(e))r=e.map(function(e){return s(e)});else if("string"==typeof e)r=[s(e)];else if(e.url)r=[s((t=e).url)];else{if(!t)throw new Error("You must specify a URL for router.resolve().");r=[s(e)]}if(!r.length)return Promise.resolve([]);var o=r.map(function(e){return n.getPageRoutePromise(e,t)});return Array.isArray(e)?Promise.all(o):o[0]},e.prototype.resolveSiteMap=function(e,t){var r=this;return void 0===t&&(t={}),ae(this.createMapObservable(e,t)).then(function(e){for(var t={},n={},o=Object.keys(e),i=0;i<o.length;i++){var a=o[i],u=e[a],c=u[u.length-1];"redirect"!==c.type?t[a]=[{type:"url",url:s(a)}].concat(u).reduce(r.reducer,void 0):n[a]=c.to}return{routes:t,redirects:n}})},e.prototype.resolveRouteMap=function(e,t){return void 0===t&&(t={}),this.resolveSiteMap(e,t).then(function(e){return e.routes})},e.prototype.getPageRoutePromise=function(e,t){var r=this,n=this.createObservable(e,t);return n?ae(n).then(function(n){for(var o=0;o<n.length;o++){var i=n[o];if("busy"===i.type)break;if("redirect"===i.type&&t.followRedirects)return r.getPageRoutePromise(s(i.to),t);if("error"===i.type)throw i.error}return[{type:"url",url:s(e)}].concat(n).reduce(r.reducer,void 0)}):Promise.reject(new d(e))},e}(),we=function(){return function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),Object.freeze(this)}}(),ge=function(){return(ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},xe=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},Se=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Re=function(){function e(e,t,r,n){var o=this;this.handleUnsubscribe=function(e){var t=o.observers.indexOf(e);-1!==t&&o.observers.splice(t,1)},this.handleChunkList=function(e){for(var t=!0,r=0;r<e.length;r++){var n=e[r];if("busy"===n.type&&(t=!1),"redirect"===n.type)return void o.history.replace(n.to)}o.setRoute([{type:"url",url:o.lastURL}].concat(e).reduce(o.reducer,void 0),t)},this.observers=[],this.isLastRouteSteady=!1,this.router=t,this.history=e,this.reducer=r,this.resolveOptions=n,this.lastURL=s(this.history.location),this.unlisten=this.history.listen(function(e){return o.handleURLChange(s(e))}),this.refresh()}return e.prototype.dispose=function(){this.observers.length=0,this.unlisten(),delete this.unlisten,delete this.history,this.observableSubscription&&this.observableSubscription.unsubscribe(),delete this.observableSubscription,delete this.router,delete this.waitUntilSteadyDeferred,delete this.lastRoute},e.prototype.refresh=function(){this.handleURLChange(s(this.history.location),!0)},e.prototype.setContext=function(e){this.router.setContext(e),this.refresh()},e.prototype.getValue=function(){return this.lastRoute},e.prototype.getSteadyRoute=function(){return xe(this,void 0,void 0,function(){return Se(this,function(e){return this.isLastRouteSteady?[2,Promise.resolve(this.lastRoute)]:(this.waitUntilSteadyDeferred||(this.waitUntilSteadyDeferred=new we),[2,this.waitUntilSteadyDeferred.promise])})})},e.prototype.subscribe=function(e,t,r){var n=ie(e,t,r);return this.observers.push(n),new oe(this.handleUnsubscribe,n)},e.prototype.handleURLChange=function(e,t){if(!t&&this.lastReceivedURL&&i(this.lastReceivedURL,e))for(var r=0;r<this.observers.length;r++)this.observers[r].next(this.lastRoute);else{if(this.lastReceivedURL=e,"/"!==e.pathname.substr(-1))return e=ge({},e,{pathname:e.pathname+"/"}),void this.history.replace(e);var n,o,a=this.lastURL;if(this.lastURL=e,e&&a&&(n=e.pathname!==a.pathname,o=e.search!==a.search),t||n||o||!this.lastRoute){this.observableSubscription&&this.observableSubscription.unsubscribe();var s=this.router.createObservable(e,this.resolveOptions);if(s)this.observableSubscription=s.subscribe(this.handleChunkList);else if(!a)throw new d(e)}else e.hash!==a.hash&&this.setRoute(this.reducer(this.lastRoute,{type:"url",url:e}),this.isLastRouteSteady)}},e.prototype.setRoute=function(e,t){if(e!==this.lastRoute){this.lastRoute=e,this.isLastRouteSteady=t,t&&this.waitUntilSteadyDeferred&&(this.waitUntilSteadyDeferred.resolve(e),delete this.waitUntilSteadyDeferred);for(var r=0;r<this.observers.length;r++)this.observers[r].next(e)}},e}(),ke=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},Oe=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};var Pe=function(){function e(e){e.pages&&(e.routes=e.pages);var r=e.reducer||ve;this.history=e.history||t.createBrowserHistory(),this.router=new me({context:e.context,routes:e.routes,basename:e.basename,reducer:r}),this.currentRouteObservable=new Re(this.history,this.router,r)}return e.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.history},e.prototype.setContext=function(e){this.currentRouteObservable.setContext(e)},e.prototype.getCurrentValue=function(){return this.currentRouteObservable.getValue()},e.prototype.getSteadyValue=function(){return this.currentRouteObservable.getSteadyRoute()},e.prototype.steady=function(){return ke(this,void 0,void 0,function(){return Oe(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},e.prototype.subscribe=function(e,t,r){var n=ie(e,t,r);return this.currentRouteObservable.subscribe(n)},e}(),je=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},Ee=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};var Ce=function(){function e(e){e.pages&&(e.routes=e.pages);var r=e.reducer||ve,n=e.url||e.request&&e.request.url;if(!n)throw new Error("createMemoriNavigation() could not find a URL.");this.history=t.createMemoryHistory({initialEntries:[s(n).href]}),this.options=e,this.router=new me({context:e.context,routes:this.options.routes||this.options.pages,basename:this.options.basename,reducer:r}),this.currentRouteObservable=new Re(this.history,this.router,r,e.request)}return e.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.options},e.prototype.setContext=function(e){this.currentRouteObservable.setContext(e)},e.prototype.getCurrentValue=function(){return this.currentRouteObservable.getValue()},e.prototype.getSteadyValue=function(){return this.currentRouteObservable.getSteadyRoute()},e.prototype.steady=function(){return je(this,void 0,void 0,function(){return Ee(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},e.prototype.subscribe=function(e,t,r){var n=ie(e,t,r);return this.currentRouteObservable.subscribe(n)},e}();e.compose=o,e.Router=me,e.createRouter=function(e){return new me(e)},e.defaultRouteReducer=ve,e.concatMatcherIterators=R,e.resolveChunks=g,e.createBrowserNavigation=function(e){return new Pe(e)},e.BrowserNavigation=Pe,e.createMemoryNavigation=function(e){return new Ce(e)},e.MemoryNavigation=Ce,e.lazy=L,e.map=L,e.createPage=function(e){return Object.assign(o(V(Z(e)),Q(function(e,t){return t.meta}),F(function(e,t){return t.title}),j(function(e,t){return t.content})),{isDeprecatedMatcher:!0})},e.createContext=function(e,t){return Object.assign(V(e,t.isDeprecatedMatcher?t:L(t)),{isDeprecatedMatcher:!0})},e.createSwitch=function(e){var t,r,n={};try{for(var i=Y(Object.keys(e.paths)),a=i.next();!a.done;a=i.next()){var s=a.value,u=e.paths[s];n[s]=u.isDeprecatedMatcher?u:L(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}if(1===Object.keys(e).length)return Object.assign(q(n),{isDeprecatedMatcher:!0});e.paths;var c=B(e,["paths"]);return Object.assign(o(V(Z(c)),Q(function(e,t){return t.meta}),F(function(e,t){return t.title}),j(function(e,t){return t.content}),q(n)),{isDeprecatedMatcher:!0})},e.createRedirect=function(e,t){var r=_(e);return t?o(Q(t),r):r},e.mount=q,e.redirect=_,e.route=function(e){if(void 0===e&&(e={}),"function"!=typeof e){var t=e.data,r=e.getData,n=e.head,i=e.getHead,a=e.headers,s=e.getHeaders,u=e.status,c=e.getStatus,l=e.title,h=e.getTitle,f=e.view,p=e.getView;re(e,["data","getData","head","getHead","headers","getHeaders","status","getStatus","title","getTitle","view","getView"]),e=function(e,o){return ee(this,void 0,void 0,function(){var b,d,y,v,m,w,g;return te(this,function(S){switch(S.label){case 0:return b=r?Promise.resolve(r(e,o,void 0)).then(x).then(ne):Promise.resolve(t||{}),d=s?Promise.resolve(s(e,o,b)).then(x):Promise.resolve(a),y=c?Promise.resolve(c(e,o,b)).then(x):Promise.resolve(u),v=h?Promise.resolve(h(e,o,b)).then(x):Promise.resolve(l),"HEAD"!==e.method&&(m=i?Promise.resolve(i(e,o,b)).then(x):Promise.resolve(n),w=p?Promise.resolve(p(e,o,b)).then(x):Promise.resolve(f)),g={},[4,b];case 1:return g.data=S.sent(),[4,m];case 2:return g.head=S.sent(),[4,d];case 3:return g.headers=S.sent(),[4,y];case 4:return g.status=S.sent(),[4,v];case 5:return g.title=S.sent(),[4,w];case 6:return[2,(g.view=S.sent(),g)]}})})}}return o(V(e),Q(function(e,t){return t.data}),K(function(e,t){return t.head}),W(function(e,t){return t.headers}),X(function(e,t){return t.status}),F(function(e,t){return t.title}),j(function(e,t){return t.view}))},e.withContext=V,e.withData=Q,e.withHead=K,e.withHeaders=W,e.withStatus=X,e.withTitle=F,e.withView=j,e.NaviError=p,e.NotFoundError=b,e.OutOfRootError=d,e.createRequest=U,e.createChunk=y,e.createNotFoundChunk=v,e.areURLDescriptorsEqual=i,e.createURLDescriptor=s,e.parseQuery=u,e.stringifyQuery=c,e.joinPaths=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("history")):"function"==typeof define&&define.amd?define(["exports","history"],t):t((e=e||self).Navi={},e.History)}(this,function(e,t){"use strict";var r=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},n=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("composeMatchers() expects at least one matcher.");return 1===e.length?e[0]:e.reduce(function(e,t){return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return e(t.apply(void 0,n(r)))}})}function i(e,t){return e==t||!(!e||!t)&&(e.pathname==t.pathname&&e.search==t.search&&e.hash==t.hash&&e.state==t.state)}var a=/((((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;function s(e,t){var r,n,o,i,s,l,h=void 0===t?{}:t,f=h.ensureTrailingSlash,p=void 0===f||f,b=h.removeHash,d=void 0!==b&&b;if("string"==typeof e){var y=a.exec(e);if(!y)throw new Error("Couldn't parse the provided URL.");r="",n=y[2]||"",o=u(i=y[6]||""),s=y[7]||""}else r=e.hostname||"",n=e.pathname||"",o=e.query||(e.search?u(e.search):{}),i=e.search||c(o),s=e.hash||"",l=e.state;return p&&n.length&&"/"!==n.substr(-1)&&(n+="/"),{hostname:r,pathname:n,query:o,search:i,hash:d?"":s,href:n+i+s,state:l}}function u(e,t){if(void 0===t&&(t="?"),!e||e[0]!=t)return{};for(var r={},n=e.slice(1).split("&"),o=0,i=n.length;o<i;o++){var a=n[o].split("=");r[a[0]]=a[1]?decodeURIComponent(a[1]):""}return r}function c(e,t){void 0===t&&(t="?");var r=Object.keys(e);if(0===r.length)return"";for(var n=[],o=0,i=r.length;o<i;o++){var a=r[o],s=String(e[a]);n.push(""===s?a:a+"="+encodeURIComponent(s))}return t+n.join("&")}function l(e,t){return t?("/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),"/"===t[0]&&(t=t.substr(1)),e+"/"+t):e}var h,f=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),p=function(e){function t(t){var r=this,n=this.constructor.prototype;return(r=e.call(this,t)||this).__proto__=n,Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,r.constructor):Object.defineProperty(r,"stack",{value:(new Error).stack}),Object.defineProperty(r,"message",{value:t}),r}return f(t,e),t}(Error),b=function(e){function t(t){var r=e.call(this,"URL not found: "+t)||this;return r.pathname=t,r.status=404,r.name="NotFoundError",r}return f(t,e),t}(p),d=function(e){function t(t){var r=e.call(this,"URL not managed by router: "+t.href)||this;return r.url=t,r.name="OutOfRootError",r}return f(t,e),t}(p);function y(e,t,r,n){return void 0===n&&(n=!0),Object.assign({type:e,url:s({pathname:t.mountpath,query:t.query},{ensureTrailingSlash:n})},r)}function v(e){var t=l(e.mountpath,e.path);return{type:"error",url:s({pathname:t,query:e.query}),error:new b(t)}}var m=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},w=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function g(e,t,r,n){var o,i,a,s,u,c,h;return m(this,function(f){switch(f.label){case 0:o="function"==typeof e?e:function(){return e};try{i=o(t,r)}catch(e){i=Promise.reject(e)}return(p=i)&&p.then?[3,1]:(a=n(i),[3,7]);case 1:s=i.then(x),u=function(e){var t={};return e.then(function(e){t.value=e,t.outcome="resolved"},function(e){t.error=e,t.outcome="rejected"}),t}(s),c=[y("busy",t,{promise:s})],f.label=2;case 2:return u.outcome?[3,4]:[4,c];case 3:return f.sent(),[3,2];case 4:return"rejected"!==u.outcome?[3,6]:((h=u.error)instanceof b&&!h.pathname&&(h.pathname=l(t.mountpath,t.path)),[4,[y("error",t,{error:h})]]);case 5:return f.sent(),[3,7];case 6:a=n(u.value),f.label=7;case 7:return a?Array.isArray(a)?[4,a.length?a:[]]:[3,9]:[3,11];case 8:return f.sent(),[3,11];case 9:return[5,w(a)];case 10:f.sent(),f.label=11;case 11:return[2]}var p})}function x(e){return function(e){return e&&"object"==typeof e&&"default"in e}(e)?e.default:e}var S=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function R(e,t){var r,n,o,i;return S(this,function(a){switch(a.label){case 0:o=[],i=[],a.label=1;case 1:return(r=e.next()).done||(o=r.value||[]),(n=t.next()).done||(i=n.value||[]),[4,o.concat(i)];case 2:a.sent(),a.label=3;case 3:if(!r.done||!n.done)return[3,1];a.label=4;case 4:return[2]}})}var k=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},O=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function P(e,t,r,n){function o(t,o,i){var a,s;return k(this,function(u){switch(u.label){case 0:return a=t.path,i||!a||"/"===a?[3,2]:[4,[v(t)]];case 1:return u.sent(),[3,4];case 2:return s=n&&!n(t)?function(){return k(this,function(e){switch(e.label){case 0:return[4,[]];case 1:return e.sent(),[2]}})}():g(e,t,o,function(e){return r(e,t)}),[5,O(i?R(s,i(t,o)):s)];case 3:u.sent(),u.label=4;case 4:return[2]}})}return function(e){return function(r,n){return o(r,n,t?t():e)}}}function j(e,t){return P(e,t,function(e,t){return e?[y("view",t,{view:e})]:[]},function(e){return"HEAD"!==e.method})}var E=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},C=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function L(e){return function(){return function(t,r){return E(this,function(n){switch(n.label){case 0:return[5,C(g(e,t,r,function(e){return e()(t,r)}))];case 1:return n.sent(),[2]}})}}}function U(e,t){return Object.defineProperties(t,{mountname:{get:function(){return t.mountpath}},pathname:{get:function(){return t.mountpath}},context:{get:function(){return e}}}),t}var T=function(){return(T=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},I="\0";function M(e,t){var r=e;if(r.length>1&&"/"===r.substr(-1)&&(r=r.substr(0,r.length-1)),"/"!==r[0]&&(r="/"+r),/\/{2,}/.test(r)&&(r=r.replace(/\/{2,}/g,"/")),/^([A-Za-z0-9\$\-_\.+!*'\(\),\/]|\/:)+$/.test(r),0===r.length)throw new Error('You cannot use an empty string "" as a pattern!');for(var n=r.split("/").slice(1),o=[],i=[],a=["^"],s=0;s<n.length;s++){var u=n[s];u.length>1&&":"===u[0]?(o.push(u.slice(1)),i.push(I),a.push("([^/]+)")):(i.push(u),a.push(u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))}return{key:i.join("/"),matcher:t,pattern:r,pathParamNames:o.length?o:void 0,regExp:new RegExp(a.join("/"))}}function D(e,t,r){var n=t.regExp.exec(e.path);if(n){var o=n[0],i=e.params;if(t.pathParamNames){i=T({},e.params);for(var a=0;a<t.pathParamNames.length;a++){i[t.pathParamNames[a]]=n[a+1]}}var s=e.path.slice(o.length)||"/",u=l(e.mountpath,o);return U(r,T({},e,{params:i,mountpath:u,path:s,url:s+e.search}))}}var G=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};function q(e){if(!e)throw new Error("mount() must be supplied with a paths object.");var t=Object.keys(e),r=t.map(function(t){return M(t,e[t])}).sort(function(e,t){return r=e.key,n=t.key,r<n?-1:r>n?1:0;var r,n});return function(){return function(e,n){var o,i,a,s,u,c,l,h;return G(this,function(f){switch(f.label){case 0:for(s=r.length-1;s>=0;s--)if(u=r[s],c=D(e,u,n)){l=u.matcher(),i=l(c,n);break}f.label=1;case 1:return!i||a&&a.done||(a=i.next()),o=[y("mount",e,{patterns:t},!1)],(h=a&&a.value)?o=o.concat(h.length?h:[]):o.push(v(e)),[4,o];case 2:f.sent(),f.label=3;case 3:if(o.filter(H).length)return[3,1];f.label=4;case 4:return[2]}})}}}function H(e){return"busy"===e.type}function _(e){return P(e,void 0,function(e,t){var r,n=t.path;return n&&"/"!==n?[v(t)]:("string"==typeof e?r="./"===e.slice(0,2)?l(t.mountpath.split("/").slice(0,-1).join("/"),e.slice(2)):e:e&&(r=s(e).href),r?[y("redirect",t,{to:r})]:[])})}var N=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},A=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function V(e,t){return function(r){return function(n,o){return function(t,r,n){return N(this,function(o){switch(o.label){case 0:return[5,A(g(e,t,r,function(e){return n(t,e||{})}))];case 1:return o.sent(),[2]}})}(n,o,t?t():r)}}}function Q(e,t){return P(e,t,function(e,t){return e?[y("data",t,{data:e})]:[]})}function F(e,t){return P(e,t,function(e,t){return e?[y("title",t,{title:e})]:[]})}var $=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},z=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},B=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r},Y=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}};function Z(e){return function(t,r){return $(this,void 0,void 0,function(){var n,o,i,a;return z(this,function(s){switch(s.label){case 0:return n=e.getMeta?Promise.resolve(e.getMeta(t,r,void 0)).then(x).then(J):Promise.resolve(e.meta||{}),o=e.getTitle?Promise.resolve(e.getTitle(t,r,n)).then(x):Promise.resolve(e.title),"HEAD"!==t.method&&(i=e.getContent?Promise.resolve(e.getContent(t,r,n)).then(x):Promise.resolve(e.content)),a={},[4,n];case 1:return a.meta=s.sent(),[4,i];case 2:return a.content=s.sent(),[4,o];case 3:return[2,(a.title=s.sent(),a)]}})})}}function J(e){return e||{}}function K(e,t){return P(e,t,function(e,t){return e?[y("head",t,{head:e})]:[]},function(e){return"HEAD"!==e.method})}function W(e,t){return P(e,t,function(e,t){return e?[y("headers",t,{headers:e})]:[]})}function X(e,t){return P(e,t,function(e,t){return e?[y("status",t,{status:e})]:[]})}var ee=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},te=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},re=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r};function ne(e){return e||{}}var oe=function(){function e(e,t){this.close=e,this.observer=t,this.observer.start&&this.observer.start(this)}return e.prototype.unsubscribe=function(){this.closed||(this.closed=!0,this.close(this.observer),delete this.close,delete this.observer)},e}();function ie(e,t,r){return"function"==typeof e?{next:e,error:t,complete:r}:e}function ae(e){return new Promise(function(t,r){e.subscribe({start:function(e){this.subscription=e},next:function(e){this.value=e},complete:function(){t(this.value),this.subscription.unsubscribe()},error:function(e){r(e),this.subscription.unsubscribe()}})})}var se=function(){function e(e,t,r,n){var o=this;this.handleUnsubscribe=function(e){var t=o.observers.indexOf(e);-1!==t&&o.observers.splice(t,1)},this.handleChange=function(e){if(e===o.lastListenId){o.lastListenId++,o.refresh();for(var t=o.result.done||o.result.value.every(function(e){return"busy"!==e.type}),r=0;r<o.observers.length;r++){var n=o.observers[r];n.next(o.result.value),t&&n.complete&&n.complete()}t&&delete o.matcherIterator}},this.refresh=function(){var e=o.matcherIterator.next();if(e.value&&(o.result=e),!o.result.done){var t=++o.lastListenId,r=function(){return o.handleChange(t)};Promise.race(o.result.value.filter(ue).map(ce)).then(r,r)}},this.url=e,this.lastListenId=0,this.observers=[],this.matcherIterator=n(t,r)}return e.prototype.subscribe=function(e,t,r){if(!this.matcherIterator)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=ie(e,t,r);this.observers.push(n);var o=new oe(this.handleUnsubscribe,n);return 1===this.observers.length&&this.handleChange(this.lastListenId),o},e}();function ue(e){return"busy"===e.type}function ce(e){return e.promise}var le=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},he=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},fe=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},pe=function(){function e(e,t,r,n,o,i){var a=this;this.handleUnsubscribe=function(e){var t=a.observers.indexOf(e);-1!==t&&a.observers.splice(t,1)},this.handleResolverUpdate=function(e){e===a.lastListenId&&(a.lastListenId++,a.isRefreshing?a.isRefreshScheduled||(a.isRefreshScheduled=!0):a.refresh())},this.refresh=function(){return le(a,void 0,void 0,function(){var e,t,r,n,o,i,a,s,u,c,h,f,p,b,d,y,v,m,w=this;return he(this,function(g){switch(g.label){case 0:this.isRefreshScheduled=!1,this.isRefreshing=!0,e=[],t=0,r=function(){var r,o,i,a,s,u,c,h,f,p,b;return he(this,function(d){switch(d.label){case 0:r=n.mapItems[t],o=r.pathname,i=r.matcherIterator.next(),r.lastResult&&!i.value||(r.lastResult=i),a=r.lastResult.value,r.chunksCache=a||[],s=a.findIndex(function(e){return"error"===e.type||e.url.href.length>=r.url.href.length&&("mount"===e.type&&r.lastMountPatterns!==e.patterns||"redirect"===e.type&&r.lastRedirectTo!==e.to)}),d.label=1;case 1:if(!(s>=0&&s<a.length))return[3,6];if(u=a[s],s++,"error"===u.type||n.options.predicate&&!n.options.predicate(u,a))return n.removeFromQueue(r),[2,"continue-items"];if("redirect"===u.type&&(r.lastRedirectTo=u.to,n.options.followRedirects&&n.addToQueue(u.to,r.depth+1,r.walkedPatternLists,o,r.order)),"mount"!==u.type)return[3,5];if(c=u.patterns,r.lastMountPatterns=c,h=c.slice(0).sort().join("\n"),!c||r.walkedPatternLists.has(h))return[3,5];r.walkedPatternLists.add(h),f=0,d.label=2;case 2:return f<c.length?[4,n.expandPatterns(l(o,c[f]))]:[3,5];case 3:for(p=d.sent(),b=0;b<p.length;b++)n.addToQueue(p[b],r.depth+1,r.walkedPatternLists,o,r.order.concat(f,b));d.label=4;case 4:return f++,[3,2];case 5:return[3,1];case 6:return a&&(e=e.concat(a)),t++,[2]}})},n=this,g.label=1;case 1:return t<this.mapItems.length?[5,r()]:[3,3];case 2:switch(g.sent()){case"continue-items":return[3,1]}return[3,1];case 3:for(o=[],i=0;i<this.mapItems.length;i++)a=this.mapItems[i],"mount"===(s=a.chunksCache[a.chunksCache.length-1]).type||"error"===s.type||this.options.predicate&&!this.options.predicate(s,a.chunksCache)||o.push([l(a.pathname,"/"),a.chunksCache,a.order]);if(u=++this.lastListenId,c=function(){return w.handleResolverUpdate(u)},Promise.race(e.filter(be).map(de)).then(c,c),o.sort(function(e,t){var r=e[2],n=t[2];if(r.length<n.length)return-1;if(r.length>n.length)return 1;for(var o=0;o<r.length;o++){if(r[o]<n[o])return-1;if(r[o]>n[o])return 1}return 0}),this.isRefreshScheduled)this.refresh();else{for(h={},f=!0,p=0;p<o.length;p++)b=fe(o[p],2),d=b[0],(y=b[1]).some(function(e){return"busy"===e.type})&&(f=!1),h[d]=y;for(v=0;v<this.observers.length;v++)(m=this.observers[v]).next(h),f&&m.complete&&m.complete();f&&(delete this.rootContext,delete this.mapItems,delete this.router,delete this.observers),this.isRefreshing=!1}return[2]}})})},this.observers=[],this.lastListenId=0,this.mapItems=[],this.router=o,this.rootContext=t,this.matcherGeneratorFunction=r,this.rootMapping=n,this.options=i,this.seenPathnames=new Set;var s=e.pathname;"/"===s.substr(-1)&&(s=s.substr(0,s.length-1)),this.addToQueue(s,0,new Set)}return e.prototype.subscribe=function(e,t,r){if(!this.observers)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=ie(e,t,r);this.observers.push(n);var o=new oe(this.handleUnsubscribe,n);return 1===this.observers.length&&this.refresh(),o},e.prototype.expandPatterns=function(e){return le(this,void 0,void 0,function(){var t;return he(this,function(r){switch(r.label){case 0:return this.options.expandPattern?[4,this.options.expandPattern(e,this.router)]:[3,2];case 1:if(t=r.sent())return[2,t];r.label=2;case 2:return[2,[e].filter(function(e){return!/\/:/.test(e)})]}})})},e.prototype.removeFromQueue=function(e){var t=this.mapItems.indexOf(e);-1!==t&&this.mapItems.splice(t,1)},e.prototype.addToQueue=function(e,t,r,n,o){if(void 0===o&&(o=[0]),!this.seenPathnames.has(e)&&(!this.options.maxDepth||t<=this.options.maxDepth)){this.seenPathnames.add(e);var i=s(e,{ensureTrailingSlash:!1,removeHash:!0}),a=D(U(this.rootContext,{body:null,headers:this.options.headers||{},method:this.options.method||"HEAD",params:{},hostname:this.options.hostname||"",mountpath:"",query:i.query,search:i.search,router:this.router,path:i.pathname,url:i.pathname+i.search,originalUrl:i.href}),this.rootMapping,this.rootContext);a&&this.mapItems.push({url:i,fromPathname:n,depth:t,pathname:e,order:o,walkedPatternLists:new Set(r),matcherIterator:this.matcherGeneratorFunction(a,this.rootContext)})}},e}();function be(e){return"busy"===e.type}function de(e){return e.promise}var ye=function(){return(ye=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function ve(e,t){return e=function(e,t){if(e){if("url"===t.type)return ye({},e,{chunks:e.chunks.filter(function(e){return"url"!==e.type}),url:t.url});if("ready"!==e.type)return e}var r={lastChunk:t,chunks:e?e.chunks.concat(t):[t],data:e?e.data:{},headers:e?e.headers:{},heads:e?e.heads:[],status:e?e.status:200,title:e&&e.title,url:e?e.url:t.url,views:e?e.views:[]};switch(t.type){case"busy":return ye({},r,{type:"busy"});case"data":return ye({},r,{type:"ready",data:ye({},r.data,t.data)});case"error":return ye({},r,{type:"error",error:t.error,status:r.status&&r.status>=400?r.status:t.error.status||500});case"head":return ye({},r,{type:"ready",heads:r.heads.concat(t.head)});case"headers":return ye({},r,{type:"ready",headers:ye({},r.headers,t.headers)});case"redirect":return ye({},r,{type:"redirect",to:t.to});case"status":return ye({},r,{type:"ready",status:t.status});case"title":return ye({},r,{type:"ready",title:t.title});case"view":return ye({},r,{type:"ready",views:r.views.concat(t.view)});default:return ye({},r,{type:"ready"})}}(e,t),Object.defineProperties(e,{meta:{configurable:!0,get:function(){return e.data}},content:{configurable:!0,get:function(){return t.view}},segments:{configurable:!0,get:function(){return e.chunks}},lastSegment:{configurable:!0,get:function(){return e.lastChunk}}}),e}var me=function(){function e(e){this.context=e.context||{},this.matcherGenerator=e.routes(),this.reducer=e.reducer||ve;var t,r,n=e.basename;n&&"/"===n.slice(-1)&&(n=n.slice(0,-1)),this.rootMapping=(t=e.routes,void 0===(r=n)&&(r=""),""!==r?M(r,t):{pattern:r,key:"",regExp:new RegExp(""),matcher:t})}return e.prototype.setContext=function(e){this.context=e||{}},e.prototype.createObservable=function(e,t){void 0===t&&(t={}),e.hash&&delete(e=Object.assign({},e)).hash;var r=D(U(this.context,{body:t.body,headers:t.headers||{},method:t.method||"GET",hostname:e.hostname,mountpath:"",params:e.query,query:e.query,search:e.search,router:this,url:e.pathname+e.search,originalUrl:e.href,path:e.pathname}),this.rootMapping,this.context);if(r)return new se(e,r,this.context,this.matcherGenerator)},e.prototype.createMapObservable=function(e,t){return void 0===t&&(t={}),new pe(s(e,{ensureTrailingSlash:!1}),this.context,this.matcherGenerator,this.rootMapping,this,t)},e.prototype.resolve=function(e,t){var r,n=this;if(void 0===t&&(t={}),Array.isArray(e))r=e.map(function(e){return s(e)});else if("string"==typeof e)r=[s(e)];else if(e.url)r=[s((t=e).url)];else{if(!t)throw new Error("You must specify a URL for router.resolve().");r=[s(e)]}if(!r.length)return Promise.resolve([]);var o=r.map(function(e){return n.getPageRoutePromise(e,t)});return Array.isArray(e)?Promise.all(o):o[0]},e.prototype.resolveSiteMap=function(e,t){var r=this;return void 0===t&&(t={}),ae(this.createMapObservable(e,t)).then(function(e){for(var t={},n={},o=Object.keys(e),i=0;i<o.length;i++){var a=o[i],u=e[a],c=u[u.length-1];"redirect"!==c.type?t[a]=[{type:"url",url:s(a)}].concat(u).reduce(r.reducer,void 0):n[a]=c.to}return{routes:t,redirects:n}})},e.prototype.resolveRouteMap=function(e,t){return void 0===t&&(t={}),this.resolveSiteMap(e,t).then(function(e){return e.routes})},e.prototype.getPageRoutePromise=function(e,t){var r=this,n=this.createObservable(e,t);return n?ae(n).then(function(n){for(var o=0;o<n.length;o++){var i=n[o];if("busy"===i.type)break;if("redirect"===i.type&&t.followRedirects)return r.getPageRoutePromise(s(i.to),t);if("error"===i.type)throw i.error}return[{type:"url",url:s(e)}].concat(n).reduce(r.reducer,void 0)}):Promise.reject(new d(e))},e}(),we=function(){return function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),Object.freeze(this)}}(),ge=function(){return(ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},xe=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},Se=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Re=function(){function e(e,t,r,n){var o=this;this.handleUnsubscribe=function(e){var t=o.observers.indexOf(e);-1!==t&&o.observers.splice(t,1)},this.handleChunkList=function(e){for(var t=!0,r=0;r<e.length;r++){var n=e[r];if("busy"===n.type&&(t=!1),"redirect"===n.type)return void o.history.replace(n.to)}o.setRoute([{type:"url",url:o.lastURL}].concat(e).reduce(o.reducer,void 0),t)},this.observers=[],this.isLastRouteSteady=!1,this.router=t,this.history=e,this.reducer=r,this.resolveOptions=n,this.lastURL=s(this.history.location),this.unlisten=this.history.listen(function(e){return o.handleURLChange(s(e))}),this.refresh()}return e.prototype.dispose=function(){this.observers.length=0,this.unlisten(),delete this.unlisten,delete this.history,this.observableSubscription&&this.observableSubscription.unsubscribe(),delete this.observableSubscription,delete this.router,delete this.waitUntilSteadyDeferred,delete this.lastRoute},e.prototype.refresh=function(){this.handleURLChange(s(this.history.location),!0)},e.prototype.setContext=function(e){this.router.setContext(e),this.refresh()},e.prototype.getValue=function(){return this.lastRoute},e.prototype.getSteadyRoute=function(){return xe(this,void 0,void 0,function(){return Se(this,function(e){return this.isLastRouteSteady?[2,Promise.resolve(this.lastRoute)]:(this.waitUntilSteadyDeferred||(this.waitUntilSteadyDeferred=new we),[2,this.waitUntilSteadyDeferred.promise])})})},e.prototype.subscribe=function(e,t,r){var n=ie(e,t,r);return this.observers.push(n),new oe(this.handleUnsubscribe,n)},e.prototype.handleURLChange=function(e,t){if(!t&&this.lastReceivedURL&&i(this.lastReceivedURL,e))for(var r=0;r<this.observers.length;r++)this.observers[r].next(this.lastRoute);else{if(this.lastReceivedURL=e,"/"!==e.pathname.substr(-1))return e=ge({},e,{pathname:e.pathname+"/"}),void this.history.replace(e);var n,o,a=this.lastURL;if(this.lastURL=e,e&&a&&(n=e.pathname!==a.pathname,o=e.search!==a.search),t||n||o||!this.lastRoute){this.observableSubscription&&this.observableSubscription.unsubscribe();var s=this.router.createObservable(e,this.resolveOptions);if(s)this.observableSubscription=s.subscribe(this.handleChunkList);else if(!a)throw new d(e)}else e.hash!==a.hash&&this.setRoute(this.reducer(this.lastRoute,{type:"url",url:e}),this.isLastRouteSteady)}},e.prototype.setRoute=function(e,t){if(e!==this.lastRoute){this.lastRoute=e,this.isLastRouteSteady=t,t&&this.waitUntilSteadyDeferred&&(this.waitUntilSteadyDeferred.resolve(e),delete this.waitUntilSteadyDeferred);for(var r=0;r<this.observers.length;r++)this.observers[r].next(e)}},e}(),ke=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},Oe=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};var Pe=function(){function e(e){e.pages&&(e.routes=e.pages);var r=e.reducer||ve;this.history=e.history||t.createBrowserHistory(),this.router=new me({context:e.context,routes:e.routes,basename:e.basename,reducer:r}),this.currentRouteObservable=new Re(this.history,this.router,r)}return e.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.history},e.prototype.setContext=function(e){this.currentRouteObservable.setContext(e)},e.prototype.getCurrentValue=function(){return this.currentRouteObservable.getValue()},e.prototype.getSteadyValue=function(){return this.currentRouteObservable.getSteadyRoute()},e.prototype.steady=function(){return ke(this,void 0,void 0,function(){return Oe(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},e.prototype.subscribe=function(e,t,r){var n=ie(e,t,r);return this.currentRouteObservable.subscribe(n)},e}(),je=function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},Ee=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};var Ce=function(){function e(e){e.pages&&(e.routes=e.pages);var r=e.reducer||ve,n=e.url||e.request&&e.request.url;if(!n)throw new Error("createMemoriNavigation() could not find a URL.");this.history=t.createMemoryHistory({initialEntries:[s(n).href]}),this.options=e,this.router=new me({context:e.context,routes:this.options.routes||this.options.pages,basename:this.options.basename,reducer:r}),this.currentRouteObservable=new Re(this.history,this.router,r,e.request)}return e.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.options},e.prototype.setContext=function(e){this.currentRouteObservable.setContext(e)},e.prototype.getCurrentValue=function(){return this.currentRouteObservable.getValue()},e.prototype.getSteadyValue=function(){return this.currentRouteObservable.getSteadyRoute()},e.prototype.steady=function(){return je(this,void 0,void 0,function(){return Ee(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},e.prototype.subscribe=function(e,t,r){var n=ie(e,t,r);return this.currentRouteObservable.subscribe(n)},e}();e.compose=o,e.Router=me,e.createRouter=function(e){return new me(e)},e.defaultRouteReducer=ve,e.concatMatcherIterators=R,e.resolveChunks=g,e.createBrowserNavigation=function(e){return new Pe(e)},e.BrowserNavigation=Pe,e.createMemoryNavigation=function(e){return new Ce(e)},e.MemoryNavigation=Ce,e.lazy=L,e.map=L,e.createPage=function(e){return Object.assign(o(V(Z(e)),Q(function(e,t){return t.meta}),F(function(e,t){return t.title}),j(function(e,t){return t.content})),{isDeprecatedMatcher:!0})},e.createContext=function(e,t){return Object.assign(V(e,t.isDeprecatedMatcher?t:L(t)),{isDeprecatedMatcher:!0})},e.createSwitch=function(e){var t,r,n={};try{for(var i=Y(Object.keys(e.paths)),a=i.next();!a.done;a=i.next()){var s=a.value,u=e.paths[s];n[s]=u.isDeprecatedMatcher?u:L(u)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}if(1===Object.keys(e).length)return Object.assign(q(n),{isDeprecatedMatcher:!0});e.paths;var c=B(e,["paths"]);return Object.assign(o(V(Z(c)),Q(function(e,t){return t.meta}),F(function(e,t){return t.title}),j(function(e,t){return t.content}),q(n)),{isDeprecatedMatcher:!0})},e.createRedirect=function(e,t){var r=_(e);return t?o(Q(t),r):r},e.mount=q,e.redirect=_,e.route=function(e){if(void 0===e&&(e={}),"function"!=typeof e){var t=e.data,r=e.getData,n=e.head,i=e.getHead,a=e.headers,s=e.getHeaders,u=e.status,c=e.getStatus,l=e.title,h=e.getTitle,f=e.view,p=e.getView;re(e,["data","getData","head","getHead","headers","getHeaders","status","getStatus","title","getTitle","view","getView"]),e=function(e,o){return ee(this,void 0,void 0,function(){var b,d,y,v,m,w,g;return te(this,function(S){switch(S.label){case 0:return b=r?Promise.resolve(r(e,o,void 0)).then(x).then(ne):Promise.resolve(t||{}),d=s?Promise.resolve(s(e,o,b)).then(x):Promise.resolve(a),y=c?Promise.resolve(c(e,o,b)).then(x):Promise.resolve(u),v=h?Promise.resolve(h(e,o,b)).then(x):Promise.resolve(l),"HEAD"!==e.method&&(m=i?Promise.resolve(i(e,o,b)).then(x):Promise.resolve(n),w=p?Promise.resolve(p(e,o,b)).then(x):Promise.resolve(f)),g={},[4,b];case 1:return g.data=S.sent(),[4,m];case 2:return g.head=S.sent(),[4,d];case 3:return g.headers=S.sent(),[4,y];case 4:return g.status=S.sent(),[4,v];case 5:return g.title=S.sent(),[4,w];case 6:return[2,(g.view=S.sent(),g)]}})})}}return o(V(e),Q(function(e,t){return t.data}),K(function(e,t){return t.head}),W(function(e,t){return t.headers}),X(function(e,t){return t.status}),F(function(e,t){return t.title}),j(function(e,t){return t.view}))},e.withContext=V,e.withData=Q,e.withHead=K,e.withHeaders=W,e.withStatus=X,e.withTitle=F,e.withView=j,e.NaviError=p,e.NotFoundError=b,e.OutOfRootError=d,e.createRequest=U,e.createChunk=y,e.createNotFoundChunk=v,e.areURLDescriptorsEqual=i,e.createURLDescriptor=s,e.parseQuery=u,e.stringifyQuery=c,e.joinPaths=l,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "navi", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "A router-loader for React.", | ||
@@ -59,3 +59,3 @@ "author": "James K Nelson <james@jamesknelson.com>", | ||
}, | ||
"gitHead": "49b835034aef926dfa40bc683f4cae869a8bb6af" | ||
"gitHead": "1772643e213eca1a3ee1025f01077c5525dc6d1c" | ||
} |
@@ -217,3 +217,6 @@ import { URLDescriptor, createURLDescriptor, joinPaths } from './URLTools' | ||
let lastChunk = item.chunksCache![item.chunksCache!.length - 1] | ||
if (lastChunk.type !== 'mount' && lastChunk.type !== 'error') { | ||
if ( | ||
lastChunk.type !== 'mount' && | ||
lastChunk.type !== 'error' && | ||
(!this.options.predicate || this.options.predicate(lastChunk, item.chunksCache!))) { | ||
chunksMapArray.push([ | ||
@@ -220,0 +223,0 @@ joinPaths(item.pathname, '/'), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
634556
10755