Comparing version 0.13.0-alpha.0 to 0.13.0-beta.1
@@ -88,2 +88,6 @@ "use strict"; | ||
var matchedPathname = match[0]; | ||
var unmatchedPath = request.path.slice(matchedPathname.length) || ''; | ||
if (unmatchedPath.length && unmatchedPath[0] !== '/') { | ||
return; | ||
} | ||
// Set path params using RegExp match | ||
@@ -98,3 +102,2 @@ var params = request.params; | ||
} | ||
var unmatchedPath = request.path.slice(matchedPathname.length) || ''; | ||
var mountpath = URLTools_1.joinPaths(request.mountpath, matchedPathname) || '/'; | ||
@@ -101,0 +104,0 @@ return __assign({}, request, { params: params, |
@@ -84,2 +84,6 @@ var __assign = (this && this.__assign) || function () { | ||
var matchedPathname = match[0]; | ||
var unmatchedPath = request.path.slice(matchedPathname.length) || ''; | ||
if (unmatchedPath.length && unmatchedPath[0] !== '/') { | ||
return; | ||
} | ||
// Set path params using RegExp match | ||
@@ -94,3 +98,2 @@ var params = request.params; | ||
} | ||
var unmatchedPath = request.path.slice(matchedPathname.length) || ''; | ||
var mountpath = joinPaths(request.mountpath, matchedPathname) || '/'; | ||
@@ -97,0 +100,0 @@ return __assign({}, request, { params: params, |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("history")):"function"==typeof define&&define.amd?define(["exports","history"],e):e((t=t||self).Navi={},t.History)}(this,function(t,e){"use strict";var r=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},n=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t},o=/((((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;function a(t,e){var r,n,a,s,c,h=void 0===e?{}:e,f=h.removeHash,p=void 0!==f&&f,y=h.trailingSlash,d=void 0===y?null:y;if("string"==typeof t){var v=o.exec(t);if(!v)throw new Error("Couldn't parse the provided URL.");r="",n=l(v[2]||"",d),a=i(s=v[6]||""),c=v[7]||""}else r=t.hostname||"",n=l(t.pathname||"",d),a=t.query||(t.search?i(t.search):{}),s=t.search||u(a),c=t.hash||"";return{hostname:r,pathname:n,query:a,search:s,hash:p?"":c,href:n+s+c}}function i(t,e){if(void 0===e&&(e="?"),!t||t[0]!=e)return{};for(var r={},n=t.slice(1).split("&"),o=0,a=n.length;o<a;o++){var i=n[o].split("=");r[i[0]]=i[1]?decodeURIComponent(i[1]):""}return r}function u(t,e){void 0===e&&(e="?");var r=Object.keys(t);if(0===r.length)return"";for(var n=[],o=0,a=r.length;o<a;o++){var i=r[o],u=String(t[i]);n.push(""===u?i:i+"="+encodeURIComponent(u))}return e+n.join("&")}function s(t){return""===t?[]:t.split("/")}function c(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var o=s(t),a=0;a<e.length;a++)o.push.apply(o,n(s(e[a])));var i=[],u=o.length-1;for(a=0;a<=u;a++){var c=o[a];".."===c?i.pop():"."===c||""===c&&0!==a&&a!==u||i.push(c)}return i.join("/")}function l(t,e){var r="/"===t.slice(-1);return"add"!==e||r?"remove"===e&&r&&t.length>1?t.slice(0,-1):t:t+"/"}var h,f=(h=function(t,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),p=function(t){function e(e){var r=this,n=this.constructor.prototype;return(r=t.call(this,e)||this).__proto__=n,Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,r.constructor):Object.defineProperty(r,"stack",{value:(new Error).stack}),Object.defineProperty(r,"message",{value:e}),r}return f(e,t),e}(Error),y=function(t){function e(e){var r=t.call(this,"URL not found: "+e)||this;return r.pathname=e,r.status=404,r.name="NotFoundError",r}return f(e,t),e}(p),d=function(t){function e(e){var r=t.call(this,"URL not managed by router: "+e.href)||this;return r.url=e,r.name="OutOfRootError",r}return f(e,t),e}(p);function v(t,e,r){return Object.assign({type:t,request:e,url:a({pathname:e.mountpath,query:e.query})},r)}function b(t){var e=c(t.mountpath,t.path);return{type:"error",request:t,url:a({pathname:e,query:t.query}),error:new y(e)}}var m=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},w=function(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 g(t,e,r){var n,o,a,i,u,s,l;return m(this,function(h){switch(h.label){case 0:n="function"==typeof t?t:function(){return t};try{o=n(e,e.context)}catch(t){o=Promise.reject(t)}return x(o)?[3,1]:(a=r(o),[3,7]);case 1:i=o.then(S),u=function(t){var e={};return t.then(function(t){e.value=t,e.outcome="resolved"},function(t){e.error=t,e.outcome="rejected"}),e}(i),s=[v("busy",e,{promise:i})],h.label=2;case 2:return u.outcome?[3,4]:[4,s];case 3:return h.sent(),[3,2];case 4:return"rejected"!==u.outcome?[3,6]:((l=u.error)instanceof y&&!l.pathname&&(l.pathname=c(e.mountpath,e.path)),[4,[v("error",e,{error:l})]]);case 5:return h.sent(),[3,7];case 6:a=r(u.value),h.label=7;case 7:return a?Array.isArray(a)?[4,a.length?a:[]]:[3,9]:[3,11];case 8:return h.sent(),[3,11];case 9:return[5,w(a)];case 10:h.sent(),h.label=11;case 11:return[2]}})}function x(t){return!!t&&!!t.then}function S(t){return function(t){return t&&"object"==typeof t&&"default"in t}(t)?t.default:t}var k=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};function O(t,e,r){return void 0===r&&(r=""),t(e)}function P(t,e){var r,n,o,a;return k(this,function(i){switch(i.label){case 0:o=[],a=[],i.label=1;case 1:return(r=t.next()).done||(o=r.value||[]),(n=e.next()).done||(a=n.value||[]),[4,o.concat(a)];case 2:i.sent(),i.label=3;case 3:if(!r.done||!n.done)return[3,1];i.label=4;case 4:return[2]}})}var R=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},_=function(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 j(t){return function(e){return function(r){return R(this,function(n){switch(n.label){case 0:return[5,_(g(t,r,function(t){return O(t(e),r)}))];case 1:return n.sent(),[2]}})}}}var E=function(){return(E=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},T="\0";function L(t,e){var r=t;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=[],a=[],i=["^"],u=0;u<n.length;u++){var s=n[u];s.length>1&&":"===s[0]?(o.push(s.slice(1)),a.push(T),i.push("([^/]+)")):(a.push(s),i.push(s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))}return{key:a.join("/"),matcher:e,pattern:r,pathParamNames:o.length?o:void 0,regExp:"/"===r?/^\/$/:new RegExp(i.join("/"))}}function C(t,e){var r=e.regExp.exec(t.path||"/");if(r){var n=r[0],o=t.params;if(e.pathParamNames){o=E({},t.params);for(var a=0;a<e.pathParamNames.length;a++){o[e.pathParamNames[a]]=r[a+1]}}var i=t.path.slice(n.length)||"",u=c(t.mountpath,n)||"/";return E({},t,{params:o,mountpath:u,path:i,url:i+t.search})}}function I(t){return[].concat.apply([],t)}var U=function(){return(U=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},q=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},A=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},D=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function N(t){return"busy"===t.type}function G(t){return"mount"===t.type}var H=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},M=function(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 F(t,e,r,n,o,a){function i(e,i){var u,s;return H(this,function(c){switch(c.label){case 0:return u=e.path,(void 0===n?!i:n)&&u&&"/"!==u?[4,[b(e)]]:[3,2];case 1:return c.sent(),[3,4];case 2:return s=e.crawler&&!o||a&&!a(e)?function(){return H(this,function(t){switch(t.label){case 0:return[4,[]];case 1:return t.sent(),[2]}})}():g(t,e,function(t){return r(t,e)}),[5,M(i?P(s,O(i,e)):s)];case 3:c.sent(),c.label=4;case 4:return[2]}})}return function(t){return function(r){return i(r,e?e(t):t)}}}var Q=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},V=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Q(arguments[e]));return t};function Y(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)throw new Error("composeMatchers() expects at least one matcher.");return 1===t.length?t[0]:t.reduce(function(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t(e.apply(void 0,V(r)))}})}var $=function(){return($=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},B=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},z=function(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 W(t,e){return function(r){return function(n){return function(e,r){return B(this,function(n){switch(n.label){case 0:return[5,z(g(t,e,function(t){return O(r,$({},e,{context:t||{}}))}))];case 1:return n.sent(),[2]}})}(n,e?e(r):r)}}}function Z(t,e){return F(t,e,function(t,e){return t?[v("data",e,{data:t})]:[]})}function J(t,e){return F(t,e,function(t,e){return t?[v("head",e,{head:t})]:[]})}function K(t,e){return F(t,e,function(t,e){return t?[v("headers",e,{headers:t})]:[]})}var X=function(){return(X=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},tt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},et=function(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 rt(t,e){function r(e,r){return tt(this,function(n){switch(n.label){case 0:return[5,et(g(t,e,function(t){var n=null===t?e.state:X({},e.state,t);return P(function(t){return tt(this,function(e){switch(e.label){case 0:return[4,t];case 1:return e.sent(),[2]}})}(null===t?[]:[v("state",e,{state:n})]),O(r,X({},e,{state:n})))}))];case 1:return n.sent(),[2]}})}return function(t){return function(n){return r(n,e?e(t):t)}}}function nt(t,e){return F(t,e,function(t,e){return t?[v("status",e,{status:t})]:[]})}function ot(t,e,r){return F(t,e,function(t,e){return t?[v("view",e,{view:t})]:[]},r,!1,function(t){return"HEAD"!==t.method})}function at(t,e){return F(t,e,function(t,e){return t?[v("title",e,{title:t})]:[]})}var it=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},ut=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},st=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r},ct=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function lt(t){return t||{}}function ht(t,e,r,n){if(e){var o=e(r,n);return x(o)?[o.then(S),!0]:[o,!1]}return[t,!1]}var ft=function(){return(ft=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},pt=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},yt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},dt=function(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}}}};var vt=function(){function t(t,e){this.close=t,this.observer=e,this.observer.start&&this.observer.start(this)}return t.prototype.unsubscribe=function(){this.closed||(this.closed=!0,this.close(this.observer),delete this.close,delete this.observer)},t}();function bt(t,e,r){return"function"==typeof t?{next:t,error:e,complete:r}:t}function mt(t){return new Promise(function(e,r){t.subscribe({start:function(t){this.subscription=t},next:function(t){this.value=t},complete:function(){e(this.value),this.subscription.unsubscribe()},error:function(t){r(t),this.subscription.unsubscribe()}})})}var wt=function(){function t(t,e,r){var n=this;this.handleUnsubscribe=function(t){var e=n.observers.indexOf(t);-1!==e&&n.observers.splice(e,1)},this.handleChange=function(t){if(t===n.lastListenId){n.lastListenId++,n.refresh();for(var e=n.result.done||n.result.value.every(function(t){return"busy"!==t.type}),r=0;r<n.observers.length;r++){var o=n.observers[r];o.next(n.result.value),e&&o.complete&&o.complete()}e&&delete n.matcherIterator}},this.refresh=function(){var t=n.matcherIterator.next();if(t.value&&(n.result=t),!n.result.done){var e=++n.lastListenId,r=function(){return n.handleChange(e)};Promise.race(n.result.value.filter(gt).map(xt)).then(r,r)}},this.url=t,this.lastListenId=0,this.observers=[],this.matcherIterator=r(e)}return t.prototype.subscribe=function(t,e,r){if(!this.matcherIterator)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=bt(t,e,r);this.observers.push(n);var o=new vt(this.handleUnsubscribe,n);return 1===this.observers.length&&this.handleChange(this.lastListenId),o},t}();function gt(t){return"busy"===t.type}function xt(t){return t.promise}var St=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},kt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Ot=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},Pt=function(){function t(t,e,r,n,o,a){var i=this;this.handleUnsubscribe=function(t){var e=i.observers.indexOf(t);-1!==e&&i.observers.splice(e,1)},this.handleResolverUpdate=function(t){t===i.lastListenId&&(i.lastListenId++,i.isRefreshing?i.isRefreshScheduled||(i.isRefreshScheduled=!0):i.refresh())},this.refresh=function(){return St(i,void 0,void 0,function(){var t,e,r,n,o,a,i,u,s,h,f,p,y,d,v,b,m,w,g=this;return kt(this,function(x){switch(x.label){case 0:this.isRefreshScheduled=!1,this.isRefreshing=!0,t=[],e=0,r=function(){var r,o,a,i,u,s,l,h,f,p,y;return kt(this,function(d){switch(d.label){case 0:r=n.mapItems[e],o=r.pathname,a=r.matcherIterator.next(),r.lastResult&&!a.value||(r.lastResult=a),i=r.lastResult.value,r.chunksCache=i||[],u=i.findIndex(function(t){return"error"===t.type||t.url.href.length>=r.url.href.length&&("mount"===t.type&&r.lastMountPatterns!==t.patterns||"redirect"===t.type&&r.lastRedirectTo!==t.to)}),d.label=1;case 1:if(!(u>=0&&u<i.length))return[3,6];if(s=i[u],u++,"error"===s.type||n.options.predicate&&!n.options.predicate(s,i))return n.removeFromQueue(r),[2,"continue-items"];if("redirect"===s.type&&(r.lastRedirectTo=s.to,n.options.followRedirects&&n.addToQueue(s.to,r.depth+1,r.walkedPatternLists,o,r.order)),"mount"!==s.type)return[3,5];if(l=s.patterns,r.lastMountPatterns=l,h=l.slice(0).sort().join("\n"),!l||r.walkedPatternLists.has(h))return[3,5];r.walkedPatternLists.add(h),f=0,d.label=2;case 2:return f<l.length?[4,n.expandPatterns(c(o,l[f]))]:[3,5];case 3:for(p=d.sent(),y=0;y<p.length;y++)n.addToQueue(p[y],r.depth+1,r.walkedPatternLists,o,r.order.concat(f,y));d.label=4;case 4:return f++,[3,2];case 5:return[3,1];case 6:return i&&(t=t.concat(i)),e++,[2]}})},n=this,x.label=1;case 1:return this.mapItems&&e<this.mapItems.length?[5,r()]:[3,3];case 2:switch(x.sent()){case"continue-items":return[3,1]}return[3,1];case 3:if(!this.mapItems)return[2];for(o=[],a=0;a<this.mapItems.length;a++)i=this.mapItems[a],"mount"===(u=i.chunksCache[i.chunksCache.length-1]).type||"error"===u.type||"busy"!==u.type&&this.options.predicate&&!this.options.predicate(u,i.chunksCache)||o.push([c(i.pathname,"/"),i.chunksCache,i.order]);if(s=++this.lastListenId,h=function(){return g.handleResolverUpdate(s)},Promise.race(t.filter(Rt).map(_t)).then(h,h),o.sort(function(t,e){var r=t[2],n=e[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(f={},p=!0,y=0;y<o.length;y++)d=Ot(o[y],2),v=d[0],(b=d[1]).some(function(t){return"busy"===t.type})&&(p=!1),f[l(v,"remove")]=b;for(m=0;m<this.observers.length;m++)(w=this.observers[m]).next(f),p&&w.complete&&w.complete();p&&(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=e,this.matcherGeneratorFunction=r,this.rootMapping=n,this.options=a,this.seenPathnames=new Set;var u=t.pathname;"/"===u.substr(-1)&&(u=u.substr(0,u.length-1)),this.addToQueue(u,0,new Set)}return t.prototype.subscribe=function(t,e,r){if(!this.observers)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=bt(t,e,r);this.observers.push(n);var o=new vt(this.handleUnsubscribe,n);return 1===this.observers.length&&this.refresh(),o},t.prototype.expandPatterns=function(t){return St(this,void 0,void 0,function(){var e;return kt(this,function(r){switch(r.label){case 0:return this.options.expandPattern?[4,this.options.expandPattern(t,this.router)]:[3,2];case 1:if(e=r.sent())return[2,e];r.label=2;case 2:return[2,[t].filter(function(t){return!/\/:/.test(t)})]}})})},t.prototype.removeFromQueue=function(t){var e=this.mapItems.indexOf(t);-1!==e&&this.mapItems.splice(e,1)},t.prototype.addToQueue=function(t,e,r,n,o){if(void 0===o&&(o=[0]),!this.seenPathnames.has(t)&&(!this.options.maxDepth||e<=this.options.maxDepth)){this.seenPathnames.add(t);var i=a(t,{removeHash:!0}),u=C({body:null,context:this.rootContext,headers:this.options.headers||{},method:this.options.method||"HEAD",params:{},hostname:this.options.hostname||"",mountpath:"",query:i.query,search:i.search,hash:i.hash,path:i.pathname,url:i.pathname+i.search,originalUrl:i.href,state:{}},this.rootMapping);u&&this.mapItems.push({url:i,fromPathname:n,depth:e,pathname:t,order:o,walkedPatternLists:new Set(r),matcherIterator:this.matcherGeneratorFunction(u)})}},t}();function Rt(t){return"busy"===t.type}function _t(t){return t.promise}var jt=function(){return(jt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function Et(t,e){return t=function(t,e){if(t){if("url"===e.type)return jt({},t,{chunks:t.chunks.filter(function(t){return"url"!==t.type}),url:e.url});if("ready"!==t.type)return t}var r={lastChunk:e,method:e.request&&e.request.method,chunks:t?t.chunks.concat(e):[e],data:t?t.data:{},headers:t?t.headers:{},heads:t?t.heads:[],state:t?t.state:{},status:t?t.status:200,title:t&&t.title,url:t?t.url:e.url,views:t?t.views:[]};switch(e.type){case"busy":return jt({},r,{type:"busy"});case"data":return jt({},r,{type:"ready",data:jt({},r.data,e.data)});case"error":return jt({},r,{type:"error",error:e.error,status:r.status&&r.status>=400?r.status:e.error.status||500});case"head":return jt({},r,{type:"ready",heads:r.heads.concat(e.head)});case"headers":return jt({},r,{type:"ready",headers:jt({},r.headers,e.headers)});case"redirect":return jt({},r,{type:"redirect",to:e.to});case"state":return jt({},r,{type:"ready",state:jt({},r.state,e.state)});case"status":return jt({},r,{type:"ready",status:e.status});case"title":return jt({},r,{type:"ready",title:e.title});case"view":return jt({},r,{type:"ready",views:r.views.concat(e.view)});default:return jt({},r,{type:"ready"})}}(t,e),Object.defineProperties(t,{meta:{configurable:!0,get:function(){return t.data}},content:{configurable:!0,get:function(){return e.view}},segments:{configurable:!0,get:function(){return t.chunks}},lastSegment:{configurable:!0,get:function(){return t.lastChunk}}}),t}function Tt(t){return new Lt(t)}var Lt=function(){function t(t){this.context=t.context||{},this.matcherGenerator=t.routes();var e,r,n=t.basename;n&&"/"===n.slice(-1)&&(n=n.slice(0,-1)),this.rootMapping=(e=t.routes,void 0===(r=n)&&(r=""),""!==r?L(r,e):{pattern:r,key:"",regExp:new RegExp(""),matcher:e})}return t.prototype.setContext=function(t){this.context=t||{}},t.prototype.createObservable=function(t,e){var r=C({body:e.body,context:this.context,headers:e.headers||{},method:e.method||"GET",hostname:t.hostname,hash:t.hash,mountpath:"/",params:t.query,query:t.query,search:t.search,url:t.pathname+t.search,originalUrl:t.href,path:t.pathname,crawler:e.crawler,state:e.state||{}},this.rootMapping);if(r)return new wt(t,r,this.matcherGenerator)},t.prototype.createMapObservable=function(t,e){return void 0===e&&(e={}),new Pt(a(t),this.context,this.matcherGenerator,this.rootMapping,this,e)},t.prototype.resolve=function(t,e){var r,n=this;if(void 0===e&&(e={}),Array.isArray(t))r=t.map(function(t){return a(t)});else if("string"==typeof t)r=[a(t)];else if(t.url)r=[a((e=t).url)];else{if(!e)throw new Error("You must specify a URL for router.resolve().");r=[a(t)]}if(!r.length)return Promise.resolve([]);var o=r.map(function(t){return n.getPageRoutePromise(t,e)});return Array.isArray(t)?Promise.all(o):o[0]},t.prototype.resolveSiteMap=function(t,e){return void 0===e&&(e={}),mt(this.createMapObservable(t,e)).then(function(t){for(var e={},r={},n=Object.keys(t),o=0;o<n.length;o++){var i=n[o],u=t[i],s=u[u.length-1];"redirect"!==s.type?e[i]=[{type:"url",url:a(i)}].concat(u).reduce(Et,void 0):r[i]=s.to}return{routes:e,redirects:r}})},t.prototype.resolveRouteMap=function(t,e){return void 0===e&&(e={}),this.resolveSiteMap(t,e).then(function(t){return t.routes})},t.prototype.getPageRoutePromise=function(t,e){var r=this,n=this.createObservable(t,e);return n?mt(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&&e.followRedirects)return r.getPageRoutePromise(a(i.to),e);if("error"===i.type)throw i.error}return[{type:"url",url:a(t)}].concat(n).reduce(Et,void 0)}):Promise.reject(new d(t))},t}(),Ct=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},It=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};var Ut=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},qt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},At=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r};function Dt(t){return Ut(this,void 0,void 0,function(){var e,r,n,o,a,i;return qt(this,function(u){if(e=t.basename,r=t.context,n=t.routes,o=t.url,a=t.urls,i=At(t,["basename","context","routes","url","urls"]),o&&a)throw new Error("You cannot pass both `url` and `urls` options to resolve(). Please pick one!");if(!o&&!a)throw new Error("You must pass one of `url` or `urls` options to resolve().");return[2,Tt({basename:e,context:r,routes:n}).resolve(o||a,i)]})})}var Nt=function(){return function(){this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),Object.freeze(this)}}(),Gt=function(){return(Gt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},Ht=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},Mt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Ft=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r},Qt=function(){function t(t){var e=this;this.handleUnsubscribe=function(t){var r=e.observers.indexOf(t);-1!==r&&e.observers.splice(r,1)},this.handleChunkList=function(t){for(var r=!0,n=e._history.location,o=0;o<t.length;o++){var i=t[o];if("busy"===i.type&&(r=!1),"state"===i.type&&(e.ignoreNextLocationChange=!0,e._history.replace(Gt({},n,{state:Yt(n.state,i.state)}))),"redirect"===i.type){var u=Bt(n.state);return void(u?(e.ignoreNextLocationChange=!0,e._history.replace(Gt({},n,{state:u})),e._history.push(i.to)):e._history.replace(i.to))}}e.setRoute([{type:"url",url:a(e.lastHandledLocation)}].concat(t).reduce(Et,void 0),r)},this._history=t.history,this.observers=[],this.isLastRouteSteady=!1,this.navigationsSinceSteady=0,this.basename=t.basename,this.matcher=t.routes,this._router=new Lt({context:t.context,routes:t.routes,basename:t.basename}),this.trailingSlash=void 0===t.trailingSlash?"remove":t.trailingSlash,this.unlisten=this._history.listen(function(t){return e.handleLocationChange(t,!1)})}return t.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,delete this._router},t.prototype.go=function(t){return Ht(this,void 0,void 0,function(){var e,r=this;return Mt(this,function(n){switch(n.label){case 0:return e=new Promise(function(t){var e=r._history.listen(function(){e(),t()})}),this._history.go(t),[4,e];case 1:return n.sent(),[2,this.getRoute()]}})})},t.prototype.goBack=function(){return this.go(-1)},t.prototype.goForward=function(){return this.go(1)},t.prototype.navigate=function(t,e){var r;if(void 0===e&&(e={}),"string"==typeof t)r=a(t);else if(t.url)r=a((e=t).url);else{if(!t)throw new Error("You must specify a URL or state to navigation.navigate().");r=a(t)}var n=this._history.location,o=e.replace||!1!==e.replace&&n.pathname===r.pathname&&n.search===r.search&&n.hash===r.hash;return this._history[o?"replace":"push"]({pathname:r.pathname,search:r.search,hash:r.hash,state:$t({revertTo:o?n.state:void 0,method:e.method,headers:e.headers,body:e.body,state:e.state})}),this.getRoute()},t.prototype.prefetch=function(t){return Ht(this,void 0,void 0,function(){return Mt(this,function(e){switch(e.label){case 0:return[4,Dt({basename:this.basename,routes:this.matcher,context:this._router.context,url:t})];case 1:return e.sent(),[2]}})})},t.prototype.refresh=function(){return this.handleLocationChange(this._history.location,!0),this.getRoute()},t.prototype.setContext=function(t){return this._router.setContext(t),this.refresh()},t.prototype.getCurrentValue=function(){return this.lastRoute},t.prototype.getRoute=function(){return Ht(this,void 0,void 0,function(){return Mt(this,function(t){return this.isLastRouteSteady?[2,this.lastRoute]:(this.waitUntilSteadyDeferred||(this.waitUntilSteadyDeferred=new Nt),[2,this.waitUntilSteadyDeferred.promise])})})},t.prototype.getSteadyValue=function(){return Ht(this,void 0,void 0,function(){return Mt(this,function(t){return[2,this.getRoute()]})})},t.prototype.steady=function(){return Ht(this,void 0,void 0,function(){return Mt(this,function(t){switch(t.label){case 0:return[4,this.getRoute()];case 1:return t.sent(),[2]}})})},t.prototype.extractState=function(){return this._history.location.state},t.prototype.subscribe=function(t,e,r){var n=bt(t,e,r);return this.observers.push(n),new vt(this.handleUnsubscribe,n)},t.prototype.handleLocationChange=function(t,e){if(this.ignoreNextLocationChange)this.ignoreNextLocationChange=!1;else if(++this.navigationsSinceSteady>100)console.error("Detected possible navigation loop with 100 navigations between steady routes. Bailing.");else{if(null!==this.trailingSlash){var r=l(t.pathname,this.trailingSlash);if(t.pathname!==r)return void this._history.replace(Gt({},t,{pathname:r}))}var n=a(t),o=this.lastHandledLocation;this.lastHandledLocation=t,this.observableSubscription&&this.observableSubscription.unsubscribe();var i=this._router.createObservable(n,function(t){void 0===t&&(t={});var e=Gt({},t);delete e[Vt];var r=t[Vt]||{};return Gt({},r.requestDataWithoutState,{state:Object.keys(e).length?e:void 0})}(t.state));if(i)this.observableSubscription=i.subscribe(this.handleChunkList);else if(!o)throw new d(n)}},t.prototype.setRoute=function(t,e){if(t!==this.lastRoute){this.lastRoute=t,this.isLastRouteSteady=e,e&&(this.navigationsSinceSteady=0);for(var r=0;r<this.observers.length;r++)this.observers[r].next(t);this.isLastRouteSteady&&this.waitUntilSteadyDeferred&&(this.waitUntilSteadyDeferred.resolve(t),delete this.waitUntilSteadyDeferred)}},t}(),Vt="__navi__";function Yt(t,e){var r;return void 0===t&&(t={}),Gt({},e,((r={})[Vt]=t[Vt],r))}function $t(t){var e,r=t.revertTo,n=t.state,o=Ft(t,["revertTo","state"]);return r&&(r=Gt({},r))[Vt]&&delete r[Vt].revertTo,Gt({},n,((e={})[Vt]={requestDataWithoutState:o,revertTo:r},e))}function Bt(t){return void 0===t&&(t={}),(t[Vt]||{}).revertTo}var zt=function(){return(zt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};var Wt=function(){return(Wt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};t.crawl=function(t){return Ct(this,void 0,void 0,function(){var e,r,n,o,i,u,s,h,f,p,y,d,v,b=this;return It(this,function(m){switch(m.label){case 0:return e=Tt({basename:t.basename,context:t.context,routes:t.routes}),r=a(t.root||""),n=t.predicate||function(){return!0},o=t.expandPattern||function(t){return[t||""]},i=function(t,e){return Ct(b,void 0,void 0,function(){return It(this,function(r){switch(r.label){case 0:return[4,o(t)];case 1:return[2,(r.sent()||[]).map(function(t){return{headers:e.headers,url:a(c(e.mountpath,t)),context:e.headers}}).filter(n)]}})})},[4,mt(e.createObservable(r,{crawler:i,headers:t.headers,method:"HEAD"}))];case 1:u=m.sent(),s=[],h={};t:for(f=0;f<u.length;f++)if("crawl"===(p=u[f]).type){if(-1!==(y=p.url.pathname).indexOf(":"))continue;for(d=f+1;d<u.length&&"crawl"!==(v=u[d]).type&&"mount"!==v.type;d++,f++)if("redirect"===v.type){h[y]=v.to;continue t}s.push(y)}return[2,{paths:null!==t.trailingSlash?s.map(function(e){return l(e,t.trailingSlash||"remove")}):s,redirects:h}]}})})},t.resolve=Dt,t.compose=Y,t.Router=Lt,t.createRouter=Tt,t.routeReducer=Et,t.concatMatcherIterators=P,t.Navigation=Qt,t.resolveChunks=g,t.createBrowserNavigation=function(t){!t.state&&void 0!==typeof window&&window.__NAVI_STATE__&&(t.state=window.__NAVI_STATE__,delete window.__NAVI_STATE__);var r=t.history||e.createBrowserHistory();t.state&&r.replace(zt({},r.location,{state:t.state}));var n=new Qt({history:r,basename:t.basename,context:t.context,routes:t.routes,trailingSlash:t.trailingSlash});return n.refresh(),n},t.createMemoryNavigation=function(t){var r=t.url||t.request&&t.request.url;if(!r)throw new Error("createMemoryNavigation() could not find a URL.");var n=e.createMemoryHistory({initialEntries:["/"]}),o=new Qt({history:n,basename:t.basename,context:t.context,routes:t.routes,trailingSlash:t.trailingSlash});return o.navigate(Wt({},t.request,{url:r,replace:!0})),o},t.lazy=j,t.map=j,t.mount=function(t){if(!t)throw new Error("mount() must be supplied with a paths object.");var e=Object.keys(t),r=e.filter(function(t){return"*"!==t}).map(function(e){return L(e,t[e])}).sort(function(t,e){return r=t.key,n=e.key,r<n?-1:r>n?1:0;var r,n});return function(n){return function(o){var a,i,u,s,c,l,h,f,p,y,d,m,w,g,x,S,k;return A(this,function(P){switch(P.label){case 0:if(u=[],s=[],c=[],l=o.crawler,!(h=l&&(""===o.path||"/"===o.path)))return[3,5];(f=function(t,e,r){return q(this,void 0,void 0,function(){var n;return A(this,function(o){switch(o.label){case 0:return n=I,[4,Promise.all(Object.entries(t).map(function(t){var n,o=D(t,2),a=o[0],i=o[1];return e("*"===a?"":a,r).then((n=i,function(t){return t.map(function(t){return[n,t]})}))}))];case 1:return[2,n.apply(void 0,[o.sent()])]}})})}(t,l,o)).then(function(t){p=t},function(t){return y=t}),P.label=1;case 1:return[4,[v("busy",o,{promise:f})]];case 2:if(P.sent(),y)throw y;P.label=3;case 3:if(!p)return[3,1];P.label=4;case 4:return i=p.map(function(t,e){var r=D(t,2),a=r[0],i=r[1],u=U({},o,{mountpath:i.url.pathname,url:"",path:""});return c[e]=u,O(a(n),u,u.mountpath)}),[3,6];case 5:for(S=r.length-1;S>=0;S--)if(d=r[S],m=C(o,d)){i=[O(d.matcher(n),m,d.pattern)];break}i||(w=t["*"])&&(i=[O(w(n),o,"*")]),P.label=6;case 6:if(i)for(S=0;S<i.length;S++)(g=u[S])&&g.done||(g=u[S]=i[S].next()),g&&!g.done&&(s[S]=g.value);for(a=[v("mount",o,{patterns:e})],x=!1,S=0;S<u.length;S++)(k=s[S])&&(x=!0,h&&!k.some(G)&&(a=a.concat(v("crawl",c[S]))),a=a.concat(k));return l||x||a.push(b(o)),[4,a];case 7:P.sent(),P.label=8;case 8:if(a.filter(N).length)return[3,6];P.label=9;case 9:return[2]}})}}},t.redirect=function(t,e){var r=(void 0===e?{}:e).exact;return F(t,void 0,function(t,e){var r;return"string"==typeof t?r="/"===t[0]?t:c("/",e.mountpath,t):t&&(r=a(t).href),r?[v("redirect",e,{to:r})]:[]},void 0===r||r,!0)},t.route=function(t){var e;if(void 0===t&&(t={}),"function"==typeof t)e=t;else{var r=t.data,n=t.getData,o=t.error,a=t.head,i=t.getHead,u=t.headers,s=t.getHeaders,c=t.state,l=t.getState,h=t.status,f=t.getStatus,p=t.title,y=t.getTitle,d=t.view,b=t.getView;st(t,["data","getData","error","head","getHead","headers","getHeaders","state","getState","status","getStatus","title","getTitle","view","getView"]),e=function(t,e){var v,m=this,w=ct(ht(r,n,t,e),2),g=w[0],S=w[1];g?x(g)&&(g=g.then(lt)):g={};var k,O,P=ct(ht(u,s,t,e),2),R=P[0],_=P[1],j=ct(ht(c,l,t,e),2),E=j[0],T=j[1],L=ct(ht(h,f,t,e),2),C=L[0],I=L[1],U=ct(ht(p,y,t,e),2),q=U[0],A=U[1],D=ct(ht(a,i,t,e),2),N=D[0],G=D[1];return"HEAD"!==t.method&&(v=ct(ht(d,b,t,e),2),k=v[0],O=v[1]),S||_||T||I||A||G||O?it(m,void 0,void 0,function(){var t;return ut(this,function(e){switch(e.label){case 0:return t={},[4,g];case 1:return t.data=e.sent(),t.error=o,[4,N];case 2:return t.head=e.sent(),[4,R];case 3:return t.headers=e.sent(),[4,E];case 4:return t.state=e.sent(),[4,C];case 5:return t.status=e.sent(),[4,q];case 6:return t.title=e.sent(),[4,k];case 7:return[2,(t.view=e.sent(),t)]}})}):{data:g,error:o,head:N,headers:R,state:E,status:C,title:q,view:k}}}return Y(W(function(t,r){return t.crawler?{}:e(t,r)}),Z(function(t){return t.context.data}),J(function(t){return t.context.head}),K(function(t){return t.context.headers}),rt(function(t){return t.context.state||null}),nt(function(t){return t.context.status}),at(function(t){return t.context.title}),ot(function(t){return t.context.view},void 0,!0),F(function(t){return t.context.error},void 0,function(t,e){return t?[v("error",e,{error:t})]:[]}))},t.withContext=W,t.withCrawlerPatterns=function(t,e){var r=this,n=function(e){return function(n,o){return pt(r,void 0,void 0,function(){var r,a,i,u;return yt(this,function(s){switch(s.label){case 0:return r=t[n],o.mountpath===e.mountpath&&r?[3,1]:[2,e.crawler(n,o)];case 1:return Array.isArray(r)?(i=r,[3,4]):[3,2];case 2:return[4,r(e,e.context)];case 3:i=s.sent(),s.label=4;case 4:return a=i,u=I,[4,Promise.all(a.map(function(t){return e.crawler(t,o)}))];case 5:return[2,u.apply(void 0,[s.sent()])]}})})}};return function(t){return function(r){return function(t,e){return yt(this,function(r){switch(r.label){case 0:return t.crawler?[3,2]:[5,dt(O(e,t))];case 1:return r.sent(),[3,4];case 2:return[5,dt(g(n,t,function(r){return O(e,ft({},t,{crawler:r}))}))];case 3:r.sent(),r.label=4;case 4:return[2]}})}(r,e?e(t):t)}}},t.withData=Z,t.withHead=J,t.withHeaders=K,t.withState=rt,t.withStatus=nt,t.withTitle=at,t.withView=ot,t.NaviError=p,t.NotFoundError=y,t.OutOfRootError=d,t.createChunk=v,t.createNotFoundChunk=b,t.createURLDescriptor=a,t.parseQuery=i,t.stringifyQuery=u,t.joinPaths=c,t.modifyTrailingSlash=l,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("history")):"function"==typeof define&&define.amd?define(["exports","history"],e):e((t=t||self).Navi={},t.History)}(this,function(t,e){"use strict";var r=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},n=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t},o=/((((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;function a(t,e){var r,n,a,s,c,h=void 0===e?{}:e,f=h.removeHash,p=void 0!==f&&f,y=h.trailingSlash,d=void 0===y?null:y;if("string"==typeof t){var v=o.exec(t);if(!v)throw new Error("Couldn't parse the provided URL.");r="",n=l(v[2]||"",d),a=i(s=v[6]||""),c=v[7]||""}else r=t.hostname||"",n=l(t.pathname||"",d),a=t.query||(t.search?i(t.search):{}),s=t.search||u(a),c=t.hash||"";return{hostname:r,pathname:n,query:a,search:s,hash:p?"":c,href:n+s+c}}function i(t,e){if(void 0===e&&(e="?"),!t||t[0]!=e)return{};for(var r={},n=t.slice(1).split("&"),o=0,a=n.length;o<a;o++){var i=n[o].split("=");r[i[0]]=i[1]?decodeURIComponent(i[1]):""}return r}function u(t,e){void 0===e&&(e="?");var r=Object.keys(t);if(0===r.length)return"";for(var n=[],o=0,a=r.length;o<a;o++){var i=r[o],u=String(t[i]);n.push(""===u?i:i+"="+encodeURIComponent(u))}return e+n.join("&")}function s(t){return""===t?[]:t.split("/")}function c(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var o=s(t),a=0;a<e.length;a++)o.push.apply(o,n(s(e[a])));var i=[],u=o.length-1;for(a=0;a<=u;a++){var c=o[a];".."===c?i.pop():"."===c||""===c&&0!==a&&a!==u||i.push(c)}return i.join("/")}function l(t,e){var r="/"===t.slice(-1);return"add"!==e||r?"remove"===e&&r&&t.length>1?t.slice(0,-1):t:t+"/"}var h,f=(h=function(t,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),p=function(t){function e(e){var r=this,n=this.constructor.prototype;return(r=t.call(this,e)||this).__proto__=n,Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,r.constructor):Object.defineProperty(r,"stack",{value:(new Error).stack}),Object.defineProperty(r,"message",{value:e}),r}return f(e,t),e}(Error),y=function(t){function e(e){var r=t.call(this,"URL not found: "+e)||this;return r.pathname=e,r.status=404,r.name="NotFoundError",r}return f(e,t),e}(p),d=function(t){function e(e){var r=t.call(this,"URL not managed by router: "+e.href)||this;return r.url=e,r.name="OutOfRootError",r}return f(e,t),e}(p);function v(t,e,r){return Object.assign({type:t,request:e,url:a({pathname:e.mountpath,query:e.query})},r)}function b(t){var e=c(t.mountpath,t.path);return{type:"error",request:t,url:a({pathname:e,query:t.query}),error:new y(e)}}var m=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},w=function(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 g(t,e,r){var n,o,a,i,u,s,l;return m(this,function(h){switch(h.label){case 0:n="function"==typeof t?t:function(){return t};try{o=n(e,e.context)}catch(t){o=Promise.reject(t)}return x(o)?[3,1]:(a=r(o),[3,7]);case 1:i=o.then(S),u=function(t){var e={};return t.then(function(t){e.value=t,e.outcome="resolved"},function(t){e.error=t,e.outcome="rejected"}),e}(i),s=[v("busy",e,{promise:i})],h.label=2;case 2:return u.outcome?[3,4]:[4,s];case 3:return h.sent(),[3,2];case 4:return"rejected"!==u.outcome?[3,6]:((l=u.error)instanceof y&&!l.pathname&&(l.pathname=c(e.mountpath,e.path)),[4,[v("error",e,{error:l})]]);case 5:return h.sent(),[3,7];case 6:a=r(u.value),h.label=7;case 7:return a?Array.isArray(a)?[4,a.length?a:[]]:[3,9]:[3,11];case 8:return h.sent(),[3,11];case 9:return[5,w(a)];case 10:h.sent(),h.label=11;case 11:return[2]}})}function x(t){return!!t&&!!t.then}function S(t){return function(t){return t&&"object"==typeof t&&"default"in t}(t)?t.default:t}var k=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};function O(t,e,r){return void 0===r&&(r=""),t(e)}function P(t,e){var r,n,o,a;return k(this,function(i){switch(i.label){case 0:o=[],a=[],i.label=1;case 1:return(r=t.next()).done||(o=r.value||[]),(n=e.next()).done||(a=n.value||[]),[4,o.concat(a)];case 2:i.sent(),i.label=3;case 3:if(!r.done||!n.done)return[3,1];i.label=4;case 4:return[2]}})}var R=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},_=function(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 j(t){return function(e){return function(r){return R(this,function(n){switch(n.label){case 0:return[5,_(g(t,r,function(t){return O(t(e),r)}))];case 1:return n.sent(),[2]}})}}}var E=function(){return(E=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},T="\0";function L(t,e){var r=t;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=[],a=[],i=["^"],u=0;u<n.length;u++){var s=n[u];s.length>1&&":"===s[0]?(o.push(s.slice(1)),a.push(T),i.push("([^/]+)")):(a.push(s),i.push(s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))}return{key:a.join("/"),matcher:e,pattern:r,pathParamNames:o.length?o:void 0,regExp:"/"===r?/^\/$/:new RegExp(i.join("/"))}}function C(t,e){var r=e.regExp.exec(t.path||"/");if(r){var n=r[0],o=t.path.slice(n.length)||"";if(!o.length||"/"===o[0]){var a=t.params;if(e.pathParamNames){a=E({},t.params);for(var i=0;i<e.pathParamNames.length;i++){a[e.pathParamNames[i]]=r[i+1]}}var u=c(t.mountpath,n)||"/";return E({},t,{params:a,mountpath:u,path:o,url:o+t.search})}}}function I(t){return[].concat.apply([],t)}var U=function(){return(U=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},q=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},A=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},D=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function N(t){return"busy"===t.type}function G(t){return"mount"===t.type}var H=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},M=function(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 F(t,e,r,n,o,a){function i(e,i){var u,s;return H(this,function(c){switch(c.label){case 0:return u=e.path,(void 0===n?!i:n)&&u&&"/"!==u?[4,[b(e)]]:[3,2];case 1:return c.sent(),[3,4];case 2:return s=e.crawler&&!o||a&&!a(e)?function(){return H(this,function(t){switch(t.label){case 0:return[4,[]];case 1:return t.sent(),[2]}})}():g(t,e,function(t){return r(t,e)}),[5,M(i?P(s,O(i,e)):s)];case 3:c.sent(),c.label=4;case 4:return[2]}})}return function(t){return function(r){return i(r,e?e(t):t)}}}var Q=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},V=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Q(arguments[e]));return t};function Y(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)throw new Error("composeMatchers() expects at least one matcher.");return 1===t.length?t[0]:t.reduce(function(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t(e.apply(void 0,V(r)))}})}var $=function(){return($=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},B=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},z=function(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 W(t,e){return function(r){return function(n){return function(e,r){return B(this,function(n){switch(n.label){case 0:return[5,z(g(t,e,function(t){return O(r,$({},e,{context:t||{}}))}))];case 1:return n.sent(),[2]}})}(n,e?e(r):r)}}}function Z(t,e){return F(t,e,function(t,e){return t?[v("data",e,{data:t})]:[]})}function J(t,e){return F(t,e,function(t,e){return t?[v("head",e,{head:t})]:[]})}function K(t,e){return F(t,e,function(t,e){return t?[v("headers",e,{headers:t})]:[]})}var X=function(){return(X=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},tt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},et=function(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 rt(t,e){function r(e,r){return tt(this,function(n){switch(n.label){case 0:return[5,et(g(t,e,function(t){var n=null===t?e.state:X({},e.state,t);return P(function(t){return tt(this,function(e){switch(e.label){case 0:return[4,t];case 1:return e.sent(),[2]}})}(null===t?[]:[v("state",e,{state:n})]),O(r,X({},e,{state:n})))}))];case 1:return n.sent(),[2]}})}return function(t){return function(n){return r(n,e?e(t):t)}}}function nt(t,e){return F(t,e,function(t,e){return t?[v("status",e,{status:t})]:[]})}function ot(t,e,r){return F(t,e,function(t,e){return t?[v("view",e,{view:t})]:[]},r,!1,function(t){return"HEAD"!==t.method})}function at(t,e){return F(t,e,function(t,e){return t?[v("title",e,{title:t})]:[]})}var it=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},ut=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},st=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r},ct=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function lt(t){return t||{}}function ht(t,e,r,n){if(e){var o=e(r,n);return x(o)?[o.then(S),!0]:[o,!1]}return[t,!1]}var ft=function(){return(ft=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},pt=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},yt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},dt=function(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}}}};var vt=function(){function t(t,e){this.close=t,this.observer=e,this.observer.start&&this.observer.start(this)}return t.prototype.unsubscribe=function(){this.closed||(this.closed=!0,this.close(this.observer),delete this.close,delete this.observer)},t}();function bt(t,e,r){return"function"==typeof t?{next:t,error:e,complete:r}:t}function mt(t){return new Promise(function(e,r){t.subscribe({start:function(t){this.subscription=t},next:function(t){this.value=t},complete:function(){e(this.value),this.subscription.unsubscribe()},error:function(t){r(t),this.subscription.unsubscribe()}})})}var wt=function(){function t(t,e,r){var n=this;this.handleUnsubscribe=function(t){var e=n.observers.indexOf(t);-1!==e&&n.observers.splice(e,1)},this.handleChange=function(t){if(t===n.lastListenId){n.lastListenId++,n.refresh();for(var e=n.result.done||n.result.value.every(function(t){return"busy"!==t.type}),r=0;r<n.observers.length;r++){var o=n.observers[r];o.next(n.result.value),e&&o.complete&&o.complete()}e&&delete n.matcherIterator}},this.refresh=function(){var t=n.matcherIterator.next();if(t.value&&(n.result=t),!n.result.done){var e=++n.lastListenId,r=function(){return n.handleChange(e)};Promise.race(n.result.value.filter(gt).map(xt)).then(r,r)}},this.url=t,this.lastListenId=0,this.observers=[],this.matcherIterator=r(e)}return t.prototype.subscribe=function(t,e,r){if(!this.matcherIterator)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=bt(t,e,r);this.observers.push(n);var o=new vt(this.handleUnsubscribe,n);return 1===this.observers.length&&this.handleChange(this.lastListenId),o},t}();function gt(t){return"busy"===t.type}function xt(t){return t.promise}var St=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},kt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Ot=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,a=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},Pt=function(){function t(t,e,r,n,o,a){var i=this;this.handleUnsubscribe=function(t){var e=i.observers.indexOf(t);-1!==e&&i.observers.splice(e,1)},this.handleResolverUpdate=function(t){t===i.lastListenId&&(i.lastListenId++,i.isRefreshing?i.isRefreshScheduled||(i.isRefreshScheduled=!0):i.refresh())},this.refresh=function(){return St(i,void 0,void 0,function(){var t,e,r,n,o,a,i,u,s,h,f,p,y,d,v,b,m,w,g=this;return kt(this,function(x){switch(x.label){case 0:this.isRefreshScheduled=!1,this.isRefreshing=!0,t=[],e=0,r=function(){var r,o,a,i,u,s,l,h,f,p,y;return kt(this,function(d){switch(d.label){case 0:r=n.mapItems[e],o=r.pathname,a=r.matcherIterator.next(),r.lastResult&&!a.value||(r.lastResult=a),i=r.lastResult.value,r.chunksCache=i||[],u=i.findIndex(function(t){return"error"===t.type||t.url.href.length>=r.url.href.length&&("mount"===t.type&&r.lastMountPatterns!==t.patterns||"redirect"===t.type&&r.lastRedirectTo!==t.to)}),d.label=1;case 1:if(!(u>=0&&u<i.length))return[3,6];if(s=i[u],u++,"error"===s.type||n.options.predicate&&!n.options.predicate(s,i))return n.removeFromQueue(r),[2,"continue-items"];if("redirect"===s.type&&(r.lastRedirectTo=s.to,n.options.followRedirects&&n.addToQueue(s.to,r.depth+1,r.walkedPatternLists,o,r.order)),"mount"!==s.type)return[3,5];if(l=s.patterns,r.lastMountPatterns=l,h=l.slice(0).sort().join("\n"),!l||r.walkedPatternLists.has(h))return[3,5];r.walkedPatternLists.add(h),f=0,d.label=2;case 2:return f<l.length?[4,n.expandPatterns(c(o,l[f]))]:[3,5];case 3:for(p=d.sent(),y=0;y<p.length;y++)n.addToQueue(p[y],r.depth+1,r.walkedPatternLists,o,r.order.concat(f,y));d.label=4;case 4:return f++,[3,2];case 5:return[3,1];case 6:return i&&(t=t.concat(i)),e++,[2]}})},n=this,x.label=1;case 1:return this.mapItems&&e<this.mapItems.length?[5,r()]:[3,3];case 2:switch(x.sent()){case"continue-items":return[3,1]}return[3,1];case 3:if(!this.mapItems)return[2];for(o=[],a=0;a<this.mapItems.length;a++)i=this.mapItems[a],"mount"===(u=i.chunksCache[i.chunksCache.length-1]).type||"error"===u.type||"busy"!==u.type&&this.options.predicate&&!this.options.predicate(u,i.chunksCache)||o.push([c(i.pathname,"/"),i.chunksCache,i.order]);if(s=++this.lastListenId,h=function(){return g.handleResolverUpdate(s)},Promise.race(t.filter(Rt).map(_t)).then(h,h),o.sort(function(t,e){var r=t[2],n=e[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(f={},p=!0,y=0;y<o.length;y++)d=Ot(o[y],2),v=d[0],(b=d[1]).some(function(t){return"busy"===t.type})&&(p=!1),f[l(v,"remove")]=b;for(m=0;m<this.observers.length;m++)(w=this.observers[m]).next(f),p&&w.complete&&w.complete();p&&(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=e,this.matcherGeneratorFunction=r,this.rootMapping=n,this.options=a,this.seenPathnames=new Set;var u=t.pathname;"/"===u.substr(-1)&&(u=u.substr(0,u.length-1)),this.addToQueue(u,0,new Set)}return t.prototype.subscribe=function(t,e,r){if(!this.observers)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=bt(t,e,r);this.observers.push(n);var o=new vt(this.handleUnsubscribe,n);return 1===this.observers.length&&this.refresh(),o},t.prototype.expandPatterns=function(t){return St(this,void 0,void 0,function(){var e;return kt(this,function(r){switch(r.label){case 0:return this.options.expandPattern?[4,this.options.expandPattern(t,this.router)]:[3,2];case 1:if(e=r.sent())return[2,e];r.label=2;case 2:return[2,[t].filter(function(t){return!/\/:/.test(t)})]}})})},t.prototype.removeFromQueue=function(t){var e=this.mapItems.indexOf(t);-1!==e&&this.mapItems.splice(e,1)},t.prototype.addToQueue=function(t,e,r,n,o){if(void 0===o&&(o=[0]),!this.seenPathnames.has(t)&&(!this.options.maxDepth||e<=this.options.maxDepth)){this.seenPathnames.add(t);var i=a(t,{removeHash:!0}),u=C({body:null,context:this.rootContext,headers:this.options.headers||{},method:this.options.method||"HEAD",params:{},hostname:this.options.hostname||"",mountpath:"",query:i.query,search:i.search,hash:i.hash,path:i.pathname,url:i.pathname+i.search,originalUrl:i.href,state:{}},this.rootMapping);u&&this.mapItems.push({url:i,fromPathname:n,depth:e,pathname:t,order:o,walkedPatternLists:new Set(r),matcherIterator:this.matcherGeneratorFunction(u)})}},t}();function Rt(t){return"busy"===t.type}function _t(t){return t.promise}var jt=function(){return(jt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function Et(t,e){return t=function(t,e){if(t){if("url"===e.type)return jt({},t,{chunks:t.chunks.filter(function(t){return"url"!==t.type}),url:e.url});if("ready"!==t.type)return t}var r={lastChunk:e,method:e.request&&e.request.method,chunks:t?t.chunks.concat(e):[e],data:t?t.data:{},headers:t?t.headers:{},heads:t?t.heads:[],state:t?t.state:{},status:t?t.status:200,title:t&&t.title,url:t?t.url:e.url,views:t?t.views:[]};switch(e.type){case"busy":return jt({},r,{type:"busy"});case"data":return jt({},r,{type:"ready",data:jt({},r.data,e.data)});case"error":return jt({},r,{type:"error",error:e.error,status:r.status&&r.status>=400?r.status:e.error.status||500});case"head":return jt({},r,{type:"ready",heads:r.heads.concat(e.head)});case"headers":return jt({},r,{type:"ready",headers:jt({},r.headers,e.headers)});case"redirect":return jt({},r,{type:"redirect",to:e.to});case"state":return jt({},r,{type:"ready",state:jt({},r.state,e.state)});case"status":return jt({},r,{type:"ready",status:e.status});case"title":return jt({},r,{type:"ready",title:e.title});case"view":return jt({},r,{type:"ready",views:r.views.concat(e.view)});default:return jt({},r,{type:"ready"})}}(t,e),Object.defineProperties(t,{meta:{configurable:!0,get:function(){return t.data}},content:{configurable:!0,get:function(){return e.view}},segments:{configurable:!0,get:function(){return t.chunks}},lastSegment:{configurable:!0,get:function(){return t.lastChunk}}}),t}function Tt(t){return new Lt(t)}var Lt=function(){function t(t){this.context=t.context||{},this.matcherGenerator=t.routes();var e,r,n=t.basename;n&&"/"===n.slice(-1)&&(n=n.slice(0,-1)),this.rootMapping=(e=t.routes,void 0===(r=n)&&(r=""),""!==r?L(r,e):{pattern:r,key:"",regExp:new RegExp(""),matcher:e})}return t.prototype.setContext=function(t){this.context=t||{}},t.prototype.createObservable=function(t,e){var r=C({body:e.body,context:this.context,headers:e.headers||{},method:e.method||"GET",hostname:t.hostname,hash:t.hash,mountpath:"/",params:t.query,query:t.query,search:t.search,url:t.pathname+t.search,originalUrl:t.href,path:t.pathname,crawler:e.crawler,state:e.state||{}},this.rootMapping);if(r)return new wt(t,r,this.matcherGenerator)},t.prototype.createMapObservable=function(t,e){return void 0===e&&(e={}),new Pt(a(t),this.context,this.matcherGenerator,this.rootMapping,this,e)},t.prototype.resolve=function(t,e){var r,n=this;if(void 0===e&&(e={}),Array.isArray(t))r=t.map(function(t){return a(t)});else if("string"==typeof t)r=[a(t)];else if(t.url)r=[a((e=t).url)];else{if(!e)throw new Error("You must specify a URL for router.resolve().");r=[a(t)]}if(!r.length)return Promise.resolve([]);var o=r.map(function(t){return n.getPageRoutePromise(t,e)});return Array.isArray(t)?Promise.all(o):o[0]},t.prototype.resolveSiteMap=function(t,e){return void 0===e&&(e={}),mt(this.createMapObservable(t,e)).then(function(t){for(var e={},r={},n=Object.keys(t),o=0;o<n.length;o++){var i=n[o],u=t[i],s=u[u.length-1];"redirect"!==s.type?e[i]=[{type:"url",url:a(i)}].concat(u).reduce(Et,void 0):r[i]=s.to}return{routes:e,redirects:r}})},t.prototype.resolveRouteMap=function(t,e){return void 0===e&&(e={}),this.resolveSiteMap(t,e).then(function(t){return t.routes})},t.prototype.getPageRoutePromise=function(t,e){var r=this,n=this.createObservable(t,e);return n?mt(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&&e.followRedirects)return r.getPageRoutePromise(a(i.to),e);if("error"===i.type)throw i.error}return[{type:"url",url:a(t)}].concat(n).reduce(Et,void 0)}):Promise.reject(new d(t))},t}(),Ct=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},It=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};var Ut=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},qt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},At=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r};function Dt(t){return Ut(this,void 0,void 0,function(){var e,r,n,o,a,i;return qt(this,function(u){if(e=t.basename,r=t.context,n=t.routes,o=t.url,a=t.urls,i=At(t,["basename","context","routes","url","urls"]),o&&a)throw new Error("You cannot pass both `url` and `urls` options to resolve(). Please pick one!");if(!o&&!a)throw new Error("You must pass one of `url` or `urls` options to resolve().");return[2,Tt({basename:e,context:r,routes:n}).resolve(o||a,i)]})})}var Nt=function(){return function(){this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),Object.freeze(this)}}(),Gt=function(){return(Gt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},Ht=function(t,e,r,n){return new(r||(r=Promise))(function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function u(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(i,u)}s((n=n.apply(t,e||[])).next())})},Mt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Ft=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r},Qt=function(){function t(t){var e=this;this.handleUnsubscribe=function(t){var r=e.observers.indexOf(t);-1!==r&&e.observers.splice(r,1)},this.handleChunkList=function(t){for(var r=!0,n=e._history.location,o=0;o<t.length;o++){var i=t[o];if("busy"===i.type&&(r=!1),"state"===i.type&&(e.ignoreNextLocationChange=!0,e._history.replace(Gt({},n,{state:Yt(n.state,i.state)}))),"redirect"===i.type){var u=Bt(n.state);return void(u?(e.ignoreNextLocationChange=!0,e._history.replace(Gt({},n,{state:u})),e._history.push(i.to)):e._history.replace(i.to))}}e.setRoute([{type:"url",url:a(e.lastHandledLocation)}].concat(t).reduce(Et,void 0),r)},this._history=t.history,this.observers=[],this.isLastRouteSteady=!1,this.navigationsSinceSteady=0,this.basename=t.basename,this.matcher=t.routes,this._router=new Lt({context:t.context,routes:t.routes,basename:t.basename}),this.trailingSlash=void 0===t.trailingSlash?"remove":t.trailingSlash,this.unlisten=this._history.listen(function(t){return e.handleLocationChange(t,!1)})}return t.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,delete this._router},t.prototype.go=function(t){return Ht(this,void 0,void 0,function(){var e,r=this;return Mt(this,function(n){switch(n.label){case 0:return e=new Promise(function(t){var e=r._history.listen(function(){e(),t()})}),this._history.go(t),[4,e];case 1:return n.sent(),[2,this.getRoute()]}})})},t.prototype.goBack=function(){return this.go(-1)},t.prototype.goForward=function(){return this.go(1)},t.prototype.navigate=function(t,e){var r;if(void 0===e&&(e={}),"string"==typeof t)r=a(t);else if(t.url)r=a((e=t).url);else{if(!t)throw new Error("You must specify a URL or state to navigation.navigate().");r=a(t)}var n=this._history.location,o=e.replace||!1!==e.replace&&n.pathname===r.pathname&&n.search===r.search&&n.hash===r.hash;return this._history[o?"replace":"push"]({pathname:r.pathname,search:r.search,hash:r.hash,state:$t({revertTo:o?n.state:void 0,method:e.method,headers:e.headers,body:e.body,state:e.state})}),this.getRoute()},t.prototype.prefetch=function(t){return Ht(this,void 0,void 0,function(){return Mt(this,function(e){switch(e.label){case 0:return[4,Dt({basename:this.basename,routes:this.matcher,context:this._router.context,url:t})];case 1:return e.sent(),[2]}})})},t.prototype.refresh=function(){return this.handleLocationChange(this._history.location,!0),this.getRoute()},t.prototype.setContext=function(t){return this._router.setContext(t),this.refresh()},t.prototype.getCurrentValue=function(){return this.lastRoute},t.prototype.getRoute=function(){return Ht(this,void 0,void 0,function(){return Mt(this,function(t){return this.isLastRouteSteady?[2,this.lastRoute]:(this.waitUntilSteadyDeferred||(this.waitUntilSteadyDeferred=new Nt),[2,this.waitUntilSteadyDeferred.promise])})})},t.prototype.getSteadyValue=function(){return Ht(this,void 0,void 0,function(){return Mt(this,function(t){return[2,this.getRoute()]})})},t.prototype.steady=function(){return Ht(this,void 0,void 0,function(){return Mt(this,function(t){switch(t.label){case 0:return[4,this.getRoute()];case 1:return t.sent(),[2]}})})},t.prototype.extractState=function(){return this._history.location.state},t.prototype.subscribe=function(t,e,r){var n=bt(t,e,r);return this.observers.push(n),new vt(this.handleUnsubscribe,n)},t.prototype.handleLocationChange=function(t,e){if(this.ignoreNextLocationChange)this.ignoreNextLocationChange=!1;else if(++this.navigationsSinceSteady>100)console.error("Detected possible navigation loop with 100 navigations between steady routes. Bailing.");else{if(null!==this.trailingSlash){var r=l(t.pathname,this.trailingSlash);if(t.pathname!==r)return void this._history.replace(Gt({},t,{pathname:r}))}var n=a(t),o=this.lastHandledLocation;this.lastHandledLocation=t,this.observableSubscription&&this.observableSubscription.unsubscribe();var i=this._router.createObservable(n,function(t){void 0===t&&(t={});var e=Gt({},t);delete e[Vt];var r=t[Vt]||{};return Gt({},r.requestDataWithoutState,{state:Object.keys(e).length?e:void 0})}(t.state));if(i)this.observableSubscription=i.subscribe(this.handleChunkList);else if(!o)throw new d(n)}},t.prototype.setRoute=function(t,e){if(t!==this.lastRoute){this.lastRoute=t,this.isLastRouteSteady=e,e&&(this.navigationsSinceSteady=0);for(var r=0;r<this.observers.length;r++)this.observers[r].next(t);this.isLastRouteSteady&&this.waitUntilSteadyDeferred&&(this.waitUntilSteadyDeferred.resolve(t),delete this.waitUntilSteadyDeferred)}},t}(),Vt="__navi__";function Yt(t,e){var r;return void 0===t&&(t={}),Gt({},e,((r={})[Vt]=t[Vt],r))}function $t(t){var e,r=t.revertTo,n=t.state,o=Ft(t,["revertTo","state"]);return r&&(r=Gt({},r))[Vt]&&delete r[Vt].revertTo,Gt({},n,((e={})[Vt]={requestDataWithoutState:o,revertTo:r},e))}function Bt(t){return void 0===t&&(t={}),(t[Vt]||{}).revertTo}var zt=function(){return(zt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};var Wt=function(){return(Wt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};t.crawl=function(t){return Ct(this,void 0,void 0,function(){var e,r,n,o,i,u,s,h,f,p,y,d,v,b=this;return It(this,function(m){switch(m.label){case 0:return e=Tt({basename:t.basename,context:t.context,routes:t.routes}),r=a(t.root||""),n=t.predicate||function(){return!0},o=t.expandPattern||function(t){return[t||""]},i=function(t,e){return Ct(b,void 0,void 0,function(){return It(this,function(r){switch(r.label){case 0:return[4,o(t)];case 1:return[2,(r.sent()||[]).map(function(t){return{headers:e.headers,url:a(c(e.mountpath,t)),context:e.headers}}).filter(n)]}})})},[4,mt(e.createObservable(r,{crawler:i,headers:t.headers,method:"HEAD"}))];case 1:u=m.sent(),s=[],h={};t:for(f=0;f<u.length;f++)if("crawl"===(p=u[f]).type){if(-1!==(y=p.url.pathname).indexOf(":"))continue;for(d=f+1;d<u.length&&"crawl"!==(v=u[d]).type&&"mount"!==v.type;d++,f++)if("redirect"===v.type){h[y]=v.to;continue t}s.push(y)}return[2,{paths:null!==t.trailingSlash?s.map(function(e){return l(e,t.trailingSlash||"remove")}):s,redirects:h}]}})})},t.resolve=Dt,t.compose=Y,t.Router=Lt,t.createRouter=Tt,t.routeReducer=Et,t.concatMatcherIterators=P,t.Navigation=Qt,t.resolveChunks=g,t.createBrowserNavigation=function(t){!t.state&&void 0!==typeof window&&window.__NAVI_STATE__&&(t.state=window.__NAVI_STATE__,delete window.__NAVI_STATE__);var r=t.history||e.createBrowserHistory();t.state&&r.replace(zt({},r.location,{state:t.state}));var n=new Qt({history:r,basename:t.basename,context:t.context,routes:t.routes,trailingSlash:t.trailingSlash});return n.refresh(),n},t.createMemoryNavigation=function(t){var r=t.url||t.request&&t.request.url;if(!r)throw new Error("createMemoryNavigation() could not find a URL.");var n=e.createMemoryHistory({initialEntries:["/"]}),o=new Qt({history:n,basename:t.basename,context:t.context,routes:t.routes,trailingSlash:t.trailingSlash});return o.navigate(Wt({},t.request,{url:r,replace:!0})),o},t.lazy=j,t.map=j,t.mount=function(t){if(!t)throw new Error("mount() must be supplied with a paths object.");var e=Object.keys(t),r=e.filter(function(t){return"*"!==t}).map(function(e){return L(e,t[e])}).sort(function(t,e){return r=t.key,n=e.key,r<n?-1:r>n?1:0;var r,n});return function(n){return function(o){var a,i,u,s,c,l,h,f,p,y,d,m,w,g,x,S,k;return A(this,function(P){switch(P.label){case 0:if(u=[],s=[],c=[],l=o.crawler,!(h=l&&(""===o.path||"/"===o.path)))return[3,5];(f=function(t,e,r){return q(this,void 0,void 0,function(){var n;return A(this,function(o){switch(o.label){case 0:return n=I,[4,Promise.all(Object.entries(t).map(function(t){var n,o=D(t,2),a=o[0],i=o[1];return e("*"===a?"":a,r).then((n=i,function(t){return t.map(function(t){return[n,t]})}))}))];case 1:return[2,n.apply(void 0,[o.sent()])]}})})}(t,l,o)).then(function(t){p=t},function(t){return y=t}),P.label=1;case 1:return[4,[v("busy",o,{promise:f})]];case 2:if(P.sent(),y)throw y;P.label=3;case 3:if(!p)return[3,1];P.label=4;case 4:return i=p.map(function(t,e){var r=D(t,2),a=r[0],i=r[1],u=U({},o,{mountpath:i.url.pathname,url:"",path:""});return c[e]=u,O(a(n),u,u.mountpath)}),[3,6];case 5:for(S=r.length-1;S>=0;S--)if(d=r[S],m=C(o,d)){i=[O(d.matcher(n),m,d.pattern)];break}i||(w=t["*"])&&(i=[O(w(n),o,"*")]),P.label=6;case 6:if(i)for(S=0;S<i.length;S++)(g=u[S])&&g.done||(g=u[S]=i[S].next()),g&&!g.done&&(s[S]=g.value);for(a=[v("mount",o,{patterns:e})],x=!1,S=0;S<u.length;S++)(k=s[S])&&(x=!0,h&&!k.some(G)&&(a=a.concat(v("crawl",c[S]))),a=a.concat(k));return l||x||a.push(b(o)),[4,a];case 7:P.sent(),P.label=8;case 8:if(a.filter(N).length)return[3,6];P.label=9;case 9:return[2]}})}}},t.redirect=function(t,e){var r=(void 0===e?{}:e).exact;return F(t,void 0,function(t,e){var r;return"string"==typeof t?r="/"===t[0]?t:c("/",e.mountpath,t):t&&(r=a(t).href),r?[v("redirect",e,{to:r})]:[]},void 0===r||r,!0)},t.route=function(t){var e;if(void 0===t&&(t={}),"function"==typeof t)e=t;else{var r=t.data,n=t.getData,o=t.error,a=t.head,i=t.getHead,u=t.headers,s=t.getHeaders,c=t.state,l=t.getState,h=t.status,f=t.getStatus,p=t.title,y=t.getTitle,d=t.view,b=t.getView;st(t,["data","getData","error","head","getHead","headers","getHeaders","state","getState","status","getStatus","title","getTitle","view","getView"]),e=function(t,e){var v,m=this,w=ct(ht(r,n,t,e),2),g=w[0],S=w[1];g?x(g)&&(g=g.then(lt)):g={};var k,O,P=ct(ht(u,s,t,e),2),R=P[0],_=P[1],j=ct(ht(c,l,t,e),2),E=j[0],T=j[1],L=ct(ht(h,f,t,e),2),C=L[0],I=L[1],U=ct(ht(p,y,t,e),2),q=U[0],A=U[1],D=ct(ht(a,i,t,e),2),N=D[0],G=D[1];return"HEAD"!==t.method&&(v=ct(ht(d,b,t,e),2),k=v[0],O=v[1]),S||_||T||I||A||G||O?it(m,void 0,void 0,function(){var t;return ut(this,function(e){switch(e.label){case 0:return t={},[4,g];case 1:return t.data=e.sent(),t.error=o,[4,N];case 2:return t.head=e.sent(),[4,R];case 3:return t.headers=e.sent(),[4,E];case 4:return t.state=e.sent(),[4,C];case 5:return t.status=e.sent(),[4,q];case 6:return t.title=e.sent(),[4,k];case 7:return[2,(t.view=e.sent(),t)]}})}):{data:g,error:o,head:N,headers:R,state:E,status:C,title:q,view:k}}}return Y(W(function(t,r){return t.crawler?{}:e(t,r)}),Z(function(t){return t.context.data}),J(function(t){return t.context.head}),K(function(t){return t.context.headers}),rt(function(t){return t.context.state||null}),nt(function(t){return t.context.status}),at(function(t){return t.context.title}),ot(function(t){return t.context.view},void 0,!0),F(function(t){return t.context.error},void 0,function(t,e){return t?[v("error",e,{error:t})]:[]}))},t.withContext=W,t.withCrawlerPatterns=function(t,e){var r=this,n=function(e){return function(n,o){return pt(r,void 0,void 0,function(){var r,a,i,u;return yt(this,function(s){switch(s.label){case 0:return r=t[n],o.mountpath===e.mountpath&&r?[3,1]:[2,e.crawler(n,o)];case 1:return Array.isArray(r)?(i=r,[3,4]):[3,2];case 2:return[4,r(e,e.context)];case 3:i=s.sent(),s.label=4;case 4:return a=i,u=I,[4,Promise.all(a.map(function(t){return e.crawler(t,o)}))];case 5:return[2,u.apply(void 0,[s.sent()])]}})})}};return function(t){return function(r){return function(t,e){return yt(this,function(r){switch(r.label){case 0:return t.crawler?[3,2]:[5,dt(O(e,t))];case 1:return r.sent(),[3,4];case 2:return[5,dt(g(n,t,function(r){return O(e,ft({},t,{crawler:r}))}))];case 3:r.sent(),r.label=4;case 4:return[2]}})}(r,e?e(t):t)}}},t.withData=Z,t.withHead=J,t.withHeaders=K,t.withState=rt,t.withStatus=nt,t.withTitle=at,t.withView=ot,t.NaviError=p,t.NotFoundError=y,t.OutOfRootError=d,t.createChunk=v,t.createNotFoundChunk=b,t.createURLDescriptor=a,t.parseQuery=i,t.stringifyQuery=u,t.joinPaths=c,t.modifyTrailingSlash=l,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "navi", | ||
"version": "0.13.0-alpha.0", | ||
"version": "0.13.0-beta.1", | ||
"description": "A router-loader for React.", | ||
@@ -60,3 +60,3 @@ "author": "James K Nelson <james@jamesknelson.com>", | ||
}, | ||
"gitHead": "7e2d77304dc7ee57eadbeb9cc23e6dfa4e902e2b" | ||
"gitHead": "8fa7ff942acdfbb3c792371f4c974e02764eb8e2" | ||
} |
@@ -70,2 +70,3 @@ <p align="center"> | ||
- [Marek Calus' blog](https://mcalus.netlify.com/) | ||
- [Offset Earth](https://offset.earth/) | ||
- *Using Navi? Submit a Pull Request to add your site here!* | ||
@@ -72,0 +73,0 @@ |
@@ -134,3 +134,8 @@ import { Matcher } from './Matcher' | ||
let matchedPathname = match[0] | ||
let unmatchedPath = request.path.slice(matchedPathname.length) || '' | ||
if (unmatchedPath.length && unmatchedPath[0] !== '/') { | ||
return | ||
} | ||
// Set path params using RegExp match | ||
@@ -146,3 +151,2 @@ let params = request.params | ||
let unmatchedPath = request.path.slice(matchedPathname.length) || '' | ||
let mountpath = joinPaths(request.mountpath, matchedPathname) || '/' | ||
@@ -149,0 +153,0 @@ return { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
746997
12706
111