koa-ts-core 0.0.24 → 0.0.25

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/dist/index.cjs.js CHANGED
@@ -36,4 +36,4 @@
36
36
  * copy-to - index.js
37
37
  * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
38
38
  * MIT Licensed
39
- */var hi=function(){if(ya)return ba;ya=1;const e=mi(),n=function(){if(xa)return va;xa=1;var e=Array.prototype.slice;function n(e,t){if(!(this instanceof n))return new n(e,t);this.src=e,this._withAccess=t}function t(e,n){return void 0===e[n]&&void 0===e.__lookupGetter__(n)&&void 0===e.__lookupSetter__(n)}return va=n,n.prototype.withAccess=function(e){return this._withAccess=!1!==e,this},n.prototype.pick=function(n){return Array.isArray(n)||(n=e.call(arguments)),n.length&&(this.keys=n),this},n.prototype.to=function(e){if(e=e||{},!this.src)return e;var n=this.keys||Object.keys(this.src);if(!this._withAccess){for(var a=0;a<n.length;a++)void 0===e[i=n[a]]&&(e[i]=this.src[i]);return e}for(a=0;a<n.length;a++){var i=n[a];if(t(e,i)){var o=this.src.__lookupGetter__(i),r=this.src.__lookupSetter__(i);o&&e.__defineGetter__(i,o),r&&e.__defineSetter__(i,r),o||r||(e[i]=this.src[i])}}return e},n.prototype.toCover=function(e){for(var n=this.keys||Object.keys(this.src),t=0;t<n.length;t++){var a=n[t];delete e[a];var i=this.src.__lookupGetter__(a),o=this.src.__lookupSetter__(a);i&&e.__defineGetter__(a,i),o&&e.__defineSetter__(a,o),i||o||(e[a]=this.src[a])}},n.prototype.override=n.prototype.toCover,n.prototype.and=function(e){var n={};return this.to(n),this.src=e,this.to(n),this.src=n,this},va}(),t=Y();function a(e,t){const a={};return n(e).to(a),a.limit=e[t+"Limit"],a}function i(e,n){n&&(Array.isArray(n)||(n=[n]),n.forEach((function(n){e.push(n)})))}function o(e,n){return e.includes(n)}return ba=function(n){n=n||{};const{detectJSON:r}=n,{onerror:s}=n,c=n.enableTypes||["json","form"],p=o(c,"form"),l=o(c,"json"),u=o(c,"text"),d=o(c,"xml");n.detectJSON=void 0,n.onerror=void 0,n.returnRawBody=!0;const f=["application/json","application/json-patch+json","application/vnd.api+json","application/csp-report","application/scim+json"],m=["application/x-www-form-urlencoded"],h=["text/plain"],v=["text/xml","application/xml"],x=a(n,"json"),b=a(n,"form"),y=a(n,"text"),g=a(n,"xml"),w=n.extendTypes||{};return i(f,w.json),i(m,w.form),i(h,w.text),i(v,w.xml),async function(n,a){if(void 0!==n.request.body||n.disableBodyParser)return await a();try{const a=await async function(n){if(l&&(r&&r(n)||function(e,n){"string"==typeof e&&(e=e.replace(/;$/,""));return t.is(e,n)}(n.request.get("content-type"),f)))return await e.json(n,x);if(p&&n.request.is(m))return await e.form(n,b);if(u&&n.request.is(h))return await e.text(n,y)||"";if(d&&n.request.is(v))return await e.text(n,g)||"";return{}}(n);n.request.body="parsed"in a?a.parsed:{},void 0===n.request.rawBody&&(n.request.rawBody=a.raw)}catch(e){if(!s)throw e;s(e,n)}await a()}}}(),vi=D(hi),xi={};function bi(e,...n){return(...t)=>e(...n,...t)}function yi(e){return function(...n){var t=n.pop();return e.call(this,n,t)}}var gi="function"==typeof queueMicrotask&&queueMicrotask,wi="function"==typeof setImmediate&&setImmediate,Si="object"==typeof process&&"function"==typeof process.nextTick;function ki(e){setTimeout(e,0)}function Ei(e){return(n,...t)=>e((()=>n(...t)))}var ji=Ei(gi?queueMicrotask:wi?setImmediate:Si?process.nextTick:ki);function Oi(e){return Ai(e)?function(...n){const t=n.pop();return Ci(e.apply(this,n),t)}:yi((function(n,t){var a;try{a=e.apply(this,n)}catch(e){return t(e)}if(a&&"function"==typeof a.then)return Ci(a,t);t(null,a)}))}function Ci(e,n){return e.then((e=>{_i(n,null,e)}),(e=>{_i(n,e&&(e instanceof Error||e.message)?e:new Error(e))}))}function _i(e,n,t){try{e(n,t)}catch(e){ji((e=>{throw e}),e)}}function Ai(e){return"AsyncFunction"===e[Symbol.toStringTag]}function Fi(e){if("function"!=typeof e)throw new Error("expected a function");return Ai(e)?Oi(e):e}function Ti(e,n){if(n||(n=e.length),!n)throw new Error("arity is undefined");return function(...t){return"function"==typeof t[n-1]?e.apply(this,t):new Promise(((a,i)=>{t[n-1]=(e,...n)=>{if(e)return i(e);a(n.length>1?n:n[0])},e.apply(this,t)}))}}function Pi(e){return function(n,...t){return Ti((function(a){var i=this;return e(n,((e,n)=>{Fi(e).apply(i,t.concat(n))}),a)}))}}function Ni(e,n,t,a){n=n||[];var i=[],o=0,r=Fi(t);return e(n,((e,n,t)=>{var a=o++;r(e,((e,n)=>{i[a]=n,t(e)}))}),(e=>{a(e,i)}))}function Ii(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}const Li={};function Mi(e){function n(...n){if(null!==e){var t=e;e=null,t.apply(this,n)}}return Object.assign(n,e),n}function qi(e){if(Ii(e))return function(e){var n=-1,t=e.length;return function(){return++n<t?{value:e[n],key:n}:null}}(e);var n,t,a,i,o=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return o?function(e){var n=-1;return function(){var t=e.next();return t.done?null:(n++,{value:t.value,key:n})}}(o):(t=(n=e)?Object.keys(n):[],a=-1,i=t.length,function e(){var o=t[++a];return"__proto__"===o?e():a<i?{value:n[o],key:o}:null})}function Di(e){return function(...n){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,n)}}function Bi(e,n,t,a){let i=!1,o=!1,r=!1,s=0,c=0;function p(){s>=n||r||i||(r=!0,e.next().then((({value:e,done:n})=>{if(!o&&!i){if(r=!1,n)return i=!0,void(s<=0&&a(null));s++,t(e,c,l),c++,p()}})).catch(u))}function l(e,n){if(s-=1,!o)return e?u(e):!1===e?(i=!0,void(o=!0)):n===Li||i&&s<=0?(i=!0,a(null)):void p()}function u(e){o||(r=!1,i=!0,a(e))}p()}var Ri=e=>(n,t,a)=>{if(a=Mi(a),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!n)return a(null);if("AsyncGenerator"===n[Symbol.toStringTag])return Bi(n,e,t,a);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(n))return Bi(n[Symbol.asyncIterator](),e,t,a);var i=qi(n),o=!1,r=!1,s=0,c=!1;function p(e,n){if(!r)if(s-=1,e)o=!0,a(e);else if(!1===e)o=!0,r=!0;else{if(n===Li||o&&s<=0)return o=!0,a(null);c||l()}}function l(){for(c=!0;s<e&&!o;){var n=i();if(null===n)return o=!0,void(s<=0&&a(null));s+=1,t(n.value,n.key,Di(p))}c=!1}l()};var zi=Ti((function(e,n,t,a){return Ri(n)(e,Fi(t),a)}),4);function $i(e,n,t){t=Mi(t);var a=0,i=0,{length:o}=e,r=!1;function s(e,n){!1===e&&(r=!0),!0!==r&&(e?t(e):++i!==o&&n!==Li||t(null))}for(0===o&&t(null);a<o;a++)n(e[a],a,Di(s))}function Ui(e,n,t){return zi(e,1/0,n,t)}var Wi=Ti((function(e,n,t){return(Ii(e)?$i:Ui)(e,Fi(n),t)}),3);var Gi=Ti((function(e,n,t){return Ni(Wi,e,n,t)}),3),Hi=Pi(Gi);var Ji=Ti((function(e,n,t){return zi(e,1,n,t)}),3);var Ki=Ti((function(e,n,t){return Ni(Ji,e,n,t)}),3),Vi=Pi(Ki);const Zi=Symbol("promiseCallback");function Qi(){let e,n;function t(t,...a){if(t)return n(t);e(a.length>1?a:a[0])}return t[Zi]=new Promise(((t,a)=>{e=t,n=a})),t}function Yi(e,n,t){"number"!=typeof n&&(t=n,n=null),t=Mi(t||Qi());var a=Object.keys(e).length;if(!a)return t(null);n||(n=a);var i={},o=0,r=!1,s=!1,c=Object.create(null),p=[],l=[],u={};function d(e,n){p.push((()=>function(e,n){if(s)return;var a=Di(((n,...a)=>{if(o--,!1!==n)if(a.length<2&&([a]=a),n){var p={};if(Object.keys(i).forEach((e=>{p[e]=i[e]})),p[e]=a,s=!0,c=Object.create(null),r)return;t(n,p)}else i[e]=a,(c[e]||[]).forEach((e=>e())),f();else r=!0}));o++;var p=Fi(n[n.length-1]);n.length>1?p(i,a):p(a)}(e,n)))}function f(){if(!r){if(0===p.length&&0===o)return t(null,i);for(;p.length&&o<n;){p.shift()()}}}function m(n){var t=[];return Object.keys(e).forEach((a=>{const i=e[a];Array.isArray(i)&&i.indexOf(n)>=0&&t.push(a)})),t}return Object.keys(e).forEach((n=>{var t=e[n];if(!Array.isArray(t))return d(n,[t]),void l.push(n);var a=t.slice(0,t.length-1),i=a.length;if(0===i)return d(n,t),void l.push(n);u[n]=i,a.forEach((o=>{if(!e[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+a.join(", "));!function(e,n){var t=c[e];t||(t=c[e]=[]);t.push(n)}(o,(()=>{0===--i&&d(n,t)}))}))})),function(){var e=0;for(;l.length;)e++,m(l.pop()).forEach((e=>{0==--u[e]&&l.push(e)}));if(e!==a)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),f(),t[Zi]}var Xi=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,eo=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,no=/,/,to=/(=.+)?(\s*)$/;function ao(e,n){var t={};return Object.keys(e).forEach((n=>{var a,i=e[n],o=Ai(i),r=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))a=[...i],i=a.pop(),t[n]=a.concat(a.length>0?s:i);else if(r)t[n]=i;else{if(a=function(e){const n=function(e){let n="",t=0,a=e.indexOf("*/");for(;t<e.length;)if("/"===e[t]&&"/"===e[t+1]){let n=e.indexOf("\n",t);t=-1===n?e.length:n}else if(-1!==a&&"/"===e[t]&&"*"===e[t+1]){let i=e.indexOf("*/",t);-1!==i?(t=i+2,a=e.indexOf("*/",t)):(n+=e[t],t++)}else n+=e[t],t++;return n}(e.toString());let t=n.match(Xi);if(t||(t=n.match(eo)),!t)throw new Error("could not parse args in autoInject\nSource:\n"+n);let[,a]=t;return a.replace(/\s/g,"").split(no).map((e=>e.replace(to,"").trim()))}(i),0===i.length&&!o&&0===a.length)throw new Error("autoInject task functions require explicit parameters.");o||a.pop(),t[n]=a.concat(s)}function s(e,n){var t=a.map((n=>e[n]));t.push(n),Fi(i)(...t)}})),Yi(t,n)}class io{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,n){n.prev=e,n.next=e.next,e.next?e.next.prev=n:this.tail=n,e.next=n,this.length+=1}insertBefore(e,n){n.prev=e.prev,n.next=e,e.prev?e.prev.next=n:this.head=n,e.prev=n,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):oo(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):oo(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var n=this.head;n;){var{next:t}=n;e(n)&&this.removeLink(n),n=t}return this}}function oo(e,n){e.length=1,e.head=e.tail=n}function ro(e,n,t){if(null==n)n=1;else if(0===n)throw new RangeError("Concurrency must not be zero");var a=Fi(e),i=0,o=[];const r={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function s(e,n){return e?n?void(r[e]=r[e].filter((e=>e!==n))):r[e]=[]:Object.keys(r).forEach((e=>r[e]=[]))}function c(e,...n){r[e].forEach((e=>e(...n)))}var p=!1;function l(e,n,t,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");var i,o;function r(e,...n){return e?t?o(e):i():n.length<=1?i(n[0]):void i(n)}h.started=!0;var s=h._createTaskItem(e,t?r:a||r);if(n?h._tasks.unshift(s):h._tasks.push(s),p||(p=!0,ji((()=>{p=!1,h.process()}))),t||!a)return new Promise(((e,n)=>{i=e,o=n}))}function u(e){return function(n,...t){i-=1;for(var a=0,r=e.length;a<r;a++){var s=e[a],p=o.indexOf(s);0===p?o.shift():p>0&&o.splice(p,1),s.callback(n,...t),null!=n&&c("error",n,s.data)}i<=h.concurrency-h.buffer&&c("unsaturated"),h.idle()&&c("drain"),h.process()}}function d(e){return!(0!==e.length||!h.idle())&&(ji((()=>c("drain"))),!0)}const f=e=>n=>{if(!n)return new Promise(((n,t)=>{!function(e,n){const t=(...a)=>{s(e,t),n(...a)};r[e].push(t)}(e,((e,a)=>{if(e)return t(e);n(a)}))}));s(e),function(e,n){r[e].push(n)}(e,n)};var m=!1,h={_tasks:new io,_createTaskItem:(e,n)=>({data:e,callback:n}),*[Symbol.iterator](){yield*h._tasks[Symbol.iterator]()},concurrency:n,payload:t,buffer:n/4,started:!1,paused:!1,push(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!1,n)))}return l(e,!1,!1,n)},pushAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!0,n)))}return l(e,!1,!0,n)},kill(){s(),h._tasks.empty()},unshift(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!1,n)))}return l(e,!0,!1,n)},unshiftAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!0,n)))}return l(e,!0,!0,n)},remove(e){h._tasks.remove(e)},process(){if(!m){for(m=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var e=[],n=[],t=h._tasks.length;h.payload&&(t=Math.min(t,h.payload));for(var r=0;r<t;r++){var s=h._tasks.shift();e.push(s),o.push(s),n.push(s.data)}i+=1,0===h._tasks.length&&c("empty"),i===h.concurrency&&c("saturated");var p=Di(u(e));a(n,p)}m=!1}},length:()=>h._tasks.length,running:()=>i,workersList:()=>o,idle:()=>h._tasks.length+i===0,pause(){h.paused=!0},resume(){!1!==h.paused&&(h.paused=!1,ji(h.process))}};return Object.defineProperties(h,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),h}function so(e,n){return ro(e,1,n)}function co(e,n,t){return ro(e,n,t)}var po=Ti((function(e,n,t,a){a=Mi(a);var i=Fi(t);return Ji(e,((e,t,a)=>{i(n,e,((e,t)=>{n=t,a(e)}))}),(e=>a(e,n)))}),4);function lo(...e){var n=e.map(Fi);return function(...e){var t=this,a=e[e.length-1];return"function"==typeof a?e.pop():a=Qi(),po(n,e,((e,n,a)=>{n.apply(t,e.concat(((e,...n)=>{a(e,n)})))}),((e,n)=>a(e,...n))),a[Zi]}}function uo(...e){return lo(...e.reverse())}var fo=Ti((function(e,n,t,a){return Ni(Ri(n),e,t,a)}),4);var mo=Ti((function(e,n,t,a){var i=Fi(t);return fo(e,n,((e,n)=>{i(e,((e,...t)=>e?n(e):n(e,t)))}),((e,n)=>{for(var t=[],i=0;i<n.length;i++)n[i]&&(t=t.concat(...n[i]));return a(e,t)}))}),4);var ho=Ti((function(e,n,t){return mo(e,1/0,n,t)}),3);var vo=Ti((function(e,n,t){return mo(e,1,n,t)}),3);function xo(...e){return function(...n){return n.pop()(null,...e)}}function bo(e,n){return(t,a,i,o)=>{var r,s=!1;const c=Fi(i);t(a,((t,a,i)=>{c(t,((a,o)=>a||!1===a?i(a):e(o)&&!r?(s=!0,r=n(!0,t),i(null,Li)):void i()))}),(e=>{if(e)return o(e);o(null,s?r:n(!1))}))}}var yo=Ti((function(e,n,t){return bo((e=>e),((e,n)=>n))(Wi,e,n,t)}),3);var go=Ti((function(e,n,t,a){return bo((e=>e),((e,n)=>n))(Ri(n),e,t,a)}),4);var wo=Ti((function(e,n,t){return bo((e=>e),((e,n)=>n))(Ri(1),e,n,t)}),3);function So(e){return(n,...t)=>Fi(n)(...t,((n,...t)=>{"object"==typeof console&&(n?console.error&&console.error(n):console[e]&&t.forEach((n=>console[e](n))))}))}var ko=So("dir");var Eo=Ti((function(e,n,t){t=Di(t);var a,i=Fi(e),o=Fi(n);function r(e,...n){if(e)return t(e);!1!==e&&(a=n,o(...n,s))}function s(e,n){return e?t(e):!1!==e?n?void i(r):t(null,...a):void 0}return s(null,!0)}),3);function jo(e,n,t){const a=Fi(n);return Eo(e,((...e)=>{const n=e.pop();a(...e,((e,t)=>n(e,!t)))}),t)}function Oo(e){return(n,t,a)=>e(n,a)}var Co=Ti((function(e,n,t){return Wi(e,Oo(Fi(n)),t)}),3);var _o=Ti((function(e,n,t,a){return Ri(n)(e,Oo(Fi(t)),a)}),4);var Ao=Ti((function(e,n,t){return _o(e,1,n,t)}),3);function Fo(e){return Ai(e)?e:function(...n){var t=n.pop(),a=!0;n.push(((...e)=>{a?ji((()=>t(...e))):t(...e)})),e.apply(this,n),a=!1}}var To=Ti((function(e,n,t){return bo((e=>!e),(e=>!e))(Wi,e,n,t)}),3);var Po=Ti((function(e,n,t,a){return bo((e=>!e),(e=>!e))(Ri(n),e,t,a)}),4);var No=Ti((function(e,n,t){return bo((e=>!e),(e=>!e))(Ji,e,n,t)}),3);function Io(e,n,t,a){var i=new Array(n.length);e(n,((e,n,a)=>{t(e,((e,t)=>{i[n]=!!t,a(e)}))}),(e=>{if(e)return a(e);for(var t=[],o=0;o<n.length;o++)i[o]&&t.push(n[o]);a(null,t)}))}function Lo(e,n,t,a){var i=[];e(n,((e,n,a)=>{t(e,((t,o)=>{if(t)return a(t);o&&i.push({index:n,value:e}),a(t)}))}),(e=>{if(e)return a(e);a(null,i.sort(((e,n)=>e.index-n.index)).map((e=>e.value)))}))}function Mo(e,n,t,a){return(Ii(n)?Io:Lo)(e,n,Fi(t),a)}var qo=Ti((function(e,n,t){return Mo(Wi,e,n,t)}),3);var Do=Ti((function(e,n,t,a){return Mo(Ri(n),e,t,a)}),4);var Bo=Ti((function(e,n,t){return Mo(Ji,e,n,t)}),3);var Ro=Ti((function(e,n){var t=Di(n),a=Fi(Fo(e));return function e(n){if(n)return t(n);!1!==n&&a(e)}()}),2);var zo=Ti((function(e,n,t,a){var i=Fi(t);return fo(e,n,((e,n)=>{i(e,((t,a)=>t?n(t):n(t,{key:a,val:e})))}),((e,n)=>{for(var t={},{hasOwnProperty:i}=Object.prototype,o=0;o<n.length;o++)if(n[o]){var{key:r}=n[o],{val:s}=n[o];i.call(t,r)?t[r].push(s):t[r]=[s]}return a(e,t)}))}),4);function $o(e,n,t){return zo(e,1/0,n,t)}function Uo(e,n,t){return zo(e,1,n,t)}var Wo=So("log");var Go=Ti((function(e,n,t,a){a=Mi(a);var i={},o=Fi(t);return Ri(n)(e,((e,n,t)=>{o(e,n,((e,a)=>{if(e)return t(e);i[n]=a,t(e)}))}),(e=>a(e,i)))}),4);function Ho(e,n,t){return Go(e,1/0,n,t)}function Jo(e,n,t){return Go(e,1,n,t)}function Ko(e,n=e=>e){var t=Object.create(null),a=Object.create(null),i=Fi(e),o=yi(((e,o)=>{var r=n(...e);r in t?ji((()=>o(null,...t[r]))):r in a?a[r].push(o):(a[r]=[o],i(...e,((e,...n)=>{e||(t[r]=n);var i=a[r];delete a[r];for(var o=0,s=i.length;o<s;o++)i[o](e,...n)})))}));return o.memo=t,o.unmemoized=e,o}var Vo=Ei(Si?process.nextTick:wi?setImmediate:ki),Zo=Ti(((e,n,t)=>{var a=Ii(n)?[]:{};e(n,((e,n,t)=>{Fi(e)(((e,...i)=>{i.length<2&&([i]=i),a[n]=i,t(e)}))}),(e=>t(e,a)))}),3);function Qo(e,n){return Zo(Wi,e,n)}function Yo(e,n,t){return Zo(Ri(n),e,t)}function Xo(e,n){var t=Fi(e);return ro(((e,n)=>{t(e[0],n)}),n,1)}class er{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let n;for(;e>0&&tr(this.heap[e],this.heap[n=nr(e)]);){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}percDown(e){let n;for(;(n=1+(e<<1))<this.heap.length&&(n+1<this.heap.length&&tr(this.heap[n+1],this.heap[n])&&(n+=1),!tr(this.heap[e],this.heap[n]));){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let n=0;for(let t=0;t<this.heap.length;t++)e(this.heap[t])||(this.heap[n]=this.heap[t],n++);this.heap.splice(n);for(let e=nr(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function nr(e){return(e+1>>1)-1}function tr(e,n){return e.priority!==n.priority?e.priority<n.priority:e.pushCount<n.pushCount}function ar(e,n){var t=Xo(e,n),{push:a,pushAsync:i}=t;function o(e,n){return Array.isArray(e)?e.map((e=>({data:e,priority:n}))):{data:e,priority:n}}return t._tasks=new er,t._createTaskItem=({data:e,priority:n},t)=>({data:e,priority:n,callback:t}),t.push=function(e,n=0,t){return a(o(e,n),t)},t.pushAsync=function(e,n=0,t){return i(o(e,n),t)},delete t.unshift,delete t.unshiftAsync,t}var ir=Ti((function(e,n){if(n=Mi(n),!Array.isArray(e))return n(new TypeError("First argument to race must be an array of functions"));if(!e.length)return n();for(var t=0,a=e.length;t<a;t++)Fi(e[t])(n)}),2);function or(e,n,t,a){var i=[...e].reverse();return po(i,n,t,a)}function rr(e){var n=Fi(e);return yi((function(e,t){return e.push(((e,...n)=>{let a={};if(e&&(a.error=e),n.length>0){var i=n;n.length<=1&&([i]=n),a.value=i}t(null,a)})),n.apply(this,e)}))}function sr(e){var n;return Array.isArray(e)?n=e.map(rr):(n={},Object.keys(e).forEach((t=>{n[t]=rr.call(this,e[t])}))),n}function cr(e,n,t,a){const i=Fi(t);return Mo(e,n,((e,n)=>{i(e,((e,t)=>{n(e,!t)}))}),a)}var pr=Ti((function(e,n,t){return cr(Wi,e,n,t)}),3);var lr=Ti((function(e,n,t,a){return cr(Ri(n),e,t,a)}),4);var ur=Ti((function(e,n,t){return cr(Ji,e,n,t)}),3);function dr(e){return function(){return e}}function fr(e,n,t){var a={times:5,intervalFunc:dr(0)};if(arguments.length<3&&"function"==typeof e?(t=n||Qi(),n=e):(!function(e,n){if("object"==typeof n)e.times=+n.times||5,e.intervalFunc="function"==typeof n.interval?n.interval:dr(+n.interval||0),e.errorFilter=n.errorFilter;else{if("number"!=typeof n&&"string"!=typeof n)throw new Error("Invalid arguments for async.retry");e.times=+n||5}}(a,e),t=t||Qi()),"function"!=typeof n)throw new Error("Invalid arguments for async.retry");var i=Fi(n),o=1;return function e(){i(((n,...i)=>{!1!==n&&(n&&o++<a.times&&("function"!=typeof a.errorFilter||a.errorFilter(n))?setTimeout(e,a.intervalFunc(o-1)):t(n,...i))}))}(),t[Zi]}function mr(e,n){n||(n=e,e=null);let t=e&&e.arity||n.length;Ai(n)&&(t+=1);var a=Fi(n);return yi(((n,i)=>{function o(e){a(...n,e)}return(n.length<t-1||null==i)&&(n.push(i),i=Qi()),e?fr(e,o,i):fr(o,i),i[Zi]}))}function hr(e,n){return Zo(Ji,e,n)}var vr=Ti((function(e,n,t){return bo(Boolean,(e=>e))(Wi,e,n,t)}),3);var xr=Ti((function(e,n,t,a){return bo(Boolean,(e=>e))(Ri(n),e,t,a)}),4);var br=Ti((function(e,n,t){return bo(Boolean,(e=>e))(Ji,e,n,t)}),3);var yr=Ti((function(e,n,t){var a=Fi(n);return Gi(e,((e,n)=>{a(e,((t,a)=>{if(t)return n(t);n(t,{value:e,criteria:a})}))}),((e,n)=>{if(e)return t(e);t(null,n.sort(i).map((e=>e.value)))}));function i(e,n){var t=e.criteria,a=n.criteria;return t<a?-1:t>a?1:0}}),3);function gr(e,n,t){var a=Fi(e);return yi(((i,o)=>{var r,s=!1;i.push(((...e)=>{s||(o(...e),clearTimeout(r))})),r=setTimeout((function(){var n=e.name||"anonymous",a=new Error('Callback function "'+n+'" timed out.');a.code="ETIMEDOUT",t&&(a.info=t),s=!0,o(a)}),n),a(...i)}))}function wr(e,n,t,a){var i=Fi(t);return fo(function(e){for(var n=Array(e);e--;)n[e]=e;return n}(e),n,i,a)}function Sr(e,n,t){return wr(e,1/0,n,t)}function kr(e,n,t){return wr(e,1,n,t)}function Er(e,n,t,a){arguments.length<=3&&"function"==typeof n&&(a=t,t=n,n=Array.isArray(e)?[]:{}),a=Mi(a||Qi());var i=Fi(t);return Wi(e,((e,t,a)=>{i(n,e,t,a)}),(e=>a(e,n))),a[Zi]}var jr=Ti((function(e,n){var t,a=null;return Ao(e,((e,n)=>{Fi(e)(((e,...i)=>{if(!1===e)return n(e);i.length<2?[t]=i:t=i,a=e,n(e?null:{})}))}),(()=>n(a,t)))}));function Or(e){return(...n)=>(e.unmemoized||e)(...n)}var Cr=Ti((function(e,n,t){t=Di(t);var a=Fi(n),i=Fi(e),o=[];function r(e,...n){if(e)return t(e);o=n,!1!==e&&i(s)}function s(e,n){return e?t(e):!1!==e?n?void a(r):t(null,...o):void 0}return i(s)}),3);function _r(e,n,t){const a=Fi(e);return Cr((e=>a(((n,t)=>e(n,!t)))),n,t)}var Ar,Fr,Tr,Pr,Nr,Ir=Ti((function(e,n){if(n=Mi(n),!Array.isArray(e))return n(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return n();var t=0;function a(n){Fi(e[t++])(...n,Di(i))}function i(i,...o){if(!1!==i)return i||t===e.length?n(i,...o):void a(o)}a([])})),Lr={apply:bi,applyEach:Hi,applyEachSeries:Vi,asyncify:Oi,auto:Yi,autoInject:ao,cargo:so,cargoQueue:co,compose:uo,concat:ho,concatLimit:mo,concatSeries:vo,constant:xo,detect:yo,detectLimit:go,detectSeries:wo,dir:ko,doUntil:jo,doWhilst:Eo,each:Co,eachLimit:_o,eachOf:Wi,eachOfLimit:zi,eachOfSeries:Ji,eachSeries:Ao,ensureAsync:Fo,every:To,everyLimit:Po,everySeries:No,filter:qo,filterLimit:Do,filterSeries:Bo,forever:Ro,groupBy:$o,groupByLimit:zo,groupBySeries:Uo,log:Wo,map:Gi,mapLimit:fo,mapSeries:Ki,mapValues:Ho,mapValuesLimit:Go,mapValuesSeries:Jo,memoize:Ko,nextTick:Vo,parallel:Qo,parallelLimit:Yo,priorityQueue:ar,queue:Xo,race:ir,reduce:po,reduceRight:or,reflect:rr,reflectAll:sr,reject:pr,rejectLimit:lr,rejectSeries:ur,retry:fr,retryable:mr,seq:lo,series:hr,setImmediate:ji,some:vr,someLimit:xr,someSeries:br,sortBy:yr,timeout:gr,times:Sr,timesLimit:wr,timesSeries:kr,transform:Er,tryEach:jr,unmemoize:Or,until:_r,waterfall:Ir,whilst:Cr,all:To,allLimit:Po,allSeries:No,any:vr,anyLimit:xr,anySeries:br,find:yo,findLimit:go,findSeries:wo,flatMap:ho,flatMapLimit:mo,flatMapSeries:vo,forEach:Co,forEachSeries:Ao,forEachLimit:_o,forEachOf:Wi,forEachOfSeries:Ji,forEachOfLimit:zi,inject:po,foldl:po,foldr:or,select:qo,selectLimit:Do,selectSeries:Bo,wrapSync:Oi,during:Cr,doDuring:Eo},Mr=B(Object.freeze({__proto__:null,all:To,allLimit:Po,allSeries:No,any:vr,anyLimit:xr,anySeries:br,apply:bi,applyEach:Hi,applyEachSeries:Vi,asyncify:Oi,auto:Yi,autoInject:ao,cargo:so,cargoQueue:co,compose:uo,concat:ho,concatLimit:mo,concatSeries:vo,constant:xo,default:Lr,detect:yo,detectLimit:go,detectSeries:wo,dir:ko,doDuring:Eo,doUntil:jo,doWhilst:Eo,during:Cr,each:Co,eachLimit:_o,eachOf:Wi,eachOfLimit:zi,eachOfSeries:Ji,eachSeries:Ao,ensureAsync:Fo,every:To,everyLimit:Po,everySeries:No,filter:qo,filterLimit:Do,filterSeries:Bo,find:yo,findLimit:go,findSeries:wo,flatMap:ho,flatMapLimit:mo,flatMapSeries:vo,foldl:po,foldr:or,forEach:Co,forEachLimit:_o,forEachOf:Wi,forEachOfLimit:zi,forEachOfSeries:Ji,forEachSeries:Ao,forever:Ro,groupBy:$o,groupByLimit:zo,groupBySeries:Uo,inject:po,log:Wo,map:Gi,mapLimit:fo,mapSeries:Ki,mapValues:Ho,mapValuesLimit:Go,mapValuesSeries:Jo,memoize:Ko,nextTick:Vo,parallel:Qo,parallelLimit:Yo,priorityQueue:ar,queue:Xo,race:ir,reduce:po,reduceRight:or,reflect:rr,reflectAll:sr,reject:pr,rejectLimit:lr,rejectSeries:ur,retry:fr,retryable:mr,select:qo,selectLimit:Do,selectSeries:Bo,seq:lo,series:hr,setImmediate:ji,some:vr,someLimit:xr,someSeries:br,sortBy:yr,timeout:gr,times:Sr,timesLimit:wr,timesSeries:kr,transform:Er,tryEach:jr,unmemoize:Or,until:_r,waterfall:Ir,whilst:Cr,wrapSync:Oi})),qr={exports:{}},Dr={exports:{}};function Br(){if(Fr)return Ar;Fr=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=7*a,o=365.25*a;function r(e,n,t,a){var i=n>=1.5*t;return Math.round(e/t)+" "+a+(i?"s":"")}return Ar=function(s,c){c=c||{};var p=typeof s;if("string"===p&&s.length>0)return function(r){if((r=String(r)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*a;case"hours":case"hour":case"hrs":case"hr":case"h":return c*t;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===p&&isFinite(s))return c.long?function(i){var o=Math.abs(i);if(o>=a)return r(i,o,a,"day");if(o>=t)return r(i,o,t,"hour");if(o>=n)return r(i,o,n,"minute");if(o>=e)return r(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=a)return Math.round(i/a)+"d";if(o>=t)return Math.round(i/t)+"h";if(o>=n)return Math.round(i/n)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},Ar}function Rr(){if(Pr)return Tr;return Pr=1,Tr=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Br(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},Tr}var zr,$r,Ur,Wr={exports:{}};function Gr(){return zr||(zr=1,function(e,n){const t=d,a=p;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=Rr()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(Wr,Wr.exports)),Wr.exports}function Hr(){return $r||($r=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?qr.exports=(Nr||(Nr=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=Rr()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Dr,Dr.exports)),Dr.exports):qr.exports=Gr()),qr.exports}var Jr=(Ur||(Ur=1,function(e){const a=n,i=l,o=u,r=t,s=Mr,c=Hr(),p=c("portfinder:testPort"),d=c("portfinder:getPort"),f=c("portfinder:defaultHosts"),m={testPort:function(n,t){function a(){p("done w/ testPort(): OK",n.host,"port",n.port),n.server.removeListener("error",i),n.server.close((function(){p("done w/ testPort(): Server closed",n.host,"port",n.port),t(null,n.port)}))}function i(i){if(p("done w/ testPort(): failed",n.host,"w/ port",n.port,"with error",i.code),n.server.removeListener("listening",a),"EADDRINUSE"!=i.code&&"EACCES"!=i.code)return t(i);const o=e.nextPort(n.port);if(o>e.highestPort)return t(new Error("No open ports available"));m.testPort({port:o,host:n.host,server:n.server},t)}t||(t=n,n={}),n.server=n.server||o.createServer((function(){})),p("entered testPort(): trying",n.host,"port",n.port),n.server.once("error",i),n.server.once("listening",a),n.host?n.server.listen(n.port,n.host):n.server.listen(n.port)}};e.basePort=8e3,e.setBasePort=function(n){e.basePort=n},e.highestPort=65535,e.setHighestPort=function(n){e.highestPort=n},e.basePath="/tmp/portfinder",e.setBasePath=function(n){e.basePath=n},m.getPort=function(n,t){if(n.port=Number(n.port)||Number(n.startPort)||Number(e.basePort),n.host=n.host||null,n.stopPort=Number(n.stopPort)||Number(e.highestPort),!n.startPort){if(n.startPort=n.port,n.startPort<0)return t(Error(`Provided options.port(${n.port}) is less than 0, which are cannot be bound.`));if(n.stopPort<n.startPort)return t(Error(`Provided options.stopPort(${n.stopPort}) is less than options.port(${n.startPort})`))}n.host&&-1===e._defaultHosts.indexOf(n.host)&&e._defaultHosts.push(n.host);const a=[];let i;return s.eachSeries(e._defaultHosts,(function(e,t){return d("in eachSeries() iteration callback: host is",e),m.testPort({host:e,port:n.port},(function(n,o){return n?(d("in eachSeries() iteration callback testPort() callback","with an err:",n.code),i=e,t(n)):(d("in eachSeries() iteration callback testPort() callback","with a success for port",o),a.push(o),t())}))}),(function(o){if(o){if(d("in eachSeries() result callback: err is",o),"EADDRNOTAVAIL"===o.code||"EINVAL"===o.code){if(n.host===i){const e="Provided host "+n.host+" could NOT be bound. Please provide a different host address or hostname";return t(Error(e))}{const a=e._defaultHosts.indexOf(i);return e._defaultHosts.splice(a,1),m.getPort(n,t)}}return t(o)}if(a.sort((function(e,n){return e-n})),d("in eachSeries() result callback: openPorts is",a),a[0]===a[a.length-1]){if(a[0]<=n.stopPort)return t(null,a[0]);{const e="No open ports found in between "+n.startPort+" and "+n.stopPort;return t(Error(e))}}return m.getPort({port:a.pop(),host:n.host,startPort:n.startPort,stopPort:n.stopPort},t)}))},e.getPort=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){m.getPort(e,(function(e,a){if(e)return t(e);n(a)}))}));m.getPort(e,n)},e.getPortPromise=e.getPort,m.getPorts=function(n,t,a){let i=null;s.timesSeries(n,(function(n,a){i&&(t.port=e.nextPort(i)),m.getPort(t,(function(e,n){e?a(e):(i=n,a(null,n))}))}),a)},e.getPorts=function(e,n,t){if("function"==typeof n&&(t=n,n={}),n=n||{},!t)return new Promise((function(t,a){m.getPorts(e,n,(function(e,n){if(e)return a(e);t(n)}))}));m.getPorts(e,n,t)},e.getPortsPromise=e.getPorts,m.getSocket=function(n,t){function i(){a.stat(n.path,(function(a){a?"ENOENT"==a.code?t(null,n.path):t(a):(n.path=e.nextSocket(n.path),m.getSocket(n,t))}))}return n.mod=n.mod||parseInt(755,8),n.path=n.path||e.basePath+".sock",n.exists?i():function(){const e=r.dirname(n.path);a.stat(e,(function(o,r){if(o||!r.isDirectory())return function(e){a.mkdir(e,{mode:n.mod,recursive:!0},(function(e){if(e)return t(e);n.exists=!0,i()}))}(e);n.exists=!0,i()}))}()},e.getSocket=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){m.getSocket(e,(function(e,a){if(e)return t(e);n(a)}))}));m.getSocket(e,n)},e.getSocketPromise=e.getSocket,e.nextPort=function(e){return e+1},e.nextSocket=function(e){const n=r.dirname(e),t=r.basename(e,".sock").match(/^([a-zA-z]+)(\d*)$/i),a=t[1];let i=parseInt(t[2]);return isNaN(i)&&(i=0),i+=1,r.join(n,a+i+".sock")},e._defaultHosts=function(){let e={};try{e=i.networkInterfaces()}catch(e){if("uv_interface_addresses"!==e.syscall)throw e}const n=Object.keys(e),t=["0.0.0.0"];for(let a=0;a<n.length;a++){const i=e[n[a]];for(let e=0;e<i.length;e++){const n=i[e];t.push(n.address)}}return t.push(null),f("exports._defaultHosts is: %o",t),t}()}(xi)),xi),Kr=D(Jr);const Vr=i.prototype.listen,Zr=e=>{const n=e.address();if(n){((e,n)=>{const t=null!==n?`http://${e}:${n}`:e;console.log(`app listen ${t}`)})("object"==typeof n?(e=>"::"===e?"0.0.0.0":e)(n.address):n,"object"==typeof n?n.port:null)}},Qr=(e,n,t,a)=>{const{pathPrefix:i,moduleName:o,name:r}=P(n,"controller"),s=`${i}/${o}`;if(!t)return;const c=F(`${e}${`${i}/${r}`}`);t.forEach((e=>{const{method:n,path:t,handler:o,functionName:r,authRequired:p,middlewares:l}=e;var u;c&&"function"==typeof c[r]&&l.push((u=c[r].bind(c),async(e,n)=>{const t=u(e);t instanceof Promise&&await t,await n()}));const d=(f=p,m=o,async(e,n)=>{let t=a(f,e);return t instanceof Promise&&(t=await t),t?m(e,n):e.throw(403,"无权限")});var f,m;const h=[...l,d],v=Yr(t,s,r,h,n);e.path=v,e.apiPrePath=i}))},Yr=(e,n,t,a,i)=>{const o=`${n}${e}`;if(t===y){const e=`${n}/index`;M[i](e,...a)}return M[i](o,...a),o};var Xr,es,ns,ts={exports:{}},as={exports:{}};function is(){if(es)return Xr;return es=1,Xr=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Br(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},Xr}var os,rs,ss,cs,ps,ls,us={exports:{}};function ds(){return os||(os=1,function(e,n){const t=d,a=p;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=is()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(us,us.exports)),us.exports}function fs(){return rs||(rs=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?ts.exports=(ns||(ns=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")||n.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=is()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(as,as.exports)),as.exports):ts.exports=ds()),ts.exports}function ms(){if(cs)return ss;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return cs=1,ss=function(n){if((n=n||{}).circles)return function(n){const t=[],a=[],i=new Map;if(i.set(Date,(e=>new Date(e))),i.set(Map,((e,n)=>new Map(r(Array.from(e),n)))),i.set(Set,((e,n)=>new Set(r(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)i.set(e[0],e[1]);let o=null;return n.proto?c:s;function r(n,r){const s=Object.keys(n),c=new Array(s.length);for(let p=0;p<s.length;p++){const l=s[p],u=n[l];if("object"!=typeof u||null===u)c[l]=u;else if(u.constructor!==Object&&(o=i.get(u.constructor)))c[l]=o(u,r);else if(ArrayBuffer.isView(u))c[l]=e(u);else{const e=t.indexOf(u);c[l]=-1!==e?a[e]:r(u)}}return c}function s(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,s);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,s);const c={};t.push(n),a.push(c);for(const r in n){if(!1===Object.hasOwnProperty.call(n,r))continue;const p=n[r];if("object"!=typeof p||null===p)c[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))c[r]=o(p,s);else if(ArrayBuffer.isView(p))c[r]=e(p);else{const e=t.indexOf(p);c[r]=-1!==e?a[e]:s(p)}}return t.pop(),a.pop(),c}function c(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,c);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,c);const s={};t.push(n),a.push(s);for(const r in n){const p=n[r];if("object"!=typeof p||null===p)s[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))s[r]=o(p,c);else if(ArrayBuffer.isView(p))s[r]=e(p);else{const e=t.indexOf(p);s[r]=-1!==e?a[e]:c(p)}}return t.pop(),a.pop(),s}}(n);const t=new Map;if(t.set(Date,(e=>new Date(e))),t.set(Map,((e,n)=>new Map(i(Array.from(e),n)))),t.set(Set,((e,n)=>new Set(i(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)t.set(e[0],e[1]);let a=null;return n.proto?function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r}:function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){if(!1===Object.hasOwnProperty.call(o,i))continue;const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r};function i(n,i){const o=Object.keys(n),r=new Array(o.length);for(let s=0;s<o.length;s++){const c=o[s],p=n[c];"object"!=typeof p||null===p?r[c]=p:p.constructor!==Object&&(a=t.get(p.constructor))?r[c]=a(p,i):ArrayBuffer.isView(p)?r[c]=e(p):r[c]=i(p)}return r}},ss}function hs(){if(ls)return ps;ls=1;const e=p,n=fs()("log4js:configuration"),t=[],a=[],i=e=>!e,o=e=>e&&"object"==typeof e&&!Array.isArray(e),r=(n,t,a)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${e.inspect(n,{depth:5})}) - ${a}`)}))};return ps={configure:e=>{n("New configuration to be validated: ",e),r(e,i(o(e)),"must be an object."),n(`Calling pre-processing listeners (${t.length})`),t.forEach((n=>n(e))),n("Configuration pre-processing finished."),n(`Calling configuration listeners (${a.length})`),a.forEach((n=>n(e))),n("Configuration finished.")},addListener:e=>{a.push(e),n(`Added listener, now ${a.length} listeners`)},addPreProcessingListener:e=>{t.push(e),n(`Added pre-processing listener, now ${t.length} listeners`)},throwExceptionIf:r,anObject:o,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:i}}var vs,xs,bs,ys,gs,ws={exports:{}};function Ss(){return vs||(vs=1,function(e){function n(e,n){for(var t=e.toString();t.length<n;)t="0"+t;return t}function t(e){return n(e,2)}function a(a,i){"string"!=typeof a&&(i=a,a=e.exports.ISO8601_FORMAT),i||(i=e.exports.now());var o,r,s,c,p=t(i.getDate()),l=t(i.getMonth()+1),u=t(i.getFullYear()),d=t(u.substring(2,4)),f=a.indexOf("yyyy")>-1?u:d,m=t(i.getHours()),h=t(i.getMinutes()),v=t(i.getSeconds()),x=n(i.getMilliseconds(),3),b=(o=i.getTimezoneOffset(),r=Math.abs(o),s=String(Math.floor(r/60)),c=String(r%60),s=("0"+s).slice(-2),c=("0"+c).slice(-2),0===o?"Z":(o<0?"+":"-")+s+":"+c);return a.replace(/dd/g,p).replace(/MM/g,l).replace(/y{1,4}/g,f).replace(/hh/g,m).replace(/mm/g,h).replace(/ss/g,v).replace(/SSS/g,x).replace(/O/g,b)}function i(e,n,t,a){e["set"+(a?"":"UTC")+n](t)}e.exports=a,e.exports.asString=a,e.exports.parse=function(n,t,a){if(!n)throw new Error("pattern must be supplied");return function(n,t,a){var o=n.indexOf("O")<0,r=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,n){i(e,"FullYear",n,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Month",n-1,o),e.getMonth()!==n-1&&(r=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,n){r&&i(e,"Month",e.getMonth()-1,o),i(e,"Date",n,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Hours",n,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,n){i(e,"Minutes",n,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,n){i(e,"Seconds",n,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,n){i(e,"Milliseconds",n,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,n){n="Z"===n?0:n.replace(":","");var t=Math.abs(n),a=(n>0?-1:1)*(t%100+60*Math.floor(t/100));e.setUTCMinutes(e.getUTCMinutes()+a)}}],c=s.reduce((function(e,n){return n.pattern.test(e.regexp)?(n.index=e.regexp.match(n.pattern).index,e.regexp=e.regexp.replace(n.pattern,"("+n.regexp+")")):n.index=-1,e}),{regexp:n,index:[]}),p=s.filter((function(e){return e.index>-1}));p.sort((function(e,n){return e.index-n.index}));var l=new RegExp(c.regexp).exec(t);if(l){var u=a||e.exports.now();return p.forEach((function(e,n){e.fn(u,l[n+1])})),u}throw new Error("String '"+t+"' could not be parsed as '"+n+"'")}(n,t,a)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(ws)),ws.exports}function ks(){if(bs)return xs;bs=1;const e=Ss(),n=l,a=p,i=t,o=m,r=fs()("log4js:layouts"),s={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function c(e){return e?`[${s[e][0]}m`:""}function u(e){return e?`[${s[e][1]}m`:""}function d(n,t){return i=a.format("[%s] [%s] %s - ",e.asString(n.startTime),n.level.toString(),n.categoryName),c(o=t)+i+u(o);var i,o}function f(e){return d(e)+a.format(...e.data)}function h(e){return d(e,e.level.colour)+a.format(...e.data)}function v(e){return a.format(...e.data)}function x(e){return e.data[0]}function b(t,s){const p=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function l(e){return e&&e.pid?e.pid.toString():process.pid.toString()}t=t||"%r %p %c - %m%n";const d={c:function(e,n){let t=e.categoryName;if(n){const e=parseInt(n,10),a=t.split(".");e<a.length&&(t=a.slice(a.length-e).join("."))}return t},d:function(n,t){let a=e.ISO8601_FORMAT;if(t)switch(a=t,a){case"ISO8601":case"ISO8601_FORMAT":a=e.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":a=e.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),r("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":a=e.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),r("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":a=e.DATETIME_FORMAT}return e.asString(a,n.startTime)},h:function(){return n.hostname().toString()},m:function(e,n){let t=e.data;if(n){const[e,a]=n.split(",");t=t.slice(e,a)}return a.format(...t)},n:function(){return n.EOL},p:function(e){return e.level.toString()},r:function(n){return e.asString("hh:mm:ss",n.startTime)},"[":function(e){return c(e.level.colour)},"]":function(e){return u(e.level.colour)},y:function(){return l()},z:l,"%":function(){return"%"},x:function(e,n){return void 0!==s[n]?"function"==typeof s[n]?s[n](e):s[n]:null},X:function(e,n){const t=e.context[n];return void 0!==t?"function"==typeof t?t(e):t:null},f:function(e,n){let t=e.fileName||"";if(t=function(e){const n="file://";return e.startsWith(n)&&("function"==typeof o.fileURLToPath?e=o.fileURLToPath(e):(e=i.normalize(e.replace(new RegExp(`^${n}`),"")),"win32"===process.platform&&(e=e.startsWith("\\")?e.slice(1):i.sep+i.sep+e))),e}(t),n){const e=parseInt(n,10),a=t.split(i.sep);a.length>e&&(t=a.slice(-e).join(i.sep))}return t},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function f(e,n,t){return d[e](n,t)}function m(e,n,t){let a=e;return a=function(e,n){let t;return e?(t=parseInt(e.slice(1),10),t>0?n.slice(0,t):n.slice(t)):n}(n,a),a=function(e,n){let t;if(e)if("-"===e.charAt(0))for(t=parseInt(e.slice(1),10);n.length<t;)n+=" ";else for(t=parseInt(e,10);n.length<t;)n=` ${n}`;return n}(t,a),a}return function(e){let n,a="",i=t;for(;null!==(n=p.exec(i));){const t=n[1],o=n[2],r=n[3],s=n[5],c=n[6];if(c)a+=c.toString();else{a+=m(f(r,e,s),o,t)}i=i.slice(n.index+n[0].length)}return a}}const y={messagePassThrough:()=>v,basic:()=>f,colored:()=>h,coloured:()=>h,pattern:e=>b(e&&e.pattern,e&&e.tokens),dummy:()=>x};return xs={basicLayout:f,messagePassThroughLayout:v,patternLayout:b,colouredLayout:h,coloredLayout:h,dummyLayout:x,addLayout(e,n){y[e]=n},layout:(e,n)=>y[e]&&y[e](n)}}function Es(){if(gs)return ys;gs=1;const e=hs(),n=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class t{constructor(e,n,t){this.level=e,this.levelStr=n,this.colour=t}toString(){return this.levelStr}static getLevel(e,n){return e?e instanceof t?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),t[e.toString().toUpperCase()]||n):n}static addLevels(e){if(e){Object.keys(e).forEach((n=>{const a=n.toUpperCase();t[a]=new t(e[n].value,a,e[n].colour);const i=t.levels.findIndex((e=>e.levelStr===a));i>-1?t.levels[i]=t[a]:t.levels.push(t[a])})),t.levels.sort(((e,n)=>e.level-n.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level===e.level}}return t.levels=[],t.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),e.addListener((t=>{const a=t.levels;if(a){e.throwExceptionIf(t,e.not(e.anObject(a)),"levels must be an object");Object.keys(a).forEach((i=>{e.throwExceptionIf(t,e.not(e.validIdentifier(i)),`level name "${i}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),e.throwExceptionIf(t,e.not(e.anObject(a[i])),`level "${i}" must be an object`),e.throwExceptionIf(t,e.not(a[i].value),`level "${i}" must have a 'value' property`),e.throwExceptionIf(t,e.not(e.anInteger(a[i].value)),`level "${i}".value must have an integer value`),e.throwExceptionIf(t,e.not(a[i].colour),`level "${i}" must have a 'colour' property`),e.throwExceptionIf(t,e.not(n.indexOf(a[i].colour)>-1),`level "${i}".colour must be one of ${n.join(", ")}`)}))}})),e.addListener((e=>{t.addLevels(e.levels)})),ys=t}var js,Os,Cs,_s,As,Fs={exports:{}},Ts={};function Ps(){if(Cs)return Os;Cs=1;const e=function(){if(js)return Ts;js=1;const{parse:e,stringify:n}=JSON,{keys:t}=Object,a=String,i="string",o={},r="object",s=(e,n)=>n,c=e=>e instanceof a?a(e):e,p=(e,n)=>typeof n===i?new a(n):n,l=(e,n,i,s)=>{const c=[];for(let p=t(i),{length:l}=p,u=0;u<l;u++){const t=p[u],l=i[t];if(l instanceof a){const a=e[l];typeof a!==r||n.has(a)?i[t]=s.call(i,t,a):(n.add(a),i[t]=o,c.push({k:t,a:[e,n,a,s]}))}else i[t]!==o&&(i[t]=s.call(i,t,l))}for(let{length:e}=c,n=0;n<e;n++){const{k:e,a:t}=c[n];i[e]=s.call(i,e,l.apply(null,t))}return i},u=(e,n,t)=>{const i=a(n.push(t)-1);return e.set(t,i),i},d=(n,t)=>{const a=e(n,p).map(c),i=a[0],o=t||s,u=typeof i===r&&i?l(a,new Set,i,o):i;return o.call({"":u},"",u)};Ts.parse=d;const f=(e,t,a)=>{const o=t&&typeof t===r?(e,n)=>""===e||-1<t.indexOf(e)?n:void 0:t||s,c=new Map,p=[],l=[];let d=+u(c,p,o.call({"":e},"",e)),f=!d;for(;d<p.length;)f=!0,l[d]=n(p[d++],m,a);return"["+l.join(",")+"]";function m(e,n){if(f)return f=!f,n;const t=o.call(this,e,n);switch(typeof t){case r:if(null===t)return t;case i:return c.get(t)||u(c,p,t)}return t}};return Ts.stringify=f,Ts.toJSON=n=>e(f(n)),Ts.fromJSON=e=>d(n(e)),Ts}(),n=Es();const t=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const n=this.deMap[e];this.serMap[n]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};class a{constructor(e,n,t,a,i,o){if(this.startTime=new Date,this.categoryName=e,this.data=t,this.level=n,this.context=Object.assign({},a),this.pid=process.pid,this.error=o,void 0!==i){if(!i||"object"!=typeof i||Array.isArray(i))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==i[e]&&(this[e]=i[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return e.stringify(this,((e,n)=>(n instanceof Error&&(n=Object.assign({message:n.message,stack:n.stack},n)),t.serialise(n))))}static deserialise(i){let o;try{const r=e.parse(i,((e,n)=>{if(n&&n.message&&n.stack){const e=new Error(n);Object.keys(n).forEach((t=>{e[t]=n[t]})),n=e}return t.deserialise(n)}));this._getLocationKeys().forEach((e=>{void 0!==r[e]&&(r.location||(r.location={}),r.location[e]=r[e])})),o=new a(r.categoryName,n.getLevel(r.level.levelStr),r.data,r.context,r.location,r.error),o.startTime=new Date(r.startTime),o.pid=r.pid,r.cluster&&(o.cluster=r.cluster)}catch(e){o=new a("log4js",n.ERROR,["Unable to parse log:",i,"because: ",e])}return o}}return Os=a}function Ns(){if(As)return _s;As=1;const e=fs()("log4js:clustering"),n=Ps(),t=hs();let a=!1,i=null;try{i=require("cluster")}catch(n){e("cluster module not present"),a=!0}const o=[];let r=!1,s="NODE_APP_INSTANCE";const c=()=>r&&"0"===process.env[s],p=()=>a||i&&i.isMaster||c(),l=e=>{o.forEach((n=>n(e)))},u=(t,a)=>{if(e("cluster message received from worker ",t,": ",a),t.topic&&t.data&&(a=t,t=void 0),a&&a.topic&&"log4js:message"===a.topic){e("received message: ",a.data);const t=n.deserialise(a.data);l(t)}};return a||t.addListener((n=>{o.length=0,({pm2:r,disableClustering:a,pm2InstanceVar:s="NODE_APP_INSTANCE"}=n),e(`clustering disabled ? ${a}`),e(`cluster.isMaster ? ${i&&i.isMaster}`),e(`pm2 enabled ? ${r}`),e(`pm2InstanceVar = ${s}`),e(`process.env[${s}] = ${process.env[s]}`),r&&process.removeListener("message",u),i&&i.removeListener&&i.removeListener("message",u),a||n.disableClustering?e("Not listening for cluster messages, because clustering disabled."):c()?(e("listening for PM2 broadcast messages"),process.on("message",u)):i&&i.isMaster?(e("listening for cluster messages"),i.on("message",u)):e("not listening for messages, because we are not a master process")})),_s={onlyOnMaster:(e,n)=>p()?e():n,isMaster:p,send:e=>{p()?l(e):(r||(e.cluster={workerId:i.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{o.push(e)}}}var Is,Ls={};function Ms(){if(Is)return Ls;function e(e){if("number"==typeof e&&Number.isInteger(e))return e;const n={K:1024,M:1048576,G:1073741824},t=Object.keys(n),a=e.slice(-1).toLocaleUpperCase(),i=e.slice(0,-1).trim();if(t.indexOf(a)<0||!Number.isInteger(Number(i)))throw Error(`maxLogSize: "${e}" is invalid`);return i*n[a]}function n(n){return function(e,n){const t=Object.assign({},n);return Object.keys(e).forEach((a=>{t[a]&&(t[a]=e[a](n[a]))})),t}({maxLogSize:e},n)}Is=1;const t={dateFile:n,file:n,fileSync:n};return Ls.modifyConfig=e=>t[e.type]?t[e.type](e):e,Ls}var qs,Ds={};function Bs(){if(qs)return Ds;qs=1;const e=console.log.bind(console);return Ds.configure=function(n,t){let a=t.colouredLayout;return n.layout&&(a=t.layout(n.layout.type,n.layout)),function(n,t){return a=>{e(n(a,t))}}(a,n.timezoneOffset)},Ds}var Rs,zs={};function $s(){if(Rs)return zs;return Rs=1,zs.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stdout.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},zs}var Us,Ws={};function Gs(){if(Us)return Ws;return Us=1,Ws.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stderr.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},Ws}var Hs,Js={};var Ks,Vs={};function Zs(){if(Ks)return Vs;Ks=1;const e=fs()("log4js:categoryFilter");return Vs.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return"string"==typeof n&&(n=[n]),a=>{e(`Checking ${a.categoryName} against ${n}`),-1===n.indexOf(a.categoryName)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},Vs}var Qs,Ys={};function Xs(){if(Qs)return Ys;Qs=1;const e=fs()("log4js:noLogFilter");return Ys.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return a=>{e(`Checking data: ${a.data} against filters: ${n}`),"string"==typeof n&&(n=[n]),n=n.filter((e=>null!=e&&""!==e));const i=new RegExp(n.join("|"),"i");(0===n.length||a.data.findIndex((e=>i.test(e)))<0)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},Ys}var ec,nc,tc,ac,ic,oc,rc,sc,cc,pc,lc,uc,dc,fc,mc,hc,vc,xc,bc,yc,gc,wc,Sc,kc,Ec,jc,Oc,Cc,_c,Ac,Fc,Tc,Pc,Nc,Ic,Lc,Mc,qc,Dc,Bc,Rc,zc,$c,Uc,Wc,Gc,Hc,Jc,Kc,Vc,Zc,Qc,Yc,Xc,ep,np,tp,ap,ip,op,rp,sp,cp,pp,lp,up,dp,fp,mp,hp,vp,xp,bp,yp,gp,wp,Sp,kp,Ep,jp,Op,Cp,_p,Ap,Fp,Tp,Pp,Np,Ip,Lp,Mp={},qp={exports:{}},Dp={},Bp={};function Rp(){return ec||(ec=1,Bp.fromCallback=function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((n,t)=>{arguments[arguments.length]=(e,a)=>{if(e)return t(e);n(a)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},Bp.fromPromise=function(e){return Object.defineProperty((function(){const n=arguments[arguments.length-1];if("function"!=typeof n)return e.apply(this,arguments);e.apply(this,arguments).then((e=>n(null,e)),n)}),"name",{value:e.name})}),Bp}function zp(){if(tc)return nc;tc=1;var e=h,n=process.cwd,t=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return t||(t=n.call(process)),t};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(e){t=null,i.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return nc=function(n){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(n){n.lchmod=function(t,a,i){n.open(t,e.O_WRONLY|e.O_SYMLINK,a,(function(e,t){e?i&&i(e):n.fchmod(t,a,(function(e){n.close(t,(function(n){i&&i(e||n)}))}))}))},n.lchmodSync=function(t,a){var i,o=n.openSync(t,e.O_WRONLY|e.O_SYMLINK,a),r=!0;try{i=n.fchmodSync(o,a),r=!1}finally{if(r)try{n.closeSync(o)}catch(e){}else n.closeSync(o)}return i}}(n);n.lutimes||function(n){e.hasOwnProperty("O_SYMLINK")&&n.futimes?(n.lutimes=function(t,a,i,o){n.open(t,e.O_SYMLINK,(function(e,t){e?o&&o(e):n.futimes(t,a,i,(function(e){n.close(t,(function(n){o&&o(e||n)}))}))}))},n.lutimesSync=function(t,a,i){var o,r=n.openSync(t,e.O_SYMLINK),s=!0;try{o=n.futimesSync(r,a,i),s=!1}finally{if(s)try{n.closeSync(r)}catch(e){}else n.closeSync(r)}return o}):n.futimes&&(n.lutimes=function(e,n,t,a){a&&process.nextTick(a)},n.lutimesSync=function(){})}(n);n.chown=o(n.chown),n.fchown=o(n.fchown),n.lchown=o(n.lchown),n.chmod=t(n.chmod),n.fchmod=t(n.fchmod),n.lchmod=t(n.lchmod),n.chownSync=r(n.chownSync),n.fchownSync=r(n.fchownSync),n.lchownSync=r(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=s(n.stat),n.fstat=s(n.fstat),n.lstat=s(n.lstat),n.statSync=c(n.statSync),n.fstatSync=c(n.fstatSync),n.lstatSync=c(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(e,n,t){t&&process.nextTick(t)},n.lchmodSync=function(){});n.chown&&!n.lchown&&(n.lchown=function(e,n,t,a){a&&process.nextTick(a)},n.lchownSync=function(){});"win32"===a&&(n.rename="function"!=typeof n.rename?n.rename:function(e){function t(t,a,i){var o=Date.now(),r=0;e(t,a,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){n.stat(a,(function(n,o){n&&"ENOENT"===n.code?e(t,a,s):i(c)}))}),r),void(r<100&&(r+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.rename));function t(e){return e?function(t,a,i){return e.call(n,t,a,(function(e){p(e)&&(e=null),i&&i.apply(this,arguments)}))}:e}function i(e){return e?function(t,a){try{return e.call(n,t,a)}catch(e){if(!p(e))throw e}}:e}function o(e){return e?function(t,a,i,o){return e.call(n,t,a,i,(function(e){p(e)&&(e=null),o&&o.apply(this,arguments)}))}:e}function r(e){return e?function(t,a,i){try{return e.call(n,t,a,i)}catch(e){if(!p(e))throw e}}:e}function s(e){return e?function(t,a,i){function o(e,n){n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof a&&(i=a,a=null),a?e.call(n,t,a,o):e.call(n,t,o)}:e}function c(e){return e?function(t,a){var i=a?e.call(n,t,a):e.call(n,t);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function p(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}n.read="function"!=typeof n.read?n.read:function(e){function t(t,a,i,o,r,s){var c;if(s&&"function"==typeof s){var p=0;c=function(l,u,d){if(l&&"EAGAIN"===l.code&&p<10)return p++,e.call(n,t,a,i,o,r,c);s.apply(this,arguments)}}return e.call(n,t,a,i,o,r,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.read),n.readSync="function"!=typeof n.readSync?n.readSync:(l=n.readSync,function(e,t,a,i,o){for(var r=0;;)try{return l.call(n,e,t,a,i,o)}catch(e){if("EAGAIN"===e.code&&r<10){r++;continue}throw e}});var l},nc}function $p(){if(cc)return sc;cc=1;var e,t,a=n,i=zp(),o=function(){if(ic)return ac;ic=1;var e=s.Stream;return ac=function(n){return{ReadStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this);var o=this;this.path=a,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var r=Object.keys(i),s=0,c=r.length;s<c;s++){var p=r[s];this[p]=i[p]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?n.open(this.path,this.flags,this.mode,(function(e,n){if(e)return o.emit("error",e),void(o.readable=!1);o.fd=n,o.emit("open",n),o._read()})):process.nextTick((function(){o._read()}))},WriteStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this),this.path=a,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),r=0,s=o.length;r<s;r++){var c=o[r];this[c]=i[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},ac}(),r=function(){if(rc)return oc;rc=1,oc=function(n){if(null===n||"object"!=typeof n)return n;if(n instanceof Object)var t={__proto__:e(n)};else t=Object.create(null);return Object.getOwnPropertyNames(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t};var e=Object.getPrototypeOf||function(e){return e.__proto__};return oc}(),c=p;function l(n,t){Object.defineProperty(n,e,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=Symbol.for("graceful-fs.queue"),t=Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var u,d=function(){};if(c.debuglog?d=c.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(d=function(){var e=c.format.apply(c,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!a[e]){var f=q[e]||[];l(a,f),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||x(),"function"==typeof t&&t.apply(this,arguments)}))}return Object.defineProperty(n,t,{value:e}),n}(a.close),a.closeSync=function(e){function n(n){e.apply(a,arguments),x()}return Object.defineProperty(n,t,{value:e}),n}(a.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){d(a[e]),v.equal(a[e].length,0)}))}function m(e){i(e),e.gracefulify=m,e.createReadStream=function(n,t){return new e.ReadStream(n,t)},e.createWriteStream=function(n,t){return new e.WriteStream(n,t)};var n=e.readFile;e.readFile=function(e,t,a){"function"==typeof t&&(a=t,t=null);return function e(t,a,i,o){return n(t,a,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):h([e,[t,a,i],n,o||Date.now(),Date.now()])}))}(e,t,a)};var t=e.writeFile;e.writeFile=function(e,n,a,i){"function"==typeof a&&(i=a,a=null);return function e(n,a,i,o,r){return t(n,a,i,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,a,i,o],t,r||Date.now(),Date.now()])}))}(e,n,a,i)};var a=e.appendFile;a&&(e.appendFile=function(e,n,t,i){"function"==typeof t&&(i=t,t=null);return function e(n,t,i,o,r){return a(n,t,i,(function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,t,i,o],a,r||Date.now(),Date.now()])}))}(e,n,t,i)});var r=e.copyFile;r&&(e.copyFile=function(e,n,t,a){"function"==typeof t&&(a=t,t=0);return function e(n,t,a,i,o){return r(n,t,a,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)});var s=e.readdir;e.readdir=function(e,n,t){"function"==typeof n&&(t=n,n=null);var a=c.test(process.version)?function(e,n,t,a){return s(e,i(e,n,t,a))}:function(e,n,t,a){return s(e,n,i(e,n,t,a))};return a(e,n,t);function i(e,n,t,i){return function(o,r){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(r&&r.sort&&r.sort(),"function"==typeof t&&t.call(this,o,r)):h([a,[e,n,t],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var p=o(e);v=p.ReadStream,x=p.WriteStream}var l=e.ReadStream;l&&(v.prototype=Object.create(l.prototype),v.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.autoClose&&e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t),e.read())}))});var u=e.WriteStream;u&&(x.prototype=Object.create(u.prototype),x.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return v},set:function(e){v=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var d=v;Object.defineProperty(e,"FileReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var f=x;function v(e,n){return this instanceof v?(l.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(e,n){return this instanceof x?(u.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var b=e.open;function y(e,n,t,a){return"function"==typeof t&&(a=t,t=null),function e(n,t,a,i,o){return b(n,t,a,(function(r,s){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)}return e.open=y,e}function h(n){d("ENQUEUE",n[0].name,n[1]),a[e].push(n),b()}function x(){for(var n=Date.now(),t=0;t<a[e].length;++t)a[e][t].length>2&&(a[e][t][3]=n,a[e][t][4]=n);b()}function b(){if(clearTimeout(u),u=void 0,0!==a[e].length){var n=a[e].shift(),t=n[0],i=n[1],o=n[2],r=n[3],s=n[4];if(void 0===r)d("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-r>=6e4){d("TIMEOUT",t.name,i);var c=i.pop();"function"==typeof c&&c.call(null,o)}else{var p=Date.now()-s,l=Math.max(s-r,1);p>=Math.min(1.2*l,100)?(d("RETRY",t.name,i),t.apply(null,i.concat([r]))):a[e].push(n)}void 0===u&&(u=setTimeout(b,0))}}return q[e]||l(q,a[e]),sc=m(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(sc=m(a),a.__patched=!0),sc}function Up(){return pc||(pc=1,function(e){const n=Rp().fromCallback,t=$p(),a=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof t[e]));Object.keys(t).forEach((n=>{"promises"!==n&&(e[n]=t[n])})),a.forEach((a=>{e[a]=n(t[a])})),e.exists=function(e,n){return"function"==typeof n?t.exists(e,n):new Promise((n=>t.exists(e,n)))},e.read=function(e,n,a,i,o,r){return"function"==typeof r?t.read(e,n,a,i,o,r):new Promise(((r,s)=>{t.read(e,n,a,i,o,((e,n,t)=>{if(e)return s(e);r({bytesRead:n,buffer:t})}))}))},e.write=function(e,n,...a){return"function"==typeof a[a.length-1]?t.write(e,n,...a):new Promise(((i,o)=>{t.write(e,n,...a,((e,n,t)=>{if(e)return o(e);i({bytesWritten:n,buffer:t})}))}))},"function"==typeof t.realpath.native&&(e.realpath.native=n(t.realpath.native))}(Dp)),Dp}function Wp(){if(uc)return lc;uc=1;const e=t;function n(n){return(n=e.normalize(e.resolve(n)).split(e.sep)).length>0?n[0]:null}const a=/[<>:"|?*]/;return lc={getRootPath:n,invalidWin32Path:function(e){const t=n(e);return e=e.replace(t,""),a.test(e)}}}function Gp(){if(xc)return vc;xc=1;const e=(0,Rp().fromCallback)(function(){if(fc)return dc;fc=1;const e=$p(),n=t,a=Wp().invalidWin32Path,i=parseInt("0777",8);return dc=function t(o,r,s,c){if("function"==typeof r?(s=r,r={}):r&&"object"==typeof r||(r={mode:r}),"win32"===process.platform&&a(o)){const e=new Error(o+" contains invalid WIN32 path characters.");return e.code="EINVAL",s(e)}let p=r.mode;const l=r.fs||e;void 0===p&&(p=i&~process.umask()),c||(c=null),s=s||function(){},o=n.resolve(o),l.mkdir(o,p,(e=>{if(!e)return s(null,c=c||o);if("ENOENT"===e.code){if(n.dirname(o)===o)return s(e);t(n.dirname(o),r,((e,n)=>{e?s(e,n):t(o,r,s,n)}))}else l.stat(o,((n,t)=>{n||!t.isDirectory()?s(e,c):s(null,c)}))}))},dc}()),n=function(){if(hc)return mc;hc=1;const e=$p(),n=t,a=Wp().invalidWin32Path,i=parseInt("0777",8);return mc=function t(o,r,s){r&&"object"==typeof r||(r={mode:r});let c=r.mode;const p=r.fs||e;if("win32"===process.platform&&a(o)){const e=new Error(o+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===c&&(c=i&~process.umask()),s||(s=null),o=n.resolve(o);try{p.mkdirSync(o,c),s=s||o}catch(e){if("ENOENT"===e.code){if(n.dirname(o)===o)throw e;s=t(n.dirname(o),r,s),t(o,r,s)}else{let n;try{n=p.statSync(o)}catch(n){throw e}if(!n.isDirectory())throw e}}return s},mc}();return vc={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function Hp(){if(yc)return bc;yc=1;const e=$p(),n=l,a=t;return bc={hasMillisRes:function(t){let i=a.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));i=a.join(n.tmpdir(),i);const o=new Date(1435410243862);e.writeFile(i,"https://github.com/jprichardson/node-fs-extra/pull/141",(n=>{if(n)return t(n);e.open(i,"r+",((n,a)=>{if(n)return t(n);e.futimes(a,o,o,(n=>{if(n)return t(n);e.close(a,(n=>{if(n)return t(n);e.stat(i,((e,n)=>{if(e)return t(e);t(null,n.mtime>1435410243e3)}))}))}))}))}))},hasMillisResSync:function(){let t=a.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));t=a.join(n.tmpdir(),t);const i=new Date(1435410243862);e.writeFileSync(t,"https://github.com/jprichardson/node-fs-extra/pull/141");const o=e.openSync(t,"r+");return e.futimesSync(o,i,i),e.closeSync(o),e.statSync(t).mtime>1435410243e3},timeRemoveMillis:function(e){if("number"==typeof e)return 1e3*Math.floor(e/1e3);if(e instanceof Date)return new Date(1e3*Math.floor(e.getTime()/1e3));throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")},utimesMillis:function(n,t,a,i){e.open(n,"r+",((n,o)=>{if(n)return i(n);e.futimes(o,t,a,(n=>{e.close(o,(e=>{i&&i(n||e)}))}))}))},utimesMillisSync:function(n,t,a){const i=e.openSync(n,"r+");return e.futimesSync(i,t,a),e.closeSync(i)}}}function Jp(){if(wc)return gc;wc=1;const e=$p(),n=t,a=process.versions.node.split("."),i=Number.parseInt(a[0],10),o=Number.parseInt(a[1],10),r=Number.parseInt(a[2],10);function s(){if(i>10)return!0;if(10===i){if(o>5)return!0;if(5===o&&r>=0)return!0}return!1}function c(e,t){const a=n.resolve(e).split(n.sep).filter((e=>e)),i=n.resolve(t).split(n.sep).filter((e=>e));return a.reduce(((e,n,t)=>e&&i[t]===n),!0)}function p(e,n,t){return`Cannot ${t} '${e}' to a subdirectory of itself, '${n}'.`}return gc={checkPaths:function(n,t,a,i){!function(n,t,a){s()?e.stat(n,{bigint:!0},((n,i)=>{if(n)return a(n);e.stat(t,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))})):e.stat(n,((n,i)=>{if(n)return a(n);e.stat(t,((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))}))}(n,t,((e,o)=>{if(e)return i(e);const{srcStat:r,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===r.ino&&s.dev===r.dev?i(new Error("Source and destination must not be the same.")):r.isDirectory()&&c(n,t)?i(new Error(p(n,t,a))):i(null,{srcStat:r,destStat:s})}))},checkPathsSync:function(n,t,a){const{srcStat:i,destStat:o}=function(n,t){let a,i;a=s()?e.statSync(n,{bigint:!0}):e.statSync(n);try{i=s()?e.statSync(t,{bigint:!0}):e.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:a,destStat:null};throw e}return{srcStat:a,destStat:i}}(n,t);if(o&&o.ino&&o.dev&&o.ino===i.ino&&o.dev===i.dev)throw new Error("Source and destination must not be the same.");if(i.isDirectory()&&c(n,t))throw new Error(p(n,t,a));return{srcStat:i,destStat:o}},checkParentPaths:function t(a,i,o,r,c){const l=n.resolve(n.dirname(a)),u=n.resolve(n.dirname(o));if(u===l||u===n.parse(u).root)return c();s()?e.stat(u,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c))):e.stat(u,((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c)))},checkParentPathsSync:function t(a,i,o,r){const c=n.resolve(n.dirname(a)),l=n.resolve(n.dirname(o));if(l===c||l===n.parse(l).root)return;let u;try{u=s()?e.statSync(l,{bigint:!0}):e.statSync(l)}catch(e){if("ENOENT"===e.code)return;throw e}if(u.ino&&u.dev&&u.ino===i.ino&&u.dev===i.dev)throw new Error(p(a,o,r));return t(a,i,l,r)},isSrcSubdir:c},gc}function Kp(){if(jc)return Ec;jc=1;const e=$p(),n=t,a=Gp().mkdirsSync,i=Hp().utimesMillisSync,o=Jp();function r(t,a,i,r){if(!r.filter||r.filter(a,i))return function(t,a,i,r){const p=r.dereference?e.statSync:e.lstatSync,l=p(a);if(l.isDirectory())return function(n,t,a,i,o){if(!t)return function(n,t,a,i){return e.mkdirSync(a),c(t,a,i),e.chmodSync(a,n.mode)}(n,a,i,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`);return c(a,i,o)}(l,t,a,i,r);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return function(n,t,a,i,o){return t?function(n,t,a,i){if(i.overwrite)return e.unlinkSync(a),s(n,t,a,i);if(i.errorOnExist)throw new Error(`'${a}' already exists`)}(n,a,i,o):s(n,a,i,o)}(l,t,a,i,r);if(l.isSymbolicLink())return function(t,a,i,r){let s=e.readlinkSync(a);r.dereference&&(s=n.resolve(process.cwd(),s));if(t){let t;try{t=e.readlinkSync(i)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return e.symlinkSync(s,i);throw n}if(r.dereference&&(t=n.resolve(process.cwd(),t)),o.isSrcSubdir(s,t))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${t}'.`);if(e.statSync(i).isDirectory()&&o.isSrcSubdir(t,s))throw new Error(`Cannot overwrite '${t}' with '${s}'.`);return function(n,t){return e.unlinkSync(t),e.symlinkSync(n,t)}(s,i)}return e.symlinkSync(s,i)}(t,a,i,r)}(t,a,i,r)}function s(n,t,a,o){return"function"==typeof e.copyFileSync?(e.copyFileSync(t,a),e.chmodSync(a,n.mode),o.preserveTimestamps?i(a,n.atime,n.mtime):void 0):function(n,t,a,i){const o=65536,r=(kc?Sc:(kc=1,Sc=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(n){return new Buffer(e)}return new Buffer(e)}))(o),s=e.openSync(t,"r"),c=e.openSync(a,"w",n.mode);let p=0;for(;p<n.size;){const n=e.readSync(s,r,0,o,p);e.writeSync(c,r,0,n),p+=n}i.preserveTimestamps&&e.futimesSync(c,n.atime,n.mtime);e.closeSync(s),e.closeSync(c)}(n,t,a,o)}function c(t,a,i){e.readdirSync(t).forEach((e=>function(e,t,a,i){const s=n.join(t,e),c=n.join(a,e),{destStat:p}=o.checkPathsSync(s,c,"copy");return r(p,s,c,i)}(e,t,a,i)))}return Ec=function(t,i,s){"function"==typeof s&&(s={filter:s}),(s=s||{}).clobber=!("clobber"in s)||!!s.clobber,s.overwrite="overwrite"in s?!!s.overwrite:s.clobber,s.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:c,destStat:p}=o.checkPathsSync(t,i,"copy");return o.checkParentPathsSync(t,c,i,"copy"),function(t,i,o,s){if(s.filter&&!s.filter(i,o))return;const c=n.dirname(o);e.existsSync(c)||a(c);return r(t,i,o,s)}(p,t,i,s)},Ec}function Vp(){return Cc?Oc:(Cc=1,Oc={copySync:Kp()})}function Zp(){if(Ac)return _c;Ac=1;const e=Rp().fromPromise,n=Up();return _c={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function Qp(){if(Tc)return Fc;Tc=1;const e=$p(),n=t,a=Gp().mkdirs,i=Zp().pathExists,o=Hp().utimesMillis,r=Jp();function s(e,t,o,r,s){const c=n.dirname(o);i(c,((n,i)=>n?s(n):i?p(e,t,o,r,s):void a(c,(n=>n?s(n):p(e,t,o,r,s)))))}function c(e,n,t,a,i,o){Promise.resolve(i.filter(t,a)).then((r=>r?e(n,t,a,i,o):o()),(e=>o(e)))}function p(e,n,t,a,i){return a.filter?c(l,e,n,t,a,i):l(e,n,t,a,i)}function l(n,t,a,i,o){(i.dereference?e.stat:e.lstat)(t,((r,s)=>r?o(r):s.isDirectory()?function(n,t,a,i,o,r){if(!t)return function(n,t,a,i,o){e.mkdir(a,(r=>{if(r)return o(r);f(t,a,i,(t=>t?o(t):e.chmod(a,n.mode,o)))}))}(n,a,i,o,r);if(t&&!t.isDirectory())return r(new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`));return f(a,i,o,r)}(s,n,t,a,i,o):s.isFile()||s.isCharacterDevice()||s.isBlockDevice()?function(n,t,a,i,o,r){return t?function(n,t,a,i,o){if(!i.overwrite)return i.errorOnExist?o(new Error(`'${a}' already exists`)):o();e.unlink(a,(e=>e?o(e):u(n,t,a,i,o)))}(n,a,i,o,r):u(n,a,i,o,r)}(s,n,t,a,i,o):s.isSymbolicLink()?h(n,t,a,i,o):void 0))}function u(n,t,a,i,o){return"function"==typeof e.copyFile?e.copyFile(t,a,(e=>e?o(e):d(n,a,i,o))):function(n,t,a,i,o){const r=e.createReadStream(t);r.on("error",(e=>o(e))).once("open",(()=>{const t=e.createWriteStream(a,{mode:n.mode});t.on("error",(e=>o(e))).on("open",(()=>r.pipe(t))).once("close",(()=>d(n,a,i,o)))}))}(n,t,a,i,o)}function d(n,t,a,i){e.chmod(t,n.mode,(e=>e?i(e):a.preserveTimestamps?o(t,n.atime,n.mtime,i):i()))}function f(n,t,a,i){e.readdir(n,((e,o)=>e?i(e):m(o,n,t,a,i)))}function m(e,t,a,i,o){const s=e.pop();return s?function(e,t,a,i,o,s){const c=n.join(a,t),l=n.join(i,t);r.checkPaths(c,l,"copy",((n,t)=>{if(n)return s(n);const{destStat:r}=t;p(r,c,l,o,(n=>n?s(n):m(e,a,i,o,s)))}))}(e,s,t,a,i,o):o()}function h(t,a,i,o,s){e.readlink(a,((a,c)=>a?s(a):(o.dereference&&(c=n.resolve(process.cwd(),c)),t?void e.readlink(i,((a,p)=>a?"EINVAL"===a.code||"UNKNOWN"===a.code?e.symlink(c,i,s):s(a):(o.dereference&&(p=n.resolve(process.cwd(),p)),r.isSrcSubdir(c,p)?s(new Error(`Cannot copy '${c}' to a subdirectory of itself, '${p}'.`)):t.isDirectory()&&r.isSrcSubdir(p,c)?s(new Error(`Cannot overwrite '${p}' with '${c}'.`)):function(n,t,a){e.unlink(t,(i=>i?a(i):e.symlink(n,t,a)))}(c,i,s)))):e.symlink(c,i,s))))}return Fc=function(e,n,t,a){"function"!=typeof t||a?"function"==typeof t&&(t={filter:t}):(a=t,t={}),a=a||function(){},(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),r.checkPaths(e,n,"copy",((i,o)=>{if(i)return a(i);const{srcStat:p,destStat:l}=o;r.checkParentPaths(e,p,n,"copy",(i=>i?a(i):t.filter?c(s,l,e,n,t,a):s(l,e,n,t,a)))}))},Fc}function Yp(){if(Nc)return Pc;Nc=1;const e=Rp().fromCallback;return Pc={copy:e(Qp())}}function Xp(){if(Lc)return Ic;Lc=1;const e=$p(),n=t,a=v,i="win32"===process.platform;function o(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{n[t]=n[t]||e[t],n[t+="Sync"]=n[t]||e[t]})),n.maxBusyTries=n.maxBusyTries||3}function r(e,n,t){let i=0;"function"==typeof n&&(t=n,n={}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a.strictEqual(typeof t,"function","rimraf: callback function required"),a(n,"rimraf: invalid options argument provided"),a.strictEqual(typeof n,"object","rimraf: options should be object"),o(n),s(e,n,(function a(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&i<n.maxBusyTries){i++;return setTimeout((()=>s(e,n,a)),100*i)}"ENOENT"===o.code&&(o=null)}t(o)}))}function s(e,n,t){a(e),a(n),a("function"==typeof t),n.lstat(e,((a,o)=>a&&"ENOENT"===a.code?t(null):a&&"EPERM"===a.code&&i?c(e,n,a,t):o&&o.isDirectory()?l(e,n,a,t):void n.unlink(e,(a=>{if(a){if("ENOENT"===a.code)return t(null);if("EPERM"===a.code)return i?c(e,n,a,t):l(e,n,a,t);if("EISDIR"===a.code)return l(e,n,a,t)}return t(a)}))))}function c(e,n,t,i){a(e),a(n),a("function"==typeof i),t&&a(t instanceof Error),n.chmod(e,438,(a=>{a?i("ENOENT"===a.code?null:t):n.stat(e,((a,o)=>{a?i("ENOENT"===a.code?null:t):o.isDirectory()?l(e,n,t,i):n.unlink(e,i)}))}))}function p(e,n,t){let i;a(e),a(n),t&&a(t instanceof Error);try{n.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw t}try{i=n.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw t}i.isDirectory()?d(e,n,t):n.unlinkSync(e)}function l(e,t,i,o){a(e),a(t),i&&a(i instanceof Error),a("function"==typeof o),t.rmdir(e,(s=>{!s||"ENOTEMPTY"!==s.code&&"EEXIST"!==s.code&&"EPERM"!==s.code?s&&"ENOTDIR"===s.code?o(i):o(s):function(e,t,i){a(e),a(t),a("function"==typeof i),t.readdir(e,((a,o)=>{if(a)return i(a);let s,c=o.length;if(0===c)return t.rmdir(e,i);o.forEach((a=>{r(n.join(e,a),t,(n=>{if(!s)return n?i(s=n):void(0==--c&&t.rmdir(e,i))}))}))}))}(e,t,o)}))}function u(e,n){let t;o(n=n||{}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a(n,"rimraf: missing options"),a.strictEqual(typeof n,"object","rimraf: options should be object");try{t=n.lstatSync(e)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&i&&p(e,n,t)}try{t&&t.isDirectory()?d(e,n,null):n.unlinkSync(e)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return i?p(e,n,t):d(e,n,t);if("EISDIR"!==t.code)throw t;d(e,n,t)}}function d(e,t,o){a(e),a(t),o&&a(o instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw o;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(a(e),a(t),t.readdirSync(e).forEach((a=>u(n.join(e,a),t))),!i){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}return Ic=r,r.sync=u,Ic}function el(){if(qc)return Mc;qc=1;const e=Rp().fromCallback,n=Xp();return Mc={remove:e(n),removeSync:n.sync}}function nl(){if(zc)return Rc;zc=1;const e=Rp().fromCallback,n=t,a=$p(),i=Gp(),o=Zp().pathExists;return Rc={createFile:e((function(e,t){function r(){a.writeFile(e,"",(e=>{if(e)return t(e);t()}))}a.stat(e,((a,s)=>{if(!a&&s.isFile())return t();const c=n.dirname(e);o(c,((e,n)=>e?t(e):n?r():void i.mkdirs(c,(e=>{if(e)return t(e);r()}))))}))})),createFileSync:function(e){let t;try{t=a.statSync(e)}catch(e){}if(t&&t.isFile())return;const o=n.dirname(e);a.existsSync(o)||i.mkdirsSync(o),a.writeFileSync(e,"")}},Rc}function tl(){if(Uc)return $c;Uc=1;const e=Rp().fromCallback,n=t,a=$p(),i=Gp(),o=Zp().pathExists;return $c={createLink:e((function(e,t,r){function s(e,n){a.link(e,n,(e=>{if(e)return r(e);r(null)}))}o(t,((c,p)=>c?r(c):p?r(null):void a.lstat(e,(a=>{if(a)return a.message=a.message.replace("lstat","ensureLink"),r(a);const c=n.dirname(t);o(c,((n,a)=>n?r(n):a?s(e,t):void i.mkdirs(c,(n=>{if(n)return r(n);s(e,t)}))))}))))})),createLinkSync:function(e,t){if(a.existsSync(t))return;try{a.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const o=n.dirname(t);return a.existsSync(o)||i.mkdirsSync(o),a.linkSync(e,t)}},$c}function al(){if(Vc)return Kc;Vc=1;const e=Rp().fromCallback,n=t,a=$p(),i=Gp(),o=i.mkdirs,r=i.mkdirsSync,s=function(){if(Gc)return Wc;Gc=1;const e=t,n=$p(),a=Zp().pathExists;return Wc={symlinkPaths:function(t,i,o){if(e.isAbsolute(t))return n.lstat(t,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),o(e)):o(null,{toCwd:t,toDst:t})));{const r=e.dirname(i),s=e.join(r,t);return a(s,((a,i)=>a?o(a):i?o(null,{toCwd:s,toDst:t}):n.lstat(t,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:t,toDst:e.relative(r,t)})))))}},symlinkPathsSync:function(t,a){let i;if(e.isAbsolute(t)){if(i=n.existsSync(t),!i)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}{const o=e.dirname(a),r=e.join(o,t);if(i=n.existsSync(r),i)return{toCwd:r,toDst:t};if(i=n.existsSync(t),!i)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:e.relative(o,t)}}}}}(),c=s.symlinkPaths,p=s.symlinkPathsSync,l=function(){if(Jc)return Hc;Jc=1;const e=$p();return Hc={symlinkType:function(n,t,a){if(a="function"==typeof t?t:a,t="function"!=typeof t&&t)return a(null,t);e.lstat(n,((e,n)=>{if(e)return a(null,"file");t=n&&n.isDirectory()?"dir":"file",a(null,t)}))},symlinkTypeSync:function(n,t){let a;if(t)return t;try{a=e.lstatSync(n)}catch(e){return"file"}return a&&a.isDirectory()?"dir":"file"}},Hc}(),u=l.symlinkType,d=l.symlinkTypeSync,f=Zp().pathExists;return Kc={createSymlink:e((function(e,t,i,r){r="function"==typeof i?i:r,i="function"!=typeof i&&i,f(t,((s,p)=>s?r(s):p?r(null):void c(e,t,((s,c)=>{if(s)return r(s);e=c.toDst,u(c.toCwd,i,((i,s)=>{if(i)return r(i);const c=n.dirname(t);f(c,((n,i)=>n?r(n):i?a.symlink(e,t,s,r):void o(c,(n=>{if(n)return r(n);a.symlink(e,t,s,r)}))))}))}))))})),createSymlinkSync:function(e,t,i){if(a.existsSync(t))return;const o=p(e,t);e=o.toDst,i=d(o.toCwd,i);const s=n.dirname(t);return a.existsSync(s)||r(s),a.symlinkSync(e,t,i)}},Kc}function il(){if(np)return ep;np=1;const e=Rp().fromCallback,t=function(){if(Xc)return Yc;var e;Xc=1;try{e=$p()}catch(t){e=n}function t(e,n){var t,a="\n";return"object"==typeof n&&null!==n&&(n.spaces&&(t=n.spaces),n.EOL&&(a=n.EOL)),JSON.stringify(e,n?n.replacer:null,t).replace(/\n/g,a)+a}function a(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var i={readFile:function(n,t,i){null==i&&(i=t,t={}),"string"==typeof t&&(t={encoding:t});var o=(t=t||{}).fs||e,r=!0;"throws"in t&&(r=t.throws),o.readFile(n,t,(function(e,o){if(e)return i(e);var s;o=a(o);try{s=JSON.parse(o,t?t.reviver:null)}catch(e){return r?(e.message=n+": "+e.message,i(e)):i(null,null)}i(null,s)}))},readFileSync:function(n,t){"string"==typeof(t=t||{})&&(t={encoding:t});var i=t.fs||e,o=!0;"throws"in t&&(o=t.throws);try{var r=i.readFileSync(n,t);return r=a(r),JSON.parse(r,t.reviver)}catch(e){if(o)throw e.message=n+": "+e.message,e;return null}},writeFile:function(n,a,i,o){null==o&&(o=i,i={});var r=(i=i||{}).fs||e,s="";try{s=t(a,i)}catch(e){return void(o&&o(e,null))}r.writeFile(n,s,i,o)},writeFileSync:function(n,a,i){var o=(i=i||{}).fs||e,r=t(a,i);return o.writeFileSync(n,r,i)}};return Yc=i}();return ep={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function ol(){if(sp)return rp;sp=1;const e=Rp().fromCallback,n=il();return n.outputJson=e(function(){if(ap)return tp;ap=1;const e=t,n=Gp(),a=Zp().pathExists,i=il();return tp=function(t,o,r,s){"function"==typeof r&&(s=r,r={});const c=e.dirname(t);a(c,((e,a)=>e?s(e):a?i.writeJson(t,o,r,s):void n.mkdirs(c,(e=>{if(e)return s(e);i.writeJson(t,o,r,s)}))))},tp}()),n.outputJsonSync=function(){if(op)return ip;op=1;const e=$p(),n=t,a=Gp(),i=il();return ip=function(t,o,r){const s=n.dirname(t);e.existsSync(s)||a.mkdirsSync(s),i.writeJsonSync(t,o,r)},ip}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,rp=n}function rl(){if(pp)return cp;pp=1;const e=$p(),n=t,a=Vp().copySync,i=el().removeSync,o=Gp().mkdirpSync,r=Jp();function s(n,t,o){try{e.renameSync(n,t)}catch(e){if("EXDEV"!==e.code)throw e;return function(e,n,t){const o={overwrite:t,errorOnExist:!0};return a(e,n,o),i(e)}(n,t,o)}}return cp=function(t,a,c){const p=(c=c||{}).overwrite||c.clobber||!1,{srcStat:l}=r.checkPathsSync(t,a,"move");return r.checkParentPathsSync(t,l,a,"move"),o(n.dirname(a)),function(n,t,a){if(a)return i(t),s(n,t,a);if(e.existsSync(t))throw new Error("dest already exists.");return s(n,t,a)}(t,a,p)},cp}function sl(){if(fp)return dp;fp=1;const e=$p(),n=t,a=Yp().copy,i=el().remove,o=Gp().mkdirp,r=Zp().pathExists,s=Jp();function c(n,t,o,r){e.rename(n,t,(e=>e?"EXDEV"!==e.code?r(e):function(e,n,t,o){const r={overwrite:t,errorOnExist:!0};a(e,n,r,(n=>n?o(n):i(e,o)))}(n,t,o,r):r()))}return dp=function(e,t,a,p){"function"==typeof a&&(p=a,a={});const l=a.overwrite||a.clobber||!1;s.checkPaths(e,t,"move",((a,u)=>{if(a)return p(a);const{srcStat:d}=u;s.checkParentPaths(e,d,t,"move",(a=>{if(a)return p(a);o(n.dirname(t),(n=>n?p(n):function(e,n,t,a){if(t)return i(n,(i=>i?a(i):c(e,n,t,a)));r(n,((i,o)=>i?a(i):o?a(new Error("dest already exists.")):c(e,n,t,a)))}(e,t,l,p)))}))}))},dp}function cl(){return bp||(bp=1,function(e){e.exports=Object.assign({},Up(),Vp(),Yp(),function(){if(Bc)return Dc;Bc=1;const e=Rp().fromCallback,n=$p(),a=t,i=Gp(),o=el(),r=e((function(e,t){t=t||function(){},n.readdir(e,((n,r)=>{if(n)return i.mkdirs(e,t);r=r.map((n=>a.join(e,n))),function e(){const n=r.pop();if(!n)return t();o.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function s(e){let t;try{t=n.readdirSync(e)}catch(n){return i.mkdirsSync(e)}t.forEach((n=>{n=a.join(e,n),o.removeSync(n)}))}return Dc={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(Qc)return Zc;Qc=1;const e=nl(),n=tl(),t=al();return Zc={createFile:e.createFile,createFileSync:e.createFileSync,ensureFile:e.createFile,ensureFileSync:e.createFileSync,createLink:n.createLink,createLinkSync:n.createLinkSync,ensureLink:n.createLink,ensureLinkSync:n.createLinkSync,createSymlink:t.createSymlink,createSymlinkSync:t.createSymlinkSync,ensureSymlink:t.createSymlink,ensureSymlinkSync:t.createSymlinkSync}}(),ol(),Gp(),up?lp:(up=1,lp={moveSync:rl()}),function(){if(hp)return mp;hp=1;const e=Rp().fromCallback;return mp={move:e(sl())}}(),function(){if(xp)return vp;xp=1;const e=Rp().fromCallback,n=$p(),a=t,i=Gp(),o=Zp().pathExists;return vp={outputFile:e((function(e,t,r,s){"function"==typeof r&&(s=r,r="utf8");const c=a.dirname(e);o(c,((a,o)=>a?s(a):o?n.writeFile(e,t,r,s):void i.mkdirs(c,(a=>{if(a)return s(a);n.writeFile(e,t,r,s)}))))})),outputFileSync:function(e,...t){const o=a.dirname(e);if(n.existsSync(o))return n.writeFileSync(e,...t);i.mkdirsSync(o),n.writeFileSync(e,...t)}},vp}(),Zp(),el());const a=n;Object.getOwnPropertyDescriptor(a,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>a.promises})}(qp)),qp.exports}function pl(){if(Sp)return wp;Sp=1;const e=fs()("streamroller:fileNameFormatter"),n=t;return wp=({file:t,keepFileExt:a,needsIndex:i,alwaysIncludeDate:o,compress:r,fileNameSep:s})=>{let c=s||".";const p=n.join(t.dir,t.name),l=e=>e+t.ext,u=(e,n,t)=>!i&&t||!n?e:e+c+n,d=(e,n,t)=>(n>0||o)&&t?e+c+t:e,f=(e,n)=>n&&r?e+".gz":e,m=a?[d,u,l,f]:[l,d,u,f];return({date:n,index:t})=>(e(`_formatFileName: date=${n}, index=${t}`),m.reduce(((e,a)=>a(e,t,n)),p))},wp}function ll(){if(Ep)return kp;Ep=1;const e=fs()("streamroller:fileNameParser"),n=Ss();return kp=({file:t,keepFileExt:a,pattern:i,fileNameSep:o})=>{let r=o||".";const s="__NOT_MATCHING__";let c=[(n,t)=>n.endsWith(".gz")?(e("it is gzipped"),t.isCompressed=!0,n.slice(0,-3)):n,a?n=>n.startsWith(t.name)&&n.endsWith(t.ext)?(e("it starts and ends with the right things"),n.slice(t.name.length+1,-1*t.ext.length)):s:n=>n.startsWith(t.base)?(e("it starts with the right things"),n.slice(t.base.length+1)):s,i?(t,a)=>{const o=t.split(r);let s=o[o.length-1];e("items: ",o,", indexStr: ",s);let c=t;void 0!==s&&s.match(/^\d+$/)?(c=t.slice(0,-1*(s.length+1)),e(`dateStr is ${c}`),i&&!c&&(c=s,s="0")):s="0";try{const e=n.parse(i,c,new Date(0,0));return n.asString(i,e)!==c?t:(a.index=parseInt(s,10),a.date=c,a.timestamp=e.getTime(),"")}catch(n){return e(`Problem parsing ${c} as ${i}, error was: `,n),t}}:(n,t)=>n.match(/^\d+$/)?(e("it has an index"),t.index=parseInt(n,10),""):n];return e=>{let n={filename:e,index:0,isCompressed:!1};return c.reduce(((e,t)=>t(e,n)),e)?null:n}},kp}function ul(){if(Op)return jp;Op=1;const e=fs()("streamroller:moveAndMaybeCompressFile"),n=cl(),t=c;return jp=async(a,i,o)=>{if(o=function(n){const t={mode:parseInt("0600",8),compress:!1},a=Object.assign({},t,n);return e(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(a)}`),a}(o),a!==i){if(await n.pathExists(a))if(e(`moveAndMaybeCompressFile: moving file from ${a} to ${i} ${o.compress?"with":"without"} compress`),o.compress)await new Promise(((r,s)=>{let c=!1;const p=n.createWriteStream(i,{mode:o.mode,flags:"wx"}).on("open",(()=>{c=!0;const i=n.createReadStream(a).on("open",(()=>{i.pipe(t.createGzip()).pipe(p)})).on("error",(n=>{e(`moveAndMaybeCompressFile: error reading ${a}`,n),p.destroy(n)}))})).on("finish",(()=>{e(`moveAndMaybeCompressFile: finished compressing ${i}, deleting ${a}`),n.unlink(a).then(r).catch((t=>{e(`moveAndMaybeCompressFile: error deleting ${a}, truncating instead`,t),n.truncate(a).then(r).catch((n=>{e(`moveAndMaybeCompressFile: error truncating ${a}`,n),s(n)}))}))})).on("error",(t=>{c?(e(`moveAndMaybeCompressFile: error writing ${i}, deleting`,t),n.unlink(i).then((()=>{s(t)})).catch((n=>{e(`moveAndMaybeCompressFile: error deleting ${i}`,n),s(n)}))):(e(`moveAndMaybeCompressFile: error creating ${i}`,t),s(t))}))})).catch((()=>{}));else{e(`moveAndMaybeCompressFile: renaming ${a} to ${i}`);try{await n.move(a,i,{overwrite:!0})}catch(t){if(e(`moveAndMaybeCompressFile: error renaming ${a} to ${i}`,t),"ENOENT"!==t.code){e("moveAndMaybeCompressFile: trying copy+truncate instead");try{await n.copy(a,i,{overwrite:!0}),await n.truncate(a)}catch(n){e("moveAndMaybeCompressFile: error copy+truncate",n)}}}}}else e("moveAndMaybeCompressFile: source and target are the same, not doing anything")},jp}function dl(){if(_p)return Cp;_p=1;const e=fs()("streamroller:RollingFileWriteStream"),n=cl(),a=t,i=l,o=gp?yp:(gp=1,yp=()=>new Date),r=Ss(),{Writable:c}=s,p=pl(),u=ll(),d=ul();return Cp=class extends c{constructor(n,t){if(e(`constructor: creating RollingFileWriteStream. path=${n}`),"string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",i.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=a.parse(n),""===this.fileObject.dir&&(this.fileObject=a.parse(a.join(process.cwd(),n))),this.fileFormatter=p({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=u({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=r(this.options.pattern,o())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),e(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{const e=n.statSync(this.filename);this.state.currentSize=e.size,this.options.pattern&&(this.state.currentDate=r(this.options.pattern,e.mtime))}catch(e){return}}_parseOption(n){const t={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},a=Object.assign({},t,n);if(a.maxSize){if(a.maxSize<=0)throw new Error(`options.maxSize (${a.maxSize}) should be > 0`)}else delete a.maxSize;if(a.numBackups||0===a.numBackups){if(a.numBackups<0)throw new Error(`options.numBackups (${a.numBackups}) should be >= 0`);if(a.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${a.numBackups}) should be < Number.MAX_SAFE_INTEGER`);a.numToKeep=a.numBackups+1}else if(a.numToKeep<=0)throw new Error(`options.numToKeep (${a.numToKeep}) should be > 0`);return e(`_parseOption: creating stream with option=${JSON.stringify(a)}`),a}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(n,t,a){this._shouldRoll().then((()=>{e(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${n}`),this.currentFileStream.write(n,t,(e=>{this.state.currentSize+=n.length,a(e)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(e(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==r(this.options.pattern,o())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return e("_roll: closing the current stream"),new Promise(((e,n)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(n)}))}))}async _moveOldFiles(){const n=await this._getExistingFiles();for(let t=(this.state.currentDate?n.filter((e=>e.date===this.state.currentDate)):n).length;t>=0;t--){e(`_moveOldFiles: i = ${t}`);const n=this.fileFormatter({date:this.state.currentDate,index:t}),a=this.fileFormatter({date:this.state.currentDate,index:t+1}),i={compress:this.options.compress&&0===t,mode:this.options.mode};await d(n,a,i)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?r(this.options.pattern,o()):null,e(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,n)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(n)}))}))}async _getExistingFiles(){const t=await n.readdir(this.fileObject.dir).catch((()=>[]));e(`_getExistingFiles: files=${t}`);const a=t.map((e=>this.fileNameParser(e))).filter((e=>e)),i=e=>(e.timestamp?e.timestamp:o().getTime())-e.index;return a.sort(((e,n)=>i(e)-i(n))),a}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return n.mkdirSync(e,{recursive:!0})}catch(i){if("ENOENT"===i.code)return t(a.dirname(e)),t(e);if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(n.statSync(e).isDirectory())return e;throw i}catch(e){throw i}}};t(this.fileObject.dir);const i={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var o,r;n.appendFileSync(e,"",(o={...i},r="flags",o["flag"]=o[r],delete o[r],o)),this.currentFileStream=n.createWriteStream(e,i),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const t=await this._getExistingFiles();if(e(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),e("_clean: existing files are: ",t),this._tooManyFiles(t.length)){const o=t.slice(0,t.length-this.options.numToKeep).map((e=>a.format({dir:this.fileObject.dir,base:e.filename})));await(i=o,e(`deleteFiles: files to delete: ${i}`),Promise.all(i.map((t=>n.unlink(t).catch((n=>{e(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${n}`)}))))))}var i}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}},Cp}function fl(){if(Fp)return Ap;Fp=1;const e=dl();return Ap=class extends e{constructor(e,n,t,a){a||(a={}),n&&(a.maxSize=n),a.numBackups||0===a.numBackups||(t||0===t||(t=1),a.numBackups=t),super(e,a),this.backups=a.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}}}function ml(){if(Pp)return Tp;Pp=1;const e=dl();return Tp=class extends e{constructor(e,n,t){n&&"object"==typeof n&&(t=n,n=null),t||(t={}),n||(n="yyyy-MM-dd"),t.pattern=n,t.numBackups||0===t.numBackups?t.daysToKeep=t.numBackups:(t.daysToKeep||0===t.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):t.daysToKeep=1,t.numBackups=t.daysToKeep),super(e,t),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}}function hl(){return Ip?Np:(Ip=1,Np={RollingFileWriteStream:dl(),RollingFileStream:fl(),DateRollingFileStream:ml()})}function vl(){if(Lp)return Mp;Lp=1;const e=fs()("log4js:file"),n=t,a=hl(),i=l,o=i.EOL;let r=!1;const s=new Set;function c(){s.forEach((e=>{e.sighupHandler()}))}return Mp.configure=function(t,p){let l=p.basicLayout;return t.layout&&(l=p.layout(t.layout.type,t.layout)),t.mode=t.mode||384,function(t,p,l,u,d,f){if("string"!=typeof t||0===t.length)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(n.sep))throw new Error(`Filename is a directory: ${t}`);function m(e,n,t,i){const o=new a.RollingFileStream(e,n,t,i);return o.on("error",(n=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,n)})),o.on("drain",(()=>{process.emit("log4js:pause",!1)})),o}0===t.indexOf(`~${n.sep}`)&&(t=t.replace("~",i.homedir())),t=n.normalize(t),e("Creating file appender (",t,", ",l,", ",u=u||0===u?u:5,", ",d,", ",f,")");let h=m(t,l,u,d);const v=function(e){if(h.writable){if(!0===d.removeColor){const n=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(n,""):e))}h.write(p(e,f)+o,"utf8")||process.emit("log4js:pause",!0)}};return v.reopen=function(){h.end((()=>{h=m(t,l,u,d)}))},v.sighupHandler=function(){e("SIGHUP handler called."),v.reopen()},v.shutdown=function(e){s.delete(v),0===s.size&&r&&(process.removeListener("SIGHUP",c),r=!1),h.end("","utf-8",e)},s.add(v),r||(process.on("SIGHUP",c),r=!0),v}(t.filename,l,t.maxLogSize,t.backups,t,t.timezoneOffset)},Mp}var xl,bl={};function yl(){if(xl)return bl;xl=1;const e=hl(),n=l.EOL;function t(t,a,i,o,r){o.maxSize=o.maxLogSize;const s=function(n,t,a){const i=new e.DateRollingFileStream(n,t,a);return i.on("error",(e=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",n,e)})),i.on("drain",(()=>{process.emit("log4js:pause",!1)})),i}(t,a,o),c=function(e){s.writable&&(s.write(i(e,r)+n,"utf8")||process.emit("log4js:pause",!0))};return c.shutdown=function(e){s.end("","utf-8",e)},c}return bl.configure=function(e,n){let a=n.basicLayout;return e.layout&&(a=n.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,t(e.filename,e.pattern,a,e,e.timezoneOffset)},bl}var gl,wl={};function Sl(){if(gl)return wl;gl=1;const e=fs()("log4js:fileSync"),a=t,i=n,o=l,r=o.EOL;function s(e,n){const t=e=>{try{return i.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(a.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(i.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(a.dirname(e)),i.appendFileSync(e,"",{mode:n.mode,flag:n.flags})}class c{constructor(n,t,a,o){if(e("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=n,this.size=t,this.backups=a,this.options=o,this.currentSize=0,this.currentSize=function(e){let n=0;try{n=i.statSync(e).size}catch(n){s(e,o)}return n}(this.filename)}shouldRoll(){return e("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(n){const t=this,o=new RegExp(`^${a.basename(n)}`);function r(e){return o.test(e)}function s(e){return parseInt(e.slice(`${a.basename(n)}.`.length),10)||0}function c(e,n){return s(e)-s(n)}function p(o){const r=s(o);if(e(`Index of ${o} is ${r}`),0===t.backups)i.truncateSync(n,0);else if(r<t.backups){try{i.unlinkSync(`${n}.${r+1}`)}catch(e){}e(`Renaming ${o} -> ${n}.${r+1}`),i.renameSync(a.join(a.dirname(n),o),`${n}.${r+1}`)}}e("Rolling, rolling, rolling"),e("Renaming the old files"),i.readdirSync(a.dirname(n)).filter(r).sort(c).reverse().forEach(p)}write(n,t){const a=this;e("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),e("writing the chunk to the file"),a.currentSize+=n.length,i.appendFileSync(a.filename,n)}}return wl.configure=function(n,t){let p=t.basicLayout;n.layout&&(p=t.layout(n.layout.type,n.layout));const l={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return function(n,t,p,l,u,d){if("string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",o.homedir())),n=a.normalize(n),e("Creating fileSync appender (",n,", ",p,", ",l=l||0===l?l:5,", ",u,", ",d,")");const f=function(e,n,t){let a;var o;return n?a=new c(e,n,t,u):(s(o=e,u),a={write(e){i.appendFileSync(o,e)}}),a}(n,p,l);return e=>{f.write(t(e,d)+r)}}(n.filename,p,n.maxLogSize,n.backups,l,n.timezoneOffset)},wl}var kl,El,jl={};function Ol(){if(kl)return jl;kl=1;const e=fs()("log4js:tcp"),n=u;return jl.configure=function(t,a){e(`configure with config = ${t}`);let i=function(e){return e.serialise()};return t.layout&&(i=a.layout(t.layout.type,t.layout)),function(t,a){let i=!1;const o=[];let r,s=3,c="__LOG4JS__";function p(n){e("Writing log event to socket"),i=r.write(`${a(n)}${c}`,"utf8")}function l(){let n;for(e("emptying buffer");n=o.shift();)p(n)}function u(n){i?p(n):(e("buffering log event because it cannot write at the moment"),o.push(n))}return function a(){e(`appender creating socket to ${t.host||"localhost"}:${t.port||5e3}`),c=`${t.endMsg||"__LOG4JS__"}`,r=n.createConnection(t.port||5e3,t.host||"localhost"),r.on("connect",(()=>{e("socket connected"),l(),i=!0})),r.on("drain",(()=>{e("drain event received, emptying buffer"),i=!0,l()})),r.on("timeout",r.end.bind(r)),r.on("error",(n=>{e("connection error",n),i=!1,l()})),r.on("close",a)}(),u.shutdown=function(n){e("shutdown called"),o.length&&s?(e("buffer has items, waiting 100ms to empty"),s-=1,setTimeout((()=>{u.shutdown(n)}),100)):(r.removeAllListeners("close"),r.end(n))},u}(t,i)},jl}function Cl(){if(El)return Fs.exports;El=1;const e=t,n=fs()("log4js:appenders"),a=hs(),i=Ns(),o=Es(),r=ks(),s=Ms(),c=new Map;c.set("console",Bs()),c.set("stdout",$s()),c.set("stderr",Gs()),c.set("logLevelFilter",(Hs||(Hs=1,Js.configure=function(e,n,t,a){const i=t(e.appender);return function(e,n,t,a){const i=a.getLevel(e),o=a.getLevel(n,a.FATAL);return e=>{const n=e.level;i.isLessThanOrEqualTo(n)&&o.isGreaterThanOrEqualTo(n)&&t(e)}}(e.level,e.maxLevel,i,a)}),Js)),c.set("categoryFilter",Zs()),c.set("noLogFilter",Xs()),c.set("file",vl()),c.set("dateFile",yl()),c.set("fileSync",Sl()),c.set("tcp",Ol());const l=new Map,u=(e,t)=>{let i;try{const t=`${e}.cjs`;i=require.resolve(t),n("Loading module from ",t)}catch(t){i=e,n("Loading module from ",e)}try{return function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(i)}catch(n){return void a.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},d=new Set,f=(e,t)=>{if(l.has(e))return l.get(e);if(!t.appenders[e])return!1;if(d.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);d.add(e),n(`Creating appender ${e}`);const a=m(e,t);return d.delete(e),l.set(e,a),a},m=(t,l)=>{const d=l.appenders[t],m=d.type.configure?d.type:((n,t)=>c.get(n)||u(`./${n}`,t)||u(n,t)||require.main&&require.main.filename&&u(e.join(e.dirname(require.main.filename),n),t)||u(e.join(process.cwd(),n),t))(d.type,l);return a.throwExceptionIf(l,a.not(m),`appender "${t}" is not valid (type "${d.type}" could not be found)`),m.appender&&(process.emitWarning(`Appender ${d.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),n("[log4js-node-DEP0001]",`DEPRECATION: Appender ${d.type} exports an appender function.`)),m.shutdown&&(process.emitWarning(`Appender ${d.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),n("[log4js-node-DEP0002]",`DEPRECATION: Appender ${d.type} exports a shutdown function.`)),n(`${t}: clustering.isMaster ? ${i.isMaster()}`),n(`${t}: appenderModule is ${p.inspect(m)}`),i.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${t} / ${d.type}`),m.configure(s.modifyConfig(d),r,(e=>f(e,l)),o))),(()=>{}))},h=e=>{if(l.clear(),d.clear(),!e)return;const n=[];Object.values(e.categories).forEach((e=>{n.push(...e.appenders)})),Object.keys(e.appenders).forEach((t=>{(n.includes(t)||"tcp-server"===e.appenders[t].type||"multiprocess"===e.appenders[t].type)&&f(t,e)}))},v=()=>{h()};return v(),a.addListener((e=>{a.throwExceptionIf(e,a.not(a.anObject(e.appenders)),'must have a property "appenders" of type object.');const n=Object.keys(e.appenders);a.throwExceptionIf(e,a.not(n.length),"must define at least one appender."),n.forEach((n=>{a.throwExceptionIf(e,a.not(e.appenders[n].type),`appender "${n}" is not valid (must be an object with property "type")`)}))})),a.addListener(h),Fs.exports=l,Fs.exports.init=v,Fs.exports}var _l,Al,Fl,Tl,Pl,Nl,Il,Ll,Ml,ql={exports:{}};function Dl(){return _l||(_l=1,function(e){const n=fs()("log4js:categories"),t=hs(),a=Es(),i=Cl(),o=new Map;function r(e,n,t){if(!1===n.inherit)return;const a=t.lastIndexOf(".");if(a<0)return;const i=t.slice(0,a);let o=e.categories[i];o||(o={inherit:!0,appenders:[]}),r(e,o,i),!e.categories[i]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[i]=o),n.appenders=n.appenders||[],n.level=n.level||o.level,o.appenders.forEach((e=>{n.appenders.includes(e)||n.appenders.push(e)})),n.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((n=>{const t=e.categories[n];r(e,t,n)}))}t.addPreProcessingListener((e=>s(e))),t.addListener((e=>{t.throwExceptionIf(e,t.not(t.anObject(e.categories)),'must have a property "categories" of type object.');const n=Object.keys(e.categories);t.throwExceptionIf(e,t.not(n.length),"must define at least one category."),n.forEach((n=>{const o=e.categories[n];t.throwExceptionIf(e,[t.not(o.appenders),t.not(o.level)],`category "${n}" is not valid (must be an object with properties "appenders" and "level")`),t.throwExceptionIf(e,t.not(Array.isArray(o.appenders)),`category "${n}" is not valid (appenders must be an array of appender names)`),t.throwExceptionIf(e,t.not(o.appenders.length),`category "${n}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&t.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${n}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((a=>{t.throwExceptionIf(e,t.not(i.get(a)),`category "${n}" is not valid (appender "${a}" is not defined)`)})),t.throwExceptionIf(e,t.not(a.getLevel(o.level)),`category "${n}" is not valid (level "${o.level}" not recognised; valid levels are ${a.levels.join(", ")})`)})),t.throwExceptionIf(e,t.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((t=>{const r=e.categories[t],s=[];r.appenders.forEach((e=>{s.push(i.get(e)),n(`Creating category ${t}`),o.set(t,{appenders:s,level:a.getLevel(r.level),enableCallStack:r.enableCallStack||!1})}))}))},p=()=>{c()};p(),t.addListener(c);const l=e=>{if(n(`configForCategory: searching for config for ${e}`),o.has(e))return n(`configForCategory: ${e} exists in config, returning it`),o.get(e);let t;return e.indexOf(".")>0?(n(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),n("configForCategory: cloning default category"),t={...o.get("default")}),o.set(e,t),t};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{l(e).level=n},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,n)=>{l(e).enableCallStack=n},init:p})}(ql)),ql.exports}function Bl(){if(Pl)return Tl;Pl=1;const e=Es();function n(e){return e.originalUrl||e.url}function t(e,n){for(let t=0;t<n.length;t++)e=e.replace(n[t].token,n[t].replacement);return e}return Tl=function(a,i){i="string"==typeof i||"function"==typeof i?{format:i}:i||{};const o=a;let r=e.getLevel(i.level,e.INFO);const s=i.format||':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';return(a,c,p)=>{if(void 0!==a._logging)return p();if("function"!=typeof i.nolog){const e=function(e){let n=null;if(e instanceof RegExp&&(n=e),"string"==typeof e&&(n=new RegExp(e)),Array.isArray(e)){const t=e.map((e=>e.source?e.source:e));n=new RegExp(t.join("|"))}return n}(i.nolog);if(e&&e.test(a.originalUrl))return p()}if(o.isLevelEnabled(r)||"auto"===i.level){const p=new Date,{writeHead:l}=c;a._logging=!0,c.writeHead=(e,n)=>{c.writeHead=l,c.writeHead(e,n),c.__statusCode=e,c.__headers=n||{}};let u=!1;const d=()=>{if(u)return;if(u=!0,"function"==typeof i.nolog&&!0===i.nolog(a,c))return void(a._logging=!1);c.responseTime=new Date-p,c.statusCode&&"auto"===i.level&&(r=e.INFO,c.statusCode>=300&&(r=e.WARN),c.statusCode>=400&&(r=e.ERROR)),r=function(n,t,a){let i=t;if(a){const t=a.find((e=>{let t=!1;return t=e.from&&e.to?n>=e.from&&n<=e.to:-1!==e.codes.indexOf(n),t}));t&&(i=e.getLevel(t.level,i))}return i}(c.statusCode,r,i.statusRules);const l=function(e,t,a){const i=[];return i.push({token:":url",replacement:n(e)}),i.push({token:":protocol",replacement:e.protocol}),i.push({token:":hostname",replacement:e.hostname}),i.push({token:":method",replacement:e.method}),i.push({token:":status",replacement:t.__statusCode||t.statusCode}),i.push({token:":response-time",replacement:t.responseTime}),i.push({token:":date",replacement:(new Date).toUTCString()}),i.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),i.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),i.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),i.push({token:":user-agent",replacement:e.headers["user-agent"]}),i.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),i.push({token:/:req\[([^\]]+)]/g,replacement:(n,t)=>e.headers[t.toLowerCase()]}),i.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const n=e.concat();for(let e=0;e<n.length;++e)for(let t=e+1;t<n.length;++t)n[e].token==n[t].token&&n.splice(t--,1);return n})(a.concat(i))}(a,c,i.tokens||[]);if(i.context&&o.addContext("res",c),"function"==typeof s){const e=s(a,c,(e=>t(e,l)));e&&o.log(r,e)}else o.log(r,t(s,l));i.context&&o.removeContext("res")};c.on("end",d),c.on("finish",d),c.on("error",d),c.on("close",d)}return p()}}}function Rl(){if(Il)return Nl;Il=1;const e=fs()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return Nl={configure:function(){return function(t){e(`received logEvent, number of events now ${n.length+1}`),e("log event was ",t),n.push(t)}},replay:t,playback:t,reset:a,erase:a}}var zl=function(){if(Ml)return Ll;Ml=1;const e=fs()("log4js:main"),t=n,a=ms()({proto:!0}),i=hs(),o=ks(),r=Es(),s=Cl(),c=Dl(),p=function(){if(Fl)return Al;Fl=1;const e=fs()("log4js:logger"),n=Ps(),t=Es(),a=Ns(),i=Dl(),o=hs(),r=/^(?:\s*)at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/;function s(e,n=4){try{const t=e.stack.split("\n").slice(n);if(!t.length)return null;const a=r.exec(t[0]);if(a&&5===a.length){let e="",n="",i="";return a[1]&&""!==a[1]&&([n,i]=a[1].replace(/[[\]]/g,"").split(" as "),i=i||"",n.includes(".")&&([e,n]=n.split("."))),{fileName:a[2],lineNumber:parseInt(a[3],10),columnNumber:parseInt(a[4],10),callStack:t.join("\n"),className:e,functionName:n,functionAlias:i,callerName:a[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}class c{constructor(n){if(!n)throw new Error("No category provided.");this.category=n,this.context={},this.callStackSkipIndex=0,this.parseCallStack=s,e(`Logger created (${this.category}, ${this.level})`)}get level(){return t.getLevel(i.getLevelForCategory(this.category),t.OFF)}set level(e){i.setLevelForCategory(this.category,t.getLevel(e,this.level))}get useCallStack(){return i.getEnableCallStackForCategory(this.category)}set useCallStack(e){i.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...n){const a=t.getLevel(e);a?this.isLevelEnabled(a)&&this._log(a,n):o.validIdentifier(e)&&n.length>0?(this.log(t.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(t.INFO,`[${e}]`,...n)):this.log(t.INFO,e,...n)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(t,i){e(`sending log data (${t}) to appenders`);const o=i.find((e=>e instanceof Error));let r;if(this.useCallStack){try{o&&(r=this.parseCallStack(o,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const s=new n(this.category,t,i,this.context,r,o);a.send(s)}addContext(e,n){this.context[e]=n}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=s}}}function p(e){const n=t.getLevel(e),a=n.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),i=a[0].toUpperCase()+a.slice(1);c.prototype[`is${i}Enabled`]=function(){return this.isLevelEnabled(n)},c.prototype[a]=function(...e){this.log(n,...e)}}return t.levels.forEach(p),o.addListener((()=>{t.levels.forEach(p)})),Al=c}(),l=Ns(),u=Bl(),d=Rl();let f=!1;function m(n){if(!f)return;e("Received log event ",n);c.appendersForCategory(n.categoryName).forEach((e=>{e(n)}))}function h(n){f&&v();let o=n;return"string"==typeof o&&(o=function(n){e(`Loading configuration from ${n}`);try{return JSON.parse(t.readFileSync(n,"utf8"))}catch(e){throw new Error(`Problem reading config from file "${n}". Error was ${e.message}`,e)}}(n)),e(`Configuration is ${o}`),i.configure(a(o)),l.onMessage(m),f=!0,x}function v(n=()=>{}){if("function"!=typeof n)throw new TypeError("Invalid callback passed to shutdown");e("Shutdown called. Disabling all log writing."),f=!1;const t=Array.from(s.values());s.init(),c.init();const a=t.reduce(((e,n)=>n.shutdown?e+1:e),0);0===a&&(e("No appenders with shutdown functions found."),n());let i,o=0;function r(t){i=i||t,o+=1,e(`Appender shutdowns complete: ${o} / ${a}`),o>=a&&(e("All shutdown functions completed."),n(i))}e(`Found ${a} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(r)))}const x={getLogger:function(e){return f||h(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new p(e||"default")},configure:h,isConfigured:function(){return f},shutdown:v,connectLogger:u,levels:r,addLayout:o.addLayout,recording:function(){return d}};return Ll=x}(),$l=D(zl);var Ul=function(e){var n=Object.prototype.hasOwnProperty;function t(e,a){return Array.isArray(e)?function(e,n){for(var a,i="",o="",s=Array.isArray(n),c=0;c<e.length;c++)(a=t(e[c]))&&(s&&n[c]&&(a=r(a)),i=i+o+a,o=" ");return i}(e,a):e&&"object"==typeof e?function(e){var t="",a="";for(var i in e)i&&e[i]&&n.call(e,i)&&(t=t+a+i,a=" ");return t}(e):e||""}function a(e){if(!e)return"";if("object"==typeof e){var t="";for(var a in e)n.call(e,a)&&(t=t+a+":"+e[a]+";");return t}return e+""}function i(e,n,t,a){return!1!==n&&null!=n&&(n||"class"!==e&&"style"!==e)?!0===n?" "+(a?e:e+'="'+e+'"'):("function"==typeof n.toJSON&&(n=n.toJSON()),"string"==typeof n||(n=JSON.stringify(n),t||-1===n.indexOf('"'))?(t&&(n=r(n))," "+e+'="'+n+'"'):" "+e+"='"+n.replace(/'/g,"&#39;")+"'"):""}e.merge=function e(n,t){if(1===arguments.length){for(var i=n[0],o=1;o<n.length;o++)i=e(i,n[o]);return i}for(var r in t)if("class"===r){var s=n[r]||[];n[r]=(Array.isArray(s)?s:[s]).concat(t[r]||[])}else if("style"===r){s=(s=a(n[r]))&&";"!==s[s.length-1]?s+";":s;var c=a(t[r]);c=c&&";"!==c[c.length-1]?c+";":c,n[r]=s+c}else n[r]=t[r];return n},e.classes=t,e.style=a,e.attr=i,e.attrs=function(e,o){var r="";for(var s in e)if(n.call(e,s)){var c=e[s];if("class"===s){r=i(s,c=t(c),!1,o)+r;continue}"style"===s&&(c=a(c)),r+=i(s,c,!1,o)}return r};var o=/["&<>]/;function r(e){var n=""+e,t=o.exec(n);if(!t)return e;var a,i,r,s="";for(a=t.index,i=0;a<n.length;a++){switch(n.charCodeAt(a)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}i!==a&&(s+=n.substring(i,a)),i=a+1,s+=r}return i!==a?s+n.substring(i,a):s}return e.escape=r,e.rethrow=function e(n,t,a,i){if(!(n instanceof Error))throw n;if(!("undefined"==typeof window&&t||i))throw n.message+=" on line "+a,n;try{i=i||require("fs").readFileSync(t,"utf8")}catch(t){e(n,null,a)}var o=3,r=i.split("\n"),s=Math.max(a-o,0),c=Math.min(r.length,a+o);o=r.slice(s,c).map((function(e,n){var t=n+s+1;return(t==a?" > ":" ")+t+"| "+e})).join("\n");throw n.path=t,n.message=(t||"Pug")+":"+a+"\n"+o+"\n\n"+n.message,n},e}({});function Wl(e){var n,t,a="";try{var i={},o=e||{};(function(e,t){a+="<!DOCTYPE html>",a+="\n<html>",a+="\n <head>",a+="\n <title>",a+="API Documentation</title>",a+="\n <style>\n ",a+="body { font-family: Arial, sans-serif; margin: 20px; }",a+="\n ",a+="",a+="\n ",a+="h1 { color: #333; text-align: center; }",a+="\n ",a+="h2 { color: #333333 }",a+="\n ",a+="h3 { cursor: pointer; transition: color 0.3s; }",a+="\n ",a+="h3 { color: #007BFF; }",a+="\n ",a+="h3:hover { color: #0056b3; }",a+="\n ",a+="",a+="\n ",a+=".api-section { ",a+="\n ",a+=" margin: 20px 0; ",a+="\n ",a+=" border: 1px solid #e0e0e0; ",a+="\n ",a+=" border-radius: 8px; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" background-color: #f9f9f9; ",a+="\n ",a+=" box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1); ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".api-method { font-weight: bold; color: #333; }",a+="\n ",a+=".api-path { font-style: italic; color: #555; }",a+="\n ",a+="",a+="\n ",a+="pre { ",a+="\n ",a+=" background: #f4f4f4; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" border-radius: 5px; ",a+="\n ",a+=" overflow-x: auto; ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".collapse { display: none; }",a+="\n ",a+="\n </style>\n </head>",a+="\n <body>",a+="\n <h1>",a+="API Documentation</h1>",a+="\n \x3c!-- 添加 JavaScript 用于折叠 Sections--\x3e",a+="\n <script>\n ",a+="document.addEventListener('DOMContentLoaded', function() {",a+="\n ",a+=" const headings = document.querySelectorAll('.toggle');",a+="\n ",a+=" headings.forEach(heading => {",a+="\n ",a+=" heading.addEventListener('click', function() {",a+="\n ",a+=" // 找到 h3 后面的 collapse 元素",a+="\n ",a+=" let content = heading.nextElementSibling;",a+="\n ",a+=" if(!(content && content.classList.contains('collapse'))) {",a+="\n ",a+=" content = content.nextElementSibling;",a+="\n ",a+=" }",a+="\n ",a+=" if (content && content.classList.contains('collapse')) {",a+="\n ",a+=' content.style.display = (content.style.display === "block") ? "none" : "block";',a+="\n ",a+=" }",a+="\n ",a+=" });",a+="\n ",a+=" });",a+="\n ",a+="});",a+="\n ",a+="\n <\/script>",function(){var i=t;if("number"==typeof i.length)for(var o=0,r=i.length;o<r;o++){var s=i[o];a=(a+="\n <h2>")+Ul.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}else{r=0;for(var o in i){r++;s=i[o];a=(a+="\n <h2>")+Ul.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}}}.call(this),a+="\n </body>\n</html>"}).call(this,"JSON"in o?o.JSON:"undefined"!=typeof JSON?JSON:void 0,"apiData"in o?o.apiData:"undefined"!=typeof apiData?apiData:void 0)}catch(e){Ul.rethrow(e,t,undefined,i[void 0])}return a}const Gl={DOCUMENTATION_DIR:t.join(process.cwd(),"doc")},Hl=(e,n)=>{const t=F(e.wholePath),a=t.prototype,i=Object.getOwnPropertyNames(a).filter((e=>"function"==typeof a[e]&&"constructor"!==e)),o=e.path.substring(e.path.indexOf("doc")+3),r=i.map((e=>{if("function"==typeof a[e]){const n=a[e]();return n.path=o+n.path,n}return null})).filter((e=>!!e));let s="";if(r[0]?.path){const e=r[0].path.lastIndexOf("/");e>-1&&(s=r[0].path.substring(0,e))}return{configs:r,desc:t.desc,name:t.name,pathPrefix:n,apiPrePath:s}};(()=>{const e=process.env.NODE_ENV||"production",a=_();let i=t.resolve(a,"env");switch(function(e){try{return n.statSync(e).isDirectory()}catch(e){return e.code,!1}}(i)||(i=t.resolve(a,"..","env")),console.log("load env path: ",i),f.config({path:t.resolve(i,".common.env")}),e){case"development":f.config({path:t.resolve(i,".development.env")});break;case"test":f.config({path:t.resolve(i,".test.env")});break;case"production":f.config({path:t.resolve(i,".production.env")})}})();exports.AuthRouter=function(e,n){return S(e,n,!0)},exports.BaseException=C,exports.INDEX_ROUTE=y,exports.Router=function(e,n){return S(e,n)},exports.contextStore=k,exports.errorRsp=O,exports.getCurrentContext=E,exports.getSrcModulePaths=A,exports.initializeKoaApp=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:a,registerHighPriorityMiddleware:o,registerHook:r,log4:s=!1,runtimeLog:c=!0}=e,p=n||new i;var l;return p.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?$l.configure({appenders:{console:{type:"console"},file:{type:"dateFile",filename:"logs/app.log",pattern:".yyyy-MM-dd",compress:!0,numBackups:7,alwaysIncludePattern:!0}},categories:{default:{appenders:["console","file"],level:"info"}}}):e($l)})(s),p.context.hook=r,p.context.runtimeLog=c,p.use((l=a,async(e,n)=>{try{await n()}catch(n){e.hook?.(e,"error"),l?l(n,e):O(500,{message:n.message})}})),p.use(I),o?.(p),p.use(L),e.corsMiddleware&&p.use(e.corsMiddleware),p.use(vi()),(e=>{const{controllerModule:n,validateModule:t}=A();console.log("load controller path: ",n),T(n,(n=>{if(!n.path.includes("controller"))return;const a=F(n.wholePath),i=a?.routesMap;i&&Qr(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t),p.context.validated={params:{},get:{},post:{}},"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||M.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return T(Gl.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=P(n,"doc");e.push(Hl(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),Wl({apiData:Array.from(n.entries())})})();e.body=n})),M.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),p.use(M.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>Zr(t)))}const t=await Kr.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?Vr.apply(e,[t]):Vr.apply(e,n);return a.on("listening",(()=>Zr(a))),a}})(p),[p,M]},exports.successRsp=e=>{const n=Array.isArray(e?.data);j({success:!0,message:e?.message,data:n?{list:e?.data}:e?.data})},exports.unSuccessRsp=e=>{j({success:!1,errorCode:e?.code,errorMessage:e?.message,data:e?.data})};
39
+ */var hi=function(){if(ya)return ba;ya=1;const e=mi(),n=function(){if(xa)return va;xa=1;var e=Array.prototype.slice;function n(e,t){if(!(this instanceof n))return new n(e,t);this.src=e,this._withAccess=t}function t(e,n){return void 0===e[n]&&void 0===e.__lookupGetter__(n)&&void 0===e.__lookupSetter__(n)}return va=n,n.prototype.withAccess=function(e){return this._withAccess=!1!==e,this},n.prototype.pick=function(n){return Array.isArray(n)||(n=e.call(arguments)),n.length&&(this.keys=n),this},n.prototype.to=function(e){if(e=e||{},!this.src)return e;var n=this.keys||Object.keys(this.src);if(!this._withAccess){for(var a=0;a<n.length;a++)void 0===e[i=n[a]]&&(e[i]=this.src[i]);return e}for(a=0;a<n.length;a++){var i=n[a];if(t(e,i)){var o=this.src.__lookupGetter__(i),r=this.src.__lookupSetter__(i);o&&e.__defineGetter__(i,o),r&&e.__defineSetter__(i,r),o||r||(e[i]=this.src[i])}}return e},n.prototype.toCover=function(e){for(var n=this.keys||Object.keys(this.src),t=0;t<n.length;t++){var a=n[t];delete e[a];var i=this.src.__lookupGetter__(a),o=this.src.__lookupSetter__(a);i&&e.__defineGetter__(a,i),o&&e.__defineSetter__(a,o),i||o||(e[a]=this.src[a])}},n.prototype.override=n.prototype.toCover,n.prototype.and=function(e){var n={};return this.to(n),this.src=e,this.to(n),this.src=n,this},va}(),t=Y();function a(e,t){const a={};return n(e).to(a),a.limit=e[t+"Limit"],a}function i(e,n){n&&(Array.isArray(n)||(n=[n]),n.forEach((function(n){e.push(n)})))}function o(e,n){return e.includes(n)}return ba=function(n){n=n||{};const{detectJSON:r}=n,{onerror:s}=n,c=n.enableTypes||["json","form"],p=o(c,"form"),l=o(c,"json"),u=o(c,"text"),d=o(c,"xml");n.detectJSON=void 0,n.onerror=void 0,n.returnRawBody=!0;const f=["application/json","application/json-patch+json","application/vnd.api+json","application/csp-report","application/scim+json"],m=["application/x-www-form-urlencoded"],h=["text/plain"],v=["text/xml","application/xml"],x=a(n,"json"),b=a(n,"form"),y=a(n,"text"),g=a(n,"xml"),w=n.extendTypes||{};return i(f,w.json),i(m,w.form),i(h,w.text),i(v,w.xml),async function(n,a){if(void 0!==n.request.body||n.disableBodyParser)return await a();try{const a=await async function(n){if(l&&(r&&r(n)||function(e,n){"string"==typeof e&&(e=e.replace(/;$/,""));return t.is(e,n)}(n.request.get("content-type"),f)))return await e.json(n,x);if(p&&n.request.is(m))return await e.form(n,b);if(u&&n.request.is(h))return await e.text(n,y)||"";if(d&&n.request.is(v))return await e.text(n,g)||"";return{}}(n);n.request.body="parsed"in a?a.parsed:{},void 0===n.request.rawBody&&(n.request.rawBody=a.raw)}catch(e){if(!s)throw e;s(e,n)}await a()}}}(),vi=D(hi),xi={};function bi(e,...n){return(...t)=>e(...n,...t)}function yi(e){return function(...n){var t=n.pop();return e.call(this,n,t)}}var gi="function"==typeof queueMicrotask&&queueMicrotask,wi="function"==typeof setImmediate&&setImmediate,Si="object"==typeof process&&"function"==typeof process.nextTick;function ki(e){setTimeout(e,0)}function Ei(e){return(n,...t)=>e((()=>n(...t)))}var ji=Ei(gi?queueMicrotask:wi?setImmediate:Si?process.nextTick:ki);function Oi(e){return Ai(e)?function(...n){const t=n.pop();return Ci(e.apply(this,n),t)}:yi((function(n,t){var a;try{a=e.apply(this,n)}catch(e){return t(e)}if(a&&"function"==typeof a.then)return Ci(a,t);t(null,a)}))}function Ci(e,n){return e.then((e=>{_i(n,null,e)}),(e=>{_i(n,e&&(e instanceof Error||e.message)?e:new Error(e))}))}function _i(e,n,t){try{e(n,t)}catch(e){ji((e=>{throw e}),e)}}function Ai(e){return"AsyncFunction"===e[Symbol.toStringTag]}function Fi(e){if("function"!=typeof e)throw new Error("expected a function");return Ai(e)?Oi(e):e}function Ti(e,n){if(n||(n=e.length),!n)throw new Error("arity is undefined");return function(...t){return"function"==typeof t[n-1]?e.apply(this,t):new Promise(((a,i)=>{t[n-1]=(e,...n)=>{if(e)return i(e);a(n.length>1?n:n[0])},e.apply(this,t)}))}}function Pi(e){return function(n,...t){return Ti((function(a){var i=this;return e(n,((e,n)=>{Fi(e).apply(i,t.concat(n))}),a)}))}}function Ni(e,n,t,a){n=n||[];var i=[],o=0,r=Fi(t);return e(n,((e,n,t)=>{var a=o++;r(e,((e,n)=>{i[a]=n,t(e)}))}),(e=>{a(e,i)}))}function Ii(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}const Li={};function Mi(e){function n(...n){if(null!==e){var t=e;e=null,t.apply(this,n)}}return Object.assign(n,e),n}function qi(e){if(Ii(e))return function(e){var n=-1,t=e.length;return function(){return++n<t?{value:e[n],key:n}:null}}(e);var n,t,a,i,o=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return o?function(e){var n=-1;return function(){var t=e.next();return t.done?null:(n++,{value:t.value,key:n})}}(o):(t=(n=e)?Object.keys(n):[],a=-1,i=t.length,function e(){var o=t[++a];return"__proto__"===o?e():a<i?{value:n[o],key:o}:null})}function Di(e){return function(...n){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,n)}}function Bi(e,n,t,a){let i=!1,o=!1,r=!1,s=0,c=0;function p(){s>=n||r||i||(r=!0,e.next().then((({value:e,done:n})=>{if(!o&&!i){if(r=!1,n)return i=!0,void(s<=0&&a(null));s++,t(e,c,l),c++,p()}})).catch(u))}function l(e,n){if(s-=1,!o)return e?u(e):!1===e?(i=!0,void(o=!0)):n===Li||i&&s<=0?(i=!0,a(null)):void p()}function u(e){o||(r=!1,i=!0,a(e))}p()}var Ri=e=>(n,t,a)=>{if(a=Mi(a),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!n)return a(null);if("AsyncGenerator"===n[Symbol.toStringTag])return Bi(n,e,t,a);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(n))return Bi(n[Symbol.asyncIterator](),e,t,a);var i=qi(n),o=!1,r=!1,s=0,c=!1;function p(e,n){if(!r)if(s-=1,e)o=!0,a(e);else if(!1===e)o=!0,r=!0;else{if(n===Li||o&&s<=0)return o=!0,a(null);c||l()}}function l(){for(c=!0;s<e&&!o;){var n=i();if(null===n)return o=!0,void(s<=0&&a(null));s+=1,t(n.value,n.key,Di(p))}c=!1}l()};var zi=Ti((function(e,n,t,a){return Ri(n)(e,Fi(t),a)}),4);function $i(e,n,t){t=Mi(t);var a=0,i=0,{length:o}=e,r=!1;function s(e,n){!1===e&&(r=!0),!0!==r&&(e?t(e):++i!==o&&n!==Li||t(null))}for(0===o&&t(null);a<o;a++)n(e[a],a,Di(s))}function Ui(e,n,t){return zi(e,1/0,n,t)}var Wi=Ti((function(e,n,t){return(Ii(e)?$i:Ui)(e,Fi(n),t)}),3);var Gi=Ti((function(e,n,t){return Ni(Wi,e,n,t)}),3),Hi=Pi(Gi);var Ji=Ti((function(e,n,t){return zi(e,1,n,t)}),3);var Ki=Ti((function(e,n,t){return Ni(Ji,e,n,t)}),3),Vi=Pi(Ki);const Zi=Symbol("promiseCallback");function Qi(){let e,n;function t(t,...a){if(t)return n(t);e(a.length>1?a:a[0])}return t[Zi]=new Promise(((t,a)=>{e=t,n=a})),t}function Yi(e,n,t){"number"!=typeof n&&(t=n,n=null),t=Mi(t||Qi());var a=Object.keys(e).length;if(!a)return t(null);n||(n=a);var i={},o=0,r=!1,s=!1,c=Object.create(null),p=[],l=[],u={};function d(e,n){p.push((()=>function(e,n){if(s)return;var a=Di(((n,...a)=>{if(o--,!1!==n)if(a.length<2&&([a]=a),n){var p={};if(Object.keys(i).forEach((e=>{p[e]=i[e]})),p[e]=a,s=!0,c=Object.create(null),r)return;t(n,p)}else i[e]=a,(c[e]||[]).forEach((e=>e())),f();else r=!0}));o++;var p=Fi(n[n.length-1]);n.length>1?p(i,a):p(a)}(e,n)))}function f(){if(!r){if(0===p.length&&0===o)return t(null,i);for(;p.length&&o<n;){p.shift()()}}}function m(n){var t=[];return Object.keys(e).forEach((a=>{const i=e[a];Array.isArray(i)&&i.indexOf(n)>=0&&t.push(a)})),t}return Object.keys(e).forEach((n=>{var t=e[n];if(!Array.isArray(t))return d(n,[t]),void l.push(n);var a=t.slice(0,t.length-1),i=a.length;if(0===i)return d(n,t),void l.push(n);u[n]=i,a.forEach((o=>{if(!e[o])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+o+"` in "+a.join(", "));!function(e,n){var t=c[e];t||(t=c[e]=[]);t.push(n)}(o,(()=>{0===--i&&d(n,t)}))}))})),function(){var e=0;for(;l.length;)e++,m(l.pop()).forEach((e=>{0==--u[e]&&l.push(e)}));if(e!==a)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),f(),t[Zi]}var Xi=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,eo=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,no=/,/,to=/(=.+)?(\s*)$/;function ao(e,n){var t={};return Object.keys(e).forEach((n=>{var a,i=e[n],o=Ai(i),r=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))a=[...i],i=a.pop(),t[n]=a.concat(a.length>0?s:i);else if(r)t[n]=i;else{if(a=function(e){const n=function(e){let n="",t=0,a=e.indexOf("*/");for(;t<e.length;)if("/"===e[t]&&"/"===e[t+1]){let n=e.indexOf("\n",t);t=-1===n?e.length:n}else if(-1!==a&&"/"===e[t]&&"*"===e[t+1]){let i=e.indexOf("*/",t);-1!==i?(t=i+2,a=e.indexOf("*/",t)):(n+=e[t],t++)}else n+=e[t],t++;return n}(e.toString());let t=n.match(Xi);if(t||(t=n.match(eo)),!t)throw new Error("could not parse args in autoInject\nSource:\n"+n);let[,a]=t;return a.replace(/\s/g,"").split(no).map((e=>e.replace(to,"").trim()))}(i),0===i.length&&!o&&0===a.length)throw new Error("autoInject task functions require explicit parameters.");o||a.pop(),t[n]=a.concat(s)}function s(e,n){var t=a.map((n=>e[n]));t.push(n),Fi(i)(...t)}})),Yi(t,n)}class io{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,n){n.prev=e,n.next=e.next,e.next?e.next.prev=n:this.tail=n,e.next=n,this.length+=1}insertBefore(e,n){n.prev=e.prev,n.next=e,e.prev?e.prev.next=n:this.head=n,e.prev=n,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):oo(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):oo(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var n=this.head;n;){var{next:t}=n;e(n)&&this.removeLink(n),n=t}return this}}function oo(e,n){e.length=1,e.head=e.tail=n}function ro(e,n,t){if(null==n)n=1;else if(0===n)throw new RangeError("Concurrency must not be zero");var a=Fi(e),i=0,o=[];const r={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function s(e,n){return e?n?void(r[e]=r[e].filter((e=>e!==n))):r[e]=[]:Object.keys(r).forEach((e=>r[e]=[]))}function c(e,...n){r[e].forEach((e=>e(...n)))}var p=!1;function l(e,n,t,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");var i,o;function r(e,...n){return e?t?o(e):i():n.length<=1?i(n[0]):void i(n)}h.started=!0;var s=h._createTaskItem(e,t?r:a||r);if(n?h._tasks.unshift(s):h._tasks.push(s),p||(p=!0,ji((()=>{p=!1,h.process()}))),t||!a)return new Promise(((e,n)=>{i=e,o=n}))}function u(e){return function(n,...t){i-=1;for(var a=0,r=e.length;a<r;a++){var s=e[a],p=o.indexOf(s);0===p?o.shift():p>0&&o.splice(p,1),s.callback(n,...t),null!=n&&c("error",n,s.data)}i<=h.concurrency-h.buffer&&c("unsaturated"),h.idle()&&c("drain"),h.process()}}function d(e){return!(0!==e.length||!h.idle())&&(ji((()=>c("drain"))),!0)}const f=e=>n=>{if(!n)return new Promise(((n,t)=>{!function(e,n){const t=(...a)=>{s(e,t),n(...a)};r[e].push(t)}(e,((e,a)=>{if(e)return t(e);n(a)}))}));s(e),function(e,n){r[e].push(n)}(e,n)};var m=!1,h={_tasks:new io,_createTaskItem:(e,n)=>({data:e,callback:n}),*[Symbol.iterator](){yield*h._tasks[Symbol.iterator]()},concurrency:n,payload:t,buffer:n/4,started:!1,paused:!1,push(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!1,n)))}return l(e,!1,!1,n)},pushAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!1,!0,n)))}return l(e,!1,!0,n)},kill(){s(),h._tasks.empty()},unshift(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!1,n)))}return l(e,!0,!1,n)},unshiftAsync(e,n){if(Array.isArray(e)){if(d(e))return;return e.map((e=>l(e,!0,!0,n)))}return l(e,!0,!0,n)},remove(e){h._tasks.remove(e)},process(){if(!m){for(m=!0;!h.paused&&i<h.concurrency&&h._tasks.length;){var e=[],n=[],t=h._tasks.length;h.payload&&(t=Math.min(t,h.payload));for(var r=0;r<t;r++){var s=h._tasks.shift();e.push(s),o.push(s),n.push(s.data)}i+=1,0===h._tasks.length&&c("empty"),i===h.concurrency&&c("saturated");var p=Di(u(e));a(n,p)}m=!1}},length:()=>h._tasks.length,running:()=>i,workersList:()=>o,idle:()=>h._tasks.length+i===0,pause(){h.paused=!0},resume(){!1!==h.paused&&(h.paused=!1,ji(h.process))}};return Object.defineProperties(h,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),h}function so(e,n){return ro(e,1,n)}function co(e,n,t){return ro(e,n,t)}var po=Ti((function(e,n,t,a){a=Mi(a);var i=Fi(t);return Ji(e,((e,t,a)=>{i(n,e,((e,t)=>{n=t,a(e)}))}),(e=>a(e,n)))}),4);function lo(...e){var n=e.map(Fi);return function(...e){var t=this,a=e[e.length-1];return"function"==typeof a?e.pop():a=Qi(),po(n,e,((e,n,a)=>{n.apply(t,e.concat(((e,...n)=>{a(e,n)})))}),((e,n)=>a(e,...n))),a[Zi]}}function uo(...e){return lo(...e.reverse())}var fo=Ti((function(e,n,t,a){return Ni(Ri(n),e,t,a)}),4);var mo=Ti((function(e,n,t,a){var i=Fi(t);return fo(e,n,((e,n)=>{i(e,((e,...t)=>e?n(e):n(e,t)))}),((e,n)=>{for(var t=[],i=0;i<n.length;i++)n[i]&&(t=t.concat(...n[i]));return a(e,t)}))}),4);var ho=Ti((function(e,n,t){return mo(e,1/0,n,t)}),3);var vo=Ti((function(e,n,t){return mo(e,1,n,t)}),3);function xo(...e){return function(...n){return n.pop()(null,...e)}}function bo(e,n){return(t,a,i,o)=>{var r,s=!1;const c=Fi(i);t(a,((t,a,i)=>{c(t,((a,o)=>a||!1===a?i(a):e(o)&&!r?(s=!0,r=n(!0,t),i(null,Li)):void i()))}),(e=>{if(e)return o(e);o(null,s?r:n(!1))}))}}var yo=Ti((function(e,n,t){return bo((e=>e),((e,n)=>n))(Wi,e,n,t)}),3);var go=Ti((function(e,n,t,a){return bo((e=>e),((e,n)=>n))(Ri(n),e,t,a)}),4);var wo=Ti((function(e,n,t){return bo((e=>e),((e,n)=>n))(Ri(1),e,n,t)}),3);function So(e){return(n,...t)=>Fi(n)(...t,((n,...t)=>{"object"==typeof console&&(n?console.error&&console.error(n):console[e]&&t.forEach((n=>console[e](n))))}))}var ko=So("dir");var Eo=Ti((function(e,n,t){t=Di(t);var a,i=Fi(e),o=Fi(n);function r(e,...n){if(e)return t(e);!1!==e&&(a=n,o(...n,s))}function s(e,n){return e?t(e):!1!==e?n?void i(r):t(null,...a):void 0}return s(null,!0)}),3);function jo(e,n,t){const a=Fi(n);return Eo(e,((...e)=>{const n=e.pop();a(...e,((e,t)=>n(e,!t)))}),t)}function Oo(e){return(n,t,a)=>e(n,a)}var Co=Ti((function(e,n,t){return Wi(e,Oo(Fi(n)),t)}),3);var _o=Ti((function(e,n,t,a){return Ri(n)(e,Oo(Fi(t)),a)}),4);var Ao=Ti((function(e,n,t){return _o(e,1,n,t)}),3);function Fo(e){return Ai(e)?e:function(...n){var t=n.pop(),a=!0;n.push(((...e)=>{a?ji((()=>t(...e))):t(...e)})),e.apply(this,n),a=!1}}var To=Ti((function(e,n,t){return bo((e=>!e),(e=>!e))(Wi,e,n,t)}),3);var Po=Ti((function(e,n,t,a){return bo((e=>!e),(e=>!e))(Ri(n),e,t,a)}),4);var No=Ti((function(e,n,t){return bo((e=>!e),(e=>!e))(Ji,e,n,t)}),3);function Io(e,n,t,a){var i=new Array(n.length);e(n,((e,n,a)=>{t(e,((e,t)=>{i[n]=!!t,a(e)}))}),(e=>{if(e)return a(e);for(var t=[],o=0;o<n.length;o++)i[o]&&t.push(n[o]);a(null,t)}))}function Lo(e,n,t,a){var i=[];e(n,((e,n,a)=>{t(e,((t,o)=>{if(t)return a(t);o&&i.push({index:n,value:e}),a(t)}))}),(e=>{if(e)return a(e);a(null,i.sort(((e,n)=>e.index-n.index)).map((e=>e.value)))}))}function Mo(e,n,t,a){return(Ii(n)?Io:Lo)(e,n,Fi(t),a)}var qo=Ti((function(e,n,t){return Mo(Wi,e,n,t)}),3);var Do=Ti((function(e,n,t,a){return Mo(Ri(n),e,t,a)}),4);var Bo=Ti((function(e,n,t){return Mo(Ji,e,n,t)}),3);var Ro=Ti((function(e,n){var t=Di(n),a=Fi(Fo(e));return function e(n){if(n)return t(n);!1!==n&&a(e)}()}),2);var zo=Ti((function(e,n,t,a){var i=Fi(t);return fo(e,n,((e,n)=>{i(e,((t,a)=>t?n(t):n(t,{key:a,val:e})))}),((e,n)=>{for(var t={},{hasOwnProperty:i}=Object.prototype,o=0;o<n.length;o++)if(n[o]){var{key:r}=n[o],{val:s}=n[o];i.call(t,r)?t[r].push(s):t[r]=[s]}return a(e,t)}))}),4);function $o(e,n,t){return zo(e,1/0,n,t)}function Uo(e,n,t){return zo(e,1,n,t)}var Wo=So("log");var Go=Ti((function(e,n,t,a){a=Mi(a);var i={},o=Fi(t);return Ri(n)(e,((e,n,t)=>{o(e,n,((e,a)=>{if(e)return t(e);i[n]=a,t(e)}))}),(e=>a(e,i)))}),4);function Ho(e,n,t){return Go(e,1/0,n,t)}function Jo(e,n,t){return Go(e,1,n,t)}function Ko(e,n=e=>e){var t=Object.create(null),a=Object.create(null),i=Fi(e),o=yi(((e,o)=>{var r=n(...e);r in t?ji((()=>o(null,...t[r]))):r in a?a[r].push(o):(a[r]=[o],i(...e,((e,...n)=>{e||(t[r]=n);var i=a[r];delete a[r];for(var o=0,s=i.length;o<s;o++)i[o](e,...n)})))}));return o.memo=t,o.unmemoized=e,o}var Vo=Ei(Si?process.nextTick:wi?setImmediate:ki),Zo=Ti(((e,n,t)=>{var a=Ii(n)?[]:{};e(n,((e,n,t)=>{Fi(e)(((e,...i)=>{i.length<2&&([i]=i),a[n]=i,t(e)}))}),(e=>t(e,a)))}),3);function Qo(e,n){return Zo(Wi,e,n)}function Yo(e,n,t){return Zo(Ri(n),e,t)}function Xo(e,n){var t=Fi(e);return ro(((e,n)=>{t(e[0],n)}),n,1)}class er{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let n;for(;e>0&&tr(this.heap[e],this.heap[n=nr(e)]);){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}percDown(e){let n;for(;(n=1+(e<<1))<this.heap.length&&(n+1<this.heap.length&&tr(this.heap[n+1],this.heap[n])&&(n+=1),!tr(this.heap[e],this.heap[n]));){let t=this.heap[e];this.heap[e]=this.heap[n],this.heap[n]=t,e=n}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let n=0;for(let t=0;t<this.heap.length;t++)e(this.heap[t])||(this.heap[n]=this.heap[t],n++);this.heap.splice(n);for(let e=nr(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function nr(e){return(e+1>>1)-1}function tr(e,n){return e.priority!==n.priority?e.priority<n.priority:e.pushCount<n.pushCount}function ar(e,n){var t=Xo(e,n),{push:a,pushAsync:i}=t;function o(e,n){return Array.isArray(e)?e.map((e=>({data:e,priority:n}))):{data:e,priority:n}}return t._tasks=new er,t._createTaskItem=({data:e,priority:n},t)=>({data:e,priority:n,callback:t}),t.push=function(e,n=0,t){return a(o(e,n),t)},t.pushAsync=function(e,n=0,t){return i(o(e,n),t)},delete t.unshift,delete t.unshiftAsync,t}var ir=Ti((function(e,n){if(n=Mi(n),!Array.isArray(e))return n(new TypeError("First argument to race must be an array of functions"));if(!e.length)return n();for(var t=0,a=e.length;t<a;t++)Fi(e[t])(n)}),2);function or(e,n,t,a){var i=[...e].reverse();return po(i,n,t,a)}function rr(e){var n=Fi(e);return yi((function(e,t){return e.push(((e,...n)=>{let a={};if(e&&(a.error=e),n.length>0){var i=n;n.length<=1&&([i]=n),a.value=i}t(null,a)})),n.apply(this,e)}))}function sr(e){var n;return Array.isArray(e)?n=e.map(rr):(n={},Object.keys(e).forEach((t=>{n[t]=rr.call(this,e[t])}))),n}function cr(e,n,t,a){const i=Fi(t);return Mo(e,n,((e,n)=>{i(e,((e,t)=>{n(e,!t)}))}),a)}var pr=Ti((function(e,n,t){return cr(Wi,e,n,t)}),3);var lr=Ti((function(e,n,t,a){return cr(Ri(n),e,t,a)}),4);var ur=Ti((function(e,n,t){return cr(Ji,e,n,t)}),3);function dr(e){return function(){return e}}function fr(e,n,t){var a={times:5,intervalFunc:dr(0)};if(arguments.length<3&&"function"==typeof e?(t=n||Qi(),n=e):(!function(e,n){if("object"==typeof n)e.times=+n.times||5,e.intervalFunc="function"==typeof n.interval?n.interval:dr(+n.interval||0),e.errorFilter=n.errorFilter;else{if("number"!=typeof n&&"string"!=typeof n)throw new Error("Invalid arguments for async.retry");e.times=+n||5}}(a,e),t=t||Qi()),"function"!=typeof n)throw new Error("Invalid arguments for async.retry");var i=Fi(n),o=1;return function e(){i(((n,...i)=>{!1!==n&&(n&&o++<a.times&&("function"!=typeof a.errorFilter||a.errorFilter(n))?setTimeout(e,a.intervalFunc(o-1)):t(n,...i))}))}(),t[Zi]}function mr(e,n){n||(n=e,e=null);let t=e&&e.arity||n.length;Ai(n)&&(t+=1);var a=Fi(n);return yi(((n,i)=>{function o(e){a(...n,e)}return(n.length<t-1||null==i)&&(n.push(i),i=Qi()),e?fr(e,o,i):fr(o,i),i[Zi]}))}function hr(e,n){return Zo(Ji,e,n)}var vr=Ti((function(e,n,t){return bo(Boolean,(e=>e))(Wi,e,n,t)}),3);var xr=Ti((function(e,n,t,a){return bo(Boolean,(e=>e))(Ri(n),e,t,a)}),4);var br=Ti((function(e,n,t){return bo(Boolean,(e=>e))(Ji,e,n,t)}),3);var yr=Ti((function(e,n,t){var a=Fi(n);return Gi(e,((e,n)=>{a(e,((t,a)=>{if(t)return n(t);n(t,{value:e,criteria:a})}))}),((e,n)=>{if(e)return t(e);t(null,n.sort(i).map((e=>e.value)))}));function i(e,n){var t=e.criteria,a=n.criteria;return t<a?-1:t>a?1:0}}),3);function gr(e,n,t){var a=Fi(e);return yi(((i,o)=>{var r,s=!1;i.push(((...e)=>{s||(o(...e),clearTimeout(r))})),r=setTimeout((function(){var n=e.name||"anonymous",a=new Error('Callback function "'+n+'" timed out.');a.code="ETIMEDOUT",t&&(a.info=t),s=!0,o(a)}),n),a(...i)}))}function wr(e,n,t,a){var i=Fi(t);return fo(function(e){for(var n=Array(e);e--;)n[e]=e;return n}(e),n,i,a)}function Sr(e,n,t){return wr(e,1/0,n,t)}function kr(e,n,t){return wr(e,1,n,t)}function Er(e,n,t,a){arguments.length<=3&&"function"==typeof n&&(a=t,t=n,n=Array.isArray(e)?[]:{}),a=Mi(a||Qi());var i=Fi(t);return Wi(e,((e,t,a)=>{i(n,e,t,a)}),(e=>a(e,n))),a[Zi]}var jr=Ti((function(e,n){var t,a=null;return Ao(e,((e,n)=>{Fi(e)(((e,...i)=>{if(!1===e)return n(e);i.length<2?[t]=i:t=i,a=e,n(e?null:{})}))}),(()=>n(a,t)))}));function Or(e){return(...n)=>(e.unmemoized||e)(...n)}var Cr=Ti((function(e,n,t){t=Di(t);var a=Fi(n),i=Fi(e),o=[];function r(e,...n){if(e)return t(e);o=n,!1!==e&&i(s)}function s(e,n){return e?t(e):!1!==e?n?void a(r):t(null,...o):void 0}return i(s)}),3);function _r(e,n,t){const a=Fi(e);return Cr((e=>a(((n,t)=>e(n,!t)))),n,t)}var Ar,Fr,Tr,Pr,Nr,Ir=Ti((function(e,n){if(n=Mi(n),!Array.isArray(e))return n(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return n();var t=0;function a(n){Fi(e[t++])(...n,Di(i))}function i(i,...o){if(!1!==i)return i||t===e.length?n(i,...o):void a(o)}a([])})),Lr={apply:bi,applyEach:Hi,applyEachSeries:Vi,asyncify:Oi,auto:Yi,autoInject:ao,cargo:so,cargoQueue:co,compose:uo,concat:ho,concatLimit:mo,concatSeries:vo,constant:xo,detect:yo,detectLimit:go,detectSeries:wo,dir:ko,doUntil:jo,doWhilst:Eo,each:Co,eachLimit:_o,eachOf:Wi,eachOfLimit:zi,eachOfSeries:Ji,eachSeries:Ao,ensureAsync:Fo,every:To,everyLimit:Po,everySeries:No,filter:qo,filterLimit:Do,filterSeries:Bo,forever:Ro,groupBy:$o,groupByLimit:zo,groupBySeries:Uo,log:Wo,map:Gi,mapLimit:fo,mapSeries:Ki,mapValues:Ho,mapValuesLimit:Go,mapValuesSeries:Jo,memoize:Ko,nextTick:Vo,parallel:Qo,parallelLimit:Yo,priorityQueue:ar,queue:Xo,race:ir,reduce:po,reduceRight:or,reflect:rr,reflectAll:sr,reject:pr,rejectLimit:lr,rejectSeries:ur,retry:fr,retryable:mr,seq:lo,series:hr,setImmediate:ji,some:vr,someLimit:xr,someSeries:br,sortBy:yr,timeout:gr,times:Sr,timesLimit:wr,timesSeries:kr,transform:Er,tryEach:jr,unmemoize:Or,until:_r,waterfall:Ir,whilst:Cr,all:To,allLimit:Po,allSeries:No,any:vr,anyLimit:xr,anySeries:br,find:yo,findLimit:go,findSeries:wo,flatMap:ho,flatMapLimit:mo,flatMapSeries:vo,forEach:Co,forEachSeries:Ao,forEachLimit:_o,forEachOf:Wi,forEachOfSeries:Ji,forEachOfLimit:zi,inject:po,foldl:po,foldr:or,select:qo,selectLimit:Do,selectSeries:Bo,wrapSync:Oi,during:Cr,doDuring:Eo},Mr=B(Object.freeze({__proto__:null,all:To,allLimit:Po,allSeries:No,any:vr,anyLimit:xr,anySeries:br,apply:bi,applyEach:Hi,applyEachSeries:Vi,asyncify:Oi,auto:Yi,autoInject:ao,cargo:so,cargoQueue:co,compose:uo,concat:ho,concatLimit:mo,concatSeries:vo,constant:xo,default:Lr,detect:yo,detectLimit:go,detectSeries:wo,dir:ko,doDuring:Eo,doUntil:jo,doWhilst:Eo,during:Cr,each:Co,eachLimit:_o,eachOf:Wi,eachOfLimit:zi,eachOfSeries:Ji,eachSeries:Ao,ensureAsync:Fo,every:To,everyLimit:Po,everySeries:No,filter:qo,filterLimit:Do,filterSeries:Bo,find:yo,findLimit:go,findSeries:wo,flatMap:ho,flatMapLimit:mo,flatMapSeries:vo,foldl:po,foldr:or,forEach:Co,forEachLimit:_o,forEachOf:Wi,forEachOfLimit:zi,forEachOfSeries:Ji,forEachSeries:Ao,forever:Ro,groupBy:$o,groupByLimit:zo,groupBySeries:Uo,inject:po,log:Wo,map:Gi,mapLimit:fo,mapSeries:Ki,mapValues:Ho,mapValuesLimit:Go,mapValuesSeries:Jo,memoize:Ko,nextTick:Vo,parallel:Qo,parallelLimit:Yo,priorityQueue:ar,queue:Xo,race:ir,reduce:po,reduceRight:or,reflect:rr,reflectAll:sr,reject:pr,rejectLimit:lr,rejectSeries:ur,retry:fr,retryable:mr,select:qo,selectLimit:Do,selectSeries:Bo,seq:lo,series:hr,setImmediate:ji,some:vr,someLimit:xr,someSeries:br,sortBy:yr,timeout:gr,times:Sr,timesLimit:wr,timesSeries:kr,transform:Er,tryEach:jr,unmemoize:Or,until:_r,waterfall:Ir,whilst:Cr,wrapSync:Oi})),qr={exports:{}},Dr={exports:{}};function Br(){if(Fr)return Ar;Fr=1;var e=1e3,n=60*e,t=60*n,a=24*t,i=7*a,o=365.25*a;function r(e,n,t,a){var i=n>=1.5*t;return Math.round(e/t)+" "+a+(i?"s":"")}return Ar=function(s,c){c=c||{};var p=typeof s;if("string"===p&&s.length>0)return function(r){if((r=String(r)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*a;case"hours":case"hour":case"hrs":case"hr":case"h":return c*t;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===p&&isFinite(s))return c.long?function(i){var o=Math.abs(i);if(o>=a)return r(i,o,a,"day");if(o>=t)return r(i,o,t,"hour");if(o>=n)return r(i,o,n,"minute");if(o>=e)return r(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=a)return Math.round(i/a)+"d";if(o>=t)return Math.round(i/t)+"h";if(o>=n)return Math.round(i/n)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},Ar}function Rr(){if(Pr)return Tr;return Pr=1,Tr=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Br(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},Tr}var zr,$r,Ur,Wr={exports:{}};function Gr(){return zr||(zr=1,function(e,n){const t=d,a=p;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=Rr()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(Wr,Wr.exports)),Wr.exports}function Hr(){return $r||($r=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?qr.exports=(Nr||(Nr=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=Rr()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Dr,Dr.exports)),Dr.exports):qr.exports=Gr()),qr.exports}var Jr=(Ur||(Ur=1,function(e){const a=n,i=l,o=u,r=t,s=Mr,c=Hr(),p=c("portfinder:testPort"),d=c("portfinder:getPort"),f=c("portfinder:defaultHosts"),m={testPort:function(n,t){function a(){p("done w/ testPort(): OK",n.host,"port",n.port),n.server.removeListener("error",i),n.server.close((function(){p("done w/ testPort(): Server closed",n.host,"port",n.port),t(null,n.port)}))}function i(i){if(p("done w/ testPort(): failed",n.host,"w/ port",n.port,"with error",i.code),n.server.removeListener("listening",a),"EADDRINUSE"!=i.code&&"EACCES"!=i.code)return t(i);const o=e.nextPort(n.port);if(o>e.highestPort)return t(new Error("No open ports available"));m.testPort({port:o,host:n.host,server:n.server},t)}t||(t=n,n={}),n.server=n.server||o.createServer((function(){})),p("entered testPort(): trying",n.host,"port",n.port),n.server.once("error",i),n.server.once("listening",a),n.host?n.server.listen(n.port,n.host):n.server.listen(n.port)}};e.basePort=8e3,e.setBasePort=function(n){e.basePort=n},e.highestPort=65535,e.setHighestPort=function(n){e.highestPort=n},e.basePath="/tmp/portfinder",e.setBasePath=function(n){e.basePath=n},m.getPort=function(n,t){if(n.port=Number(n.port)||Number(n.startPort)||Number(e.basePort),n.host=n.host||null,n.stopPort=Number(n.stopPort)||Number(e.highestPort),!n.startPort){if(n.startPort=n.port,n.startPort<0)return t(Error(`Provided options.port(${n.port}) is less than 0, which are cannot be bound.`));if(n.stopPort<n.startPort)return t(Error(`Provided options.stopPort(${n.stopPort}) is less than options.port(${n.startPort})`))}n.host&&-1===e._defaultHosts.indexOf(n.host)&&e._defaultHosts.push(n.host);const a=[];let i;return s.eachSeries(e._defaultHosts,(function(e,t){return d("in eachSeries() iteration callback: host is",e),m.testPort({host:e,port:n.port},(function(n,o){return n?(d("in eachSeries() iteration callback testPort() callback","with an err:",n.code),i=e,t(n)):(d("in eachSeries() iteration callback testPort() callback","with a success for port",o),a.push(o),t())}))}),(function(o){if(o){if(d("in eachSeries() result callback: err is",o),"EADDRNOTAVAIL"===o.code||"EINVAL"===o.code){if(n.host===i){const e="Provided host "+n.host+" could NOT be bound. Please provide a different host address or hostname";return t(Error(e))}{const a=e._defaultHosts.indexOf(i);return e._defaultHosts.splice(a,1),m.getPort(n,t)}}return t(o)}if(a.sort((function(e,n){return e-n})),d("in eachSeries() result callback: openPorts is",a),a[0]===a[a.length-1]){if(a[0]<=n.stopPort)return t(null,a[0]);{const e="No open ports found in between "+n.startPort+" and "+n.stopPort;return t(Error(e))}}return m.getPort({port:a.pop(),host:n.host,startPort:n.startPort,stopPort:n.stopPort},t)}))},e.getPort=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){m.getPort(e,(function(e,a){if(e)return t(e);n(a)}))}));m.getPort(e,n)},e.getPortPromise=e.getPort,m.getPorts=function(n,t,a){let i=null;s.timesSeries(n,(function(n,a){i&&(t.port=e.nextPort(i)),m.getPort(t,(function(e,n){e?a(e):(i=n,a(null,n))}))}),a)},e.getPorts=function(e,n,t){if("function"==typeof n&&(t=n,n={}),n=n||{},!t)return new Promise((function(t,a){m.getPorts(e,n,(function(e,n){if(e)return a(e);t(n)}))}));m.getPorts(e,n,t)},e.getPortsPromise=e.getPorts,m.getSocket=function(n,t){function i(){a.stat(n.path,(function(a){a?"ENOENT"==a.code?t(null,n.path):t(a):(n.path=e.nextSocket(n.path),m.getSocket(n,t))}))}return n.mod=n.mod||parseInt(755,8),n.path=n.path||e.basePath+".sock",n.exists?i():function(){const e=r.dirname(n.path);a.stat(e,(function(o,r){if(o||!r.isDirectory())return function(e){a.mkdir(e,{mode:n.mod,recursive:!0},(function(e){if(e)return t(e);n.exists=!0,i()}))}(e);n.exists=!0,i()}))}()},e.getSocket=function(e,n){if("function"==typeof e&&(n=e,e={}),e=e||{},!n)return new Promise((function(n,t){m.getSocket(e,(function(e,a){if(e)return t(e);n(a)}))}));m.getSocket(e,n)},e.getSocketPromise=e.getSocket,e.nextPort=function(e){return e+1},e.nextSocket=function(e){const n=r.dirname(e),t=r.basename(e,".sock").match(/^([a-zA-z]+)(\d*)$/i),a=t[1];let i=parseInt(t[2]);return isNaN(i)&&(i=0),i+=1,r.join(n,a+i+".sock")},e._defaultHosts=function(){let e={};try{e=i.networkInterfaces()}catch(e){if("uv_interface_addresses"!==e.syscall)throw e}const n=Object.keys(e),t=["0.0.0.0"];for(let a=0;a<n.length;a++){const i=e[n[a]];for(let e=0;e<i.length;e++){const n=i[e];t.push(n.address)}}return t.push(null),f("exports._defaultHosts is: %o",t),t}()}(xi)),xi),Kr=D(Jr);const Vr=i.prototype.listen,Zr=e=>{const n=e.address();if(n){((e,n)=>{const t=null!==n?`http://${e}:${n}`:e;console.log(`app listen ${t}`)})("object"==typeof n?(e=>"::"===e?"0.0.0.0":e)(n.address):n,"object"==typeof n?n.port:null)}},Qr=(e,n,t,a)=>{const{pathPrefix:i,moduleName:o,name:r}=P(n,"controller"),s=`${i}/${o}`;if(!t)return;const c=F(`${e}${`${i}/${r}`}`);t.forEach((e=>{const{method:n,path:t,handler:o,functionName:r,authRequired:p,middlewares:l}=e;var u;c&&"function"==typeof c[r]&&l.push((u=c[r].bind(c),async(e,n)=>{const t=u(e);t instanceof Promise&&await t,await n()}));const d=(f=p,m=o,async(e,n)=>{let t=a(f,e);return t instanceof Promise&&(t=await t),t?m(e,n):e.throw(403,"无权限")});var f,m;const h=[...l,d],v=Yr(t,s,r,h,n);e.path=v,e.apiPrePath=i}))},Yr=(e,n,t,a,i)=>{const o=`${n}${e}`;if(t===y){const e=`${n}/index`;M[i](e,...a)}return M[i](o,...a),o};var Xr,es,ns,ts={exports:{}},as={exports:{}};function is(){if(es)return Xr;return es=1,Xr=function(e){function n(e){let a,i,o,r=null;function s(...e){if(!s.enabled)return;const t=s,i=Number(new Date),o=i-(a||i);t.diff=o,t.prev=a,t.curr=i,a=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let r=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((a,i)=>{if("%%"===a)return"%";r++;const o=n.formatters[i];if("function"==typeof o){const n=e[r];a=o.call(t,n),e.splice(r,1),r--}return a})),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=t,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==r?r:(i!==n.namespaces&&(i=n.namespaces,o=n.enabled(e)),o),set:e=>{r=e}}),"function"==typeof n.init&&n.init(s),s}function t(e,t){const a=n(this.namespace+(void 0===t?":":t)+e);return a.log=this.log,a}function a(e,n){let t=0,a=0,i=-1,o=0;for(;t<e.length;)if(a<n.length&&(n[a]===e[t]||"*"===n[a]))"*"===n[a]?(i=a,o=t,a++):(t++,a++);else{if(-1===i)return!1;a=i+1,o++,t=o}for(;a<n.length&&"*"===n[a];)a++;return a===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(a(e,t))return!1;for(const t of n.names)if(a(e,t))return!0;return!1},n.humanize=Br(),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((t=>{n[t]=e[t]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n},Xr}var os,rs,ss,cs,ps,ls,us={exports:{}};function ds(){return os||(os=1,function(e,n){const t=d,a=p;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let a=0;a<t.length;a++)e.inspectOpts[t[a]]=n.inspectOpts[t[a]]},n.log=function(...e){return process.stderr.write(a.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(t){const{namespace:a,useColors:i}=this;if(i){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${a} `;t[0]=o+t[0].split("\n").join("\n"+o),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+a+" "+t[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):t.isatty(process.stderr.fd)},n.destroy=a.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=require("supports-color");e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,n)=>{const t=n.substring(6).toLowerCase().replace(/_([a-z])/g,((e,n)=>n.toUpperCase()));let a=process.env[n];return a=!!/^(yes|on|true|enabled)$/i.test(a)||!/^(no|off|false|disabled)$/i.test(a)&&("null"===a?null:Number(a)),e[t]=a,e}),{}),e.exports=is()(n);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}}(us,us.exports)),us.exports}function fs(){return rs||(rs=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?ts.exports=(ns||(ns=1,function(e,n){n.formatArgs=function(n){if(n[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+n[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const t="color: "+this.color;n.splice(1,0,t,"color: inherit");let a=0,i=0;n[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(a++,"%c"===e&&(i=a))})),n.splice(i,0,t)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")||n.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),e.exports=is()(n);const{formatters:t}=e.exports;t.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(as,as.exports)),as.exports):ts.exports=ds()),ts.exports}function ms(){if(cs)return ss;function e(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}return cs=1,ss=function(n){if((n=n||{}).circles)return function(n){const t=[],a=[],i=new Map;if(i.set(Date,(e=>new Date(e))),i.set(Map,((e,n)=>new Map(r(Array.from(e),n)))),i.set(Set,((e,n)=>new Set(r(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)i.set(e[0],e[1]);let o=null;return n.proto?c:s;function r(n,r){const s=Object.keys(n),c=new Array(s.length);for(let p=0;p<s.length;p++){const l=s[p],u=n[l];if("object"!=typeof u||null===u)c[l]=u;else if(u.constructor!==Object&&(o=i.get(u.constructor)))c[l]=o(u,r);else if(ArrayBuffer.isView(u))c[l]=e(u);else{const e=t.indexOf(u);c[l]=-1!==e?a[e]:r(u)}}return c}function s(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,s);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,s);const c={};t.push(n),a.push(c);for(const r in n){if(!1===Object.hasOwnProperty.call(n,r))continue;const p=n[r];if("object"!=typeof p||null===p)c[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))c[r]=o(p,s);else if(ArrayBuffer.isView(p))c[r]=e(p);else{const e=t.indexOf(p);c[r]=-1!==e?a[e]:s(p)}}return t.pop(),a.pop(),c}function c(n){if("object"!=typeof n||null===n)return n;if(Array.isArray(n))return r(n,c);if(n.constructor!==Object&&(o=i.get(n.constructor)))return o(n,c);const s={};t.push(n),a.push(s);for(const r in n){const p=n[r];if("object"!=typeof p||null===p)s[r]=p;else if(p.constructor!==Object&&(o=i.get(p.constructor)))s[r]=o(p,c);else if(ArrayBuffer.isView(p))s[r]=e(p);else{const e=t.indexOf(p);s[r]=-1!==e?a[e]:c(p)}}return t.pop(),a.pop(),s}}(n);const t=new Map;if(t.set(Date,(e=>new Date(e))),t.set(Map,((e,n)=>new Map(i(Array.from(e),n)))),t.set(Set,((e,n)=>new Set(i(Array.from(e),n)))),n.constructorHandlers)for(const e of n.constructorHandlers)t.set(e[0],e[1]);let a=null;return n.proto?function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r}:function n(o){if("object"!=typeof o||null===o)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(a=t.get(o.constructor)))return a(o,n);const r={};for(const i in o){if(!1===Object.hasOwnProperty.call(o,i))continue;const s=o[i];"object"!=typeof s||null===s?r[i]=s:s.constructor!==Object&&(a=t.get(s.constructor))?r[i]=a(s,n):ArrayBuffer.isView(s)?r[i]=e(s):r[i]=n(s)}return r};function i(n,i){const o=Object.keys(n),r=new Array(o.length);for(let s=0;s<o.length;s++){const c=o[s],p=n[c];"object"!=typeof p||null===p?r[c]=p:p.constructor!==Object&&(a=t.get(p.constructor))?r[c]=a(p,i):ArrayBuffer.isView(p)?r[c]=e(p):r[c]=i(p)}return r}},ss}function hs(){if(ls)return ps;ls=1;const e=p,n=fs()("log4js:configuration"),t=[],a=[],i=e=>!e,o=e=>e&&"object"==typeof e&&!Array.isArray(e),r=(n,t,a)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${e.inspect(n,{depth:5})}) - ${a}`)}))};return ps={configure:e=>{n("New configuration to be validated: ",e),r(e,i(o(e)),"must be an object."),n(`Calling pre-processing listeners (${t.length})`),t.forEach((n=>n(e))),n("Configuration pre-processing finished."),n(`Calling configuration listeners (${a.length})`),a.forEach((n=>n(e))),n("Configuration finished.")},addListener:e=>{a.push(e),n(`Added listener, now ${a.length} listeners`)},addPreProcessingListener:e=>{t.push(e),n(`Added pre-processing listener, now ${t.length} listeners`)},throwExceptionIf:r,anObject:o,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:i}}var vs,xs,bs,ys,gs,ws={exports:{}};function Ss(){return vs||(vs=1,function(e){function n(e,n){for(var t=e.toString();t.length<n;)t="0"+t;return t}function t(e){return n(e,2)}function a(a,i){"string"!=typeof a&&(i=a,a=e.exports.ISO8601_FORMAT),i||(i=e.exports.now());var o,r,s,c,p=t(i.getDate()),l=t(i.getMonth()+1),u=t(i.getFullYear()),d=t(u.substring(2,4)),f=a.indexOf("yyyy")>-1?u:d,m=t(i.getHours()),h=t(i.getMinutes()),v=t(i.getSeconds()),x=n(i.getMilliseconds(),3),b=(o=i.getTimezoneOffset(),r=Math.abs(o),s=String(Math.floor(r/60)),c=String(r%60),s=("0"+s).slice(-2),c=("0"+c).slice(-2),0===o?"Z":(o<0?"+":"-")+s+":"+c);return a.replace(/dd/g,p).replace(/MM/g,l).replace(/y{1,4}/g,f).replace(/hh/g,m).replace(/mm/g,h).replace(/ss/g,v).replace(/SSS/g,x).replace(/O/g,b)}function i(e,n,t,a){e["set"+(a?"":"UTC")+n](t)}e.exports=a,e.exports.asString=a,e.exports.parse=function(n,t,a){if(!n)throw new Error("pattern must be supplied");return function(n,t,a){var o=n.indexOf("O")<0,r=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,n){i(e,"FullYear",n,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Month",n-1,o),e.getMonth()!==n-1&&(r=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,n){r&&i(e,"Month",e.getMonth()-1,o),i(e,"Date",n,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,n){i(e,"Hours",n,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,n){i(e,"Minutes",n,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,n){i(e,"Seconds",n,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,n){i(e,"Milliseconds",n,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,n){n="Z"===n?0:n.replace(":","");var t=Math.abs(n),a=(n>0?-1:1)*(t%100+60*Math.floor(t/100));e.setUTCMinutes(e.getUTCMinutes()+a)}}],c=s.reduce((function(e,n){return n.pattern.test(e.regexp)?(n.index=e.regexp.match(n.pattern).index,e.regexp=e.regexp.replace(n.pattern,"("+n.regexp+")")):n.index=-1,e}),{regexp:n,index:[]}),p=s.filter((function(e){return e.index>-1}));p.sort((function(e,n){return e.index-n.index}));var l=new RegExp(c.regexp).exec(t);if(l){var u=a||e.exports.now();return p.forEach((function(e,n){e.fn(u,l[n+1])})),u}throw new Error("String '"+t+"' could not be parsed as '"+n+"'")}(n,t,a)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(ws)),ws.exports}function ks(){if(bs)return xs;bs=1;const e=Ss(),n=l,a=p,i=t,o=m,r=fs()("log4js:layouts"),s={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function c(e){return e?`[${s[e][0]}m`:""}function u(e){return e?`[${s[e][1]}m`:""}function d(n,t){return i=a.format("[%s] [%s] %s - ",e.asString(n.startTime),n.level.toString(),n.categoryName),c(o=t)+i+u(o);var i,o}function f(e){return d(e)+a.format(...e.data)}function h(e){return d(e,e.level.colour)+a.format(...e.data)}function v(e){return a.format(...e.data)}function x(e){return e.data[0]}function b(t,s){const p=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflosCMAF%])(\{([^}]+)\})?|([^%]+)/;function l(e){return e&&e.pid?e.pid.toString():process.pid.toString()}t=t||"%r %p %c - %m%n";const d={c:function(e,n){let t=e.categoryName;if(n){const e=parseInt(n,10),a=t.split(".");e<a.length&&(t=a.slice(a.length-e).join("."))}return t},d:function(n,t){let a=e.ISO8601_FORMAT;if(t)switch(a=t,a){case"ISO8601":case"ISO8601_FORMAT":a=e.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":a=e.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),r("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":a=e.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),r("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":a=e.DATETIME_FORMAT}return e.asString(a,n.startTime)},h:function(){return n.hostname().toString()},m:function(e,n){let t=e.data;if(n){const[e,a]=n.split(",");t=t.slice(e,a)}return a.format(...t)},n:function(){return n.EOL},p:function(e){return e.level.toString()},r:function(n){return e.asString("hh:mm:ss",n.startTime)},"[":function(e){return c(e.level.colour)},"]":function(e){return u(e.level.colour)},y:function(){return l()},z:l,"%":function(){return"%"},x:function(e,n){return void 0!==s[n]?"function"==typeof s[n]?s[n](e):s[n]:null},X:function(e,n){const t=e.context[n];return void 0!==t?"function"==typeof t?t(e):t:null},f:function(e,n){let t=e.fileName||"";if(t=function(e){const n="file://";return e.startsWith(n)&&("function"==typeof o.fileURLToPath?e=o.fileURLToPath(e):(e=i.normalize(e.replace(new RegExp(`^${n}`),"")),"win32"===process.platform&&(e=e.startsWith("\\")?e.slice(1):i.sep+i.sep+e))),e}(t),n){const e=parseInt(n,10),a=t.split(i.sep);a.length>e&&(t=a.slice(-e).join(i.sep))}return t},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""},C:function(e){return e.className||""},M:function(e){return e.functionName||""},A:function(e){return e.functionAlias||""},F:function(e){return e.callerName||""}};function f(e,n,t){return d[e](n,t)}function m(e,n,t){let a=e;return a=function(e,n){let t;return e?(t=parseInt(e.slice(1),10),t>0?n.slice(0,t):n.slice(t)):n}(n,a),a=function(e,n){let t;if(e)if("-"===e.charAt(0))for(t=parseInt(e.slice(1),10);n.length<t;)n+=" ";else for(t=parseInt(e,10);n.length<t;)n=` ${n}`;return n}(t,a),a}return function(e){let n,a="",i=t;for(;null!==(n=p.exec(i));){const t=n[1],o=n[2],r=n[3],s=n[5],c=n[6];if(c)a+=c.toString();else{a+=m(f(r,e,s),o,t)}i=i.slice(n.index+n[0].length)}return a}}const y={messagePassThrough:()=>v,basic:()=>f,colored:()=>h,coloured:()=>h,pattern:e=>b(e&&e.pattern,e&&e.tokens),dummy:()=>x};return xs={basicLayout:f,messagePassThroughLayout:v,patternLayout:b,colouredLayout:h,coloredLayout:h,dummyLayout:x,addLayout(e,n){y[e]=n},layout:(e,n)=>y[e]&&y[e](n)}}function Es(){if(gs)return ys;gs=1;const e=hs(),n=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class t{constructor(e,n,t){this.level=e,this.levelStr=n,this.colour=t}toString(){return this.levelStr}static getLevel(e,n){return e?e instanceof t?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),t[e.toString().toUpperCase()]||n):n}static addLevels(e){if(e){Object.keys(e).forEach((n=>{const a=n.toUpperCase();t[a]=new t(e[n].value,a,e[n].colour);const i=t.levels.findIndex((e=>e.levelStr===a));i>-1?t.levels[i]=t[a]:t.levels.push(t[a])})),t.levels.sort(((e,n)=>e.level-n.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=t.getLevel(e)),this.level===e.level}}return t.levels=[],t.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),e.addListener((t=>{const a=t.levels;if(a){e.throwExceptionIf(t,e.not(e.anObject(a)),"levels must be an object");Object.keys(a).forEach((i=>{e.throwExceptionIf(t,e.not(e.validIdentifier(i)),`level name "${i}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),e.throwExceptionIf(t,e.not(e.anObject(a[i])),`level "${i}" must be an object`),e.throwExceptionIf(t,e.not(a[i].value),`level "${i}" must have a 'value' property`),e.throwExceptionIf(t,e.not(e.anInteger(a[i].value)),`level "${i}".value must have an integer value`),e.throwExceptionIf(t,e.not(a[i].colour),`level "${i}" must have a 'colour' property`),e.throwExceptionIf(t,e.not(n.indexOf(a[i].colour)>-1),`level "${i}".colour must be one of ${n.join(", ")}`)}))}})),e.addListener((e=>{t.addLevels(e.levels)})),ys=t}var js,Os,Cs,_s,As,Fs={exports:{}},Ts={};function Ps(){if(Cs)return Os;Cs=1;const e=function(){if(js)return Ts;js=1;const{parse:e,stringify:n}=JSON,{keys:t}=Object,a=String,i="string",o={},r="object",s=(e,n)=>n,c=e=>e instanceof a?a(e):e,p=(e,n)=>typeof n===i?new a(n):n,l=(e,n,i,s)=>{const c=[];for(let p=t(i),{length:l}=p,u=0;u<l;u++){const t=p[u],l=i[t];if(l instanceof a){const a=e[l];typeof a!==r||n.has(a)?i[t]=s.call(i,t,a):(n.add(a),i[t]=o,c.push({k:t,a:[e,n,a,s]}))}else i[t]!==o&&(i[t]=s.call(i,t,l))}for(let{length:e}=c,n=0;n<e;n++){const{k:e,a:t}=c[n];i[e]=s.call(i,e,l.apply(null,t))}return i},u=(e,n,t)=>{const i=a(n.push(t)-1);return e.set(t,i),i},d=(n,t)=>{const a=e(n,p).map(c),i=a[0],o=t||s,u=typeof i===r&&i?l(a,new Set,i,o):i;return o.call({"":u},"",u)};Ts.parse=d;const f=(e,t,a)=>{const o=t&&typeof t===r?(e,n)=>""===e||-1<t.indexOf(e)?n:void 0:t||s,c=new Map,p=[],l=[];let d=+u(c,p,o.call({"":e},"",e)),f=!d;for(;d<p.length;)f=!0,l[d]=n(p[d++],m,a);return"["+l.join(",")+"]";function m(e,n){if(f)return f=!f,n;const t=o.call(this,e,n);switch(typeof t){case r:if(null===t)return t;case i:return c.get(t)||u(c,p,t)}return t}};return Ts.stringify=f,Ts.toJSON=n=>e(f(n)),Ts.fromJSON=e=>d(n(e)),Ts}(),n=Es();const t=new class{constructor(){const e={__LOG4JS_undefined__:void 0,__LOG4JS_NaN__:Number("abc"),__LOG4JS_Infinity__:1/0,"__LOG4JS_-Infinity__":-1/0};this.deMap=e,this.serMap={},Object.keys(this.deMap).forEach((e=>{const n=this.deMap[e];this.serMap[n]=e}))}canSerialise(e){return"string"!=typeof e&&e in this.serMap}serialise(e){return this.canSerialise(e)?this.serMap[e]:e}canDeserialise(e){return e in this.deMap}deserialise(e){return this.canDeserialise(e)?this.deMap[e]:e}};class a{constructor(e,n,t,a,i,o){if(this.startTime=new Date,this.categoryName=e,this.data=t,this.level=n,this.context=Object.assign({},a),this.pid=process.pid,this.error=o,void 0!==i){if(!i||"object"!=typeof i||Array.isArray(i))throw new TypeError("Invalid location type passed to LoggingEvent constructor");this.constructor._getLocationKeys().forEach((e=>{void 0!==i[e]&&(this[e]=i[e])}))}}static _getLocationKeys(){return["fileName","lineNumber","columnNumber","callStack","className","functionName","functionAlias","callerName"]}serialise(){return e.stringify(this,((e,n)=>(n instanceof Error&&(n=Object.assign({message:n.message,stack:n.stack},n)),t.serialise(n))))}static deserialise(i){let o;try{const r=e.parse(i,((e,n)=>{if(n&&n.message&&n.stack){const e=new Error(n);Object.keys(n).forEach((t=>{e[t]=n[t]})),n=e}return t.deserialise(n)}));this._getLocationKeys().forEach((e=>{void 0!==r[e]&&(r.location||(r.location={}),r.location[e]=r[e])})),o=new a(r.categoryName,n.getLevel(r.level.levelStr),r.data,r.context,r.location,r.error),o.startTime=new Date(r.startTime),o.pid=r.pid,r.cluster&&(o.cluster=r.cluster)}catch(e){o=new a("log4js",n.ERROR,["Unable to parse log:",i,"because: ",e])}return o}}return Os=a}function Ns(){if(As)return _s;As=1;const e=fs()("log4js:clustering"),n=Ps(),t=hs();let a=!1,i=null;try{i=require("cluster")}catch(n){e("cluster module not present"),a=!0}const o=[];let r=!1,s="NODE_APP_INSTANCE";const c=()=>r&&"0"===process.env[s],p=()=>a||i&&i.isMaster||c(),l=e=>{o.forEach((n=>n(e)))},u=(t,a)=>{if(e("cluster message received from worker ",t,": ",a),t.topic&&t.data&&(a=t,t=void 0),a&&a.topic&&"log4js:message"===a.topic){e("received message: ",a.data);const t=n.deserialise(a.data);l(t)}};return a||t.addListener((n=>{o.length=0,({pm2:r,disableClustering:a,pm2InstanceVar:s="NODE_APP_INSTANCE"}=n),e(`clustering disabled ? ${a}`),e(`cluster.isMaster ? ${i&&i.isMaster}`),e(`pm2 enabled ? ${r}`),e(`pm2InstanceVar = ${s}`),e(`process.env[${s}] = ${process.env[s]}`),r&&process.removeListener("message",u),i&&i.removeListener&&i.removeListener("message",u),a||n.disableClustering?e("Not listening for cluster messages, because clustering disabled."):c()?(e("listening for PM2 broadcast messages"),process.on("message",u)):i&&i.isMaster?(e("listening for cluster messages"),i.on("message",u)):e("not listening for messages, because we are not a master process")})),_s={onlyOnMaster:(e,n)=>p()?e():n,isMaster:p,send:e=>{p()?l(e):(r||(e.cluster={workerId:i.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{o.push(e)}}}var Is,Ls={};function Ms(){if(Is)return Ls;function e(e){if("number"==typeof e&&Number.isInteger(e))return e;const n={K:1024,M:1048576,G:1073741824},t=Object.keys(n),a=e.slice(-1).toLocaleUpperCase(),i=e.slice(0,-1).trim();if(t.indexOf(a)<0||!Number.isInteger(Number(i)))throw Error(`maxLogSize: "${e}" is invalid`);return i*n[a]}function n(n){return function(e,n){const t=Object.assign({},n);return Object.keys(e).forEach((a=>{t[a]&&(t[a]=e[a](n[a]))})),t}({maxLogSize:e},n)}Is=1;const t={dateFile:n,file:n,fileSync:n};return Ls.modifyConfig=e=>t[e.type]?t[e.type](e):e,Ls}var qs,Ds={};function Bs(){if(qs)return Ds;qs=1;const e=console.log.bind(console);return Ds.configure=function(n,t){let a=t.colouredLayout;return n.layout&&(a=t.layout(n.layout.type,n.layout)),function(n,t){return a=>{e(n(a,t))}}(a,n.timezoneOffset)},Ds}var Rs,zs={};function $s(){if(Rs)return zs;return Rs=1,zs.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stdout.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},zs}var Us,Ws={};function Gs(){if(Us)return Ws;return Us=1,Ws.configure=function(e,n){let t=n.colouredLayout;return e.layout&&(t=n.layout(e.layout.type,e.layout)),function(e,n){return t=>{process.stderr.write(`${e(t,n)}\n`)}}(t,e.timezoneOffset)},Ws}var Hs,Js={};var Ks,Vs={};function Zs(){if(Ks)return Vs;Ks=1;const e=fs()("log4js:categoryFilter");return Vs.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return"string"==typeof n&&(n=[n]),a=>{e(`Checking ${a.categoryName} against ${n}`),-1===n.indexOf(a.categoryName)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},Vs}var Qs,Ys={};function Xs(){if(Qs)return Ys;Qs=1;const e=fs()("log4js:noLogFilter");return Ys.configure=function(n,t,a){const i=a(n.appender);return function(n,t){return a=>{e(`Checking data: ${a.data} against filters: ${n}`),"string"==typeof n&&(n=[n]),n=n.filter((e=>null!=e&&""!==e));const i=new RegExp(n.join("|"),"i");(0===n.length||a.data.findIndex((e=>i.test(e)))<0)&&(e("Not excluded, sending to appender"),t(a))}}(n.exclude,i)},Ys}var ec,nc,tc,ac,ic,oc,rc,sc,cc,pc,lc,uc,dc,fc,mc,hc,vc,xc,bc,yc,gc,wc,Sc,kc,Ec,jc,Oc,Cc,_c,Ac,Fc,Tc,Pc,Nc,Ic,Lc,Mc,qc,Dc,Bc,Rc,zc,$c,Uc,Wc,Gc,Hc,Jc,Kc,Vc,Zc,Qc,Yc,Xc,ep,np,tp,ap,ip,op,rp,sp,cp,pp,lp,up,dp,fp,mp,hp,vp,xp,bp,yp,gp,wp,Sp,kp,Ep,jp,Op,Cp,_p,Ap,Fp,Tp,Pp,Np,Ip,Lp,Mp={},qp={exports:{}},Dp={},Bp={};function Rp(){return ec||(ec=1,Bp.fromCallback=function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((n,t)=>{arguments[arguments.length]=(e,a)=>{if(e)return t(e);n(a)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},Bp.fromPromise=function(e){return Object.defineProperty((function(){const n=arguments[arguments.length-1];if("function"!=typeof n)return e.apply(this,arguments);e.apply(this,arguments).then((e=>n(null,e)),n)}),"name",{value:e.name})}),Bp}function zp(){if(tc)return nc;tc=1;var e=h,n=process.cwd,t=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return t||(t=n.call(process)),t};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(e){t=null,i.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return nc=function(n){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(n){n.lchmod=function(t,a,i){n.open(t,e.O_WRONLY|e.O_SYMLINK,a,(function(e,t){e?i&&i(e):n.fchmod(t,a,(function(e){n.close(t,(function(n){i&&i(e||n)}))}))}))},n.lchmodSync=function(t,a){var i,o=n.openSync(t,e.O_WRONLY|e.O_SYMLINK,a),r=!0;try{i=n.fchmodSync(o,a),r=!1}finally{if(r)try{n.closeSync(o)}catch(e){}else n.closeSync(o)}return i}}(n);n.lutimes||function(n){e.hasOwnProperty("O_SYMLINK")&&n.futimes?(n.lutimes=function(t,a,i,o){n.open(t,e.O_SYMLINK,(function(e,t){e?o&&o(e):n.futimes(t,a,i,(function(e){n.close(t,(function(n){o&&o(e||n)}))}))}))},n.lutimesSync=function(t,a,i){var o,r=n.openSync(t,e.O_SYMLINK),s=!0;try{o=n.futimesSync(r,a,i),s=!1}finally{if(s)try{n.closeSync(r)}catch(e){}else n.closeSync(r)}return o}):n.futimes&&(n.lutimes=function(e,n,t,a){a&&process.nextTick(a)},n.lutimesSync=function(){})}(n);n.chown=o(n.chown),n.fchown=o(n.fchown),n.lchown=o(n.lchown),n.chmod=t(n.chmod),n.fchmod=t(n.fchmod),n.lchmod=t(n.lchmod),n.chownSync=r(n.chownSync),n.fchownSync=r(n.fchownSync),n.lchownSync=r(n.lchownSync),n.chmodSync=i(n.chmodSync),n.fchmodSync=i(n.fchmodSync),n.lchmodSync=i(n.lchmodSync),n.stat=s(n.stat),n.fstat=s(n.fstat),n.lstat=s(n.lstat),n.statSync=c(n.statSync),n.fstatSync=c(n.fstatSync),n.lstatSync=c(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(e,n,t){t&&process.nextTick(t)},n.lchmodSync=function(){});n.chown&&!n.lchown&&(n.lchown=function(e,n,t,a){a&&process.nextTick(a)},n.lchownSync=function(){});"win32"===a&&(n.rename="function"!=typeof n.rename?n.rename:function(e){function t(t,a,i){var o=Date.now(),r=0;e(t,a,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){n.stat(a,(function(n,o){n&&"ENOENT"===n.code?e(t,a,s):i(c)}))}),r),void(r<100&&(r+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.rename));function t(e){return e?function(t,a,i){return e.call(n,t,a,(function(e){p(e)&&(e=null),i&&i.apply(this,arguments)}))}:e}function i(e){return e?function(t,a){try{return e.call(n,t,a)}catch(e){if(!p(e))throw e}}:e}function o(e){return e?function(t,a,i,o){return e.call(n,t,a,i,(function(e){p(e)&&(e=null),o&&o.apply(this,arguments)}))}:e}function r(e){return e?function(t,a,i){try{return e.call(n,t,a,i)}catch(e){if(!p(e))throw e}}:e}function s(e){return e?function(t,a,i){function o(e,n){n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof a&&(i=a,a=null),a?e.call(n,t,a,o):e.call(n,t,o)}:e}function c(e){return e?function(t,a){var i=a?e.call(n,t,a):e.call(n,t);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function p(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}n.read="function"!=typeof n.read?n.read:function(e){function t(t,a,i,o,r,s){var c;if(s&&"function"==typeof s){var p=0;c=function(l,u,d){if(l&&"EAGAIN"===l.code&&p<10)return p++,e.call(n,t,a,i,o,r,c);s.apply(this,arguments)}}return e.call(n,t,a,i,o,r,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(t,e),t}(n.read),n.readSync="function"!=typeof n.readSync?n.readSync:(l=n.readSync,function(e,t,a,i,o){for(var r=0;;)try{return l.call(n,e,t,a,i,o)}catch(e){if("EAGAIN"===e.code&&r<10){r++;continue}throw e}});var l},nc}function $p(){if(cc)return sc;cc=1;var e,t,a=n,i=zp(),o=function(){if(ic)return ac;ic=1;var e=s.Stream;return ac=function(n){return{ReadStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this);var o=this;this.path=a,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var r=Object.keys(i),s=0,c=r.length;s<c;s++){var p=r[s];this[p]=i[p]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?n.open(this.path,this.flags,this.mode,(function(e,n){if(e)return o.emit("error",e),void(o.readable=!1);o.fd=n,o.emit("open",n),o._read()})):process.nextTick((function(){o._read()}))},WriteStream:function t(a,i){if(!(this instanceof t))return new t(a,i);e.call(this),this.path=a,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),r=0,s=o.length;r<s;r++){var c=o[r];this[c]=i[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},ac}(),r=function(){if(rc)return oc;rc=1,oc=function(n){if(null===n||"object"!=typeof n)return n;if(n instanceof Object)var t={__proto__:e(n)};else t=Object.create(null);return Object.getOwnPropertyNames(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t};var e=Object.getPrototypeOf||function(e){return e.__proto__};return oc}(),c=p;function l(n,t){Object.defineProperty(n,e,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=Symbol.for("graceful-fs.queue"),t=Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var u,d=function(){};if(c.debuglog?d=c.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(d=function(){var e=c.format.apply(c,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!a[e]){var f=q[e]||[];l(a,f),a.close=function(e){function n(n,t){return e.call(a,n,(function(e){e||x(),"function"==typeof t&&t.apply(this,arguments)}))}return Object.defineProperty(n,t,{value:e}),n}(a.close),a.closeSync=function(e){function n(n){e.apply(a,arguments),x()}return Object.defineProperty(n,t,{value:e}),n}(a.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){d(a[e]),v.equal(a[e].length,0)}))}function m(e){i(e),e.gracefulify=m,e.createReadStream=function(n,t){return new e.ReadStream(n,t)},e.createWriteStream=function(n,t){return new e.WriteStream(n,t)};var n=e.readFile;e.readFile=function(e,t,a){"function"==typeof t&&(a=t,t=null);return function e(t,a,i,o){return n(t,a,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):h([e,[t,a,i],n,o||Date.now(),Date.now()])}))}(e,t,a)};var t=e.writeFile;e.writeFile=function(e,n,a,i){"function"==typeof a&&(i=a,a=null);return function e(n,a,i,o,r){return t(n,a,i,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,a,i,o],t,r||Date.now(),Date.now()])}))}(e,n,a,i)};var a=e.appendFile;a&&(e.appendFile=function(e,n,t,i){"function"==typeof t&&(i=t,t=null);return function e(n,t,i,o,r){return a(n,t,i,(function(a){!a||"EMFILE"!==a.code&&"ENFILE"!==a.code?"function"==typeof o&&o.apply(this,arguments):h([e,[n,t,i,o],a,r||Date.now(),Date.now()])}))}(e,n,t,i)});var r=e.copyFile;r&&(e.copyFile=function(e,n,t,a){"function"==typeof t&&(a=t,t=0);return function e(n,t,a,i,o){return r(n,t,a,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)});var s=e.readdir;e.readdir=function(e,n,t){"function"==typeof n&&(t=n,n=null);var a=c.test(process.version)?function(e,n,t,a){return s(e,i(e,n,t,a))}:function(e,n,t,a){return s(e,n,i(e,n,t,a))};return a(e,n,t);function i(e,n,t,i){return function(o,r){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(r&&r.sort&&r.sort(),"function"==typeof t&&t.call(this,o,r)):h([a,[e,n,t],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var p=o(e);v=p.ReadStream,x=p.WriteStream}var l=e.ReadStream;l&&(v.prototype=Object.create(l.prototype),v.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.autoClose&&e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t),e.read())}))});var u=e.WriteStream;u&&(x.prototype=Object.create(u.prototype),x.prototype.open=function(){var e=this;y(e.path,e.flags,e.mode,(function(n,t){n?(e.destroy(),e.emit("error",n)):(e.fd=t,e.emit("open",t))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return v},set:function(e){v=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var d=v;Object.defineProperty(e,"FileReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var f=x;function v(e,n){return this instanceof v?(l.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(e,n){return this instanceof x?(u.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var b=e.open;function y(e,n,t,a){return"function"==typeof t&&(a=t,t=null),function e(n,t,a,i,o){return b(n,t,a,(function(r,s){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof i&&i.apply(this,arguments):h([e,[n,t,a,i],r,o||Date.now(),Date.now()])}))}(e,n,t,a)}return e.open=y,e}function h(n){d("ENQUEUE",n[0].name,n[1]),a[e].push(n),b()}function x(){for(var n=Date.now(),t=0;t<a[e].length;++t)a[e][t].length>2&&(a[e][t][3]=n,a[e][t][4]=n);b()}function b(){if(clearTimeout(u),u=void 0,0!==a[e].length){var n=a[e].shift(),t=n[0],i=n[1],o=n[2],r=n[3],s=n[4];if(void 0===r)d("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-r>=6e4){d("TIMEOUT",t.name,i);var c=i.pop();"function"==typeof c&&c.call(null,o)}else{var p=Date.now()-s,l=Math.max(s-r,1);p>=Math.min(1.2*l,100)?(d("RETRY",t.name,i),t.apply(null,i.concat([r]))):a[e].push(n)}void 0===u&&(u=setTimeout(b,0))}}return q[e]||l(q,a[e]),sc=m(r(a)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!a.__patched&&(sc=m(a),a.__patched=!0),sc}function Up(){return pc||(pc=1,function(e){const n=Rp().fromCallback,t=$p(),a=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof t[e]));Object.keys(t).forEach((n=>{"promises"!==n&&(e[n]=t[n])})),a.forEach((a=>{e[a]=n(t[a])})),e.exists=function(e,n){return"function"==typeof n?t.exists(e,n):new Promise((n=>t.exists(e,n)))},e.read=function(e,n,a,i,o,r){return"function"==typeof r?t.read(e,n,a,i,o,r):new Promise(((r,s)=>{t.read(e,n,a,i,o,((e,n,t)=>{if(e)return s(e);r({bytesRead:n,buffer:t})}))}))},e.write=function(e,n,...a){return"function"==typeof a[a.length-1]?t.write(e,n,...a):new Promise(((i,o)=>{t.write(e,n,...a,((e,n,t)=>{if(e)return o(e);i({bytesWritten:n,buffer:t})}))}))},"function"==typeof t.realpath.native&&(e.realpath.native=n(t.realpath.native))}(Dp)),Dp}function Wp(){if(uc)return lc;uc=1;const e=t;function n(n){return(n=e.normalize(e.resolve(n)).split(e.sep)).length>0?n[0]:null}const a=/[<>:"|?*]/;return lc={getRootPath:n,invalidWin32Path:function(e){const t=n(e);return e=e.replace(t,""),a.test(e)}}}function Gp(){if(xc)return vc;xc=1;const e=(0,Rp().fromCallback)(function(){if(fc)return dc;fc=1;const e=$p(),n=t,a=Wp().invalidWin32Path,i=parseInt("0777",8);return dc=function t(o,r,s,c){if("function"==typeof r?(s=r,r={}):r&&"object"==typeof r||(r={mode:r}),"win32"===process.platform&&a(o)){const e=new Error(o+" contains invalid WIN32 path characters.");return e.code="EINVAL",s(e)}let p=r.mode;const l=r.fs||e;void 0===p&&(p=i&~process.umask()),c||(c=null),s=s||function(){},o=n.resolve(o),l.mkdir(o,p,(e=>{if(!e)return s(null,c=c||o);if("ENOENT"===e.code){if(n.dirname(o)===o)return s(e);t(n.dirname(o),r,((e,n)=>{e?s(e,n):t(o,r,s,n)}))}else l.stat(o,((n,t)=>{n||!t.isDirectory()?s(e,c):s(null,c)}))}))},dc}()),n=function(){if(hc)return mc;hc=1;const e=$p(),n=t,a=Wp().invalidWin32Path,i=parseInt("0777",8);return mc=function t(o,r,s){r&&"object"==typeof r||(r={mode:r});let c=r.mode;const p=r.fs||e;if("win32"===process.platform&&a(o)){const e=new Error(o+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===c&&(c=i&~process.umask()),s||(s=null),o=n.resolve(o);try{p.mkdirSync(o,c),s=s||o}catch(e){if("ENOENT"===e.code){if(n.dirname(o)===o)throw e;s=t(n.dirname(o),r,s),t(o,r,s)}else{let n;try{n=p.statSync(o)}catch(n){throw e}if(!n.isDirectory())throw e}}return s},mc}();return vc={mkdirs:e,mkdirsSync:n,mkdirp:e,mkdirpSync:n,ensureDir:e,ensureDirSync:n}}function Hp(){if(yc)return bc;yc=1;const e=$p(),n=l,a=t;return bc={hasMillisRes:function(t){let i=a.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));i=a.join(n.tmpdir(),i);const o=new Date(1435410243862);e.writeFile(i,"https://github.com/jprichardson/node-fs-extra/pull/141",(n=>{if(n)return t(n);e.open(i,"r+",((n,a)=>{if(n)return t(n);e.futimes(a,o,o,(n=>{if(n)return t(n);e.close(a,(n=>{if(n)return t(n);e.stat(i,((e,n)=>{if(e)return t(e);t(null,n.mtime>1435410243e3)}))}))}))}))}))},hasMillisResSync:function(){let t=a.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));t=a.join(n.tmpdir(),t);const i=new Date(1435410243862);e.writeFileSync(t,"https://github.com/jprichardson/node-fs-extra/pull/141");const o=e.openSync(t,"r+");return e.futimesSync(o,i,i),e.closeSync(o),e.statSync(t).mtime>1435410243e3},timeRemoveMillis:function(e){if("number"==typeof e)return 1e3*Math.floor(e/1e3);if(e instanceof Date)return new Date(1e3*Math.floor(e.getTime()/1e3));throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")},utimesMillis:function(n,t,a,i){e.open(n,"r+",((n,o)=>{if(n)return i(n);e.futimes(o,t,a,(n=>{e.close(o,(e=>{i&&i(n||e)}))}))}))},utimesMillisSync:function(n,t,a){const i=e.openSync(n,"r+");return e.futimesSync(i,t,a),e.closeSync(i)}}}function Jp(){if(wc)return gc;wc=1;const e=$p(),n=t,a=process.versions.node.split("."),i=Number.parseInt(a[0],10),o=Number.parseInt(a[1],10),r=Number.parseInt(a[2],10);function s(){if(i>10)return!0;if(10===i){if(o>5)return!0;if(5===o&&r>=0)return!0}return!1}function c(e,t){const a=n.resolve(e).split(n.sep).filter((e=>e)),i=n.resolve(t).split(n.sep).filter((e=>e));return a.reduce(((e,n,t)=>e&&i[t]===n),!0)}function p(e,n,t){return`Cannot ${t} '${e}' to a subdirectory of itself, '${n}'.`}return gc={checkPaths:function(n,t,a,i){!function(n,t,a){s()?e.stat(n,{bigint:!0},((n,i)=>{if(n)return a(n);e.stat(t,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))})):e.stat(n,((n,i)=>{if(n)return a(n);e.stat(t,((e,n)=>e?"ENOENT"===e.code?a(null,{srcStat:i,destStat:null}):a(e):a(null,{srcStat:i,destStat:n})))}))}(n,t,((e,o)=>{if(e)return i(e);const{srcStat:r,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===r.ino&&s.dev===r.dev?i(new Error("Source and destination must not be the same.")):r.isDirectory()&&c(n,t)?i(new Error(p(n,t,a))):i(null,{srcStat:r,destStat:s})}))},checkPathsSync:function(n,t,a){const{srcStat:i,destStat:o}=function(n,t){let a,i;a=s()?e.statSync(n,{bigint:!0}):e.statSync(n);try{i=s()?e.statSync(t,{bigint:!0}):e.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:a,destStat:null};throw e}return{srcStat:a,destStat:i}}(n,t);if(o&&o.ino&&o.dev&&o.ino===i.ino&&o.dev===i.dev)throw new Error("Source and destination must not be the same.");if(i.isDirectory()&&c(n,t))throw new Error(p(n,t,a));return{srcStat:i,destStat:o}},checkParentPaths:function t(a,i,o,r,c){const l=n.resolve(n.dirname(a)),u=n.resolve(n.dirname(o));if(u===l||u===n.parse(u).root)return c();s()?e.stat(u,{bigint:!0},((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c))):e.stat(u,((e,n)=>e?"ENOENT"===e.code?c():c(e):n.ino&&n.dev&&n.ino===i.ino&&n.dev===i.dev?c(new Error(p(a,o,r))):t(a,i,u,r,c)))},checkParentPathsSync:function t(a,i,o,r){const c=n.resolve(n.dirname(a)),l=n.resolve(n.dirname(o));if(l===c||l===n.parse(l).root)return;let u;try{u=s()?e.statSync(l,{bigint:!0}):e.statSync(l)}catch(e){if("ENOENT"===e.code)return;throw e}if(u.ino&&u.dev&&u.ino===i.ino&&u.dev===i.dev)throw new Error(p(a,o,r));return t(a,i,l,r)},isSrcSubdir:c},gc}function Kp(){if(jc)return Ec;jc=1;const e=$p(),n=t,a=Gp().mkdirsSync,i=Hp().utimesMillisSync,o=Jp();function r(t,a,i,r){if(!r.filter||r.filter(a,i))return function(t,a,i,r){const p=r.dereference?e.statSync:e.lstatSync,l=p(a);if(l.isDirectory())return function(n,t,a,i,o){if(!t)return function(n,t,a,i){return e.mkdirSync(a),c(t,a,i),e.chmodSync(a,n.mode)}(n,a,i,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`);return c(a,i,o)}(l,t,a,i,r);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return function(n,t,a,i,o){return t?function(n,t,a,i){if(i.overwrite)return e.unlinkSync(a),s(n,t,a,i);if(i.errorOnExist)throw new Error(`'${a}' already exists`)}(n,a,i,o):s(n,a,i,o)}(l,t,a,i,r);if(l.isSymbolicLink())return function(t,a,i,r){let s=e.readlinkSync(a);r.dereference&&(s=n.resolve(process.cwd(),s));if(t){let t;try{t=e.readlinkSync(i)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return e.symlinkSync(s,i);throw n}if(r.dereference&&(t=n.resolve(process.cwd(),t)),o.isSrcSubdir(s,t))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${t}'.`);if(e.statSync(i).isDirectory()&&o.isSrcSubdir(t,s))throw new Error(`Cannot overwrite '${t}' with '${s}'.`);return function(n,t){return e.unlinkSync(t),e.symlinkSync(n,t)}(s,i)}return e.symlinkSync(s,i)}(t,a,i,r)}(t,a,i,r)}function s(n,t,a,o){return"function"==typeof e.copyFileSync?(e.copyFileSync(t,a),e.chmodSync(a,n.mode),o.preserveTimestamps?i(a,n.atime,n.mtime):void 0):function(n,t,a,i){const o=65536,r=(kc?Sc:(kc=1,Sc=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(n){return new Buffer(e)}return new Buffer(e)}))(o),s=e.openSync(t,"r"),c=e.openSync(a,"w",n.mode);let p=0;for(;p<n.size;){const n=e.readSync(s,r,0,o,p);e.writeSync(c,r,0,n),p+=n}i.preserveTimestamps&&e.futimesSync(c,n.atime,n.mtime);e.closeSync(s),e.closeSync(c)}(n,t,a,o)}function c(t,a,i){e.readdirSync(t).forEach((e=>function(e,t,a,i){const s=n.join(t,e),c=n.join(a,e),{destStat:p}=o.checkPathsSync(s,c,"copy");return r(p,s,c,i)}(e,t,a,i)))}return Ec=function(t,i,s){"function"==typeof s&&(s={filter:s}),(s=s||{}).clobber=!("clobber"in s)||!!s.clobber,s.overwrite="overwrite"in s?!!s.overwrite:s.clobber,s.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:c,destStat:p}=o.checkPathsSync(t,i,"copy");return o.checkParentPathsSync(t,c,i,"copy"),function(t,i,o,s){if(s.filter&&!s.filter(i,o))return;const c=n.dirname(o);e.existsSync(c)||a(c);return r(t,i,o,s)}(p,t,i,s)},Ec}function Vp(){return Cc?Oc:(Cc=1,Oc={copySync:Kp()})}function Zp(){if(Ac)return _c;Ac=1;const e=Rp().fromPromise,n=Up();return _c={pathExists:e((function(e){return n.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function Qp(){if(Tc)return Fc;Tc=1;const e=$p(),n=t,a=Gp().mkdirs,i=Zp().pathExists,o=Hp().utimesMillis,r=Jp();function s(e,t,o,r,s){const c=n.dirname(o);i(c,((n,i)=>n?s(n):i?p(e,t,o,r,s):void a(c,(n=>n?s(n):p(e,t,o,r,s)))))}function c(e,n,t,a,i,o){Promise.resolve(i.filter(t,a)).then((r=>r?e(n,t,a,i,o):o()),(e=>o(e)))}function p(e,n,t,a,i){return a.filter?c(l,e,n,t,a,i):l(e,n,t,a,i)}function l(n,t,a,i,o){(i.dereference?e.stat:e.lstat)(t,((r,s)=>r?o(r):s.isDirectory()?function(n,t,a,i,o,r){if(!t)return function(n,t,a,i,o){e.mkdir(a,(r=>{if(r)return o(r);f(t,a,i,(t=>t?o(t):e.chmod(a,n.mode,o)))}))}(n,a,i,o,r);if(t&&!t.isDirectory())return r(new Error(`Cannot overwrite non-directory '${i}' with directory '${a}'.`));return f(a,i,o,r)}(s,n,t,a,i,o):s.isFile()||s.isCharacterDevice()||s.isBlockDevice()?function(n,t,a,i,o,r){return t?function(n,t,a,i,o){if(!i.overwrite)return i.errorOnExist?o(new Error(`'${a}' already exists`)):o();e.unlink(a,(e=>e?o(e):u(n,t,a,i,o)))}(n,a,i,o,r):u(n,a,i,o,r)}(s,n,t,a,i,o):s.isSymbolicLink()?h(n,t,a,i,o):void 0))}function u(n,t,a,i,o){return"function"==typeof e.copyFile?e.copyFile(t,a,(e=>e?o(e):d(n,a,i,o))):function(n,t,a,i,o){const r=e.createReadStream(t);r.on("error",(e=>o(e))).once("open",(()=>{const t=e.createWriteStream(a,{mode:n.mode});t.on("error",(e=>o(e))).on("open",(()=>r.pipe(t))).once("close",(()=>d(n,a,i,o)))}))}(n,t,a,i,o)}function d(n,t,a,i){e.chmod(t,n.mode,(e=>e?i(e):a.preserveTimestamps?o(t,n.atime,n.mtime,i):i()))}function f(n,t,a,i){e.readdir(n,((e,o)=>e?i(e):m(o,n,t,a,i)))}function m(e,t,a,i,o){const s=e.pop();return s?function(e,t,a,i,o,s){const c=n.join(a,t),l=n.join(i,t);r.checkPaths(c,l,"copy",((n,t)=>{if(n)return s(n);const{destStat:r}=t;p(r,c,l,o,(n=>n?s(n):m(e,a,i,o,s)))}))}(e,s,t,a,i,o):o()}function h(t,a,i,o,s){e.readlink(a,((a,c)=>a?s(a):(o.dereference&&(c=n.resolve(process.cwd(),c)),t?void e.readlink(i,((a,p)=>a?"EINVAL"===a.code||"UNKNOWN"===a.code?e.symlink(c,i,s):s(a):(o.dereference&&(p=n.resolve(process.cwd(),p)),r.isSrcSubdir(c,p)?s(new Error(`Cannot copy '${c}' to a subdirectory of itself, '${p}'.`)):t.isDirectory()&&r.isSrcSubdir(p,c)?s(new Error(`Cannot overwrite '${p}' with '${c}'.`)):function(n,t,a){e.unlink(t,(i=>i?a(i):e.symlink(n,t,a)))}(c,i,s)))):e.symlink(c,i,s))))}return Fc=function(e,n,t,a){"function"!=typeof t||a?"function"==typeof t&&(t={filter:t}):(a=t,t={}),a=a||function(){},(t=t||{}).clobber=!("clobber"in t)||!!t.clobber,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),r.checkPaths(e,n,"copy",((i,o)=>{if(i)return a(i);const{srcStat:p,destStat:l}=o;r.checkParentPaths(e,p,n,"copy",(i=>i?a(i):t.filter?c(s,l,e,n,t,a):s(l,e,n,t,a)))}))},Fc}function Yp(){if(Nc)return Pc;Nc=1;const e=Rp().fromCallback;return Pc={copy:e(Qp())}}function Xp(){if(Lc)return Ic;Lc=1;const e=$p(),n=t,a=v,i="win32"===process.platform;function o(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{n[t]=n[t]||e[t],n[t+="Sync"]=n[t]||e[t]})),n.maxBusyTries=n.maxBusyTries||3}function r(e,n,t){let i=0;"function"==typeof n&&(t=n,n={}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a.strictEqual(typeof t,"function","rimraf: callback function required"),a(n,"rimraf: invalid options argument provided"),a.strictEqual(typeof n,"object","rimraf: options should be object"),o(n),s(e,n,(function a(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&i<n.maxBusyTries){i++;return setTimeout((()=>s(e,n,a)),100*i)}"ENOENT"===o.code&&(o=null)}t(o)}))}function s(e,n,t){a(e),a(n),a("function"==typeof t),n.lstat(e,((a,o)=>a&&"ENOENT"===a.code?t(null):a&&"EPERM"===a.code&&i?c(e,n,a,t):o&&o.isDirectory()?l(e,n,a,t):void n.unlink(e,(a=>{if(a){if("ENOENT"===a.code)return t(null);if("EPERM"===a.code)return i?c(e,n,a,t):l(e,n,a,t);if("EISDIR"===a.code)return l(e,n,a,t)}return t(a)}))))}function c(e,n,t,i){a(e),a(n),a("function"==typeof i),t&&a(t instanceof Error),n.chmod(e,438,(a=>{a?i("ENOENT"===a.code?null:t):n.stat(e,((a,o)=>{a?i("ENOENT"===a.code?null:t):o.isDirectory()?l(e,n,t,i):n.unlink(e,i)}))}))}function p(e,n,t){let i;a(e),a(n),t&&a(t instanceof Error);try{n.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw t}try{i=n.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw t}i.isDirectory()?d(e,n,t):n.unlinkSync(e)}function l(e,t,i,o){a(e),a(t),i&&a(i instanceof Error),a("function"==typeof o),t.rmdir(e,(s=>{!s||"ENOTEMPTY"!==s.code&&"EEXIST"!==s.code&&"EPERM"!==s.code?s&&"ENOTDIR"===s.code?o(i):o(s):function(e,t,i){a(e),a(t),a("function"==typeof i),t.readdir(e,((a,o)=>{if(a)return i(a);let s,c=o.length;if(0===c)return t.rmdir(e,i);o.forEach((a=>{r(n.join(e,a),t,(n=>{if(!s)return n?i(s=n):void(0==--c&&t.rmdir(e,i))}))}))}))}(e,t,o)}))}function u(e,n){let t;o(n=n||{}),a(e,"rimraf: missing path"),a.strictEqual(typeof e,"string","rimraf: path should be a string"),a(n,"rimraf: missing options"),a.strictEqual(typeof n,"object","rimraf: options should be object");try{t=n.lstatSync(e)}catch(t){if("ENOENT"===t.code)return;"EPERM"===t.code&&i&&p(e,n,t)}try{t&&t.isDirectory()?d(e,n,null):n.unlinkSync(e)}catch(t){if("ENOENT"===t.code)return;if("EPERM"===t.code)return i?p(e,n,t):d(e,n,t);if("EISDIR"!==t.code)throw t;d(e,n,t)}}function d(e,t,o){a(e),a(t),o&&a(o instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw o;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(a(e),a(t),t.readdirSync(e).forEach((a=>u(n.join(e,a),t))),!i){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}return Ic=r,r.sync=u,Ic}function el(){if(qc)return Mc;qc=1;const e=Rp().fromCallback,n=Xp();return Mc={remove:e(n),removeSync:n.sync}}function nl(){if(zc)return Rc;zc=1;const e=Rp().fromCallback,n=t,a=$p(),i=Gp(),o=Zp().pathExists;return Rc={createFile:e((function(e,t){function r(){a.writeFile(e,"",(e=>{if(e)return t(e);t()}))}a.stat(e,((a,s)=>{if(!a&&s.isFile())return t();const c=n.dirname(e);o(c,((e,n)=>e?t(e):n?r():void i.mkdirs(c,(e=>{if(e)return t(e);r()}))))}))})),createFileSync:function(e){let t;try{t=a.statSync(e)}catch(e){}if(t&&t.isFile())return;const o=n.dirname(e);a.existsSync(o)||i.mkdirsSync(o),a.writeFileSync(e,"")}},Rc}function tl(){if(Uc)return $c;Uc=1;const e=Rp().fromCallback,n=t,a=$p(),i=Gp(),o=Zp().pathExists;return $c={createLink:e((function(e,t,r){function s(e,n){a.link(e,n,(e=>{if(e)return r(e);r(null)}))}o(t,((c,p)=>c?r(c):p?r(null):void a.lstat(e,(a=>{if(a)return a.message=a.message.replace("lstat","ensureLink"),r(a);const c=n.dirname(t);o(c,((n,a)=>n?r(n):a?s(e,t):void i.mkdirs(c,(n=>{if(n)return r(n);s(e,t)}))))}))))})),createLinkSync:function(e,t){if(a.existsSync(t))return;try{a.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const o=n.dirname(t);return a.existsSync(o)||i.mkdirsSync(o),a.linkSync(e,t)}},$c}function al(){if(Vc)return Kc;Vc=1;const e=Rp().fromCallback,n=t,a=$p(),i=Gp(),o=i.mkdirs,r=i.mkdirsSync,s=function(){if(Gc)return Wc;Gc=1;const e=t,n=$p(),a=Zp().pathExists;return Wc={symlinkPaths:function(t,i,o){if(e.isAbsolute(t))return n.lstat(t,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),o(e)):o(null,{toCwd:t,toDst:t})));{const r=e.dirname(i),s=e.join(r,t);return a(s,((a,i)=>a?o(a):i?o(null,{toCwd:s,toDst:t}):n.lstat(t,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:t,toDst:e.relative(r,t)})))))}},symlinkPathsSync:function(t,a){let i;if(e.isAbsolute(t)){if(i=n.existsSync(t),!i)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}{const o=e.dirname(a),r=e.join(o,t);if(i=n.existsSync(r),i)return{toCwd:r,toDst:t};if(i=n.existsSync(t),!i)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:e.relative(o,t)}}}}}(),c=s.symlinkPaths,p=s.symlinkPathsSync,l=function(){if(Jc)return Hc;Jc=1;const e=$p();return Hc={symlinkType:function(n,t,a){if(a="function"==typeof t?t:a,t="function"!=typeof t&&t)return a(null,t);e.lstat(n,((e,n)=>{if(e)return a(null,"file");t=n&&n.isDirectory()?"dir":"file",a(null,t)}))},symlinkTypeSync:function(n,t){let a;if(t)return t;try{a=e.lstatSync(n)}catch(e){return"file"}return a&&a.isDirectory()?"dir":"file"}},Hc}(),u=l.symlinkType,d=l.symlinkTypeSync,f=Zp().pathExists;return Kc={createSymlink:e((function(e,t,i,r){r="function"==typeof i?i:r,i="function"!=typeof i&&i,f(t,((s,p)=>s?r(s):p?r(null):void c(e,t,((s,c)=>{if(s)return r(s);e=c.toDst,u(c.toCwd,i,((i,s)=>{if(i)return r(i);const c=n.dirname(t);f(c,((n,i)=>n?r(n):i?a.symlink(e,t,s,r):void o(c,(n=>{if(n)return r(n);a.symlink(e,t,s,r)}))))}))}))))})),createSymlinkSync:function(e,t,i){if(a.existsSync(t))return;const o=p(e,t);e=o.toDst,i=d(o.toCwd,i);const s=n.dirname(t);return a.existsSync(s)||r(s),a.symlinkSync(e,t,i)}},Kc}function il(){if(np)return ep;np=1;const e=Rp().fromCallback,t=function(){if(Xc)return Yc;var e;Xc=1;try{e=$p()}catch(t){e=n}function t(e,n){var t,a="\n";return"object"==typeof n&&null!==n&&(n.spaces&&(t=n.spaces),n.EOL&&(a=n.EOL)),JSON.stringify(e,n?n.replacer:null,t).replace(/\n/g,a)+a}function a(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var i={readFile:function(n,t,i){null==i&&(i=t,t={}),"string"==typeof t&&(t={encoding:t});var o=(t=t||{}).fs||e,r=!0;"throws"in t&&(r=t.throws),o.readFile(n,t,(function(e,o){if(e)return i(e);var s;o=a(o);try{s=JSON.parse(o,t?t.reviver:null)}catch(e){return r?(e.message=n+": "+e.message,i(e)):i(null,null)}i(null,s)}))},readFileSync:function(n,t){"string"==typeof(t=t||{})&&(t={encoding:t});var i=t.fs||e,o=!0;"throws"in t&&(o=t.throws);try{var r=i.readFileSync(n,t);return r=a(r),JSON.parse(r,t.reviver)}catch(e){if(o)throw e.message=n+": "+e.message,e;return null}},writeFile:function(n,a,i,o){null==o&&(o=i,i={});var r=(i=i||{}).fs||e,s="";try{s=t(a,i)}catch(e){return void(o&&o(e,null))}r.writeFile(n,s,i,o)},writeFileSync:function(n,a,i){var o=(i=i||{}).fs||e,r=t(a,i);return o.writeFileSync(n,r,i)}};return Yc=i}();return ep={readJson:e(t.readFile),readJsonSync:t.readFileSync,writeJson:e(t.writeFile),writeJsonSync:t.writeFileSync}}function ol(){if(sp)return rp;sp=1;const e=Rp().fromCallback,n=il();return n.outputJson=e(function(){if(ap)return tp;ap=1;const e=t,n=Gp(),a=Zp().pathExists,i=il();return tp=function(t,o,r,s){"function"==typeof r&&(s=r,r={});const c=e.dirname(t);a(c,((e,a)=>e?s(e):a?i.writeJson(t,o,r,s):void n.mkdirs(c,(e=>{if(e)return s(e);i.writeJson(t,o,r,s)}))))},tp}()),n.outputJsonSync=function(){if(op)return ip;op=1;const e=$p(),n=t,a=Gp(),i=il();return ip=function(t,o,r){const s=n.dirname(t);e.existsSync(s)||a.mkdirsSync(s),i.writeJsonSync(t,o,r)},ip}(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,rp=n}function rl(){if(pp)return cp;pp=1;const e=$p(),n=t,a=Vp().copySync,i=el().removeSync,o=Gp().mkdirpSync,r=Jp();function s(n,t,o){try{e.renameSync(n,t)}catch(e){if("EXDEV"!==e.code)throw e;return function(e,n,t){const o={overwrite:t,errorOnExist:!0};return a(e,n,o),i(e)}(n,t,o)}}return cp=function(t,a,c){const p=(c=c||{}).overwrite||c.clobber||!1,{srcStat:l}=r.checkPathsSync(t,a,"move");return r.checkParentPathsSync(t,l,a,"move"),o(n.dirname(a)),function(n,t,a){if(a)return i(t),s(n,t,a);if(e.existsSync(t))throw new Error("dest already exists.");return s(n,t,a)}(t,a,p)},cp}function sl(){if(fp)return dp;fp=1;const e=$p(),n=t,a=Yp().copy,i=el().remove,o=Gp().mkdirp,r=Zp().pathExists,s=Jp();function c(n,t,o,r){e.rename(n,t,(e=>e?"EXDEV"!==e.code?r(e):function(e,n,t,o){const r={overwrite:t,errorOnExist:!0};a(e,n,r,(n=>n?o(n):i(e,o)))}(n,t,o,r):r()))}return dp=function(e,t,a,p){"function"==typeof a&&(p=a,a={});const l=a.overwrite||a.clobber||!1;s.checkPaths(e,t,"move",((a,u)=>{if(a)return p(a);const{srcStat:d}=u;s.checkParentPaths(e,d,t,"move",(a=>{if(a)return p(a);o(n.dirname(t),(n=>n?p(n):function(e,n,t,a){if(t)return i(n,(i=>i?a(i):c(e,n,t,a)));r(n,((i,o)=>i?a(i):o?a(new Error("dest already exists.")):c(e,n,t,a)))}(e,t,l,p)))}))}))},dp}function cl(){return bp||(bp=1,function(e){e.exports=Object.assign({},Up(),Vp(),Yp(),function(){if(Bc)return Dc;Bc=1;const e=Rp().fromCallback,n=$p(),a=t,i=Gp(),o=el(),r=e((function(e,t){t=t||function(){},n.readdir(e,((n,r)=>{if(n)return i.mkdirs(e,t);r=r.map((n=>a.join(e,n))),function e(){const n=r.pop();if(!n)return t();o.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function s(e){let t;try{t=n.readdirSync(e)}catch(n){return i.mkdirsSync(e)}t.forEach((n=>{n=a.join(e,n),o.removeSync(n)}))}return Dc={emptyDirSync:s,emptydirSync:s,emptyDir:r,emptydir:r}}(),function(){if(Qc)return Zc;Qc=1;const e=nl(),n=tl(),t=al();return Zc={createFile:e.createFile,createFileSync:e.createFileSync,ensureFile:e.createFile,ensureFileSync:e.createFileSync,createLink:n.createLink,createLinkSync:n.createLinkSync,ensureLink:n.createLink,ensureLinkSync:n.createLinkSync,createSymlink:t.createSymlink,createSymlinkSync:t.createSymlinkSync,ensureSymlink:t.createSymlink,ensureSymlinkSync:t.createSymlinkSync}}(),ol(),Gp(),up?lp:(up=1,lp={moveSync:rl()}),function(){if(hp)return mp;hp=1;const e=Rp().fromCallback;return mp={move:e(sl())}}(),function(){if(xp)return vp;xp=1;const e=Rp().fromCallback,n=$p(),a=t,i=Gp(),o=Zp().pathExists;return vp={outputFile:e((function(e,t,r,s){"function"==typeof r&&(s=r,r="utf8");const c=a.dirname(e);o(c,((a,o)=>a?s(a):o?n.writeFile(e,t,r,s):void i.mkdirs(c,(a=>{if(a)return s(a);n.writeFile(e,t,r,s)}))))})),outputFileSync:function(e,...t){const o=a.dirname(e);if(n.existsSync(o))return n.writeFileSync(e,...t);i.mkdirsSync(o),n.writeFileSync(e,...t)}},vp}(),Zp(),el());const a=n;Object.getOwnPropertyDescriptor(a,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>a.promises})}(qp)),qp.exports}function pl(){if(Sp)return wp;Sp=1;const e=fs()("streamroller:fileNameFormatter"),n=t;return wp=({file:t,keepFileExt:a,needsIndex:i,alwaysIncludeDate:o,compress:r,fileNameSep:s})=>{let c=s||".";const p=n.join(t.dir,t.name),l=e=>e+t.ext,u=(e,n,t)=>!i&&t||!n?e:e+c+n,d=(e,n,t)=>(n>0||o)&&t?e+c+t:e,f=(e,n)=>n&&r?e+".gz":e,m=a?[d,u,l,f]:[l,d,u,f];return({date:n,index:t})=>(e(`_formatFileName: date=${n}, index=${t}`),m.reduce(((e,a)=>a(e,t,n)),p))},wp}function ll(){if(Ep)return kp;Ep=1;const e=fs()("streamroller:fileNameParser"),n=Ss();return kp=({file:t,keepFileExt:a,pattern:i,fileNameSep:o})=>{let r=o||".";const s="__NOT_MATCHING__";let c=[(n,t)=>n.endsWith(".gz")?(e("it is gzipped"),t.isCompressed=!0,n.slice(0,-3)):n,a?n=>n.startsWith(t.name)&&n.endsWith(t.ext)?(e("it starts and ends with the right things"),n.slice(t.name.length+1,-1*t.ext.length)):s:n=>n.startsWith(t.base)?(e("it starts with the right things"),n.slice(t.base.length+1)):s,i?(t,a)=>{const o=t.split(r);let s=o[o.length-1];e("items: ",o,", indexStr: ",s);let c=t;void 0!==s&&s.match(/^\d+$/)?(c=t.slice(0,-1*(s.length+1)),e(`dateStr is ${c}`),i&&!c&&(c=s,s="0")):s="0";try{const e=n.parse(i,c,new Date(0,0));return n.asString(i,e)!==c?t:(a.index=parseInt(s,10),a.date=c,a.timestamp=e.getTime(),"")}catch(n){return e(`Problem parsing ${c} as ${i}, error was: `,n),t}}:(n,t)=>n.match(/^\d+$/)?(e("it has an index"),t.index=parseInt(n,10),""):n];return e=>{let n={filename:e,index:0,isCompressed:!1};return c.reduce(((e,t)=>t(e,n)),e)?null:n}},kp}function ul(){if(Op)return jp;Op=1;const e=fs()("streamroller:moveAndMaybeCompressFile"),n=cl(),t=c;return jp=async(a,i,o)=>{if(o=function(n){const t={mode:parseInt("0600",8),compress:!1},a=Object.assign({},t,n);return e(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(a)}`),a}(o),a!==i){if(await n.pathExists(a))if(e(`moveAndMaybeCompressFile: moving file from ${a} to ${i} ${o.compress?"with":"without"} compress`),o.compress)await new Promise(((r,s)=>{let c=!1;const p=n.createWriteStream(i,{mode:o.mode,flags:"wx"}).on("open",(()=>{c=!0;const i=n.createReadStream(a).on("open",(()=>{i.pipe(t.createGzip()).pipe(p)})).on("error",(n=>{e(`moveAndMaybeCompressFile: error reading ${a}`,n),p.destroy(n)}))})).on("finish",(()=>{e(`moveAndMaybeCompressFile: finished compressing ${i}, deleting ${a}`),n.unlink(a).then(r).catch((t=>{e(`moveAndMaybeCompressFile: error deleting ${a}, truncating instead`,t),n.truncate(a).then(r).catch((n=>{e(`moveAndMaybeCompressFile: error truncating ${a}`,n),s(n)}))}))})).on("error",(t=>{c?(e(`moveAndMaybeCompressFile: error writing ${i}, deleting`,t),n.unlink(i).then((()=>{s(t)})).catch((n=>{e(`moveAndMaybeCompressFile: error deleting ${i}`,n),s(n)}))):(e(`moveAndMaybeCompressFile: error creating ${i}`,t),s(t))}))})).catch((()=>{}));else{e(`moveAndMaybeCompressFile: renaming ${a} to ${i}`);try{await n.move(a,i,{overwrite:!0})}catch(t){if(e(`moveAndMaybeCompressFile: error renaming ${a} to ${i}`,t),"ENOENT"!==t.code){e("moveAndMaybeCompressFile: trying copy+truncate instead");try{await n.copy(a,i,{overwrite:!0}),await n.truncate(a)}catch(n){e("moveAndMaybeCompressFile: error copy+truncate",n)}}}}}else e("moveAndMaybeCompressFile: source and target are the same, not doing anything")},jp}function dl(){if(_p)return Cp;_p=1;const e=fs()("streamroller:RollingFileWriteStream"),n=cl(),a=t,i=l,o=gp?yp:(gp=1,yp=()=>new Date),r=Ss(),{Writable:c}=s,p=pl(),u=ll(),d=ul();return Cp=class extends c{constructor(n,t){if(e(`constructor: creating RollingFileWriteStream. path=${n}`),"string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",i.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=a.parse(n),""===this.fileObject.dir&&(this.fileObject=a.parse(a.join(process.cwd(),n))),this.fileFormatter=p({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=u({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=r(this.options.pattern,o())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),e(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{const e=n.statSync(this.filename);this.state.currentSize=e.size,this.options.pattern&&(this.state.currentDate=r(this.options.pattern,e.mtime))}catch(e){return}}_parseOption(n){const t={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},a=Object.assign({},t,n);if(a.maxSize){if(a.maxSize<=0)throw new Error(`options.maxSize (${a.maxSize}) should be > 0`)}else delete a.maxSize;if(a.numBackups||0===a.numBackups){if(a.numBackups<0)throw new Error(`options.numBackups (${a.numBackups}) should be >= 0`);if(a.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${a.numBackups}) should be < Number.MAX_SAFE_INTEGER`);a.numToKeep=a.numBackups+1}else if(a.numToKeep<=0)throw new Error(`options.numToKeep (${a.numToKeep}) should be > 0`);return e(`_parseOption: creating stream with option=${JSON.stringify(a)}`),a}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(n,t,a){this._shouldRoll().then((()=>{e(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${n}`),this.currentFileStream.write(n,t,(e=>{this.state.currentSize+=n.length,a(e)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(e(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==r(this.options.pattern,o())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return e("_roll: closing the current stream"),new Promise(((e,n)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(n)}))}))}async _moveOldFiles(){const n=await this._getExistingFiles();for(let t=(this.state.currentDate?n.filter((e=>e.date===this.state.currentDate)):n).length;t>=0;t--){e(`_moveOldFiles: i = ${t}`);const n=this.fileFormatter({date:this.state.currentDate,index:t}),a=this.fileFormatter({date:this.state.currentDate,index:t+1}),i={compress:this.options.compress&&0===t,mode:this.options.mode};await d(n,a,i)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?r(this.options.pattern,o()):null,e(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,n)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(n)}))}))}async _getExistingFiles(){const t=await n.readdir(this.fileObject.dir).catch((()=>[]));e(`_getExistingFiles: files=${t}`);const a=t.map((e=>this.fileNameParser(e))).filter((e=>e)),i=e=>(e.timestamp?e.timestamp:o().getTime())-e.index;return a.sort(((e,n)=>i(e)-i(n))),a}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return n.mkdirSync(e,{recursive:!0})}catch(i){if("ENOENT"===i.code)return t(a.dirname(e)),t(e);if("EEXIST"!==i.code&&"EROFS"!==i.code)throw i;try{if(n.statSync(e).isDirectory())return e;throw i}catch(e){throw i}}};t(this.fileObject.dir);const i={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var o,r;n.appendFileSync(e,"",(o={...i},r="flags",o["flag"]=o[r],delete o[r],o)),this.currentFileStream=n.createWriteStream(e,i),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const t=await this._getExistingFiles();if(e(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),e("_clean: existing files are: ",t),this._tooManyFiles(t.length)){const o=t.slice(0,t.length-this.options.numToKeep).map((e=>a.format({dir:this.fileObject.dir,base:e.filename})));await(i=o,e(`deleteFiles: files to delete: ${i}`),Promise.all(i.map((t=>n.unlink(t).catch((n=>{e(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${n}`)}))))))}var i}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}},Cp}function fl(){if(Fp)return Ap;Fp=1;const e=dl();return Ap=class extends e{constructor(e,n,t,a){a||(a={}),n&&(a.maxSize=n),a.numBackups||0===a.numBackups||(t||0===t||(t=1),a.numBackups=t),super(e,a),this.backups=a.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}}}function ml(){if(Pp)return Tp;Pp=1;const e=dl();return Tp=class extends e{constructor(e,n,t){n&&"object"==typeof n&&(t=n,n=null),t||(t={}),n||(n="yyyy-MM-dd"),t.pattern=n,t.numBackups||0===t.numBackups?t.daysToKeep=t.numBackups:(t.daysToKeep||0===t.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):t.daysToKeep=1,t.numBackups=t.daysToKeep),super(e,t),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}}function hl(){return Ip?Np:(Ip=1,Np={RollingFileWriteStream:dl(),RollingFileStream:fl(),DateRollingFileStream:ml()})}function vl(){if(Lp)return Mp;Lp=1;const e=fs()("log4js:file"),n=t,a=hl(),i=l,o=i.EOL;let r=!1;const s=new Set;function c(){s.forEach((e=>{e.sighupHandler()}))}return Mp.configure=function(t,p){let l=p.basicLayout;return t.layout&&(l=p.layout(t.layout.type,t.layout)),t.mode=t.mode||384,function(t,p,l,u,d,f){if("string"!=typeof t||0===t.length)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(n.sep))throw new Error(`Filename is a directory: ${t}`);function m(e,n,t,i){const o=new a.RollingFileStream(e,n,t,i);return o.on("error",(n=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,n)})),o.on("drain",(()=>{process.emit("log4js:pause",!1)})),o}0===t.indexOf(`~${n.sep}`)&&(t=t.replace("~",i.homedir())),t=n.normalize(t),e("Creating file appender (",t,", ",l,", ",u=u||0===u?u:5,", ",d,", ",f,")");let h=m(t,l,u,d);const v=function(e){if(h.writable){if(!0===d.removeColor){const n=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(n,""):e))}h.write(p(e,f)+o,"utf8")||process.emit("log4js:pause",!0)}};return v.reopen=function(){h.end((()=>{h=m(t,l,u,d)}))},v.sighupHandler=function(){e("SIGHUP handler called."),v.reopen()},v.shutdown=function(e){s.delete(v),0===s.size&&r&&(process.removeListener("SIGHUP",c),r=!1),h.end("","utf-8",e)},s.add(v),r||(process.on("SIGHUP",c),r=!0),v}(t.filename,l,t.maxLogSize,t.backups,t,t.timezoneOffset)},Mp}var xl,bl={};function yl(){if(xl)return bl;xl=1;const e=hl(),n=l.EOL;function t(t,a,i,o,r){o.maxSize=o.maxLogSize;const s=function(n,t,a){const i=new e.DateRollingFileStream(n,t,a);return i.on("error",(e=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",n,e)})),i.on("drain",(()=>{process.emit("log4js:pause",!1)})),i}(t,a,o),c=function(e){s.writable&&(s.write(i(e,r)+n,"utf8")||process.emit("log4js:pause",!0))};return c.shutdown=function(e){s.end("","utf-8",e)},c}return bl.configure=function(e,n){let a=n.basicLayout;return e.layout&&(a=n.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,t(e.filename,e.pattern,a,e,e.timezoneOffset)},bl}var gl,wl={};function Sl(){if(gl)return wl;gl=1;const e=fs()("log4js:fileSync"),a=t,i=n,o=l,r=o.EOL;function s(e,n){const t=e=>{try{return i.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(a.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(i.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(a.dirname(e)),i.appendFileSync(e,"",{mode:n.mode,flag:n.flags})}class c{constructor(n,t,a,o){if(e("In RollingFileStream"),t<0)throw new Error(`maxLogSize (${t}) should be > 0`);this.filename=n,this.size=t,this.backups=a,this.options=o,this.currentSize=0,this.currentSize=function(e){let n=0;try{n=i.statSync(e).size}catch(n){s(e,o)}return n}(this.filename)}shouldRoll(){return e("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(n){const t=this,o=new RegExp(`^${a.basename(n)}`);function r(e){return o.test(e)}function s(e){return parseInt(e.slice(`${a.basename(n)}.`.length),10)||0}function c(e,n){return s(e)-s(n)}function p(o){const r=s(o);if(e(`Index of ${o} is ${r}`),0===t.backups)i.truncateSync(n,0);else if(r<t.backups){try{i.unlinkSync(`${n}.${r+1}`)}catch(e){}e(`Renaming ${o} -> ${n}.${r+1}`),i.renameSync(a.join(a.dirname(n),o),`${n}.${r+1}`)}}e("Rolling, rolling, rolling"),e("Renaming the old files"),i.readdirSync(a.dirname(n)).filter(r).sort(c).reverse().forEach(p)}write(n,t){const a=this;e("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),e("writing the chunk to the file"),a.currentSize+=n.length,i.appendFileSync(a.filename,n)}}return wl.configure=function(n,t){let p=t.basicLayout;n.layout&&(p=t.layout(n.layout.type,n.layout));const l={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return function(n,t,p,l,u,d){if("string"!=typeof n||0===n.length)throw new Error(`Invalid filename: ${n}`);if(n.endsWith(a.sep))throw new Error(`Filename is a directory: ${n}`);0===n.indexOf(`~${a.sep}`)&&(n=n.replace("~",o.homedir())),n=a.normalize(n),e("Creating fileSync appender (",n,", ",p,", ",l=l||0===l?l:5,", ",u,", ",d,")");const f=function(e,n,t){let a;var o;return n?a=new c(e,n,t,u):(s(o=e,u),a={write(e){i.appendFileSync(o,e)}}),a}(n,p,l);return e=>{f.write(t(e,d)+r)}}(n.filename,p,n.maxLogSize,n.backups,l,n.timezoneOffset)},wl}var kl,El,jl={};function Ol(){if(kl)return jl;kl=1;const e=fs()("log4js:tcp"),n=u;return jl.configure=function(t,a){e(`configure with config = ${t}`);let i=function(e){return e.serialise()};return t.layout&&(i=a.layout(t.layout.type,t.layout)),function(t,a){let i=!1;const o=[];let r,s=3,c="__LOG4JS__";function p(n){e("Writing log event to socket"),i=r.write(`${a(n)}${c}`,"utf8")}function l(){let n;for(e("emptying buffer");n=o.shift();)p(n)}function u(n){i?p(n):(e("buffering log event because it cannot write at the moment"),o.push(n))}return function a(){e(`appender creating socket to ${t.host||"localhost"}:${t.port||5e3}`),c=`${t.endMsg||"__LOG4JS__"}`,r=n.createConnection(t.port||5e3,t.host||"localhost"),r.on("connect",(()=>{e("socket connected"),l(),i=!0})),r.on("drain",(()=>{e("drain event received, emptying buffer"),i=!0,l()})),r.on("timeout",r.end.bind(r)),r.on("error",(n=>{e("connection error",n),i=!1,l()})),r.on("close",a)}(),u.shutdown=function(n){e("shutdown called"),o.length&&s?(e("buffer has items, waiting 100ms to empty"),s-=1,setTimeout((()=>{u.shutdown(n)}),100)):(r.removeAllListeners("close"),r.end(n))},u}(t,i)},jl}function Cl(){if(El)return Fs.exports;El=1;const e=t,n=fs()("log4js:appenders"),a=hs(),i=Ns(),o=Es(),r=ks(),s=Ms(),c=new Map;c.set("console",Bs()),c.set("stdout",$s()),c.set("stderr",Gs()),c.set("logLevelFilter",(Hs||(Hs=1,Js.configure=function(e,n,t,a){const i=t(e.appender);return function(e,n,t,a){const i=a.getLevel(e),o=a.getLevel(n,a.FATAL);return e=>{const n=e.level;i.isLessThanOrEqualTo(n)&&o.isGreaterThanOrEqualTo(n)&&t(e)}}(e.level,e.maxLevel,i,a)}),Js)),c.set("categoryFilter",Zs()),c.set("noLogFilter",Xs()),c.set("file",vl()),c.set("dateFile",yl()),c.set("fileSync",Sl()),c.set("tcp",Ol());const l=new Map,u=(e,t)=>{let i;try{const t=`${e}.cjs`;i=require.resolve(t),n("Loading module from ",t)}catch(t){i=e,n("Loading module from ",e)}try{return function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(i)}catch(n){return void a.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},d=new Set,f=(e,t)=>{if(l.has(e))return l.get(e);if(!t.appenders[e])return!1;if(d.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);d.add(e),n(`Creating appender ${e}`);const a=m(e,t);return d.delete(e),l.set(e,a),a},m=(t,l)=>{const d=l.appenders[t],m=d.type.configure?d.type:((n,t)=>c.get(n)||u(`./${n}`,t)||u(n,t)||require.main&&require.main.filename&&u(e.join(e.dirname(require.main.filename),n),t)||u(e.join(process.cwd(),n),t))(d.type,l);return a.throwExceptionIf(l,a.not(m),`appender "${t}" is not valid (type "${d.type}" could not be found)`),m.appender&&(process.emitWarning(`Appender ${d.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),n("[log4js-node-DEP0001]",`DEPRECATION: Appender ${d.type} exports an appender function.`)),m.shutdown&&(process.emitWarning(`Appender ${d.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),n("[log4js-node-DEP0002]",`DEPRECATION: Appender ${d.type} exports a shutdown function.`)),n(`${t}: clustering.isMaster ? ${i.isMaster()}`),n(`${t}: appenderModule is ${p.inspect(m)}`),i.onlyOnMaster((()=>(n(`calling appenderModule.configure for ${t} / ${d.type}`),m.configure(s.modifyConfig(d),r,(e=>f(e,l)),o))),(()=>{}))},h=e=>{if(l.clear(),d.clear(),!e)return;const n=[];Object.values(e.categories).forEach((e=>{n.push(...e.appenders)})),Object.keys(e.appenders).forEach((t=>{(n.includes(t)||"tcp-server"===e.appenders[t].type||"multiprocess"===e.appenders[t].type)&&f(t,e)}))},v=()=>{h()};return v(),a.addListener((e=>{a.throwExceptionIf(e,a.not(a.anObject(e.appenders)),'must have a property "appenders" of type object.');const n=Object.keys(e.appenders);a.throwExceptionIf(e,a.not(n.length),"must define at least one appender."),n.forEach((n=>{a.throwExceptionIf(e,a.not(e.appenders[n].type),`appender "${n}" is not valid (must be an object with property "type")`)}))})),a.addListener(h),Fs.exports=l,Fs.exports.init=v,Fs.exports}var _l,Al,Fl,Tl,Pl,Nl,Il,Ll,Ml,ql={exports:{}};function Dl(){return _l||(_l=1,function(e){const n=fs()("log4js:categories"),t=hs(),a=Es(),i=Cl(),o=new Map;function r(e,n,t){if(!1===n.inherit)return;const a=t.lastIndexOf(".");if(a<0)return;const i=t.slice(0,a);let o=e.categories[i];o||(o={inherit:!0,appenders:[]}),r(e,o,i),!e.categories[i]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[i]=o),n.appenders=n.appenders||[],n.level=n.level||o.level,o.appenders.forEach((e=>{n.appenders.includes(e)||n.appenders.push(e)})),n.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((n=>{const t=e.categories[n];r(e,t,n)}))}t.addPreProcessingListener((e=>s(e))),t.addListener((e=>{t.throwExceptionIf(e,t.not(t.anObject(e.categories)),'must have a property "categories" of type object.');const n=Object.keys(e.categories);t.throwExceptionIf(e,t.not(n.length),"must define at least one category."),n.forEach((n=>{const o=e.categories[n];t.throwExceptionIf(e,[t.not(o.appenders),t.not(o.level)],`category "${n}" is not valid (must be an object with properties "appenders" and "level")`),t.throwExceptionIf(e,t.not(Array.isArray(o.appenders)),`category "${n}" is not valid (appenders must be an array of appender names)`),t.throwExceptionIf(e,t.not(o.appenders.length),`category "${n}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&t.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${n}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((a=>{t.throwExceptionIf(e,t.not(i.get(a)),`category "${n}" is not valid (appender "${a}" is not defined)`)})),t.throwExceptionIf(e,t.not(a.getLevel(o.level)),`category "${n}" is not valid (level "${o.level}" not recognised; valid levels are ${a.levels.join(", ")})`)})),t.throwExceptionIf(e,t.not(e.categories.default),'must define a "default" category.')}));const c=e=>{if(o.clear(),!e)return;Object.keys(e.categories).forEach((t=>{const r=e.categories[t],s=[];r.appenders.forEach((e=>{s.push(i.get(e)),n(`Creating category ${t}`),o.set(t,{appenders:s,level:a.getLevel(r.level),enableCallStack:r.enableCallStack||!1})}))}))},p=()=>{c()};p(),t.addListener(c);const l=e=>{if(n(`configForCategory: searching for config for ${e}`),o.has(e))return n(`configForCategory: ${e} exists in config, returning it`),o.get(e);let t;return e.indexOf(".")>0?(n(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...l(e.slice(0,e.lastIndexOf(".")))}):(o.has("default")||c({categories:{default:{appenders:["out"],level:"OFF"}}}),n("configForCategory: cloning default category"),t={...o.get("default")}),o.set(e,t),t};e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{l(e).level=n},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,n)=>{l(e).enableCallStack=n},init:p})}(ql)),ql.exports}function Bl(){if(Pl)return Tl;Pl=1;const e=Es();function n(e){return e.originalUrl||e.url}function t(e,n){for(let t=0;t<n.length;t++)e=e.replace(n[t].token,n[t].replacement);return e}return Tl=function(a,i){i="string"==typeof i||"function"==typeof i?{format:i}:i||{};const o=a;let r=e.getLevel(i.level,e.INFO);const s=i.format||':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';return(a,c,p)=>{if(void 0!==a._logging)return p();if("function"!=typeof i.nolog){const e=function(e){let n=null;if(e instanceof RegExp&&(n=e),"string"==typeof e&&(n=new RegExp(e)),Array.isArray(e)){const t=e.map((e=>e.source?e.source:e));n=new RegExp(t.join("|"))}return n}(i.nolog);if(e&&e.test(a.originalUrl))return p()}if(o.isLevelEnabled(r)||"auto"===i.level){const p=new Date,{writeHead:l}=c;a._logging=!0,c.writeHead=(e,n)=>{c.writeHead=l,c.writeHead(e,n),c.__statusCode=e,c.__headers=n||{}};let u=!1;const d=()=>{if(u)return;if(u=!0,"function"==typeof i.nolog&&!0===i.nolog(a,c))return void(a._logging=!1);c.responseTime=new Date-p,c.statusCode&&"auto"===i.level&&(r=e.INFO,c.statusCode>=300&&(r=e.WARN),c.statusCode>=400&&(r=e.ERROR)),r=function(n,t,a){let i=t;if(a){const t=a.find((e=>{let t=!1;return t=e.from&&e.to?n>=e.from&&n<=e.to:-1!==e.codes.indexOf(n),t}));t&&(i=e.getLevel(t.level,i))}return i}(c.statusCode,r,i.statusRules);const l=function(e,t,a){const i=[];return i.push({token:":url",replacement:n(e)}),i.push({token:":protocol",replacement:e.protocol}),i.push({token:":hostname",replacement:e.hostname}),i.push({token:":method",replacement:e.method}),i.push({token:":status",replacement:t.__statusCode||t.statusCode}),i.push({token:":response-time",replacement:t.responseTime}),i.push({token:":date",replacement:(new Date).toUTCString()}),i.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),i.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),i.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),i.push({token:":user-agent",replacement:e.headers["user-agent"]}),i.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),i.push({token:/:req\[([^\]]+)]/g,replacement:(n,t)=>e.headers[t.toLowerCase()]}),i.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const n=e.concat();for(let e=0;e<n.length;++e)for(let t=e+1;t<n.length;++t)n[e].token==n[t].token&&n.splice(t--,1);return n})(a.concat(i))}(a,c,i.tokens||[]);if(i.context&&o.addContext("res",c),"function"==typeof s){const e=s(a,c,(e=>t(e,l)));e&&o.log(r,e)}else o.log(r,t(s,l));i.context&&o.removeContext("res")};c.on("end",d),c.on("finish",d),c.on("error",d),c.on("close",d)}return p()}}}function Rl(){if(Il)return Nl;Il=1;const e=fs()("log4js:recording"),n=[];function t(){return n.slice()}function a(){n.length=0}return Nl={configure:function(){return function(t){e(`received logEvent, number of events now ${n.length+1}`),e("log event was ",t),n.push(t)}},replay:t,playback:t,reset:a,erase:a}}var zl=function(){if(Ml)return Ll;Ml=1;const e=fs()("log4js:main"),t=n,a=ms()({proto:!0}),i=hs(),o=ks(),r=Es(),s=Cl(),c=Dl(),p=function(){if(Fl)return Al;Fl=1;const e=fs()("log4js:logger"),n=Ps(),t=Es(),a=Ns(),i=Dl(),o=hs(),r=/^(?:\s*)at (?:(.+) \()?(?:([^(]+?):(\d+):(\d+))\)?$/;function s(e,n=4){try{const t=e.stack.split("\n").slice(n);if(!t.length)return null;const a=r.exec(t[0]);if(a&&5===a.length){let e="",n="",i="";return a[1]&&""!==a[1]&&([n,i]=a[1].replace(/[[\]]/g,"").split(" as "),i=i||"",n.includes(".")&&([e,n]=n.split("."))),{fileName:a[2],lineNumber:parseInt(a[3],10),columnNumber:parseInt(a[4],10),callStack:t.join("\n"),className:e,functionName:n,functionAlias:i,callerName:a[1]||""}}console.error("log4js.logger - defaultParseCallStack error")}catch(e){console.error("log4js.logger - defaultParseCallStack error",e)}return null}class c{constructor(n){if(!n)throw new Error("No category provided.");this.category=n,this.context={},this.callStackSkipIndex=0,this.parseCallStack=s,e(`Logger created (${this.category}, ${this.level})`)}get level(){return t.getLevel(i.getLevelForCategory(this.category),t.OFF)}set level(e){i.setLevelForCategory(this.category,t.getLevel(e,this.level))}get useCallStack(){return i.getEnableCallStackForCategory(this.category)}set useCallStack(e){i.setEnableCallStackForCategory(this.category,!0===e)}get callStackLinesToSkip(){return this.callStackSkipIndex}set callStackLinesToSkip(e){if("number"!=typeof e)throw new TypeError("Must be a number");if(e<0)throw new RangeError("Must be >= 0");this.callStackSkipIndex=e}log(e,...n){const a=t.getLevel(e);a?this.isLevelEnabled(a)&&this._log(a,n):o.validIdentifier(e)&&n.length>0?(this.log(t.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",e),this.log(t.INFO,`[${e}]`,...n)):this.log(t.INFO,e,...n)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(t,i){e(`sending log data (${t}) to appenders`);const o=i.find((e=>e instanceof Error));let r;if(this.useCallStack){try{o&&(r=this.parseCallStack(o,this.callStackSkipIndex+1))}catch(e){}r=r||this.parseCallStack(new Error,this.callStackSkipIndex+3+1)}const s=new n(this.category,t,i,this.context,r,o);a.send(s)}addContext(e,n){this.context[e]=n}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){if("function"==typeof e)this.parseCallStack=e;else{if(void 0!==e)throw new TypeError("Invalid type passed to setParseCallStackFunction");this.parseCallStack=s}}}function p(e){const n=t.getLevel(e),a=n.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),i=a[0].toUpperCase()+a.slice(1);c.prototype[`is${i}Enabled`]=function(){return this.isLevelEnabled(n)},c.prototype[a]=function(...e){this.log(n,...e)}}return t.levels.forEach(p),o.addListener((()=>{t.levels.forEach(p)})),Al=c}(),l=Ns(),u=Bl(),d=Rl();let f=!1;function m(n){if(!f)return;e("Received log event ",n);c.appendersForCategory(n.categoryName).forEach((e=>{e(n)}))}function h(n){f&&v();let o=n;return"string"==typeof o&&(o=function(n){e(`Loading configuration from ${n}`);try{return JSON.parse(t.readFileSync(n,"utf8"))}catch(e){throw new Error(`Problem reading config from file "${n}". Error was ${e.message}`,e)}}(n)),e(`Configuration is ${o}`),i.configure(a(o)),l.onMessage(m),f=!0,x}function v(n=()=>{}){if("function"!=typeof n)throw new TypeError("Invalid callback passed to shutdown");e("Shutdown called. Disabling all log writing."),f=!1;const t=Array.from(s.values());s.init(),c.init();const a=t.reduce(((e,n)=>n.shutdown?e+1:e),0);0===a&&(e("No appenders with shutdown functions found."),n());let i,o=0;function r(t){i=i||t,o+=1,e(`Appender shutdowns complete: ${o} / ${a}`),o>=a&&(e("All shutdown functions completed."),n(i))}e(`Found ${a} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(r)))}const x={getLogger:function(e){return f||h(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new p(e||"default")},configure:h,isConfigured:function(){return f},shutdown:v,connectLogger:u,levels:r,addLayout:o.addLayout,recording:function(){return d}};return Ll=x}(),$l=D(zl);var Ul=function(e){var n=Object.prototype.hasOwnProperty;function t(e,a){return Array.isArray(e)?function(e,n){for(var a,i="",o="",s=Array.isArray(n),c=0;c<e.length;c++)(a=t(e[c]))&&(s&&n[c]&&(a=r(a)),i=i+o+a,o=" ");return i}(e,a):e&&"object"==typeof e?function(e){var t="",a="";for(var i in e)i&&e[i]&&n.call(e,i)&&(t=t+a+i,a=" ");return t}(e):e||""}function a(e){if(!e)return"";if("object"==typeof e){var t="";for(var a in e)n.call(e,a)&&(t=t+a+":"+e[a]+";");return t}return e+""}function i(e,n,t,a){return!1!==n&&null!=n&&(n||"class"!==e&&"style"!==e)?!0===n?" "+(a?e:e+'="'+e+'"'):("function"==typeof n.toJSON&&(n=n.toJSON()),"string"==typeof n||(n=JSON.stringify(n),t||-1===n.indexOf('"'))?(t&&(n=r(n))," "+e+'="'+n+'"'):" "+e+"='"+n.replace(/'/g,"&#39;")+"'"):""}e.merge=function e(n,t){if(1===arguments.length){for(var i=n[0],o=1;o<n.length;o++)i=e(i,n[o]);return i}for(var r in t)if("class"===r){var s=n[r]||[];n[r]=(Array.isArray(s)?s:[s]).concat(t[r]||[])}else if("style"===r){s=(s=a(n[r]))&&";"!==s[s.length-1]?s+";":s;var c=a(t[r]);c=c&&";"!==c[c.length-1]?c+";":c,n[r]=s+c}else n[r]=t[r];return n},e.classes=t,e.style=a,e.attr=i,e.attrs=function(e,o){var r="";for(var s in e)if(n.call(e,s)){var c=e[s];if("class"===s){r=i(s,c=t(c),!1,o)+r;continue}"style"===s&&(c=a(c)),r+=i(s,c,!1,o)}return r};var o=/["&<>]/;function r(e){var n=""+e,t=o.exec(n);if(!t)return e;var a,i,r,s="";for(a=t.index,i=0;a<n.length;a++){switch(n.charCodeAt(a)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}i!==a&&(s+=n.substring(i,a)),i=a+1,s+=r}return i!==a?s+n.substring(i,a):s}return e.escape=r,e.rethrow=function e(n,t,a,i){if(!(n instanceof Error))throw n;if(!("undefined"==typeof window&&t||i))throw n.message+=" on line "+a,n;try{i=i||require("fs").readFileSync(t,"utf8")}catch(t){e(n,null,a)}var o=3,r=i.split("\n"),s=Math.max(a-o,0),c=Math.min(r.length,a+o);o=r.slice(s,c).map((function(e,n){var t=n+s+1;return(t==a?" > ":" ")+t+"| "+e})).join("\n");throw n.path=t,n.message=(t||"Pug")+":"+a+"\n"+o+"\n\n"+n.message,n},e}({});function Wl(e){var n,t,a="";try{var i={},o=e||{};(function(e,t){a+="<!DOCTYPE html>",a+="\n<html>",a+="\n <head>",a+="\n <title>",a+="API Documentation</title>",a+="\n <style>\n ",a+="body { font-family: Arial, sans-serif; margin: 20px; }",a+="\n ",a+="",a+="\n ",a+="h1 { color: #333; text-align: center; }",a+="\n ",a+="h2 { color: #333333 }",a+="\n ",a+="h3 { cursor: pointer; transition: color 0.3s; }",a+="\n ",a+="h3 { color: #007BFF; }",a+="\n ",a+="h3:hover { color: #0056b3; }",a+="\n ",a+="",a+="\n ",a+=".api-section { ",a+="\n ",a+=" margin: 20px 0; ",a+="\n ",a+=" border: 1px solid #e0e0e0; ",a+="\n ",a+=" border-radius: 8px; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" background-color: #f9f9f9; ",a+="\n ",a+=" box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1); ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".api-method { font-weight: bold; color: #333; }",a+="\n ",a+=".api-path { font-style: italic; color: #555; }",a+="\n ",a+="",a+="\n ",a+="pre { ",a+="\n ",a+=" background: #f4f4f4; ",a+="\n ",a+=" padding: 10px; ",a+="\n ",a+=" border-radius: 5px; ",a+="\n ",a+=" overflow-x: auto; ",a+="\n ",a+="}",a+="\n ",a+="",a+="\n ",a+=".collapse { display: none; }",a+="\n ",a+="\n </style>\n </head>",a+="\n <body>",a+="\n <h1>",a+="API Documentation</h1>",a+="\n \x3c!-- 添加 JavaScript 用于折叠 Sections--\x3e",a+="\n <script>\n ",a+="document.addEventListener('DOMContentLoaded', function() {",a+="\n ",a+=" const headings = document.querySelectorAll('.toggle');",a+="\n ",a+=" headings.forEach(heading => {",a+="\n ",a+=" heading.addEventListener('click', function() {",a+="\n ",a+=" // 找到 h3 后面的 collapse 元素",a+="\n ",a+=" let content = heading.nextElementSibling;",a+="\n ",a+=" if(!(content && content.classList.contains('collapse'))) {",a+="\n ",a+=" content = content.nextElementSibling;",a+="\n ",a+=" }",a+="\n ",a+=" if (content && content.classList.contains('collapse')) {",a+="\n ",a+=' content.style.display = (content.style.display === "block") ? "none" : "block";',a+="\n ",a+=" }",a+="\n ",a+=" });",a+="\n ",a+=" });",a+="\n ",a+="});",a+="\n ",a+="\n <\/script>",function(){var i=t;if("number"==typeof i.length)for(var o=0,r=i.length;o<r;o++){var s=i[o];a=(a+="\n <h2>")+Ul.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}else{r=0;for(var o in i){r++;s=i[o];a=(a+="\n <h2>")+Ul.escape(null==(n=s[0])?"":n)+"</h2>",function(){var t=s[1];if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}else{o=0;for(var i in t){o++;r=t[i];a+='\n <div class="api-section">',a=(a+='\n <h3 class="toggle">')+Ul.escape(null==(n=r.name)?"":n)+"</h3>",r.desc&&(a=(a+="\n <p>")+Ul.escape(null==(n=r.desc)?"":n)+"</p>"),a+='\n <div class="collapse">',function(){var t=r.configs;if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++){var s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}else{o=0;for(var i in t){o++;s=t[i];a=(a+='\n <h4 class="api-method">')+Ul.escape(null==(n=s.method.toUpperCase()+" "+s.path)?"":n)+"</h4>",s.description&&(a=(a+="\n <h5>")+Ul.escape(null==(n=s.description)?"":n)+"</h5>"),a+="\n <pre>",a+="Request Header:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.header,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.body,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Request Query:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.request.query,null,2))?"":n)+"</pre>",a+="\n <pre>",a+="Response Body:</pre>",a=(a+="\n <pre>")+Ul.escape(null==(n=e.stringify(s.response.body,null,2))?"":n)+"</pre>"}}}.call(this),a+="\n </div>\n </div>"}}}.call(this)}}}.call(this),a+="\n </body>\n</html>"}).call(this,"JSON"in o?o.JSON:"undefined"!=typeof JSON?JSON:void 0,"apiData"in o?o.apiData:"undefined"!=typeof apiData?apiData:void 0)}catch(e){Ul.rethrow(e,t,undefined,i[void 0])}return a}const Gl={DOCUMENTATION_DIR:t.join(process.cwd(),"doc")},Hl=(e,n)=>{const t=F(e.wholePath),a=t.prototype,i=Object.getOwnPropertyNames(a).filter((e=>"function"==typeof a[e]&&"constructor"!==e)),o=e.path.substring(e.path.indexOf("doc")+3),r=i.map((e=>{if("function"==typeof a[e]){const n=a[e]();return n.path=o+n.path,n}return null})).filter((e=>!!e));let s="";if(r[0]?.path){const e=r[0].path.lastIndexOf("/");e>-1&&(s=r[0].path.substring(0,e))}return{configs:r,desc:t.desc,name:t.name,pathPrefix:n,apiPrePath:s}},Jl=async(e,n)=>{e.extra={get:e.query,post:e.request.body??{}},await n()};(()=>{const e=process.env.NODE_ENV||"production",a=_();let i=t.resolve(a,"env");switch(function(e){try{return n.statSync(e).isDirectory()}catch(e){return e.code,!1}}(i)||(i=t.resolve(a,"..","env")),console.log("load env path: ",i),f.config({path:t.resolve(i,".common.env")}),e){case"development":f.config({path:t.resolve(i,".development.env")});break;case"test":f.config({path:t.resolve(i,".test.env")});break;case"production":f.config({path:t.resolve(i,".production.env")})}})();exports.AuthRouter=function(e,n){return S(e,n,!0)},exports.BaseException=C,exports.INDEX_ROUTE=y,exports.Router=function(e,n){return S(e,n)},exports.contextStore=k,exports.errorRsp=O,exports.getCurrentContext=E,exports.getSrcModulePaths=A,exports.initializeKoaApp=async e=>{const{koaInstance:n,authCheckCallback:t,catchErrorCallback:a,registerHighPriorityMiddleware:o,registerHook:r,log4:s=!1,runtimeLog:c=!0}=e,p=n||new i;var l;return p.context.log4=(e=>{if(!1!==e)return"boolean"==typeof e&&!0===e?$l.configure({appenders:{console:{type:"console"},file:{type:"dateFile",filename:"logs/app.log",pattern:".yyyy-MM-dd",compress:!0,numBackups:7,alwaysIncludePattern:!0}},categories:{default:{appenders:["console","file"],level:"info"}}}):e($l)})(s),p.context.hook=r,p.context.runtimeLog=c,p.use((l=a,async(e,n)=>{try{await n()}catch(n){e.hook?.(e,"error"),l?l(n,e):O(500,{message:n.message})}})),p.use(I),o?.(p),p.use(L),e.corsMiddleware&&p.use(e.corsMiddleware),p.use(vi()),p.use(Jl),(e=>{const{controllerModule:n,validateModule:t}=A();console.log("load controller path: ",n),T(n,(n=>{if(!n.path.includes("controller"))return;const a=F(n.wholePath),i=a?.routesMap;i&&Qr(t,n,i,((t,a)=>!t||e({filePath:n,ctx:a})))}))})(t),p.context.validated={params:{},get:{},post:{}},"development"!==process.env.NODE_ENV&&"true"!==process.env.DOC||M.get("/doc",(async e=>{const n=await(async()=>{const e=[],n=new Map;return T(Gl.DOCUMENTATION_DIR,(n=>{const{pathPrefix:t}=P(n,"doc");e.push(Hl(n,t))})),e.forEach((e=>{n.has(e.pathPrefix)||n.set(e.pathPrefix,[]),n.get(e.pathPrefix)?.push(e)})),Wl({apiData:Array.from(n.entries())})})();e.body=n})),M.get("/",(async e=>{e.body={code:200,message:"hello koa-ts-cli https://www.npmjs.com/package/koa-ts-core"}})),p.use(M.routes()),await(async e=>{const n=process.env.APP_PORT;if(n){const t=e.listen(Number(n));return void t.on("listening",(()=>Zr(t)))}const t=await Kr.getPortPromise({port:8e3,stopPort:9999});e.listen=(...n)=>{const a=0===n.length?Vr.apply(e,[t]):Vr.apply(e,n);return a.on("listening",(()=>Zr(a))),a}})(p),[p,M]},exports.successRsp=e=>{const n=Array.isArray(e?.data);j({success:!0,message:e?.message,data:n?{list:e?.data}:e?.data})},exports.unSuccessRsp=e=>{j({success:!1,errorCode:e?.code,errorMessage:e?.message,data:e?.data})};