orator 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.config/configstore/update-notifier-npm.json +1 -1
- package/dist/orator.js +58 -6
- package/dist/orator.min.js +2 -2
- package/dist/orator.min.js.map +1 -1
- package/package.json +2 -2
- package/source/Orator-ServiceServer-Base.js +70 -11
- package/source/Orator-ServiceServer-IPC.js +8 -0
- package/test/Orator_basic_tests.js +6 -1
package/dist/orator.js
CHANGED
|
@@ -4687,6 +4687,7 @@
|
|
|
4687
4687
|
constructor(pOrator) {
|
|
4688
4688
|
this.orator = pOrator;
|
|
4689
4689
|
this.log = pOrator.log;
|
|
4690
|
+
this.ServiceServerType = 'Base';
|
|
4690
4691
|
this.Name = this.orator.settings.Product;
|
|
4691
4692
|
this.URL = 'BASE_SERVICE_SERVER';
|
|
4692
4693
|
this.Port = this.orator.settings.ServicePort;
|
|
@@ -4709,13 +4710,17 @@
|
|
|
4709
4710
|
* End of Service Lifecycle Functions
|
|
4710
4711
|
*/
|
|
4711
4712
|
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4713
|
+
/*
|
|
4714
|
+
* Content parsing functions
|
|
4715
|
+
*************************************************************************/
|
|
4716
|
+
bodyParser(pOptions) {
|
|
4717
|
+
return (pRequest, pResponse, fNext) => {
|
|
4718
|
+
fNext();
|
|
4719
|
+
};
|
|
4718
4720
|
}
|
|
4721
|
+
/*************************************************************************
|
|
4722
|
+
* End of Service Lifecycle Functions
|
|
4723
|
+
*/
|
|
4719
4724
|
|
|
4720
4725
|
/*
|
|
4721
4726
|
* Service Route Creation Functions
|
|
@@ -4736,11 +4741,27 @@
|
|
|
4736
4741
|
}
|
|
4737
4742
|
* This pattern and calling super is totally optional, obviously.
|
|
4738
4743
|
*************************************************************************/
|
|
4744
|
+
use(fHandlerFunction) {
|
|
4745
|
+
if (typeof fHandlerFunction != 'function') {
|
|
4746
|
+
this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof fHandlerFunction} instead of a string.`);
|
|
4747
|
+
return false;
|
|
4748
|
+
}
|
|
4749
|
+
return true;
|
|
4750
|
+
}
|
|
4751
|
+
doGet(pRoute, ...fRouteProcessingFunctions) {
|
|
4752
|
+
return true;
|
|
4753
|
+
}
|
|
4739
4754
|
get(pRoute, ...fRouteProcessingFunctions) {
|
|
4740
4755
|
if (typeof pRoute != 'string') {
|
|
4741
4756
|
this.log.error(`Orator GET Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
|
|
4742
4757
|
return false;
|
|
4743
4758
|
}
|
|
4759
|
+
return this.doGet(pRoute, ...fRouteProcessingFunctions);
|
|
4760
|
+
}
|
|
4761
|
+
getWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4762
|
+
return this.get(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4763
|
+
}
|
|
4764
|
+
doPut(pRoute, ...fRouteProcessingFunctions) {
|
|
4744
4765
|
return true;
|
|
4745
4766
|
}
|
|
4746
4767
|
put(pRoute, ...fRouteProcessingFunctions) {
|
|
@@ -4748,6 +4769,12 @@
|
|
|
4748
4769
|
this.log.error(`Orator PUT Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
|
|
4749
4770
|
return false;
|
|
4750
4771
|
}
|
|
4772
|
+
return this.doPut(pRoute, ...fRouteProcessingFunctions);
|
|
4773
|
+
}
|
|
4774
|
+
putWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4775
|
+
return this.put(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4776
|
+
}
|
|
4777
|
+
doPost(pRoute, ...fRouteProcessingFunctions) {
|
|
4751
4778
|
return true;
|
|
4752
4779
|
}
|
|
4753
4780
|
post(pRoute, ...fRouteProcessingFunctions) {
|
|
@@ -4757,6 +4784,12 @@
|
|
|
4757
4784
|
}
|
|
4758
4785
|
return true;
|
|
4759
4786
|
}
|
|
4787
|
+
postWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4788
|
+
return this.post(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4789
|
+
}
|
|
4790
|
+
doDel(pRoute, ...fRouteProcessingFunctions) {
|
|
4791
|
+
return true;
|
|
4792
|
+
}
|
|
4760
4793
|
del(pRoute, ...fRouteProcessingFunctions) {
|
|
4761
4794
|
if (typeof pRoute != 'string') {
|
|
4762
4795
|
this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
|
|
@@ -4764,6 +4797,9 @@
|
|
|
4764
4797
|
}
|
|
4765
4798
|
return true;
|
|
4766
4799
|
}
|
|
4800
|
+
delWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4801
|
+
return this.del(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4802
|
+
}
|
|
4767
4803
|
patch(pRoute, ...fRouteProcessingFunctions) {
|
|
4768
4804
|
if (typeof pRoute != 'string') {
|
|
4769
4805
|
this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
|
|
@@ -4771,6 +4807,9 @@
|
|
|
4771
4807
|
}
|
|
4772
4808
|
return true;
|
|
4773
4809
|
}
|
|
4810
|
+
patchWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4811
|
+
return this.patch(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4812
|
+
}
|
|
4774
4813
|
opts(pRoute, ...fRouteProcessingFunctions) {
|
|
4775
4814
|
if (typeof pRoute != 'string') {
|
|
4776
4815
|
this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
|
|
@@ -4778,6 +4817,9 @@
|
|
|
4778
4817
|
}
|
|
4779
4818
|
return true;
|
|
4780
4819
|
}
|
|
4820
|
+
optsWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4821
|
+
return this.opts(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4822
|
+
}
|
|
4781
4823
|
head(pRoute, ...fRouteProcessingFunctions) {
|
|
4782
4824
|
if (typeof pRoute != 'string') {
|
|
4783
4825
|
this.log.error(`Orator HEAD Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
|
|
@@ -4785,6 +4827,9 @@
|
|
|
4785
4827
|
}
|
|
4786
4828
|
return true;
|
|
4787
4829
|
}
|
|
4830
|
+
headWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
4831
|
+
return this.head(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
|
|
4832
|
+
}
|
|
4788
4833
|
/*************************************************************************
|
|
4789
4834
|
* End of Service Route Creation Functions
|
|
4790
4835
|
*/
|
|
@@ -4886,6 +4931,7 @@
|
|
|
4886
4931
|
this.routerOptions = this.orator.settings.hasOwnProperty('router_options') && typeof this.orator.settings.router_options == 'object' ? this.orator.settings.router_options : {};
|
|
4887
4932
|
this.router = libFindMyWay(this.routerOptions);
|
|
4888
4933
|
this.router.addConstraintStrategy(libOratorServiceServerIPCCustomConstrainer);
|
|
4934
|
+
this.ServiceServerType = 'IPC';
|
|
4889
4935
|
this.URL = 'IPC';
|
|
4890
4936
|
this.preBehaviorFunctions = [];
|
|
4891
4937
|
this.behaviorMap = {};
|
|
@@ -4980,6 +5026,9 @@
|
|
|
4980
5026
|
});
|
|
4981
5027
|
return true;
|
|
4982
5028
|
}
|
|
5029
|
+
|
|
5030
|
+
// This is the virtualized "body parser"
|
|
5031
|
+
|
|
4983
5032
|
get(pRoute, ...fRouteProcessingFunctions) {
|
|
4984
5033
|
if (!super.get(pRoute, ...fRouteProcessingFunctions)) {
|
|
4985
5034
|
this.log.error(`IPC provider failed to map GET route [${pRoute}]!`);
|
|
@@ -4987,6 +5036,9 @@
|
|
|
4987
5036
|
}
|
|
4988
5037
|
return this.addRouteProcessor('GET', pRoute, Array.from(fRouteProcessingFunctions));
|
|
4989
5038
|
}
|
|
5039
|
+
getWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
|
|
5040
|
+
return this.get(pRoute, fS);
|
|
5041
|
+
}
|
|
4990
5042
|
put(pRoute, ...fRouteProcessingFunctions) {
|
|
4991
5043
|
if (!super.get(pRoute, ...fRouteProcessingFunctions)) {
|
|
4992
5044
|
this.log.error(`IPC provider failed to map PUT route [${pRoute}]!`);
|
package/dist/orator.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
6
6
|
* @license MIT
|
|
7
|
-
*/function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function s(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t("util/"),a=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c="foo"===function(){}.name;function l(t){return Object.prototype.toString.call(t)}function f(t){return!s(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=e.exports=m,p=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(o.isFunction(t)){if(c)return t.name;var e=t.toString().match(p);return e&&e[1]}}function g(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function y(t){if(c||!o.isFunction(t))return o.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function v(t,e,r,n,i){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function m(t,e){t||v(t,!0,e,"==",h.ok)}function b(t,e,r,n){if(t===e)return!0;if(s(t)&&s(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(f(t)&&f(e)&&l(t)===l(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var a=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==a&&a===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=S(t),s=S(e);if(i&&!s||!i&&s)return!1;if(i)return b(t=u.call(t),e=u.call(e),r);var a,c,l=x(t),f=x(e);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),c=l.length-1;c>=0;c--)if(l[c]!==f[c])return!1;for(c=l.length-1;c>=0;c--)if(!b(t[a=l[c]],e[a],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function S(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function C(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!t&&i&&!r;if((!t&&o.isError(i)&&s&&w(i,r)||a)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!w(i,r)||!t&&i)throw i}h.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(y(t.actual),128)+" "+t.operator+" "+g(y(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=m,h.equal=function(t,e,r){t!=e&&v(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){b(t,e,!1)||v(t,e,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,r){b(t,e,!0)||v(t,e,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){b(t,e,!1)&&v(t,e,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){b(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",h.notStrictEqual)},h.throws=function(t,e,r){C(!0,t,e,r)},h.doesNotThrow=function(t,e,r){C(!1,t,e,r)},h.ifError=function(t){if(t)throw t},h.strict=n((function t(e,r){e||v(e,!0,r,"==",t)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var x=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":36,"util/":4}],2:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],3:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],4:[function(t,e,r){(function(e,n){(function(){var i=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(a(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,s=n.length,o=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<s;u=n[++r])g(u)||!S(u)?o+=" "+u:o+=" "+a(u);return o},r.deprecate=function(t,i){if(m(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(!0===e.noDeprecation)return t;var s=!1;return function(){if(!s){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),s=!0}return t.apply(this,arguments)}};var s,o={};function a(t,e){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,t,n.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function c(t,e){return t}function l(t,e,n){if(t.customInspect&&e&&x(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=l(t,i,n)),i}var s=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(y(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(s)return s;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),C(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(x(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(b(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(w(e))return t.stylize(Date.prototype.toString.call(e),"date");if(C(e))return f(e)}var c,S="",O=!1,P=["{","}"];(p(e)&&(O=!0,P=["[","]"]),x(e))&&(S=" [Function"+(e.name?": "+e.name:"")+"]");return b(e)&&(S=" "+RegExp.prototype.toString.call(e)),w(e)&&(S=" "+Date.prototype.toUTCString.call(e)),C(e)&&(S=" "+f(e)),0!==o.length||O&&0!=e.length?n<0?b(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=O?function(t,e,r,n,i){for(var s=[],o=0,a=e.length;o<a;++o)j(e,String(o))?s.push(h(t,e,r,n,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(h(t,e,r,n,i,!0))})),s}(t,e,n,a,o):o.map((function(r){return h(t,e,n,a,r,O)})),t.seen.pop(),function(t,e,r){var n=t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(n>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,S,P)):P[0]+S+P[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),j(n,i)||(o="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=g(r)?l(t,u.value,null):l(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),m(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return"number"==typeof t}function v(t){return"string"==typeof t}function m(t){return void 0===t}function b(t){return S(t)&&"[object RegExp]"===O(t)}function S(t){return"object"==typeof t&&null!==t}function w(t){return S(t)&&"[object Date]"===O(t)}function C(t){return S(t)&&("[object Error]"===O(t)||t instanceof Error)}function x(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function P(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(m(s)&&(s=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(s)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=y,r.isString=v,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=m,r.isRegExp=b,r.isObject=S,r.isDate=w,r.isError=C,r.isFunction=x,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[P(t.getHours()),P(t.getMinutes()),P(t.getSeconds())].join(":"),[t.getDate(),E[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!S(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":3,_process:37,inherits:2}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,s.isAsync)(t))return function(...e){const r=e.pop();return a(t.apply(this,e),r)};return(0,n.default)((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return a(n,r);r(null,n)}))};var n=o(t("./internal/initialParams.js")),i=o(t("./internal/setImmediate.js")),s=t("./internal/wrapAsync.js");function o(t){return t&&t.__esModule?t:{default:t}}function a(t,e){return t.then((t=>{u(e,null,t)}),(t=>{u(e,t&&t.message?t:new Error(t))}))}function u(t,e,r){try{t(e,r)}catch(t){(0,i.default)((t=>{throw t}),t)}}e.exports=r.default},{"./internal/initialParams.js":13,"./internal/setImmediate.js":18,"./internal/wrapAsync.js":19}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(t("./internal/eachOfLimit.js")),i=o(t("./internal/wrapAsync.js")),s=o(t("./internal/awaitify.js"));function o(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e,r,s){return(0,n.default)(e)(t,(0,i.default)(r),s)}),4),e.exports=r.default},{"./internal/awaitify.js":9,"./internal/eachOfLimit.js":11,"./internal/wrapAsync.js":19}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(t("./eachOfLimit.js")),i=s(t("./internal/awaitify.js"));function s(t){return t&&t.__esModule?t:{default:t}}r.default=(0,i.default)((function(t,e,r){return(0,n.default)(t,1,e,r)}),3),e.exports=r.default},{"./eachOfLimit.js":6,"./internal/awaitify.js":9}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e,r,n){let i=!1,o=!1,a=!1,u=0,c=0;function l(){u>=e||a||i||(a=!0,t.next().then((({value:t,done:e})=>{if(!o&&!i){if(a=!1,e)return i=!0,void(u<=0&&n(null));u++,r(t,c,f),c++,l()}})).catch(h))}function f(t,e){if(u-=1,!o)return t?h(t):!1===t?(i=!0,void(o=!0)):e===s.default||i&&u<=0?(i=!0,n(null)):void l()}function h(t){o||(a=!1,i=!0,n(t))}l()};var n,i=t("./breakLoop.js"),s=(n=i)&&n.__esModule?n:{default:n};e.exports=r.default},{"./breakLoop.js":10}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise(((n,i)=>{r[e-1]=(t,...e)=>{if(t)return i(t);n(e.length>1?e:e[0])},t.apply(this,r)}))}},e.exports=r.default},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default={},e.exports=r.default},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=c(t("./once.js")),i=c(t("./iterator.js")),s=c(t("./onlyOnce.js")),o=t("./wrapAsync.js"),a=c(t("./asyncEachOfLimit.js")),u=c(t("./breakLoop.js"));function c(t){return t&&t.__esModule?t:{default:t}}r.default=t=>(e,r,c)=>{if(c=(0,n.default)(c),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return c(null);if((0,o.isAsyncGenerator)(e))return(0,a.default)(e,t,r,c);if((0,o.isAsyncIterable)(e))return(0,a.default)(e[Symbol.asyncIterator](),t,r,c);var l=(0,i.default)(e),f=!1,h=!1,p=0,d=!1;function g(t,e){if(!h)if(p-=1,t)f=!0,c(t);else if(!1===t)f=!0,h=!0;else{if(e===u.default||f&&p<=0)return f=!0,c(null);d||y()}}function y(){for(d=!0;p<t&&!f;){var e=l();if(null===e)return f=!0,void(p<=0&&c(null));p+=1,r(e.value,e.key,(0,s.default)(g))}d=!1}y()},e.exports=r.default},{"./asyncEachOfLimit.js":8,"./breakLoop.js":10,"./iterator.js":15,"./once.js":16,"./onlyOnce.js":17,"./wrapAsync.js":19}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()},e.exports=r.default},{}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){var r=e.pop();return t.call(this,e,r)}},e.exports=r.default},{}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0},e.exports=r.default},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,n.default)(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e=(0,i.default)(t);return e?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(e):(r=t,s=r?Object.keys(r):[],o=-1,a=s.length,function t(){var e=s[++o];return"__proto__"===e?t():o<a?{value:r[e],key:e}:null});var r,s,o,a};var n=s(t("./isArrayLike.js")),i=s(t("./getIterator.js"));function s(t){return t&&t.__esModule?t:{default:t}}e.exports=r.default},{"./getIterator.js":12,"./isArrayLike.js":14}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e},e.exports=r.default},{}],17:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}},e.exports=r.default},{}],18:[function(t,e,r){(function(t,e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fallback=a,r.wrap=u;var n,i=r.hasQueueMicrotask="function"==typeof queueMicrotask&&queueMicrotask,s=r.hasSetImmediate="function"==typeof e&&e,o=r.hasNextTick="object"==typeof t&&"function"==typeof t.nextTick;function a(t){setTimeout(t,0)}function u(t){return(e,...r)=>t((()=>e(...r)))}n=i?queueMicrotask:s?e:o?t.nextTick:a,r.default=u(n)}).call(this)}).call(this,t("_process"),t("timers").setImmediate)},{_process:37,timers:44}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isAsyncIterable=r.isAsyncGenerator=r.isAsync=void 0;var n,i=t("../asyncify.js"),s=(n=i)&&n.__esModule?n:{default:n};function o(t){return"AsyncFunction"===t[Symbol.toStringTag]}r.default=function(t){if("function"!=typeof t)throw new Error("expected a function");return o(t)?(0,s.default)(t):t},r.isAsync=o,r.isAsyncGenerator=function(t){return"AsyncGenerator"===t[Symbol.toStringTag]},r.isAsyncIterable=function(t){return"function"==typeof t[Symbol.asyncIterator]}},{"../asyncify.js":5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/once.js")),i=a(t("./internal/onlyOnce.js")),s=a(t("./internal/wrapAsync.js")),o=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,o.default)((function(t,e){if(e=(0,n.default)(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function o(e){(0,s.default)(t[r++])(...e,(0,i.default)(a))}function a(n,...i){if(!1!==n)return n||r===t.length?e(n,...i):void o(i)}o([])})),e.exports=r.default},{"./internal/awaitify.js":9,"./internal/once.js":16,"./internal/onlyOnce.js":17,"./internal/wrapAsync.js":19}],21:[function(t,e,r){"use strict";var n=12,i=0,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];var o={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function a(t,e){var r=o[t];return void 0===r?255:r<<e}e.exports=function(t){var e=t.indexOf("%");if(-1===e)return t;for(var r=t.length,o="",u=0,c=0,l=e,f=n;e>-1&&e<r;){var h=a(t[e+1],4)|a(t[e+2],0),p=s[h];if(f=s[256+f+p],c=c<<6|h&s[364+p],f!==n){if(f===i)return null;if((e+=3)<r&&37===t.charCodeAt(e))continue;return null}o+=t.slice(u,l),o+=c<=65535?String.fromCharCode(c):String.fromCharCode(55232+(c>>10),56320+(1023&c)),c=0,u=e+3,e=l=t.indexOf("%",u)}return o+t.slice(u)}},{}],22:[function(t,e,r){"use strict";e.exports=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(i=n;0!=i--;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(s=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;0!=i--;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!=e&&r!=r}},{}],23:[function(t,e,r){"use strict";const n=t("./parse"),i=t("./stringify"),s={parse:n,stringify:i};e.exports=s,e.exports.default=s,e.exports.parse=n,e.exports.stringify=i},{"./parse":25,"./stringify":26}],24:[function(t,e,r){const n=Array.from({length:256},((t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase())),i=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]);e.exports={encodeString:function(t){const e=t.length;if(0===e)return"";let r="",s=0,o=0;t:for(;o<e;o++){let a=t.charCodeAt(o);for(;a<128;){if(1!==i[a]&&(s<o&&(r+=t.slice(s,o)),s=o+1,r+=n[a]),++o===e)break t;a=t.charCodeAt(o)}if(s<o&&(r+=t.slice(s,o)),a<2048){s=o+1,r+=n[192|a>>6]+n[128|63&a];continue}if(a<55296||a>=57344){s=o+1,r+=n[224|a>>12]+n[128|a>>6&63]+n[128|63&a];continue}if(++o,o>=e)throw new Error("URI malformed");s=o+1,a=65536+((1023&a)<<10|1023&t.charCodeAt(o)),r+=n[240|a>>18]+n[128|a>>12&63]+n[128|a>>6&63]+n[128|63&a]}return 0===s?t:s<e?r+t.slice(s):r}}},{}],25:[function(t,e,r){"use strict";const n=t("fast-decode-uri-component"),i=/\+/g,s=function(){};s.prototype=Object.create(null),e.exports=function(t){const e=new s;if("string"!=typeof t)return e;let r=t.length,o="",a="",u=-1,c=-1,l=!1,f=!1,h=!1,p=!1,d=!1,g=0;for(let s=0;s<r+1;s++)if(g=s!==r?t.charCodeAt(s):38,38===g){if(d=c>u,d||(c=s),o=t.slice(u+1,c),d||o.length>0){h&&(o=o.replace(i," ")),l&&(o=n(o)||o),d&&(a=t.slice(c+1,s),p&&(a=a.replace(i," ")),f&&(a=n(a)||a));const r=e[o];void 0===r?e[o]=a:r.pop?r.push(a):e[o]=[r,a]}a="",u=s,c=s,l=!1,f=!1,h=!1,p=!1}else 61===g?c<=u?c=s:f=!0:43===g?c>u?p=!0:h=!0:37===g&&(c>u?f=!0:l=!0);return e}},{"fast-decode-uri-component":21}],26:[function(t,e,r){"use strict";const{encodeString:n}=t("./internals/querystring");function i(t){const e=typeof t;return"string"===e?n(t):"bigint"===e?t.toString():"boolean"===e?t?"true":"false":"number"===e&&Number.isFinite(t)?t<1e21?""+t:n(""+t):""}e.exports=function(t){let e="";if(null===t||"object"!=typeof t)return e;const r=Object.keys(t),s=r.length;let o=0;for(let a=0;a<s;a++){const s=r[a],u=t[s],c=n(s)+"=";if(a&&(e+="&"),Array.isArray(u)){o=u.length;for(let t=0;t<o;t++)t&&(e+="&"),e+=c,e+=i(u[t])}else e+=c,e+=i(u)}return e}},{"./internals/querystring":24}],27:[function(t,e,r){"use strict";const n=t("./handler_storage"),i={STATIC:0,PARAMETRIC:1,WILDCARD:2};class s{constructor(){this.handlerStorage=new n}}class o extends s{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(t,e){const r=this.staticChildren[t.charAt(e)];return void 0!==r&&r.matchPrefix(t,e)?r:null}createStaticChild(t){if(0===t.length)return this;let e=this.staticChildren[t.charAt(0)];if(e){let r=1;for(;r<e.prefix.length;r++)if(t.charCodeAt(r)!==e.prefix.charCodeAt(r)){e=e.split(this,r);break}return e.createStaticChild(t.slice(r))}const r=t.charAt(0);return this.staticChildren[r]=new a(t),this.staticChildren[r]}}class a extends o{constructor(t){super(),this.prefix=t,this.wildcardChild=null,this.parametricChildren=[],this.kind=i.STATIC,this._compilePrefixMatch()}createParametricChild(t,e){const r=t&&t.source;let n=this.parametricChildren.find((t=>(t.regex&&t.regex.source)===r));return n||(n=new u(t,e),this.parametricChildren.push(n),this.parametricChildren.sort(((t,e)=>t.isRegex?e.isRegex?null===t.staticSuffix?1:null===e.staticSuffix?-1:e.staticSuffix.endsWith(t.staticSuffix)?1:t.staticSuffix.endsWith(e.staticSuffix)?-1:0:-1:1)),n)}createWildcardChild(){return this.wildcardChild||(this.wildcardChild=new c),this.wildcardChild}split(t,e){const r=this.prefix.slice(0,e),n=this.prefix.slice(e);this.prefix=n,this._compilePrefixMatch();const i=new a(r);return i.staticChildren[n.charAt(0)]=this,t.staticChildren[r.charAt(0)]=i,i}getNextNode(t,e,r,n){let i=this.findStaticMatchingChild(t,e),s=0;if(null===i){if(0===this.parametricChildren.length)return this.wildcardChild;i=this.parametricChildren[0],s=1}null!==this.wildcardChild&&r.push({paramsCount:n,brotherPathIndex:e,brotherNode:this.wildcardChild});for(let t=this.parametricChildren.length-1;t>=s;t--)r.push({paramsCount:n,brotherPathIndex:e,brotherNode:this.parametricChildren[t]});return i}_compilePrefixMatch(){if(1===this.prefix.length)return void(this.matchPrefix=()=>!0);const t=[];for(let e=1;e<this.prefix.length;e++){const r=this.prefix.charCodeAt(e);t.push(`path.charCodeAt(i + ${e}) === ${r}`)}this.matchPrefix=new Function("path","i",`return ${t.join(" && ")}`)}}class u extends o{constructor(t,e){super(),this.isRegex=!!t,this.regex=t||null,this.staticSuffix=e||null,this.kind=i.PARAMETRIC}getNextNode(t,e){return this.findStaticMatchingChild(t,e)}}class c extends s{constructor(){super(),this.kind=i.WILDCARD}getNextNode(){return null}}e.exports={StaticNode:a,ParametricNode:u,WildcardNode:c,NODE_TYPES:i}},{"./handler_storage":28}],28:[function(t,e,r){"use strict";e.exports=class{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(t){return void 0===t?this.unconstrainedHandler:this._getHandlerMatchingConstraints(t)}addHandler(t,e,r,n,i){const s={handler:t,params:e,constraints:i,store:r||null,_createParamsObject:this._compileCreateParamsObject(e)};0===Object.keys(i).length&&(this.unconstrainedHandler=s);for(const t of Object.keys(i))this.constraints.includes(t)||("version"===t?this.constraints.unshift(t):this.constraints.push(t));if(this.handlers.length>=32)throw new Error("find-my-way supports a maximum of 32 route handlers per node when there are constraints, limit reached");this.handlers.push(s),this.handlers.sort(((t,e)=>Object.keys(t.constraints).length-Object.keys(e.constraints).length)),this._compileGetHandlerMatchingConstraints(n,i)}_compileCreateParamsObject(t){const e=[];for(let r=0;r<t.length;r++)e.push(`'${t[r]}': paramsArray[${r}]`);return new Function("paramsArray",`return {${e.join(",")}}`)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(t,e){for(let r=0;r<this.handlers.length;r++){const n=this.handlers[r].constraints[e];if(void 0!==n){let e=t.get(n)||0;e|=1<<r,t.set(n,e)}}}_constrainedIndexBitmask(t){let e=0;for(let r=0;r<this.handlers.length;r++){void 0!==this.handlers[r].constraints[t]&&(e|=1<<r)}return~e}_compileGetHandlerMatchingConstraints(t){this.constrainedHandlerStores={};for(const e of this.constraints){const r=t.newStoreForConstraint(e);this.constrainedHandlerStores[e]=r,this._buildConstraintStore(r,e)}const e=[];e.push(`\n let candidates = ${(1<<this.handlers.length)-1}\n let mask, matches\n `);for(const r of this.constraints){e.push(`\n mask = ${this._constrainedIndexBitmask(r)}\n value = derivedConstraints.${r}\n `);const n=t.strategies[r].mustMatchWhenDerived?"matches":"(matches | mask)";e.push(`\n if (value === undefined) {\n candidates &= mask\n } else {\n matches = this.constrainedHandlerStores.${r}.get(value) || 0\n candidates &= ${n}\n }\n if (candidates === 0) return null;\n `)}for(const r in t.strategies){t.strategies[r].mustMatchWhenDerived&&!this.constraints.includes(r)&&e.push(`if (derivedConstraints.${r} !== undefined) return null`)}e.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",e.join("\n"))}}},{}],29:[function(t,e,r){"use strict";const n=t("assert"),i=t("fast-querystring"),s=t("safe-regex2"),o=t("fast-deep-equal"),{flattenNode:a,compressFlattenedNode:u,prettyPrintFlattenedNode:c,prettyPrintRoutesArray:l}=t("./lib/pretty-print"),{StaticNode:f,NODE_TYPES:h}=t("./custom_node"),p=t("./lib/constrainer"),d=t("./lib/http-methods"),{safeDecodeURI:g,safeDecodeURIComponent:y}=t("./lib/url-sanitizer"),v=/^https?:\/\/.*?\//,m=/(\/:[^/()]*?)\?(\/?)/;if(!s(v))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!s(m))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function b(t){if(!(this instanceof b))return new b(t);(t=t||{}).defaultRoute?(n("function"==typeof t.defaultRoute,"The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(n("function"==typeof t.onBadUrl,"The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(n("function"==typeof t.buildPrettyMeta,"buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=P,t.querystringParser?(n("function"==typeof t.querystringParser,"querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=t=>""===t?{}:i.parse(t),this.caseSensitive=void 0===t.caseSensitive||t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.routes=[],this.trees={},this.constrainer=new p(t.constraints),this._routesPatterns={}}for(var S in b.prototype.on=function(t,e,r,i,s){"function"==typeof r&&(void 0!==i&&(s=i),i=r,r={}),n("string"==typeof e,"Path should be a string"),n(e.length>0,"The path could not be empty"),n("/"===e[0]||"*"===e[0],"The first character of a path should be `/` or `*`"),n("function"==typeof i,"Handler should be a function");const o=e.match(m);if(o){n(e.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");const a=e.replace(m,"$1$2"),u=e.replace(m,"$2");return this.on(t,a,r,i,s),void this.on(t,u,r,i,s)}const a=e;this.ignoreDuplicateSlashes&&(e=w(e)),this.ignoreTrailingSlash&&(e=C(e));const u=Array.isArray(t)?t:[t];for(const t of u)this._on(t,e,r,i,s,a),this.routes.push({method:t,path:e,opts:r,handler:i,store:s})},b.prototype._on=function(t,e,r,i,a){n("string"==typeof t,"Method should be a string"),n(d.includes(t),`Method '${t}' is not an http method.`);let u={};if(void 0!==r.constraints&&(n("object"==typeof r.constraints&&null!==r.constraints,"Constraints should be an object"),0!==Object.keys(r.constraints).length&&(u=r.constraints)),this.constrainer.validateConstraints(u),this.constrainer.noteUsage(u),void 0===this.trees[t]&&(this.trees[t]=new f("/"),this._routesPatterns[t]=[]),"*"===e&&0!==this.trees[t].prefix.length){const e=this.trees[t];this.trees[t]=new f(""),this.trees[t].staticChildren["/"]=e}let c=this.trees[t],l=c.prefix.length;const h=[];for(let t=0;t<=e.length;t++){if(58===e.charCodeAt(t)&&58===e.charCodeAt(t+1)){t++;continue}const r=58===e.charCodeAt(t)&&58!==e.charCodeAt(t+1),i=42===e.charCodeAt(t);if(r||i||t===e.length&&t!==l){let r=e.slice(l,t);this.caseSensitive||(r=r.toLowerCase()),r=r.split("::").join(":"),r=r.split("%").join("%25"),c=c.createStaticChild(r)}if(r){let r=!1;const i=[];let o=t+1;for(let a=o;;a++){const u=e.charCodeAt(a),f=40===u,p=45===u||46===u,d=47===u||a===e.length;if(f||p||d){const u=e.slice(o,a);if(h.push(u),r=r||f||p,f){const t=O(e,a),r=e.slice(a,t+1);this.allowUnsafeRegex||n(s(new RegExp(r)),`The regex '${r}' is not safe!`),i.push(x(r)),a=t+1}else i.push("(.*?)");const g=a;for(;a<e.length;a++){const t=e.charCodeAt(a);if(47===t)break;if(58===t){if(58!==e.charCodeAt(a+1))break;a++}}let y=e.slice(g,a);if(y&&(y=y.split("::").join(":"),y=y.split("%").join("%25"),i.push(y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),o=a+1,d||47===e.charCodeAt(a)||a===e.length){const n=r?"()"+y:y;e=e.slice(0,t+1)+n+e.slice(a),t+=n.length;const s=r?new RegExp("^"+i.join("")+"$"):null;c=c.createParametricChild(s,y||null),l=t+1;break}}}}else if(i&&(h.push("*"),c=c.createWildcardChild(),l=t+1,t!==e.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(e=e.toLowerCase()),"*"===e&&(e="/*");for(const r of this._routesPatterns[t])if(r.path===e&&o(r.constraints,u))throw new Error(`Method '${t}' already declared for route '${e}' with constraints '${JSON.stringify(u)}'`);this._routesPatterns[t].push({path:e,params:h,constraints:u}),c.handlerStorage.addHandler(i,h,a,this.constrainer,u)},b.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)},b.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)},b.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns={}},b.prototype.off=function(t,e,r){n("string"==typeof e,"Path should be a string"),n(e.length>0,"The path could not be empty"),n("/"===e[0]||"*"===e[0],"The first character of a path should be `/` or `*`"),n(void 0===r||"object"==typeof r&&!Array.isArray(r)&&null!==r,"Constraints should be an object or undefined.");const i=e.match(m);if(i){n(e.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");const s=e.replace(m,"$1$2"),o=e.replace(m,"$2");return this.off(t,s,r),void this.off(t,o,r)}this.ignoreDuplicateSlashes&&(e=w(e)),this.ignoreTrailingSlash&&(e=C(e));const s=Array.isArray(t)?t:[t];for(const t of s)this._off(t,e,r)},b.prototype._off=function(t,e,r){function i(r){return t!==r.method||e!==r.path}n("string"==typeof t,"Method should be a string"),n(d.includes(t),`Method '${t}' is not an http method.`);const s=r?function(t){return i(t)||!o(r,t.opts.constraints||{})}:i,a=this.routes.filter(s);this._rebuild(a)},b.prototype.lookup=function(t,e,r,n){if("function"==typeof r&&(n=r,r=void 0),void 0===n){const n=this.constrainer.deriveConstraints(t,r),i=this.find(t.method,t.url,n);return this.callHandler(i,t,e,r)}this.constrainer.deriveConstraints(t,r,((i,s)=>{if(null===i)try{const i=this.find(t.method,t.url,s),o=this.callHandler(i,t,e,r);n(null,o)}catch(i){n(i)}else n(i)}))},b.prototype.callHandler=function(t,e,r,n){return null===t?this._defaultRoute(e,r,n):void 0===n?t.handler(e,r,t.params,t.store,t.searchParams):t.handler.call(n,e,r,t.params,t.store,t.searchParams)},b.prototype.find=function(t,e,r){let n,i,s,o=this.trees[t];if(void 0===o)return null;47!==e.charCodeAt(0)&&(e=e.replace(v,"/")),this.ignoreDuplicateSlashes&&(e=w(e));try{n=g(e),e=n.path,i=n.querystring,s=n.shouldDecodeParam}catch(t){return this._onBadUrl(e)}this.ignoreTrailingSlash&&(e=C(e));const a=e;!1===this.caseSensitive&&(e=e.toLowerCase());const u=this.maxParamLength;let c=o.prefix.length;const l=[],f=e.length,p=[];for(;;){if(c===f){const t=o.handlerStorage.getMatchingHandler(r);if(null!==t)return{handler:t.handler,store:t.store,params:t._createParamsObject(l),searchParams:this.querystringParser(i)}}let t=o.getNextNode(e,c,p,l.length);if(null===t){if(0===p.length)return null;const e=p.pop();c=e.brotherPathIndex,l.splice(e.paramsCount),t=e.brotherNode}if(o=t,o.kind!==h.STATIC)if(o.kind!==h.WILDCARD){if(o.kind===h.PARAMETRIC){let t=a.indexOf("/",c);-1===t&&(t=f);let e=a.slice(c,t);if(s&&(e=y(e)),o.isRegex){const t=o.regex.exec(e);if(null===t)continue;for(let e=1;e<t.length;e++){const r=t[e];if(r.length>u)return null;l.push(r)}}else{if(e.length>u)return null;l.push(e)}c=t}}else{let t=a.slice(c);s&&(t=y(t)),l.push(t),c=f}else c+=o.prefix.length}},b.prototype._rebuild=function(t){this.reset();for(const e of t){const{method:t,path:r,opts:n,handler:i,store:s}=e;this._on(t,r,n,i,s),this.routes.push({method:t,path:r,opts:n,handler:i,store:s})}},b.prototype._defaultRoute=function(t,e,r){if(null!==this.defaultRoute)return void 0===r?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()},b.prototype._onBadUrl=function(t){if(null===this.onBadUrl)return null;const e=this.onBadUrl;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}},b.prototype.prettyPrint=function(t={}){if(t.commonPrefix=void 0===t.commonPrefix||t.commonPrefix,!t.commonPrefix)return l.call(this,this.routes,t);const e={prefix:"/",nodes:[],children:{}};for(const t in this.trees){const r=this.trees[t];r&&a(e,r,t)}return u(e),c.call(this,e,"",!0,t)},d){if(!d.hasOwnProperty(S))continue;const t=d[S],e=t.toLowerCase();if(b.prototype[e])throw new Error("Method already exists: "+e);b.prototype[e]=function(e,r,n){return this.on(t,e,r,n)}}function w(t){return t.replace(/\/\/+/g,"/")}function C(t){return t.length>1&&47===t.charCodeAt(t.length-1)?t.slice(0,-1):t}function x(t){return 94===t.charCodeAt(1)&&(t=t.slice(0,1)+t.slice(2)),36===t.charCodeAt(t.length-2)&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function O(t,e){for(var r=1;e<t.length;)if("\\"!==t[++e]){if(")"===t[e]?r--:"("===t[e]&&r++,!r)return e}else e++;throw new TypeError('Invalid regexp expression in "'+t+'"')}function P(t){return t&&t.store?Object.assign({},t.store):{}}b.prototype.all=function(t,e,r){this.on(d,t,e,r)},e.exports=b},{"./custom_node":27,"./lib/constrainer":30,"./lib/http-methods":31,"./lib/pretty-print":32,"./lib/url-sanitizer":35,assert:1,"fast-deep-equal":22,"fast-querystring":23,"safe-regex2":38}],30:[function(t,e,r){"use strict";const n=t("./strategies/accept-version"),i=t("./strategies/accept-host"),s=t("assert");e.exports=class{constructor(t){if(this.strategies={version:n,host:i},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,t)for(const e of Object.values(t))this.addConstraintStrategy(e)}isStrategyUsed(t){return this.strategiesInUse.has(t)||this.asyncStrategiesInUse.has(t)}hasConstraintStrategy(t){const e=this.strategies[t];return void 0!==e&&(e.isCustom||this.isStrategyUsed(t))}addConstraintStrategy(t){if(s("string"==typeof t.name&&""!==t.name,"strategy.name is required."),s(t.storage&&"function"==typeof t.storage,"strategy.storage function is required."),s(t.deriveConstraint&&"function"==typeof t.deriveConstraint,"strategy.deriveConstraint function is required."),this.strategies[t.name]&&this.strategies[t.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${t.name}.`);if(this.isStrategyUsed(t.name))throw new Error(`There already exists a route with ${t.name} constraint.`);t.isCustom=!0,t.isAsync=3===t.deriveConstraint.length,this.strategies[t.name]=t,t.mustMatchWhenDerived&&this.noteUsage({[t.name]:t})}deriveConstraints(t,e,r){const n=this.deriveSyncConstraints(t,e);if(void 0===r)return n;this.deriveAsyncConstraints(n,t,e,r)}deriveSyncConstraints(t,e){}noteUsage(t){if(t){const e=this.strategiesInUse.size;for(const e in t){this.strategies[e].isAsync?this.asyncStrategiesInUse.add(e):this.strategiesInUse.add(e)}e!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(t){if(!this.strategies[t])throw new Error(`No strategy registered for constraint key ${t}`);return this.strategies[t].storage()}validateConstraints(t){for(const e in t){const r=t[e];if(void 0===r)throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");const n=this.strategies[e];if(!n)throw new Error(`No strategy registered for constraint key ${e}`);n.validate&&n.validate(r)}}deriveAsyncConstraints(t,e,r,n){let i=this.asyncStrategiesInUse.size;if(0!==i){t=t||{};for(const s of this.asyncStrategiesInUse){this.strategies[s].deriveConstraint(e,r,((e,r)=>{null===e?(t[s]=r,0==--i&&n(null,t)):n(e)}))}}else n(null,t)}_buildDeriveConstraints(){if(0===this.strategiesInUse.size)return;const t=["return {"];for(const e of this.strategiesInUse){const r=this.strategies[e];if(r.isCustom)t.push(` ${r.name}: this.strategies.${e}.deriveConstraint(req, ctx),`);else if("version"===e)t.push(" version: req.headers['accept-version'],");else{if("host"!==e)throw new Error("unknown non-custom strategy for compiling constraint derivation function");t.push(" host: req.headers.host || req.headers[':authority'],")}}t.push("}"),this.deriveSyncConstraints=new Function("req","ctx",t.join("\n")).bind(this)}}},{"./strategies/accept-host":33,"./strategies/accept-version":34,assert:1}],31:[function(t,e,r){"use strict";e.exports=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"]},{}],32:[function(t,e,r){"use strict";const n=" ",i="│ ",s="├── ",o="└── ",a="*",u="/",c=/(?=\/)/;function l(t){return Array.isArray(t)?t.map((t=>l(t))):"symbol"==typeof t?t.toString():"function"==typeof t?function(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}(t):t}function f(t,e){const r={},n=this.buildPrettyMeta(t);return Array.isArray(e)||(e=n?Reflect.ownKeys(n):[]),e.forEach((t=>{const e="symbol"==typeof t?t.toString():t;n&&n[t]&&(r[e]=l(n[t]))})),r}function h(t,e,r,a,u){let c="";if(a||u||(c+="\n"),a||(c+=`${e||""}${r?o:s}`),c+=`${t.path}`,t.handlers){const s=t.handlers.reduce(((t,e)=>{const r=t.findIndex((t=>JSON.stringify(t.opts)===JSON.stringify(e.opts)));return-1!==r?t[r].method=[t[r].method,e.method].join(", "):t.push(e),t}),[]);s.forEach(((o,u)=>{u>0&&(c+=`${a?"":e||""}${r?n:i}${t.path}`),c+=` (${o.method||"-"})`,o.opts&&"{}"!==JSON.stringify(o.opts)&&(c+=` ${JSON.stringify(o.opts)}`),o.meta&&Reflect.ownKeys(o.meta).forEach(((t,s)=>{c+=`\n${a?"":e||""}${r?n:i}`,c+=`• (${t}) ${JSON.stringify(o.meta[t])}`})),s.length>1&&u!==s.length-1&&(c+="\n")}))}else t.children.length>1&&(c+=" (-)");return a||(e=`${e||""}${r?n:i}`),t.children.forEach(((r,n)=>{const i=n===t.children.length-1,s=!t.handlers&&1===t.children.length;c+=h(r,e,i,s)})),c}e.exports={flattenNode:function t(e,r,n){if(0!==r.handlerStorage.handlers.length&&e.nodes.push({method:n,node:r}),r.parametricChildren&&r.parametricChildren[0]&&(e.children[":"]||(e.children[":"]={prefix:":",nodes:[],children:{}}),t(e.children[":"],r.parametricChildren[0],n)),r.wildcardChild&&(e.children["*"]||(e.children["*"]={prefix:"*",nodes:[],children:{}}),t(e.children["*"],r.wildcardChild,n)),r.staticChildren)for(const i of Object.values(r.staticChildren)){const r=i.prefix.split(c);let s,o=e;for(const t of r)s=o,o=o.children[t],o||(o={prefix:t,nodes:[],children:{}},s.children[t]=o);t(o,i,n)}},compressFlattenedNode:function t(e){const r=Object.keys(e.children);if(0===e.nodes.length&&1===r.length){const n=e.children[r[0]];if(n.nodes.length<=1)return t(n),e.nodes=n.nodes,e.prefix+=n.prefix,e.children=n.children,e}for(const r of Object.keys(e.children))t(e.children[r]);return e},prettyPrintFlattenedNode:function t(e,r,a,u){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");u.includeMeta=u.includeMeta||null;let c="";const l=[];for(const{node:t,method:r}of e.nodes)for(const e of t.handlerStorage.handlers)l.push({method:r,...e});l.length?l.forEach(((t,s)=>{let o=`(${t.method||"-"})`;Object.keys(t.constraints).length>0&&(o+=" "+JSON.stringify(t.constraints));let l="";const h=e.prefix.split("").map(((t,e)=>":"===t?e:null)).filter((t=>null!==t));if(h.length){let r=0;h.forEach(((n,i)=>{l+=e.prefix.slice(r,n+1),l+=t.params[t.params.length-h.length+i],i===h.length-1&&(l+=e.prefix.slice(n+1)),r=n+1}))}else l=e.prefix;if(c+=0===s?`${l} ${o}`:`\n${r}${a?n:i}${l} ${o}`,u.includeMeta){const e=f.call(this,t,u.includeMeta);Object.keys(e).forEach(((t,s)=>{c+=`\n${r||""}${a?n:i}`,c+=`• (${t}) ${JSON.stringify(e[t])}`}))}})):c=e.prefix;let h=`${r}${a?o:s}${c}\n`;r=`${r}${a?n:i}`;const p=Object.keys(e.children);for(let n=0;n<p.length;n++){const i=e.children[p[n]];h+=t.call(this,i,r,n===p.length-1,u)}return h},prettyPrintRoutesArray:function(t,e={}){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");e.includeMeta=e.includeMeta||null;const r=[];let n="";t.sort(((t,e)=>t.path&&e.path?t.path.localeCompare(e.path):0));for(let n=0;n<t.length;n++){const i=t[n],s=r.find((t=>i.path===t.path));if(s){s.handlers.push({method:i.method,opts:i.opts.constraints||void 0,meta:e.includeMeta?f.call(this,i,e.includeMeta):null});continue}const o={method:i.method,opts:i.opts.constraints||void 0,meta:e.includeMeta?f.call(this,i,e.includeMeta):null};r.push({path:i.path,methods:[i.method],opts:[i.opts],handlers:[o]})}if(!r.filter((t=>t.path===u)).length){const t={path:u,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter((t=>t.path===a)).length?r.splice(1,0,t):r.unshift(t)}const i=function(t){const e=[],r={result:e};return t.forEach(((t,e)=>{let n=t.path.split(c);n[0]!==u&&n[0]!==a&&(n=[u,n[0].slice(1),...n.slice(1)]),n.reduce(((e,r,i)=>{if(!e[r]){e[r]={result:[]};const s={path:r,children:e[r].result};i===n.length-1&&(s.handlers=t.handlers),e.result.push(s)}return e[r]}),r)})),e}(r);return i.forEach(((t,e)=>{n+=h(t,null,e===i.length-1,!1,!0),n+="\n"})),n}}},{}],33:[function(t,e,r){"use strict";const n=t("assert");e.exports={name:"host",mustMatchWhenDerived:!1,storage:function(){const t={},e=[];return{get:r=>{const n=t[r];if(n)return n;for(const t of e)if(t.host.test(r))return t.value},set:(r,n)=>{r instanceof RegExp?e.push({host:r,value:n}):t[r]=n}}},validate(t){n("string"==typeof t||"[object RegExp]"===Object.prototype.toString.call(t),"Host should be a string or a RegExp")}}},{assert:1}],34:[function(t,e,r){"use strict";const n=t("assert");function i(){if(!(this instanceof i))return new i;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}i.prototype.set=function(t,e){if("string"!=typeof t)throw new TypeError("Version should be a string");let[r,n,i]=t.split(".");return r=Number(r)||0,n=Number(n)||0,i=Number(i)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.x=e,this.store["*"]=e,this.store["x.x"]=e,this.store["x.x.x"]=e),n>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=n,this.store[`${r}.x`]=e,this.store[`${r}.x.x`]=e),i>=(this.store[`${r}.${n}`]||0)&&(this.maxPatches[`${r}.${n}`]=i,this.store[`${r}.${n}.x`]=e),this.store[`${r}.${n}.${i}`]=e,this},i.prototype.get=function(t){return this.store[t]},e.exports={name:"version",mustMatchWhenDerived:!0,storage:i,validate(t){n("string"==typeof t,"Version should be a string")}}},{assert:1}],35:[function(t,e,r){"use strict";function n(t,e){return 50===t?53===e?"%":51===e?"#":52===e?"$":54===e?"&":66===e||98===e?"+":67===e||99===e?",":70===e||102===e?"/":null:51===t?65===e||97===e?":":66===e||98===e?";":68===e||100===e?"=":70===e||102===e?"?":null:52===t&&48===e?"@":null}e.exports={safeDecodeURI:function(t){let e=!1,r=!1,i="";for(let s=1;s<t.length;s++){const o=t.charCodeAt(s);if(37===o){const i=t.charCodeAt(s+1),o=t.charCodeAt(s+2);null===n(i,o)?e=!0:(r=!0,50===i&&53===o&&(e=!0,t=t.slice(0,s+1)+"25"+t.slice(s+1),s+=2),s+=2)}else if(63===o||59===o||35===o){i=t.slice(s+1),t=t.slice(0,s);break}}return{path:e?decodeURI(t):t,querystring:i,shouldDecodeParam:r}},safeDecodeURIComponent:function(t){const e=t.indexOf("%");if(-1===e)return t;let r="",i=e;for(let s=e;s<t.length;s++)if(37===t.charCodeAt(s)){const e=n(t.charCodeAt(s+1),t.charCodeAt(s+2));r+=t.slice(i,s)+e,i=s+3}return t.slice(0,e)+r+t.slice(i)}}},{}],36:[function(t,e,r){
|
|
7
|
+
*/function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function s(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t("util/"),a=Object.prototype.hasOwnProperty,u=Array.prototype.slice,c="foo"===function(){}.name;function l(t){return Object.prototype.toString.call(t)}function f(t){return!s(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=e.exports=m,p=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(o.isFunction(t)){if(c)return t.name;var e=t.toString().match(p);return e&&e[1]}}function g(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function y(t){if(c||!o.isFunction(t))return o.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function v(t,e,r,n,i){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function m(t,e){t||v(t,!0,e,"==",h.ok)}function b(t,e,r,n){if(t===e)return!0;if(s(t)&&s(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(f(t)&&f(e)&&l(t)===l(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var a=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==a&&a===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=S(t),s=S(e);if(i&&!s||!i&&s)return!1;if(i)return b(t=u.call(t),e=u.call(e),r);var a,c,l=x(t),f=x(e);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),c=l.length-1;c>=0;c--)if(l[c]!==f[c])return!1;for(c=l.length-1;c>=0;c--)if(!b(t[a=l[c]],e[a],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function S(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function C(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!t&&i&&!r;if((!t&&o.isError(i)&&s&&w(i,r)||a)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!w(i,r)||!t&&i)throw i}h.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(y(t.actual),128)+" "+t.operator+" "+g(y(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=m,h.equal=function(t,e,r){t!=e&&v(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){b(t,e,!1)||v(t,e,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,r){b(t,e,!0)||v(t,e,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){b(t,e,!1)&&v(t,e,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){b(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",h.notStrictEqual)},h.throws=function(t,e,r){C(!0,t,e,r)},h.doesNotThrow=function(t,e,r){C(!1,t,e,r)},h.ifError=function(t){if(t)throw t},h.strict=n((function t(e,r){e||v(e,!0,r,"==",t)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var x=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":36,"util/":4}],2:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],3:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],4:[function(t,e,r){(function(e,n){(function(){var i=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(a(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,s=n.length,o=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<s;u=n[++r])g(u)||!S(u)?o+=" "+u:o+=" "+a(u);return o},r.deprecate=function(t,i){if(m(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(!0===e.noDeprecation)return t;var s=!1;return function(){if(!s){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),s=!0}return t.apply(this,arguments)}};var s,o={};function a(t,e){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),l(n,t,n.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function c(t,e){return t}function l(t,e,n){if(t.customInspect&&e&&x(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=l(t,i,n)),i}var s=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(y(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(s)return s;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),C(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(x(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(b(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(w(e))return t.stylize(Date.prototype.toString.call(e),"date");if(C(e))return f(e)}var c,S="",P=!1,O=["{","}"];(p(e)&&(P=!0,O=["[","]"]),x(e))&&(S=" [Function"+(e.name?": "+e.name:"")+"]");return b(e)&&(S=" "+RegExp.prototype.toString.call(e)),w(e)&&(S=" "+Date.prototype.toUTCString.call(e)),C(e)&&(S=" "+f(e)),0!==o.length||P&&0!=e.length?n<0?b(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=P?function(t,e,r,n,i){for(var s=[],o=0,a=e.length;o<a;++o)j(e,String(o))?s.push(h(t,e,r,n,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(h(t,e,r,n,i,!0))})),s}(t,e,n,a,o):o.map((function(r){return h(t,e,n,a,r,P)})),t.seen.pop(),function(t,e,r){var n=t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(n>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,S,O)):O[0]+S+O[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),j(n,i)||(o="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=g(r)?l(t,u.value,null):l(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),m(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return"number"==typeof t}function v(t){return"string"==typeof t}function m(t){return void 0===t}function b(t){return S(t)&&"[object RegExp]"===P(t)}function S(t){return"object"==typeof t&&null!==t}function w(t){return S(t)&&"[object Date]"===P(t)}function C(t){return S(t)&&("[object Error]"===P(t)||t instanceof Error)}function x(t){return"function"==typeof t}function P(t){return Object.prototype.toString.call(t)}function O(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(m(s)&&(s=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(s)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=y,r.isString=v,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=m,r.isRegExp=b,r.isObject=S,r.isDate=w,r.isError=C,r.isFunction=x,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":"),[t.getDate(),E[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!S(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":3,_process:37,inherits:2}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,s.isAsync)(t))return function(...e){const r=e.pop();return a(t.apply(this,e),r)};return(0,n.default)((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return a(n,r);r(null,n)}))};var n=o(t("./internal/initialParams.js")),i=o(t("./internal/setImmediate.js")),s=t("./internal/wrapAsync.js");function o(t){return t&&t.__esModule?t:{default:t}}function a(t,e){return t.then((t=>{u(e,null,t)}),(t=>{u(e,t&&t.message?t:new Error(t))}))}function u(t,e,r){try{t(e,r)}catch(t){(0,i.default)((t=>{throw t}),t)}}e.exports=r.default},{"./internal/initialParams.js":13,"./internal/setImmediate.js":18,"./internal/wrapAsync.js":19}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(t("./internal/eachOfLimit.js")),i=o(t("./internal/wrapAsync.js")),s=o(t("./internal/awaitify.js"));function o(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e,r,s){return(0,n.default)(e)(t,(0,i.default)(r),s)}),4),e.exports=r.default},{"./internal/awaitify.js":9,"./internal/eachOfLimit.js":11,"./internal/wrapAsync.js":19}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(t("./eachOfLimit.js")),i=s(t("./internal/awaitify.js"));function s(t){return t&&t.__esModule?t:{default:t}}r.default=(0,i.default)((function(t,e,r){return(0,n.default)(t,1,e,r)}),3),e.exports=r.default},{"./eachOfLimit.js":6,"./internal/awaitify.js":9}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e,r,n){let i=!1,o=!1,a=!1,u=0,c=0;function l(){u>=e||a||i||(a=!0,t.next().then((({value:t,done:e})=>{if(!o&&!i){if(a=!1,e)return i=!0,void(u<=0&&n(null));u++,r(t,c,f),c++,l()}})).catch(h))}function f(t,e){if(u-=1,!o)return t?h(t):!1===t?(i=!0,void(o=!0)):e===s.default||i&&u<=0?(i=!0,n(null)):void l()}function h(t){o||(a=!1,i=!0,n(t))}l()};var n,i=t("./breakLoop.js"),s=(n=i)&&n.__esModule?n:{default:n};e.exports=r.default},{"./breakLoop.js":10}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise(((n,i)=>{r[e-1]=(t,...e)=>{if(t)return i(t);n(e.length>1?e:e[0])},t.apply(this,r)}))}},e.exports=r.default},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default={},e.exports=r.default},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=c(t("./once.js")),i=c(t("./iterator.js")),s=c(t("./onlyOnce.js")),o=t("./wrapAsync.js"),a=c(t("./asyncEachOfLimit.js")),u=c(t("./breakLoop.js"));function c(t){return t&&t.__esModule?t:{default:t}}r.default=t=>(e,r,c)=>{if(c=(0,n.default)(c),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return c(null);if((0,o.isAsyncGenerator)(e))return(0,a.default)(e,t,r,c);if((0,o.isAsyncIterable)(e))return(0,a.default)(e[Symbol.asyncIterator](),t,r,c);var l=(0,i.default)(e),f=!1,h=!1,p=0,d=!1;function g(t,e){if(!h)if(p-=1,t)f=!0,c(t);else if(!1===t)f=!0,h=!0;else{if(e===u.default||f&&p<=0)return f=!0,c(null);d||y()}}function y(){for(d=!0;p<t&&!f;){var e=l();if(null===e)return f=!0,void(p<=0&&c(null));p+=1,r(e.value,e.key,(0,s.default)(g))}d=!1}y()},e.exports=r.default},{"./asyncEachOfLimit.js":8,"./breakLoop.js":10,"./iterator.js":15,"./once.js":16,"./onlyOnce.js":17,"./wrapAsync.js":19}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()},e.exports=r.default},{}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){var r=e.pop();return t.call(this,e,r)}},e.exports=r.default},{}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0},e.exports=r.default},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,n.default)(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e=(0,i.default)(t);return e?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(e):(r=t,s=r?Object.keys(r):[],o=-1,a=s.length,function t(){var e=s[++o];return"__proto__"===e?t():o<a?{value:r[e],key:e}:null});var r,s,o,a};var n=s(t("./isArrayLike.js")),i=s(t("./getIterator.js"));function s(t){return t&&t.__esModule?t:{default:t}}e.exports=r.default},{"./getIterator.js":12,"./isArrayLike.js":14}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e},e.exports=r.default},{}],17:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}},e.exports=r.default},{}],18:[function(t,e,r){(function(t,e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fallback=a,r.wrap=u;var n,i=r.hasQueueMicrotask="function"==typeof queueMicrotask&&queueMicrotask,s=r.hasSetImmediate="function"==typeof e&&e,o=r.hasNextTick="object"==typeof t&&"function"==typeof t.nextTick;function a(t){setTimeout(t,0)}function u(t){return(e,...r)=>t((()=>e(...r)))}n=i?queueMicrotask:s?e:o?t.nextTick:a,r.default=u(n)}).call(this)}).call(this,t("_process"),t("timers").setImmediate)},{_process:37,timers:44}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isAsyncIterable=r.isAsyncGenerator=r.isAsync=void 0;var n,i=t("../asyncify.js"),s=(n=i)&&n.__esModule?n:{default:n};function o(t){return"AsyncFunction"===t[Symbol.toStringTag]}r.default=function(t){if("function"!=typeof t)throw new Error("expected a function");return o(t)?(0,s.default)(t):t},r.isAsync=o,r.isAsyncGenerator=function(t){return"AsyncGenerator"===t[Symbol.toStringTag]},r.isAsyncIterable=function(t){return"function"==typeof t[Symbol.asyncIterator]}},{"../asyncify.js":5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/once.js")),i=a(t("./internal/onlyOnce.js")),s=a(t("./internal/wrapAsync.js")),o=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,o.default)((function(t,e){if(e=(0,n.default)(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function o(e){(0,s.default)(t[r++])(...e,(0,i.default)(a))}function a(n,...i){if(!1!==n)return n||r===t.length?e(n,...i):void o(i)}o([])})),e.exports=r.default},{"./internal/awaitify.js":9,"./internal/once.js":16,"./internal/onlyOnce.js":17,"./internal/wrapAsync.js":19}],21:[function(t,e,r){"use strict";var n=12,i=0,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];var o={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function a(t,e){var r=o[t];return void 0===r?255:r<<e}e.exports=function(t){var e=t.indexOf("%");if(-1===e)return t;for(var r=t.length,o="",u=0,c=0,l=e,f=n;e>-1&&e<r;){var h=a(t[e+1],4)|a(t[e+2],0),p=s[h];if(f=s[256+f+p],c=c<<6|h&s[364+p],f!==n){if(f===i)return null;if((e+=3)<r&&37===t.charCodeAt(e))continue;return null}o+=t.slice(u,l),o+=c<=65535?String.fromCharCode(c):String.fromCharCode(55232+(c>>10),56320+(1023&c)),c=0,u=e+3,e=l=t.indexOf("%",u)}return o+t.slice(u)}},{}],22:[function(t,e,r){"use strict";e.exports=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(i=n;0!=i--;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(s=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;0!=i--;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!=e&&r!=r}},{}],23:[function(t,e,r){"use strict";const n=t("./parse"),i=t("./stringify"),s={parse:n,stringify:i};e.exports=s,e.exports.default=s,e.exports.parse=n,e.exports.stringify=i},{"./parse":25,"./stringify":26}],24:[function(t,e,r){const n=Array.from({length:256},((t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase())),i=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]);e.exports={encodeString:function(t){const e=t.length;if(0===e)return"";let r="",s=0,o=0;t:for(;o<e;o++){let a=t.charCodeAt(o);for(;a<128;){if(1!==i[a]&&(s<o&&(r+=t.slice(s,o)),s=o+1,r+=n[a]),++o===e)break t;a=t.charCodeAt(o)}if(s<o&&(r+=t.slice(s,o)),a<2048){s=o+1,r+=n[192|a>>6]+n[128|63&a];continue}if(a<55296||a>=57344){s=o+1,r+=n[224|a>>12]+n[128|a>>6&63]+n[128|63&a];continue}if(++o,o>=e)throw new Error("URI malformed");s=o+1,a=65536+((1023&a)<<10|1023&t.charCodeAt(o)),r+=n[240|a>>18]+n[128|a>>12&63]+n[128|a>>6&63]+n[128|63&a]}return 0===s?t:s<e?r+t.slice(s):r}}},{}],25:[function(t,e,r){"use strict";const n=t("fast-decode-uri-component"),i=/\+/g,s=function(){};s.prototype=Object.create(null),e.exports=function(t){const e=new s;if("string"!=typeof t)return e;let r=t.length,o="",a="",u=-1,c=-1,l=!1,f=!1,h=!1,p=!1,d=!1,g=0;for(let s=0;s<r+1;s++)if(g=s!==r?t.charCodeAt(s):38,38===g){if(d=c>u,d||(c=s),o=t.slice(u+1,c),d||o.length>0){h&&(o=o.replace(i," ")),l&&(o=n(o)||o),d&&(a=t.slice(c+1,s),p&&(a=a.replace(i," ")),f&&(a=n(a)||a));const r=e[o];void 0===r?e[o]=a:r.pop?r.push(a):e[o]=[r,a]}a="",u=s,c=s,l=!1,f=!1,h=!1,p=!1}else 61===g?c<=u?c=s:f=!0:43===g?c>u?p=!0:h=!0:37===g&&(c>u?f=!0:l=!0);return e}},{"fast-decode-uri-component":21}],26:[function(t,e,r){"use strict";const{encodeString:n}=t("./internals/querystring");function i(t){const e=typeof t;return"string"===e?n(t):"bigint"===e?t.toString():"boolean"===e?t?"true":"false":"number"===e&&Number.isFinite(t)?t<1e21?""+t:n(""+t):""}e.exports=function(t){let e="";if(null===t||"object"!=typeof t)return e;const r=Object.keys(t),s=r.length;let o=0;for(let a=0;a<s;a++){const s=r[a],u=t[s],c=n(s)+"=";if(a&&(e+="&"),Array.isArray(u)){o=u.length;for(let t=0;t<o;t++)t&&(e+="&"),e+=c,e+=i(u[t])}else e+=c,e+=i(u)}return e}},{"./internals/querystring":24}],27:[function(t,e,r){"use strict";const n=t("./handler_storage"),i={STATIC:0,PARAMETRIC:1,WILDCARD:2};class s{constructor(){this.handlerStorage=new n}}class o extends s{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(t,e){const r=this.staticChildren[t.charAt(e)];return void 0!==r&&r.matchPrefix(t,e)?r:null}createStaticChild(t){if(0===t.length)return this;let e=this.staticChildren[t.charAt(0)];if(e){let r=1;for(;r<e.prefix.length;r++)if(t.charCodeAt(r)!==e.prefix.charCodeAt(r)){e=e.split(this,r);break}return e.createStaticChild(t.slice(r))}const r=t.charAt(0);return this.staticChildren[r]=new a(t),this.staticChildren[r]}}class a extends o{constructor(t){super(),this.prefix=t,this.wildcardChild=null,this.parametricChildren=[],this.kind=i.STATIC,this._compilePrefixMatch()}createParametricChild(t,e){const r=t&&t.source;let n=this.parametricChildren.find((t=>(t.regex&&t.regex.source)===r));return n||(n=new u(t,e),this.parametricChildren.push(n),this.parametricChildren.sort(((t,e)=>t.isRegex?e.isRegex?null===t.staticSuffix?1:null===e.staticSuffix?-1:e.staticSuffix.endsWith(t.staticSuffix)?1:t.staticSuffix.endsWith(e.staticSuffix)?-1:0:-1:1)),n)}createWildcardChild(){return this.wildcardChild||(this.wildcardChild=new c),this.wildcardChild}split(t,e){const r=this.prefix.slice(0,e),n=this.prefix.slice(e);this.prefix=n,this._compilePrefixMatch();const i=new a(r);return i.staticChildren[n.charAt(0)]=this,t.staticChildren[r.charAt(0)]=i,i}getNextNode(t,e,r,n){let i=this.findStaticMatchingChild(t,e),s=0;if(null===i){if(0===this.parametricChildren.length)return this.wildcardChild;i=this.parametricChildren[0],s=1}null!==this.wildcardChild&&r.push({paramsCount:n,brotherPathIndex:e,brotherNode:this.wildcardChild});for(let t=this.parametricChildren.length-1;t>=s;t--)r.push({paramsCount:n,brotherPathIndex:e,brotherNode:this.parametricChildren[t]});return i}_compilePrefixMatch(){if(1===this.prefix.length)return void(this.matchPrefix=()=>!0);const t=[];for(let e=1;e<this.prefix.length;e++){const r=this.prefix.charCodeAt(e);t.push(`path.charCodeAt(i + ${e}) === ${r}`)}this.matchPrefix=new Function("path","i",`return ${t.join(" && ")}`)}}class u extends o{constructor(t,e){super(),this.isRegex=!!t,this.regex=t||null,this.staticSuffix=e||null,this.kind=i.PARAMETRIC}getNextNode(t,e){return this.findStaticMatchingChild(t,e)}}class c extends s{constructor(){super(),this.kind=i.WILDCARD}getNextNode(){return null}}e.exports={StaticNode:a,ParametricNode:u,WildcardNode:c,NODE_TYPES:i}},{"./handler_storage":28}],28:[function(t,e,r){"use strict";e.exports=class{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(t){return void 0===t?this.unconstrainedHandler:this._getHandlerMatchingConstraints(t)}addHandler(t,e,r,n,i){const s={handler:t,params:e,constraints:i,store:r||null,_createParamsObject:this._compileCreateParamsObject(e)};0===Object.keys(i).length&&(this.unconstrainedHandler=s);for(const t of Object.keys(i))this.constraints.includes(t)||("version"===t?this.constraints.unshift(t):this.constraints.push(t));if(this.handlers.length>=32)throw new Error("find-my-way supports a maximum of 32 route handlers per node when there are constraints, limit reached");this.handlers.push(s),this.handlers.sort(((t,e)=>Object.keys(t.constraints).length-Object.keys(e.constraints).length)),this._compileGetHandlerMatchingConstraints(n,i)}_compileCreateParamsObject(t){const e=[];for(let r=0;r<t.length;r++)e.push(`'${t[r]}': paramsArray[${r}]`);return new Function("paramsArray",`return {${e.join(",")}}`)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(t,e){for(let r=0;r<this.handlers.length;r++){const n=this.handlers[r].constraints[e];if(void 0!==n){let e=t.get(n)||0;e|=1<<r,t.set(n,e)}}}_constrainedIndexBitmask(t){let e=0;for(let r=0;r<this.handlers.length;r++){void 0!==this.handlers[r].constraints[t]&&(e|=1<<r)}return~e}_compileGetHandlerMatchingConstraints(t){this.constrainedHandlerStores={};for(const e of this.constraints){const r=t.newStoreForConstraint(e);this.constrainedHandlerStores[e]=r,this._buildConstraintStore(r,e)}const e=[];e.push(`\n let candidates = ${(1<<this.handlers.length)-1}\n let mask, matches\n `);for(const r of this.constraints){e.push(`\n mask = ${this._constrainedIndexBitmask(r)}\n value = derivedConstraints.${r}\n `);const n=t.strategies[r].mustMatchWhenDerived?"matches":"(matches | mask)";e.push(`\n if (value === undefined) {\n candidates &= mask\n } else {\n matches = this.constrainedHandlerStores.${r}.get(value) || 0\n candidates &= ${n}\n }\n if (candidates === 0) return null;\n `)}for(const r in t.strategies){t.strategies[r].mustMatchWhenDerived&&!this.constraints.includes(r)&&e.push(`if (derivedConstraints.${r} !== undefined) return null`)}e.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",e.join("\n"))}}},{}],29:[function(t,e,r){"use strict";const n=t("assert"),i=t("fast-querystring"),s=t("safe-regex2"),o=t("fast-deep-equal"),{flattenNode:a,compressFlattenedNode:u,prettyPrintFlattenedNode:c,prettyPrintRoutesArray:l}=t("./lib/pretty-print"),{StaticNode:f,NODE_TYPES:h}=t("./custom_node"),p=t("./lib/constrainer"),d=t("./lib/http-methods"),{safeDecodeURI:g,safeDecodeURIComponent:y}=t("./lib/url-sanitizer"),v=/^https?:\/\/.*?\//,m=/(\/:[^/()]*?)\?(\/?)/;if(!s(v))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!s(m))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function b(t){if(!(this instanceof b))return new b(t);(t=t||{}).defaultRoute?(n("function"==typeof t.defaultRoute,"The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(n("function"==typeof t.onBadUrl,"The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(n("function"==typeof t.buildPrettyMeta,"buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=O,t.querystringParser?(n("function"==typeof t.querystringParser,"querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=t=>""===t?{}:i.parse(t),this.caseSensitive=void 0===t.caseSensitive||t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.routes=[],this.trees={},this.constrainer=new p(t.constraints),this._routesPatterns={}}for(var S in b.prototype.on=function(t,e,r,i,s){"function"==typeof r&&(void 0!==i&&(s=i),i=r,r={}),n("string"==typeof e,"Path should be a string"),n(e.length>0,"The path could not be empty"),n("/"===e[0]||"*"===e[0],"The first character of a path should be `/` or `*`"),n("function"==typeof i,"Handler should be a function");const o=e.match(m);if(o){n(e.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");const a=e.replace(m,"$1$2"),u=e.replace(m,"$2");return this.on(t,a,r,i,s),void this.on(t,u,r,i,s)}const a=e;this.ignoreDuplicateSlashes&&(e=w(e)),this.ignoreTrailingSlash&&(e=C(e));const u=Array.isArray(t)?t:[t];for(const t of u)this._on(t,e,r,i,s,a),this.routes.push({method:t,path:e,opts:r,handler:i,store:s})},b.prototype._on=function(t,e,r,i,a){n("string"==typeof t,"Method should be a string"),n(d.includes(t),`Method '${t}' is not an http method.`);let u={};if(void 0!==r.constraints&&(n("object"==typeof r.constraints&&null!==r.constraints,"Constraints should be an object"),0!==Object.keys(r.constraints).length&&(u=r.constraints)),this.constrainer.validateConstraints(u),this.constrainer.noteUsage(u),void 0===this.trees[t]&&(this.trees[t]=new f("/"),this._routesPatterns[t]=[]),"*"===e&&0!==this.trees[t].prefix.length){const e=this.trees[t];this.trees[t]=new f(""),this.trees[t].staticChildren["/"]=e}let c=this.trees[t],l=c.prefix.length;const h=[];for(let t=0;t<=e.length;t++){if(58===e.charCodeAt(t)&&58===e.charCodeAt(t+1)){t++;continue}const r=58===e.charCodeAt(t)&&58!==e.charCodeAt(t+1),i=42===e.charCodeAt(t);if(r||i||t===e.length&&t!==l){let r=e.slice(l,t);this.caseSensitive||(r=r.toLowerCase()),r=r.split("::").join(":"),r=r.split("%").join("%25"),c=c.createStaticChild(r)}if(r){let r=!1;const i=[];let o=t+1;for(let a=o;;a++){const u=e.charCodeAt(a),f=40===u,p=45===u||46===u,d=47===u||a===e.length;if(f||p||d){const u=e.slice(o,a);if(h.push(u),r=r||f||p,f){const t=P(e,a),r=e.slice(a,t+1);this.allowUnsafeRegex||n(s(new RegExp(r)),`The regex '${r}' is not safe!`),i.push(x(r)),a=t+1}else i.push("(.*?)");const g=a;for(;a<e.length;a++){const t=e.charCodeAt(a);if(47===t)break;if(58===t){if(58!==e.charCodeAt(a+1))break;a++}}let y=e.slice(g,a);if(y&&(y=y.split("::").join(":"),y=y.split("%").join("%25"),i.push(y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),o=a+1,d||47===e.charCodeAt(a)||a===e.length){const n=r?"()"+y:y;e=e.slice(0,t+1)+n+e.slice(a),t+=n.length;const s=r?new RegExp("^"+i.join("")+"$"):null;c=c.createParametricChild(s,y||null),l=t+1;break}}}}else if(i&&(h.push("*"),c=c.createWildcardChild(),l=t+1,t!==e.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(e=e.toLowerCase()),"*"===e&&(e="/*");for(const r of this._routesPatterns[t])if(r.path===e&&o(r.constraints,u))throw new Error(`Method '${t}' already declared for route '${e}' with constraints '${JSON.stringify(u)}'`);this._routesPatterns[t].push({path:e,params:h,constraints:u}),c.handlerStorage.addHandler(i,h,a,this.constrainer,u)},b.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)},b.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)},b.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns={}},b.prototype.off=function(t,e,r){n("string"==typeof e,"Path should be a string"),n(e.length>0,"The path could not be empty"),n("/"===e[0]||"*"===e[0],"The first character of a path should be `/` or `*`"),n(void 0===r||"object"==typeof r&&!Array.isArray(r)&&null!==r,"Constraints should be an object or undefined.");const i=e.match(m);if(i){n(e.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");const s=e.replace(m,"$1$2"),o=e.replace(m,"$2");return this.off(t,s,r),void this.off(t,o,r)}this.ignoreDuplicateSlashes&&(e=w(e)),this.ignoreTrailingSlash&&(e=C(e));const s=Array.isArray(t)?t:[t];for(const t of s)this._off(t,e,r)},b.prototype._off=function(t,e,r){function i(r){return t!==r.method||e!==r.path}n("string"==typeof t,"Method should be a string"),n(d.includes(t),`Method '${t}' is not an http method.`);const s=r?function(t){return i(t)||!o(r,t.opts.constraints||{})}:i,a=this.routes.filter(s);this._rebuild(a)},b.prototype.lookup=function(t,e,r,n){if("function"==typeof r&&(n=r,r=void 0),void 0===n){const n=this.constrainer.deriveConstraints(t,r),i=this.find(t.method,t.url,n);return this.callHandler(i,t,e,r)}this.constrainer.deriveConstraints(t,r,((i,s)=>{if(null===i)try{const i=this.find(t.method,t.url,s),o=this.callHandler(i,t,e,r);n(null,o)}catch(i){n(i)}else n(i)}))},b.prototype.callHandler=function(t,e,r,n){return null===t?this._defaultRoute(e,r,n):void 0===n?t.handler(e,r,t.params,t.store,t.searchParams):t.handler.call(n,e,r,t.params,t.store,t.searchParams)},b.prototype.find=function(t,e,r){let n,i,s,o=this.trees[t];if(void 0===o)return null;47!==e.charCodeAt(0)&&(e=e.replace(v,"/")),this.ignoreDuplicateSlashes&&(e=w(e));try{n=g(e),e=n.path,i=n.querystring,s=n.shouldDecodeParam}catch(t){return this._onBadUrl(e)}this.ignoreTrailingSlash&&(e=C(e));const a=e;!1===this.caseSensitive&&(e=e.toLowerCase());const u=this.maxParamLength;let c=o.prefix.length;const l=[],f=e.length,p=[];for(;;){if(c===f){const t=o.handlerStorage.getMatchingHandler(r);if(null!==t)return{handler:t.handler,store:t.store,params:t._createParamsObject(l),searchParams:this.querystringParser(i)}}let t=o.getNextNode(e,c,p,l.length);if(null===t){if(0===p.length)return null;const e=p.pop();c=e.brotherPathIndex,l.splice(e.paramsCount),t=e.brotherNode}if(o=t,o.kind!==h.STATIC)if(o.kind!==h.WILDCARD){if(o.kind===h.PARAMETRIC){let t=a.indexOf("/",c);-1===t&&(t=f);let e=a.slice(c,t);if(s&&(e=y(e)),o.isRegex){const t=o.regex.exec(e);if(null===t)continue;for(let e=1;e<t.length;e++){const r=t[e];if(r.length>u)return null;l.push(r)}}else{if(e.length>u)return null;l.push(e)}c=t}}else{let t=a.slice(c);s&&(t=y(t)),l.push(t),c=f}else c+=o.prefix.length}},b.prototype._rebuild=function(t){this.reset();for(const e of t){const{method:t,path:r,opts:n,handler:i,store:s}=e;this._on(t,r,n,i,s),this.routes.push({method:t,path:r,opts:n,handler:i,store:s})}},b.prototype._defaultRoute=function(t,e,r){if(null!==this.defaultRoute)return void 0===r?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()},b.prototype._onBadUrl=function(t){if(null===this.onBadUrl)return null;const e=this.onBadUrl;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}},b.prototype.prettyPrint=function(t={}){if(t.commonPrefix=void 0===t.commonPrefix||t.commonPrefix,!t.commonPrefix)return l.call(this,this.routes,t);const e={prefix:"/",nodes:[],children:{}};for(const t in this.trees){const r=this.trees[t];r&&a(e,r,t)}return u(e),c.call(this,e,"",!0,t)},d){if(!d.hasOwnProperty(S))continue;const t=d[S],e=t.toLowerCase();if(b.prototype[e])throw new Error("Method already exists: "+e);b.prototype[e]=function(e,r,n){return this.on(t,e,r,n)}}function w(t){return t.replace(/\/\/+/g,"/")}function C(t){return t.length>1&&47===t.charCodeAt(t.length-1)?t.slice(0,-1):t}function x(t){return 94===t.charCodeAt(1)&&(t=t.slice(0,1)+t.slice(2)),36===t.charCodeAt(t.length-2)&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function P(t,e){for(var r=1;e<t.length;)if("\\"!==t[++e]){if(")"===t[e]?r--:"("===t[e]&&r++,!r)return e}else e++;throw new TypeError('Invalid regexp expression in "'+t+'"')}function O(t){return t&&t.store?Object.assign({},t.store):{}}b.prototype.all=function(t,e,r){this.on(d,t,e,r)},e.exports=b},{"./custom_node":27,"./lib/constrainer":30,"./lib/http-methods":31,"./lib/pretty-print":32,"./lib/url-sanitizer":35,assert:1,"fast-deep-equal":22,"fast-querystring":23,"safe-regex2":38}],30:[function(t,e,r){"use strict";const n=t("./strategies/accept-version"),i=t("./strategies/accept-host"),s=t("assert");e.exports=class{constructor(t){if(this.strategies={version:n,host:i},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,t)for(const e of Object.values(t))this.addConstraintStrategy(e)}isStrategyUsed(t){return this.strategiesInUse.has(t)||this.asyncStrategiesInUse.has(t)}hasConstraintStrategy(t){const e=this.strategies[t];return void 0!==e&&(e.isCustom||this.isStrategyUsed(t))}addConstraintStrategy(t){if(s("string"==typeof t.name&&""!==t.name,"strategy.name is required."),s(t.storage&&"function"==typeof t.storage,"strategy.storage function is required."),s(t.deriveConstraint&&"function"==typeof t.deriveConstraint,"strategy.deriveConstraint function is required."),this.strategies[t.name]&&this.strategies[t.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${t.name}.`);if(this.isStrategyUsed(t.name))throw new Error(`There already exists a route with ${t.name} constraint.`);t.isCustom=!0,t.isAsync=3===t.deriveConstraint.length,this.strategies[t.name]=t,t.mustMatchWhenDerived&&this.noteUsage({[t.name]:t})}deriveConstraints(t,e,r){const n=this.deriveSyncConstraints(t,e);if(void 0===r)return n;this.deriveAsyncConstraints(n,t,e,r)}deriveSyncConstraints(t,e){}noteUsage(t){if(t){const e=this.strategiesInUse.size;for(const e in t){this.strategies[e].isAsync?this.asyncStrategiesInUse.add(e):this.strategiesInUse.add(e)}e!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(t){if(!this.strategies[t])throw new Error(`No strategy registered for constraint key ${t}`);return this.strategies[t].storage()}validateConstraints(t){for(const e in t){const r=t[e];if(void 0===r)throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");const n=this.strategies[e];if(!n)throw new Error(`No strategy registered for constraint key ${e}`);n.validate&&n.validate(r)}}deriveAsyncConstraints(t,e,r,n){let i=this.asyncStrategiesInUse.size;if(0!==i){t=t||{};for(const s of this.asyncStrategiesInUse){this.strategies[s].deriveConstraint(e,r,((e,r)=>{null===e?(t[s]=r,0==--i&&n(null,t)):n(e)}))}}else n(null,t)}_buildDeriveConstraints(){if(0===this.strategiesInUse.size)return;const t=["return {"];for(const e of this.strategiesInUse){const r=this.strategies[e];if(r.isCustom)t.push(` ${r.name}: this.strategies.${e}.deriveConstraint(req, ctx),`);else if("version"===e)t.push(" version: req.headers['accept-version'],");else{if("host"!==e)throw new Error("unknown non-custom strategy for compiling constraint derivation function");t.push(" host: req.headers.host || req.headers[':authority'],")}}t.push("}"),this.deriveSyncConstraints=new Function("req","ctx",t.join("\n")).bind(this)}}},{"./strategies/accept-host":33,"./strategies/accept-version":34,assert:1}],31:[function(t,e,r){"use strict";e.exports=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"]},{}],32:[function(t,e,r){"use strict";const n=" ",i="│ ",s="├── ",o="└── ",a="*",u="/",c=/(?=\/)/;function l(t){return Array.isArray(t)?t.map((t=>l(t))):"symbol"==typeof t?t.toString():"function"==typeof t?function(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}(t):t}function f(t,e){const r={},n=this.buildPrettyMeta(t);return Array.isArray(e)||(e=n?Reflect.ownKeys(n):[]),e.forEach((t=>{const e="symbol"==typeof t?t.toString():t;n&&n[t]&&(r[e]=l(n[t]))})),r}function h(t,e,r,a,u){let c="";if(a||u||(c+="\n"),a||(c+=`${e||""}${r?o:s}`),c+=`${t.path}`,t.handlers){const s=t.handlers.reduce(((t,e)=>{const r=t.findIndex((t=>JSON.stringify(t.opts)===JSON.stringify(e.opts)));return-1!==r?t[r].method=[t[r].method,e.method].join(", "):t.push(e),t}),[]);s.forEach(((o,u)=>{u>0&&(c+=`${a?"":e||""}${r?n:i}${t.path}`),c+=` (${o.method||"-"})`,o.opts&&"{}"!==JSON.stringify(o.opts)&&(c+=` ${JSON.stringify(o.opts)}`),o.meta&&Reflect.ownKeys(o.meta).forEach(((t,s)=>{c+=`\n${a?"":e||""}${r?n:i}`,c+=`• (${t}) ${JSON.stringify(o.meta[t])}`})),s.length>1&&u!==s.length-1&&(c+="\n")}))}else t.children.length>1&&(c+=" (-)");return a||(e=`${e||""}${r?n:i}`),t.children.forEach(((r,n)=>{const i=n===t.children.length-1,s=!t.handlers&&1===t.children.length;c+=h(r,e,i,s)})),c}e.exports={flattenNode:function t(e,r,n){if(0!==r.handlerStorage.handlers.length&&e.nodes.push({method:n,node:r}),r.parametricChildren&&r.parametricChildren[0]&&(e.children[":"]||(e.children[":"]={prefix:":",nodes:[],children:{}}),t(e.children[":"],r.parametricChildren[0],n)),r.wildcardChild&&(e.children["*"]||(e.children["*"]={prefix:"*",nodes:[],children:{}}),t(e.children["*"],r.wildcardChild,n)),r.staticChildren)for(const i of Object.values(r.staticChildren)){const r=i.prefix.split(c);let s,o=e;for(const t of r)s=o,o=o.children[t],o||(o={prefix:t,nodes:[],children:{}},s.children[t]=o);t(o,i,n)}},compressFlattenedNode:function t(e){const r=Object.keys(e.children);if(0===e.nodes.length&&1===r.length){const n=e.children[r[0]];if(n.nodes.length<=1)return t(n),e.nodes=n.nodes,e.prefix+=n.prefix,e.children=n.children,e}for(const r of Object.keys(e.children))t(e.children[r]);return e},prettyPrintFlattenedNode:function t(e,r,a,u){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");u.includeMeta=u.includeMeta||null;let c="";const l=[];for(const{node:t,method:r}of e.nodes)for(const e of t.handlerStorage.handlers)l.push({method:r,...e});l.length?l.forEach(((t,s)=>{let o=`(${t.method||"-"})`;Object.keys(t.constraints).length>0&&(o+=" "+JSON.stringify(t.constraints));let l="";const h=e.prefix.split("").map(((t,e)=>":"===t?e:null)).filter((t=>null!==t));if(h.length){let r=0;h.forEach(((n,i)=>{l+=e.prefix.slice(r,n+1),l+=t.params[t.params.length-h.length+i],i===h.length-1&&(l+=e.prefix.slice(n+1)),r=n+1}))}else l=e.prefix;if(c+=0===s?`${l} ${o}`:`\n${r}${a?n:i}${l} ${o}`,u.includeMeta){const e=f.call(this,t,u.includeMeta);Object.keys(e).forEach(((t,s)=>{c+=`\n${r||""}${a?n:i}`,c+=`• (${t}) ${JSON.stringify(e[t])}`}))}})):c=e.prefix;let h=`${r}${a?o:s}${c}\n`;r=`${r}${a?n:i}`;const p=Object.keys(e.children);for(let n=0;n<p.length;n++){const i=e.children[p[n]];h+=t.call(this,i,r,n===p.length-1,u)}return h},prettyPrintRoutesArray:function(t,e={}){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");e.includeMeta=e.includeMeta||null;const r=[];let n="";t.sort(((t,e)=>t.path&&e.path?t.path.localeCompare(e.path):0));for(let n=0;n<t.length;n++){const i=t[n],s=r.find((t=>i.path===t.path));if(s){s.handlers.push({method:i.method,opts:i.opts.constraints||void 0,meta:e.includeMeta?f.call(this,i,e.includeMeta):null});continue}const o={method:i.method,opts:i.opts.constraints||void 0,meta:e.includeMeta?f.call(this,i,e.includeMeta):null};r.push({path:i.path,methods:[i.method],opts:[i.opts],handlers:[o]})}if(!r.filter((t=>t.path===u)).length){const t={path:u,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter((t=>t.path===a)).length?r.splice(1,0,t):r.unshift(t)}const i=function(t){const e=[],r={result:e};return t.forEach(((t,e)=>{let n=t.path.split(c);n[0]!==u&&n[0]!==a&&(n=[u,n[0].slice(1),...n.slice(1)]),n.reduce(((e,r,i)=>{if(!e[r]){e[r]={result:[]};const s={path:r,children:e[r].result};i===n.length-1&&(s.handlers=t.handlers),e.result.push(s)}return e[r]}),r)})),e}(r);return i.forEach(((t,e)=>{n+=h(t,null,e===i.length-1,!1,!0),n+="\n"})),n}}},{}],33:[function(t,e,r){"use strict";const n=t("assert");e.exports={name:"host",mustMatchWhenDerived:!1,storage:function(){const t={},e=[];return{get:r=>{const n=t[r];if(n)return n;for(const t of e)if(t.host.test(r))return t.value},set:(r,n)=>{r instanceof RegExp?e.push({host:r,value:n}):t[r]=n}}},validate(t){n("string"==typeof t||"[object RegExp]"===Object.prototype.toString.call(t),"Host should be a string or a RegExp")}}},{assert:1}],34:[function(t,e,r){"use strict";const n=t("assert");function i(){if(!(this instanceof i))return new i;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}i.prototype.set=function(t,e){if("string"!=typeof t)throw new TypeError("Version should be a string");let[r,n,i]=t.split(".");return r=Number(r)||0,n=Number(n)||0,i=Number(i)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.x=e,this.store["*"]=e,this.store["x.x"]=e,this.store["x.x.x"]=e),n>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=n,this.store[`${r}.x`]=e,this.store[`${r}.x.x`]=e),i>=(this.store[`${r}.${n}`]||0)&&(this.maxPatches[`${r}.${n}`]=i,this.store[`${r}.${n}.x`]=e),this.store[`${r}.${n}.${i}`]=e,this},i.prototype.get=function(t){return this.store[t]},e.exports={name:"version",mustMatchWhenDerived:!0,storage:i,validate(t){n("string"==typeof t,"Version should be a string")}}},{assert:1}],35:[function(t,e,r){"use strict";function n(t,e){return 50===t?53===e?"%":51===e?"#":52===e?"$":54===e?"&":66===e||98===e?"+":67===e||99===e?",":70===e||102===e?"/":null:51===t?65===e||97===e?":":66===e||98===e?";":68===e||100===e?"=":70===e||102===e?"?":null:52===t&&48===e?"@":null}e.exports={safeDecodeURI:function(t){let e=!1,r=!1,i="";for(let s=1;s<t.length;s++){const o=t.charCodeAt(s);if(37===o){const i=t.charCodeAt(s+1),o=t.charCodeAt(s+2);null===n(i,o)?e=!0:(r=!0,50===i&&53===o&&(e=!0,t=t.slice(0,s+1)+"25"+t.slice(s+1),s+=2),s+=2)}else if(63===o||59===o||35===o){i=t.slice(s+1),t=t.slice(0,s);break}}return{path:e?decodeURI(t):t,querystring:i,shouldDecodeParam:r}},safeDecodeURIComponent:function(t){const e=t.indexOf("%");if(-1===e)return t;let r="",i=e;for(let s=e;s<t.length;s++)if(37===t.charCodeAt(s)){const e=n(t.charCodeAt(s+1),t.charCodeAt(s+2));r+=t.slice(i,s)+e,i=s+3}return t.slice(0,e)+r+t.slice(i)}}},{}],36:[function(t,e,r){
|
|
8
8
|
/*
|
|
9
9
|
object-assign
|
|
10
10
|
(c) Sindre Sorhus
|
|
@@ -25,7 +25,7 @@ var n=t("./Orator.js");"object"!=typeof window||window.hasOwnProperty("Orator")|
|
|
|
25
25
|
*
|
|
26
26
|
* @author Steven Velozo <steven@velozo.com>
|
|
27
27
|
*/
|
|
28
|
-
getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":51}],48:[function(t,e,r){e.exports=class{constructor(t){this.orator=t,this.log=t.log,this.Name=this.orator.settings.Product,this.URL="BASE_SERVICE_SERVER",this.Port=this.orator.settings.ServicePort,this.Active=!1}listen(t,e){return this.Active=!0,e()}close(t){return this.Active=!1,t()}use(t){return"function"==typeof t||(this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof t} instead of a string.`),!1)}get(t,...e){return"string"
|
|
28
|
+
getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":51}],48:[function(t,e,r){e.exports=class{constructor(t){this.orator=t,this.log=t.log,this.ServiceServerType="Base",this.Name=this.orator.settings.Product,this.URL="BASE_SERVICE_SERVER",this.Port=this.orator.settings.ServicePort,this.Active=!1}listen(t,e){return this.Active=!0,e()}close(t){return this.Active=!1,t()}bodyParser(t){return(t,e,r)=>{r()}}use(t){return"function"==typeof t||(this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof t} instead of a string.`),!1)}doGet(t,...e){return!0}get(t,...e){return"string"!=typeof t?(this.log.error(`Orator GET Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doGet(t,...e)}getWithBodyParser(t,...e){return this.get(t,this.bodyParser(),...e)}doPut(t,...e){return!0}put(t,...e){return"string"!=typeof t?(this.log.error(`Orator PUT Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1):this.doPut(t,...e)}putWithBodyParser(t,...e){return this.put(t,this.bodyParser(),...e)}doPost(t,...e){return!0}post(t,...e){return"string"==typeof t||(this.log.error(`Orator POST Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}postWithBodyParser(t,...e){return this.post(t,this.bodyParser(),...e)}doDel(t,...e){return!0}del(t,...e){return"string"==typeof t||(this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}delWithBodyParser(t,...e){return this.del(t,this.bodyParser(),...e)}patch(t,...e){return"string"==typeof t||(this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}patchWithBodyParser(t,...e){return this.patch(t,this.bodyParser(),...e)}opts(t,...e){return"string"==typeof t||(this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}optsWithBodyParser(t,...e){return this.opts(t,this.bodyParser(),...e)}head(t,...e){return"string"==typeof t||(this.log.error(`Orator HEAD Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}headWithBodyParser(t,...e){return this.head(t,this.bodyParser(),...e)}invoke(t,e,r,n){return this.log.debug(`Orator invoke called for route [${e}] and landed on the base class; the service provider likely does not implement programmatic invoke capabilities.`,r),!1}}},{}],49:[function(t,e,r){"use strict";e.exports={name:"ipc",isAsync:!0,storage:()=>{let t={};return{get:e=>t[e]||null,set:(e,r)=>{t[e]=r}}},deriveConstraint:(t,e,r)=>r(null,"IPC"),mustMatchWhenDerived:!0}},{}],50:[function(t,e,r){e.exports=class{constructor(t,e){this.log=t,this.requestGUID=e,this.responseData=null,this.responseStatus=-1}send(t){return"string"==typeof t?null===this.responseData?(this.responseData=t,!0):"string"==typeof this.responseData?(this.responseData=this.responseData+t,!0):(this.log(`Request ${this.requestGUID} has tried to send() a string value after send()ing data type ${typeof this.responseData}.`,t),!1):"object"==typeof t?null===this.responseData?(this.responseData=JSON.stringify(t),!0):"string"==typeof this.responseData?(this.responseData+=this.responseData+JSON.stringify(t),!0):(this.log(`Request ${this.requestGUID} has tried to send() an object value to be auto stringified after send()ing data type ${typeof this.responseData}.`,t),!1):void 0}}},{}],51:[function(t,e,r){const n=t("./Orator-ServiceServer-Base.js"),i=t("./Orator-ServiceServer-IPC-SynthesizedResponse.js"),s=t("./Orator-ServiceServer-IPC-RouterConstrainer.js"),o=t("find-my-way"),a=t("async/waterfall"),u=t("async/eachOfSeries");e.exports=class extends n{constructor(t){super(t),this.routerOptions=this.orator.settings.hasOwnProperty("router_options")&&"object"==typeof this.orator.settings.router_options?this.orator.settings.router_options:{},this.router=o(this.routerOptions),this.router.addConstraintStrategy(s),this.ServiceServerType="IPC",this.URL="IPC",this.preBehaviorFunctions=[],this.behaviorMap={},this.postBehaviorFunctions=[]}use(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}addPostBehaviorFunction(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}executePreBehaviorFunctions(t,e,r){u(this.preBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider preBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addPostBehaviorFunction(t){if(!super.use(t))return this.log.error("IPC provider failed to map USE handler function!"),!1;this.preBehaviorFunctions.push(t)}executePostBehaviorFunctions(t,e,r){u(this.postBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider postBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addRouteProcessor(t,e,r){return this.router.on(t,e,{constraints:{ipc:"IPC"}},((t,e,n)=>{a([e=>(t.params=n,e()),r=>this.executePreBehaviorFunctions(t,e,r),n=>{u(r,((r,n,i)=>r(t,e,i)),(t=>{if(t)return this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${t}`,t),fNext(pError)}))},r=>this.executePostBehaviorFunctions(t,e,r)],(t=>{t&&this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${pBehaviorFunctionError}`,pBehaviorFunctionError)}))})),!0}get(t,...e){return super.get(t,...e)?this.addRouteProcessor("GET",t,Array.from(e)):(this.log.error(`IPC provider failed to map GET route [${t}]!`),!1)}getWithBodyParser(t,...e){return this.get(t,fS)}put(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map PUT route [${t}]!`),!1)}post(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map POST route [${t}]!`),!1)}del(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map DEL route [${t}]!`),!1)}invoke(t,e,r,n){let s="function"==typeof n?n:"function"==typeof r?r:()=>{},o={method:t,url:e,guid:this.orator.fable.getUUID()},a=new i(this.log,o.guid);return this.router.lookup(o,a,((t,n)=>(t&&this.log.error(`IPC Request Error Request GUID [${o.guid}] handling route [${e}]: ${t}`,{Error:t,Route:e,Data:r}),s(t,a.responseData,a,n))))}}},{"./Orator-ServiceServer-Base.js":48,"./Orator-ServiceServer-IPC-RouterConstrainer.js":49,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":50,"async/eachOfSeries":7,"async/waterfall":20,"find-my-way":29}],52:[function(t,e,r){
|
|
29
29
|
/**
|
|
30
30
|
* Orator Service Abstraction
|
|
31
31
|
*
|